pipeline
BlenderHost
Bases: HostBase, IWorkfileHost, IPublishHost, ILoadHost
Source code in client/ayon_blender/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 | |
get_containers()
List containers from active Blender scene.
Source code in client/ayon_blender/api/pipeline.py
92 93 94 | |
get_context_data()
Override abstract method from IPublishHost. Get global data related to creation-publishing from workfile.
Returns:
| Name | Type | Description |
|---|---|---|
dict | dict | Context data stored using 'update_context_data'. |
Source code in client/ayon_blender/api/pipeline.py
155 156 157 158 159 160 161 162 163 164 165 | |
get_current_workfile()
Override get_current_workfile method from IWorkfileHost. Retrieve currently opened workfile path.
Returns:
| Name | Type | Description |
|---|---|---|
str | str | Path to currently opened workfile. |
Source code in client/ayon_blender/api/pipeline.py
124 125 126 127 128 129 130 131 | |
get_workfile_extensions()
Override get_workfile_extensions method from IWorkfileHost. Get workfile possible extensions.
Returns:
| Type | Description |
|---|---|
List[str] | List[str]: Workfile extensions. |
Source code in client/ayon_blender/api/pipeline.py
96 97 98 99 100 101 102 103 | |
install()
Override install method from HostBase. Install Blender host functionality.
Source code in client/ayon_blender/api/pipeline.py
87 88 89 90 | |
open_workfile(filepath)
Override open_workfile method from IWorkfileHost. Open workfile at specified filepath in the host.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filepath | str | Path to workfile. | required |
Source code in client/ayon_blender/api/pipeline.py
115 116 117 118 119 120 121 122 | |
save_workfile(dst_path=None)
Override save_workfile method from IWorkfileHost. Save currently opened workfile.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dst_path | str | Where the current scene should be saved. Or use current path if | None |
Source code in client/ayon_blender/api/pipeline.py
105 106 107 108 109 110 111 112 113 | |
update_context_data(data, changes)
Override abstract method from IPublishHost. Store global context data to workfile.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data | dict | New data as are. | required |
changes | dict | Only data that has been changed. Each value has tuple with '( | required |
Source code in client/ayon_blender/api/pipeline.py
167 168 169 170 171 172 173 174 175 176 | |
work_root(session)
Override work_root method from IWorkfileHost. Modify workdir per host.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session | dict | Session context data. | required |
Returns:
| Name | Type | Description |
|---|---|---|
str | str | Path to new workdir. |
Source code in client/ayon_blender/api/pipeline.py
143 144 145 146 147 148 149 150 151 152 153 | |
workfile_has_unsaved_changes()
Override wokfile_has_unsaved_changes method from IWorkfileHost. Returns True if opened workfile has no unsaved changes.
Returns:
| Name | Type | Description |
|---|---|---|
bool | bool | True if scene is saved and False if it has unsaved modifications. |
Source code in client/ayon_blender/api/pipeline.py
133 134 135 136 137 138 139 140 141 | |
add_to_ayon_container(container)
Add the container (object or collection) to the AYON container.
Source code in client/ayon_blender/api/pipeline.py
633 634 635 636 637 638 639 640 641 | |
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 | Optional[str] | Name of loader used to produce this container. | None |
suffix | Optional[str] | Suffix of container, defaults to | 'CON' |
Returns:
| Type | Description |
|---|---|
Collection | The container assembly |
Source code in client/ayon_blender/api/pipeline.py
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 | |
containerise_existing(container, name, namespace, context, loader=None, suffix='CON')
Imprint or update container with metadata.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name | str | Name of resulting assembly | required |
namespace | str | Namespace under which to host container | required |
context | Dict | Asset information | required |
loader | Optional[str] | Name of loader used to produce this container. | None |
suffix | Optional[str] | Suffix of container, defaults to | 'CON' |
Returns:
| Type | Description |
|---|---|
Collection | The container assembly |
Source code in client/ayon_blender/api/pipeline.py
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 809 810 | |
ensure_ayon_container()
Ensure AYON_CONTAINERS exists and is ready for use.
Source code in client/ayon_blender/api/pipeline.py
669 670 671 672 673 674 675 676 677 678 679 680 | |
get_ayon_container()
Get Ayon Container
Returns:
| Type | Description |
|---|---|
Collection | bpy.types.Collection: Ayon containers collection |
Source code in client/ayon_blender/api/pipeline.py
644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 | |
get_container_name(name, namespace, context, suffix)
Function to get container name
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name | str | Name of resulting assembly | required |
namespace | str | Namespace under which to host container | required |
context | Dict | Asset information | required |
suffix | str | Suffix of container | required |
Returns:
| Type | Description |
|---|---|
| The name of the container assembly |
Source code in client/ayon_blender/api/pipeline.py
697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 | |
get_frame_range(task_entity=None)
Get the task entity's frame range and handles
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
task_entity | Optional[dict] | Task Entity. When not provided defaults to current context task. | None |
Returns:
| Type | Description |
|---|---|
Union[Dict[str, int], None] | Union[Dict[str, int], None]: Dictionary with frame start, frame end, handle start, handle end. |
Source code in client/ayon_blender/api/pipeline.py
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 | |
install()
Install Blender configuration for AYON.
Source code in client/ayon_blender/api/pipeline.py
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 | |
ls()
List containers from active Blender scene.
This is the host-equivalent of api.ls(), but instead of listing assets on disk, it lists assets already loaded in Blender; once loaded they are called containers.
Source code in client/ayon_blender/api/pipeline.py
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 883 884 885 886 887 888 | |
metadata_update(node, data)
Imprint the node with metadata.
Existing metadata will be updated.
Source code in client/ayon_blender/api/pipeline.py
683 684 685 686 687 688 689 690 691 692 693 694 | |
on_before_save(event)
Handle the event before saving a Blender file.
When saving to a new scene name, e.g. on incrementing the workfile then update the render paths to match the new scene name by replacing the old scene name with the new one in all render paths.
Source code in client/ayon_blender/api/pipeline.py
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 | |
parse_container(container, validate=True)
Return the container node's full container data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
container | Collection | A container node name. | required |
validate | bool | turn the validation for the container on or off | True |
Returns:
| Type | Description |
|---|---|
Dict | The container schema data for this container node. |
Source code in client/ayon_blender/api/pipeline.py
813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 | |
publish()
Shorthand to publish from within host.
Source code in client/ayon_blender/api/pipeline.py
891 892 893 894 | |
set_context_settings(frame_range=True, resolution=True, scene_units=False)
Set context settings for the current scene.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
frame_range | bool | Set frame range context variable. | True |
resolution | bool | Set resolution context variable. | True |
scene_units | bool | Set scene units context variable. | False |
Source code in client/ayon_blender/api/pipeline.py
285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 | |
uninstall()
Uninstall Blender configuration for AYON.
Source code in client/ayon_blender/api/pipeline.py
214 215 216 217 218 219 220 221 222 223 224 225 226 | |