Shinya Kitaoka 810553
#pragma once
Shinya Kitaoka 810553
Toshihiro Shimizu 890ddd
#ifndef TOONZ_PLUGIN_H__
Toshihiro Shimizu 890ddd
#define TOONZ_PLUGIN_H__
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include <stdint.h></stdint.h>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifdef _MSC_VER
Toshihiro Shimizu 890ddd
#define TOONZ_EXPORT __declspec(dllexport)
Toshihiro Shimizu 890ddd
#define TOONZ_PACK
Toshihiro Shimizu 890ddd
#else
Toshihiro Shimizu 890ddd
#define TOONZ_EXPORT
Toshihiro Shimizu 890ddd
#define TOONZ_PACK __attribute__((packed))
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#if defined(_MSC_VER)
Toshihiro Shimizu 890ddd
#pragma pack(push, 1)
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
struct toonz_UUID_ {
Toshihiro Shimizu 890ddd
	uint32_t uid0;
Toshihiro Shimizu 890ddd
	uint16_t uid1;
Toshihiro Shimizu 890ddd
	uint16_t uid2;
Toshihiro Shimizu 890ddd
	uint16_t uid3;
Toshihiro Shimizu 890ddd
	uint64_t uid4;
Toshihiro Shimizu 890ddd
} TOONZ_PACK;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef toonz_UUID_ toonz_UUID;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
struct toonz_if_version_t_ {
Toshihiro Shimizu 890ddd
	int32_t major;
Toshihiro Shimizu 890ddd
	int32_t minor;
Toshihiro Shimizu 890ddd
} TOONZ_PACK;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef toonz_if_version_t_ toonz_if_version_t;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
struct toonz_plugin_version_t_ {
Toshihiro Shimizu 890ddd
	int32_t major;
Toshihiro Shimizu 890ddd
	int32_t minor;
Toshihiro Shimizu 890ddd
} TOONZ_PACK;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef toonz_plugin_version_t_ toonz_plugin_version_t;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
struct toonz_nodal_rasterfx_handler_t_;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
struct toonz_plugin_probe_t_ {
Toshihiro Shimizu 890ddd
	toonz_if_version_t ver;			   /* version of the structure */
Toshihiro Shimizu 890ddd
	toonz_plugin_version_t plugin_ver; /* version of the plugin */
Toshihiro Shimizu 890ddd
	const char *name;
Toshihiro Shimizu 890ddd
	const char *vendor;
Toshihiro Shimizu 890ddd
	const char *id;
Toshihiro Shimizu 890ddd
	const char *note;
Toshihiro Shimizu 890ddd
	const char *helpurl;
Toshihiro Shimizu 890ddd
	void *reserved_ptr_[3];
Toshihiro Shimizu 890ddd
	uint32_t clss;
Toshihiro Shimizu 890ddd
	uint32_t reserved_int_[7];
Toshihiro Shimizu 890ddd
	toonz_nodal_rasterfx_handler_t_ *handler;
Toshihiro Shimizu 890ddd
	void *reserved_ptr_trail_[3];
Toshihiro Shimizu 890ddd
} TOONZ_PACK;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef toonz_plugin_probe_t_ toonz_plugin_probe_t;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
struct toonz_plugin_probe_list_t_ {
Toshihiro Shimizu 890ddd
	toonz_if_version_t ver; /* a version of toonz_plugin_probe_t */
Toshihiro Shimizu 890ddd
	struct toonz_plugin_probe_t_ *begin;
Toshihiro Shimizu 890ddd
	struct toonz_plugin_probe_t_ *end;
Toshihiro Shimizu 890ddd
} TOONZ_PACK;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef toonz_plugin_probe_list_t_ toonz_plugin_probe_list_t;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#if defined(_MSC_VER)
Toshihiro Shimizu 890ddd
#pragma pack(pop)
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#if defined(__cplusplus)
Toshihiro Shimizu 890ddd
namespace toonz
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
typedef toonz_UUID UUID;
Toshihiro Shimizu 890ddd
typedef toonz_plugin_probe_t plugin_probe_t;
Toshihiro Shimizu 890ddd
typedef toonz_plugin_probe_list_t plugin_probe_list_t;
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#define TOONZ_IF_VER(major, minor) \
Toshihiro Shimizu 890ddd
	{                              \
Toshihiro Shimizu 890ddd
		(major), (minor)           \
Toshihiro Shimizu 890ddd
	} /* interface or type version */
