python - blender 2.6 : Select object by name through Python

标签 python blender bpy

如何在 Blender 2.6 中通过 Python 按名称选择对象?

2.4-2.5 中,可以简单地使用:

bpy.ops.object.select_name("OBJECT")

...但是在 2.6 中已停止使用,要替换为什么?


2.6中,可以像这样获取当前选中的对象...

bpy.context.selected_objects

还有一种方法可以设置场景的事件对象...

bpy.context.scene.objects.active = bpy.data.objects["OBJECT"]

也可以通过操作进行选择,例如select_all()select_by_type()...

bpy.ops.object.select_all(action="TOGGLE")

但我找不到简单地通过名称进行选择的方法。

非常感谢。

最佳答案

bpy.data.objects['OBJECT'].select = True

选择数据包含在各个对象中。您可以阅读,如图所示。以更易读的形式:

object = bpy.data.objects['OBJECT']
object.select = True

关于python - blender 2.6 : Select object by name through Python,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19472499/

相关文章:

python - Django 'resolve' : get the url name instead of the view_function

Python 2.5 至 2.7

python - 使用 blender 和 twisted (python) 的服务器端渲染

python-3.x - 使用 bpy 渲染具有顶点颜色的对象或将顶点颜色转换为纹理

python - python 中 BPY 模块的导入错误

python - 有没有办法将谷歌云存储中的 csv 文件中的数据加载到 datalab 中的单独变量中?

python - 最小垂直切片和

python - 用于原始 blender 导出器的 blender python 脚本

python - blender 脚本 : how to write to text object

python - 将按键修饰符与搅拌器模式一起使用