VSE: Story Tools: Sync object modes when switching scenes

Currenty, when switching from one scene to another, the mode
of the active objects (before & after) is left untouched.

This becomes a workflow problem when trying to work across
different scenes. E.g. when opening the new "Storyboarding"
template and scrubbing to the next scene strip, the Grease Pencil
object is now in Object Mode, when in the previous shot it was
in Draw Mode.

To solve this, when syncing scenes try to change the mode of
the next active object to the mode of the previous active object
if the type of the object is the same.

Pull Request: https://projects.blender.org/blender/blender/pulls/146981
This commit is contained in:
Falk David
2025-09-30 10:38:30 +02:00
committed by Falk David
parent acde9be6fd
commit cd40f5b0f1

View File

@@ -29,6 +29,7 @@
#include "BKE_context.hh"
#include "BKE_global.hh"
#include "BKE_layer.hh"
#include "BKE_library.hh"
#include "BKE_main.hh"
#include "BKE_report.hh"
@@ -63,6 +64,7 @@
/* For menu, popup, icons, etc. */
#include "ED_fileselect.hh"
#include "ED_numinput.hh"
#include "ED_object.hh"
#include "ED_scene.hh"
#include "ED_screen.hh"
#include "ED_screen_types.hh"
@@ -369,6 +371,8 @@ void sync_active_scene_and_time_with_scene_strip(bContext &C)
wmWindow *win = CTX_wm_window(&C);
Scene *active_scene = WM_window_get_active_scene(win);
ViewLayer *view_layer = WM_window_get_active_view_layer(win);
Object *prev_obact = BKE_view_layer_active_object_get(view_layer);
Editing *ed = seq::editing_get(sequence_scene);
if (!ed) {
@@ -448,6 +452,14 @@ void sync_active_scene_and_time_with_scene_strip(bContext &C)
}
FRAMENUMBER_MIN_CLAMP(active_scene->r.cfra);
/* Try to sync the object mode of the active object. */
if (prev_obact) {
Object *obact = CTX_data_active_object(&C);
if (obact && prev_obact->type == obact->type) {
ed::object::mode_set(&C, eObjectMode(prev_obact->mode));
}
}
DEG_id_tag_update(&active_scene->id, ID_RECALC_FRAME_CHANGE);
WM_event_add_notifier(&C, NC_WINDOW, nullptr);
WM_event_add_notifier(&C, NC_SCENE | ND_FRAME, nullptr);