mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 08:24:53 +01:00
Implement Alembic Camera extraction in Houdini - the right way
This commit is contained in:
parent
c33e1274f3
commit
3e2b506cf3
5 changed files with 67 additions and 10 deletions
|
|
@ -21,11 +21,25 @@ class CreateAlembicCamera(houdini.Creator):
|
||||||
def process(self):
|
def process(self):
|
||||||
instance = super(CreateAlembicCamera, self).process()
|
instance = super(CreateAlembicCamera, self).process()
|
||||||
|
|
||||||
parms = {"use_sop_path": True,
|
parms = {
|
||||||
"filename": "$HIP/pyblish/%s.abc" % self.name}
|
"filename": "$HIP/pyblish/%s.abc" % self.name,
|
||||||
|
"use_sop_path": False
|
||||||
|
}
|
||||||
|
|
||||||
if self.nodes:
|
if self.nodes:
|
||||||
node = self.nodes[0]
|
node = self.nodes[0]
|
||||||
parms.update({"sop_path": node.path()})
|
path = node.path()
|
||||||
|
|
||||||
|
# Split the node path into the first root and the remainder
|
||||||
|
# So we can set the root and objects parameters correctly
|
||||||
|
_, root, remainder = path.split("/", 2)
|
||||||
|
parms.update({
|
||||||
|
"root": "/" + root,
|
||||||
|
"objects": remainder
|
||||||
|
})
|
||||||
|
|
||||||
instance.setParms(parms)
|
instance.setParms(parms)
|
||||||
|
|
||||||
|
# Lock the Use Sop Path setting so the
|
||||||
|
# user doesn't accidentally enable it.
|
||||||
|
instance.parm("use_sop_path").lock(True)
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,8 @@ class CollectOutputSOPPath(pyblish.api.InstancePlugin):
|
||||||
"""Collect the out node's SOP Path value."""
|
"""Collect the out node's SOP Path value."""
|
||||||
|
|
||||||
order = pyblish.api.CollectorOrder
|
order = pyblish.api.CollectorOrder
|
||||||
families = ["*"]
|
families = ["colorbleed.pointcache",
|
||||||
|
"colorbleed.vdbcache"]
|
||||||
hosts = ["houdini"]
|
hosts = ["houdini"]
|
||||||
label = "Collect Output SOP Path"
|
label = "Collect Output SOP Path"
|
||||||
|
|
||||||
|
|
|
||||||
41
colorbleed/plugins/houdini/publish/validate_camera_rop.py
Normal file
41
colorbleed/plugins/houdini/publish/validate_camera_rop.py
Normal file
|
|
@ -0,0 +1,41 @@
|
||||||
|
import pyblish.api
|
||||||
|
import colorbleed.api
|
||||||
|
|
||||||
|
|
||||||
|
class ValidateIntermediateDirectoriesChecked(pyblish.api.InstancePlugin):
|
||||||
|
"""Validate Camera ROP settings."""
|
||||||
|
|
||||||
|
order = colorbleed.api.ValidateContentsOrder
|
||||||
|
families = ['colorbleed.camera']
|
||||||
|
hosts = ['houdini']
|
||||||
|
label = 'Camera ROP'
|
||||||
|
|
||||||
|
def process(self, instance):
|
||||||
|
|
||||||
|
import hou
|
||||||
|
|
||||||
|
node = instance[0]
|
||||||
|
if node.parm("use_sop_path").eval():
|
||||||
|
raise RuntimeError("Alembic ROP for Camera export should not be "
|
||||||
|
"set to 'Use Sop Path'. Please disable.")
|
||||||
|
|
||||||
|
# Get the root and objects parameter of the Alembic ROP node
|
||||||
|
root = node.parm("root").eval()
|
||||||
|
objects = node.parm("objects").eval()
|
||||||
|
assert root, "Root parameter must be set on Alembic ROP"
|
||||||
|
assert root.startswith("/"), "Root parameter must start with slash /"
|
||||||
|
assert objects, "Objects parameter must be set on Alembic ROP"
|
||||||
|
assert len(objects.split(" ")) == 1, "Must have only a single object."
|
||||||
|
|
||||||
|
# Check if the object exists and is a camera
|
||||||
|
path = root + "/" + objects
|
||||||
|
camera = hou.node(path)
|
||||||
|
|
||||||
|
if not camera:
|
||||||
|
raise ValueError("Camera path does not exist: %s" % path)
|
||||||
|
|
||||||
|
if not camera.type().name() == "cam":
|
||||||
|
raise ValueError("Object set in Alembic ROP is not a camera: "
|
||||||
|
"%s (type: %s)" % (camera, camera.type().name()))
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -6,7 +6,8 @@ class ValidateIntermediateDirectoriesChecked(pyblish.api.InstancePlugin):
|
||||||
"""Validate Create Intermediate Directories is enabled on ROP node."""
|
"""Validate Create Intermediate Directories is enabled on ROP node."""
|
||||||
|
|
||||||
order = colorbleed.api.ValidateContentsOrder
|
order = colorbleed.api.ValidateContentsOrder
|
||||||
families = ['colorbleed.pointcache']
|
families = ['colorbleed.pointcache',
|
||||||
|
'colorbleed.camera']
|
||||||
hosts = ['houdini']
|
hosts = ['houdini']
|
||||||
label = 'Create Intermediate Directories Checked'
|
label = 'Create Intermediate Directories Checked'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,8 @@ class ValidateOutputNode(pyblish.api.InstancePlugin):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
order = pyblish.api.ValidatorOrder
|
order = pyblish.api.ValidatorOrder
|
||||||
families = ["*"]
|
families = ["colorbleed.pointcache",
|
||||||
|
"colorbleed.vdbcache"]
|
||||||
hosts = ["houdini"]
|
hosts = ["houdini"]
|
||||||
label = "Validate Output Node"
|
label = "Validate Output Node"
|
||||||
|
|
||||||
|
|
@ -39,10 +40,9 @@ class ValidateOutputNode(pyblish.api.InstancePlugin):
|
||||||
|
|
||||||
# Check if type is correct
|
# Check if type is correct
|
||||||
type_name = output_node.type().name()
|
type_name = output_node.type().name()
|
||||||
if type_name not in ["output", "cam"]:
|
if type_name != "output":
|
||||||
cls.log.error("Output node `%s` is not an accepted type."
|
cls.log.error("Output node `%s` is not an `output` type node."
|
||||||
"Expected types: `output` or `camera`" %
|
% output_node.path())
|
||||||
output_node.path())
|
|
||||||
return [output_node.path()]
|
return [output_node.path()]
|
||||||
|
|
||||||
# Check if output node has incoming connections
|
# Check if output node has incoming connections
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue