Skip to content

Commit

Permalink
Merge pull request #81 from BigRoy/enhancement/houdini_detect_unsaved…
Browse files Browse the repository at this point in the history
…_file

Collect current file ignore the default untitled scene when no save or load has happened yet
  • Loading branch information
BigRoy authored Sep 5, 2024
2 parents dc72143 + ca59121 commit 79ecd4a
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions client/ayon_houdini/plugins/publish/collect_current_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,15 @@ def process(self, context):
"""Inject the current working file"""

current_file = hou.hipFile.path()
if not os.path.exists(current_file):
if (
hou.hipFile.isNewFile()
or not os.path.exists(current_file)
):
# By default, Houdini will even point a new scene to a path.
# However if the file is not saved at all and does not exist,
# we assume the user never set it.
self.log.warning("Houdini workfile is unsaved.")
current_file = ""

elif os.path.basename(current_file) == "untitled.hip":
# Due to even a new file being called 'untitled.hip' we are unable
# to confirm the current scene was ever saved because the file
# could have existed already. We will allow it if the file exists,
# but show a warning for this edge case to clarify the potential
# false positive.
self.log.warning(
"Current file is 'untitled.hip' and we are "
"unable to detect whether the current scene is "
"saved correctly."
)

context.data["currentFile"] = current_file
self.log.info('Current workfile path: {}'.format(current_file))

0 comments on commit 79ecd4a

Please sign in to comment.