Multithreading Utilities Object Info Globals Table of Contents

Node Editor

Availability  LightWave® 9.0
Component  Layout,Modeler
Header  lwnodeeditor.h

This global provides access to a user interface for editing nodes.

Global Call

   LWNodeEditorFuncs *nodeedf;
   nodeedf = global( LWNODEEDITORFUNCS_GLOBAL, GFUSE_TRANSIENT );

Root Node Functions

 typedef struct LWRootNode_t {
 NodePreviewType  previewType;
 LWError          (*init)( NodeEditorID, int );
 LWError          (*newTime)( NodeEditorID, LWFrame, LWTime );
 void             (*cleanup)( NodeEditorID );
 LWXPanelID       (*rootPanel)( NodeEditorID ); 
 LWError          (*rootOptions)( NodeEditorID );
 void             (*rootPreview)( NodeEditorID,
		    LWNodalAccess*, LWDVector );
 void             (*rootCustomPreview)( NodeEditorID,
		    int, int );
 } LWRootNode;

The root node, is the destination node that all the other nodes connect to.
The client needs to evaluate the inputs, and handle the implementation for whatever class it is used with.

init( editor , mode )
Init for the root node. For initializing render data for the root node.
newTime( editor, frame, time )
Newtime for the root node.
cleanup( editor )
Cleanup for the root node.
rootPanel( editor )
Embedded xpanel, for the “Node Properties” panel.
rootOptions( editor )
Options is called when no xpanel is defined for the root node.
rootPreview( editor, access, color )
Preview function to draw the preview sphere for the root node. The color is the resulting pixel color which the client should fill in. The color will be scaled and clamped into [0, 255] range internally.
rootCustomPreview( editor, width, height )
Custom preview function, for doing custom previews for the root node.

Node Editor Functions

 typedef struct st_LWNodeEditorFuncs {
 NodeEditorID       (*create)( const char*, const char*, LWRootNode*, 
                    void* );
 void               (*destroy)( NodeEditorID );
 void               (*rename)( const char*, NodeEditorID ); 
 void               (*setUpdateFunc)( NodeEditorID, 
                    nodeEditorUpdateFunc* );
 LWError            (*copy)( NodeEditorID, NodeEditorID );
 LWError            (*save)( NodeEditorID, const LWSaveState* );
 LWError            (*load)( NodeEditorID, const LWLoadState* );
 LWError            (*init)( NodeEditorID, int );
 LWError            (*newTime)( NodeEditorID, LWFrame, LWTime );
 void               (*cleanup)( NodeEditorID );
 NodeInputID        (*addInput)( NodeEditorID, ConnectionType, 
                    const char*, NodeInputEvent* );
 void               (*setEnvGroup)( NodeEditorID, LWChanGroupID );
 void               (*setAutosize)( NodeEditorID, nodeAutoSizeFunc* );
 void               (*setUserData)( NodeEditorID, void* );
 void               *(*getUserData)( NodeEditorID );
 int                (*numberOfNodes)( NodeEditorID );
 NodeInputID        (*getInputByName)( NodeEditorID, const char* );
 NodeInputID        (*getInputByIndex)( NodeEditorID, int );
 unsigned short int (*getState)( NodeEditorID );
 void               (*setState)( NodeEditorID, unsigned short int );
 int                (*OpenNodeEditor)( NodeEditorID );
 int                (*isOpenNodeEditor)( NodeEditorID );
 NodeID             (*getRootNodeID)( NodeEditorID );
} LWNodeEditorFuncs;

The node editor functions.

create( rootname, paneltitle, rootnodefuncs, userdata )
Create a node editor ID.
destroy( editor )
Destroy a node editor ID.
rename( newname, editor )
Rename the editor. It is essentially the title for the editor window.
setUpdateFunc( editor, UpdateFunc )
Set the update function for the editor.
copy( to, from )
Copy the node editor data.
save( editor, SaveState )
Save the node editor data.
load( editor, LoadState )
Load the node editor data.
init( editor, mode )
Init needs to be called when rendering is being initialized.
This function calls Init for all the nodes in the editor.
newTime( editor, frame, time )
This function calls newTime for all the nodes in the editor.
cleanup( editor )
This function calls cleanup for all the nodes in the editor.
Must be called after evaluation is done, if Init was called.
addInput( editor, ConnectionType, name, InputEvent )
Add an input to the root node.
setEnvGroup( editor, ChanGroupID )
Set the envelope group for the editor. All node envelope groups are parented into this group.
setAutosize( editor, AutoSizeFunc )
Set the autosize function for the editor.
setUserData( editor, userdata )
Set the userdata for this editor.
getUserData( editor )
Get the userdata from this editor.
numberOfNodes( editor )
Returns the number of nodes in this editor.
getInputByName( editor, inputname )
Get an input from the root node, by it's name.
getInputByIndex( editor, index )
Get an input from the root node, by it's index.
getState( editor )
Get the state. Enabled/Disabled.
setState( editor, state )
Set the state. 0 disables the rendering for this editor, and 1 enables it.
OpenNodeEditor( editor )
Open the editor window.
isOpenNodeEditor( editor )
Is the node editor open, and set to this NodeEditorID?
getRootNodeID( editor )
Get the NodeID of the root node from this editor.

Example

The Node Displacement sample is a displacement plugin that utilises a node editor to create the displacement.