From d5e0e9af99e84a8886a47a75e49c2064e9b1b1c2 Mon Sep 17 00:00:00 2001 From: Iwo Plaza <iwoplaza@gmail.com> Date: Thu, 9 Apr 2020 20:31:54 +0200 Subject: [PATCH] Altered the format a bit. --- data.py | 6 +++--- export_mobends.py | 2 +- statics.py | 3 +++ 3 files changed, 7 insertions(+), 4 deletions(-) create mode 100644 statics.py diff --git a/data.py b/data.py index 10c8def..ca964a7 100644 --- a/data.py +++ b/data.py @@ -1,11 +1,11 @@ # <pep8 compliant> import bpy +from .statics import FORMAT_VERSION def create_bone_data(scene_bone): return { - 'name': scene_bone.name, 'keyframes': [] } # end create_bone_data @@ -13,7 +13,6 @@ def create_bone_data(scene_bone): def create_armature_data(scene_armature): armature = { - 'name': scene_armature.name, 'bones': {} } @@ -78,7 +77,7 @@ def create_data(context, EXPORT_SEL_ONLY=False): for obj in scene_objs: if obj.type == 'ARMATURE': armature = create_armature_data(obj) - armatures[armature['name']] = armature + armatures[obj.name] = armature orig_frame = scene.frame_current @@ -94,6 +93,7 @@ def create_data(context, EXPORT_SEL_ONLY=False): scene.frame_set(orig_frame, subframe=0.0) return { + 'version': FORMAT_VERSION, 'meta': bpy.app.version_string, 'armatures': armatures } diff --git a/export_mobends.py b/export_mobends.py index 14037f4..059dba6 100644 --- a/export_mobends.py +++ b/export_mobends.py @@ -21,6 +21,6 @@ def save(context, # Exporting the data as JSON with open(filepath, 'w', encoding='utf8', newline='\n') as f: - f.write(json.dumps(data, sort_keys=True, indent=4)) + f.write(json.dumps(data, indent=4)) return { 'FINISHED' } \ No newline at end of file diff --git a/statics.py b/statics.py new file mode 100644 index 0000000..390ed3c --- /dev/null +++ b/statics.py @@ -0,0 +1,3 @@ +# <pep8 compliant> + +FORMAT_VERSION = 1 \ No newline at end of file