[Bf-blender-cvs] [d5263c3] master: Modifier: New Wireframe Modifier

Campbell Barton noreply at git.blender.org
Sat Dec 21 21:14:17 CET 2013


Commit: d5263c37faf73d0f6cc2466ac0806fef972119fb
Author: Campbell Barton
Date:   Sun Dec 22 07:08:35 2013 +1100
http://developer.blender.org/rBd5263c37faf73d0f6cc2466ac0806fef972119fb

Modifier: New Wireframe Modifier

Based on patch originally by Thomas Beck,
uses options similar to solidify.

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

M	release/scripts/startup/bl_ui/properties_data_modifier.py
M	source/blender/editors/include/UI_icons.h
M	source/blender/editors/space_outliner/outliner_draw.c
M	source/blender/makesdna/DNA_modifier_types.h
M	source/blender/makesrna/RNA_access.h
M	source/blender/makesrna/intern/rna_modifier.c
M	source/blender/modifiers/CMakeLists.txt
M	source/blender/modifiers/MOD_modifiertypes.h
M	source/blender/modifiers/intern/MOD_util.c
A	source/blender/modifiers/intern/MOD_wireframe.c

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

diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py
index 7d87100..59b369d 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -1189,5 +1189,36 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
         col.label(text="UV Map:")
         col.prop_search(md, "uv_layer", ob.data, "uv_textures", text="")
 
+    def WIREFRAME(self, layout, ob, md):
+        has_vgroup = bool(md.vertex_group)
+
+        split = layout.split()
+
+        col = split.column()
+        col.prop(md, "thickness", text="Thickness")
+
+        row = col.row(align=True)
+        row.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
+        sub = row.row(align=True)
+        sub.active = has_vgroup
+        sub.prop(md, "invert_vertex_group", text="", icon='ARROW_LEFTRIGHT')
+        row = col.row(align=True)
+        row.active = has_vgroup
+        row.prop(md, "thickness_vertex_group", text="Factor")
+
+        col.prop(md, "use_crease", text="Crease Edges")
+        col.prop(md, "crease_weight", text="Crease Weight")
+
+        col = split.column()
+
+        col.prop(md, "offset")
+        col.prop(md, "use_even_offset", text="Even Thickness")
+        col.prop(md, "use_relative_offset", text="Relative Thickness")
+        col.prop(md, "use_boundary", text="Boundary")
+        col.prop(md, "use_replace", text="Replace Original")
+
+        col.prop(md, "material_offset", text="Material Offset")
+
+
 if __name__ == "__main__":  # only for live edit.
     bpy.utils.register_module(__name__)
diff --git a/source/blender/editors/include/UI_icons.h b/source/blender/editors/include/UI_icons.h
index f8e1bbb..bbad49d 100644
--- a/source/blender/editors/include/UI_icons.h
+++ b/source/blender/editors/include/UI_icons.h
@@ -592,8 +592,8 @@ DEF_ICON(MOD_OCEAN)
 DEF_ICON(MOD_WARP)
 DEF_ICON(MOD_SKIN)
 DEF_ICON(MOD_TRIANGULATE)
+DEF_ICON(MOD_WIREFRAME) // DEF_ICON(BLANK166)
 #ifndef DEF_ICON_BLANK_SKIP
