[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [40811] branches/soc-2008-mxcurioni: Fine control of feature edge selection with mesh face and edge marks.

Tamito Kajiyama rd6t-kjym at asahi-net.or.jp
Thu Oct 6 04:04:47 CEST 2011


Revision: 40811
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=40811
Author:   kjym3
Date:     2011-10-06 02:04:43 +0000 (Thu, 06 Oct 2011)
Log Message:
-----------
Fine control of feature edge selection with mesh face and edge marks.

New "face marks" and "edge marks" have been introduced in mesh data
blocks.  In the edit mode of a mesh object, face marks can be put
to selected faces by choosing Mesh >> Faces >> Mark Freestyle Face
from the menu of a 3D View window or Ctrl-F >> Mark Freestyle Face
from the context menu.  Similarly, edge marks can be put to selected
edges by Mesh >> Edges >> Mark Freestyle Edge or Ctrl-E >> Mark
Freestyle Edge.  These marks should work fine with the Subdivision
surface modifier.

Moreover, two new conditions for feature edge selection have been
added to the Parameter Editor mode as described below:

1. The Selection by Edge Types option has now the new Edge Mark type,
which can be used to (de)select feature edges having edge marks.
This option can be used to add to (or remove from) the view map
arbitrary edges of mesh objects.

2. Selection by Face Marks option has been newly introduced, in which
face marks are used for feature edge selection in two ways.  One
option is called "One Face" which is to (de)select feature edges if
one of faces on the left and right of each feature edge has a face
mark.  The other option is "Both Faces" to (de)select feature edges
if both faces on the left and right have a face mark.

Modified Paths:
--------------
    branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/parameter_editor.py
    branches/soc-2008-mxcurioni/release/scripts/startup/bl_ui/properties_render.py
    branches/soc-2008-mxcurioni/release/scripts/startup/bl_ui/space_view3d.py
    branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/BME_conversions.c
    branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/DerivedMesh.c
    branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/cdderivedmesh.c
    branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/subsurf_ccg.c
    branches/soc-2008-mxcurioni/source/blender/blenlib/BLI_editVert.h
    branches/soc-2008-mxcurioni/source/blender/editors/include/UI_resources.h
    branches/soc-2008-mxcurioni/source/blender/editors/interface/resources.c
    branches/soc-2008-mxcurioni/source/blender/editors/mesh/editface.c
    branches/soc-2008-mxcurioni/source/blender/editors/mesh/editmesh.c
    branches/soc-2008-mxcurioni/source/blender/editors/mesh/editmesh_mods.c
    branches/soc-2008-mxcurioni/source/blender/editors/mesh/editmesh_tools.c
    branches/soc-2008-mxcurioni/source/blender/editors/mesh/mesh_intern.h
    branches/soc-2008-mxcurioni/source/blender/editors/mesh/mesh_ops.c
    branches/soc-2008-mxcurioni/source/blender/editors/space_view3d/drawobject.c
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.h
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Nature.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.h
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/view_map/FEdgeXDetector.h
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/view_map/Silhouette.h
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/winged_edge/Nature.h
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/winged_edge/WEdge.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/winged_edge/WEdge.h
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/winged_edge/WXEdge.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/winged_edge/WXEdge.h
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.h
    branches/soc-2008-mxcurioni/source/blender/makesdna/DNA_freestyle_types.h
    branches/soc-2008-mxcurioni/source/blender/makesdna/DNA_mesh_types.h
    branches/soc-2008-mxcurioni/source/blender/makesdna/DNA_meshdata_types.h
    branches/soc-2008-mxcurioni/source/blender/makesdna/DNA_scene_types.h
    branches/soc-2008-mxcurioni/source/blender/makesdna/DNA_userdef_types.h
    branches/soc-2008-mxcurioni/source/blender/makesrna/intern/rna_mesh.c
    branches/soc-2008-mxcurioni/source/blender/makesrna/intern/rna_scene.c
    branches/soc-2008-mxcurioni/source/blender/makesrna/intern/rna_userdef.c
    branches/soc-2008-mxcurioni/source/blender/render/intern/include/render_types.h
    branches/soc-2008-mxcurioni/source/blender/render/intern/source/convertblender.c

Modified: branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/parameter_editor.py
===================================================================
--- branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/parameter_editor.py	2011-10-06 01:51:01 UTC (rev 40810)
+++ branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/parameter_editor.py	2011-10-06 02:04:43 UTC (rev 40811)
@@ -752,6 +752,32 @@
             return False
         return True
 
+class FaceMarkBothUP1D(UnaryPredicate1D):
+    def __call__(self, inter): # ViewEdge
+        fe = inter.fedgeA()
+        while fe is not None:
+            if fe.isSmooth():
+                if fe.faceMark():
+                    return True
+            else:
+                if fe.aFaceMark() and fe.bFaceMark():
+                    return True
+            fe = fe.nextEdge()
+        return False
+
+class FaceMarkOneUP1D(UnaryPredicate1D):
+    def __call__(self, inter): # ViewEdge
+        fe = inter.fedgeA()
+        while fe is not None:
+            if fe.isSmooth():
+                if fe.faceMark():
+                    return True
+            else:
+                if fe.aFaceMark() or fe.bFaceMark():
+                    return True
+            fe = fe.nextEdge()
+        return False
+
 # predicates for splitting
 
 class MaterialBoundaryUP0D(UnaryPredicate0D):
@@ -825,6 +851,8 @@
                 flags |= Nature.SUGGESTIVE_CONTOUR
             if lineset.select_material_boundary:
                 flags |= Nature.MATERIAL_BOUNDARY
+            if lineset.select_edge_mark:
+                flags |= Nature.EDGE_MARK
             if flags != Nature.NO_FEATURE:
                 edge_type_criteria.append(pyNatureUP1D(flags))
         else:
@@ -842,6 +870,8 @@
                 edge_type_criteria.append(pyNatureUP1D(Nature.SUGGESTIVE_CONTOUR))
             if lineset.select_material_boundary:
                 edge_type_criteria.append(pyNatureUP1D(Nature.MATERIAL_BOUNDARY))
+            if lineset.select_edge_mark:
+                edge_type_criteria.append(pyNatureUP1D(Nature.EDGE_MARK))
         if lineset.select_contour:
             edge_type_criteria.append(ContourUP1D())
         if lineset.select_external_contour:
@@ -854,6 +884,15 @@
             if lineset.edge_type_negation == "EXCLUSIVE":
                 upred = NotUP1D(upred)
             selection_criteria.append(upred)
+    # prepare selection criteria by face marks
+    if lineset.select_by_face_marks:
+        if lineset.face_mark_condition == "BOTH":
+            upred = FaceMarkBothUP1D()
+        else:
+            upred = FaceMarkOneUP1D()
+        if lineset.face_mark_negation == "EXCLUSIVE":
+            upred = NotUP1D(upred)
+        selection_criteria.append(upred)
     # prepare selection criteria by group of objects
     if lineset.select_by_group:
         if lineset.group is not None and len(lineset.group.objects) > 0:

Modified: branches/soc-2008-mxcurioni/release/scripts/startup/bl_ui/properties_render.py
===================================================================
--- branches/soc-2008-mxcurioni/release/scripts/startup/bl_ui/properties_render.py	2011-10-06 01:51:01 UTC (rev 40810)
+++ branches/soc-2008-mxcurioni/release/scripts/startup/bl_ui/properties_render.py	2011-10-06 02:04:43 UTC (rev 40811)
@@ -253,11 +253,20 @@
                     sub.prop(lineset, "select_valley")
                     sub.prop(lineset, "select_suggestive_contour")
                     sub.prop(lineset, "select_material_boundary")
+                    sub.prop(lineset, "select_edge_mark")
                     sub = row.column()
                     sub.prop(lineset, "select_contour")
                     sub.prop(lineset, "select_external_contour")
                     col.separator() # XXX
 
+                col.prop(lineset, "select_by_face_marks")
+                if lineset.select_by_face_marks:
+                    row = col.row()
+                    row.prop(lineset, "face_mark_negation", expand=True)
+                    row = col.row()
+                    row.prop(lineset, "face_mark_condition", expand=True)
+                    col.separator() # XXX
+
                 col.prop(lineset, "select_by_group")
                 if lineset.select_by_group:
                     col.prop(lineset, "group")

Modified: branches/soc-2008-mxcurioni/release/scripts/startup/bl_ui/space_view3d.py
===================================================================
--- branches/soc-2008-mxcurioni/release/scripts/startup/bl_ui/space_view3d.py	2011-10-06 01:51:01 UTC (rev 40810)
+++ branches/soc-2008-mxcurioni/release/scripts/startup/bl_ui/space_view3d.py	2011-10-06 02:04:43 UTC (rev 40811)
@@ -1605,6 +1605,11 @@
 
         layout.separator()
 
+        layout.operator("mesh.mark_freestyle_edge")
+        layout.operator("mesh.mark_freestyle_edge", text="Clear Freestyle Edge").clear = True
+
+        layout.separator()
+
         layout.operator("mesh.edge_rotate", text="Rotate Edge CW").direction = 'CW'
         layout.operator("mesh.edge_rotate", text="Rotate Edge CCW").direction = 'CCW'
 
@@ -1647,6 +1652,11 @@
 
         layout.separator()
 
+        layout.operator("mesh.mark_freestyle_face")
+        layout.operator("mesh.mark_freestyle_face", text="Clear Freestyle Face").clear = True
+
+        layout.separator()
+
         layout.operator("mesh.quads_convert_to_tris")
         layout.operator("mesh.tris_convert_to_quads")
         layout.operator("mesh.edge_flip")
@@ -2170,6 +2180,8 @@
         col.prop(mesh, "show_edge_bevel_weight", text="Bevel Weights")
         col.prop(mesh, "show_edge_seams", text="Seams")
         col.prop(mesh, "show_edge_sharp", text="Sharp")
+        col.prop(mesh, "show_freestyle_edge_marks", text="Freestyle Edge Marks")
+        col.prop(mesh, "show_freestyle_face_marks", text="Freestyle Face Marks")
 
         col.separator()
         col.label(text="Normals:")

Modified: branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/BME_conversions.c
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/BME_conversions.c	2011-10-06 01:51:01 UTC (rev 40810)
+++ branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/BME_conversions.c	2011-10-06 02:04:43 UTC (rev 40811)
@@ -303,6 +303,7 @@
 		e->flag = eed->f & SELECT;
 		if(eed->sharp) e->flag |= ME_SHARP;
 		if(eed->seam) e->flag |= ME_SEAM;
+		if(eed->freestyle) e->flag |= ME_FREESTYLE_EDGE;
 		//XXX if(eed->h & EM_FGON) e->flag |= ME_FGON;
 		if(eed->h & 1) e->flag |= ME_HIDE;
 		eed->tmp.e = (EditEdge*)e;
@@ -395,6 +396,7 @@
 			eed->bweight = e->bweight;
 			if(e->flag & ME_SEAM) eed->seam = 1;
 			if(e->flag & ME_SHARP) eed->sharp = 1;
+			if(e->flag & ME_FREESTYLE_EDGE) eed->freestyle = 1;
 			if(e->flag & SELECT) eed->f |= SELECT;
 			//XXX if(e->flag & ME_FGON) eed->h= EM_FGON; // 2 different defines!
 			if(e->flag & ME_HIDE) eed->h |= 1;

Modified: branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/DerivedMesh.c
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/DerivedMesh.c	2011-10-06 01:51:01 UTC (rev 40810)
+++ branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/DerivedMesh.c	2011-10-06 02:04:43 UTC (rev 40811)
@@ -1199,6 +1199,7 @@
 	edge_r->flag = ME_EDGEDRAW|ME_EDGERENDER;
 	if (ee->seam) edge_r->flag |= ME_SEAM;
 	if (ee->sharp) edge_r->flag |= ME_SHARP;
+	if (ee->freestyle) edge_r->flag |= ME_FREESTYLE_EDGE;
 #if 0
 	/* this needs setup of f2 field */
 	if (!ee->f2) edge_r->flag |= ME_LOOSEEDGE;
@@ -1299,6 +1300,7 @@
 		edge_r->flag = ME_EDGEDRAW|ME_EDGERENDER;
 		if (ee->seam) edge_r->flag |= ME_SEAM;
 		if (ee->sharp) edge_r->flag |= ME_SHARP;
+		if (ee->freestyle) edge_r->flag |= ME_FREESTYLE_EDGE;
 #if 0
 		/* this needs setup of f2 field */
 		if (!ee->f2) edge_r->flag |= ME_LOOSEEDGE;

Modified: branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/cdderivedmesh.c
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/cdderivedmesh.c	2011-10-06 01:51:01 UTC (rev 40810)
+++ branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/cdderivedmesh.c	2011-10-06 02:04:43 UTC (rev 40811)
@@ -1651,6 +1651,7 @@
 		
 		if(eed->seam) med->flag |= ME_SEAM;
 		if(eed->sharp) med->flag |= ME_SHARP;
+		if(eed->freestyle) med->flag |= ME_FREESTYLE_EDGE;
 		if(!eed->f2) med->flag |= ME_LOOSEEDGE;
 
 		*index = i;

Modified: branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/subsurf_ccg.c
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/subsurf_ccg.c	2011-10-06 01:51:01 UTC (rev 40810)
+++ branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/subsurf_ccg.c	2011-10-06 02:04:43 UTC (rev 40811)
@@ -751,7 +751,7 @@
 
 		edgeFlag = (ccgdm->edgeFlags)? &ccgdm->edgeFlags[i]: NULL;
 		if(edgeFlag)
-			flags |= (*edgeFlag & (ME_SEAM | ME_SHARP))
+			flags |= (*edgeFlag & (ME_SEAM | ME_SHARP | ME_FREESTYLE_EDGE))
 					 | ME_EDGEDRAW | ME_EDGERENDER;
 		else
 			flags |= ME_EDGEDRAW | ME_EDGERENDER;
@@ -936,7 +936,7 @@
 
 		if(edgeFlags) {
 			if(edgeIdx != -1) {
-				flags |= (edgeFlags[index] & (ME_SEAM | ME_SHARP))
+				flags |= (edgeFlags[index] & (ME_SEAM | ME_SHARP | ME_FREESTYLE_EDGE))
 						 | ME_EDGEDRAW | ME_EDGERENDER;
 			}
 		} else {

Modified: branches/soc-2008-mxcurioni/source/blender/blenlib/BLI_editVert.h
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/blenlib/BLI_editVert.h	2011-10-06 01:51:01 UTC (rev 40810)
+++ branches/soc-2008-mxcurioni/source/blender/blenlib/BLI_editVert.h	2011-10-06 02:04:43 UTC (rev 40811)
@@ -102,7 +102,7 @@
 		float			fp;
 	} tmp;
 	short f1, f2;	/* short, f1 is (ab)used in subdiv */
-	unsigned char f, h, dir, seam, sharp;
+	unsigned char f, h, dir, seam, sharp, freestyle;
 	float crease;
 	float bweight;
 	short fast; 		/* only 0 or 1, for editmesh_fastmalloc */

Modified: branches/soc-2008-mxcurioni/source/blender/editors/include/UI_resources.h
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/editors/include/UI_resources.h	2011-10-06 01:51:01 UTC (rev 40810)

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list