[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [30949] branches/soc-2010-jwilkins: * various fixes to the presentation of overlays in the UI

Jason Wilkins Jason.A.Wilkins at gmail.com
Sun Aug 1 23:00:42 CEST 2010


Revision: 30949
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=30949
Author:   jwilkins
Date:     2010-08-01 23:00:41 +0200 (Sun, 01 Aug 2010)

Log Message:
-----------
* various fixes to the presentation of overlays in the UI

Modified Paths:
--------------
    branches/soc-2010-jwilkins/release/scripts/ui/space_view3d_toolbar.py
    branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/paint_stroke.c
    branches/soc-2010-jwilkins/source/blender/makesrna/intern/rna_brush.c

Modified: branches/soc-2010-jwilkins/release/scripts/ui/space_view3d_toolbar.py
===================================================================
--- branches/soc-2010-jwilkins/release/scripts/ui/space_view3d_toolbar.py	2010-08-01 20:36:24 UTC (rev 30948)
+++ branches/soc-2010-jwilkins/release/scripts/ui/space_view3d_toolbar.py	2010-08-01 21:00:41 UTC (rev 30949)
@@ -770,33 +770,16 @@
             col.separator()
 
             col = layout.column()
-            col.active = tex_slot.map_mode in ('FIXED')
+            col.active = tex_slot.map_mode in ('FIXED', 'TILED', 'WRAP')
             col.label(text="Angle:")
             
             col = layout.column()
-            if not brush.use_anchor and brush.sculpt_tool not in ('GRAB', 'SNAKE_HOOK', 'THUMB', 'ROTATE') and tex_slot.map_mode in ('FIXED'):
-                col.prop(brush, "texture_angle_source", text="")
-            else:
-                col.prop(brush, "texture_angle_source_no_random", text="")
+            col.prop(brush, "texture_angle_source", text="")
 
-            #row = col.row(align=True)
-            #row.label(text="Angle:")
-            #row.active = tex_slot.map_mode in ('FIXED', 'TILED')
-
-            #row = col.row(align=True)
-
-            #col = row.column()
-            #col.active = tex_slot.map_mode in ('FIXED')
-            #col.prop(brush, "use_rake", toggle=True, icon='PARTICLEMODE', text="")
-
             col = layout.column()
             col.prop(tex_slot, "angle", text="")
-            col.active = tex_slot.map_mode in ('FIXED', 'TILED')
+            col.active = tex_slot.map_mode in ('FIXED', 'TILED', 'WRAP')
 
-            #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()
 
             col = split.column()
@@ -818,7 +801,7 @@
 
             row = col.row(align=True)
             row.label(text="Overlay:")
-            row.active = tex_slot.map_mode in ('FIXED', 'TILED')
+            row.active = tex_slot.map_mode in ('FIXED', 'TILED', 'WRAP')
 
             row = col.row(align=True)
 
@@ -829,11 +812,11 @@
             else:
                 col.prop(brush, "use_texture_overlay", toggle=True, text="", icon='MUTE_IPO_ON')
 
-            col.active = tex_slot.map_mode in ('FIXED', 'TILED')
+            col.active = tex_slot.map_mode in ('FIXED', 'TILED', 'WRAP')
 
             col = row.column()
             col.prop(brush, "texture_overlay_alpha", text="Alpha")
-            col.active = tex_slot.map_mode in ('FIXED', 'TILED') and brush.use_texture_overlay
+            col.active = tex_slot.map_mode in ('FIXED', 'TILED', 'WRAP') and brush.use_texture_overlay
 
 
 class VIEW3D_PT_tools_brush_tool(PaintPanel):

Modified: branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/paint_stroke.c
===================================================================
--- branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/paint_stroke.c	2010-08-01 20:36:24 UTC (rev 30948)
+++ branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/paint_stroke.c	2010-08-01 21:00:41 UTC (rev 30949)
@@ -727,18 +727,16 @@
 		glPushMatrix();
 		glLoadIdentity();
 
-		if (brush->mtex.brush_map_mode == MTEX_MAP_MODE_FIXED) {
-			glTranslatef(0.5f, 0.5f, 0);
+		glTranslatef(0.5f, 0.5f, 0);
 
-			glRotatef(angle, 0, 0, 1);
+		glRotatef(angle, 0, 0, 1);
 
-			glTranslatef(-0.5f, -0.5f, 0);
+		glTranslatef(-0.5f, -0.5f, 0);
 
-			if (sd->draw_pressure && (brush->flag & BRUSH_SIZE_PRESSURE)) {
-				glTranslatef(0.5f, 0.5f, 0);
-				glScalef(1.0f/sd->pressure_value, 1.0f/sd->pressure_value, 1);
-				glTranslatef(-0.5f, -0.5f, 0);
-			}
+		if (sd->draw_pressure && (brush->flag & BRUSH_SIZE_PRESSURE)) {
+			glTranslatef(0.5f, 0.5f, 0);
+			glScalef(1.0f/sd->pressure_value, 1.0f/sd->pressure_value, 1);
+			glTranslatef(-0.5f, -0.5f, 0);
 		}
 
 		glColor4f(

Modified: branches/soc-2010-jwilkins/source/blender/makesrna/intern/rna_brush.c
===================================================================
--- branches/soc-2010-jwilkins/source/blender/makesrna/intern/rna_brush.c	2010-08-01 20:36:24 UTC (rev 30948)
+++ branches/soc-2010-jwilkins/source/blender/makesrna/intern/rna_brush.c	2010-08-01 21:00:41 UTC (rev 30949)
@@ -44,6 +44,12 @@
 	{BRUSH_DIR_IN, "SUBTRACT", 0, "Subtract", "Subtract effect of brush"},
 	{0, NULL, 0, NULL, NULL}};
 
+static EnumPropertyItem texture_angle_source_items[] = {
+	{0, "USER", 0, "User", ""},
+	{BRUSH_RAKE, "RAKE", 0, "Rake", ""},
+	{BRUSH_RANDOM_ROTATION, "RANDOM", 0, "Random", ""},
+	{0, NULL, 0, NULL, NULL}};
+
 EnumPropertyItem brush_sculpt_tool_items[] = {
 	{SCULPT_TOOL_BLOB, "BLOB", ICON_BRUSH_BLOB, "Blob", ""},
 	{SCULPT_TOOL_CLAY, "CLAY", ICON_BRUSH_CLAY, "Clay", ""},
@@ -329,6 +335,26 @@
 	}
 }
 
+static EnumPropertyItem *rna_Brush_texture_angle_source_itemf(bContext *C, PointerRNA *ptr, int *free)
+{
+	Brush *me= (Brush*)(ptr->data);
+
+	static EnumPropertyItem texture_angle_source_no_random_items[] = {
+		{0, "USER", 0, "User", ""},
+		{BRUSH_RAKE, "RAKE", 0, "Rake", ""},
+		{0, NULL, 0, NULL, NULL}};
+
+		if (!(me->flag & BRUSH_ANCHORED) &&
+			!ELEM4(me->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_SNAKE_HOOK, SCULPT_TOOL_THUMB, SCULPT_TOOL_ROTATE) &&
+			ELEM(me->mtex.brush_map_mode, MTEX_MAP_MODE_FIXED, MTEX_MAP_MODE_WRAP))
+		{
+			return texture_angle_source_items;
+		}
+		else {
+			return texture_angle_source_no_random_items;
+		}
+}
+
 #else
 
 static void rna_def_brush_texture_slot(BlenderRNA *brna)
@@ -384,17 +410,6 @@
 		{BRUSH_AIRBRUSH, "AIRBRUSH", 0, "Airbrush", ""},
 		{0, NULL, 0, NULL, NULL}};
 
