diff --git a/scripts/startup/bl_operators/sequencer.py b/scripts/startup/bl_operators/sequencer.py index fdb0382a722..715c098093a 100644 --- a/scripts/startup/bl_operators/sequencer.py +++ b/scripts/startup/bl_operators/sequencer.py @@ -34,11 +34,14 @@ class SequencerCrossfadeSounds(Operator): @classmethod def poll(cls, context): + sequencer_scene = context.sequencer_scene + if not sequencer_scene: + return False strip = context.active_strip return strip and (strip.type == 'SOUND') def execute(self, context): - scene = context.scene + scene = context.sequencer_scene strip1 = None strip2 = None for strip in scene.sequence_editor.strips_all: @@ -89,11 +92,14 @@ class SequencerSplitMulticam(Operator): @classmethod def poll(cls, context): + sequencer_scene = context.sequencer_scene + if not sequencer_scene: + return False strip = context.active_strip return strip and (strip.type == 'MULTICAM') def execute(self, context): - scene = context.scene + scene = context.sequencer_scene camera = self.camera strip = context.active_strip @@ -126,7 +132,8 @@ class SequencerDeinterlaceSelectedMovies(Operator): return (scene and scene.sequence_editor) def execute(self, context): - for strip in context.scene.sequence_editor.strips_all: + scene = context.sequencer_scene + for strip in scene.sequence_editor.strips_all: if strip.select and strip.type == 'MOVIE': strip.use_deinterlace = True @@ -141,13 +148,16 @@ class SequencerFadesClear(Operator): @classmethod def poll(cls, context): + sequencer_scene = context.sequencer_scene + if not sequencer_scene: + return False strip = context.active_strip return strip is not None def execute(self, context): from bpy_extras import anim_utils - scene = context.scene + scene = context.sequencer_scene animation_data = scene.animation_data if animation_data is None: return {'CANCELLED'} @@ -201,6 +211,9 @@ class SequencerFadesAdd(Operator): @classmethod def poll(cls, context): + sequencer_scene = context.sequencer_scene + if not sequencer_scene: + return False # Can't use context.selected_strips as it can have an impact on performances strip = context.active_strip return strip is not None @@ -209,7 +222,7 @@ class SequencerFadesAdd(Operator): from math import floor # We must create a scene action first if there's none - scene = context.scene + scene = context.sequencer_scene if not scene.animation_data: scene.animation_data_create() if not scene.animation_data.action: @@ -254,7 +267,7 @@ class SequencerFadesAdd(Operator): return {'FINISHED'} def calculate_fade_duration(self, context, strip): - scene = context.scene + scene = context.sequencer_scene frame_current = scene.frame_current duration = 0.0 if self.type == 'CURSOR_TO': @@ -288,7 +301,7 @@ class SequencerFadesAdd(Operator): that corresponds to the strip. Returns the matching FCurve or creates a new one if the function can't find a match. """ - scene = context.scene + scene = context.sequencer_scene action = scene.animation_data.action searched_data_path = strip.path_from_id(animated_property) return action.fcurve_ensure_for_datablock(scene, searched_data_path) diff --git a/source/blender/blenkernel/intern/lib_id.cc b/source/blender/blenkernel/intern/lib_id.cc index 2342309ac94..f534af9769c 100644 --- a/source/blender/blenkernel/intern/lib_id.cc +++ b/source/blender/blenkernel/intern/lib_id.cc @@ -220,7 +220,7 @@ void BKE_lib_id_clear_library_data(Main *bmain, ID *id, const int flags) id->lib = nullptr; id->tag &= ~(ID_TAG_INDIRECT | ID_TAG_EXTERN); - id->flag &= ~ID_FLAG_INDIRECT_WEAK_LINK; + id->flag &= ~(ID_FLAG_INDIRECT_WEAK_LINK | ID_FLAG_LINKED_AND_PACKED); if (id_in_mainlist) { IDNewNameResult result = BKE_id_new_name_validate(*bmain, *which_libbase(bmain, GS(id->name)), diff --git a/source/blender/blenloader/intern/readfile.cc b/source/blender/blenloader/intern/readfile.cc index bf291ac0e43..39d8e17252f 100644 --- a/source/blender/blenloader/intern/readfile.cc +++ b/source/blender/blenloader/intern/readfile.cc @@ -2239,8 +2239,21 @@ static void direct_link_id_common(BlendDataReader *reader, id->session_uid = MAIN_ID_SESSION_UID_UNSET; } - if (ID_IS_PACKED(id)) { - BLI_assert(current_library->flag & LIBRARY_FLAG_IS_ARCHIVE); + if (id->flag & ID_FLAG_LINKED_AND_PACKED) { + if (!current_library) { + CLOG_ERROR(&LOG, + "Data-block '%s' flagged as packed, but without a valid library, fixing by " + "making fully local...", + id->name); + id->flag &= ~ID_FLAG_LINKED_AND_PACKED; + } + else if ((current_library->flag & LIBRARY_FLAG_IS_ARCHIVE) == 0) { + CLOG_ERROR(&LOG, + "Data-block '%s' flagged as packed, but using a regular library, fixing by " + "making fully linked...", + id->name); + id->flag &= ~ID_FLAG_LINKED_AND_PACKED; + } } id->lib = current_library; if (id->lib) { @@ -4759,7 +4772,7 @@ static void expand_doit_library(void *fdhandle, BLO_reportf_wrap(fd->reports, RPT_ERROR, RPT_("LIB: .blend file %s seems corrupted, no owner 'Library' data found " - "for the linked data-block %s"), + "for the linked data-block '%s'. Try saving the file again."), mainvar->curlib->runtime->filepath_abs, id_name ? id_name : ""); return; @@ -4800,7 +4813,7 @@ static void expand_doit_library(void *fdhandle, BLO_reportf_wrap(fd->reports, RPT_ERROR, RPT_("LIB: .blend file %s seems corrupted, no owner 'Library' data found " - "for the packed linked data-block %s"), + "for the packed linked data-block %s. Try saving the file again."), mainvar->curlib->runtime->filepath_abs, id_name ? id_name : ""); return;