【发布时间】:2014-01-17 18:06:42
【问题描述】:
在搅拌机中,我可以从这样的顶点列表中创建一个网格“我”:
me = bpy.data.meshes.new("name")
me.from_pydata(vertices,[],[])
但是对于 bmesh,这个功能不存在。我想做的是
bme=bmesh.new()
bme.from_pydata(vertices,[],[])
我怎样才能做到这一点?
【问题讨论】:
在搅拌机中,我可以从这样的顶点列表中创建一个网格“我”:
me = bpy.data.meshes.new("name")
me.from_pydata(vertices,[],[])
但是对于 bmesh,这个功能不存在。我想做的是
bme=bmesh.new()
bme.from_pydata(vertices,[],[])
我怎样才能做到这一点?
【问题讨论】:
bmesh 模板的略微修改版本将为您提供
import bpy
import bmesh
myvertexlist = [[2,2,2],[4,4,4],[6,6,6],[8,8,8]]
# Get the active mesh
me = bpy.context.object.data
# Get a BMesh representation
bm = bmesh.new() # create an empty BMesh
bm.from_mesh(me) # fill it in from a Mesh
# Modify the BMesh, can do anything here...
for newvert in myvertexlist:
bm.verts.new(newvert)
# also add bm.edges and bm.faces
# Finish up, write the bmesh back to the mesh
bm.to_mesh(me)
bm.free() # free and prevent further access