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:
Tamito Kajiyama 2014-05-26 10:53:42 +09:00
parent 6b7bee6cd7
commit fce731a175
Notes: blender-bot 2023-02-14 11:57:23 +01:00
Referenced by issue #36425, freestyle edge marks not working
2 changed files with 4 additions and 56 deletions

View File

@ -1122,54 +1122,6 @@ class 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 = {
'MEAN': IntegrationType.MEAN,
'MIN': IntegrationType.MIN,
@ -1318,9 +1270,6 @@ def process(layer_name, lineset_name):
Operators.sort(bpred)
# prepare a list of stroke shaders
shaders_list = []
###
shaders_list.append(StrokeCleaner())
###
for m in linestyle.geometry_modifiers:
if not m.use:
continue

View File

@ -1147,17 +1147,16 @@ static Stroke *createStroke(Interface1D& inter)
StrokeVertex *sv;
std::vector<StrokeVertex *>::iterator it = overlapping_vertices.begin();
if (!reverse) {
for (int n = 1; n < nvert; n++) {
for (int n = 0; n < nvert; n++) {
sv = (*it);
sv->setPoint(sv->getPoint() + offset * n);
sv->setPoint(sv->getPoint() + offset * (n + 1));
++it;
}
}
else {
int last = nvert - 1;
for (int n = 0; n < last; n++) {
for (int n = 0; n < nvert; n++) {
sv = (*it);
sv->setPoint(sv->getPoint() + offset * (last - n));
sv->setPoint(sv->getPoint() + offset * (nvert - n));
++it;
}
}