diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2011-02-22 04:39:56 +0300 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2011-02-22 04:39:56 +0300 |
commit | ecd76d99d64d76846f9f1ed24c54a82b6e9ad041 (patch) | |
tree | c58c376e7c82cbb42838630c3a109cdf16019b84 /source/blender/freestyle/intern/stroke/Curve.cpp | |
parent | 70aa63306ad3ec1402275ed623b745d06d14db18 (diff) |
Consolidation of stroke drawing.
Fixed a complicated bug that caused a failure of CurvePoint::getFEdge()
which had affected a number of C/Python API functions such as MaterialF0D.
The current view map building procedure may generate ViewEdges whose
two-dimensional (2D) length is almost or exactly zero. Such a zero-length
ViewEdge is possibly chained with other ViewEdges to form a stroke. When
the stroke is finally generated by Operators::create(), an attempt to remove
redundant vertices at the same 2D point is made. This possibly breaks the
links of ViewEdges on top of which the stroke has been built, and eventually
result in a fatal error of CurvePoint::getFEdge() when API functions that
rely on this method are called from within a style module.
The present fix addresses this issue by automatically removing zero-length
ViewEdges (and Chains of them) before stroke drawing is started and after
splitting is performed (e.g., using Operators::sequentialSplit()).
Diffstat (limited to 'source/blender/freestyle/intern/stroke/Curve.cpp')
-rwxr-xr-x | source/blender/freestyle/intern/stroke/Curve.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/source/blender/freestyle/intern/stroke/Curve.cpp b/source/blender/freestyle/intern/stroke/Curve.cpp index a4bf2ae85f2..d865d9be8e4 100755 --- a/source/blender/freestyle/intern/stroke/Curve.cpp +++ b/source/blender/freestyle/intern/stroke/Curve.cpp @@ -195,8 +195,10 @@ FEdge *CurvePoint::fedge() FEdge* CurvePoint::getFEdge(Interface0D& inter) { CurvePoint* iVertexB = dynamic_cast<CurvePoint*>(&inter); - if (!iVertexB) + if (!iVertexB) { + cerr << "Warning: CurvePoint::getFEdge() failed to cast the given 0D element to CurvePoint." << endl; return 0; + } if(((__A == iVertexB->__A) && (__B == iVertexB->__B)) || ((__A == iVertexB->__B) && (__B == iVertexB->__A))) @@ -245,8 +247,15 @@ FEdge* CurvePoint::getFEdge(Interface0D& inter) if((_t2d != 0) && (iVertexB->_t2d == 1)) return __A->getFEdge(*__B); } - - cerr << "Warning: you should not be there..." << endl; +#if 0 + printf("__A 0x%p p (%f, %f)\n", __A, __A->getPoint2D().x(), __A->getPoint2D().y()); + printf("__B 0x%p p (%f, %f)\n", __B, __B->getPoint2D().x(), __B->getPoint2D().y()); + printf("iVertexB->A() 0x%p p (%f, %f)\n", iVertexB->A(), iVertexB->A()->getPoint2D().x(), iVertexB->A()->getPoint2D().y()); + printf("iVertexB->B() 0x%p p (%f, %f)\n", iVertexB->B(), iVertexB->B()->getPoint2D().x(), iVertexB->B()->getPoint2D().y()); + printf("_t2d %f p (%f, %f)\n", _t2d, getPoint2D().x(), getPoint2D().y()); + printf("iVertexB->t2d() %f p (%f, %f)\n", iVertexB->t2d(), iVertexB->getPoint2D().x(), iVertexB->getPoint2D().y()); +#endif + cerr << "Warning: CurvePoint::getFEdge() failed." << endl; return 0; } |