Help for file structure

Hello, I was trying to figure out if there was a way to structure a file like this:

#usda 1.0
(
    
    defaultPrim = "World"
    metersPerUnit = 0.01
    upAxis = "Y"
)

def "Geom"
{
	def Mesh "Plane"
    {
            int[] faceVertexCounts = [4]
            int[] faceVertexIndices = [0, 2, 3, 1]
            point3f[] points = [(-50, 0, -50), (50, 0, -50), (-50, 0, 50), (50, 0, 50)]
            uniform token[] xformOpOrder = ["xformOp:translate"]
        }
}

def Xform "World"
{
    def Mesh "Plane_01" (
        instanceable = true
        prepend references = </Geom/Plane>
    )
    {
        double3 xformOp:translate = (133, 0, 0)
        uniform token[] xformOpOrder = ["xformOp:translate"]
    }
	
	def Mesh "Plane_02" (
        instanceable = true
        prepend references = </Geom/Plane>
    )
    {
        double3 xformOp:translate = (266, 0, 0)
        uniform token[] xformOpOrder = ["xformOp:translate"]
    }
}

where I can define all my geometry in the “Geom” prim and instantiate when necessary. Right now this is the result in the viewer:


but I would like to hide the original geometry (and possibly also hide “Geom” from the hierarchy as well) and make all the instances visible, since right now they aren’t.
Thanks for the help!

There’s a few ways to do that, but the best way is make the ancestor of Plane a class. This marks that subgraph as “abstract” and it won’t be traversed (or imaged) by default.

You should also generally avoid instancing gprims directly, as instancing only applies to descendants of the instanceable prim.

# quick snippet of example structure.
class "instance_sources" {
     def Xform "Geom" {
           def Plane "plane" {}
     }
}

def "Plane_instance" (references = </instance_sources/Geom>
                                   instanceable = True) {
}
1 Like

Thank you! It works great now

I know Matthew solved this for you already, but just in case you are after some other examples with also how to apply edits on these prims, we are trying to finalize this as part of the official assets repo, so at the moment is in this fork-to-be-merged, but there could be useful examples hopefully.

And any feedback is more than welcome! :slight_smile: