diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2010-12-03 02:50:10 +0300 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2010-12-03 02:50:10 +0300 |
commit | 1bfcba31d2e1010a912f9cd283e348b833e43a27 (patch) | |
tree | b2c546b991d4d9ee5d60e9e2fcd9afc870e28fe0 /release/scripts/freestyle | |
parent | 5eb840f910fafd0e1701f54a2713fdfcb0affa09 (diff) |
New feature edge selection criterion based on object groups.
The Freestyle tab in the Render buttons has a couple of new
options "Group" and "Group Negation". The Group option specifies
a group of objects (defined through the Groups tab in the Object
buttons), while the Group Negation value is either INCLUSIVE or
EXCLUSIVE. If INCLUSIVE, feature edges belonging to some object
in the group are selected. Otherwise, those feature edges not
belonging to any object in the group are selected.
Diffstat (limited to 'release/scripts/freestyle')
-rw-r--r-- | release/scripts/freestyle/style_modules/parameter_editor.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/release/scripts/freestyle/style_modules/parameter_editor.py b/release/scripts/freestyle/style_modules/parameter_editor.py index 1e59648f8c9..83c5bcaef80 100644 --- a/release/scripts/freestyle/style_modules/parameter_editor.py +++ b/release/scripts/freestyle/style_modules/parameter_editor.py @@ -299,6 +299,19 @@ def join_unary_predicates(upred_list, bpred): upred = bpred(upred, p) return upred +class ObjectNamesUP1D(UnaryPredicate1D): + def __init__(self, names, negative): + UnaryPredicate1D.__init__(self) + self._names = names + self._negative = negative + def getName(self): + return "ObjectNamesUP1D" + def __call__(self, viewEdge): + found = viewEdge.viewShape().getName() in self._names + if self._negative: + return not found + return found + # Stroke caps def iter_stroke_vertices(stroke): @@ -506,6 +519,12 @@ def process(layer_name, lineset_name): if lineset.edge_type_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: + names = dict((ob.name, True) for ob in lineset.group.objects) + upred = ObjectNamesUP1D(names, lineset.group_negation == 'EXCLUSIVE') + selection_criteria.append(upred) # do feature edge selection upred = join_unary_predicates(selection_criteria, AndUP1D) if upred is None: |