load
IncompatibleLoaderError
Bases: ValueError
Error when Loader is incompatible with a representation.
Source code in client/ayon_core/pipeline/load/utils.py
58 59 60 |
|
InvalidRepresentationContext
Bases: ValueError
Representation path can't be received using representation document.
Source code in client/ayon_core/pipeline/load/utils.py
63 64 65 |
|
LoadError
Bases: Exception
Known error that happened during loading.
A message is shown to user (without traceback). Make sure an artist can understand the problem.
Source code in client/ayon_core/pipeline/load/utils.py
48 49 50 51 52 53 54 55 |
|
LoaderNotFoundError
Bases: RuntimeError
Error when Loader plugin for a loader name is not found.
Source code in client/ayon_core/pipeline/load/utils.py
73 74 75 |
|
LoaderPlugin
Bases: list
Load representation into host application
Source code in client/ayon_core/pipeline/load/plugins.py
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 |
|
fname
property
Backwards compatibility with deprecation warning
get_options(contexts)
classmethod
Returns static (cls) options or could collect from 'contexts'.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
contexts | list | of repre or product contexts | required |
Returns: (list)
Source code in client/ayon_core/pipeline/load/plugins.py
212 213 214 215 216 217 218 219 220 221 222 |
|
get_representation_name_aliases(representation_name)
classmethod
Return representation names to which switching is allowed from the input representation name, like an alias replacement of the input representation_name
.
For example, to allow an automated switch on update from representation ma
to mb
or abc
, then when representation_name
is ma
return: ["mb", "abc"]
The order of the names in the returned representation names is important, because the first one existing under the new version will be chosen.
Returns:
Type | Description |
---|---|
List[str]: Representation names switching to is allowed on update if the input representation name is not found on the new version. |
Source code in client/ayon_core/pipeline/load/plugins.py
237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 |
|
get_representations()
classmethod
Representation names with which is plugin compatible.
Empty set makes the plugin incompatible with any representation. To allow compatibility with all representations use '{"*"}'.
Returns:
Type | Description |
---|---|
set[str]: Names with which is plugin compatible. |
Source code in client/ayon_core/pipeline/load/plugins.py
155 156 157 158 159 160 161 162 163 164 165 166 |
|
has_valid_extension(repre_entity)
classmethod
Has representation document valid extension for loader.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
repre_entity | dict[str, Any] | Representation entity. | required |
Returns:
Name | Type | Description |
---|---|---|
bool | Representation has valid extension |
Source code in client/ayon_core/pipeline/load/plugins.py
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 |
|
is_compatible_loader(context)
classmethod
Return whether a loader is compatible with a context.
On override make sure it is overridden as class or static method.
This checks the product type and the representation for the given loader plugin.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
context | dict[str, Any] | Documents of context for which should be loader used. | required |
Returns:
Name | Type | Description |
---|---|---|
bool | Is loader compatible for context. |
Source code in client/ayon_core/pipeline/load/plugins.py
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 |
|
load(context, name=None, namespace=None, options=None)
Load asset via database
Parameters:
Name | Type | Description | Default |
---|---|---|---|
context | dict | Full parenthood of representation to load | required |
name | str | Use pre-defined name | None |
namespace | str | Use pre-defined namespace | None |
options | dict | Additional settings dictionary | None |
Source code in client/ayon_core/pipeline/load/plugins.py
172 173 174 175 176 177 178 179 180 181 182 183 |
|
remove(container)
Remove a container
Parameters:
Name | Type | Description | Default |
---|---|---|---|
container | avalon - core | container-1.0): Container to remove, from | required |
Returns:
Name | Type | Description |
---|---|---|
bool | Whether the container was deleted |
Source code in client/ayon_core/pipeline/load/plugins.py
197 198 199 200 201 202 203 204 205 206 207 208 209 210 |
|
update(container, context)
Update container
to representation
Parameters:
Name | Type | Description | Default |
---|---|---|---|
container | avalon - core | container-1.0): Container to update, from | required |
context | dict | Update the container to this representation. | required |
Source code in client/ayon_core/pipeline/load/plugins.py
185 186 187 188 189 190 191 192 193 194 195 |
|
LoaderSwitchNotImplementedError
Bases: NotImplementedError
Error when switch
is used with Loader that has no implementation.
Source code in client/ayon_core/pipeline/load/utils.py
68 69 70 |
|
ProductLoaderPlugin
Bases: LoaderPlugin
Load product into host application Arguments: context (dict): avalon-core:context-1.0 name (str, optional): Use pre-defined name namespace (str, optional): Use pre-defined namespace
Source code in client/ayon_core/pipeline/load/plugins.py
258 259 260 261 262 263 264 |
|
any_outdated_containers(host=None, project_name=None)
Check if there are any outdated containers in scene.
Source code in client/ayon_core/pipeline/load/utils.py
921 922 923 924 925 926 |
|
filter_containers(containers, project_name)
Filter containers and split them into 4 categories.
Categories are 'latest', 'outdated', 'invalid' and 'not_found'. The 'lastest' containers are from last version, 'outdated' are not, 'invalid' are invalid containers (invalid content) and 'not_found' has some missing entity in database.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
containers | Iterable[dict] | List of containers referenced into scene. | required |
project_name | str | Name of project in which context shoud look for versions. | required |
Returns:
Name | Type | Description |
---|---|---|
ContainersFilterResult | Named tuple with 'latest', 'outdated', 'invalid' and 'not_found' containers. |
Source code in client/ayon_core/pipeline/load/utils.py
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 |
|
filter_repre_contexts_by_loader(repre_contexts, loader)
Filter representation contexts for loader.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
repre_contexts | list[dict[str, Ant]] | Representation context. | required |
loader | LoaderPlugin | Loader plugin to filter contexts for. | required |
Returns:
Type | Description |
---|---|
list[dict[str, Any]]: Filtered representation contexts. |
Source code in client/ayon_core/pipeline/load/utils.py
892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 |
|
get_loader_identifier(loader)
Loader identifier from loader plugin or object.
Identifier should be stored to container for future management.
Source code in client/ayon_core/pipeline/load/utils.py
414 415 416 417 418 419 420 421 |
|
get_outdated_containers(host=None, project_name=None)
Collect outdated containers from host scene.
Currently registered host and project in global session are used if arguments are not passed.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
host | ModuleType | Host implementation with 'ls' function available. | None |
project_name | str | Name of project in which context we are. | None |
Source code in client/ayon_core/pipeline/load/utils.py
929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 |
|
get_product_contexts(product_ids, project_name=None)
Return parenthood context for product.
Provides context on product granularity - less detail than
'get_repre_contexts'.
Args: product_ids (list): The product ids. project_name (Optional[str]): Project name. Returns: dict: The full representation context by representation id.
Source code in client/ayon_core/pipeline/load/utils.py
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 |
|
get_repres_contexts(representation_ids, project_name=None)
Return parenthood context for representation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
representation_ids | list | The representation ids. | required |
project_name | Optional[str] | Project name. | None |
Returns:
Name | Type | Description |
---|---|---|
dict | The full representation context by representation id. keys are repre_id, value is dictionary with entities of folder, product, version and representation. |
Source code in client/ayon_core/pipeline/load/utils.py
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 |
|
get_representation_context(project_name, representation)
Return parenthood context for representation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
project_name | str | Project name. | required |
representation | Union[dict[str, Any], str] | Representation entity or representation id. | required |
Returns:
Type | Description |
---|---|
dict[str, dict[str, Any]]: The full representation context. |
Raises:
Type | Description |
---|---|
ValueError | When representation is invalid or parents were not found. |
Source code in client/ayon_core/pipeline/load/utils.py
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 |
|
get_representation_contexts(project_name, representation_entities)
Parenthood context for representations.
Function fills None
if any entity was not found or could not be queried.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
project_name | str | Project name. | required |
representation_entities | Iterable[dict[str, Any]] | Representation entities. | required |
Returns:
Type | Description |
---|---|
dict[str, dict[str, Any]]: The full representation context by representation id. |
Source code in client/ayon_core/pipeline/load/utils.py
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 |
|
get_representation_contexts_by_ids(project_name, representation_ids)
Parenthood context for representations found by ids.
Function fills None
if any entity was not found or could not be queried.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
project_name | str | Project name. | required |
representation_ids | Iterable[str] | Representation ids. | required |
Returns:
Type | Description |
---|---|
dict[str, dict[str, Any]]: The full representation context by representation id. |
Source code in client/ayon_core/pipeline/load/utils.py
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 |
|
get_representation_path(representation, root=None)
Get filename from representation document
There are three ways of getting the path from representation which are tried in following sequence until successful. 1. Get template from representation['data']['template'] and data from representation['context']. Then format template with the data. 2. Get template from project['config'] and format it with default data set 3. Get representation['data']['path'] and use it directly
Parameters:
Name | Type | Description | Default |
---|---|---|---|
representation(dict) | representation document from the database | required |
Returns:
Name | Type | Description |
---|---|---|
str | fullpath of the representation |
Source code in client/ayon_core/pipeline/load/utils.py
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 |
|
get_representation_path_from_context(context)
Preparation wrapper using only context as a argument
Source code in client/ayon_core/pipeline/load/utils.py
627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 |
|
get_representation_path_with_anatomy(repre_entity, anatomy)
Receive representation path using representation document and anatomy.
Anatomy is used to replace 'root' key in representation file. Ideally should be used instead of 'get_representation_path' which is based on "current context".
Future notes
We want also be able store resources into representation and I can imagine the result should also contain paths to possible resources.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
repre_entity | Dict[str, Any] | Representation entity. | required |
anatomy | Anatomy | Project anatomy object. | required |
Returns:
Type | Description |
---|---|
Union[None, TemplateResult]: None if path can't be received |
Raises:
Type | Description |
---|---|
InvalidRepresentationContext | When representation data are probably invalid or not available. |
Source code in client/ayon_core/pipeline/load/utils.py
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 |
|
is_compatible_loader(Loader, context)
Return whether a loader is compatible with a context.
This checks the product type and the representation for the given Loader.
Returns:
Type | Description |
---|---|
bool |
Source code in client/ayon_core/pipeline/load/utils.py
869 870 871 872 873 874 875 876 877 878 879 |
|
load_container(Loader, representation, namespace=None, name=None, options=None, **kwargs)
Use Loader to load a representation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
Loader | Loader | The loader class to trigger. | required |
representation | str or dict | The representation id or full representation as returned by the database. | required |
namespace | (str, Optional) | The namespace to assign. Defaults to None. | None |
name | (str, Optional) | The name to assign. Defaults to product name. | None |
options | (dict, Optional) | Additional options to pass on to the loader. | None |
Returns:
Type | Description |
---|---|
The return of the |
Raises:
Type | Description |
---|---|
IncompatibleLoaderError | When the loader is not compatible with the representation. |
Source code in client/ayon_core/pipeline/load/utils.py
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 |
|
loaders_from_repre_context(loaders, repre_context)
Return compatible loaders for by representaiton's context.
Source code in client/ayon_core/pipeline/load/utils.py
882 883 884 885 886 887 888 889 |
|
loaders_from_representation(loaders, representation)
Return all compatible loaders for a representation.
Source code in client/ayon_core/pipeline/load/utils.py
910 911 912 913 914 915 916 917 918 |
|
remove_container(container)
Remove a container
Source code in client/ayon_core/pipeline/load/utils.py
450 451 452 453 454 455 456 457 458 459 460 |
|
switch_container(container, representation, loader_plugin=None)
Switch a container to representation
Parameters:
Name | Type | Description | Default |
---|---|---|---|
container | dict | container information | required |
representation | dict | representation entity | required |
Returns:
Type | Description |
---|---|
function call |
Source code in client/ayon_core/pipeline/load/utils.py
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 |
|
update_container(container, version=-1)
Update a container
Source code in client/ayon_core/pipeline/load/utils.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 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 |
|