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>2014-07-07 10:54:46 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2014-07-07 11:19:51 +0400
commit7915d7277ac8c605f016f30f943080556244fb59 (patch)
tree4e137b5a4e98fad4911815a938cae8fd00783030 /release/scripts/startup/bl_ui/properties_freestyle.py
parentdc40928087e9b1183a6df2b38bb6a9a610e4ed13 (diff)
Per-material line color settings for Freestyle.
New properties 'line_color' and 'line_priority' are added to Material ID data blocks. The 'line_color' property allows users to specify a per-material line color that can be used as a Freestyle line color through Material color modifiers of line style settings. The new line color property is intended to provide a solution for line color stylization when a proper Freestyle support for Cycles is implemented (likely as part of the upcoming Blender 2.72 release; see Patch D632). Materials in Cycles are usually set up using shader nodes, and Freestyle won't be capable of retrieving colors and other properties from node-based materials any soon. The new line color property of materials addresses this foreseen limitation by providing artists with an intuitive alternative mean to specify line colors on a per-material basis independently from node trees. The 'line_priority' property gives users a way to control line colors at material boundaries. When a line is drawn along a feature edge at material boundaries, one of the two materials on both sides of the edge has to be picked up to determine the line color. So far there was no way to control this selection (which was in effect at random). Now the material with a higher line color priority will be selected. The new per-material line settings are shown in the new Freestyle Line tab in the Material context of the Properties window (only when Freestyle is enabled).
Diffstat (limited to 'release/scripts/startup/bl_ui/properties_freestyle.py')
-rw-r--r--release/scripts/startup/bl_ui/properties_freestyle.py34
1 files changed, 33 insertions, 1 deletions
diff --git a/release/scripts/startup/bl_ui/properties_freestyle.py b/release/scripts/startup/bl_ui/properties_freestyle.py
index 31a638d3c7e..c5716dff86d 100644
--- a/release/scripts/startup/bl_ui/properties_freestyle.py
+++ b/release/scripts/startup/bl_ui/properties_freestyle.py
@@ -344,7 +344,7 @@ class RENDERLAYER_PT_freestyle_linestyle(RenderLayerFreestyleEditorButtonsPanel,
row.prop(modifier, "material_attribute", text="")
sub = row.column()
sub.prop(modifier, "use_ramp")
- if modifier.material_attribute in {'DIFF', 'SPEC'}:
+ if modifier.material_attribute in {'LINE', 'DIFF', 'SPEC'}:
sub.active = True
show_ramp = modifier.use_ramp
else:
@@ -691,5 +691,37 @@ class RENDERLAYER_PT_freestyle_linestyle(RenderLayerFreestyleEditorButtonsPanel,
pass
+# Material properties
+
+class MaterialFreestyleButtonsPanel():
+ bl_space_type = 'PROPERTIES'
+ bl_region_type = 'WINDOW'
+ bl_context = "material"
+ # COMPAT_ENGINES must be defined in each subclass, external engines can add themselves here
+
+ @classmethod
+ def poll(cls, context):
+ scene = context.scene
+ material = context.material
+ with_freestyle = bpy.app.build_options.freestyle
+ return with_freestyle and material and scene and scene.render.use_freestyle and \
+ (scene.render.engine in cls.COMPAT_ENGINES)
+
+
+class MATERIAL_PT_freestyle_line(MaterialFreestyleButtonsPanel, Panel):
+ bl_label = "Freestyle Line"
+ bl_options = {'DEFAULT_CLOSED'}
+ COMPAT_ENGINES = {'BLENDER_RENDER'} # TODO: 'CYCLES'
+
+ def draw(self, context):
+ layout = self.layout
+
+ mat = context.material
+
+ row = layout.row()
+ row.prop(mat, "line_color", text="")
+ row.prop(mat, "line_priority", text="Priority")
+
+
if __name__ == "__main__": # only for live edit.
bpy.utils.register_module(__name__)