Kayla's and BigRoy's comments

This commit is contained in:
Mustafa-Zarkash 2023-09-01 01:02:32 +03:00
parent 1c7c12cdf9
commit e4819fc952
4 changed files with 34 additions and 67 deletions

View file

@ -26,8 +26,8 @@ class CreateUnrealStaticMesh(plugin.HoudiniCreator):
"""Unreal Static Meshes with collisions. """
# you should set
identifier = "io.openpype.creators.houdini.unrealstaticmesh"
label = "Unreal - Static Mesh"
identifier = "io.openpype.creators.houdini.unrealstaticmesh.fbx"
label = "Unreal - Static Mesh (FBX)"
family = "staticMesh"
icon = "fa5s.cubes"

View file

@ -31,7 +31,7 @@ class FbxLoader(load.LoaderPlugin):
def load(self, context, name=None, namespace=None, data=None):
# get file path
file_path = self.get_file_path(context)
file_path = self.get_file_path(context=context)
# get necessary data
namespace, node_name = self.get_node_name(context, name, namespace)
@ -41,10 +41,15 @@ class FbxLoader(load.LoaderPlugin):
self[:] = nodes
# Call containerise function which does some
# automations for you
containerised_nodes = self.get_containerised_nodes(
nodes, context, node_name, namespace
# Call containerise function which does some automations for you
# like moving created nodes to the AVALON_CONTAINERS subnetwork
containerised_nodes = pipeline.containerise(
node_name,
namespace,
nodes,
context,
self.__class__.__name__,
suffix="",
)
return containerised_nodes
@ -61,8 +66,7 @@ class FbxLoader(load.LoaderPlugin):
return
# Update the file path
file_path = get_representation_path(representation)
file_path = self.format_path(file_path, representation)
file_path = self.get_file_path(representation=representation)
file_node.setParms({"file": file_path})
@ -77,15 +81,18 @@ class FbxLoader(load.LoaderPlugin):
def switch(self, container, representation):
self.update(container, representation)
def get_file_path(self, context):
def get_file_path(self, context=None, representation=None):
"""Return formatted file path."""
# Format file name, Houdini only wants forward slashes
file_path = self.filepath_from_context(context)
file_path = os.path.normpath(file_path)
file_path = file_path.replace("\\", "/")
if context:
file_path = self.filepath_from_context(context)
elif representation:
file_path = get_representation_path(representation)
else:
return ""
return file_path
return file_path.replace("\\", "/")
def get_node_name(self, context, name=None, namespace=None):
"""Define node name."""
@ -145,27 +152,8 @@ class FbxLoader(load.LoaderPlugin):
# node to optimize "debug" displaying in the viewport.
file_node.setDisplayFlag(True)
# Set new position for unpack node else it gets cluttered
nodes = [parent_node, file_node, attribdelete, null]
for nr, node in enumerate(nodes):
node.setPosition([0, (0 - nr)])
# Set new position for children nodes
parent_node.layoutChildren()
return nodes
def get_containerised_nodes(self, nodes, context, node_name, namespace):
"""Call containerise function.
It does some automations that you don't have to worry about, e.g.
1. It moves created nodes to the AVALON_CONTAINERS subnetwork
2. Add extra parameters
"""
containerised_nodes = pipeline.containerise(
node_name,
namespace,
nodes,
context,
self.__class__.__name__,
suffix="",
)
return containerised_nodes
# Retrun all the nodes
return [parent_node, file_node, attribdelete, null]

View file

@ -16,7 +16,7 @@ class CollectFilmboxfbxType(pyblish.api.InstancePlugin):
"""Collect data type for fbx instance."""
hosts = ["houdini"]
families = ["fbx", "staticMesh"]
families = ["staticMesh"]
label = "Collect type of fbx"
# Usually you will use this value as default
@ -25,35 +25,9 @@ class CollectFilmboxfbxType(pyblish.api.InstancePlugin):
# overrides InstancePlugin.process()
def process(self, instance):
if instance.data["creator_identifier"] == "io.openpype.creators.houdini.unrealstaticmesh": # noqa: E501
if instance.data["creator_identifier"] == "io.openpype.creators.houdini.unrealstaticmesh.fbx": # noqa: E501
# such a condition can be used to differentiate between
# instances by identifier becuase sometimes instances
# instances by identifier because sometimes instances
# may have the same family but different identifier
# e.g. bgeo and alembic
instance.data["families"] += ["fbx"]
# Update instance.data with ouptut_node
out_node = self.get_output_node(instance)
if out_node:
instance.data["output_node"] = out_node
# Disclaimer : As a convntin we use collect_output_node.py
# to Update instance.data with ouptut_node of different types
# however, this collector is used for demonstration
def get_output_node(self, instance):
"""Getting output_node Logic."""
import hou
# get output node
node = hou.node(instance.data["instance_node"])
out_node = node.parm("startnode").evalAsNode()
if not out_node:
self.log.warning("No output node collected.")
return
self.log.debug("Output node: %s" % out_node.path())
return out_node

View file

@ -12,7 +12,8 @@ class CollectOutputSOPPath(pyblish.api.InstancePlugin):
"imagesequence",
"usd",
"usdrender",
"redshiftproxy"
"redshiftproxy",
"staticMesh"
]
hosts = ["houdini"]
@ -57,6 +58,10 @@ class CollectOutputSOPPath(pyblish.api.InstancePlugin):
elif node_type == "Redshift_Proxy_Output":
out_node = node.parm("RS_archive_sopPath").evalAsNode()
elif node_type == "filmboxfbx":
out_node = node.parm("startnode").evalAsNode()
else:
raise ValueError(
"ROP node type '%s' is" " not supported." % node_type