mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 05:14:40 +01:00
move SelectRopAction to api.actions
This commit is contained in:
parent
379cf0f769
commit
612b85a703
2 changed files with 47 additions and 22 deletions
|
|
@ -44,3 +44,46 @@ class SelectInvalidAction(pyblish.api.Action):
|
|||
node.setCurrent(True)
|
||||
else:
|
||||
self.log.info("No invalid nodes found.")
|
||||
|
||||
|
||||
class SelectROPAction(pyblish.api.Action):
|
||||
"""Select ROP.
|
||||
|
||||
It's used to select the associated ROPs with all errored instances
|
||||
not necessarily the ones that errored on the plugin we're running the action on.
|
||||
"""
|
||||
|
||||
label = "Select ROP"
|
||||
on = "failed" # This action is only available on a failed plug-in
|
||||
icon = "mdi.cursor-default-click"
|
||||
|
||||
def process(self, context, plugin):
|
||||
errored_instances = get_errored_instances_from_context(context)
|
||||
|
||||
# Apply pyblish.logic to get the instances for the plug-in
|
||||
instances = pyblish.api.instances_by_plugin(errored_instances, plugin)
|
||||
|
||||
# Get the invalid nodes for the plug-ins
|
||||
self.log.info("Finding ROP nodes..")
|
||||
rop_nodes = list()
|
||||
for instance in instances:
|
||||
node_path = instance.data.get("instance_node")
|
||||
if not node_path:
|
||||
continue
|
||||
|
||||
node = hou.node(node_path)
|
||||
if not node:
|
||||
continue
|
||||
|
||||
rop_nodes.append(node)
|
||||
|
||||
hou.clearAllSelected()
|
||||
if rop_nodes:
|
||||
self.log.info("Selecting ROP nodes: {}".format(
|
||||
", ".join(node.path() for node in rop_nodes)
|
||||
))
|
||||
for node in rop_nodes:
|
||||
node.setSelected(True)
|
||||
node.setCurrent(True)
|
||||
else:
|
||||
self.log.info("No ROP nodes found.")
|
||||
|
|
|
|||
|
|
@ -1,16 +1,14 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import pyblish.api
|
||||
from openpype.pipeline import PublishValidationError
|
||||
from openpype.pipeline.publish import RepairAction
|
||||
from openpype.hosts.houdini.api.action import SelectInvalidAction
|
||||
from openpype.hosts.houdini.api.action import (
|
||||
SelectInvalidAction,
|
||||
SelectROPAction,
|
||||
)
|
||||
|
||||
import hou
|
||||
|
||||
|
||||
class SelectROPAction(RepairAction):
|
||||
label = "Select ROP"
|
||||
icon = "mdi.cursor-default-click"
|
||||
|
||||
class ValidateSopOutputNode(pyblish.api.InstancePlugin):
|
||||
"""Validate the instance SOP Output Node.
|
||||
|
||||
|
|
@ -87,19 +85,3 @@ class ValidateSopOutputNode(pyblish.api.InstancePlugin):
|
|||
"Output node `%s` has no geometry data." % output_node.path()
|
||||
)
|
||||
return [output_node]
|
||||
|
||||
@classmethod
|
||||
def repair(cls, instance):
|
||||
"""Select ROP.
|
||||
|
||||
It's used to select the associated ROP for the selected instance
|
||||
which tells the artist which ROP node need to be fixed!
|
||||
"""
|
||||
|
||||
rop_node = hou.node(instance.data["instance_node"])
|
||||
rop_node.setSelected(True, clear_all_selected=True)
|
||||
|
||||
cls.log.debug(
|
||||
'%s has been selected'
|
||||
% rop_node.path()
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue