From 3952a1cb23dd55670cf1197513e2169c67d724ea Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Mon, 14 Dec 2020 18:52:02 +0100 Subject: [PATCH 01/13] moved pype's part of tvpaint implementation to subfolder `api` --- pype/hosts/tvpaint/{ => api}/__init__.py | 0 pype/hosts/tvpaint/{ => api}/avalon.loc | 0 pype/hosts/tvpaint/{ => api}/template.tvpp | Bin 3 files changed, 0 insertions(+), 0 deletions(-) rename pype/hosts/tvpaint/{ => api}/__init__.py (100%) rename pype/hosts/tvpaint/{ => api}/avalon.loc (100%) rename pype/hosts/tvpaint/{ => api}/template.tvpp (100%) diff --git a/pype/hosts/tvpaint/__init__.py b/pype/hosts/tvpaint/api/__init__.py similarity index 100% rename from pype/hosts/tvpaint/__init__.py rename to pype/hosts/tvpaint/api/__init__.py diff --git a/pype/hosts/tvpaint/avalon.loc b/pype/hosts/tvpaint/api/avalon.loc similarity index 100% rename from pype/hosts/tvpaint/avalon.loc rename to pype/hosts/tvpaint/api/avalon.loc diff --git a/pype/hosts/tvpaint/template.tvpp b/pype/hosts/tvpaint/api/template.tvpp similarity index 100% rename from pype/hosts/tvpaint/template.tvpp rename to pype/hosts/tvpaint/api/template.tvpp From 333c204e5415fc590d6a9af6c1307f261f51c585 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Mon, 14 Dec 2020 18:52:26 +0100 Subject: [PATCH 02/13] tvpaint plugins moved to tvpaint host --- .../tvpaint/plugins}/create/create_render_layer.py | 0 .../tvpaint/plugins}/create/create_render_pass.py | 0 .../tvpaint => hosts/tvpaint/plugins}/create/create_review.py | 0 .../{plugins/tvpaint => hosts/tvpaint/plugins}/load/load_image.py | 0 .../tvpaint/plugins}/load/load_reference_image.py | 0 .../tvpaint/plugins}/publish/collect_instances.py | 0 .../tvpaint/plugins}/publish/collect_workfile_data.py | 0 .../tvpaint => hosts/tvpaint/plugins}/publish/extract_sequence.py | 0 .../tvpaint/plugins}/publish/validate_frame_range.py | 0 .../tvpaint/plugins}/publish/validate_workfile_project_name.py | 0 10 files changed, 0 insertions(+), 0 deletions(-) rename pype/{plugins/tvpaint => hosts/tvpaint/plugins}/create/create_render_layer.py (100%) rename pype/{plugins/tvpaint => hosts/tvpaint/plugins}/create/create_render_pass.py (100%) rename pype/{plugins/tvpaint => hosts/tvpaint/plugins}/create/create_review.py (100%) rename pype/{plugins/tvpaint => hosts/tvpaint/plugins}/load/load_image.py (100%) rename pype/{plugins/tvpaint => hosts/tvpaint/plugins}/load/load_reference_image.py (100%) rename pype/{plugins/tvpaint => hosts/tvpaint/plugins}/publish/collect_instances.py (100%) rename pype/{plugins/tvpaint => hosts/tvpaint/plugins}/publish/collect_workfile_data.py (100%) rename pype/{plugins/tvpaint => hosts/tvpaint/plugins}/publish/extract_sequence.py (100%) rename pype/{plugins/tvpaint => hosts/tvpaint/plugins}/publish/validate_frame_range.py (100%) rename pype/{plugins/tvpaint => hosts/tvpaint/plugins}/publish/validate_workfile_project_name.py (100%) diff --git a/pype/plugins/tvpaint/create/create_render_layer.py b/pype/hosts/tvpaint/plugins/create/create_render_layer.py similarity index 100% rename from pype/plugins/tvpaint/create/create_render_layer.py rename to pype/hosts/tvpaint/plugins/create/create_render_layer.py diff --git a/pype/plugins/tvpaint/create/create_render_pass.py b/pype/hosts/tvpaint/plugins/create/create_render_pass.py similarity index 100% rename from pype/plugins/tvpaint/create/create_render_pass.py rename to pype/hosts/tvpaint/plugins/create/create_render_pass.py diff --git a/pype/plugins/tvpaint/create/create_review.py b/pype/hosts/tvpaint/plugins/create/create_review.py similarity index 100% rename from pype/plugins/tvpaint/create/create_review.py rename to pype/hosts/tvpaint/plugins/create/create_review.py diff --git a/pype/plugins/tvpaint/load/load_image.py b/pype/hosts/tvpaint/plugins/load/load_image.py similarity index 100% rename from pype/plugins/tvpaint/load/load_image.py rename to pype/hosts/tvpaint/plugins/load/load_image.py diff --git a/pype/plugins/tvpaint/load/load_reference_image.py b/pype/hosts/tvpaint/plugins/load/load_reference_image.py similarity index 100% rename from pype/plugins/tvpaint/load/load_reference_image.py rename to pype/hosts/tvpaint/plugins/load/load_reference_image.py diff --git a/pype/plugins/tvpaint/publish/collect_instances.py b/pype/hosts/tvpaint/plugins/publish/collect_instances.py similarity index 100% rename from pype/plugins/tvpaint/publish/collect_instances.py rename to pype/hosts/tvpaint/plugins/publish/collect_instances.py diff --git a/pype/plugins/tvpaint/publish/collect_workfile_data.py b/pype/hosts/tvpaint/plugins/publish/collect_workfile_data.py similarity index 100% rename from pype/plugins/tvpaint/publish/collect_workfile_data.py rename to pype/hosts/tvpaint/plugins/publish/collect_workfile_data.py diff --git a/pype/plugins/tvpaint/publish/extract_sequence.py b/pype/hosts/tvpaint/plugins/publish/extract_sequence.py similarity index 100% rename from pype/plugins/tvpaint/publish/extract_sequence.py rename to pype/hosts/tvpaint/plugins/publish/extract_sequence.py diff --git a/pype/plugins/tvpaint/publish/validate_frame_range.py b/pype/hosts/tvpaint/plugins/publish/validate_frame_range.py similarity index 100% rename from pype/plugins/tvpaint/publish/validate_frame_range.py rename to pype/hosts/tvpaint/plugins/publish/validate_frame_range.py diff --git a/pype/plugins/tvpaint/publish/validate_workfile_project_name.py b/pype/hosts/tvpaint/plugins/publish/validate_workfile_project_name.py similarity index 100% rename from pype/plugins/tvpaint/publish/validate_workfile_project_name.py rename to pype/hosts/tvpaint/plugins/publish/validate_workfile_project_name.py From 2af2dbdca491886c8fd9a79ac05954260b691f22 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Mon, 14 Dec 2020 18:52:43 +0100 Subject: [PATCH 03/13] tvpaint launch hooks moved to tvpaint host --- pype/{hooks/tvpaint => hosts/tvpaint/hooks}/pre_install_pywin.py | 0 pype/{hooks/tvpaint => hosts/tvpaint/hooks}/pre_launch_args.py | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename pype/{hooks/tvpaint => hosts/tvpaint/hooks}/pre_install_pywin.py (100%) rename pype/{hooks/tvpaint => hosts/tvpaint/hooks}/pre_launch_args.py (100%) diff --git a/pype/hooks/tvpaint/pre_install_pywin.py b/pype/hosts/tvpaint/hooks/pre_install_pywin.py similarity index 100% rename from pype/hooks/tvpaint/pre_install_pywin.py rename to pype/hosts/tvpaint/hooks/pre_install_pywin.py diff --git a/pype/hooks/tvpaint/pre_launch_args.py b/pype/hosts/tvpaint/hooks/pre_launch_args.py similarity index 100% rename from pype/hooks/tvpaint/pre_launch_args.py rename to pype/hosts/tvpaint/hooks/pre_launch_args.py From 84175aaa786f5e97b538e89951b63bf4602d5b98 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Mon, 14 Dec 2020 19:00:10 +0100 Subject: [PATCH 04/13] modified loading of hooks to look for them also in host folder --- pype/lib/applications.py | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/pype/lib/applications.py b/pype/lib/applications.py index 115db43930..cae270aca2 100644 --- a/pype/lib/applications.py +++ b/pype/lib/applications.py @@ -575,19 +575,38 @@ class ApplicationLaunchContext: def paths_to_launch_hooks(self): """Directory paths where to look for launch hooks.""" # This method has potential to be part of application manager (maybe). - - # TODO find better way how to define dir path to default launch hooks - import pype - pype_dir = os.path.dirname(os.path.abspath(pype.__file__)) - hooks_dir = os.path.join(pype_dir, "hooks") + paths = [] # TODO load additional studio paths from settings # TODO add paths based on used modules (like `ftrack`) - paths = [] - subfolder_names = ["global", self.host_name, self.app_name] + import pype + pype_dir = os.path.dirname(os.path.abspath(pype.__file__)) + + # --- START: Backwards compatibility --- + hooks_dir = os.path.join(pype_dir, "hooks") + + subfolder_names = ["global", self.host_name] for subfolder_name in subfolder_names: path = os.path.join(hooks_dir, subfolder_name) - if os.path.exists(path) and os.path.isdir(path): + if ( + os.path.exists(path) + and os.path.isdir(path) + and path not in paths + ): + paths.append(path) + # --- END: Backwards compatibility --- + + subfolders_list = ( + ("hooks", "global"), + ("hosts", "tvpaint", self.host_name) + ) + for subfolders in subfolders_list: + path = os.path.join(pype_dir, *subfolders) + if ( + os.path.exists(path) + and os.path.isdir(path) + and path not in paths + ): paths.append(path) return paths From ef2abd1de8bff31fa4ffade01d5bdc8be89717fe Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Mon, 14 Dec 2020 19:00:22 +0100 Subject: [PATCH 05/13] fixed subfolder --- pype/lib/applications.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pype/lib/applications.py b/pype/lib/applications.py index cae270aca2..846ebda2dd 100644 --- a/pype/lib/applications.py +++ b/pype/lib/applications.py @@ -598,7 +598,7 @@ class ApplicationLaunchContext: subfolders_list = ( ("hooks", "global"), - ("hosts", "tvpaint", self.host_name) + ("hosts", "tvpaint", self.host_name, "hooks") ) for subfolders in subfolders_list: path = os.path.join(pype_dir, *subfolders) From 0d84faa80aaf411135c84cd48163ddf280ac5c15 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Mon, 14 Dec 2020 19:19:55 +0100 Subject: [PATCH 06/13] fix host folder parts --- pype/lib/applications.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pype/lib/applications.py b/pype/lib/applications.py index 846ebda2dd..2ee37a167b 100644 --- a/pype/lib/applications.py +++ b/pype/lib/applications.py @@ -598,7 +598,7 @@ class ApplicationLaunchContext: subfolders_list = ( ("hooks", "global"), - ("hosts", "tvpaint", self.host_name, "hooks") + ("hosts", self.host_name, "hooks") ) for subfolders in subfolders_list: path = os.path.join(pype_dir, *subfolders) From 021241de97673718d22be7ead416bd8e4816e232 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Mon, 14 Dec 2020 19:20:08 +0100 Subject: [PATCH 07/13] initialize log in lib/applications.py --- pype/lib/applications.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pype/lib/applications.py b/pype/lib/applications.py index 2ee37a167b..cccc50d397 100644 --- a/pype/lib/applications.py +++ b/pype/lib/applications.py @@ -16,6 +16,8 @@ from .python_module_tools import ( classes_from_module ) +log = PypeLogger().get_logger(__name__) + class ApplicationNotFound(Exception): """Application was not found in ApplicationManager by name.""" From dd462986c2954c5326b4f5c2af3b1054642ad79d Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Mon, 14 Dec 2020 19:20:19 +0100 Subject: [PATCH 08/13] fix path to template --- pype/hosts/tvpaint/hooks/pre_launch_args.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pype/hosts/tvpaint/hooks/pre_launch_args.py b/pype/hosts/tvpaint/hooks/pre_launch_args.py index 210b1e99c3..7515d709ed 100644 --- a/pype/hosts/tvpaint/hooks/pre_launch_args.py +++ b/pype/hosts/tvpaint/hooks/pre_launch_args.py @@ -78,7 +78,7 @@ class TvpaintPrelaunchHook(PreLaunchHook): # TODO add ability to set different template workfile path via # settings pype_dir = os.path.dirname(os.path.abspath(tvpaint.__file__)) - template_path = os.path.join(pype_dir, "template.tvpp") + template_path = os.path.join(pype_dir, "api", "template.tvpp") if not os.path.exists(template_path): self.log.warning( From 534b6e69146760dbeba4df5ca02c9ec4f5fd593b Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Mon, 14 Dec 2020 19:24:26 +0100 Subject: [PATCH 09/13] fixed path to plugins --- pype/hosts/tvpaint/api/__init__.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/pype/hosts/tvpaint/api/__init__.py b/pype/hosts/tvpaint/api/__init__.py index 7027f0fb55..758acc738f 100644 --- a/pype/hosts/tvpaint/api/__init__.py +++ b/pype/hosts/tvpaint/api/__init__.py @@ -5,13 +5,18 @@ from avalon.tvpaint.communication_server import register_localization_file from avalon.tvpaint import pipeline import avalon.api import pyblish.api -from pype import PLUGINS_DIR + +from pype.hosts import tvpaint log = logging.getLogger("pype.hosts.tvpaint") -PUBLISH_PATH = os.path.join(PLUGINS_DIR, "tvpaint", "publish") -LOAD_PATH = os.path.join(PLUGINS_DIR, "tvpaint", "load") -CREATE_PATH = os.path.join(PLUGINS_DIR, "tvpaint", "create") +PLUGINS_DIR = os.path.join( + os.path.dirname(os.path.abspath(tvpaint.__file__)), + "plugins" +) +PUBLISH_PATH = os.path.join(PLUGINS_DIR, "publish") +LOAD_PATH = os.path.join(PLUGINS_DIR, "load") +CREATE_PATH = os.path.join(PLUGINS_DIR, "create") def on_instance_toggle(instance, old_value, new_value): From c78ce01563a38704b8e5e0840758cdecece24e4a Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Mon, 14 Dec 2020 19:24:38 +0100 Subject: [PATCH 10/13] added empty init to tvpaint host --- pype/hosts/tvpaint/__init__.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 pype/hosts/tvpaint/__init__.py diff --git a/pype/hosts/tvpaint/__init__.py b/pype/hosts/tvpaint/__init__.py new file mode 100644 index 0000000000..e69de29bb2 From 0deef5096eb9cd82d2e8df11befc6a20e4cefe63 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Mon, 14 Dec 2020 19:24:47 +0100 Subject: [PATCH 11/13] added `aiohttp_json_rpc` to requirements --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index ac197b9b1e..6128ac130f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,5 @@ aiohttp +aiohttp_json_rpc appdirs arrow certifi From b776b3ba47cf0f6fde4b595e1382d63acea65160 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Tue, 15 Dec 2020 11:33:44 +0100 Subject: [PATCH 12/13] moved template.tvpp and localization file to resources dir --- pype/hosts/tvpaint/{api => resources}/avalon.loc | 0 pype/hosts/tvpaint/{api => resources}/template.tvpp | Bin 2 files changed, 0 insertions(+), 0 deletions(-) rename pype/hosts/tvpaint/{api => resources}/avalon.loc (100%) rename pype/hosts/tvpaint/{api => resources}/template.tvpp (100%) diff --git a/pype/hosts/tvpaint/api/avalon.loc b/pype/hosts/tvpaint/resources/avalon.loc similarity index 100% rename from pype/hosts/tvpaint/api/avalon.loc rename to pype/hosts/tvpaint/resources/avalon.loc diff --git a/pype/hosts/tvpaint/api/template.tvpp b/pype/hosts/tvpaint/resources/template.tvpp similarity index 100% rename from pype/hosts/tvpaint/api/template.tvpp rename to pype/hosts/tvpaint/resources/template.tvpp From 5ac0880872c597f4e5c47f4a9ba515efd9292891 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Tue, 15 Dec 2020 11:34:21 +0100 Subject: [PATCH 13/13] fixed paths to template.tvpp and avalon.loc in code --- pype/hosts/tvpaint/api/__init__.py | 9 +++------ pype/hosts/tvpaint/hooks/pre_launch_args.py | 4 +++- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/pype/hosts/tvpaint/api/__init__.py b/pype/hosts/tvpaint/api/__init__.py index 758acc738f..08484895c9 100644 --- a/pype/hosts/tvpaint/api/__init__.py +++ b/pype/hosts/tvpaint/api/__init__.py @@ -10,10 +10,8 @@ from pype.hosts import tvpaint log = logging.getLogger("pype.hosts.tvpaint") -PLUGINS_DIR = os.path.join( - os.path.dirname(os.path.abspath(tvpaint.__file__)), - "plugins" -) +HOST_DIR = os.path.dirname(os.path.abspath(tvpaint.__file__)) +PLUGINS_DIR = os.path.join(HOST_DIR, "plugins") PUBLISH_PATH = os.path.join(PLUGINS_DIR, "publish") LOAD_PATH = os.path.join(PLUGINS_DIR, "load") CREATE_PATH = os.path.join(PLUGINS_DIR, "create") @@ -38,8 +36,7 @@ def on_instance_toggle(instance, old_value, new_value): def install(): log.info("Pype - Installing TVPaint integration") - current_dir = os.path.dirname(os.path.abspath(__file__)) - localization_file = os.path.join(current_dir, "avalon.loc") + localization_file = os.path.join(HOST_DIR, "resources", "avalon.loc") register_localization_file(localization_file) pyblish.api.register_plugin_path(PUBLISH_PATH) diff --git a/pype/hosts/tvpaint/hooks/pre_launch_args.py b/pype/hosts/tvpaint/hooks/pre_launch_args.py index 7515d709ed..ebb911220f 100644 --- a/pype/hosts/tvpaint/hooks/pre_launch_args.py +++ b/pype/hosts/tvpaint/hooks/pre_launch_args.py @@ -78,7 +78,9 @@ class TvpaintPrelaunchHook(PreLaunchHook): # TODO add ability to set different template workfile path via # settings pype_dir = os.path.dirname(os.path.abspath(tvpaint.__file__)) - template_path = os.path.join(pype_dir, "api", "template.tvpp") + template_path = os.path.join( + pype_dir, "resources", "template.tvpp" + ) if not os.path.exists(template_path): self.log.warning(