-
Notifications
You must be signed in to change notification settings - Fork 93
/
Copy pathmaterials.py
executable file
·37 lines (27 loc) · 1.24 KB
/
materials.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""This module demonstrates the deprecated way to query material bindings.
In short, don't use this. Check out `material_binding_api.py` for an
updated way to search for bound materials.
"""
# IMPORT THIRD-PARTY LIBRARIES
from pxr import Usd, UsdShade
def main():
"""Run the main execution of the current script."""
stage = Usd.Stage.Open("../usda/materials.usda")
# XXX : It looks as though the `GetBindingRel` and
# `GetBoundMaterial` work but only for the `material:binding`
# Relationship.
#
prim = stage.GetPrimAtPath("/Bob/Geom/Belt")
print('Found Prim "{}".'.format(UsdShade.Material.GetBoundMaterial(prim).GetPrim()))
print('Found Relationship "{}".'.format(UsdShade.Material.GetBindingRel(prim)))
# XXX : If you attempt to use them on a Prim with a material
# Property with different syntax, like `material:binding:full`,
# it'll just return back invalid Prim / Relationship information.
#
prim = stage.GetPrimAtPath("/Bob/Geom/Body")
print('Found Prim "{}".'.format(UsdShade.Material.GetBoundMaterial(prim).GetPrim()))
print('Found Relationship "{}".'.format(UsdShade.Material.GetBindingRel(prim)))
if __name__ == "__main__":
main()