Murl Engine Lua Addon API  Version 1.0 beta
Murl.Graph.IInstance

The IInstance graph node interface.

This interface provides a means to instantiate zero, one, or more sub-graphs in the current scene graph. The source object (i.e. graph template) can either be a Resource::IGraph object from the resource collection set via GetGraphResourceTarget(), or an already instantiated Graph::ITemplate node referenced via GetTemplateNodeTarget().


Table members

Methods


GetNodeInterface()

Get the constant Graph::INode interface. This method returns a constant pointer to the node's Graph::INode interface, to be able to query common node properties such as active state, visibility or ID.

Murl.Graph.INode GetNodeInterface()

Returns
Murl.Graph.INode The constant Graph::INode interface, or null if not available

GetGraphResourceTarget()

Get a constant Graph::IGraphResourceTarget container. This method returns a constant pointer to a Graph::IGraphResourceTarget container, which allows to query the graph resources referenced by a node implementing this interface.

Murl.Graph.IGenericResourceTarget.ResourceIGraph GetGraphResourceTarget()

Returns
Murl.Graph.IGenericResourceTarget.ResourceIGraph The constant Graph::IGraphResourceTarget container, or null if not available

GetTemplateNodeTarget()

Get the constant Graph::ITemplateNodeTarget container. This method returns a constant pointer to the node's Graph::ITemplateNodeTarget container, which allows to query the template graph node used for instantiaton.

Murl.Graph.IGenericNodeTarget.GraphITemplate GetTemplateNodeTarget()

Returns
Murl.Graph.IGenericNodeTarget.GraphITemplate The mutable Graph::ITemplateNodeTarget container, or null if not available.

SetNumberOfReplications(numberOfReplications)

Set the number of replications. This method sets the number of times the referenced graph resource should be instantiated. By default, this value is set to 1; it is also possible to set it to zero to not instantiate any graphs at all, useful e.g. when the instance node itself is used from within a parameterized sub-graph.

Boolean SetNumberOfReplications(Integer numberOfReplications)

Parameters
numberOfReplicationsThe number of replications of the graph to create.
Returns
Boolean true if successful.

GetNumberOfReplications()

Get the number of replications.

Integer GetNumberOfReplications()

Returns
Integer The number of replications of the graph to create.

GetReplicationNode(index)

Return the replication at a given position. This returns a mutable pointer to this node's replication at a given index.

Murl.Graph.INode GetReplicationNode(Integer index)

Parameters
indexThe zero-based index of the replication.
Returns
Murl.Graph.INode A pointer to the replication node, or null if the index was out of range.

AddParameter(name, value)

Add a user-defined instance parameter. It is possible to parameterize a graph instance by adding individual parameter name/value pairs, which are then evaluated during creation of the given sub-graph. If a node attribute from the given graph resource contains an identifier name enclosed in curly braces, e.g. "{myVariable}", that sequence is replaced by the value of the parameter with the given name if present, otherwise a default value is used that can be defined in the graph resource (or an empty string if that default value is also not present).

Boolean AddParameter(String name, String value)

Parameters
nameThe parameter name.
valueThe parameter value.
Returns
Boolean true if successful.

GetNumberOfParameters()

Get the total number of user-defined instance parameters.

Integer GetNumberOfParameters()

Returns
Integer The number of parameters.

GetParameterName(index)

Get the name of a user-defined instance parameter at a given index.

String GetParameterName(Integer index)

Parameters
indexThe zero-based index of the parameter to query.
Returns
String The parameter name at the given index.

GetParameterValue(index)

Get the value of a user-defined instance parameter at a given index.

String GetParameterValue(Integer index)

Parameters
indexThe zero-based index of the parameter to query.
Returns
String The parameter value at the given index.