diff options
Diffstat (limited to 'source/blender/editors/space_buttons/buttons_texture.c')
-rw-r--r-- | source/blender/editors/space_buttons/buttons_texture.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/source/blender/editors/space_buttons/buttons_texture.c b/source/blender/editors/space_buttons/buttons_texture.c index e3d72ba67d8..036db87e846 100644 --- a/source/blender/editors/space_buttons/buttons_texture.c +++ b/source/blender/editors/space_buttons/buttons_texture.c @@ -54,6 +54,7 @@ #include "DNA_linestyle_types.h" #include "BKE_context.h" +#include "BKE_layer.h" #include "BKE_linestyle.h" #include "BKE_material.h" #include "BKE_modifier.h" @@ -108,14 +109,14 @@ bool ED_texture_context_check_linestyle(const bContext *C) { #ifdef WITH_FREESTYLE Scene *scene = CTX_data_scene(C); - SceneRenderLayer *actsrl; + ViewLayer *active_view_layer; FreestyleConfig *config; FreestyleLineSet *lineset; FreestyleLineStyle *linestyle; if (scene && (scene->r.mode & R_EDGE_FRS)) { - actsrl = BLI_findlink(&scene->r.layers, scene->r.actlay); - config = &actsrl->freestyleConfig; + active_view_layer = BLI_findlink(&scene->view_layers, scene->active_view_layer); + config = &active_view_layer->freestyle_config; if (config->mode == FREESTYLE_CONTROL_EDITOR_MODE) { lineset = BKE_freestyle_lineset_get_active(config); if (lineset) { @@ -195,7 +196,7 @@ static void set_texture_context(const bContext *C, SpaceButs *sbuts) else if ((sbuts->mainb == BCONTEXT_PARTICLE) && valid_particles) { sbuts->texture_context = sbuts->texture_context_prev = SB_TEXC_PARTICLES; } - else if ((sbuts->mainb == BCONTEXT_RENDER_LAYER) && valid_linestyle) { + else if ((sbuts->mainb == BCONTEXT_VIEW_LAYER) && valid_linestyle) { sbuts->texture_context = sbuts->texture_context_prev = SB_TEXC_LINESTYLE; } else if ((ELEM(sbuts->mainb, BCONTEXT_MODIFIER, BCONTEXT_PHYSICS)) && valid_others) { @@ -324,6 +325,7 @@ static void buttons_texture_users_from_context(ListBase *users, const bContext * Material *ma = NULL; Lamp *la = NULL; World *wrld = NULL; + WorkSpace *workspace = NULL; FreestyleLineStyle *linestyle = NULL; Brush *brush = NULL; ID *pinid = sbuts->pinid; @@ -345,17 +347,25 @@ static void buttons_texture_users_from_context(ListBase *users, const bContext * brush = (Brush *)pinid; else if (GS(pinid->name) == ID_LS) linestyle = (FreestyleLineStyle *)pinid; + else if (GS(pinid->name) == ID_WS) + workspace = (WorkSpace *)workspace; } if (!scene) scene = CTX_data_scene(C); if (!pinid || GS(pinid->name) == ID_SCE) { - ob = (scene->basact) ? scene->basact->object : NULL; wrld = scene->world; brush = BKE_paint_brush(BKE_paint_get_active_from_context(C)); linestyle = BKE_linestyle_active_from_scene(scene); } + else if (!pinid || GS(pinid->name) == ID_WS) { + if (!workspace) { + workspace = CTX_wm_workspace(C); + } + ViewLayer *view_layer = BKE_view_layer_from_workspace_get(scene, workspace); + ob = OBACT(view_layer); + } if (ob && ob->type == OB_LAMP && !la) la = ob->data; |