The reported problem is a visual artefact (extra lines) generated by
ChainingIterators.pySketchyChainingIterator used for sketchy chaining with the Same Object
option disabled in the Parameter Editor mode. The issue is caused by an inconsistency in
the internal data structure (i.e., view map). For now this fatal error condition is addressed
to avoid visually incorrect results. Another fix will follow to address the cause of the
internal inconsistency.
* Fix for wild card import statements (e.g., "from Freestyle import *") was done.
Now import statements are either without using "from" or with all imported names
explicitly listed.
* GNU GPL header blocks were added to Python programs. Additional code clean-up
was also made.
* Removed freestyle_init.py and extra-lines.sml that were no longer used.
* Proper handling of keyword arguments was implemented in Operators and ContextFunctions,
as well as in methods of Interface0D, Interface1D, Iterator, their subclasses, Noise and
IntegrationType.
* Operators' methods and functions in the ContextFunctions module were renamed from
CamelCase to lower cases + underscores. Style modules were updated accordingly.
* Additional code clean-up was also made.
API users no longer need to define them in user-defined Functions, Predicates and StrokeShaders.
Also removed all .getName() and .getExactTypeName() definitions in pre-defined Functions,
Predicates and StrokeShaders subclasses.
Handling of keyword arguments in Python wrapper class constructors was revised.
This revision is mainly focused on Interface0D, Interface1D, Iterator, and
their subclasses, as well as a few additional view map component classes.
Implementation notes: Because of the extensive use of constructor overloading
in the underlying C++ classes, the corresponding Python wrappers try to parse
arguments through multiple calls of PyArg_ParseTupleAndKeywords() if needed.
The downside of this implementation is that most argument errors result in the
same error message ("invalid argument(s)") without indicating what is wrong.
For now this issue is left for future work.
* Now the instantiation of ViewVertex is prohibited since the underlying
C++ class is an abstract class.
* Removed the .cast_to_interface0diterator() method from CurvePointIterator
and StrokeVertexIterator. Instead the constructor of Interface0DIterator now
accepts the instances of these two iterator classes to construct a nested
Interface0DIterator instance that can be passed to Function0D functor objects.
Specifically, an iterator 'it' is passed to a functor 'func' as follows:
func(Interface0DIterator(it))
instead of:
func(it.cast_to_interface0diterator())
* Boolean arguments of class constructors only accept values of boolean type.
Input values of other types are considered as error.
* Additional code clean-up was made.
Major API updates were made as in part 3 to address code review comments.
This revision focuses on Python wrappers of C++ iterators.
* Most getter/setter methods were reimplemented as attributes using PyGetSetDef.
* The naming of methods and attributes was fixed to follow the naming conventions
of the Blender Python API (i.e., lower case + underscores for methods and attributes,
and CamelCase for classes). The only irregular naming change is the following, to
better indicate the functionality:
- ChainingIterator: getVertex --> next_vertex
* In addition, some code clean-up was done in both C++ and Python. Also duplicated
definitions of predicate classes were removed.
Major API updates were made to address code review comments.
This revision mostly focuses on Python wrappers of C++ 0D and 1D elements (i.e.,
Interface0D and Interface1D, as well as their subclasses).
* Most getter/setter methods were reimplemented as attributes using PyGetSetDef.
Vector attributes are now implemented based on mathutils callbacks. Boolean
attributes now only accept boolean values.
* The __getitem__ method was removed and the Sequence protocol was used instead.
* The naming of methods and attributes was fixed to follow the naming conventions
of the Blender Python API (i.e., lower case + underscores for methods and attributes,
and CamelCase for classes). Some naming inconsistency within the Freestyle Python
API was also addressed.
* The Freestyle API had a number of method names including prefix/suffix "A" and
"B", and their meanings were inconsistent (i.e., referring to different things
depending on the classes). The names with these two letters were replaced with
more straightforward names. Also some attribute names were changed so as to indicate
the type of the value (e.g., FEdge.next_fedge instead of FEdge.next_edge) in line
with other names explicitly indicating what the value is (e.g., SVertex.viewvertex).
* In addition, some code clean-up was done in both C++ and Python.
Notes:
In summary, the following irregular naming changes were made through this revision
(those resulting from regular changes of naming conventions are not listed):
- CurvePoint: {A,B} --> {first,second}_svertex
- FEdge: vertex{A,B} --> {first,second}_svertex
- FEdge: {next,previous}Edge --> {next,previous}_fedge
- FEdgeSharp: normal{A,B} --> normal_{right,left}
- FEdgeSharp: {a,b}FaceMark --> face_mark_{right,left}
- FEdgeSharp: {a,b}Material --> material_{right,left}
- FEdgeSharp: {a,b}MaterialIndex --> material_index_{right,left}
- FrsCurve: empty --> is_empty
- FrsCurve: nSegments --> segments_size
- TVertex: mate() --> get_mate()
- ViewEdge: fedge{A,B} --> {first,last}_fedge
- ViewEdge: setaShape, aShape --> occlude
- ViewEdge: {A,B} --> {first,last}_viewvertex
- ViewMap: getScene3dBBox --> scene_bbox
This allows users to test the types of those objects that are returned
by API functions, by means of usual Python idioms such as "type(I) is T"
and "isinstance(I, T)".
* Removed all occurrences of ViewVertex::castToTVertex() in the following
modules and rewrote the code segments using it by means of the "type(I)
is T" idiom mentioned above:
ChainingIterators.py
PredicatesU1D.py
* Replaced all occurrences of vector.Vec2, vector.Vec3, Vec2f and Vec3f
by Blender.Mathutils.Vector in the following modules:
anisotropic_diffusion.py
Functions0D.py
shaders.py
sketchy_topology_broken.py
* shaders.py: Fixed NameError's concerning math.pow().
* shaders.py: Added a Python equivalent of getFEdge function, defined
in source\blender\freestyle\intern\view_map\Functions0D.cpp as follows:
FEdge* Functions0D::getFEdge(Interface0D& it1, Interface0D& it2) {
return it1.getFEdge(it2);
}
* shaders.py: Replaced fe.qi() by fe.viewedge().qi().
* contour.py: Fixed the import statement for freestyle_init.py.