Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-04-28 19:14:16 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-04-28 19:14:16 +0400
commitef054e165cad35715a5b2388aac3db68a65ea275 (patch)
tree0726e9c5a28962839a8d36ba4647f0b76fff7ad2 /source/blender/editors/armature
parent887d1533f81b0ee89975efd8162a011b99c976af (diff)
style cleanup: format 'for' loop macros the same as for loops, some renaming to BLI_array macros.
Diffstat (limited to 'source/blender/editors/armature')
-rw-r--r--source/blender/editors/armature/editarmature.c36
-rw-r--r--source/blender/editors/armature/editarmature_retarget.c2
-rw-r--r--source/blender/editors/armature/poseUtils.c6
-rw-r--r--source/blender/editors/armature/poseobject.c57
4 files changed, 37 insertions, 64 deletions
diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c
index c529ad66d73..cd698bbf09f 100644
--- a/source/blender/editors/armature/editarmature.c
+++ b/source/blender/editors/armature/editarmature.c
@@ -755,8 +755,7 @@ static int pose_visual_transform_apply_exec (bContext *C, wmOperator *UNUSED(op)
*
* TODO, loop over children before parents if multiple bones
* at once are to be predictable*/
- CTX_DATA_BEGIN(C, bPoseChannel *, pchan, selected_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel *, pchan, selected_pose_bones) {
float delta_mat[4][4];
/* chan_mat already contains the delta transform from rest pose to pose-mode pose
@@ -922,7 +921,7 @@ int join_armature_exec(bContext *C, wmOperator *UNUSED(op))
pose= ob->pose;
ob->mode &= ~OB_MODE_POSE;
- CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
+ CTX_DATA_BEGIN (C, Base*, base, selected_editable_bases) {
if ((base->object->type==OB_ARMATURE) && (base->object!=ob)) {
bArmature *curarm= base->object->data;
@@ -1193,7 +1192,7 @@ static int separate_armature_exec (bContext *C, wmOperator *UNUSED(op))
/* 1) only edit-base selected */
// TODO: use context iterators for this?
- CTX_DATA_BEGIN(C, Base *, base, visible_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, visible_bases) {
if (base->object==obedit) base->flag |= 1;
else base->flag &= ~1;
}
@@ -2816,8 +2815,7 @@ static int armature_fill_bones_exec (bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
/* loop over all bones, and only consider if visible */
- CTX_DATA_BEGIN(C, EditBone *, ebone, visible_bones)
- {
+ CTX_DATA_BEGIN (C, EditBone *, ebone, visible_bones) {
if (!(ebone->flag & BONE_CONNECTED) && (ebone->flag & BONE_ROOTSEL))
fill_add_joint(ebone, 0, &points);
if (ebone->flag & BONE_TIPSEL)
@@ -3530,8 +3528,7 @@ static int armature_subdivide_exec(bContext *C, wmOperator *op)
/* loop over all editable bones */
// XXX the old code did this in reverse order though!
- CTX_DATA_BEGIN(C, EditBone *, ebone, selected_editable_bones)
- {
+ CTX_DATA_BEGIN (C, EditBone *, ebone, selected_editable_bones) {
for (i=numcuts+1; i>1; i--) {
/* compute cut ratio first */
float cutratio= 1.0f / (float)i;
@@ -3819,7 +3816,7 @@ static int armature_parent_set_exec(bContext *C, wmOperator *op)
*/
/* parent selected bones to the active one */
- CTX_DATA_BEGIN(C, EditBone *, ebone, selected_editable_bones) {
+ CTX_DATA_BEGIN (C, EditBone *, ebone, selected_editable_bones) {
if (ELEM(ebone, actbone, actmirb) == 0) {
if (ebone->flag & BONE_SELECTED)
bone_connect_to_new_parent(arm->edbo, ebone, actbone, val);
@@ -3844,7 +3841,7 @@ static int armature_parent_set_invoke(bContext *C, wmOperator *UNUSED(op), wmEve
uiLayout *layout= uiPupMenuLayout(pup);
int allchildbones = 0;
- CTX_DATA_BEGIN(C, EditBone *, ebone, selected_editable_bones) {
+ CTX_DATA_BEGIN (C, EditBone *, ebone, selected_editable_bones) {
if (ebone != actbone) {
if (ebone->parent != actbone) allchildbones= 1;
}
@@ -3903,7 +3900,7 @@ static int armature_parent_clear_exec(bContext *C, wmOperator *op)
bArmature *arm= (bArmature *)ob->data;
int val = RNA_enum_get(op->ptr, "type");
- CTX_DATA_BEGIN(C, EditBone *, ebone, selected_editable_bones) {
+ CTX_DATA_BEGIN (C, EditBone *, ebone, selected_editable_bones) {
editbone_clear_parent(ebone, val);
}
CTX_DATA_END;
@@ -3939,7 +3936,7 @@ void ARMATURE_OT_parent_clear(wmOperatorType *ot)
static int armature_select_inverse_exec(bContext *C, wmOperator *UNUSED(op))
{
/* Set the flags */
- CTX_DATA_BEGIN(C, EditBone *, ebone, visible_bones) {
+ CTX_DATA_BEGIN (C, EditBone *, ebone, visible_bones) {
/* ignore bone if selection can't change */
if ((ebone->flag & BONE_UNSELECTABLE) == 0) {
/* select bone */
@@ -3981,7 +3978,7 @@ static int armature_de_select_all_exec(bContext *C, wmOperator *op)
}
/* Set the flags */
- CTX_DATA_BEGIN(C, EditBone *, ebone, visible_bones) {
+ CTX_DATA_BEGIN (C, EditBone *, ebone, visible_bones) {
/* ignore bone if selection can't change */
if ((ebone->flag & BONE_UNSELECTABLE) == 0) {
switch (action) {
@@ -4215,7 +4212,7 @@ static int armature_align_bones_exec(bContext *C, wmOperator *op)
*/
/* align selected bones to the active one */
- CTX_DATA_BEGIN(C, EditBone *, ebone, selected_editable_bones) {
+ CTX_DATA_BEGIN (C, EditBone *, ebone, selected_editable_bones) {
if (ELEM(ebone, actbone, actmirb) == 0) {
if (ebone->flag & BONE_SELECTED)
bone_align_to_bone(arm->edbo, ebone, actbone);
@@ -4904,8 +4901,7 @@ static int pose_clear_transform_generic_exec(bContext *C, wmOperator *op,
}
/* only clear relevant transforms for selected bones */
- CTX_DATA_BEGIN(C, bPoseChannel*, pchan, selected_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel*, pchan, selected_pose_bones) {
/* run provided clearing function */
clear_func(pchan);
@@ -5046,7 +5042,7 @@ static int pose_de_select_all_exec(bContext *C, wmOperator *op)
}
/* Set the flags */
- CTX_DATA_BEGIN(C, bPoseChannel *, pchan, visible_pose_bones) {
+ CTX_DATA_BEGIN (C, bPoseChannel *, pchan, visible_pose_bones) {
/* select pchan only if selectable, but deselect works always */
switch (action) {
case SEL_SELECT:
@@ -5435,8 +5431,7 @@ static int armature_flip_names_exec (bContext *C, wmOperator *UNUSED(op))
arm= ob->data;
/* loop through selected bones, auto-naming them */
- CTX_DATA_BEGIN(C, EditBone *, ebone, selected_editable_bones)
- {
+ CTX_DATA_BEGIN (C, EditBone *, ebone, selected_editable_bones) {
flip_side_name(newname, ebone->name, TRUE); // 1 = do strip off number extensions
ED_armature_bone_rename(arm, ebone->name, newname);
}
@@ -5480,8 +5475,7 @@ static int armature_autoside_names_exec (bContext *C, wmOperator *op)
arm= ob->data;
/* loop through selected bones, auto-naming them */
- CTX_DATA_BEGIN(C, EditBone *, ebone, selected_editable_bones)
- {
+ CTX_DATA_BEGIN (C, EditBone *, ebone, selected_editable_bones) {
BLI_strncpy(newname, ebone->name, sizeof(newname));
if (bone_autoside_name(newname, 1, axis, ebone->head[axis], ebone->tail[axis]))
ED_armature_bone_rename(arm, ebone->name, newname);
diff --git a/source/blender/editors/armature/editarmature_retarget.c b/source/blender/editors/armature/editarmature_retarget.c
index 7e4d76cb794..77b035024a9 100644
--- a/source/blender/editors/armature/editarmature_retarget.c
+++ b/source/blender/editors/armature/editarmature_retarget.c
@@ -2555,7 +2555,7 @@ void BIF_retargetArmature(bContext *C)
printf("Reeb Graph created\n");
- CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
+ CTX_DATA_BEGIN (C, Base*, base, selected_editable_bases) {
Object *ob = base->object;
if (ob->type==OB_ARMATURE) {
diff --git a/source/blender/editors/armature/poseUtils.c b/source/blender/editors/armature/poseUtils.c
index 1a9ff73e5dc..88d219137f7 100644
--- a/source/blender/editors/armature/poseUtils.c
+++ b/source/blender/editors/armature/poseUtils.c
@@ -131,8 +131,7 @@ void poseAnim_mapping_get (bContext *C, ListBase *pfLinks, Object *ob, bAction *
/* for each Pose-Channel which gets affected, get the F-Curves for that channel
* and set the relevant transform flags...
*/
- CTX_DATA_BEGIN(C, bPoseChannel*, pchan, selected_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel*, pchan, selected_pose_bones) {
fcurves_to_pchan_links_get(pfLinks, ob, act, pchan);
}
CTX_DATA_END;
@@ -141,8 +140,7 @@ void poseAnim_mapping_get (bContext *C, ListBase *pfLinks, Object *ob, bAction *
* i.e. if nothing selected, do whole pose
*/
if (pfLinks->first == NULL) {
- CTX_DATA_BEGIN(C, bPoseChannel*, pchan, visible_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel*, pchan, visible_pose_bones) {
fcurves_to_pchan_links_get(pfLinks, ob, act, pchan);
}
CTX_DATA_END;
diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c
index 043383d79a3..f54cdb330e3 100644
--- a/source/blender/editors/armature/poseobject.c
+++ b/source/blender/editors/armature/poseobject.c
@@ -216,8 +216,7 @@ static int pose_calculate_paths_exec (bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
/* set up path data for bones being calculated */
- CTX_DATA_BEGIN(C, bPoseChannel*, pchan, selected_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel*, pchan, selected_pose_bones) {
/* verify makes sure that the selected bone has a bone with the appropriate settings */
animviz_verify_motionpaths(op->reports, scene, ob, pchan);
}
@@ -324,8 +323,7 @@ static int pose_select_constraint_target_exec(bContext *C, wmOperator *UNUSED(op
bConstraint *con;
int found= 0;
- CTX_DATA_BEGIN(C, bPoseChannel *, pchan, visible_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel *, pchan, visible_pose_bones) {
if (pchan->bone->flag & BONE_SELECTED) {
for (con= pchan->constraints.first; con; con= con->next) {
bConstraintTypeInfo *cti= constraint_get_typeinfo(con);
@@ -387,8 +385,7 @@ static int pose_select_hierarchy_exec(bContext *C, wmOperator *op)
int add_to_sel = RNA_boolean_get(op->ptr, "extend");
int found= 0;
- CTX_DATA_BEGIN(C, bPoseChannel *, pchan, visible_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel *, pchan, visible_pose_bones) {
curbone= pchan->bone;
if ((curbone->flag & BONE_UNSELECTABLE)==0) {
@@ -505,8 +502,7 @@ static short pose_select_same_group (bContext *C, Object *ob, short extend)
*/
group_flags= MEM_callocN(numGroups+1, "pose_select_same_group");
- CTX_DATA_BEGIN(C, bPoseChannel *, pchan, visible_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel *, pchan, visible_pose_bones) {
/* keep track of group as group to use later? */
if (pchan->bone->flag & BONE_SELECTED) {
group_flags[pchan->agrp_index] = 1;
@@ -522,8 +518,7 @@ static short pose_select_same_group (bContext *C, Object *ob, short extend)
/* small optimization: only loop through bones a second time if there are any groups tagged */
if (tagged) {
/* only if group matches (and is not selected or current bone) */
- CTX_DATA_BEGIN(C, bPoseChannel *, pchan, visible_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel *, pchan, visible_pose_bones) {
if ((pchan->bone->flag & BONE_UNSELECTABLE)==0) {
/* check if the group used by this bone is counted */
if (group_flags[pchan->agrp_index]) {
@@ -552,8 +547,7 @@ static short pose_select_same_layer (bContext *C, Object *ob, short extend)
return 0;
/* figure out what bones are selected */
- CTX_DATA_BEGIN(C, bPoseChannel *, pchan, visible_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel *, pchan, visible_pose_bones) {
/* keep track of layers to use later? */
if (pchan->bone->flag & BONE_SELECTED)
layers |= pchan->bone->layer;
@@ -567,8 +561,7 @@ static short pose_select_same_layer (bContext *C, Object *ob, short extend)
return 0;
/* select bones that are on same layers as layers flag */
- CTX_DATA_BEGIN(C, bPoseChannel *, pchan, visible_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel *, pchan, visible_pose_bones) {
/* if bone is on a suitable layer, and the bone can have its selection changed, select it */
if ((layers & pchan->bone->layer) && (pchan->bone->flag & BONE_UNSELECTABLE)==0) {
pchan->bone->flag |= BONE_SELECTED;
@@ -598,8 +591,7 @@ static int pose_select_same_keyingset(bContext *C, Object *ob, short extend)
/* if not extending selection, deselect all selected first */
if (extend == 0) {
- CTX_DATA_BEGIN(C, bPoseChannel *, pchan, visible_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel *, pchan, visible_pose_bones) {
if ((pchan->bone->flag & BONE_UNSELECTABLE)==0)
pchan->bone->flag &= ~BONE_SELECTED;
}
@@ -1403,8 +1395,7 @@ static int pose_group_assign_exec (bContext *C, wmOperator *op)
pose_add_group(ob);
/* add selected bones to group then */
- CTX_DATA_BEGIN(C, bPoseChannel*, pchan, selected_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel*, pchan, selected_pose_bones) {
pchan->agrp_index= pose->active_group;
done= 1;
}
@@ -1457,8 +1448,7 @@ static int pose_group_unassign_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_CANCELLED;
/* find selected bones to remove from all bone groups */
- CTX_DATA_BEGIN(C, bPoseChannel*, pchan, selected_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel*, pchan, selected_pose_bones) {
if (pchan->agrp_index) {
pchan->agrp_index= 0;
done= 1;
@@ -1660,8 +1650,7 @@ static void pose_group_select(bContext *C, Object *ob, int select)
{
bPose *pose= ob->pose;
- CTX_DATA_BEGIN(C, bPoseChannel*, pchan, visible_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel*, pchan, visible_pose_bones) {
if ((pchan->bone->flag & BONE_UNSELECTABLE)==0) {
if (select) {
if (pchan->agrp_index == pose->active_group)
@@ -1765,8 +1754,7 @@ static int pose_flip_names_exec (bContext *C, wmOperator *UNUSED(op))
arm= ob->data;
/* loop through selected bones, auto-naming them */
- CTX_DATA_BEGIN(C, bPoseChannel*, pchan, selected_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel*, pchan, selected_pose_bones) {
char newname[MAXBONENAME];
flip_side_name(newname, pchan->name, TRUE);
ED_armature_bone_rename(arm, pchan->name, newname);
@@ -1812,8 +1800,7 @@ static int pose_autoside_names_exec (bContext *C, wmOperator *op)
arm= ob->data;
/* loop through selected bones, auto-naming them */
- CTX_DATA_BEGIN(C, bPoseChannel*, pchan, selected_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel*, pchan, selected_pose_bones) {
BLI_strncpy(newname, pchan->name, sizeof(newname));
if (bone_autoside_name(newname, 1, axis, pchan->bone->head[axis], pchan->bone->tail[axis]))
ED_armature_bone_rename(arm, pchan->name, newname);
@@ -1862,8 +1849,7 @@ static int pose_bone_rotmode_exec (bContext *C, wmOperator *op)
int mode = RNA_enum_get(op->ptr, "type");
/* set rotation mode of selected bones */
- CTX_DATA_BEGIN(C, bPoseChannel *, pchan, selected_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel *, pchan, selected_pose_bones) {
pchan->rotmode = mode;
}
CTX_DATA_END;
@@ -2046,8 +2032,7 @@ static int pose_bone_layers_invoke (bContext *C, wmOperator *op, wmEvent *evt)
int layers[32]= {0}; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
/* get layers that are active already */
- CTX_DATA_BEGIN(C, bPoseChannel *, pchan, selected_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel *, pchan, selected_pose_bones) {
short bit;
/* loop over the bits for this pchan's layers, adding layers where they're needed */
@@ -2080,8 +2065,7 @@ static int pose_bone_layers_exec (bContext *C, wmOperator *op)
RNA_boolean_get_array(op->ptr, "layers", layers);
/* set layers of pchans based on the values set in the operator props */
- CTX_DATA_BEGIN(C, bPoseChannel *, pchan, selected_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel *, pchan, selected_pose_bones) {
/* get pointer for pchan, and write flags this way */
RNA_pointer_create((ID *)ob->data, &RNA_Bone, pchan->bone, &ptr);
RNA_boolean_set_array(&ptr, "layers", layers);
@@ -2121,8 +2105,7 @@ static int armature_bone_layers_invoke (bContext *C, wmOperator *op, wmEvent *ev
int layers[32]= {0}; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
/* get layers that are active already */
- CTX_DATA_BEGIN(C, EditBone *, ebone, selected_editable_bones)
- {
+ CTX_DATA_BEGIN (C, EditBone *, ebone, selected_editable_bones) {
short bit;
/* loop over the bits for this pchan's layers, adding layers where they're needed */
@@ -2152,8 +2135,7 @@ static int armature_bone_layers_exec (bContext *C, wmOperator *op)
RNA_boolean_get_array(op->ptr, "layers", layers);
/* set layers of pchans based on the values set in the operator props */
- CTX_DATA_BEGIN(C, EditBone *, ebone, selected_editable_bones)
- {
+ CTX_DATA_BEGIN (C, EditBone *, ebone, selected_editable_bones) {
/* get pointer for pchan, and write flags this way */
RNA_pointer_create((ID *)arm, &RNA_EditBone, ebone, &ptr);
RNA_boolean_set_array(&ptr, "layers", layers);
@@ -2195,8 +2177,7 @@ static int pose_flip_quats_exec (bContext *C, wmOperator *UNUSED(op))
KeyingSet *ks = ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_LOC_ROT_SCALE_ID);
/* loop through all selected pchans, flipping and keying (as needed) */
- CTX_DATA_BEGIN(C, bPoseChannel*, pchan, selected_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel*, pchan, selected_pose_bones) {
/* only if bone is using quaternion rotation */
if (pchan->rotmode == ROT_MODE_QUAT) {
/* quaternions have 720 degree range */