diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-12-10 21:28:22 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-12-10 21:28:22 +0300 |
commit | 2576268fb85071f2e3ba80142ddb01e733c07e08 (patch) | |
tree | 82d19e1d86807ffdc94cd41e2fd61bfdaa0aae54 | |
parent | 0779f2c42599dd665730902cd669741070bdb46b (diff) |
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.
-rw-r--r-- | release/scripts/modules/rigify/__init__.py | 8 | ||||
-rw-r--r-- | release/scripts/modules/rigify/arm_biped_generic.py | 5 | ||||
-rw-r--r-- | release/scripts/modules/rigify/delta.py | 3 | ||||
-rw-r--r-- | release/scripts/modules/rigify/finger_curl.py | 5 | ||||
-rw-r--r-- | release/scripts/modules/rigify/leg_biped_generic.py | 11 | ||||
-rw-r--r-- | release/scripts/modules/rigify/neck_flex.py | 3 | ||||
-rw-r--r-- | release/scripts/modules/rigify/spine_pivot_flex.py | 4 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_regions.c | 1 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_internal.h | 1 |
9 files changed, 27 insertions, 14 deletions
diff --git a/release/scripts/modules/rigify/__init__.py b/release/scripts/modules/rigify/__init__.py index 611bfd7035d..ff0c1421f55 100644 --- a/release/scripts/modules/rigify/__init__.py +++ b/release/scripts/modules/rigify/__init__.py @@ -24,7 +24,13 @@ from Mathutils import Vector # 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(".") diff --git a/release/scripts/modules/rigify/arm_biped_generic.py b/release/scripts/modules/rigify/arm_biped_generic.py index af6c4880954..dfae94875b7 100644 --- a/release/scripts/modules/rigify/arm_biped_generic.py +++ b/release/scripts/modules/rigify/arm_biped_generic.py @@ -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 @@ def metarig_definition(obj, orig_bone_name): 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 @@ def metarig_definition(obj, orig_bone_name): 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] diff --git a/release/scripts/modules/rigify/delta.py b/release/scripts/modules/rigify/delta.py index faedf7029f0..a83b45307dd 100644 --- a/release/scripts/modules/rigify/delta.py +++ b/release/scripts/modules/rigify/delta.py @@ -19,6 +19,7 @@ # <pep8 compliant> import bpy +from rigify import RigifyError # not used, defined for completeness METARIG_NAMES = tuple() @@ -64,7 +65,7 @@ def metarig_definition(obj, orig_bone_name): 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] diff --git a/release/scripts/modules/rigify/finger_curl.py b/release/scripts/modules/rigify/finger_curl.py index 73d4cc5fbd8..15bdd803500 100644 --- a/release/scripts/modules/rigify/finger_curl.py +++ b/release/scripts/modules/rigify/finger_curl.py @@ -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 @@ def metarig_definition(obj, orig_bone_name): 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 diff --git a/release/scripts/modules/rigify/leg_biped_generic.py b/release/scripts/modules/rigify/leg_biped_generic.py index c6fb57dd6f5..d08d0e99f43 100644 --- a/release/scripts/modules/rigify/leg_biped_generic.py +++ b/release/scripts/modules/rigify/leg_biped_generic.py @@ -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 @@ def metarig_definition(obj, orig_bone_name): 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 @@ def metarig_definition(obj, orig_bone_name): 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 @@ def metarig_definition(obj, orig_bone_name): 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 @@ def metarig_definition(obj, orig_bone_name): 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 diff --git a/release/scripts/modules/rigify/neck_flex.py b/release/scripts/modules/rigify/neck_flex.py index 68015b3ebd3..31763518f09 100644 --- a/release/scripts/modules/rigify/neck_flex.py +++ b/release/scripts/modules/rigify/neck_flex.py @@ -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 @@ def metarig_definition(obj, orig_bone_name): 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] diff --git a/release/scripts/modules/rigify/spine_pivot_flex.py b/release/scripts/modules/rigify/spine_pivot_flex.py index 37a350bb3be..f9a5aceb4d6 100644 --- a/release/scripts/modules/rigify/spine_pivot_flex.py +++ b/release/scripts/modules/rigify/spine_pivot_flex.py @@ -104,11 +104,11 @@ def metarig_definition(obj, orig_bone_name): 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] diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index f01ae990586..8ebfed21dcc 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -2288,6 +2288,7 @@ uiPopupBlockHandle *ui_popup_menu_create(bContext *C, ARegion *butregion, uiBut /* 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 */ diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h index df1dd249dd1..6f4233b9337 100644 --- a/source/blender/makesrna/intern/rna_internal.h +++ b/source/blender/makesrna/intern/rna_internal.h @@ -207,6 +207,7 @@ void RNA_api_action(StructRNA *srna); 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); |