USD.Stage

Inherits from Object

Description

A class that represents a USD Stage.

Properties

defaultPrim The default prim set for the stage.

Methods

definePrim Create a USD.Prim in the stage.
findPrim Return a USD.Prim with a given name.
getPrims Return an Array of all USD.Prim objects on the stage.
processLiveUpdates Send live updates to the server and process live updates received from the server.
reload Reload the stage.
save Save changes to the stage.

Details

Do no remove, this fixes the anchor on doc.flexsim.com

USD.Stage.defaultPrim

readonly USD.Prim defaultPrim

Description

The default prim set for the stage.


				USD.Stage stage = Model.find("USD Stage1");
				USD.Prim prim = stage.defaultPrim;
			
Do no remove, this fixes the anchor on doc.flexsim.com

USD.Stage.definePrim()

USD.Prim definePrim( string primPath , string typeName = "" )

Parameters

primPath The path of the new prim.
typeName Optional. The type of prim being created.

Returns

USD.Prim The newly created USD.Prim.

Description

Create a USD.Prim in the stage.

Prim paths follow a filepath-structure. For example, if you want to create a prim named "Processor1" nested under a prim called "World", your primPath would be the string "/World/Processor1". Note: if the "World" prim didn't exist in this example, it would be created to fulfill the creation of the prim. If you try to define a prim that already exists at the given path with no typeName or the same typeName, no new prim will be created. If the typeName is different, it will redefine the type of the existing prim.

Prim types are schemas that are generally found in the OpenUSD documentation or are user defined. The typeName parameter specifices what type of prim you want to create, defaulting to no type. For example, you can create an "Xform" (short for USD transformation) prim by running the code below.


				USD.Stage stage = Model.find("USD Stage1");
				USD.Prim prim = stage.definePrim("/my/test/prim", "Xform");
				if (prim) {
					...
				}
			
Do no remove, this fixes the anchor on doc.flexsim.com

USD.Stage.findPrim()

USD.Prim findPrim( string primName )

Parameters

primName The name of the prim to search for.

Returns

USD.Prim A USD.Prim.

Description

Return a USD.Prim with a given name.

Prim names follow a filepath-structure. For example, if you have a prim named "Processor1" nested under a prim called "World", you would search for it with the string "/World/Processor1".

				USD.Stage stage = Model.find("USD Stage1");
				USD.Prim prim = stage.findPrim("/World/Processor1");
				if (prim) {
					...
				}
			
Do no remove, this fixes the anchor on doc.flexsim.com

USD.Stage.getPrims()

Array getPrims( )

Returns

Array An array of USD.Prim objects.

Description

Return an Array of all USD.Prim objects on the stage.

Return an Array of all USD.Prim objects on the stage. This function performs a Depth First Search on the stage to find all prims in the stage.

				USD.Stage stage = Model.find("USD Stage1");
				Array prims = stage.getPrims();
				for (int i = 1; i <= prims.length; i++) {
					...
				}
			
Do no remove, this fixes the anchor on doc.flexsim.com

USD.Stage.processLiveUpdates()

processLiveUpdates( )

Description

Send live updates to the server and process live updates received from the server.


				USD.Stage stage = Model.find("USD Stage1");
				USD.Prim prim = stage.definePrim("/my/test/prim", "Xform");
				stage.processLiveUpdates(); // send changes to the server; receive any changes and update the stage
			
Do no remove, this fixes the anchor on doc.flexsim.com

USD.Stage.reload()

int reload( )

Returns

int Whether or not the reload was successful. Returns 1 for success; otherwise 0.

Description

Reload the stage.


				USD.Stage stage = Model.find("USD Stage1");
				USD.Prim prim = stage.definePrim("/my/test/prim", "Xform");
				stage.reload(); // reverts changes to the stage
			
Do no remove, this fixes the anchor on doc.flexsim.com

USD.Stage.save()

Variant save( )

Returns

Variant Whether or not the save was successful. Returns 1 for success; otherwise 0.

Description

Save changes to the stage.

The .usd* file will be updated.

				USD.Stage stage = Model.find("USD Stage1");
				USD.Prim prim = stage.definePrim("/my/test/prim", "Xform");
				stage.save(); // saves the new prim to the stage