[Bf-blender-cvs] [cfcba6574ea] soc-2020-outliner: Outliner: Add initial support for properties tab switch
Nathan Craddock
noreply at git.blender.org
Wed Jun 17 06:03:15 CEST 2020
Commit: cfcba6574ea72b3ab15f2b5b73e3d8e8dc48869d
Author: Nathan Craddock
Date: Tue Jun 16 22:02:27 2020 -0600
Branches: soc-2020-outliner
https://developer.blender.org/rBcfcba6574ea72b3ab15f2b5b73e3d8e8dc48869d
Outliner: Add initial support for properties tab switch
When selecting datablocks from the outliner, switch the properties
editor to the relevant tab.
This is a very basic proof of concept implementation.
===================================================================
M source/blender/editors/include/ED_buttons.h
M source/blender/editors/space_buttons/buttons_context.c
M source/blender/editors/space_outliner/outliner_select.c
===================================================================
diff --git a/source/blender/editors/include/ED_buttons.h b/source/blender/editors/include/ED_buttons.h
index 2eaef5e82e0..18e137603da 100644
--- a/source/blender/editors/include/ED_buttons.h
+++ b/source/blender/editors/include/ED_buttons.h
@@ -27,6 +27,10 @@
extern "C" {
#endif
+struct bContext;
+
+void ED_buttons_set_context(const struct bContext *C, const short context);
+
#ifdef __cplusplus
}
#endif
diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c
index 7e6088bc3cc..84f101d60d0 100644
--- a/source/blender/editors/space_buttons/buttons_context.c
+++ b/source/blender/editors/space_buttons/buttons_context.c
@@ -102,6 +102,20 @@ static PointerRNA *get_pointer_type(ButsContextPath *path, StructRNA *type)
/************************* Creating the Path ************************/
+void ED_buttons_set_context(const bContext *C, const short context)
+{
+ bScreen *screen = CTX_wm_screen(C);
+ LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
+ LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
+ if (sl->spacetype == SPACE_PROPERTIES) {
+ SpaceProperties *sbuts = (SpaceProperties *)sl;
+ sbuts->mainbuser = context;
+ sbuts->mainb = sbuts->mainbuser;
+ }
+ }
+ }
+}
+
static int buttons_context_path_scene(ButsContextPath *path)
{
PointerRNA *ptr = &path->ptr[path->len - 1];
diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c
index 1dd47878298..081b2344308 100644
--- a/source/blender/editors/space_outliner/outliner_select.c
+++ b/source/blender/editors/space_outliner/outliner_select.c
@@ -54,6 +54,7 @@
#include "DEG_depsgraph_build.h"
#include "ED_armature.h"
+#include "ED_buttons.h"
#include "ED_gpencil.h"
#include "ED_object.h"
#include "ED_outliner.h"
@@ -515,11 +516,13 @@ static eOLDrawState tree_element_active_material(bContext *C,
* Note that RNA material update does it too, see e.g. rna_MaterialSlot_update(). */
DEG_id_tag_update((ID *)ob, ID_RECALC_TRANSFORM);
WM_event_add_notifier(C, NC_MATERIAL | ND_SHADING_LINKS, NULL);
+
+ ED_buttons_set_context(C, BCONTEXT_MATERIAL);
}
return OL_DRAWSEL_NONE;
}
-static eOLDrawState tree_element_active_camera(bContext *UNUSED(C),
+static eOLDrawState tree_element_active_camera(bContext *C,
Scene *scene,
ViewLayer *UNUSED(view_layer),
TreeElement *te,
@@ -528,6 +531,7 @@ static eOLDrawState tree_element_active_camera(bContext *UNUSED(C),
Object *ob = (Object *)outliner_search_back(te, ID_OB);
if (set != OL_SETSEL_NONE) {
+ ED_buttons_set_context(C, BCONTEXT_DATA);
return OL_DRAWSEL_NONE;
}
else {
@@ -559,6 +563,7 @@ static eOLDrawState tree_element_active_world(bContext *C,
if (sce && scene != sce) {
WM_window_set_active_scene(CTX_data_main(C), C, CTX_wm_window(C), sce);
}
+ ED_buttons_set_context(C, BCONTEXT_WORLD);
}
if (tep == NULL || tselem->id == (ID *)scene) {
@@ -853,7 +858,7 @@ static eOLDrawState tree_element_active_modifier(bContext *C,
WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
- // XXX extern_set_butspace(F9KEY, 0);
+ ED_buttons_set_context(C, BCONTEXT_MODIFIER);
}
return OL_DRAWSEL_NONE;
More information about the Bf-blender-cvs
mailing list