load
IncompatibleLoaderError
Bases: ValueError
Error when Loader is incompatible with a representation.
Source code in client/ayon_core/pipeline/load/utils.py
61 62 63 | |
InvalidRepresentationContext
Bases: ValueError
Representation path can't be received using representation document.
Source code in client/ayon_core/pipeline/load/utils.py
66 67 68 | |
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
51 52 53 54 55 56 57 58 | |
LoaderNotFoundError
Bases: RuntimeError
Error when Loader plugin for a loader name is not found.
Source code in client/ayon_core/pipeline/load/utils.py
76 77 78 | |
LoaderPlugin
Bases: list
Load representation into host application
Source code in client/ayon_core/pipeline/load/plugins.py
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 | |
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
256 257 258 259 260 261 262 263 264 265 | |
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
267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 | |
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
200 201 202 203 204 205 206 207 208 209 210 211 | |
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
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 | |
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
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 | |
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
217 218 219 220 221 222 223 224 225 226 227 228 | |
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
242 243 244 245 246 247 248 249 250 251 252 253 254 | |
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
230 231 232 233 234 235 236 237 238 239 240 | |
LoaderSwitchNotImplementedError
Bases: NotImplementedError
Error when switch is used with Loader that has no implementation.
Source code in client/ayon_core/pipeline/load/utils.py
71 72 73 | |
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
288 289 290 291 292 293 294 | |
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
1048 1049 1050 1051 1052 1053 | |
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.
Todos
Respect 'project_name' on containers if is available.
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
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 | |
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
1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 | |
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
426 427 428 429 430 431 432 433 | |
get_outdated_containers(host=None, project_name=None, ignore_locked_versions=False)
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 | Optional[AbstractHost] | Host implementation. | None |
project_name | Optional[str] | Name of project in which context we are. | None |
ignore_locked_versions | bool | Locked versions are ignored. | False |
Source code in client/ayon_core/pipeline/load/utils.py
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 | |
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
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 | |
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
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 | |
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
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 | |
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
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 | |
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
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 | |
get_representation_path(project_name, repre_entity, *, anatomy=None, project_entity=None)
get_representation_path(representation: dict[str, Any], root: Optional[dict[str, Any]] = None) -> TemplateResult
get_representation_path(project_name: str, repre_entity: dict[str, Any], *, anatomy: Optional[Anatomy] = None, project_entity: Optional[dict[str, Any]] = None) -> TemplateResult
Get filled representation path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project_name | str | Project name. | required |
repre_entity | dict[str, Any] | Representation entity. | required |
anatomy | Optional[Anatomy] | Project anatomy. | None |
project_entity | Optional[dict[str, Any] | Project entity. Is used to initialize Anatomy and is not needed if 'anatomy' is passed in. | None |
Returns:
| Name | Type | Description |
|---|---|---|
TemplateResult | TemplateResult | Resolved path to representation. |
Raises:
| Type | Description |
|---|---|
InvalidRepresentationContext | When representation data are probably invalid or not available. |
Source code in client/ayon_core/pipeline/load/utils.py
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 | |
get_representation_path_from_context(context)
Preparation wrapper using only context as a argument
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 | |
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:
| Name | Type | Description |
|---|---|---|
TemplateResult | Resolved representation path. |
Raises:
| Type | Description |
|---|---|
InvalidRepresentationContext | When representation data are probably invalid or not available. |
Source code in client/ayon_core/pipeline/load/utils.py
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 | |
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
996 997 998 999 1000 1001 1002 1003 1004 1005 1006 | |
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
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 | |
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
1009 1010 1011 1012 1013 1014 1015 1016 | |
loaders_from_representation(loaders, representation)
Return all compatible loaders for a representation.
Source code in client/ayon_core/pipeline/load/utils.py
1037 1038 1039 1040 1041 1042 1043 1044 1045 | |
remove_container(container)
Remove a container
Source code in client/ayon_core/pipeline/load/utils.py
462 463 464 465 466 467 468 469 470 471 472 | |
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 |
|---|---|
| return from function call |
Source code in client/ayon_core/pipeline/load/utils.py
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 | |
update_container(container, version=-1)
Update a container
Source code in client/ayon_core/pipeline/load/utils.py
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 | |