[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [58060] trunk/blender: Fix for incorrect clipping of Freestyle strokes when the viewport preview is used .
Tamito Kajiyama
rd6t-kjym at asahi-net.or.jp
Sun Jul 7 17:29:00 CEST 2013
Revision: 58060
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=58060
Author: kjym3
Date: 2013-07-07 15:29:00 +0000 (Sun, 07 Jul 2013)
Log Message:
-----------
Fix for incorrect clipping of Freestyle strokes when the viewport preview is used.
Modified Paths:
--------------
trunk/blender/release/scripts/freestyle/style_modules/parameter_editor.py
trunk/blender/source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp
trunk/blender/source/blender/freestyle/intern/stroke/Canvas.h
trunk/blender/source/blender/freestyle/intern/stroke/ContextFunctions.cpp
trunk/blender/source/blender/freestyle/intern/stroke/ContextFunctions.h
Modified: trunk/blender/release/scripts/freestyle/style_modules/parameter_editor.py
===================================================================
--- trunk/blender/release/scripts/freestyle/style_modules/parameter_editor.py 2013-07-07 14:23:20 UTC (rev 58059)
+++ trunk/blender/release/scripts/freestyle/style_modules/parameter_editor.py 2013-07-07 15:29:00 UTC (rev 58060)
@@ -32,7 +32,7 @@
FalseBP1D, FalseUP1D, GuidingLinesShader, Interface0DIterator, Nature, Noise, Normal2DF0D, Operators, \
PolygonalizationShader, QuantitativeInvisibilityF1D, QuantitativeInvisibilityUP1D, SamplingShader, \
SpatialNoiseShader, StrokeAttribute, StrokeShader, TipRemoverShader, TrueBP1D, TrueUP1D, UnaryPredicate0D, \
- UnaryPredicate1D, VertexOrientation2DF0D, WithinImageBoundaryUP1D
+ UnaryPredicate1D, VertexOrientation2DF0D, WithinImageBoundaryUP1D, ContextFunctions
from Functions0D import CurveMaterialF0D
from PredicatesU1D import pyNatureUP1D
from logical_operators import AndUP1D, NotUP1D, OrUP1D
@@ -1046,17 +1046,7 @@
selection_criteria.append(upred)
# prepare selection criteria by image border
if lineset.select_by_image_border:
- fac = scene.render.resolution_percentage / 100.0
- w = scene.render.resolution_x * fac
- h = scene.render.resolution_y * fac
- 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)
+ xmin, ymin, xmax, ymax = ContextFunctions.get_border()
upred = WithinImageBoundaryUP1D(xmin, ymin, xmax, ymax)
selection_criteria.append(upred)
# select feature edges
Modified: trunk/blender/source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp
===================================================================
--- trunk/blender/source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp 2013-07-07 14:23:20 UTC (rev 58059)
+++ trunk/blender/source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp 2013-07-07 15:29:00 UTC (rev 58060)
@@ -79,6 +79,26 @@
return PyLong_FromLong(ContextFunctions::GetCanvasHeightCF());
}
+static char ContextFunctions_get_border___doc__[] =
+".. method:: get_border()\n"
+"\n"
+" Returns the border.\n"
+"\n"
+" :return: A tuple of 4 numbers (xmin, ymin, xmax, ymax).\n"
+" :rtype: tuple\n";
+
+static PyObject *
+ContextFunctions_get_border(PyObject *self)
+{
+ BBox<Vec2i> border(ContextFunctions::GetBorderCF());
+ PyObject *v = PyTuple_New(4);
+ PyTuple_SET_ITEM(v, 0, PyLong_FromLong(border.getMin().x()));
+ PyTuple_SET_ITEM(v, 1, PyLong_FromLong(border.getMin().y()));
+ PyTuple_SET_ITEM(v, 2, PyLong_FromLong(border.getMax().x()));
+ PyTuple_SET_ITEM(v, 3, PyLong_FromLong(border.getMax().y()));
+ return v;
+}
+
static char ContextFunctions_load_map___doc__[] =
".. function:: load_map(file_name, map_name, num_levels=4, sigma=1.0)\n"
"\n"
@@ -232,6 +252,8 @@
ContextFunctions_get_canvas_width___doc__},
{"get_canvas_height", (PyCFunction)ContextFunctions_get_canvas_height, METH_NOARGS,
ContextFunctions_get_canvas_height___doc__},
+ {"get_border", (PyCFunction)ContextFunctions_get_border, METH_NOARGS,
+ ContextFunctions_get_border___doc__},
{"load_map", (PyCFunction)ContextFunctions_load_map, METH_VARARGS | METH_KEYWORDS,
ContextFunctions_load_map___doc__},
{"read_map_pixel", (PyCFunction)ContextFunctions_read_map_pixel, METH_VARARGS | METH_KEYWORDS,
Modified: trunk/blender/source/blender/freestyle/intern/stroke/Canvas.h
===================================================================
--- trunk/blender/source/blender/freestyle/intern/stroke/Canvas.h 2013-07-07 14:23:20 UTC (rev 58059)
+++ trunk/blender/source/blender/freestyle/intern/stroke/Canvas.h 2013-07-07 15:29:00 UTC (rev 58060)
@@ -195,6 +195,7 @@
virtual int width() const = 0;
virtual int height() const = 0;
+ virtual BBox<Vec2i> border() const = 0;
virtual BBox<Vec3r> scene3DBBox() const = 0;
inline const StrokeRenderer *renderer() const
Modified: trunk/blender/source/blender/freestyle/intern/stroke/ContextFunctions.cpp
===================================================================
--- trunk/blender/source/blender/freestyle/intern/stroke/ContextFunctions.cpp 2013-07-07 14:23:20 UTC (rev 58059)
+++ trunk/blender/source/blender/freestyle/intern/stroke/ContextFunctions.cpp 2013-07-07 15:29:00 UTC (rev 58060)
@@ -51,6 +51,11 @@
return Canvas::getInstance()->height();
}
+BBox<Vec2i> GetBorderCF()
+{
+ return Canvas::getInstance()->border();
+}
+
void LoadMapCF(const char *iFileName, const char *iMapName, unsigned iNbLevels, float iSigma)
{
return Canvas::getInstance()->loadMap(iFileName, iMapName, iNbLevels, iSigma);
Modified: trunk/blender/source/blender/freestyle/intern/stroke/ContextFunctions.h
===================================================================
--- trunk/blender/source/blender/freestyle/intern/stroke/ContextFunctions.h 2013-07-07 14:23:20 UTC (rev 58059)
+++ trunk/blender/source/blender/freestyle/intern/stroke/ContextFunctions.h 2013-07-07 15:29:00 UTC (rev 58060)
@@ -54,10 +54,15 @@
unsigned GetCanvasWidthCF();
// GetCanvasHeight
-/*! Returns the canvas width */
+/*! Returns the canvas height */
LIB_STROKE_EXPORT
unsigned GetCanvasHeightCF();
+// GetBorder
+/*! Returns the border */
+LIB_STROKE_EXPORT
+BBox<Vec2i> GetBorderCF();
+
// Load map
/*! Loads an image map for further reading */
LIB_STROKE_EXPORT
More information about the Bf-blender-cvs
mailing list