[Bf-blender-cvs] [1819fa2] master: A follow-up to Patch D623: minor code updates and style cleanup.
Tamito Kajiyama
noreply at git.blender.org
Thu Jul 24 07:29:55 CEST 2014
Commit: 1819fa2b5aab703a0361d4312f19d2ee6cd7e51f
Author: Tamito Kajiyama
Date: Thu Jul 24 11:43:16 2014 +0900
Branches: master
https://developer.blender.org/rB1819fa2b5aab703a0361d4312f19d2ee6cd7e51f
A follow-up to Patch D623: minor code updates and style cleanup.
===================================================================
M release/scripts/freestyle/modules/freestyle/predicates.py
M release/scripts/freestyle/modules/freestyle/utils.py
M release/scripts/freestyle/modules/parameter_editor.py
===================================================================
diff --git a/release/scripts/freestyle/modules/freestyle/predicates.py b/release/scripts/freestyle/modules/freestyle/predicates.py
index e15820b..7192917 100644
--- a/release/scripts/freestyle/modules/freestyle/predicates.py
+++ b/release/scripts/freestyle/modules/freestyle/predicates.py
@@ -46,13 +46,13 @@ from _freestyle import (
# constructs for predicate definition in Python
from freestyle.types import (
BinaryPredicate1D,
+ Id,
IntegrationType,
+ Interface0DIterator,
Nature,
TVertex,
UnaryPredicate0D,
UnaryPredicate1D,
- Id,
- Interface0DIterator,
)
from freestyle.functions import (
Curvature2DAngleF0D,
@@ -160,7 +160,7 @@ class AndUP1D(UnaryPredicate1D):
self.predicates = predicates
# there are cases in which only one predicate is supplied (in the parameter editor)
if len(self.predicates) < 1:
- raise ValueError("Expected two or more UnaryPredicate1D, got ", len(predicates))
+ raise ValueError("Expected one or more UnaryPredicate1D, got ", len(predicates))
def __call__(self, inter):
return all(pred(inter) for pred in self.predicates)
@@ -172,7 +172,7 @@ class OrUP1D(UnaryPredicate1D):
self.predicates = predicates
# there are cases in which only one predicate is supplied (in the parameter editor)
if len(self.predicates) < 1:
- raise ValueError("Expected two or more UnaryPredicate1D, got ", len(predicates))
+ raise ValueError("Expected one or more UnaryPredicate1D, got ", len(predicates))
def __call__(self, inter):
return any(pred(inter) for pred in self.predicates)
diff --git a/release/scripts/freestyle/modules/freestyle/utils.py b/release/scripts/freestyle/modules/freestyle/utils.py
index b7f4020..0e9ae19 100644
--- a/release/scripts/freestyle/modules/freestyle/utils.py
+++ b/release/scripts/freestyle/modules/freestyle/utils.py
@@ -191,12 +191,21 @@ def iter_material_value(stroke, func, attribute):
for svert in it:
material = func(it)
# main
- if attribute == 'DIFF':
- value = rgb_to_bw(*material.diffuse[0:3])
+ if attribute == 'LINE':
+ value = rgb_to_bw(*material.line[0:3])
elif attribute == 'ALPHA':
- value = material.diffuse[3]
+ value = material.line[3]
+ elif attribute == 'DIFF':
+ value = rgb_to_bw(*material.diffuse[0:3])
elif attribute == 'SPEC':
value = rgb_to_bw(*material.specular[0:3])
+ # line seperate
+ elif attribute == 'LINE_R':
+ value = material.line[0]
+ elif attribute == 'LINE_G':
+ value = material.line[1]
+ elif attribute == 'LINE_B':
+ value = material.line[2]
# diffuse seperate
elif attribute == 'DIFF_R':
value = material.diffuse[0]
diff --git a/release/scripts/freestyle/modules/parameter_editor.py b/release/scripts/freestyle/modules/parameter_editor.py
index 92814e8..4c33e28 100644
--- a/release/scripts/freestyle/modules/parameter_editor.py
+++ b/release/scripts/freestyle/modules/parameter_editor.py
@@ -207,13 +207,13 @@ class ThicknessBlenderMixIn(ThicknessModifierMixIn):
v = self.blend(outer + inner, v)
# Part 1: blend
- if self.position == "CENTER":
+ if self.position == 'CENTER':
outer = inner = v * 0.5
- elif self.position == "INSIDE":
+ elif self.position == 'INSIDE':
outer, inner = 0, v
- elif self.position == "OUTSIDE":
+ elif self.position == 'OUTSIDE':
outer, inner = v, 0
- elif self.position == "RELATIVE":
+ elif self.position == 'RELATIVE':
outer, inner = v * self.ratio, v - (v * self.ratio)
else:
raise ValueError("unknown thickness position: " + position)
@@ -415,10 +415,10 @@ class ColorMaterialShader(ColorRampModifier):
if not self.use_ramp and self.attribute in attributes:
for svert in it:
material = self.func(it)
- if self.attribute == 'DIFF':
- b = material.diffuse[0:3]
- elif self.attribute == 'LINE':
+ if self.attribute == 'LINE':
b = material.line[0:3]
+ elif self.attribute == 'DIFF':
+ b = material.diffuse[0:3]
else:
b = material.specular[0:3]
a = svert.attribute.color
@@ -706,10 +706,10 @@ class DashedLineShader(StrokeShader):
def shade(self, stroke):
start = 0.0 # 2D curvilinear length
visible = True
- """ The extra 'sampling' term is added below, because the
- visibility attribute of the i-th vertex refers to the
- visibility of the stroke segment between the i-th and
- (i+1)-th vertices. """
+ # The extra 'sampling' term is added below, because the
+ # visibility attribute of the i-th vertex refers to the
+ # visibility of the stroke segment between the i-th and
+ # (i+1)-th vertices.
sampling = 1.0
it = stroke.stroke_vertices_begin(sampling)
pattern_cycle = cycle(self.pattern)
More information about the Bf-blender-cvs
mailing list