hi, is it possible to change a node type from diffuse to glossy?
i tried using updateProperties() but my changes seem to get ignored
-- connect the material to all the pins of the mesh
for pinIx=1,mesh:getPinCount() do
mesh:connectToIx(pinIx, material)
end
--
-- Select a material and a mesh
--
local mesh, material = nil, nil
-- figure out the selection of the material and the mesh
local selection = octane.project.getSelection()
if #selection ~= 2 then error("a material and a mesh needs to be selected") end
if selection[1]:getProperties().type == octane.NT_GEO_MESH and
selection[2]:getProperties().type == octane.NT_MAT_DIFFUSE then
mesh, material = selection[1], selection[2]
elseif selection[1]:getProperties().type == octane.NT_MAT_DIFFUSE and
selection[2]:getProperties().type == octane.NT_GEO_MESH then
mesh, material = selection[2], selection[1]
else
error("a material and a mesh need to be selected")
end
-- connect the material to all the pins of the mesh
for pinIx=1,mesh:getPinCount() do
mesh:connectToIx(pinIx, material)
end
--
-- Select a limbs material and a mesh
--
local mesh, limbs = nil, nil
-- figure out the selection of the limbs material and the mesh
local selection = octane.project.getSelection()
if #selection ~= 2 then error("a material and a mesh needs to be selected") end
if selection[1]:getProperties().type == octane.NT_GEO_MESH and
selection[2]:getProperties().type == octane.NT_MAT_MIX then
mesh, limbs = selection[1], selection[2]
elseif selection[1]:getProperties().type == octane.NT_MAT_MIX and
selection[2]:getProperties().type == octane.NT_GEO_MESH then
mesh, limbs = selection[2], selection[1]
else
error("a material and a mesh need to be selected")
end
-- connect the material to all the pins of the mesh
pinIx=1,mesh:getPinCount()
mesh:connectToIx(pinIx, limbs)
pinIx=17,mesh:getPinCount()
mesh:connectToIx(pinIx, limbs)
pinIx=18,mesh:getPinCount()
mesh:connectToIx(pinIx, limbs)
pinIx=23,mesh:getPinCount()
mesh:connectToIx(pinIx, limbs)
pinIx=24,mesh:getPinCount()
mesh:connectToIx(pinIx, limbs)
--
-- Select a toso material and a mesh
--
local mesh, torso = nil, nil
-- figure out the selection of the torso material and the mesh
local selection = octane.project.getSelection()
if #selection ~= 2 then error("a material and a mesh needs to be selected") end
if selection[1]:getProperties().type == octane.NT_GEO_MESH and
selection[2]:getProperties().type == octane.NT_MAT_MIX then
mesh, torso = selection[1], selection[2]
elseif selection[1]:getProperties().type == octane.NT_MAT_MIX and
selection[2]:getProperties().type == octane.NT_GEO_MESH then
mesh, torso = selection[2], selection[1]
else
error("a material and a mesh need to be selected")
end
-- connect the material to all the pins of the mesh
pinIx=16,mesh:getPinCount()
mesh:connectToIx(pinIx, torso)
pinIx=19,mesh:getPinCount()
mesh:connectToIx(pinIx, torso)
pinIx=20,mesh:getPinCount()
mesh:connectToIx(pinIx, torso)
pinIx=21,mesh:getPinCount()
mesh:connectToIx(pinIx, torso)
pinIx=22,mesh:getPinCount()
mesh:connectToIx(pinIx, torso)
pinIx=28,mesh:getPinCount()
mesh:connectToIx(pinIx, torso)
--
-- Select an object layer map and an object layer node
--
local Object_Layer_Map, Object_Layer = nil, nil
-- figure out the selection of the material and the mesh
local selection = octane.project.getSelection()
if #selection ~= 2 then error("an object layer map and an object layer node needs to be selected") end
if selection[1]:getProperties().type == octane.NT_OBJECTLAYER_MAP and
selection[2]:getProperties().type == octane.NT_OBJECTLAYER then
Object_Layer_Map, Object_Layer = selection[1], selection[2]
elseif selection[1]:getProperties().type == octane.NT_OBJECTLAYER and
selection[2]:getProperties().type == octane.NT_OBJECTLAYER_MAP then
Object_Layer_Map, Object_Layer = selection[2], selection[1]
else
error("an object layer map and an object layer node need to be selected")
end
-- connect the object layer to all the pins of the object layer map
for pinIx=17,Object_Layer_Map:getPinCount() do
Object_Layer_Map:connectToIx(pinIx, Object_Layer)
end
--
-- Select an object layer map and an object layer in node
--
local Object_Layer_Map, Object_Layer_In = nil, nil
-- figure out the selection of the material and the mesh
local selection = octane.project.getSelection()
if #selection ~= 2 then error("an object layer map and an object layer in node needs to be selected") end
if selection[1]:getProperties().type == octane.NT_OBJECTLAYER_MAP and
selection[2]:getProperties().type == octane.IN_OBJECTLAYER then
Object_Layer_Map, Object_Layer_In = selection[1], selection[2]
elseif selection[1]:getProperties().type == octane.IN_OBJECTLAYER and
selection[2]:getProperties().type == octane.NT_OBJECTLAYER_MAP then
Object_Layer_Map, Object_Layer_In = selection[2], selection[1]
else
error("an object layer map and an object layer in node need to be selected")
end
-- connect the object layer in node to all the pins of the object layer map
for pinIx=17,Object_Layer_Map:getPinCount() do
Object_Layer_Map:connectToIx(pinIx, Object_Layer_In)
end
Slide3D wrote:I got several codes for each material
it is possible to unite in one code?
- Code: Select all
--
-- Select a limbs material and a mesh
--
local mesh, limbs = nil, nil
-- figure out the selection of the limbs material and the mesh
local selection = octane.project.getSelection()
if #selection ~= 2 then error("a material and a mesh needs to be selected") end
if selection[1]:getProperties().type == octane.NT_GEO_MESH and
selection[2]:getProperties().type == octane.NT_MAT_MIX then
mesh, limbs = selection[1], selection[2]
elseif selection[1]:getProperties().type == octane.NT_MAT_MIX and
selection[2]:getProperties().type == octane.NT_GEO_MESH then
mesh, limbs = selection[2], selection[1]
else
error("a material and a mesh need to be selected")
end
-- connect the material to all the pins of the mesh
pinIx=1,mesh:getPinCount()
mesh:connectToIx(pinIx, limbs)
pinIx=17,mesh:getPinCount()
mesh:connectToIx(pinIx, limbs)
pinIx=18,mesh:getPinCount()
mesh:connectToIx(pinIx, limbs)
pinIx=23,mesh:getPinCount()
mesh:connectToIx(pinIx, limbs)
pinIx=24,mesh:getPinCount()
mesh:connectToIx(pinIx, limbs)
- Code: Select all
--
-- Select a toso material and a mesh
--
local mesh, torso = nil, nil
-- figure out the selection of the torso material and the mesh
local selection = octane.project.getSelection()
if #selection ~= 2 then error("a material and a mesh needs to be selected") end
if selection[1]:getProperties().type == octane.NT_GEO_MESH and
selection[2]:getProperties().type == octane.NT_MAT_MIX then
mesh, torso = selection[1], selection[2]
elseif selection[1]:getProperties().type == octane.NT_MAT_MIX and
selection[2]:getProperties().type == octane.NT_GEO_MESH then
mesh, torso = selection[2], selection[1]
else
error("a material and a mesh need to be selected")
end
-- connect the material to all the pins of the mesh
pinIx=16,mesh:getPinCount()
mesh:connectToIx(pinIx, torso)
pinIx=19,mesh:getPinCount()
mesh:connectToIx(pinIx, torso)
pinIx=20,mesh:getPinCount()
mesh:connectToIx(pinIx, torso)
pinIx=21,mesh:getPinCount()
mesh:connectToIx(pinIx, torso)
pinIx=22,mesh:getPinCount()
mesh:connectToIx(pinIx, torso)
pinIx=28,mesh:getPinCount()
mesh:connectToIx(pinIx, torso)
and for other mats
-- maps a matterial to all the pins
connections = { ["V6Torso"] = { "dzmat_Head", "dzmat_Neck", "dzmat_Hips", "dzmat_Torso" } }
for i,pinName in ipairs(connections["V6Torso"]) do
print(string.format("connect material %s to pin %s", "V6Torso", pinName))
-- do the connections here...
end
bepeg4d wrote:hi thomas,
i have tried to convert your script for connecting an object layer node to all the pins of an object layer map node, but it works only for some pins and leaves always the others unconnected:
- Code: Select all
--
-- Select an object layer map and an object layer node
--
local Object_Layer_Map, Object_Layer = nil, nil
-- figure out the selection of the material and the mesh
local selection = octane.project.getSelection()
if #selection ~= 2 then error("an object layer map and an object layer node needs to be selected") end
if selection[1]:getProperties().type == octane.NT_OBJECTLAYER_MAP and
selection[2]:getProperties().type == octane.NT_OBJECTLAYER then
Object_Layer_Map, Object_Layer = selection[1], selection[2]
elseif selection[1]:getProperties().type == octane.NT_OBJECTLAYER and
selection[2]:getProperties().type == octane.NT_OBJECTLAYER_MAP then
Object_Layer_Map, Object_Layer = selection[2], selection[1]
else
error("an object layer map and an object layer node need to be selected")
end
-- connect the object layer to all the pins of the object layer map
for pinIx=17,Object_Layer_Map:getPinCount() do
Object_Layer_Map:connectToIx(pinIx, Object_Layer)
end
another question, the best would be to use an "object layer in" node but i'm not able to sobstitute the "Object_Layer" with the input version, where is the mistake?
- Code: Select all
--
-- Select an object layer map and an object layer in node
--
local Object_Layer_Map, Object_Layer_In = nil, nil
-- figure out the selection of the material and the mesh
local selection = octane.project.getSelection()
if #selection ~= 2 then error("an object layer map and an object layer in node needs to be selected") end
if selection[1]:getProperties().type == octane.NT_OBJECTLAYER_MAP and
selection[2]:getProperties().type == octane.IN_OBJECTLAYER then
Object_Layer_Map, Object_Layer_In = selection[1], selection[2]
elseif selection[1]:getProperties().type == octane.IN_OBJECTLAYER and
selection[2]:getProperties().type == octane.NT_OBJECTLAYER_MAP then
Object_Layer_Map, Object_Layer_In = selection[2], selection[1]
else
error("an object layer map and an object layer in node need to be selected")
end
-- connect the object layer in node to all the pins of the object layer map
for pinIx=17,Object_Layer_Map:getPinCount() do
Object_Layer_Map:connectToIx(pinIx, Object_Layer_In)
end
ciao beppe
-- connect the object layer to all the pins of the object layer map
for pinIx=2,Object_Layer_Map:getPinCount() do
Object_Layer_Map:connectToIx(pinIx, Object_Layer)
end
octane.NT_IN_OBJECTLAYER
not IN_OBJECT_LAYER
.--
-- Select an object layer map and an object layer in node
--
local Object_Layer_Map, Object_Layer_In = nil, nil
-- figure out the selection of the material and the mesh
local selection = octane.project.getSelection()
if #selection ~= 2 then error("an object layer map and an object layer in node needs to be selected") end
if selection[1]:getProperties().type == octane.NT_OBJECTLAYER_MAP and
selection[2]:getProperties().type == octane.NT_IN_OBJECTLAYER then
Object_Layer_Map, Object_Layer_In = selection[1], selection[2]
elseif selection[1]:getProperties().type == octane.NT_IN_OBJECTLAYER and
selection[2]:getProperties().type == octane.NT_OBJECTLAYER_MAP then
Object_Layer_Map, Object_Layer_In = selection[2], selection[1]
else
error("an object layer map and an object layer in node need to be selected")
end
-- connect the object layer in node to all the pins of the object layer map
for pinIx=2,Object_Layer_Map:getPinCount() do
Object_Layer_Map:connectToIx(pinIx, Object_Layer_In)
end
Users browsing this forum: No registered users and 4 guests