diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-04-24 16:20:17 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-04-26 18:06:14 +0300 |
commit | 67b014af484ad4ba6667e3cf9907422bedc8238a (patch) | |
tree | 68408128f8377b864c7b77be7c91b1fcead601b7 /release/scripts/startup | |
parent | c490428bd4dff75fb371777d4e95ea270c77ea94 (diff) |
Workspaces: active view layer now always comes from workspace, not scene.
Both the scene and workspace had an active view layer, and it was confusing
which settings were being used or displayed where. Now we always have one,
so there is no mismatch.
The "View Layers" tab in the properties editor is now "View Layer", no longer
showing a list of layers. Instead view layers can be added and removed with
the workspace view layer selector. They are also listed and selectable in the
outliner.
Single layer rendering uses the active view layer from the workspace.
This fixes bugs where the wrong active view layer was used, but more places
remain that are wrong and are now using the first view layer in the scene.
These are all marked with BKE_view_layer_context_active_PLACEHOLDER.
Diffstat (limited to 'release/scripts/startup')
-rw-r--r-- | release/scripts/startup/bl_operators/freestyle.py | 6 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/properties_freestyle.py | 18 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/properties_view_layer.py | 34 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/space_node.py | 2 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/space_topbar.py | 8 |
5 files changed, 27 insertions, 41 deletions
diff --git a/release/scripts/startup/bl_operators/freestyle.py b/release/scripts/startup/bl_operators/freestyle.py index 0cfe78879db..d3023f8e582 100644 --- a/release/scripts/startup/bl_operators/freestyle.py +++ b/release/scripts/startup/bl_operators/freestyle.py @@ -47,14 +47,14 @@ class SCENE_OT_freestyle_fill_range_by_selection(bpy.types.Operator): @classmethod def poll(cls, context): - view_layer = context.scene.view_layers.active + view_layer = context.view_layer return view_layer and view_layer.freestyle_settings.linesets.active def execute(self, context): import sys scene = context.scene - view_layer = scene.view_layers.active + view_layer = context.view_layer lineset = view_layer.freestyle_settings.linesets.active linestyle = lineset.linestyle # Find the modifier to work on @@ -207,7 +207,7 @@ class SCENE_OT_freestyle_module_open(bpy.types.Operator): @classmethod def poll(cls, context): - view_layer = context.scene.view_layers.active + view_layer = context.view_layer return view_layer and view_layer.freestyle_settings.mode == 'SCRIPT' def invoke(self, context, event): diff --git a/release/scripts/startup/bl_ui/properties_freestyle.py b/release/scripts/startup/bl_ui/properties_freestyle.py index 84ebb21c703..a9c9d512335 100644 --- a/release/scripts/startup/bl_ui/properties_freestyle.py +++ b/release/scripts/startup/bl_ui/properties_freestyle.py @@ -71,11 +71,11 @@ class ViewLayerFreestyleButtonsPanel: @classmethod def poll(cls, context): scene = context.scene - rd = context.scene.render + rd = scene.render with_freestyle = bpy.app.build_options.freestyle return (scene and with_freestyle and rd.use_freestyle and - scene.view_layers.active and(context.engine in cls.COMPAT_ENGINES)) + (context.engine in cls.COMPAT_ENGINES)) class ViewLayerFreestyleEditorButtonsPanel(ViewLayerFreestyleButtonsPanel): @@ -85,7 +85,7 @@ class ViewLayerFreestyleEditorButtonsPanel(ViewLayerFreestyleButtonsPanel): def poll(cls, context): if not super().poll(context): return False - view_layer = context.scene.view_layers.active + view_layer = context.view_layer return view_layer and view_layer.freestyle_settings.mode == 'EDITOR' @@ -117,7 +117,7 @@ class VIEWLAYER_PT_freestyle(ViewLayerFreestyleButtonsPanel, Panel): layout = self.layout scene = context.scene - view_layer = scene.view_layers.active + view_layer = context.view_layer freestyle = view_layer.freestyle_settings layout.active = view_layer.use_freestyle @@ -186,7 +186,7 @@ class VIEWLAYER_PT_freestyle_lineset(ViewLayerFreestyleEditorButtonsPanel, Panel scene = context.scene rd = scene.render - view_layer = scene.view_layers.active + view_layer = context.view_layer freestyle = view_layer.freestyle_settings lineset = freestyle.linesets.active @@ -378,7 +378,7 @@ class VIEWLAYER_PT_freestyle_linestyle(ViewLayerFreestyleEditorButtonsPanel, Pan row = box.row(align=True) row.prop(modifier, "curvature_min") row.prop(modifier, "curvature_max") - freestyle = context.scene.view_layers.active.freestyle_settings + freestyle = context.view_layer.freestyle_settings if not freestyle.use_smoothness: message = "Enable Face Smoothness to use this modifier" self.draw_modifier_box_error(col.box(), modifier, message) @@ -433,7 +433,7 @@ class VIEWLAYER_PT_freestyle_linestyle(ViewLayerFreestyleEditorButtonsPanel, Pan row = box.row(align=True) row.prop(modifier, "curvature_min") row.prop(modifier, "curvature_max") - freestyle = context.scene.view_layers.active.freestyle_settings + freestyle = context.view_layer.freestyle_settings if not freestyle.use_smoothness: message = "Enable Face Smoothness to use this modifier" self.draw_modifier_box_error(col.box(), modifier, message) @@ -505,7 +505,7 @@ class VIEWLAYER_PT_freestyle_linestyle(ViewLayerFreestyleEditorButtonsPanel, Pan row = box.row(align=True) row.prop(modifier, "curvature_min") row.prop(modifier, "curvature_max") - freestyle = context.scene.view_layers.active.freestyle_settings + freestyle = context.view_layer.freestyle_settings if not freestyle.use_smoothness: message = "Enable Face Smoothness to use this modifier" self.draw_modifier_box_error(col.box(), modifier, message) @@ -614,7 +614,7 @@ class VIEWLAYER_PT_freestyle_linestyle(ViewLayerFreestyleEditorButtonsPanel, Pan layout = self.layout scene = context.scene - view_layer = scene.view_layers.active + view_layer = context.view_layer lineset = view_layer.freestyle_settings.linesets.active layout.active = view_layer.use_freestyle diff --git a/release/scripts/startup/bl_ui/properties_view_layer.py b/release/scripts/startup/bl_ui/properties_view_layer.py index 28fd5bf666f..842a3f36fa2 100644 --- a/release/scripts/startup/bl_ui/properties_view_layer.py +++ b/release/scripts/startup/bl_ui/properties_view_layer.py @@ -32,21 +32,8 @@ class ViewLayerButtonsPanel: return (context.engine in cls.COMPAT_ENGINES) -class VIEWLAYER_UL_viewlayers(UIList): - def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index): - # assert(isinstance(item, bpy.types.SceneLayer) - layer = item - if self.layout_type in {'DEFAULT', 'COMPACT'}: - layout.prop(layer, "name", text="", icon_value=icon, emboss=False) - layout.prop(layer, "use", text="", index=index) - elif self.layout_type == 'GRID': - layout.alignment = 'CENTER' - layout.label("", icon_value=icon) - - -class VIEWLAYER_PT_layers(ViewLayerButtonsPanel, Panel): - bl_label = "Layer List" - bl_options = {'HIDE_HEADER'} +class VIEWLAYER_PT_layer(ViewLayerButtonsPanel, Panel): + bl_label = "View Layer" COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_CLAY', 'BLENDER_EEVEE'} def draw(self, context): @@ -54,16 +41,10 @@ class VIEWLAYER_PT_layers(ViewLayerButtonsPanel, Panel): scene = context.scene rd = scene.render + layer = bpy.context.view_layer - row = layout.row() - col = row.column() - col.template_list("VIEWLAYER_UL_viewlayers", "", scene, "view_layers", scene.view_layers, "active_index", rows=2) - - col = row.column() - sub = col.column(align=True) - sub.operator("scene.view_layer_add", icon='ZOOMIN', text="") - sub.operator("scene.view_layer_remove", icon='ZOOMOUT', text="") - col.prop(rd, "use_single_layer", icon_only=True) + layout.prop(layer, "use", text="Use for Rendering"); + layout.prop(rd, "use_single_layer", text="Render Single Layer") class VIEWLAYER_PT_clay_settings(ViewLayerButtonsPanel, Panel): @@ -385,7 +366,7 @@ class VIEWLAYER_PT_eevee_layer_passes(ViewLayerButtonsPanel, Panel): scene = context.scene rd = scene.render - view_layer = scene.view_layers.active + view_layer = context.view_layer split = layout.split() @@ -405,8 +386,7 @@ class VIEWLAYER_PT_eevee_layer_passes(ViewLayerButtonsPanel, Panel): classes = ( - VIEWLAYER_UL_viewlayers, - VIEWLAYER_PT_layers, + VIEWLAYER_PT_layer, VIEWLAYER_PT_clay_settings, VIEWLAYER_PT_eevee_sampling, VIEWLAYER_PT_eevee_shadows, diff --git a/release/scripts/startup/bl_ui/space_node.py b/release/scripts/startup/bl_ui/space_node.py index f97c88be0ad..23d822bbf1f 100644 --- a/release/scripts/startup/bl_ui/space_node.py +++ b/release/scripts/startup/bl_ui/space_node.py @@ -79,7 +79,7 @@ class NODE_HT_header(Header): row.prop(snode_id, "use_nodes") if snode.shader_type == 'LINESTYLE': - view_layer = context.scene.view_layers.active + view_layer = context.view_layer lineset = view_layer.freestyle_settings.linesets.active if lineset is not None: row = layout.row() diff --git a/release/scripts/startup/bl_ui/space_topbar.py b/release/scripts/startup/bl_ui/space_topbar.py index 3eded5e0b46..b6d88dc5a6e 100644 --- a/release/scripts/startup/bl_ui/space_topbar.py +++ b/release/scripts/startup/bl_ui/space_topbar.py @@ -85,7 +85,13 @@ class TOPBAR_HT_upper_bar(Header): # Active workspace view-layer is retrieved through window, not through workspace. layout.template_ID(window, "scene", new="scene.new", unlink="scene.delete") - layout.template_search(window, "view_layer", scene, "view_layers") + + row = layout.row(align=True) + row.template_search( + window, "view_layer", + scene, "view_layers", + new="scene.view_layer_add", + unlink="scene.view_layer_remove") class TOPBAR_HT_lower_bar(Header): |