tahoma2d/toonz/sources/toonzqt/toonz_plugin.h

172 lines
6.4 KiB
C
Raw Normal View History

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