#include <c4d_operatordata.h>
A class for registering new Graph View operators. These show up as nodes in XPresso.
Use GvRegisterOperatorPlugin() to register a Graph View operator.
Information on how to handle data in a GvOperatorData plugin can be found in the articles Graph View Calculation (XPresso) Manual and Graph View Data Format (XPresso) Manual.
|
virtual Bool | Init (GeListNode *node, Bool isCloneInit) |
|
virtual Bool | GetDDescription (const GeListNode *node, Description *description, DESCFLAGS_DESC &flags) const |
|
virtual Bool | GetDParameter (const GeListNode *node, const DescID &id, GeData &t_data, DESCFLAGS_GET &flags) const |
|
virtual Bool | GetDEnabling (const GeListNode *node, const DescID &id, const GeData &t_data, DESCFLAGS_ENABLE flags, const BaseContainer *itemdesc) const |
|
virtual Bool | SetDParameter (GeListNode *node, const DescID &id, const GeData &t_data, DESCFLAGS_SET &flags) |
|
|
virtual void | EditorDraw (GvNode *bn, GvNodeGUI *gui, GeUserArea *da, Int32 x1, Int32 y1, Int32 x2, Int32 y2) |
|
virtual Bool | SceneDraw (GvNode *bn, BaseDraw *bd, BaseDrawHelp *bh, BaseThread *bt, SCENEHOOKDRAW flags, void *data, UInt32 counter) |
|
virtual Bool | BodyMessage (GvNode *bn, GvNodeGUI *gui, Int32 x, Int32 y, Int32 chn, Int32 qua, const BaseContainer &msg) |
|
virtual Bool | EditSettings (GvNode *bn, GvNodeGUI *gui) |
|
|
virtual Bool | QueryCalculation (GvNode *bn, GvQuery *query) |
|
virtual Bool | InitCalculation (GvNode *bn, GvCalc *calc, GvRun *run) |
|
virtual void | FreeCalculation (GvNode *bn, GvCalc *calc) |
|
virtual Bool | Calculate (GvNode *bn, GvPort *port, GvRun *run, GvCalc *calc) |
|
virtual Bool | AddToCalculationTable (GvNode *bn, GvRun *run) |
|
virtual Bool | SetRecalculate (GvNode *bn, GvPort *port, GvRun *run, Bool force_set=false) |
|
|
virtual Int32 | FillPortMenu (GvNode *bn, BaseContainer &menu, Int32 port_id, Int32 first_menu_id) |
|
virtual Bool | PortMenuCommand (GvNode *bn, Int32 menu_id, Int32 port_id, Int32 mx, Int32 my) |
|
virtual Int32 | FillOperatorMenu (GvNode *bn, BaseContainer &menu, Int32 first_menu_id) |
|
virtual Bool | OperatorMenuCommand (GvNode *bn, Int32 menu_id, Int32 mx, Int32 my) |
|
virtual Int32 | FillPortsMenu (GvNode *bn, BaseContainer &names, BaseContainer &ids, GvValueID value_type, GvPortIO port, Int32 first_menu_id) |
|
|
| NodeData () |
|
GeListNode * | Get () |
|
const GeListNode * | Get () const |
|
virtual Bool | Message (GeListNode *node, Int32 type, void *data) |
|
virtual void | GetBubbleHelp (GeListNode *node, maxon::String &str) |
|
virtual const BaseDocument * | GetDocument (const GeListNode *node) const |
|
virtual maxon::Result< Bool > | GetBranchInfo (const GeListNode *node, const maxon::ValueReceiver< const BranchInfo & > &info, GETBRANCHINFO flags) const |
|
virtual Bool | IsInstanceOf (const GeListNode *node, Int32 type) const |
|
virtual Bool | IsDocumentRelated (const GeListNode *node, Bool &docrelated) const |
|
virtual maxon::Result< Bool > | GetAccessedObjects (const BaseList2D *node, METHOD_ID method, AccessedObjectsCallback &access) const |
|
virtual maxon::Result< maxon::GenericData > | GroupChanges (BaseList2D *node) |
|
virtual void | Free (GeListNode *node) |
|
virtual Bool | Read (GeListNode *node, HyperFile *hf, Int32 level) |
|
virtual Bool | Write (const GeListNode *node, HyperFile *hf) const |
|
virtual Bool | CopyTo (NodeData *dest, const GeListNode *snode, GeListNode *dnode, COPYFLAGS flags, AliasTrans *trn) const |
|
virtual Bool | TranslateDescID (GeListNode *node, const DescID &id, DescID &res_id, C4DAtom *&res_at) |
|
virtual | ~BaseData () |
|
void | Destructor () |
|
GeListNode * | private_link |
|
◆ Init()
Called when a new instance of the node type is being allocated.
The parameters of a node must be initialized in this method. NodeData::Init is being called frequently due to nodes being reallocated in the background by Cinema 4D. One should therefore be careful with carrying out computationally complex tasks in this function.
{
BaseKey*
op = (BaseKey*)
node;
data.
SetFloat(BLINKERKEY_STRENGTH, 1.0);
data.
SetBool(BLINKERKEY_SOFT,
false);
return true;
}
Definition: c4d_basecontainer.h:48
void SetFloat(Int32 id, Float r)
Definition: c4d_basecontainer.h:615
void SetBool(Int32 id, Bool b)
Definition: c4d_basecontainer.h:580
Represents a C4DAtom that resides in a 4D list.
Definition: c4d_baselist.h:1975
maxon::Bool Bool
Definition: ge_sys_math.h:51
PyObject * op
Definition: object.h:520
- Note
- If the node data class has a constructor it is called as usual before, but at that time there is no GeListNode link established.
- Parameters
-
[in] | node | The GeListNode connected with the NodeData instance. Equal to Get(). Provided for speed and convenience. Cinema 4D owns the pointed node. |
- Returns
- true if the node was initialized, otherwise false.
Reimplemented from NodeData.
◆ GetDDescription()
Called to add parameters to the description for the node.
Modify the passed description as needed, set the appropriate flags. Make sure to include a call to the parent at the end.
- Note
- {The
SUPER
syntax is only available when the INSTANCEOF macro has been invoked for the NodeData which contains the NodeData::GetDDescription implementation.} return SUPER::GetDDescription(data, description,
flags, parentdescription);
PyCompilerFlags * flags
Definition: ast.h:14
-
If only a description resource is used it is not needed to overload GetDDescription.
- Parameters
-
[in] | node | The GeListNode connected with the NodeData instance. Equal to Get(). Provided for speed and convenience. Cinema 4D owns the pointed node. |
[in,out] | description | The node's description to add the parameters to. Cinema 4D owns the pointed description. |
[in,out] | flags | The flags for the description operation: DESCFLAGS_DESC |
- Returns
- true if successful, otherwise false. It is recommended to include a call to the parent function as last return.
Reimplemented from NodeData.
◆ GetDParameter()
Called to override the reading of description parameters.
Necessary for parameters that are not simply stored in the node's container, e.g. the global position of an object.
Modify the passed t_data if the right id is provided, and set the appropriate flags. Make sure to include a call to the parent at the end.
- Note
- {The
SUPER
syntax is only available when the INSTANCEOF macro has been invoked for the NodeData which contains the NodeData::GetDParameter implementation.} return SUPER::GetDParameter(data,
id, t_data,
flags);
-
If only a description resource is used it is not needed to overload GetDParameter.
- Parameters
-
[in] | node | The GeListNode connected with the NodeData instance. Equal to Get(). Provided for speed and convenience. Cinema 4D owns the pointed node. |
[in] | id | The ID of the parameter. |
[out] | t_data | The parameter data to return. Cinema 4D owns the pointed data. |
[in,out] | flags | The flags for the description operation: DESCFLAGS_GET |
- Returns
- true if successful, otherwise false. It is recommended to include a call to the parent function as last return.
Reimplemented from NodeData.
◆ GetDEnabling()
Called to decide which description parameters should be enabled or disabled.
Can be used both for parameters that are stored in the node's description and for dynamic parameters.
Read the passed t_data if the right id was provided, and return true to enable the parameter or false to disable it. Make sure to include a call to the parent at the end.
- Note
- {The
SUPER
syntax is only available when the INSTANCEOF macro has been invoked for the NodeData which contains the NodeData::GetDEnabling implementation.} return SUPER::GetDEnabling(data,
id, t_data,
flags, itemdesc);
- Parameters
-
[in] | node | The GeListNode connected with the NodeData instance. Equal to Get(). Provided for speed and convenience. Cinema 4D owns the pointed node. |
[in] | id | The ID of the parameter. |
[in] | t_data | The parameter data. Cinema 4D owns the pointed data. |
[in] | flags | Not used. |
[in] | itemdesc | The parameter's description, encoded to a container as described in Description. |
- Returns
- true if the parameter should be enabled, otherwise false. It is recommended to include a call to the parent function as last return.
Reimplemented from NodeData.
◆ SetDParameter()
Called to override the writing of parameters.
Read the passed t_data if the right id was provided, store the data, and set the appropriate flags. Make sure to include a call to the parent at the end.
- Note
- {The
SUPER
syntax is only available when the INSTANCEOF macro has been invoked for the NodeData which contains the NodeData::SetDParameter implementation.}
{
}
{
return SUPER::SetDParameter(
node,
id, t_data,
flags);
}
#define INSTANCEOF(X, Y)
Definition: c4d_baselist.h:38
Definition: lib_description.h:355
Definition: c4d_gedata.h:83
Definition: c4d_objectdata.h:166
DESCFLAGS_SET
Definition: ge_prepass.h:3364
-
If only a description resource is used it is not needed to overload SetDParameter.
- Parameters
-
[in] | node | The GeListNode connected with the NodeData instance. Equal to Get(). Provided for speed and convenience. Cinema 4D owns the pointed node. |
[in] | id | The ID of the parameter. |
[in] | t_data | The parameter data to set. Cinema 4D owns the pointed data. |
[in,out] | flags | The flags for the description operation: DESCFLAGS_SET |
- Returns
- true if successful, otherwise false. It is recommended to include a call to the parent function as last return.
Reimplemented from NodeData.
◆ iGetPortList()
Internal wrapper for GvNode::GetPortList(). Normally it is not need to override this function.
- Parameters
-
[in] | bn | Equal to static_cast<GvNode*>->Get(). Provided for speed and convenience. Cinema 4D owns the pointed node. |
[in] | port | Only retrieve ports with the IO mode: GvPortIO |
[out] | portlist | Filled with the ports for this node. The caller owns the pointed GvPortList. |
◆ iGetPortDescription()
Internal wrapper for GvNode::GetPortDescription(). Normally it is not need to override this function.
- Parameters
-
[in] | bn | Equal to static_cast<GvNode*>->Get(). Provided for speed and convenience. Cinema 4D owns the pointed node. |
[in] | port | Only retrieve port description with the IO mode: GvPortIO |
[in] | id | The port ID. |
[in] | pd | Filled with the port description. The caller owns the pointed GvPortDescription. |
- Returns
- true if successful, otherwise false.
◆ iCreateOperator()
Internal wrapper for GvNode::CreateOperator().
Initialize here default parameters for the operator:
{
if (!bc)
return false;
return SUPER::iCreateOperator(bn);
}
Definition: c4d_graphview.h:429
BaseContainer * GetOpContainerInstance()
Definition: c4d_graphview.h:780
virtual Bool iCreateOperator(GvNode *bn)
- Parameters
-
[in] | bn | Equal to static_cast<GvNode*>->Get(). Provided for speed and convenience. Cinema 4D owns the pointed node. |
- Returns
- true if successful, otherwise false.
◆ CreatePortDescriptionCache()
virtual Bool CreatePortDescriptionCache |
( |
GvNode * |
bn, |
|
|
Bool |
lock_only = false |
|
) |
| |
|
virtual |
Called before a node master's Calculate() is executed to give the node the chance to cache internal data.
- Parameters
-
[in] | bn | Equal to static_cast<GvNode*>->Get(). Provided for speed and convenience. Cinema 4D owns the pointed node. |
[in] | lock_only | true to lock only. |
- Returns
- true if successful, otherwise false.
◆ FreePortDescriptionCache()
virtual void FreePortDescriptionCache |
( |
GvNode * |
bn | ) |
|
|
virtual |
Called after a node master's Calculate() is executed to free the cached internal data.
- Parameters
-
[in] | bn | Equal to static_cast<GvNode*>->Get(). Provided for speed and convenience. Cinema 4D owns the pointed node. |
◆ GetDetailedText()
◆ GetText()
Called to retrieve the text for the operator.
- Parameters
-
[in] | bn | Equal to static_cast<GvNode*>->Get(). Provided for speed and convenience. Cinema 4D owns the pointed node. |
- Returns
- The operator text.
◆ GetTitle()
◆ GetPortIcon()
Called to provide an icon for a port.
- Note
- Currently this is not used anywhere.
- Parameters
-
[in] | bn | Equal to static_cast<GvNode*>->Get(). Provided for speed and convenience. Cinema 4D owns the pointed node. |
[in] | id | The port ID. |
[in] | layout_type | The layout type: GvLayoutType |
- Returns
- The port icon. The operator owns the pointed BaseBitmap.
◆ GetBodySize()
virtual void GetBodySize |
( |
const GvNode * |
bn, |
|
|
Int32 * |
width, |
|
|
Int32 * |
height |
|
) |
| const |
|
virtual |
Called to give a default body size for the operator.
- Parameters
-
[in] | bn | Equal to static_cast<GvNode*>->Get(). Provided for speed and convenience. Cinema 4D owns the pointed node. |
[out] | width | Assign the default width in pixels. |
[out] | height | Assign the default height in pixels. |
◆ GetBodyColor()
Called to give a default body color for the operator.
- Parameters
-
[in] | bn | Equal to static_cast<GvNode*>->Get(). Provided for speed and convenience. Cinema 4D owns the pointed node. |
- Returns
- The default body color.
◆ GetOperatorDescription()
Called to set operator flags in od.
- Note
- This is for future extensions. Currently all flags that affect the node are static and set with GvRegisterOperatorPlugin().
- Parameters
-
[in] | bn | Equal to static_cast<GvNode*>->Get(). Provided for speed and convenience. Cinema 4D owns the pointed node. |
[out] | od | The operator description. The caller owns the pointed GvOperatorDescription. |
- Returns
- true if successful, otherwise false.
◆ EditorDraw()
Called to draw inside the operator body.
Use the da pointer to draw in the rectangle defined by (x1, y1) and (x2, y2).
A clipping rectangle is set, so it does not matter if draw occurs outside this bound.
- Parameters
-
[in] | bn | Equal to static_cast<GvNode*>->Get(). Provided for speed and convenience. Cinema 4D owns the pointed node. |
[in] | gui | The current GUI. The caller owns the pointed GvNodeGUI. |
[in] | da | The user area to draw in. The caller owns the pointed GeUserArea. |
[in] | x1 | The upper left X coordinate. |
[in] | y1 | The upper left Y coordinate. |
[in] | x2 | The lower right X coordinate. |
[in] | y2 | The lower right Y coordinate. |
◆ SceneDraw()
Allows the node to draw into the editor window.
- Parameters
-
- Returns
- true if successful, otherwise false.
◆ BodyMessage()
Called if the user clicks in the body of the node.
- Parameters
-
[in] | bn | Equal to static_cast<GvNode*>->Get(). Provided for speed and convenience. Cinema 4D owns the pointed node. |
[in] | gui | The node GUI. The caller owns the pointed GvNodeGUI. |
[in] | x | The mouse X coordinate. |
[in] | y | The mouse Y coordinate. |
[in] | chn | The mouse channel: BFM_INPUT_CHANNEL |
[in] | qua | A bitmask with the qualifiers at the time when the mouse event occurred: QUALIFIERS |
[in] | msg | The original message. See Input Events. |
- Returns
- true if the message was handled, otherwise false.
◆ EditSettings()
Called to give the operator the chance to provide a custom settings dialog.
- Parameters
-
[in] | bn | Equal to static_cast<GvNode*>->Get(). Provided for speed and convenience. Cinema 4D owns the pointed node. |
[in] | gui | The node GUI. The caller owns the pointed GvNodeGUI. |
- Returns
- true if successful, otherwise false.
◆ QueryCalculation()
Called to check if it is OK to start a calculation. If false is returned tell the caller why by setting an error flag in query.
- Parameters
-
[in] | bn | Equal to static_cast<GvNode*>->Get(). Provided for speed and convenience. Cinema 4D owns the pointed node. |
[out] | query | The query parameter. The caller owns the pointed GvQuery. |
- Returns
- true if it is OK to start a calculation, otherwise false.
◆ InitCalculation()
Called before the calculation is started.
- Parameters
-
[in] | bn | Equal to static_cast<GvNode*>->Get(). Provided for speed and convenience. Cinema 4D owns the pointed node. |
[in] | calc | The current calculation helper. The caller owns the pointed GvCalc. |
[in] | run | The current run helper. The caller owns the pointed GvRun. |
- Returns
- true if calculation was initialized, otherwise false.
◆ FreeCalculation()
Called after the calculation is finished.
- Parameters
-
[in] | bn | Equal to static_cast<GvNode*>->Get(). Provided for speed and convenience. Cinema 4D owns the pointed node. |
[in] | calc | The current calculation helper. The caller owns the pointed GvCalc. |
◆ Calculate()
Called either from the node master, when the node has called GvRun::AddNodeToCalculationTable(), or from another node that calls GvValue::Calculate() for a port that is connected to the node.
- Parameters
-
[in] | bn | Equal to static_cast<GvNode*>->Get(). Provided for speed and convenience. Cinema 4D owns the pointed node. |
[in] | port | If the call comes directly from the node master this is nullptr. Otherwise it is the outport that another node wants to be calculated. The caller owns the pointed GvPort. |
[in] | run | The current run helper. The caller owns the pointed GvRun. |
[in] | calc | The current calculation helper. The caller owns the pointed GvCalc. |
- Returns
- true if calculation was successful, otherwise false.
◆ AddToCalculationTable()
Called by the node master before the calculation starts.
To set if a node can be evaluated regardless of whether another node requests data from its output ports or not, call GvRun::AddNodeToCalculationTable() here.
- Parameters
-
[in] | bn | Equal to static_cast<GvNode*>->Get(). Provided for speed and convenience. Cinema 4D owns the pointed node. |
[in] | run | The current run helper. The caller owns the pointed GvRun. |
- Returns
- true if successful, otherwise false.
◆ SetRecalculate()
Called by the node master when someone has called SetRecalculate().
As a rule of thumb, if GvRun::AddNodeToCalculationTable() is called in AddToCalculationTable() this should be done here as well. Otherwise this method should not be implemented.
- Parameters
-
[in] | bn | Equal to static_cast<GvNode*>->Get(). Provided for speed and convenience. Cinema 4D owns the pointed node. |
[in] | port | The port that was invalidated. |
[in] | run | The current run helper. The caller owns the pointed GvRun. |
[in] | force_set | If true the recalculation is forced even if the data is already updated. |
- Returns
- true if successful, otherwise false.
◆ SetData()
Called for example when the user drops something on the node.
- Note
- Overload IsSetDataAllowed() to specify what kinds of data is accepted.
- Parameters
-
[in] | bn | Equal to static_cast<GvNode*>->Get(). Provided for speed and convenience. Cinema 4D owns the pointed node. |
[in] | type | The data type: GvDataType |
[in] | data | The data pointer. The format depends on type. |
[in] | mode | The mode: GvOpSetDataMode |
- Returns
- true if successful, otherwise false.
◆ IsSetDataAllowed()
Called to check if the specified data would be acceptable for a SetData() action. This is used to for example determine the cursor during drag-and-drop.
- Parameters
-
[in] | bn | Equal to static_cast<GvNode*>->Get(). Provided for speed and convenience. Cinema 4D owns the pointed node. |
[in] | type | The data type: GvDataType |
[in] | data | The data pointer. The format depends on type. |
[in] | mode | The mode: GvOpSetDataMode |
- Returns
- true if data is acceptable, otherwise false.
◆ FillPortMenu()
Called when the user has opened the port menu, for example by right-clicking on a port.
Add menu items to the menu container, as described in ShowPopupMenu(), and then return the number of entries added. Do not use menu IDs below first_menu_id.
If the user chooses one of the commands, PortMenuCommand() is called.
- Parameters
-
[in] | bn | Equal to static_cast<GvNode*>->Get(). Provided for speed and convenience. Cinema 4D owns the pointed node. |
[out] | menu | The menu container to add entries to. |
[in] | port_id | The port ID. |
[in] | first_menu_id | The first menu item ID. |
- Returns
- The number of menu entries added.
◆ PortMenuCommand()
Called when the user chooses one of the commands in the port menu set in FillPortMenu().
- Parameters
-
[in] | bn | Equal to static_cast<GvNode*>->Get(). Provided for speed and convenience. Cinema 4D owns the pointed node. |
[in] | menu_id | The menu item ID. |
[in] | port_id | The port ID. |
[in] | mx | The mouse X coordinate. |
[in] | my | The mouse Y coordinate. |
- Returns
- true if the command was handled, otherwise false.
◆ FillOperatorMenu()
Called when the user has opened the operator menu, for example by right-clicking on the operator.
Add menu items to the menu container, as described in ShowPopupMenu(), and then return the number of entries added. Do not use menu IDs below first_menu_id.
If the user chooses one of the commands, OperatorMenuCommand() is called.
- Parameters
-
[in] | bn | Equal to static_cast<GvNode*>->Get(). Provided for speed and convenience. Cinema 4D owns the pointed node. |
[out] | menu | The menu container to add entries to. |
[in] | first_menu_id | The first menu item ID. |
- Returns
- The number of menu entries added.
◆ OperatorMenuCommand()
Called when the user chooses one of the commands in the operator menu set in FillOperatorMenu().
- Parameters
-
[in] | bn | Equal to static_cast<GvNode*>->Get(). Provided for speed and convenience. Cinema 4D owns the pointed node. |
[in] | menu_id | The menu item ID. |
[in] | mx | The mouse X coordinate. |
[in] | my | The mouse Y coordinate. |
- Returns
- true if the command was handled, otherwise false.
◆ FillPortsMenu()
Called when the user has opened the ports menu, for example by clicking on the corner of the node or dragging a connection from another port.
Add a name entry to names and an ID entry to ids for each possible port to create for this action and return the number of added entries.
The ids container is a translation between menu IDs and the port IDs of the data types:
names.SetString(first_menu_id +
i,
"Port name");
ids.SetInt32(first_menu_id +
i, PORT_ID);
Py_ssize_t i
Definition: abstract.h:645
PyObject PyObject * names
Definition: code.h:159
- See also
- ShowPopupMenu() for the name formatting.
- Parameters
-
[in] | bn | Equal to static_cast<GvNode*>->Get(). Provided for speed and convenience. Cinema 4D owns the pointed node. |
[out] | names | The container with the menu entries. |
[out] | ids | The container for the translation between menu ID and port ID. |
[in] | value_type | The value type for drag-and-drop, or ID_GV_VALUE_TYPE_NONE if this is not a drag-and-drop action. |
[in] | port | The IO mode: GvPortIO |
[in] | first_menu_id | The first menu item ID. |
- Returns
- The number of menu entries added.
◆ GetErrorString()
Called to let translate error messages that have been set when the calculation failed.
- Note
- Currently this function is not called.
- Parameters
-
[in] | bn | Equal to static_cast<GvNode*>->Get(). Provided for speed and convenience. Cinema 4D owns the pointed node. |
[in] | error | The error ID. |
- Returns
- The error message.
◆ GetMainID()
Return the port main ID of the given desc_id.
- Note
- Normally it is not need to implement this method. It is currently only used by the object node.
- Parameters
-
[in] | bn | Equal to static_cast<GvNode*>->Get(). Provided for speed and convenience. Cinema 4D owns the pointed node. |
[in] | io | The IO mode: GvPortIO |
[in] | desc_id | The description ID. |
- Returns
- The main ID.
◆ GetDescID()
Return the description ID of the given port main_id.
- Note
- Normally it is not need to implement this method. It is currently only used by the object node.
- Parameters
-
[in] | bn | Equal to static_cast<GvNode*>->Get(). Provided for speed and convenience. Cinema 4D owns the pointed node. |
[in] | io | The IO mode: GvPortIO |
[in] | main_id | The main ID. |
- Returns
- The description ID.