[Bf-blender-cvs] [1908909] master: Sculpt Dynamic Topology: support collapsing edges without subdividing edges as well

Brecht Van Lommel noreply at git.blender.org
Tue Nov 26 00:22:02 CET 2013


Commit: 19089092739cce491888a7fa0e48e5e6a5fe64d8
Author: Brecht Van Lommel
Date:   Tue Nov 19 21:55:46 2013 +0100
http://developer.blender.org/rB19089092739cce491888a7fa0e48e5e6a5fe64d8

Sculpt Dynamic Topology: support collapsing edges without subdividing edges as well

This allows you to choose between subdivide edges, collapse and both. Being able to
only collapse edges can be useful to simplify meshes with accidentally introducing
more detail.

Reviewed By: psy-fi, carter2422

Differential Revision: http://developer.blender.org/D15

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

M	release/scripts/startup/bl_ui/space_view3d_toolbar.py
M	source/blender/blenkernel/BKE_blender.h
M	source/blender/blenloader/intern/readfile.c
M	source/blender/editors/sculpt_paint/sculpt.c
M	source/blender/makesdna/DNA_scene_types.h
M	source/blender/makesrna/intern/rna_sculpt_paint.c

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

diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index cd3c238..bfda0c8 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -986,6 +986,8 @@ class VIEW3D_PT_sculpt_topology(Panel, View3DPaintPanel):
 
         toolsettings = context.tool_settings
         sculpt = toolsettings.sculpt
+        settings = self.paint_settings(context)
+        brush = settings.brush
 
         if context.sculpt_object.use_dynamic_topology_sculpting:
             layout.operator("sculpt.dynamic_topology_toggle", icon='X', text="Disable Dynamic")
@@ -994,9 +996,12 @@ class VIEW3D_PT_sculpt_topology(Panel, View3DPaintPanel):
 
         col = layout.column()
         col.active = context.sculpt_object.use_dynamic_topology_sculpting
-        col.prop(sculpt, "detail_size")
+        sub = col.column(align=True)
+        sub.active = brush and brush.sculpt_tool not in ('MASK')
+        sub.prop(sculpt, "detail_size")
+        sub.prop(sculpt, "detail_refine_method", text="")
+        col.separator()
         col.prop(sculpt, "use_smooth_shading")
-        col.prop(sculpt, "use_edge_collapse")
         col.operator("sculpt.optimize")
         col.separator()
         col.prop(sculpt, "symmetrize_direction")
diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h
index f2d9c0e..a4a6b60 100644
--- a/source/blender/blenkernel/BKE_blender.h
+++ b/source/blender/blenkernel/BKE_blender.h
@@ -42,7 +42,7 @@ extern "C" {
  * and keep comment above the defines.
  * Use STRINGIFY() rather than defining with quotes */
 #define BLENDER_VERSION         269
-#define BLENDER_SUBVERSION      2
+#define BLENDER_SUBVERSION      3
 /* 262 was the last editmesh release but it has compatibility code for bmesh data */
 #define BLENDER_MINVERSION      262
 #define BLENDER_MINSUBVERSION   0
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index c7e82c1..1773538 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -9768,7 +9768,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		} FOREACH_NODETREE_END
 	}
 
