Fix for thinning strokes at intersections between visible and background hidden lines.
This commit is intended to fully fix the problem described in https://developer.blender.org/T36425#19 (see also the previous commit rB08528f577dcb). Addition of a small offset (to avoid singularity in stroke rendering due to overlapping vertices) was not performed for all overlapping vertices. Removed the StrokeCleaner and related helper functions which were added as a temporary workaround in rB2a5b6d9c8f16.
This commit is contained in:
@@ -1122,54 +1122,6 @@ class Seed:
|
|||||||
_seed = Seed()
|
_seed = Seed()
|
||||||
|
|
||||||
|
|
||||||
### T.K. 07-Aug-2013 Temporary fix for unexpected line gaps
|
|
||||||
|
|
||||||
def iter_three_segments(stroke):
|
|
||||||
n = stroke.stroke_vertices_size()
|
|
||||||
if n >= 4:
|
|
||||||
it1 = stroke.stroke_vertices_begin()
|
|
||||||
it2 = stroke.stroke_vertices_begin()
|
|
||||||
it2.increment()
|
|
||||||
it3 = stroke.stroke_vertices_begin()
|
|
||||||
it3.increment()
|
|
||||||
it3.increment()
|
|
||||||
it4 = stroke.stroke_vertices_begin()
|
|
||||||
it4.increment()
|
|
||||||
it4.increment()
|
|
||||||
it4.increment()
|
|
||||||
while not it4.is_end:
|
|
||||||
yield (it1.object, it2.object, it3.object, it4.object)
|
|
||||||
it1.increment()
|
|
||||||
it2.increment()
|
|
||||||
it3.increment()
|
|
||||||
it4.increment()
|
|
||||||
|
|
||||||
|
|
||||||
def is_tvertex(svertex):
|
|
||||||
return type(svertex.viewvertex) is TVertex
|
|
||||||
|
|
||||||
|
|
||||||
class StrokeCleaner(StrokeShader):
|
|
||||||
def shade(self, stroke):
|
|
||||||
for sv1, sv2, sv3, sv4 in iter_three_segments(stroke):
|
|
||||||
seg1 = sv2.point - sv1.point
|
|
||||||
seg2 = sv3.point - sv2.point
|
|
||||||
seg3 = sv4.point - sv3.point
|
|
||||||
if not ((is_tvertex(sv2.first_svertex) and is_tvertex(sv2.second_svertex)) or
|
|
||||||
(is_tvertex(sv3.first_svertex) and is_tvertex(sv3.second_svertex))):
|
|
||||||
continue
|
|
||||||
if seg1.dot(seg2) < 0.0 and seg2.dot(seg3) < 0.0 and seg2.length < 0.01:
|
|
||||||
#print(sv2.first_svertex.viewvertex)
|
|
||||||
#print(sv2.second_svertex.viewvertex)
|
|
||||||
#print(sv3.first_svertex.viewvertex)
|
|
||||||
#print(sv3.second_svertex.viewvertex)
|
|
||||||
p2 = mathutils.Vector(sv2.point)
|
|
||||||
p3 = mathutils.Vector(sv3.point)
|
|
||||||
sv2.point = p3
|
|
||||||
sv3.point = p2
|
|
||||||
stroke.update_length()
|
|
||||||
|
|
||||||
|
|
||||||
integration_types = {
|
integration_types = {
|
||||||
'MEAN': IntegrationType.MEAN,
|
'MEAN': IntegrationType.MEAN,
|
||||||
'MIN': IntegrationType.MIN,
|
'MIN': IntegrationType.MIN,
|
||||||
@@ -1318,9 +1270,6 @@ def process(layer_name, lineset_name):
|
|||||||
Operators.sort(bpred)
|
Operators.sort(bpred)
|
||||||
# prepare a list of stroke shaders
|
# prepare a list of stroke shaders
|
||||||
shaders_list = []
|
shaders_list = []
|
||||||
###
|
|
||||||
shaders_list.append(StrokeCleaner())
|
|
||||||
###
|
|
||||||
for m in linestyle.geometry_modifiers:
|
for m in linestyle.geometry_modifiers:
|
||||||
if not m.use:
|
if not m.use:
|
||||||
continue
|
continue
|
||||||
|
|||||||
@@ -1147,17 +1147,16 @@ static Stroke *createStroke(Interface1D& inter)
|
|||||||
StrokeVertex *sv;
|
StrokeVertex *sv;
|
||||||
std::vector<StrokeVertex *>::iterator it = overlapping_vertices.begin();
|
std::vector<StrokeVertex *>::iterator it = overlapping_vertices.begin();
|
||||||
if (!reverse) {
|
if (!reverse) {
|
||||||
for (int n = 1; n < nvert; n++) {
|
for (int n = 0; n < nvert; n++) {
|
||||||
sv = (*it);
|
sv = (*it);
|
||||||
sv->setPoint(sv->getPoint() + offset * n);
|
sv->setPoint(sv->getPoint() + offset * (n + 1));
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
int last = nvert - 1;
|
for (int n = 0; n < nvert; n++) {
|
||||||
for (int n = 0; n < last; n++) {
|
|
||||||
sv = (*it);
|
sv = (*it);
|
||||||
sv->setPoint(sv->getPoint() + offset * (last - n));
|
sv->setPoint(sv->getPoint() + offset * (nvert - n));
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user