From 72fa8d3c0c0b58627685b7b1ec93dc8ef790a1d7 Mon Sep 17 00:00:00 2001 From: Artem30801 Date: Tue, 4 Aug 2020 14:54:47 +0300 Subject: [PATCH] Addon: Fix repeat detection --- blender-addon/clever-show-addon-src/operators/export.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/blender-addon/clever-show-addon-src/operators/export.py b/blender-addon/clever-show-addon-src/operators/export.py index 2b3b16c..a923cde 100644 --- a/blender-addon/clever-show-addon-src/operators/export.py +++ b/blender-addon/clever-show-addon-src/operators/export.py @@ -107,6 +107,8 @@ class ExportSwarmAnimation(Operator, ExportHelper): for drone_obj in drone_objects: animation = self._generate_animation(drone_obj, context) animation = self._remove_idle_frames(animation) + animation = self._remove_repeats(animation) + animation = self._compress_empty(animation) with open(os.path.join(self.filepath, '{}.anim'.format(drone_obj.name)), 'w') as f: f.writelines(json.dumps(frame)+"\n" for frame in animation) @@ -207,7 +209,7 @@ class ExportSwarmAnimation(Operator, ExportHelper): @classmethod def _detect_armed_states(cls, animation): - for i, items in enumerate(neighbour_pairs(vals)): + for i, items in enumerate(neighbour_pairs(animation)): item1, item2 = items if item2 > item1: j = i @@ -249,7 +251,7 @@ class ExportSwarmAnimation(Operator, ExportHelper): @staticmethod def _remove_repeats(animation): - to_remove = ("fly", "fly_gps", "yaw", "led_color", "led_mode" "armed") + to_remove = ("fly", "fly_gps", "yaw", "led_color", "led_effect", "armed") previous_frame = dict() for frame in animation: for func in to_remove: