博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Blender Python UV 学习
阅读量:5094 次
发布时间:2019-06-13

本文共 1449 字,大约阅读时间需要 4 分钟。

Blender Python UV 学习

1. bmesh面转换

bm = bmesh.from_edit_mesh(bpy.context.edit_object.data)bm.faces.ensure_lookup_table()

2. 面选择

# Index of face to textureface_ind = 0bpy.ops.mesh.select_all(action='DESELECT')bm.faces[face_ind].select = True

3. uv展开

# Unwrap to instantiate uv layer (对选择表面, 展开uv层)bpy.ops.uv.unwrap()

4. 得到uv BMLayerItem

# Grab uv layeruv_layer = bm.loops.layers.uv.active

bm.loops <bmesh.types.BMLoopSeq>

This meshes loops (read-only).    Note: Loops must be accessed via faces, this is only exposed for layer access.

bm.loops.layers <bmesh.types.BMLayerAccessLoop>

custom-data layers (read-only).

bm.loops.layers.uv <bmesh.types.BMLayerCollection>

Accessor for BMLoopUV UV (as a 2D Vector).

bm.loops.layers.uv.active <bmesh.types.BMLayerItem>

The active layer of this type (read-only).

bmesh.types.BMLayerItem

Exposes a single custom data layer, their main purpose is for use as item accessors to custom-data when used with vert/edge/face/loop data.

5. 开始uv映射

# Begin mapping...loop_data = bm.faces[face_ind].loops

bm.faces <bmesh.types.BMFaceSeq>

This meshes face sequence (read-only).

bm.faces[face_ind] <bmesh.types.BMFace>

bm.faces[face_ind].loops <bmesh.types.BMElemSeq of BMLoop>

bmesh.types.BMLoop

This is normally accessed from BMFace.loops where each face loop represents a corner of the face.
# bottom rightuv_data = loop_data[0][uv_layer].uvuv_data.x = 1.0uv_data.y = 0.0

转载于:https://www.cnblogs.com/yaoyu126/p/8625914.html

你可能感兴趣的文章
python3 生成器与迭代器
查看>>
CPU,寄存器,一缓二缓.... RAM ROM 外部存储器等简介
查看>>
git .gitignore 文件不起作用
查看>>
digitalocean --- How To Install Apache Tomcat 8 on Ubuntu 16.04
查看>>
【题解】[P4178 Tree]
查看>>
cer证书签名验证
查看>>
【深度学习】caffe 中的一些参数介绍
查看>>
QML学习笔记之一
查看>>
App右上角数字
查看>>
小算法
查看>>
新作《ASP.NET MVC 5框架揭秘》正式出版
查看>>
WPF中实现多选ComboBox控件
查看>>
读构建之法第四章第十七章有感
查看>>
Windows Phone开发(4):框架和页 转:http://blog.csdn.net/tcjiaan/article/details/7263146
查看>>
python asyncio 异步实现mongodb数据转xls文件
查看>>
TestNG入门
查看>>
【ul开发攻略】HTML5/CSS3菜单代码 阴影+发光+圆角
查看>>
IOS-图片操作集合
查看>>
IO—》Properties类&序列化流与反序列化流
查看>>
jquery实现限制textarea输入字数
查看>>