Code: Select all
-- Copies the content of the diffuse pin of the diffuse material into the transmission pin
-- of the specular material.
-- create materials
local diffuseMatNode = octane.node.create{ type = octane.NT_MAT_DIFFUSE, name = "source node" }
local texNode = octane.node.create{ type = octane.NT_TEX_CHECKS, "checkers" }
diffuseMatNode:connectTo(octane.P_DIFFUSE, texNode)
local specularMatNode = octane.node.create{ type = octane.NT_MAT_SPECULAR, name = "dest. node" }
-- wrap up the full tree connect to the diffuse pin in a seperate nodegraph and make sure that
-- this graph has a texture output node
local tmpGraph = octane.nodegraph.create{ type = octane.GT_STANDARD, name = "Mess wrapper" }
local matOutputNode = octane.node.create{ type = octane.NT_OUT_TEXTURE, graphOwner = tmpGraph, name = "texture output" }
local copy = tmpGraph:copyItemTree(texNode)
matOutputNode:connectTo(octane.P_INPUT, copy)
-- copy the full graph into the transmission pin of the specular material
specularMatNode:copyFrom(octane.P_TRANSMISSION, tmpGraph)
-- tidy up
octane.project.getSceneGraph():unfold()
In your example you copy the texNode.
But, in your case that is a reference to the node created before.
In my case I don't create that node from code so I don't have direct access to it.
I guess I have to get it from the diffuse pin in the material somehow or?