mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-27 14:22:37 +01:00
Merge pull request #204 from aardschok/PLN-156b
Add FPS check to Houdini pipeline
This commit is contained in:
commit
e3ce009c60
5 changed files with 83 additions and 6 deletions
|
|
@ -35,11 +35,10 @@ def install():
|
|||
|
||||
log.info("Installing callbacks ... ")
|
||||
avalon.on("init", on_init)
|
||||
avalon.before("save", before_save)
|
||||
avalon.on("save", on_save)
|
||||
avalon.on("open", on_open)
|
||||
|
||||
log.info("Overriding existing event 'taskChanged'")
|
||||
|
||||
log.info("Setting default family states for loader..")
|
||||
avalon.data["familiesStateToggled"] = ["colorbleed.imagesequence"]
|
||||
|
||||
|
|
@ -48,6 +47,10 @@ def on_init(*args):
|
|||
houdini.on_houdini_initialize()
|
||||
|
||||
|
||||
def before_save(*args):
|
||||
return lib.validate_fps()
|
||||
|
||||
|
||||
def on_save(*args):
|
||||
|
||||
avalon.logger.info("Running callback on save..")
|
||||
|
|
@ -72,7 +75,6 @@ def on_open(*args):
|
|||
|
||||
# Get main window
|
||||
parent = hou.ui.mainQtWindow()
|
||||
|
||||
if parent is None:
|
||||
log.info("Skipping outdated content pop-up "
|
||||
"because Maya window can't be found.")
|
||||
|
|
|
|||
|
|
@ -4,15 +4,17 @@ from contextlib import contextmanager
|
|||
|
||||
import hou
|
||||
|
||||
from colorbleed import lib
|
||||
|
||||
from avalon import api, io
|
||||
from avalon.houdini import lib
|
||||
from avalon.houdini import lib as houdini
|
||||
|
||||
|
||||
def set_id(node, unique_id, overwrite=False):
|
||||
|
||||
exists = node.parm("id")
|
||||
if not exists:
|
||||
lib.imprint(node, {"id": unique_id})
|
||||
houdini.imprint(node, {"id": unique_id})
|
||||
|
||||
if not exists and overwrite:
|
||||
node.setParm("id", unique_id)
|
||||
|
|
@ -188,3 +190,45 @@ def attribute_values(node, data):
|
|||
pass
|
||||
finally:
|
||||
node.setParms(previous_attrs)
|
||||
|
||||
|
||||
def set_scene_fps(fps):
|
||||
hou.setFps(fps)
|
||||
|
||||
|
||||
# Valid FPS
|
||||
def validate_fps():
|
||||
"""Validate current scene FPS and show pop-up when it is incorrect
|
||||
|
||||
Returns:
|
||||
bool
|
||||
|
||||
"""
|
||||
|
||||
fps = lib.get_asset_fps()
|
||||
current_fps = hou.fps() # returns float
|
||||
|
||||
if current_fps != fps:
|
||||
|
||||
from ..widgets import popup
|
||||
|
||||
# Find main window
|
||||
parent = hou.ui.mainQtWindow()
|
||||
if parent is None:
|
||||
pass
|
||||
else:
|
||||
dialog = popup.Popup2(parent=parent)
|
||||
dialog.setModal(True)
|
||||
dialog.setWindowTitle("Maya scene not in line with project")
|
||||
dialog.setMessage("The FPS is out of sync, please fix")
|
||||
|
||||
# Set new text for button (add optional argument for the popup?)
|
||||
toggle = dialog.widgets["toggle"]
|
||||
toggle.setEnabled(False)
|
||||
dialog.on_show.connect(lambda: set_scene_fps(fps))
|
||||
|
||||
dialog.show()
|
||||
|
||||
return False
|
||||
|
||||
return True
|
||||
|
|
|
|||
|
|
@ -341,7 +341,8 @@ class IntegrateAsset(pyblish.api.InstancePlugin):
|
|||
"author": context.data["user"],
|
||||
"source": source,
|
||||
"comment": context.data.get("comment"),
|
||||
"machine": context.data.get("machine")}
|
||||
"machine": context.data.get("machine"),
|
||||
"fps": context.data.get("fps")}
|
||||
|
||||
# Include optional data if present in
|
||||
optionals = ["startFrame", "endFrame", "step", "handles"]
|
||||
|
|
|
|||
15
colorbleed/plugins/houdini/publish/collect_workscene_fps.py
Normal file
15
colorbleed/plugins/houdini/publish/collect_workscene_fps.py
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
import pyblish.api
|
||||
import hou
|
||||
|
||||
|
||||
class CollectWorksceneFPS(pyblish.api.ContextPlugin):
|
||||
"""Get the FPS of the work scene"""
|
||||
|
||||
label = "Workscene FPS"
|
||||
order = pyblish.api.CollectorOrder
|
||||
hosts = ["houdini"]
|
||||
|
||||
def process(self, context):
|
||||
fps = hou.fps()
|
||||
self.log.info("Workscene FPS: %s" % fps)
|
||||
context.data.update({"fps": fps})
|
||||
15
colorbleed/plugins/maya/publish/collect_workscene_fps.py
Normal file
15
colorbleed/plugins/maya/publish/collect_workscene_fps.py
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
import pyblish.api
|
||||
from maya import mel
|
||||
|
||||
|
||||
class CollectWorksceneFPS(pyblish.api.ContextPlugin):
|
||||
"""Get the FPS of the work scene"""
|
||||
|
||||
label = "Workscene FPS"
|
||||
order = pyblish.api.CollectorOrder
|
||||
hosts = ["maya"]
|
||||
|
||||
def process(self, context):
|
||||
fps = mel.eval('currentTimeUnitToFPS()')
|
||||
self.log.info("Workscene FPS: %s" % fps)
|
||||
context.data.update({"fps": fps})
|
||||
Loading…
Add table
Add a link
Reference in a new issue