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:
Diffstat (limited to 'source/blender/editors/space_buttons/buttons_context.c')
-rw-r--r--source/blender/editors/space_buttons/buttons_context.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c
index dd943e7988d..4ad62ec705d 100644
--- a/source/blender/editors/space_buttons/buttons_context.c
+++ b/source/blender/editors/space_buttons/buttons_context.c
@@ -47,6 +47,7 @@
#include "DNA_world_types.h"
#include "DNA_brush_types.h"
#include "DNA_linestyle_types.h"
+#include "DNA_windowmanager_types.h"
#include "BKE_context.h"
#include "BKE_action.h"
@@ -70,6 +71,8 @@
#include "UI_interface.h"
#include "UI_resources.h"
+#include "WM_api.h"
+
#include "buttons_intern.h" // own include
static int set_pointer_type(ButsContextPath *path, bContextDataResult *result, StructRNA *type)
@@ -114,11 +117,13 @@ static int buttons_context_path_scene(ButsContextPath *path)
return RNA_struct_is_a(ptr->type, &RNA_Scene);
}
-static int buttons_context_path_view_layer(ButsContextPath *path, WorkSpace *workspace)
+static int buttons_context_path_view_layer(ButsContextPath *path, wmWindow *win)
{
if (buttons_context_path_scene(path)) {
Scene *scene = path->ptr[path->len - 1].data;
- ViewLayer *view_layer = BKE_view_layer_from_workspace_get(scene, workspace);
+ ViewLayer *view_layer = (win->scene == scene) ?
+ WM_window_get_active_view_layer(win) :
+ BKE_view_layer_default_view(scene);
RNA_pointer_create(&scene->id, &RNA_ViewLayer, view_layer, &path->ptr[path->len]);
path->len++;
@@ -159,7 +164,7 @@ static int buttons_context_path_world(ButsContextPath *path)
return 0;
}
-static int buttons_context_path_linestyle(ButsContextPath *path, WorkSpace *workspace)
+static int buttons_context_path_linestyle(ButsContextPath *path, wmWindow *window)
{
FreestyleLineStyle *linestyle;
PointerRNA *ptr = &path->ptr[path->len - 1];
@@ -169,7 +174,7 @@ static int buttons_context_path_linestyle(ButsContextPath *path, WorkSpace *work
return 1;
}
/* if we have a view layer, use the lineset's linestyle */
- else if (buttons_context_path_view_layer(path, workspace)) {
+ else if (buttons_context_path_view_layer(path, window)) {
ViewLayer *view_layer = path->ptr[path->len - 1].data;
linestyle = BKE_linestyle_active_from_view_layer(view_layer);
if (linestyle) {
@@ -432,7 +437,7 @@ static int buttons_context_path_texture(const bContext *C, ButsContextPath *path
else if (GS(id->name) == ID_OB)
buttons_context_path_object(path);
else if (GS(id->name) == ID_LS)
- buttons_context_path_linestyle(path, CTX_wm_workspace(C));
+ buttons_context_path_linestyle(path, CTX_wm_window(C));
}
if (ct->texture) {
@@ -472,8 +477,9 @@ static int buttons_context_path(const bContext *C, ButsContextPath *path, int ma
{
SpaceButs *sbuts = CTX_wm_space_buts(C);
Scene *scene = CTX_data_scene(C);
+ ViewLayer *view_layer = CTX_data_view_layer(C);
+ wmWindow *window = CTX_wm_window(C);
WorkSpace *workspace = CTX_wm_workspace(C);
- ViewLayer *view_layer = BKE_view_layer_from_workspace_get(scene, workspace);
ID *id;
int found;
@@ -514,13 +520,13 @@ static int buttons_context_path(const bContext *C, ButsContextPath *path, int ma
case BCONTEXT_VIEW_LAYER:
#ifdef WITH_FREESTYLE
if (buttons_context_linestyle_pinnable(C, view_layer)) {
- found = buttons_context_path_linestyle(path, workspace);
+ found = buttons_context_path_linestyle(path, window);
if (found) {
break;
}
}
#endif
- found = buttons_context_path_view_layer(path, workspace);
+ found = buttons_context_path_view_layer(path, window);
break;
case BCONTEXT_WORLD:
found = buttons_context_path_world(path);