diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2010-12-04 02:17:49 +0300 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2010-12-04 02:17:49 +0300 |
commit | a9e50bde82acb3befa179213a458d8e1f8844aea (patch) | |
tree | 37a43a68d125a4be5b462bc533bd89dcdcba1937 /release/scripts/freestyle | |
parent | 1bfcba31d2e1010a912f9cd283e348b833e43a27 (diff) |
A few attempts to reduce the amount of memory consumption in Freestyle.
* Made changes to the Controller so that dynamically allocated
memory areas (e.g. imported mesh data, winged edges, and a view map)
are released soon after they become unnecessary.
* Added a new feature edge selection criterion based on image border.
When the "Selection by Image Border" option is enabled, feature edges
are selected only if they are within the border of the image being
rendered. The border is defined either by the frame size or a border
region (specified by the Shift-B key in a 3D View window). When large
scenes are rendered, this clipping by the image border leads to less
memory consumption.
* Enabled the "Silhouette", "Border", and "Crease" edge types of
the Selection by Edge Types option by default.
When no edge types are specified, all feature edges including "Ridge",
"Valley" and "Suggestive Contour" are detected at the cost of extra
memory consumption. Disabling these three edge types and enabling
some other edge type leads to less memory consumption. This change
is intended to help new Freestyle users by providing a typical, low
memory consumption default setting.
* Slightly rearranged the UI controls for feature edge selection.
Diffstat (limited to 'release/scripts/freestyle')
-rw-r--r-- | release/scripts/freestyle/style_modules/parameter_editor.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/release/scripts/freestyle/style_modules/parameter_editor.py b/release/scripts/freestyle/style_modules/parameter_editor.py index 83c5bcaef80..cf4a87d2ee5 100644 --- a/release/scripts/freestyle/style_modules/parameter_editor.py +++ b/release/scripts/freestyle/style_modules/parameter_editor.py @@ -312,6 +312,22 @@ class ObjectNamesUP1D(UnaryPredicate1D): return not found return found +class WithinImageBorderUP1D(UnaryPredicate1D): + def __init__(self, xmin, xmax, ymin, ymax): + UnaryPredicate1D.__init__(self) + self._xmin = xmin + self._xmax = xmax + self._ymin = ymin + self._ymax = ymax + def getName(self): + return "WithinImageBorderUP1D" + def __call__(self, inter): + return self.withinBorder(inter.A()) or self.withinBorder(inter.B()) + def withinBorder(self, vert): + x = vert.getProjectedX() + y = vert.getProjectedY() + return self._xmin <= x <= self._xmax and self._ymin <= y <= self._ymax + # Stroke caps def iter_stroke_vertices(stroke): @@ -525,6 +541,20 @@ def process(layer_name, lineset_name): names = dict((ob.name, True) for ob in lineset.group.objects) upred = ObjectNamesUP1D(names, lineset.group_negation == 'EXCLUSIVE') selection_criteria.append(upred) + # prepare selection criteria by image border + if lineset.select_by_image_border: + w = scene.render.resolution_x + h = scene.render.resolution_y + if scene.render.use_border: + xmin = scene.render.border_min_x * w + xmax = scene.render.border_max_x * w + ymin = scene.render.border_min_y * h + ymax = scene.render.border_max_y * h + else: + xmin, xmax = 0.0, float(w) + ymin, ymax = 0.0, float(h) + upred = WithinImageBorderUP1D(xmin, xmax, ymin, ymax) + selection_criteria.append(upred) # do feature edge selection upred = join_unary_predicates(selection_criteria, AndUP1D) if upred is None: |