Skip to content

Commit 89ca571

Browse files
committed
Update pydll
Signed-off-by: Squareys <Squareys@googlemail.com>
1 parent 2cff538 commit 89ca571

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

src/io_scene_ogex/pyddl.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,11 @@ def __init__(self, data_type, data, name=None, vector_size=0):
4949
self.data = data
5050

5151
def is_simple_primitive(self):
52-
return len(self.data) == 1 and self.vector_size <= 4
52+
if len(self.data) == 1:
53+
return self.vector_size <= 4
54+
elif len(self.data) <= 4:
55+
return self.vector_size == 0
56+
return False
5357

5458

5559
class DdlStructure:
@@ -261,6 +265,8 @@ def property_as_text(self, prop):
261265
value_bytes = self.to_int_byte(value)
262266
elif isinstance(value, float):
263267
value_bytes = self.to_float_byte(value)
268+
elif isinstance(value, DdlStructure):
269+
value_bytes = self.to_ref_byte(value)
264270
elif isinstance(value, str):
265271
value_bytes = B"\"" + bytes(value, "UTF-8") + B"\""
266272
elif isinstance(value, bytes):
@@ -320,7 +326,7 @@ def primitive_as_text(self, primitive, no_indent=False):
320326
elif primitive.is_simple_primitive():
321327
lines.append(B"\n" if has_comment else B" ")
322328
if primitive.vector_size == 0:
323-
lines.append(B"{" + to_bytes(primitive.data[0]) + B"}")
329+
lines.append(B"{" + B", ".join(map(to_bytes, primitive.data)) + B"}")
324330
else:
325331
lines.append(B"{{" + (B", ".join(map(to_bytes, primitive.data[0]))) + B"}}")
326332
else:

0 commit comments

Comments
 (0)