Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2017-09-29 11:16:13 +0300
committerCampbell Barton <ideasman42@gmail.com>2017-09-29 11:18:56 +0300
commit1542092295c92adfaff687050a74cd7c34747c22 (patch)
treed623a0f4c9dfdb92bcb13f761e7b0c75066adf06 /io_mesh_ply/import_ply.py
parent88f0d4f89e03da4b6972c1b17569f668d98b06ea (diff)
I/O script changes for GSoC 2017 Vertex Paint
These are changes to the ply and fbx export functions, and the ply import function, to deal with vertex color alphas as implemented in the GSoC 2017 Vertex Paint project - see T52910 & D2855
Diffstat (limited to 'io_mesh_ply/import_ply.py')
-rw-r--r--io_mesh_ply/import_ply.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/io_mesh_ply/import_ply.py b/io_mesh_ply/import_ply.py
index eb097ba9..86fc2e1b 100644
--- a/io_mesh_ply/import_ply.py
+++ b/io_mesh_ply/import_ply.py
@@ -242,7 +242,7 @@ def load_ply_mesh(filepath, ply_name):
uvindices = (el.index(b's'), el.index(b't'))
if -1 in uvindices:
uvindices = None
- colindices = el.index(b'red'), el.index(b'green'), el.index(b'blue')
+ colindices = el.index(b'red'), el.index(b'green'), el.index(b'blue'), el.index(b'alpha')
if -1 in colindices:
colindices = None
else: # if not a float assume uchar
@@ -267,6 +267,7 @@ def load_ply_mesh(filepath, ply_name):
mesh_colors.append([(vertices[index][colindices[0]] * colmultiply[0],
vertices[index][colindices[1]] * colmultiply[1],
vertices[index][colindices[2]] * colmultiply[2],
+ vertices[index][colindices[3]] * colmultiply[3],
) for index in indices])
if uvindices or colindices:
@@ -340,7 +341,10 @@ def load_ply_mesh(filepath, ply_name):
f_col = f.color1, f.color2, f.color3
for j, col in enumerate(f_col):
- col.r, col.g, col.b = ply_col[j]
+ col[0] = ply_col[j][0]
+ col[1] = ply_col[j][1]
+ col[2] = ply_col[j][2]
+ col[3] = ply_col[j][3]
mesh.validate()
mesh.update()