Edit Action Graph

I am trying to edit an Action Graph through Python.
Is there any way to Disconnect two nodes using Python script?

In the example I provide it my Action graph had a Tick Node and a Print Text Node connected to each other.

This is a simpler version to just disconnect two nodes. You will need to provide the property path for the connection which can be found in the Raw USD Properties inside the Property Panel.

The code example was based on the following: Controller Class — kit-omnigraph 1.23.1 documentation

import omni.graph.core as og

keys = og.Controller.Keys  # Usually handy to keep this name short as it is used often
controller = og.Controller()

controller.edit(
	graph_id='/World/ActionGraph',
	edit_commands={
		# Disconnect
		keys.DISCONNECT: [
			("/World/ActionGraph/on_tick.outputs:tick", "/World/ActionGraph/print_text.inputs:execIn")
		]
	},
	path_to_object_map=None,  # Saved object-to-path map, bootstraps any created as part of the call
	update_usd=True,  # Immediately echo the changes to the underlying USD
	undoable=True,  # If False then do not remember previous state - useful for writing tests
	allow_exists_node=False,  # If True then silently succeed requests to create already existing nodes
	allow_exists_prim=False,  # If True then silently succeed requests to create already existing prims
)
2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.