[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [30637] trunk/blender: == Sculpt/ Paint Fixes ==

Jason Wilkins Jason.A.Wilkins at gmail.com
Thu Jul 22 20:56:46 CEST 2010


Revision: 30637
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=30637
Author:   jwilkins
Date:     2010-07-22 20:56:46 +0200 (Thu, 22 Jul 2010)

Log Message:
-----------
== Sculpt/Paint Fixes ==
* Fix: unify strength and size did work consistently with other paint modes
* Fix: If [ and ] keys were used to resize a brush it was not possible to increase the size of the brush if it went under 10 pixels
* Fix: Made interpretation of brush size consistent across all modes, Texture/Image paint interpreted brush size as the diameter while all the other modes interpret it as radius
* Fix: The default spacing for vertex paint brushes was 3%, should be 10%
* Fix: due to fixes to unified strength, re-enabled 'Unify Size' by default
* Fix: Unified size and strength were stored in UserPrefs, moved this to ToolSettings
* Fix: The setting of pressure sensitivity was not unified when strength or size were unified.  Now the appropriate pressure sensitivity setting is also unified across all brushes when corresponding unification option is selected
* Fix: When using [ and ] to resize the brush it didn't immediately redraw
* Fix: fkey resizing/"re-strength-ing" was not working consistently accross all paint modes due to only sculpt mode having full support for unified size and strength, now it works properly.
* Fix: other paint modes did expose the ability to have a  custom brush colors, so I added the small bit of code to allow it.  Note: I made all of the other paint mode brushes white.  Note2: Actually, probably want to make the paint modes use the selected color for painting instead of a constant brush color.
* I had removed OPTYPE_REGISTER from some Sculpt/Paint operators but in this commit I add them back.  I'm not completely sure what this option does so I don't want to disturb it for now.

Modified Paths:
--------------
    trunk/blender/release/scripts/ui/space_view3d_toolbar.py
    trunk/blender/source/blender/blenkernel/BKE_brush.h
    trunk/blender/source/blender/blenkernel/intern/brush.c
    trunk/blender/source/blender/blenloader/intern/readfile.c
    trunk/blender/source/blender/editors/datafiles/startup.blend.c
    trunk/blender/source/blender/editors/interface/resources.c
    trunk/blender/source/blender/editors/sculpt_paint/paint_image.c
    trunk/blender/source/blender/editors/sculpt_paint/paint_ops.c
    trunk/blender/source/blender/editors/sculpt_paint/paint_stroke.c
    trunk/blender/source/blender/editors/sculpt_paint/paint_utils.c
    trunk/blender/source/blender/editors/sculpt_paint/paint_vertex.c
    trunk/blender/source/blender/editors/sculpt_paint/sculpt.c
    trunk/blender/source/blender/editors/space_image/image_draw.c
    trunk/blender/source/blender/makesdna/DNA_scene_types.h
    trunk/blender/source/blender/makesdna/DNA_userdef_types.h
    trunk/blender/source/blender/makesrna/intern/rna_brush.c
    trunk/blender/source/blender/makesrna/intern/rna_scene.c
    trunk/blender/source/blender/makesrna/intern/rna_userdef.c

Modified: trunk/blender/release/scripts/ui/space_view3d_toolbar.py
===================================================================
--- trunk/blender/release/scripts/ui/space_view3d_toolbar.py	2010-07-22 15:16:20 UTC (rev 30636)
+++ trunk/blender/release/scripts/ui/space_view3d_toolbar.py	2010-07-22 18:56:46 UTC (rev 30637)
@@ -555,7 +555,6 @@
         # Sculpt Mode #
 
         elif context.sculpt_object and brush:
-            edit = context.user_preferences.edit
 
             col = layout.column()
 
@@ -564,21 +563,12 @@
 
             row = col.row(align=True)
 
-            if edit.sculpt_paint_use_unified_size:
-                if edit.sculpt_paint_unified_lock_brush_size:
-                    row.prop(edit, "sculpt_paint_unified_lock_brush_size", toggle=True, text="", icon='LOCKED')
-                    row.prop(edit, "sculpt_paint_unified_unprojected_radius", text="Radius", slider=True)
-                else:
-                    row.prop(edit, "sculpt_paint_unified_lock_brush_size", toggle=True, text="", icon='UNLOCKED')
-                    row.prop(edit, "sculpt_paint_unified_size", text="Radius", slider=True)
-
+            if brush.use_locked_size:
+                row.prop(brush, "use_locked_size", toggle=True, text="", icon='LOCKED')
+                row.prop(brush, "unprojected_radius", text="Radius", slider=True)
             else:
-                if brush.lock_brush_size:
-                    row.prop(brush, "lock_brush_size", toggle=True, text="", icon='LOCKED')
-                    row.prop(brush, "unprojected_radius", text="Radius", slider=True)
-                else:
-                    row.prop(brush, "lock_brush_size", toggle=True, text="", icon='UNLOCKED')
-                    row.prop(brush, "size", text="Radius", slider=True)
+                row.prop(brush, "use_locked_size", toggle=True, text="", icon='UNLOCKED')
+                row.prop(brush, "size", text="Radius", slider=True)
 
             row.prop(brush, "use_size_pressure", toggle=True, text="")
 
@@ -594,11 +584,7 @@
                     else:
                         row.prop(brush, "use_space_atten", toggle=True, text="", icon='UNLOCKED')
 
-                if edit.sculpt_paint_use_unified_strength:
-                    row.prop(edit, "sculpt_paint_unified_strength", text="Unified Strength", slider=True)
-                else:
-                    row.prop(brush, "strength", text="Strength", slider=True)
-
+                row.prop(brush, "strength", text="Strength", slider=True)
                 row.prop(brush, "use_strength_pressure", text="")
 
 
@@ -710,11 +696,11 @@
             col.prop(brush, "color", text="")
 
             row = col.row(align=True)
-            row.prop(brush, "size", slider=True)
+            row.prop(brush, "size", text="Radius", slider=True)
             row.prop(brush, "use_size_pressure", toggle=True, text="")
 
             row = col.row(align=True)
-            row.prop(brush, "strength", slider=True)
+            row.prop(brush, "strength", text="Strength", slider=True)
             row.prop(brush, "use_strength_pressure", toggle=True, text="")
 
             row = col.row(align=True)
@@ -735,12 +721,13 @@
             layout.prop(context.tool_settings, "auto_normalize", text="Auto Normalize")
 
             col = layout.column()
+
             row = col.row(align=True)
-            row.prop(brush, "size", slider=True)
+            row.prop(brush, "size", text="Radius", slider=True)
             row.prop(brush, "use_size_pressure", toggle=True, text="")
 
             row = col.row(align=True)
-            row.prop(brush, "strength", slider=True)
+            row.prop(brush, "strength", text="Strength", slider=True)
             row.prop(brush, "use_strength_pressure", toggle=True, text="")
 
             row = col.row(align=True)
@@ -755,11 +742,11 @@
             col.prop(brush, "color", text="")
 
             row = col.row(align=True)
-            row.prop(brush, "size", slider=True)
+            row.prop(brush, "size", text="Radius", slider=True)
             row.prop(brush, "use_size_pressure", toggle=True, text="")
 
             row = col.row(align=True)
-            row.prop(brush, "strength", slider=True)
+            row.prop(brush, "strength", text="Strength", slider=True)
             row.prop(brush, "use_strength_pressure", toggle=True, text="")
 
             # XXX - TODO
@@ -1032,7 +1019,8 @@
 
         wide_ui = context.region.width > narrowui
 
-        sculpt = context.tool_settings.sculpt
+        tool_settings = context.tool_settings
+        sculpt = tool_settings.sculpt
         settings = self.paint_settings(context)
         brush = settings.brush
 
@@ -1040,10 +1028,9 @@
 
         col = split.column()
 
-        edit = context.user_preferences.edit
         col.label(text="Unified Settings:")
-        col.prop(edit, "sculpt_paint_use_unified_size", text="Size")
-        col.prop(edit, "sculpt_paint_use_unified_strength", text="Strength")
+        col.prop(tool_settings, "sculpt_paint_use_unified_size", text="Size")
+        col.prop(tool_settings, "sculpt_paint_use_unified_strength", text="Strength")
 
         if wide_ui:
             col = split.column()
@@ -1108,17 +1095,19 @@
         settings = self.paint_settings(context)
         brush = settings.brush
 
+        col = layout.column();
+
         if context.sculpt_object and context.tool_settings.sculpt:
-            col = layout.column();
-
-            #if brush.sculpt_tool in ('DRAW', 'INFLATE', 'CLAY', 'CLAY_TUBES', 'PINCH', 'CREASE', 'BLOB', 'FLATTEN', 'FILL', 'SCRAPE'):
+            #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'):
                 col.prop(brush, "add_col", text="Add Color")
                 col.prop(brush, "sub_col", text="Subtract Color")
             else:
                 col.prop(brush, "add_col", text="Color")
+        else:
+            col.prop(brush, "add_col", text="Color")
 
-            col.separator()
+        col.separator()
 
         col = layout.column()
         col.label(text="Icon:")
@@ -1154,7 +1143,8 @@
     def draw(self, context):
         layout = self.layout
 
-        wpaint = context.tool_settings.weight_paint
+        tool_settings = context.tool_settings
+        wpaint = tool_settings.weight_paint
 
         col = layout.column()
         col.prop(wpaint, "all_faces")
@@ -1167,6 +1157,10 @@
             col.prop(mesh, "use_mirror_x")
             col.prop(mesh, "use_mirror_topology")
 
+        col.label(text="Unified Settings:")
+        col.prop(tool_settings, "sculpt_paint_use_unified_size", text="Size")
+        col.prop(tool_settings, "sculpt_paint_use_unified_strength", text="Strength")
+
 # Commented out because the Apply button isn't an operator yet, making these settings useless
 #		col.label(text="Gamma:")
 #		col.prop(wpaint, "gamma", text="")
@@ -1186,7 +1180,8 @@
     def draw(self, context):
         layout = self.layout
 
-        vpaint = context.tool_settings.vertex_paint
+        tool_settings = context.tool_settings
+        vpaint = tool_settings.vertex_paint
 
         col = layout.column()
         #col.prop(vpaint, "mode", text="")
@@ -1194,6 +1189,10 @@
         col.prop(vpaint, "normals")
         col.prop(vpaint, "spray")
 
+        col.label(text="Unified Settings:")
+        col.prop(tool_settings, "sculpt_paint_use_unified_size", text="Size")
+        col.prop(tool_settings, "sculpt_paint_use_unified_strength", text="Strength")
+
 # Commented out because the Apply button isn't an operator yet, making these settings useless
 #		col.label(text="Gamma:")
 #		col.prop(vpaint, "gamma", text="")
@@ -1272,6 +1271,23 @@
         sub.operator("image.save_dirty", text="Save All Edited")
 
 
+class VIEW3D_PT_imagepaint_options(PaintPanel):
+    bl_label = "Options"
+    bl_default_closed = True
+
+    def poll(self, context):
+        return (context.texture_paint_object and context.tool_settings.image_paint)
+
+    def draw(self, context):
+        layout = self.layout
+
+        col = layout.column()
+
+        tool_settings = context.tool_settings
+        col.label(text="Unified Settings:")
+        col.prop(tool_settings, "sculpt_paint_use_unified_size", text="Size")
+        col.prop(tool_settings, "sculpt_paint_use_unified_strength", text="Strength")
+        
 class VIEW3D_MT_tools_projectpaint_clone(bpy.types.Menu):
     bl_label = "Clone Layer"
 
@@ -1385,6 +1401,7 @@
     VIEW3D_PT_sculpt_options,
     VIEW3D_PT_tools_vertexpaint,
     VIEW3D_PT_tools_weightpaint_options,
+    VIEW3D_PT_imagepaint_options,
 
     VIEW3D_PT_tools_projectpaint,
     VIEW3D_MT_tools_projectpaint_clone,

Modified: trunk/blender/source/blender/blenkernel/BKE_brush.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_brush.h	2010-07-22 15:16:20 UTC (rev 30636)
+++ trunk/blender/source/blender/blenkernel/BKE_brush.h	2010-07-22 18:56:46 UTC (rev 30637)
@@ -88,14 +88,24 @@
 int brush_radial_control_exec(struct wmOperator *op, struct Brush *br, float size_weight);
 
 /* unified strength and size */
-int sculpt_get_brush_size(struct Brush *brush);
-void sculpt_set_brush_size(struct Brush *brush, int size);
-int sculpt_get_lock_brush_size(struct Brush *brush);
-float sculpt_get_brush_unprojected_radius(struct Brush *brush);
-void sculpt_set_brush_unprojected_radius(struct Brush *brush, float unprojected_radius);
-float sculpt_get_brush_alpha(struct Brush *brush);
-void sculpt_set_brush_alpha(struct Brush *brush, float alpha);
 
+int  brush_size(struct Brush *brush);
+void brush_set_size(struct Brush *brush, int value);
 
+int  brush_use_locked_size(struct Brush *brush);
+void brush_set_use_locked_size(struct Brush *brush, int value);
+
+int  brush_use_alpha_pressure(struct Brush *brush);
+void brush_set_use_alpha_pressure(struct Brush *brush, int value);
+
+int  brush_use_size_pressure(struct Brush *brush);
+void brush_set_use_size_pressure(struct Brush *brush, int value);
+
+float brush_unprojected_radius(struct Brush *brush);
+void  brush_set_unprojected_radius(struct Brush *brush, float value);
+
+float brush_alpha(struct Brush *brush);
+void  brush_set_alpha(struct Brush *brush, float value);
+
 #endif
 


@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list