Here's a little script to copy and paste a full node tree. The root of the tree is the selected node. To use it, just select a node and run the script. The script is mapped to
alt + c
but you can change this of course. Might be useless 99.99% of the time but I think it's nifty This only works with release 1.34 and higher.
Here's a visually what the script does:
- Code: Select all
-- Creates a copy of tree starting at the selected item. The copy is immediately
-- pasted into the current project and the copied tree is selected.
--
-- @description creates an item tree copy
-- @author Thomas Loockx
-- @version 0.1
-- @shortcut alt+c
-- get the current selection
local selection = octane.project.getSelection()
-- only do something if we have a single selection
if #selection == 1 then
-- create a root graph to copy into
local copyGraph = octane.nodegraph.createRootGraph("Copy Tree Graph")
-- copy the full tree into the copy graph
local copyRoot = copyGraph:copyItemTree(selection[1])
-- unclutter it a bit
copyGraph:unfold()
-- copy it into the scene graph
local copies = octane.nodegraph.getRootGraph():copyFrom(copyGraph:getOwnedItems())
-- select all those copied items
octane.project.clearSelection()
for i, item in pairs(copies) do
octane.project.select(item)
end
end
cheers,
Thomas