[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [4321] trunk/py/scripts/addons/rigify/ rig_lists.py: Rigify: bug fix: certain kinds of import errors were being suppressed in

Nathan Vegdahl cessen at cessen.com
Sat Feb 23 20:55:56 CET 2013


Revision: 4321
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=4321
Author:   cessen
Date:     2013-02-23 19:55:56 +0000 (Sat, 23 Feb 2013)
Log Message:
-----------
Rigify: bug fix: certain kinds of import errors were being suppressed in
rig types.

Modified Paths:
--------------
    trunk/py/scripts/addons/rigify/rig_lists.py

Modified: trunk/py/scripts/addons/rigify/rig_lists.py
===================================================================
--- trunk/py/scripts/addons/rigify/rig_lists.py	2013-02-23 00:19:59 UTC (rev 4320)
+++ trunk/py/scripts/addons/rigify/rig_lists.py	2013-02-23 19:55:56 UTC (rev 4321)
@@ -17,6 +17,8 @@
 #======================= END GPL LICENSE BLOCK ========================
 
 import os
+import traceback
+import logging
 
 from . import utils
 
@@ -33,37 +35,32 @@
 
     for f in files:
         is_dir = os.path.isdir(os.path.join(SEARCH_DIR_ABS, f))  # Whether the file is a directory
-        if f[0] in {".", "_"}:
-            pass
-        elif f.count(".") >= 2 or (is_dir and "." in f):
+
+        # Stop cases
+        if f[0] in [".", "_"]:
+            continue
+        if f.count(".") >= 2 or (is_dir and "." in f):
             print("Warning: %r, filename contains a '.', skipping" % os.path.join(SEARCH_DIR_ABS, f))
-        else:
-            if is_dir:
-                # Check directories
-                module_name = os.path.join(path, f).replace(os.sep, ".")
-                try:
-                    rig = utils.get_rig_type(module_name)
-                except ImportError as e:
-                    print("Rigify: " + str(e))
-                else:
-                    # Check if it's a rig itself
-                    if not hasattr(rig, "Rig"):
-                        # Check for sub-rigs
-                        ls = get_rig_list(os.path.join(path, f, ""))  # "" adds a final slash
-                        rigs.extend(["%s.%s" % (f, l) for l in ls])
-                    else:
-                        rigs += [f]
+            continue
 
-            elif f.endswith(".py"):
-                # Check straight-up python files
-                t = f[:-3]
-                module_name = os.path.join(path, t).replace(os.sep, ".")
-                try:
-                    utils.get_rig_type(module_name).Rig
-                except (ImportError, AttributeError):
-                    pass
-                else:
-                    rigs += [t]
+        if is_dir:
+            # Check directories
+            module_name = os.path.join(path, f).replace(os.sep, ".")
+            rig = utils.get_rig_type(module_name)
+            # Check if it's a rig itself
+            if hasattr(rig, "Rig"):
+                rigs += [f]
+            else:
+                # Check for sub-rigs
+                ls = get_rig_list(os.path.join(path, f, ""))  # "" adds a final slash
+                rigs.extend(["%s.%s" % (f, l) for l in ls])
+        elif f.endswith(".py"):
+            # Check straight-up python files
+            t = f[:-3]
+            module_name = os.path.join(path, t).replace(os.sep, ".")
+            rig = utils.get_rig_type(module_name)
+            if hasattr(rig, "Rig"):
+                rigs += [t]
     rigs.sort()
     return rigs
 



More information about the Bf-extensions-cvs mailing list