linker

class guerilla.linker

Bases: object

static connect(left, right, connect, mode, submode)

Manage the connection between 2 objects in a specified mode

This function handles the connection between 2 objects, such as light linking, trace linking, etc.

It takes 2 nodes to connect/disconnect, a flag that tells if the nodes must be connected or disconnected, a mode that indicates which kind of connection must be handled and an optional submode if the connection mode has submodes. The passed mode can be either a string for built-in linker modes, or a custom table for alternative linking mode. Available built-in linker modes are:

  • RenderpassLinking: (dis)connect a SceneGraphNode to a Layer or LayerOut

  • CameraLinking: (dis)connect a Camera to a RenderPass, a Bake3d or a CameraMap

  • FileInLinking: (dis)connect a FileIn to a RenderFileOut

  • ProceduralLinking: (dis)connect a Procedural to a Primitive

The left and right nodes classes to connect are expected to be compatible with the mode’s LeftClasses and RightClasses attributes. For instance: LUA{ linker.connect (myPrimitive, myMaterial, true, “MaterialLinking”) – Correct, connect myPrimitive Primitive to myMaterial Material

linker.connect (myLight, myPrimitive, true, “LightLinking”) – Wrong, left is expected to be a SceneGraphNode, or a LayerOut – and right is expected to be a Light or a ShaderNodeShadow

linker.connect (myPrimitive, myLight, true, “LightLinking”) – Correct, myPrimitive is connected to myLight – No submode assumes default connections, that is Lit and Shadow } The mode argument can be a custom linker mode, as a table: LUA{ local LeftStereoLinking = {

– The name to be displayed as linking mode in the linker Name = “Left Camera”, – Filter to use in the left tree LeftLabels = “Stereo Camera”, LeftClasses = {“Camera”}, – Filter to use in the right tree RightLabels = “Left Camera”, RightClasses = {“Camera”}, – Dependencies Dependencies = {

{
{
“LeftCam”, – Plug to connect in the left object “CameraParams”, – Plug to connect in the right object true, – true : left depends on right, false : right depends on left false, – true : enable multiple connections, false : only one connection

},

},

}

param left:The left node to connect
type left:Node
param right:The right node to connect
type right:Node
param connect:Connect or disconnect
type connect:types.bool
param mode:The connection mode
type mode:str or table
param submode:The connection submode
type submode:str or None
static getconnections(node, result, left, mode, submode, name)

Get the connection of an object in a specified mode

Parameters:
  • node (Node) – The node to get connections
  • result (table or None) – The result table to fill (if nil, will return a new table)
  • left (types.bool) – Node is left in the connection mode
  • mode (str or table) – The connection mode
  • submode (str or None) – The connection submode
  • name (str or None) – Prefix for the result of the connections