[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [53843] trunk/blender: Unification of brush code

Antony Riakiotakis kalast at gmail.com
Wed Jan 16 13:57:36 CET 2013


Revision: 53843
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=53843
Author:   psy-fi
Date:     2013-01-16 12:57:35 +0000 (Wed, 16 Jan 2013)
Log Message:
-----------
Unification of brush code

* rename sculpt_brush_texture_settings to brush_texture_settings
* Expose texture scale and offset in texture paint mode
* Introduce still inactive mapping mode for texture paint, tiled and
view aligned only. Projective paint uses only tiled, while 2d paint can
use both. Commit will come that will use both appropriately for both
modes, omitting fixed brush flag (which is tiled with another name)

Modified Paths:
--------------
    trunk/blender/release/scripts/startup/bl_ui/properties_paint_common.py
    trunk/blender/release/scripts/startup/bl_ui/properties_texture.py
    trunk/blender/release/scripts/startup/bl_ui/space_view3d_toolbar.py
    trunk/blender/source/blender/makesrna/intern/rna_brush.c

Modified: trunk/blender/release/scripts/startup/bl_ui/properties_paint_common.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/properties_paint_common.py	2013-01-16 12:28:25 UTC (rev 53842)
+++ trunk/blender/release/scripts/startup/bl_ui/properties_paint_common.py	2013-01-16 12:57:35 UTC (rev 53843)
@@ -70,34 +70,40 @@
 
 
 # Used in both the View3D toolbar and texture properties
-def sculpt_brush_texture_settings(layout, brush):
+def brush_texture_settings(layout, brush, sculpt):
     tex_slot = brush.texture_slot
 
     layout.label(text="Brush Mapping:")
 
     # map_mode
-    layout.row().prop(tex_slot, "map_mode", text="")
-    layout.separator()
-
+    if sculpt:
+        layout.row().prop(tex_slot, "map_mode", text="")
+        layout.separator()
+    else:
+        layout.row().prop(tex_slot, "tex_paint_map_mode", text="")
+        layout.separator()
+        
     # angle and texture_angle_source
     col = layout.column()
-    col.active = brush.sculpt_capabilities.has_texture_angle_source
-    col.label(text="Angle:")
-    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="")
+    if sculpt:
+        col.active = brush.sculpt_capabilities.has_texture_angle_source
+        col.label(text="Angle:")
+        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="")
 
-    col = layout.column()
-    col.active = brush.sculpt_capabilities.has_texture_angle
-    col.prop(tex_slot, "angle", text="")
+        col = layout.column()
+        col.active = brush.sculpt_capabilities.has_texture_angle
+        col.prop(tex_slot, "angle", text="")
 
     # scale and offset
     split = layout.split()
     split.prop(tex_slot, "offset")
     split.prop(tex_slot, "scale")
-
-    # texture_sample_bias
-    col = layout.column(align=True)
-    col.label(text="Sample Bias:")
-    col.prop(brush, "texture_sample_bias", slider=True, text="")
+    
+    if sculpt:
+        # texture_sample_bias
+        col = layout.column(align=True)
+        col.label(text="Sample Bias:")
+        col.prop(brush, "texture_sample_bias", slider=True, text="")

Modified: trunk/blender/release/scripts/startup/bl_ui/properties_texture.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/properties_texture.py	2013-01-16 12:28:25 UTC (rev 53842)
+++ trunk/blender/release/scripts/startup/bl_ui/properties_texture.py	2013-01-16 12:57:35 UTC (rev 53843)
@@ -30,7 +30,7 @@
 
 from rna_prop_ui import PropertyPanel
 
-from bl_ui.properties_paint_common import sculpt_brush_texture_settings
+from bl_ui.properties_paint_common import brush_texture_settings
 
 
 class TEXTURE_MT_specials(Menu):
@@ -884,8 +884,8 @@
                 split.prop(tex, "object", text="")
 
         if isinstance(idblock, Brush):
-            if context.sculpt_object:
-                sculpt_brush_texture_settings(layout, idblock)
+            if context.sculpt_object or context.image_paint_object:
+                brush_texture_settings(layout, idblock, context.sculpt_object)
         else:
             if isinstance(idblock, Material):
                 split = layout.split(percentage=0.3)

Modified: trunk/blender/release/scripts/startup/bl_ui/space_view3d_toolbar.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/space_view3d_toolbar.py	2013-01-16 12:28:25 UTC (rev 53842)
+++ trunk/blender/release/scripts/startup/bl_ui/space_view3d_toolbar.py	2013-01-16 12:57:35 UTC (rev 53843)
@@ -20,7 +20,7 @@
 import bpy
 from bpy.types import Menu, Panel
 from bl_ui.properties_paint_common import UnifiedPaintPanel
-from bl_ui.properties_paint_common import sculpt_brush_texture_settings
+from bl_ui.properties_paint_common import brush_texture_settings
 
 
 class View3DPanel():
@@ -723,9 +723,9 @@
         if brush.use_paint_image:
             col.prop(brush, "use_fixed_texture")
 
+        brush_texture_settings(col, brush, context.sculpt_object)
+
         if context.sculpt_object:
-            sculpt_brush_texture_settings(col, brush)
-
             # use_texture_overlay and texture_overlay_alpha
             col = layout.column(align=True)
             col.active = brush.sculpt_capabilities.has_overlay

Modified: trunk/blender/source/blender/makesrna/intern/rna_brush.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_brush.c	2013-01-16 12:28:25 UTC (rev 53842)
+++ trunk/blender/source/blender/makesrna/intern/rna_brush.c	2013-01-16 12:57:35 UTC (rev 53843)
@@ -429,6 +429,12 @@
 		{0, NULL, 0, NULL, NULL}
 	};
 
+	static EnumPropertyItem prop_tex_paint_map_mode_items[] = {
+		{MTEX_MAP_MODE_VIEW, "VIEW_PLANE", 0, "View Plane", ""},
+		{MTEX_MAP_MODE_TILED, "TILED", 0, "Tiled", ""},
+		{0, NULL, 0, NULL, NULL}
+	};
+
 	srna = RNA_def_struct(brna, "BrushTextureSlot", "TextureSlot");
 	RNA_def_struct_sdna(srna, "MTex");
 	RNA_def_struct_ui_text(srna, "Brush Texture Slot", "Texture slot for textures in a Brush datablock");
@@ -444,6 +450,12 @@
 	RNA_def_property_enum_items(prop, prop_map_mode_items);
 	RNA_def_property_ui_text(prop, "Mode", "");
 	RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
+
+	prop = RNA_def_property(srna, "tex_paint_map_mode", PROP_ENUM, PROP_NONE);
+	RNA_def_property_enum_sdna(prop, NULL, "brush_map_mode");
+	RNA_def_property_enum_items(prop, prop_tex_paint_map_mode_items);
+	RNA_def_property_ui_text(prop, "Mode", "");
+	RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
 }
 
 static void rna_def_sculpt_capabilities(BlenderRNA *brna)




More information about the Bf-blender-cvs mailing list