-	DEF_ICON(BLANK166)
 	DEF_ICON(BLANK167)
 	DEF_ICON(BLANK168)
 	DEF_ICON(BLANK169)
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index ebaeb9c..10f4e01 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -965,6 +965,8 @@ static void tselem_draw_icon(uiBlock *block, int xmax, float x, float y, TreeSto
 						UI_icon_draw(x, y, ICON_MOD_TRIANGULATE); break;
 					case eModifierType_MeshCache:
 						UI_icon_draw(x, y, ICON_MOD_MESHDEFORM); break;  /* XXX, needs own icon */
+					case eModifierType_Wireframe:
+						UI_icon_draw(x, y, ICON_MOD_WIREFRAME); break;
 					case eModifierType_LaplacianDeform:
 						UI_icon_draw(x, y, ICON_MOD_MESHDEFORM); break;  /* XXX, needs own icon */
 					/* Default */
diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h
index a3792e9..f057333 100644
--- a/source/blender/makesdna/DNA_modifier_types.h
+++ b/source/blender/makesdna/DNA_modifier_types.h
@@ -81,6 +81,7 @@ typedef enum ModifierType {
 	eModifierType_UVWarp            = 45,
 	eModifierType_MeshCache         = 46,
 	eModifierType_LaplacianDeform   = 47,
+	eModifierType_Wireframe         = 48,
 	NUM_MODIFIER_TYPES
 } ModifierType;
 
@@ -1321,5 +1322,26 @@ enum {
 	MOD_LAPLACIANDEFORM_BIND = 1,
 };
 
+/* many of these options match 'solidify' */
+typedef struct WireframeModifierData {
+	ModifierData modifier;
+	char defgrp_name[64];  /* MAX_VGROUP_NAME */
+	float offset;
+	float offset_fac;
+	float offset_fac_vg;
+	float crease_weight;
+	short flag, mat_ofs;
+} WireframeModifierData;
+
+enum {
+	MOD_WIREFRAME_INVERT_VGROUP = (1 << 0),
+	MOD_WIREFRAME_REPLACE       = (1 << 1),
+	MOD_WIREFRAME_BOUNDARY      = (1 << 2),
+	MOD_MESHCACHE_OFS_EVEN      = (1 << 3),
+	MOD_MESHCACHE_OFS_RELATIVE  = (1 << 4),
+	MOD_MESHCACHE_CREASE        = (1 << 5),
+};
+
+
 
 #endif  /* __DNA_MODIFIER_TYPES_H__ */
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h
index f7909d2..14d51ad 100644
--- a/source/blender/makesrna/RNA_access.h
+++ b/source/blender/makesrna/RNA_access.h
@@ -658,6 +658,7 @@ extern StructRNA RNA_VertexWeightProximityModifier;
 extern StructRNA RNA_Window;
 extern StructRNA RNA_WindowManager;
 extern StructRNA RNA_WipeSequence;
+extern StructRNA RNA_WireframeModifier;
 extern StructRNA RNA_WoodTexture;
 extern StructRNA RNA_World;
 extern StructRNA RNA_WorldAmbientOcclusion;
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index 7427d8d..04055bf 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -80,6 +80,7 @@ EnumPropertyItem modifier_type_items[] = {
 	{eModifierType_Solidify, "SOLIDIFY", ICON_MOD_SOLIDIFY, "Solidify", ""},
 	{eModifierType_Subsurf, "SUBSURF", ICON_MOD_SUBSURF, "Subdivision Surface", ""},
 	{eModifierType_Triangulate, "TRIANGULATE", ICON_MOD_TRIANGULATE, "Triangulate", ""},
+	{eModifierType_Wireframe, "WIREFRAME", ICON_MOD_WIREFRAME, "Wireframe", "Generates a wireframe on the edges of a mesh"},
 	{0, "", 0, N_("Deform"), ""},
 	{eModifierType_Armature, "ARMATURE", ICON_MOD_ARMATURE, "Armature", ""},
 	{eModifierType_Cast, "CAST", ICON_MOD_CAST, "Cast", ""},
@@ -241,6 +242,8 @@ static StructRNA *rna_Modifier_refine(struct PointerRNA *ptr)
 			return &RNA_MeshCacheModifier;
 		case eModifierType_LaplacianDeform:
 			return &RNA_LaplacianDeformModifier;
+		case eModifierType_Wireframe:
+			return &RNA_WireframeModifier;
 		/* Default */
 		case eModifierType_None:
 		case eModifierType_ShapeKey:
@@ -486,6 +489,12 @@ static void RNA_WarpModifier_vgroup_set(PointerRNA *ptr, const char *value)
 	rna_object_vgroup_name_set(ptr, value, tmd->defgrp_name, sizeof(tmd->defgrp_name));
 }
 
+static void RNA_WireframeModifier_vgroup_set(PointerRNA *ptr, const char *value)
+{
+	WireframeModifierData *wmd = (WireframeModifierData *)ptr->data;
+	rna_object_vgroup_name_set(ptr, value, wmd->defgrp_name, sizeof(wmd->defgrp_name));
+}
+
 static void rna_WeightVGModifier_mask_uvlayer_set(PointerRNA *ptr, const char *value)
 {
 	ModifierData *md = (ModifierData *)ptr->data;
@@ -3700,6 +3709,90 @@ static void rna_def_modifier_laplaciandeform(BlenderRNA *brna)
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 }
 
+static void rna_def_modifier_wireframe(BlenderRNA *brna)
+{
+	StructRNA *srna;
+	PropertyRNA *prop;
+
+	srna = RNA_def_struct(brna, "WireframeModifier", "Modifier");
+	RNA_def_struct_ui_text(srna, "Wireframe Modifier", "Wireframe effect modifier");
+	RNA_def_struct_sdna(srna, "WireframeModifierData");
+	RNA_def_struct_ui_icon(srna, ICON_MOD_WIREFRAME);
+
+
+	prop = RNA_def_property(srna, "thickness", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_float_sdna(prop, NULL, "offset");
+	RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
+	RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.01, 4);
+	RNA_def_property_ui_text(prop, "Thickness", "Thickness factor");
+	RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+	prop = RNA_def_property(srna, "thickness_vertex_group", PROP_FLOAT, PROP_FACTOR);
+	RNA_def_property_float_sdna(prop, NULL, "offset_fac_vg");
+	RNA_def_property_range(prop, 0.0, 1.0);
+	RNA_def_property_ui_range(prop, 0, 1, 0.1, 3);
+	RNA_def_property_ui_text(prop, "Vertex Group Factor",
+	                         "Thickness factor to use for zero vertex group influence");
+	RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+	prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_FACTOR);
+	RNA_def_property_float_sdna(prop, NULL, "offset_fac");
+	RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
+	RNA_def_property_ui_range(prop, -1, 1, 0.1, 4);
+	RNA_def_property_ui_text(prop, "Offset", "Offset the thickness from the center");
+	RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+	prop = RNA_def_property(srna, "use_replace", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WIREFRAME_REPLACE);
+	RNA_def_property_ui_text(prop, "Replace", "Remove original geometry");
+	RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+	prop = RNA_def_property(srna, "use_boundary", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WIREFRAME_BOUNDARY);
+	RNA_def_property_ui_text(prop, "Boundary", "Support face boundaries");
+	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_MESHCACHE_OFS_EVEN);
+	RNA_def_property_ui_text(prop, "Offset Even", "Scale the offset to give more even thickness");
+	RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+	prop = RNA_def_property(srna, "use_relative_offset", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MESHCACHE_OFS_RELATIVE);
+	RNA_def_property_ui_text(prop, "Offset Relative", "Scale the offset by surrounding geometry");
+	RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+	prop = RNA_def_property(srna, "use_crease", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MESHCACHE_CREASE);
+	RNA_def_property_ui_text(prop, "Offset Relative", "Crease hub edges for improved subsurf");
+	RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+	prop = RNA_def_property(srna, "crease_weight", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_float_sdna(prop, NULL, "crease_weight");
+	RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
+	RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 1);
+	RNA_def_property_ui_text(prop, "Weigth", "Crease weight (if active)");
+	RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+	prop = RNA_def_property(srna, "material_offset", PROP_INT, PROP_NONE);
+	RNA_def_property_int_sdna(prop, NULL, "mat_ofs");
+	RNA_def_property_range(prop, SHRT_MIN, SHRT_MAX);
+	RNA_def_property_ui_text(prop, "Material Offset", "Offset material index of generated faces");
+	RNA_def_property_update(prop, 0, "rn

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list