Inherits DD::Image::Description.
Public Member Functions | |
Op * | constructor (Node *node) const |
< Nuke calls this to create an instance. | |
Description (const char *n, OpConstructor c, License *l=0) | |
Description (const char *n, OpConstructor c, NodeBuilder nodeBuilder) | |
Description (const char *n, const char *, OpConstructor c) | |
Description (const char *n, const char *, IopConstructor c) | |
Static Public Member Functions | |
static const Description * | find (int i) |
Public Attributes | |
const char * | name |
Nuke command. | |
Protected Types | |
typedef Op *(* | OpConstructor )(Node *) |
typedef Iop *(* | IopConstructor )(Node *) |
Static Protected Member Functions | |
static void | add (DD::Image::Description *) |
Protected Attributes | |
OpConstructor | constructor_ |
Static Protected Attributes | |
static const Description * | current_ |
A subclass of Op that wants to appear on Nuke's menu or be created by a Nuke script command must create one or more static instances of this structure. The constructor adds itself to a list which Nuke scans to find all the possible operators.
The code that goes into a plugin to create the entry looks like this:
static const char* const MYCLASS = "MyOp"; class MyOp : public Op { static const Description description; public: const char* Class() const {return MYCLASS;} ... }; static Op* build(Node* node) {return new MyOp(node);} const Op::Description MyOp::description(MYCLASS, build);
It is required that the string inside the description and returned by Op::Class() be the exact same pointer. This is checked by Nuke. It is also required that this string is the same as base name of the plugin file, or the name of a .tcl file that says "load foo" where foo is the name of this plugin file. Nuke only stores the name in the saved script, so this is necessary for it to find the plugin again.
DD::Image::Op::Description::Description | ( | const char * | n, |
OpConstructor | c, | ||
License * | l = 0 |
||
) | [inline] |
The constructor adds this Op to the internal table of available script commands.
If the License is not null then it is tested and if the test fails the description is not added to the table, making it impossible to call the constructor. You should check the license pointer when your constructor is called to make sure some cracker has not changed it or cleared it.
DD::Image::Op::Description::Description | ( | const char * | n, |
const char * | , | ||
OpConstructor | c | ||
) | [inline] |
For back compatibility with Nuke4.0 plugins, this takes an extra "menu" argument which is ignored (menu entries are all set by tcl commands now).
DD::Image::Op::Description::Description | ( | const char * | n, |
const char * | , | ||
IopConstructor | c | ||
) | [inline] |
For back compatibility with Nuke4.0 plugins, this takes an extra "menu" argument which is ignored (menu entries are all set by tcl commands now).
void Op::Description::add | ( | DD::Image::Description * | p | ) | [static, protected] |
Internals of the constructor, adds the description to the internal array and calls add_callback.
const Op::Description * Op::Description::find | ( | int | i | ) | [static] |
Return the i'th Op::Description known about, or return a null pointer for the last one. This does not load any plugins, it only returns the ones that have been loaded so far.