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
e280ae
#ifdef _WIN32
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_ {
Shinya Kitaoka 120a6e
  uint32_t uid0;
Shinya Kitaoka 120a6e
  uint16_t uid1;
Shinya Kitaoka 120a6e
  uint16_t uid2;
Shinya Kitaoka 120a6e
  uint16_t uid3;
Shinya Kitaoka 120a6e
  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_ {
Shinya Kitaoka 120a6e
  int32_t major;
Shinya Kitaoka 120a6e
  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_ {
Shinya Kitaoka 120a6e
  int32_t major;
Shinya Kitaoka 120a6e
  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_ {
Shinya Kitaoka 120a6e
  toonz_if_version_t ver;            /* version of the structure */
Shinya Kitaoka 120a6e
  toonz_plugin_version_t plugin_ver; /* version of the plugin */
Shinya Kitaoka 120a6e
  const char *name;
Shinya Kitaoka 120a6e
  const char *vendor;
Shinya Kitaoka 120a6e
  const char *id;
Shinya Kitaoka 120a6e
  const char *note;
Shinya Kitaoka 120a6e
  const char *helpurl;
Shinya Kitaoka 120a6e
  void *reserved_ptr_[3];
Shinya Kitaoka 120a6e
  uint32_t clss;
Shinya Kitaoka 120a6e
  uint32_t reserved_int_[7];
Shinya Kitaoka 120a6e
  toonz_nodal_rasterfx_handler_t_ *handler;
Shinya Kitaoka 120a6e
  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_ {
Shinya Kitaoka 120a6e
  toonz_if_version_t ver; /* a version of toonz_plugin_probe_t */
Shinya Kitaoka 120a6e
  struct toonz_plugin_probe_t_ *begin;
Shinya Kitaoka 120a6e
  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)
Shinya Kitaoka 120a6e
namespace toonz {
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
Shinya Kitaoka 120a6e
#define TOONZ_IF_VER(major, minor)                                             \
Shinya Kitaoka 120a6e
  { (major), (minor) } /* interface or type version */
Shinya Kitaoka 120a6e
#define TOONZ_PLUGIN_VER(major, minor)                                         \
Shinya Kitaoka 120a6e
  { (major), (minor) } /* plugin version */
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
#define TOONZ_PLUGIN_PROBE_BEGIN(ver)                                          \
Shinya Kitaoka 120a6e
  static const toonz_if_version_t toonz_plugin_probe_ver_ = ver;               \
Shinya Kitaoka 120a6e
  struct toonz_plugin_probe_t_ toonz_plugin_info_begin_[] = {
Shinya Kitaoka 120a6e
#define TOONZ_PLUGIN_PROBE_DEFINE(plugin_ver, nm, vendor, ident, note,         \
Shinya Kitaoka 120a6e
                                  helpurl, cls, handler)                       \
Shinya Kitaoka 120a6e
  {                                                                            \
Shinya Kitaoka 120a6e
    toonz_plugin_probe_ver_, plugin_ver, (nm), (vendor), (ident), (note),      \
Shinya Kitaoka 120a6e
        (helpurl), {0}, /* reserved null ptrs */                               \
Shinya Kitaoka 120a6e
        ((cls)), {0},   /* reserved 32bit-integers */                          \
Shinya Kitaoka 120a6e
        (handler), {                                                           \
Shinya Kitaoka 120a6e
      0                                                                        \
Shinya Kitaoka 120a6e
    } /* reserved null ptrs */                                                 \
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
#define TOONZ_PLUGIN_PROBE_END                                                 \
Shinya Kitaoka 120a6e
  , { 0 } /* delim */                                                          \
Shinya Kitaoka 120a6e
  }                                                                            \
Shinya Kitaoka 120a6e
  ;                                                                            \
Shinya Kitaoka 120a6e
  TOONZ_EXPORT struct toonz_plugin_probe_list_t_ toonz_plugin_info_list = {    \
Shinya Kitaoka 120a6e
      toonz_plugin_probe_ver_, toonz_plugin_info_begin_,                       \
Shinya Kitaoka 120a6e
      &toonz_plugin_info_begin_[sizeof(toonz_plugin_info_begin_) /             \
Shinya Kitaoka 120a6e
                                    sizeof(struct toonz_plugin_probe_t_) -     \
Shinya Kitaoka 120a6e
                                1]};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*! エラーコード */
Shinya Kitaoka 120a6e
#define TOONZ_OK (0)             /*!< 成功 */
Shinya Kitaoka 120a6e
#define TOONZ_ERROR_UNKNOWN (-1) /*!< 下記以外の不明なエラー */
Shinya Kitaoka 120a6e
#define TOONZ_ERROR_NOT_IMPLEMENTED (-2) /*!< 未実装 */
Shinya Kitaoka 120a6e
#define TOONZ_ERROR_VERSION_UNMATCH (-3) /*!< バージョン不整合 */
Shinya Kitaoka 120a6e
#define TOONZ_ERROR_INVALID_HANDLE                                             \
Shinya Kitaoka 120a6e
  (-4) /*!< 型が異なるなどの無効なハンドルが渡された */
Shinya Kitaoka 120a6e
#define TOONZ_ERROR_NULL (-5) /*!< NULLが許容されていない引数がNULL */
Shinya Kitaoka 120a6e
#define TOONZ_ERROR_POLLUTED                                                   \
Shinya Kitaoka 120a6e
  (-6) /*!< 0でなければならない予約フィールドが0ではない */
Shinya Kitaoka 120a6e
#define TOONZ_ERROR_OUT_OF_MEMORY (-7) /*!< メモリ不足 */
Shinya Kitaoka 120a6e
#define TOONZ_ERROR_INVALID_SIZE                                               \
Shinya Kitaoka 120a6e
  (-8) /*!< 引数で指定されたサイズが間違っている */
Shinya Kitaoka 120a6e
#define TOONZ_ERROR_INVALID_VALUE (-9) /*!< 定義されてない値 */
Shinya Kitaoka 120a6e
#define TOONZ_ERROR_BUSY (-10) /*!< 要求されたリソースが既に使用されている */
Shinya Kitaoka 120a6e
#define TOONZ_ERROR_NOT_FOUND (-11) /*!< 指定されたものが見つからなかった */
Toshihiro Shimizu 890ddd
#define TOONZ_ERROR_FAILED_TO_CREATE (-12) /*!< オブジェクト等の作成に失敗 */
Shinya Kitaoka 120a6e
#define TOONZ_ERROR_PREREQUISITE                                               \
Shinya Kitaoka 120a6e
  (-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 */
Shinya Kitaoka 120a6e
#define TOONZ_PARAM_ERROR_TYPE                                                 \
Shinya Kitaoka 120a6e
  (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
Shinya Kitaoka 120a6e
#define TOONZ_PARAM_ERROR_NO_KEY (1 << 8) /* the key is null */
Shinya Kitaoka 120a6e
#define TOONZ_PARAM_ERROR_KEY_DUP                                              \
Shinya Kitaoka 120a6e
  (1 << 9) /* the key must be unique in the plugin */
Shinya Kitaoka 120a6e
#define TOONZ_PARAM_ERROR_KEY_NAME                                             \
Shinya Kitaoka 120a6e
  (1 << 10) /* the key must be formed as '[:alpha:_][:alpha::number:_]* */
Shinya Kitaoka 120a6e
#define TOONZ_PARAM_ERROR_POLLUTED                                             \
Shinya Kitaoka 120a6e
  (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 {
Shinya Kitaoka 120a6e
  TOONZ_PARAM_TYPE_DOUBLE,
Shinya Kitaoka 120a6e
  TOONZ_PARAM_TYPE_RANGE,
Shinya Kitaoka 120a6e
  TOONZ_PARAM_TYPE_PIXEL,
Shinya Kitaoka 120a6e
  TOONZ_PARAM_TYPE_POINT,
Shinya Kitaoka 120a6e
  TOONZ_PARAM_TYPE_ENUM,
Shinya Kitaoka 120a6e
  TOONZ_PARAM_TYPE_INT,
Shinya Kitaoka 120a6e
  TOONZ_PARAM_TYPE_BOOL,
Shinya Kitaoka 120a6e
  TOONZ_PARAM_TYPE_SPECTRUM,
Shinya Kitaoka 120a6e
  TOONZ_PARAM_TYPE_STRING,
Shinya Kitaoka 120a6e
  TOONZ_PARAM_TYPE_TONECURVE,
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  TOONZ_PARAM_TYPE_NB,
Shinya Kitaoka 120a6e
  TOONZ_PARAM_TYPE_MAX = 0x7FFFFFFF
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif