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
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 |
|
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
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 |
|
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 |
|
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
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 |
|
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
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 |
|
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
435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 |
|
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
708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 |
|
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
age
of five.lsattrs({"age": "five"})
Return nodes with both
age
andcolor
of five and blue.lsattrs({"age": "five", "color": "blue"})
Return
list: matching nodes.
Source code in client/ayon_maya/api/lib.py
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 |
|
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
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 |
|
read(node)
Return user-defined attributes from node
Source code in client/ayon_maya/api/lib.py
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 |
|
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
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
|
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
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 |
|