Skip to content

Instantly share code, notes, and snippets.

@BigRoy
Created November 19, 2023 22:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save BigRoy/701e6ac542c21347bab9e75a0faa846a to your computer and use it in GitHub Desktop.
Save BigRoy/701e6ac542c21347bab9e75a0faa846a to your computer and use it in GitHub Desktop.
Get all registered prim types to create by a nice plug-in grouping
from pxr import Usd, Plug, Tf
from collections import defaultdict
NICE_NAMES = {
"usdGeom": "Geometry",
"usdLux": "Lighting",
"mayaUsd_Schemas": "Maya Reference",
"usdMedia": "Media",
"usdRender": "Render",
"usdRi": "RenderMan",
"usdShade": "Shading",
"usdSkel": "Skeleton",
"usdUI": "UI",
"usdVol": "Volumes",
"usdProc": "Procedural",
"usdPhysics": "Physics",
"usdArnold": "Arnold",
# Skip legacy AL schemas
"AL_USDMayaSchemasTest": "",
"AL_USDMayaSchemas": "",
}
plug_reg = Plug.Registry()
schema_reg = Usd.SchemaRegistry()
# Get schema types by plug-in group
types_by_group = defaultdict(list)
for t in plug_reg.GetAllDerivedTypes(Tf.Type.FindByName("UsdSchemaBase")):
if not schema_reg.IsConcrete(t):
continue
plugin = plug_reg.GetPluginForType(t)
if not plugin:
continue
plugin_name = plugin.name
plugin_name = NICE_NAMES.get(plugin_name, plugin_name)
# We don't list empty names. This allows hiding certain plugins too.
if not plugin_name:
continue
type_name = schema_reg.GetConcreteSchemaTypeName(t)
types_by_group[plugin_name].append(type_name)
# Sort and print
types_by_group = {key: sorted(value) for key, value in sorted(types_by_group.items())}
for group, types_names in types_by_group.items():
for type_name in types_names:
print(f"{group} > {type_name}")
@BigRoy
Copy link
Author

BigRoy commented Nov 19, 2023

Basically mimics behavior of this PR: Autodesk/maya-usd#1350

Example output of above snippet is:

Geometry > BasisCurves
Geometry > Camera
Geometry > Capsule
Geometry > Cone
Geometry > Cube
Geometry > Cylinder
Geometry > GeomSubset
Geometry > HermiteCurves
Geometry > Mesh
Geometry > NurbsCurves
Geometry > NurbsPatch
Geometry > Plane
Geometry > PointInstancer
Geometry > Points
Geometry > Scope
Geometry > Sphere
Geometry > Xform
Lighting > CylinderLight
Lighting > DiskLight
Lighting > DistantLight
Lighting > DomeLight
Lighting > GeometryLight
Lighting > LightFilter
Lighting > PluginLight
Lighting > PluginLightFilter
Lighting > PortalLight
Lighting > RectLight
Lighting > SphereLight
Maya Reference > ALMayaReference
Maya Reference > MayaReference
Media > SpatialAudio
Physics > PhysicsCollisionGroup
Physics > PhysicsDistanceJoint
Physics > PhysicsFixedJoint
Physics > PhysicsJoint
Physics > PhysicsPrismaticJoint
Physics > PhysicsRevoluteJoint
Physics > PhysicsScene
Physics > PhysicsSphericalJoint
Procedural > GenerativeProcedural
Render > RenderDenoisePass
Render > RenderPass
Render > RenderProduct
Render > RenderSettings
Render > RenderVar
Shading > Material
Shading > NodeGraph
Shading > Shader
Skeleton > BlendShape
Skeleton > PackedJointAnimation
Skeleton > SkelAnimation
Skeleton > SkelRoot
Skeleton > Skeleton
UI > Backdrop
Volumes > Field3DAsset
Volumes > OpenVDBAsset
Volumes > Volume

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment