mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-02 00:44:52 +01:00
Force geometry update, otherwise manual update mode will fail to get the geometry correctly
This commit is contained in:
parent
bb24b82364
commit
9484bd4a51
1 changed files with 20 additions and 2 deletions
|
|
@ -1,4 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import contextlib
|
||||
|
||||
import pyblish.api
|
||||
import hou
|
||||
|
||||
|
|
@ -39,6 +41,23 @@ def group_consecutive_numbers(nums):
|
|||
yield _result(start, end)
|
||||
|
||||
|
||||
@contextlib.contextmanager
|
||||
def update_mode_context(mode):
|
||||
original = hou.updateModeSetting()
|
||||
try:
|
||||
hou.setUpdateMode(mode)
|
||||
yield
|
||||
finally:
|
||||
hou.setUpdateMode(original)
|
||||
|
||||
|
||||
def get_geometry_at_frame(sop_node, frame, force=True):
|
||||
"""Return geometry at frame but force a cooked value."""
|
||||
with update_mode_context(hou.updateMode.AutoUpdate):
|
||||
sop_node.cook(force=force, frame_range=(frame, frame))
|
||||
return sop_node.geometryAtFrame(frame)
|
||||
|
||||
|
||||
class ValidateVDBOutputNode(pyblish.api.InstancePlugin):
|
||||
"""Validate that the node connected to the output node is of type VDB.
|
||||
|
||||
|
|
@ -95,8 +114,7 @@ class ValidateVDBOutputNode(pyblish.api.InstancePlugin):
|
|||
return [instance_node, error]
|
||||
|
||||
frame = instance.data.get("frameStart", 0)
|
||||
node.cook(force=True, frame_range=(frame, frame))
|
||||
geometry = node.geometryAtFrame(frame)
|
||||
geometry = get_geometry_at_frame(node, frame)
|
||||
if geometry is None:
|
||||
# No geometry data on this node, maybe the node hasn't cooked?
|
||||
error = (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue