[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [40946] trunk/blender/release/scripts/ startup/bl_ui/space_view3d_toolbar.py: python UI was doing a lot of attribute lookups on tool & sculpt tool ( not especially efficient & annoying when adding breakpoints into why its not working right ).

Campbell Barton ideasman42 at gmail.com
Wed Oct 12 02:47:50 CEST 2011


Revision: 40946
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=40946
Author:   campbellbarton
Date:     2011-10-12 00:47:50 +0000 (Wed, 12 Oct 2011)
Log Message:
-----------
python UI was doing a lot of attribute lookups on tool & sculpt tool (not especially efficient & annoying when adding breakpoints into why its not working right).

Modified Paths:
--------------
    trunk/blender/release/scripts/startup/bl_ui/space_view3d_toolbar.py

Modified: trunk/blender/release/scripts/startup/bl_ui/space_view3d_toolbar.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/space_view3d_toolbar.py	2011-10-12 00:21:08 UTC (rev 40945)
+++ trunk/blender/release/scripts/startup/bl_ui/space_view3d_toolbar.py	2011-10-12 00:47:50 UTC (rev 40946)
@@ -484,16 +484,18 @@
 
         # XXX This needs a check if psys is editable.
         if context.particle_edit_object:
+            tool = settings.tool
+
             # XXX Select Particle System
             layout.column().prop(settings, "tool", expand=True)
 
-            if settings.tool != 'NONE':
+            if tool != 'NONE':
                 col = layout.column()
                 col.prop(brush, "size", slider=True)
-                if settings.tool != 'ADD':
+                if tool != 'ADD':
                     col.prop(brush, "strength", slider=True)
 
-            if settings.tool == 'ADD':
+            if tool == 'ADD':
                 col.prop(brush, "count")
                 col = layout.column()
                 col.prop(settings, "use_default_interpolate")
@@ -501,15 +503,16 @@
                 sub.active = settings.use_default_interpolate
                 sub.prop(brush, "steps", slider=True)
                 sub.prop(settings, "default_key_count", slider=True)
-            elif settings.tool == 'LENGTH':
+            elif tool == 'LENGTH':
                 layout.prop(brush, "length_mode", expand=True)
-            elif settings.tool == 'PUFF':
+            elif tool == 'PUFF':
                 layout.prop(brush, "puff_mode", expand=True)
                 layout.prop(brush, "use_puff_volume")
 
         # Sculpt Mode #
 
         elif context.sculpt_object and brush:
+            tool = brush.sculpt_tool
 
             col = layout.column()
 
@@ -526,12 +529,12 @@
 
             row.prop(brush, "use_pressure_size", toggle=True, text="")
 
-            if brush.sculpt_tool not in {'SNAKE_HOOK', 'GRAB', 'ROTATE'}:
+            if tool not in {'SNAKE_HOOK', 'GRAB', 'ROTATE'}:
                 col.separator()
 
                 row = col.row(align=True)
 
-                if brush.use_space and brush.sculpt_tool not in {'SMOOTH'}:
+                if brush.use_space and tool != 'SMOOTH':
                     if brush.use_space_atten:
                         row.prop(brush, "use_space_atten", toggle=True, text="", icon='LOCKED')
                     else:
@@ -540,26 +543,26 @@
                 row.prop(brush, "strength", text="Strength", slider=True)
                 row.prop(brush, "use_pressure_strength", text="")
 
-            if brush.sculpt_tool not in {'SMOOTH'}:
+            if tool != 'SMOOTH':
                 col.separator()
 
                 row = col.row(align=True)
                 row.prop(brush, "auto_smooth_factor", slider=True)
                 row.prop(brush, "use_inverse_smooth_pressure", toggle=True, text="")
 
-            if brush.sculpt_tool in {'GRAB', 'SNAKE_HOOK'}:
+            if tool in {'GRAB', 'SNAKE_HOOK'}:
                 col.separator()
 
                 row = col.row(align=True)
                 row.prop(brush, "normal_weight", slider=True)
 
-            if brush.sculpt_tool in {'CREASE', 'BLOB'}:
+            if tool in {'CREASE', 'BLOB'}:
                 col.separator()
 
                 row = col.row(align=True)
                 row.prop(brush, "crease_pinch_factor", slider=True, text="Pinch")
 
-            if brush.sculpt_tool not in {'PINCH', 'INFLATE', 'SMOOTH'}:
+            if tool not in {'PINCH', 'INFLATE', 'SMOOTH'}:
                 row = col.row(align=True)
 
                 col.separator()
@@ -571,8 +574,8 @@
 
                 row.prop(brush, "sculpt_plane", text="")
 
-            #if brush.sculpt_tool in {'CLAY', 'CLAY_TUBES', 'FLATTEN', 'FILL', 'SCRAPE'}:
-            if brush.sculpt_tool in {'CLAY', 'FLATTEN', 'FILL', 'SCRAPE'}:
+            #if tool in {'CLAY', 'CLAY_TUBES', 'FLATTEN', 'FILL', 'SCRAPE'}:
+            if tool in {'CLAY', 'FLATTEN', 'FILL', 'SCRAPE'}:
                 row = col.row(align=True)
                 row.prop(brush, "plane_offset", slider=True)
                 row.prop(brush, "use_offset_pressure", text="")
@@ -585,7 +588,7 @@
                 row.active = brush.use_plane_trim
                 row.prop(brush, "plane_trim", slider=True, text="Distance")
 
-            if brush.sculpt_tool == 'LAYER':
+            if tool == 'LAYER':
                 row = col.row()
                 row.prop(brush, "height", slider=True, text="Height")
 
@@ -597,12 +600,12 @@
             col.separator()
             col.row().prop(brush, "direction", expand=True)
 
-            if brush.sculpt_tool in {'DRAW', 'CREASE', 'BLOB', 'INFLATE', 'LAYER', 'CLAY'}:
+            if tool in {'DRAW', 'CREASE', 'BLOB', 'INFLATE', 'LAYER', 'CLAY'}:
                 col.separator()
 
                 col.prop(brush, "use_accumulate")
 
-            if brush.sculpt_tool == 'LAYER':
+            if tool == 'LAYER':
                 col.separator()
 
                 ob = context.sculpt_object




More information about the Bf-blender-cvs mailing list