actions
ActionForm dataclass
Form for loader action.
If an action needs to collect information from a user before or during of the action execution, it can return a response with a form. When the form is submitted, a new execution of the action is triggered.
It is also possible to just show a label message without the submit button to make sure the user has seen the message.
Attributes:
| Name | Type | Description |
|---|---|---|
title | str | Title of the form -> title of the window. |
fields | list[AbstractAttrDef] | Fields of the form. |
submit_label | Optional[str] | Label of the submit button. Is hidden if is set to None. |
submit_icon | Optional[dict[str, Any]] | Icon definition of the submit button. |
cancel_label | Optional[str] | Label of the cancel button. Is hidden if is set to None. User can still close the window tho. |
cancel_icon | Optional[dict[str, Any]] | Icon definition of the cancel button. |
Source code in client/ayon_core/pipeline/actions/structures.py
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 | |
InventoryAction
A custom action for the scene inventory tool
If registered the action will be visible in the Right Mouse Button menu under the submenu "Actions".
Source code in client/ayon_core/pipeline/actions/inventory.py
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 | |
is_compatible(container) staticmethod
Override function in a custom class
This method is specifically used to ensure the action can operate on the container.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
container | dict | the data of a loaded asset, see host.ls() | required |
Returns:
| Type | Description |
|---|---|
| bool |
Source code in client/ayon_core/pipeline/actions/inventory.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 | |
process(containers)
Override function in a custom class
This method will receive all containers even those which are incompatible. It is advised to create a small filter along the lines of this example:
valid_containers = filter(self.is_compatible(c) for c in containers)
The return value will need to be a True-ish value to trigger the data_changed signal in order to refresh the view.
You can return a list of container names to trigger GUI to select treeview items.
You can return a dict to carry extra GUI options. For example: { "objectNames": [container names...], "options": {"mode": "toggle", "clear": False} } Currently workable GUI options are: - clear (bool): Clear current selection before selecting by action. Default True. - mode (str): selection mode, use one of these: "select", "deselect", "toggle". Default is "select".
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
containers | list | list of dictionaries | required |
Return
bool, list or dict
Source code in client/ayon_core/pipeline/actions/inventory.py
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 | |
LauncherAction
Bases: object
A custom action available
Source code in client/ayon_core/pipeline/actions/launcher.py
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 | |
is_compatible(selection)
Return whether the class is compatible with the Session.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
selection | LauncherActionSelection | Data with selection. | required |
Source code in client/ayon_core/pipeline/actions/launcher.py
369 370 371 372 373 374 375 376 | |
process(selection, **kwargs)
Process the action.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
selection | LauncherActionSelection | Data with selection. | required |
**kwargs | Additional arguments. | {} |
Source code in client/ayon_core/pipeline/actions/launcher.py
378 379 380 381 382 383 384 385 386 | |
LauncherActionSelection
Object helper to pass selection to actions.
Object support backwards compatibility for 'session' from OpenPype where environment variable keys were used to define selection.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project_name | str | Selected project name. | required |
folder_id | str | Selected folder id. | required |
task_id | str | Selected task id. | required |
folder_path | Optional[str] | Selected folder path. | None |
task_name | Optional[str] | Selected task name. | None |
project_entity | Optional[dict[str, Any]] | Project entity. | None |
folder_entity | Optional[dict[str, Any]] | Folder entity. | None |
task_entity | Optional[dict[str, Any]] | Task entity. | None |
Source code in client/ayon_core/pipeline/actions/launcher.py
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 | |
is_folder_selected property
Return whether a folder is selected.
Returns:
| Name | Type | Description |
|---|---|---|
bool | Whether a folder is selected. |
is_project_selected property
Return whether a project is selected.
Returns:
| Name | Type | Description |
|---|---|---|
bool | Whether a project is selected. |
is_task_selected property
Return whether a task is selected.
Returns:
| Name | Type | Description |
|---|---|---|
bool | Whether a task is selected. |
is_workfile_selected property
Return whether a task is selected.
Returns:
| Name | Type | Description |
|---|---|---|
bool | Whether a task is selected. |
get(key, default=None)
Deprecated
Added for backwards compatibility with older actions.
Source code in client/ayon_core/pipeline/actions/launcher.py
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | |
get_folder_entity()
Folder entity for the selection.
Returns:
| Type | Description |
|---|---|
| Union[dict[str, Any], None]: Folder entity. |
Source code in client/ayon_core/pipeline/actions/launcher.py
238 239 240 241 242 243 244 245 246 247 248 249 250 251 | |
get_folder_id()
Selected folder id.
Returns:
| Type | Description |
|---|---|
| Union[str, None]: Selected folder id. |
Source code in client/ayon_core/pipeline/actions/launcher.py
172 173 174 175 176 177 178 179 | |
get_folder_path()
Selected folder path.
Returns:
| Type | Description |
|---|---|
| Union[str, None]: Selected folder path. |
Source code in client/ayon_core/pipeline/actions/launcher.py
181 182 183 184 185 186 187 188 189 190 191 192 | |
get_project_entity()
Project entity for the selection.
Returns:
| Type | Description |
|---|---|
| Union[dict[str, Any], None]: Project entity. |
Source code in client/ayon_core/pipeline/actions/launcher.py
225 226 227 228 229 230 231 232 233 234 235 236 | |
get_project_name()
Selected project name.
Returns:
| Type | Description |
|---|---|
| Union[str, None]: Selected project name. |
Source code in client/ayon_core/pipeline/actions/launcher.py
163 164 165 166 167 168 169 170 | |
get_project_settings()
Project settings for the selection.
Returns:
| Type | Description |
|---|---|
| dict[str, Any]: Project settings or studio settings if project is not selected. |
Source code in client/ayon_core/pipeline/actions/launcher.py
289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 | |
get_task_entity()
Task entity for the selection.
Returns:
| Type | Description |
|---|---|
| Union[dict[str, Any], None]: Task entity. |
Source code in client/ayon_core/pipeline/actions/launcher.py
253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 | |
get_task_id()
Selected task id.
Returns:
| Type | Description |
|---|---|
| Union[str, None]: Selected task id. |
Source code in client/ayon_core/pipeline/actions/launcher.py
194 195 196 197 198 199 200 201 | |
get_task_name()
Selected task name.
Returns:
| Type | Description |
|---|---|
| Union[str, None]: Selected task name. |
Source code in client/ayon_core/pipeline/actions/launcher.py
203 204 205 206 207 208 209 210 211 212 213 214 | |
get_workfile_entity()
Workfile entity for the selection.
Returns:
| Type | Description |
|---|---|
| Union[dict[str, Any], None]: Workfile entity. |
Source code in client/ayon_core/pipeline/actions/launcher.py
271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 | |
get_workfile_id()
Selected workfile id.
Returns:
| Type | Description |
|---|---|
| Union[str, None]: Selected workfile id. |
Source code in client/ayon_core/pipeline/actions/launcher.py
216 217 218 219 220 221 222 223 | |
items()
Deprecated
Added for backwards compatibility with older actions.
Source code in client/ayon_core/pipeline/actions/launcher.py
128 129 130 131 132 133 134 135 136 137 138 139 140 141 | |
keys()
Deprecated
Added for backwards compatibility with older actions.
Source code in client/ayon_core/pipeline/actions/launcher.py
143 144 145 146 147 148 149 150 151 | |
values()
Deprecated
Added for backwards compatibility with older actions.
Source code in client/ayon_core/pipeline/actions/launcher.py
153 154 155 156 157 158 159 160 161 | |
LoaderActionItem dataclass
Item of loader action.
Action plugins return these items as possible actions to run for a given context.
Because the action item can be related to a specific entity and not the whole selection, they also have to define the entity type and ids to be executed on.
Attributes:
| Name | Type | Description |
|---|---|---|
label | str | Text shown in UI. |
order | int | Order of the action in UI. |
group_label | Optional[str] | Label of the group to which the action belongs. |
icon | Optional[dict[str, Any] | Icon definition. |
data | Optional[DataType] | Action item data. |
identifier | Optional[str] | Identifier of the plugin which created the action item. Is filled automatically. Is not changed if is filled -> can lead to different plugin. |
Source code in client/ayon_core/pipeline/actions/loader.py
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 | |
LoaderActionPlugin
Bases: ABC
Plugin for loader actions.
Plugin is responsible for getting action items and executing actions.
Source code in client/ayon_core/pipeline/actions/loader.py
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 | |
host_name property
Name of the current host.
identifier property
Identifier of the plugin.
Returns:
| Name | Type | Description |
|---|---|---|
str | str | Plugin identifier. |
apply_settings(studio_settings)
Apply studio settings to the plugin.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
studio_settings | dict[str, Any] | Studio settings. | required |
Source code in client/ayon_core/pipeline/actions/loader.py
564 565 566 567 568 569 570 571 | |
execute_action(selection, data, form_values) abstractmethod
Execute an action.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
selection | LoaderActionSelection | Selection wrapper. Can be used to get entities or get context of original selection. | required |
data | Optional[DataType] | Additional action item data. | required |
form_values | dict[str, Any] | Attribute values. | required |
Returns:
| Type | Description |
|---|---|
Optional[LoaderActionResult] | Optional[LoaderActionResult]: Result of the action execution. |
Source code in client/ayon_core/pipeline/actions/loader.py
609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 | |
get_action_items(selection) abstractmethod
Action items for the selection.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
selection | LoaderActionSelection | Selection. | required |
Returns:
| Type | Description |
|---|---|
list[LoaderActionItem] | list[LoaderActionItem]: Action items. |
Source code in client/ayon_core/pipeline/actions/loader.py
594 595 596 597 598 599 600 601 602 603 604 605 606 607 | |
LoaderActionResult dataclass
Result of loader action execution.
Attributes:
| Name | Type | Description |
|---|---|---|
message | Optional[str] | Message to show in UI. |
success | bool | If the action was successful. Affects color of the message. |
form | Optional[ActionForm] | Form to show in UI. |
form_values | Optional[dict[str, Any]] | Values for the form. Can be used if the same form is re-shown e.g. because a user forgot to fill a required field. |
Source code in client/ayon_core/pipeline/actions/loader.py
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 | |
LoaderActionSelection
Selection of entities for loader actions.
Selection tells action plugins what exactly is selected in the tool and which ids.
Contains entity cache which can be used to get entities by their ids. Or to get project settings and anatomy.
Source code in client/ayon_core/pipeline/actions/loader.py
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 | |
get_selected_representation_entities()
Retrieve selected representation entities.
An empty list is returned if 'representation' is not the selected entity type.
Returns:
| Type | Description |
|---|---|
list[dict[str, Any]] | list[dict[str, Any]]: List of selected representation entities. |
Source code in client/ayon_core/pipeline/actions/loader.py
466 467 468 469 470 471 472 473 474 475 476 477 478 | |
get_selected_version_entities()
Retrieve selected version entities.
An empty list is returned if 'version' is not the selected entity type.
Returns:
| Type | Description |
|---|---|
list[dict[str, Any]] | list[dict[str, Any]]: List of selected version entities. |
Source code in client/ayon_core/pipeline/actions/loader.py
452 453 454 455 456 457 458 459 460 461 462 463 464 | |
representations_selected()
Selected entity type is representation.
Returns:
| Name | Type | Description |
|---|---|---|
bool | bool | True if selected entity type is representation. |
Source code in client/ayon_core/pipeline/actions/loader.py
443 444 445 446 447 448 449 450 | |
versions_selected()
Selected entity type is version.
Returns:
| Name | Type | Description |
|---|---|---|
bool | bool | True if selected entity type is version. |
Source code in client/ayon_core/pipeline/actions/loader.py
434 435 436 437 438 439 440 441 | |
LoaderActionsContext
Wrapper for loader actions and their logic.
Takes care about the public api of loader actions and internal logic like discovery and initialization of plugins.
Source code in client/ayon_core/pipeline/actions/loader.py
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 | |
execute_action(identifier, selection, data, form_values)
Trigger action execution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
identifier | str | Identifier of the plugin. | required |
selection | LoaderActionSelection | Selection wrapper. Can be used to get what is selected in UI and to get access to entity cache. | required |
data | Optional[DataType] | Additional action item data. | required |
form_values | dict[str, Any] | Form values related to action. Usually filled if action returned response with form. | required |
Source code in client/ayon_core/pipeline/actions/loader.py
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 | |
get_action_items(selection)
Collect action items from all plugins for given selection.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
selection | LoaderActionSelection | Selection wrapper. | required |
Source code in client/ayon_core/pipeline/actions/loader.py
701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 | |
get_host()
Get current host integration.
Returns:
| Type | Description |
|---|---|
Optional[AbstractHost] | Optional[AbstractHost]: Host integration. Can be None if host integration is not registered -> probably not used in the host integration process. |
Source code in client/ayon_core/pipeline/actions/loader.py
675 676 677 678 679 680 681 682 683 684 685 686 687 688 | |
reset(studio_settings=None)
Reset context cache.
Reset plugins and studio settings to reload them.
Notes
Does not reset the cache of AddonsManger because there should not be a reason to do so.
Source code in client/ayon_core/pipeline/actions/loader.py
653 654 655 656 657 658 659 660 661 662 663 664 665 666 | |
LoaderSelectedType
Bases: StrEnum
Selected entity type.
Source code in client/ayon_core/pipeline/actions/loader.py
91 92 93 94 95 96 | |
LoaderSimpleActionPlugin
Bases: LoaderActionPlugin
Simple action plugin.
This action will show exactly one action item defined by attributes on the class.
Attributes:
| Name | Type | Description |
|---|---|---|
label | Optional[str] | Label of the action item. |
order | int | Order of the action item. |
group_label | Optional[str] | Label of the group to which the action belongs. |
icon | Optional[dict[str, Any]] | Icon definition shown next to label. |
Source code in client/ayon_core/pipeline/actions/loader.py
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 | |
execute_simple_action(selection, form_values) abstractmethod
Process action based on selection.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
selection | LoaderActionSelection | Selection information. | required |
form_values | dict[str, Any] | Values from a form if there are any. | required |
Returns:
| Type | Description |
|---|---|
Optional[LoaderActionResult] | Optional[LoaderActionResult]: Result of the action. |
Source code in client/ayon_core/pipeline/actions/loader.py
843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 | |
is_compatible(selection) abstractmethod
Check if plugin is compatible with selection.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
selection | LoaderActionSelection | Selection information. | required |
Returns:
| Name | Type | Description |
|---|---|---|
bool | bool | True if plugin is compatible with selection. |
Source code in client/ayon_core/pipeline/actions/loader.py
830 831 832 833 834 835 836 837 838 839 840 841 | |
SelectionEntitiesCache
Cache of entities used as helper in the selection wrapper.
It is possible to get entities based on ids with helper methods to get entities, their parents or their children's entities.
The goal is to avoid multiple API calls for the same entity in multiple action plugins.
The cache is based on the selected project. Entities are fetched if are not in cache yet.
Source code in client/ayon_core/pipeline/actions/loader.py
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 | |
get_project()
Get project entity
Source code in client/ayon_core/pipeline/actions/loader.py
140 141 142 143 144 | |
webaction_fields_to_attribute_defs(fields)
Helper function to convert fields definition from webactions form.
Convert form fields to attribute definitions to be able to display them using attribute definitions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fields | list[dict[str, Any]] | Fields from webaction form. | required |
Returns:
| Type | Description |
|---|---|
list[AbstractAttrDef] | list[AbstractAttrDef]: Converted attribute definitions. |
Source code in client/ayon_core/pipeline/actions/utils.py
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 | |