static A_Err MDLIO_GetDuration( AEIO_BasicData *basic_dataP , AEIO_InSpecH specH , A_Time * tr ) { AEGP_SuiteHandler suites( basic_dataP->pica_basicP ); AEIO_Handle optionsH = NULL; suites.IOInSuite4()->AEGP_GetInSpecOptionsHandle( specH, reinterpret_cast<void**>(&optionsH) ); if( optionsH == NULL ) { return A_Err_GENERIC; } Menge::MDLOptions * headerP; suites.MemorySuite1()->AEGP_LockMemHandle( optionsH, reinterpret_cast<void**>(&headerP) ); if( headerP == NULL ) { return A_Err_GENERIC; } *tr = headerP->duration; suites.MemorySuite1()->AEGP_UnlockMemHandle( optionsH ); return A_Err_NONE; };
static A_Err UpdateMenuHook( AEGP_GlobalRefcon plugin_refconPV, /* >> */ AEGP_UpdateMenuRefcon refconPV, /* >> */ AEGP_WindowType active_window) /* >> */ { A_Err err = A_Err_NONE; AEGP_SuiteHandler suites(sP); AEGP_LayerH layerH = NULL; AEGP_ObjectType type = AEGP_ObjectType_NONE; try { ERR(suites.LayerSuite5()->AEGP_GetActiveLayer(&layerH)); if (layerH){ ERR(suites.LayerSuite5()->AEGP_GetLayerObjectType(layerH, &type)); if (type == AEGP_ObjectType_TEXT){ ERR(suites.CommandSuite1()->AEGP_SetMenuCommandName(S_Text_Twiddler_cmd, STR(StrID_Name))); ERR(suites.CommandSuite1()->AEGP_EnableCommand(S_Text_Twiddler_cmd)); } else { ERR(suites.CommandSuite1()->AEGP_DisableCommand(S_Text_Twiddler_cmd)); } } else { ERR(suites.CommandSuite1()->AEGP_SetMenuCommandName(S_Text_Twiddler_cmd, STR(StrID_Selection))); } } catch (A_Err &thrown_err){ err = thrown_err; } return err; }
static A_Err MDLIO_GetDimensions( AEIO_BasicData * basic_dataP , AEIO_InSpecH specH , const AEIO_RationalScale * rs0 , A_long * width0 , A_long * height0 ) { AEGP_SuiteHandler suites( basic_dataP->pica_basicP ); AEIO_Handle optionsH = NULL; suites.IOInSuite4()->AEGP_GetInSpecOptionsHandle( specH, reinterpret_cast<void**>(&optionsH) ); if( optionsH == NULL ) { return A_Err_GENERIC; } Menge::MDLOptions * headerP; suites.MemorySuite1()->AEGP_LockMemHandle( optionsH, reinterpret_cast<void**>(&headerP) ); if( headerP == NULL ) { return A_Err_GENERIC; } *width0 = headerP->width; *height0 = headerP->height; suites.MemorySuite1()->AEGP_UnlockMemHandle( optionsH ); return A_Err_NONE; };
static A_Err FBIO_DrawSparseFrame( AEIO_BasicData *basic_dataP, AEIO_InSpecH specH, const AEIO_DrawSparseFramePB *sparse_framePPB, PF_EffectWorld *wP, AEIO_DrawingFlags *draw_flagsP) { AEGP_SuiteHandler suites(basic_dataP->pica_basicP); PF_Pixel color = {255, 123, 223, 0}; A_Rect rectR = {0, 0, 0, 0}; // If the sparse_frame required rect is NOT all zeroes, // use it. Otherwise, just blit the whole thing. if (!(sparse_framePPB->required_region.top == sparse_framePPB->required_region.left == sparse_framePPB->required_region.bottom == sparse_framePPB->required_region.right)){ rectR.top = sparse_framePPB->required_region.top; rectR.bottom = sparse_framePPB->required_region.bottom; rectR.left = sparse_framePPB->required_region.left; rectR.right = sparse_framePPB->required_region.right; } return suites.FillMatteSuite2()->fill( 0, &color, NULL,//reinterpret_cast<const Rect*>(&rectR), wP); };
static A_Err UpdateMenuHook( AEGP_GlobalRefcon plugin_refconPV, /* >> */ AEGP_UpdateMenuRefcon refconPV, /* >> */ AEGP_WindowType active_window) /* >> */ { A_Err err = A_Err_NONE, err2 = A_Err_NONE; AEGP_ItemH active_itemH = NULL; AEGP_ItemType item_type = AEGP_ItemType_NONE; AEGP_SuiteHandler suites(sP); ERR(suites.ItemSuite6()->AEGP_GetActiveItem(&active_itemH)); if (active_itemH) { ERR(suites.ItemSuite6()->AEGP_GetItemType(active_itemH, &item_type)); if (AEGP_ItemType_COMP == item_type || AEGP_ItemType_FOOTAGE == item_type) { ERR(suites.CommandSuite1()->AEGP_EnableCommand(S_Grabba_cmd)); } } else { ERR2(suites.CommandSuite1()->AEGP_DisableCommand(S_Grabba_cmd)); } return err; }
static A_Err MDLIO_DisposeInSpec( AEIO_BasicData * basic_dataP , AEIO_InSpecH specH ) { AEGP_SuiteHandler suites( basic_dataP->pica_basicP ); Menge::Logger logger( basic_dataP->msg_func ); AEIO_Handle optionsH = NULL; suites.IOInSuite4()->AEGP_GetInSpecOptionsHandle( specH, reinterpret_cast<void**>(&optionsH) ); if( optionsH == NULL ) { return A_Err_NONE; } Menge::MDLOptions * old_headerP = NULL; suites.MemorySuite1()->AEGP_LockMemHandle( optionsH, reinterpret_cast<void**>(&old_headerP) ); if( old_headerP->model != nullptr ) { Menge::MDLRender * render = (Menge::MDLRender *)basic_dataP->aegp_refconPV; render->destroyModel( logger, old_headerP->model ); } suites.MemorySuite1()->AEGP_UnlockMemHandle( optionsH ); suites.MemorySuite1()->AEGP_FreeMemHandle( optionsH ); return A_Err_NONE; };
static A_Err FBIO_GetSound( AEIO_BasicData *basic_dataP, AEIO_InSpecH specH, AEIO_SndQuality quality, const AEIO_InterruptFuncs *interrupt_funcsP0, const A_Time *startPT, const A_Time *durPT, A_u_long start_sampLu, A_u_long num_samplesLu, void *dataPV) { A_Err err = A_Err_NONE; AEIO_Handle optionsH = NULL; FBIO_FileHeader *headerP = NULL; AEGP_SuiteHandler suites(basic_dataP->pica_basicP); ERR(suites.IOInSuite4()->AEGP_GetInSpecOptionsHandle(specH, reinterpret_cast<void**>(&optionsH))); ERR(suites.MemorySuite1()->AEGP_LockMemHandle(optionsH, reinterpret_cast<void**>(&headerP))); if (!err) { A_char report[AEGP_MAX_ABOUT_STRING_SIZE] = {'\0'}; suites.ANSICallbacksSuite1()->sprintf(report, "SDK_IO : %d samples of audio requested.", num_samplesLu); ERR(suites.UtilitySuite3()->AEGP_ReportInfo(basic_dataP->aegp_plug_id, report)); ERR(suites.MemorySuite1()->AEGP_UnlockMemHandle(optionsH)); } return err; };
static A_Err FBIO_GetFlatOutputOptions( AEIO_BasicData *basic_dataP, AEIO_OutSpecH outH, AEIO_Handle *optionsPH) { A_Err err = A_Err_NONE; FBIO_FileHeader *infoP = 0; AEGP_SuiteHandler suites(basic_dataP->pica_basicP); ERR(suites.MemorySuite1()->AEGP_NewMemHandle( S_mem_id, "flat optionsH", sizeof(FBIO_FileHeader), AEGP_MemFlag_CLEAR, optionsPH)); ERR(suites.MemorySuite1()->AEGP_LockMemHandle(*optionsPH, reinterpret_cast<void**>(&infoP))); if (!err){ suites.ANSICallbacksSuite1()->strcpy(infoP->name, "flatoptions"); infoP->widthLu = 42; infoP->heightLu = 32; ERR(suites.MemorySuite1()->AEGP_UnlockMemHandle(*optionsPH)); } return err; }
PF_Err Arb_Copy( PF_InData *in_data, PF_OutData *out_data, const PF_ArbitraryH *srcP, PF_ArbitraryH *dstP) { PF_Err err = PF_Err_NONE; PF_Handle sourceH = *srcP; AEGP_SuiteHandler suites(in_data->pica_basicP); if (sourceH) { CG_ArbData *src_arbP = reinterpret_cast<CG_ArbData*>(suites.HandleSuite1()->host_lock_handle(sourceH)); if (!src_arbP) { err = PF_Err_OUT_OF_MEMORY; } else { PF_Handle destH = *dstP; if (destH) { CG_ArbData *dst_arbP = reinterpret_cast<CG_ArbData*>(suites.HandleSuite1()->host_lock_handle(destH)); if (!dst_arbP) { err = PF_Err_OUT_OF_MEMORY; } else { memcpy(dst_arbP,src_arbP,sizeof(CG_ArbData)); suites.HandleSuite1()->host_unlock_handle(destH); } } suites.HandleSuite1()->host_unlock_handle(sourceH); } } return err; }
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; }
static A_Err MDLIO_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. */ AEGP_SuiteHandler suites( basic_dataP->pica_basicP ); Menge::Logger logger( basic_dataP->msg_func ); AEIO_Handle optionsH = NULL; suites.MemorySuite1()->AEGP_NewMemHandle( basic_dataP->aegp_plug_id, "MDLOptions", sizeof( Menge::MDLOptions ), AEGP_MemFlag_CLEAR, &optionsH ); Menge::MDLOptions * headerP = NULL; suites.MemorySuite1()->AEGP_LockMemHandle( optionsH, reinterpret_cast<void **>(&headerP) ); if( headerP == NULL ) { return A_Err_GENERIC; } Menge::MDLRender * render = (Menge::MDLRender *)basic_dataP->aegp_refconPV; bool successful = true; std::wstring ptc = (const wchar_t *)file_pathZ; successful = s_InitInSpecFromFile( logger, headerP, render, ptc ); if( successful == true ) { AEIO_Handle old_optionsH = NULL; suites.IOInSuite4()->AEGP_SetInSpecOptionsHandle( specH, optionsH, reinterpret_cast<void **>(&old_optionsH) ); suites.IOInSuite4()->AEGP_SetInSpecDepth( specH, 32 ); suites.IOInSuite4()->AEGP_SetInSpecDuration( specH, &headerP->duration ); suites.IOInSuite4()->AEGP_SetInSpecDimensions( specH, headerP->width, headerP->height ); A_Fixed native_fps = FLOAT2FIX( 29.97 ); suites.IOInSuite4()->AEGP_SetInSpecNativeFPS( specH, native_fps ); } suites.MemorySuite1()->AEGP_UnlockMemHandle( optionsH ); if( successful == false ) { return A_Err_GENERIC; } return A_Err_NONE; }
static PF_Err HandleEvent( PF_InData *in_data, PF_OutData *out_data, PF_ParamDef *params[], PF_LayerDef *output, PF_EventExtra *extra) { PF_Err err = PF_Err_NONE; AEGP_SuiteHandler suites(in_data->pica_basicP); switch (extra->e_type) { case PF_Event_DO_CLICK: ERR(DoClick(in_data, out_data, params, output, extra)); // Premiere Pro/Elements does not support this suite if (in_data->appl_id != 'PrMr') { ERR(suites.AdvAppSuite2()->PF_InfoDrawText3("ColorGrid - Do Click Event","Adobe Systems, Inc.", NULL)); } break; case PF_Event_DRAG: // Premiere Pro/Elements does not support this suite if (in_data->appl_id != 'PrMr') { ERR(suites.AdvAppSuite2()->PF_InfoDrawText3("ColorGrid - Drag Event","Adobe Systems, Inc.", NULL)); } break; case PF_Event_DRAW: ERR(DrawEvent(in_data, out_data, params, output, extra, params[1]->u.cd.value)); // Premiere Pro/Elements does not support this suite if (in_data->appl_id != 'PrMr') { // don't draw info palette *during* a draw event, it will mess up // the drawing and cause schmutz // ERR(suites.AdvAppSuite2()->PF_InfoDrawText3("ColorGrid - Draw Event","Adobe Systems, Inc.", NULL)); } break; case PF_Event_ADJUST_CURSOR: ERR(ChangeCursor(in_data, out_data, params, output, extra)); // Premiere Pro/Elements does not support this suite if (in_data->appl_id != 'PrMr') { ERR(suites.AdvAppSuite2()->PF_InfoDrawText3("ColorGrid - Change Cursor Event","Adobe Systems, Inc.", NULL)); } break; default: break; } return err; }
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_SuiteHandler suites(sP); if (S_Grabba_cmd == command) { AEGP_ItemH active_itemH = NULL; AEGP_RenderOptionsH roH = NULL; ERR(suites.ItemSuite6()->AEGP_GetActiveItem(&active_itemH)); if (active_itemH) { ERR(suites.RenderOptionsSuite1()->AEGP_NewFromItem(S_my_id, active_itemH, &roH)); if (!err && roH) { AEGP_FrameReceiptH receiptH = NULL; AEGP_WorldH frameH = NULL; A_Time timeT = {0,1}; AEGP_WorldType type = AEGP_WorldType_NONE; ERR(suites.RenderOptionsSuite1()->AEGP_SetTime(roH, timeT)); // avoid "div by 0" ERR(suites.RenderOptionsSuite1()->AEGP_GetWorldType(roH, &type)); ERR(suites.RenderSuite2()->AEGP_RenderAndCheckoutFrame(roH, NULL, NULL, &receiptH)); if (receiptH) { ERR(suites.RenderSuite2()->AEGP_GetReceiptWorld(receiptH, &frameH)); // WooHOO! Pixel Party! // We Crash, So You Don't Have To... // // A nice developer like yourself might instinctually // AEGP_Dispose() of the frame you just got. Actually, // After Effects will manage that frame for you. Do // not dispose! Thanks for being so considerate. Now // go wash your hands. ERR2(suites.RenderSuite2()->AEGP_CheckinFrame(receiptH)); } } ERR(suites.RenderOptionsSuite1()->AEGP_Dispose(roH)); } *handledPB = TRUE; } return err; }
static A_Err ConstructModuleInfo( SPBasicSuite * pica_basicP, AEIO_ModuleInfo * info ) { A_Err err = A_Err_NONE; AEGP_SuiteHandler suites( pica_basicP ); if( info ) { info->sig = 'MDL_'; info->max_width = 2048; info->max_height = 2048; info->num_filetypes = 1; info->num_extensions = 1; info->num_clips = 0; info->create_kind.type = 'MDL_'; info->create_kind.creator = AEIO_ANY_CREATOR; info->create_ext.pad = '.'; info->create_ext.extension[0] = 'm'; info->create_ext.extension[1] = 'd'; info->create_ext.extension[2] = 'l'; info->num_aux_extensionsS = 0; suites.ANSICallbacksSuite1()->strcpy( info->name, "MDL IO files (SDK)" ); info->flags = AEIO_MFlag_INPUT | AEIO_MFlag_OUTPUT | AEIO_MFlag_FILE | AEIO_MFlag_VIDEO | AEIO_MFlag_NO_TIME | //AEIO_MFlag_HAS_LAYERS | AEIO_MFlag_INPUT_OPTIONS | //AEIO_MFlag_HOST_FRAME_START_DIALOG | //AEIO_MFlag_HAS_AUX_DATA | //AEIO_MFlag_HAS_META_DATA | //AEIO_MFlag_NO_OPTIONS | AEIO_MFlag_VIDEO; info->read_kinds[0].mac.type = 'MDL_'; info->read_kinds[0].mac.creator = AEIO_ANY_CREATOR; info->read_kinds[1].ext = info->create_ext; info->read_kinds[2].ext.pad = '.'; info->read_kinds[2].ext.extension[0] = 'm'; info->read_kinds[2].ext.extension[1] = 'd'; info->read_kinds[2].ext.extension[2] = 'l'; } else { err = A_Err_STRUCT; } return err; }
static A_Err FBIO_FlattenOptions( AEIO_BasicData *basic_dataP, AEIO_InSpecH specH, AEIO_Handle *flat_optionsPH) { A_Err err = A_Err_NONE, err2 = A_Err_NONE; AEIO_Handle optionsH = NULL; FBIO_FileHeader *flat_headerP = NULL, *old_headerP = NULL; AEGP_SuiteHandler suites(basic_dataP->pica_basicP); // Given the AEIO_InSpecH, acquire the non-flat // options handle and use it to create a flat // version. Do NOT de-allocate the non-flat // options handle! ERR(suites.IOInSuite4()->AEGP_GetInSpecOptionsHandle(specH, reinterpret_cast<void**>(&optionsH))); if (optionsH) { ERR(suites.MemorySuite1()->AEGP_LockMemHandle(optionsH, reinterpret_cast<void**>(&old_headerP))); } if (old_headerP){ ERR(suites.MemorySuite1()->AEGP_NewMemHandle( S_mem_id, "flattened_options", sizeof(FBIO_FileHeader), AEGP_MemFlag_CLEAR, flat_optionsPH)); } if (*flat_optionsPH){ ERR(suites.MemorySuite1()->AEGP_LockMemHandle(*flat_optionsPH, (void**)&flat_headerP)); } if (!err && flat_headerP) { // Here is where you should provide a disk-safe copy of your options data ERR(PretendToReadFileHeader(basic_dataP, flat_headerP)); } if (optionsH) { ERR2(suites.MemorySuite1()->AEGP_UnlockMemHandle(optionsH)); } if (*flat_optionsPH) { ERR2(suites.MemorySuite1()->AEGP_UnlockMemHandle(*flat_optionsPH)); } return err; };
static A_Err MDLIO_GetInSpecInfo( AEIO_BasicData * basic_dataP , AEIO_InSpecH specH , AEIO_Verbiage * verbiageP ) { AEGP_SuiteHandler suites( basic_dataP->pica_basicP ); suites.ANSICallbacksSuite1()->strcpy( verbiageP->name, "MDL" ); suites.ANSICallbacksSuite1()->strcpy( verbiageP->type, "(SDK) MDL File" ); suites.ANSICallbacksSuite1()->strcpy( verbiageP->sub_type, "no particular subtype" ); return A_Err_NONE; };
std::string GetProjectDir(PF_InData *in_data) { if(in_data->appl_id == 'PrMr') return std::string(""); AEGP_SuiteHandler suites(in_data->pica_basicP); AEGP_ProjectH projH = NULL; suites.ProjSuite5()->AEGP_GetProjectByIndex(0, &projH); AEGP_MemHandle pathH = NULL; suites.ProjSuite5()->AEGP_GetProjectPath(projH, &pathH); if(pathH) { std::string proj_dir; A_UTF16Char *path = NULL; suites.MemorySuite1()->AEGP_LockMemHandle(pathH, (void **)&path); if(path) { // poor-man's unicode copy char c_path[AEGP_MAX_PATH_SIZE]; char *c = c_path; A_UTF16Char *s = path; do{ *c++ = *s; }while(*s++ != '\0'); #ifdef WIN_ENV #define PATH_DELIMITER '\\' #else #define PATH_DELIMITER '/' #endif std::string proj_path(c_path); if(proj_path.find_last_of(PATH_DELIMITER) != std::string::npos) { proj_dir = proj_path.substr(0, proj_path.find_last_of(PATH_DELIMITER)); } } suites.MemorySuite1()->AEGP_FreeMemHandle(pathH); return proj_dir; } return std::string(""); }
static A_Err ConstructModuleInfo( SPBasicSuite *pica_basicP, AEIO_ModuleInfo *info) { A_Err err = A_Err_NONE; AEGP_SuiteHandler suites(pica_basicP); if (info) { info->sig = 'FFK_'; info->max_width = 720; info->max_height = 480; info->num_filetypes = 1; info->num_extensions = 1; info->num_clips = 0; info->create_kind.type = 'FFK_'; info->create_kind.creator = AEIO_ANY_CREATOR; info->create_ext.pad = '.'; info->create_ext.extension[0] = 'f'; info->create_ext.extension[1] = 'f'; info->create_ext.extension[2] = 'k'; info->num_aux_extensionsS = 0; suites.ANSICallbacksSuite1()->strcpy(info->name, "FFK files (SDK)"); info->flags = AEIO_MFlag_INPUT | AEIO_MFlag_OUTPUT | AEIO_MFlag_FILE | AEIO_MFlag_STILL | AEIO_MFlag_NO_TIME | AEIO_MFlag_HOST_FRAME_START_DIALOG | AEIO_MFlag_NO_OPTIONS; info->read_kinds[0].mac.type = 'FFK_'; info->read_kinds[0].mac.creator = AEIO_ANY_CREATOR; info->read_kinds[1].ext = info->create_ext; info->read_kinds[2].ext.pad = '.'; info->read_kinds[2].ext.extension[0] = 'f'; info->read_kinds[2].ext.extension[1] = 'f'; info->read_kinds[2].ext.extension[2] = 'k'; info->read_kinds[2].ext.extension[3] = '\0'; } else { err = A_Err_STRUCT; } return err; }
static A_Err FBIO_DisposeOutputOptions( AEIO_BasicData *basic_dataP, void *optionsPV) { AEGP_SuiteHandler suites(basic_dataP->pica_basicP); AEIO_Handle optionsH = reinterpret_cast<AEIO_Handle>(optionsPV); A_Err err = A_Err_NONE; if (optionsH){ ERR(suites.MemorySuite1()->AEGP_FreeMemHandle(optionsH)); } return err; };
static A_Err DeathHook( AEGP_GlobalRefcon plugin_refconP, AEGP_DeathRefcon refconP) { A_Err err = A_Err_NONE; AEGP_SuiteHandler suites(sP); A_char report[AEGP_MAX_ABOUT_STRING_SIZE] = {'\0'}; suites.ANSICallbacksSuite1()->sprintf(report, STR(StrID_IdleCount), S_idle_count); return err; }
static A_Err FBIO_GetOutputInfo( AEIO_BasicData *basic_dataP, AEIO_OutSpecH outH, AEIO_Verbiage *verbiageP) { A_Err err = A_Err_NONE; AEGP_SuiteHandler suites(basic_dataP->pica_basicP); suites.ANSICallbacksSuite1()->strcpy(verbiageP->name, "filename"); suites.ANSICallbacksSuite1()->strcpy(verbiageP->type, "(SDK) Fake File"); suites.ANSICallbacksSuite1()->strcpy(verbiageP->sub_type, "no subtypes supported"); return err; };
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; };
static A_Err FBIO_DisposeInSpec( AEIO_BasicData *basic_dataP, AEIO_InSpecH specH) { A_Err err = A_Err_NONE; AEIO_Handle optionsH = NULL; AEGP_SuiteHandler suites(basic_dataP->pica_basicP); ERR(suites.IOInSuite4()->AEGP_GetInSpecOptionsHandle(specH, reinterpret_cast<void**>(&optionsH))); if (optionsH) { ERR(suites.MemorySuite1()->AEGP_FreeMemHandle(optionsH)); } return err; };
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; }
static PF_Err About ( PF_InData *in_data, PF_OutData *out_data, PF_ParamDef *params[], PF_LayerDef *output ) { AEGP_SuiteHandler suites(in_data->pica_basicP); suites.ANSICallbacksSuite1()->sprintf( out_data->return_msg, "%s v%d.%d\r%s", STR(StrID_Name), MAJOR_VERSION, MINOR_VERSION, STR(StrID_Description)); return PF_Err_NONE; }
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; }
static A_Err MDLIO_FlattenOptions( AEIO_BasicData * basic_dataP , AEIO_InSpecH specH , AEIO_Handle * flat_optionsPH ) { AEGP_SuiteHandler suites( basic_dataP->pica_basicP ); Menge::Logger logger( basic_dataP->msg_func ); AEIO_Handle optionsH = NULL; suites.IOInSuite4()->AEGP_GetInSpecOptionsHandle( specH, reinterpret_cast<void**>(&optionsH) ); Menge::MDLOptions * headerP = NULL; suites.MemorySuite1()->AEGP_LockMemHandle( optionsH, reinterpret_cast<void**>(&headerP) ); suites.MemorySuite1()->AEGP_NewMemHandle( basic_dataP->aegp_plug_id, "MDLFlatten", MDL_IO_FLATTEN_OPTIONS_SIZE, AEGP_MemFlag_CLEAR, flat_optionsPH ); unsigned char * flat_headerP = NULL; suites.MemorySuite1()->AEGP_LockMemHandle( *flat_optionsPH, (void**)&flat_headerP ); if( headerP->writeFlatten( flat_headerP ) == false ) { logger.message( "MDLIO_FlattenOptions headerP invalid writeFlatten" ); } if( headerP->model != nullptr ) { Menge::MDLRender * render = (Menge::MDLRender *)basic_dataP->aegp_refconPV; render->destroyModel( logger, headerP->model ); headerP->model = nullptr; } suites.MemorySuite1()->AEGP_UnlockMemHandle( *flat_optionsPH ); suites.MemorySuite1()->AEGP_UnlockMemHandle( optionsH ); return A_Err_NONE; };
PF_Err Arb_Interpolate( PF_InData *in_data, PF_OutData *out_data, double intrp_amtF, const PF_ArbitraryH *l_arbPH, const PF_ArbitraryH *r_arbPH, PF_ArbitraryH *intrp_arbP) { PF_Err err = PF_Err_NONE; CG_ArbData *int_arbP = NULL, *l_arbP = NULL, *r_arbP = NULL; PF_PixelFloat *headP = NULL, *lpixP = NULL, *rpixP = NULL; A_short iS = 0; AEGP_SuiteHandler suites(in_data->pica_basicP); int_arbP = reinterpret_cast<CG_ArbData*>(suites.HandleSuite1()->host_lock_handle(*intrp_arbP)); l_arbP = reinterpret_cast<CG_ArbData*>(suites.HandleSuite1()->host_lock_handle(*l_arbPH)); r_arbP = reinterpret_cast<CG_ArbData*>(suites.HandleSuite1()->host_lock_handle(*r_arbPH)); headP = reinterpret_cast<PF_PixelFloat*>(int_arbP); lpixP = reinterpret_cast<PF_PixelFloat*>(l_arbP); rpixP = reinterpret_cast<PF_PixelFloat*>(r_arbP); for(iS = 0; iS < CG_ARBDATA_ELEMENTS; ++iS) { ColorGrid_InterpPixel( intrp_amtF, lpixP, rpixP, headP); lpixP++; rpixP++; headP++; } suites.HandleSuite1()->host_unlock_handle(*intrp_arbP); suites.HandleSuite1()->host_unlock_handle(*l_arbPH); suites.HandleSuite1()->host_unlock_handle(*r_arbPH); return err; }
void AnimatorPluginInitiator::initialize(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; AnimatorPluginInfo * info = AnimatorPluginInfo::shared(); info->m_basicSuite = pica_basicP; info->m_pluginID = aegp_plugin_id; // 初始化菜单 AEGP_SuiteHandler suites(pica_basicP); AEGP_Command commandSeperator; ERR(suites.CommandSuite1()->AEGP_GetUniqueCommand(&commandSeperator)); ERR(suites.CommandSuite1()->AEGP_InsertMenuCommand(commandSeperator, "-", AEGP_Menu_FILE, AEGP_MENU_INSERT_AT_BOTTOM)); ERR(suites.RegisterSuite5()->AEGP_RegisterUpdateMenuHook(info->m_pluginID, animatorPlugin_UpdateMenuHook, NULL)); ERR(suites.CommandSuite1()->AEGP_GetUniqueCommand(&info->m_commandID)); ERR(suites.CommandSuite1()->AEGP_InsertMenuCommand(info->m_commandID, "Export Animator File", AEGP_Menu_FILE, AEGP_MENU_INSERT_AT_BOTTOM)); ERR(suites.RegisterSuite5()->AEGP_RegisterCommandHook(info->m_pluginID, AEGP_HP_BeforeAE, info->m_commandID, animatorPlugin_CommandHook, NULL)); ERR(suites.CommandSuite1()->AEGP_GetUniqueCommand(&info->m_foreverCommandID)); ERR(suites.CommandSuite1()->AEGP_InsertMenuCommand(info->m_foreverCommandID, "Export Forever File", AEGP_Menu_FILE, AEGP_MENU_INSERT_AT_BOTTOM)); ERR(suites.RegisterSuite5()->AEGP_RegisterCommandHook(info->m_pluginID, AEGP_HP_BeforeAE, info->m_foreverCommandID, animatorPlugin_CommandHook, NULL)); ERR(suites.CommandSuite1()->AEGP_GetUniqueCommand(&info->m_moudleCommandID)); ERR(suites.CommandSuite1()->AEGP_InsertMenuCommand(info->m_moudleCommandID, "Export Moudle File", AEGP_Menu_FILE, AEGP_MENU_INSERT_AT_BOTTOM)); ERR(suites.RegisterSuite5()->AEGP_RegisterCommandHook(info->m_pluginID, AEGP_HP_BeforeAE, info->m_moudleCommandID, animatorPlugin_CommandHook, NULL)); ERR(suites.CommandSuite1()->AEGP_GetUniqueCommand(&info->m_batchCommandID)); ERR(suites.CommandSuite1()->AEGP_InsertMenuCommand(info->m_batchCommandID, "Batch Export File", AEGP_Menu_FILE, AEGP_MENU_INSERT_AT_BOTTOM)); ERR(suites.RegisterSuite5()->AEGP_RegisterCommandHook(info->m_pluginID, AEGP_HP_BeforeAE, info->m_batchCommandID, animatorPlugin_CommandHook, NULL)); ERR(suites.CommandSuite1()->AEGP_GetUniqueCommand(&info->m_batchForeverCommandID)); ERR(suites.CommandSuite1()->AEGP_InsertMenuCommand(info->m_batchForeverCommandID, "Batch Export Forever File", AEGP_Menu_FILE, AEGP_MENU_INSERT_AT_BOTTOM)); ERR(suites.RegisterSuite5()->AEGP_RegisterCommandHook(info->m_pluginID, AEGP_HP_BeforeAE, info->m_batchForeverCommandID, animatorPlugin_CommandHook, NULL)); // info->printInfomation(); }
static A_Err MDLIO_DrawSparseFrame( AEIO_BasicData * basic_dataP , AEIO_InSpecH specH , const AEIO_DrawSparseFramePB * sparse_framePPB , PF_EffectWorld * wP , AEIO_DrawingFlags * draw_flagsP ) { AEGP_SuiteHandler suites( basic_dataP->pica_basicP ); Menge::Logger logger( basic_dataP->msg_func ); Menge::MDLRender * render = (Menge::MDLRender *)basic_dataP->aegp_refconPV; AEIO_Handle optionsH = NULL; suites.IOInSuite4()->AEGP_GetInSpecOptionsHandle( specH, reinterpret_cast<void**>(&optionsH) ); if( optionsH == NULL ) { return A_Err_GENERIC; } Menge::MDLOptions * headerP; suites.MemorySuite1()->AEGP_LockMemHandle( optionsH, reinterpret_cast<void**>(&headerP) ); if( headerP == NULL ) { logger.message( "DrawSparseFrame headerP == NULL" ); return A_Err_GENERIC; } double timing = (double( sparse_framePPB->tr.value ) / double( sparse_framePPB->tr.scale )) * 1000.0; bool successful = s_DrawMDLFrame( logger, wP, render, headerP, timing ); suites.MemorySuite1()->AEGP_UnlockMemHandle( optionsH ); if( successful == false ) { return A_Err_GENERIC; } return A_Err_NONE; };