[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [25294] trunk/blender: missed a header last commit, added custom exceptions to rigify so they can be caught and converted into reports and have normal errors display the stack trace as useual .

Campbell Barton ideasman42 at gmail.com
Thu Dec 10 19:28:22 CET 2009


Revision: 25294
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=25294
Author:   campbellbarton
Date:     2009-12-10 19:28:22 +0100 (Thu, 10 Dec 2009)

Log Message:
-----------
missed a header last commit, added custom exceptions to rigify so they can be caught and converted into reports and have normal errors display the stack trace as useual.

Modified Paths:
--------------
    trunk/blender/release/scripts/modules/rigify/__init__.py
    trunk/blender/release/scripts/modules/rigify/arm_biped_generic.py
    trunk/blender/release/scripts/modules/rigify/delta.py
    trunk/blender/release/scripts/modules/rigify/finger_curl.py
    trunk/blender/release/scripts/modules/rigify/leg_biped_generic.py
    trunk/blender/release/scripts/modules/rigify/neck_flex.py
    trunk/blender/release/scripts/modules/rigify/spine_pivot_flex.py
    trunk/blender/source/blender/editors/interface/interface_regions.c
    trunk/blender/source/blender/makesrna/intern/rna_internal.h

Modified: trunk/blender/release/scripts/modules/rigify/__init__.py
===================================================================
--- trunk/blender/release/scripts/modules/rigify/__init__.py	2009-12-10 17:41:03 UTC (rev 25293)
+++ trunk/blender/release/scripts/modules/rigify/__init__.py	2009-12-10 18:28:22 UTC (rev 25294)
@@ -24,8 +24,14 @@
 # TODO, have these in a more general module
 from rna_prop_ui import rna_idprop_ui_prop_get
 
+class RigifyError(Exception):
+    """Exception raised for errors in the metarig.
+    """
+    def __init__(self, message):
+        self.message = message
+    def __str__(self):
+        return repr(self.message)
 
-
 def submodule_func_from_type(bone_type):
     type_pair = bone_type.split(".")
 

Modified: trunk/blender/release/scripts/modules/rigify/arm_biped_generic.py
===================================================================
--- trunk/blender/release/scripts/modules/rigify/arm_biped_generic.py	2009-12-10 17:41:03 UTC (rev 25293)
+++ trunk/blender/release/scripts/modules/rigify/arm_biped_generic.py	2009-12-10 18:28:22 UTC (rev 25294)
@@ -19,6 +19,7 @@
 # <pep8 compliant>
 
 import bpy
+from rigify import RigifyError
 from rigify_utils import bone_class_instance, copy_bone_simple, add_pole_target_bone, add_stretch_to, blend_bone_list, get_side_name, get_base_name
 from rna_prop_ui import rna_idprop_ui_prop_get
 from Mathutils import Vector
@@ -68,7 +69,7 @@
     mt.shoulder_p = mt.arm_p.parent
 
     if not mt.shoulder_p:
-        raise Exception("could not find '%s' parent, skipping:" % orig_bone_name)
+        raise RigifyError("could not find '%s' parent, skipping:" % orig_bone_name)
 
     mt.shoulder = mt.shoulder_p.name
 
@@ -80,7 +81,7 @@
             hands.append(pbone)
 
     if len(hands) != 1:
-        raise Exception("Found %s possible hands attached to this arm, expected 1 from bone: %s" % ([pbone.name for pbone in hands], orig_bone_name))
+        raise RigifyError("Found %s possible hands attached to this arm, expected 1 from bone: %s" % ([pbone.name for pbone in hands], orig_bone_name))
 
     # first add the 2 new bones
     mt.hand_p = hands[0]

Modified: trunk/blender/release/scripts/modules/rigify/delta.py
===================================================================
--- trunk/blender/release/scripts/modules/rigify/delta.py	2009-12-10 17:41:03 UTC (rev 25293)
+++ trunk/blender/release/scripts/modules/rigify/delta.py	2009-12-10 18:28:22 UTC (rev 25294)
@@ -19,6 +19,7 @@
 # <pep8 compliant>
 
 import bpy
+from rigify import RigifyError
 
 # not used, defined for completeness
 METARIG_NAMES = tuple()
@@ -64,7 +65,7 @@
     children = delta.children
 
     if len(children) != 1:
-        raise Exception("only 1 child supported for delta on bone '%s'" % delta.name)
+        raise RigifyError("only 1 child supported for delta on bone '%s'" % delta.name)
 
     bone_definition = [delta.name, children[0].name]
 

Modified: trunk/blender/release/scripts/modules/rigify/finger_curl.py
===================================================================
--- trunk/blender/release/scripts/modules/rigify/finger_curl.py	2009-12-10 17:41:03 UTC (rev 25293)
+++ trunk/blender/release/scripts/modules/rigify/finger_curl.py	2009-12-10 18:28:22 UTC (rev 25294)
@@ -19,6 +19,7 @@
 # <pep8 compliant>
 
 import bpy
+from rigify import RigifyError
 from rigify_utils import copy_bone_simple, get_side_name, get_base_name, EMPTY_LAYER
 from rna_prop_ui import rna_idprop_ui_prop_get
 from functools import reduce
@@ -73,13 +74,13 @@
         children = bone.children
 
         if len(children) != 1:
-            raise Exception("expected the chain to have 2 children from bone '%s' without a fork" % orig_bone_name)
+            raise RigifyError("expected the chain to have 2 children from bone '%s' without a fork" % orig_bone_name)
         bone = children[0]
         bone_definition.append(bone.name) # finger_02, finger_03
         chain += 1
 
     if len(bone_definition) != len(METARIG_NAMES):
-        raise Exception("internal problem, expected %d bones" % len(METARIG_NAMES))
+        raise RigifyError("internal problem, expected %d bones" % len(METARIG_NAMES))
 
     return bone_definition
 

Modified: trunk/blender/release/scripts/modules/rigify/leg_biped_generic.py
===================================================================
--- trunk/blender/release/scripts/modules/rigify/leg_biped_generic.py	2009-12-10 17:41:03 UTC (rev 25293)
+++ trunk/blender/release/scripts/modules/rigify/leg_biped_generic.py	2009-12-10 18:28:22 UTC (rev 25294)
@@ -19,6 +19,7 @@
 # <pep8 compliant>
 
 import bpy
+from rigify import RigifyError
 from rigify_utils import bone_class_instance, copy_bone_simple, blend_bone_list, get_side_name, get_base_name
 from rna_prop_ui import rna_idprop_ui_prop_get
 
@@ -85,7 +86,7 @@
     orig_bone_parent = orig_bone.parent
 
     if orig_bone_parent is None:
-        raise Exception("expected the thigh bone to have a parent hip bone")
+        raise RigifyError("expected the thigh bone to have a parent hip bone")
 
     bone_definition.append(orig_bone_parent.name)
     bone_definition.append(orig_bone.name)
@@ -97,7 +98,7 @@
         children = bone.children
 
         if len(children) != 1:
-            raise Exception("expected the thigh bone to have 3 children without a fork")
+            raise RigifyError("expected the thigh bone to have 3 children without a fork")
         bone = children[0]
         bone_definition.append(bone.name) # shin, foot
         chain += 1
@@ -105,10 +106,10 @@
     children = bone.children
     # Now there must be 2 children, only one connected
     if len(children) != 2:
-        raise Exception("expected the foot bone:'%s' to have 2 children" % bone.name )
+        raise RigifyError("expected the foot bone:'%s' to have 2 children" % bone.name )
 
     if children[0].connected == children[1].connected:
-        raise Exception("expected one bone to be connected")
+        raise RigifyError("expected one bone to be connected")
 
     toe, heel = children
     if heel.connected:
@@ -119,7 +120,7 @@
     bone_definition.append(heel.name)
 
     if len(bone_definition) != len(METARIG_NAMES):
-        raise Exception("internal problem, expected %d bones" % len(METARIG_NAMES))
+        raise RigifyError("internal problem, expected %d bones" % len(METARIG_NAMES))
 
     return bone_definition
 

Modified: trunk/blender/release/scripts/modules/rigify/neck_flex.py
===================================================================
--- trunk/blender/release/scripts/modules/rigify/neck_flex.py	2009-12-10 17:41:03 UTC (rev 25293)
+++ trunk/blender/release/scripts/modules/rigify/neck_flex.py	2009-12-10 18:28:22 UTC (rev 25294)
@@ -19,6 +19,7 @@
 # <pep8 compliant>
 
 import bpy
+from rigify import RigifyError
 from rigify_utils import bone_class_instance, copy_bone_simple
 from rna_prop_ui import rna_idprop_ui_prop_get
 
@@ -91,7 +92,7 @@
 
     children = head.children
     if len(children) != 1:
-        print("expected the head to have only 1 child.")
+        raise RigifyError("expected the head bone '%s' to have only 1 child." % orig_bone_name)
 
     child = children[0]
     bone_definition = [body.name, head.name, child.name]

Modified: trunk/blender/release/scripts/modules/rigify/spine_pivot_flex.py
===================================================================
--- trunk/blender/release/scripts/modules/rigify/spine_pivot_flex.py	2009-12-10 17:41:03 UTC (rev 25293)
+++ trunk/blender/release/scripts/modules/rigify/spine_pivot_flex.py	2009-12-10 18:28:22 UTC (rev 25294)
@@ -104,11 +104,11 @@
     pelvis = ribcage.parent
 
     if pelvis is None:
-        raise Exception("expected the ribcage bone:'%s' to have a parent (ribcage)." % ribcage.name)
+        raise RigifyError("expected the ribcage bone:'%s' to have a parent (ribcage)." % ribcage.name)
 
     children = ribcage.children
     if len(children) != 1:
-        raise Exception("expected the ribcage to have only 1 child.")
+        raise RigifyError("expected the ribcage to have only 1 child.")
 
     child = children[0]
 

Modified: trunk/blender/source/blender/editors/interface/interface_regions.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_regions.c	2009-12-10 17:41:03 UTC (rev 25293)
+++ trunk/blender/source/blender/editors/interface/interface_regions.c	2009-12-10 18:28:22 UTC (rev 25294)
@@ -2288,6 +2288,7 @@
 		/* menu is created from a string */
 		pup->menu_func= ui_block_func_MENUSTR;
 		pup->menu_arg= str;
+		// XXX pup->block->flag |= UI_BLOCK_NO_FLIP;
 	}
 	else {
 		/* menu is created from a callback */

Modified: trunk/blender/source/blender/makesrna/intern/rna_internal.h
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_internal.h	2009-12-10 17:41:03 UTC (rev 25293)
+++ trunk/blender/source/blender/makesrna/intern/rna_internal.h	2009-12-10 18:28:22 UTC (rev 25294)
@@ -207,6 +207,7 @@
 void RNA_api_armature_edit_bone(StructRNA *srna);
 void RNA_api_drivers(StructRNA *srna);
 void RNA_api_image(struct StructRNA *srna);
+void RNA_api_operator(struct StructRNA *srna);
 void RNA_api_keyconfig(struct StructRNA *srna);
 void RNA_api_keyingset(struct StructRNA *srna);
 void RNA_api_keymap(struct StructRNA *srna);





More information about the Bf-blender-cvs mailing list