Created
November 19, 2023 22:59
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Basically mimics behavior of this PR: Autodesk/maya-usd#1350
Example output of above snippet is: