[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [29432] trunk/blender: solidify rim material option, use the next material slot for rim faces.

Campbell Barton ideasman42 at gmail.com
Sun Jun 13 15:56:14 CEST 2010


Revision: 29432
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=29432
Author:   campbellbarton
Date:     2010-06-13 15:56:13 +0200 (Sun, 13 Jun 2010)

Log Message:
-----------
solidify rim material option, use the next material slot for rim faces.
a bit arbitrary but with most cases where solidify is used in durian we get UV texture stretching since there is no way to access the newly created size faces this gives us a way to switch out the material on the rim.

Modified Paths:
--------------
    trunk/blender/release/scripts/ui/properties_data_modifier.py
    trunk/blender/source/blender/makesdna/DNA_modifier_types.h
    trunk/blender/source/blender/makesrna/intern/rna_modifier.c
    trunk/blender/source/blender/modifiers/intern/MOD_solidify.c

Modified: trunk/blender/release/scripts/ui/properties_data_modifier.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_data_modifier.py	2010-06-13 05:48:21 UTC (rev 29431)
+++ trunk/blender/release/scripts/ui/properties_data_modifier.py	2010-06-13 13:56:13 UTC (rev 29432)
@@ -643,13 +643,14 @@
         colsub.active = (md.vertex_group is not "")
         colsub.prop(md, "invert", text="Invert")
 
-        if wide_ui:
-            col.label(text="")
-
-        col.prop(md, "use_rim")
         col.prop(md, "use_even_offset")
         col.prop(md, "use_quality_normals")
 
+        col.prop(md, "use_rim")
+        colsub = col.column()
+        colsub.active = md.use_rim
+        colsub.prop(md, "use_rim_material")
+
         # col = layout.column()
         # col.label(text="Vertex Group:")
         # col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")

Modified: trunk/blender/source/blender/makesdna/DNA_modifier_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_modifier_types.h	2010-06-13 05:48:21 UTC (rev 29431)
+++ trunk/blender/source/blender/makesdna/DNA_modifier_types.h	2010-06-13 13:56:13 UTC (rev 29432)
@@ -703,6 +703,7 @@
 #define MOD_SOLIDIFY_EVEN			(1<<1)
 #define MOD_SOLIDIFY_NORMAL_CALC	(1<<2)
 #define MOD_SOLIDIFY_VGROUP_INV		(1<<3)
+#define MOD_SOLIDIFY_RIM_MATERIAL	(1<<4)
 
 typedef struct ScrewModifierData {
 	ModifierData modifier;

Modified: trunk/blender/source/blender/makesrna/intern/rna_modifier.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_modifier.c	2010-06-13 05:48:21 UTC (rev 29431)
+++ trunk/blender/source/blender/makesrna/intern/rna_modifier.c	2010-06-13 13:56:13 UTC (rev 29432)
@@ -2104,6 +2104,11 @@
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SOLIDIFY_RIM);
 	RNA_def_property_ui_text(prop, "Fill Rim", "Create edge loops between the inner and outer surfaces on face edges (slow, disable when not needed)");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
+	
+	prop= RNA_def_property(srna, "use_rim_material", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SOLIDIFY_RIM_MATERIAL);
+	RNA_def_property_ui_text(prop, "Rim Material", "Use in the next material for rim faces");
+	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
 	prop= RNA_def_property(srna, "use_even_offset", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SOLIDIFY_EVEN);
@@ -2119,6 +2124,8 @@
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SOLIDIFY_VGROUP_INV);
 	RNA_def_property_ui_text(prop, "Vertex Group Invert", "Invert the vertex group influence");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
+	
+	
 }
 
 static void rna_def_modifier_screw(BlenderRNA *brna)

Modified: trunk/blender/source/blender/modifiers/intern/MOD_solidify.c
===================================================================
--- trunk/blender/source/blender/modifiers/intern/MOD_solidify.c	2010-06-13 05:48:21 UTC (rev 29431)
+++ trunk/blender/source/blender/modifiers/intern/MOD_solidify.c	2010-06-13 13:56:13 UTC (rev 29432)
@@ -514,6 +514,8 @@
 		float (*edge_vert_nos)[3]= MEM_callocN(sizeof(float) * numVerts * 3, "solidify_edge_nos");
 		float nor[3];
 #endif
+		/* maximum value -1, so we have room to increase */
+		const short mat_nr_shift= (smd->flag & MOD_SOLIDIFY_RIM_MATERIAL) ? ob->totcol-1 : -1;
 
 		const unsigned char crease_rim= smd->crease_rim * 255.0f;
 		const unsigned char crease_outer= smd->crease_outer * 255.0f;
@@ -572,6 +574,10 @@
 				mf->v3= ed->v1 + numVerts;
 				mf->v4= ed->v2 + numVerts;
 			}
+			
+			/* use the next material index if option enabled */
+			if(mf->mat_nr < mat_nr_shift)
+				mf->mat_nr++;
 
 			if(crease_outer)
 				ed->crease= crease_outer;





More information about the Bf-blender-cvs mailing list