Fix T42198: Linked lines only work with linked objects.

The reported issue was caused by a backward incompatibility due to careless
code changes made when per-material Freestyle line colors were introduced
in rB7915d7277ac8c605f016f30f943080556244fb59.  In 2.71 line style
Material color/alpha/thickness modifiers was retrieving alpha transparency
from Material.alpha, whereas in 2.72 Material.line_color[3] was referenced.

The present fix reverts the aforementioned code changes.

This issue is a regression from 2.71, so the fix is appropriate for inclusion in
the 2.72a release.
This commit is contained in:
Tamito Kajiyama 2014-10-14 00:53:08 +09:00
parent bdc41ca756
commit f4a260fb3c
Notes: blender-bot 2023-02-14 09:57:43 +01:00
Referenced by issue #42198, Linked lines only work with linked objects
4 changed files with 7 additions and 3 deletions

View File

@ -217,8 +217,6 @@ def iter_material_value(stroke, func, attribute):
# main
if attribute == 'LINE':
value = rgb_to_bw(*material.line[0:3])
elif attribute == 'ALPHA':
value = material.line[3]
elif attribute == 'DIFF':
value = rgb_to_bw(*material.diffuse[0:3])
elif attribute == 'SPEC':
@ -230,6 +228,8 @@ def iter_material_value(stroke, func, attribute):
value = material.line[1]
elif attribute == 'LINE_B':
value = material.line[2]
elif attribute == 'LINE_A':
value = material.line[3]
# diffuse seperate
elif attribute == 'DIFF_R':
value = material.diffuse[0]
@ -237,6 +237,8 @@ def iter_material_value(stroke, func, attribute):
value = material.diffuse[1]
elif attribute == 'DIFF_B':
value = material.diffuse[2]
elif attribute == 'ALPHA':
value = material.diffuse[3]
# specular seperate
elif attribute == 'SPEC_R':
value = material.specular[0]

View File

@ -442,7 +442,7 @@ LineStyleModifier *BKE_linestyle_alpha_modifier_add(FreestyleLineStyle *linestyl
{
LineStyleAlphaModifier_Material *p = (LineStyleAlphaModifier_Material *)m;
p->curve = curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
p->mat_attr = LS_MODIFIER_MATERIAL_ALPHA;
p->mat_attr = LS_MODIFIER_MATERIAL_LINE_A;
break;
}
default:

View File

@ -203,6 +203,7 @@ typedef struct LineStyleThicknessModifier_DistanceFromObject {
#define LS_MODIFIER_MATERIAL_LINE_R 12
#define LS_MODIFIER_MATERIAL_LINE_G 13
#define LS_MODIFIER_MATERIAL_LINE_B 14
#define LS_MODIFIER_MATERIAL_LINE_A 15
typedef struct LineStyleColorModifier_Material {
struct LineStyleModifier modifier;

View File

@ -698,6 +698,7 @@ static void rna_def_modifier_material_common(StructRNA *srna)
{LS_MODIFIER_MATERIAL_LINE_R, "LINE_R", 0, "Line Color Red", ""},
{LS_MODIFIER_MATERIAL_LINE_G, "LINE_G", 0, "Line Color Green", ""},
{LS_MODIFIER_MATERIAL_LINE_B, "LINE_B", 0, "Line Color Blue", ""},
{LS_MODIFIER_MATERIAL_LINE_A, "LINE_A", 0, "Line Color Alpha", ""},
{LS_MODIFIER_MATERIAL_DIFF, "DIFF", 0, "Diffuse Color", ""},
{LS_MODIFIER_MATERIAL_DIFF_R, "DIFF_R", 0, "Diffuse Color Red", ""},
{LS_MODIFIER_MATERIAL_DIFF_G, "DIFF_G", 0, "Diffuse Color Green", ""},