GvWorld Class Reference

#include <c4d_graphview.h>

Detailed Description

The GV world class. Cannot be instantiated. To retrieve the global instance call GvGetWorld().

Private Member Functions

 GvWorld ()
 
 ~GvWorld ()
 

Alloc/Free Node Master

GvNodeMasterAllocNodeMaster (BaseList2D *object, Bool add_to_list=true, Bool send_messages=true)
 
void FreeNodeMaster (GvNodeMaster *&master)
 

Alloc/Free Node GUI

GvNodeGUIAllocNodeGUI (GvShape *shape, GvShape *group, Int32 user_area_id)
 
void FreeNodeGUI (GvNodeGUI *&gui)
 

Alloc/Free Shape

GvShape * AllocShape ()
 
GvShape * AllocGroupShape ()
 
void FreeShape (GvShape *&shape)
 

Hook

Bool RegisterHook (const GvHook &hook, void *user)
 
Bool AttachHook (Int32 hook_id, GvHookCallback callback)
 
void DetachHook (Int32 hook_id)
 
BaseList2DGetHookInstance (BaseDocument *doc, Int32 hook_id)
 

Send Message

Bool SendHookMessage (BaseDocument *doc, GvNodeMaster *master, GvMessHook &data, Int32 owner_id)
 
Bool SendOperatorMessage (BaseDocument *doc, Int32 message_id, void *data)
 

Dialog

Bool OpenDialog (Int32 id, GvNodeMaster *master)
 
void CloseDialog (Int32 id)
 

Redraw

void RedrawAll ()
 
void RedrawMaster (GvNodeMaster *master)
 
Bool AttachNode (GvNodeMaster *master, GvNode *node, Int32 x, Int32 y)
 

Get String/Float/Integer

const String GetString (const maxon::String &title, const maxon::String &default_value)
 
Float GetFloat (const maxon::String &title, Float default_value)
 
Int32 GetInteger (const maxon::String &title, Int32 default_value)
 

Data Types Information

Int32 GetDataTypesMenu (BaseContainer &bc, BaseContainer &index, Int32 first_menu_id, Int32 first_sub_id, Bool show_undefined_type=false, GvValueFlags flags=GV_CALC_NOP)
 
Int32 GetDataTypes (BaseContainer &bc, GvDataOptions options=GV_DATA_OPTIONS_NONE, GvValueFlags flags=GV_CALC_NOP)
 
Bool GetDataTypesTable (GvDataInfo *&info, Int32 &count)
 
Int32 GetDataTypeIndex (GvDataID id)
 
GvDataInfoGetDataTypeInfo (GvDataID id)
 
Int32 GetDataTypeNames (BaseContainer &bc, GvDataID *ids)
 

Miscellaneous

BaseBitmapGetDefaultOperatorIcon (GvOperatorType type)
 
GvNodeMasterGetMaster (Int32 id)
 
GvNodeGUIGetMasterGUI (GvNodeMaster *master, UInt32 nr=0)
 
UInt32 GetUniqueID ()
 
void SetForceUpdate ()
 

Preferences

void SetPrefs (const BaseContainer &bc)
 
void GetPrefs (BaseContainer &bc)
 

Constructor & Destructor Documentation

◆ GvWorld()

GvWorld ( )
private

◆ ~GvWorld()

~GvWorld ( )
private

Member Function Documentation

◆ AllocNodeMaster()

GvNodeMaster* AllocNodeMaster ( BaseList2D object,
Bool  add_to_list = true,
Bool  send_messages = true 
)

Allocates a node master. Must be freed with FreeNodeMaster().

Note
This function is normally not needed. Use XPressoTag::Alloc() instead.
Parameters
[in]objectThe parent object for the node master. The caller owns the pointed object.
[in]add_to_listAdd this master to the global list of masters. To have a private master, set this to false.
[in]send_messagesIf true messages are sent to object for example when nodes are added.
Returns
The allocated node master. The caller owns the pointed node master.

◆ FreeNodeMaster()

void FreeNodeMaster ( GvNodeMaster *&  master)

Frees node masters allocated with AllocNodeMaster().

Parameters
[in,out]masterThe node master to destruct. If the pointer is nullptr nothing happens. The pointer is assigned nullptr afterwards.

◆ AllocNodeGUI()

GvNodeGUI* AllocNodeGUI ( GvShape *  shape,
GvShape *  group,
Int32  user_area_id 
)

Allocates a node GUI. Must be freed with FreeNodeGUI().

Note
This function is normally not needed.
Parameters
[in]shapeThe GV shape. The caller owns the pointed shape.
[in]groupThe group shape. The caller owns the pointed group shape.
[in]user_area_idThe user area ID.
Returns
The allocated node GUI. The caller owns the pointed node GUI.

◆ FreeNodeGUI()

void FreeNodeGUI ( GvNodeGUI *&  gui)

Frees node GUIs allocated with AllocNodeGUI().

