diff --git a/doc/python_api/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py index acf37cf8b8c..ed7876e145c 100644 --- a/doc/python_api/sphinx_doc_gen.py +++ b/doc/python_api/sphinx_doc_gen.py @@ -1178,6 +1178,7 @@ context_type_map = { "active_operator": [("Operator", False)], "active_pose_bone": [("PoseBone", False)], "active_sequence_strip": [("Strip", False)], + "active_strip": [("Strip", False)], "active_editable_fcurve": [("FCurve", False)], "active_nla_strip": [("NlaStrip", False)], "active_nla_track": [("NlaTrack", False)], @@ -1238,6 +1239,7 @@ context_type_map = { "selected_editable_keyframes": [("Keyframe", True)], "selected_editable_objects": [("Object", True)], "selected_editable_sequences": [("Strip", True)], + "selected_editable_strips": [("Strip", True)], "selected_files": [("FileSelectEntry", True)], "selected_ids": [("ID", True)], "selected_nla_strips": [("NlaStrip", True)], @@ -1247,9 +1249,11 @@ context_type_map = { "selected_pose_bones": [("PoseBone", True)], "selected_pose_bones_from_active_object": [("PoseBone", True)], "selected_sequences": [("Strip", True)], + "selected_strips": [("Strip", True)], "selected_visible_actions": [("Action", True)], "selected_visible_fcurves": [("FCurve", True)], "sequences": [("Strip", True)], + "strips": [("Strip", True)], "soft_body": [("SoftBodyModifier", False)], "speaker": [("Speaker", False)], "texture": [("Texture", False)], diff --git a/scripts/startup/bl_operators/sequencer.py b/scripts/startup/bl_operators/sequencer.py index 5e3d656d2c7..e53c538418b 100644 --- a/scripts/startup/bl_operators/sequencer.py +++ b/scripts/startup/bl_operators/sequencer.py @@ -34,14 +34,14 @@ class SequencerCrossfadeSounds(Operator): @classmethod def poll(cls, context): - strip = context.active_sequence_strip + strip = context.active_strip return strip and (strip.type == 'SOUND') def execute(self, context): scene = context.scene seq1 = None seq2 = None - for strip in scene.sequence_editor.sequences_all: + for strip in scene.sequence_editor.strips_all: if strip.select and strip.type == 'SOUND': if seq1 is None: seq1 = strip @@ -89,14 +89,14 @@ class SequencerSplitMulticam(Operator): @classmethod def poll(cls, context): - strip = context.active_sequence_strip + strip = context.active_strip return strip and (strip.type == 'MULTICAM') def execute(self, context): scene = context.scene camera = self.camera - strip = context.active_sequence_strip + strip = context.active_strip if strip.multicam_source == camera or camera >= strip.channel: return {'FINISHED'} @@ -109,7 +109,7 @@ class SequencerSplitMulticam(Operator): right_strip.select = True scene.sequence_editor.active_strip = right_strip - context.active_sequence_strip.multicam_source = camera + context.active_strip.multicam_source = camera return {'FINISHED'} @@ -126,7 +126,7 @@ class SequencerDeinterlaceSelectedMovies(Operator): return (scene and scene.sequence_editor) def execute(self, context): - for strip in context.scene.sequence_editor.sequences_all: + for strip in context.scene.sequence_editor.strips_all: if strip.select and strip.type == 'MOVIE': strip.use_deinterlace = True @@ -141,7 +141,7 @@ class SequencerFadesClear(Operator): @classmethod def poll(cls, context): - strip = context.active_sequence_strip + strip = context.active_strip return strip is not None def execute(self, context): @@ -156,9 +156,9 @@ class SequencerFadesClear(Operator): fcurve_map = { curve.data_path: curve for curve in fcurves - if curve.data_path.startswith("sequence_editor.sequences_all") + if curve.data_path.startswith("sequence_editor.strips_all") } - for sequence in context.selected_sequences: + for sequence in context.selected_strips: for animated_property in _animated_properties_get(sequence): data_path = sequence.path_from_id() + "." + animated_property curve = fcurve_map.get(data_path) @@ -199,8 +199,8 @@ class SequencerFadesAdd(Operator): @classmethod def poll(cls, context): - # Can't use context.selected_sequences as it can have an impact on performances - strip = context.active_sequence_strip + # Can't use context.selected_strips as it can have an impact on performances + strip = context.active_strip return strip is not None def execute(self, context): @@ -214,7 +214,7 @@ class SequencerFadesAdd(Operator): action = bpy.data.actions.new(scene.name + "Action") scene.animation_data.action = action - sequences = context.selected_sequences + sequences = context.selected_strips if not sequences: self.report({'ERROR'}, "No sequences selected") diff --git a/scripts/startup/bl_operators/wm.py b/scripts/startup/bl_operators/wm.py index bf595a091c4..b3160ec5c15 100644 --- a/scripts/startup/bl_operators/wm.py +++ b/scripts/startup/bl_operators/wm.py @@ -2845,9 +2845,9 @@ class WM_OT_batch_rename(Operator): return data_type_test if data_type == data_type_test: data = ( - context.selected_sequences + context.selected_strips if only_selected else - scene.sequence_editor.sequences_all, + scene.sequence_editor.strips_all, "name", iface_("Strip(s)"), ) diff --git a/scripts/startup/bl_ui/space_sequencer.py b/scripts/startup/bl_ui/space_sequencer.py index ad7132d60ee..7e325228f21 100644 --- a/scripts/startup/bl_ui/space_sequencer.py +++ b/scripts/startup/bl_ui/space_sequencer.py @@ -31,7 +31,7 @@ def _space_view_types(st): def selected_strips_count(context): - selected_strips = getattr(context, "selected_sequences", None) + selected_strips = getattr(context, "selected_strips", None) if selected_strips is None: return 0, 0 @@ -637,7 +637,7 @@ class SEQUENCER_MT_change(Menu): def draw(self, context): layout = self.layout - strip = context.active_sequence_strip + strip = context.active_strip layout.operator_context = 'INVOKE_REGION_WIN' if strip and strip.type == 'SCENE': @@ -948,7 +948,7 @@ class SEQUENCER_MT_strip_input(Menu): def draw(self, context): layout = self.layout - strip = context.active_sequence_strip + strip = context.active_strip layout.operator("sequencer.reload", text="Reload Strips") layout.operator("sequencer.reload", text="Reload Strips and Adjust Length").adjust_length = True @@ -1011,7 +1011,7 @@ class SEQUENCER_MT_strip_retiming(Menu): def draw(self, context): is_retiming = context.scene.sequence_editor is not None and \ context.scene.sequence_editor.selected_retiming_keys - strip = context.active_sequence_strip + strip = context.active_strip layout = self.layout layout.operator("sequencer.retiming_key_add") @@ -1054,7 +1054,7 @@ class SEQUENCER_MT_strip(Menu): else: layout.operator_context = 'INVOKE_REGION_WIN' - strip = context.active_sequence_strip + strip = context.active_strip if has_preview: layout.separator() @@ -1235,7 +1235,7 @@ class SEQUENCER_MT_context_menu(Menu): props.keep_open = False layout.operator("sequencer.delete", text="Delete") - strip = context.active_sequence_strip + strip = context.active_strip if strip and strip.type == 'SCENE': layout.operator("sequencer.delete", text="Delete Strip & Data").delete_data = True layout.operator("sequencer.scene_frame_range_update") @@ -1410,7 +1410,7 @@ class SequencerButtonsPanel: @classmethod def poll(cls, context): - return cls.has_sequencer(context) and (context.active_sequence_strip is not None) + return cls.has_sequencer(context) and (context.active_strip is not None) class SequencerButtonsPanel_Output: @@ -1437,7 +1437,7 @@ class SequencerColorTagPicker: @classmethod def poll(cls, context): - return cls.has_sequencer(context) and context.active_sequence_strip is not None + return cls.has_sequencer(context) and context.active_strip is not None class SEQUENCER_PT_color_tag_picker(SequencerColorTagPicker, Panel): @@ -1472,7 +1472,7 @@ class SEQUENCER_PT_strip(SequencerButtonsPanel, Panel): def draw(self, context): layout = self.layout - strip = context.active_sequence_strip + strip = context.active_strip strip_type = strip.type if strip_type in { @@ -1535,14 +1535,14 @@ class SEQUENCER_PT_adjust_crop(SequencerButtonsPanel, Panel): if not cls.has_sequencer(context): return False - strip = context.active_sequence_strip + strip = context.active_strip if not strip: return False return strip.type != 'SOUND' def draw(self, context): - strip = context.active_sequence_strip + strip = context.active_strip layout = self.layout layout.use_property_split = True layout.active = not strip.mute @@ -1563,7 +1563,7 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel, Panel): if not cls.has_sequencer(context): return False - strip = context.active_sequence_strip + strip = context.active_strip if not strip: return False @@ -1578,7 +1578,7 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel, Panel): layout = self.layout layout.use_property_split = True - strip = context.active_sequence_strip + strip = context.active_strip layout.active = not strip.mute @@ -1723,11 +1723,11 @@ class SEQUENCER_PT_effect_text_layout(SequencerButtonsPanel, Panel): @classmethod def poll(cls, context): - strip = context.active_sequence_strip + strip = context.active_strip return strip.type == 'TEXT' def draw(self, context): - strip = context.active_sequence_strip + strip = context.active_strip layout = self.layout layout.use_property_split = True col = layout.column() @@ -1744,11 +1744,11 @@ class SEQUENCER_PT_effect_text_style(SequencerButtonsPanel, Panel): @classmethod def poll(cls, context): - strip = context.active_sequence_strip + strip = context.active_strip return strip.type == 'TEXT' def draw(self, context): - strip = context.active_sequence_strip + strip = context.active_strip layout = self.layout layout.use_property_split = True col = layout.column() @@ -1771,16 +1771,16 @@ class SEQUENCER_PT_effect_text_outline(SequencerButtonsPanel, Panel): @classmethod def poll(cls, context): - strip = context.active_sequence_strip + strip = context.active_strip return strip.type == "TEXT" def draw_header(self, context): - strip = context.active_sequence_strip + strip = context.active_strip layout = self.layout layout.prop(strip, "use_outline", text="") def draw(self, context): - strip = context.active_sequence_strip + strip = context.active_strip layout = self.layout layout.use_property_split = True @@ -1798,16 +1798,16 @@ class SEQUENCER_PT_effect_text_shadow(SequencerButtonsPanel, Panel): @classmethod def poll(cls, context): - strip = context.active_sequence_strip + strip = context.active_strip return strip.type == "TEXT" def draw_header(self, context): - strip = context.active_sequence_strip + strip = context.active_strip layout = self.layout layout.prop(strip, "use_shadow", text="") def draw(self, context): - strip = context.active_sequence_strip + strip = context.active_strip layout = self.layout layout.use_property_split = True @@ -1828,16 +1828,16 @@ class SEQUENCER_PT_effect_text_box(SequencerButtonsPanel, Panel): @classmethod def poll(cls, context): - strip = context.active_sequence_strip + strip = context.active_strip return strip.type == "TEXT" def draw_header(self, context): - strip = context.active_sequence_strip + strip = context.active_strip layout = self.layout layout.prop(strip, "use_box", text="") def draw(self, context): - strip = context.active_sequence_strip + strip = context.active_strip layout = self.layout layout.use_property_split = True @@ -1858,7 +1858,7 @@ class SEQUENCER_PT_source(SequencerButtonsPanel, Panel): if not cls.has_sequencer(context): return False - strip = context.active_sequence_strip + strip = context.active_strip if not strip: return False @@ -1870,7 +1870,7 @@ class SEQUENCER_PT_source(SequencerButtonsPanel, Panel): layout.use_property_decorate = False scene = context.scene - strip = context.active_sequence_strip + strip = context.active_strip strip_type = strip.type layout.active = not strip.mute @@ -1984,7 +1984,7 @@ class SEQUENCER_PT_movie_clip(SequencerButtonsPanel, Panel): if not cls.has_sequencer(context): return False - strip = context.active_sequence_strip + strip = context.active_strip if not strip: return False @@ -1995,7 +1995,7 @@ class SEQUENCER_PT_movie_clip(SequencerButtonsPanel, Panel): layout.use_property_split = True layout.use_property_decorate = False - strip = context.active_sequence_strip + strip = context.active_strip layout.active = not strip.mute layout.template_ID(strip, "clip") @@ -2024,14 +2024,14 @@ class SEQUENCER_PT_scene(SequencerButtonsPanel, Panel): if not cls.has_sequencer(context): return False - strip = context.active_sequence_strip + strip = context.active_strip if not strip: return False return (strip.type == 'SCENE') def draw(self, context): - strip = context.active_sequence_strip + strip = context.active_strip scene = strip.scene layout = self.layout @@ -2063,14 +2063,14 @@ class SEQUENCER_PT_scene_sound(SequencerButtonsPanel, Panel): if not cls.has_sequencer(context): return False - strip = context.active_sequence_strip + strip = context.active_strip if not strip: return False return (strip.type == 'SCENE') def draw(self, context): - strip = context.active_sequence_strip + strip = context.active_strip layout = self.layout layout.use_property_split = True @@ -2096,7 +2096,7 @@ class SEQUENCER_PT_mask(SequencerButtonsPanel, Panel): if not cls.has_sequencer(context): return False - strip = context.active_sequence_strip + strip = context.active_strip if not strip: return False @@ -2106,7 +2106,7 @@ class SEQUENCER_PT_mask(SequencerButtonsPanel, Panel): layout = self.layout layout.use_property_split = True - strip = context.active_sequence_strip + strip = context.active_strip layout.active = not strip.mute @@ -2133,7 +2133,7 @@ class SEQUENCER_PT_time(SequencerButtonsPanel, Panel): if not cls.has_sequencer(context): return False - strip = context.active_sequence_strip + strip = context.active_strip if not strip: return False @@ -2142,7 +2142,7 @@ class SEQUENCER_PT_time(SequencerButtonsPanel, Panel): def draw_header_preset(self, context): layout = self.layout layout.alignment = 'RIGHT' - strip = context.active_sequence_strip + strip = context.active_strip layout.prop(strip, "lock", text="", icon_only=True, emboss=False) @@ -2155,7 +2155,7 @@ class SEQUENCER_PT_time(SequencerButtonsPanel, Panel): scene = context.scene frame_current = scene.frame_current - strip = context.active_sequence_strip + strip = context.active_strip is_effect = isinstance(strip, bpy.types.EffectStrip) @@ -2287,7 +2287,7 @@ class SEQUENCER_PT_adjust_sound(SequencerButtonsPanel, Panel): if not cls.has_sequencer(context): return False - strip = context.active_sequence_strip + strip = context.active_strip if not strip: return False @@ -2298,7 +2298,7 @@ class SEQUENCER_PT_adjust_sound(SequencerButtonsPanel, Panel): st = context.space_data overlay_settings = st.timeline_overlay - strip = context.active_sequence_strip + strip = context.active_strip sound = strip.sound layout.active = not strip.mute @@ -2366,7 +2366,7 @@ class SEQUENCER_PT_adjust_comp(SequencerButtonsPanel, Panel): if not cls.has_sequencer(context): return False - strip = context.active_sequence_strip + strip = context.active_strip if not strip: return False @@ -2376,7 +2376,7 @@ class SEQUENCER_PT_adjust_comp(SequencerButtonsPanel, Panel): layout = self.layout layout.use_property_split = True - strip = context.active_sequence_strip + strip = context.active_strip layout.active = not strip.mute @@ -2395,14 +2395,14 @@ class SEQUENCER_PT_adjust_transform(SequencerButtonsPanel, Panel): if not cls.has_sequencer(context): return False - strip = context.active_sequence_strip + strip = context.active_strip if not strip: return False return strip.type != 'SOUND' def draw(self, context): - strip = context.active_sequence_strip + strip = context.active_strip layout = self.layout layout.use_property_split = True layout.active = not strip.mute @@ -2439,7 +2439,7 @@ class SEQUENCER_PT_adjust_video(SequencerButtonsPanel, Panel): if not cls.has_sequencer(context): return False - strip = context.active_sequence_strip + strip = context.active_strip if not strip: return False @@ -2458,7 +2458,7 @@ class SEQUENCER_PT_adjust_video(SequencerButtonsPanel, Panel): col = layout.column() - strip = context.active_sequence_strip + strip = context.active_strip layout.active = not strip.mute @@ -2476,7 +2476,7 @@ class SEQUENCER_PT_adjust_color(SequencerButtonsPanel, Panel): if not cls.has_sequencer(context): return False - strip = context.active_sequence_strip + strip = context.active_strip if not strip: return False @@ -2492,7 +2492,7 @@ class SEQUENCER_PT_adjust_color(SequencerButtonsPanel, Panel): layout = self.layout layout.use_property_split = True - strip = context.active_sequence_strip + strip = context.active_strip layout.active = not strip.mute @@ -2592,14 +2592,14 @@ class SEQUENCER_PT_strip_proxy(SequencerButtonsPanel, Panel): if not cls.has_sequencer(context) and context.scene.sequence_editor: return False - strip = context.active_sequence_strip + strip = context.active_strip if not strip: return False return strip.type in {'MOVIE', 'IMAGE'} def draw_header(self, context): - strip = context.active_sequence_strip + strip = context.active_strip self.layout.prop(strip, "use_proxy", text="") @@ -2610,7 +2610,7 @@ class SEQUENCER_PT_strip_proxy(SequencerButtonsPanel, Panel): ed = context.scene.sequence_editor - strip = context.active_sequence_strip + strip = context.active_strip if strip.proxy: proxy = strip.proxy @@ -2654,12 +2654,12 @@ class SEQUENCER_PT_strip_cache(SequencerButtonsPanel, Panel): show_developer_ui = context.preferences.view.show_developer_ui if not cls.has_sequencer(context): return False - if context.active_sequence_strip is not None and show_developer_ui: + if context.active_strip is not None and show_developer_ui: return True return False def draw_header(self, context): - strip = context.active_sequence_strip + strip = context.active_strip self.layout.prop(strip, "override_cache_settings", text="") def draw(self, context): @@ -2667,7 +2667,7 @@ class SEQUENCER_PT_strip_cache(SequencerButtonsPanel, Panel): layout.use_property_split = True layout.use_property_decorate = False - strip = context.active_sequence_strip + strip = context.active_strip layout.active = strip.override_cache_settings col = layout.column(heading="Cache") @@ -2848,7 +2848,7 @@ class SEQUENCER_PT_modifiers(SequencerButtonsPanel, Panel): layout = self.layout layout.use_property_split = True - strip = context.active_sequence_strip + strip = context.active_strip ed = context.scene.sequence_editor if strip.type == 'SOUND': sound = strip.sound @@ -2921,7 +2921,7 @@ class SEQUENCER_PT_modifiers(SequencerButtonsPanel, Panel): sequences_object = ed if ed.meta_stack: sequences_object = ed.meta_stack[-1] - col.prop_search(mod, "input_mask_strip", sequences_object, "sequences", text="Mask") + col.prop_search(mod, "input_mask_strip", sequences_object, "strips", text="Mask") else: col.prop(mod, "input_mask_id") row = col.row() @@ -3012,7 +3012,7 @@ class SEQUENCER_PT_custom_props(SequencerButtonsPanel, PropertyPanel, Panel): 'BLENDER_RENDER', 'BLENDER_WORKBENCH', } - _context_path = "active_sequence_strip" + _context_path = "active_strip" _property_type = (bpy.types.Strip,) bl_category = "Strip" diff --git a/scripts/startup/bl_ui/space_topbar.py b/scripts/startup/bl_ui/space_topbar.py index 6148464ba4b..31855ba8e72 100644 --- a/scripts/startup/bl_ui/space_topbar.py +++ b/scripts/startup/bl_ui/space_topbar.py @@ -687,7 +687,7 @@ class TOPBAR_PT_name(Panel): found = False if space_type == 'SEQUENCE_EDITOR': layout.label(text="Sequence Strip Name") - item = context.active_sequence_strip + item = context.active_strip if item: row = row_with_icon(layout, 'SEQUENCE') row.prop(item, "name", text="") diff --git a/source/blender/blenloader/intern/versioning_400.cc b/source/blender/blenloader/intern/versioning_400.cc index 379705cc425..454f307c069 100644 --- a/source/blender/blenloader/intern/versioning_400.cc +++ b/source/blender/blenloader/intern/versioning_400.cc @@ -1492,6 +1492,34 @@ void do_versions_after_linking_400(FileData *fd, Main *bmain) } } + if (!MAIN_VERSION_FILE_ATLEAST(bmain, 404, 24)) { + LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) { + if (!scene->adt) { + continue; + } + using namespace blender; + auto replace_rna_path_prefix = + [](FCurve &fcurve, const StringRef old_prefix, const StringRef new_prefix) { + const StringRef rna_path = fcurve.rna_path; + if (!rna_path.startswith(old_prefix)) { + return; + } + const StringRef tail = rna_path.drop_prefix(old_prefix.size()); + char *new_rna_path = BLI_strdupcat(new_prefix.data(), tail.data()); + MEM_freeN(fcurve.rna_path); + fcurve.rna_path = new_rna_path; + }; + if (scene->adt->action) { + animrig::foreach_fcurve_in_action(scene->adt->action->wrap(), [&](FCurve &fcurve) { + replace_rna_path_prefix(fcurve, "sequence_editor.sequences", "sequence_editor.strips"); + }); + } + LISTBASE_FOREACH (FCurve *, driver, &scene->adt->drivers) { + replace_rna_path_prefix(*driver, "sequence_editor.sequences", "sequence_editor.strips"); + } + } + } + /** * Always bump subversion in BKE_blender_version.h when adding versioning * code here, and wrap it inside a MAIN_VERSION_FILE_ATLEAST check. diff --git a/source/blender/editors/animation/anim_deps.cc b/source/blender/editors/animation/anim_deps.cc index 63ca67a9033..b42e947133a 100644 --- a/source/blender/editors/animation/anim_deps.cc +++ b/source/blender/editors/animation/anim_deps.cc @@ -184,9 +184,9 @@ static void animchan_sync_fcurve_scene(bAnimListElem *ale) FCurve *fcu = (FCurve *)ale->data; Strip *strip = nullptr; - /* Only affect if F-Curve involves sequence_editor.sequences. */ + /* Only affect if F-Curve involves sequence_editor.strips. */ char strip_name[sizeof(strip->name)]; - if (!BLI_str_quoted_substr(fcu->rna_path, "sequences_all[", strip_name, sizeof(strip_name))) { + if (!BLI_str_quoted_substr(fcu->rna_path, "strips_all[", strip_name, sizeof(strip_name))) { return; } diff --git a/source/blender/editors/animation/anim_filter.cc b/source/blender/editors/animation/anim_filter.cc index d62c48e1b57..e439b25d05f 100644 --- a/source/blender/editors/animation/anim_filter.cc +++ b/source/blender/editors/animation/anim_filter.cc @@ -1013,9 +1013,9 @@ static bool skip_fcurve_selected_data(bAnimContext *ac, Strip *strip = nullptr; char strip_name[sizeof(strip->name)]; - /* Only consider if F-Curve involves `sequence_editor.sequences`. */ + /* Only consider if F-Curve involves `sequence_editor.strips`. */ if (fcu->rna_path && - BLI_str_quoted_substr(fcu->rna_path, "sequences_all[", strip_name, sizeof(strip_name))) + BLI_str_quoted_substr(fcu->rna_path, "strips_all[", strip_name, sizeof(strip_name))) { /* Get strip name, and check if this strip is selected. */ Editing *ed = SEQ_editing_get(scene); diff --git a/source/blender/editors/animation/anim_ipo_utils.cc b/source/blender/editors/animation/anim_ipo_utils.cc index c980bf48074..1fe11ad113a 100644 --- a/source/blender/editors/animation/anim_ipo_utils.cc +++ b/source/blender/editors/animation/anim_ipo_utils.cc @@ -133,7 +133,7 @@ std::optional getname_anim_fcurve(char *name, ID *id, FCurve *fcu) if (GS(ptr.owner_id->name) == ID_SCE) { char stripname[name_maxncpy]; if (BLI_str_quoted_substr( - fcu->rna_path, "sequence_editor.sequences_all[", stripname, sizeof(stripname))) + fcu->rna_path, "sequence_editor.strips_all[", stripname, sizeof(stripname))) { if (strstr(fcu->rna_path, ".transform.") || strstr(fcu->rna_path, ".crop.") || strstr(fcu->rna_path, ".modifiers[")) diff --git a/source/blender/editors/interface/interface_ops.cc b/source/blender/editors/interface/interface_ops.cc index b095f57d7b0..2e70e9e7141 100644 --- a/source/blender/editors/interface/interface_ops.cc +++ b/source/blender/editors/interface/interface_ops.cc @@ -1173,14 +1173,14 @@ bool UI_context_copy_to_selected_list(bContext *C, *r_lb = list_of_things; } else if (RNA_struct_is_a(ptr->type, &RNA_Strip)) { - /* Special case when we do this for 'Sequence.lock'. - * (if the sequence is locked, it won't be in "selected_editable_sequences"). */ + /* Special case when we do this for 'Strip.lock'. + * (if the strip is locked, it won't be in "selected_editable_strips"). */ const char *prop_id = RNA_property_identifier(prop); if (STREQ(prop_id, "lock")) { - *r_lb = CTX_data_collection_get(C, "selected_sequences"); + *r_lb = CTX_data_collection_get(C, "selected_strips"); } else { - *r_lb = CTX_data_collection_get(C, "selected_editable_sequences"); + *r_lb = CTX_data_collection_get(C, "selected_editable_strips"); } if (is_rna) { @@ -1303,14 +1303,14 @@ bool UI_context_copy_to_selected_list(bContext *C, * to handle situations like #41062... */ *r_path = RNA_path_resolve_from_type_to_property(ptr, prop, &RNA_Strip); if (r_path->has_value()) { - /* Special case when we do this for 'Sequence.lock'. - * (if the sequence is locked, it won't be in "selected_editable_sequences"). */ + /* Special case when we do this for 'Strip.lock'. + * (if the strip is locked, it won't be in "selected_editable_strips"). */ const char *prop_id = RNA_property_identifier(prop); if (is_rna && STREQ(prop_id, "lock")) { - *r_lb = CTX_data_collection_get(C, "selected_sequences"); + *r_lb = CTX_data_collection_get(C, "selected_strips"); } else { - *r_lb = CTX_data_collection_get(C, "selected_editable_sequences"); + *r_lb = CTX_data_collection_get(C, "selected_editable_strips"); } if (is_rna) { diff --git a/source/blender/editors/screen/screen_context.cc b/source/blender/editors/screen/screen_context.cc index e5a403b0844..807f35cea98 100644 --- a/source/blender/editors/screen/screen_context.cc +++ b/source/blender/editors/screen/screen_context.cc @@ -85,10 +85,10 @@ const char *screen_context_dir[] = { "image_paint_object", "particle_edit_object", "pose_object", - "active_sequence_strip", - "sequences", - "selected_sequences", - "selected_editable_sequences", /* sequencer */ + "active_sequence_strip", /* DEPRECATED - use "active_strip" */ + "sequences", /* DEPRECATED - use "strips" */ + "selected_sequences", /* DEPRECATED - use "selected_strips" */ + "selected_editable_sequences", /* DEPRECATED - use "selected_editable_strips" */ "active_nla_track", "active_nla_strip", "selected_nla_strips", /* nla editor */ @@ -112,6 +112,10 @@ const char *screen_context_dir[] = { "ui_list", "property", "asset_library_reference", + "active_strip", + "strips", + "selected_strips", + "selected_editable_strips", nullptr, }; @@ -1131,6 +1135,67 @@ static eContextResult screen_ctx_ui_list(const bContext *C, bContextDataResult * return CTX_RESULT_NO_DATA; } +static eContextResult screen_ctx_active_strip(const bContext *C, bContextDataResult *result) +{ + wmWindow *win = CTX_wm_window(C); + Scene *scene = WM_window_get_active_scene(win); + Strip *strip = SEQ_select_active_get(scene); + if (strip) { + CTX_data_pointer_set(result, &scene->id, &RNA_Strip, strip); + return CTX_RESULT_OK; + } + return CTX_RESULT_NO_DATA; +} +static eContextResult screen_ctx_strips(const bContext *C, bContextDataResult *result) +{ + wmWindow *win = CTX_wm_window(C); + Scene *scene = WM_window_get_active_scene(win); + Editing *ed = SEQ_editing_get(scene); + if (ed) { + LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) { + CTX_data_list_add(result, &scene->id, &RNA_Strip, strip); + } + CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION); + return CTX_RESULT_OK; + } + return CTX_RESULT_NO_DATA; +} +static eContextResult screen_ctx_selected_strips(const bContext *C, bContextDataResult *result) +{ + wmWindow *win = CTX_wm_window(C); + Scene *scene = WM_window_get_active_scene(win); + Editing *ed = SEQ_editing_get(scene); + if (ed) { + LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) { + if (strip->flag & SELECT) { + CTX_data_list_add(result, &scene->id, &RNA_Strip, strip); + } + } + CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION); + return CTX_RESULT_OK; + } + return CTX_RESULT_NO_DATA; +} +static eContextResult screen_ctx_selected_editable_strips(const bContext *C, + bContextDataResult *result) +{ + wmWindow *win = CTX_wm_window(C); + Scene *scene = WM_window_get_active_scene(win); + Editing *ed = SEQ_editing_get(scene); + if (ed == nullptr) { + return CTX_RESULT_NO_DATA; + } + + ListBase *channels = SEQ_channels_displayed_get(ed); + LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) { + if (strip->flag & SELECT && !SEQ_transform_is_locked(channels, strip)) { + CTX_data_list_add(result, &scene->id, &RNA_Strip, strip); + } + } + CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION); + return CTX_RESULT_OK; +} + /* Registry of context callback functions. */ using context_callback = eContextResult (*)(const bContext *C, bContextDataResult *result); @@ -1167,10 +1232,11 @@ ensure_ed_screen_context_functions() map.add("image_paint_object", screen_ctx_image_paint_object); map.add("particle_edit_object", screen_ctx_particle_edit_object); map.add("pose_object", screen_ctx_pose_object); - map.add("active_sequence_strip", screen_ctx_active_sequence_strip); - map.add("sequences", screen_ctx_sequences); - map.add("selected_sequences", screen_ctx_selected_sequences); - map.add("selected_editable_sequences", screen_ctx_selected_editable_sequences); + map.add("active_sequence_strip", screen_ctx_active_sequence_strip); /* DEPRECATED */ + map.add("sequences", screen_ctx_sequences); /* DEPRECATED */ + map.add("selected_sequences", screen_ctx_selected_sequences); /* DEPRECATED */ + map.add("selected_editable_sequences", + screen_ctx_selected_editable_sequences); /* DEPRECATED */ map.add("active_nla_track", screen_ctx_active_nla_track); map.add("active_nla_strip", screen_ctx_active_nla_strip); map.add("selected_nla_strips", screen_ctx_selected_nla_strips); @@ -1192,6 +1258,10 @@ ensure_ed_screen_context_functions() map.add("asset_library_reference", screen_ctx_asset_library); map.add("ui_list", screen_ctx_ui_list); map.add("property", screen_ctx_property); + map.add("active_strip", screen_ctx_active_strip); + map.add("strips", screen_ctx_strips); + map.add("selected_strips", screen_ctx_selected_strips); + map.add("selected_editable_strips", screen_ctx_selected_editable_strips); return map; }(); return screen_context_functions; diff --git a/source/blender/editors/space_sequencer/sequencer_edit.cc b/source/blender/editors/space_sequencer/sequencer_edit.cc index 233fe129968..4045e2b2b72 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.cc +++ b/source/blender/editors/space_sequencer/sequencer_edit.cc @@ -113,7 +113,7 @@ bool ED_space_sequencer_check_show_strip(SpaceSeq *sseq) static bool sequencer_fcurves_targets_color_strip(const FCurve *fcurve) { - if (!BLI_str_startswith(fcurve->rna_path, "sequence_editor.sequences_all[\"")) { + if (!BLI_str_startswith(fcurve->rna_path, "sequence_editor.strips_all[\"")) { return false; } diff --git a/source/blender/makesrna/intern/rna_internal.hh b/source/blender/makesrna/intern/rna_internal.hh index 5053067e54d..b86907bf900 100644 --- a/source/blender/makesrna/intern/rna_internal.hh +++ b/source/blender/makesrna/intern/rna_internal.hh @@ -464,7 +464,7 @@ void RNA_api_space_text(StructRNA *srna); void RNA_api_space_filebrowser(StructRNA *srna); void RNA_api_region_view3d(StructRNA *srna); void RNA_api_texture(StructRNA *srna); -void RNA_api_strips(BlenderRNA *brna, PropertyRNA *cprop, bool metastrip); +void RNA_api_strips(StructRNA *srna, bool metastrip); void RNA_api_strip_elements(BlenderRNA *brna, PropertyRNA *cprop); void RNA_api_strip_retiming_keys(BlenderRNA *brna); void RNA_api_sound(StructRNA *srna); diff --git a/source/blender/makesrna/intern/rna_sequencer.cc b/source/blender/makesrna/intern/rna_sequencer.cc index 915ffe699e7..efefc607683 100644 --- a/source/blender/makesrna/intern/rna_sequencer.cc +++ b/source/blender/makesrna/intern/rna_sequencer.cc @@ -651,7 +651,7 @@ static std::optional rna_StripTransform_path(const PointerRNA *ptr) if (strip) { char name_esc[(sizeof(strip->name) - 2) * 2]; BLI_str_escape(name_esc, strip->name + 2, sizeof(name_esc)); - return fmt::format("sequence_editor.sequences_all[\"{}\"].transform", name_esc); + return fmt::format("sequence_editor.strips_all[\"{}\"].transform", name_esc); } return ""; } @@ -698,7 +698,7 @@ static std::optional rna_StripCrop_path(const PointerRNA *ptr) if (strip) { char name_esc[(sizeof(strip->name) - 2) * 2]; BLI_str_escape(name_esc, strip->name + 2, sizeof(name_esc)); - return fmt::format("sequence_editor.sequences_all[\"{}\"].crop", name_esc); + return fmt::format("sequence_editor.strips_all[\"{}\"].crop", name_esc); } return ""; } @@ -762,19 +762,12 @@ static void rna_Strip_name_set(PointerRNA *ptr, const char *value) /* Don't rename everywhere because these are per scene. */ # if 0 BKE_animdata_fix_paths_rename_all( - nullptr, "sequence_editor.sequences_all", oldname, strip->name + 2); + nullptr, "sequence_editor.strips_all", oldname, strip->name + 2); # endif adt = BKE_animdata_from_id(&scene->id); if (adt) { - BKE_animdata_fix_paths_rename(&scene->id, - adt, - nullptr, - "sequence_editor.sequences_all", - oldname, - strip->name + 2, - 0, - 0, - 1); + BKE_animdata_fix_paths_rename( + &scene->id, adt, nullptr, "sequence_editor.strips_all", oldname, strip->name + 2, 0, 0, 1); } } @@ -848,7 +841,7 @@ static std::optional rna_Strip_path(const PointerRNA *ptr) char name_esc[(sizeof(strip->name) - 2) * 2]; BLI_str_escape(name_esc, strip->name + 2, sizeof(name_esc)); - return fmt::format("sequence_editor.sequences_all[\"{}\"]", name_esc); + return fmt::format("sequence_editor.strips_all[\"{}\"]", name_esc); } static IDProperty **rna_Strip_idprops(PointerRNA *ptr) @@ -1186,13 +1179,13 @@ static std::optional rna_StripColorBalance_path(const PointerRNA *p if (!smd) { /* Path to old filter color balance. */ - return fmt::format("sequence_editor.sequences_all[\"{}\"].color_balance", name_esc); + return fmt::format("sequence_editor.strips_all[\"{}\"].color_balance", name_esc); } /* Path to modifier. */ char name_esc_smd[sizeof(smd->name) * 2]; BLI_str_escape(name_esc_smd, smd->name, sizeof(name_esc_smd)); - return fmt::format("sequence_editor.sequences_all[\"{}\"].modifiers[\"{}\"].color_balance", + return fmt::format("sequence_editor.strips_all[\"{}\"].modifiers[\"{}\"].color_balance", name_esc, name_esc_smd); } @@ -1346,7 +1339,7 @@ static std::optional rna_StripModifier_path(const PointerRNA *ptr) BLI_str_escape(name_esc, strip->name + 2, sizeof(name_esc)); BLI_str_escape(name_esc_smd, smd->name, sizeof(name_esc_smd)); return fmt::format( - "sequence_editor.sequences_all[\"{}\"].modifiers[\"{}\"]", name_esc, name_esc_smd); + "sequence_editor.strips_all[\"{}\"].modifiers[\"{}\"]", name_esc, name_esc_smd); } return ""; } @@ -1377,7 +1370,7 @@ static void rna_StripModifier_name_set(PointerRNA *ptr, const char *value) char strip_name_esc[(sizeof(strip->name) - 2) * 2]; BLI_str_escape(strip_name_esc, strip->name + 2, sizeof(strip_name_esc)); - SNPRINTF(rna_path_prefix, "sequence_editor.sequences_all[\"%s\"].modifiers", strip_name_esc); + SNPRINTF(rna_path_prefix, "sequence_editor.strips_all[\"%s\"].modifiers", strip_name_esc); BKE_animdata_fix_paths_rename( &scene->id, adt, nullptr, rna_path_prefix, oldname, smd->name, 0, 0, 1); } @@ -1585,7 +1578,7 @@ static std::optional rna_SeqTimelineChannel_path(const PointerRNA * char owner_name_esc[(sizeof(channel_owner->name) - 2) * 2]; BLI_str_escape(owner_name_esc, channel_owner->name + 2, sizeof(owner_name_esc)); return fmt::format( - "sequence_editor.sequences_all[\"{}\"].channels[\"{}\"]", owner_name_esc, channel_name_esc); + "sequence_editor.strips_all[\"{}\"].channels[\"{}\"]", owner_name_esc, channel_name_esc); } static EQCurveMappingData *rna_Strip_SoundEqualizer_Curve_add(SoundEqualizerModifierData *semd, @@ -2367,6 +2360,17 @@ static void rna_def_channel(BlenderRNA *brna) prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceTimelineChannel_mute_update"); } +static void rna_def_strips_top_level(BlenderRNA *brna) +{ + StructRNA *srna; + + srna = RNA_def_struct(brna, "StripsTopLevel", nullptr); + RNA_def_struct_sdna(srna, "Editing"); + RNA_def_struct_ui_text(srna, "Strips", "Collection of Strips"); + + RNA_api_strips(srna, false); +} + static void rna_def_editor(BlenderRNA *brna) { StructRNA *srna; @@ -2389,13 +2393,41 @@ static void rna_def_editor(BlenderRNA *brna) RNA_def_struct_ui_icon(srna, ICON_SEQUENCE); RNA_def_struct_sdna(srna, "Editing"); + rna_def_strips_top_level(brna); + + /* DEPRECATED */ prop = RNA_def_property(srna, "sequences", PROP_COLLECTION, PROP_NONE); + RNA_def_property_srna(prop, "StripsTopLevel"); + RNA_def_property_collection_sdna(prop, nullptr, "seqbase", nullptr); + RNA_def_property_struct_type(prop, "Strip"); + RNA_def_property_ui_text( + prop, "Strips", "(Deprecated: Replaced by '.strips') Top-level strips only"); + + /* DEPRECATED */ + prop = RNA_def_property(srna, "sequences_all", PROP_COLLECTION, PROP_NONE); + RNA_def_property_collection_sdna(prop, nullptr, "seqbase", nullptr); + RNA_def_property_struct_type(prop, "Strip"); + RNA_def_property_ui_text(prop, + "All Strips", + "(Deprecated: Replaced by '.strips_all') All strips, recursively " + "including those inside metastrips"); + RNA_def_property_collection_funcs(prop, + "rna_SequenceEditor_strips_all_begin", + "rna_SequenceEditor_strips_all_next", + "rna_SequenceEditor_strips_all_end", + "rna_SequenceEditor_strips_all_get", + nullptr, + nullptr, + "rna_SequenceEditor_strips_all_lookup_string", + nullptr); + + prop = RNA_def_property(srna, "strips", PROP_COLLECTION, PROP_NONE); + RNA_def_property_srna(prop, "StripsTopLevel"); RNA_def_property_collection_sdna(prop, nullptr, "seqbase", nullptr); RNA_def_property_struct_type(prop, "Strip"); RNA_def_property_ui_text(prop, "Strips", "Top-level strips only"); - RNA_api_strips(brna, prop, false); - prop = RNA_def_property(srna, "sequences_all", PROP_COLLECTION, PROP_NONE); + prop = RNA_def_property(srna, "strips_all", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, nullptr, "seqbase", nullptr); RNA_def_property_struct_type(prop, "Strip"); RNA_def_property_ui_text( @@ -2773,6 +2805,17 @@ static void rna_def_image(BlenderRNA *brna) rna_def_color_management(srna); } +static void rna_def_strips_meta(BlenderRNA *brna) +{ + StructRNA *srna; + + srna = RNA_def_struct(brna, "StripsMeta", nullptr); + RNA_def_struct_sdna(srna, "Strip"); + RNA_def_struct_ui_text(srna, "Strips", "Collection of Strips"); + + RNA_api_strips(srna, true); +} + static void rna_def_meta(BlenderRNA *brna) { StructRNA *srna; @@ -2784,11 +2827,21 @@ static void rna_def_meta(BlenderRNA *brna) srna, "Meta Strip", "Sequence strip to group other strips as a single sequence strip"); RNA_def_struct_sdna(srna, "Strip"); + rna_def_strips_meta(brna); + + /* DEPRECATED */ prop = RNA_def_property(srna, "sequences", PROP_COLLECTION, PROP_NONE); + RNA_def_property_srna(prop, "StripsMeta"); + RNA_def_property_collection_sdna(prop, nullptr, "seqbase", nullptr); + RNA_def_property_struct_type(prop, "Strip"); + RNA_def_property_ui_text( + prop, "Strips", "(Deprecated: Replaced by '.strips') Strips nested in meta strip"); + + prop = RNA_def_property(srna, "strips", PROP_COLLECTION, PROP_NONE); + RNA_def_property_srna(prop, "StripsMeta"); RNA_def_property_collection_sdna(prop, nullptr, "seqbase", nullptr); RNA_def_property_struct_type(prop, "Strip"); RNA_def_property_ui_text(prop, "Strips", "Strips nested in meta strip"); - RNA_api_strips(brna, prop, true); prop = RNA_def_property(srna, "channels", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, nullptr, "channels", nullptr); diff --git a/source/blender/makesrna/intern/rna_sequencer_api.cc b/source/blender/makesrna/intern/rna_sequencer_api.cc index 6ab4fc5cb2b..56081bd5e6c 100644 --- a/source/blender/makesrna/intern/rna_sequencer_api.cc +++ b/source/blender/makesrna/intern/rna_sequencer_api.cc @@ -781,9 +781,8 @@ void RNA_api_strip_retiming_keys(BlenderRNA *brna) RNA_def_function_ui_description(func, "Remove all retiming keys"); } -void RNA_api_strips(BlenderRNA *brna, PropertyRNA *cprop, const bool metastrip) +void RNA_api_strips(StructRNA *srna, const bool metastrip) { - StructRNA *srna; PropertyRNA *parm; FunctionRNA *func; @@ -832,10 +831,6 @@ void RNA_api_strips(BlenderRNA *brna, PropertyRNA *cprop, const bool metastrip) const char *remove_func_name = "rna_Strips_editing_remove"; if (metastrip) { - RNA_def_property_srna(cprop, "StripsMeta"); - srna = RNA_def_struct(brna, "StripsMeta", nullptr); - RNA_def_struct_sdna(srna, "Strip"); - new_clip_func_name = "rna_Strips_meta_new_clip"; new_mask_func_name = "rna_Strips_meta_new_mask"; new_scene_func_name = "rna_Strips_meta_new_scene"; @@ -846,13 +841,6 @@ void RNA_api_strips(BlenderRNA *brna, PropertyRNA *cprop, const bool metastrip) new_effect_func_name = "rna_Strips_meta_new_effect"; remove_func_name = "rna_Strips_meta_remove"; } - else { - RNA_def_property_srna(cprop, "StripsTopLevel"); - srna = RNA_def_struct(brna, "StripsTopLevel", nullptr); - RNA_def_struct_sdna(srna, "Editing"); - } - - RNA_def_struct_ui_text(srna, "Strips", "Collection of Strips"); func = RNA_def_function(srna, "new_clip", new_clip_func_name); RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN); diff --git a/source/blender/sequencer/intern/animation.cc b/source/blender/sequencer/intern/animation.cc index 39720647afe..d0b470fb6e0 100644 --- a/source/blender/sequencer/intern/animation.cc +++ b/source/blender/sequencer/intern/animation.cc @@ -38,7 +38,7 @@ bool SEQ_animation_drivers_exist(Scene *scene) bool SEQ_fcurve_matches(const Strip &strip, const FCurve &fcurve) { return animrig::fcurve_matches_collection_path( - fcurve, "sequence_editor.sequences_all[", strip.name + 2); + fcurve, "sequence_editor.strips_all[", strip.name + 2); } void SEQ_offset_animdata(Scene *scene, Strip *strip, int ofs) diff --git a/source/blender/sequencer/intern/utils.cc b/source/blender/sequencer/intern/utils.cc index 3efaf1b0843..2caeedbe698 100644 --- a/source/blender/sequencer/intern/utils.cc +++ b/source/blender/sequencer/intern/utils.cc @@ -504,7 +504,7 @@ void SEQ_ensure_unique_name(Strip *strip, Scene *scene) BKE_animdata_fix_paths_rename(&scene->id, scene->adt, nullptr, - "sequence_editor.sequences_all", + "sequence_editor.strips_all", name, strip->name + 2, 0, diff --git a/source/blender/windowmanager/intern/wm_operators.cc b/source/blender/windowmanager/intern/wm_operators.cc index c910ff90493..d6c050b6ab2 100644 --- a/source/blender/windowmanager/intern/wm_operators.cc +++ b/source/blender/windowmanager/intern/wm_operators.cc @@ -509,7 +509,7 @@ static const char *wm_context_member_from_ptr(const bContext *C, const ID_Type ptr_id_type = GS(ptr->owner_id->name); switch (ptr_id_type) { case ID_SCE: { - TEST_PTR_DATA_TYPE_FROM_CONTEXT("active_sequence_strip", RNA_Strip, ptr); + TEST_PTR_DATA_TYPE_FROM_CONTEXT("active_strip", RNA_Strip, ptr); CTX_TEST_PTR_ID(C, "scene", ptr->owner_id); break; diff --git a/tests/python/ffmpeg_tests.py b/tests/python/ffmpeg_tests.py index 8ee0aa4322d..afcd4f5b6bd 100644 --- a/tests/python/ffmpeg_tests.py +++ b/tests/python/ffmpeg_tests.py @@ -24,7 +24,7 @@ class AbstractFFmpegSequencerTest(AbstractFFmpegTest): return \ "import bpy; " \ "bpy.context.scene.sequence_editor_create(); " \ - "strip = bpy.context.scene.sequence_editor.sequences.new_movie(" \ + "strip = bpy.context.scene.sequence_editor.strips.new_movie(" \ "'test_movie', %r, channel=1, frame_start=1); " \ "print(f'fps:{strip.fps}'); " \ "print(f'duration:{strip.frame_final_duration}'); " % movie.as_posix() diff --git a/tools/utils_api/bpy_introspect_ui.py b/tools/utils_api/bpy_introspect_ui.py index 538b9b4277b..094e83eaef3 100644 --- a/tools/utils_api/bpy_introspect_ui.py +++ b/tools/utils_api/bpy_introspect_ui.py @@ -177,7 +177,7 @@ _attribute_builder_overrides = { "context.gpencil_data.layers": AttributeBuilder_Seq("context.gpencil_data.layers", "layers"), "context.object.material_slots": (), "context.selected_nodes": (), - "context.selected_sequences": (), + "context.selected_strips": (), "context.space_data.bookmarks": (), "context.space_data.text.filepath": "", "context.preferences.filepaths.script_directory": "",