[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [3435] contrib/py/scripts/addons/ cmu_mocap_browser/__init__.py: Clarified the meaning of error messages requiring activation of other addons .

Daniel M. Basso danielmbasso at gmail.com
Fri Jun 1 14:58:35 CEST 2012


Revision: 3435
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=3435
Author:   dmbasso
Date:     2012-06-01 12:58:35 +0000 (Fri, 01 Jun 2012)
Log Message:
-----------
Clarified the meaning of error messages requiring activation of other addons. 

Modified Paths:
--------------
    contrib/py/scripts/addons/cmu_mocap_browser/__init__.py

Modified: contrib/py/scripts/addons/cmu_mocap_browser/__init__.py
===================================================================
--- contrib/py/scripts/addons/cmu_mocap_browser/__init__.py	2012-06-01 08:02:00 UTC (rev 3434)
+++ contrib/py/scripts/addons/cmu_mocap_browser/__init__.py	2012-06-01 12:58:35 UTC (rev 3435)
@@ -25,12 +25,12 @@
 bl_info = {
     'name': "Carnegie Mellon University Mocap Library Browser",
     'author': "Daniel Monteiro Basso <daniel at basso.inf.br>",
-    'version': (2011, 10, 30, 1),
-    'blender': (2, 6, 0),
+    'version': (2012, 6, 1, 1),
+    'blender': (2, 6, 3),
     'location': "View3D > Tools",
     'description': "Assistant for using CMU Motion Capture data",
-    'warning': 'Script is returning errors',
-    'wiki_url': "http://wiki.blender.org/index.php/Extensions:2.5/Py/"\
+    'warning': '',
+    'wiki_url': "http://wiki.blender.org/index.php/Extensions:2.6/Py/"\
                 "Scripts/3D_interaction/CMU_Mocap_Library_Browser",
     'tracker_url': "http://projects.blender.org/tracker/index.php?"\
                    "func=detail&aid=29086&group_id=153&atid=467",
@@ -222,30 +222,43 @@
             if self.local_file.endswith("mpg"):
                 bpy.ops.wm.path_open(filepath=self.local_file)
             elif self.local_file.endswith("asf"):
-                bpy.ops.import_anim.asf(
-                    filepath=self.local_file,
-                    from_inches=True,
-                    use_rot_x=True, use_rot_z=True,
-                    armature_name=cml.subject_import_name)
+                try:
+                    bpy.ops.import_anim.asf(
+                        filepath=self.local_file,
+                        from_inches=True,
+                        use_rot_x=True, use_rot_z=True,
+                        armature_name=cml.subject_import_name)
+                except AttributeError:
+                    self.report({'ERROR'}, "To use this feature "
+                        "please enable the Acclaim ASF/AMC Importer addon.")
             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
-                bpy.ops.import_anim.amc(
-                    filepath=self.local_file,
-                    frame_skip=cml.frame_skip)
+                try:
+                    bpy.ops.import_anim.amc(
+                        filepath=self.local_file,
+                        frame_skip=cml.frame_skip)
+                except AttributeError:
+                    self.report({'ERROR'}, "To use this feature please "
+                        "enable the Acclaim ASF/AMC Importer addon.")
             elif self.local_file.endswith("c3d"):
-                bpy.ops.import_anim.c3d(
-                    filepath=self.local_file,
-                    from_inches=False,
-                    auto_scale=True,
-                    scale=cml.cloud_scale,
-                    show_names=False,
-                    frame_skip=cml.frame_skip)
+                try:
+                    bpy.ops.import_anim.c3d(
+                        filepath=self.local_file,
+                        from_inches=False,
+                        auto_scale=True,
+                        scale=cml.cloud_scale,
+                        show_names=False,
+                        frame_skip=cml.frame_skip)
+                except AttributeError:
+                    self.report({'ERROR'}, "To use this feature "
+                        "please enable the C3D Importer addon.")
 
 
+
 class CMUMocapConfig(bpy.types.Panel):
     bl_idname = "object.cmu_mocap_config"
     bl_label = "CMU Mocap Browser Configuration"



More information about the Bf-extensions-cvs mailing list