linker.connectΒΆ
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
- LeftClasses are SceneGraphNode, RenderPass and LayerOut
- RightClasses are RenderPass and LayerOut
- submodes are "Visible", "Matte", "Exclude Visible", "Exclude Matte"
- CameraLinking: (dis)connect a Camera to a RenderPass, a Bake3d or a CameraMap
- LeftClasses is Camera
- RightClasses are RenderPass, ShaderNodeBake3d and ShaderNodeCameraMap
- FileInLinking: (dis)connect a FileIn to a RenderFileOut
- LeftClasses is ShaderNodeFileIn
- RightClasses is RenderFileOut
- ProceduralLinking: (dis)connect a Procedural to a Primitive
- LeftClasses is Procedural
- RightClasses is Primitive
- submode is "Instances"
The left and right nodes classes to connect are expected to be compatible with the mode's LeftClasses and RightClasses attributes. For instance:
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:
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
},
},
}
}
left The left node to connectright The right node to connectconnect Connect or disconnectmode The connection modesubmode The connection submode