From cd10166f1c25451764cc631497ab5d0b4687e3ef Mon Sep 17 00:00:00 2001 From: wijnand Date: Wed, 25 Apr 2018 16:52:50 +0200 Subject: [PATCH 01/10] Register manager actions on init --- colorbleed/__init__.py | 1 + colorbleed/fusion/__init__.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/colorbleed/__init__.py b/colorbleed/__init__.py index 07b65815cb..55258c8e80 100644 --- a/colorbleed/__init__.py +++ b/colorbleed/__init__.py @@ -3,6 +3,7 @@ from pyblish import api as pyblish from avalon import api as avalon from .launcher_actions import register_launcher_actions +from .manager_actions import register_manager_actions PACKAGE_DIR = os.path.dirname(__file__) PLUGINS_DIR = os.path.join(PACKAGE_DIR, "plugins") diff --git a/colorbleed/fusion/__init__.py b/colorbleed/fusion/__init__.py index 86ee04a71a..021a872d6c 100644 --- a/colorbleed/fusion/__init__.py +++ b/colorbleed/fusion/__init__.py @@ -3,6 +3,8 @@ import os from avalon import api as avalon from pyblish import api as pyblish +import colorbleed + PARENT_DIR = os.path.dirname(__file__) PACKAGE_DIR = os.path.dirname(PARENT_DIR) PLUGINS_DIR = os.path.join(PACKAGE_DIR, "plugins") @@ -20,6 +22,8 @@ def install(): pyblish.register_callback("instanceToggled", on_pyblish_instance_toggled) + colorbleed.register_manager_actions() + def uninstall(): print("Deregistering Fusion plug-ins..") From b80eb38199b99643345fcb4b1bac697e14ce0e77 Mon Sep 17 00:00:00 2001 From: wijnand Date: Wed, 25 Apr 2018 16:53:21 +0200 Subject: [PATCH 02/10] Definitions of tool action plugins and the register_manager_action function --- colorbleed/manager_actions.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 colorbleed/manager_actions.py diff --git a/colorbleed/manager_actions.py b/colorbleed/manager_actions.py new file mode 100644 index 0000000000..02ff3ce610 --- /dev/null +++ b/colorbleed/manager_actions.py @@ -0,0 +1,29 @@ +from avalon import api, pipeline + + +class FusionSelectContainer(api.ToolAction): + + label = "Select Container" + icon = "object-group" + hosts = ["fusion"] + tools = ["manager"] + + def process(self, items): + + import avalon.fusion + + tools = [i["_tool"] for i in items] + + comp = avalon.fusion.get_current_comp() + flow = comp.CurrentFrame.FlowView + + # Clear selection + flow.Select() + + # Select tool + for tool in tools: + flow.Select(tool) + + +def register_manager_actions(): + pipeline.register_plugin(api.ToolAction, FusionSelectContainer) From a7b5a8d755593d15c947dbb8670e47264285326f Mon Sep 17 00:00:00 2001 From: wijnand Date: Wed, 25 Apr 2018 17:20:12 +0200 Subject: [PATCH 03/10] Changed icon and added color --- colorbleed/manager_actions.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/colorbleed/manager_actions.py b/colorbleed/manager_actions.py index 02ff3ce610..b0a1fe18bd 100644 --- a/colorbleed/manager_actions.py +++ b/colorbleed/manager_actions.py @@ -4,7 +4,8 @@ from avalon import api, pipeline class FusionSelectContainer(api.ToolAction): label = "Select Container" - icon = "object-group" + icon = "mouse-pointer" + color = "#d8d8d8" hosts = ["fusion"] tools = ["manager"] From b1c53ba21e915338a40d0531468e0a0ad37b1e21 Mon Sep 17 00:00:00 2001 From: wijnand Date: Wed, 25 Apr 2018 17:44:57 +0200 Subject: [PATCH 04/10] Updated function, lock comp during selection, updated arg name --- colorbleed/manager_actions.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/colorbleed/manager_actions.py b/colorbleed/manager_actions.py index b0a1fe18bd..50a3e35056 100644 --- a/colorbleed/manager_actions.py +++ b/colorbleed/manager_actions.py @@ -9,21 +9,22 @@ class FusionSelectContainer(api.ToolAction): hosts = ["fusion"] tools = ["manager"] - def process(self, items): + def process(self, containers): import avalon.fusion - tools = [i["_tool"] for i in items] + tools = [i["_tool"] for i in containers] comp = avalon.fusion.get_current_comp() flow = comp.CurrentFrame.FlowView - # Clear selection - flow.Select() + with avalon.fusion.comp_lock_and_undo_chunk(comp, self.label): + # Clear selection + flow.Select() - # Select tool - for tool in tools: - flow.Select(tool) + # Select tool + for tool in tools: + flow.Select(tool) def register_manager_actions(): From 85dd7e247ce184d2c544d6bc25776e213275a4a7 Mon Sep 17 00:00:00 2001 From: wijnand Date: Thu, 26 Apr 2018 16:06:18 +0200 Subject: [PATCH 05/10] Refactored ToolAction to InventoryAction --- colorbleed/manager_actions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/colorbleed/manager_actions.py b/colorbleed/manager_actions.py index 50a3e35056..17d4c80605 100644 --- a/colorbleed/manager_actions.py +++ b/colorbleed/manager_actions.py @@ -1,7 +1,7 @@ from avalon import api, pipeline -class FusionSelectContainer(api.ToolAction): +class FusionSelectContainer(api.InventoryAction): label = "Select Container" icon = "mouse-pointer" @@ -28,4 +28,4 @@ class FusionSelectContainer(api.ToolAction): def register_manager_actions(): - pipeline.register_plugin(api.ToolAction, FusionSelectContainer) + pipeline.register_plugin(api.InventoryAction, FusionSelectContainer) From bd16d489bc07f65ac7617f57b276ed82808eac00 Mon Sep 17 00:00:00 2001 From: wijnand Date: Mon, 30 Apr 2018 11:12:33 +0200 Subject: [PATCH 06/10] removed tools attribute from class --- colorbleed/manager_actions.py | 1 - 1 file changed, 1 deletion(-) diff --git a/colorbleed/manager_actions.py b/colorbleed/manager_actions.py index 17d4c80605..adb76d42b4 100644 --- a/colorbleed/manager_actions.py +++ b/colorbleed/manager_actions.py @@ -7,7 +7,6 @@ class FusionSelectContainer(api.InventoryAction): icon = "mouse-pointer" color = "#d8d8d8" hosts = ["fusion"] - tools = ["manager"] def process(self, containers): From a8aba5d4e08cf0ac0c01272b08995615a9a37832 Mon Sep 17 00:00:00 2001 From: wijnand Date: Mon, 30 Apr 2018 13:21:02 +0200 Subject: [PATCH 07/10] Moved plugin to inventory folder of host, removes need for register_manager_actions --- colorbleed/__init__.py | 1 - colorbleed/fusion/__init__.py | 5 ++--- .../fusion/inventory/select_containers.py} | 8 ++------ 3 files changed, 4 insertions(+), 10 deletions(-) rename colorbleed/{manager_actions.py => plugins/fusion/inventory/select_containers.py} (73%) diff --git a/colorbleed/__init__.py b/colorbleed/__init__.py index 55258c8e80..07b65815cb 100644 --- a/colorbleed/__init__.py +++ b/colorbleed/__init__.py @@ -3,7 +3,6 @@ from pyblish import api as pyblish from avalon import api as avalon from .launcher_actions import register_launcher_actions -from .manager_actions import register_manager_actions PACKAGE_DIR = os.path.dirname(__file__) PLUGINS_DIR = os.path.join(PACKAGE_DIR, "plugins") diff --git a/colorbleed/fusion/__init__.py b/colorbleed/fusion/__init__.py index 021a872d6c..2bb4fec5ea 100644 --- a/colorbleed/fusion/__init__.py +++ b/colorbleed/fusion/__init__.py @@ -3,7 +3,6 @@ import os from avalon import api as avalon from pyblish import api as pyblish -import colorbleed PARENT_DIR = os.path.dirname(__file__) PACKAGE_DIR = os.path.dirname(PARENT_DIR) @@ -12,6 +11,7 @@ PLUGINS_DIR = os.path.join(PACKAGE_DIR, "plugins") PUBLISH_PATH = os.path.join(PLUGINS_DIR, "fusion", "publish") LOAD_PATH = os.path.join(PLUGINS_DIR, "fusion", "load") CREATE_PATH = os.path.join(PLUGINS_DIR, "fusion", "create") +INVENTORY_PATH = os.path.join(PLUGINS_DIR, "fusion", "inventory") def install(): @@ -19,11 +19,10 @@ def install(): pyblish.register_plugin_path(PUBLISH_PATH) avalon.register_plugin_path(avalon.Loader, LOAD_PATH) avalon.register_plugin_path(avalon.Creator, CREATE_PATH) + avalon.register_plugin_path(avalon.InventoryAction, INVENTORY_PATH) pyblish.register_callback("instanceToggled", on_pyblish_instance_toggled) - colorbleed.register_manager_actions() - def uninstall(): print("Deregistering Fusion plug-ins..") diff --git a/colorbleed/manager_actions.py b/colorbleed/plugins/fusion/inventory/select_containers.py similarity index 73% rename from colorbleed/manager_actions.py rename to colorbleed/plugins/fusion/inventory/select_containers.py index adb76d42b4..a1b54ebb74 100644 --- a/colorbleed/manager_actions.py +++ b/colorbleed/plugins/fusion/inventory/select_containers.py @@ -1,9 +1,9 @@ from avalon import api, pipeline -class FusionSelectContainer(api.InventoryAction): +class FusionSelectContainers(api.InventoryAction): - label = "Select Container" + label = "Select Containers" icon = "mouse-pointer" color = "#d8d8d8" hosts = ["fusion"] @@ -24,7 +24,3 @@ class FusionSelectContainer(api.InventoryAction): # Select tool for tool in tools: flow.Select(tool) - - -def register_manager_actions(): - pipeline.register_plugin(api.InventoryAction, FusionSelectContainer) From 84eea57b996608ed24d4ca4a4ffe487adc685272 Mon Sep 17 00:00:00 2001 From: wijnand Date: Mon, 30 Apr 2018 13:21:31 +0200 Subject: [PATCH 08/10] Removed unused import --- colorbleed/plugins/fusion/inventory/select_containers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/colorbleed/plugins/fusion/inventory/select_containers.py b/colorbleed/plugins/fusion/inventory/select_containers.py index a1b54ebb74..654384b847 100644 --- a/colorbleed/plugins/fusion/inventory/select_containers.py +++ b/colorbleed/plugins/fusion/inventory/select_containers.py @@ -1,4 +1,4 @@ -from avalon import api, pipeline +from avalon import api class FusionSelectContainers(api.InventoryAction): From 127895117378351339b4e94fed5f04c3ee48fe0a Mon Sep 17 00:00:00 2001 From: wijnand Date: Mon, 30 Apr 2018 13:23:52 +0200 Subject: [PATCH 09/10] removed redundant empty line --- colorbleed/widgets/popup.py | 1 - 1 file changed, 1 deletion(-) diff --git a/colorbleed/widgets/popup.py b/colorbleed/widgets/popup.py index 0ad1e07490..805eae8c23 100644 --- a/colorbleed/widgets/popup.py +++ b/colorbleed/widgets/popup.py @@ -30,7 +30,6 @@ class Popup(QtWidgets.QDialog): QtWidgets.QSizePolicy.Maximum) show.setStyleSheet("""QPushButton { background-color: #BB0000 }""") - layout.addWidget(message) layout.addWidget(show) From 3098b68d91ace746b0bb2ef36095a9477865f354 Mon Sep 17 00:00:00 2001 From: wijnand Date: Mon, 30 Apr 2018 16:51:37 +0200 Subject: [PATCH 10/10] removed hosts attribute --- colorbleed/plugins/fusion/inventory/select_containers.py | 1 - 1 file changed, 1 deletion(-) diff --git a/colorbleed/plugins/fusion/inventory/select_containers.py b/colorbleed/plugins/fusion/inventory/select_containers.py index 654384b847..2f7b3e5809 100644 --- a/colorbleed/plugins/fusion/inventory/select_containers.py +++ b/colorbleed/plugins/fusion/inventory/select_containers.py @@ -6,7 +6,6 @@ class FusionSelectContainers(api.InventoryAction): label = "Select Containers" icon = "mouse-pointer" color = "#d8d8d8" - hosts = ["fusion"] def process(self, containers):