[Bf-blender-cvs] [9e950ea] master: Fix issue in separate rake control commit:

Antony Riakiotakis noreply at git.blender.org
Tue Dec 30 18:07:31 CET 2014


Commit: 9e950ea6610b2f876d816c4787cb06082d91bd82
Author: Antony Riakiotakis
Date:   Tue Dec 30 18:06:59 2014 +0100
Branches: master
https://developer.blender.org/rB9e950ea6610b2f876d816c4787cb06082d91bd82

Fix issue in separate rake control commit:

Mask slot still depended on regular slot to check some capabilities.
Some angle capabilities now only depend on the texture slot, not the
brush, so separate them and use the slot where appropriate.

===================================================================

M	release/scripts/startup/bl_ui/properties_paint_common.py
M	source/blender/makesrna/intern/rna_brush.c

===================================================================

diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py b/release/scripts/startup/bl_ui/properties_paint_common.py
index 4963498..ba1947b 100644
--- a/release/scripts/startup/bl_ui/properties_paint_common.py
+++ b/release/scripts/startup/bl_ui/properties_paint_common.py
@@ -243,14 +243,14 @@ def brush_texture_settings(layout, brush, sculpt):
         layout.operator("brush.stencil_reset_transform")
 
     # angle and texture_angle_source
-    if brush.brush_capabilities.has_texture_angle:
+    if tex_slot.has_texture_angle:
         col = layout.column()
         col.label(text="Angle:")
-        if brush.brush_capabilities.has_texture_angle_source:
-            col.prop(tex_slot, "angle", text="")
+        col.prop(tex_slot, "angle", text="")
+        if tex_slot.has_texture_angle_source:
             col.prop(tex_slot, "use_rake", text="Rake")
             
-            if brush.brush_capabilities.has_random_texture_angle:
+            if brush.brush_capabilities.has_random_texture_angle and tex_slot.has_random_texture_angle:
                 if sculpt:
                     if brush.sculpt_capabilities.has_random_texture_angle:
                         col.prop(tex_slot, "use_random", text="Random")
@@ -290,14 +290,14 @@ def brush_mask_texture_settings(layout, brush):
     col = layout.column()
     col.prop(brush, "use_pressure_masking", text="")
     # angle and texture_angle_source
-    if brush.brush_capabilities.has_texture_angle:
+    if mask_tex_slot.has_texture_angle:
         col = layout.column()
         col.label(text="Angle:")
-        if brush.brush_capabilities.has_texture_angle_source:
-            col.prop(mask_tex_slot, "angle", text="")
+        col.prop(mask_tex_slot, "angle", text="")
+        if mask_tex_slot.has_texture_angle_source:
             col.prop(mask_tex_slot, "use_rake", text="Rake")
             
-            if brush.brush_capabilities.has_random_texture_angle:
+            if brush.brush_capabilities.has_random_texture_angle and mask_tex_slot.has_random_texture_angle:
                 col.prop(mask_tex_slot, "use_random", text="Random")
                 if mask_tex_slot.use_random:
                     col.prop(mask_tex_slot, "random_angle", text="")
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c
index 2c7b7b3..81ba3a9 100644
--- a/source/blender/makesrna/intern/rna_brush.c
+++ b/source/blender/makesrna/intern/rna_brush.c
@@ -194,14 +194,20 @@ static int rna_SculptToolCapabilities_has_random_texture_angle_get(PointerRNA *p
 	              SCULPT_TOOL_SNAKE_HOOK, SCULPT_TOOL_THUMB));
 }
 
-static int rna_BrushCapabilities_has_random_texture_angle_get(PointerRNA *ptr)
+static int rna_TextureCapabilities_has_random_texture_angle_get(PointerRNA *ptr)
 {
-	Brush *br = (Brush *)ptr->data;
-	return (ELEM(br->mtex.brush_map_mode,
+	MTex *mtex = (MTex *)ptr->data;
+	return ELEM(mtex->brush_map_mode,
 	             MTEX_MAP_MODE_VIEW,
 	             MTEX_MAP_MODE_AREA,
-	             MTEX_MAP_MODE_RANDOM) &&
-	        !(br->flag & BRUSH_ANCHORED));
+	             MTEX_MAP_MODE_RANDOM);
+}
+
+
+static int rna_BrushCapabilities_has_random_texture_angle_get(PointerRNA *ptr)
+{
+	Brush *br = (Brush *)ptr->data;
+	return !(br->flag & BRUSH_ANCHORED);
 }
 
 static int rna_SculptToolCapabilities_has_sculpt_plane_get(PointerRNA *ptr)
