PlugΒΆ

class Plug

A Plug is an attribute of a node. The plug can be "readable" only or "readable and writable".

A Plug is implemented with a Lua table.

Hierarchy

Children classes : class BakePlug , class ExpressionInput , class ExpressionOutput , class MeshPlug , class UserPlug

Members

Methods:

nil adddependencies ( Plug ... ) Connect outputs plug to this plug
nil adddependency ( Plug output ) Connect an output plug to this plug
nil connect ( Plug output , boolean safe ) Connect an output plug to this plug
nil delete ( ) Delete this plug.
nil disconnect ( Plug output ) Disconnect an output plug from this plug
nil disconnectall ( ) Disconnect a plug from all its connections
nil disconnectcontrol ( ) Disconnect the plug from its input and delete the input if it is a control and it is no longer connected
nil get ( ) Returns the value of a plug. The plug must be readable.
nil getbackdependencies ( ) Retrieve the list of plugs this plug has dependencies on, or nil if none
nil getdependencies ( ) Retrieve the list of plugs this plug is dependent on, or nil if none
types.bool state getflag ( number flag ) Get a specific plug flag.
number flags getflags ( ) Gets the plug flags.
nil getinmotion ( int steps , float time , float start , float stop ) Return an array of values of this plug evaluated in time.
Plug result getinput ( ) Returns the input connection
nil getname ( ) Returns the name of the plug in its parent
nil getnode ( ) Returns the parent node of the plug
{Plug} result getoutputs ( ) Returns the list of output connections
nil getpath ( ) Returns the path of the plug
nil getraw ( ) Returns the raw value of a plug, regardless of its invalidation state.
nil gettype ( ) Get the type associated to the plug
nil hasbackdependencies ( ) Tells if some plugs are dependent on this plug
nil hasdependencies ( ) Tells if the plug is dependent on other plugs
bool result hasoutputs ( ) Tells if the plug is connected in output to some other plugs
nil isanimatable ( ) Tells if the plug value can be animated
boolean result isconnected ( Plug output ) Test if a plug is connected to another
boolean dependent isdependent ( Plug plug ) Returns true if this plug is dependent on other
nil isrefoverriden ( ) Tells if the plug state is overriden from its reference state
boolean result isvalid ( ) Returns the validity status of the plug
nil removealldependencies ( ) Remove all input dependencies of this plug
nil removedependencies ( Plug ... ) Connect an output plug to this plug
nil removedependency ( Plug output ) Connect an output plug to this plug
nil set ( Type value ) Set the value of a plug. The plug must be writable.
nil setflags ( number flags ) Sets the plug flags
nil setvalid ( ) Force the plug valid state, but the plug is not evaluated.
string result tostring ( ) Returns a human readble string of the plug's value
nil touch ( ) Invalidate this plug
nil validate ( ) Force the plug validation by evaluating the plug.

Documentation

nil adddependencies ( Plug ... )

Connect outputs plug to this plug

Arguments:

  • ... The list of plugs to connect to this plug


nil adddependency ( Plug output )

Connect an output plug to this plug

Arguments:

  • output The output to connect to this plug


nil connect ( Plug output , boolean safe )

Connect an output plug to this plug

Arguments:

  • output The output to connect to this plug
  • safe Is true, no error if the plug is already connected. In this case, replace the old connection by the new one. If false, raise an error if the plug is already connected.


nil delete ( )

Delete this plug.


nil disconnect ( Plug output )

Disconnect an output plug from this plug

Arguments:

  • output The output to connect to this plug


nil disconnectall ( )

Disconnect a plug from all its connections


nil disconnectcontrol ( )

Disconnect the plug from its input and delete the input if it is a control and it is no longer connected


nil get ( )

Returns the value of a plug. The plug must be readable.

If the plug was invalidated, its value is recomputed.

nil getbackdependencies ( )

Retrieve the list of plugs this plug has dependencies on, or nil if none


nil getdependencies ( )

Retrieve the list of plugs this plug is dependent on, or nil if none


types.bool state getflag ( number flag )

Get a specific plug flag.

Arguments:

  • flag the flag to retrieve

Return:

  • state The current state


number flags getflags ( )

Gets the plug flags.

A Plug has various flags that indicate parts of the Plug state. The addressable flags are:
  • Plug.Dynamic: the plug is create dynamically, not within the node constructor
  • Plug.NoSerial: the plug connection, dependencies and value are not written to file
  • Plug.KeepOnCopy: the plug connection and dependencies to out of copy/paste space are written (for instance, when copy/pasting a primitive, the connection to the material is kept)
  • Plug.RefReadOnly: the plug value and incoming connection/dependencies are kept untouched if the plug is read from a reference
Return:

  • flags


nil getinmotion ( int steps , float time , float start , float stop )

Return an array of values of this plug evaluated in time.

The array is always of size 'steps'. If this plug is connected to a curve driven by the document's time, this method will evaluate the value in the desired time steps. If not, it will return 'steps' times the current plug value.
Arguments:

  • steps Number of motion steps wanted
  • time Base time at which we want the motion values
  • start Delta time from the base time for the first value
  • stop Delta time from the base time for the last value


Plug result getinput ( )

Returns the input connection

Return:

  • result the connected input plug


nil getname ( )

Returns the name of the plug in its parent


nil getnode ( )

Returns the parent node of the plug


{Plug} result getoutputs ( )

Returns the list of output connections

Return:

  • result the connected output plugs or nil if no plug is connected


nil getpath ( )

Returns the path of the plug


nil getraw ( )

Returns the raw value of a plug, regardless of its invalidation state.


nil gettype ( )

Get the type associated to the plug


nil hasbackdependencies ( )

Tells if some plugs are dependent on this plug


nil hasdependencies ( )

Tells if the plug is dependent on other plugs


bool result hasoutputs ( )

Tells if the plug is connected in output to some other plugs

Return:

  • result True if the plug is connected in output


nil isanimatable ( )

Tells if the plug value can be animated


boolean result isconnected ( Plug output )

Test if a plug is connected to another

Arguments:

  • output The output to test connection

Return:

  • result


boolean dependent isdependent ( Plug plug )

Returns true if this plug is dependent on other

Arguments:

  • plug The plug to test dependency on

Return:

  • dependent True if this plug is dependent on plug


nil isrefoverriden ( )

Tells if the plug state is overriden from its reference state


boolean result isvalid ( )

Returns the validity status of the plug

Return:

  • result


nil removealldependencies ( )

Remove all input dependencies of this plug


nil removedependencies ( Plug ... )

Connect an output plug to this plug

Arguments:

  • ... The list of plugs to disconnect to this plug


nil removedependency ( Plug output )

Connect an output plug to this plug

Arguments:

  • output The output to connect to this plug


nil set ( Type value )

Set the value of a plug. The plug must be writable.

All the plugs dependent of this plug will be invalidated.
Arguments:

  • value The new value to put in the plug


nil setflags ( number flags )

Sets the plug flags

Arguments:

  • flags the flags to set.


nil setvalid ( )

Force the plug valid state, but the plug is not evaluated.


string result tostring ( )

Returns a human readble string of the plug's value

Return:

  • result the string value


nil touch ( )

Invalidate this plug


nil validate ( )

Force the plug validation by evaluating the plug.