mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
🎨 change how the instances are deleted and instance look
This commit is contained in:
parent
44a7e844b2
commit
3325ee0330
2 changed files with 25 additions and 7 deletions
|
|
@ -43,7 +43,7 @@ class Creator(LegacyCreator):
|
|||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(Creator, self).__init__(*args, **kwargs)
|
||||
self.nodes = list()
|
||||
self.nodes = []
|
||||
|
||||
def process(self):
|
||||
"""This is the base functionality to create instances in Houdini
|
||||
|
|
@ -181,6 +181,8 @@ class HoudiniCreator(NewCreator, HoudiniCreatorBase):
|
|||
instance_node = self.create_instance_node(
|
||||
subset_name, "/out", node_type)
|
||||
|
||||
self.customize_node_look(instance_node)
|
||||
|
||||
instance_data["instance_node"] = instance_node.path()
|
||||
instance = CreatedInstance(
|
||||
self.family,
|
||||
|
|
@ -245,15 +247,30 @@ class HoudiniCreator(NewCreator, HoudiniCreatorBase):
|
|||
"""
|
||||
for instance in instances:
|
||||
instance_node = hou.node(instance.data.get("instance_node"))
|
||||
to_delete = None
|
||||
for parameter in instance_node.spareParms():
|
||||
if parameter.name() == "id" and \
|
||||
parameter.eval() == "pyblish.avalon.instance":
|
||||
to_delete = parameter
|
||||
instance_node.removeSpareParmTuple(to_delete)
|
||||
if instance_node:
|
||||
instance_node.destroy()
|
||||
|
||||
self._remove_instance_from_context(instance)
|
||||
|
||||
def get_pre_create_attr_defs(self):
|
||||
return [
|
||||
BoolDef("use_selection", label="Use selection")
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def customize_node_look(
|
||||
node, color=hou.Color((0.616, 0.871, 0.769)),
|
||||
shape="chevron_down"):
|
||||
"""Set custom look for instance nodes.
|
||||
|
||||
Args:
|
||||
node (hou.Node): Node to set look.
|
||||
color (hou.Color, Optional): Color of the node.
|
||||
shape (str, Optional): Shape name of the node.
|
||||
|
||||
Returns:
|
||||
None
|
||||
|
||||
"""
|
||||
node.setUserData('nodeshape', shape)
|
||||
node.setColor(color)
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ class CreateHDA(plugin.HoudiniCreator):
|
|||
hda_node = to_hda
|
||||
|
||||
hda_node.setName(node_name)
|
||||
self.customize_node_look(hda_node)
|
||||
return hda_node
|
||||
|
||||
def create(self, subset_name, instance_data, pre_create_data):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue