您当前的位置: 首页 >  ui

插件开发

暂无认证

  • 1浏览

    0关注

    492博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

第一章 Adobe After Effects AE插件开发 SDK入门-SPBasicSuite对象

插件开发 发布时间:2022-04-07 08:00:10 ,浏览量:1

文章目录
    • 1.SPBasicSuite对象
    • 2.作者答疑

1.SPBasicSuite对象

  插件的本质就是一个后缀名称为aex的动态库,把编译好的动态库放到AE指定的文件夹下(一般是AE安装文件夹下的Plug-ins或者用快捷方式链接到指定文件夹),AE启动时就会找到插件并加载它。   首先是进入点函数:代码如下所示:

A_Err EntryPointFunc(
	struct SPBasicSuite		*pica_basicP,			/* >> */
	A_long				 	major_versionL,			/* >> */		
	A_long					minor_versionL,			/* >> */		
	AEGP_PluginID			aegp_plugin_id,			/* >> */
	AEGP_GlobalRefcon		*global_refconP)		/* d.basic;
	sBasic->function( )
	@endcode
	*/
typedef struct SPBasicSuite {
	/** Acquires a function suite. Loads the suite if necessary,
		and increments its reference count. For example:
	@code
SPErr 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_PHOTOSHOP
SPAPI SPErr SPBasicAcquireSuiteCFM( const char *name, int version, const void **suite );
SPAPI SPErr SPBasicReleaseSuiteCFM( const char *name, int version );
#endif

/*******************************************************************************
 **
 **	Errors
 **
 **/
2.作者答疑

  如有疑问,请留言。

关注
打赏
1665481431
查看更多评论
立即登录/注册

微信扫码登录

0.0782s