1.SPBasicSuite对象
插件的本质就是一个后缀名称为阴离子交换的动态库,把编译好的动态库放到自动曝光装置指定的文件夹下(一般是自动曝光装置安装文件夹下的插件或者用快捷方式链接到指定文件夹),AE启动时就会找到插件并加载它。
首先是进入点函数:代码如下所示:
A _ Err EntryPointFunc(struct SPBasicSuite * pica _ basicP,/* */A_long major_versionL,/* */A_long minor_versionL,/* */AEGP _ PluginID AEGP _ plugin _ id,/* */AEGP _ global refcon * global _ ref conp)/* */{ PT _ XTE _ START { * global _ ref conp=(AEGP _ global refcon)new panel ator(pica _ basicP,AEGP _ plugin _ id);} PT _ XTE _ CATCH _ RETURN _错误;} SPBasicSuite是什么?代码如下:
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *常量* * * * * */* * * * PICA基本套件名称*/#定义kSPBasicSuite ‘SP基本套件/** PICA基本套件版本*/# define kSPBasicSuiteVersion 4/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *一个套件由一列函数指针组成。应用程序或加载套件的插件在获取套件时提供有效的指针。当套件不可用时,指针被设置为\ c#未定义()函数的地址。不要试图获取套件(除了\c #SPBlocksSuite)来响应异食癖访问(\ c # kSPAccessCaller)或属性(\ c # kSPPropertiesCaller)消息。在这些加载和卸载操作期间,大多数套件都不可用。只要在卸载插件之前释放它们,您就可以在首次加载插件时获得所有需要的套件。然而,在关机时,只获取那些明确需要关机的套件是最有效的; 例如,释放内存和保存首选项\c SPBasicSuite本身是通过任何调用传递给插件的消息数据的一部分。从消息数据结构: @代码SPBasicSuite sBasic=m访问它
essage->d.basic; sBasic->function( ) @endcode */typedef struct SPBasicSuite { /** Acquires a function suite. Loads the suite if necessary, and increments its reference count. For example: @codeSPErr error;SPBasicSuite *sBasic = message->d.basic;AIRandomSuite *sRandom;sBasic->AcquireSuite( kAIRandomSuite, kAIRandomVersion, &sRandom ); @endcode @param name The suite name. @param version The suite version number. @param suite [out] A buffer in which to return the suite pointer. @see \c #SPSuitesSuite::AcquireSuite() */ SPAPI SPErr (*AcquireSuite)( const char *name, int version, const void **suite ); /** Decrements the reference count of a suite and unloads it when the reference count reaches 0. @param name The suite name. @param version The suite version number. */ SPAPI SPErr (*ReleaseSuite)( const char *name, int version ); /** Compares two strings for equality. @param token1 The first null-terminated string. @param token2 The second null-terminated string. @return True if the strings are the same, false otherwise. */ SPAPI SPBoolean (*IsEqual)( const char *token1, const char *token2 ); /** Allocates a block of memory. @param size The number of bytes. @param block [out] A buffer in which to return the block pointer. @see \c #SPBlocksSuite::AllocateBlock() */ SPAPI SPErr (*AllocateBlock)( size_t size, void **block ); /** Frees a block of memory allocated with \c #AllocateBlock(). @param block The block pointer. @see \c #SPBlocksSuite::FreeBlock() */ SPAPI SPErr (*FreeBlock)( void *block ); /** Reallocates a block previously allocated with \c #AllocateBlock(). Increases the size without changing the location, if possible. @param block The block pointer. @param newSize The new number of bytes. @param newblock [out] A buffer in which to return the new block pointer. @see \c #SPBlocksSuite::ReallocateBlock() */ SPAPI SPErr (*ReallocateBlock)( void *block, size_t newSize, void **newblock ); /** A function pointer for unloaded suites. This is a protective measure against other plug-ins that may mistakenly use the suite after they have released it. A plug-in that exports a suite should unload the suite's procedure pointers when it is unloaded, and restore them when the plug-in is reloaded. \li On unload, replace the suite's procedure pointers with the address of this function. \li On reload, restore the suite's procedure pointers with the updated addresses of their functions. For example: @code SPErr UnloadSuite( MySuite *mySuite, SPAccessMessage *message ) { mySuite->functionA = (void *) message->d.basic->Undefined; mySuite->functionB = (void *) message->d.basic->Undefined; } SPErr ReloadSuite( MySuite *mySuite, SPAccessMessage *message ) { mySuite->functionA = functionA; mySuite->functionB = functionB; } @endcode */ SPAPI SPErr (*Undefined)( void );} SPBasicSuite;/** Internal */SPAPI SPErr SPBasicAcquireSuite( const char *name, int version, const void **suite );/** Internal */SPAPI SPErr SPBasicReleaseSuite( const char *name, int version );/** Internal */SPAPI SPBoolean SPBasicIsEqual( const char *token1, const char *token2 );/** Internal */SPAPI SPErr SPBasicAllocateBlock( size_t size, void **block );/** Internal */SPAPI SPErr SPBasicFreeBlock( void *block );/** Internal */SPAPI SPErr SPBasicReallocateBlock( void *block, size_t newSize, void **newblock );/** Internal */SPAPI SPErr SPBasicUndefined( void );#if INSIDE_PHOTOSHOPSPAPI SPErr SPBasicAcquireSuiteCFM( const char *name, int version, const void **suite );SPAPI SPErr SPBasicReleaseSuiteCFM( const char *name, int version );#endif/******************************************************************************* ** ** Errors ** **/
2.作者答疑
如有疑问,请留言。
提示:作者联系方式
提示:插件开发流程 – 知乎