From 7eb58a1525488cc903c86fe91b0dead05ede145e Mon Sep 17 00:00:00 2001 From: wijnand Date: Tue, 27 Mar 2018 16:23:24 +0200 Subject: [PATCH 1/8] Added register_launcher_action (cherry picked from commit 2fdd3c8) --- colorbleed/__init__.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/colorbleed/__init__.py b/colorbleed/__init__.py index f29597a297..6a1699a030 100644 --- a/colorbleed/__init__.py +++ b/colorbleed/__init__.py @@ -1,5 +1,6 @@ import os from pyblish import api as pyblish +from avalon import api, pipeline PACKAGE_DIR = os.path.dirname(__file__) PLUGINS_DIR = os.path.join(PACKAGE_DIR, "plugins") @@ -16,3 +17,11 @@ def install(): def uninstall(): pyblish.deregister_plugin_path(PUBLISH_PATH) + +def register_launcher_actions(): + """Register specific actions which should be accessible in the launcher""" + + # Register fusion actions + from .fusion import rendernode + pipeline.register_plugin(api.Action, rendernode.FusionRenderNode) + From b46b5e4cba707c7b764dbb7bb0d29f988d7d291f Mon Sep 17 00:00:00 2001 From: wijnand Date: Tue, 27 Mar 2018 16:24:33 +0200 Subject: [PATCH 2/8] FusionRenderNode action for launcher (cherry picked from commit cc7124a) --- colorbleed/fusion/rendernode.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 colorbleed/fusion/rendernode.py diff --git a/colorbleed/fusion/rendernode.py b/colorbleed/fusion/rendernode.py new file mode 100644 index 0000000000..21ed091ad7 --- /dev/null +++ b/colorbleed/fusion/rendernode.py @@ -0,0 +1,23 @@ +import os +from avalon import api, lib + +# TODO: get fusion render node exe from somewhere else +FRN = "C:/Program Files/Blackmagic Design/Fusion Render Node 9/FusionRenderNode.exe" + + +class FusionRenderNode(api.Action): + + name = "fusionrendernode" + label = "F9 Render Node" + icon = "object-group" + order = 997 + + def is_compatible(self, session): + """Return whether the action is compatible with the session""" + return True + + def process(self, session, **kwargs): + """Implement the behavior for when the action is triggered""" + return lib.launch(executable=FRN, + args=[], + environment=os.environ.update(session)) From 4f3c02c07ca0b9e652a979f3a7dc3e5ebbf3cbae Mon Sep 17 00:00:00 2001 From: wijnand Date: Wed, 28 Mar 2018 12:26:15 +0200 Subject: [PATCH 3/8] only show rusion render node at root of launcher --- colorbleed/fusion/rendernode.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/colorbleed/fusion/rendernode.py b/colorbleed/fusion/rendernode.py index 21ed091ad7..ae823427a5 100644 --- a/colorbleed/fusion/rendernode.py +++ b/colorbleed/fusion/rendernode.py @@ -14,6 +14,8 @@ class FusionRenderNode(api.Action): def is_compatible(self, session): """Return whether the action is compatible with the session""" + if "AVALON_PROJECT" in session: + return False return True def process(self, session, **kwargs): From f8869e4f68a04958186634e3cf239a982a0abff6 Mon Sep 17 00:00:00 2001 From: wijnand Date: Fri, 30 Mar 2018 11:42:25 +0200 Subject: [PATCH 4/8] register actions for launcher --- colorbleed/config_actions.py | 44 ++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 colorbleed/config_actions.py diff --git a/colorbleed/config_actions.py b/colorbleed/config_actions.py new file mode 100644 index 0000000000..c5ca3f8573 --- /dev/null +++ b/colorbleed/config_actions.py @@ -0,0 +1,44 @@ +import os +from avalon import api, lib, pipeline + + +class FusionRenderNode(api.Action): + + name = "fusionrendernode9" + label = "F9 Render Node" + icon = "object-group" + order = 997 + + def is_compatible(self, session): + """Return whether the action is compatible with the session""" + if "AVALON_PROJECT" in session: + return False + return True + + def process(self, session, **kwargs): + """Implement the behavior for when the action is triggered + + Args: + session (dict): environment dictionary + + Returns: + Popen instance of newly spawned process + + """ + + # Update environment with session + env = os.environ.copy() + env.update(session) + + # Get executable by na.e + app = lib.get_application(self.name) + executable = lib.which(app["executable"]) + + return lib.launch(executable=executable, args=[], environment=env) + + +def register_actions(): + """Register specific actions which should be accessible in the launcher""" + + # Register fusion actions + pipeline.register_plugin(api.Action, FusionRenderNode) From c283f732c93edd8e91cb3f72409ab82beea868d2 Mon Sep 17 00:00:00 2001 From: wijnand Date: Fri, 30 Mar 2018 11:44:11 +0200 Subject: [PATCH 5/8] Register launcher action --- colorbleed/__init__.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/colorbleed/__init__.py b/colorbleed/__init__.py index 6a1699a030..1e47cf9995 100644 --- a/colorbleed/__init__.py +++ b/colorbleed/__init__.py @@ -1,6 +1,7 @@ import os from pyblish import api as pyblish -from avalon import api, pipeline + +from .config_actions import register_actions PACKAGE_DIR = os.path.dirname(__file__) PLUGINS_DIR = os.path.join(PACKAGE_DIR, "plugins") @@ -19,9 +20,5 @@ def uninstall(): def register_launcher_actions(): - """Register specific actions which should be accessible in the launcher""" - - # Register fusion actions - from .fusion import rendernode - pipeline.register_plugin(api.Action, rendernode.FusionRenderNode) - + """Convenience function to register the actions""" + register_actions() From 115299e6b5ac85dd320949f3b9676f98b1f8bdb7 Mon Sep 17 00:00:00 2001 From: wijnand Date: Fri, 30 Mar 2018 11:44:41 +0200 Subject: [PATCH 6/8] Removed module, content moved to config_actions --- colorbleed/fusion/rendernode.py | 25 ------------------------- 1 file changed, 25 deletions(-) delete mode 100644 colorbleed/fusion/rendernode.py diff --git a/colorbleed/fusion/rendernode.py b/colorbleed/fusion/rendernode.py deleted file mode 100644 index ae823427a5..0000000000 --- a/colorbleed/fusion/rendernode.py +++ /dev/null @@ -1,25 +0,0 @@ -import os -from avalon import api, lib - -# TODO: get fusion render node exe from somewhere else -FRN = "C:/Program Files/Blackmagic Design/Fusion Render Node 9/FusionRenderNode.exe" - - -class FusionRenderNode(api.Action): - - name = "fusionrendernode" - label = "F9 Render Node" - icon = "object-group" - order = 997 - - def is_compatible(self, session): - """Return whether the action is compatible with the session""" - if "AVALON_PROJECT" in session: - return False - return True - - def process(self, session, **kwargs): - """Implement the behavior for when the action is triggered""" - return lib.launch(executable=FRN, - args=[], - environment=os.environ.update(session)) From 1ec79ac2fb71f199ae2a4ae4c5b03b3f60f9d3a4 Mon Sep 17 00:00:00 2001 From: wijnand Date: Fri, 30 Mar 2018 12:19:42 +0200 Subject: [PATCH 7/8] Renamed module, refactored register function --- colorbleed/{config_actions.py => launcher_actions.py} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename colorbleed/{config_actions.py => launcher_actions.py} (97%) diff --git a/colorbleed/config_actions.py b/colorbleed/launcher_actions.py similarity index 97% rename from colorbleed/config_actions.py rename to colorbleed/launcher_actions.py index c5ca3f8573..dd5cf2374e 100644 --- a/colorbleed/config_actions.py +++ b/colorbleed/launcher_actions.py @@ -37,7 +37,7 @@ class FusionRenderNode(api.Action): return lib.launch(executable=executable, args=[], environment=env) -def register_actions(): +def register_launcher_actions(): """Register specific actions which should be accessible in the launcher""" # Register fusion actions From ddf9d3d6aebe2bf0c994ba07652f6983e1bca99a Mon Sep 17 00:00:00 2001 From: wijnand Date: Fri, 30 Mar 2018 12:20:47 +0200 Subject: [PATCH 8/8] Removed register function as import adds it to module attributes --- colorbleed/__init__.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/colorbleed/__init__.py b/colorbleed/__init__.py index 1e47cf9995..13aa87c153 100644 --- a/colorbleed/__init__.py +++ b/colorbleed/__init__.py @@ -1,7 +1,7 @@ import os from pyblish import api as pyblish -from .config_actions import register_actions +from .launcher_actions import register_launcher_actions PACKAGE_DIR = os.path.dirname(__file__) PLUGINS_DIR = os.path.join(PACKAGE_DIR, "plugins") @@ -17,8 +17,3 @@ def install(): def uninstall(): pyblish.deregister_plugin_path(PUBLISH_PATH) - - -def register_launcher_actions(): - """Convenience function to register the actions""" - register_actions()