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_scene_fbx
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_scene_fbx')
-rw-r--r--io_scene_fbx/export_fbx.py6
-rw-r--r--io_scene_fbx/export_fbx_bin.py4
2 files changed, 5 insertions, 5 deletions
diff --git a/io_scene_fbx/export_fbx.py b/io_scene_fbx/export_fbx.py
index dc647f71..e62d512d 100644
--- a/io_scene_fbx/export_fbx.py
+++ b/io_scene_fbx/export_fbx.py
@@ -1508,13 +1508,13 @@ def save_single(operator, scene, filepath="",
collayers = []
if len(me.vertex_colors):
collayers = me.vertex_colors
- t_lc = [None] * len(me.loops) * 3
+ t_lc = [None] * len(me.loops) * 4
col2idx = None
_nchunk = 4 # Number of colors per line
_nchunk_idx = 64 # Number of color indices per line
for colindex, collayer in enumerate(collayers):
collayer.data.foreach_get("color", t_lc)
- lc = tuple(zip(*[iter(t_lc)] * 3))
+ lc = tuple(zip(*[iter(t_lc)] * 4))
fw('\n\t\tLayerElementColor: %i {'
'\n\t\t\tVersion: 101'
'\n\t\t\tName: "%s"'
@@ -1523,7 +1523,7 @@ def save_single(operator, scene, filepath="",
'\n\t\t\tColors: ' % (colindex, collayer.name))
col2idx = tuple(set(lc))
- fw(',\n\t\t\t '.join(','.join('%.6f,%.6f,%.6f,1' % c for c in chunk)
+ fw(',\n\t\t\t '.join(','.join('%.6f,%.6f,%.6f,%.06f' % c for c in chunk)
for chunk in grouper_exact(col2idx, _nchunk)))
fw('\n\t\t\tColorIndex: ')
diff --git a/io_scene_fbx/export_fbx_bin.py b/io_scene_fbx/export_fbx_bin.py
index e9e1248e..a630f86b 100644
--- a/io_scene_fbx/export_fbx_bin.py
+++ b/io_scene_fbx/export_fbx_bin.py
@@ -1061,9 +1061,9 @@ def fbx_data_mesh_elements(root, me_obj, scene_data, done_meshes):
vcolnumber = len(me.vertex_colors)
if vcolnumber:
def _coltuples_gen(raw_cols):
- return zip(*(iter(raw_cols),) * 3 + (_infinite_gen(1.0),)) # We need a fake alpha...
+ return zip(*(iter(raw_cols),) * 4)
- t_lc = array.array(data_types.ARRAY_FLOAT64, (0.0,)) * len(me.loops) * 3
+ t_lc = array.array(data_types.ARRAY_FLOAT64, (0.0,)) * len(me.loops) * 4
for colindex, collayer in enumerate(me.vertex_colors):
collayer.data.foreach_get("color", t_lc)
lay_vcol = elem_data_single_int32(geom, b"LayerElementColor", colindex)