Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2014-08-20 05:37:02 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2014-08-20 05:37:41 +0400
commiteb8964fb7f19463acdf441592a29dbfc1ff3ab29 (patch)
tree34fb8734d0e1c4286000823e536f1f2583358323 /release
parent4b4ae8374f26bbeb31b14aa82c2d6d329291f495 (diff)
Fix T41464: Material Boundary bug in Freestyle.
The reported issue was caused by an old bug combined with another bug introduced by recent Freestyle Python API updates. The old bug was that a mutable reference to CurvePoint was treated as if it were immutable. Iteration over CurvePoint objects is implemented by the C++ CurvePointIterator class, whose dereference method CurvePointIterator::operator*() returns a reference to a mutable data member (probably originally intended for better performance). Hence the returned reference may vary upon iteration over different CurvePoints. This implementation detail was overlooked and the returned reference was treated as immutable (which is the case in fact for other Interface0D subclasses except for CurvePoint). This bug was surprisingly old as it existed before the beginning of Freestyle integration into Blender. The other bug was in the MaterialBoundaryUP0D predicate class that was not properly handling the end of iteration. It is noted that when the iter() and next() built-in functions are applied to Interface0DIterator, it is no longer possible to reliably check the end of iteration by the .is_end property of the iterator. Namely, the .is_end property works as expected only when iteration is carried out in combination with the conventional .increment() and .decrement() methods of the iterator. For this reason the commit rBb408d8af31c9 was partly reverted to recover the previous definition of MaterialBoundaryUP0D.
Diffstat (limited to 'release')
-rw-r--r--release/scripts/freestyle/modules/parameter_editor.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/release/scripts/freestyle/modules/parameter_editor.py b/release/scripts/freestyle/modules/parameter_editor.py
index 6de53c623a6..6ab4184651a 100644
--- a/release/scripts/freestyle/modules/parameter_editor.py
+++ b/release/scripts/freestyle/modules/parameter_editor.py
@@ -814,17 +814,17 @@ class FaceMarkOneUP1D(UnaryPredicate1D):
class MaterialBoundaryUP0D(UnaryPredicate0D):
def __call__(self, it):
- if (it.is_begin or it.is_end):
+ if it.is_begin:
return False
- else:
- it.decrement()
- prev = it.object
- svert = next(it)
- succ = next(it)
-
- fe = svert.get_fedge(prev)
+ it_prev = Interface0DIterator(it)
+ it_prev.decrement()
+ v = it.object
+ it.increment()
+ if it.is_end:
+ return False
+ fe = v.get_fedge(it_prev.object)
idx1 = fe.material_index if fe.is_smooth else fe.material_index_left
- fe = svert.get_fedge(succ)
+ fe = v.get_fedge(it.object)
idx2 = fe.material_index if fe.is_smooth else fe.material_index_left
return idx1 != idx2