Changeset View
Changeset View
Standalone View
Standalone View
tests/python/physics_cloth.py
- This file was copied to tests/python/demo_file_generator.py, tests/python/physics_dynamic_paint.py, tests/python/physics_ocean.py, tests/python/physics_particle_instance.py, tests/python/physics_particle_system.py.
| Show All 18 Lines | |||||
| # <pep8 compliant> | # <pep8 compliant> | ||||
| import os | import os | ||||
| import sys | import sys | ||||
| import bpy | import bpy | ||||
| sys.path.append(os.path.dirname(os.path.realpath(__file__))) | sys.path.append(os.path.dirname(os.path.realpath(__file__))) | ||||
| from modules.mesh_test import ModifierTest, PhysicsSpec | from modules.mesh_test import ModifierTest, ModifierSpec | ||||
| def main(): | def main(): | ||||
| test = [ | test = [ | ||||
| ["testCloth", "expectedCloth", | |||||
| [PhysicsSpec('Cloth', 'CLOTH', {'quality': 5}, 35)]], | # Make sure no modifier is added on the test object. | ||||
| ["ClothSimple", "testCloth", "expectedCloth", | |||||
| [ModifierSpec('Cloth', 'CLOTH', {'settings': {'quality': 5}}, 35)]], | |||||
| ["ClothPressure", "testObjClothPressure", "expObjClothPressure", | |||||
| [ModifierSpec('Cloth2', 'CLOTH', {'settings': {'use_pressure': True, 'uniform_pressure_force': 1}}, 16)]], | |||||
| ["ClothSelfCollision", "testClothCollision", "expClothCollision", | |||||
| [ModifierSpec('Cloth', 'CLOTH', {'collision_settings': {'use_self_collision': True}}, 67)]], | |||||
| ["ClothSpring", "testTorusClothSpring", "expTorusClothSpring", | |||||
| [ModifierSpec('Cloth2', 'CLOTH', {'settings': {'use_internal_springs': True}}, 30)]], | |||||
| ] | ] | ||||
| cloth_test = ModifierTest(test, threshold=1e-3) | cloth_test = ModifierTest(test, threshold=1e-3) | ||||
| command = list(sys.argv) | command = list(sys.argv) | ||||
| for i, cmd in enumerate(command): | for i, cmd in enumerate(command): | ||||
| if cmd == "--run-all-tests": | if cmd == "--run-all-tests": | ||||
| cloth_test.apply_modifiers = True | cloth_test.apply_modifiers = True | ||||
| cloth_test.run_all_tests() | cloth_test.run_all_tests() | ||||
| break | break | ||||
| elif cmd == "--run-test": | elif cmd == "--run-test": | ||||
| cloth_test.apply_modifiers = False | cloth_test.apply_modifiers = False | ||||
| index = int(command[i + 1]) | name = str(command[i + 1]) | ||||
| cloth_test.run_test(index) | cloth_test.run_test(name) | ||||
| break | break | ||||
| if __name__ == "__main__": | if __name__ == "__main__": | ||||
| main() | main() | ||||