如何从顶点列表创建bmesh

2024-04-26 11:12:18 发布

您现在位置:Python中文网/ 问答频道 /正文

在blender中,我可以从一个顶点列表中创建一个网格“我”:

me = bpy.data.meshes.new("name") 
me.from_pydata(vertices,[],[])

但是对于bmesh不存在此函数。我想做的是

^{pr2}$

我怎样才能做到这一点?在


Tags: 函数namefrom网格列表newdatapydata
1条回答
网友
1楼 · 发布于 2024-04-26 11:12:18

稍微修改一下的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

相关问题 更多 >