Hi there,
I'm testing out if we can fit Bifrost in certain parts of our pipeline and got into scripting a graph. I did run into a problem when trying to rename a node though. It looks like Bifrost acts like Maya, in the sense that if you try to name a node to something that already has the same name, it will automatically increment the name by 1. This is fine and I'm very used to it in cmds, but in cmds it returns the result, while it looks like Bifrost's cmds.vnnCompound(renameNode) returns nothing at all. This is an issue because if the node I'm trying to rename has a conflict I'll suddenly lose reference to the node!
Is there some workaround to get its real name in case of a conflict? Ideally cmds.vnnCompound would also have a name parameter that you can set right off the bat, just like cmds.createNode.
Solved! Go to Solution.
Solved by jonah.friedman. Go to Solution.
Solved by labbejason. Go to Solution.
This is the best I have so far, but quite the overkill 🙂
Would love to hear if there's a better solution.
node = cmds.vnnCompound(graph, "/", addIONode=True)[0] # Create node.
graph_nodes = cmds.vnnCompound(graph, "/", listNodes=True) # List all nodes in graph.
graph_nodes.pop(graph_nodes.index(node)) # Remove new node from the list.
cmds.vnnCompound(graph, "/", renameNode=(a, "NEW")) # Rename it.
new_graph_nodes = cmds.vnnCompound(graph, "/", listNodes=True) # Re-list all nodes in graph.
node = next(iter(set(new_graph_nodes).difference(graph_nodes))) # Re-assign value to the one new node.
Hi Jason,
That's indeed a known issue and it's logged as BIFROST-1648 so you can look out for it in future release notes.
Your solution looks like the kind of workaround I'd suggest except your Python is nicer. (I like that last line, readable and compact).
Can't find what you're looking for? Ask the community or share your knowledge.