api
Public API
Anything that isn't defined here is INTERNAL and unreliable for external use.
 Loader 
  Bases: LoaderPlugin
Source code in client/ayon_maya/api/plugin.py
 | 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 |  | 
 get_custom_namespace_and_group(context, options, loader_key) 
 Queries Settings to get custom template for namespace and group.
Group template might be empty >> this forces to not wrap imported items into separate group.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| options | dict | artist modifiable options from dialog | required | 
| loader_key | str | key to get separate configuration from Settings ('reference_loader'|'import_loader') | required | 
Source code in client/ayon_maya/api/plugin.py
 | 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 |  | 
 MayaHost 
  Bases: HostBase, IWorkfileHost, ILoadHost, IPublishHost
Source code in client/ayon_maya/api/pipeline.py
 | 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 |  | 
 apply_shaders(relationships, shadernodes, nodes) 
 Link shadingEngine to the right nodes based on relationship data
Relationship data is constructed of a collection of sets and attributes sets corresponds with the shaderEngines found in the lookdev. Each set has the keys name, members and uuid, the members hold a collection of node information name and uuid.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| relationships | dict | relationship data | required | 
| shadernodes | list | list of nodes of the shading objectSets (includes | required | 
| nodes | list | list of nodes to apply shader to | required | 
Returns:
| Type | Description | 
|---|---|
| None | 
Source code in client/ayon_maya/api/lib.py
 | 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 |  | 
 containerise(name, namespace, nodes, context, loader=None, suffix='CON') 
 Bundle nodes into an assembly and imprint it with metadata
Containerisation enables a tracking of version, author and origin for loaded assets.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| name | str | Name of resulting assembly | required | 
| namespace | str | Namespace under which to host container | required | 
| nodes | list | Long names of nodes to containerise | required | 
| context | dict | Asset information | required | 
| loader | str | Name of loader used to produce this container. | None | 
| suffix | str | Suffix of container, defaults to  | 'CON' | 
Returns:
| Name | Type | Description | 
|---|---|---|
| container | str | Name of container assembly | 
Source code in client/ayon_maya/api/pipeline.py
 | 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 |  | 
 ls() 
 Yields containers from active Maya scene
This is the host-equivalent of api.ls(), but instead of listing assets on disk, it lists assets already loaded in Maya; once loaded they are called 'containers'
Yields:
| Type | Description | 
|---|---|
| dict[str, Any]: container | 
Source code in client/ayon_maya/api/pipeline.py
 | 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 |  | 
 lsattr(attr, value=None) 
 Return nodes matching key and value
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| attr | str | Name of Maya attribute | required | 
| value | object | Value of attribute. If none is provided, return all nodes with this attribute. | None | 
Example
lsattr("id", "myId") ["myNode"] lsattr("id") ["myNode", "myOtherNode"]
Source code in client/ayon_maya/api/lib.py
 | 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 |  | 
 lsattrs(attrs) 
 Return nodes with the given attribute(s).
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| attrs | dict | Name and value pairs of expected matches | required | 
Example
Return nodes with an
ageof five.lsattrs({"age": "five"})
Return nodes with both
ageandcolorof five and blue.lsattrs({"age": "five", "color": "blue"})
Return
list: matching nodes.
Source code in client/ayon_maya/api/lib.py
 | 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 |  | 
 maintained_selection() 
 Maintain selection during context
Example
scene = cmds.file(new=True, force=True) node = cmds.createNode("transform", name="Test") cmds.select("persp") with maintained_selection(): ... cmds.select("Test", replace=True) "Test" in cmds.ls(selection=True) False
Source code in client/ayon_maya/api/lib.py
 | 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 |  | 
 read(node) 
 Return user-defined attributes from node
Source code in client/ayon_maya/api/lib.py
 | 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 |  | 
 suspended_refresh(suspend=True) 
 Suspend viewport refreshes
cmds.ogs(pause=True) is a toggle so we can't pass False.
Source code in client/ayon_maya/api/lib.py
 | 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |  | 
 unique_namespace(namespace, format='%02d', prefix='', suffix='') 
 Return unique namespace
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| namespace | str | Name of namespace to consider | required | 
| format | str | Formatting of the given iteration number | '%02d' | 
| suffix | str | Only consider namespaces with this suffix. | '' | 
unique_namespace("bar")
bar01
unique_namespace(":hello")
:hello01
unique_namespace("bar:", suffix="_NS")
bar01_NS:
Source code in client/ayon_maya/api/lib.py
 | 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 |  |