[Bf-blender-cvs] [7b6c77aa848] master: Fix T88015: Round end caps on Freestyle lines not shaped as documented

Philipp Oeser noreply at git.blender.org
Mon Jul 12 22:19:51 CEST 2021


Commit: 7b6c77aa84803e4268406e394aa4556ebf7980b0
Author: Philipp Oeser
Date:   Fri May 21 13:42:13 2021 +0200
Branches: master
https://developer.blender.org/rB7b6c77aa84803e4268406e394aa4556ebf7980b0

Fix T88015: Round end caps on Freestyle lines not shaped as documented

This might be an artistic choice, but round end caps are supposed to be
a "half circle centered at the end point of the line" as documented
here: https://docs.blender.org/manual/en/dev/render/freestyle/
parameter_editor/line_style/strokes.html#caps

They are a shashed half circle instead.

This patch makes this pure half circles [and also fixes the case where
thickness of beginning was used for both beginning and end of the
stroke]

Maniphest Tasks: T88015

Differential Revision: https://developer.blender.org/D11340

===================================================================

M	release/scripts/freestyle/modules/freestyle/shaders.py

===================================================================

diff --git a/release/scripts/freestyle/modules/freestyle/shaders.py b/release/scripts/freestyle/modules/freestyle/shaders.py
index 28b8aa9b23e..95e1c873657 100644
--- a/release/scripts/freestyle/modules/freestyle/shaders.py
+++ b/release/scripts/freestyle/modules/freestyle/shaders.py
@@ -1153,11 +1153,9 @@ class RoundCapShader(StrokeShader):
             return
         # calculate the number of additional vertices to form caps
         thickness_beg = sum(stroke[0].attribute.thickness)
-        caplen_beg = thickness_beg / 2.0
         nverts_beg = max(5, int(thickness_beg))
 
         thickness_end = sum(stroke[-1].attribute.thickness)
-        caplen_end = (thickness_end) / 2.0
         nverts_end = max(5, int(thickness_end))
 
         # adjust the total number of stroke vertices
@@ -1169,7 +1167,7 @@ class RoundCapShader(StrokeShader):
         # reshape the cap at the beginning of the stroke
         q, attr = buffer[1]
         p, attr = buffer[0]
-        direction = (p - q).normalized() * caplen_beg
+        direction = (p - q).normalized() * thickness_beg
         n = 1.0 / nverts_beg
         R, L = attr.thickness
         for t, svert in zip(range(nverts_beg, 0, -1), stroke):
@@ -1180,7 +1178,7 @@ class RoundCapShader(StrokeShader):
         # reshape the cap at the end of the stroke
         q, attr = buffer[-2]
         p, attr = buffer[-1]
-        direction = (p - q).normalized() * caplen_beg
+        direction = (p - q).normalized() * thickness_end
         n = 1.0 / nverts_end
         R, L = attr.thickness
         for t, svert in zip(range(nverts_end, 0, -1), reversed(stroke)):



More information about the Bf-blender-cvs mailing list