Skip to content

Commit

Permalink
Udpate to use path setting
Browse files Browse the repository at this point in the history
  • Loading branch information
woutbelt committed Oct 2, 2023
1 parent b54736a commit 3a0223d
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 31 deletions.
12 changes: 12 additions & 0 deletions info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,18 @@ configuration:
default_value: []
values:
type: str

# --- PATHS ---

substance_painter_path_linux:
type: str
description: Linux path to your Substance Painter installation for creating slates.
substance_painter_path_mac:
type: str
description: Mac path to your Substance Painter installation for creating slates.
substance_painter_path_windows:
type: str
description: Windows path to your Substance Painter installation for creating slates.

# the Shotgun fields that this engine needs in order to operate correctly
requires_shotgun_fields:
Expand Down
57 changes: 26 additions & 31 deletions startup.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,18 +212,6 @@ class SubstancePainterLauncher(SoftwareLauncher):
# globbing and regex matches by replacing the named format placeholders
# with an appropriate glob or regex string.

EXECUTABLE_TEMPLATES = {
"darwin": ["/Applications/Allegorithmic/Substance Painter.app"],
"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",
"/opt/Allegorithmic/Substance_Painter/Substance Painter",
],
}

@property
def minimum_supported_version(self):
"""
Expand Down Expand Up @@ -433,32 +421,39 @@ def _find_software(self):
"""

# all the executable templates for the current OS
executable_templates = self.EXECUTABLE_TEMPLATES.get(sys.platform, [])
if sgtk.util.is_linux():
executable_template = "{}".format(self.get_setting("substance_painter_path_linux"))
elif sgtk.util.is_macos():
executable_template = "{}".format(self.get_setting("substance_painter_path_mac"))
elif sgtk.util.is_windows():
executable_template = "{}".format(self.get_setting("substance_painter_path_windows"))

self.logger.debug("AAAAAAAAAAAAAA")
self.logger.debug(executable_template)

# all the discovered executables
sw_versions = []

for executable_template in executable_templates:
self.logger.debug("Processing template %s.", executable_template)
self.logger.debug("Processing template %s.", executable_template)

executable_matches = self._glob_and_match(
executable_template, self.COMPONENT_REGEX_LOOKUP
)
executable_matches = self._glob_and_match(
executable_template, self.COMPONENT_REGEX_LOOKUP
)

# Extract all products from that executable.
for executable_path, key_dict in executable_matches:
executable_version = key_dict.get("version", UNKNOWN_VERSION)
# Extract all products from that executable.
for executable_path, key_dict in executable_matches:
executable_version = key_dict.get("version", UNKNOWN_VERSION)

self.logger.debug(
"Software found: %s | %s.", executable_version, executable_template
)
sw_versions.append(
SoftwareVersion(
executable_version,
"Substance Painter",
executable_path,
self._icon_from_engine(),
)
self.logger.debug(
"Software found: %s | %s.", executable_version, executable_template
)
sw_versions.append(
SoftwareVersion(
executable_version,
"Substance Painter",
executable_path,
self._icon_from_engine(),
)
)

return sw_versions

0 comments on commit 3a0223d

Please sign in to comment.