Plug

class guerilla.Plug

Bases: object

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

adddependencies(*args)

Connect outputs plug to this plug

Parameters:*args

The list of plugs to connect to this plug

adddependency(plug)

Add dependency to plug

Use current modifier context

Parameters:plug (Plug) – plug object
connect(plug)

Connect to plug

Use current modifier context

Parameters:plug (Plug) – plug object
connections(source=True, destination=False)

Retrieve connected plug

Parameters:
  • source (bool) – return outputs
  • destination (bool) – return input
Returns:

list of connected Plug

Return type:

list of Plug

delete()

Delete this plug.

dependencies(source=True, destination=False)

Retrieve dependencies and backdependencies

Parameters:
  • source (bool) – return back dependencies
  • destination (bool) – return dependencies
Returns:

list of dependent Plug

Return type:

list of Plug

disconnect(plug)

Disconnect from plug

Use current modifier context

Parameters:plug (Plug) – plug object
disconnectall()

Disconnect a plug from all its connections

disconnectcontrol()

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

get()

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

If the plug was invalidated, its value is recomputed.

getbackdependencies()

Retrieve the list of plugs this plug has dependencies on

getdependencies()

Retrieve the list of plugs this plug is dependent on

getflag(flag)

Get a specific plug flag.

Parameters:flag (number) – the flag to retrieve
Returns:The current state
Return type:types.bool
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

    rtype:number
getinmotion(steps, time, start, 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.

Parameters:
  • steps (int) – Number of motion steps wanted
  • time (float) – Base time at which we want the motion values
  • start (float) – Delta time from the base time for the first value
  • stop (float) – Delta time from the base time for the last value
getinput()

Returns the input connection

Returns:the connected input plug
Return type:Plug
getname()

Returns the name of the plug in its parent

getnode()

Returns the parent node of the plug

getoutputs()

Returns the list of output connections

Returns:the connected output plugs or None if no plug is connected
Return type:{Plug}
getpath()

Plug path

Returns:plug path (ie. long name)
Return type:str
getraw()

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

gettype()

Get the type associated to the plug

hasbackdependencies()

Tells if some plugs are dependent on this plug

hasdependencies()

Tells if the plug is dependent on other plugs

hasoutputs()

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

Returns:True if the plug is connected in output
Return type:bool
hastype()

Check if plug has a type or not

Returns:True if plug is typed else False
Return type:bool
isanimatable()

Tells if the plug value can be animated

isconnected(output)

Test if a plug is connected to another

Parameters:output (Plug) – The output to test connection
Return type:bool
isdependent(plug)

Returns true if this plug is dependent on other

Parameters:plug (Plug) – The plug to test dependency on
Returns:True if this plug is dependent on plug
Return type:bool
isreadonly()

Check if this plug is read only

Returns:True if plug is read only else False
Return type:bool
isrefoverriden()

Tells if the plug state is overriden from its reference state

isvalid()

Returns the validity status of the plug

Return type:bool
name

Plug name

Returns:plug name
Return type:str
parent

Parent node

Returns:parent node
Return type:Node
path

Plug long name

Returns:plug long name
Return type:str
removealldependencies()

Remove all input dependencies of this plug

removedependencies(*args)

Connect an output plug to this plug

Parameters:*args

The list of plugs to disconnect to this plug

removedependency(output)

Connect an output plug to this plug

Parameters:output (Plug) – The output to connect to this plug
set(value)

Set plug value

Use current modifier context

Parameters:value – plug value
setflags(flags)

Sets the plug flags

Parameters:flags (number) – the flags to set.
setvalid()

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

tostring()

Returns a human readble string of the plug’s value

Returns:the string value
Return type:str
touch()

Invalidate (ie. force re-evaluation) value

Use current modifier context

validate()

Force the plug validation by evaluating the plug.