Skip to content

Commit 55b7102

Browse files
authored
Merge pull request #8 from GPLgithub/master
Fix for Maya FBX publisher and github_release example
2 parents 0a86fc2 + 02055a9 commit 55b7102

File tree

4 files changed

+35
-19
lines changed

4 files changed

+35
-19
lines changed

README.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,24 @@ frameworks:
5959
- If you're using a local descriptor (dev or path) you need to build the PySide2 libraries
6060
yourself. See [building the PySide2 libraries locally](#building-the-pyside2-libraries-locally).
6161

62-
- If you're using a remote descriptor, just in time download must be added so these binaries are downloaded in SG TK bootstrap process. The provided [bootstrap.py](hooks/core/bootstrap.py) script implements just in time downloads from Github releases with a `git` descriptor:
62+
- If you're using a remote descriptor, just in time download must be added so these binaries are downloaded in SG TK bootstrap process. The provided [bootstrap.py](hooks/core/bootstrap.py) script implements just in time downloads from Github releases with a `git` or a `github_release` descriptor:
6363
- Copy the `hooks/core/bootstrap.py` file to your config `core/hooks/bootstrap.py`
6464
hook.
6565
- Use a `git` descriptor for the framework, e.g.:
6666
```
6767
tk-framework-unrealqt_v1.x.x:
6868
location:
69-
version: v1.2.5
69+
version: v1.3.0
7070
type: git
7171
path: [email protected]:ue4plugins/tk-framework-unrealqt.git
7272
```
73+
- Or use a `github_release` descriptor for the framework, e.g.:
74+
```
75+
tk-framework-unrealqt_v1.x.x:
76+
location:
77+
version: v1.3.0
78+
type: github_release
79+
organization: ue4plugins
80+
repository: tk-framework-unrealqt
81+
```
7382

hooks/core/bootstrap.py

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,7 @@ def can_cache_bundle(self, descriptor):
5454
:raises RuntimeError: If six.moves is not available.
5555
"""
5656
descd = descriptor.get_dict()
57-
# Some descriptors like shotgun descriptors don't have a path: ignore
58-
# them.
59-
if not descd.get("path"):
60-
return False
61-
return bool(self._should_download_release(descd["path"]))
57+
return bool(self._should_download_release(descd))
6258

6359
def populate_bundle_cache_entry(self, destination, descriptor, **kwargs):
6460
"""
@@ -92,7 +88,7 @@ def populate_bundle_cache_entry(self, destination, descriptor, **kwargs):
9288
descd = descriptor.get_dict()
9389
version = descriptor.version
9490
self.logger.info("Treating %s" % descd)
95-
specs = self._should_download_release(descd["path"])
91+
specs = self._should_download_release(descd)
9692
if not specs:
9793
raise RuntimeError("Don't know how to download %s" % descd)
9894
name = specs[0]
@@ -171,17 +167,28 @@ def populate_bundle_cache_entry(self, destination, descriptor, **kwargs):
171167
self.logger.exception(e)
172168
raise
173169

174-
def _should_download_release(self, desc_path):
170+
def _should_download_release(self, desc):
175171
"""
176-
Return a repo name and a token if the given descriptor path should be downloaded
172+
Return a repo name and a token if the given descriptor should be downloaded
177173
from a github release.
178174
179-
:param str desc_path: A Toolkit descriptor path.
175+
:param str desc: A Toolkit descriptor.
180176
:returns: A name, token tuple or ``None``.
181177
"""
182-
for name, token in self._download_release_from_github:
183-
if "[email protected]:%s.git" % name == desc_path:
184-
return name, token
178+
if desc["type"] == "github_release":
179+
# Let's be safe...
180+
if not desc.get("organization") or not desc.get("repository"):
181+
return None
182+
desc_path = "%s/%s" % (desc["organization"], desc["repository"])
183+
for name, token in self._download_release_from_github:
184+
if name == desc_path:
185+
return name, token
186+
elif desc.get("path"):
187+
# Check the path for a git descriptor
188+
desc_path = desc["path"]
189+
for name, token in self._download_release_from_github:
190+
if "[email protected]:%s.git" % name == desc_path:
191+
return name, token
185192
return None
186193

187194
def _download_zip_github_asset(self, asset, destination, token):

hooks/tk-multi-publish2/tk-maya/basic/publish_fbx.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ def accept(self, settings, item):
157157

158158
# We've validated the publish template. add it to the item properties
159159
# for use in subsequent methods
160-
item.properties["publish_template"] = publish_template
160+
item.local_properties["publish_template"] = publish_template
161161

162162
path = _session_path()
163163
if not path:
@@ -226,7 +226,7 @@ def validate(self, settings, item):
226226
# matches. if not, warn the user and provide a way to save the file to
227227
# a different path
228228
work_template = item.properties.get("work_template")
229-
publish_template = item.properties.get("publish_template")
229+
publish_template = item.local_properties.get("publish_template")
230230
if work_template and publish_template:
231231
# Ensure the fields work for the publish template
232232
# This raises an error if the path does not match the template.
@@ -235,7 +235,7 @@ def validate(self, settings, item):
235235
if missing_keys:
236236
error_msg = (
237237
"Work file '%s' missing keys required for the "
238-
"publish template: %s" % (path, missing_keys)
238+
"publish template %s: %s" % (path, publish_template, missing_keys)
239239
)
240240
self.logger.error(error_msg)
241241
return False

hooks/tk-multi-publish2/tk-maya/basic/publish_turntable.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ def accept(self, settings, item):
672672

673673
# We've validated the publish template. add it to the item properties
674674
# for use in subsequent methods
675-
item.properties["publish_template"] = publish_template
675+
item.local_properties["publish_template"] = publish_template
676676

677677
# Because a publish template is configured, disable context change. This
678678
# is a temporary measure until the publisher handles context switching
@@ -721,7 +721,7 @@ def validate(self, settings, item):
721721

722722
# get the configured work file template
723723
work_template = item.properties.get("work_template")
724-
publish_template = item.properties.get("publish_template")
724+
publish_template = item.local_properties.get("publish_template")
725725
if work_template and publish_template:
726726
# get the current scene path and extract fields from it using the work
727727
# template:

0 commit comments

Comments
 (0)