Better fix for T41464: Material Boundary bug in Freestyle.
The problem addressed here is that there was no mean to check if an iterator points the last of the elements being iterated over. Such checking is necessary to reliably dereference the iterator (i.e., calling the operator*() method of the underlying C++ iterator object). Now Interface0DIterator and StrokeVertexIterator have an .at_last property to check if an iterator points the last element. Using this new API feature, the present commit partly reverts the previous commit rBeb8964fb7f19 to better address T41464. Differential revision: https://developer.blender.org/D752 Author: flokkievids (Folkert de Vries) Reviewed by: kjym3 (Tamito Kajiyama)
This commit is contained in:
@@ -814,17 +814,14 @@ class FaceMarkOneUP1D(UnaryPredicate1D):
|
||||
|
||||
class MaterialBoundaryUP0D(UnaryPredicate0D):
|
||||
def __call__(self, it):
|
||||
if it.is_begin:
|
||||
# can't use only it.is_end here, see commit rBeb8964fb7f19
|
||||
if it.is_begin or it.at_last or it.is_end:
|
||||
return False
|
||||
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)
|
||||
it.decrement()
|
||||
prev, v, succ = next(it), next(it), next(it)
|
||||
fe = v.get_fedge(prev)
|
||||
idx1 = fe.material_index if fe.is_smooth else fe.material_index_left
|
||||
fe = v.get_fedge(it.object)
|
||||
fe = v.get_fedge(succ)
|
||||
idx2 = fe.material_index if fe.is_smooth else fe.material_index_left
|
||||
return idx1 != idx2
|
||||
|
||||
|
Reference in New Issue
Block a user