From 01c97f192f6cb2ba639cb579321c5bcecfd8cac5 Mon Sep 17 00:00:00 2001 From: Ricardo Musch Date: Tue, 6 Apr 2021 21:29:16 +0100 Subject: [PATCH 1/6] Update collector.py Changed the default for folder publish to False --- hooks/tk-multi-publish2/basic/collector.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hooks/tk-multi-publish2/basic/collector.py b/hooks/tk-multi-publish2/basic/collector.py index 6a6e17c..7b4c191 100644 --- a/hooks/tk-multi-publish2/basic/collector.py +++ b/hooks/tk-multi-publish2/basic/collector.py @@ -74,7 +74,7 @@ def settings(self): }, "Publish Textures as Folder": { "type": "bool", - "default": True, + "default": False, "description": "Publish Substance Painter textures as a folder." "If true (default) textures will be all exported" " together as a folder publish." From c893df74c6b2d207cb0db1c03fb5c6796ed0cfe8 Mon Sep 17 00:00:00 2001 From: Ricardo Musch Date: Tue, 6 Apr 2021 22:36:16 +0100 Subject: [PATCH 2/6] Update collector.py Hardcoded collect textures vs folder --- hooks/tk-multi-publish2/basic/collector.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/hooks/tk-multi-publish2/basic/collector.py b/hooks/tk-multi-publish2/basic/collector.py index 7b4c191..dcfd39a 100644 --- a/hooks/tk-multi-publish2/basic/collector.py +++ b/hooks/tk-multi-publish2/basic/collector.py @@ -102,11 +102,17 @@ def process_current_session(self, settings, parent_item): item = self.collect_current_substancepainter_session(settings, parent_item) if item: - publish_as_folder_setting = settings.get("Publish Textures as Folder") - if publish_as_folder_setting and publish_as_folder_setting.value: - resource_items = self.collect_textures_as_folder(settings, item) - else: - resource_items = self.collect_textures(settings, item) + + # TO FIX + # THIS DOES NOT SEEM TO WORK! + # publish_as_folder_setting = settings.get("Publish Textures as Folder") + # if publish_as_folder_setting and publish_as_folder_setting.value: + # resource_items = self.collect_textures_as_folder(settings, item) + # else: + # resource_items = self.collect_textures(settings, item) + + # HARDCODE to publish textures as individual published files + resource_items = self.collect_textures(settings, item) def get_export_path(self, settings): publisher = self.parent From c272792b8916e270fd7612d36a51f2cd8c5e989e Mon Sep 17 00:00:00 2001 From: Alina Gotovtseva Date: Mon, 21 Nov 2022 15:21:35 +0000 Subject: [PATCH 3/6] Update export_document_maps func to accept configs --- python/tk_substancepainter/application.py | 8 ++++++-- resources/plugins/shotgun_bridge/main.qml | 5 +---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/python/tk_substancepainter/application.py b/python/tk_substancepainter/application.py index fdb941f..13b257a 100644 --- a/python/tk_substancepainter/application.py +++ b/python/tk_substancepainter/application.py @@ -270,7 +270,7 @@ def get_map_export_information(self): result = self.send_and_receive("GET_MAP_EXPORT_INFORMATION") return result - def export_document_maps(self, destination): + def export_document_maps(self, preset, destination, format, mapInfo): # This is a trick to wait until the async process of # exporting textures finishes. self.__export_results = None @@ -283,7 +283,11 @@ def run_once_finished_exporting_maps(**kwargs): ) self.log_debug("Starting map export...") - result = self.send_and_receive("EXPORT_DOCUMENT_MAPS", destination=destination) + self.send_and_receive("EXPORT_DOCUMENT_MAPS", + preset=preset, + destination=destination, + format=format, + mapInfo=mapInfo) while self.__export_results is None: self.log_debug("Waiting for maps to be exported ...") diff --git a/resources/plugins/shotgun_bridge/main.qml b/resources/plugins/shotgun_bridge/main.qml index da0577d..69ee54c 100644 --- a/resources/plugins/shotgun_bridge/main.qml +++ b/resources/plugins/shotgun_bridge/main.qml @@ -464,11 +464,8 @@ PainterPlugin function exportDocumentMaps(data) { - var export_preset = alg.mapexport.getProjectExportPreset(); - var export_options = alg.mapexport.getProjectExportOptions(); - var export_path = data.destination; server.sendCommand("EXPORT_STARTED", {}); - var result = alg.mapexport.exportDocumentMaps(export_preset, export_path, export_options.fileFormat) + var result = alg.mapexport.exportDocumentMaps(data.preset, data.destination, data.format, data.mapInfo) server.sendCommand("EXPORT_FINISHED", {map_infos:result}); return true; } From 9ca93ef0790270fa4244722327bb336752875e0a Mon Sep 17 00:00:00 2001 From: Alina Gotovtseva Date: Mon, 21 Nov 2022 15:40:41 +0000 Subject: [PATCH 4/6] Do not show warning if current version is higher than min supported --- engine.py | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/engine.py b/engine.py index bd2bd75..c68f045 100644 --- a/engine.py +++ b/engine.py @@ -462,7 +462,7 @@ def pre_app_init(self): raise tank.TankError(msg) if painter_version > painter_min_supported_version: - # show a warning that this version of Substance Painter isn't yet fully tested + # log a warning that this version of Substance Painter isn't yet fully tested # with Shotgun: msg = ( "The Shotgun Pipeline Toolkit has not yet been fully " @@ -472,26 +472,6 @@ def pre_app_init(self): "\n\n" % (painter_version) ) - # determine if we should show the compatibility warning dialog: - show_warning_dlg = self.has_ui and SHOW_COMP_DLG not in os.environ - - if show_warning_dlg: - # make sure we only show it once per session - os.environ[SHOW_COMP_DLG] = "1" - - # check against the compatibility_dialog_min_version - # setting - min_version_str = self.get_setting("compatibility_dialog_min_version") - - min_version = to_new_version_system(min_version_str) - if painter_version < min_version: - show_warning_dlg = False - - if show_warning_dlg: - # Note, title is padded to try to ensure dialog isn't insanely - # narrow! - self.show_warning(msg) - # always log the warning to the script editor: self.logger.warning(msg) From 506b911f4086810c4bb6353a7a8059d20492d994 Mon Sep 17 00:00:00 2001 From: Alina Gotovtseva Date: Wed, 25 Jan 2023 18:05:16 +0000 Subject: [PATCH 5/6] Update folders to Adobe --- startup.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/startup.py b/startup.py index bd8be6a..8a7ce85 100644 --- a/startup.py +++ b/startup.py @@ -214,7 +214,7 @@ class SubstancePainterLauncher(SoftwareLauncher): EXECUTABLE_TEMPLATES = { "darwin": ["/Applications/Allegorithmic/Substance Painter.app"], - "win32": ["C:/Program Files/Allegorithmic/Substance Painter/Substance Painter.exe"], + "win32": ["C:/Program Files/Adobe/Adobe Substance 3D Painter/Adobe Substance 3D Painter.exe"], "linux2": [ "/usr/Allegorithmic/Substance Painter", "/usr/Allegorithmic/Substance_Painter/Substance Painter", @@ -297,11 +297,11 @@ def prepare_launch(self, exec_path, args, file_to_open=None): None, CSIDL_PERSONAL, None, SHGFP_TYPE_CURRENT, path_buffer ) - user_scripts_path = path_buffer.value + r"\Allegorithmic\Substance Painter\plugins" + user_scripts_path = path_buffer.value + r"\Adobe\Adobe Substance 3D Painter\plugins" else: user_scripts_path = os.path.expanduser( - r"~/Documents/Allegorithmic/Substance Painter/plugins" + r"~/Documents/Adobe/Adobe Substance 3D Painter/plugins" ) ensure_scripts_up_to_date(resources_plugins_path, user_scripts_path) From 22ceebe81396087e2b68dcd8d35de11e443b3ade Mon Sep 17 00:00:00 2001 From: Alina Gotovtseva Date: Fri, 28 Apr 2023 18:47:04 +0100 Subject: [PATCH 6/6] Add python3 support --- config/env/includes/frameworks.yml | 8 +++----- engine.py | 10 +++++----- hooks/tk-multi-publish2/basic/collector.py | 4 ++-- hooks/tk-multi-publish2/basic/publish_session.py | 2 +- hooks/tk-multi-publish2/basic/publish_texture.py | 4 ++-- hooks/tk-multi-publish2/basic/publish_textures.py | 4 ++-- hooks/tk-multi-publish2/basic/start_version_control.py | 2 +- python/tk_substancepainter/__init__.py | 2 +- python/tk_substancepainter/application.py | 4 ++-- python/tk_substancepainter/menu_generation.py | 2 +- startup.py | 2 +- startup/bootstrap.py | 6 +++--- 12 files changed, 24 insertions(+), 26 deletions(-) diff --git a/config/env/includes/frameworks.yml b/config/env/includes/frameworks.yml index c75b488..8b47c61 100644 --- a/config/env/includes/frameworks.yml +++ b/config/env/includes/frameworks.yml @@ -22,8 +22,6 @@ frameworks: # unrealqt - PySide build for Unreal (Windows-only) tk-framework-unrealqt_v1.x.x: location: - type: git_branch - path: https://github.com/shotgunsoftware/tk-framework-unrealqt.git - branch: master - version: 58c2f7b - + type: git + path: https://github.com/ue4plugins/tk-framework-unrealqt.git + version: v1.2.3 diff --git a/engine.py b/engine.py index c68f045..6622b9c 100644 --- a/engine.py +++ b/engine.py @@ -139,7 +139,7 @@ def refresh_engine(scene_name, prev_context): # and construct the new context for this path: tk = tank.tank_from_path(new_path) ctx = tk.context_from_path(new_path, prev_context) - except tank.TankError, e: + except tank.TankError as e: try: # could not detect context from path, will use the project context # for menus if it exists @@ -154,7 +154,7 @@ def refresh_engine(scene_name, prev_context): ) engine.show_warning(message) - except tank.TankError, e: + except tank.TankError as e: (exc_type, exc_value, exc_traceback) = sys.exc_info() message = "" message += "Shotgun Substance Painter Engine cannot be started:.\n" @@ -592,7 +592,7 @@ def _run_app_instance_commands(self): # Build a dictionary mapping app instance names to dictionaries of # commands they registered with the engine. app_instance_commands = {} - for (cmd_name, value) in self.commands.iteritems(): + for (cmd_name, value) in self.commands.items(): app_instance = value["properties"].get("app") if app_instance: # Add entry 'command name: command function' to the command @@ -624,7 +624,7 @@ def _run_app_instance_commands(self): else: if not setting_cmd_name: # Run all commands of the given app instance. - for (cmd_name, command_function) in cmd_dict.iteritems(): + for (cmd_name, command_function) in cmd_dict.items(): msg = ( "%s startup running app '%s' command '%s'.", self.name, @@ -736,7 +736,7 @@ def close_windows(self): # the original dialog list. self.logger.debug("Closing dialog %s.", dialog_window_title) dialog.close() - except Exception, exception: + except Exception as exception: traceback.print_exc() self.logger.error( "Cannot close dialog %s: %s", dialog_window_title, exception diff --git a/hooks/tk-multi-publish2/basic/collector.py b/hooks/tk-multi-publish2/basic/collector.py index dcfd39a..94c6e15 100644 --- a/hooks/tk-multi-publish2/basic/collector.py +++ b/hooks/tk-multi-publish2/basic/collector.py @@ -210,8 +210,8 @@ def collect_textures(self, settings, parent_item): icon_path = os.path.join(self.disk_location, os.pardir, "icons", "texture.png") - for texture_set_name, texture_set in map_export_info.iteritems(): - for texture_id, texture_file in texture_set.iteritems(): + for texture_set_name, texture_set in map_export_info.items(): + for texture_id, texture_file in texture_set.items(): if os.path.exists(texture_file): _, filenamefile = os.path.split(texture_file) texture_name, _ = os.path.splitext(filenamefile) diff --git a/hooks/tk-multi-publish2/basic/publish_session.py b/hooks/tk-multi-publish2/basic/publish_session.py index 1eded1f..a566642 100644 --- a/hooks/tk-multi-publish2/basic/publish_session.py +++ b/hooks/tk-multi-publish2/basic/publish_session.py @@ -361,7 +361,7 @@ def _session_path(): # get the path to the current file path = engine.app.get_current_project_path() - if isinstance(path, unicode): + if not isinstance(path, str): path = path.encode("utf-8") return path diff --git a/hooks/tk-multi-publish2/basic/publish_texture.py b/hooks/tk-multi-publish2/basic/publish_texture.py index 0872506..acf709d 100644 --- a/hooks/tk-multi-publish2/basic/publish_texture.py +++ b/hooks/tk-multi-publish2/basic/publish_texture.py @@ -365,7 +365,7 @@ def _find_publishes(self, ctx, publish_name, publish_type): sg_publishes = self.parent.shotgun.find( publish_entity_type, filters, query_fields ) - except Exception, e: + except Exception as e: self.logger.error( "Failed to find publishes of type '%s', called '%s', for context %s: %s" % (publish_name, publish_type, ctx, e) @@ -383,7 +383,7 @@ def _export_path(): # get the path to the current file path = engine.app.get_project_export_path() - if isinstance(path, unicode): + if not isinstance(path, str): path = path.encode("utf-8") return path diff --git a/hooks/tk-multi-publish2/basic/publish_textures.py b/hooks/tk-multi-publish2/basic/publish_textures.py index 532656a..07f9fa8 100644 --- a/hooks/tk-multi-publish2/basic/publish_textures.py +++ b/hooks/tk-multi-publish2/basic/publish_textures.py @@ -377,7 +377,7 @@ def _find_publishes(self, ctx, publish_name, publish_type): sg_publishes = self.parent.shotgun.find( publish_entity_type, filters, query_fields ) - except Exception, e: + except Exception as e: self.logger.error( "Failed to find publishes of type '%s', called '%s', for context %s: %s" % (publish_name, publish_type, ctx, e) @@ -395,7 +395,7 @@ def _export_path(): # get the path to the current file path = engine.app.get_project_export_path() - if isinstance(path, unicode): + if not isinstance(path, str): path = path.encode("utf-8") return path diff --git a/hooks/tk-multi-publish2/basic/start_version_control.py b/hooks/tk-multi-publish2/basic/start_version_control.py index 7155988..02719e1 100644 --- a/hooks/tk-multi-publish2/basic/start_version_control.py +++ b/hooks/tk-multi-publish2/basic/start_version_control.py @@ -285,7 +285,7 @@ def _session_path(): # get the path to the current file path = engine.app.get_current_project_path() - if isinstance(path, unicode): + if not isinstance(path, str): path = path.encode("utf-8") return path diff --git a/python/tk_substancepainter/__init__.py b/python/tk_substancepainter/__init__.py index 7f12a24..5143460 100644 --- a/python/tk_substancepainter/__init__.py +++ b/python/tk_substancepainter/__init__.py @@ -1,2 +1,2 @@ -import application +from . import application from .menu_generation import MenuGenerator diff --git a/python/tk_substancepainter/application.py b/python/tk_substancepainter/application.py index 13b257a..656b147 100644 --- a/python/tk_substancepainter/application.py +++ b/python/tk_substancepainter/application.py @@ -134,13 +134,13 @@ def on_text_message_received(self, message): message_id = jsonData.get("id") # requesting data - if jsonData.has_key("method"): + if "method" in jsonData: # self.log_debug("client: request detected: %s" % (message)) method = jsonData.get("method") params = jsonData.get("params") self.engine.process_request(method, **params) - if jsonData.has_key("result"): + if "result" in jsonData: # self.log_debug("client: result detected: %s" % (message)) if message_id in self.callbacks: # self.log_debug( diff --git a/python/tk_substancepainter/menu_generation.py b/python/tk_substancepainter/menu_generation.py index e438910..2c3b2d8 100644 --- a/python/tk_substancepainter/menu_generation.py +++ b/python/tk_substancepainter/menu_generation.py @@ -286,7 +286,7 @@ def get_documentation_url_str(self): app = self.properties["app"] doc_url = app.documentation_url # deal with nuke's inability to handle unicode. #fail - if doc_url.__class__ == unicode: + if not isinstance(doc_url, str): doc_url = unicodedata.normalize("NFKD", doc_url).encode( "ascii", "ignore" ) diff --git a/startup.py b/startup.py index 8a7ce85..4134019 100644 --- a/startup.py +++ b/startup.py @@ -275,7 +275,7 @@ def prepare_launch(self, exec_path, args, file_to_open=None): # Only the startup script, the location of python and potentially the file to open # are needed. args = "" - args = ["%s=%s" % (k, v) for k, v in required_env.iteritems()] + args = ["%s=%s" % (k, v) for k, v in required_env.items()] args = '"&%s"' % "&".join(args) logger.info("running %s" % args) diff --git a/startup/bootstrap.py b/startup/bootstrap.py index b05592a..264ecbe 100644 --- a/startup/bootstrap.py +++ b/startup/bootstrap.py @@ -65,7 +65,7 @@ def start_toolkit_classic(): try: # Deserialize the environment context context = sgtk.context.deserialize(env_context) - except Exception, e: + except Exception as e: msg = ( "Shotgun: Could not create context! Shotgun Pipeline Toolkit" " will be disabled. Details: %s" % e @@ -83,7 +83,7 @@ def start_toolkit_classic(): engine = sgtk.platform.start_engine(env_engine, context.sgtk, context) logger.debug("Current engine '%s'" % sgtk.platform.current_engine()) - except Exception, e: + except Exception as e: msg = "Shotgun: Could not start engine. Details: %s" % e etype, value, tb = sys.exc_info() msg += "".join(traceback.format_exception(etype, value, tb)) @@ -100,7 +100,7 @@ def start_toolkit(): # Verify sgtk can be loaded. try: import sgtk - except Exception, e: + except Exception as e: msg = "Shotgun: Could not import sgtk! Disabling for now: %s" % e print(msg) return