Fix: VSE: Scene Strip template ID "new" function not working
In the `Strip` panel in the scene template ID, the "new/duplicate" operator would duplicate the active scene in the window instead of the selected scene in the strip. Pull Request: https://projects.blender.org/blender/blender/pulls/144453
This commit is contained in:
@@ -20,12 +20,9 @@ struct Strip;
|
||||
Scene *ED_scene_add(Main *bmain, bContext *C, wmWindow *win, eSceneCopyMethod method)
|
||||
ATTR_NONNULL();
|
||||
/**
|
||||
* Add a new scene in the sequence editor.
|
||||
*
|
||||
* Special mode for adding a scene assigned to sequencer strip.
|
||||
* Add a new scene from the sequence editor.
|
||||
*/
|
||||
Scene *ED_scene_sequencer_add(
|
||||
Main *bmain, bContext *C, Strip *active_strip, eSceneCopyMethod method, bool assign_strip);
|
||||
Scene *ED_scene_sequencer_add(Main *bmain, bContext *C, eSceneCopyMethod method);
|
||||
/**
|
||||
* \note Only call outside of area/region loops.
|
||||
* \return true if successful.
|
||||
|
||||
@@ -65,33 +65,11 @@ static Scene *scene_add(Main *bmain, Scene *scene_old, eSceneCopyMethod method)
|
||||
return scene_new;
|
||||
}
|
||||
|
||||
Scene *ED_scene_sequencer_add(
|
||||
Main *bmain, bContext *C, Strip *strip, eSceneCopyMethod method, const bool assign_strip)
|
||||
Scene *ED_scene_sequencer_add(Main *bmain, bContext *C, eSceneCopyMethod method)
|
||||
{
|
||||
Scene *sequencer_scene = CTX_data_sequencer_scene(C);
|
||||
Scene *active_scene = CTX_data_scene(C);
|
||||
|
||||
Scene *scene_new = scene_add(bmain, active_scene, method);
|
||||
|
||||
/* If don't need assign the scene to the strip, nothing else to do. */
|
||||
if (!assign_strip) {
|
||||
return scene_new;
|
||||
}
|
||||
|
||||
/* As the scene is created in sequencer, do not set the new scene as active.
|
||||
* This is useful for story-boarding where we want to keep actual scene active.
|
||||
* The new scene is linked to the active strip and the viewport updated. */
|
||||
if (scene_new && strip) {
|
||||
strip->scene = scene_new;
|
||||
/* Do a refresh of the sequencer data. */
|
||||
blender::seq::relations_invalidate_cache_raw(sequencer_scene, strip);
|
||||
DEG_id_tag_update(&sequencer_scene->id, ID_RECALC_AUDIO | ID_RECALC_SEQUENCER_STRIPS);
|
||||
DEG_relations_tag_update(bmain);
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, sequencer_scene);
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_SCENEBROWSE, sequencer_scene);
|
||||
|
||||
return scene_new;
|
||||
}
|
||||
|
||||
@@ -284,14 +262,23 @@ static wmOperatorStatus scene_new_sequencer_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Main *bmain = CTX_data_main(C);
|
||||
int type = RNA_enum_get(op->ptr, "type");
|
||||
Scene *scene = CTX_data_sequencer_scene(C);
|
||||
Strip *strip = blender::seq::select_active_get(scene);
|
||||
Scene *sequencer_scene = CTX_data_sequencer_scene(C);
|
||||
Strip *strip = blender::seq::select_active_get(sequencer_scene);
|
||||
BLI_assert(strip != nullptr);
|
||||
|
||||
if (ED_scene_sequencer_add(bmain, C, strip, eSceneCopyMethod(type), true) == nullptr) {
|
||||
if (!strip->scene) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
Scene *scene_new = scene_add(bmain, strip->scene, eSceneCopyMethod(type));
|
||||
if (!scene_new) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
strip->scene = scene_new;
|
||||
/* Do a refresh of the sequencer data. */
|
||||
blender::seq::relations_invalidate_cache_raw(sequencer_scene, strip);
|
||||
DEG_id_tag_update(&sequencer_scene->id, ID_RECALC_AUDIO | ID_RECALC_SEQUENCER_STRIPS);
|
||||
DEG_relations_tag_update(bmain);
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
|
||||
@@ -731,7 +731,7 @@ static wmOperatorStatus sequencer_add_scene_strip_new_exec(bContext *C, wmOperat
|
||||
load_data_init_from_operator(&load_data, C, op);
|
||||
|
||||
int type = RNA_enum_get(op->ptr, "type");
|
||||
Scene *scene_new = ED_scene_sequencer_add(bmain, C, nullptr, eSceneCopyMethod(type), false);
|
||||
Scene *scene_new = ED_scene_sequencer_add(bmain, C, eSceneCopyMethod(type));
|
||||
if (scene_new == nullptr) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user