CMU mocap browser: fixed missing/incorrect return values.
authorSybren A. Stüvel <sybren@stuvel.eu>
Fri, 20 Mar 2015 09:20:53 +0000 (10:20 +0100)
committerSybren A. Stüvel <sybren@stuvel.eu>
Fri, 20 Mar 2015 09:20:53 +0000 (10:20 +0100)
cmu_mocap_browser/__init__.py
cmu_mocap_browser/download.py

index 11823d2928ca0c962eede2332703d4d0d3ae34d0..7feaeb93c9bf2cf192ac76b4e48bd11a7ddea5d7 100644 (file)
@@ -25,7 +25,7 @@
 bl_info = {
     "name": "Carnegie Mellon University Mocap Library Browser",
     "author": "Daniel Monteiro Basso <daniel@basso.inf.br>",
-    "version": (2013, 5, 9),
+    "version": (2015, 3, 20),
     "blender": (2, 66, 6),
     "location": "View3D > Tools",
     "description": "Assistant for using CMU Motion Capture data",
index b4d4a0943e4877e8697a786fcae21dfddc6d5746..0f30386b3ad6d07205e3e429b0bb579049246c70 100644 (file)
@@ -98,7 +98,8 @@ class CMUMocapDownloadImport(bpy.types.Operator):
         bpy.types.SpaceView3D.draw_handler_remove(self.handle, 'WINDOW')
         cml = context.user_preferences.addons['cmu_mocap_browser'].preferences
         if os.path.exists(self.local_file):
-            self.import_or_open(cml)
+            return self.import_or_open(cml)
+        return {'CANCELLED'}
 
     def execute(self, context):
         cml = context.user_preferences.addons['cmu_mocap_browser'].preferences
@@ -141,12 +142,13 @@ class CMUMocapDownloadImport(bpy.types.Operator):
                 except AttributeError:
                     self.report({'ERROR'}, "To use this feature "
                         "please enable the Acclaim ASF/AMC Importer addon.")
+                    return {'CANCELLED'}
             elif self.local_file.endswith("amc"):
                 ob = bpy.context.active_object
                 if not ob or ob.type != 'ARMATURE' or \
                     'source_file_path' not in ob:
                     self.report({'ERROR'}, "Please select a CMU Armature.")
-                    return
+                    return {'CANCELLED'}
                 try:
                     bpy.ops.import_anim.amc(
                         filepath=self.local_file,
@@ -154,6 +156,7 @@ class CMUMocapDownloadImport(bpy.types.Operator):
                 except AttributeError:
                     self.report({'ERROR'}, "To use this feature please "
                         "enable the Acclaim ASF/AMC Importer addon.")
+                    return {'CANCELLED'}
             elif self.local_file.endswith("c3d"):
                 try:
                     bpy.ops.import_anim.c3d(
@@ -166,4 +169,6 @@ class CMUMocapDownloadImport(bpy.types.Operator):
                 except AttributeError:
                     self.report({'ERROR'}, "To use this feature "
                         "please enable the C3D Importer addon.")
+                    return {'CANCELLED'}
 
+        return {'FINISHED'}