Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support new flipbook node for reviews #167

Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 22 additions & 11 deletions client/ayon_houdini/api/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def get_output_parameter(node):
return node.parm("sopoutput")
elif node_type == "comp":
return node.parm("copoutput")
elif node_type in {"karma", "opengl"}:
elif node_type in {"karma", "opengl", "flipbook"}:
return node.parm("picture")
elif node_type == "ifd": # Mantra
if node.evalParm("soho_outputmode"):
Expand Down Expand Up @@ -896,40 +896,51 @@ def get_current_context_template_data_with_entity_attrs():
return template_data


def set_review_color_space(opengl_node, review_color_space="", log=None):
def set_review_color_space(node, review_color_space="", log=None):
"""Set ociocolorspace parameter for the given OpenGL node.

Set `ociocolorspace` parameter of the given OpenGl node
Set `ociocolorspace` parameter of the given node
to to the given review_color_space value.
If review_color_space is empty, a default colorspace corresponding to
the display & view of the current Houdini session will be used.

Note:
This function expects nodes of type `opengl` or `flipbook`.

Args:
opengl_node (hou.Node): ROP node to set its ociocolorspace parm.
node (hou.Node): ROP node to set its ociocolorspace parm.
review_color_space (str): Colorspace value for ociocolorspace parm.
log (logging.Logger): Logger to log to.
"""

if log is None:
log = self.log

if node.type().name() not in {"opengl", "flipbook"}:
log.warning(
"Type of given node {} not allowed."
" only types `opengl` and `flipbook` are allowed."
.format(node.type().name())
)

# Set Color Correction parameter to OpenColorIO
colorcorrect_parm = opengl_node.parm("colorcorrect")
if colorcorrect_parm.eval() != 2:
colorcorrect_parm.set(2)
colorcorrect_parm = node.parm("colorcorrect")
if colorcorrect_parm.evalAsString() != "ocio":
idx = colorcorrect_parm.menuItems().index("ocio")
colorcorrect_parm.set(idx)
log.debug(
"'Color Correction' parm on '{}' has been set to"
" 'OpenColorIO'".format(opengl_node.path())
"'Color Correction' parm on '{}' has been set to '{}'"
.format(node.path(), colorcorrect_parm.menuLabels()[idx])
)

opengl_node.setParms(
node.setParms(
{"ociocolorspace": review_color_space}
)

log.debug(
"'OCIO Colorspace' parm on '{}' has been set to "
"the view color space '{}'"
.format(opengl_node, review_color_space)
.format(node.path(), review_color_space)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just wondering why you don't use node (hou.Node) here as the previous code used opengl_node which happened to be hou.Node.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for consistency, I turned this one into node.path() instead of just node
other log messages are using node.path()

)


Expand Down
12 changes: 10 additions & 2 deletions client/ayon_houdini/plugins/create/create_review.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ class CreateReview(plugin.HoudiniCreator):
"""Review with OpenGL ROP"""

identifier = "io.openpype.creators.houdini.review"
label = "Review"
label = "Review (OpenGL)"
product_type = "review"
icon = "video-camera"
review_color_space = ""
node_type = "opengl"

def apply_settings(self, project_settings):
super(CreateReview, self).apply_settings(project_settings)
Expand All @@ -27,7 +28,7 @@ def apply_settings(self, project_settings):

def create(self, product_name, instance_data, pre_create_data):

instance_data.update({"node_type": "opengl"})
instance_data.update({"node_type": self.node_type})
instance_data["imageFormat"] = pre_create_data.get("imageFormat")
instance_data["keepImages"] = pre_create_data.get("keepImages")

Expand Down Expand Up @@ -150,3 +151,10 @@ def get_pre_create_attr_defs(self):
minimum=0.0001,
decimals=3)
]


class CreateFlipbookReview(CreateReview):

