Merge pull request #2747 from BigRoy/hou_move_save_current_file_to_extractororder

Houdini: Move Houdini Save Current File to beginning of ExtractorOrder
This commit is contained in:
Ondřej Samohel 2022-02-22 09:34:29 +01:00 committed by GitHub
commit ebd2795ff5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 38 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.IntegratorOrder - 0.49
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.IntegratorOrder - 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..")