Parameters
[in,out]guiThe node GUI to destruct. If the pointer is nullptr nothing happens. The pointer is assigned nullptr afterwards.

◆ AllocShape()

GvShape* AllocShape ( )

Allocates a shape. Must be freed with FreeShape().

Note
A shape defines the layout of the nodes and the click behavior. It is completely private, but maybe in future versions it will be possible to use different shapes.
Returns
The allocated shape. The caller owns the pointed shape.

◆ AllocGroupShape()

GvShape* AllocGroupShape ( )

Allocates a group shape. Must be freed with FreeShape().

Note
A shape defines the layout of the nodes and the click behavior. It is completely private, but maybe in future versions it will be possible to use different shapes.
Returns
The allocated group shape. The caller owns the pointed group shape.

◆ FreeShape()

void FreeShape ( GvShape *&  shape)

Frees shapes allocated with AllocShape() or AllocGroupShape().

Parameters
[in,out]shapeThe shape to destruct. If the pointer is nullptr nothing happens. The pointer is assigned nullptr afterwards.

◆ RegisterHook()

Bool RegisterHook ( const GvHook hook,
void *  user 
)

Registers a hook. See GvHook for more information.

Parameters
[in]hookThe hook to register.
[in]userThe user data pointer for the hook. Passed to the hook functions. The caller owns the pointed data.
Returns
true if successful, otherwise false.

◆ AttachHook()

Bool AttachHook ( Int32  hook_id,
GvHookCallback  callback 
)

Attaches a callback to a hook. The callback function is evaluated with GetHookInstance().

Parameters
[in]hook_idThe hook ID.
[in]callbackThe callback to register.
Returns
true if successful, otherwise false.

◆ DetachHook()

void DetachHook ( Int32  hook_id)

Detaches a callback attached with AttachHook(). This makes GetHookInstance() return nullptr for hook_id.

Parameters
[in]hook_idThe hook ID.

◆ GetHookInstance()

BaseList2D* GetHookInstance ( BaseDocument doc,
Int32  hook_id 
)

Returns (*callback)(doc, hook_id) for callbacks registered with AttachHook().

Parameters
[in]docThe document. The caller owns the pointed document.
[in]hook_idThe hook ID.
Returns
The callback return, or nullptr if no callback was attached.

◆ SendHookMessage()

Bool SendHookMessage ( BaseDocument doc,
GvNodeMaster master,
GvMessHook data,
Int32  owner_id 
)

Sends a message to all hooks with the given owner_id set in GvHook::owner_id.

Parameters
[in]docThe document. The caller owns the pointed document.
[in]masterThe node master. The caller owns the pointed node master.
[in]dataThe message data.
[in]owner_idThe owner ID.
Returns
true if successful, otherwise false.

◆ SendOperatorMessage()

Bool SendOperatorMessage ( BaseDocument doc,
Int32  message_id,
void *  data 
)

Sends a message to all nodes, i.e. calls NodeData::Message() for all GvOperatorData.

Parameters
[in]docThe document. The caller owns the pointed document.
[in]message_idThe message ID.
[in]dataThe message data. The caller owns the pointed data.
Returns
true if successful, otherwise false.

◆ OpenDialog()

Bool OpenDialog ( Int32  id,
GvNodeMaster master 
)

Opens the XPresso dialog for a specific node master.

Parameters
[in]idThe plugin ID. See GeDialog::Open().
[in]masterThe node master to open the dialog for. The caller owns the pointed node master.
Returns
true if the dialog was opened, otherwise false.

◆ CloseDialog()

void CloseDialog ( Int32  id)

Closes a dialog opened with OpenDialog().

Parameters
[in]idThe plugin ID that the dialog was opened with.

◆ RedrawAll()

void RedrawAll ( )

Redraws all opened dialogs.

Note
Currently there can only be one dialog, so this is for future extensions.

◆ RedrawMaster()

void RedrawMaster ( GvNodeMaster master)

Redraws a node master.

Parameters
[in]masterThe node master to redraw. The caller owns the pointed node master.

◆ AttachNode()

Bool AttachNode ( GvNodeMaster master,
GvNode node,
Int32  x,
Int32  y 
)

Attaches a node to a node master.

Parameters
[in]masterThe node master to attach the node to. The caller owns the pointed node master.
[in]nodeThe node to attach. The caller owns the pointed node.
[in]xThe X coordinate.
[in]yThe Y coordinate.
Returns
true if the node was attached, otherwise false.

◆ GetString()

const String GetString ( const maxon::String title,
const maxon::String default_value 
)

Opens a dialog where the user can enter a string value.

Parameters
[in]titleThe dialog title.
[in]default_valueThe default value.
Returns
The string entered by the user.

◆ GetFloat()

Float GetFloat ( const maxon::String title,
Float  default_value 
)

Opens a dialog where the user can enter a float value.

Parameters
[in]titleThe dialog title.
[in]default_valueThe default value.
Returns
The float entered by the user.

◆ GetInteger()

