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')
-rw-r--r--source/blender/editors/space_buttons/buttons_context.c341
-rw-r--r--source/blender/editors/space_buttons/buttons_intern.h17
-rw-r--r--source/blender/editors/space_buttons/buttons_ops.c14
-rw-r--r--source/blender/editors/space_buttons/buttons_texture.c219
-rw-r--r--source/blender/editors/space_buttons/space_buttons.c221
5 files changed, 318 insertions, 494 deletions
diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c
index f5e0ccb60c7..dd943e7988d 100644
--- a/source/blender/editors/space_buttons/buttons_context.c
+++ b/source/blender/editors/space_buttons/buttons_context.c
@@ -39,6 +39,7 @@
#include "BLT_translation.h"
#include "DNA_armature_types.h"
+#include "DNA_group_types.h"
#include "DNA_lamp_types.h"
#include "DNA_material_types.h"
#include "DNA_node_types.h"
@@ -49,6 +50,7 @@
#include "BKE_context.h"
#include "BKE_action.h"
+#include "BKE_layer.h"
#include "BKE_material.h"
#include "BKE_modifier.h"
#include "BKE_paint.h"
@@ -56,6 +58,7 @@
#include "BKE_screen.h"
#include "BKE_texture.h"
#include "BKE_linestyle.h"
+#include "BKE_workspace.h"
#include "RNA_access.h"
@@ -111,6 +114,20 @@ 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)
+{
+ 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);
+
+ RNA_pointer_create(&scene->id, &RNA_ViewLayer, view_layer, &path->ptr[path->len]);
+ path->len++;
+ return 1;
+ }
+
+ return 0;
+}
+
/* note: this function can return 1 without adding a world to the path
* so the buttons stay visible, but be sure to check the ID type if a ID_WO */
static int buttons_context_path_world(ButsContextPath *path)
@@ -142,9 +159,8 @@ static int buttons_context_path_world(ButsContextPath *path)
return 0;
}
-static int buttons_context_path_linestyle(ButsContextPath *path)
+static int buttons_context_path_linestyle(ButsContextPath *path, WorkSpace *workspace)
{
- Scene *scene;
FreestyleLineStyle *linestyle;
PointerRNA *ptr = &path->ptr[path->len - 1];
@@ -152,10 +168,10 @@ static int buttons_context_path_linestyle(ButsContextPath *path)
if (RNA_struct_is_a(ptr->type, &RNA_FreestyleLineStyle)) {
return 1;
}
- /* if we have a scene, use the lineset's linestyle */
- else if (buttons_context_path_scene(path)) {
- scene = path->ptr[path->len - 1].data;
- linestyle = BKE_linestyle_active_from_scene(scene);
+ /* if we have a view layer, use the lineset's linestyle */
+ else if (buttons_context_path_view_layer(path, workspace)) {
+ ViewLayer *view_layer = path->ptr[path->len - 1].data;
+ linestyle = BKE_linestyle_active_from_view_layer(view_layer);
if (linestyle) {
RNA_id_pointer_create(&linestyle->id, &path->ptr[path->len]);
path->len++;
@@ -167,27 +183,31 @@ static int buttons_context_path_linestyle(ButsContextPath *path)
return 0;
}
+static int buttons_context_path_workspace(ButsContextPath *path)
+{
+ PointerRNA *ptr = &path->ptr[path->len - 1];
+
+ /* This one just verifies. */
+ return RNA_struct_is_a(ptr->type, &RNA_WorkSpace);
+}
+
static int buttons_context_path_object(ButsContextPath *path)
{
- Scene *scene;
- Object *ob;
PointerRNA *ptr = &path->ptr[path->len - 1];
/* if we already have a (pinned) object, we're done */
if (RNA_struct_is_a(ptr->type, &RNA_Object)) {
return 1;
}
- /* if we have a scene, use the scene's active object */
- else if (buttons_context_path_scene(path)) {
- scene = path->ptr[path->len - 1].data;
- ob = (scene->basact) ? scene->basact->object : NULL;
- if (ob) {
- RNA_id_pointer_create(&ob->id, &path->ptr[path->len]);
- path->len++;
+ ViewLayer *view_layer = ptr->data;
+ Object *ob = (view_layer->basact) ? view_layer->basact->object : NULL;
- return 1;
- }
+ if (ob) {
+ RNA_id_pointer_create(&ob->id, &path->ptr[path->len]);
+ path->len++;
+
+ return 1;
}
/* no path to a object possible */
@@ -208,6 +228,7 @@ static int buttons_context_path_data(ButsContextPath *path, int type)
else if (RNA_struct_is_a(ptr->type, &RNA_Camera) && (type == -1 || type == OB_CAMERA)) return 1;
else if (RNA_struct_is_a(ptr->type, &RNA_Lamp) && (type == -1 || type == OB_LAMP)) return 1;
else if (RNA_struct_is_a(ptr->type, &RNA_Speaker) && (type == -1 || type == OB_SPEAKER)) return 1;
+ else if (RNA_struct_is_a(ptr->type, &RNA_LightProbe) && (type == -1 || type == OB_LIGHTPROBE)) return 1;
/* try to get an object in the path, no pinning supported here */
else if (buttons_context_path_object(path)) {
ob = path->ptr[path->len - 1].data;
@@ -238,7 +259,7 @@ static int buttons_context_path_modifier(ButsContextPath *path)
return 0;
}
-static int buttons_context_path_material(ButsContextPath *path, bool for_texture, bool new_shading)
+static int buttons_context_path_material(ButsContextPath *path)
{
Object *ob;
PointerRNA *ptr = &path->ptr[path->len - 1];
@@ -256,18 +277,6 @@ static int buttons_context_path_material(ButsContextPath *path, bool for_texture
ma = give_current_material(ob, ob->actcol);
RNA_id_pointer_create(&ma->id, &path->ptr[path->len]);
path->len++;
-
- if (for_texture && give_current_material_texture_node(ma))
- return 1;
-
- if (!new_shading) {
- /* Only try to get mat from node in case of old shading system (see T40331). */
- ma = give_node_material(ma);
- if (ma) {
- RNA_id_pointer_create(&ma->id, &path->ptr[path->len]);
- path->len++;
- }
- }
return 1;
}
}
@@ -367,7 +376,7 @@ static int buttons_context_path_particle(ButsContextPath *path)
return 0;
}
-static int buttons_context_path_brush(ButsContextPath *path)
+static int buttons_context_path_brush(const bContext *C, ButsContextPath *path)
{
Scene *scene;
Brush *br = NULL;
@@ -381,8 +390,10 @@ static int buttons_context_path_brush(ButsContextPath *path)
else if (buttons_context_path_scene(path)) {
scene = path->ptr[path->len - 1].data;
- if (scene)
- br = BKE_paint_brush(BKE_paint_get_active(scene));
+ if (scene) {
+ ViewLayer *view_layer = CTX_data_view_layer(C);
+ br = BKE_paint_brush(BKE_paint_get_active(scene, view_layer));
+ }
if (br) {
RNA_id_pointer_create((ID *)br, &path->ptr[path->len]);
@@ -396,141 +407,46 @@ static int buttons_context_path_brush(ButsContextPath *path)
return 0;
}
-static int buttons_context_path_texture(ButsContextPath *path, ButsContextTexture *ct)
+static int buttons_context_path_texture(const bContext *C, ButsContextPath *path, ButsContextTexture *ct)
{
- if (ct) {
- /* new shading system */
- PointerRNA *ptr = &path->ptr[path->len - 1];
- ID *id;
-
- /* if we already have a (pinned) texture, we're done */
- if (RNA_struct_is_a(ptr->type, &RNA_Texture))
- return 1;
-
- if (!ct->user)
- return 0;
-
- id = ct->user->id;
-
- if (id) {
- if (GS(id->name) == ID_BR)
- buttons_context_path_brush(path);
- else if (GS(id->name) == ID_MA)
- buttons_context_path_material(path, false, true);
- else if (GS(id->name) == ID_WO)
- buttons_context_path_world(path);
- else if (GS(id->name) == ID_LA)
- buttons_context_path_data(path, OB_LAMP);
- else if (GS(id->name) == ID_PA)
- buttons_context_path_particle(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);
- }
+ PointerRNA *ptr = &path->ptr[path->len - 1];
+ ID *id;
- if (ct->texture) {
- RNA_id_pointer_create(&ct->texture->id, &path->ptr[path->len]);
- path->len++;
- }
+ if (!ct)
+ return 0;
+ /* if we already have a (pinned) texture, we're done */
+ if (RNA_struct_is_a(ptr->type, &RNA_Texture))
return 1;
- }
- else {
- /* old shading system */
- Material *ma;
- Lamp *la;
- World *wo;
- ParticleSystem *psys;
- FreestyleLineStyle *ls;
- Tex *tex;
- PointerRNA *ptr = &path->ptr[path->len - 1];
-
- /* if we already have a (pinned) texture, we're done */
- if (RNA_struct_is_a(ptr->type, &RNA_Texture)) {
- return 1;
- }
- /* try world */
- else if ((path->tex_ctx == SB_TEXC_WORLD) && buttons_context_path_world(path)) {
- wo = path->ptr[path->len - 1].data;
-
- if (wo && GS(wo->id.name) == ID_WO) {
- tex = give_current_world_texture(wo);
-
- RNA_id_pointer_create(&tex->id, &path->ptr[path->len]);
- path->len++;
- return 1;
- }
- }
- /* try particles */
- else if ((path->tex_ctx == SB_TEXC_PARTICLES) && buttons_context_path_particle(path)) {
- if (path->ptr[path->len - 1].type == &RNA_ParticleSettings) {
- ParticleSettings *part = path->ptr[path->len - 1].data;
- tex = give_current_particle_texture(part);
- RNA_id_pointer_create(&tex->id, &path->ptr[path->len]);
- path->len++;
- return 1;
- }
- else {
- psys = path->ptr[path->len - 1].data;
-
- if (psys && psys->part && GS(psys->part->id.name) == ID_PA) {
- tex = give_current_particle_texture(psys->part);
-
- RNA_id_pointer_create(&tex->id, &path->ptr[path->len]);
- path->len++;
- return 1;
- }
- }
- }
- /* try material */
- else if ((path->tex_ctx == SB_TEXC_MATERIAL) && buttons_context_path_material(path, true, false)) {
- ma = path->ptr[path->len - 1].data;
-
- if (ma) {
- tex = give_current_material_texture(ma);
-
- RNA_id_pointer_create(&tex->id, &path->ptr[path->len]);
- path->len++;
- return 1;
- }
- }
- /* try lamp */
- else if ((path->tex_ctx == SB_TEXC_LAMP) && buttons_context_path_data(path, OB_LAMP)) {
- la = path->ptr[path->len - 1].data;
-
- if (la) {
- tex = give_current_lamp_texture(la);
+ if (!ct->user)
+ return 0;
- RNA_id_pointer_create(&tex->id, &path->ptr[path->len]);
- path->len++;
- return 1;
- }
- }
- /* try linestyle */
- else if ((path->tex_ctx == SB_TEXC_LINESTYLE) && buttons_context_path_linestyle(path)) {
- ls = path->ptr[path->len - 1].data;
+ id = ct->user->id;
- if (ls) {
- tex = give_current_linestyle_texture(ls);
+ if (id) {
+ if (GS(id->name) == ID_BR)
+ buttons_context_path_brush(C, path);
+ else if (GS(id->name) == ID_PA)
+ buttons_context_path_particle(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));
+ }
- RNA_id_pointer_create(&tex->id, &path->ptr[path->len]);
- path->len++;
- return 1;
- }
- }
+ if (ct->texture) {
+ RNA_id_pointer_create(&ct->texture->id, &path->ptr[path->len]);
+ path->len++;
}
- /* no path to a texture possible */
- return 0;
+ return 1;
}
#ifdef WITH_FREESTYLE
-static bool buttons_context_linestyle_pinnable(const bContext *C)
+static bool buttons_context_linestyle_pinnable(const bContext *C, ViewLayer *view_layer)
{
Scene *scene = CTX_data_scene(C);
- SceneRenderLayer *actsrl;
FreestyleConfig *config;
SpaceButs *sbuts;
@@ -539,8 +455,7 @@ static bool buttons_context_linestyle_pinnable(const bContext *C)
return false;
}
/* if Freestyle is not in the Parameter Editor mode */
- actsrl = BLI_findlink(&scene->r.layers, scene->r.actlay);
- config = &actsrl->freestyleConfig;
+ config = &view_layer->freestyle_config;
if (config->mode != FREESTYLE_CONTROL_EDITOR_MODE) {
return false;
}
@@ -556,26 +471,37 @@ static bool buttons_context_linestyle_pinnable(const bContext *C)
static int buttons_context_path(const bContext *C, ButsContextPath *path, int mainb, int flag)
{
SpaceButs *sbuts = CTX_wm_space_buts(C);
+ Scene *scene = CTX_data_scene(C);
+ WorkSpace *workspace = CTX_wm_workspace(C);
+ ViewLayer *view_layer = BKE_view_layer_from_workspace_get(scene, workspace);
ID *id;
int found;
memset(path, 0, sizeof(*path));
path->flag = flag;
- path->tex_ctx = sbuts->texture_context;
- /* if some ID datablock is pinned, set the root pointer */
+ /* If some ID datablock is pinned, set the root pointer. */
if (sbuts->pinid) {
id = sbuts->pinid;
RNA_id_pointer_create(id, &path->ptr[0]);
path->len++;
}
+ /* No pinned root, use scene as initial root. */
+ else {
+ if (ELEM(mainb, BCONTEXT_WORKSPACE, BCONTEXT_TOOL)) {
+ RNA_id_pointer_create(&workspace->id, &path->ptr[0]);
+ path->len++;
+ }
+ else {
+ RNA_id_pointer_create(&scene->id, &path->ptr[0]);
+ path->len++;
- /* no pinned root, use scene as root */
- if (path->len == 0) {
- id = (ID *)CTX_data_scene(C);
- RNA_id_pointer_create(id, &path->ptr[0]);
- path->len++;
+ if (!ELEM(mainb, BCONTEXT_SCENE, BCONTEXT_RENDER, BCONTEXT_VIEW_LAYER, BCONTEXT_WORLD)) {
+ RNA_pointer_create(NULL, &RNA_ViewLayer, view_layer, &path->ptr[path->len]);
+ path->len++;
+ }
+ }
}
/* now for each buttons context type, we try to construct a path,
@@ -585,20 +511,24 @@ static int buttons_context_path(const bContext *C, ButsContextPath *path, int ma
case BCONTEXT_RENDER:
found = buttons_context_path_scene(path);
break;
- case BCONTEXT_RENDER_LAYER:
+ case BCONTEXT_VIEW_LAYER:
#ifdef WITH_FREESTYLE
- if (buttons_context_linestyle_pinnable(C)) {
- found = buttons_context_path_linestyle(path);
+ if (buttons_context_linestyle_pinnable(C, view_layer)) {
+ found = buttons_context_path_linestyle(path, workspace);
if (found) {
break;
}
}
#endif
- found = buttons_context_path_scene(path);
+ found = buttons_context_path_view_layer(path, workspace);
break;
case BCONTEXT_WORLD:
found = buttons_context_path_world(path);
break;
+ case BCONTEXT_TOOL:
+ case BCONTEXT_WORKSPACE:
+ found = buttons_context_path_workspace(path);
+ break;
case BCONTEXT_OBJECT:
case BCONTEXT_PHYSICS:
case BCONTEXT_CONSTRAINT:
@@ -614,10 +544,10 @@ static int buttons_context_path(const bContext *C, ButsContextPath *path, int ma
found = buttons_context_path_particle(path);
break;
case BCONTEXT_MATERIAL:
- found = buttons_context_path_material(path, false, (sbuts->texuser != NULL));
+ found = buttons_context_path_material(path);
break;
case BCONTEXT_TEXTURE:
- found = buttons_context_path_texture(path, sbuts->texuser);
+ found = buttons_context_path_texture(C, path, sbuts->texuser);
break;
case BCONTEXT_BONE:
found = buttons_context_path_bone(path);
@@ -672,7 +602,7 @@ void buttons_context_compute(const bContext *C, SpaceButs *sbuts)
path = sbuts->path;
- /* We need to set Scene path now! Else, buttons_texture_context_compute() might not get a valid scene. */
+ /* Set scene path. */
buttons_context_path(C, path, BCONTEXT_SCENE, pflag);
buttons_texture_context_compute(C, sbuts);
@@ -740,11 +670,11 @@ void buttons_context_compute(const bContext *C, SpaceButs *sbuts)
const char *buttons_context_dir[] = {
"texture_slot", "scene", "world", "object", "mesh", "armature", "lattice", "curve",
- "meta_ball", "lamp", "speaker", "camera", "material", "material_slot",
+ "meta_ball", "lamp", "speaker", "lightprobe", "camera", "material", "material_slot",
"texture", "texture_user", "texture_user_property", "bone", "edit_bone",
"pose_bone", "particle_system", "particle_system_editable", "particle_settings",
"cloth", "soft_body", "fluid", "smoke", "collision", "brush", "dynamic_paint",
- "line_style", NULL
+ "line_style", "collection", NULL
};
int buttons_context(const bContext *C, const char *member, bContextDataResult *result)
@@ -809,6 +739,10 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
set_pointer_type(path, result, &RNA_Speaker);
return 1;
}
+ else if (CTX_data_equals(member, "lightprobe")) {
+ set_pointer_type(path, result, &RNA_LightProbe);
+ return 1;
+ }
else if (CTX_data_equals(member, "material")) {
set_pointer_type(path, result, &RNA_Material);
return 1;
@@ -817,13 +751,8 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
ButsContextTexture *ct = sbuts->texuser;
if (ct) {
- /* new shading system */
CTX_data_pointer_set(result, &ct->texture->id, &RNA_Texture, ct->texture);
}
- else {
- /* old shading system */
- set_pointer_type(path, result, &RNA_Texture);
- }
return 1;
}
@@ -847,7 +776,7 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
ButsContextTexture *ct = sbuts->texuser;
if (!ct)
- return -1; /* old shading system (found but not available) */
+ return -1;
if (ct->user && ct->user->ptr.data) {
ButsTextureUser *user = ct->user;
@@ -860,7 +789,7 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
ButsContextTexture *ct = sbuts->texuser;
if (!ct)
- return -1; /* old shading system (found but not available) */
+ return -1;
if (ct->user && ct->user->ptr.data) {
ButsTextureUser *user = ct->user;
@@ -880,21 +809,6 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
return 1;
}
- else {
- /* old shading system */
- PointerRNA *ptr;
-
- if ((ptr = get_pointer_type(path, &RNA_Material))) {
- Material *ma = ptr->data;
-
- if (ma) {
- bNode *node = give_current_material_texture_node(ma);
- CTX_data_pointer_set(result, &ma->nodetree->id, &RNA_Node, node);
- }
- }
-
- return 1;
- }
}
else if (CTX_data_equals(member, "texture_slot")) {
ButsContextTexture *ct = sbuts->texuser;
@@ -910,38 +824,6 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
else if (ct) {
return 0; /* new shading system */
}
- else if ((ptr = get_pointer_type(path, &RNA_Material))) {
- Material *ma = ptr->data;
-
- /* if we have a node material, get slot from material in material node */
- if (ma && ma->use_nodes && ma->nodetree) {
- /* if there's an active texture node in the node tree,
- * then that texture is in context directly, without a texture slot */
- if (give_current_material_texture_node(ma))
- return 0;
-
- ma = give_node_material(ma);
- if (ma)
- CTX_data_pointer_set(result, &ma->id, &RNA_MaterialTextureSlot, ma->mtex[(int)ma->texact]);
- else
- return 0;
- }
- else if (ma) {
- CTX_data_pointer_set(result, &ma->id, &RNA_MaterialTextureSlot, ma->mtex[(int)ma->texact]);
- }
- }
- else if ((ptr = get_pointer_type(path, &RNA_Lamp))) {
- Lamp *la = ptr->data;
-
- if (la)
- CTX_data_pointer_set(result, &la->id, &RNA_LampTextureSlot, la->mtex[(int)la->texact]);
- }
- else if ((ptr = get_pointer_type(path, &RNA_World))) {
- World *wo = ptr->data;
-
- if (wo)
- CTX_data_pointer_set(result, &wo->id, &RNA_WorldTextureSlot, wo->mtex[(int)wo->texact]);
- }
else if ((ptr = get_pointer_type(path, &RNA_FreestyleLineStyle))) {
FreestyleLineStyle *ls = ptr->data;
@@ -1121,10 +1003,15 @@ void buttons_context_draw(const bContext *C, uiLayout *layout)
name = RNA_struct_name_get_alloc(ptr, namebuf, sizeof(namebuf), NULL);
if (name) {
- if (!ELEM(sbuts->mainb, BCONTEXT_RENDER, BCONTEXT_SCENE, BCONTEXT_RENDER_LAYER) && ptr->type == &RNA_Scene)
+ if ((!ELEM(sbuts->mainb, BCONTEXT_RENDER, BCONTEXT_SCENE, BCONTEXT_VIEW_LAYER) && ptr->type == &RNA_Scene)) {
uiItemLDrag(row, ptr, "", icon); /* save some space */
- else
+ }
+ else if ((!ELEM(sbuts->mainb, BCONTEXT_RENDER, BCONTEXT_SCENE, BCONTEXT_VIEW_LAYER) && ptr->type == &RNA_ViewLayer)) {
+ uiItemLDrag(row, ptr, "", icon); /* save some space */
+ }
+ else {
uiItemLDrag(row, ptr, name, icon);
+ }
if (name != namebuf)
MEM_freeN(name);
diff --git a/source/blender/editors/space_buttons/buttons_intern.h b/source/blender/editors/space_buttons/buttons_intern.h
index 77623974d0a..aab7b39484d 100644
--- a/source/blender/editors/space_buttons/buttons_intern.h
+++ b/source/blender/editors/space_buttons/buttons_intern.h
@@ -45,26 +45,13 @@ struct bNodeTree;
struct uiLayout;
struct wmOperatorType;
-/* buts->scaflag */
-#define BUTS_SENS_SEL 1
-#define BUTS_SENS_ACT 2
-#define BUTS_SENS_LINK 4
-#define BUTS_CONT_SEL 8
-#define BUTS_CONT_ACT 16
-#define BUTS_CONT_LINK 32
-#define BUTS_ACT_SEL 64
-#define BUTS_ACT_ACT 128
-#define BUTS_ACT_LINK 256
-#define BUTS_SENS_STATE 512
-#define BUTS_ACT_STATE 1024
-
/* context data */
typedef struct ButsContextPath {
PointerRNA ptr[8];
int len;
int flag;
- int tex_ctx;
+ int collection_ctx;
} ButsContextPath;
typedef struct ButsTextureUser {
@@ -111,6 +98,6 @@ void buttons_texture_context_compute(const struct bContext *C, struct SpaceButs
/* buttons_ops.c */
void BUTTONS_OT_file_browse(struct wmOperatorType *ot);
void BUTTONS_OT_directory_browse(struct wmOperatorType *ot);
-void BUTTONS_OT_toolbox(struct wmOperatorType *ot);
+void BUTTONS_OT_context_menu(struct wmOperatorType *ot);
#endif /* __BUTTONS_INTERN_H__ */
diff --git a/source/blender/editors/space_buttons/buttons_ops.c b/source/blender/editors/space_buttons/buttons_ops.c
index 47f97b8087f..93670919d4c 100644
--- a/source/blender/editors/space_buttons/buttons_ops.c
+++ b/source/blender/editors/space_buttons/buttons_ops.c
@@ -60,9 +60,9 @@
#include "buttons_intern.h" /* own include */
-/********************** toolbox operator *********************/
+/********************** context_menu operator *********************/
-static int toolbox_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *UNUSED(event))
+static int context_menu_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *UNUSED(event))
{
bScreen *sc = CTX_wm_screen(C);
SpaceButs *sbuts = CTX_wm_space_buts(C);
@@ -80,15 +80,15 @@ static int toolbox_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *UN
return OPERATOR_INTERFACE;
}
-void BUTTONS_OT_toolbox(wmOperatorType *ot)
+void BUTTONS_OT_context_menu(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Toolbox";
- ot->description = "Display button panel toolbox";
- ot->idname = "BUTTONS_OT_toolbox";
+ ot->name = "Context Menu";
+ ot->description = "Display button panel context_menu";
+ ot->idname = "BUTTONS_OT_context_menu";
/* api callbacks */
- ot->invoke = toolbox_invoke;
+ ot->invoke = context_menu_invoke;
ot->poll = ED_operator_buttons_active;
}
diff --git a/source/blender/editors/space_buttons/buttons_texture.c b/source/blender/editors/space_buttons/buttons_texture.c
index 1d9d5130f98..5feb74edef7 100644
--- a/source/blender/editors/space_buttons/buttons_texture.c
+++ b/source/blender/editors/space_buttons/buttons_texture.c
@@ -41,8 +41,6 @@
#include "DNA_brush_types.h"
#include "DNA_ID.h"
-#include "DNA_lamp_types.h"
-#include "DNA_material_types.h"
#include "DNA_node_types.h"
#include "DNA_object_types.h"
#include "DNA_object_force_types.h"
@@ -50,17 +48,17 @@
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "DNA_space_types.h"
-#include "DNA_world_types.h"
#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"
#include "BKE_node.h"
#include "BKE_paint.h"
#include "BKE_particle.h"
#include "BKE_scene.h"
+#include "BKE_workspace.h"
#ifdef WITH_FREESTYLE
# include "BKE_freestyle.h"
#endif
@@ -78,172 +76,6 @@
#include "buttons_intern.h" // own include
-/****************** "Old Shading" Texture Context ****************/
-
-bool ED_texture_context_check_world(const bContext *C)
-{
- Scene *scene = CTX_data_scene(C);
- return (scene && scene->world);
-}
-
-bool ED_texture_context_check_material(const bContext *C)
-{
- Object *ob = CTX_data_active_object(C);
- return (ob && (ob->totcol != 0));
-}
-
-bool ED_texture_context_check_lamp(const bContext *C)
-{
- Object *ob = CTX_data_active_object(C);
- return (ob && (ob->type == OB_LAMP));
-}
-
-bool ED_texture_context_check_particles(const bContext *C)
-{
- Object *ob = CTX_data_active_object(C);
- return (ob && ob->particlesystem.first);
-}
-
-bool ED_texture_context_check_linestyle(const bContext *C)
-{
-#ifdef WITH_FREESTYLE
- Scene *scene = CTX_data_scene(C);
- SceneRenderLayer *actsrl;
- 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;
- if (config->mode == FREESTYLE_CONTROL_EDITOR_MODE) {
- lineset = BKE_freestyle_lineset_get_active(config);
- if (lineset) {
- linestyle = lineset->linestyle;
- return linestyle && (linestyle->flag & LS_TEXTURE);
- }
- }
- }
-#else
- (void)C;
-#endif
- return false;
-}
-
-static void texture_context_check_modifier_foreach(void *userData, Object *UNUSED(ob), ModifierData *UNUSED(md),
- const char *UNUSED(propname))
-{
- *((bool *)userData) = true;
-}
-
-bool ED_texture_context_check_others(const bContext *C)
-{
- /* We cannot rely on sbuts->texuser here, as it is NULL when in "old" tex handling, non-OTHERS tex context. */
- Object *ob = CTX_data_active_object(C);
-
- /* object */
- if (ob) {
- /* Tex force field. */
- if (ob->pd && ob->pd->forcefield == PFIELD_TEXTURE) {
- return true;
- }
-
- /* modifiers */
- {
- bool check = false;
- modifiers_foreachTexLink(ob, texture_context_check_modifier_foreach, &check);
- if (check) {
- return true;
- }
- }
- }
-
- /* brush */
- if (BKE_paint_brush(BKE_paint_get_active_from_context(C))) {
- return true;
- }
-
- return false;
-}
-
-static void set_texture_context(const bContext *C, SpaceButs *sbuts)
-{
- Scene *scene = CTX_data_scene(C);
-
- if (BKE_scene_use_new_shading_nodes(scene)) {
- return; /* No texture context in new shading mode */
- }
-
- {
- bool valid_world = ED_texture_context_check_world(C);
- bool valid_material = ED_texture_context_check_material(C);
- bool valid_lamp = ED_texture_context_check_lamp(C);
- bool valid_particles = ED_texture_context_check_particles(C);
- bool valid_linestyle = ED_texture_context_check_linestyle(C);
- bool valid_others = ED_texture_context_check_others(C);
-
- /* this is similar to direct user action, no need to keep "better" ctxt in _prev */
- if ((sbuts->mainb == BCONTEXT_WORLD) && valid_world) {
- sbuts->texture_context = sbuts->texture_context_prev = SB_TEXC_WORLD;
- }
- else if ((sbuts->mainb == BCONTEXT_MATERIAL) && valid_material) {
- sbuts->texture_context = sbuts->texture_context_prev = SB_TEXC_MATERIAL;
- }
- else if ((sbuts->mainb == BCONTEXT_DATA) && valid_lamp) {
- sbuts->texture_context = sbuts->texture_context_prev = SB_TEXC_LAMP;
- }
- 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) {
- sbuts->texture_context = sbuts->texture_context_prev = SB_TEXC_LINESTYLE;
- }
- else if ((ELEM(sbuts->mainb, BCONTEXT_MODIFIER, BCONTEXT_PHYSICS)) && valid_others) {
- sbuts->texture_context = sbuts->texture_context_prev = SB_TEXC_OTHER;
- }
- /* Else, try to revive a previous "better" ctxt... */
- else if ((sbuts->texture_context_prev != sbuts->texture_context) &&
- (((sbuts->texture_context_prev == SB_TEXC_WORLD) && valid_world) ||
- ((sbuts->texture_context_prev == SB_TEXC_MATERIAL) && valid_material) ||
- ((sbuts->texture_context_prev == SB_TEXC_LAMP) && valid_lamp) ||
- ((sbuts->texture_context_prev == SB_TEXC_PARTICLES) && valid_particles) ||
- ((sbuts->texture_context_prev == SB_TEXC_LINESTYLE) && valid_linestyle) ||
- ((sbuts->texture_context_prev == SB_TEXC_OTHER) && valid_others)))
- {
- sbuts->texture_context = sbuts->texture_context_prev;
- }
- /* Else, just be sure that current context is valid! */
- else if (((sbuts->texture_context == SB_TEXC_WORLD) && !valid_world) ||
- ((sbuts->texture_context == SB_TEXC_MATERIAL) && !valid_material) ||
- ((sbuts->texture_context == SB_TEXC_LAMP) && !valid_lamp) ||
- ((sbuts->texture_context == SB_TEXC_PARTICLES) && !valid_particles) ||
- ((sbuts->texture_context == SB_TEXC_LINESTYLE) && !valid_linestyle) ||
- ((sbuts->texture_context == SB_TEXC_OTHER) && !valid_others))
- {
- /* this is default fallback, do keep "better" ctxt in _prev */
- sbuts->texture_context_prev = sbuts->texture_context;
- if (valid_material) {
- sbuts->texture_context = SB_TEXC_MATERIAL;
- }
- else if (valid_lamp) {
- sbuts->texture_context = SB_TEXC_LAMP;
- }
- else if (valid_particles) {
- sbuts->texture_context = SB_TEXC_PARTICLES;
- }
- else if (valid_linestyle) {
- sbuts->texture_context = SB_TEXC_LINESTYLE;
- }
- else if (valid_world) {
- sbuts->texture_context = SB_TEXC_WORLD;
- }
- else if (valid_others) {
- sbuts->texture_context = SB_TEXC_OTHER;
- }
- }
- }
-}
-
/************************* Texture User **************************/
static void buttons_texture_user_property_add(ListBase *users, ID *id,
@@ -321,9 +153,6 @@ static void buttons_texture_users_from_context(ListBase *users, const bContext *
{
Scene *scene = NULL;
Object *ob = NULL;
- Material *ma = NULL;
- Lamp *la = NULL;
- World *wrld = NULL;
FreestyleLineStyle *linestyle = NULL;
Brush *brush = NULL;
ID *pinid = sbuts->pinid;
@@ -335,42 +164,29 @@ static void buttons_texture_users_from_context(ListBase *users, const bContext *
scene = (Scene *)pinid;
else if (GS(pinid->name) == ID_OB)
ob = (Object *)pinid;
- else if (GS(pinid->name) == ID_LA)
- la = (Lamp *)pinid;
- else if (GS(pinid->name) == ID_WO)
- wrld = (World *)pinid;
- else if (GS(pinid->name) == ID_MA)
- ma = (Material *)pinid;
else if (GS(pinid->name) == ID_BR)
brush = (Brush *)pinid;
else if (GS(pinid->name) == ID_LS)
linestyle = (FreestyleLineStyle *)pinid;
}
- if (!scene)
+ if (!scene) {
scene = CTX_data_scene(C);
+ }
+
+ const ID_Type id_type = pinid != NULL ? GS(pinid->name) : -1;
+ if (!pinid || id_type == ID_SCE) {
+ WorkSpace *workspace = CTX_wm_workspace(C);
+ ViewLayer *view_layer = BKE_workspace_view_layer_get(workspace, scene);
- 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);
+ linestyle = BKE_linestyle_active_from_view_layer(view_layer);
+ ob = OBACT(view_layer);
}
- if (ob && ob->type == OB_LAMP && !la)
- la = ob->data;
- if (ob && !ma)
- ma = give_current_material(ob, ob->actcol);
-
/* fill users */
BLI_listbase_clear(users);
- if (ma && !limited_mode)
- buttons_texture_users_find_nodetree(users, &ma->id, ma->nodetree, N_("Material"));
- if (la && !limited_mode)
- buttons_texture_users_find_nodetree(users, &la->id, la->nodetree, N_("Lamp"));
- if (wrld && !limited_mode)
- buttons_texture_users_find_nodetree(users, &wrld->id, wrld->nodetree, N_("World"));
if (linestyle && !limited_mode)
buttons_texture_users_find_nodetree(users, &linestyle->id, linestyle->nodetree, N_("Line Style"));
@@ -439,21 +255,8 @@ void buttons_texture_context_compute(const bContext *C, SpaceButs *sbuts)
/* gather available texture users in context. runs on every draw of
* properties editor, before the buttons are created. */
ButsContextTexture *ct = sbuts->texuser;
- Scene *scene = CTX_data_scene(C);
ID *pinid = sbuts->pinid;
- set_texture_context(C, sbuts);
-
- if (!((sbuts->texture_context == SB_TEXC_OTHER) || BKE_scene_use_new_shading_nodes(scene))) {
- if (ct) {
- BLI_freelistN(&ct->users);
- MEM_freeN(ct);
- sbuts->texuser = NULL;
- }
-
- return;
- }
-
if (!ct) {
ct = MEM_callocN(sizeof(ButsContextTexture), "ButsContextTexture");
sbuts->texuser = ct;
diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c
index 7bcad841bca..a951c2a8524 100644
--- a/source/blender/editors/space_buttons/space_buttons.c
+++ b/source/blender/editors/space_buttons/space_buttons.c
@@ -44,14 +44,21 @@
#include "WM_api.h"
#include "WM_types.h"
+#include "WM_message.h"
#include "RNA_access.h"
+#include "RNA_define.h"
+#include "RNA_enum_types.h"
+
+#include "UI_resources.h"
+
+#include "GPU_glew.h"
#include "buttons_intern.h" /* own include */
/* ******************** default callbacks for buttons space ***************** */
-static SpaceLink *buttons_new(const bContext *UNUSED(C))
+static SpaceLink *buttons_new(const ScrArea *UNUSED(area), const Scene *UNUSED(scene))
{
ARegion *ar;
SpaceButs *sbuts;
@@ -60,6 +67,8 @@ static SpaceLink *buttons_new(const bContext *UNUSED(C))
sbuts->spacetype = SPACE_BUTS;
sbuts->align = BUT_VERTICAL;
+ sbuts->mainb = sbuts->mainbuser = BCONTEXT_OBJECT;
+
/* header */
ar = MEM_callocN(sizeof(ARegion), "header for buts");
@@ -135,50 +144,161 @@ static void buttons_main_region_init(wmWindowManager *wm, ARegion *ar)
WM_event_add_keymap_handler(&ar->handlers, keymap);
}
-static void buttons_main_region_draw(const bContext *C, ARegion *ar)
+static void buttons_main_region_layout_properties(const bContext *C, SpaceButs *sbuts, ARegion *ar)
{
- /* draw entirely, view changes should be handled here */
- SpaceButs *sbuts = CTX_wm_space_buts(C);
const bool vertical = (sbuts->align == BUT_VERTICAL);
buttons_context_compute(C, sbuts);
- if (sbuts->mainb == BCONTEXT_SCENE)
- ED_region_panels(C, ar, "scene", sbuts->mainb, vertical);
- else if (sbuts->mainb == BCONTEXT_RENDER)
- ED_region_panels(C, ar, "render", sbuts->mainb, vertical);
- else if (sbuts->mainb == BCONTEXT_RENDER_LAYER)
- ED_region_panels(C, ar, "render_layer", sbuts->mainb, vertical);
- else if (sbuts->mainb == BCONTEXT_WORLD)
- ED_region_panels(C, ar, "world", sbuts->mainb, vertical);
- else if (sbuts->mainb == BCONTEXT_OBJECT)
- ED_region_panels(C, ar, "object", sbuts->mainb, vertical);
- else if (sbuts->mainb == BCONTEXT_DATA)
- ED_region_panels(C, ar, "data", sbuts->mainb, vertical);
- else if (sbuts->mainb == BCONTEXT_MATERIAL)
- ED_region_panels(C, ar, "material", sbuts->mainb, vertical);
- else if (sbuts->mainb == BCONTEXT_TEXTURE)
- ED_region_panels(C, ar, "texture", sbuts->mainb, vertical);
- else if (sbuts->mainb == BCONTEXT_PARTICLE)
- ED_region_panels(C, ar, "particle", sbuts->mainb, vertical);
- else if (sbuts->mainb == BCONTEXT_PHYSICS)
- ED_region_panels(C, ar, "physics", sbuts->mainb, vertical);
- else if (sbuts->mainb == BCONTEXT_BONE)
- ED_region_panels(C, ar, "bone", sbuts->mainb, vertical);
- else if (sbuts->mainb == BCONTEXT_MODIFIER)
- ED_region_panels(C, ar, "modifier", sbuts->mainb, vertical);
- else if (sbuts->mainb == BCONTEXT_CONSTRAINT)
- ED_region_panels(C, ar, "constraint", sbuts->mainb, vertical);
- else if (sbuts->mainb == BCONTEXT_BONE_CONSTRAINT)
- ED_region_panels(C, ar, "bone_constraint", sbuts->mainb, vertical);
+ const char *contexts[2] = {NULL, NULL};
+
+ switch (sbuts->mainb) {
+ case BCONTEXT_SCENE:
+ contexts[0] = "scene";
+ break;
+ case BCONTEXT_RENDER:
+ contexts[0] = "render";
+ break;
+ case BCONTEXT_VIEW_LAYER:
+ contexts[0] = "view_layer";
+ break;
+ case BCONTEXT_WORLD:
+ contexts[0] = "world";
+ break;
+ case BCONTEXT_WORKSPACE:
+ contexts[0] = "workspace";
+ break;
+ case BCONTEXT_OBJECT:
+ contexts[0] = "object";
+ break;
+ case BCONTEXT_DATA:
+ contexts[0] = "data";
+ break;
+ case BCONTEXT_MATERIAL:
+ contexts[0] = "material";
+ break;
+ case BCONTEXT_TEXTURE:
+ contexts[0] = "texture";
+ break;
+ case BCONTEXT_PARTICLE:
+ contexts[0] = "particle";
+ break;
+ case BCONTEXT_PHYSICS:
+ contexts[0] = "physics";
+ break;
+ case BCONTEXT_BONE:
+ contexts[0] = "bone";
+ break;
+ case BCONTEXT_MODIFIER:
+ contexts[0] = "modifier";
+ break;
+ case BCONTEXT_CONSTRAINT:
+ contexts[0] = "constraint";
+ break;
+ case BCONTEXT_BONE_CONSTRAINT:
+ contexts[0] = "bone_constraint";
+ break;
+ case BCONTEXT_TOOL:
+ contexts[0] = "tool";
+ break;
+ }
+
+ ED_region_panels_layout_ex(C, ar, contexts, sbuts->mainb, vertical);
+}
+
+static void buttons_main_region_layout_tool(const bContext *C, SpaceButs *sbuts, ARegion *ar)
+{
+ const bool vertical = (sbuts->align == BUT_VERTICAL);
+ const char *contexts[3] = {NULL};
+
+ const WorkSpace *workspace = CTX_wm_workspace(C);
+ if (workspace->tools_space_type == SPACE_VIEW3D) {
+ const int mode = CTX_data_mode_enum(C);
+ switch (mode) {
+ case CTX_MODE_EDIT_MESH:
+ ARRAY_SET_ITEMS(contexts, ".mesh_edit");
+ break;
+ case CTX_MODE_EDIT_CURVE:
+ ARRAY_SET_ITEMS(contexts, ".curve_edit");
+ break;
+ case CTX_MODE_EDIT_SURFACE:
+ ARRAY_SET_ITEMS(contexts, ".curve_edit");
+ break;
+ case CTX_MODE_EDIT_TEXT:
+ ARRAY_SET_ITEMS(contexts, ".todo");
+ break;
+ case CTX_MODE_EDIT_ARMATURE:
+ ARRAY_SET_ITEMS(contexts, ".armature_edit");
+ break;
+ case CTX_MODE_EDIT_METABALL:
+ ARRAY_SET_ITEMS(contexts, ".todo");
+ break;
+ case CTX_MODE_EDIT_LATTICE:
+ ARRAY_SET_ITEMS(contexts, ".todo");
+ break;
+ case CTX_MODE_POSE:
+ ARRAY_SET_ITEMS(contexts, ".posemode");
+ break;
+ case CTX_MODE_SCULPT:
+ ARRAY_SET_ITEMS(contexts, ".paint_common", ".sculpt_mode");
+ break;
+ case CTX_MODE_PAINT_WEIGHT:
+ ARRAY_SET_ITEMS(contexts, ".paint_common", ".weightpaint");
+ break;
+ case CTX_MODE_PAINT_VERTEX:
+ ARRAY_SET_ITEMS(contexts, ".paint_common", ".vertexpaint");
+ break;
+ case CTX_MODE_PAINT_TEXTURE:
+ ARRAY_SET_ITEMS(contexts, ".paint_common", ".imagepaint");
+ break;
+ case CTX_MODE_PARTICLE:
+ ARRAY_SET_ITEMS(contexts, ".particlemode");
+ break;
+ case CTX_MODE_OBJECT:
+ ARRAY_SET_ITEMS(contexts, ".todo");
+ break;
+ }
+ }
+ else if (workspace->tools_space_type == SPACE_IMAGE) {
+ /* TODO */
+ }
+
+ ED_region_panels_layout_ex(C, ar, contexts, -1, vertical);
+}
+
+static void buttons_main_region_layout(const bContext *C, ARegion *ar)
+{
+ /* draw entirely, view changes should be handled here */
+ SpaceButs *sbuts = CTX_wm_space_buts(C);
+
+ if (sbuts->mainb == BCONTEXT_TOOL) {
+ buttons_main_region_layout_tool(C, sbuts, ar);
+ }
+ else {
+ buttons_main_region_layout_properties(C, sbuts, ar);
+ }
sbuts->re_align = 0;
sbuts->mainbo = sbuts->mainb;
}
+static void buttons_main_region_listener(
+ bScreen *UNUSED(sc), ScrArea *UNUSED(sa), ARegion *ar, wmNotifier *wmn,
+ const Scene *UNUSED(scene))
+{
+ /* context changes */
+ switch (wmn->category) {
+ case NC_SCREEN:
+ if (ELEM(wmn->data, ND_LAYER)) {
+ ED_region_tag_redraw(ar);
+ }
+ break;
+ }
+}
+
static void buttons_operatortypes(void)
{
- WM_operatortype_append(BUTTONS_OT_toolbox);
+ WM_operatortype_append(BUTTONS_OT_context_menu);
WM_operatortype_append(BUTTONS_OT_file_browse);
WM_operatortype_append(BUTTONS_OT_directory_browse);
}
@@ -187,7 +307,7 @@ static void buttons_keymap(struct wmKeyConfig *keyconf)
{
wmKeyMap *keymap = WM_keymap_find(keyconf, "Property Editor", SPACE_BUTS, 0);
- WM_keymap_add_item(keymap, "BUTTONS_OT_toolbox", RIGHTMOUSE, KM_PRESS, 0, 0);
+ WM_keymap_add_item(keymap, "BUTTONS_OT_context_menu", RIGHTMOUSE, KM_PRESS, 0, 0);
}
/* add handlers, stuff you only do once or on area/region changes */
@@ -206,6 +326,28 @@ static void buttons_header_region_draw(const bContext *C, ARegion *ar)
ED_region_header(C, ar);
}
+static void buttons_header_region_message_subscribe(
+ const bContext *UNUSED(C),
+ WorkSpace *UNUSED(workspace), Scene *UNUSED(scene),
+ bScreen *UNUSED(screen), ScrArea *sa, ARegion *ar,
+ struct wmMsgBus *mbus)
+{
+ SpaceButs *sbuts = sa->spacedata.first;
+ wmMsgSubscribeValue msg_sub_value_region_tag_redraw = {
+ .owner = ar,
+ .user_data = ar,
+ .notify = ED_region_do_msg_notify_tag_redraw,
+ };
+
+ /* Don't check for SpaceButs.mainb here, we may toggle between view-layers
+ * where one has no active object, so that available contexts changes. */
+ WM_msg_subscribe_rna_anon_prop(mbus, Window, view_layer, &msg_sub_value_region_tag_redraw);
+
+ if (!ELEM(sbuts->mainb, BCONTEXT_RENDER, BCONTEXT_SCENE, BCONTEXT_WORLD)) {
+ WM_msg_subscribe_rna_anon_prop(mbus, ViewLayer, name, &msg_sub_value_region_tag_redraw);
+ }
+}
+
/* draw a certain button set only if properties area is currently
* showing that button set, to reduce unnecessary drawing. */
static void buttons_area_redraw(ScrArea *sa, short buttons)
@@ -218,7 +360,9 @@ static void buttons_area_redraw(ScrArea *sa, short buttons)
}
/* reused! */
-static void buttons_area_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn)
+static void buttons_area_listener(
+ bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn, Scene *UNUSED(scene),
+ WorkSpace *UNUSED(workspace))
{
SpaceButs *sbuts = sa->spacedata.first;
@@ -228,7 +372,7 @@ static void buttons_area_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *
switch (wmn->data) {
case ND_RENDER_OPTIONS:
buttons_area_redraw(sa, BCONTEXT_RENDER);
- buttons_area_redraw(sa, BCONTEXT_RENDER_LAYER);
+ buttons_area_redraw(sa, BCONTEXT_VIEW_LAYER);
break;
case ND_WORLD:
buttons_area_redraw(sa, BCONTEXT_WORLD);
@@ -467,7 +611,9 @@ void ED_spacetype_buttons(void)
art = MEM_callocN(sizeof(ARegionType), "spacetype buttons region");
art->regionid = RGN_TYPE_WINDOW;
art->init = buttons_main_region_init;
- art->draw = buttons_main_region_draw;
+ art->layout = buttons_main_region_layout;
+ art->draw = ED_region_panels_draw;
+ art->listener = buttons_main_region_listener;
art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_FRAMES;
BLI_addhead(&st->regiontypes, art);
@@ -481,6 +627,7 @@ void ED_spacetype_buttons(void)
art->init = buttons_header_region_init;
art->draw = buttons_header_region_draw;
+ art->message_subscribe = buttons_header_region_message_subscribe;
BLI_addhead(&st->regiontypes, art);
BKE_spacetype_register(st);