Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2011-08-13 04:05:25 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2011-08-13 04:05:25 +0400
commit5057810bda81733eb55acca1d3eb5c73317d4c55 (patch)
tree9185c0800162c5baf661754fd1224bd938b1dd22
parent820ced18b980aac1f97278094fb5842c580afbc7 (diff)
New line style option for splitting chains of feature edges at material boundaries.
-rw-r--r--release/scripts/freestyle/style_modules/parameter_editor.py23
-rw-r--r--release/scripts/startup/bl_ui/properties_render.py4
-rw-r--r--source/blender/makesdna/DNA_linestyle_types.h7
-rw-r--r--source/blender/makesrna/intern/rna_linestyle.c5
4 files changed, 36 insertions, 3 deletions
diff --git a/release/scripts/freestyle/style_modules/parameter_editor.py b/release/scripts/freestyle/style_modules/parameter_editor.py
index 2a9ce6c77c4..97ca75eef5d 100644
--- a/release/scripts/freestyle/style_modules/parameter_editor.py
+++ b/release/scripts/freestyle/style_modules/parameter_editor.py
@@ -633,6 +633,26 @@ class AndBP1D(BinaryPredicate1D):
def __call__(self, i1, i2):
return self.__pred1(i1, i2) and self.__pred2(i1, i2)
+# predicates for splitting
+
+class MaterialBoundaryUP0D(UnaryPredicate0D):
+ def __call__(self, it):
+ if it.isBegin():
+ return False
+ it_prev = Interface0DIterator(it)
+ it_prev.decrement()
+ v = it.getObject()
+ it.increment()
+ if it.isEnd():
+ return False
+ fe = v.getFEdge(it_prev.getObject())
+ idx1 = fe.materialIndex() if fe.isSmooth() else fe.bMaterialIndex()
+ print(1, fe, idx1)
+ fe = v.getFEdge(it.getObject())
+ idx2 = fe.materialIndex() if fe.isSmooth() else fe.bMaterialIndex()
+ print(2, fe, idx2)
+ return idx1 != idx2
+
# main function for parameter processing
def process(layer_name, lineset_name):
@@ -749,6 +769,9 @@ def process(layer_name, lineset_name):
Operators.sequentialSplit(DashedLineStartingUP0D(controller),
DashedLineStoppingUP0D(controller),
sampling)
+ # split chains of feature edges
+ if linestyle.material_boundary:
+ Operators.sequentialSplit(MaterialBoundaryUP0D())
# prepare a list of stroke shaders
color = linestyle.color
shaders_list = [
diff --git a/release/scripts/startup/bl_ui/properties_render.py b/release/scripts/startup/bl_ui/properties_render.py
index 68806b3b126..87e72839fbb 100644
--- a/release/scripts/startup/bl_ui/properties_render.py
+++ b/release/scripts/startup/bl_ui/properties_render.py
@@ -477,6 +477,10 @@ class RENDER_PT_freestyle_linestyle(RenderButtonsPanel, bpy.types.Panel):
col.label(text="Chaining:")
col.prop(linestyle, "same_object")
col.separator()
+ col.label(text="Splitting:")
+ sub = col.row(align=True)
+ sub.prop(linestyle, "material_boundary")
+ col.separator()
col.label(text="Caps:")
sub = col.row(align=True)
sub.prop(linestyle, "caps", expand=True)
diff --git a/source/blender/makesdna/DNA_linestyle_types.h b/source/blender/makesdna/DNA_linestyle_types.h
index 75662b9cd10..fc6ce430446 100644
--- a/source/blender/makesdna/DNA_linestyle_types.h
+++ b/source/blender/makesdna/DNA_linestyle_types.h
@@ -231,9 +231,10 @@ typedef struct LineStyleThicknessModifier_Material {
#define LS_PANEL_MISC 6
/* FreestyleLineStyle::flag */
-#define LS_DS_EXPAND 1 /* for animation editors */
-#define LS_SAME_OBJECT 2
-#define LS_DASHED_LINE 4
+#define LS_DS_EXPAND 1 /* for animation editors */
+#define LS_SAME_OBJECT 2
+#define LS_DASHED_LINE 4
+#define LS_MATERIAL_BOUNDARY 8
/* FreestyleLineStyle::caps */
#define LS_CAPS_BUTT 1
diff --git a/source/blender/makesrna/intern/rna_linestyle.c b/source/blender/makesrna/intern/rna_linestyle.c
index 79c69868067..a948f0032db 100644
--- a/source/blender/makesrna/intern/rna_linestyle.c
+++ b/source/blender/makesrna/intern/rna_linestyle.c
@@ -505,6 +505,11 @@ static void rna_def_linestyle(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Same Object", "If true, only feature edges of the same object are joined.");
RNA_def_property_update(prop, NC_SCENE, NULL);
+ prop= RNA_def_property(srna, "material_boundary", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", LS_MATERIAL_BOUNDARY);
+ RNA_def_property_ui_text(prop, "Material Boundary", "If true, chains of feature edges are split at material boundaries.");
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+
prop= RNA_def_property(srna, "use_dashed_line", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", LS_DASHED_LINE);
RNA_def_property_ui_text(prop, "Dashed Line", "Enable or disable dashed line.");