[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [44899] trunk/blender/release/scripts/ startup/bl_ui/space_view3d_toolbar.py: Use Brush. sculpt_capabilities in Python UI code for sculpt toolbar.

Nicholas Bishop nicholasbishop at gmail.com
Thu Mar 15 10:11:17 CET 2012


Revision: 44899
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=44899
Author:   nicholasbishop
Date:     2012-03-15 09:11:16 +0000 (Thu, 15 Mar 2012)
Log Message:
-----------
Use Brush.sculpt_capabilities in Python UI code for sculpt toolbar.

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	2012-03-15 09:10:54 UTC (rev 44898)
+++ trunk/blender/release/scripts/startup/bl_ui/space_view3d_toolbar.py	2012-03-15 09:11:16 UTC (rev 44899)
@@ -500,7 +500,7 @@
         # Sculpt Mode #
 
         elif context.sculpt_object and brush:
-            tool = brush.sculpt_tool
+            capabilities = brush.sculpt_capabilities
 
             col = layout.column()
 
@@ -519,12 +519,12 @@
 
             self.prop_unified_size(row, context, brush, "use_pressure_size")
 
-            if tool not in {'SNAKE_HOOK', 'GRAB', 'ROTATE'}:
+            # strength, use_strength_pressure, and use_strength_attenuation
+            if capabilities.has_strength:
                 col.separator()
-
                 row = col.row(align=True)
 
-                if brush.use_space and tool != 'SMOOTH':
+                if capabilities.has_space_attenuation:
                     if brush.use_space_attenuation:
                         row.prop(brush, "use_space_attenuation", toggle=True, text="", icon='LOCKED')
                     else:
@@ -533,33 +533,29 @@
                 self.prop_unified_strength(row, context, brush, "strength", text="Strength")
                 self.prop_unified_strength(row, context, brush, "use_pressure_strength")
 
-            if tool == 'ROTATE':
-                row = col.row(align=True)
-                self.prop_unified_strength(row, context, brush, "strength", text="Strength")
-                self.prop_unified_strength(row, context, brush, "use_pressure_strength")
-
-            if tool != 'SMOOTH':
+            # auto_smooth_factor and use_inverse_smooth_pressure
+            if capabilities.has_auto_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 tool in {'GRAB', 'SNAKE_HOOK'}:
+            # normal_weight
+            if capabilities.has_normal_weight:
                 col.separator()
-
                 row = col.row(align=True)
                 row.prop(brush, "normal_weight", slider=True)
 
-            if tool in {'CREASE', 'BLOB'}:
+            # crease_pinch_factor
+            if capabilities.has_pinch_factor:
                 col.separator()
-
                 row = col.row(align=True)
                 row.prop(brush, "crease_pinch_factor", slider=True, text="Pinch")
 
-            if tool not in {'PINCH', 'INFLATE', 'SMOOTH'}:
+            # use_original_normal and sculpt_plane
+            if capabilities.has_sculpt_plane:
                 row = col.row(align=True)
-
                 col.separator()
 
                 if brush.use_original_normal:
@@ -569,8 +565,8 @@
 
                 row.prop(brush, "sculpt_plane", text="")
 
-            #if tool in {'CLAY', 'CLAY_TUBES', 'FLATTEN', 'FILL', 'SCRAPE'}:
-            if tool in {'CLAY', 'FLATTEN', 'FILL', 'SCRAPE'}:
+            # plane_offset, use_offset_pressure, use_plane_trim, plane_trim
+            if capabilities.has_plane_offset:
                 row = col.row(align=True)
                 row.prop(brush, "plane_offset", slider=True)
                 row.prop(brush, "use_offset_pressure", text="")
@@ -583,24 +579,28 @@
                 row.active = brush.use_plane_trim
                 row.prop(brush, "plane_trim", slider=True, text="Distance")
 
-            if tool == 'LAYER':
+            # height
+            if capabilities.has_height:
                 row = col.row()
                 row.prop(brush, "height", slider=True, text="Height")
 
+            # use_frontface
             col.separator()
-
             row = col.row()
             row.prop(brush, "use_frontface", text="Front Faces Only")
 
+            # direction
             col.separator()
             col.row().prop(brush, "direction", expand=True)
 
-            if tool in {'DRAW', 'CREASE', 'BLOB', 'INFLATE', 'LAYER', 'CLAY'}:
+            # use_accumulate
+            if capabilities.has_accumulate:
                 col.separator()
 
                 col.prop(brush, "use_accumulate")
 
-            if tool == 'LAYER':
+            # use_persistent, set_persistent_base
+            if capabilities.has_persistence:
                 col.separator()
 
                 ob = context.sculpt_object
@@ -714,7 +714,7 @@
             col = layout.column()
             col.active = tex_slot.map_mode in {'FIXED'}
             col.label(text="Angle:")
-            if not brush.use_anchor and brush.sculpt_tool not in {'GRAB', 'SNAKE_HOOK', 'THUMB', 'ROTATE'} and tex_slot.map_mode in {'FIXED'}:
+            if brush.sculpt_capabilities.has_random_texture_angle:
                 col.prop(brush, "texture_angle_source_random", text="")
             else:
                 col.prop(brush, "texture_angle_source_no_random", text="")
@@ -733,10 +733,6 @@
             col.active = tex_slot.map_mode in {'FIXED', 'TILED'}
             col.prop(tex_slot, "angle", text="")
 
-            #col = layout.column()
-            #col.prop(brush, "use_random_rotation")
-            #col.active = (not brush.use_rake) and (not brush.use_anchor) and (brush.sculpt_tool not in {'GRAB', 'SNAKE_HOOK', 'THUMB', 'ROTATE'}) and tex_slot.map_mode in {'FIXED'}
-
             split = layout.split()
             split.prop(tex_slot, "offset")
             split.prop(tex_slot, "scale")
@@ -832,7 +828,7 @@
                 row.active = brush.use_space
                 row.prop(brush, "spacing", text="Spacing")
 
-            if (brush.sculpt_tool not in {'GRAB', 'THUMB', 'SNAKE_HOOK', 'ROTATE'}) and (not brush.use_anchor) and (not brush.use_restore_mesh):
+            if brush.sculpt_capabilities.has_smooth_stroke:
                 col = layout.column()
                 col.separator()
 
@@ -843,6 +839,7 @@
                 sub.prop(brush, "smooth_stroke_radius", text="Radius", slider=True)
                 sub.prop(brush, "smooth_stroke_factor", text="Factor", slider=True)
 
+            if brush.sculpt_capabilities.has_jitter:
                 col.separator()
 
                 row = col.row(align=True)
@@ -869,22 +866,14 @@
             col.separator()
 
             col = layout.column()
-            col.active = (not brush.use_anchor) and (brush.sculpt_tool not in {'GRAB', 'THUMB', 'ROTATE', 'SNAKE_HOOK'})
+            col.active = brush.sculpt_capabilities.has_spacing
             col.prop(brush, "use_space")
 
             row = col.row()
             row.active = brush.use_space
             row.prop(brush, "spacing", text="Spacing")
 
-            #col.prop(brush, "use_space_attenuation", text="Adaptive Strength")
-            #col.prop(brush, "use_adaptive_space", text="Adaptive Spacing")
 
-            #col.separator()
-
-            #if image_paint:
-            #    row.prop(brush, "use_pressure_spacing", toggle=True, text="")
-
-
 class VIEW3D_PT_tools_brush_curve(Panel, View3DPaintPanel):
     bl_label = "Curve"
     bl_options = {'DEFAULT_CLOSED'}
@@ -989,8 +978,7 @@
         col = layout.column()
 
         if context.sculpt_object and context.tool_settings.sculpt:
-            #if brush.sculpt_tool in {'DRAW', 'INFLATE', 'CLAY', 'PINCH', 'CREASE', 'BLOB', 'FLATTEN', 'FILL', 'SCRAPE', 'CLAY_TUBES'}:
-            if brush.sculpt_tool in {'DRAW', 'INFLATE', 'CLAY', 'PINCH', 'CREASE', 'BLOB', 'FLATTEN', 'FILL', 'SCRAPE'}:
+            if brush.sculpt_capabilities.has_secondary_color:
                 col.prop(brush, "cursor_color_add", text="Add Color")
                 col.prop(brush, "cursor_color_subtract", text="Subtract Color")
             else:




More information about the Bf-blender-cvs mailing list