-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update startup.py #69
Open
kramester
wants to merge
17
commits into
shotgunsoftware:master
Choose a base branch
from
nimbleheroes:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+60
−19
Open
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
5547fdf
Update startup.py
kramester e2ca3bb
software entity for match templates
kramester 7f0dd5e
Merge pull request #1 from nimbleheroes/2020-04-20_scan-entity-for-ma…
kramester 54cb63b
Merge pull request #2 from shotgunsoftware/master
kramester 36edc7f
Merge branch 'merge_0.12.7' into shotgun_master
kramester e32f561
Merge pull request #3 from nimbleheroes/shotgun_master
kramester 6c842a7
Merge pull request #4 from nimbleheroes/merge_0.12.7
kramester f53ff83
added a context switch checker
kramester 55787ab
Merge pull request #5 from nimbleheroes/2020-09-19_remove_context_swi…
kramester f3c5a6a
can now pass hotkeys to registered commands
kramester fee65cc
Merge pull request #6 from nimbleheroes/2020-09-21_add_nx_framework
kramester cbb1677
Merge pull request #7 from shotgunsoftware/master
kramester f56d995
Merge pull request #8 from nimbleheroes/shotgun_master
kramester c0adaea
Merge pull request #9 from nimbleheroes/2020-12-20_v0.12.10_merge
kramester 63c4940
fixes a small bug that would show a warning when SW template was blank
kramester a6a4cc2
Merge pull request #10 from nimbleheroes/2020-12-30_startup_bug_fix
kramester 0297d82
fixes startup bug
kramester File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,6 +49,7 @@ class NukeLauncher(SoftwareLauncher): | |
"NukeAssist", | ||
"NukeStudio", | ||
"NukeX", | ||
"Hiero", | ||
] | ||
|
||
# This dictionary defines a list of executable template strings for each | ||
|
@@ -110,6 +111,40 @@ def scan_software(self): | |
|
||
return softwares | ||
|
||
def _scan_software_entities(self): | ||
filters = [ | ||
['sg_status_list', 'is', 'act'], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Black would make changes. |
||
['engine', 'in', ['tk-nuke', 'tk-hiero', 'tk-nukestudio']], | ||
{ | ||
'filter_operator': 'any', | ||
'filters': [ | ||
['sg_mac_template', 'is_not', None], | ||
['sg_linux_template', 'is_not', None], | ||
['sg_windows_template', 'is_not', None], | ||
] | ||
} | ||
] | ||
os_template = {'win32': 'sg_windows_template', | ||
'linux2': 'sg_linux_template', | ||
'darwin': 'sg_mac_template'} | ||
fields = ['sg_mac_template', | ||
'sg_linux_template', | ||
'sg_windows_template'] | ||
results = self.shotgun.find("Software", filters, fields) | ||
|
||
templ_list = [] | ||
for result in results: | ||
if result.get(os_template[sys.platform]): | ||
try: | ||
templ_list.extend(result.get( | ||
os_template[sys.platform]).split('\n')) | ||
except AttributeError as e: | ||
self.logger.error( | ||
'AttributeError on template \'{}\': {}'.format(result.get('code'), e)) | ||
pass | ||
|
||
return templ_list | ||
|
||
def _find_software(self): | ||
""" | ||
Finds all Nuke software on disk. | ||
|
@@ -129,15 +164,18 @@ def _find_software(self): | |
) | ||
|
||
# Certain platforms have more than one location for installed software | ||
for template in executable_templates: | ||
self.logger.debug("Processing template %s.", template) | ||
# Extract all products from that executable. | ||
for executable, tokens in self._glob_and_match( | ||
template, self.COMPONENT_REGEX_LOOKUP | ||
): | ||
self.logger.debug("Processing %s with tokens %s", executable, tokens) | ||
for sw in self._extract_products_from_path(executable, tokens): | ||
yield sw | ||
match_templates = executable_templates | ||
match_templates.extend(self._scan_software_entities()) | ||
|
||
for template in match_templates: | ||
if template is not None: | ||
self.logger.debug("Processing template %s.", template) | ||
# Extract all products from that executable. | ||
for executable, tokens in self._glob_and_match(template, self.COMPONENT_REGEX_LOOKUP): | ||
self.logger.debug( | ||
"Processing %s with tokens %s", executable, tokens) | ||
for sw in self._extract_products_from_path(executable, tokens): | ||
yield sw | ||
|
||
def _extract_products_from_path(self, executable_path, match): | ||
""" | ||
|
@@ -268,7 +306,8 @@ def prepare_launch(self, exec_path, args, file_to_open=None): | |
required_env["TANK_CONTEXT"] = sgtk.Context.serialize(self.context) | ||
required_env["TANK_ENGINE"] = self.engine_name | ||
|
||
self.logger.debug("Launch environment: %s", pprint.pformat(required_env)) | ||
self.logger.debug("Launch environment: %s", | ||
pprint.pformat(required_env)) | ||
self.logger.debug("Launch arguments: %s", required_args) | ||
|
||
return LaunchInformation(exec_path, required_args, required_env) | ||
|
@@ -317,7 +356,8 @@ def _get_plugin_startup_env(self, plugin_names, app_path, app_args, file_to_open | |
plugin_path = os.path.join(self.disk_location, "plugins", plugin_name) | ||
|
||
if os.path.exists(plugin_path): | ||
self.logger.debug("Plugin '%s' found at '%s'", plugin_name, plugin_path) | ||
self.logger.debug("Plugin '%s' found at '%s'", | ||
plugin_name, plugin_path) | ||
startup_paths.append(plugin_path) | ||
else: | ||
self.logger.warning( | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Black would make changes.