diff --git a/openpype/hosts/nuke/api/__init__.py b/openpype/hosts/nuke/api/__init__.py index 1af5ff365d..55c4b8c808 100644 --- a/openpype/hosts/nuke/api/__init__.py +++ b/openpype/hosts/nuke/api/__init__.py @@ -43,7 +43,8 @@ from .lib import ( get_node_data, set_node_data, update_node_data, - create_write_node + create_write_node, + get_app_version_info ) from .utils import ( colorspace_exists_on_node, @@ -90,6 +91,7 @@ __all__ = ( "set_node_data", "update_node_data", "create_write_node", + "get_app_version_info", "colorspace_exists_on_node", "get_colorspace_list" diff --git a/openpype/hosts/nuke/api/lib.py b/openpype/hosts/nuke/api/lib.py index 4a57bc3165..bf66b9e1a9 100644 --- a/openpype/hosts/nuke/api/lib.py +++ b/openpype/hosts/nuke/api/lib.py @@ -3116,3 +3116,14 @@ def get_viewer_config_from_string(input_string): ).format(input_string)) return (display, viewer) + + +def get_app_version_info(): + """ Return dict of Nuke's version semantic info""" + dot_split = nuke.NUKE_VERSION_STRING.split(".") + v_spit = dot_split[1].split("v") + return { + "major": int(dot_split[0]), + "minor": int(v_spit[0]), + "patch": int(v_spit[1]) + } diff --git a/openpype/hosts/nuke/api/pipeline.py b/openpype/hosts/nuke/api/pipeline.py index e7c1c0ba0e..998c03b3dd 100644 --- a/openpype/hosts/nuke/api/pipeline.py +++ b/openpype/hosts/nuke/api/pipeline.py @@ -43,7 +43,8 @@ from .lib import ( add_scripts_menu, add_scripts_gizmo, get_node_data, - set_node_data + set_node_data, + get_app_version_info ) from .workfile_template_builder import ( NukePlaceholderLoadPlugin, @@ -218,6 +219,7 @@ def _install_menu(): main_window = get_main_window() menubar = nuke.menu("Nuke") menu = menubar.addMenu(MENU_LABEL) + app_version = get_app_version_info() if not ASSIST: label = "{0}, {1}".format( @@ -237,17 +239,21 @@ def _install_menu(): menu.addSeparator() if not ASSIST: + # only add parent if nuke version is 14 or higher + # known issue with no solution yet menu.addCommand( "Create...", lambda: host_tools.show_publisher( - parent=main_window, + parent=main_window if app_version["major"] >= 14 else None, tab="create" ) ) + # only add parent if nuke version is 14 or higher + # known issue with no solution yet menu.addCommand( "Publish...", lambda: host_tools.show_publisher( - parent=main_window, + parent=main_window if app_version["major"] >= 14 else None, tab="publish" ) )