File size: 143,594 Bytes
d8ab1df |
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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 |
UsdShade module — pxr-usd-api 105.1 documentation
pxr-usd-api
»
Modules »
UsdShade module
# UsdShade module
Summary: The UsdShade module provides schemas and behaviors for creating and binding materials, which encapsulate shading networks.
Classes:
AttributeType
ConnectableAPI
UsdShadeConnectableAPI is an API schema that provides a common interface for creating outputs and making connections between shading parameters and outputs.
ConnectionModification
ConnectionSourceInfo
A compact struct to represent a bundle of information about an upstream source attribute.
CoordSysAPI
UsdShadeCoordSysAPI provides a way to designate, name, and discover coordinate systems.
Input
This class encapsulates a shader or node-graph input, which is a connectable attribute representing a typed value.
Material
A Material provides a container into which multiple"render targets"can add data that defines a"shading material"for a renderer.
MaterialBindingAPI
UsdShadeMaterialBindingAPI is an API schema that provides an interface for binding materials to prims or collections of prims (represented by UsdCollectionAPI objects).
NodeDefAPI
UsdShadeNodeDefAPI is an API schema that provides attributes for a prim to select a corresponding Shader Node Definition ("Sdr Node"), as well as to look up a runtime entry for that shader node in the form of an SdrShaderNode.
NodeGraph
A node-graph is a container for shading nodes, as well as other node- graphs.
Output
This class encapsulates a shader or node-graph output, which is a connectable attribute representing a typed, externally computed value.
Shader
Base class for all USD shaders.
ShaderDefParserPlugin
Parses shader definitions represented using USD scene description using the schemas provided by UsdShade.
ShaderDefUtils
This class contains a set of utility functions used for populating the shader registry with shaders definitions specified using UsdShade schemas.
Tokens
Utils
This class contains a set of utility functions used when authoring and querying shading networks.
class pxr.UsdShade.AttributeType
Attributes:
Input
Invalid
Output
names
values
Input = pxr.UsdShade.AttributeType.Input
Invalid = pxr.UsdShade.AttributeType.Invalid
Output = pxr.UsdShade.AttributeType.Output
names = {'Input': pxr.UsdShade.AttributeType.Input, 'Invalid': pxr.UsdShade.AttributeType.Invalid, 'Output': pxr.UsdShade.AttributeType.Output}
values = {0: pxr.UsdShade.AttributeType.Invalid, 1: pxr.UsdShade.AttributeType.Input, 2: pxr.UsdShade.AttributeType.Output}
class pxr.UsdShade.ConnectableAPI
UsdShadeConnectableAPI is an API schema that provides a common
interface for creating outputs and making connections between shading
parameters and outputs. The interface is common to all UsdShade
schemas that support Inputs and Outputs, which currently includes
UsdShadeShader, UsdShadeNodeGraph, and UsdShadeMaterial.
One can construct a UsdShadeConnectableAPI directly from a UsdPrim, or
from objects of any of the schema classes listed above. If it seems
onerous to need to construct a secondary schema object to interact
with Inputs and Outputs, keep in mind that any function whose purpose
is either to walk material/shader networks via their connections, or
to create such networks, can typically be written entirely in terms of
UsdShadeConnectableAPI objects, without needing to care what the
underlying prim type is.
Additionally, the most common UsdShadeConnectableAPI behaviors
(creating Inputs and Outputs, and making connections) are wrapped as
convenience methods on the prim schema classes (creation) and
UsdShadeInput and UsdShadeOutput.
Methods:
CanConnect
classmethod CanConnect(input, source) -> bool
ClearSource
classmethod ClearSource(shadingAttr) -> bool
ClearSources
classmethod ClearSources(shadingAttr) -> bool
ConnectToSource
classmethod ConnectToSource(shadingAttr, source, mod) -> bool
CreateInput(name, typeName)
Create an input which can both have a value and be connected.
CreateOutput(name, typeName)
Create an output, which represents and externally computed, typed value.
DisconnectSource
classmethod DisconnectSource(shadingAttr, sourceAttr) -> bool
Get
classmethod Get(stage, path) -> ConnectableAPI
GetConnectedSource
classmethod GetConnectedSource(shadingAttr, source, sourceName, sourceType) -> bool
GetConnectedSources
classmethod GetConnectedSources(shadingAttr, invalidSourcePaths) -> list[UsdShadeSourceInfo]
GetInput(name)
Return the requested input if it exists.
GetInputs(onlyAuthored)
Returns all inputs on the connectable prim (i.e.
GetOutput(name)
Return the requested output if it exists.
GetOutputs(onlyAuthored)
Returns all outputs on the connectable prim (i.e.
GetRawConnectedSourcePaths
classmethod GetRawConnectedSourcePaths(shadingAttr, sourcePaths) -> bool
GetSchemaAttributeNames
classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken]
HasConnectableAPI
classmethod HasConnectableAPI(schemaType) -> bool
HasConnectedSource
classmethod HasConnectedSource(shadingAttr) -> bool
IsContainer()
Returns true if the prim is a container.
IsSourceConnectionFromBaseMaterial
classmethod IsSourceConnectionFromBaseMaterial(shadingAttr) -> bool
RequiresEncapsulation()
Returns true if container encapsulation rules should be respected when evaluating connectibility behavior, false otherwise.
SetConnectedSources
classmethod SetConnectedSources(shadingAttr, sourceInfos) -> bool
static CanConnect()
classmethod CanConnect(input, source) -> bool
Determines whether the given input can be connected to the given
source attribute, which can be an input or an output.
The result depends on the”connectability”of the input and the source
attributes. Depending on the prim type, this may require the plugin
that defines connectability behavior for that prim type be loaded.
UsdShadeInput::SetConnectability
UsdShadeInput::GetConnectability
Parameters
input (Input) –
source (Attribute) –
CanConnect(input, sourceInput) -> bool
This is an overloaded member function, provided for convenience. It
differs from the above function only in what argument(s) it accepts.
Parameters
input (Input) –
sourceInput (Input) –
CanConnect(input, sourceOutput) -> bool
This is an overloaded member function, provided for convenience. It
differs from the above function only in what argument(s) it accepts.
Parameters
input (Input) –
sourceOutput (Output) –
CanConnect(output, source) -> bool
Determines whether the given output can be connected to the given
source attribute, which can be an input or an output.
An output is considered to be connectable only if it belongs to a
node-graph. Shader outputs are not connectable.
source is an optional argument. If a valid UsdAttribute is
supplied for it, this method will return true only if the source
attribute is owned by a descendant of the node-graph owning the
output.
Parameters
output (Output) –
source (Attribute) –
CanConnect(output, sourceInput) -> bool
This is an overloaded member function, provided for convenience. It
differs from the above function only in what argument(s) it accepts.
Parameters
output (Output) –
sourceInput (Input) –
CanConnect(output, sourceOutput) -> bool
This is an overloaded member function, provided for convenience. It
differs from the above function only in what argument(s) it accepts.
Parameters
output (Output) –
sourceOutput (Output) –
static ClearSource()
classmethod ClearSource(shadingAttr) -> bool
Deprecated
This is the older version that only referenced a single source. Please
use ClearSources instead.
Parameters
shadingAttr (Attribute) –
ClearSource(input) -> bool
Deprecated
This is an overloaded member function, provided for convenience. It
differs from the above function only in what argument(s) it accepts.
Parameters
input (Input) –
ClearSource(output) -> bool
Deprecated
This is an overloaded member function, provided for convenience. It
differs from the above function only in what argument(s) it accepts.
Parameters
output (Output) –
static ClearSources()
classmethod ClearSources(shadingAttr) -> bool
Clears sources for this shading attribute in the current
UsdEditTarget.
Most of the time, what you probably want is DisconnectSource() rather
than this function.
DisconnectSource()
Parameters
shadingAttr (Attribute) –
ClearSources(input) -> bool
This is an overloaded member function, provided for convenience. It
differs from the above function only in what argument(s) it accepts.
Parameters
input (Input) –
ClearSources(output) -> bool
This is an overloaded member function, provided for convenience. It
differs from the above function only in what argument(s) it accepts.
Parameters
output (Output) –
static ConnectToSource()
classmethod ConnectToSource(shadingAttr, source, mod) -> bool
Authors a connection for a given shading attribute shadingAttr .
shadingAttr can represent a parameter, an input or an output.
source is a struct that describes the upstream source attribute
with all the information necessary to make a connection. See the
documentation for UsdShadeConnectionSourceInfo. mod describes the
operation that should be applied to the list of connections. By
default the new connection will replace any existing connections, but
it can add to the list of connections to represent multiple input
connections.
true if a connection was created successfully. false if
shadingAttr or source is invalid.
This method does not verify the connectability of the shading
attribute to the source. Clients must invoke CanConnect() themselves
to ensure compatibility.
The source shading attribute is created if it doesn’t exist already.
Parameters
shadingAttr (Attribute) –
source (ConnectionSourceInfo) –
mod (ConnectionModification) –
ConnectToSource(input, source, mod) -> bool
This is an overloaded member function, provided for convenience. It
differs from the above function only in what argument(s) it accepts.
Parameters
input (Input) –
source (ConnectionSourceInfo) –
mod (ConnectionModification) –
ConnectToSource(output, source, mod) -> bool
This is an overloaded member function, provided for convenience. It
differs from the above function only in what argument(s) it accepts.
Parameters
output (Output) –
source (ConnectionSourceInfo) –
mod (ConnectionModification) –
ConnectToSource(shadingAttr, source, sourceName, sourceType, typeName) -> bool
Deprecated
Please use the versions that take a UsdShadeConnectionSourceInfo to
describe the upstream source This is an overloaded member function,
provided for convenience. It differs from the above function only in
what argument(s) it accepts.
Parameters
shadingAttr (Attribute) –
source (ConnectableAPI) –
sourceName (str) –
sourceType (AttributeType) –
typeName (ValueTypeName) –
ConnectToSource(input, source, sourceName, sourceType, typeName) -> bool
Deprecated
This is an overloaded member function, provided for convenience. It
differs from the above function only in what argument(s) it accepts.
Parameters
input (Input) –
source (ConnectableAPI) –
sourceName (str) –
sourceType (AttributeType) –
typeName (ValueTypeName) –
ConnectToSource(output, source, sourceName, sourceType, typeName) -> bool
Deprecated
This is an overloaded member function, provided for convenience. It
differs from the above function only in what argument(s) it accepts.
Parameters
output (Output) –
source (ConnectableAPI) –
sourceName (str) –
sourceType (AttributeType) –
typeName (ValueTypeName) –
ConnectToSource(shadingAttr, sourcePath) -> bool
This is an overloaded member function, provided for convenience. It
differs from the above function only in what argument(s) it accepts.
Connect the given shading attribute to the source at path,
sourcePath .
sourcePath should be the fully namespaced property path.
This overload is provided for convenience, for use in contexts where
the prim types are unknown or unavailable.
Parameters
shadingAttr (Attribute) –
sourcePath (Path) –
ConnectToSource(input, sourcePath) -> bool
This is an overloaded member function, provided for convenience. It
differs from the above function only in what argument(s) it accepts.
Parameters
input (Input) –
sourcePath (Path) –
ConnectToSource(output, sourcePath) -> bool
This is an overloaded member function, provided for convenience. It
differs from the above function only in what argument(s) it accepts.
Parameters
output (Output) –
sourcePath (Path) –
ConnectToSource(shadingAttr, sourceInput) -> bool
This is an overloaded member function, provided for convenience. It
differs from the above function only in what argument(s) it accepts.
Connect the given shading attribute to the given source input.
Parameters
shadingAttr (Attribute) –
sourceInput (Input) –
ConnectToSource(input, sourceInput) -> bool
This is an overloaded member function, provided for convenience. It
differs from the above function only in what argument(s) it accepts.
Parameters
input (Input) –
sourceInput (Input) –
ConnectToSource(output, sourceInput) -> bool
This is an overloaded member function, provided for convenience. It
differs from the above function only in what argument(s) it accepts.
Parameters
output (Output) –
sourceInput (Input) –
ConnectToSource(shadingAttr, sourceOutput) -> bool
This is an overloaded member function, provided for convenience. It
differs from the above function only in what argument(s) it accepts.
Connect the given shading attribute to the given source output.
Parameters
shadingAttr (Attribute) –
sourceOutput (Output) –
ConnectToSource(input, sourceOutput) -> bool
This is an overloaded member function, provided for convenience. It
differs from the above function only in what argument(s) it accepts.
Parameters
input (Input) –
sourceOutput (Output) –
ConnectToSource(output, sourceOutput) -> bool
This is an overloaded member function, provided for convenience. It
differs from the above function only in what argument(s) it accepts.
Parameters
output (Output) –
sourceOutput (Output) –
CreateInput(name, typeName) → Input
Create an input which can both have a value and be connected.
The attribute representing the input is created in
the”inputs:”namespace.
Parameters
name (str) –
typeName (ValueTypeName) –
CreateOutput(name, typeName) → Output
Create an output, which represents and externally computed, typed
value.
Outputs on node-graphs can be connected.
The attribute representing an output is created in
the”outputs:”namespace.
Parameters
name (str) –
typeName (ValueTypeName) –
static DisconnectSource()
classmethod DisconnectSource(shadingAttr, sourceAttr) -> bool
Disconnect source for this shading attribute.
If sourceAttr is valid it will disconnect the connection to this
upstream attribute. Otherwise it will disconnect all connections by
authoring an empty list of connections for the attribute
shadingAttr .
This may author more scene description than you might expect - we
define the behavior of disconnect to be that, even if a shading
attribute becomes connected in a weaker layer than the current
UsdEditTarget, the attribute will still be disconnected in the
composition, therefore we must”block”it in the current UsdEditTarget.
ConnectToSource() .
Parameters
shadingAttr (Attribute) –
sourceAttr (Attribute) –
DisconnectSource(input, sourceAttr) -> bool
This is an overloaded member function, provided for convenience. It
differs from the above function only in what argument(s) it accepts.
Parameters
input (Input) –
sourceAttr (Attribute) –
DisconnectSource(output, sourceAttr) -> bool
This is an overloaded member function, provided for convenience. It
differs from the above function only in what argument(s) it accepts.
Parameters
output (Output) –
sourceAttr (Attribute) –
static Get()
classmethod Get(stage, path) -> ConnectableAPI
Return a UsdShadeConnectableAPI holding the prim adhering to this
schema at path on stage .
If no prim exists at path on stage , or if the prim at that
path does not adhere to this schema, return an invalid schema object.
This is shorthand for the following:
UsdShadeConnectableAPI(stage->GetPrimAtPath(path));
Parameters
stage (Stage) –
path (Path) –
static GetConnectedSource()
classmethod GetConnectedSource(shadingAttr, source, sourceName, sourceType) -> bool
Deprecated
Shading attributes can have multiple connections and so using
GetConnectedSources is needed in general
Finds the source of a connection for the given shading attribute.
shadingAttr is the shading attribute whose connection we want to
interrogate. source is an output parameter which will be set to
the source connectable prim. sourceName will be set to the name of
the source shading attribute, which may be an input or an output, as
specified by sourceType sourceType will have the type of the
source shading attribute, i.e. whether it is an Input or
Output
true if the shading attribute is connected to a valid, defined
source attribute. false if the shading attribute is not connected
to a single, defined source attribute.
Previously this method would silently return false for multiple
connections. We are changing the behavior of this method to return the
result for the first connection and issue a TfWarn about it. We want
to encourage clients to use GetConnectedSources going forward.
The python wrapping for this method returns a (source, sourceName,
sourceType) tuple if the parameter is connected, else None
Parameters
shadingAttr (Attribute) –
source (ConnectableAPI) –
sourceName (str) –
sourceType (AttributeType) –
GetConnectedSource(input, source, sourceName, sourceType) -> bool
Deprecated
This is an overloaded member function, provided for convenience. It
differs from the above function only in what argument(s) it accepts.
Parameters
input (Input) –
source (ConnectableAPI) –
sourceName (str) –
sourceType (AttributeType) –
GetConnectedSource(output, source, sourceName, sourceType) -> bool
Deprecated
This is an overloaded member function, provided for convenience. It
differs from the above function only in what argument(s) it accepts.
Parameters
output (Output) –
source (ConnectableAPI) –
sourceName (str) –
sourceType (AttributeType) –
static GetConnectedSources()
classmethod GetConnectedSources(shadingAttr, invalidSourcePaths) -> list[UsdShadeSourceInfo]
Finds the valid sources of connections for the given shading
attribute.
shadingAttr is the shading attribute whose connections we want to
interrogate. invalidSourcePaths is an optional output parameter to
collect the invalid source paths that have not been reported in the
returned vector.
Returns a vector of UsdShadeConnectionSourceInfo structs with
information about each upsteam attribute. If the vector is empty,
there have been no connections.
A valid connection requires the existence of the source attribute and
also requires that the source prim is UsdShadeConnectableAPI
compatible.
The python wrapping returns a tuple with the valid connections first,
followed by the invalid source paths.
Parameters
shadingAttr (Attribute) –
invalidSourcePaths (list[SdfPath]) –
GetConnectedSources(input, invalidSourcePaths) -> list[UsdShadeSourceInfo]
This is an overloaded member function, provided for convenience. It
differs from the above function only in what argument(s) it accepts.
Parameters
input (Input) –
invalidSourcePaths (list[SdfPath]) –
GetConnectedSources(output, invalidSourcePaths) -> list[UsdShadeSourceInfo]
This is an overloaded member function, provided for convenience. It
differs from the above function only in what argument(s) it accepts.
Parameters
output (Output) –
invalidSourcePaths (list[SdfPath]) –
GetInput(name) → Input
Return the requested input if it exists.
name is the unnamespaced base name.
Parameters
name (str) –
GetInputs(onlyAuthored) → list[Input]
Returns all inputs on the connectable prim (i.e.
shader or node-graph). Inputs are represented by attributes in
the”inputs:”namespace. If onlyAuthored is true (the default), then
only return authored attributes; otherwise, this also returns un-
authored builtins.
Parameters
onlyAuthored (bool) –
GetOutput(name) → Output
Return the requested output if it exists.
name is the unnamespaced base name.
Parameters
name (str) –
GetOutputs(onlyAuthored) → list[Output]
Returns all outputs on the connectable prim (i.e.
shader or node-graph). Outputs are represented by attributes in
the”outputs:”namespace. If onlyAuthored is true (the default),
then only return authored attributes; otherwise, this also returns un-
authored builtins.
Parameters
onlyAuthored (bool) –
static GetRawConnectedSourcePaths()
classmethod GetRawConnectedSourcePaths(shadingAttr, sourcePaths) -> bool
Deprecated
Please us GetConnectedSources to retrieve multiple connections
Returns the”raw”(authored) connected source paths for the given
shading attribute.
Parameters
shadingAttr (Attribute) –
sourcePaths (list[SdfPath]) –
GetRawConnectedSourcePaths(input, sourcePaths) -> bool
Deprecated
This is an overloaded member function, provided for convenience. It
differs from the above function only in what argument(s) it accepts.
Parameters
input (Input) –
sourcePaths (list[SdfPath]) –
GetRawConnectedSourcePaths(output, sourcePaths) -> bool
Deprecated
This is an overloaded member function, provided for convenience. It
differs from the above function only in what argument(s) it accepts.
Parameters
output (Output) –
sourcePaths (list[SdfPath]) –
static GetSchemaAttributeNames()
classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken]
Return a vector of names of all pre-declared attributes for this
schema class and all its ancestor classes.
Does not include attributes that may be authored by custom/extended
methods of the schemas involved.
Parameters
includeInherited (bool) –
static HasConnectableAPI()
classmethod HasConnectableAPI(schemaType) -> bool
Return true if the schemaType has a valid connectableAPIBehavior
registered, false otherwise.
To check if a prim’s connectableAPI has a behavior defined, use
UsdSchemaBase::operator bool() .
Parameters
schemaType (Type) –
HasConnectableAPI() -> bool
Return true if the schema type T has a connectableAPIBehavior
registered, false otherwise.
static HasConnectedSource()
classmethod HasConnectedSource(shadingAttr) -> bool
Returns true if and only if the shading attribute is currently
connected to at least one valid (defined) source.
If you will be calling GetConnectedSources() afterwards anyways, it
will be much faster to instead check if the returned vector is
empty:
UsdShadeSourceInfoVector connections =
UsdShadeConnectableAPI::GetConnectedSources(attribute);
if (!connections.empty()){
// process connected attribute
} else {
// process unconnected attribute
}
Parameters
shadingAttr (Attribute) –
HasConnectedSource(input) -> bool
This is an overloaded member function, provided for convenience. It
differs from the above function only in what argument(s) it accepts.
Parameters
input (Input) –
HasConnectedSource(output) -> bool
This is an overloaded member function, provided for convenience. It
differs from the above function only in what argument(s) it accepts.
Parameters
output (Output) –
IsContainer() → bool
Returns true if the prim is a container.
The underlying prim type may provide runtime behavior that defines
whether it is a container.
static IsSourceConnectionFromBaseMaterial()
classmethod IsSourceConnectionFromBaseMaterial(shadingAttr) -> bool
Returns true if the connection to the given shading attribute’s
source, as returned by UsdShadeConnectableAPI::GetConnectedSource() ,
is authored across a specializes arc, which is used to denote a base
material.
Parameters
shadingAttr (Attribute) –
IsSourceConnectionFromBaseMaterial(input) -> bool
This is an overloaded member function, provided for convenience. It
differs from the above function only in what argument(s) it accepts.
Parameters
input (Input) –
IsSourceConnectionFromBaseMaterial(output) -> bool
This is an overloaded member function, provided for convenience. It
differs from the above function only in what argument(s) it accepts.
Parameters
output (Output) –
RequiresEncapsulation() → bool
Returns true if container encapsulation rules should be respected when
evaluating connectibility behavior, false otherwise.
The underlying prim type may provide runtime behavior that defines if
encapsulation rules are respected or not.
static SetConnectedSources()
classmethod SetConnectedSources(shadingAttr, sourceInfos) -> bool
Authors a list of connections for a given shading attribute
shadingAttr .
shadingAttr can represent a parameter, an input or an output.
sourceInfos is a vector of structs that describes the upstream
source attributes with all the information necessary to make all the
connections. See the documentation for UsdShadeConnectionSourceInfo.
true if all connection were created successfully. false if the
shadingAttr or one of the sources are invalid.
A valid connection is one that has a valid
UsdShadeConnectionSourceInfo , which requires the existence of the
upstream source prim. It does not require the existence of the source
attribute as it will be create if necessary.
Parameters
shadingAttr (Attribute) –
sourceInfos (list[ConnectionSourceInfo]) –
class pxr.UsdShade.ConnectionModification
Attributes:
Append
Prepend
Replace
names
values
Append = pxr.UsdShade.ConnectionModification.Append
Prepend = pxr.UsdShade.ConnectionModification.Prepend
Replace = pxr.UsdShade.ConnectionModification.Replace
names = {'Append': pxr.UsdShade.ConnectionModification.Append, 'Prepend': pxr.UsdShade.ConnectionModification.Prepend, 'Replace': pxr.UsdShade.ConnectionModification.Replace}
values = {0: pxr.UsdShade.ConnectionModification.Replace, 1: pxr.UsdShade.ConnectionModification.Prepend, 2: pxr.UsdShade.ConnectionModification.Append}
class pxr.UsdShade.ConnectionSourceInfo
A compact struct to represent a bundle of information about an
upstream source attribute.
Methods:
IsValid()
Return true if this source info is valid for setting up a connection.
Attributes:
source
sourceName
sourceType
typeName
IsValid() → bool
Return true if this source info is valid for setting up a connection.
property source
property sourceName
property sourceType
property typeName
class pxr.UsdShade.CoordSysAPI
UsdShadeCoordSysAPI provides a way to designate, name, and discover
coordinate systems.
Coordinate systems are implicitly established by UsdGeomXformable
prims, using their local space. That coordinate system may be bound
(i.e., named) from another prim. The binding is encoded as a single-
target relationship in the”coordSys:”namespace. Coordinate system
bindings apply to descendants of the prim where the binding is
expressed, but names may be re-bound by descendant prims.
Named coordinate systems are useful in shading workflows. An example
is projection paint, which projects a texture from a certain view (the
paint coordinate system). Using the paint coordinate frame avoids the
need to assign a UV set to the object, and can be a concise way to
project paint across a collection of objects with a single shared
paint coordinate system.
This is a non-applied API schema.
Methods:
Bind(name, path)
Bind the name to the given path.
BlockBinding(name)
Block the indicated coordinate system binding on this prim by blocking targets on the underlying relationship.
CanContainPropertyName
classmethod CanContainPropertyName(name) -> bool
ClearBinding(name, removeSpec)
Clear the indicated coordinate system binding on this prim from the current edit target.
FindBindingsWithInheritance()
Find the list of coordinate system bindings that apply to this prim, including inherited bindings.
Get
classmethod Get(stage, path) -> CoordSysAPI
GetCoordSysRelationshipName
classmethod GetCoordSysRelationshipName(coordSysName) -> str
GetLocalBindings()
Get the list of coordinate system bindings local to this prim.
GetSchemaAttributeNames
classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken]
HasLocalBindings()
Returns true if the prim has local coordinate system binding opinions.
Bind(name, path) → bool
Bind the name to the given path.
The prim at the given path is expected to be UsdGeomXformable, in
order for the binding to be succesfully resolved.
Parameters
name (str) –
path (Path) –
BlockBinding(name) → bool
Block the indicated coordinate system binding on this prim by blocking
targets on the underlying relationship.
Parameters
name (str) –
static CanContainPropertyName()
classmethod CanContainPropertyName(name) -> bool
Test whether a given name contains the”coordSys:”prefix.
Parameters
name (str) –
ClearBinding(name, removeSpec) → bool
Clear the indicated coordinate system binding on this prim from the
current edit target.
Only remove the spec if removeSpec is true (leave the spec to
preserve meta-data we may have intentionally authored on the
relationship)
Parameters
name (str) –
removeSpec (bool) –
FindBindingsWithInheritance() → list[Binding]
Find the list of coordinate system bindings that apply to this prim,
including inherited bindings.
This computation examines this prim and ancestors for the strongest
binding for each name. A binding expressed by a child prim supercedes
bindings on ancestors.
Note that this API does not validate the prims at the target paths;
they may be of incorrect type, or missing entirely.
Binding relationships with no resolved targets are skipped.
static Get()
classmethod Get(stage, path) -> CoordSysAPI
Return a UsdShadeCoordSysAPI holding the prim adhering to this schema
at path on stage .
If no prim exists at path on stage , or if the prim at that
path does not adhere to this schema, return an invalid schema object.
This is shorthand for the following:
UsdShadeCoordSysAPI(stage->GetPrimAtPath(path));
Parameters
stage (Stage) –
path (Path) –
static GetCoordSysRelationshipName()
classmethod GetCoordSysRelationshipName(coordSysName) -> str
Returns the fully namespaced coordinate system relationship name,
given the coordinate system name.
Parameters
coordSysName (str) –
GetLocalBindings() → list[Binding]
Get the list of coordinate system bindings local to this prim.
This does not process inherited bindings. It does not validate that a
prim exists at the indicated path. If the binding relationship has
multiple targets, only the first is used.
static GetSchemaAttributeNames()
classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken]
Return a vector of names of all pre-declared attributes for this
schema class and all its ancestor classes.
Does not include attributes that may be authored by custom/extended
methods of the schemas involved.
Parameters
includeInherited (bool) –
HasLocalBindings() → bool
Returns true if the prim has local coordinate system binding opinions.
Note that the resulting binding list may still be empty.
class pxr.UsdShade.Input
This class encapsulates a shader or node-graph input, which is a
connectable attribute representing a typed value.
Methods:
CanConnect(source)
Determines whether this Input can be connected to the given source attribute, which can be an input or an output.
ClearConnectability()
Clears any authored connectability on the Input.
ClearSdrMetadata()
Clears any"sdrMetadata"value authored on the Input in the current EditTarget.
ClearSdrMetadataByKey(key)
Clears the entry corresponding to the given key in the"sdrMetadata"dictionary authored in the current EditTarget.
ClearSource()
Deprecated
ClearSources()
Clears sources for this Input in the current UsdEditTarget.
ConnectToSource(source, mod)
Authors a connection for this Input.
DisconnectSource(sourceAttr)
Disconnect source for this Input.
Get(value, time)
Convenience wrapper for the templated UsdAttribute::Get() .
GetAttr()
Explicit UsdAttribute extractor.
GetBaseName()
Returns the name of the input.
GetConnectability()
Returns the connectability of the Input.
GetConnectedSource(source, sourceName, ...)
Deprecated
GetConnectedSources(invalidSourcePaths)
Finds the valid sources of connections for the Input.
GetDisplayGroup()
Get the displayGroup metadata for this Input, i.e.
GetDocumentation()
Get documentation string for this Input.
GetFullName()
Get the name of the attribute associated with the Input.
GetPrim()
Get the prim that the input belongs to.
GetRawConnectedSourcePaths(sourcePaths)
Deprecated
GetRenderType()
Return this Input's specialized renderType, or an empty token if none was authored.
GetSdrMetadata()
Returns this Input's composed"sdrMetadata"dictionary as a NdrTokenMap.
GetSdrMetadataByKey(key)
Returns the value corresponding to key in the composed sdrMetadata dictionary.
GetTypeName()
Get the"scene description"value type name of the attribute associated with the Input.
GetValueProducingAttribute(attrType)
Deprecated
GetValueProducingAttributes(shaderOutputsOnly)
Find what is connected to this Input recursively.
HasConnectedSource()
Returns true if and only if this Input is currently connected to a valid (defined) source.
HasRenderType()
Return true if a renderType has been specified for this Input.
HasSdrMetadata()
Returns true if the Input has a non-empty composed"sdrMetadata"dictionary value.
HasSdrMetadataByKey(key)
Returns true if there is a value corresponding to the given key in the composed"sdrMetadata"dictionary.
IsInput
classmethod IsInput(attr) -> bool
IsInterfaceInputName
classmethod IsInterfaceInputName(name) -> bool
IsSourceConnectionFromBaseMaterial()
Returns true if the connection to this Input's source, as returned by GetConnectedSource() , is authored across a specializes arc, which is used to denote a base material.
Set(value, time)
Set a value for the Input at time .
SetConnectability(connectability)
Set the connectability of the Input.
SetConnectedSources(sourceInfos)
Connects this Input to the given sources, sourceInfos .
SetDisplayGroup(displayGroup)
Set the displayGroup metadata for this Input, i.e.
SetDocumentation(docs)
Set documentation string for this Input.
SetRenderType(renderType)
Specify an alternative, renderer-specific type to use when emitting/translating this Input, rather than translating based on its GetTypeName()
SetSdrMetadata(sdrMetadata)
Authors the given sdrMetadata value on this Input at the current EditTarget.
SetSdrMetadataByKey(key, value)
Sets the value corresponding to key to the given string value , in the Input's"sdrMetadata"dictionary at the current EditTarget.
CanConnect(source) → bool
Determines whether this Input can be connected to the given source
attribute, which can be an input or an output.
UsdShadeConnectableAPI::CanConnect
Parameters
source (Attribute) –
CanConnect(sourceInput) -> bool
This is an overloaded member function, provided for convenience. It
differs from the above function only in what argument(s) it accepts.
Parameters
sourceInput (Input) –
CanConnect(sourceOutput) -> bool
This is an overloaded member function, provided for convenience. It
differs from the above function only in what argument(s) it accepts.
Parameters
sourceOutput (Output) –
ClearConnectability() → bool
Clears any authored connectability on the Input.
ClearSdrMetadata() → None
Clears any”sdrMetadata”value authored on the Input in the current
EditTarget.
ClearSdrMetadataByKey(key) → None
Clears the entry corresponding to the given key in
the”sdrMetadata”dictionary authored in the current EditTarget.
Parameters
key (str) –
ClearSource() → bool
Deprecated
ClearSources() → bool
Clears sources for this Input in the current UsdEditTarget.
Most of the time, what you probably want is DisconnectSource() rather
than this function.
UsdShadeConnectableAPI::ClearSources
ConnectToSource(source, mod) → bool
Authors a connection for this Input.
source is a struct that describes the upstream source attribute
with all the information necessary to make a connection. See the
documentation for UsdShadeConnectionSourceInfo. mod describes the
operation that should be applied to the list of connections. By
default the new connection will replace any existing connections, but
it can add to the list of connections to represent multiple input
connections.
true if a connection was created successfully. false if this
input or source is invalid.
This method does not verify the connectability of the shading
attribute to the source. Clients must invoke CanConnect() themselves
to ensure compatibility.
The source shading attribute is created if it doesn’t exist already.
UsdShadeConnectableAPI::ConnectToSource
Parameters
source (ConnectionSourceInfo) –
mod (ConnectionModification) –
ConnectToSource(source, sourceName, sourceType, typeName) -> bool
Deprecated
This is an overloaded member function, provided for convenience. It
differs from the above function only in what argument(s) it accepts.
Parameters
source (ConnectableAPI) –
sourceName (str) –
sourceType (AttributeType) –
typeName (ValueTypeName) –
ConnectToSource(sourcePath) -> bool
Authors a connection for this Input to the source at the given path.
UsdShadeConnectableAPI::ConnectToSource
Parameters
sourcePath (Path) –
ConnectToSource(sourceInput) -> bool
Connects this Input to the given input, sourceInput .
UsdShadeConnectableAPI::ConnectToSource
Parameters
sourceInput (Input) –
ConnectToSource(sourceOutput) -> bool
Connects this Input to the given output, sourceOutput .
UsdShadeConnectableAPI::ConnectToSource
Parameters
sourceOutput (Output) –
DisconnectSource(sourceAttr) → bool
Disconnect source for this Input.
If sourceAttr is valid, only a connection to the specified
attribute is disconnected, otherwise all connections are removed.
UsdShadeConnectableAPI::DisconnectSource
Parameters
sourceAttr (Attribute) –
Get(value, time) → bool
Convenience wrapper for the templated UsdAttribute::Get() .
Parameters
value (T) –
time (TimeCode) –
Get(value, time) -> bool
Convenience wrapper for VtValue version of UsdAttribute::Get() .
Parameters
value (VtValue) –
time (TimeCode) –
GetAttr() → Attribute
Explicit UsdAttribute extractor.
GetBaseName() → str
Returns the name of the input.
We call this the base name since it strips off the”inputs:”namespace
prefix from the attribute name, and returns it.
GetConnectability() → str
Returns the connectability of the Input.
SetConnectability()
GetConnectedSource(source, sourceName, sourceType) → bool
Deprecated
Parameters
source (ConnectableAPI) –
sourceName (str) –
sourceType (AttributeType) –
GetConnectedSources(invalidSourcePaths) → list[SourceInfo]
Finds the valid sources of connections for the Input.
invalidSourcePaths is an optional output parameter to collect the
invalid source paths that have not been reported in the returned
vector.
Returns a vector of UsdShadeConnectionSourceInfo structs with
information about each upsteam attribute. If the vector is empty,
there have been no valid connections.
A valid connection requires the existence of the source attribute and
also requires that the source prim is UsdShadeConnectableAPI
compatible.
The python wrapping returns a tuple with the valid connections first,
followed by the invalid source paths.
UsdShadeConnectableAPI::GetConnectedSources
Parameters
invalidSourcePaths (list[SdfPath]) –
GetDisplayGroup() → str
Get the displayGroup metadata for this Input, i.e.
hint for the location and nesting of the attribute.
UsdProperty::GetDisplayGroup() , UsdProperty::GetNestedDisplayGroup()
GetDocumentation() → str
Get documentation string for this Input.
UsdObject::GetDocumentation()
GetFullName() → str
Get the name of the attribute associated with the Input.
GetPrim() → Prim
Get the prim that the input belongs to.
GetRawConnectedSourcePaths(sourcePaths) → bool
Deprecated
Returns the”raw”(authored) connected source paths for this Input.
UsdShadeConnectableAPI::GetRawConnectedSourcePaths
Parameters
sourcePaths (list[SdfPath]) –
GetRenderType() → str
Return this Input’s specialized renderType, or an empty token if none
was authored.
SetRenderType()
GetSdrMetadata() → NdrTokenMap
Returns this Input’s composed”sdrMetadata”dictionary as a NdrTokenMap.
GetSdrMetadataByKey(key) → str
Returns the value corresponding to key in the composed
sdrMetadata dictionary.
Parameters
key (str) –
GetTypeName() → ValueTypeName
Get the”scene description”value type name of the attribute associated
with the Input.
GetValueProducingAttribute(attrType) → Attribute
Deprecated
in favor of calling GetValueProducingAttributes
Parameters
attrType (AttributeType) –
GetValueProducingAttributes(shaderOutputsOnly) → list[UsdShadeAttribute]
Find what is connected to this Input recursively.
UsdShadeUtils::GetValueProducingAttributes
Parameters
shaderOutputsOnly (bool) –
HasConnectedSource() → bool
Returns true if and only if this Input is currently connected to a
valid (defined) source.
UsdShadeConnectableAPI::HasConnectedSource
HasRenderType() → bool
Return true if a renderType has been specified for this Input.
SetRenderType()
HasSdrMetadata() → bool
Returns true if the Input has a non-empty
composed”sdrMetadata”dictionary value.
HasSdrMetadataByKey(key) → bool
Returns true if there is a value corresponding to the given key in
the composed”sdrMetadata”dictionary.
Parameters
key (str) –
static IsInput()
classmethod IsInput(attr) -> bool
Test whether a given UsdAttribute represents a valid Input, which
implies that creating a UsdShadeInput from the attribute will succeed.
Success implies that attr.IsDefined() is true.
Parameters
attr (Attribute) –
static IsInterfaceInputName()
classmethod IsInterfaceInputName(name) -> bool
Test if this name has a namespace that indicates it could be an input.
Parameters
name (str) –
IsSourceConnectionFromBaseMaterial() → bool
Returns true if the connection to this Input’s source, as returned by
GetConnectedSource() , is authored across a specializes arc, which is
used to denote a base material.
UsdShadeConnectableAPI::IsSourceConnectionFromBaseMaterial
Set(value, time) → bool
Set a value for the Input at time .
Parameters
value (VtValue) –
time (TimeCode) –
Set(value, time) -> bool
This is an overloaded member function, provided for convenience. It
differs from the above function only in what argument(s) it accepts.
Set a value of the Input at time .
Parameters
value (T) –
time (TimeCode) –
SetConnectability(connectability) → bool
Set the connectability of the Input.
In certain shading data models, there is a need to distinguish which
inputs can vary over a surface from those that must be
uniform. This is accomplished in UsdShade by limiting the
connectability of the input. This is done by setting
the”connectability”metadata on the associated attribute.
Connectability of an Input can be set to UsdShadeTokens->full or
UsdShadeTokens->interfaceOnly.
full implies that the Input can be connected to any other
Input or Output.
interfaceOnly implies that the Input can only be connected to
a NodeGraph Input (which represents an interface override, not a
render-time dataflow connection), or another Input whose
connectability is also”interfaceOnly”.
The default connectability of an input is UsdShadeTokens->full.
SetConnectability()
Parameters
connectability (str) –
SetConnectedSources(sourceInfos) → bool
Connects this Input to the given sources, sourceInfos .
UsdShadeConnectableAPI::SetConnectedSources
Parameters
sourceInfos (list[ConnectionSourceInfo]) –
SetDisplayGroup(displayGroup) → bool
Set the displayGroup metadata for this Input, i.e.
hinting for the location and nesting of the attribute.
Note for an input representing a nested SdrShaderProperty, its
expected to have the scope delimited by a”:”.
UsdProperty::SetDisplayGroup() , UsdProperty::SetNestedDisplayGroup()
SdrShaderProperty::GetPage()
Parameters
displayGroup (str) –
SetDocumentation(docs) → bool
Set documentation string for this Input.
UsdObject::SetDocumentation()
Parameters
docs (str) –
SetRenderType(renderType) → bool
Specify an alternative, renderer-specific type to use when
emitting/translating this Input, rather than translating based on its
GetTypeName()
For example, we set the renderType to”struct”for Inputs that are of
renderman custom struct types.
true on success.
Parameters
renderType (str) –
SetSdrMetadata(sdrMetadata) → None
Authors the given sdrMetadata value on this Input at the current
EditTarget.
Parameters
sdrMetadata (NdrTokenMap) –
SetSdrMetadataByKey(key, value) → None
Sets the value corresponding to key to the given string value
, in the Input’s”sdrMetadata”dictionary at the current EditTarget.
Parameters
key (str) –
value (str) –
class pxr.UsdShade.Material
A Material provides a container into which multiple”render targets”can
add data that defines a”shading material”for a renderer. Typically
this consists of one or more UsdRelationship properties that target
other prims of type Shader - though a target/client is free to add
any data that is suitable. We strongly advise that all targets
adopt the convention that all properties be prefixed with a namespace
that identifies the target, e.g.”rel ri:surface =</Shaders/mySurf>”.
In the UsdShading model, geometry expresses a binding to a single
Material or to a set of Materials partitioned by UsdGeomSubsets
defined beneath the geometry; it is legal to bind a Material at the
root (or other sub-prim) of a model, and then bind a different
Material to individual gprims, but the meaning of inheritance
and”ancestral overriding”of Material bindings is left to each render-
target to determine. Since UsdGeom has no concept of shading, we
provide the API for binding and unbinding geometry on the API schema
UsdShadeMaterialBindingAPI.
The entire power of USD VariantSets and all the other composition
operators can leveraged when encoding shading variation.
UsdShadeMaterial provides facilities for a particular way of
building”Material variants”in which neither the identity of the
Materials themselves nor the geometry Material-bindings need to change
- instead we vary the targeted networks, interface values, and even
parameter values within a single variantSet. See Authoring Material
Variations for more details.
UsdShade requires that all of the shaders that”belong”to the Material
live under the Material in namespace. This supports powerful, easy
reuse of Materials, because it allows us to reference a Material
from one asset (the asset might be a module of Materials) into
another asset: USD references compose all descendant prims of the
reference target into the referencer’s namespace, which means that all
of the referenced Material’s shader networks will come along with the
Material. When referenced in this way, Materials can also be
instanced, for ease of deduplication and compactness. Finally,
Material encapsulation also allows us to specialize child materials
from parent materials.
For any described attribute Fallback Value or Allowed Values
below that are text/tokens, the actual token is published and defined
in UsdShadeTokens. So to set an attribute to the value”rightHanded”,
use UsdShadeTokens->rightHanded as the value.
Methods:
ClearBaseMaterial()
Clear the base Material of this Material.
ComputeDisplacementSource(renderContext, ...)
Deprecated
ComputeSurfaceSource(renderContext, ...)
Deprecated
ComputeVolumeSource(renderContext, ...)
Deprecated
CreateDisplacementAttr(defaultValue, ...)
See GetDisplacementAttr() , and also Create vs Get Property Methods for when to use Get vs Create.
CreateDisplacementOutput(renderContext)
Creates and returns the"displacement"output on this material for the specified renderContext .
CreateMasterMaterialVariant
classmethod CreateMasterMaterialVariant(masterPrim, MaterialPrims, masterVariantSetName) -> bool
CreateSurfaceAttr(defaultValue, writeSparsely)
See GetSurfaceAttr() , and also Create vs Get Property Methods for when to use Get vs Create.
CreateSurfaceOutput(renderContext)
Creates and returns the"surface"output on this material for the specified renderContext .
CreateVolumeAttr(defaultValue, writeSparsely)
See GetVolumeAttr() , and also Create vs Get Property Methods for when to use Get vs Create.
CreateVolumeOutput(renderContext)
Creates and returns the"volume"output on this material for the specified renderContext .
Define
classmethod Define(stage, path) -> Material
Get
classmethod Get(stage, path) -> Material
GetBaseMaterial()
Get the path to the base Material of this Material.
GetBaseMaterialPath()
Get the base Material of this Material.
GetDisplacementAttr()
Represents the universal"displacement"output terminal of a material.
GetDisplacementOutput(renderContext)
Returns the"displacement"output of this material for the specified renderContext.
GetDisplacementOutputs()
Returns the"displacement"outputs of this material for all available renderContexts.
GetEditContextForVariant(...)
Helper function for configuring a UsdStage 's UsdEditTarget to author Material variations.
GetMaterialVariant()
Return a UsdVariantSet object for interacting with the Material variant variantSet.
GetSchemaAttributeNames
classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken]
GetSurfaceAttr()
Represents the universal"surface"output terminal of a material.
GetSurfaceOutput(renderContext)
Returns the"surface"output of this material for the specified renderContext .
GetSurfaceOutputs()
Returns the"surface"outputs of this material for all available renderContexts.
GetVolumeAttr()
Represents the universal"volume"output terminal of a material.
GetVolumeOutput(renderContext)
Returns the"volume"output of this material for the specified renderContext.
GetVolumeOutputs()
Returns the"volume"outputs of this material for all available renderContexts.
HasBaseMaterial()
SetBaseMaterial(baseMaterial)
Set the base Material of this Material.
SetBaseMaterialPath(baseMaterialPath)
Set the path to the base Material of this Material.
ClearBaseMaterial() → None
Clear the base Material of this Material.
ComputeDisplacementSource(renderContext, sourceName, sourceType) → Shader
Deprecated
Use the form that takes a TfTokenVector or renderContexts
Parameters
renderContext (str) –
sourceName (str) –
sourceType (AttributeType) –
ComputeDisplacementSource(contextVector, sourceName, sourceType) -> Shader
Computes the resolved”displacement”output source for the given
contextVector .
Using the earliest renderContext in the contextVector that produces a
valid Shader object.
If a”displacement”output corresponding to each of the renderContexts
does not exist or is not connected to a valid source, then this
checks the universal displacement output.
Returns an empty Shader object if there is no valid displacement
output source for any of the renderContexts in the contextVector .
The python version of this method returns a tuple containing three
elements (the source displacement shader, sourceName, sourceType).
Parameters
contextVector (list[TfToken]) –
sourceName (str) –
sourceType (AttributeType) –
ComputeSurfaceSource(renderContext, sourceName, sourceType) → Shader
Deprecated
Use the form that takes a TfTokenVector or renderContexts.
Parameters
renderContext (str) –
sourceName (str) –
sourceType (AttributeType) –
ComputeSurfaceSource(contextVector, sourceName, sourceType) -> Shader
Computes the resolved”surface”output source for the given
contextVector .
Using the earliest renderContext in the contextVector that produces a
valid Shader object.
If a”surface”output corresponding to each of the renderContexts does
not exist or is not connected to a valid source, then this checks
the universal surface output.
Returns an empty Shader object if there is no valid surface output
source for any of the renderContexts in the contextVector . The
python version of this method returns a tuple containing three
elements (the source surface shader, sourceName, sourceType).
Parameters
contextVector (list[TfToken]) –
sourceName (str) –
sourceType (AttributeType) –
ComputeVolumeSource(renderContext, sourceName, sourceType) → Shader
Deprecated
Use the form that takes a TfTokenVector or renderContexts
Parameters
renderContext (str) –
sourceName (str) –
sourceType (AttributeType) –
ComputeVolumeSource(contextVector, sourceName, sourceType) -> Shader
Computes the resolved”volume”output source for the given
contextVector .
Using the earliest renderContext in the contextVector that produces a
valid Shader object.
If a”volume”output corresponding to each of the renderContexts does
not exist or is not connected to a valid source, then this checks
the universal volume output.
Returns an empty Shader object if there is no valid volume output
output source for any of the renderContexts in the contextVector .
The python version of this method returns a tuple containing three
elements (the source volume shader, sourceName, sourceType).
Parameters
contextVector (list[TfToken]) –
sourceName (str) –
sourceType (AttributeType) –
CreateDisplacementAttr(defaultValue, writeSparsely) → Attribute
See GetDisplacementAttr() , and also Create vs Get Property Methods
for when to use Get vs Create.
If specified, author defaultValue as the attribute’s default,
sparsely (when it makes sense to do so) if writeSparsely is
true - the default for writeSparsely is false .
Parameters
defaultValue (VtValue) –
writeSparsely (bool) –
CreateDisplacementOutput(renderContext) → Output
Creates and returns the”displacement”output on this material for the
specified renderContext .
If the output already exists on the material, it is returned and no
authoring is performed. The returned output will always have the
requested renderContext.
Parameters
renderContext (str) –
static CreateMasterMaterialVariant()
classmethod CreateMasterMaterialVariant(masterPrim, MaterialPrims, masterVariantSetName) -> bool
Create a variantSet on masterPrim that will set the
MaterialVariant on each of the given MaterialPrims.
The variantSet, whose name can be specified with
masterVariantSetName and defaults to the same MaterialVariant name
created on Materials by GetEditContextForVariant() , will have the
same variants as the Materials, and each Master variant will set every
MaterialPrims' MaterialVariant selection to the same variant as
the master. Thus, it allows all Materials to be switched with a single
variant selection, on masterPrim .
If masterPrim is an ancestor of any given member of
MaterialPrims , then we will author variant selections directly on
the MaterialPrims. However, it is often preferable to create a master
MaterialVariant in a separately rooted tree from the MaterialPrims, so
that it can be layered more strongly on top of the Materials.
Therefore, for any MaterialPrim in a different tree than masterPrim,
we will create”overs”as children of masterPrim that recreate the path
to the MaterialPrim, substituting masterPrim’s full path for the
MaterialPrim’s root path component.
Upon successful completion, the new variantSet we created on
masterPrim will have its variant selection authored to
the”last”variant (determined lexicographically). It is up to the
calling client to either UsdVariantSet::ClearVariantSelection() on
masterPrim , or set the selection to the desired default setting.
Return true on success. It is an error if any of Materials
have a different set of variants for the MaterialVariant than the
others.
Parameters
masterPrim (Prim) –
MaterialPrims (list[Prim]) –
masterVariantSetName (str) –
CreateSurfaceAttr(defaultValue, writeSparsely) → Attribute
See GetSurfaceAttr() , and also Create vs Get Property Methods for
when to use Get vs Create.
If specified, author defaultValue as the attribute’s default,
sparsely (when it makes sense to do so) if writeSparsely is
true - the default for writeSparsely is false .
Parameters
defaultValue (VtValue) –
writeSparsely (bool) –
CreateSurfaceOutput(renderContext) → Output
Creates and returns the”surface”output on this material for the
specified renderContext .
If the output already exists on the material, it is returned and no
authoring is performed. The returned output will always have the
requested renderContext.
Parameters
renderContext (str) –
CreateVolumeAttr(defaultValue, writeSparsely) → Attribute
See GetVolumeAttr() , and also Create vs Get Property Methods for when
to use Get vs Create.
If specified, author defaultValue as the attribute’s default,
sparsely (when it makes sense to do so) if writeSparsely is
true - the default for writeSparsely is false .
Parameters
defaultValue (VtValue) –
writeSparsely (bool) –
CreateVolumeOutput(renderContext) → Output
Creates and returns the”volume”output on this material for the
specified renderContext .
If the output already exists on the material, it is returned and no
authoring is performed. The returned output will always have the
requested renderContext.
Parameters
renderContext (str) –
static Define()
classmethod Define(stage, path) -> Material
Attempt to ensure a UsdPrim adhering to this schema at path is
defined (according to UsdPrim::IsDefined() ) on this stage.
If a prim adhering to this schema at path is already defined on
this stage, return that prim. Otherwise author an SdfPrimSpec with
specifier == SdfSpecifierDef and this schema’s prim type name for
the prim at path at the current EditTarget. Author SdfPrimSpec s
with specifier == SdfSpecifierDef and empty typeName at the
current EditTarget for any nonexistent, or existing but not Defined
ancestors.
The given path must be an absolute prim path that does not contain
any variant selections.
If it is impossible to author any of the necessary PrimSpecs, (for
example, in case path cannot map to the current UsdEditTarget ‘s
namespace) issue an error and return an invalid UsdPrim.
Note that this method may return a defined prim whose typeName does
not specify this schema class, in case a stronger typeName opinion
overrides the opinion at the current EditTarget.
Parameters
stage (Stage) –
path (Path) –
static Get()
classmethod Get(stage, path) -> Material
Return a UsdShadeMaterial holding the prim adhering to this schema at
path on stage .
If no prim exists at path on stage , or if the prim at that
path does not adhere to this schema, return an invalid schema object.
This is shorthand for the following:
UsdShadeMaterial(stage->GetPrimAtPath(path));
Parameters
stage (Stage) –
path (Path) –
GetBaseMaterial() → Material
Get the path to the base Material of this Material.
If there is no base Material, an empty Material is returned
GetBaseMaterialPath() → Path
Get the base Material of this Material.
If there is no base Material, an empty path is returned
GetDisplacementAttr() → Attribute
Represents the universal”displacement”output terminal of a material.
Declaration
token outputs:displacement
C++ Type
TfToken
Usd Type
SdfValueTypeNames->Token
GetDisplacementOutput(renderContext) → Output
Returns the”displacement”output of this material for the specified
renderContext.
The returned output will always have the requested renderContext.
An invalid output is returned if an output corresponding to the
requested specific-renderContext does not exist.
UsdShadeMaterial::ComputeDisplacementSource()
Parameters
renderContext (str) –
GetDisplacementOutputs() → list[Output]
Returns the”displacement”outputs of this material for all available
renderContexts.
The returned vector will include all authored”displacement”outputs
with the universal renderContext output first, if present. Outputs
are returned regardless of whether they are connected to a valid
source.
GetEditContextForVariant(MaterialVariantName, layer) → tuple[Stage, EditTarget]
Helper function for configuring a UsdStage ‘s UsdEditTarget to author
Material variations.
Takes care of creating the Material variantSet and specified variant,
if necessary.
Let’s assume that we are authoring Materials into the Stage’s current
UsdEditTarget, and that we are iterating over the variations of a
UsdShadeMaterial clothMaterial, and currVariant is the variant we
are processing (e.g.”denim”).
In C++, then, we would use the following pattern:
{
UsdEditContext ctxt(clothMaterial.GetEditContextForVariant(currVariant));
// All USD mutation of the UsdStage on which clothMaterial sits will
// now go "inside" the currVariant of the "MaterialVariant" variantSet
}
In python, the pattern is:
with clothMaterial.GetEditContextForVariant(currVariant):
# Now sending mutations to currVariant
If layer is specified, then we will use it, rather than the
stage’s current UsdEditTarget ‘s layer as the destination layer for
the edit context we are building. If layer does not actually
contribute to the Material prim’s definition, any editing will have no
effect on this Material.
Note: As just stated, using this method involves authoring a
selection for the MaterialVariant in the stage’s current EditTarget.
When client is done authoring variations on this prim, they will
likely want to either UsdVariantSet::SetVariantSelection() to the
appropriate default selection, or possibly
UsdVariantSet::ClearVariantSelection() on the
UsdShadeMaterial::GetMaterialVariant() UsdVariantSet.
UsdVariantSet::GetVariantEditContext()
Parameters
MaterialVariantName (str) –
layer (Layer) –
GetMaterialVariant() → VariantSet
Return a UsdVariantSet object for interacting with the Material
variant variantSet.
static GetSchemaAttributeNames()
classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken]
Return a vector of names of all pre-declared attributes for this
schema class and all its ancestor classes.
Does not include attributes that may be authored by custom/extended
methods of the schemas involved.
Parameters
includeInherited (bool) –
GetSurfaceAttr() → Attribute
Represents the universal”surface”output terminal of a material.
Declaration
token outputs:surface
C++ Type
TfToken
Usd Type
SdfValueTypeNames->Token
GetSurfaceOutput(renderContext) → Output
Returns the”surface”output of this material for the specified
renderContext .
The returned output will always have the requested renderContext.
An invalid output is returned if an output corresponding to the
requested specific-renderContext does not exist.
UsdShadeMaterial::ComputeSurfaceSource()
Parameters
renderContext (str) –
GetSurfaceOutputs() → list[Output]
Returns the”surface”outputs of this material for all available
renderContexts.
The returned vector will include all authored”surface”outputs with the
universal renderContext output first, if present. Outputs are
returned regardless of whether they are connected to a valid source.
GetVolumeAttr() → Attribute
Represents the universal”volume”output terminal of a material.
Declaration
token outputs:volume
C++ Type
TfToken
Usd Type
SdfValueTypeNames->Token
GetVolumeOutput(renderContext) → Output
Returns the”volume”output of this material for the specified
renderContext.
The returned output will always have the requested renderContext.
An invalid output is returned if an output corresponding to the
requested specific-renderContext does not exist.
UsdShadeMaterial::ComputeVolumeSource()
Parameters
renderContext (str) –
GetVolumeOutputs() → list[Output]
Returns the”volume”outputs of this material for all available
renderContexts.
The returned vector will include all authored”volume”outputs with the
universal renderContext output first, if present. Outputs are
returned regardless of whether they are connected to a valid source.
HasBaseMaterial() → bool
SetBaseMaterial(baseMaterial) → None
Set the base Material of this Material.
An empty Material is equivalent to clearing the base Material.
Parameters
baseMaterial (Material) –
SetBaseMaterialPath(baseMaterialPath) → None
Set the path to the base Material of this Material.
An empty path is equivalent to clearing the base Material.
Parameters
baseMaterialPath (Path) –
class pxr.UsdShade.MaterialBindingAPI
UsdShadeMaterialBindingAPI is an API schema that provides an interface
for binding materials to prims or collections of prims (represented by
UsdCollectionAPI objects).
In the USD shading model, each renderable gprim computes a single
resolved Material that will be used to shade the gprim
(exceptions, of course, for gprims that possess UsdGeomSubsets, as
each subset can be shaded by a different Material). A gprim and each
of its ancestor prims can possess, through the MaterialBindingAPI,
both a direct binding to a Material, and any number of
collection-based bindings to Materials; each binding can be
generic or declared for a particular purpose, and given a specific
binding strength. It is the process of”material resolution”(see
UsdShadeMaterialBindingAPI_MaterialResolution) that examines all of
these bindings, and selects the one Material that best matches the
client’s needs.
The intent of purpose is that each gprim should be able to resolve
a Material for any given purpose, which implies it can have
differently bound materials for different purposes. There are two
special values of purpose defined in UsdShade, although the API
fully supports specifying arbitrary values for it, for the sake of
extensibility:
UsdShadeTokens->full : to be used when the purpose of the
render is entirely to visualize the truest representation of a scene,
considering all lighting and material information, at highest
fidelity.
UsdShadeTokens->preview : to be used when the render is in
service of a goal other than a high fidelity”full”render (such as
scene manipulation, modeling, or realtime playback). Latency and speed
are generally of greater concern for preview renders, therefore
preview materials are generally designed to be”lighterweight”compared
to full materials.
A binding can also have no specific purpose at all, in which case, it
is considered to be the fallback or all-purpose binding (denoted by
the empty-valued token UsdShadeTokens->allPurpose).
The purpose of a material binding is encoded in the name of the
binding relationship.
In the case of a direct binding, the allPurpose binding is
represented by the relationship named “material:binding”. Special-
purpose direct bindings are represented by relationships named
“material:binding: *purpose*. A direct binding relationship must
have a single target path that points to a UsdShadeMaterial.
In the case of a collection-based binding, the allPurpose
binding is represented by a relationship
named”material:binding:collection:<i>bindingName</i>”, where
bindingName establishes an identity for the binding that is unique
on the prim. Attempting to establish two collection bindings of the
same name on the same prim will result in the first binding simply
being overridden. A special-purpose collection-based binding is
represented by a relationship
named”material:binding:collection:<i>purpose:bindingName</i>”. A
collection-based binding relationship must have exacly two targets,
one of which should be a collection-path (see ef
UsdCollectionAPI::GetCollectionPath() ) and the other should point to
a UsdShadeMaterial. In the future, we may allow a single
collection binding to target multiple collections, if we can establish
a reasonable round-tripping pattern for applications that only allow a
single collection to be associated with each Material.
Note: Both bindingName and purpose must be non-namespaced
tokens. This allows us to know the role of a binding relationship
simply from the number of tokens in it.
Two tokens : the fallback,”all purpose”, direct binding,
material:binding
Three tokens : a purpose-restricted, direct, fallback
binding, e.g. material:binding:preview
Four tokens : an all-purpose, collection-based binding, e.g.
material:binding:collection:metalBits
Five tokens : a purpose-restricted, collection-based binding,
e.g. material:binding:collection:full:metalBits
A binding-strength value is used to specify whether a binding
authored on a prim should be weaker or stronger than bindings that
appear lower in namespace. We encode the binding strength with as
token-valued metadata ‘bindMaterialAs’ for future flexibility,
even though for now, there are only two possible values:
UsdShadeTokens->weakerThanDescendants and
UsdShadeTokens->strongerThanDescendants. When binding-strength is
not authored (i.e. empty) on a binding-relationship, the default
behavior matches UsdShadeTokens->weakerThanDescendants.
If a material binding relationship is a built-in property defined as
part of a typed prim’s schema, a fallback value should not be provided
for it. This is because the”material resolution”algorithm only
conisders authored properties.
Classes:
CollectionBinding
DirectBinding
Methods:
AddPrimToBindingCollection(prim, ...)
Adds the specified prim to the collection targeted by the binding relationship corresponding to given bindingName and materialPurpose .
Apply
classmethod Apply(prim) -> MaterialBindingAPI
Bind(material, bindingStrength, materialPurpose)
Authors a direct binding to the given material on this prim.
CanApply
classmethod CanApply(prim, whyNot) -> bool
CanContainPropertyName
classmethod CanContainPropertyName(name) -> bool
ComputeBoundMaterial(bindingsCache, ...)
Computes the resolved bound material for this prim, for the given material purpose.
ComputeBoundMaterials
classmethod ComputeBoundMaterials(prims, materialPurpose, bindingRels) -> list[Material]
CreateMaterialBindSubset(subsetName, ...)
Creates a GeomSubset named subsetName with element type, elementType and familyName materialBind **below this prim.**
Get
classmethod Get(stage, path) -> MaterialBindingAPI
GetCollectionBindingRel(bindingName, ...)
Returns the collection-based material-binding relationship with the given bindingName and materialPurpose on this prim.
GetCollectionBindingRels(materialPurpose)
Returns the list of collection-based material binding relationships on this prim for the given material purpose, materialPurpose .
GetCollectionBindings(materialPurpose)
Returns all the collection-based bindings on this prim for the given material purpose.
GetDirectBinding(materialPurpose)
Computes and returns the direct binding for the given material purpose on this prim.
GetDirectBindingRel(materialPurpose)
Returns the direct material-binding relationship on this prim for the given material purpose.
GetMaterialBindSubsets()
Returns all the existing GeomSubsets with familyName=UsdShadeTokens->materialBind below this prim.
GetMaterialBindSubsetsFamilyType()
Returns the familyType of the family of"materialBind"GeomSubsets on this prim.
GetMaterialBindingStrength
classmethod GetMaterialBindingStrength(bindingRel) -> str
GetMaterialPurposes
classmethod GetMaterialPurposes() -> list[TfToken]
GetResolvedTargetPathFromBindingRel
classmethod GetResolvedTargetPathFromBindingRel(bindingRel) -> Path
GetSchemaAttributeNames
classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken]
RemovePrimFromBindingCollection(prim, ...)
Removes the specified prim from the collection targeted by the binding relationship corresponding to given bindingName and materialPurpose .
SetMaterialBindSubsetsFamilyType(familyType)
Author the familyType of the"materialBind"family of GeomSubsets on this prim.
SetMaterialBindingStrength
classmethod SetMaterialBindingStrength(bindingRel, bindingStrength) -> bool
UnbindAllBindings()
Unbinds all direct and collection-based bindings on this prim.
UnbindCollectionBinding(bindingName, ...)
Unbinds the collection-based binding with the given bindingName , for the given materialPurpose on this prim.
UnbindDirectBinding(materialPurpose)
Unbinds the direct binding for the given material purpose ( materialPurpose ) on this prim.
class CollectionBinding
Methods:
GetBindingRel
GetCollection
GetCollectionPath
GetMaterial
GetMaterialPath
IsCollectionBindingRel
IsValid
GetBindingRel()
GetCollection()
GetCollectionPath()
GetMaterial()
GetMaterialPath()
static IsCollectionBindingRel()
IsValid()
class DirectBinding
Methods:
GetBindingRel
GetMaterial
GetMaterialPath
GetMaterialPurpose
GetBindingRel()
GetMaterial()
GetMaterialPath()
GetMaterialPurpose()
AddPrimToBindingCollection(prim, bindingName, materialPurpose) → bool
Adds the specified prim to the collection targeted by the binding
relationship corresponding to given bindingName and
materialPurpose .
If the collection-binding relationship doesn’t exist or if the
targeted collection already includes the prim , then this does
nothing and returns true.
If the targeted collection does not include prim (or excludes it
explicitly), then this modifies the collection by adding the prim to
it (by invoking UsdCollectionAPI::AddPrim()).
Parameters
prim (Prim) –
bindingName (str) –
materialPurpose (str) –
static Apply()
classmethod Apply(prim) -> MaterialBindingAPI
Applies this single-apply API schema to the given prim .
This information is stored by adding”MaterialBindingAPI”to the token-
valued, listOp metadata apiSchemas on the prim.
A valid UsdShadeMaterialBindingAPI object is returned upon success. An
invalid (or empty) UsdShadeMaterialBindingAPI object is returned upon
failure. See UsdPrim::ApplyAPI() for conditions resulting in failure.
UsdPrim::GetAppliedSchemas()
UsdPrim::HasAPI()
UsdPrim::CanApplyAPI()
UsdPrim::ApplyAPI()
UsdPrim::RemoveAPI()
Parameters
prim (Prim) –
Bind(material, bindingStrength, materialPurpose) → bool
Authors a direct binding to the given material on this prim.
If bindingStrength is UsdShadeTokens->fallbackStrength, the value
UsdShadeTokens->weakerThanDescendants is authored sparsely. To stamp
out the bindingStrength value explicitly, clients can pass in
UsdShadeTokens->weakerThanDescendants or
UsdShadeTokens->strongerThanDescendants directly.
If materialPurpose is specified and isn’t equal to
UsdShadeTokens->allPurpose, the binding only applies to the specified
material purpose.
Note that UsdShadeMaterialBindingAPI is a SingleAppliedAPI schema
which when applied updates the prim definition accordingly. This
information on the prim definition is helpful in multiple queries and
more performant. Hence its recommended to call
UsdShadeMaterialBindingAPI::Apply() when Binding a material.
Returns true on success, false otherwise.
Parameters
material (Material) –
bindingStrength (str) –
materialPurpose (str) –
Bind(collection, material, bindingName, bindingStrength, materialPurpose) -> bool
Authors a collection-based binding, which binds the given material
to the given collection on this prim.
bindingName establishes an identity for the binding that is unique
on the prim. Attempting to establish two collection bindings of the
same name on the same prim will result in the first binding simply
being overridden. If bindingName is empty, it is set to the base-
name of the collection being bound (which is the collection-name with
any namespaces stripped out). If there are multiple collections with
the same base-name being bound at the same prim, clients should pass
in a unique binding name per binding, in order to preserve all
bindings. The binding name used in constructing the collection-binding
relationship name shoud not contain namespaces. Hence, a coding error
is issued and no binding is authored if the provided value of
bindingName is non-empty and contains namespaces.
If bindingStrength is UsdShadeTokens->fallbackStrength, the
value UsdShadeTokens->weakerThanDescendants is authored sparsely, i.e.
only when there is an existing binding with a different
bindingStrength. To stamp out the bindingStrength value explicitly,
clients can pass in UsdShadeTokens->weakerThanDescendants or
UsdShadeTokens->strongerThanDescendants directly.
If materialPurpose is specified and isn’t equal to
UsdShadeTokens->allPurpose, the binding only applies to the specified
material purpose.
Note that UsdShadeMaterialBindingAPI is a SingleAppliedAPI schema
which when applied updates the prim definition accordingly. This
information on the prim definition is helpful in multiple queries and
more performant. Hence its recommended to call
UsdShadeMaterialBindingAPI::Apply() when Binding a material.
Returns true on success, false otherwise.
Parameters
collection (CollectionAPI) –
material (Material) –
bindingName (str) –
bindingStrength (str) –
materialPurpose (str) –
static CanApply()
classmethod CanApply(prim, whyNot) -> bool
Returns true if this single-apply API schema can be applied to the
given prim .
If this schema can not be a applied to the prim, this returns false
and, if provided, populates whyNot with the reason it can not be
applied.
Note that if CanApply returns false, that does not necessarily imply
that calling Apply will fail. Callers are expected to call CanApply
before calling Apply if they want to ensure that it is valid to apply
a schema.
UsdPrim::GetAppliedSchemas()
UsdPrim::HasAPI()
UsdPrim::CanApplyAPI()
UsdPrim::ApplyAPI()
UsdPrim::RemoveAPI()
Parameters
prim (Prim) –
whyNot (str) –
static CanContainPropertyName()
classmethod CanContainPropertyName(name) -> bool
Test whether a given name contains the”material:binding:”prefix.
Parameters
name (str) –
ComputeBoundMaterial(bindingsCache, collectionQueryCache, materialPurpose, bindingRel) → Material
Computes the resolved bound material for this prim, for the given
material purpose.
This overload of ComputeBoundMaterial makes use of the BindingsCache (
bindingsCache ) and CollectionQueryCache (
collectionQueryCache ) that are passed in, to avoid redundant
binding computations and computations of MembershipQuery objects for
collections. It would be beneficial to make use of these when
resolving bindings for a tree of prims. These caches are populated
lazily as more and more bindings are resolved.
When the goal is to compute the bound material for a range (or list)
of prims, it is recommended to use this version of
ComputeBoundMaterial() . Here’s how you could compute the bindings of
a range of prims efficiently in C++:
std::vector<std::pair<UsdPrim, UsdShadeMaterial> primBindings;
UsdShadeMaterialBindingAPI::BindingsCache bindingsCache;
UsdShadeMaterialBindingAPI::CollectionQueryCache collQueryCache;
for (auto prim : UsdPrimRange(rootPrim)) {
UsdShadeMaterial boundMaterial =
UsdShadeMaterialBindingAPI(prim).ComputeBoundMaterial(
& bindingsCache, & collQueryCache);
if (boundMaterial) {
primBindings.emplace_back({prim, boundMaterial});
}
}
If bindingRel is not null, then it is set to the”winning”binding
relationship.
Note the resolved bound material is considered valid if the target
path of the binding relationship is a valid non-empty prim path. This
makes sure winning binding relationship and the bound material remain
consistent consistent irrespective of the presence/absence of prim at
material path. For ascenario where ComputeBoundMaterial returns a
invalid UsdShadeMaterial with a valid winning bindingRel, clients can
use the static method
UsdShadeMaterialBindingAPI::GetResolvedTargetPathFromBindingRel to get
the path of the resolved target identified by the winning bindingRel.
See Bound Material Resolution for details on the material resolution
process.
The python version of this method returns a tuple containing the bound
material and the”winning”binding relationship.
Parameters
bindingsCache (BindingsCache) –
collectionQueryCache (CollectionQueryCache) –
materialPurpose (str) –
bindingRel (Relationship) –
ComputeBoundMaterial(materialPurpose, bindingRel) -> Material
This is an overloaded member function, provided for convenience. It
differs from the above function only in what argument(s) it accepts.
Computes the resolved bound material for this prim, for the given
material purpose.
This overload does not utilize cached MembershipQuery object. However,
it only computes the MembershipQuery of every collection that bound in
the ancestor chain at most once.
If bindingRel is not null, then it is set to the winning binding
relationship.
See Bound Material Resolution for details on the material resolution
process.
The python version of this method returns a tuple containing the bound
material and the”winning”binding relationship.
Parameters
materialPurpose (str) –
bindingRel (Relationship) –
static ComputeBoundMaterials()
classmethod ComputeBoundMaterials(prims, materialPurpose, bindingRels) -> list[Material]
Static API for efficiently and concurrently computing the resolved
material bindings for a vector of UsdPrims, prims for the given
materialPurpose .
The size of the returned vector always matches the size of the input
vector, prims . If a prim is not bound to any material, an invalid
or empty UsdShadeMaterial is returned at the index corresponding to
it.
If the pointer bindingRels points to a valid vector, then it is
populated with the set of all”winning”binding relationships.
The python version of this method returns a tuple containing two lists
- the bound materials and the corresponding”winning”binding
relationships.
Parameters
prims (list[Prim]) –
materialPurpose (str) –
bindingRels (list[Relationship]) –
CreateMaterialBindSubset(subsetName, indices, elementType) → Subset
Creates a GeomSubset named subsetName with element type,
elementType and familyName materialBind **below this prim.**
If a GeomSubset named subsetName already exists, then
its”familyName”is updated to be UsdShadeTokens->materialBind and its
indices (at default timeCode) are updated with the provided
indices value before returning.
This method forces the familyType of the”materialBind”family of
subsets to UsdGeomTokens->nonOverlapping if it’s unset or explicitly
set to UsdGeomTokens->unrestricted.
The default value elementType is UsdGeomTokens->face, as we expect
materials to be bound most often to subsets of faces on meshes.
Parameters
subsetName (str) –
indices (IntArray) –
elementType (str) –
static Get()
classmethod Get(stage, path) -> MaterialBindingAPI
Return a UsdShadeMaterialBindingAPI holding the prim adhering to this
schema at path on stage .
If no prim exists at path on stage , or if the prim at that
path does not adhere to this schema, return an invalid schema object.
This is shorthand for the following:
UsdShadeMaterialBindingAPI(stage->GetPrimAtPath(path));
Parameters
stage (Stage) –
path (Path) –
GetCollectionBindingRel(bindingName, materialPurpose) → Relationship
Returns the collection-based material-binding relationship with the
given bindingName and materialPurpose on this prim.
For info on bindingName , see UsdShadeMaterialBindingAPI::Bind() .
The material purpose of the relationship that’s returned will match
the specified materialPurpose .
Parameters
bindingName (str) –
materialPurpose (str) –
GetCollectionBindingRels(materialPurpose) → list[Relationship]
Returns the list of collection-based material binding relationships on
this prim for the given material purpose, materialPurpose .
The returned list of binding relationships will be in native property
order. See UsdPrim::GetPropertyOrder() , UsdPrim::SetPropertyOrder() .
Bindings that appear earlier in the property order are considered to
be stronger than the ones that come later. See rule #6 in
UsdShadeMaterialBindingAPI_MaterialResolution.
Parameters
materialPurpose (str) –
GetCollectionBindings(materialPurpose) → list[CollectionBinding]
Returns all the collection-based bindings on this prim for the given
material purpose.
The returned CollectionBinding objects always have the specified
materialPurpose (i.e. the all-purpose binding is not returned if a
special purpose binding is requested).
If one or more collection based bindings are to prims that are not
Materials, this does not generate an error, but the corresponding
Material(s) will be invalid (i.e. evaluate to false).
The python version of this API returns a tuple containing the vector
of CollectionBinding objects and the corresponding vector of binding
relationships.
The returned list of collection-bindings will be in native property
order of the associated binding relationships. See
UsdPrim::GetPropertyOrder() , UsdPrim::SetPropertyOrder() . Binding
relationships that come earlier in the list are considered to be
stronger than the ones that come later. See rule #6 in
UsdShadeMaterialBindingAPI_MaterialResolution.
Parameters
materialPurpose (str) –
GetDirectBinding(materialPurpose) → DirectBinding
Computes and returns the direct binding for the given material purpose
on this prim.
The returned binding always has the specified materialPurpose
(i.e. the all-purpose binding is not returned if a special purpose
binding is requested).
If the direct binding is to a prim that is not a Material, this does
not generate an error, but the returned Material will be invalid (i.e.
evaluate to false).
Parameters
materialPurpose (str) –
GetDirectBindingRel(materialPurpose) → Relationship
Returns the direct material-binding relationship on this prim for the
given material purpose.
The material purpose of the relationship that’s returned will match
the specified materialPurpose .
Parameters
materialPurpose (str) –
GetMaterialBindSubsets() → list[Subset]
Returns all the existing GeomSubsets with
familyName=UsdShadeTokens->materialBind below this prim.
GetMaterialBindSubsetsFamilyType() → str
Returns the familyType of the family of”materialBind”GeomSubsets on
this prim.
By default, materialBind subsets have familyType=”nonOverlapping”, but
they can also be tagged as a”partition”, using
SetMaterialBindFaceSubsetsFamilyType().
UsdGeomSubset::GetFamilyNameAttr
static GetMaterialBindingStrength()
classmethod GetMaterialBindingStrength(bindingRel) -> str
Resolves the’bindMaterialAs’token-valued metadata on the given binding
relationship and returns it.
If the resolved value is empty, this returns the fallback value
UsdShadeTokens->weakerThanDescendants.
UsdShadeMaterialBindingAPI::SetMaterialBindingStrength()
Parameters
bindingRel (Relationship) –
static GetMaterialPurposes()
classmethod GetMaterialPurposes() -> list[TfToken]
Returns a vector of the possible values for the’material purpose’.
static GetResolvedTargetPathFromBindingRel()
classmethod GetResolvedTargetPathFromBindingRel(bindingRel) -> Path
returns the path of the resolved target identified by bindingRel .
Parameters
bindingRel (Relationship) –
static GetSchemaAttributeNames()
classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken]
Return a vector of names of all pre-declared attributes for this
schema class and all its ancestor classes.
Does not include attributes that may be authored by custom/extended
methods of the schemas involved.
Parameters
includeInherited (bool) –
RemovePrimFromBindingCollection(prim, bindingName, materialPurpose) → bool
Removes the specified prim from the collection targeted by the
binding relationship corresponding to given bindingName and
materialPurpose .
If the collection-binding relationship doesn’t exist or if the
targeted collection does not include the prim , then this does
nothing and returns true.
If the targeted collection includes prim , then this modifies the
collection by removing the prim from it (by invoking
UsdCollectionAPI::RemovePrim()). This method can be used in
conjunction with the Unbind*() methods (if desired) to guarantee
that a prim has no resolved material binding.
Parameters
prim (Prim) –
bindingName (str) –
materialPurpose (str) –
SetMaterialBindSubsetsFamilyType(familyType) → bool
Author the familyType of the”materialBind”family of GeomSubsets on
this prim.
The default familyType is UsdGeomTokens->nonOverlapping *. It can
be set to *UsdGeomTokens->partition to indicate that the entire
imageable prim is included in the union of all
the”materialBind”subsets. The family type should never be set to
UsdGeomTokens->unrestricted, since it is invalid for a single piece of
geometry (in this case, a subset) to be bound to more than one
material. Hence, a coding error is issued if familyType is
UsdGeomTokens->unrestricted.**
**
UsdGeomSubset::SetFamilyType**
Parameters
familyType (str) –
static SetMaterialBindingStrength()
classmethod SetMaterialBindingStrength(bindingRel, bindingStrength) -> bool
Sets the’bindMaterialAs’token-valued metadata on the given binding
relationship.
If bindingStrength is UsdShadeTokens->fallbackStrength, the
value UsdShadeTokens->weakerThanDescendants is authored sparsely, i.e.
only when there is a different existing bindingStrength value. To
stamp out the bindingStrength value explicitly, clients can pass in
UsdShadeTokens->weakerThanDescendants or
UsdShadeTokens->strongerThanDescendants directly. Returns true on
success, false otherwise.
UsdShadeMaterialBindingAPI::GetMaterialBindingStrength()
Parameters
bindingRel (Relationship) –
bindingStrength (str) –
UnbindAllBindings() → bool
Unbinds all direct and collection-based bindings on this prim.
UnbindCollectionBinding(bindingName, materialPurpose) → bool
Unbinds the collection-based binding with the given bindingName ,
for the given materialPurpose on this prim.
It accomplishes this by blocking the targets of the associated binding
relationship in the current edit target.
If a binding was created without specifying a bindingName , then
the correct bindingName to use for unbinding is the instance name
of the targetted collection.
Parameters
bindingName (str) –
materialPurpose (str) –
UnbindDirectBinding(materialPurpose) → bool
Unbinds the direct binding for the given material purpose (
materialPurpose ) on this prim.
It accomplishes this by blocking the targets of the binding
relationship in the current edit target.
Parameters
materialPurpose (str) –
class pxr.UsdShade.NodeDefAPI
UsdShadeNodeDefAPI is an API schema that provides attributes for a
prim to select a corresponding Shader Node Definition (“Sdr Node”), as
well as to look up a runtime entry for that shader node in the form of
an SdrShaderNode.
UsdShadeNodeDefAPI is intended to be a pre-applied API schema for any
prim type that wants to refer to the SdrRegistry for further
implementation details about the behavior of that prim. The primary
use in UsdShade itself is as UsdShadeShader, which is a basis for
material shading networks (UsdShadeMaterial), but this is intended to
be used in other domains that also use the Sdr node mechanism.
This schema provides properties that allow a prim to identify an
external node definition, either by a direct identifier key into the
SdrRegistry (info:id), an asset to be parsed by a suitable
NdrParserPlugin (info:sourceAsset), or an inline source code that must
also be parsed (info:sourceCode); as well as a selector attribute to
determine which specifier is active (info:implementationSource).
For any described attribute Fallback Value or Allowed Values
below that are text/tokens, the actual token is published and defined
in UsdShadeTokens. So to set an attribute to the value”rightHanded”,
use UsdShadeTokens->rightHanded as the value.
Methods:
Apply
classmethod Apply(prim) -> NodeDefAPI
CanApply
classmethod CanApply(prim, whyNot) -> bool
CreateIdAttr(defaultValue, writeSparsely)
See GetIdAttr() , and also Create vs Get Property Methods for when to use Get vs Create.
CreateImplementationSourceAttr(defaultValue, ...)
See GetImplementationSourceAttr() , and also Create vs Get Property Methods for when to use Get vs Create.
Get
classmethod Get(stage, path) -> NodeDefAPI
GetIdAttr()
The id is an identifier for the type or purpose of the shader.
GetImplementationSource()
Reads the value of info:implementationSource attribute and returns a token identifying the attribute that must be consulted to identify the shader's source program.
GetImplementationSourceAttr()
Specifies the attribute that should be consulted to get the shader's implementation or its source code.
GetSchemaAttributeNames
classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken]
GetShaderId(id)
Fetches the shader's ID value from the info:id attribute, if the shader's info:implementationSource is id.
GetShaderNodeForSourceType(sourceType)
This method attempts to ensure that there is a ShaderNode in the shader registry (i.e.
GetSourceAsset(sourceAsset, sourceType)
Fetches the shader's source asset value for the specified sourceType value from the info: *sourceType*: sourceAsset attribute, if the shader's info:implementationSource is sourceAsset.
GetSourceAssetSubIdentifier(subIdentifier, ...)
Fetches the shader's sub-identifier for the source asset with the specified sourceType value from the info: *sourceType*: sourceAsset:subIdentifier attribute, if the shader's info: implementationSource is sourceAsset.
GetSourceCode(sourceCode, sourceType)
Fetches the shader's source code for the specified sourceType value by reading the info: *sourceType*: sourceCode attribute, if the shader's info:implementationSource is sourceCode.
SetShaderId(id)
Sets the shader's ID value.
SetSourceAsset(sourceAsset, sourceType)
Sets the shader's source-asset path value to sourceAsset for the given source type, sourceType .
SetSourceAssetSubIdentifier(subIdentifier, ...)
Set a sub-identifier to be used with a source asset of the given source type.
SetSourceCode(sourceCode, sourceType)
Sets the shader's source-code value to sourceCode for the given source type, sourceType .
static Apply()
classmethod Apply(prim) -> NodeDefAPI
Applies this single-apply API schema to the given prim .
This information is stored by adding”NodeDefAPI”to the token-valued,
listOp metadata apiSchemas on the prim.
A valid UsdShadeNodeDefAPI object is returned upon success. An invalid
(or empty) UsdShadeNodeDefAPI object is returned upon failure. See
UsdPrim::ApplyAPI() for conditions resulting in failure.
UsdPrim::GetAppliedSchemas()
UsdPrim::HasAPI()
UsdPrim::CanApplyAPI()
UsdPrim::ApplyAPI()
UsdPrim::RemoveAPI()
Parameters
prim (Prim) –
static CanApply()
classmethod CanApply(prim, whyNot) -> bool
Returns true if this single-apply API schema can be applied to the
given prim .
If this schema can not be a applied to the prim, this returns false
and, if provided, populates whyNot with the reason it can not be
applied.
Note that if CanApply returns false, that does not necessarily imply
that calling Apply will fail. Callers are expected to call CanApply
before calling Apply if they want to ensure that it is valid to apply
a schema.
UsdPrim::GetAppliedSchemas()
UsdPrim::HasAPI()
UsdPrim::CanApplyAPI()
UsdPrim::ApplyAPI()
UsdPrim::RemoveAPI()
Parameters
prim (Prim) –
whyNot (str) –
CreateIdAttr(defaultValue, writeSparsely) → Attribute
See GetIdAttr() , and also Create vs Get Property Methods for when to
use Get vs Create.
If specified, author defaultValue as the attribute’s default,
sparsely (when it makes sense to do so) if writeSparsely is
true - the default for writeSparsely is false .
Parameters
defaultValue (VtValue) –
writeSparsely (bool) –
CreateImplementationSourceAttr(defaultValue, writeSparsely) → Attribute
See GetImplementationSourceAttr() , and also Create vs Get Property
Methods for when to use Get vs Create.
If specified, author defaultValue as the attribute’s default,
sparsely (when it makes sense to do so) if writeSparsely is
true - the default for writeSparsely is false .
Parameters
defaultValue (VtValue) –
writeSparsely (bool) –
static Get()
classmethod Get(stage, path) -> NodeDefAPI
Return a UsdShadeNodeDefAPI holding the prim adhering to this schema
at path on stage .
If no prim exists at path on stage , or if the prim at that
path does not adhere to this schema, return an invalid schema object.
This is shorthand for the following:
UsdShadeNodeDefAPI(stage->GetPrimAtPath(path));
Parameters
stage (Stage) –
path (Path) –
GetIdAttr() → Attribute
The id is an identifier for the type or purpose of the shader.
E.g.: Texture or FractalFloat. The use of this id will depend on the
render target: some will turn it into an actual shader path, some will
use it to generate shader source code dynamically.
SetShaderId()
Declaration
uniform token info:id
C++ Type
TfToken
Usd Type
SdfValueTypeNames->Token
Variability
SdfVariabilityUniform
GetImplementationSource() → str
Reads the value of info:implementationSource attribute and returns a
token identifying the attribute that must be consulted to identify the
shader’s source program.
This returns
id, to indicate that the”info:id”attribute must be consulted.
sourceAsset to indicate that the asset-
valued”info:{sourceType}:sourceAsset”attribute associated with the
desired sourceType should be consulted to locate the asset with
the shader’s source.
sourceCode to indicate that the string-
valued”info:{sourceType}:sourceCode”attribute associated with the
desired sourceType should be read to get shader’s source.
This issues a warning and returns id if the
info:implementationSource attribute has an invalid value.
{sourceType} above is a place holder for a token that identifies the
type of shader source or its implementation. For example: osl, glslfx,
riCpp etc. This allows a shader to specify different sourceAsset (or
sourceCode) values for different sourceTypes. The sourceType tokens
usually correspond to the sourceType value of the NdrParserPlugin
that’s used to parse the shader source (NdrParserPlugin::SourceType).
When sourceType is empty, the corresponding sourceAsset or sourceCode
is considered to be”universal”(or fallback), which is represented by
the empty-valued token UsdShadeTokens->universalSourceType. When the
sourceAsset (or sourceCode) corresponding to a specific, requested
sourceType is unavailable, the universal sourceAsset (or sourceCode)
is returned by GetSourceAsset (and GetSourceCode} API, if present.
GetShaderId()
GetSourceAsset()
GetSourceCode()
GetImplementationSourceAttr() → Attribute
Specifies the attribute that should be consulted to get the shader’s
implementation or its source code.
If set to”id”, the”info:id”attribute’s value is used to determine
the shader source from the shader registry.
If set to”sourceAsset”, the resolved value of
the”info:sourceAsset”attribute corresponding to the desired
implementation (or source-type) is used to locate the shader source. A
source asset file may also specify multiple shader definitions, so
there is an optional attribute”info:sourceAsset:subIdentifier”whose
value should be used to indicate a particular shader definition from a
source asset file.
If set to”sourceCode”, the value of”info:sourceCode”attribute
corresponding to the desired implementation (or source type) is used
as the shader source.
Declaration
uniform token info:implementationSource ="id"
C++ Type
TfToken
Usd Type
SdfValueTypeNames->Token
Variability
SdfVariabilityUniform
Allowed Values
id, sourceAsset, sourceCode
static GetSchemaAttributeNames()
classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken]
Return a vector of names of all pre-declared attributes for this
schema class and all its ancestor classes.
Does not include attributes that may be authored by custom/extended
methods of the schemas involved.
Parameters
includeInherited (bool) –
GetShaderId(id) → bool
Fetches the shader’s ID value from the info:id attribute, if the
shader’s info:implementationSource is id.
Returns true if the shader’s implementation source is id and
the value was fetched properly into id . Returns false otherwise.
GetImplementationSource()
Parameters
id (str) –
GetShaderNodeForSourceType(sourceType) → ShaderNode
This method attempts to ensure that there is a ShaderNode in the
shader registry (i.e.
SdrRegistry) representing this shader for the given sourceType .
It may return a null pointer if none could be found or created.
Parameters
sourceType (str) –
GetSourceAsset(sourceAsset, sourceType) → bool
Fetches the shader’s source asset value for the specified
sourceType value from the info: *sourceType*: sourceAsset
attribute, if the shader’s info:implementationSource is
sourceAsset.
If the sourceAsset attribute corresponding to the requested
sourceType isn’t present on the shader, then the universal
fallback sourceAsset attribute, i.e. info:sourceAsset is
consulted, if present, to get the source asset path.
Returns true if the shader’s implementation source is
sourceAsset and the source asset path value was fetched
successfully into sourceAsset . Returns false otherwise.
GetImplementationSource()
Parameters
sourceAsset (AssetPath) –
sourceType (str) –
GetSourceAssetSubIdentifier(subIdentifier, sourceType) → bool
Fetches the shader’s sub-identifier for the source asset with the
specified sourceType value from the info: *sourceType*:
sourceAsset:subIdentifier attribute, if the shader’s info:
implementationSource is sourceAsset.
If the subIdentifier attribute corresponding to the requested
sourceType isn’t present on the shader, then the universal
fallback sub-identifier attribute, i.e. info:sourceAsset:
subIdentifier is consulted, if present, to get the sub-identifier
name.
Returns true if the shader’s implementation source is
sourceAsset and the sub-identifier for the given source type was
fetched successfully into subIdentifier . Returns false otherwise.
Parameters
subIdentifier (str) –
sourceType (str) –
GetSourceCode(sourceCode, sourceType) → bool
Fetches the shader’s source code for the specified sourceType
value by reading the info: *sourceType*: sourceCode attribute, if
the shader’s info:implementationSource is sourceCode.
If the sourceCode attribute corresponding to the requested
sourceType isn’t present on the shader, then the universal or
fallback sourceCode attribute (i.e. info:sourceCode) is consulted,
if present, to get the source code.
Returns true if the shader’s implementation source is
sourceCode and the source code string was fetched successfully
into sourceCode . Returns false otherwise.
GetImplementationSource()
Parameters
sourceCode (str) –
sourceType (str) –
SetShaderId(id) → bool
Sets the shader’s ID value.
This also sets the info:implementationSource attribute on the shader
to UsdShadeTokens->id, if the existing value is different.
Parameters
id (str) –
SetSourceAsset(sourceAsset, sourceType) → bool
Sets the shader’s source-asset path value to sourceAsset for the
given source type, sourceType .
This also sets the info:implementationSource attribute on the shader
to UsdShadeTokens->sourceAsset.
Parameters
sourceAsset (AssetPath) –
sourceType (str) –
SetSourceAssetSubIdentifier(subIdentifier, sourceType) → bool
Set a sub-identifier to be used with a source asset of the given
source type.
This sets the info: *sourceType*: sourceAsset:subIdentifier.
This also sets the info:implementationSource attribute on the shader
to UsdShadeTokens->sourceAsset
Parameters
subIdentifier (str) –
sourceType (str) –
SetSourceCode(sourceCode, sourceType) → bool
Sets the shader’s source-code value to sourceCode for the given
source type, sourceType .
This also sets the info:implementationSource attribute on the shader
to UsdShadeTokens->sourceCode.
Parameters
sourceCode (str) –
sourceType (str) –
class pxr.UsdShade.NodeGraph
A node-graph is a container for shading nodes, as well as other node-
graphs. It has a public input interface and provides a list of public
outputs.
Node Graph Interfaces
One of the most important functions of a node-graph is to host
the”interface”with which clients of already-built shading networks
will interact. Please see Interface Inputs for a detailed explanation
of what the interface provides, and how to construct and use it, to
effectively share/instance shader networks.
Node Graph Outputs
These behave like outputs on a shader and are typically connected to
an output on a shader inside the node-graph.
Methods:
ComputeInterfaceInputConsumersMap(...)
Walks the namespace subtree below the node-graph and computes a map containing the list of all inputs on the node-graph and the associated vector of consumers of their values.
ComputeOutputSource(outputName, sourceName, ...)
Deprecated
ConnectableAPI()
Contructs and returns a UsdShadeConnectableAPI object with this node- graph.
CreateInput(name, typeName)
Create an Input which can either have a value or can be connected.
CreateOutput(name, typeName)
Create an output which can either have a value or can be connected.
Define
classmethod Define(stage, path) -> NodeGraph
Get
classmethod Get(stage, path) -> NodeGraph
GetInput(name)
Return the requested input if it exists.
GetInputs(onlyAuthored)
Returns all inputs present on the node-graph.
GetInterfaceInputs()
Returns all the"Interface Inputs"of the node-graph.
GetOutput(name)
Return the requested output if it exists.
GetOutputs(onlyAuthored)
Outputs are represented by attributes in the"outputs:"namespace.
GetSchemaAttributeNames
classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken]
ComputeInterfaceInputConsumersMap(computeTransitiveConsumers) → InterfaceInputConsumersMap
Walks the namespace subtree below the node-graph and computes a map
containing the list of all inputs on the node-graph and the associated
vector of consumers of their values.
The consumers can be inputs on shaders within the node-graph or on
nested node-graphs).
If computeTransitiveConsumers is true, then value consumers
belonging to node-graphs are resolved transitively to compute the
transitive mapping from inputs on the node-graph to inputs on shaders
inside the material. Note that inputs on node-graphs that don’t have
value consumers will continue to be included in the result.
This API is provided for use by DCC’s that want to present node-graph
interface / shader connections in the opposite direction than they are
encoded in USD.
Parameters
computeTransitiveConsumers (bool) –
ComputeOutputSource(outputName, sourceName, sourceType) → Shader
Deprecated
in favor of GetValueProducingAttributes on UsdShadeOutput Resolves the
connection source of the requested output, identified by
outputName to a shader output.
sourceName is an output parameter that is set to the name of the
resolved output, if the node-graph output is connected to a valid
shader source.
sourceType is an output parameter that is set to the type of the
resolved output, if the node-graph output is connected to a valid
shader source.
Returns a valid shader object if the specified output exists and is
connected to one. Return an empty shader object otherwise. The python
version of this method returns a tuple containing three elements (the
source shader, sourceName, sourceType).
Parameters
outputName (str) –
sourceName (str) –
sourceType (AttributeType) –
ConnectableAPI() → ConnectableAPI
Contructs and returns a UsdShadeConnectableAPI object with this node-
graph.
Note that most tasks can be accomplished without explicitly
constructing a UsdShadeConnectable API, since connection-related API
such as UsdShadeConnectableAPI::ConnectToSource() are static methods,
and UsdShadeNodeGraph will auto-convert to a UsdShadeConnectableAPI
when passed to functions that want to act generically on a connectable
UsdShadeConnectableAPI object.
CreateInput(name, typeName) → Input
Create an Input which can either have a value or can be connected.
The attribute representing the input is created in
the”inputs:”namespace.
Parameters
name (str) –
typeName (ValueTypeName) –
CreateOutput(name, typeName) → Output
Create an output which can either have a value or can be connected.
The attribute representing the output is created in
the”outputs:”namespace.
Parameters
name (str) –
typeName (ValueTypeName) –
static Define()
classmethod Define(stage, path) -> NodeGraph
Attempt to ensure a UsdPrim adhering to this schema at path is
defined (according to UsdPrim::IsDefined() ) on this stage.
If a prim adhering to this schema at path is already defined on
this stage, return that prim. Otherwise author an SdfPrimSpec with
specifier == SdfSpecifierDef and this schema’s prim type name for
the prim at path at the current EditTarget. Author SdfPrimSpec s
with specifier == SdfSpecifierDef and empty typeName at the
current EditTarget for any nonexistent, or existing but not Defined
ancestors.
The given path must be an absolute prim path that does not contain
any variant selections.
If it is impossible to author any of the necessary PrimSpecs, (for
example, in case path cannot map to the current UsdEditTarget ‘s
namespace) issue an error and return an invalid UsdPrim.
Note that this method may return a defined prim whose typeName does
not specify this schema class, in case a stronger typeName opinion
overrides the opinion at the current EditTarget.
Parameters
stage (Stage) –
path (Path) –
static Get()
classmethod Get(stage, path) -> NodeGraph
Return a UsdShadeNodeGraph holding the prim adhering to this schema at
path on stage .
If no prim exists at path on stage , or if the prim at that
path does not adhere to this schema, return an invalid schema object.
This is shorthand for the following:
UsdShadeNodeGraph(stage->GetPrimAtPath(path));
Parameters
stage (Stage) –
path (Path) –
GetInput(name) → Input
Return the requested input if it exists.
Parameters
name (str) –
GetInputs(onlyAuthored) → list[Input]
Returns all inputs present on the node-graph.
These are represented by attributes in the”inputs:”namespace. If
onlyAuthored is true (the default), then only return authored
attributes; otherwise, this also returns un-authored builtins.
Parameters
onlyAuthored (bool) –
GetInterfaceInputs() → list[Input]
Returns all the”Interface Inputs”of the node-graph.
This is the same as GetInputs() , but is provided as a convenience, to
allow clients to distinguish between inputs on shaders vs. interface-
inputs on node-graphs.
GetOutput(name) → Output
Return the requested output if it exists.
Parameters
name (str) –
GetOutputs(onlyAuthored) → list[Output]
Outputs are represented by attributes in the”outputs:”namespace.
If onlyAuthored is true (the default), then only return authored
attributes; otherwise, this also returns un-authored builtins.
Parameters
onlyAuthored (bool) –
static GetSchemaAttributeNames()
classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken]
Return a vector of names of all pre-declared attributes for this
schema class and all its ancestor classes.
Does not include attributes that may be authored by custom/extended
methods of the schemas involved.
Parameters
includeInherited (bool) –
class pxr.UsdShade.Output
This class encapsulates a shader or node-graph output, which is a
connectable attribute representing a typed, externally computed value.
Methods:
CanConnect(source)
Determines whether this Output can be connected to the given source attribute, which can be an input or an output.
ClearSdrMetadata()
Clears any"sdrMetadata"value authored on the Output in the current EditTarget.
ClearSdrMetadataByKey(key)
Clears the entry corresponding to the given key in the"sdrMetadata"dictionary authored in the current EditTarget.
ClearSource()
Deprecated
ClearSources()
Clears sources for this Output in the current UsdEditTarget.
ConnectToSource(source, mod)
Authors a connection for this Output.
DisconnectSource(sourceAttr)
Disconnect source for this Output.
GetAttr()
Explicit UsdAttribute extractor.
GetBaseName()
Returns the name of the output.
GetConnectedSource(source, sourceName, ...)
Deprecated
GetConnectedSources(invalidSourcePaths)
Finds the valid sources of connections for the Output.
GetFullName()
Get the name of the attribute associated with the output.
GetPrim()
Get the prim that the output belongs to.
GetRawConnectedSourcePaths(sourcePaths)
Deprecated
GetRenderType()
Return this output's specialized renderType, or an empty token if none was authored.
GetSdrMetadata()
Returns this Output's composed"sdrMetadata"dictionary as a NdrTokenMap.
GetSdrMetadataByKey(key)
Returns the value corresponding to key in the composed sdrMetadata dictionary.
GetTypeName()
Get the"scene description"value type name of the attribute associated with the output.
GetValueProducingAttributes(shaderOutputsOnly)
Find what is connected to this Output recursively.
HasConnectedSource()
Returns true if and only if this Output is currently connected to a valid (defined) source.
HasRenderType()
Return true if a renderType has been specified for this output.
HasSdrMetadata()
Returns true if the Output has a non-empty composed"sdrMetadata"dictionary value.
HasSdrMetadataByKey(key)
Returns true if there is a value corresponding to the given key in the composed"sdrMetadata"dictionary.
IsOutput
classmethod IsOutput(attr) -> bool
IsSourceConnectionFromBaseMaterial()
Returns true if the connection to this Output's source, as returned by GetConnectedSource() , is authored across a specializes arc, which is used to denote a base material.
Set(value, time)
Set a value for the output.
SetConnectedSources(sourceInfos)
Connects this Output to the given sources, sourceInfos .
SetRenderType(renderType)
Specify an alternative, renderer-specific type to use when emitting/translating this output, rather than translating based on its GetTypeName()
SetSdrMetadata(sdrMetadata)
Authors the given sdrMetadata value on this Output at the current EditTarget.
SetSdrMetadataByKey(key, value)
Sets the value corresponding to key to the given string value , in the Output's"sdrMetadata"dictionary at the current EditTarget.
CanConnect(source) → bool
Determines whether this Output can be connected to the given source
attribute, which can be an input or an output.
An output is considered to be connectable only if it belongs to a
node-graph. Shader outputs are not connectable.
UsdShadeConnectableAPI::CanConnect
Parameters
source (Attribute) –
CanConnect(sourceInput) -> bool
This is an overloaded member function, provided for convenience. It
differs from the above function only in what argument(s) it accepts.
Parameters
sourceInput (Input) –
CanConnect(sourceOutput) -> bool
This is an overloaded member function, provided for convenience. It
differs from the above function only in what argument(s) it accepts.
Parameters
sourceOutput (Output) –
ClearSdrMetadata() → None
Clears any”sdrMetadata”value authored on the Output in the current
EditTarget.
ClearSdrMetadataByKey(key) → None
Clears the entry corresponding to the given key in
the”sdrMetadata”dictionary authored in the current EditTarget.
Parameters
key (str) –
ClearSource() → bool
Deprecated
ClearSources() → bool
Clears sources for this Output in the current UsdEditTarget.
Most of the time, what you probably want is DisconnectSource() rather
than this function.
UsdShadeConnectableAPI::ClearSources
ConnectToSource(source, mod) → bool
Authors a connection for this Output.
source is a struct that describes the upstream source attribute
with all the information necessary to make a connection. See the
documentation for UsdShadeConnectionSourceInfo. mod describes the
operation that should be applied to the list of connections. By
default the new connection will replace any existing connections, but
it can add to the list of connections to represent multiple input
connections.
true if a connection was created successfully. false if
shadingAttr or source is invalid.
This method does not verify the connectability of the shading
attribute to the source. Clients must invoke CanConnect() themselves
to ensure compatibility.
The source shading attribute is created if it doesn’t exist already.
UsdShadeConnectableAPI::ConnectToSource
Parameters
source (ConnectionSourceInfo) –
mod (ConnectionModification) –
ConnectToSource(source, sourceName, sourceType, typeName) -> bool
Deprecated
This is an overloaded member function, provided for convenience. It
differs from the above function only in what argument(s) it accepts.
Parameters
source (ConnectableAPI) –
sourceName (str) –
sourceType (AttributeType) –
typeName (ValueTypeName) –
ConnectToSource(sourcePath) -> bool
Authors a connection for this Output to the source at the given path.
UsdShadeConnectableAPI::ConnectToSource
Parameters
sourcePath (Path) –
ConnectToSource(sourceInput) -> bool
Connects this Output to the given input, sourceInput .
UsdShadeConnectableAPI::ConnectToSource
Parameters
sourceInput (Input) –
ConnectToSource(sourceOutput) -> bool
Connects this Output to the given output, sourceOutput .
UsdShadeConnectableAPI::ConnectToSource
Parameters
sourceOutput (Output) –
DisconnectSource(sourceAttr) → bool
Disconnect source for this Output.
If sourceAttr is valid, only a connection to the specified
attribute is disconnected, otherwise all connections are removed.
UsdShadeConnectableAPI::DisconnectSource
Parameters
sourceAttr (Attribute) –
GetAttr() → Attribute
Explicit UsdAttribute extractor.
GetBaseName() → str
Returns the name of the output.
We call this the base name since it strips off the”outputs:”namespace
prefix from the attribute name, and returns it.
GetConnectedSource(source, sourceName, sourceType) → bool
Deprecated
Please use GetConnectedSources instead
Parameters
source (ConnectableAPI) –
sourceName (str) –
sourceType (AttributeType) –
GetConnectedSources(invalidSourcePaths) → list[SourceInfo]
Finds the valid sources of connections for the Output.
invalidSourcePaths is an optional output parameter to collect the
invalid source paths that have not been reported in the returned
vector.
Returns a vector of UsdShadeConnectionSourceInfo structs with
information about each upsteam attribute. If the vector is empty,
there have been no valid connections.
A valid connection requires the existence of the source attribute and
also requires that the source prim is UsdShadeConnectableAPI
compatible.
The python wrapping returns a tuple with the valid connections first,
followed by the invalid source paths.
UsdShadeConnectableAPI::GetConnectedSources
Parameters
invalidSourcePaths (list[SdfPath]) –
GetFullName() → str
Get the name of the attribute associated with the output.
GetPrim() → Prim
Get the prim that the output belongs to.
GetRawConnectedSourcePaths(sourcePaths) → bool
Deprecated
Returns the”raw”(authored) connected source paths for this Output.
UsdShadeConnectableAPI::GetRawConnectedSourcePaths
Parameters
sourcePaths (list[SdfPath]) –
GetRenderType() → str
Return this output’s specialized renderType, or an empty token if none
was authored.
SetRenderType()
GetSdrMetadata() → NdrTokenMap
Returns this Output’s composed”sdrMetadata”dictionary as a
NdrTokenMap.
GetSdrMetadataByKey(key) → str
Returns the value corresponding to key in the composed
sdrMetadata dictionary.
Parameters
key (str) –
GetTypeName() → ValueTypeName
Get the”scene description”value type name of the attribute associated
with the output.
GetValueProducingAttributes(shaderOutputsOnly) → list[UsdShadeAttribute]
Find what is connected to this Output recursively.
UsdShadeUtils::GetValueProducingAttributes
Parameters
shaderOutputsOnly (bool) –
HasConnectedSource() → bool
Returns true if and only if this Output is currently connected to a
valid (defined) source.
UsdShadeConnectableAPI::HasConnectedSource
HasRenderType() → bool
Return true if a renderType has been specified for this output.
SetRenderType()
HasSdrMetadata() → bool
Returns true if the Output has a non-empty
composed”sdrMetadata”dictionary value.
HasSdrMetadataByKey(key) → bool
Returns true if there is a value corresponding to the given key in
the composed”sdrMetadata”dictionary.
Parameters
key (str) –
static IsOutput()
classmethod IsOutput(attr) -> bool
Test whether a given UsdAttribute represents a valid Output, which
implies that creating a UsdShadeOutput from the attribute will
succeed.
Success implies that attr.IsDefined() is true.
Parameters
attr (Attribute) –
IsSourceConnectionFromBaseMaterial() → bool
Returns true if the connection to this Output’s source, as returned by
GetConnectedSource() , is authored across a specializes arc, which is
used to denote a base material.
UsdShadeConnectableAPI::IsSourceConnectionFromBaseMaterial
Set(value, time) → bool
Set a value for the output.
It’s unusual to be setting a value on an output since it represents an
externally computed value. The Set API is provided here just for the
sake of completeness and uniformity with other property schema.
Parameters
value (VtValue) –
time (TimeCode) –
Set(value, time) -> bool
This is an overloaded member function, provided for convenience. It
differs from the above function only in what argument(s) it accepts.
Set the attribute value of the Output at time .
Parameters
value (T) –
time (TimeCode) –
SetConnectedSources(sourceInfos) → bool
Connects this Output to the given sources, sourceInfos .
UsdShadeConnectableAPI::SetConnectedSources
Parameters
sourceInfos (list[ConnectionSourceInfo]) –
SetRenderType(renderType) → bool
Specify an alternative, renderer-specific type to use when
emitting/translating this output, rather than translating based on its
GetTypeName()
For example, we set the renderType to”struct”for outputs that are of
renderman custom struct types.
true on success
Parameters
renderType (str) –
SetSdrMetadata(sdrMetadata) → None
Authors the given sdrMetadata value on this Output at the current
EditTarget.
Parameters
sdrMetadata (NdrTokenMap) –
SetSdrMetadataByKey(key, value) → None
Sets the value corresponding to key to the given string value
, in the Output’s”sdrMetadata”dictionary at the current EditTarget.
Parameters
key (str) –
value (str) –
class pxr.UsdShade.Shader
Base class for all USD shaders. Shaders are the building blocks of
shading networks. While UsdShadeShader objects are not target
specific, each renderer or application target may derive its own
renderer-specific shader object types from this base, if needed.
Objects of this class generally represent a single shading object,
whether it exists in the target renderer or not. For example, a
texture, a fractal, or a mix node.
The UsdShadeNodeDefAPI provides attributes to uniquely identify the
type of this node. The id resolution into a renderable shader target
type of this node. The id resolution into a renderable shader target
is deferred to the consuming application.
The purpose of representing them in Usd is two-fold:
To represent, via”connections”the topology of the shading network
that must be reconstructed in the renderer. Facilities for authoring
and manipulating connections are encapsulated in the API schema
UsdShadeConnectableAPI.
To present a (partial or full) interface of typed input
parameters whose values can be set and overridden in Usd, to be
provided later at render-time as parameter values to the actual render
shader objects. Shader input parameters are encapsulated in the
property schema UsdShadeInput.
Methods:
ClearSdrMetadata()
Clears any"sdrMetadata"value authored on the shader in the current EditTarget.
ClearSdrMetadataByKey(key)
Clears the entry corresponding to the given key in the"sdrMetadata"dictionary authored in the current EditTarget.
ConnectableAPI()
Contructs and returns a UsdShadeConnectableAPI object with this shader.
CreateIdAttr(defaultValue, writeSparsely)
Forwards to UsdShadeNodeDefAPI(prim).
CreateImplementationSourceAttr(defaultValue, ...)
Forwards to UsdShadeNodeDefAPI(prim).
CreateInput(name, typeName)
Create an input which can either have a value or can be connected.
CreateOutput(name, typeName)
Create an output which can either have a value or can be connected.
Define
classmethod Define(stage, path) -> Shader
Get
classmethod Get(stage, path) -> Shader
GetIdAttr()
Forwards to UsdShadeNodeDefAPI(prim).
GetImplementationSource()
Forwards to UsdShadeNodeDefAPI(prim).
GetImplementationSourceAttr()
Forwards to UsdShadeNodeDefAPI(prim).
GetInput(name)
Return the requested input if it exists.
GetInputs(onlyAuthored)
Inputs are represented by attributes in the"inputs:"namespace.
GetOutput(name)
Return the requested output if it exists.
GetOutputs(onlyAuthored)
Outputs are represented by attributes in the"outputs:"namespace.
GetSchemaAttributeNames
classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken]
GetSdrMetadata()
Returns this shader's composed"sdrMetadata"dictionary as a NdrTokenMap.
GetSdrMetadataByKey(key)
Returns the value corresponding to key in the composed sdrMetadata dictionary.
GetShaderId(id)
Forwards to UsdShadeNodeDefAPI(prim).
GetShaderNodeForSourceType(sourceType)
Forwards to UsdShadeNodeDefAPI(prim).
GetSourceAsset(sourceAsset, sourceType)
Forwards to UsdShadeNodeDefAPI(prim).
GetSourceAssetSubIdentifier(subIdentifier, ...)
Forwards to UsdShadeNodeDefAPI(prim).
GetSourceCode(sourceCode, sourceType)
Forwards to UsdShadeNodeDefAPI(prim).
HasSdrMetadata()
Returns true if the shader has a non-empty composed"sdrMetadata"dictionary value.
HasSdrMetadataByKey(key)
Returns true if there is a value corresponding to the given key in the composed"sdrMetadata"dictionary.
SetSdrMetadata(sdrMetadata)
Authors the given sdrMetadata on this shader at the current EditTarget.
SetSdrMetadataByKey(key, value)
Sets the value corresponding to key to the given string value , in the shader's"sdrMetadata"dictionary at the current EditTarget.
SetShaderId(id)
Forwards to UsdShadeNodeDefAPI(prim).
SetSourceAsset(sourceAsset, sourceType)
Forwards to UsdShadeNodeDefAPI(prim).
SetSourceAssetSubIdentifier(subIdentifier, ...)
Forwards to UsdShadeNodeDefAPI(prim).
SetSourceCode(sourceCode, sourceType)
Forwards to UsdShadeNodeDefAPI(prim).
ClearSdrMetadata() → None
Clears any”sdrMetadata”value authored on the shader in the current
EditTarget.
ClearSdrMetadataByKey(key) → None
Clears the entry corresponding to the given key in
the”sdrMetadata”dictionary authored in the current EditTarget.
Parameters
key (str) –
ConnectableAPI() → ConnectableAPI
Contructs and returns a UsdShadeConnectableAPI object with this
shader.
Note that most tasks can be accomplished without explicitly
constructing a UsdShadeConnectable API, since connection-related API
such as UsdShadeConnectableAPI::ConnectToSource() are static methods,
and UsdShadeShader will auto-convert to a UsdShadeConnectableAPI when
passed to functions that want to act generically on a connectable
UsdShadeConnectableAPI object.
CreateIdAttr(defaultValue, writeSparsely) → Attribute
Forwards to UsdShadeNodeDefAPI(prim).
Parameters
defaultValue (VtValue) –
writeSparsely (bool) –
CreateImplementationSourceAttr(defaultValue, writeSparsely) → Attribute
Forwards to UsdShadeNodeDefAPI(prim).
Parameters
defaultValue (VtValue) –
writeSparsely (bool) –
CreateInput(name, typeName) → Input
Create an input which can either have a value or can be connected.
The attribute representing the input is created in
the”inputs:”namespace. Inputs on both shaders and node-graphs are
connectable.
Parameters
name (str) –
typeName (ValueTypeName) –
CreateOutput(name, typeName) → Output
Create an output which can either have a value or can be connected.
The attribute representing the output is created in
the”outputs:”namespace. Outputs on a shader cannot be connected, as
their value is assumed to be computed externally.
Parameters
name (str) –
typeName (ValueTypeName) –
static Define()
classmethod Define(stage, path) -> Shader
Attempt to ensure a UsdPrim adhering to this schema at path is
defined (according to UsdPrim::IsDefined() ) on this stage.
If a prim adhering to this schema at path is already defined on
this stage, return that prim. Otherwise author an SdfPrimSpec with
specifier == SdfSpecifierDef and this schema’s prim type name for
the prim at path at the current EditTarget. Author SdfPrimSpec s
with specifier == SdfSpecifierDef and empty typeName at the
current EditTarget for any nonexistent, or existing but not Defined
ancestors.
The given path must be an absolute prim path that does not contain
any variant selections.
If it is impossible to author any of the necessary PrimSpecs, (for
example, in case path cannot map to the current UsdEditTarget ‘s
namespace) issue an error and return an invalid UsdPrim.
Note that this method may return a defined prim whose typeName does
not specify this schema class, in case a stronger typeName opinion
overrides the opinion at the current EditTarget.
Parameters
stage (Stage) –
path (Path) –
static Get()
classmethod Get(stage, path) -> Shader
Return a UsdShadeShader holding the prim adhering to this schema at
path on stage .
If no prim exists at path on stage , or if the prim at that
path does not adhere to this schema, return an invalid schema object.
This is shorthand for the following:
UsdShadeShader(stage->GetPrimAtPath(path));
Parameters
stage (Stage) –
path (Path) –
GetIdAttr() → Attribute
Forwards to UsdShadeNodeDefAPI(prim).
GetImplementationSource() → str
Forwards to UsdShadeNodeDefAPI(prim).
GetImplementationSourceAttr() → Attribute
Forwards to UsdShadeNodeDefAPI(prim).
GetInput(name) → Input
Return the requested input if it exists.
Parameters
name (str) –
GetInputs(onlyAuthored) → list[Input]
Inputs are represented by attributes in the”inputs:”namespace.
If onlyAuthored is true (the default), then only return authored
attributes; otherwise, this also returns un-authored builtins.
Parameters
onlyAuthored (bool) –
GetOutput(name) → Output
Return the requested output if it exists.
Parameters
name (str) –
GetOutputs(onlyAuthored) → list[Output]
Outputs are represented by attributes in the”outputs:”namespace.
If onlyAuthored is true (the default), then only return authored
attributes; otherwise, this also returns un-authored builtins.
Parameters
onlyAuthored (bool) –
static GetSchemaAttributeNames()
classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken]
Return a vector of names of all pre-declared attributes for this
schema class and all its ancestor classes.
Does not include attributes that may be authored by custom/extended
methods of the schemas involved.
Parameters
includeInherited (bool) –
GetSdrMetadata() → NdrTokenMap
Returns this shader’s composed”sdrMetadata”dictionary as a
NdrTokenMap.
GetSdrMetadataByKey(key) → str
Returns the value corresponding to key in the composed
sdrMetadata dictionary.
Parameters
key (str) –
GetShaderId(id) → bool
Forwards to UsdShadeNodeDefAPI(prim).
Parameters
id (str) –
GetShaderNodeForSourceType(sourceType) → ShaderNode
Forwards to UsdShadeNodeDefAPI(prim).
Parameters
sourceType (str) –
GetSourceAsset(sourceAsset, sourceType) → bool
Forwards to UsdShadeNodeDefAPI(prim).
Parameters
sourceAsset (AssetPath) –
sourceType (str) –
GetSourceAssetSubIdentifier(subIdentifier, sourceType) → bool
Forwards to UsdShadeNodeDefAPI(prim).
Parameters
subIdentifier (str) –
sourceType (str) –
GetSourceCode(sourceCode, sourceType) → bool
Forwards to UsdShadeNodeDefAPI(prim).
Parameters
sourceCode (str) –
sourceType (str) –
HasSdrMetadata() → bool
Returns true if the shader has a non-empty
composed”sdrMetadata”dictionary value.
HasSdrMetadataByKey(key) → bool
Returns true if there is a value corresponding to the given key in
the composed”sdrMetadata”dictionary.
Parameters
key (str) –
SetSdrMetadata(sdrMetadata) → None
Authors the given sdrMetadata on this shader at the current
EditTarget.
Parameters
sdrMetadata (NdrTokenMap) –
SetSdrMetadataByKey(key, value) → None
Sets the value corresponding to key to the given string value
, in the shader’s”sdrMetadata”dictionary at the current EditTarget.
Parameters
key (str) –
value (str) –
SetShaderId(id) → bool
Forwards to UsdShadeNodeDefAPI(prim).
Parameters
id (str) –
SetSourceAsset(sourceAsset, sourceType) → bool
Forwards to UsdShadeNodeDefAPI(prim).
Parameters
sourceAsset (AssetPath) –
sourceType (str) –
SetSourceAssetSubIdentifier(subIdentifier, sourceType) → bool
Forwards to UsdShadeNodeDefAPI(prim).
Parameters
subIdentifier (str) –
sourceType (str) –
SetSourceCode(sourceCode, sourceType) → bool
Forwards to UsdShadeNodeDefAPI(prim).
Parameters
sourceCode (str) –
sourceType (str) –
class pxr.UsdShade.ShaderDefParserPlugin
Parses shader definitions represented using USD scene description
using the schemas provided by UsdShade.
Methods:
GetDiscoveryTypes()
Returns the types of nodes that this plugin can parse.
GetSourceType()
Returns the source type that this parser operates on.
Parse(discoveryResult)
Takes the specified NdrNodeDiscoveryResult instance, which was a result of the discovery process, and generates a new NdrNode .
GetDiscoveryTypes() → NdrTokenVec
Returns the types of nodes that this plugin can parse.
“Type”here is the discovery type (in the case of files, this will
probably be the file extension, but in other systems will be data that
can be determined during discovery). This type should only be used to
match up a NdrNodeDiscoveryResult to its parser plugin; this value
is not exposed in the node’s API.
GetSourceType() → str
Returns the source type that this parser operates on.
A source type is the most general type for a node. The parser plugin
is responsible for parsing all discovery results that have the types
declared under GetDiscoveryTypes() , and those types are
collectively identified as one”source type”.
Parse(discoveryResult) → NdrNodeUnique
Takes the specified NdrNodeDiscoveryResult instance, which was a
result of the discovery process, and generates a new NdrNode .
The node’s name, source type, and family must match.
Parameters
discoveryResult (NodeDiscoveryResult) –
class pxr.UsdShade.ShaderDefUtils
This class contains a set of utility functions used for populating the
shader registry with shaders definitions specified using UsdShade
schemas.
Methods:
GetNodeDiscoveryResults
classmethod GetNodeDiscoveryResults(shaderDef, sourceUri) -> NdrNodeDiscoveryResultVec
GetPrimvarNamesMetadataString
classmethod GetPrimvarNamesMetadataString(metadata, shaderDef) -> str
GetShaderProperties
classmethod GetShaderProperties(shaderDef) -> NdrPropertyUniquePtrVec
static GetNodeDiscoveryResults()
classmethod GetNodeDiscoveryResults(shaderDef, sourceUri) -> NdrNodeDiscoveryResultVec
Returns the list of NdrNodeDiscoveryResult objects that must be added
to the shader registry for the given shader shaderDef , assuming
it is found in a shader definition file found by an Ndr discovery
plugin.
To enable the shaderDef parser to find and parse this shader,
sourceUri should have the resolved path to the usd file containing
this shader prim.
Parameters
shaderDef (Shader) –
sourceUri (str) –
static GetPrimvarNamesMetadataString()
classmethod GetPrimvarNamesMetadataString(metadata, shaderDef) -> str
Collects all the names of valid primvar inputs of the given
metadata and the given shaderDef and returns the string used
to represent them in SdrShaderNode metadata.
Parameters
metadata (NdrTokenMap) –
shaderDef (ConnectableAPI) –
static GetShaderProperties()
classmethod GetShaderProperties(shaderDef) -> NdrPropertyUniquePtrVec
Gets all input and output properties of the given shaderDef and
translates them into NdrProperties that can be used as the properties
for an SdrShaderNode.
Parameters
shaderDef (ConnectableAPI) –
class pxr.UsdShade.Tokens
Attributes:
allPurpose
bindMaterialAs
coordSys
displacement
fallbackStrength
full
id
infoId
infoImplementationSource
inputs
interfaceOnly
materialBind
materialBinding
materialBindingCollection
materialVariant
outputs
outputsDisplacement
outputsSurface
outputsVolume
preview
sdrMetadata
sourceAsset
sourceCode
strongerThanDescendants
subIdentifier
surface
universalRenderContext
universalSourceType
volume
weakerThanDescendants
allPurpose = ''
bindMaterialAs = 'bindMaterialAs'
coordSys = 'coordSys:'
displacement = 'displacement'
fallbackStrength = 'fallbackStrength'
full = 'full'
id = 'id'
infoId = 'info:id'
infoImplementationSource = 'info:implementationSource'
inputs = 'inputs:'
interfaceOnly = 'interfaceOnly'
materialBind = 'materialBind'
materialBinding = 'material:binding'
materialBindingCollection = 'material:binding:collection'
materialVariant = 'materialVariant'
outputs = 'outputs:'
outputsDisplacement = 'outputs:displacement'
outputsSurface = 'outputs:surface'
outputsVolume = 'outputs:volume'
preview = 'preview'
sdrMetadata = 'sdrMetadata'
sourceAsset = 'sourceAsset'
sourceCode = 'sourceCode'
strongerThanDescendants = 'strongerThanDescendants'
subIdentifier = 'subIdentifier'
surface = 'surface'
universalRenderContext = ''
universalSourceType = ''
volume = 'volume'
weakerThanDescendants = 'weakerThanDescendants'
class pxr.UsdShade.Utils
This class contains a set of utility functions used when authoring and
querying shading networks.
Methods:
GetBaseNameAndType
classmethod GetBaseNameAndType(fullName) -> tuple[str, AttributeType]
GetConnectedSourcePath
classmethod GetConnectedSourcePath(srcInfo) -> Path
GetFullName
classmethod GetFullName(baseName, type) -> str
GetPrefixForAttributeType
classmethod GetPrefixForAttributeType(sourceType) -> str
GetType
classmethod GetType(fullName) -> AttributeType
GetValueProducingAttributes
classmethod GetValueProducingAttributes(input, shaderOutputsOnly) -> list[UsdShadeAttribute]
static GetBaseNameAndType()
classmethod GetBaseNameAndType(fullName) -> tuple[str, AttributeType]
Given the full name of a shading attribute, returns it’s base name and
shading attribute type.
Parameters
fullName (str) –
static GetConnectedSourcePath()
classmethod GetConnectedSourcePath(srcInfo) -> Path
For a valid UsdShadeConnectionSourceInfo, return the complete path to
the source property; otherwise the empty path.
Parameters
srcInfo (ConnectionSourceInfo) –
static GetFullName()
classmethod GetFullName(baseName, type) -> str
Returns the full shading attribute name given the basename and the
shading attribute type.
baseName is the name of the input or output on the shading node.
type is the UsdShadeAttributeType of the shading attribute.
Parameters
baseName (str) –
type (AttributeType) –
static GetPrefixForAttributeType()
classmethod GetPrefixForAttributeType(sourceType) -> str
Returns the namespace prefix of the USD attribute associated with the
given shading attribute type.
Parameters
sourceType (AttributeType) –
static GetType()
classmethod GetType(fullName) -> AttributeType
Given the full name of a shading attribute, returns its shading
attribute type.
Parameters
fullName (str) –
static GetValueProducingAttributes()
classmethod GetValueProducingAttributes(input, shaderOutputsOnly) -> list[UsdShadeAttribute]
Find what is connected to an Input or Output recursively.
GetValueProducingAttributes implements the UsdShade connectivity rules
described in Connection Resolution Utilities.
When tracing connections within networks that contain containers like
UsdShadeNodeGraph nodes, the actual output(s) or value(s) at the end
of an input or output might be multiple connections removed. The
methods below resolves this across multiple physical connections.
An UsdShadeInput is getting its value from one of these sources:
If the input is not connected the UsdAttribute for this input is
returned, but only if it has an authored value. The input attribute
itself carries the value for this input.
If the input is connected we follow the connection(s) until we
reach a valid output of a UsdShadeShader node or if we reach a valid
UsdShadeInput attribute of a UsdShadeNodeGraph or UsdShadeMaterial
that has an authored value.
An UsdShadeOutput on a container can get its value from the same type
of sources as a UsdShadeInput on either a UsdShadeShader or
UsdShadeNodeGraph. Outputs on non-containers (UsdShadeShaders) cannot
be connected.
This function returns a vector of UsdAttributes. The vector is empty
if no valid attribute was found. The type of each attribute can be
determined with the UsdShadeUtils::GetType function.
If shaderOutputsOnly is true, it will only report attributes that
are outputs of non-containers (UsdShadeShaders). This is a bit faster
and what is need when determining the connections for Material
terminals.
This will return the last attribute along the connection chain that
has an authored value, which might not be the last attribute in the
chain itself.
When the network contains multi-connections, this function can return
multiple attributes for a single input or output. The list of
attributes is build by a depth-first search, following the underlying
connection paths in order. The list can contain both UsdShadeOutput
and UsdShadeInput attributes. It is up to the caller to decide how to
process such a mixture.
Parameters
input (Input) –
shaderOutputsOnly (bool) –
GetValueProducingAttributes(output, shaderOutputsOnly) -> list[UsdShadeAttribute]
This is an overloaded member function, provided for convenience. It
differs from the above function only in what argument(s) it accepts.
Parameters
output (Output) –
shaderOutputsOnly (bool) –
© Copyright 2019-2023, NVIDIA.
Last updated on Nov 14, 2023.
|