【问题标题】:Blender Python API add property to objectBlender Python API 向对象添加属性
【发布时间】:2013-06-29 01:32:56
【问题描述】:

这是我想要做的:

reference_object= bpy.context.active_object
reference_object.add_variable(name='some_property',value=5)
reference_object.some_property

它会打印回 5

我基本上是在尝试将属性添加到已经创建的对象中,并且没有我要在其类中添加的特定变量。我尝试查找如何执行此操作,但我似乎无法理解其他一些帖子。任何建议都会很棒。

【问题讨论】:

    标签: python class object blender


    【解决方案1】:

    你可以这样做:

    reference_object['some_property'] = 5
    

    然后访问它:

    reference_object['some_property']
    # Prints back 5
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-10-23
      • 1970-01-01
      • 1970-01-01
      • 2021-07-14
      相关资源
      最近更新 更多