示例#1
0
ImBuf *BKE_sequence_modifier_apply_stack(const SeqRenderData *context, Sequence *seq, ImBuf *ibuf, int cfra)
{
	SequenceModifierData *smd;
	ImBuf *processed_ibuf = ibuf;

	if (seq->modifiers.first && (seq->flag & SEQ_USE_LINEAR_MODIFIERS)) {
		processed_ibuf = IMB_dupImBuf(ibuf);
		BKE_sequencer_imbuf_from_sequencer_space(context->scene, processed_ibuf);
	}

	for (smd = seq->modifiers.first; smd; smd = smd->next) {
		const SequenceModifierTypeInfo *smti = BKE_sequence_modifier_type_info_get(smd->type);

		/* could happen if modifier is being removed or not exists in current version of blender */
		if (!smti)
			continue;

		/* modifier is muted, do nothing */
		if (smd->flag & SEQUENCE_MODIFIER_MUTE)
			continue;

		if (smti->apply) {
			int frame_offset;
			if (smd->mask_time == SEQUENCE_MASK_TIME_RELATIVE) {
				frame_offset = seq->start;
			}
			else /*if (smd->mask_time == SEQUENCE_MASK_TIME_ABSOLUTE)*/ {
				frame_offset = 0;
			}

			ImBuf *mask = modifier_mask_get(smd,
			                                context,
			                                cfra,
			                                frame_offset,
			                                ibuf->rect_float != NULL);

			if (processed_ibuf == ibuf)
				processed_ibuf = IMB_dupImBuf(ibuf);

			smti->apply(smd, processed_ibuf, mask);

			if (mask)
				IMB_freeImBuf(mask);
		}
	}

	if (seq->modifiers.first && (seq->flag & SEQ_USE_LINEAR_MODIFIERS)) {
		BKE_sequencer_imbuf_to_sequencer_space(context->scene, processed_ibuf, false);
	}

	return processed_ibuf;
}
示例#2
0
ImBuf *BKE_sequence_modifier_apply_stack(SeqRenderData context, Sequence *seq, ImBuf *ibuf, int cfra)
{
	SequenceModifierData *smd;
	ImBuf *processed_ibuf = ibuf;

	if (seq->modifiers.first && (seq->flag & SEQ_USE_LINEAR_MODIFIERS)) {
		processed_ibuf = IMB_dupImBuf(ibuf);
		BKE_sequencer_imbuf_from_sequencer_space(context.scene, processed_ibuf);
	}

	for (smd = seq->modifiers.first; smd; smd = smd->next) {
		SequenceModifierTypeInfo *smti = BKE_sequence_modifier_type_info_get(smd->type);

		/* could happen if modifier is being removed or not exists in current version of blender */
		if (!smti)
			continue;

		/* modifier is muted, do nothing */
		if (smd->flag & SEQUENCE_MODIFIER_MUTE)
			continue;

		if (smti->apply) {
			ImBuf *mask = modifier_mask_get(smd, context, cfra, ibuf->rect_float != NULL);

			if (processed_ibuf == ibuf)
				processed_ibuf = IMB_dupImBuf(ibuf);

			smti->apply(smd, processed_ibuf, mask);

			if (mask)
				IMB_freeImBuf(mask);
		}
	}

	if (seq->modifiers.first && (seq->flag & SEQ_USE_LINEAR_MODIFIERS)) {
		BKE_sequencer_imbuf_to_sequencer_space(context.scene, processed_ibuf, FALSE);
	}

	return processed_ibuf;
}