[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [34468] trunk/blender: Some ui reorganization of the physics tab:

Janne Karhu jhkarh at gmail.com
Sun Jan 23 15:04:33 CET 2011


Revision: 34468
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=34468
Author:   jhk
Date:     2011-01-23 14:04:31 +0000 (Sun, 23 Jan 2011)
Log Message:
-----------
Some ui reorganization of the physics tab:
* Before the different simulations all had a panel with an "add this" button making the whole tab look really messy. It also rarely makes sense to have more than one or two physics things enabled for a single object, so having all the panels in the tab just added a great deal of visual clutter.
* Now there is a single "enable physics for" panel at the top that allows for enable/disable of any simulation. All actual physics panels are hidden until a simulation is enabled.
* There was no "add" button for force fields before, but I added a toggle between "none" and "force" to unify the ui even further.

Modified Paths:
--------------
    trunk/blender/release/scripts/ui/properties_physics_cloth.py
    trunk/blender/release/scripts/ui/properties_physics_common.py
    trunk/blender/release/scripts/ui/properties_physics_field.py
    trunk/blender/release/scripts/ui/properties_physics_fluid.py
    trunk/blender/release/scripts/ui/properties_physics_smoke.py
    trunk/blender/release/scripts/ui/properties_physics_softbody.py
    trunk/blender/source/blender/editors/object/object_edit.c
    trunk/blender/source/blender/editors/object/object_intern.h
    trunk/blender/source/blender/editors/object/object_ops.c

Modified: trunk/blender/release/scripts/ui/properties_physics_cloth.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_physics_cloth.py	2011-01-23 13:52:24 UTC (rev 34467)
+++ trunk/blender/release/scripts/ui/properties_physics_cloth.py	2011-01-23 14:04:31 UTC (rev 34468)
@@ -47,7 +47,7 @@
     def poll(cls, context):
         ob = context.object
         rd = context.scene.render
-        return (ob and ob.type == 'MESH') and (not rd.use_game_engine)
+        return (ob and ob.type == 'MESH') and (not rd.use_game_engine) and (context.cloth)
 
 
 class PHYSICS_PT_cloth(PhysicButtonsPanel, bpy.types.Panel):
@@ -59,22 +59,7 @@
         md = context.cloth
         ob = context.object
 
-        split = layout.split()
-
         if md:
-            # remove modifier + settings
-            split.context_pointer_set("modifier", md)
-            split.operator("object.modifier_remove", text="Remove")
-
-            row = split.row(align=True)
-            row.prop(md, "show_render", text="")
-            row.prop(md, "show_viewport", text="")
-        else:
-            # add modifier
-            split.operator("object.modifier_add", text="Add").type = 'CLOTH'
-            split.label()
-
-        if md:
             cloth = md.settings
 
             split = layout.split()

Modified: trunk/blender/release/scripts/ui/properties_physics_common.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_physics_common.py	2011-01-23 13:52:24 UTC (rev 34467)
+++ trunk/blender/release/scripts/ui/properties_physics_common.py	2011-01-23 14:04:31 UTC (rev 34468)
@@ -20,9 +20,60 @@
 
 import bpy
 
+class PhysicButtonsPanel():
+    bl_space_type = 'PROPERTIES'
+    bl_region_type = 'WINDOW'
+    bl_context = "physics"
+
+    @classmethod
+    def poll(cls, context):
+        rd = context.scene.render
+        return (context.object) and (not rd.use_game_engine)
+        
+def physics_add(self, layout, md, name, type, typeicon, toggles):
+    sub = layout.row(align=True)
+    if md:
+        sub.context_pointer_set("modifier", md)
+        sub.operator("object.modifier_remove", text=name, icon='X')
+        if(toggles):
+            sub.prop(md, "show_render", text="")
+            sub.prop(md, "show_viewport", text="")
+    else:
+        sub.operator("object.modifier_add", text=name, icon=typeicon).type = type
+
+class PHYSICS_PT_add(PhysicButtonsPanel, bpy.types.Panel):
+    bl_label = ""
+    bl_options = {'HIDE_HEADER'}
+    
+    def draw(self, context):
+        ob = context.object
+        
+        layout = self.layout
+        layout.label("Enable physics for:")
+        split = layout.split()
+        col = split.column()
+        
+        if(context.object.field.type == 'NONE'):
+            col.operator("object.forcefield_toggle", text="Force Field", icon='FORCE_FORCE')
+        else:
+            col.operator("object.forcefield_toggle", text="Force Field", icon='X')
+            
+        if(ob.type == 'MESH'):
+            physics_add(self, col, context.collision, "Collision", 'COLLISION', 'MOD_PHYSICS', False);
+            physics_add(self, col, context.cloth, "Cloth", 'CLOTH', 'MOD_CLOTH', True);
+        
+        col = split.column()
+        
+        if(ob.type == 'MESH' or ob.type == 'LATTICE'or ob.type == 'CURVE'):
+            physics_add(self, col, context.soft_body, "Soft Body", 'SOFT_BODY', 'MOD_SOFT', True);
+            
+        if(ob.type == 'MESH'):
+            physics_add(self, col, context.fluid, "Fluid", 'FLUID_SIMULATION', 'MOD_FLUIDSIM', True);
+            physics_add(self, col, context.smoke, "Smoke", 'SMOKE', 'MOD_SMOKE', True);
+
+
 #cachetype can be 'PSYS' 'HAIR' 'SMOKE' etc
 
-
 def point_cache_ui(self, context, cache, enabled, cachetype):
     layout = self.layout
 

Modified: trunk/blender/release/scripts/ui/properties_physics_field.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_physics_field.py	2011-01-23 13:52:24 UTC (rev 34467)
+++ trunk/blender/release/scripts/ui/properties_physics_field.py	2011-01-23 14:04:31 UTC (rev 34468)
@@ -37,6 +37,12 @@
 
 class PHYSICS_PT_field(PhysicButtonsPanel, bpy.types.Panel):
     bl_label = "Force Fields"
+    
+    @classmethod
+    def poll(cls, context):
+        ob = context.object
+        rd = context.scene.render
+        return (not rd.use_game_engine) and (ob.field) and (ob.field.type != 'NONE')
 
     def draw(self, context):
         layout = self.layout
@@ -164,7 +170,7 @@
     def poll(cls, context):
         ob = context.object
         rd = context.scene.render
-        return (ob and ob.type == 'MESH') and (not rd.use_game_engine)
+        return (ob and ob.type == 'MESH') and (not rd.use_game_engine) and (context.collision)
 
     def draw(self, context):
         layout = self.layout
@@ -173,25 +179,8 @@
 
         split = layout.split()
 
-        if md:
-            # remove modifier + settings
-            split.context_pointer_set("modifier", md)
-            split.operator("object.modifier_remove", text="Remove")
-            col = split.column()
+        coll = md.settings
 
-            #row = split.row(align=True)
-            #row.prop(md, "show_render", text="")
-            #row.prop(md, "show_viewport", text="")
-
-            coll = md.settings
-
-        else:
-            # add modifier
-            split.operator("object.modifier_add", text="Add").type = 'COLLISION'
-            split.label()
-
-            coll = None
-
         if coll:
             settings = context.object.collision
 

Modified: trunk/blender/release/scripts/ui/properties_physics_fluid.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_physics_fluid.py	2011-01-23 13:52:24 UTC (rev 34467)
+++ trunk/blender/release/scripts/ui/properties_physics_fluid.py	2011-01-23 14:04:31 UTC (rev 34468)
@@ -29,7 +29,7 @@
     def poll(cls, context):
         ob = context.object
         rd = context.scene.render
-        return (ob and ob.type == 'MESH') and (not rd.use_game_engine)
+        return (ob and ob.type == 'MESH') and (not rd.use_game_engine) and (context.fluid)
 
 
 class PHYSICS_PT_fluid(PhysicButtonsPanel, bpy.types.Panel):
@@ -40,25 +40,9 @@
 
         md = context.fluid
 
-        split = layout.split()
-
         if md:
-            # remove modifier + settings
-            split.context_pointer_set("modifier", md)
-            split.operator("object.modifier_remove", text="Remove")
-
-            row = split.row(align=True)
-            row.prop(md, "show_render", text="")
-            row.prop(md, "show_viewport", text="")
-
             fluid = md.settings
-
-        else:
-            # add modifier
-            split.operator("object.modifier_add", text="Add").type = 'FLUID_SIMULATION'
-            split.label()
-
-        if md:
+            
             row = layout.row()
             if fluid is None:
                 row.label("built without fluids")

Modified: trunk/blender/release/scripts/ui/properties_physics_smoke.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_physics_smoke.py	2011-01-23 13:52:24 UTC (rev 34467)
+++ trunk/blender/release/scripts/ui/properties_physics_smoke.py	2011-01-23 14:04:31 UTC (rev 34468)
@@ -33,7 +33,7 @@
     def poll(cls, context):
         ob = context.object
         rd = context.scene.render
-        return (ob and ob.type == 'MESH') and (not rd.use_game_engine)
+        return (ob and ob.type == 'MESH') and (not rd.use_game_engine) and (context.smoke)
 
 
 class PHYSICS_PT_smoke(PhysicButtonsPanel, bpy.types.Panel):
@@ -45,23 +45,7 @@
         md = context.smoke
         ob = context.object
 
-        split = layout.split()
-
         if md:
-            # remove modifier + settings
-            split.context_pointer_set("modifier", md)
-            split.operator("object.modifier_remove", text="Remove")
-
-            row = split.row(align=True)
-            row.prop(md, "show_render", text="")
-            row.prop(md, "show_viewport", text="")
-
-        else:
-            # add modifier
-            split.operator("object.modifier_add", text="Add").type = 'SMOKE'
-            split.label()
-
-        if md:
             layout.prop(md, "smoke_type", expand=True)
 
             if md.smoke_type == 'DOMAIN':

Modified: trunk/blender/release/scripts/ui/properties_physics_softbody.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_physics_softbody.py	2011-01-23 13:52:24 UTC (rev 34467)
+++ trunk/blender/release/scripts/ui/properties_physics_softbody.py	2011-01-23 14:04:31 UTC (rev 34468)
@@ -39,7 +39,7 @@
         rd = context.scene.render
 #        return (ob and ob.type == 'MESH') and (not rd.use_game_engine)
 # i really hate touching things i do not understand completely .. but i think this should read (bjornmose)
-        return (ob and (ob.type == 'MESH' or ob.type == 'LATTICE'or ob.type == 'CURVE')) and (not rd.use_game_engine)
+        return (ob and (ob.type == 'MESH' or ob.type == 'LATTICE'or ob.type == 'CURVE')) and (not rd.use_game_engine) and (context.soft_body)
 
 
 class PHYSICS_PT_softbody(PhysicButtonsPanel, bpy.types.Panel):
@@ -51,22 +51,7 @@
         md = context.soft_body
         ob = context.object
 
-        split = layout.split()
-
         if md:
-            # remove modifier + settings
-            split.context_pointer_set("modifier", md)
-            split.operator("object.modifier_remove", text="Remove")
-
-            row = split.row(align=True)
-            row.prop(md, "show_render", text="")
-            row.prop(md, "show_viewport", text="")
-        else:
-            # add modifier
-            split.operator("object.modifier_add", text="Add").type = 'SOFT_BODY'
-            split.column()
-
-        if md:
             softbody = md.settings
 
             # General

Modified: trunk/blender/source/blender/editors/object/object_edit.c
===================================================================
--- trunk/blender/source/blender/editors/object/object_edit.c	2011-01-23 13:52:24 UTC (rev 34467)
+++ trunk/blender/source/blender/editors/object/object_edit.c	2011-01-23 14:04:31 UTC (rev 34468)
@@ -50,6 +50,7 @@
 #include "DNA_property_types.h"

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list