bpy.ops.mesh.primitive_cube_add()创建box bpy.context.object.active_material返回当前选择物体的材质球 bpy.data.materials.get(材质球名称字符串)拿到当前场景的某个材质 bpy.context.view_layer.objects.active.material_slots.data.active_material= 材质 给当前激活的物体材质球插槽赋予某个材质 bpy.ops.wm....
自从Blender 2.8更新后,对python脚本调整了原有设置选择物体代码,根据 Blender 2.8 Python API 更改网格(对象)可以使用 getters 和设置器进行选择。尝试通过调用blender2.79代码“bpy.context.active_object.select”属性检查网格的选定状态时,Blender 会引发错误:AttributeError: 'Object' object has no attribute...
而作为脚本的基础规则之一,只有将物体指定为active_object之后才能对该物体进行操作,平常在GUI中所进行的点击也可以视作将物体设为active。 因此,大部分脚本的起手式都是“选择需要编辑的物体”——set object as active: 回到GUI,可以看到位于eyes名称左侧位置出现了小框: 虽然光标选在face上,但在脚本中依然会对ey...
pip install imagepip install imathsudo apt-get install libopenexr-dev zlib1g-dev # 安装依赖pip install openexr 编写脚本 脚本一:采集深度图 控制Blender采集深度图。 脚本执行命令: blender -b -P render_depth.py # 注意:终端执行即可,这个py文件不...
Python工具提示里本身就给出了命令,用到了上个专栏里没提到的“替代GUI操作”的bpy.ops句柄: 看一下文档: 加个report=True以显示结果: #需要先选中面部材质(M_Head)而非Armature(md_chr0262_3739_hq)bpy.ops.object.modifier_apply_as_shapekey(keep_modifier=True,modifier="md_chr0262_3739_hq",report=Tru...
API 本身,bpy(代表“Blender Python”),可以在 Blender 的特定文档中浏览;它被细分为几个子模块,其中 3 个最重要/最常用的是: bpy.context:它包含只读值的 getter 和 reader,这些值描述你当前的工作上下文,甚至是当前正在访问的区域(即窗口中的面板) ...
顶部菜单Window-> Toggle System console,调出python控制台。 点击Text Editor的运行按钮查看数据。 二.生成AN柱形图 创建一个Cylinder。 tab进入Edit mode。调整Median的z为1m。将原点设置为柱子的底部圆心。返回Object mode。 2.1 创建AN Object, Cylinders ...
Slider-Puzle-Text-Tutorial:Slider Puzzle for Blender 3D in Python Text-Editor-Bookmarks:Add line number bookmarks to text files in Blender 3D to easily jump between sections of code Object-Draw-Type-Pie:Adds a pie menu in blender for switching the selected objects from 'Solid' to 'Wire' dr...
# rename the object bpy.context.object.name = obj_name # return the object reference return bpy.context.object N_PLANETS = 6 for n in range(N_PLANETS): # get a random radius (a float in [1, 5]) r = 1 + random() * 4 # get a random distace to the origin point: # - an ...
(bpy.types.Panel): bl_label = "Point Control Panel" bl_idname = "OBJECT_PT_point_control" bl_space_type = 'VIEW_3D' bl_region_type = 'UI' bl_category = 'Tool' def draw(self, context): layout = self.layout scene = context.scene my_point_properties = scene.my_point_properties ...