Compare Programming Domains
If you are already familiar with an Omniverse App like Omniverse Code or Omniverse USD Composer and want to get started with programming a project you should read this page.
In this comparison we cover Extensions, Python Scripting Components (PSC) and the Script Editor. Functionally, extensions can do anything a PSC and the Script Editor can do but may have more setup time and persistence than needed. A PSC is very useful for attaching a script to a specific prim on the stage. The Script Editor is a useful tool to execute script files but lacks persistence when you relaunch your App.
This comparison does not cover Apps, Connectors, Services or OmniGraph since they are outside the scope of programming this USD authoring scenario.
Which Programming Domain Should I Use?
The programming domain to use relies heavily on what you’d like to achieve. Let’s take a look at some ideas a developer could create in a USD authoring environment
You are building a reusable tool
Let’s say you are building The Randomizer Tool. It’s purpose is to add randomized rotations (transforms) to objects prims. You would like this tool to act on many prims at once and you need its UI to be persistent so the user can use it whenever it’s needed.
![Example: Randomizer Tool](_images/randomizer_preview.png)
✅ An Extension is the appropriate environment to use. We want a persistent tool and UI for the user to be able to use whenever it is needed.
❌ A Python Scripting Component wouldn’t be appropriate because if the parent Prim is deleted the tool will be destroyed.
❌ The Script Editor isn’t appropriate because we need the Randomizer Tool to be persistent across Application sessions.
You are Creating a Programmatic Animation
Let’s say you’d like to render out an animation of exactly 3 bouncing balls. The balls do not need to interact and each one will bounce twice and then get destroyed.
❌ An Extension would be overkill for this project. Unlike a PSC, an Extension would keep running after the ball is deleted from the scene unless it is manually disabled in the Extension Manager. (An extension would become appropriate if there were complex interactions between balls or if we wanted to let the user create new ones on the fly with modifiable parameters.)
✅ A PSC could be written to animate a ball Prim to make it bounce. A PSC is appropriate here since it is designed to act on a specific prim and a UI isn’t necessary. The PSC can be reused on as many ball prims as desired. It also has the advantage of shutting down when the Prim is deleted.
❌ The Script Editor would have the following drawbacks: It would need the ball Prim to be specified when executed. Also, deleting the prim wouldn’t automatically dispose of the script.