@@ -270,15 +276,10 @@ static int rna_SculptToolCapabilities_has_strength_pressure_get(PointerRNA *ptr)
 	return !ELEM(br->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_SNAKE_HOOK);
 }
 
-static int rna_BrushCapabilities_has_texture_angle_get(PointerRNA *ptr)
+static int rna_TextureCapabilities_has_texture_angle_get(PointerRNA *ptr)
 {
-	Brush *br = (Brush *)ptr->data;
-	return ELEM(br->mtex.brush_map_mode,
-	            MTEX_MAP_MODE_VIEW,
-	            MTEX_MAP_MODE_AREA,
-	            MTEX_MAP_MODE_TILED,
-	            MTEX_MAP_MODE_STENCIL,
-	            MTEX_MAP_MODE_RANDOM);
+	MTex *mtex = (MTex *)ptr->data;
+	return mtex->brush_map_mode != MTEX_MAP_MODE_3D;
 }
 
 static int rna_SculptToolCapabilities_has_gravity_get(PointerRNA *ptr)
@@ -287,10 +288,10 @@ static int rna_SculptToolCapabilities_has_gravity_get(PointerRNA *ptr)
 	return !ELEM(br->sculpt_tool, SCULPT_TOOL_MASK, SCULPT_TOOL_SMOOTH);
 }
 
-static int rna_BrushCapabilities_has_texture_angle_source_get(PointerRNA *ptr)
+static int rna_TextureCapabilities_has_texture_angle_source_get(PointerRNA *ptr)
 {
-	Brush *br = (Brush *)ptr->data;
-	return ELEM(br->mtex.brush_map_mode,
+	MTex *mtex = (MTex *)ptr->data;
+	return ELEM(mtex->brush_map_mode,
 	            MTEX_MAP_MODE_VIEW,
 	            MTEX_MAP_MODE_AREA,
 	            MTEX_MAP_MODE_RANDOM);
@@ -627,6 +628,15 @@ static void rna_def_brush_texture_slot(BlenderRNA *brna)
 		{0, NULL, 0, NULL, NULL}
 	};
 
+#define TEXTURE_CAPABILITY(prop_name_, ui_name_)                          \
+	prop = RNA_def_property(srna, #prop_name_,                          \
+	                        PROP_BOOLEAN, PROP_NONE);                   \
+	RNA_def_property_clear_flag(prop, PROP_EDITABLE);                   \
+	RNA_def_property_boolean_funcs(prop, "rna_TextureCapabilities_"      \
+	                               #prop_name_ "_get", NULL);           \
+	RNA_def_property_ui_text(prop, ui_name_, 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");
@@ -669,6 +679,10 @@ static void rna_def_brush_texture_slot(BlenderRNA *brna)
 	RNA_def_property_range(prop, 0, M_PI * 2);
 	RNA_def_property_ui_text(prop, "Random Angle", "Brush texture random angle");
 	RNA_def_property_update(prop, 0, "rna_TextureSlot_brush_update");
+	
+	TEXTURE_CAPABILITY(has_texture_angle_source, "Has Texture Angle Source");
+	TEXTURE_CAPABILITY(has_random_texture_angle, "Has Random Texture Angle");
+	TEXTURE_CAPABILITY(has_texture_angle, "Has Texture Angle Source");	
 }
 
 static void rna_def_sculpt_capabilities(BlenderRNA *brna)
@@ -732,8 +746,6 @@ static void rna_def_brush_capabilities(BlenderRNA *brna)
 
 	BRUSH_CAPABILITY(has_overlay, "Has Overlay");
 	BRUSH_CAPABILITY(has_random_texture_angle, "Has Random Texture Angle");
-	BRUSH_CAPABILITY(has_texture_angle, "Has Texture Angle");
-	BRUSH_CAPABILITY(has_texture_angle_source, "Has Texture Angle Source");
 	BRUSH_CAPABILITY(has_spacing, "Has Spacing");
 	BRUSH_CAPABILITY(has_smooth_stroke, "Has Smooth Stroke");




More information about the Bf-blender-cvs mailing list