2.5 Physic Buttons:
authorThomas Dinges <blender@dingto.org>
Sat, 15 Aug 2009 14:16:50 +0000 (14:16 +0000)
committerThomas Dinges <blender@dingto.org>
Sat, 15 Aug 2009 14:16:50 +0000 (14:16 +0000)
Patch by nudelZ. Thanks.
* Some layout and code cleanup.
* Made Collision Panel use Modifier Layout with Add/remove Operator.

release/ui/buttons_physics_cloth.py
release/ui/buttons_physics_field.py
release/ui/buttons_physics_fluid.py

index 0edf099fa9019a3cc1124300dc0a101bff4ef97a..d18df9e5003553d578c2c1702d1c9670b60ae1c7 100644 (file)
@@ -16,6 +16,7 @@ class PHYSICS_PT_cloth(PhysicButtonsPanel):
 
        def draw(self, context):
                layout = self.layout
+               
                md = context.cloth
                ob = context.object
 
@@ -41,27 +42,29 @@ class PHYSICS_PT_cloth(PhysicButtonsPanel):
                        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 @@ class PHYSICS_PT_cloth_collision(PhysicButtonsPanel):
                
                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 @@ class PHYSICS_PT_cloth_stiffness(PhysicButtonsPanel):
                
                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)
index 3b054f7d55711aa24e252ebff149fde9d3bb8267..02802779c040be0b5937b9e22d677e0317992092 100644 (file)
@@ -165,46 +165,66 @@ class PHYSICS_PT_collision(PhysicButtonsPanel):
                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
+               
+               if coll:
+                       settings = context.object.collision
+
+                       layout.active = settings.enabled
+               
+                       split = layout.split()
                
-               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="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.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)
+                       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")
+                       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)
+                       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)
index be695d664489b22f351fef12c5a23eb104415869..0ad87120a7f359aa57578e019770392b8f1ce4b6 100644 (file)
@@ -51,10 +51,9 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel):
                                
                                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 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel):
                                col.itemL(text="Viewport Display:")
                                col.itemR(fluid, "viewport_display_mode", text="")
                                col.itemL()
-                               col.itemR(fluid, "reverse_frames")
                                col.itemR(fluid, "generate_speed_vectors")
+                               col.itemR(fluid, "reverse_frames")
                                
                                layout.itemR(fluid, "path", text="")
                                
@@ -93,12 +92,12 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel):
                                
                                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 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel):
                                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")
-                               
-                               layout.itemR(fluid, "path", text="")
+                               col.itemR(fluid, "particle_influence", text="Size")
+                               col.itemR(fluid, "alpha_influence", text="Alpha")
                                
                                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()