python - 如何从搅拌机 API 2.79 中的网格中获取面列表
问题描述
我正在尝试在搅拌机中创建一些代码,我可以让它打印我选择的网格的顶点和面的完整列表。然后,我计划使用此列表在我想用作附加组件的另一个程序中绘制相同的网格。我可以让搅拌机返回控制台中的顶点列表,但我对这些面孔没有运气。我刚刚开始学习搅拌机 API,因此将不胜感激。
我已经看过一些较早的论坛来解决这个问题,但它们都使用了一个 mesh.faces 函数,搅拌机说它不再存在。我有一种感觉,经过一些更新,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。
解决方案
推荐阅读
- azure - 在应用程序洞察中捕获 APIM 请求和响应有效负载的正确方法是什么?
- amazon-web-services - EKS pod 中的多个卷挂载
- c++ - 等待 MyService 服务连接时达到超时(45000 毫秒)
- javascript - 有没有一种巧妙的方法来分隔 JS/jquery 中的选中复选框标签?
- r - 根据列值删除分组后的行
- javascript - 如何在输入时连续加粗div中的文本
- mysql - 未找到兼容的服务器 - MySQL
- css - 如何在 MD Bootstrap 中更改输入组件的下划线颜色
- python-3.x - 如何在 Google Colab 中使用 OpenPose Python API?
- flutter - 如何获取存储在我的数据库中的坐标的纬度和经度以等待 Geolocator().distanceBetween 颤动