diff options
author | Joshua Leung <aligorith@gmail.com> | 2014-06-26 08:40:35 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2014-07-03 16:09:35 +0400 |
commit | 796aef081bf3dff52bb177b247c659ef16cae6fb (patch) | |
tree | 46fec161108ce23962574c4e860a05893008dcf5 | |
parent | 26eae6315c05526021b93d9e32b064208a9d7ab8 (diff) |
Code Cleanup - Replaced magic numbers with defines
-rw-r--r-- | source/blender/editors/armature/pose_select.c | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/source/blender/editors/armature/pose_select.c b/source/blender/editors/armature/pose_select.c index d783c1dcfde..a6264632549 100644 --- a/source/blender/editors/armature/pose_select.c +++ b/source/blender/editors/armature/pose_select.c @@ -627,6 +627,13 @@ void POSE_OT_select_hierarchy(wmOperatorType *ot) /* -------------------------------------- */ +/* modes for select same */ +typedef enum ePose_SelectSame_Mode { + POSE_SEL_SAME_LAYER = 0, + POSE_SEL_SAME_GROUP = 1, + POSE_SEL_SAME_KEYINGSET = 2, +} ePose_SelectSame_Mode; + static bool pose_select_same_group(bContext *C, Object *ob, bool extend) { bArmature *arm = (ob) ? ob->data : NULL; @@ -785,6 +792,7 @@ static int pose_select_grouped_exec(bContext *C, wmOperator *op) { Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C)); bArmature *arm = (bArmature *)ob->data; + const ePose_SelectSame_Mode type = RNA_enum_get(op->ptr, "type"); const bool extend = RNA_boolean_get(op->ptr, "extend"); bool changed = false; @@ -792,18 +800,22 @@ static int pose_select_grouped_exec(bContext *C, wmOperator *op) if (ob->pose == NULL) return OPERATOR_CANCELLED; - /* selection types - * NOTE: for the order of these, see the enum in POSE_OT_select_grouped() - */ - switch (RNA_enum_get(op->ptr, "type")) { - case 1: /* group */ + /* selection types */ + switch (type) { + case POSE_SEL_SAME_LAYER: /* layer */ + changed = pose_select_same_layer(C, ob, extend); + break; + + case POSE_SEL_SAME_GROUP: /* group */ changed = pose_select_same_group(C, ob, extend); break; - case 2: /* Keying Set */ + + case POSE_SEL_SAME_KEYINGSET: /* Keying Set */ changed = pose_select_same_keyingset(C, ob, extend); break; - default: /* layer */ - changed = pose_select_same_layer(C, ob, extend); + + default: + printf("pose_select_grouped() - Unknown selection type %d\n", type); break; } @@ -825,9 +837,9 @@ static int pose_select_grouped_exec(bContext *C, wmOperator *op) void POSE_OT_select_grouped(wmOperatorType *ot) { static EnumPropertyItem prop_select_grouped_types[] = { - {0, "LAYER", 0, "Layer", "Shared layers"}, - {1, "GROUP", 0, "Group", "Shared group"}, - {2, "KEYINGSET", 0, "Keying Set", "All bones affected by active Keying Set"}, + {POSE_SEL_SAME_LAYER, "LAYER", 0, "Layer", "Shared layers"}, + {POSE_SEL_SAME_GROUP, "GROUP", 0, "Group", "Shared group"}, + {POSE_SEL_SAME_KEYINGSET, "KEYINGSET", 0, "Keying Set", "All bones affected by active Keying Set"}, {0, NULL, 0, NULL, NULL} }; |