Blender Git Loki

Git Commits -> Revision 840891e

Revision 840891e by Tamito Kajiyama (master)
June 16, 2014, 01:12 (GMT)
D545: Freestyle Python API: new methods for Stroke and StrokeVertexIterator.

This revision extends the Freestyle Python API to make for style module writing
easier.

- freestyle.types.Stroke: A proper support for reversed() is implemented. It
works the same with other Python sequence objects (returns an iterator starting
from the end). This is in effect equivalent to Stroke.stroke_vertices_end().

- freestyle.types.StrokeVertexIterator: An incremented, decremented and reversed
method are added. The first two methods return a new StrokeVertexIterator
object that has been incremented and decremented, respectively. The reversed
method returns a new StrokeVertexIterator object that will traverse stroke
vertices in the opposite direction.

- freestyle.types.Interface0DIterator: Its constructor now accepts a Stroke
object to create an Interface0DIterator that traverses stroke vertices. This is
in effect equivalent to Stroke.vertices_begin(). The new API makes stroke
shaders involving function calls much simpler as illustrated below:

# in the old API
it = stroke.stroke_vertices_begin()
for vert in it:
result = somefunc(Interface0DIterator(it))

# in the new API
it = Interface0DIterator(stroke)
for vert in it:
result = somefunc(it)


Differential Revision: https://developer.blender.org/D545

Reviewers: kjym3

Commit Details:

Full Hash: 840891e22a12c7bbb7c3b8d086ef0c6ff11a24d9
Parent Commit: ea3bca7
Lines Changed: +91, -14

3 Modified Paths:

/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp (+16, -0) (Diff)
/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp (+12, -3) (Diff)
/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp (+63, -11) (Diff)
Tehnyt: Miika HämäläinenViimeksi päivitetty: 07.11.2014 14:18MiikaH:n Sivut a.k.a. MiikaHweb | 2003-2021