-	{
+	if (!MAIN_VERSION_ATLEAST(main, 269, 3)) {
 		bScreen *sc;
 		ScrArea *sa;
 		SpaceLink *sl;
@@ -9834,25 +9834,27 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		}
 
 		for (scene = main->scene.first; scene; scene = scene->id.next) {
-			if (scene->gm.matmode == GAME_MAT_TEXFACE) {
+			/* this can now be turned off */
+			ToolSettings *ts= scene->toolsettings;
+			if (ts->sculpt)
+				ts->sculpt->flags |= SCULPT_DYNTOPO_SUBDIVIDE;
+
+			/* single texture mode removed from game engine */
+			if (scene->gm.matmode == GAME_MAT_TEXFACE)
 				scene->gm.matmode = GAME_MAT_MULTITEX;
-			}
-		}
 
-		/* 'Increment' mode disabled for nodes, use true grid snapping instead */
-		for (scene = main->scene.first; scene; scene = scene->id.next) {
+			/* 'Increment' mode disabled for nodes, use true grid snapping instead */
 			if (scene->toolsettings->snap_node_mode == SCE_SNAP_MODE_INCREMENT)
 				scene->toolsettings->snap_node_mode = SCE_SNAP_MODE_GRID;
-		}
 
-		/* Update for removed "sound-only" option in FFMPEG export settings. */
 #ifdef WITH_FFMPEG
-		for (scene = main->scene.first; scene; scene = scene->id.next) {
+			/* Update for removed "sound-only" option in FFMPEG export settings. */
 			if (scene->r.ffcodecdata.type >= FFMPEG_INVALID) {
 				scene->r.ffcodecdata.type = FFMPEG_AVI;
 			}
-		}
 #endif
+
+		}
 	}
 
 	/* WATCH IT!!!: pointers from libdata have not been converted yet here! */
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 6bd935a..100eae9 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -3076,9 +3076,12 @@ static void sculpt_topology_update(Sculpt *sd, Object *ob, Brush *brush)
 
 	/* Only act if some verts are inside the brush area */
 	if (totnode) {
-		PBVHTopologyUpdateMode mode = PBVH_Subdivide;
+		PBVHTopologyUpdateMode mode = 0;
 		float location[3];
 
+		if (sd->flags & SCULPT_DYNTOPO_SUBDIVIDE)
+			mode |= PBVH_Subdivide;
+
 		if ((sd->flags & SCULPT_DYNTOPO_COLLAPSE) ||
 			(brush->sculpt_tool == SCULPT_TOOL_SIMPLIFY))
 		{
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index 7aabad8..5291ad8 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -1568,8 +1568,9 @@ typedef enum SculptFlags {
 	 * dynamic-topology mode */
 	SCULPT_DYNTOPO_SMOOTH_SHADING = (1 << 10),
 
-	/* If set, dynamic-topology brushes will collapse short edges in
-	 * addition to subdividing long ones */
+	/* If set, dynamic-topology brushes will subdivide short edges */
+	SCULPT_DYNTOPO_SUBDIVIDE = (1 << 12),
+	/* If set, dynamic-topology brushes will collapse short edges */
 	SCULPT_DYNTOPO_COLLAPSE = (1 << 11)
 } SculptFlags;
 
diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c
index a9f84f1..53200d4 100644
--- a/source/blender/makesrna/intern/rna_sculpt_paint.c
+++ b/source/blender/makesrna/intern/rna_sculpt_paint.c
@@ -322,6 +322,16 @@ static void rna_def_paint(BlenderRNA *brna)
 
 static void rna_def_sculpt(BlenderRNA  *brna)
 {
+	static EnumPropertyItem detail_refine_items[] = {
+		{SCULPT_DYNTOPO_SUBDIVIDE, "SUBDIVIDE", 0,
+		 "Subdivide Edges", "Subdivide long edges to add mesh detail where needed"},
+		{SCULPT_DYNTOPO_COLLAPSE, "COLLAPSE", 0,
+		 "Collapse Edges", "Collapse short edges to remove mesh detail where possible"},
+		{SCULPT_DYNTOPO_SUBDIVIDE|SCULPT_DYNTOPO_COLLAPSE, "SUBDIVIDE_COLLAPSE", 0,
+		 "Subdivide Collapse", "Both subdivide long edges and collapse short edges to refine mesh detail"},
+		{0, NULL, 0, NULL, NULL}
+	};
+
 	StructRNA *srna;
 	PropertyRNA *prop;
 
@@ -403,16 +413,16 @@ static void rna_def_sculpt(BlenderRNA  *brna)
 	                         "shading rather than flat shaded");
 	RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Sculpt_update");
 
-	prop = RNA_def_property(srna, "use_edge_collapse", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_DYNTOPO_COLLAPSE);
-	RNA_def_property_ui_text(prop, "Collapse Short Edges",
-	                         "In dynamic-topology mode, collapse short edges "
-	                         "in addition to subdividing long ones");
-	RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
 	prop = RNA_def_property(srna, "symmetrize_direction", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, symmetrize_direction_items);
 	RNA_def_property_ui_text(prop, "Direction", "Source and destination for symmetrize operator");
+
+	prop = RNA_def_property(srna, "detail_refine_method", PROP_ENUM, PROP_NONE);
+	RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags");
+	RNA_def_property_enum_items(prop, detail_refine_items);
+	RNA_def_property_ui_text(prop, "Detail Refine Method",
+	                         "In dynamic-topology mode, how to add or remove mesh detail");
+	RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
 }




More information about the Bf-blender-cvs mailing list