我试图使用Blender Python API设置一个属性,并将其添加到RotationSyncFinalValue列表。列表按需要的方式设置,但属性未更新,因此列表不显示值。在
下面是我定义属性的代码:
atr = bpy.types.Scene
RotationSyncFinalValue = []
atr.RotationSyncValuesList =EnumProperty(
items= RotationSyncFinalValue,
name = "List",
description = "Select The Action to Do with the Value")
下面是我在面板中设置属性的位置:
^{pr2}$这是我试图给数组添加一个值RotationSyncFinalValue
fvalue = ('{0:.4f}'.format(value),
'{0:.4f}'.format(value),
'{0:.4f}'.format(value))
RotationSyncFinalValue.extend([fvalue])
你在任务中使用了错误的类型。EnumProperty是必须存在于已定义的可接受值列表中的单个值,传递给构造函数的项列表是该属性可接受的值的列表,不在初始列表中的值不能分配给该属性。在
我希望您能看看给CollectionProperty提供的示例,以得到类似于-
那么在你的小组里你可以用-
^{pr2}$由于您似乎想要三个具有相同值的属性,您应该考虑使用custom get/set functions,这可以确保所有三个属性保持同步(或者只存储一个值),您可以将get/set添加到PropertyGroup类中的属性。在
如果您使用的是前面提到的数组,那么您可以查看文档并理解不能使用数组对象将列表传递给此函数。在
如果是打字错误,RotationSyncFinalValue是一个列表,请添加更多信息,以便我们可以帮助您。在
相关问题 更多 >
编程相关推荐