static PF_Err
ParamsSetup (
    PF_InData		*in_data,
    PF_OutData		*out_data,
    PF_ParamDef		*params[],
    PF_LayerDef		*output )
{
    PF_Err		err		= PF_Err_NONE;
    PF_ParamDef	def;

    AEFX_CLR_STRUCT(def);

    PF_ADD_FLOAT_SLIDERX(	STR(StrID_Gain_Param_Name),
                            SKELETON_GAIN_MIN,
                            SKELETON_GAIN_MAX,
                            SKELETON_GAIN_MIN,
                            SKELETON_GAIN_MAX,
                            SKELETON_GAIN_DFLT,
                            PF_Precision_HUNDREDTHS,
                            0,
                            0,
                            GAIN_DISK_ID);

    AEFX_CLR_STRUCT(def);

    PF_ADD_COLOR(	STR(StrID_Color_Param_Name),
                    PF_HALF_CHAN8,
                    PF_MAX_CHAN8,
                    PF_MAX_CHAN8,
                    COLOR_DISK_ID);

    out_data->num_params = SKELETON_NUM_PARAMS;

    return err;
}
Exemple #2
0
A_Err
EntryPointFunc(
	struct SPBasicSuite		*pica_basicP,			/* >> */
	A_long				 	major_versionL,			/* >> */		
	A_long					minor_versionL,			/* >> */		
	AEGP_PluginID			aegp_plugin_id,			/* >> */
	AEGP_GlobalRefcon		*global_refconP)		/* << */
{
	A_Err 				err					= A_Err_NONE;

	AEIO_ModuleInfo		info;
	AEIO_FunctionBlock4	funcs;
	AEGP_SuiteHandler	suites(pica_basicP);	

	AEFX_CLR_STRUCT(info);
	AEFX_CLR_STRUCT(funcs);
	
	ERR(suites.RegisterSuite5()->AEGP_RegisterDeathHook(aegp_plugin_id, DeathHook, 0));
	ERR(ConstructModuleInfo(pica_basicP, &info));
	ERR(ConstructFunctionBlock(&funcs));

	ERR(suites.RegisterSuite5()->AEGP_RegisterIO(	aegp_plugin_id,
													0,
													&info, 
													&funcs));

	ERR(suites.UtilitySuite3()->AEGP_RegisterWithAEGP(	NULL,
														"FBIO",
														&S_mem_id));
	return err;
}
Exemple #3
0
static PF_Err 
ParamsSetup (
	PF_InData		*in_data,
	PF_OutData		*out_data,
	PF_ParamDef		*params[],
	PF_LayerDef		*output )
{
	PF_Err			err = PF_Err_NONE;
	PF_ParamDef		def;	
	PF_EffectUISuite1	*effect_ui_suiteP = NULL;


	AEFX_CLR_STRUCT(def);
	
	PF_ADD_SLIDER(	NAME, 
					CHECK_FRAME_MIN, 
					CHECK_FRAME_MAX, 
					CHECK_FRAME_MIN, 
					CHECK_FRAME_MAX, 
					CHECK_FRAME_DFLT,
					CHECK_FRAME_DISK_ID);

	AEFX_CLR_STRUCT(def);

	PF_ADD_LAYER(	"Layer to checkout", 
					PF_LayerDefault_MYSELF, 
					CHECK_LAYER_DISK_ID);

	out_data->num_params = CHECK_NUM_PARAMS;
	
	// Premiere Pro/Elements does not support this suite
	if (in_data->appl_id != 'PrMr')
	{
		ERR(AEFX_AcquireSuite(	in_data,
								out_data,
								kPFEffectUISuite,
								kPFEffectUISuiteVersion1,
								NULL,
								(void**)&effect_ui_suiteP));

		ERR(effect_ui_suiteP->PF_SetOptionsButtonName(in_data->effect_ref, "Whatever I want!"));
		(void)AEFX_ReleaseSuite(in_data, 
								out_data, 
								kPFEffectUISuite, 
								kPFEffectUISuiteVersion1, 
								NULL);
	}
	return err;
}
Exemple #4
0
static PF_Err 
ParamsSetup (
	PF_InData		*in_data,
	PF_OutData		*out_data,
	PF_ParamDef		*params[],
	PF_LayerDef		*output )
{
	PF_Err			err = PF_Err_NONE;
	PF_ParamDef		def;
	AEFX_CLR_STRUCT(def);

	PF_ADD_FIXED(	"Gamma", 
					GAMMA_MIN, 
					GAMMA_BIG_MAX, 
					GAMMA_MIN, 
					GAMMA_MAX, 
					GAMMA_DFLT,
					1, 
					0,
					0,
					GAMMA_DISK_ID);

	out_data->num_params = GAMMA_NUM_PARAMS;

	return err;
}
Exemple #5
0
static A_Err	
FBIO_OutputInfoChanged(
	AEIO_BasicData		*basic_dataP,
	AEIO_OutSpecH		outH)
{
	/*	This function is called when either the user 
		or the plug-in has changed the output options info.
		You may want to update your plug-in's internal
		representation of the output at this time. 
		We've exercised the likely getters below.
	*/
	
	A_Err err					=	A_Err_NONE;
	
	AEIO_AlphaLabel	alpha;
	AEFX_CLR_STRUCT(alpha);
	
	FIEL_Label		fields;
	AEFX_CLR_STRUCT(fields);

	A_short			depthS		=	0;
	A_Time			durationT	=	{0,1};

	A_Fixed			native_fps	=	0;
	A_Ratio			hsf			=	{1,1};
	A_Boolean		is_missingB	=	TRUE;
	
	AEGP_SuiteHandler	suites(basic_dataP->pica_basicP);	
	
	ERR(suites.IOOutSuite4()->AEGP_GetOutSpecIsMissing(outH, &is_missingB));
	
	if (!is_missingB)
	{
		// Find out all the details of the output spec; update
		// your options data as necessary.
		
		ERR(suites.IOOutSuite4()->AEGP_GetOutSpecAlphaLabel(outH, &alpha));
		ERR(suites.IOOutSuite4()->AEGP_GetOutSpecDepth(outH, &depthS));
		ERR(suites.IOOutSuite4()->AEGP_GetOutSpecInterlaceLabel(outH, &fields));
		ERR(suites.IOOutSuite4()->AEGP_GetOutSpecDuration(outH, &durationT));
		ERR(suites.IOOutSuite4()->AEGP_GetOutSpecFPS(outH, &native_fps));
		ERR(suites.IOOutSuite4()->AEGP_GetOutSpecHSF(outH, &hsf));
	}
	return err;
}
Exemple #6
0
A_Err EntryPointFunc(
struct SPBasicSuite		*pica_basicP,			/* >> */
	A_long				 	major_versionL,			/* >> */
	A_long					minor_versionL,			/* >> */
	AEGP_PluginID			aegp_plugin_id,			/* >> */
	AEGP_GlobalRefcon		*global_refconP )		/* << */
{
	AEGP_SuiteHandler	suites( pica_basicP );
	
#	ifdef _DEBUG
	Menge::Console * console = new Menge::Console();

	console->initialize();
#	endif

	Menge::MDLRender * render = new Menge::MDLRender();

	if( render->initialize() == false )
	{
		printf( "Render not initialize!!!\n" );

		return A_Err_GENERIC;
	}

	suites.RegisterSuite5()->AEGP_RegisterDeathHook( aegp_plugin_id, DeathHook, (AEGP_DeathRefcon)render );

	AEIO_ModuleInfo info;
	AEFX_CLR_STRUCT( info );
	ConstructModuleInfo( pica_basicP, &info );

	AEIO_FunctionBlock4	funcs;
	AEFX_CLR_STRUCT( funcs );
	ConstructFunctionBlock( &funcs );

	suites.RegisterSuite5()->AEGP_RegisterIO( aegp_plugin_id,
		(AEGP_IORefcon)render,
		&info,
		&funcs );

	return A_Err_NONE;
}
Exemple #7
0
static A_Err	
FBIO_StartAdding(
	AEIO_BasicData		*basic_dataP,
	AEIO_OutSpecH		outH, 
	A_long				flags)
{ 
	A_Err	err				=	A_Err_NONE;
	FBIO_FileHeader	header;
	A_Time	duration	=	{0,1};
	A_Fixed	fps			=	0;
	A_long	widthL 		= 	0,
			heightL 	= 	0;
	A_char name[AEGP_MAX_PATH_SIZE] = {'\0'};
	AEGP_SuiteHandler	suites(basic_dataP->pica_basicP);

	AEFX_CLR_STRUCT(header);

	ERR(suites.IOOutSuite4()->AEGP_GetOutSpecDuration(outH, &duration));

	ERR(suites.IOOutSuite4()->AEGP_GetOutSpecDimensions(outH, &widthL, &heightL));

	if (name && widthL && heightL) {
		ERR(suites.IOOutSuite4()->AEGP_GetOutSpecFPS(outH, &fps));
		
		if (!err){
			header.fpsT.value	=	duration.value;
			header.fpsT.scale	=	duration.scale;

			header.hasVideo		=	TRUE;	
			header.hasAudio		=	FALSE;
			header.widthLu		=	(unsigned long)widthL;
			header.heightLu		=	(unsigned long)heightL;
			
			header.rowbytesLu	=	(unsigned long)(4 * widthL);

			header.numFramesLu	=	(unsigned long) fps; 

			if (!err){
				/*
					+	Open file
					+	Write header
					+	(keep file open)
				*/
			}
		}
	}
	return err; 
};
Exemple #8
0
static A_Err	
FBIO_InitOutputSpec(
	AEIO_BasicData			*basic_dataP,
	AEIO_OutSpecH			outH, 
	A_Boolean				*user_interacted)
{
	A_Err err						= A_Err_NONE;
	AEIO_Handle		optionsH		= NULL, 
					old_optionsH	= 0;
	FBIO_FileHeader	*fileP	=	new FBIO_FileHeader;

	AEGP_SuiteHandler	suites(basic_dataP->pica_basicP);

	AEFX_CLR_STRUCT(*fileP);
	
	ERR(suites.MemorySuite1()->AEGP_NewMemHandle(	S_mem_id, 
													"InitOutputSpec options", 
													sizeof(FBIO_FileHeader), 
													AEGP_MemFlag_CLEAR, 
													&optionsH));

	if (!err)
	{
		ERR(PretendToReadFileHeader(basic_dataP, fileP));

		ERR(suites.MemorySuite1()->AEGP_LockMemHandle(optionsH, reinterpret_cast<void**>(&fileP)));

		if (!err) {
			basic_dataP->msg_func(err, "Here is where you would modify the output spec,\rbased on user interaction.");

			if (rand() % 7){
				*user_interacted = TRUE;
			} else {
				*user_interacted = FALSE;
			}
			ERR(suites.MemorySuite1()->AEGP_UnlockMemHandle(optionsH));

			ERR(suites.IOOutSuite4()->AEGP_SetOutSpecOptionsHandle(outH, optionsH, reinterpret_cast<void**>(&old_optionsH)));

			if (old_optionsH) {
				ERR(suites.MemorySuite1()->AEGP_FreeMemHandle(old_optionsH));
			}
		}
	}
	return err;
}
Exemple #9
0
static PF_Err 
ParamsSetup (
	PF_InData			*in_data,
	PF_OutData			*out_data,
	PF_ParamDef			*params[],
	PF_LayerDef			*output)
{
	PF_Err			err = PF_Err_NONE;
	PF_ParamDef		def;	

	AEFX_CLR_STRUCT(def);

	ERR(CreateDefaultArb(	in_data, 
							out_data, 
							&def.u.arb_d.dephault));

	PF_ADD_ARBITRARY2(	"Color Grid", 
						UI_GRID_WIDTH,
						UI_GRID_HEIGHT,
						0,
						PF_PUI_CONTROL | PF_PUI_DONT_ERASE_CONTROL,
						def.u.arb_d.dephault, 
						COLOR_GRID_UI,
						ARB_REFCON);

	if (!err) {
		PF_CustomUIInfo			ci;
		
		ci.events				= PF_CustomEFlag_EFFECT;
 		
		ci.comp_ui_width		= ci.comp_ui_height = 0;
		ci.comp_ui_alignment	= PF_UIAlignment_NONE;
		
		ci.layer_ui_width		= 
		ci.layer_ui_height		= 0;
		ci.layer_ui_alignment	= PF_UIAlignment_NONE;
		
		ci.preview_ui_width		= 
		ci.preview_ui_height	= 0;
		ci.layer_ui_alignment	= PF_UIAlignment_NONE;

		err = (*(in_data->inter.register_ui))(in_data->effect_ref, &ci);
		out_data->num_params = CG_NUM_PARAMS;
	}
	return err;
}
static PF_Err
Render (
    PF_InData		*in_data,
    PF_OutData		*out_data,
    PF_ParamDef		*params[],
    PF_LayerDef		*output )
{
    PF_Err				err		= PF_Err_NONE;
    AEGP_SuiteHandler	suites(in_data->pica_basicP);

    /*	Put interesting code here. */
    GainInfo			giP;
    AEFX_CLR_STRUCT(giP);
    A_long				linesL	= 0;

    linesL 		= output->extent_hint.bottom - output->extent_hint.top;
    giP.gainF 	= params[SKELETON_GAIN]->u.fs_d.value;

    if (PF_WORLD_IS_DEEP(output)) {
        ERR(suites.Iterate16Suite1()->iterate(	in_data,
                                                0,								// progress base
                                                linesL,							// progress final
                                                &params[SKELETON_INPUT]->u.ld,	// src
                                                NULL,							// area - null for all pixels
                                                (void*)&giP,					// refcon - your custom data pointer
                                                MySimpleGainFunc16,				// pixel function pointer
                                                output));
    } else {
        ERR(suites.Iterate8Suite1()->iterate(	in_data,
                                                0,								// progress base
                                                linesL,							// progress final
                                                &params[SKELETON_INPUT]->u.ld,	// src
                                                NULL,							// area - null for all pixels
                                                (void*)&giP,					// refcon - your custom data pointer
                                                MySimpleGainFunc8,				// pixel function pointer
                                                output));
    }

    return err;
}
Exemple #11
0
static PF_Err
PreRender(
	PF_InData				*in_data,
	PF_OutData				*out_data,
	PF_PreRenderExtra		*extra)
{
	PF_Err err = PF_Err_NONE;

	PF_ParamDef arb_param;
	
	PF_RenderRequest req = extra->input->output_request;
	PF_CheckoutResult in_result;
	
	AEFX_CLR_STRUCT(arb_param);
	
	ERR(PF_CHECKOUT_PARAM(	in_data, 
							CG_GRID_UI, 
							in_data->current_time, 
							in_data->time_step, 
							in_data->time_scale, 
							&arb_param));

	ERR(extra->cb->checkout_layer(	in_data->effect_ref,
									CG_INPUT,
									CG_INPUT,
									&req,
									in_data->current_time,
									in_data->time_step,
									in_data->time_scale,
									&in_result));
	
	if (!err){
		UnionLRect(&in_result.result_rect, 		&extra->output->result_rect);
		UnionLRect(&in_result.max_result_rect, 	&extra->output->max_result_rect);	
	}
	ERR(PF_CHECKIN_PARAM(in_data, &arb_param));
	return err;
}
PF_Err	
CreateDefaultArb(	
	PF_InData			*in_data,
	PF_OutData			*out_data,
	PF_ArbitraryH		*dephault)
{
	PF_Err			err		= PF_Err_NONE;
	PF_Handle		arbH	= NULL;
	
	AEGP_SuiteHandler	suites(in_data->pica_basicP);
	
	arbH = suites.HandleSuite1()->host_new_handle(sizeof(CG_ArbData));

	if (arbH) {
		CG_ArbData	*arbP = reinterpret_cast<CG_ArbData*>(PF_LOCK_HANDLE(arbH));
		if (!arbP) {
			err = PF_Err_OUT_OF_MEMORY;
		} else {
			AEFX_CLR_STRUCT(*arbP);
			#ifdef AE_OS_WIN
				#pragma warning (disable : 4305)
			#endif
			arbP->colorA[0].alpha	= 1.0;
			arbP->colorA[0].blue	= 0.0;
			arbP->colorA[0].green	= 0.5;
			arbP->colorA[0].red		= 1.0;
			
			arbP->colorA[1].alpha	= 1.0;
			arbP->colorA[1].blue	= 0.5;
			arbP->colorA[1].green	= 0.32;
			arbP->colorA[1].red		= 0.67;
			
			arbP->colorA[2].alpha	= 1.0;
			arbP->colorA[2].blue	= 0.6;
			arbP->colorA[2].green	= 0.27;
			arbP->colorA[2].red		= 0.34;
			
			arbP->colorA[3].alpha	= 1.0;
			arbP->colorA[3].blue	= 1.0;
			arbP->colorA[3].green	= 0.4039;
			arbP->colorA[3].red		= 0.47;
			
			arbP->colorA[4].alpha	= 1.0;
			arbP->colorA[4].blue	= 0.47;
			arbP->colorA[4].green	= 0.54;
			arbP->colorA[4].red		= 0.603;
			
			arbP->colorA[5].alpha	= 1.0;
			arbP->colorA[5].blue	= 0.0603;
			arbP->colorA[5].green	= 0.67;
			arbP->colorA[5].red		= 0.9;
			
			arbP->colorA[6].alpha	= 1.0;
			arbP->colorA[6].blue	= 0.737;
			arbP->colorA[6].green	= 0.81;
			arbP->colorA[6].red		= 0.89;
			
			arbP->colorA[7].alpha	= 1.0;
			arbP->colorA[7].blue	= 0.5;
			arbP->colorA[7].green	= 1.0;
			arbP->colorA[7].red		= 0.5;
			
			arbP->colorA[8].alpha	= 1.0;
			arbP->colorA[8].blue	= 0.5;
			arbP->colorA[8].green	= 0.5;
			arbP->colorA[8].red		= 0.9;
			#ifdef AE_OS_WIN
				#pragma warning (pop)
			#endif
			*dephault = arbH;
		}
		suites.HandleSuite1()->host_unlock_handle(arbH);
	}
	return err;
}
Exemple #13
0
static A_Err	
FBIO_InitInSpecFromFile(
	AEIO_BasicData		*basic_dataP,
	const A_UTF16Char	*file_pathZ,
	AEIO_InSpecH		specH)
{ 
	/*	Read the file referenced by the path. Use the 
		file information to set all fields of the AEIO_InSpecH.
	*/

	A_Err			err				=	A_Err_NONE,
					err2			=	A_Err_NONE;
	AEIO_Handle		optionsH		=	NULL,
					old_optionsH	=	NULL;
	FBIO_FileHeader	*headerP;

	AEGP_SuiteHandler	suites(basic_dataP->pica_basicP);

	if (!err) {
		/*		What are we doing here? 

			+	Allocate a new OptionsH to hold our file header info.
			+	Lock it in memory, copy our local header into the OptionsH.
			+	Unlock handle so AE can move it at will.
		
		*/
		
		ERR(suites.MemorySuite1()->AEGP_NewMemHandle(	S_mem_id,
														"SDK_IO optionsH", 
														sizeof(FBIO_FileHeader), 
														AEGP_MemFlag_CLEAR, 
														&optionsH));
													
		if (optionsH){
			ERR(suites.MemorySuite1()->AEGP_LockMemHandle(optionsH, reinterpret_cast<void **>(&headerP)));
		}	
		if (!err){
			
			ERR(PretendToReadFileHeader(basic_dataP, headerP));

			ERR(suites.IOInSuite4()->AEGP_SetInSpecOptionsHandle(	specH, 
																	optionsH, 
																	reinterpret_cast<void **>(&old_optionsH)));
		
			// [23547] Do _not_ free the old options handle here.  This results in a crash when user chooses 
			// Reload Footage, the handle is freed here, and FBIO_DisposeOutputOptions() is called later on.
			//if (old_optionsH){
				// ERR(suites.MemorySuite1()->AEGP_FreeMemHandle(old_optionsH));
			//}
		}

		/*	
			Set specH information based on what we (pretended to) read from the file.
		*/

		ERR(suites.IOInSuite4()->AEGP_SetInSpecDepth(specH, headerP->bitdepthS)); // always 32 bits for .fak files
		ERR(suites.IOInSuite4()->AEGP_SetInSpecDuration(specH, &(headerP->durationT)));
		ERR(suites.IOInSuite4()->AEGP_SetInSpecDimensions(	specH, 
															static_cast<A_long>(headerP->widthLu),
															static_cast<A_long>(headerP->heightLu)));

		if (!err){
			AEIO_AlphaLabel	alpha;
			AEFX_CLR_STRUCT(alpha);

			alpha.alpha		=	AEIO_Alpha_PREMUL;
			alpha.flags		=	AEIO_AlphaPremul;
			alpha.version	=	AEIO_AlphaLabel_VERSION;
			alpha.red		=	146;
			alpha.green		=	123;
			alpha.blue		=	23;
			
			err = suites.IOInSuite4()->AEGP_SetInSpecAlphaLabel(specH, &alpha);
		}
		ERR2(suites.MemorySuite1()->AEGP_UnlockMemHandle(optionsH));
	}
	return err;
}
Exemple #14
0
static A_Err
CommandHook(
	AEGP_GlobalRefcon	plugin_refconPV,		/* >> */
	AEGP_CommandRefcon	refconPV,				/* >> */
	AEGP_Command		command,				/* >> */
	AEGP_HookPriority	hook_priority,			/* >> */
	A_Boolean			already_handledB,		/* >> */
	A_Boolean			*handledPB)				/* << */
{
	A_Err 				err 					= A_Err_NONE, 
						err2 					= A_Err_NONE;

	AEGP_StreamType		stream_type				= AEGP_StreamType_NO_DATA;
	AEGP_StreamRefH		new_streamH				= NULL,
						text_streamH			= NULL;

	A_Time				timeT					= {0,1};
	AEGP_LTimeMode		time_mode				= AEGP_LTimeMode_LayerTime;
	AEGP_LayerH			layerH 					= NULL;
	AEGP_StreamValue	val;
	
	AEGP_SuiteHandler	suites(sP);

	if (command == S_Text_Twiddler_cmd) {
		try {
			ERR(suites.UtilitySuite3()->AEGP_StartUndoGroup(STR(StrID_Name)));
			AEFX_CLR_STRUCT(val);	// wash before first use.
			ERR(suites.LayerSuite5()->AEGP_GetActiveLayer(&layerH));			
			
			// 	How do we know there's only one text layer selected? Because
			//	our command wouldn't have been enabled if it weren't. -bbb 5/12/04
			
			ERR(suites.DynamicStreamSuite2()->AEGP_GetNewStreamRefForLayer(S_my_id, layerH, &new_streamH));
			ERR(suites.StreamSuite2()->AEGP_GetNewLayerStream(	S_my_id, 
																layerH,
																AEGP_LayerStream_SOURCE_TEXT,
																&text_streamH));
			ERR(suites.StreamSuite2()->AEGP_GetStreamType(text_streamH, &stream_type));
			
			if (!err && (stream_type == AEGP_StreamType_TEXT_DOCUMENT)){
				ERR(suites.LayerSuite5()->AEGP_GetLayerCurrentTime(layerH, time_mode, &timeT));
				ERR(suites.StreamSuite2()->AEGP_GetNewStreamValue(	S_my_id,
																	text_streamH,
																	AEGP_LTimeMode_LayerTime,
																	&timeT,
																	TRUE,
																	&val));
																	
				//	Yes, Unicode looks funny. Use your favorite platform-specific
				//	routine to turn plain old char *'s into Unicode. Or just write hex!
				
				const A_u_short unicode[] = {0x0042, 0x0042, 0x0042};  // "BBB"

				A_long	lengthL = sizeof(unicode) / sizeof(A_u_short);
				
				ERR(suites.TextDocumentSuite1()->AEGP_SetText(val.val.text_documentH, unicode, lengthL));
				ERR(suites.StreamSuite2()->AEGP_SetStreamValue(S_my_id, text_streamH, &val));
				*handledPB = TRUE;
			}
			ERR2(suites.StreamSuite2()->AEGP_DisposeStreamValue(&val));
			if (new_streamH){
				ERR2(suites.StreamSuite2()->AEGP_DisposeStream(new_streamH));
			}
			if (text_streamH){
				ERR2(suites.StreamSuite2()->AEGP_DisposeStream(text_streamH));
			}
			ERR2(suites.UtilitySuite3()->AEGP_EndUndoGroup());
		} catch (A_Err &thrown_err){
			err = thrown_err;
		}
	}
	return err;		
}
Exemple #15
0
static PF_Err 
ParamsSetup (	
	PF_InData		*in_data,
	PF_OutData		*out_data,
	PF_ParamDef		*params[],
	PF_LayerDef		*output )
{
	PF_Err		err		= PF_Err_NONE;
	PF_ParamDef	def;	

	AEFX_CLR_STRUCT(def);

	PF_ADD_FIXED(	STR(StrID_ColorBlendSlider_Name),
					XFORM_AMOUNT_MIN,
					XFORM_AMOUNT_MAX,
					XFORM_AMOUNT_MIN,
					XFORM_AMOUNT_MAX,
					XFORM_COLOR_BLEND_DFLT,					
					0,
					PF_ValueDisplayFlag_PERCENT,
					0,
					COLORBLEND_DISK_ID);

	AEFX_CLR_STRUCT(def);

	PF_ADD_COLOR(	STR(StrID_Color_Param_Name), 
					128,
					255,
					255,
					COLOR_DISK_ID);
	
	AEFX_CLR_STRUCT(def);
	
	def.flags 	= 	PF_ParamFlag_START_COLLAPSED;
	
	PF_ADD_TOPIC(STR(StrID_Topic_Name), TOPIC_DISK_ID);
	
	AEFX_CLR_STRUCT(def);

	PF_ADD_FIXED(	STR(StrID_LayerBlendSlider_Name),
					XFORM_AMOUNT_MIN,
					XFORM_AMOUNT_MAX,
					XFORM_AMOUNT_MIN,
					XFORM_AMOUNT_MAX,
					XFORM_AMOUNT_MAX,
					0,
					PF_ValueDisplayFlag_PERCENT,
					0,
					LAYERBLEND_DISK_ID);

	AEFX_CLR_STRUCT(def);
	
	PF_ADD_LAYER(	STR(StrID_Layer_Param_Name),
					PF_LayerDefault_MYSELF,
					LAYER_DISK_ID);
					
	AEFX_CLR_STRUCT(def);
	
	PF_END_TOPIC(END_TOPIC_DISK_ID);
	
	out_data->num_params = XFORM_NUM_PARAMS;

	return err;
}
Exemple #16
0
static PF_Err 
Render(	
	PF_InData		*in_data,
	PF_OutData		*out_data,
	PF_ParamDef		*params[],
	PF_LayerDef		*output )
{
	PF_Err				err 			= PF_Err_NONE,
						err2 			= PF_Err_NONE;
	int32_t				num_channelsL 	= 0;
	PF_Rect				halfsies		= {0,0,0,0};
	PF_ParamDef			checkout; 
	PF_ChannelSuite1	*csP			= NULL;
	PF_ChannelDesc		desc;
	PF_ChannelRef		ref;
	PF_ChannelChunk		chunk;
	PF_Boolean			found_depthPB;
	
	AEFX_CLR_STRUCT(checkout);
	
	// Premiere Pro/Elements does not support this suite
	if (in_data->appl_id != 'PrMr')
	{
		ERR(AEFX_AcquireSuite(	in_data, 
									out_data, 
									kPFChannelSuite1, 
									kPFChannelSuiteVersion1, 
									"Couldn't load suite.",
									(void**)&csP));
								
		ERR(csP->PF_GetLayerChannelCount(	in_data->effect_ref, 
											 0, 
											 &num_channelsL));
												 

		if(num_channelsL) {
			ERR(csP->PF_GetLayerChannelTypedRefAndDesc(	in_data->effect_ref,
														0,	
														PF_ChannelType_DEPTH,		
														&found_depthPB,		
														&ref,	
														&desc)); 

			ERR(csP->PF_CheckoutLayerChannel(	in_data->effect_ref,
												&ref,
												in_data->current_time,
												in_data->time_step,			
												in_data->time_scale,			
												desc.data_type,			
												&chunk));
												
			// do interesting 3d stuff here;
			
			ERR(csP->PF_CheckinLayerChannel(in_data->effect_ref,
											&ref,
											&chunk));
		}

		ERR2(AEFX_ReleaseSuite(	in_data, 
								out_data, 
								kPFChannelSuite1, 
								kPFChannelSuiteVersion1,
								"Couldn't release suite."));
	}

	// set the checked-out rect to be the top half of the layer 
	
	halfsies.top	= halfsies.left	= 0;
	halfsies.right	= (short)output->width;
	halfsies.bottom	= (short)(output->height / 2);
	
	ERR(PF_CHECKOUT_PARAM(	in_data, 
							CHECK_LAYER,
							(in_data->current_time + params[CHECK_FRAME]->u.sd.value * in_data->time_step), 
							in_data->time_step,
							in_data->time_scale, 
							&checkout));
							
	if (!err) {
		if (checkout.u.ld.data)  {
			ERR(PF_COPY(&checkout.u.ld, 
						output, 
						NULL, 
						&halfsies));
		}  else  {
			// no layer? Zero-alpha black.
			ERR(PF_FILL(NULL, &halfsies, output));		
		}
	
		if (!err)  {
			halfsies.top		= halfsies.bottom;				//reset rect, copy.
			halfsies.bottom 	= (short)output->height;

			ERR(PF_COPY(&params[CHECK_INPUT]->u.ld, 
						output, 
						NULL, 
						&halfsies));
		}
	}

	ERR2(PF_CHECKIN_PARAM(in_data, &checkout));		// ALWAYS check in,
													// even if invalid param.
	return err;
}
Exemple #17
0
static PF_Err 
ParamsSetup (	
	PF_InData		*in_data,
	PF_OutData		*out_data,
	PF_ParamDef		*params[],
	PF_LayerDef		*output)
{
	PF_Err 			err = PF_Err_NONE;
	PF_ParamDef		def;
	
	AEFX_CLR_STRUCT(def);

	PF_ADD_FIXED(	STR(StrID_X_Slider_Name), 
					CCU_RADIUS_MIN, 
					CCU_RADIUS_BIG_MAX, 
					CCU_RADIUS_MIN, 
					CCU_RADIUS_MAX, 
					CCU_RADIUS_DFLT, 
					SLIDER_PRECISION, 
					DISPLAY_FLAGS,
					0,
					X_SLIDER_DISK_ID);

	AEFX_CLR_STRUCT(def);
	
	PF_ADD_FIXED(	STR(StrID_Y_Slider_Name), 
					CCU_RADIUS_MIN, 
					CCU_RADIUS_BIG_MAX, 
					CCU_RADIUS_MIN, 
					CCU_RADIUS_MAX, 
					CCU_RADIUS_DFLT, 
					SLIDER_PRECISION, 
					DISPLAY_FLAGS,
					0,
					Y_SLIDER_DISK_ID);

	AEFX_CLR_STRUCT(def);

	PF_ADD_POINT(	STR(StrID_Center_Name), 
					CCU_PTX_DFLT, 
					CCU_PTY_DFLT, 
					RESTRICT_BOUNDS,
					CENTER_DISK_ID);

	AEFX_CLR_STRUCT(def);	

	if (!err) 
	{
		PF_CustomUIInfo			ci;
		
		AEFX_CLR_STRUCT(ci);
		
		ci.events				=	PF_CustomEFlag_LAYER | 
									PF_CustomEFlag_COMP;
 		ci.comp_ui_width		= 
		ci.comp_ui_height		=	0;
		
		ci.comp_ui_alignment	=	PF_UIAlignment_NONE;
		
		ci.layer_ui_width		= 
		ci.layer_ui_height		=	0;
		
		ci.layer_ui_alignment	=	PF_UIAlignment_NONE;
		
		ci.preview_ui_width		=	
		ci.preview_ui_height	=	0;
		
		ci.layer_ui_alignment	=	PF_UIAlignment_NONE;

		err = (*(in_data->inter.register_ui))(in_data->effect_ref, &ci);
	}
	
	out_data->num_params		= CCU_NUM_PARAMS;
	
	return err;
}
Exemple #18
0
static PF_Err
SmartRender(
	PF_InData				*in_data,
	PF_OutData				*out_data,
	PF_SmartRenderExtra		*extra)
{
	PF_Err				err		= PF_Err_NONE,
						err2	= PF_Err_NONE;
	
	PF_EffectWorld		*input_worldP	= NULL, 
						*output_worldP  = NULL;
	PF_WorldSuite2		*wsP			= NULL;
	PF_PixelFormat		format			= PF_PixelFormat_INVALID;
	PF_Point			origin			= {0,0};
	A_u_short			iSu				= 0;
	PF_Rect				current_rectR	= {0,0,0,0};
	A_long				box_acrossL		= 0,
						box_downL		= 0;

	
	AEGP_SuiteHandler suites(in_data->pica_basicP);
	
	CG_ArbData		*arbP			= NULL; 
	PF_PixelFloat	*current_colorP = NULL;

	PF_ParamDef arb_param;
	AEFX_CLR_STRUCT(arb_param);
	
	ERR(PF_CHECKOUT_PARAM(	in_data, 
							CG_GRID_UI, 
							in_data->current_time, 
							in_data->time_step, 
							in_data->time_scale, 
							&arb_param));
	
	if (!err){
		arbP = reinterpret_cast<CG_ArbData*>(*arb_param.u.arb_d.value);
		if (arbP){
			current_colorP = reinterpret_cast<PF_PixelFloat*>(arbP);
		}
	}
	ERR((extra->cb->checkout_layer_pixels(	in_data->effect_ref, CG_INPUT, &input_worldP)));
	
	ERR(extra->cb->checkout_output(	in_data->effect_ref, &output_worldP));
	
	if (!err){
		for(iSu = 0; !err && iSu < BOXES_PER_GRID; ++iSu){
			if(box_acrossL == BOXES_ACROSS)	{
				box_downL++;
				box_acrossL = 0;
			}
			ColorGrid_Get_Box_In_Grid(	&origin,
										in_data->width * in_data->downsample_x.num / in_data->downsample_x.den,
										in_data->height * in_data->downsample_y.num / in_data->downsample_y.den,
										box_acrossL,
										box_downL,
										&current_rectR);

			if (!err && output_worldP){
				ERR(AEFX_AcquireSuite(	in_data, 
										out_data, 
										kPFWorldSuite, 
										kPFWorldSuiteVersion2, 
										"Couldn't load suite.",
										(void**)&wsP));
				
				ERR(wsP->PF_GetPixelFormat(input_worldP, &format));
				
				origin.h = (A_short)(in_data->output_origin_x);
				origin.v = (A_short)(in_data->output_origin_y);
				
				if (!err){
					switch (format) {
						
						case PF_PixelFormat_ARGB128:
							
							ERR(suites.IterateFloatSuite1()->iterate_origin(in_data,
																			0,
																			output_worldP->height,
																			input_worldP,
																			&current_rectR,
																			&origin,
																			reinterpret_cast<void*>(current_colorP),
																			ColorGrid_ColorizePixelFloat,
																			output_worldP));
							break;
							
						case PF_PixelFormat_ARGB64:
							
							PF_Pixel16 temp16;
							
							temp16.red		= static_cast<A_u_short>(current_colorP->red	* PF_MAX_CHAN16);
							temp16.green	= static_cast<A_u_short>(current_colorP->green * PF_MAX_CHAN16);
							temp16.blue		= static_cast<A_u_short>(current_colorP->blue	* PF_MAX_CHAN16);
							temp16.alpha	= static_cast<A_u_short>(current_colorP->red	* PF_MAX_CHAN16);
							
							ERR(suites.Iterate16Suite1()->iterate_origin(	in_data,
																			0,
																			output_worldP->height,
																			input_worldP,
																			&current_rectR,
																			&origin,
																			reinterpret_cast<void*>(&temp16),
																			ColorGrid_ColorizePixel16,
																			output_worldP));
							break;
							
						case PF_PixelFormat_ARGB32:
							
							PF_Pixel8 temp8;
							
							temp8.red		= static_cast<A_u_char>(current_colorP->red		* PF_MAX_CHAN8);
							temp8.green		= static_cast<A_u_char>(current_colorP->green	* PF_MAX_CHAN8);
							temp8.blue		= static_cast<A_u_char>(current_colorP->blue	* PF_MAX_CHAN8);
							
							ERR(suites.Iterate8Suite1()->iterate_origin(	in_data,
																			0,
																			output_worldP->height,
																			input_worldP,
																			&current_rectR,
																			&origin,
																			reinterpret_cast<void*>(&temp8),
																			ColorGrid_ColorizePixel8,
																			output_worldP));
							break;
							
						default:
							err = PF_Err_BAD_CALLBACK_PARAM;
							break;
					}
				}
			}
			current_colorP++;
			box_acrossL++;
		}
	}
	ERR2(AEFX_ReleaseSuite(	in_data,
							out_data,
							kPFWorldSuite, 
							kPFWorldSuiteVersion2, 
							"Couldn't release suite."));
	ERR2(PF_CHECKIN_PARAM(in_data, &arb_param));
	ERR2(extra->cb->checkin_layer_pixels(in_data->effect_ref, CG_INPUT));
	return err;
}
Exemple #19
0
static PF_Err 
Render (
	PF_InData		*in_data,
	PF_OutData		*out_data,
	PF_ParamDef		*params[],
	PF_LayerDef		*output )
{
	PF_Err			err			 		= PF_Err_NONE;
	register A_long	xL					= 0,
					progress_heightL	= 0;
	Gamma_Table		*g_tableP			= NULL;
	GammaInfo		gamma_info;
	
	AEFX_CLR_STRUCT(gamma_info);
	
	// If the gamma factor is exactly 1.0 just make a direct copy.
	
	if (params[GAMMA_GAMMA]->u.fd.value == (1L << 16)) {
		ERR(PF_COPY(&params[0]->u.ld, 
					output, 
					NULL, 
					NULL));
	} else {
		 
		// If no table exists, pop an error message.

		if (!out_data->sequence_data) {
			PF_STRCPY(out_data->return_msg, "Gamma effect invoked without lookup table");
			out_data->out_flags |= PF_OutFlag_DISPLAY_ERROR_MESSAGE;
			err = PF_Err_INTERNAL_STRUCT_DAMAGED;
		}
		
		if (!err){
			g_tableP = *(Gamma_Table **)out_data->sequence_data;
		
			if (g_tableP->gamma_val != params[GAMMA_GAMMA]->u.fd.value) {
			
				// if the table values are bad, regenerate table contents.
				 
				register double	temp, gamma;

				g_tableP->gamma_val	= params[GAMMA_GAMMA]->u.fd.value;
				gamma				= (PF_FpLong)g_tableP->gamma_val / (double)(1L << 16);
				gamma				= 1.0/gamma;
				
				for (xL = 0; xL <= PF_MAX_CHAN8; ++xL) {
					temp = PF_POW((PF_FpLong)xL / 255.0, gamma);
					g_tableP->lut[xL] = (A_u_char)(temp * 255.0);
				}
			}
			
			// clear all pixels outside extent_hint.

			if (in_data->extent_hint.left	!=	output->extent_hint.left	||
				in_data->extent_hint.top	!=	output->extent_hint.top		||
				in_data->extent_hint.right	!=	output->extent_hint.right	||
				in_data->extent_hint.bottom	!=	output->extent_hint.bottom) {
		
				ERR(PF_FILL(NULL, 
							&output->extent_hint, 
							output));
			}
			
		}
		if (!err) {
		
			// iterate over image data.

			progress_heightL = in_data->extent_hint.top - in_data->extent_hint.bottom;
			gamma_info.lut = g_tableP->lut;
			
			ERR(PF_ITERATE(	0, 
							progress_heightL,
							&params[GAMMA_INPUT]->u.ld, 
							&in_data->extent_hint,
							(void*)&gamma_info, 
							GammaFunc, 
							output));
		}
	}
	return err;
}
Exemple #20
0
static PF_Err 
Render (
	PF_InData		*in_data,
	PF_OutData		*out_data,
	PF_ParamDef		*params[],
	PF_LayerDef		*output )
{
	AEGP_SuiteHandler	suites(in_data->pica_basicP);

	PF_Err				err		= 	PF_Err_NONE,	
						err2	=	PF_Err_NONE;	
						
	PF_Pixel16			bigpix	=	{0,0,0,0};

	A_long				widthL	=	output->width,
						heightL	=	output->height;
	
	PF_NewWorldFlags	flags	=	PF_NewWorldFlag_CLEAR_PIXELS;
	
	PF_EffectWorld		color_world;
	
	PF_Boolean			deepB			=	PF_WORLD_IS_DEEP(output),
						two_sourcesB	=	FALSE;
	
	PF_ParamDef			temp_param;
	
	AEFX_CLR_STRUCT(temp_param);	
	AEFX_CLR_STRUCT(color_world);	
	
	/*	We're going to blend the input with the color. If 
		the user has picked an additional layer, we'll blend 
		it in too, giving it a 'special' look along the way.	
	*/
	
	if (PF_Quality_HI == in_data->quality) {
		ERR(suites.WorldTransformSuite1()->copy_hq(	in_data->effect_ref,
													&params[XFORM_INPUT]->u.ld,
													output,
													&params[XFORM_INPUT]->u.ld.extent_hint,
													&output->extent_hint));
	} else {
		ERR(suites.WorldTransformSuite1()->copy(	in_data->effect_ref,
													&params[XFORM_INPUT]->u.ld,
													output,
													&params[XFORM_INPUT]->u.ld.extent_hint,
													&output->extent_hint));
	}	
	
	ERR(PF_ABORT(in_data));

	/*	Make an offscreen world. If the user has selected an
		extra input layer, we'll size to that (so we can use
		the blend callback, which requires input PF_Worlds of 
		the same dimensions), of the appropriate pixel depth.	
	*/
	
	if (deepB) {
		flags	|=	PF_NewWorldFlag_DEEP_PIXELS;
	}
	
	ERR(PF_CHECKOUT_PARAM(	in_data,
							XFORM_LAYER,
							in_data->current_time,
							in_data->time_step,
							in_data->time_scale,
							&temp_param));
	ERR(PF_ABORT(in_data));
	
	if (!err) {
		if (temp_param.u.ld.data) {
			two_sourcesB	=	TRUE;
			widthL			=	temp_param.u.ld.width;
			heightL			=	temp_param.u.ld.height;		
		} else {
			widthL	=	output->width;
			heightL	=	output->height;
		}

		ERR(suites.WorldSuite1()->new_world(	in_data->effect_ref,
												widthL,
												heightL,
												flags,
												&color_world));

		ERR(PF_ABORT(in_data));
	
		if (deepB) {
			ERR(Copy8BitPixelTo16BitPixel(&params[XFORM_COLOR]->u.cd.value, &bigpix));

			ERR(suites.FillMatteSuite2()->fill16(in_data->effect_ref,
												&bigpix,
												NULL,
												&color_world));
		} else {
			ERR(suites.FillMatteSuite2()->fill(	in_data->effect_ref,
												&params[XFORM_COLOR]->u.cd.value,
												NULL,
												&color_world));
		}

		ERR(PF_ABORT(in_data));


		if (two_sourcesB) {

			ERR(suites.WorldTransformSuite1()->blend(in_data->effect_ref,
													&temp_param.u.ld,
													&color_world,
													params[XFORM_LAYERBLEND]->u.fd.value,
													&color_world));
		} else 	{
			ERR(suites.WorldTransformSuite1()->blend(in_data->effect_ref,
													&params[XFORM_INPUT]->u.ld,
													&color_world,
													params[XFORM_COLORBLEND]->u.fd.value,
													output));
		}

		ERR(PF_ABORT(in_data));

		if (!err) {		

			//	Blend the color layer () with the output	

			PF_CompositeMode	mode;
			
			AEFX_CLR_STRUCT(mode);
			
			mode.xfer		=	PF_Xfer_DIFFERENCE;
			mode.opacity	=	static_cast<A_u_char>(FIX2INT_ROUND(params[XFORM_LAYERBLEND]->u.fd.value / PF_MAX_CHAN8));
			mode.rgb_only	=	TRUE;

			PF_FpLong			opacityF	= FIX_2_FLOAT(params[XFORM_LAYERBLEND]->u.fd.value);

			mode.opacity	= static_cast<A_u_char>((opacityF 	* PF_MAX_CHAN8) 	+ 0.5);
			mode.opacitySu	= static_cast<A_u_short>((opacityF 	* PF_MAX_CHAN16) 	+ 0.5);

				if (mode.opacitySu 	> PF_MAX_CHAN16) {
				mode.opacitySu 	= PF_MAX_CHAN16;
			}

			ERR(suites.WorldTransformSuite1()->transfer_rect(in_data->effect_ref,
															in_data->quality,
															PF_MF_Alpha_STRAIGHT,
															in_data->field,
															&color_world.extent_hint,
															&color_world,
															&mode,
															NULL,
															(A_long)suites.ANSICallbacksSuite1()->fabs(output->extent_hint.right 	- color_world.extent_hint.right ) / 2,
															(A_long)suites.ANSICallbacksSuite1()->fabs(output->extent_hint.bottom - color_world.extent_hint.bottom ) / 2,
															output));
		}
	}		
	
	ERR(PF_ABORT(in_data));
	ERR2(suites.WorldSuite1()->dispose_world(in_data->effect_ref, &color_world));
	ERR2(PF_CHECKIN_PARAM(in_data, &temp_param));
													
	return err;
	
}