Skip to content

Commit 04fbec2

Browse files
authored
14333 secondary publishes fixes (#3)
* For #14333, secondary publishes fixes Fixed secondary publishes being overwritten with the primary publish by overriding some new "copy" methods. Fixed a problem with temporary paths on Windows which would cause UE crashes. Fixed wrongly indented block
1 parent c97a735 commit 04fbec2

File tree

2 files changed

+49
-5
lines changed

2 files changed

+49
-5
lines changed

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

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,9 +293,27 @@ def validate(self, settings, item):
293293

294294
return True
295295

296+
def _copy_to_publish(self, settings, item):
297+
"""
298+
Override base implementation to do nothing
299+
since we're not copying a file but exporting
300+
directly to the publish location.
301+
"""
302+
pass
303+
304+
def _copy_local_to_publish(self, settings, item):
305+
"""
306+
Override base implementation to do nothing
307+
since we're not copying a file but exporting
308+
directly to the publish location.
309+
"""
310+
pass
311+
296312
def _copy_work_to_publish(self, settings, item):
297313
"""
298-
Override base implementation to do nothing.
314+
Override base implementation to do nothing
315+
since we're not copying a file but exporting
316+
directly to the publish location.
299317
"""
300318
pass
301319

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

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -988,7 +988,14 @@ def publish(self, settings, item):
988988
# The FBX will be exported to a temp folder
989989
# Another folder can be specified as long as the name has no spaces
990990
# Spaces are not allowed in command line Unreal Python args
991-
temp_folder = tempfile.mkdtemp(suffix="temp_unreal_shotgun")
991+
992+
# Set a base temp dir on Windows to avoid having
993+
# the user name in the temp path which can include
994+
# "." e.g. firstname.name and makes UE crashes
995+
base_temp_dir = None
996+
if sys.platform == "win32":
997+
base_temp_dir = r"C:\Temp"
998+
temp_folder = tempfile.mkdtemp(suffix="temp_unreal_shotgun", dir=base_temp_dir)
992999
# Store the temp folder path on the item for cleanup in finalize
9931000
item.local_properties["temp_folder"] = temp_folder
9941001
fbx_folder = temp_folder
@@ -1043,7 +1050,7 @@ def publish(self, settings, item):
10431050
# Use the unreal_setup_turntable to do this in Unreal
10441051
self.logger.info("Setting up Unreal turntable project...")
10451052
# Copy the Unreal project in a temp location so we can modify it
1046-
temp_dir = tempfile.mkdtemp()
1053+
temp_dir = tempfile.mkdtemp(dir=base_temp_dir)
10471054
project_path, project_file = os.path.split(unreal_project_path)
10481055
project_folder = os.path.basename(project_path)
10491056
temp_project_dir = os.path.join(temp_dir, project_folder)
@@ -1591,12 +1598,31 @@ def evaluate_unreal_project_path(self, unreal_project_path_template, unreal_engi
15911598
)
15921599
)
15931600

1601+
def _copy_to_publish(self, settings, item):
1602+
"""
1603+
Override base implementation to do nothing
1604+
since we're not copying a file but rendering
1605+
directly to the publish location.
1606+
"""
1607+
pass
1608+
1609+
def _copy_local_to_publish(self, settings, item):
1610+
"""
1611+
Override base implementation to do nothing
1612+
since we're not copying a file but rendering
1613+
directly to the publish location.
1614+
"""
1615+
pass
1616+
15941617
def _copy_work_to_publish(self, settings, item):
15951618
"""
1596-
Override base implementation to do nothing.
1619+
Override base implementation to do nothing
1620+
since we're not copying a file but rendering
1621+
directly to the publish location.
15971622
"""
15981623
pass
15991624

1625+
16001626
def _short_version(version):
16011627
"""
16021628
Return a short major.minor version for the given version.
@@ -1608,7 +1634,7 @@ def _short_version(version):
16081634
"""
16091635
parts = version.split(".", 2)
16101636
if len(parts) > 2:
1611-
return ".".join(parts[:2])
1637+
return ".".join(parts[:2])
16121638
return version
16131639

16141640

0 commit comments

Comments
 (0)