Fixes for MovieClip strip user counter.

Currently copies behavior of clip and image editors:
- On file load, all strip will reference clip they're using
- On adding new strip, clip would be referenced only if it've got zero user
- On removing strip clip wouldn't be de-referenced to prevent clip editors
  pointing to zero-counted datablocks.
Not actually ideal from human beings point of view, but referencing/dereferencing
clip on each strip add/delete is getting crappy because of current logic of how
clip datablocks are referenced from clip editor (which is designed to work fine with
loading files without loading UI).
This commit is contained in:
2012-04-09 08:45:51 +00:00
parent d5953568c8
commit 48d71a40b1
2 changed files with 6 additions and 1 deletions

View File

@@ -4841,6 +4841,7 @@ static void lib_link_scene(FileData *fd, Main *main)
} }
if (seq->clip) { if (seq->clip) {
seq->clip = newlibadr(fd, sce->id.lib, seq->clip); seq->clip = newlibadr(fd, sce->id.lib, seq->clip);
seq->clip->id.us++;
} }
if (seq->scene_camera) seq->scene_camera= newlibadr(fd, sce->id.lib, seq->scene_camera); if (seq->scene_camera) seq->scene_camera= newlibadr(fd, sce->id.lib, seq->scene_camera);
if (seq->sound) { if (seq->sound) {

View File

@@ -50,6 +50,7 @@
#include "BKE_context.h" #include "BKE_context.h"
#include "BKE_global.h" #include "BKE_global.h"
#include "BKE_library.h"
#include "BKE_main.h" #include "BKE_main.h"
#include "BKE_sequencer.h" #include "BKE_sequencer.h"
#include "BKE_movieclip.h" #include "BKE_movieclip.h"
@@ -323,7 +324,10 @@ static int sequencer_add_movieclip_strip_exec(bContext *C, wmOperator *op)
seq->type = SEQ_MOVIECLIP; seq->type = SEQ_MOVIECLIP;
seq->blend_mode = SEQ_CROSS; seq->blend_mode = SEQ_CROSS;
seq->clip = clip; seq->clip = clip;
if (seq->clip->id.us == 0)
seq->clip->id.us = 1;
/* basic defaults */ /* basic defaults */
seq->strip = strip = MEM_callocN(sizeof(Strip), "strip"); seq->strip = strip = MEM_callocN(sizeof(Strip), "strip");
seq->len = BKE_movieclip_get_duration(clip); seq->len = BKE_movieclip_get_duration(clip);