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:
authorBastien Montagne <montagne29@wanadoo.fr>2014-04-02 22:09:09 +0400
committerBastien Montagne <montagne29@wanadoo.fr>2014-04-02 22:09:09 +0400
commit88f9248faf9dec6bf30005097262c211dd330f32 (patch)
tree91c58c37fd3a8102c056ec186b2cd4c2d5772013 /io_scene_fbx/encode_bin.py
parent8edb6704c83ea603c41125ba7311cd3599a397d8 (diff)
FBX: At last, animation works!
Bad news is: we have to hack at binary level! Yes, some kind of elements do have some specific need binary-wise. I won't say what I think of this.
Diffstat (limited to 'io_scene_fbx/encode_bin.py')
-rw-r--r--io_scene_fbx/encode_bin.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/io_scene_fbx/encode_bin.py b/io_scene_fbx/encode_bin.py
index 5cd3b744..6444ef96 100644
--- a/io_scene_fbx/encode_bin.py
+++ b/io_scene_fbx/encode_bin.py
@@ -42,6 +42,8 @@ _TIME_ID = b'1970-01-01 10:00:00:000'
_FILE_ID = b'\x28\xb3\x2a\xeb\xb6\x24\xcc\xc2\xbf\xc8\xb0\x2a\xa9\x2b\xfc\xf1'
_FOOT_ID = b'\xfa\xbc\xab\x09\xd0\xc8\xd4\x66\xb1\x76\xfb\x83\x1c\xf7\x26\x7e'
+# Awful exceptions: those "classes" of elements seem to need block sentinel even when having no children and some props.
+_ELEMS_ID_ALWAYS_BLOCK_SENTINEL = {b"AnimationStack", b"AnimationLayer"}
class FBXElem:
__slots__ = (
@@ -193,7 +195,6 @@ class FBXElem:
assert(self._end_offset == -1)
assert(self._props_length == -1)
- # print("Offset", offset)
offset += 12 # 3 uints
offset += 1 + len(self.id) # len + idname
@@ -215,7 +216,7 @@ class FBXElem:
for elem in self.elems:
offset = elem._calc_offsets(offset, (elem is elem_last))
offset += _BLOCK_SENTINEL_LENGTH
- elif not self.props:
+ elif not self.props or self.id in _ELEMS_ID_ALWAYS_BLOCK_SENTINEL:
if not is_last:
offset += _BLOCK_SENTINEL_LENGTH
@@ -225,7 +226,6 @@ class FBXElem:
assert(self._end_offset != -1)
assert(self._props_length != -1)
- # print(self.id, self._end_offset, len(self.props), self._props_length)
write(pack('<3I', self._end_offset, len(self.props), self._props_length))
write(bytes((len(self.id),)))
@@ -248,7 +248,7 @@ class FBXElem:
assert(elem.id != b'')
elem._write(write, tell, (elem is elem_last))
write(_BLOCK_SENTINEL_DATA)
- elif not self.props:
+ elif not self.props or self.id in _ELEMS_ID_ALWAYS_BLOCK_SENTINEL:
if not is_last:
write(_BLOCK_SENTINEL_DATA)