Revision: 22468
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=22468
Author:   dingto
Date:     2009-08-15 16:16:50 +0200 (Sat, 15 Aug 2009)

Log Message:
-----------
2.5 Physic Buttons:

Patch by nudelZ. Thanks.
* Some layout and code cleanup.
* Made Collision Panel use Modifier Layout with Add/remove Operator.

Modified Paths:
--------------
    branches/blender2.5/blender/release/ui/buttons_physics_cloth.py
    branches/blender2.5/blender/release/ui/buttons_physics_field.py
    branches/blender2.5/blender/release/ui/buttons_physics_fluid.py

Modified: branches/blender2.5/blender/release/ui/buttons_physics_cloth.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_physics_cloth.py     
2009-08-15 13:30:28 UTC (rev 22467)
+++ branches/blender2.5/blender/release/ui/buttons_physics_cloth.py     
2009-08-15 14:16:50 UTC (rev 22468)
@@ -16,6 +16,7 @@
 
        def draw(self, context):
                layout = self.layout
+               
                md = context.cloth
                ob = context.object
 
@@ -41,27 +42,29 @@
                        split = layout.split()
                        
                        col = split.column()
-                       col.itemR(cloth, "quality", slider=True)
+                       col.itemL(text="Quality:")
+                       col.itemR(cloth, "quality", text="Steps",slider=True)
                        col.itemL(text="Gravity:")
                        col.itemR(cloth, "gravity", text="")
 
                        col.itemR(cloth, "pin_cloth", text="Pin")
-                       colsub = col.column(align=True)
-                       colsub.active = cloth.pin_cloth
-                       colsub.itemR(cloth, "pin_stiffness", text="Stiffness")
-                       colsub.item_pointerR(cloth, "mass_vertex_group", ob, 
"vertex_groups", text="")
+                       sub = col.column(align=True)
+                       sub.active = cloth.pin_cloth
+                       sub.itemR(cloth, "pin_stiffness", text="Stiffness")
+                       sub.item_pointerR(cloth, "mass_vertex_group", ob, 
"vertex_groups", text="")
                        
                        col = split.column()
                        col.itemL(text="Presets...")
+                       col.itemL(text="TODO!")
                        col.itemL(text="Material:")
-                       colsub = col.column(align=True)
-                       colsub.itemR(cloth, "mass")
-                       colsub.itemR(cloth, "structural_stiffness", 
text="Structural")
-                       colsub.itemR(cloth, "bending_stiffness", text="Bending")
+                       sub = col.column(align=True)
+                       sub.itemR(cloth, "mass")
+                       sub.itemR(cloth, "structural_stiffness", 
text="Structural")
+                       sub.itemR(cloth, "bending_stiffness", text="Bending")
                        col.itemL(text="Damping:")
