Skip to content

Commit bf4bce9

Browse files
authored
Merge pull request #442 from kromar/fix-error-with-empty-vertex-colors
fix error when trying to export empty vertex colors
2 parents 26ae7d9 + 2a4b75c commit bf4bce9

File tree

2 files changed

+44
-22
lines changed

2 files changed

+44
-22
lines changed

GoB.py

Lines changed: 43 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -945,6 +945,28 @@ def exportGoZ(self, path, scn, obj, pathImport):
945945
vcolArray[vert_idx*3] = int(255*vcoldata[loop.index].color[0])
946946
vcolArray[vert_idx*3+1] = int(255*vcoldata[loop.index].color[1])
947947
vcolArray[vert_idx*3+2] = int(255*vcoldata[loop.index].color[2])
948+
949+
if prefs().performance_profiling:
950+
start_time = profiler(start_time, " Polypaint: loop")
951+
952+
goz_file.write(pack('<4B', 0xb9, 0x88, 0x00, 0x00))
953+
goz_file.write(pack('<I', numVertices*4+16))
954+
goz_file.write(pack('<Q', numVertices))
955+
if prefs().performance_profiling:
956+
start_time = profiler(start_time, " Polypaint: write numVertices")
957+
958+
for i in range(0, len(vcolArray), 3):
959+
goz_file.write(pack('<B', vcolArray[i+2]))
960+
goz_file.write(pack('<B', vcolArray[i+1]))
961+
goz_file.write(pack('<B', vcolArray[i]))
962+
goz_file.write(pack('<B', 0))
963+
if prefs().performance_profiling:
964+
start_time = profiler(start_time, " Polypaint: write color")
965+
966+
vcolArray.clear()
967+
if prefs().performance_profiling:
968+
start_time = profiler(start_time, " Polypaint: vcolArray.clear")
969+
948970
else:
949971
if obj.data.color_attributes.active_color_name:
950972
vcoldata = me.color_attributes[obj.data.color_attributes.active_color_name].data
@@ -954,30 +976,30 @@ def exportGoZ(self, path, scn, obj, pathImport):
954976
vcolArray[v.index * 3] = int(255*vcoldata[v.index].color_srgb[0])
955977
vcolArray[v.index * 3+1] = int(255*vcoldata[v.index].color_srgb[1])
956978
vcolArray[v.index * 3+2] = int(255*vcoldata[v.index].color_srgb[2])
979+
980+
if prefs().performance_profiling:
981+
start_time = profiler(start_time, " Polypaint: loop")
957982

958-
if prefs().performance_profiling:
959-
start_time = profiler(start_time, " Polypaint: loop")
960-
961-
goz_file.write(pack('<4B', 0xb9, 0x88, 0x00, 0x00))
962-
goz_file.write(pack('<I', numVertices*4+16))
963-
goz_file.write(pack('<Q', numVertices))
964-
if prefs().performance_profiling:
965-
start_time = profiler(start_time, " Polypaint: write numVertices")
983+
goz_file.write(pack('<4B', 0xb9, 0x88, 0x00, 0x00))
984+
goz_file.write(pack('<I', numVertices*4+16))
985+
goz_file.write(pack('<Q', numVertices))
986+
if prefs().performance_profiling:
987+
start_time = profiler(start_time, " Polypaint: write numVertices")
966988

967-
for i in range(0, len(vcolArray), 3):
968-
goz_file.write(pack('<B', vcolArray[i+2]))
969-
goz_file.write(pack('<B', vcolArray[i+1]))
970-
goz_file.write(pack('<B', vcolArray[i]))
971-
goz_file.write(pack('<B', 0))
972-
if prefs().performance_profiling:
973-
start_time = profiler(start_time, " Polypaint: write color")
989+
for i in range(0, len(vcolArray), 3):
990+
goz_file.write(pack('<B', vcolArray[i+2]))
991+
goz_file.write(pack('<B', vcolArray[i+1]))
992+
goz_file.write(pack('<B', vcolArray[i]))
993+
goz_file.write(pack('<B', 0))
994+
if prefs().performance_profiling:
995+
start_time = profiler(start_time, " Polypaint: write color")
974996

975-
vcolArray.clear()
976-
if prefs().performance_profiling:
977-
start_time = profiler(start_time, " Polypaint: vcolArray.clear")
978-
979-
if prefs().performance_profiling:
980-
start_time = profiler(start_time, "Write Polypaint")
997+
vcolArray.clear()
998+
if prefs().performance_profiling:
999+
start_time = profiler(start_time, " Polypaint: vcolArray.clear")
1000+
1001+
if prefs().performance_profiling:
1002+
start_time = profiler(start_time, "Write Polypaint")
9811003

9821004
# --Mask--
9831005
if not prefs().export_clear_mask:

__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"name": "GoB",
3737
"description": "An unofficial GOZ-like addon for Blender",
3838
"author": "ODe, JoseConseco, Daniel Grauer",
39-
"version": (3, 6, 2),
39+
"version": (3, 6, 3),
4040
"blender": (2, 93, 0),
4141
"location": "In the info header",
4242
"doc_url": "https://github.com/JoseConseco/GoB/wiki",

0 commit comments

Comments
 (0)