diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2011-10-06 06:04:43 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2011-10-06 06:04:43 +0400 |
commit | f84e8e76406a30bd15e6e55e41714e62826315aa (patch) | |
tree | e4a077ee05de21155421b35854162ad5f29c53b3 /release/scripts/freestyle | |
parent | cb4f6629279ba9792cc46114fe603bebff11c6a3 (diff) |
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.
Diffstat (limited to 'release/scripts/freestyle')
-rw-r--r-- | release/scripts/freestyle/style_modules/parameter_editor.py | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/release/scripts/freestyle/style_modules/parameter_editor.py b/release/scripts/freestyle/style_modules/parameter_editor.py index 1099618e4d1..68ba077277e 100644 --- a/release/scripts/freestyle/style_modules/parameter_editor.py +++ b/release/scripts/freestyle/style_modules/parameter_editor.py @@ -752,6 +752,32 @@ class LengthThresholdUP1D(UnaryPredicate1D): 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 @@ def process(layer_name, lineset_name): 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 @@ def process(layer_name, lineset_name): 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 @@ def process(layer_name, lineset_name): 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: |