gpt4 book ai didi

python - 具有自定义属性的 Maya 到 fbx

转载 作者:太空宇宙 更新时间:2023-11-03 17:36:21 24 4
gpt4 key购买 nike

我有一个 Maya 场景,其中每个网格在形状节点上都有一个自定义属性列表,我使用 python 动态添加这些属性。

import maya.cmds as cmds
import maya.mel as mm

#get mesh objects.
meshes = maya.cmds.ls(type="mesh")
for mesh in meshes:
cmds.select(mesh)


#check if attribute exists, if not, create.
if not mm.eval( 'attributeExists "test" "%s"' % mesh):
cmds.addAttr( shortName='tst', longName='test', dataType="string")

当我导出到 .fbx 并重新导入时,这些属性及其值消失了。

如何在导出时保留所有这些值?

最佳答案

不幸的是,你不能。来自 maya docs :

You can export Maya transform node custom attributes to the user properties of FbxNode. However, you cannot export Maya shape node custom attributes, such as mesh node, to FbxGeometry. This is because FbxGeometry does not currently support user properties.

如果可能的话,您最好的选择可能是尝试将自定义属性放在非形状节点上,或者探索其他导出格式,例如 alembic或您自己的自定义格式。

关于python - 具有自定义属性的 Maya 到 fbx,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31161790/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com