Lua script for updating Orbx/Ocs files?
Hi there, I need some help creating a script which update an orbx/ocs node (like the update button for geometry?) as orbx/ocs files are being exported from different programs, and currently I have to delete the node and re-link them manually. Any help would be appreciated.
One possible way is as follows:
- Clear any non-linker nodes in your graph
- Import the ORBX file inside your graph
- Connect all matching linker nodes: input linkers in your graph → input linkers in the imported graph, and the other way for outputs
- Ungroup the original graph.
Hi Thank you for your reply, I'm having trouble getting this to work, would you mind elaborating what's a 'non-linker nodes' and 'matching linker nodes'?roeland wrote:One possible way is as follows:
I'm using the following: -Roeland
- Clear any non-linker nodes in your graph
- Import the ORBX file inside your graph
- Connect all matching linker nodes: input linkers in your graph → input linkers in the imported graph, and the other way for outputs
- Ungroup the original graph.
I couldn't get it working, maybe I am having trouble understanding it.
say I have a file with a simple obj exported from my 3D program.
I load it into octane, group it then rightclick save as A.orbx
then i put that A.orbx into another octane file B.orbx.
if I make some changes to A.orbx and save it, how do I update A.orbx loaded into B.orbx without having to re import it?
say I have a file with a simple obj exported from my 3D program.
I load it into octane, group it then rightclick save as A.orbx
then i put that A.orbx into another octane file B.orbx.
if I make some changes to A.orbx and save it, how do I update A.orbx loaded into B.orbx without having to re import it?
The script as is allows you to load B.orbx, select one or more node graphs and replace the contents of that with A.orbx.
You can do the same programatically, roughly like this (replace the part of the script below
You can do the same programatically, roughly like this (replace the part of the script below
-- get selection
):
Code: Select all
-- Open B
assert(octane.project.load([[path/to/B.orbx]]))
local B = octane.project.getSceneGraph()
-- Load A
local sourceGraph = octane.nodegraph.createRootGraph("")
assert(octane.nodegraph.importFromFile(sourceGraph, [[path/to/A.orbx]]))
local sourceItems = sourceGraph:getOwnedItems()
assert(#sourceItems == 1)
local A = sourceItems[1]
-- find node graphs to refresh. You'll need some way
-- to identify which graphs were imported from B.orbx:
local graphs = B:findItemsByName("B.orbx", true)
-- and refresh node graphs
for _, g in ipairs(graphs) do
if g.graphType == octane.GT_STANDARD then
replaceContents(g, A)
print("Replaced graph")
end
end
-- save
-- check carefully if this is working before actually saving
-- assert(octane.project.save())