improve collector variable - big roy's comment

This commit is contained in:
Kayla Man 2024-06-20 15:59:27 +08:00
parent faca062036
commit f66fe753b6
4 changed files with 14 additions and 20 deletions

View file

@ -19,13 +19,9 @@ class CollectOxCache(plugin.MayaInstancePlugin):
# Get transform data
parent = cmds.listRelatives(ox_shape, parent=True)[0]
mesh_shape_data = {"name": parent, "cbId": lib.get_id(parent)}
ox_cache_nodes = [
ox_node for ox_node in cmds.listConnections(ox_shape, destination=True)
if cmds.nodeType(ox_node) == "HairFromGuidesNode"
]
ox_cache_nodes = cmds.listConnections(
ox_shape, destination=True, type="HairFromGuidesNode") or []
# transfer cache file
if not lib.get_id(ox_shape):
return
shape_data = {
"shape": mesh_shape_data,
"name": ox_shapes,
@ -34,5 +30,7 @@ class CollectOxCache(plugin.MayaInstancePlugin):
"cache_file_attribute": ["{}.cacheFilePath".format(ox_node)
for ox_node in ox_cache_nodes]
}
settings["nodes"].append(shape_data)
if shape_data["cbId"]:
settings["nodes"].append(shape_data)
self.log.debug(settings)
instance.data["cachesettings"] = settings

View file

@ -53,17 +53,13 @@ class CollectOxRig(plugin.MayaInstancePlugin):
ox_nodes = [
ox_node for ox_node in cmds.listConnections(node_shape, destination=True)
if cmds.nodeType(ox_node) in ORNATRIX_NODES
]
ox_image_file = [
ox_img for ox_img in cmds.listConnections(ox_nodes, destination=False)
if cmds.nodeType(ox_img) == "file"
]
if not ox_image_file:
] or []
ox_file_nodes = cmds.listConnections(ox_nodes, destination=False, type="file") or []
if not ox_file_nodes:
return []
for img in ox_image_file:
texture_attr = "{}.fileTextureName".format(img)
texture = cmds.getAttr("{}.fileTextureName".format(img))
for file_node in ox_file_nodes:
texture_attr = "{}.fileTextureName".format(file_node)
texture = cmds.getAttr("{}.fileTextureName".format(file_node))
files = []
if os.path.isabs(texture):
self.log.debug("Texture is absolute path, ignoring "

View file

@ -1,3 +1,3 @@
# -*- coding: utf-8 -*-
"""Package declaring AYON addon 'maya' version."""
__version__ = "0.2.3"
__version__ = "0.2.4"

View file

@ -382,13 +382,13 @@ DEFAULT_CREATORS_SETTINGS = {
]
},
"CreateOxRig": {
"enabled": False,
"enabled": True,
"default_variants": [
"Main"
]
},
"CreateOxCache": {
"enabled": False,
"enabled": True,
"default_variants": [
"Main"
]