如何在Blender API 2.79中从网格获取面列表

时间:2019-04-07 03:21:41

标签: python blender

我正在尝试在Blender中创建一些代码,在其中我可以让它为我选择的网格打印顶点和面的完整列表。然后,我计划使用此列表在要用作附件的另一个程序中绘制相同的网格。我能够使Blender返回控制台中的顶点列表,但是我的脸没有运气。我刚刚开始学习Blender API,因此将不胜感激。

我已经在一些较旧的论坛上找到了解决此问题的方法,但是它们都使用了mesh.faces函数,blender表示该函数不再存在。我感觉到,经过一些更新,blender已将其移至新的类函数中,但是我不知道它在哪里。

## This first part works like a charm, and it prints out the vertices perfectly.
obj = bpy.context.active_object
v = obj.data.vertices[0]
coords = [(obj.matrix_world * v.co) for v in obj.data.vertices]

plain_coords = [vert.to_tuple() for vert in coords]
print(plain_coords)

## This is the part I need help on. No matter what I try it keeps saying there is no attribute 
f = obj.faces
print(f)

在底部,我试图将f设置为obj中的面孔列表,但它一直在说obj没有属性faces。

0 个答案:

没有答案