Fix missing refresh of editors when changing workspace view-layer
Needs to use new messaging system.
This commit is contained in:
parent
2b25d8ea30
commit
9515737b55
Notes:
blender-bot
2023-02-14 06:18:26 +01:00
Referenced by commit b517dc9b2d
, Fix T53638: View layer renaming crashes 1/2
Referenced by issue #53638, View layer renaming crashes
|
@ -225,6 +225,23 @@ static void buttons_header_region_draw(const bContext *C, ARegion *ar)
|
|||
ED_region_header(C, ar);
|
||||
}
|
||||
|
||||
static void buttons_header_region_message_subscribe(
|
||||
const struct bContext *UNUSED(C),
|
||||
struct WorkSpace *UNUSED(workspace), struct Scene *UNUSED(scene),
|
||||
struct bScreen *UNUSED(screen), struct ScrArea *UNUSED(sa), struct ARegion *ar,
|
||||
struct wmMsgBus *mbus)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
/* 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)
|
||||
|
@ -503,6 +520,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);
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
#include "ED_screen.h"
|
||||
|
||||
#include "WM_api.h"
|
||||
#include "WM_message.h"
|
||||
#include "WM_types.h"
|
||||
|
||||
#include "BIF_gl.h"
|
||||
|
@ -423,6 +424,24 @@ static void outliner_main_region_listener(
|
|||
|
||||
}
|
||||
|
||||
static void outliner_main_region_message_subscribe(
|
||||
const struct bContext *UNUSED(C),
|
||||
struct WorkSpace *UNUSED(workspace), struct Scene *UNUSED(scene),
|
||||
struct bScreen *UNUSED(screen), struct ScrArea *sa, struct ARegion *ar,
|
||||
struct wmMsgBus *mbus)
|
||||
{
|
||||
SpaceOops *soops = sa->spacedata.first;
|
||||
wmMsgSubscribeValue msg_sub_value_region_tag_redraw = {
|
||||
.owner = ar,
|
||||
.user_data = ar,
|
||||
.notify = ED_region_do_msg_notify_tag_redraw,
|
||||
};
|
||||
|
||||
if (ELEM(soops->outlinevis, SO_ACT_LAYER, SO_COLLECTIONS)) {
|
||||
WM_msg_subscribe_rna_anon_prop(mbus, Window, view_layer, &msg_sub_value_region_tag_redraw);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* ************************ header outliner area region *********************** */
|
||||
|
||||
|
@ -576,6 +595,7 @@ void ED_spacetype_outliner(void)
|
|||
art->draw = outliner_main_region_draw;
|
||||
art->free = outliner_main_region_free;
|
||||
art->listener = outliner_main_region_listener;
|
||||
art->message_subscribe = outliner_main_region_message_subscribe;
|
||||
BLI_addhead(&st->regiontypes, art);
|
||||
|
||||
/* regions: header */
|
||||
|
|
|
@ -1073,6 +1073,8 @@ static void view3d_main_region_message_subscribe(
|
|||
|
||||
/* Only subscribe to types. */
|
||||
StructRNA *type_array[] = {
|
||||
&RNA_Window,
|
||||
|
||||
/* These object have properties that impact drawing. */
|
||||
&RNA_AreaLamp,
|
||||
&RNA_Camera,
|
||||
|
|
|
@ -763,10 +763,8 @@ static PointerRNA rna_Window_view_layer_get(PointerRNA *ptr)
|
|||
Scene *scene = WM_window_get_active_scene(win);
|
||||
WorkSpace *workspace = WM_window_get_active_workspace(win);
|
||||
ViewLayer *view_layer = BKE_workspace_view_layer_get(workspace, scene);
|
||||
PointerRNA scene_ptr;
|
||||
|
||||
RNA_id_pointer_create(&scene->id, &scene_ptr);
|
||||
return rna_pointer_inherit_refine(&scene_ptr, &RNA_ViewLayer, view_layer);
|
||||
return rna_pointer_inherit_refine(ptr, &RNA_ViewLayer, view_layer);
|
||||
}
|
||||
|
||||
static void rna_Window_view_layer_set(PointerRNA *ptr, PointerRNA value)
|
||||
|
|
Loading…
Reference in New Issue