void BKE_sequencer_preprocessed_cache_put(const SeqRenderData *context, Sequence *seq, float cfra, seq_stripelem_ibuf_t type, ImBuf *ibuf)
{
	SeqPreprocessCacheElem *elem;

	if (!preprocess_cache) {
		preprocess_cache = MEM_callocN(sizeof(SeqPreprocessCache), "sequencer preprocessed cache");
	}
	else {
		if (preprocess_cache->cfra != cfra)
			BKE_sequencer_preprocessed_cache_cleanup();
	}

	elem = MEM_callocN(sizeof(SeqPreprocessCacheElem), "sequencer preprocessed cache element");

	elem->seq = seq;
	elem->type = type;
	elem->context = *context;
	elem->ibuf = ibuf;

	preprocess_cache->cfra = cfra;

	IMB_refImBuf(ibuf);

	BLI_addtail(&preprocess_cache->elems, elem);
}
void BKE_sequencer_cache_cleanup(void)
{
	if (moviecache) {
		IMB_moviecache_free(moviecache);
		moviecache = IMB_moviecache_create("seqcache", sizeof(SeqCacheKey), seqcache_hashhash, seqcache_hashcmp);
	}

	BKE_sequencer_preprocessed_cache_cleanup();
}
static void preprocessed_cache_destruct(void)
{
	if (!preprocess_cache)
		return;

	BKE_sequencer_preprocessed_cache_cleanup();

	MEM_freeN(preprocess_cache);
	preprocess_cache = NULL;
}
Exemple #4
0
static void rna_ColorManagedColorspaceSettings_reload_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
	ID *id = ptr->id.data;

	if (GS(id->name) == ID_IM) {
		Image *ima = (Image *) id;

		DAG_id_tag_update(&ima->id, 0);

		BKE_image_signal(ima, NULL, IMA_SIGNAL_COLORMANAGE);

		WM_main_add_notifier(NC_IMAGE | ND_DISPLAY, &ima->id);
		WM_main_add_notifier(NC_IMAGE | NA_EDITED, &ima->id);
	}
	else if (GS(id->name) == ID_MC) {
		MovieClip *clip = (MovieClip *) id;

		BKE_movieclip_reload(clip);

		/* all sequencers for now, we don't know which scenes are using this clip as a strip */
		BKE_sequencer_cache_cleanup();
		BKE_sequencer_preprocessed_cache_cleanup();

		WM_main_add_notifier(NC_MOVIECLIP | ND_DISPLAY, &clip->id);
		WM_main_add_notifier(NC_MOVIECLIP | NA_EDITED, &clip->id);
	}
	else if (GS(id->name) == ID_SCE) {
		Scene *scene = (Scene *) id;

		if (scene->ed) {
			ColorManagedColorspaceSettings *colorspace_settings = (ColorManagedColorspaceSettings *) ptr->data;
			Sequence *seq;
			bool seq_found = false;

			if (&scene->sequencer_colorspace_settings != colorspace_settings) {
				SEQ_BEGIN(scene->ed, seq);
				{
					if (seq->strip && &seq->strip->colorspace_settings == colorspace_settings) {
						seq_found = true;
						break;
					}
				}
				SEQ_END;
			}

			if (seq_found) {
				BKE_sequence_free_anim(seq);

				if (seq->strip->proxy && seq->strip->proxy->anim) {
					IMB_free_anim(seq->strip->proxy->anim);
					seq->strip->proxy->anim = NULL;
				}

				BKE_sequence_invalidate_cache(scene, seq);
				BKE_sequencer_preprocessed_cache_cleanup_sequence(seq);
			}
			else {
				SEQ_BEGIN(scene->ed, seq);
				{
					BKE_sequence_free_anim(seq);
				}
				SEQ_END;

				BKE_sequencer_cache_cleanup();
				BKE_sequencer_preprocessed_cache_cleanup();
			}

			WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, NULL);
		}
	}
}