-                       colsub = col.column(align=True)
-                       colsub.itemR(cloth, "spring_damping", text="Spring")
-                       colsub.itemR(cloth, "air_damping", text="Air")
+                       sub = col.column(align=True)
+                       sub.itemR(cloth, "spring_damping", text="Spring")
+                       sub.itemR(cloth, "air_damping", text="Air")
                        
                        # Disabled for now
                        """
@@ -150,14 +153,14 @@
                
                layout.active = cloth.enable_collision
                
-               col = split.column(align=True)
+               col = split.column()
                col.itemR(cloth, "collision_quality", slider=True, 
text="Quality")
                col.itemR(cloth, "min_distance", slider=True, text="Distance")
                col.itemR(cloth, "friction")
                
-               col = split.column(align=True)
+               col = split.column()
                col.itemR(cloth, "enable_self_collision", text="Self Collision")
-               col = col.column(align=True)
+               col = col.column()
                col.active = cloth.enable_self_collision
                col.itemR(cloth, "self_collision_quality", slider=True, 
text="Quality")
                col.itemR(cloth, "self_min_distance", slider=True, 
text="Distance")
@@ -186,15 +189,15 @@
                
                col = split.column()
                col.itemL(text="Structural Stiffness:")
-               colsub = col.column(align=True)
-               colsub.itemR(cloth, "structural_stiffness_max", text="Max")
-               colsub.item_pointerR(cloth, 
"structural_stiffness_vertex_group", ob, "vertex_groups", text="")
+               sub = col.column(align=True)
+               sub.itemR(cloth, "structural_stiffness_max", text="Max")
+               sub.item_pointerR(cloth, "structural_stiffness_vertex_group", 
ob, "vertex_groups", text="")
                
                col = split.column()
                col.itemL(text="Bending Stiffness:")
-               colsub = col.column(align=True)
-               colsub.itemR(cloth, "bending_stiffness_max", text="Max")
-               colsub.item_pointerR(cloth, "bending_vertex_group", ob, 
"vertex_groups", text="")
+               sub = col.column(align=True)
+               sub.itemR(cloth, "bending_stiffness_max", text="Max")
+               sub.item_pointerR(cloth, "bending_vertex_group", ob, 
"vertex_groups", text="")
                
 bpy.types.register(PHYSICS_PT_cloth)
 bpy.types.register(PHYSICS_PT_cloth_cache)

Modified: branches/blender2.5/blender/release/ui/buttons_physics_field.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_physics_field.py     
2009-08-15 13:30:28 UTC (rev 22467)
+++ branches/blender2.5/blender/release/ui/buttons_physics_field.py     
2009-08-15 14:16:50 UTC (rev 22468)
@@ -165,46 +165,66 @@
                ob = context.object
                rd = context.scene.render_data
                return (ob and ob.type == 'MESH') and (not rd.use_game_engine)
-
-       def draw_header(self, context):
-               settings = context.object.collision
-               self.layout.itemR(settings, "enabled", text="")
-
+       
        def draw(self, context):
                layout = self.layout
                
                md = context.collision
-               settings = context.object.collision
 
-               layout.active = settings.enabled
-               
                split = layout.split()
+               split.operator_context = 'EXEC_DEFAULT'
+
+               if md:
+                       # remove modifier + settings
+                       split.set_context_pointer("modifier", md)
+                       split.itemO("object.modifier_remove", text="Remove")
+                       col = split.column()
+                       
+                       #row = split.row(align=True)
+                       #row.itemR(md, "render", text="")
+                       #row.itemR(md, "realtime", text="")
+                       
+                       coll = md.settings
+                       
+               else:
+                       # add modifier
+                       split.item_enumO("object.modifier_add", "type", 
'COLLISION', text="Add")
+                       split.itemL()
+                       
+                       coll = None
                
-               col = split.column()
-               col.itemL(text="Particle:")
-               col.itemR(settings, "permeability", slider=True)
-               col.itemL(text="Particle Damping:")
-               sub = col.column(align=True)
-               sub.itemR(settings, "damping_factor", text="Factor", 
slider=True)
-               sub.itemR(settings, "random_damping", text="Random", 
slider=True)
+               if coll:
+                       settings = context.object.collision
+
+                       layout.active = settings.enabled
                
-               col.itemL(text="Soft Body and Cloth:")
-               sub = col.column(align=True)
-               sub.itemR(settings, "outer_thickness", text="Outer", 
slider=True)
-               sub.itemR(settings, "inner_thickness", text="Inner", 
slider=True)
+                       split = layout.split()
                
-               layout.itemL(text="Force Fields:")
-               layout.itemR(md, "absorption", text="Absorption")
+                       col = split.column()
+                       col.itemL(text="Particle:")
+                       col.itemR(settings, "permeability", slider=True)
+                       col.itemL(text="Particle Damping:")
+                       sub = col.column(align=True)
+                       sub.itemR(settings, "damping_factor", text="Factor", 
slider=True)
+                       sub.itemR(settings, "random_damping", text="Random", 
slider=True)
                
-               col = split.column()
-               col.itemL(text="")
-               col.itemR(settings, "kill_particles")
-               col.itemL(text="Particle Friction:")
-               sub = col.column(align=True)
-               sub.itemR(settings, "friction_factor", text="Factor", 
slider=True)
-               sub.itemR(settings, "random_friction", text="Random", 
slider=True)
-               col.itemL(text="Soft Body Damping:")
-               col.itemR(settings, "damping", text="Factor", slider=True)
+                       col.itemL(text="Soft Body and Cloth:")
+                       sub = col.column(align=True)
+                       sub.itemR(settings, "outer_thickness", text="Outer", 
slider=True)
+                       sub.itemR(settings, "inner_thickness", text="Inner", 
slider=True)
                
+                       layout.itemL(text="Force Fields:")
+                       layout.itemR(md, "absorption", text="Absorption")
+               
+                       col = split.column()
+                       col.itemL(text="")
+                       col.itemR(settings, "kill_particles")
+                       col.itemL(text="Particle Friction:")
+                       sub = col.column(align=True)
+                       sub.itemR(settings, "friction_factor", text="Factor", 
slider=True)
+                       sub.itemR(settings, "random_friction", text="Random", 
slider=True)
+                       col.itemL(text="Soft Body Damping:")
+                       col.itemR(settings, "damping", text="Factor", 
slider=True)
+               
 bpy.types.register(PHYSICS_PT_field)
 bpy.types.register(PHYSICS_PT_collision)

Modified: branches/blender2.5/blender/release/ui/buttons_physics_fluid.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_physics_fluid.py     
2009-08-15 13:30:28 UTC (rev 22467)
+++ branches/blender2.5/blender/release/ui/buttons_physics_fluid.py     
2009-08-15 14:16:50 UTC (rev 22468)
@@ -51,10 +51,9 @@
                                
                                col = split.column()
                                col.itemL(text="Resolution:")
-                               sub = col.column()
-                               sub.itemR(fluid, "resolution", text="Final")
-                               sub.itemL(text="Render Display:")
-                               sub.itemR(fluid, "render_display_mode", text="")
+                               col.itemR(fluid, "resolution", text="Final")
+                               col.itemL(text="Render Display:")
+                               col.itemR(fluid, "render_display_mode", text="")
                                col.itemL(text="Time:")
                                sub = col.column(align=True)
                                sub.itemR(fluid, "start_time", text="Start")
@@ -66,8 +65,8 @@
                                col.itemL(text="Viewport Display:")
                                col.itemR(fluid, "viewport_display_mode", 
text="")
                                col.itemL()
+                               col.itemR(fluid, "generate_speed_vectors")
                                col.itemR(fluid, "reverse_frames")
-                               col.itemR(fluid, "generate_speed_vectors")
                                
                                layout.itemR(fluid, "path", text="")
                                
@@ -93,12 +92,12 @@
                                
                                col = split.column()
                                col.itemL(text="Slip Type:")
-                               sub = col.column(align=True)
-                               sub.itemR(fluid, "slip_type", text="")
+                               col.itemR(fluid, "slip_type", text="")
                                if fluid.slip_type == 'PARTIALSLIP':
-                                       sub.itemR(fluid, "partial_slip_amount", 
slider=True, text="Amount")
+                                       col.itemR(fluid, "partial_slip_amount", 
slider=True, text="Amount")
                                        
-                               col.itemR(fluid, "impact_factor")
+                               col.itemL(text="Impact:")
+                               col.itemR(fluid, "impact_factor", text="Factor")
                                
                        elif fluid.type == 'INFLOW':
                                split = layout.split()
@@ -124,22 +123,23 @@
                                split.column()
                                
                        elif fluid.type == 'PARTICLE':
-                               split = layout.split()
+                               split = layout.split(percentage=0.5)
                                
                                col = split.column()
                                col.itemL(text="Influence:")
-                               sub = col.column(align=True)
-                               sub.itemR(fluid, "particle_influence", 
text="Size")
-                               sub.itemR(fluid, "alpha_influence", 
text="Alpha")
+                               col.itemR(fluid, "particle_influence", 
text="Size")
+                               col.itemR(fluid, "alpha_influence", 
text="Alpha")
                                
-                               layout.itemR(fluid, "path", text="")
-                               
                                col = split.column()
                                col.itemL(text="Type:")
                                col.itemR(fluid, "drops")
                                col.itemR(fluid, "floats")
+                               col = split.column()
+                               col.itemL()
                                col.itemR(fluid, "tracer")
                                
+                               layout.itemR(fluid, "path", text="")
+                               
                        elif fluid.type == 'CONTROL':
                                split = layout.split()
                                


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to