diff --git a/api/python2/alias2019-alias2020.2/alias_api.pyd b/api/python2/alias2019-alias2020.2/alias_api.pyd index 877e9250..7feca40f 100644 Binary files a/api/python2/alias2019-alias2020.2/alias_api.pyd and b/api/python2/alias2019-alias2020.2/alias_api.pyd differ diff --git a/api/python2/alias2020.3-alias2021/alias_api.pyd b/api/python2/alias2020.3-alias2021/alias_api.pyd index 7d4f39bf..283a257e 100644 Binary files a/api/python2/alias2020.3-alias2021/alias_api.pyd and b/api/python2/alias2020.3-alias2021/alias_api.pyd differ diff --git a/api/python2/alias2021.3/alias_api.pyd b/api/python2/alias2021.3/alias_api.pyd index 51ec5cc6..d3cde883 100644 Binary files a/api/python2/alias2021.3/alias_api.pyd and b/api/python2/alias2021.3/alias_api.pyd differ diff --git a/api/python3/alias2019-alias2020.2/alias_api.pyd b/api/python3/alias2019-alias2020.2/alias_api.pyd index a893d81c..d4b69b56 100644 Binary files a/api/python3/alias2019-alias2020.2/alias_api.pyd and b/api/python3/alias2019-alias2020.2/alias_api.pyd differ diff --git a/api/python3/alias2020.3-alias2021/alias_api.pyd b/api/python3/alias2020.3-alias2021/alias_api.pyd index a9596ccf..77785c58 100644 Binary files a/api/python3/alias2020.3-alias2021/alias_api.pyd and b/api/python3/alias2020.3-alias2021/alias_api.pyd differ diff --git a/api/python3/alias2021.3/alias_api.pyd b/api/python3/alias2021.3/alias_api.pyd index 3949d5df..2cae9943 100644 Binary files a/api/python3/alias2021.3/alias_api.pyd and b/api/python3/alias2021.3/alias_api.pyd differ diff --git a/engine.py b/engine.py index 38708ff7..925d53fd 100644 --- a/engine.py +++ b/engine.py @@ -13,6 +13,7 @@ import sgtk from sgtk.util import LocalFileStorageManager + import alias_api @@ -30,6 +31,7 @@ def __init__(self, tk, context, engine_instance_name, env): self.alias_codename = None self.alias_execpath = None self.alias_bindir = None + self.alias_version = None self._dialog_parent = None self._menu_generator = None @@ -132,19 +134,36 @@ def pre_app_init(self): self.alias_codename = os.getenv("TK_ALIAS_CODENAME", "autostudio") # Be sure the current version is supported - alias_version = int(os.getenv("TK_ALIAS_VERSION", None)) - if not alias_version: + self.alias_version = os.getenv("TK_ALIAS_VERSION", None) + if not self.alias_version: self.logger.debug("Couldn't get Alias version. Skip version comparison") return - if alias_version > self.get_setting("compatibility_dialog_min_version", 2021): + if int(self.alias_version[0:4]) > self.get_setting( + "compatibility_dialog_min_version", 2021 + ): from sgtk.platform.qt import QtGui msg = ( - "The ShotGrid Pipeline Toolkit has not yet been fully tested with Alias %d. " + "The ShotGrid Pipeline Toolkit has not yet been fully tested with Alias %s. " "You can continue to use the Toolkit but you may experience bugs or " "instability. Please report any issues you see to %s" - % (alias_version, sgtk.support_url) + % (self.alias_version, sgtk.support_url) + ) + self.logger.warning(msg) + QtGui.QMessageBox.warning( + self.get_parent_window(), "Warning - ShotGrid Pipeline Toolkit!", msg, + ) + elif int(self.alias_version[0:4]) < 2021 and self.get_setting( + "compatibility_dialog_old_version" + ): + from sgtk.platform.qt import QtGui + + msg = ( + "The ShotGrid Pipeline Toolkit is not fully capable with Alias %s. " + "You should consider upgrading to a more recent version of Alias. " + "Please report any issues you see to %s" + % (self.alias_version, sgtk.support_url) ) self.logger.warning(msg) QtGui.QMessageBox.warning( diff --git a/info.yml b/info.yml index d3a4bd2e..38db02a4 100644 --- a/info.yml +++ b/info.yml @@ -61,6 +61,11 @@ configuration: value to the current major version + 1." default_value: 2022 + compatibility_dialog_old_version: + type: bool + description: "Disable warning about older versions of Alias" + default_value: True + # the Shotgun fields that this engine needs in order to operate correctly requires_shotgun_fields: diff --git a/plugins/shotgrid.plugin b/plugins/shotgrid.plugin new file mode 100644 index 00000000..50945472 Binary files /dev/null and b/plugins/shotgrid.plugin differ diff --git a/plugins/shotgrid_py2.plugin b/plugins/shotgrid_py2.plugin new file mode 100644 index 00000000..1768b083 Binary files /dev/null and b/plugins/shotgrid_py2.plugin differ diff --git a/plugins/shotgun.plugin b/plugins/shotgun.plugin index ac7d341b..f5394c66 100644 Binary files a/plugins/shotgun.plugin and b/plugins/shotgun.plugin differ diff --git a/plugins/shotgun_legacy.plugin b/plugins/shotgun_legacy.plugin index 0cd221b1..ca434924 100644 Binary files a/plugins/shotgun_legacy.plugin and b/plugins/shotgun_legacy.plugin differ diff --git a/plugins/shotgun_legacy_py2.plugin b/plugins/shotgun_legacy_py2.plugin index e0366a71..4671f818 100644 Binary files a/plugins/shotgun_legacy_py2.plugin and b/plugins/shotgun_legacy_py2.plugin differ diff --git a/plugins/shotgun_py2.plugin b/plugins/shotgun_py2.plugin index 418b20ca..44302ae9 100644 Binary files a/plugins/shotgun_py2.plugin and b/plugins/shotgun_py2.plugin differ diff --git a/python/tk_alias/menu_generation.py b/python/tk_alias/menu_generation.py index fe4e2eab..a8997aa2 100644 --- a/python/tk_alias/menu_generation.py +++ b/python/tk_alias/menu_generation.py @@ -21,8 +21,6 @@ class AliasMenuGenerator(object): Menu handling for Alias. """ - MENU_NAME = "al_shotgun" - def __init__(self, engine): """ Initializes a new menu generator. @@ -31,6 +29,10 @@ def __init__(self, engine): :type engine: :class:`tank.platform.Engine` """ self._engine = engine + if self._version_check(engine.alias_version, "2022.2") >= 0: + self.MENU_NAME = "al_shotgrid" + else: + self.MENU_NAME = "al_shotgun" self._alias_menu = alias_api.Menu(self.MENU_NAME) def create_menu(self, clean_menu=True): @@ -41,7 +43,7 @@ def create_menu(self, clean_menu=True): new one. This is useful in the case you're rebuilding the menu after context switching. """ - # First, ensure that the Shotgun menu inside Alias is empty. + # First, ensure that the ShotGrid menu inside Alias is empty. # This is to ensure we can recover from weird context switches # where the engine didn't clean up after itself properly. if clean_menu: @@ -186,6 +188,45 @@ def _jump_to_fs(self): if exit_code != 0: self._engine.logger.error("Failed to launch '%s'!", cmd) + def _version_check(self, version1, version2): + """ + Compare version strings and return 1 if version1 is greater than version2, + 0 if they are equal and -1 if version1 is less than version2 + + :param version1: A version string to compare against version2 e.g. 2022.2 + :param version2: A version string to compare against version1 e.g. 2021.3.1 + + :return: 1, 0, -1 as per above. + """ + # This will split both the versions by the '.' character + arr1 = version1.split(".") + arr2 = version2.split(".") + n = len(arr1) + m = len(arr2) + + # Converts to integer from string + arr1 = [int(i) for i in arr1] + arr2 = [int(i) for i in arr2] + + # Compares which list is bigger and fills + # the smaller list with zero (for unequal delimeters) + if n > m: + for i in range(m, n): + arr2.append(0) + elif m > n: + for i in range(n, m): + arr1.append(0) + + # Returns 1 if version1 is greater + # Returns -1 if version2 is greater + # Returns 0 if they are equal + for i in range(len(arr1)): + if arr1[i] > arr2[i]: + return 1 + elif arr2[i] > arr1[i]: + return -1 + return 0 + def refresh(self): """ Refresh the menu by forcing Alias to rebuild of its menus. diff --git a/startup.py b/startup.py index cdf1425f..0c87377e 100644 --- a/startup.py +++ b/startup.py @@ -44,10 +44,20 @@ class AliasLauncher(SoftwareLauncher): # Fallback code name to use when none is given FALLBACK_CODE_NAME = "AutoStudio" - # Shotgun default plugins + # ShotGrid default plugins DEFAULT_PLUGINS = { - "shotgun.plugin": {"min_version": "2020.2", "python_major_version": 3}, - "shotgun_py2.plugin": {"min_version": "2020.2", "python_major_version": 2}, + "shotgrid.plugin": {"min_version": "2022.2", "python_major_version": 3}, + "shotgrid_py2.plugin": {"min_version": "2022.2", "python_major_version": 2}, + "shotgun.plugin": { + "min_version": "2020.2", + "max_version": "2022.1", + "python_major_version": 3, + }, + "shotgun_py2.plugin": { + "min_version": "2020.2", + "max_version": "2022.1", + "python_major_version": 2, + }, "shotgun_legacy.plugin": { "min_version": "2019", "max_version": "2020.1", @@ -63,7 +73,7 @@ class AliasLauncher(SoftwareLauncher): ALIAS_API = { "alias2021.3": {"min_version": "2021.3"}, "alias2020.3-alias2021": {"min_version": "2020.3", "max_version": "2021.2.2"}, - "alias2019-alias2020.2": {"min_version": "2019", "max_version": "2020.2"}, + "alias2019-alias2020.2": {"min_version": "2019", "max_version": "2020.2.2"}, } # This dictionary defines a list of executable template strings for each @@ -152,12 +162,12 @@ def prepare_launch(self, exec_path, args, file_to_open=None): tk_alias_codename_lower = tk_alias_codename.lower() required_env["TK_ALIAS_VERSION"] = self._get_release_version( exec_path, tk_alias_codename - ).split(".")[0] + ) else: tk_alias_codename_lower = self.FALLBACK_CODE_NAME.lower() required_env["TK_ALIAS_VERSION"] = self._get_release_version( exec_path, self.FALLBACK_CODE_NAME - ).split(".")[0] + ) required_env["TK_ALIAS_CODENAME"] = tk_alias_codename_lower