svn merge ^/trunk/blender -r55357:55372
[blender.git] / release / scripts / startup / bl_ui / properties_render.py
index b5de3701b494147f8ffe1a8673386bed5c7880bf..0d3317810196cdb1073dd607d2808d9f55dfe23f 100644 (file)
@@ -19,7 +19,7 @@
 
 # <pep8 compliant>
 import bpy
-from bpy.types import Menu, Panel, UIList
+from bpy.types import Menu, Panel
 
 
 class RENDER_MT_presets(Menu):
@@ -43,18 +43,6 @@ class RENDER_MT_framerate_presets(Menu):
     draw = Menu.draw_preset
 
 
-class RENDER_UL_renderlayers(UIList):
-    def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
-        # assert(isinstance(item, bpy.types.SceneRenderLayer)
-        layer = item
-        if self.layout_type in {'DEFAULT', 'COMPACT'}:
-            layout.label(text=layer.name, translate=False, icon_value=icon)
-            layout.prop(layer, "use", text="", index=index)
-        elif self.layout_type in {'GRID'}:
-            layout.alignment = 'CENTER'
-            layout.label(text="", icon_value=icon)
-
-
 class RenderButtonsPanel():
     bl_space_type = 'PROPERTIES'
     bl_region_type = 'WINDOW'
@@ -63,8 +51,18 @@ class RenderButtonsPanel():
 
     @classmethod
     def poll(cls, context):
-        rd = context.scene.render
-        return context.scene and (rd.engine in cls.COMPAT_ENGINES)
+        scene = context.scene
+        return scene and (scene.render.engine in cls.COMPAT_ENGINES)
+
+
+class RenderFreestyleButtonsPanel(RenderButtonsPanel):
+    # COMPAT_ENGINES must be defined in each subclass, external engines can add themselves here
+
+    @classmethod
+    def poll(cls, context):
+        if not super().poll(context):
+            return False
+        return bpy.app.build_options.freestyle
 
 
 class RENDER_PT_render(RenderButtonsPanel, Panel):
@@ -84,110 +82,6 @@ class RENDER_PT_render(RenderButtonsPanel, Panel):
         layout.prop(rd, "display_mode", text="Display")
 
 
-class RENDER_PT_layers(RenderButtonsPanel, Panel):
-    bl_label = "Layers"
-    bl_options = {'DEFAULT_CLOSED'}
-    COMPAT_ENGINES = {'BLENDER_RENDER'}
-
-    def draw(self, context):
-        layout = self.layout
-
-        scene = context.scene
-        rd = scene.render
-
-        row = layout.row()
-        row.template_list("RENDER_UL_renderlayers", "", rd, "layers", rd.layers, "active_index", rows=2)
-
-        col = row.column(align=True)
-        col.operator("scene.render_layer_add", icon='ZOOMIN', text="")
-        col.operator("scene.render_layer_remove", icon='ZOOMOUT', text="")
-
-        row = layout.row()
-        rl = rd.layers.active
-        if rl:
-            row.prop(rl, "name")
-        row.prop(rd, "use_single_layer", text="", icon_only=True)
-
-        split = layout.split()
-
-        col = split.column()
-        col.prop(scene, "layers", text="Scene")
-        col.label(text="")
-        col.prop(rl, "light_override", text="Light")
-        col.prop(rl, "material_override", text="Material")
-
-        col = split.column()
-        col.prop(rl, "layers", text="Layer")
-        col.label(text="Mask Layers:")
-        col.prop(rl, "layers_zmask", text="")
-
-        layout.separator()
-        layout.label(text="Include:")
-
-        split = layout.split()
-
-        col = split.column()
-        col.prop(rl, "use_zmask")
-        row = col.row()
-        row.prop(rl, "invert_zmask", text="Negate")
-        row.active = rl.use_zmask
-        col.prop(rl, "use_all_z")
-
-        col = split.column()
-        col.prop(rl, "use_solid")
-        col.prop(rl, "use_halo")
-        col.prop(rl, "use_ztransp")
-
-        col = split.column()
-        col.prop(rl, "use_sky")
-        col.prop(rl, "use_edge_enhance")
-        col.prop(rl, "use_strand")
-
-        layout.separator()
-
-        split = layout.split()
-
-        col = split.column()
-        col.label(text="Passes:")
-        col.prop(rl, "use_pass_combined")
-        col.prop(rl, "use_pass_z")
-        col.prop(rl, "use_pass_vector")
-        col.prop(rl, "use_pass_normal")
-        col.prop(rl, "use_pass_uv")
-        col.prop(rl, "use_pass_mist")
-        col.prop(rl, "use_pass_object_index")
-        col.prop(rl, "use_pass_material_index")
-        col.prop(rl, "use_pass_color")
-
-        col = split.column()
-        col.label()
-        col.prop(rl, "use_pass_diffuse")
-        row = col.row()
-        row.prop(rl, "use_pass_specular")
-        row.prop(rl, "exclude_specular", text="")
-        row = col.row()
-        row.prop(rl, "use_pass_shadow")
-        row.prop(rl, "exclude_shadow", text="")
-        row = col.row()
-        row.prop(rl, "use_pass_emit")
-        row.prop(rl, "exclude_emit", text="")
-        row = col.row()
-        row.prop(rl, "use_pass_ambient_occlusion")
-        row.prop(rl, "exclude_ambient_occlusion", text="")
-        row = col.row()
-        row.prop(rl, "use_pass_environment")
-        row.prop(rl, "exclude_environment", text="")
-        row = col.row()
-        row.prop(rl, "use_pass_indirect")
-        row.prop(rl, "exclude_indirect", text="")
-        row = col.row()
-        row.prop(rl, "use_pass_reflection")
-        row.prop(rl, "exclude_reflection", text="")
-        row = col.row()
-        row.prop(rl, "use_pass_refraction")
-        row.prop(rl, "exclude_refraction", text="")
-
-
 class RENDER_PT_dimensions(RenderButtonsPanel, Panel):
     bl_label = "Dimensions"
     COMPAT_ENGINES = {'BLENDER_RENDER'}
@@ -414,6 +308,29 @@ class RENDER_PT_post_processing(RenderButtonsPanel, Panel):
         sub.prop(rd, "edge_color", text="")
 
 
+class RENDER_PT_freestyle(RenderFreestyleButtonsPanel, Panel):
+    bl_label = "Freestyle"
+    bl_options = {'DEFAULT_CLOSED'}
+    COMPAT_ENGINES = {'BLENDER_RENDER'}
+
+    def draw_header(self, context):
+        rd = context.scene.render
+        self.layout.prop(rd, "use_freestyle", text="")
+
+    def draw(self, context):
+        rd = context.scene.render
+
+        layout = self.layout
+        layout.active = rd.use_freestyle
+
+        row = layout.row()
+        row.label(text="Line Thickness:")
+        row.prop(rd, "line_thickness_mode", expand=True)
+        row = layout.row()
+        row.active = (rd.line_thickness_mode == 'ABSOLUTE')
+        row.prop(rd, "unit_line_thickness")
+
+
 class RENDER_PT_stamp(RenderButtonsPanel, Panel):
     bl_label = "Stamp"
     bl_options = {'DEFAULT_CLOSED'}