* Minor cleanups.

* Added Cloth Presets. Patch by nudelZ. Thanks!
This commit is contained in:
Thomas Dinges 2009-11-22 10:32:37 +00:00
parent 07db9033c9
commit 02e99b9a43
7 changed files with 67 additions and 1 deletions

View File

@ -23,6 +23,7 @@ from wm import AddPresetBase
class AddPresetRender(AddPresetBase): class AddPresetRender(AddPresetBase):
'''Add a Render Preset.'''
bl_idname = "render.preset_add" bl_idname = "render.preset_add"
bl_label = "Add Render Preset" bl_label = "Add Render Preset"
name = AddPresetBase.name name = AddPresetBase.name
@ -41,6 +42,7 @@ class AddPresetRender(AddPresetBase):
class AddPresetSSS(AddPresetBase): class AddPresetSSS(AddPresetBase):
'''Add a Subsurface Scattering Preset.'''
bl_idname = "material.sss_preset_add" bl_idname = "material.sss_preset_add"
bl_label = "Add SSS Preset" bl_label = "Add SSS Preset"
name = AddPresetBase.name name = AddPresetBase.name
@ -62,8 +64,26 @@ class AddPresetSSS(AddPresetBase):
] ]
preset_path = os.path.join("presets", "sss") 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(AddPresetRender)
bpy.ops.add(AddPresetSSS) bpy.ops.add(AddPresetSSS)
bpy.ops.add(AddPresetCloth)

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -28,6 +28,18 @@ from properties_physics_common import effector_weights_ui
def cloth_panel_enabled(md): def cloth_panel_enabled(md):
return md.point_cache.baked == False 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): class PhysicButtonsPanel(bpy.types.Panel):
@ -78,7 +90,9 @@ class PHYSICS_PT_cloth(PhysicButtonsPanel):
col = split.column() col = split.column()
col.itemL(text="Presets:") 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.itemL(text="Quality:")
col.itemR(cloth, "quality", text="Steps", slider=True) col.itemR(cloth, "quality", text="Steps", slider=True)
@ -213,6 +227,8 @@ class PHYSICS_PT_cloth_field_weights(PhysicButtonsPanel):
def draw(self, context): def draw(self, context):
cloth = context.cloth.settings cloth = context.cloth.settings
effector_weights_ui(self, context, cloth.effector_weights) 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)
bpy.types.register(PHYSICS_PT_cloth_cache) bpy.types.register(PHYSICS_PT_cloth_cache)