[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [24755] trunk/blender/release/scripts: * Minor cleanups.

Thomas Dinges dingto at gmx.de
Sun Nov 22 11:32:37 CET 2009


Revision: 24755
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=24755
Author:   dingto
Date:     2009-11-22 11:32:37 +0100 (Sun, 22 Nov 2009)

Log Message:
-----------
* Minor cleanups.
* Added Cloth Presets. Patch by nudelZ. Thanks! 

Modified Paths:
--------------
    trunk/blender/release/scripts/op/presets.py
    trunk/blender/release/scripts/ui/properties_physics_cloth.py

Added Paths:
-----------
    trunk/blender/release/scripts/presets/cloth/
    trunk/blender/release/scripts/presets/cloth/cotton.py
    trunk/blender/release/scripts/presets/cloth/denim.py
    trunk/blender/release/scripts/presets/cloth/leather.py
    trunk/blender/release/scripts/presets/cloth/rubber.py
    trunk/blender/release/scripts/presets/cloth/silk.py

Modified: trunk/blender/release/scripts/op/presets.py
===================================================================
--- trunk/blender/release/scripts/op/presets.py	2009-11-22 10:06:08 UTC (rev 24754)
+++ trunk/blender/release/scripts/op/presets.py	2009-11-22 10:32:37 UTC (rev 24755)
@@ -23,6 +23,7 @@
 
 
 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 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 @@
     ]
 
     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)
 
 

Added: trunk/blender/release/scripts/presets/cloth/cotton.py
===================================================================
--- trunk/blender/release/scripts/presets/cloth/cotton.py	                        (rev 0)
+++ trunk/blender/release/scripts/presets/cloth/cotton.py	2009-11-22 10:32:37 UTC (rev 24755)
@@ -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

Added: trunk/blender/release/scripts/presets/cloth/denim.py
===================================================================
--- trunk/blender/release/scripts/presets/cloth/denim.py	                        (rev 0)
+++ trunk/blender/release/scripts/presets/cloth/denim.py	2009-11-22 10:32:37 UTC (rev 24755)
@@ -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

Added: trunk/blender/release/scripts/presets/cloth/leather.py
===================================================================
--- trunk/blender/release/scripts/presets/cloth/leather.py	                        (rev 0)
+++ trunk/blender/release/scripts/presets/cloth/leather.py	2009-11-22 10:32:37 UTC (rev 24755)
@@ -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

Added: trunk/blender/release/scripts/presets/cloth/rubber.py
===================================================================
--- trunk/blender/release/scripts/presets/cloth/rubber.py	                        (rev 0)
+++ trunk/blender/release/scripts/presets/cloth/rubber.py	2009-11-22 10:32:37 UTC (rev 24755)
@@ -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

Added: trunk/blender/release/scripts/presets/cloth/silk.py
===================================================================
--- trunk/blender/release/scripts/presets/cloth/silk.py	                        (rev 0)
+++ trunk/blender/release/scripts/presets/cloth/silk.py	2009-11-22 10:32:37 UTC (rev 24755)
@@ -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

Modified: trunk/blender/release/scripts/ui/properties_physics_cloth.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_physics_cloth.py	2009-11-22 10:06:08 UTC (rev 24754)
+++ trunk/blender/release/scripts/ui/properties_physics_cloth.py	2009-11-22 10:32:37 UTC (rev 24755)
@@ -28,8 +28,20 @@
 
 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):
     bl_space_type = 'PROPERTIES'
     bl_region_type = 'WINDOW'
@@ -78,7 +90,9 @@
             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 @@
     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)





More information about the Bf-blender-cvs mailing list