Always perform scene save in Houdini on publish

This commit is contained in:
Roy Nieterau 2022-02-21 22:07:10 +01:00
parent b7d2ea23b2
commit 7de42ee923
2 changed files with 2 additions and 37 deletions

View file

@ -2,26 +2,14 @@ import pyblish.api
import avalon.api
class SaveCurrentScene(pyblish.api.InstancePlugin):
class SaveCurrentScene(pyblish.api.ContextPlugin):
"""Save current scene"""
label = "Save current file"
order = pyblish.api.ExtractorOrder - 0.49
hosts = ["houdini"]
families = ["usdrender",
"redshift_rop"]
targets = ["local"]
def process(self, instance):
# This should be a ContextPlugin, but this is a workaround
# for a bug in pyblish to run once for a family: issue #250
context = instance.context
key = "__hasRun{}".format(self.__class__.__name__)
if context.data.get(key, False):
return
else:
context.data[key] = True
def process(self, context):
# Filename must not have changed since collecting
host = avalon.api.registered_host()

View file

@ -1,23 +0,0 @@
import pyblish.api
class SaveCurrentSceneDeadline(pyblish.api.ContextPlugin):
"""Save current scene"""
label = "Save current file"
order = pyblish.api.ExtractorOrder - 0.49
hosts = ["houdini"]
targets = ["deadline"]
def process(self, context):
import hou
assert (
context.data["currentFile"] == hou.hipFile.path()
), "Collected filename from current scene name."
if hou.hipFile.hasUnsavedChanges():
self.log.info("Saving current file..")
hou.hipFile.save(save_to_recent_files=True)
else:
self.log.debug("No unsaved changes, skipping file save..")