Deactivating a prim in stage (Not deleting)

Hello,

I have an issue where I need to Deactivate a prim in my stage:

Where can I find the code that is called by the Deactivate option in the context menu? I need to implement this code in my extension.

Some backround into why I need this:

I have a main usd stage where I enable my extension. My extension then load a “template” which is just a template of a specific environment. I then create an Omnigraph with scatter a node in my code and run rundomization with an async loop and rep.orchestrator.

Then, once the simulation ren X frames, I load a new template and edit the input to my scatter nodes and start the async loop again. and so forth.

The issues:

  1. I cannot delete an “old template”. This is a bug with Omnigraph. Even though I changed the Input to scatter2dnode:input:SurfacePrim to the floor plane of the new template, I still cannot delete the previous input surface prim (which is inside the older template). If I do delete that plane then EVERYTHING brakes in my stage. If I click a prim in the stage I get a flooding or errors.

To handle this I simply set the visability of the older template to false.

  1. The issue with my solution to issue 1 is, That if I have two templates in my stage (regardless of visability) I get a flooding of the error:
    [Error] [omni.syntheticdata.plugin] OgnSdStageSemanticInstanceMapping missing filteredLabelMap semLabelMap in the history.

Why? because the “floor” plate in each template has many many grass instances that was created with the paint tool. each instance has a semantic label “grass”.
It turns out there is a limit on how many semantic instances you can have in a single stage.

So now we come to the third and final issue.

  1. Cannot delete the PaintTool prim of the older template:
    image

There for, I need to deactivate it.

Thank you,
Danielle

Update: after further investigating, I found that setting the PaintTool visability to false, is sufficient for the render product to ignore it’s children’s semantic labelings.
I am getting the [Error] [omni.syntheticdata.plugin] OgnSdStageSemanticInstanceMapping missing filteredLabelMap semLabelMap in the history error because I have too many labeled prims in my stage even with just one template (i get the error only after i enable my randomization extantion and more labeled prims are instantiated, on top of the template with the PaintTool grass).

I still need to know, how can I disable a prim with code. Thank you.