diff options
author | Nathan Craddock <nzcraddock@gmail.com> | 2019-08-09 22:47:53 +0300 |
---|---|---|
committer | Nathan Craddock <nzcraddock@gmail.com> | 2019-08-16 21:30:54 +0300 |
commit | b83b0d73a67a6e732a790a1d85babdbd177f9379 (patch) | |
tree | 6ec7bd54a18567d0a153ae29a44b5b82910563cd /source/blender/editors/space_outliner | |
parent | 05f2ccd6d415f76ea6278b0455914172544bc4a8 (diff) |
Outliner: set scene camera on camera data activate
Diffstat (limited to 'source/blender/editors/space_outliner')
-rw-r--r-- | source/blender/editors/space_outliner/outliner_select.c | 20 | ||||
-rw-r--r-- | source/blender/editors/space_outliner/space_outliner.c | 3 |
2 files changed, 19 insertions, 4 deletions
diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c index 6e70cdcddcd..a279512e84a 100644 --- a/source/blender/editors/space_outliner/outliner_select.c +++ b/source/blender/editors/space_outliner/outliner_select.c @@ -51,6 +51,7 @@ #include "BKE_workspace.h" #include "DEG_depsgraph.h" +#include "DEG_depsgraph_build.h" #include "ED_armature.h" #include "ED_object.h" @@ -451,9 +452,9 @@ static eOLDrawState tree_element_active_material(bContext *C, 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(sl), + ViewLayer *UNUSED(view_layer), SpaceOutliner *soops, TreeElement *te, const eOLSetState set) @@ -461,10 +462,21 @@ static eOLDrawState tree_element_active_camera(bContext *UNUSED(C), Object *ob = (Object *)outliner_search_back(soops, te, ID_OB); if (set != OL_SETSEL_NONE) { + scene->camera = ob; + + Main *bmain = CTX_data_main(C); + wmWindowManager *wm = bmain->wm.first; + + WM_windows_scene_data_sync(&wm->windows, scene); + DEG_id_tag_update(&scene->id, ID_RECALC_COPY_ON_WRITE); + DEG_relations_tag_update(bmain); + WM_event_add_notifier(C, NC_SCENE | NA_EDITED, NULL); + return OL_DRAWSEL_NONE; } - - return scene->camera == ob; + else { + return scene->camera == ob; + } } static eOLDrawState tree_element_active_world(bContext *C, diff --git a/source/blender/editors/space_outliner/space_outliner.c b/source/blender/editors/space_outliner/space_outliner.c index 3ac09b8bcf8..79880c68120 100644 --- a/source/blender/editors/space_outliner/space_outliner.c +++ b/source/blender/editors/space_outliner/space_outliner.c @@ -131,6 +131,9 @@ static void outliner_main_region_listener(wmWindow *UNUSED(win), ED_region_tag_redraw(ar); break; } + if (wmn->action & NA_EDITED) { + ED_region_tag_redraw(ar); + } break; case NC_OBJECT: switch (wmn->data) { |