identifier = "io.ayon.creators.houdini.review.flipbook"
label = "Review (Flipbook)"
node_type = "flipbook"
MustafaJafar marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 1 addition & 1 deletion client/ayon_houdini/plugins/publish/collect_review_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def _get_camera_path(self, ropnode):
"""

if ropnode.type().name() in {
"opengl", "karma", "ifd", "arnold"
"opengl", "karma", "ifd", "arnold", "flipbook"
}:
return ropnode.parm("camera").eval()

Expand Down
10 changes: 5 additions & 5 deletions client/ayon_houdini/plugins/publish/extract_rop.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ def update_representation_data(self,
pass


class ExtractOpenGL(ExtractROP,
publish.ColormanagedPyblishPluginMixin):
class ExtractOpenGLAndFlipbook(ExtractROP,
publish.ColormanagedPyblishPluginMixin):

order = pyblish.api.ExtractorOrder - 0.01
label = "Extract OpenGL"
label = "Extract Review (OpenGL & Flipbook)"
families = ["review"]

def process(self, instance):
Expand All @@ -98,12 +98,12 @@ def process(self, instance):
return

rop_node = hou.node(instance_node)
if rop_node.type().name() != "opengl":
if rop_node.type().name() not in {"opengl", "flipbook"}:
self.log.debug("Skipping OpenGl extraction. Rop node {} "
"is not an OpenGl node.".format(rop_node.path()))
return

super(ExtractOpenGL, self).process(instance)
super(ExtractOpenGLAndFlipbook, self).process(instance)
MustafaJafar marked this conversation as resolved.
Show resolved Hide resolved

def update_representation_data(self,
instance: pyblish.api.Instance,
Expand Down
59 changes: 34 additions & 25 deletions client/ayon_houdini/plugins/publish/validate_review_colorspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ def process(self, instance):
# TODO: Don't run this plugin on wrong instances.
# This plugin should run only on review product type
# with instance node of opengl type.
if rop_node.type().name() != "opengl":
if rop_node.type().name() not in {"opengl", "flipbook"}:
self.log.debug("Skipping Validation. Rop node {} "
"is not an OpenGl node.".format(rop_node.path()))
"is not an `opengl` or `flipbook` node.".format(rop_node.path()))
return

if not self.is_active(instance.data):
Expand All @@ -79,35 +79,44 @@ def process(self, instance):
)
return

if rop_node.evalParm("colorcorrect") != 2:
colorcorrect = rop_node.parm("colorcorrect").evalAsString()
if not colorcorrect.startswith("ocio"):
# any colorspace settings other than default requires
# 'Color Correct' parm to be set to 'OpenColorIO'
raise PublishValidationError(
"'Color Correction' parm on '{}' ROP must be set to"
" 'OpenColorIO'".format(rop_node.path())
" use 'OpenColorIO'".format(rop_node.path())
)

current_color_space = rop_node.evalParm("ociocolorspace")
if current_color_space not in hou.Color.ocio_spaces():
raise PublishValidationError(
"Invalid value: Colorspace name doesn't exist.\n"
"Check 'OCIO Colorspace' parameter on '{}' ROP"
.format(rop_node.path())
)

# if houdini/imageio/workfile is enabled and
# Review colorspace setting is empty then this check should
# actually check if the current_color_space setting equals
# the default colorspace value.
# However, it will make the black cmd screen show up more often
# which is very annoying.
if self.review_color_space and \
self.review_color_space != current_color_space:

raise PublishValidationError(
"Invalid value: Colorspace name doesn't match"
"the Colorspace specified in settings."
)
if colorcorrect == "ocio":
# For both opengl and flipbook nodes.

current_color_space = rop_node.evalParm("ociocolorspace")
if current_color_space not in hou.Color.ocio_spaces():
raise PublishValidationError(
"Invalid value: Colorspace name doesn't exist.\n"
"Check 'OCIO Colorspace' parameter on '{}' ROP"
.format(rop_node.path())
)

# If `ayon+settings://houdini/imageio/workfile` is enabled
# and the Review colorspace setting is empty, then this check
# should verify if the `current_color_space` setting equals
# the default colorspace value.
if self.review_color_space and \
self.review_color_space != current_color_space:

raise PublishValidationError(
"Invalid value: Colorspace name doesn't match"
"the Colorspace specified in settings."
)

# TODO: Check if `ociodisplay` and `ocioview` are the same as the default display and view.
# Should be the default value specified in settings?
# OR Should be the current/default value specified in the hip file?
elif colorcorrect == "ocioview":
# For flipbook nodes only.
pass

@classmethod
def repair(cls, instance):
Expand Down