Int32 GetInteger ( const maxon::String title,
Int32  default_value 
)

Opens a dialog where the user can enter an integer value.

Parameters
[in]titleThe dialog title.
[in]default_valueThe default value.
Returns
The integer entered by the user.

◆ GetDataTypesMenu()

Int32 GetDataTypesMenu ( BaseContainer bc,
BaseContainer index,
Int32  first_menu_id,
Int32  first_sub_id,
Bool  show_undefined_type = false,
GvValueFlags  flags = GV_CALC_NOP 
)

Fills bc with a menu description of all data types, suitable for e.g. ShowPopupMenu().
The index container is a translation between the menu ID and the GvDataID of the data types.
Optionally the set of data types can be restricted to only those that allows a set of calculation flags.

Parameters
[in]bcFilled with the menu entries.
[in]indexFilled with a translation table between menu ID and GvDataID.
[in]first_menu_idThe first menu item ID. You can pass FIRST_POPUP_ID.
[in]first_sub_idThe first sub menu item ID. Use something slightly larger than first_menu_id, for example FIRST_POPUP_ID + 1000.
[in]show_undefined_typeIf true the data type "Undefined" is included where needed.
[in]flagsIf set, only data types that can handle these calculations are retrieved: GvValueFlags
Returns
The number of data types found.

◆ GetDataTypes()

Int32 GetDataTypes ( BaseContainer bc,
GvDataOptions  options = GV_DATA_OPTIONS_NONE,
GvValueFlags  flags = GV_CALC_NOP 
)

Fills bc with a description of all data types, as String values with the name of the data type and an ID with the corresponding GvDataID::
Optionally the set of data types can be restricted to only those that allows a set of calculation flags.

Parameters
[in]bcFilled with the data types.
[in]optionsThe data options: GvDataOptions
[in]flagsIf set, only data types that can handle these calculations are retrieved: GvValueFlags
Returns
The number of data types found.

◆ GetDataTypesTable()

Bool GetDataTypesTable ( GvDataInfo *&  info,
Int32 count 
)

Retrieves the complete data types table.

Parameters
[out]infoSet to point to an array of length count with the currently registered data types. The GV world owns the pointed array.
[out]countAssigned the number of elements in the retrieved info table.
Returns
true if the table was retrieved, otherwise false.

◆ GetDataTypeIndex()

Int32 GetDataTypeIndex ( GvDataID  id)

Gets the index of the given data type in the data type table returned by GetDataTypesTable().

Parameters
[in]idThe ID of the data type to look for.
Returns
The index of the data type.

◆ GetDataTypeInfo()

GvDataInfo* GetDataTypeInfo ( GvDataID  id)

Gets the data type information for a data type.

Parameters
[in]idThe data type ID.
Returns
The data type information. The GV world owns the pointed information.

◆ GetDataTypeNames()

Int32 GetDataTypeNames ( BaseContainer bc,
GvDataID ids 
)

Fills bc with a description of the data types with IDs in ids, just as GetDataTypes().

Parameters
[in]bcFilled with the data type names.
[in]idsA zero terminated array of data type IDs. The caller owns the pointed array.
Returns
The number of data types found.

◆ GetDefaultOperatorIcon()

BaseBitmap* GetDefaultOperatorIcon ( GvOperatorType  type)

Gets the default operator icon for an operator type.

Parameters
[in]typeThe operator type: GvOperatorType
Returns
The default operator icon. The GV world owns the pointed bitmap.

◆ GetMaster()

GvNodeMaster* GetMaster ( Int32  id)

Returns the GV node master.

Parameters
[in]idThe node GUI index. Currently not used, should be set to 0. This is for future extensions.
Returns
The node master. The GV world owns the pointed node master.

◆ GetMasterGUI()

GvNodeGUI* GetMasterGUI ( GvNodeMaster master,
UInt32  nr = 0 
)

Gets the node GUI for a node master.

Note
Return nullptr if the XPresso window has not been opened yet.
Parameters
[in]masterThe node master to get the GUI for. The caller owns the pointed node master.
[in]nrThe node GUI index. Currently not used, should be set to 0. This is for future extensions.
Returns
The node GUI for master. The GV world owns the pointed node GUI.

◆ GetUniqueID()

UInt32 GetUniqueID ( )

Gets a unique ID. The generated ID is unique within the GvWorld during the session only.

Returns
The generated unique ID for the session.

◆ SetForceUpdate()

void SetForceUpdate ( )

Sets a flag that forces nodes to compute for the rest of the current scene evaluation even if the time since the last evaluation has not changed.

Since
R16.050

◆ SetPrefs()

void SetPrefs ( const BaseContainer bc)

Sets the preferences for the GV world.

Parameters
[in]bcThe new preferences. Use these container IDs: GvWorldConfigIDs

◆ GetPrefs()

void GetPrefs ( BaseContainer bc)

Gets the preferences for the GV world.

Parameters
[out]bcFilled with the current preferences. Use these container IDs: GvWorldConfigIDs