-	static EnumPropertyItem texture_angle_source_items[] = {
-		{0, "USER", 0, "User", ""},
-		{BRUSH_RAKE, "RAKE", 0, "Rake", ""},
-		{BRUSH_RANDOM_ROTATION, "RANDOM", 0, "Random", ""},
-		{0, NULL, 0, NULL, NULL}};
-
-	static EnumPropertyItem texture_angle_source_no_random_items[] = {
-		{0, "USER", 0, "User", ""},
-		{BRUSH_RAKE, "RAKE", 0, "Rake", ""},
-		{0, NULL, 0, NULL, NULL}};
-
 	static EnumPropertyItem brush_sculpt_plane_items[] = {
 		{SCULPT_DISP_DIR_AREA, "AREA", 0, "Area Plane", ""},
 		{SCULPT_DISP_DIR_VIEW, "VIEW", 0, "View Plane", ""},
@@ -476,15 +491,10 @@
 	prop= RNA_def_property(srna, "texture_angle_source", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
 	RNA_def_property_enum_items(prop, texture_angle_source_items);
+	RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Brush_texture_angle_source_itemf");
 	RNA_def_property_ui_text(prop, "Texture Angle Source", "");
 	RNA_def_property_update(prop, 0, "rna_Brush_update");
 
-	prop= RNA_def_property(srna, "texture_angle_source_no_random", PROP_ENUM, PROP_NONE);
-	RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
-	RNA_def_property_enum_items(prop, texture_angle_source_no_random_items);
-	RNA_def_property_ui_text(prop, "Texture Angle Source", "");
-	RNA_def_property_update(prop, 0, "rna_Brush_update");
-
 	prop= RNA_def_property(srna, "sculpt_plane", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, brush_sculpt_plane_items);
 	RNA_def_property_ui_text(prop, "Sculpt Plane", "");





More information about the Bf-blender-cvs mailing list