Toshihiro Shimizu 890ddd
#define TOONZ_PLUGIN_VER(major, minor) \
Toshihiro Shimizu 890ddd
	{                                  \
Toshihiro Shimizu 890ddd
		(major), (minor)               \
Toshihiro Shimizu 890ddd
	} /* plugin version */
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#define TOONZ_PLUGIN_PROBE_BEGIN(ver)                              \
Toshihiro Shimizu 890ddd
	static const toonz_if_version_t toonz_plugin_probe_ver_ = ver; \
Toshihiro Shimizu 890ddd
	struct toonz_plugin_probe_t_ toonz_plugin_info_begin_[] = {
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#define TOONZ_PLUGIN_PROBE_DEFINE(plugin_ver, nm, vendor, ident, note, helpurl, cls, handler) \
Toshihiro Shimizu 890ddd
	{                                                                                         \
Toshihiro Shimizu 890ddd
		toonz_plugin_probe_ver_,                                                              \
Toshihiro Shimizu 890ddd
			plugin_ver,                                                                       \
Toshihiro Shimizu 890ddd
			(nm), (vendor), (ident), (note), (helpurl),                                       \
Toshihiro Shimizu 890ddd
			{0}, /* reserved null ptrs */                                                     \
Toshihiro Shimizu 890ddd
			((cls)),                                                                          \
Toshihiro Shimizu 890ddd
			{0}, /* reserved 32bit-integers */                                                \
Toshihiro Shimizu 890ddd
			(handler),                                                                        \
Toshihiro Shimizu 890ddd
		{                                                                                     \
Toshihiro Shimizu 890ddd
			0                                                                                 \
Toshihiro Shimizu 890ddd
		} /* reserved null ptrs */                                                            \
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#define TOONZ_PLUGIN_PROBE_END \
Toshihiro Shimizu 890ddd
	, { 0 } /* delim */        \
Toshihiro Shimizu 890ddd
	}                          \
Toshihiro Shimizu 890ddd
	;                          \
Toshihiro Shimizu 890ddd
	TOONZ_EXPORT struct toonz_plugin_probe_list_t_ toonz_plugin_info_list = {toonz_plugin_probe_ver_, toonz_plugin_info_begin_, &toonz_plugin_info_begin_[sizeof(toonz_plugin_info_begin_) / sizeof(struct toonz_plugin_probe_t_) - 1]};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*! エラーコード */
Toshihiro Shimizu 890ddd
#define TOONZ_OK (0)					   /*!< 成功 */
Toshihiro Shimizu 890ddd
#define TOONZ_ERROR_UNKNOWN (-1)		   /*!< 下記以外の不明なエラー */
Toshihiro Shimizu 890ddd
#define TOONZ_ERROR_NOT_IMPLEMENTED (-2)   /*!< 未実装 */
Toshihiro Shimizu 890ddd
#define TOONZ_ERROR_VERSION_UNMATCH (-3)   /*!< バージョン不整合 */
Toshihiro Shimizu 890ddd
#define TOONZ_ERROR_INVALID_HANDLE (-4)	/*!< 型が異なるなどの無効なハンドルが渡された */
Toshihiro Shimizu 890ddd
#define TOONZ_ERROR_NULL (-5)			   /*!< NULLが許容されていない引数がNULL */
Toshihiro Shimizu 890ddd
#define TOONZ_ERROR_POLLUTED (-6)		   /*!< 0でなければならない予約フィールドが0ではない */
Toshihiro Shimizu 890ddd
#define TOONZ_ERROR_OUT_OF_MEMORY (-7)	 /*!< メモリ不足 */
Toshihiro Shimizu 890ddd
#define TOONZ_ERROR_INVALID_SIZE (-8)	  /*!< 引数で指定されたサイズが間違っている */
Toshihiro Shimizu 890ddd
#define TOONZ_ERROR_INVALID_VALUE (-9)	 /*!< 定義されてない値 */
Toshihiro Shimizu 890ddd
#define TOONZ_ERROR_BUSY (-10)			   /*!< 要求されたリソースが既に使用されている */
Toshihiro Shimizu 890ddd
#define TOONZ_ERROR_NOT_FOUND (-11)		   /*!< 指定されたものが見つからなかった */
Toshihiro Shimizu 890ddd
#define TOONZ_ERROR_FAILED_TO_CREATE (-12) /*!< オブジェクト等の作成に失敗 */
Toshihiro Shimizu 890ddd
#define TOONZ_ERROR_PREREQUISITE (-13)	 /*!< 事前に他の関数を呼ぶなどの前提条件が満たされていない */
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#define TOONZ_PARAM_ERROR_NONE (0)
Toshihiro Shimizu 890ddd
#define TOONZ_PARAM_ERROR_VERSION (1 << 0) /* version unmatched */
Toshihiro Shimizu 890ddd
#define TOONZ_PARAM_ERROR_LABEL (1 << 1)   /* the label is null */
Toshihiro Shimizu 890ddd
#define TOONZ_PARAM_ERROR_TYPE (1 << 2)	/* type code does not match to structure */
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#define TOONZ_PARAM_ERROR_PAGE_NUM (1 << 3)
Toshihiro Shimizu 890ddd
#define TOONZ_PARAM_ERROR_GROUP_NUM (1 << 4)
Toshihiro Shimizu 890ddd
#define TOONZ_PARAM_ERROR_TRAITS (1 << 5) /* traits is unknown*/
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#define TOONZ_PARAM_ERROR_NO_KEY (1 << 8)	/* the key is null */
Toshihiro Shimizu 890ddd
#define TOONZ_PARAM_ERROR_KEY_DUP (1 << 9)   /* the key must be unique in the plugin */
Toshihiro Shimizu 890ddd
#define TOONZ_PARAM_ERROR_KEY_NAME (1 << 10) /* the key must be formed as '[:alpha:_][:alpha::number:_]* */
Toshihiro Shimizu 890ddd
#define TOONZ_PARAM_ERROR_POLLUTED (1 << 11) /* reserved field must be zero. for future release */
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#define TOONZ_PARAM_ERROR_MIN_MAX (1 << 12)
Toshihiro Shimizu 890ddd
#define TOONZ_PARAM_ERROR_ARRAY_NUM (1 << 13)
Toshihiro Shimizu 890ddd
#define TOONZ_PARAM_ERROR_ARRAY (1 << 14)
Toshihiro Shimizu 890ddd
#define TOONZ_PARAM_ERROR_UNKNOWN (1 << 31) /* */
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
enum toonz_param_type_enum {
Toshihiro Shimizu 890ddd
	TOONZ_PARAM_TYPE_DOUBLE,
Toshihiro Shimizu 890ddd
	TOONZ_PARAM_TYPE_RANGE,
Toshihiro Shimizu 890ddd
	TOONZ_PARAM_TYPE_PIXEL,
Toshihiro Shimizu 890ddd
	TOONZ_PARAM_TYPE_POINT,
Toshihiro Shimizu 890ddd
	TOONZ_PARAM_TYPE_ENUM,
Toshihiro Shimizu 890ddd
	TOONZ_PARAM_TYPE_INT,
Toshihiro Shimizu 890ddd
	TOONZ_PARAM_TYPE_BOOL,
Toshihiro Shimizu 890ddd
	TOONZ_PARAM_TYPE_SPECTRUM,
Toshihiro Shimizu 890ddd
	TOONZ_PARAM_TYPE_STRING,
Toshihiro Shimizu 890ddd
	TOONZ_PARAM_TYPE_TONECURVE,
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TOONZ_PARAM_TYPE_NB,
Toshihiro Shimizu 890ddd
	TOONZ_PARAM_TYPE_MAX = 0x7FFFFFFF
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif