diff options
author | Thomas Dinges <blender@dingto.org> | 2009-11-22 13:32:37 +0300 |
---|---|---|
committer | Thomas Dinges <blender@dingto.org> | 2009-11-22 13:32:37 +0300 |
commit | 02e99b9a43f460ef1eb1168c60a024f8f98e6fb8 (patch) | |
tree | 30f10f9be1e10121cca1cdb76b791ede34122207 /release/scripts | |
parent | 07db9033c9e3d79b51d86c790388c9cf341f896c (diff) |
* Minor cleanups.
* Added Cloth Presets. Patch by nudelZ. Thanks!
Diffstat (limited to 'release/scripts')
-rw-r--r-- | release/scripts/op/presets.py | 20 | ||||
-rw-r--r-- | release/scripts/presets/cloth/cotton.py | 6 | ||||
-rw-r--r-- | release/scripts/presets/cloth/denim.py | 6 | ||||
-rw-r--r-- | release/scripts/presets/cloth/leather.py | 6 | ||||
-rw-r--r-- | release/scripts/presets/cloth/rubber.py | 6 | ||||
-rw-r--r-- | release/scripts/presets/cloth/silk.py | 6 | ||||
-rw-r--r-- | release/scripts/ui/properties_physics_cloth.py | 18 |
7 files changed, 67 insertions, 1 deletions
diff --git a/release/scripts/op/presets.py b/release/scripts/op/presets.py index 7088fb1adc9..dbc7b71b916 100644 --- a/release/scripts/op/presets.py +++ b/release/scripts/op/presets.py @@ -23,6 +23,7 @@ from wm import AddPresetBase class AddPresetRender(AddPresetBase): + '''Add a Render Preset.''' bl_idname = "render.preset_add" bl_label = "Add Render Preset" name = AddPresetBase.name @@ -41,6 +42,7 @@ class AddPresetRender(AddPresetBase): class AddPresetSSS(AddPresetBase): + '''Add a Subsurface Scattering Preset.''' bl_idname = "material.sss_preset_add" bl_label = "Add SSS Preset" name = AddPresetBase.name @@ -62,8 +64,26 @@ class AddPresetSSS(AddPresetBase): ] preset_path = os.path.join("presets", "sss") + +class AddPresetCloth(AddPresetBase): + '''Add a Cloth Preset.''' + bl_idname = "cloth.preset_add" + bl_label = "Add Cloth Preset" + name = AddPresetBase.name + + preset_values = [ + "bpy.context.active_object.modifiers['Cloth'].settings.quality", + "bpy.context.active_object.modifiers['Cloth'].settings.mass", + "bpy.context.active_object.modifiers['Cloth'].settings.structural_stiffness", + "bpy.context.active_object.modifiers['Cloth'].settings.bending_stiffness", + "bpy.context.active_object.modifiers['Cloth'].settings.spring_damping", + "bpy.context.active_object.modifiers['Cloth'].settings.air_damping", + ] + + preset_path = os.path.join("presets", "cloth") bpy.ops.add(AddPresetRender) bpy.ops.add(AddPresetSSS) +bpy.ops.add(AddPresetCloth) diff --git a/release/scripts/presets/cloth/cotton.py b/release/scripts/presets/cloth/cotton.py new file mode 100644 index 00000000000..27717495e99 --- /dev/null +++ b/release/scripts/presets/cloth/cotton.py @@ -0,0 +1,6 @@ +bpy.context.active_object.modifiers['Cloth'].settings.quality = 5 +bpy.context.active_object.modifiers['Cloth'].settings.mass = 0.300 +bpy.context.active_object.modifiers['Cloth'].settings.structural_stiffness = 15.000 +bpy.context.active_object.modifiers['Cloth'].settings.bending_stiffness = 0.500 +bpy.context.active_object.modifiers['Cloth'].settings.spring_damping = 5.000 +bpy.context.active_object.modifiers['Cloth'].settings.air_damping = 1.000 diff --git a/release/scripts/presets/cloth/denim.py b/release/scripts/presets/cloth/denim.py new file mode 100644 index 00000000000..0d9be3cb583 --- /dev/null +++ b/release/scripts/presets/cloth/denim.py @@ -0,0 +1,6 @@ +bpy.context.active_object.modifiers['Cloth'].settings.quality = 12 +bpy.context.active_object.modifiers['Cloth'].settings.mass = 1 +bpy.context.active_object.modifiers['Cloth'].settings.structural_stiffness = 40 +bpy.context.active_object.modifiers['Cloth'].settings.bending_stiffness = 10 +bpy.context.active_object.modifiers['Cloth'].settings.spring_damping = 25 +bpy.context.active_object.modifiers['Cloth'].settings.air_damping = 1 diff --git a/release/scripts/presets/cloth/leather.py b/release/scripts/presets/cloth/leather.py new file mode 100644 index 00000000000..f64608b24c7 --- /dev/null +++ b/release/scripts/presets/cloth/leather.py @@ -0,0 +1,6 @@ +bpy.context.active_object.modifiers['Cloth'].settings.quality = 15 +bpy.context.active_object.modifiers['Cloth'].settings.mass = 0.4 +bpy.context.active_object.modifiers['Cloth'].settings.structural_stiffness = 80 +bpy.context.active_object.modifiers['Cloth'].settings.bending_stiffness = 150 +bpy.context.active_object.modifiers['Cloth'].settings.spring_damping = 25 +bpy.context.active_object.modifiers['Cloth'].settings.air_damping = 1 diff --git a/release/scripts/presets/cloth/rubber.py b/release/scripts/presets/cloth/rubber.py new file mode 100644 index 00000000000..101c11b141a --- /dev/null +++ b/release/scripts/presets/cloth/rubber.py @@ -0,0 +1,6 @@ +bpy.context.active_object.modifiers['Cloth'].settings.quality = 7 +bpy.context.active_object.modifiers['Cloth'].settings.mass = 3 +bpy.context.active_object.modifiers['Cloth'].settings.structural_stiffness = 15 +bpy.context.active_object.modifiers['Cloth'].settings.bending_stiffness = 25 +bpy.context.active_object.modifiers['Cloth'].settings.spring_damping = 25 +bpy.context.active_object.modifiers['Cloth'].settings.air_damping = 1 diff --git a/release/scripts/presets/cloth/silk.py b/release/scripts/presets/cloth/silk.py new file mode 100644 index 00000000000..21de166adf9 --- /dev/null +++ b/release/scripts/presets/cloth/silk.py @@ -0,0 +1,6 @@ +bpy.context.active_object.modifiers["Cloth"].settings.quality = 5 +bpy.context.active_object.modifiers["Cloth"].settings.mass = 0.150 +bpy.context.active_object.modifiers["Cloth"].settings.structural_stiffness = 5 +bpy.context.active_object.modifiers["Cloth"].settings.bending_stiffness = 0.05 +bpy.context.active_object.modifiers["Cloth"].settings.spring_damping = 0 +bpy.context.active_object.modifiers["Cloth"].settings.air_damping = 1 diff --git a/release/scripts/ui/properties_physics_cloth.py b/release/scripts/ui/properties_physics_cloth.py index 2dc818ab149..620225c6dee 100644 --- a/release/scripts/ui/properties_physics_cloth.py +++ b/release/scripts/ui/properties_physics_cloth.py @@ -28,6 +28,18 @@ from properties_physics_common import effector_weights_ui def cloth_panel_enabled(md): return md.point_cache.baked == False + + +class CLOTH_MT_presets(bpy.types.Menu): + ''' + Creates the menu items by scanning scripts/templates + ''' + bl_label = "Cloth Presets" + + def draw(self, context): + import os + template_dir = os.path.join(os.path.dirname(__file__), os.path.pardir, "presets", "cloth") + self.path_menu(template_dir, "script.python_file_run") class PhysicButtonsPanel(bpy.types.Panel): @@ -78,7 +90,9 @@ class PHYSICS_PT_cloth(PhysicButtonsPanel): col = split.column() col.itemL(text="Presets:") - col.itemL(text="TODO!") + sub = col.row(align=True).split(percentage=0.75) + sub.itemM("CLOTH_MT_presets", text="Presets") + sub.itemO("cloth.preset_add", text="Add") col.itemL(text="Quality:") col.itemR(cloth, "quality", text="Steps", slider=True) @@ -213,6 +227,8 @@ class PHYSICS_PT_cloth_field_weights(PhysicButtonsPanel): def draw(self, context): cloth = context.cloth.settings effector_weights_ui(self, context, cloth.effector_weights) + +bpy.types.register(CLOTH_MT_presets) bpy.types.register(PHYSICS_PT_cloth) bpy.types.register(PHYSICS_PT_cloth_cache) |