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:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2018-04-24 16:20:17 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-04-26 18:06:14 +0300
commit67b014af484ad4ba6667e3cf9907422bedc8238a (patch)
tree68408128f8377b864c7b77be7c91b1fcead601b7 /source/blender/editors/space_outliner
parentc490428bd4dff75fb371777d4e95ea270c77ea94 (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 'source/blender/editors/space_outliner')
-rw-r--r--source/blender/editors/space_outliner/outliner_draw.c8
-rw-r--r--source/blender/editors/space_outliner/outliner_select.c18
-rw-r--r--source/blender/editors/space_outliner/outliner_tree.c12
-rw-r--r--source/blender/editors/space_outliner/space_outliner.c1
4 files changed, 22 insertions, 17 deletions
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index 765c77e4906..fad35060d72 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -442,11 +442,13 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar
if (te->ys + 2 * UI_UNIT_Y >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) {
if (tselem->type == TSE_R_LAYER && (soops->outlinevis == SO_SCENES)) {
/* View layer render toggle. */
+ ViewLayer *view_layer = te->directdata;
+
UI_block_emboss_set(block, UI_EMBOSS_NONE);
- bt = uiDefIconButBitI(block, UI_BTYPE_ICON_TOGGLE_N, VIEW_LAYER_RENDER, 0, ICON_RESTRICT_RENDER_OFF,
+ bt = uiDefIconButBitS(block, UI_BTYPE_ICON_TOGGLE_N, VIEW_LAYER_RENDER, 0, ICON_RESTRICT_RENDER_OFF,
(int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_RENDERX), te->ys, UI_UNIT_X,
- UI_UNIT_Y, te->directdata, 0, 0, 0, 0, TIP_("Use view layer for rendering"));
+ UI_UNIT_Y, &view_layer->flag, 0, 0, 0, 0, TIP_("Use view layer for rendering"));
UI_but_func_set(bt, restrictbutton_r_lay_cb, tselem->id, NULL);
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
@@ -1045,7 +1047,7 @@ static void tselem_draw_icon(uiBlock *block, int xmax, float x, float y, TreeSto
ICON_DRAW(ICON_OUTLINER_OB_GROUP_INSTANCE);
break;
case TSE_R_LAYER:
- ICON_DRAW(ICON_RENDERLAYERS);
+ ICON_DRAW(ICON_RENDER_RESULT);
break;
case TSE_LINKED_LAMP:
ICON_DRAW(ICON_LAMP_DATA);
diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c
index 800f36d35a0..a3dbab1b3fd 100644
--- a/source/blender/editors/space_outliner/outliner_select.c
+++ b/source/blender/editors/space_outliner/outliner_select.c
@@ -43,13 +43,14 @@
#include "BLI_utildefines.h"
#include "BLI_listbase.h"
+#include "BKE_armature.h"
#include "BKE_context.h"
#include "BKE_group.h"
-#include "BKE_object.h"
#include "BKE_layer.h"
+#include "BKE_object.h"
#include "BKE_scene.h"
#include "BKE_sequencer.h"
-#include "BKE_armature.h"
+#include "BKE_workspace.h"
#include "DEG_depsgraph.h"
@@ -75,7 +76,7 @@
/* ****************************************************** */
/* Outliner Element Selection/Activation on Click */
-static eOLDrawState tree_element_active_renderlayer(
+static eOLDrawState active_viewlayer(
bContext *C, Scene *UNUSED(scene), ViewLayer *UNUSED(sl), TreeElement *te, TreeStoreElem *tselem, const eOLSetState set)
{
Scene *sce;
@@ -85,12 +86,15 @@ static eOLDrawState tree_element_active_renderlayer(
return OL_DRAWSEL_NONE;
sce = (Scene *)tselem->id;
+ WorkSpace *workspace = CTX_wm_workspace(C);
+ ViewLayer *view_layer = te->directdata;
+
if (set != OL_SETSEL_NONE) {
- sce->active_view_layer = tselem->nr;
- WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, sce);
+ BKE_workspace_view_layer_set(workspace, view_layer, sce);
+ WM_event_add_notifier(C, NC_SCREEN | ND_LAYER, NULL);
}
else {
- return sce->active_view_layer == tselem->nr;
+ return BKE_workspace_view_layer_get(workspace, sce) == view_layer;
}
return OL_DRAWSEL_NONE;
}
@@ -782,7 +786,7 @@ eOLDrawState tree_element_type_active(
return tree_element_active_constraint(C, scene, view_layer, te, tselem, set);
case TSE_R_LAYER:
if (soops->outlinevis == SO_SCENES) {
- return tree_element_active_renderlayer(C, scene, view_layer, te, tselem, set);
+ return active_viewlayer(C, scene, view_layer, te, tselem, set);
}
else {
return OL_DRAWSEL_NONE;
diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c
index 60473853e18..2a5151a16ad 100644
--- a/source/blender/editors/space_outliner/outliner_tree.c
+++ b/source/blender/editors/space_outliner/outliner_tree.c
@@ -297,11 +297,10 @@ static void outliner_add_scene_contents(SpaceOops *soops, ListBase *lb, Scene *s
tenla->name = IFACE_("View Layers");
ViewLayer *view_layer;
- int a;
- for (a = 0, view_layer = sce->view_layers.first; view_layer; view_layer = view_layer->next, a++) {
- TreeElement *tenlay = outliner_add_element(soops, &tenla->subtree, sce, te, TSE_R_LAYER, a);
+ for (view_layer = sce->view_layers.first; view_layer; view_layer = view_layer->next) {
+ TreeElement *tenlay = outliner_add_element(soops, &tenla->subtree, sce, te, TSE_R_LAYER, 0);
tenlay->name = view_layer->name;
- tenlay->directdata = &view_layer->flag;
+ tenlay->directdata = view_layer;
}
/* Collections */
@@ -2198,10 +2197,9 @@ void outliner_build_tree(Main *mainvar, Scene *scene, ViewLayer *view_layer, Spa
outliner_add_orphaned_datablocks(mainvar, soops);
}
else if (soops->outlinevis == SO_COLLECTIONS) {
- int a = BLI_findindex(&scene->view_layers, view_layer);
- TreeElement *tenlay = outliner_add_element(soops, &soops->tree, scene, te, TSE_R_LAYER, a);
+ TreeElement *tenlay = outliner_add_element(soops, &soops->tree, scene, te, TSE_R_LAYER, 0);
tenlay->name = view_layer->name;
- tenlay->directdata = &view_layer->flag;
+ tenlay->directdata = view_layer;
TREESTORE(tenlay)->flag &= ~TSE_CLOSED;
if ((soops->filter & SO_FILTER_ENABLE) && (soops->filter & SO_FILTER_NO_COLLECTION)) {
diff --git a/source/blender/editors/space_outliner/space_outliner.c b/source/blender/editors/space_outliner/space_outliner.c
index 5c4d2b98055..557a0723cb4 100644
--- a/source/blender/editors/space_outliner/space_outliner.c
+++ b/source/blender/editors/space_outliner/space_outliner.c
@@ -332,6 +332,7 @@ static void outliner_main_region_listener(
case ND_LAYER:
case ND_LAYER_CONTENT:
case ND_WORLD:
+ case ND_SCENEBROWSE:
ED_region_tag_redraw(ar);
break;
}