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:
Diffstat (limited to 'source/blender/editors/armature')
-rw-r--r--source/blender/editors/armature/armature_ops.c6
-rw-r--r--source/blender/editors/armature/editarmature.c222
-rw-r--r--source/blender/editors/armature/editarmature_retarget.c20
-rw-r--r--source/blender/editors/armature/editarmature_sketch.c6
-rw-r--r--source/blender/editors/armature/meshlaplacian.c450
-rw-r--r--source/blender/editors/armature/poseSlide.c2
-rw-r--r--source/blender/editors/armature/poseobject.c36
-rw-r--r--source/blender/editors/armature/reeb.c132
8 files changed, 437 insertions, 437 deletions
diff --git a/source/blender/editors/armature/armature_ops.c b/source/blender/editors/armature/armature_ops.c
index 4155f76e515..21b97188522 100644
--- a/source/blender/editors/armature/armature_ops.c
+++ b/source/blender/editors/armature/armature_ops.c
@@ -171,7 +171,7 @@ void ED_operatormacros_armature(void)
wmOperatorTypeMacro *otmacro;
ot = WM_operatortype_append_macro("ARMATURE_OT_duplicate_move", "Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER);
- if(ot) {
+ if (ot) {
ot->description = "Make copies of the selected bones within the same armature and move them";
WM_operatortype_macro_define(ot, "ARMATURE_OT_duplicate");
otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
@@ -179,7 +179,7 @@ void ED_operatormacros_armature(void)
}
ot = WM_operatortype_append_macro("ARMATURE_OT_extrude_move", "Extrude", OPTYPE_UNDO|OPTYPE_REGISTER);
- if(ot) {
+ if (ot) {
ot->description = "Create new bones from the selected joints and move them";
otmacro=WM_operatortype_macro_define(ot, "ARMATURE_OT_extrude");
RNA_boolean_set(otmacro->ptr, "forked", FALSE);
@@ -190,7 +190,7 @@ void ED_operatormacros_armature(void)
// XXX would it be nicer to just be able to have standard extrude_move, but set the forked property separate?
// that would require fixing a properties bug 19733
ot = WM_operatortype_append_macro("ARMATURE_OT_extrude_forked", "Extrude Forked", OPTYPE_UNDO|OPTYPE_REGISTER);
- if(ot) {
+ if (ot) {
ot->description = "Create new bones from the selected joints and move them";
otmacro=WM_operatortype_macro_define(ot, "ARMATURE_OT_extrude");
RNA_boolean_set(otmacro->ptr, "forked", TRUE);
diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c
index 71c0e41ee33..4090fc1acaa 100644
--- a/source/blender/editors/armature/editarmature.c
+++ b/source/blender/editors/armature/editarmature.c
@@ -123,18 +123,18 @@ void ED_armature_validate_active(struct bArmature *arm)
{
EditBone *ebone= arm->act_edbone;
- if(ebone) {
- if(ebone->flag & BONE_HIDDEN_A)
+ if (ebone) {
+ if (ebone->flag & BONE_HIDDEN_A)
arm->act_edbone= NULL;
}
}
static void bone_free(bArmature *arm, EditBone *bone)
{
- if(arm->act_edbone==bone)
+ if (arm->act_edbone==bone)
arm->act_edbone= NULL;
- if(bone->prop) {
+ if (bone->prop) {
IDP_FreeProperty(bone->prop);
MEM_freeN(bone->prop);
}
@@ -275,9 +275,9 @@ EditBone *make_boneList(ListBase *edbo, ListBase *bones, EditBone *parent, Bone
else {
/* if the bone is not selected, but connected to its parent
* copy the parents tip selection state */
- if(eBone->parent && (eBone->flag & BONE_CONNECTED)) {
+ if (eBone->parent && (eBone->flag & BONE_CONNECTED)) {
/* selecting with the mouse gives this behavior */
- if(eBone->parent->flag & BONE_TIPSEL) {
+ if (eBone->parent->flag & BONE_TIPSEL) {
eBone->flag |= BONE_ROOTSEL;
}
else {
@@ -306,7 +306,7 @@ EditBone *make_boneList(ListBase *edbo, ListBase *bones, EditBone *parent, Bone
eBone->segments = curBone->segments;
eBone->layer = curBone->layer;
- if(curBone->prop)
+ if (curBone->prop)
eBone->prop= IDP_CopyProperty(curBone->prop);
BLI_addtail(edbo, eBone);
@@ -314,11 +314,11 @@ EditBone *make_boneList(ListBase *edbo, ListBase *bones, EditBone *parent, Bone
/* Add children if necessary */
if (curBone->childbase.first) {
eBoneTest= make_boneList(edbo, &curBone->childbase, eBone, actBone);
- if(eBoneTest)
+ if (eBoneTest)
eBoneAct= eBoneTest;
}
- if(curBone==actBone)
+ if (curBone==actBone)
eBoneAct= eBone;
}
@@ -434,7 +434,7 @@ void ED_armature_from_edit(Object *obedit)
newBone->segments= eBone->segments;
newBone->layer = eBone->layer;
- if(eBone->prop)
+ if (eBone->prop)
newBone->prop= IDP_CopyProperty(eBone->prop);
}
@@ -542,7 +542,7 @@ void docenter_armature (Scene *scene, Object *ob, float cursor[3], int centermod
float cent[3];
/* Put the armature into editmode */
- if(ob != obedit) {
+ if (ob != obedit) {
ED_armature_to_edit(ob);
obedit= NULL; /* we cant use this so behave as if there is no obedit */
}
@@ -554,7 +554,7 @@ void docenter_armature (Scene *scene, Object *ob, float cursor[3], int centermod
mul_m4_v3(ob->imat, cent);
}
else {
- if(around==V3D_CENTROID) {
+ if (around==V3D_CENTROID) {
int total= 0;
zero_v3(cent);
for (ebone= arm->edbo->first; ebone; ebone=ebone->next) {
@@ -582,13 +582,13 @@ void docenter_armature (Scene *scene, Object *ob, float cursor[3], int centermod
}
/* Turn the list into an armature */
- if(obedit==NULL) {
+ if (obedit==NULL) {
ED_armature_from_edit(ob);
ED_armature_edit_free(ob);
}
/* Adjust object location for new centerpoint */
- if(centermode && obedit==NULL) {
+ if (centermode && obedit==NULL) {
mul_mat3_m4_v3(ob->obmat, cent); /* ommit translation part */
add_v3_v3(ob->loc, cent);
}
@@ -1043,12 +1043,12 @@ static void separated_armature_fix_links(Object *origArm, Object *newArm)
*/
if (ct->subtarget[0] != 0) {
if (ct->tar == origArm) {
- if(BLI_findstring(npchans, ct->subtarget, offsetof(bPoseChannel, name))) {
+ if (BLI_findstring(npchans, ct->subtarget, offsetof(bPoseChannel, name))) {
ct->tar= newArm;
}
}
else if (ct->tar == newArm) {
- if(BLI_findstring(opchans, ct->subtarget, offsetof(bPoseChannel, name))) {
+ if (BLI_findstring(opchans, ct->subtarget, offsetof(bPoseChannel, name))) {
ct->tar= origArm;
}
}
@@ -1079,14 +1079,14 @@ static void separated_armature_fix_links(Object *origArm, Object *newArm)
* - the target isn't origArm/newArm itself
* - the target is one that can be found in newArm/origArm
*/
- if(ct->subtarget[0] != '\0') {
+ if (ct->subtarget[0] != '\0') {
if (ct->tar == origArm) {
- if(BLI_findstring(npchans, ct->subtarget, offsetof(bPoseChannel, name))) {
+ if (BLI_findstring(npchans, ct->subtarget, offsetof(bPoseChannel, name))) {
ct->tar= newArm;
}
}
else if (ct->tar == newArm) {
- if(BLI_findstring(opchans, ct->subtarget, offsetof(bPoseChannel, name))) {
+ if (BLI_findstring(opchans, ct->subtarget, offsetof(bPoseChannel, name))) {
ct->tar= origArm;
}
}
@@ -1104,7 +1104,7 @@ static void separated_armature_fix_links(Object *origArm, Object *newArm)
if (ob->parent && (ob->parent == origArm)) {
/* Is object parented to a bone of this src armature? */
if ((ob->partype == PARBONE) && (ob->parsubstr[0] != '\0')) {
- if(BLI_findstring(npchans, ob->parsubstr, offsetof(bPoseChannel, name))) {
+ if (BLI_findstring(npchans, ob->parsubstr, offsetof(bPoseChannel, name))) {
ob->parent= newArm;
}
}
@@ -1263,7 +1263,7 @@ void ARMATURE_OT_separate (wmOperatorType *ot)
Bone *get_indexed_bone (Object *ob, int index)
{
bPoseChannel *pchan;
- if(ob->pose==NULL) return NULL;
+ if (ob->pose==NULL) return NULL;
index>>=16; // bone selection codes use left 2 bytes
pchan= BLI_findlink(&ob->pose->chanbase, index);
@@ -1281,17 +1281,17 @@ static void *get_bone_from_selectbuffer(Scene *scene, Base *base, unsigned int *
unsigned int hitresult;
short i, takeNext=0, sel;
- for (i=0; i< hits; i++){
+ for (i=0; i< hits; i++) {
hitresult = buffer[3+(i*4)];
if (!(hitresult & BONESEL_NOSEL)) { // -1
- if(hitresult & BONESEL_ANY) { // to avoid including objects in selection
+ if (hitresult & BONESEL_ANY) { // to avoid including objects in selection
hitresult &= ~(BONESEL_ANY);
/* Determine what the current bone is */
if (obedit==NULL || base->object!=obedit) {
/* no singular posemode, so check for correct object */
- if(base->selcol == (hitresult & 0xFFFF)) {
+ if (base->selcol == (hitresult & 0xFFFF)) {
bone = get_indexed_bone(base->object, hitresult);
if (findunsel)
@@ -1306,7 +1306,7 @@ static void *get_bone_from_selectbuffer(Scene *scene, Base *base, unsigned int *
sel= 0;
}
}
- else{
+ else {
bArmature *arm= obedit->data;
ebone = BLI_findlink(arm->edbo, hitresult);
@@ -1318,9 +1318,9 @@ static void *get_bone_from_selectbuffer(Scene *scene, Base *base, unsigned int *
data = ebone;
}
- if(data) {
+ if (data) {
if (sel) {
- if(!firstSel) firstSel= data;
+ if (!firstSel) firstSel= data;
takeNext=1;
}
else {
@@ -1430,7 +1430,7 @@ static int pose_select_connected_invoke(bContext *C, wmOperator *op, wmEvent *ev
return OPERATOR_CANCELLED;
/* Select parents */
- for (curBone=bone; curBone; curBone=next){
+ for (curBone=bone; curBone; curBone=next) {
/* ignore bone if cannot be selected */
if ((curBone->flag & BONE_UNSELECTABLE) == 0) {
// XXX old cruft! use notifiers instead
@@ -1512,7 +1512,7 @@ static int armature_select_linked_invoke(bContext *C, wmOperator *op, wmEvent *e
if (extend) {
curBone->flag &= ~(BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL);
}
- else{
+ else {
curBone->flag |= (BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL);
}
}
@@ -1596,7 +1596,7 @@ static EditBone *get_nearest_editbonepoint (ViewContext *vc, const int mval[2],
rect.ymax = mval[1]+5;
hits= view3d_opengl_select(vc, buffer, MAXPICKBUF, &rect);
- if(hits==0) {
+ if (hits==0) {
rect.xmin = mval[0]-12;
rect.xmax = mval[0]+12;
rect.ymin = mval[1]-12;
@@ -1606,7 +1606,7 @@ static EditBone *get_nearest_editbonepoint (ViewContext *vc, const int mval[2],
/* See if there are any selected bones in this group */
if (hits>0) {
- if(hits==1) {
+ if (hits==1) {
if (!(buffer[3] & BONESEL_NOSEL))
besthitresult= buffer[3];
}
@@ -1619,12 +1619,12 @@ static EditBone *get_nearest_editbonepoint (ViewContext *vc, const int mval[2],
ebone = BLI_findlink(edbo, hitresult & ~BONESEL_ANY);
/* clicks on bone points get advantage */
- if( hitresult & (BONESEL_ROOT|BONESEL_TIP)) {
+ if ( hitresult & (BONESEL_ROOT|BONESEL_TIP)) {
/* but also the unselected one */
- if(findunsel) {
- if( (hitresult & BONESEL_ROOT) && (ebone->flag & BONE_ROOTSEL)==0)
+ if (findunsel) {
+ if ( (hitresult & BONESEL_ROOT) && (ebone->flag & BONE_ROOTSEL)==0)
dep= 1;
- else if( (hitresult & BONESEL_TIP) && (ebone->flag & BONE_TIPSEL)==0)
+ else if ( (hitresult & BONESEL_TIP) && (ebone->flag & BONE_TIPSEL)==0)
dep= 1;
else
dep= 2;
@@ -1633,15 +1633,15 @@ static EditBone *get_nearest_editbonepoint (ViewContext *vc, const int mval[2],
}
else {
/* bone found */
- if(findunsel) {
- if((ebone->flag & BONE_SELECTED)==0)
+ if (findunsel) {
+ if ((ebone->flag & BONE_SELECTED)==0)
dep= 2;
else
dep= 3;
}
else dep= 3;
}
- if(dep < mindep) {
+ if (dep < mindep) {
mindep= dep;
besthitresult= hitresult;
}
@@ -1729,7 +1729,7 @@ static int armature_delete_selected_exec(bContext *C, wmOperator *UNUSED(op))
ebone_next= curBone->next;
if (arm->layer & curBone->layer) {
if (curBone->flag & BONE_SELECTED) {
- if(curBone==arm->act_edbone) arm->act_edbone= NULL;
+ if (curBone==arm->act_edbone) arm->act_edbone= NULL;
ED_armature_edit_bone_remove(arm, curBone);
}
}
@@ -1769,12 +1769,12 @@ void ED_armature_deselect_all(Object *obedit, int toggle)
EditBone *eBone;
int sel=1;
- if(toggle==1) {
+ if (toggle==1) {
/* Determine if there are any selected bones
* and therefore whether we are selecting or deselecting */
- for (eBone=arm->edbo->first;eBone;eBone=eBone->next){
- // if(arm->layer & eBone->layer) {
- if (eBone->flag & (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL)){
+ for (eBone=arm->edbo->first;eBone;eBone=eBone->next) {
+ // if (arm->layer & eBone->layer) {
+ if (eBone->flag & (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL)) {
sel=0;
break;
}
@@ -1787,24 +1787,24 @@ void ED_armature_deselect_all(Object *obedit, int toggle)
for (eBone=arm->edbo->first;eBone;eBone=eBone->next) {
if (sel==2) {
/* invert selection of bone */
- if(EBONE_VISIBLE(arm, eBone)) {
+ if (EBONE_VISIBLE(arm, eBone)) {
eBone->flag ^= (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
- if(arm->act_edbone==eBone)
+ if (arm->act_edbone==eBone)
arm->act_edbone= NULL;
}
}
else if (sel==1) {
/* select bone */
- if(EBONE_VISIBLE(arm, eBone)) {
+ if (EBONE_VISIBLE(arm, eBone)) {
eBone->flag |= (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
- if(eBone->parent)
+ if (eBone->parent)
eBone->parent->flag |= (BONE_TIPSEL);
}
}
else {
/* deselect bone */
eBone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
- if(arm->act_edbone==eBone)
+ if (arm->act_edbone==eBone)
arm->act_edbone= NULL;
}
}
@@ -1830,7 +1830,7 @@ void ED_armature_deselect_all_visible(Object *obedit)
/* accounts for connected parents */
static int ebone_select_flag(EditBone *ebone)
{
- if(ebone->parent && (ebone->flag & BONE_CONNECTED)) {
+ if (ebone->parent && (ebone->flag & BONE_CONNECTED)) {
return ((ebone->parent->flag & BONE_TIPSEL) ? BONE_ROOTSEL : 0) | (ebone->flag & (BONE_SELECTED|BONE_TIPSEL));
}
else {
@@ -1860,16 +1860,16 @@ int mouse_armature(bContext *C, const int mval[2], int extend)
/* by definition the non-root connected bones have no root point drawn,
* so a root selection needs to be delivered to the parent tip */
- if(selmask & BONE_SELECTED) {
- if(nearBone->parent && (nearBone->flag & BONE_CONNECTED)) {
+ if (selmask & BONE_SELECTED) {
+ if (nearBone->parent && (nearBone->flag & BONE_CONNECTED)) {
/* click in a chain */
- if(extend) {
+ if (extend) {
/* hold shift inverts this bone's selection */
- if(nearBone->flag & BONE_SELECTED) {
+ if (nearBone->flag & BONE_SELECTED) {
/* deselect this bone */
nearBone->flag &= ~(BONE_TIPSEL|BONE_SELECTED);
/* only deselect parent tip if it is not selected */
- if(!(nearBone->parent->flag & BONE_SELECTED))
+ if (!(nearBone->parent->flag & BONE_SELECTED))
nearBone->parent->flag &= ~BONE_TIPSEL;
}
else {
@@ -1885,9 +1885,9 @@ int mouse_armature(bContext *C, const int mval[2], int extend)
}
}
else {
- if(extend) {
+ if (extend) {
/* hold shift inverts this bone's selection */
- if(nearBone->flag & BONE_SELECTED)
+ if (nearBone->flag & BONE_SELECTED)
nearBone->flag &= ~(BONE_TIPSEL|BONE_ROOTSEL);
else
nearBone->flag |= (BONE_TIPSEL|BONE_ROOTSEL);
@@ -1904,9 +1904,9 @@ int mouse_armature(bContext *C, const int mval[2], int extend)
ED_armature_sync_selection(arm->edbo);
- if(nearBone) {
+ if (nearBone) {
/* then now check for active status */
- if(ebone_select_flag(nearBone)) {
+ if (ebone_select_flag(nearBone)) {
arm->act_edbone= nearBone;
}
}
@@ -1966,15 +1966,15 @@ float ED_rollBoneToVector(EditBone *bone, const float align_axis[3], const short
vec_roll_to_mat3(nor, 0.0f, mat);
/* check the bone isn't aligned with the axis */
- if(!is_zero_v3(align_axis) && angle_v3v3(align_axis, mat[2]) > FLT_EPSILON) {
+ if (!is_zero_v3(align_axis) && angle_v3v3(align_axis, mat[2]) > FLT_EPSILON) {
float vec[3], align_axis_proj[3], roll;
/* project the new_up_axis along the normal */
project_v3_v3v3(vec, align_axis, nor);
sub_v3_v3v3(align_axis_proj, align_axis, vec);
- if(axis_only) {
- if(angle_v3v3(align_axis_proj, mat[2]) > (float)(M_PI/2.0)) {
+ if (axis_only) {
+ if (angle_v3v3(align_axis_proj, mat[2]) > (float)(M_PI/2.0)) {
negate_v3(align_axis_proj);
}
}
@@ -2020,7 +2020,7 @@ static int armature_calc_roll_exec(bContext *C, wmOperator *op)
copy_m3_m4(imat, ob->obmat);
invert_m3(imat);
- if(type==7) { /* Cursor */
+ if (type==7) { /* Cursor */
Scene *scene= CTX_data_scene(C);
View3D *v3d= CTX_wm_view3d(C); /* can be NULL */
float cursor_local[3];
@@ -2031,20 +2031,20 @@ static int armature_calc_roll_exec(bContext *C, wmOperator *op)
mul_m3_v3(imat, cursor_local);
/* cursor */
- for(ebone= arm->edbo->first; ebone; ebone= ebone->next) {
- if(EBONE_VISIBLE(arm, ebone) && EBONE_EDITABLE(ebone)) {
+ for (ebone= arm->edbo->first; ebone; ebone= ebone->next) {
+ if (EBONE_VISIBLE(arm, ebone) && EBONE_EDITABLE(ebone)) {
float cursor_rel[3];
sub_v3_v3v3(cursor_rel, cursor_local, ebone->head);
- if(axis_flip) negate_v3(cursor_rel);
+ if (axis_flip) negate_v3(cursor_rel);
ebone->roll= ED_rollBoneToVector(ebone, cursor_rel, axis_only);
}
}
}
else {
float vec[3]= {0.0f, 0.0f, 0.0f};
- if(type==6) { /* View */
+ if (type==6) { /* View */
RegionView3D *rv3d= CTX_wm_region_view3d(C);
- if(rv3d==NULL) {
+ if (rv3d==NULL) {
BKE_report(op->reports, RPT_ERROR, "No region view3d available");
return OPERATOR_CANCELLED;
}
@@ -2055,7 +2055,7 @@ static int armature_calc_roll_exec(bContext *C, wmOperator *op)
else if (type==5) {
float mat[3][3], nor[3];
ebone= (EditBone *)arm->act_edbone;
- if(ebone==NULL) {
+ if (ebone==NULL) {
BKE_report(op->reports, RPT_ERROR, "No active bone set");
return OPERATOR_CANCELLED;
}
@@ -2066,15 +2066,15 @@ static int armature_calc_roll_exec(bContext *C, wmOperator *op)
}
else { /* Axis */
assert(type >= 0 && type <= 5);
- if(type<3) vec[type]= 1.0f;
+ if (type<3) vec[type]= 1.0f;
else vec[type-2]= -1.0f;
mul_m3_v3(imat, vec);
}
- if(axis_flip) negate_v3(vec);
+ if (axis_flip) negate_v3(vec);
- for(ebone= arm->edbo->first; ebone; ebone= ebone->next) {
- if(EBONE_VISIBLE(arm, ebone) && EBONE_EDITABLE(ebone)) {
+ for (ebone= arm->edbo->first; ebone; ebone= ebone->next) {
+ if (EBONE_VISIBLE(arm, ebone) && EBONE_EDITABLE(ebone)) {
/* roll func is a callback which assumes that all is well */
ebone->roll= ED_rollBoneToVector(ebone, vec, axis_only);
}
@@ -2082,8 +2082,8 @@ static int armature_calc_roll_exec(bContext *C, wmOperator *op)
}
if (arm->flag & ARM_MIRROR_EDIT) {
- for(ebone= arm->edbo->first; ebone; ebone= ebone->next) {
- if((EBONE_VISIBLE(arm, ebone) && EBONE_EDITABLE(ebone)) == 0) {
+ for (ebone= arm->edbo->first; ebone; ebone= ebone->next) {
+ if ((EBONE_VISIBLE(arm, ebone) && EBONE_EDITABLE(ebone)) == 0) {
EditBone *ebone_mirr= ED_armature_bone_get_mirrored(arm->edbo, ebone);
if (ebone_mirr && (EBONE_VISIBLE(arm, ebone_mirr) && EBONE_EDITABLE(ebone_mirr))) {
ebone->roll= -ebone_mirr->roll;
@@ -2135,14 +2135,14 @@ static void undoBones_to_editBones(void *uarmv, void *armv, void *UNUSED(data))
BLI_freelistN(arm->edbo);
/* copy */
- for(ebo= uarm->lb.first; ebo; ebo= ebo->next) {
+ for (ebo= uarm->lb.first; ebo; ebo= ebo->next) {
newebo= MEM_dupallocN(ebo);
ebo->temp= newebo;
BLI_addtail(arm->edbo, newebo);
}
/* active bone */
- if(uarm->act_edbone) {
+ if (uarm->act_edbone) {
ebo= uarm->act_edbone;
arm->act_edbone= ebo->temp;
}
@@ -2150,11 +2150,11 @@ static void undoBones_to_editBones(void *uarmv, void *armv, void *UNUSED(data))
arm->act_edbone= NULL;
/* set pointers */
- for(newebo= arm->edbo->first; newebo; newebo= newebo->next) {
- if(newebo->parent) newebo->parent= newebo->parent->temp;
+ for (newebo= arm->edbo->first; newebo; newebo= newebo->next) {
+ if (newebo->parent) newebo->parent= newebo->parent->temp;
}
/* be sure they don't hang ever */
- for(newebo= arm->edbo->first; newebo; newebo= newebo->next) {
+ for (newebo= arm->edbo->first; newebo; newebo= newebo->next) {
newebo->temp= NULL;
}
}
@@ -2168,21 +2168,21 @@ static void *editBones_to_undoBones(void *armv, void *UNUSED(obdata))
uarm= MEM_callocN(sizeof(UndoArmature), "listbase undo");
/* copy */
- for(ebo= arm->edbo->first; ebo; ebo= ebo->next) {
+ for (ebo= arm->edbo->first; ebo; ebo= ebo->next) {
newebo= MEM_dupallocN(ebo);
ebo->temp= newebo;
BLI_addtail(&uarm->lb, newebo);
}
/* active bone */
- if(arm->act_edbone) {
+ if (arm->act_edbone) {
ebo= arm->act_edbone;
uarm->act_edbone= ebo->temp;
}
/* set pointers */
- for(newebo= uarm->lb.first; newebo; newebo= newebo->next) {
- if(newebo->parent) newebo->parent= newebo->parent->temp;
+ for (newebo= uarm->lb.first; newebo; newebo= newebo->next) {
+ if (newebo->parent) newebo->parent= newebo->parent->temp;
}
return uarm;
@@ -2199,7 +2199,7 @@ static void free_undoBones(void *uarmv)
static void *get_armature_edit(bContext *C)
{
Object *obedit= CTX_data_edit_object(C);
- if(obedit && obedit->type==OB_ARMATURE) {
+ if (obedit && obedit->type==OB_ARMATURE) {
return obedit->data;
}
return NULL;
@@ -2541,7 +2541,7 @@ EditBone *duplicateEditBoneObjects(EditBone *curBone, const char *name, ListBase
BLI_addtail(editbones, eBone);
/* copy the ID property */
- if(curBone->prop)
+ if (curBone->prop)
eBone->prop= IDP_CopyProperty(curBone->prop);
/* Lets duplicate the list of constraints that the
@@ -2557,7 +2557,7 @@ EditBone *duplicateEditBoneObjects(EditBone *curBone, const char *name, ListBase
*/
channew= verify_pose_channel(dst_ob->pose, eBone->name);
- if(channew) {
+ if (channew) {
duplicate_pose_channel_data(channew, chanold);
}
}
@@ -2653,9 +2653,9 @@ static int armature_duplicate_selected_exec(bContext *C, wmOperator *UNUSED(op))
}
/* correct the active bone */
- if(arm->act_edbone) {
+ if (arm->act_edbone) {
eBone= arm->act_edbone;
- if(eBone->temp)
+ if (eBone->temp)
arm->act_edbone= eBone->temp;
}
@@ -3205,7 +3205,7 @@ static int armature_reveal_exec(bContext *C, wmOperator *UNUSED(op))
EditBone *ebone;
for (ebone = arm->edbo->first; ebone; ebone=ebone->next) {
- if(arm->layer & ebone->layer) {
+ if (arm->layer & ebone->layer) {
if (ebone->flag & BONE_HIDDEN_A) {
ebone->flag |= (BONE_TIPSEL|BONE_SELECTED|BONE_ROOTSEL);
ebone->flag &= ~BONE_HIDDEN_A;
@@ -3281,7 +3281,7 @@ void show_all_armature_bones(Scene *scene)
EditBone *ebone;
for (ebone = arm->edbo->first; ebone; ebone=ebone->next) {
- if(arm->layer & ebone->layer) {
+ if (arm->layer & ebone->layer) {
if (ebone->flag & BONE_HIDDEN_A) {
ebone->flag |= (BONE_TIPSEL|BONE_SELECTED|BONE_ROOTSEL);
ebone->flag &= ~BONE_HIDDEN_A;
@@ -3481,7 +3481,7 @@ static int armature_bone_primitive_add_exec(bContext *C, wmOperator *op)
copy_v3_v3(bone->head, curs);
- if(rv3d && (U.flag & USER_ADD_VIEWALIGNED))
+ if (rv3d && (U.flag & USER_ADD_VIEWALIGNED))
add_v3_v3v3(bone->tail, bone->head, imat[1]); // bone with unit length 1
else
add_v3_v3v3(bone->tail, bone->head, imat[2]); // bone with unit length 1, pointing up Z
@@ -3988,7 +3988,7 @@ static int armature_de_select_all_exec(bContext *C, wmOperator *op)
switch (action) {
case SEL_SELECT:
ebone->flag |= (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
- if(ebone->parent)
+ if (ebone->parent)
ebone->parent->flag |= (BONE_TIPSEL);
break;
case SEL_DESELECT:
@@ -4000,7 +4000,7 @@ static int armature_de_select_all_exec(bContext *C, wmOperator *op)
}
else {
ebone->flag |= (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
- if(ebone->parent)
+ if (ebone->parent)
ebone->parent->flag |= (BONE_TIPSEL);
}
break;
@@ -4312,7 +4312,7 @@ int ED_do_pose_selectbuffer(Scene *scene, Base *base, unsigned int *buffer, shor
else {
if (nearBone->flag & BONE_SELECTED) {
/* if not active, we make it active */
- if(nearBone != arm->act_bone) {
+ if (nearBone != arm->act_bone) {
arm->act_bone= nearBone;
}
else {
@@ -4416,7 +4416,7 @@ static int bone_skinnable_cb(Object *ob, Bone *bone, void *datap)
int a, segments;
struct { Object *armob; void *list; int heat; } *data = datap;
- if(!(ob->mode & OB_MODE_WEIGHT_PAINT) || !(bone->flag & BONE_HIDDEN_P)) {
+ if (!(ob->mode & OB_MODE_WEIGHT_PAINT) || !(bone->flag & BONE_HIDDEN_P)) {
if (!(bone->flag & BONE_NO_DEFORM)) {
if (data->heat && data->armob->pose && get_pose_channel(data->armob->pose, bone->name))
segments = bone->segments;
@@ -4490,7 +4490,7 @@ static int dgroup_skinnable_cb(Object *ob, Bone *bone, void *datap)
else
segments = 1;
- if(!wpmode || ((arm->layer & bone->layer) && (bone->flag & BONE_SELECTED)))
+ if (!wpmode || ((arm->layer & bone->layer) && (bone->flag & BONE_SELECTED)))
if (!(defgroup = defgroup_find_name(ob, bone->name)))
defgroup = ED_vgroup_add_name(ob, bone->name);
@@ -4710,7 +4710,7 @@ static void add_verts_to_dgroups(ReportList *reports, Scene *scene, Object *ob,
heat_bone_weighting(ob, mesh, verts, numbones, dgrouplist, dgroupflip,
root, tip, selected, &error);
- if(error) {
+ if (error) {
BKE_report(reports, RPT_WARNING, error);
}
}
@@ -4739,7 +4739,7 @@ void create_vgroups_from_armature(ReportList *reports, Scene *scene, Object *ob,
*/
bArmature *arm= par->data;
- if(mode == ARM_GROUPS_NAME) {
+ if (mode == ARM_GROUPS_NAME) {
/* Traverse the bone list, trying to create empty vertex
* groups corresponding to the bone.
*/
@@ -4748,7 +4748,7 @@ void create_vgroups_from_armature(ReportList *reports, Scene *scene, Object *ob,
if (ob->type == OB_MESH)
ED_vgroup_data_create(ob->data);
}
- else if(mode == ARM_GROUPS_ENVELOPE || mode == ARM_GROUPS_AUTO) {
+ else if (mode == ARM_GROUPS_ENVELOPE || mode == ARM_GROUPS_AUTO) {
/* Traverse the bone list, trying to create vertex groups
* that are populated with the vertices for which the
* bone is closest.
@@ -5148,7 +5148,7 @@ static int hide_selected_pose_bone_cb(Object *ob, Bone *bone, void *UNUSED(ptr))
if (bone->flag & BONE_SELECTED) {
bone->flag |= BONE_HIDDEN_P;
bone->flag &= ~BONE_SELECTED;
- if(arm->act_bone==bone)
+ if (arm->act_bone==bone)
arm->act_bone= NULL;
}
}
@@ -5163,7 +5163,7 @@ static int hide_unselected_pose_bone_cb(Object *ob, Bone *bone, void *UNUSED(ptr
// hrm... typo here?
if ((bone->flag & BONE_SELECTED)==0) {
bone->flag |= BONE_HIDDEN_P;
- if(arm->act_bone==bone)
+ if (arm->act_bone==bone)
arm->act_bone= NULL;
}
}
@@ -5176,7 +5176,7 @@ static int pose_hide_exec(bContext *C, wmOperator *op)
Object *ob= object_pose_armature_get(CTX_data_active_object(C));
bArmature *arm= ob->data;
- if(RNA_boolean_get(op->ptr, "unselected"))
+ if (RNA_boolean_get(op->ptr, "unselected"))
bone_looper(ob, arm->bonebase.first, NULL, hide_unselected_pose_bone_cb);
else
bone_looper(ob, arm->bonebase.first, NULL, hide_selected_pose_bone_cb);
@@ -5296,7 +5296,7 @@ void ED_armature_bone_rename(bArmature *arm, const char *oldnamep, const char *n
char oldname[MAXBONENAME];
/* names better differ! */
- if(strncmp(oldnamep, newnamep, MAXBONENAME)) {
+ if (strncmp(oldnamep, newnamep, MAXBONENAME)) {
/* we alter newname string... so make copy */
BLI_strncpy(newname, newnamep, MAXBONENAME);
@@ -5371,7 +5371,7 @@ void ED_armature_bone_rename(bArmature *arm, const char *oldnamep, const char *n
if (modifiers_usesArmature(ob, arm)) {
bDeformGroup *dg= defgroup_find_name(ob, oldname);
- if(dg) {
+ if (dg) {
BLI_strncpy(dg->name, newname, MAXBONENAME);
}
}
@@ -5398,15 +5398,15 @@ void ED_armature_bone_rename(bArmature *arm, const char *oldnamep, const char *n
/* correct view locking */
{
bScreen *screen;
- for(screen= G.main->screen.first; screen; screen= screen->id.next) {
+ for (screen= G.main->screen.first; screen; screen= screen->id.next) {
ScrArea *sa;
/* add regions */
- for(sa= screen->areabase.first; sa; sa= sa->next) {
+ for (sa= screen->areabase.first; sa; sa= sa->next) {
SpaceLink *sl;
for (sl= sa->spacedata.first; sl; sl= sl->next) {
- if(sl->spacetype==SPACE_VIEW3D) {
+ if (sl->spacetype==SPACE_VIEW3D) {
View3D *v3d= (View3D *)sl;
- if(v3d->ob_centre && v3d->ob_centre->data == arm) {
+ if (v3d->ob_centre && v3d->ob_centre->data == arm) {
if (!strcmp(v3d->ob_centre_bone, oldname)) {
BLI_strncpy(v3d->ob_centre_bone, newname, MAXBONENAME);
}
@@ -5480,7 +5480,7 @@ static int armature_autoside_names_exec (bContext *C, wmOperator *op)
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]))
+ if (bone_autoside_name(newname, 1, axis, ebone->head[axis], ebone->tail[axis]))
ED_armature_bone_rename(arm, ebone->name, newname);
}
CTX_DATA_END;
@@ -5642,7 +5642,7 @@ EditBone * subdivideByAngle(Scene *scene, Object *obedit, ReebArc *arc, ReebNode
* to let subsequent subdivision methods do their thing.
* */
if (parent == root) {
- if(parent==arm->act_edbone) arm->act_edbone= NULL;
+ if (parent==arm->act_edbone) arm->act_edbone= NULL;
ED_armature_edit_bone_remove(arm, parent);
parent = NULL;
}
@@ -5862,7 +5862,7 @@ void generateSkeletonFromReebGraph(Scene *scene, ReebGraph *rg)
EditBone *childBone = BLI_ghash_lookup(arcBoneMap, arc);
/* find the root bone */
- while(childBone->parent != NULL)
+ while (childBone->parent != NULL)
{
childBone = childBone->parent;
}
diff --git a/source/blender/editors/armature/editarmature_retarget.c b/source/blender/editors/armature/editarmature_retarget.c
index 375184d3229..261018329ab 100644
--- a/source/blender/editors/armature/editarmature_retarget.c
+++ b/source/blender/editors/armature/editarmature_retarget.c
@@ -323,7 +323,7 @@ static RigGraph *newRigGraph(void)
rg->free_node = NULL;
#ifdef USE_THREADS
-// if(G.scene->r.mode & R_FIXED_THREADS)
+// if (G.scene->r.mode & R_FIXED_THREADS)
// {
// totthread = G.scene->r.threads;
// }
@@ -1008,7 +1008,7 @@ static void RIG_reconnectControlBones(RigGraph *rg)
/* look on deform bones first */
BLI_ghashIterator_init(&ghi, rg->bones_map);
- for( ; !BLI_ghashIterator_isDone(&ghi); BLI_ghashIterator_step(&ghi))
+ for ( ; !BLI_ghashIterator_isDone(&ghi); BLI_ghashIterator_step(&ghi))
{
EditBone *bone = (EditBone*)BLI_ghashIterator_getValue(&ghi);
@@ -1298,7 +1298,7 @@ static void RIG_arcFromBoneChain(RigGraph *rg, ListBase *list, EditBone *root_bo
RigArc *arc = NULL;
int contain_head = 0;
- for(bone = root_bone; bone; bone = nextEditBoneChild(list, bone, 0))
+ for (bone = root_bone; bone; bone = nextEditBoneChild(list, bone, 0))
{
int nb_children;
@@ -1550,7 +1550,7 @@ RigGraph *RIG_graphFromArmature(const bContext *C, Object *ob, bArmature *arm)
rg->ob = ob;
/* Do the rotations */
- for (ebone = rg->editbones->first; ebone; ebone=ebone->next){
+ for (ebone = rg->editbones->first; ebone; ebone=ebone->next) {
if (ebone->parent == NULL)
{
RIG_arcFromBoneChain(rg, rg->editbones, ebone, NULL, 0);
@@ -1602,7 +1602,7 @@ static RigGraph *armatureSelectedToGraph(bContext *C, Object *ob, bArmature *arm
rg->ob = ob;
/* Do the rotations */
- for (ebone = rg->editbones->first; ebone; ebone=ebone->next){
+ for (ebone = rg->editbones->first; ebone; ebone=ebone->next) {
if (ebone->parent == NULL)
{
RIG_arcFromBoneChain(rg, rg->editbones, ebone, NULL, 1);
@@ -2488,7 +2488,7 @@ static void markMultiResolutionChildArc(ReebNode *end_enode, ReebNode *enode)
{
int i;
- for(i = 0; i < enode->degree; i++)
+ for (i = 0; i < enode->degree; i++)
{
ReebArc *earc = (ReebArc*)enode->arcs[i];
@@ -2593,7 +2593,7 @@ static void findCorrespondingArc(RigGraph *rigg, RigArc *start_arc, RigNode *sta
// RIG_printArcBones(next_iarc);
// }
- for(i = 0; i < enode->degree; i++)
+ for (i = 0; i < enode->degree; i++)
{
next_earc = (ReebArc*)enode->arcs[i];
@@ -2644,14 +2644,14 @@ static void findCorrespondingArc(RigGraph *rigg, RigArc *start_arc, RigNode *sta
// printf("flag %i -- level %i -- flag %i -- group %i\n", ARC_FREE, symmetry_level, symmetry_flag, symmetry_group);
//
// printf("CANDIDATES\n");
-// for(i = 0; i < enode->degree; i++)
+// for (i = 0; i < enode->degree; i++)
// {
// next_earc = (ReebArc*)enode->arcs[i];
// printf("flag %i -- level %i -- flag %i -- group %i\n", next_earc->flag, next_earc->symmetry_level, next_earc->symmetry_flag, next_earc->symmetry_group);
// }
/* Emergency matching */
- for(i = 0; i < enode->degree; i++)
+ for (i = 0; i < enode->degree; i++)
{
next_earc = (ReebArc*)enode->arcs[i];
@@ -2687,7 +2687,7 @@ static void retargetSubgraph(bContext *C, RigGraph *rigg, RigArc *start_arc, Rig
matchMultiResolutionNode(rigg, inode, enode);
}
- for(i = 0; i < inode->degree; i++)
+ for (i = 0; i < inode->degree; i++)
{
RigArc *next_iarc = (RigArc*)inode->arcs[i];
diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c
index f9f3cd60d0b..81b020a4cf9 100644
--- a/source/blender/editors/armature/editarmature_sketch.c
+++ b/source/blender/editors/armature/editarmature_sketch.c
@@ -1870,7 +1870,7 @@ int sk_detectCommandGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UN
SK_Intersection *isect, *self_isect;
/* get the the last intersection of the first pair */
- for( isect = gest->intersections.first; isect; isect = isect->next )
+ for ( isect = gest->intersections.first; isect; isect = isect->next )
{
if (isect->stroke == isect->next->stroke)
{
@@ -1897,7 +1897,7 @@ void sk_applyCommandGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UN
// XXX
// command = pupmenu("Action %t|Flatten %x1|Straighten %x2|Polygonize %x3");
- if(command < 1) return;
+ if (command < 1) return;
for (isect = gest->intersections.first; isect; isect = isect->next)
{
@@ -2177,7 +2177,7 @@ static int sk_selectStroke(bContext *C, SK_Sketch *sketch, const int mval[2], in
{
int besthitresult = -1;
- if(hits == 1) {
+ if (hits == 1) {
besthitresult = buffer[3];
}
else {
diff --git a/source/blender/editors/armature/meshlaplacian.c b/source/blender/editors/armature/meshlaplacian.c
index de9b4a890cb..4c1315e847e 100644
--- a/source/blender/editors/armature/meshlaplacian.c
+++ b/source/blender/editors/armature/meshlaplacian.c
@@ -142,7 +142,7 @@ static void laplacian_increase_edge_count(EdgeHash *edgehash, int v1, int v2)
{
void **p = BLI_edgehash_lookup_p(edgehash, v1, v2);
- if(p)
+ if (p)
*p = (void*)((intptr_t)*p + (intptr_t)1);
else
BLI_edgehash_insert(edgehash, v1, v2, (void*)(intptr_t)1);
@@ -184,8 +184,8 @@ static void laplacian_triangle_area(LaplacianSystem *sys, int i1, int i2, int i3
t3= cotan_weight(v3, v1, v2);
if (angle_v3v3v3(v2, v1, v3) > DEG2RADF(90.0f)) obtuse= 1;
- else if(angle_v3v3v3(v1, v2, v3) > DEG2RADF(90.0f)) obtuse= 2;
- else if(angle_v3v3v3(v1, v3, v2) > DEG2RADF(90.0f)) obtuse= 3;
+ else if (angle_v3v3v3(v1, v2, v3) > DEG2RADF(90.0f)) obtuse= 2;
+ else if (angle_v3v3v3(v1, v3, v2) > DEG2RADF(90.0f)) obtuse= 3;
if (obtuse > 0) {
area= area_tri_v3(v1, v2, v3);
@@ -237,7 +237,7 @@ static void laplacian_triangle_weights(LaplacianSystem *sys, int f, int i1, int
nlMatrixAdd(i3, i1, -t2*varea[i3]);
nlMatrixAdd(i1, i3, -t2*varea[i1]);
- if(sys->storeweights) {
+ if (sys->storeweights) {
sys->fweights[f][0]= t1*varea[i1];
sys->fweights[f][1]= t2*varea[i2];
sys->fweights[f][2]= t3*varea[i3];
@@ -263,7 +263,7 @@ static LaplacianSystem *laplacian_system_construct_begin(int totvert, int totfac
/* create opennl context */
nlNewContext();
nlSolverParameteri(NL_NB_VARIABLES, totvert);
- if(lsq)
+ if (lsq)
nlSolverParameteri(NL_LEAST_SQUARES, NL_TRUE);
sys->context= nlGetCurrent();
@@ -296,39 +296,39 @@ static void laplacian_system_construct_end(LaplacianSystem *sys)
sys->varea= MEM_callocN(sizeof(float)*totvert, "LaplacianSystemVarea");
sys->edgehash= BLI_edgehash_new();
- for(a=0, face=sys->faces; a<sys->totface; a++, face++) {
+ for (a=0, face=sys->faces; a<sys->totface; a++, face++) {
laplacian_increase_edge_count(sys->edgehash, (*face)[0], (*face)[1]);
laplacian_increase_edge_count(sys->edgehash, (*face)[1], (*face)[2]);
laplacian_increase_edge_count(sys->edgehash, (*face)[2], (*face)[0]);
}
- if(sys->areaweights)
- for(a=0, face=sys->faces; a<sys->totface; a++, face++)
+ if (sys->areaweights)
+ for (a=0, face=sys->faces; a<sys->totface; a++, face++)
laplacian_triangle_area(sys, (*face)[0], (*face)[1], (*face)[2]);
- for(a=0; a<totvert; a++) {
- if(sys->areaweights) {
- if(sys->varea[a] != 0.0f)
+ for (a=0; a<totvert; a++) {
+ if (sys->areaweights) {
+ if (sys->varea[a] != 0.0f)
sys->varea[a]= 0.5f/sys->varea[a];
}
else
sys->varea[a]= 1.0f;
/* for heat weighting */
- if(sys->heat.H)
+ if (sys->heat.H)
nlMatrixAdd(a, a, sys->heat.H[a]);
}
- if(sys->storeweights)
+ if (sys->storeweights)
sys->fweights= MEM_callocN(sizeof(float)*3*totface, "LaplacianFWeight");
- for(a=0, face=sys->faces; a<totface; a++, face++)
+ for (a=0, face=sys->faces; a<totface; a++, face++)
laplacian_triangle_weights(sys, a, (*face)[0], (*face)[1], (*face)[2]);
MEM_freeN(sys->faces);
sys->faces= NULL;
- if(sys->varea) {
+ if (sys->varea) {
MEM_freeN(sys->varea);
sys->varea= NULL;
}
@@ -339,11 +339,11 @@ static void laplacian_system_construct_end(LaplacianSystem *sys)
static void laplacian_system_delete(LaplacianSystem *sys)
{
- if(sys->verts) MEM_freeN(sys->verts);
- if(sys->varea) MEM_freeN(sys->varea);
- if(sys->vpinned) MEM_freeN(sys->vpinned);
- if(sys->faces) MEM_freeN(sys->faces);
- if(sys->fweights) MEM_freeN(sys->fweights);
+ if (sys->verts) MEM_freeN(sys->verts);
+ if (sys->varea) MEM_freeN(sys->varea);
+ if (sys->vpinned) MEM_freeN(sys->vpinned);
+ if (sys->faces) MEM_freeN(sys->faces);
+ if (sys->fweights) MEM_freeN(sys->fweights);
nlDeleteContext(sys->context);
MEM_freeN(sys);
@@ -356,9 +356,9 @@ void laplacian_begin_solve(LaplacianSystem *sys, int index)
if (!sys->nlbegun) {
nlBegin(NL_SYSTEM);
- if(index >= 0) {
- for(a=0; a<sys->totvert; a++) {
- if(sys->vpinned[a]) {
+ if (index >= 0) {
+ for (a=0; a<sys->totvert; a++) {
+ if (sys->vpinned[a]) {
nlSetVariable(0, a, sys->verts[a][index]);
nlLockVariable(a);
}
@@ -415,9 +415,9 @@ static void bvh_callback(void *userdata, int index, const BVHTreeRay *UNUSED(ray
mul_v3_v3fl(dir, data->vec, hit->dist);
- if(isect_ray_tri_v3(data->start, dir, verts[mf->v1], verts[mf->v2], verts[mf->v3], &lambda, uv)) {
+ if (isect_ray_tri_v3(data->start, dir, verts[mf->v1], verts[mf->v2], verts[mf->v3], &lambda, uv)) {
normal_tri_v3(n, verts[mf->v1], verts[mf->v2], verts[mf->v3]);
- if(lambda < 1.0f && dot_v3v3(n, data->vec) < -1e-5f) {
+ if (lambda < 1.0f && dot_v3v3(n, data->vec) < -1e-5f) {
hit->index = index;
hit->dist *= lambda;
}
@@ -425,9 +425,9 @@ static void bvh_callback(void *userdata, int index, const BVHTreeRay *UNUSED(ray
mul_v3_v3fl(dir, data->vec, hit->dist);
- if(isect_ray_tri_v3(data->start, dir, verts[mf->v1], verts[mf->v3], verts[mf->v4], &lambda, uv)) {
+ if (isect_ray_tri_v3(data->start, dir, verts[mf->v1], verts[mf->v3], verts[mf->v4], &lambda, uv)) {
normal_tri_v3(n, verts[mf->v1], verts[mf->v3], verts[mf->v4]);
- if(lambda < 1.0f && dot_v3v3(n, data->vec) < -1e-5f) {
+ if (lambda < 1.0f && dot_v3v3(n, data->vec) < -1e-5f) {
hit->index = index;
hit->dist *= lambda;
}
@@ -446,7 +446,7 @@ static void heat_ray_tree_create(LaplacianSystem *sys)
sys->heat.bvhtree = BLI_bvhtree_new(totface, 0.0f, 4, 6);
sys->heat.vface = MEM_callocN(sizeof(MFace*)*totvert, "HeatVFaces");
- for(a=0; a<totface; a++) {
+ for (a=0; a<totface; a++) {
MFace *mf = mface+a;
float bb[6];
@@ -454,7 +454,7 @@ static void heat_ray_tree_create(LaplacianSystem *sys)
DO_MINMAX(verts[mf->v1], bb, bb+3);
DO_MINMAX(verts[mf->v2], bb, bb+3);
DO_MINMAX(verts[mf->v3], bb, bb+3);
- if(mf->v4) {
+ if (mf->v4) {
DO_MINMAX(verts[mf->v4], bb, bb+3);
}
@@ -464,7 +464,7 @@ static void heat_ray_tree_create(LaplacianSystem *sys)
sys->heat.vface[mf->v1]= mf;
sys->heat.vface[mf->v2]= mf;
sys->heat.vface[mf->v3]= mf;
- if(mf->v4) sys->heat.vface[mf->v4]= mf;
+ if (mf->v4) sys->heat.vface[mf->v4]= mf;
}
BLI_bvhtree_balance(sys->heat.bvhtree);
@@ -479,13 +479,13 @@ static int heat_ray_source_visible(LaplacianSystem *sys, int vertex, int source)
int visible;
mface= sys->heat.vface[vertex];
- if(!mface)
+ if (!mface)
return 1;
data.sys= sys;
copy_v3_v3(data.start, sys->heat.verts[vertex]);
- if(sys->heat.root) /* bone */
+ if (sys->heat.root) /* bone */
closest_to_line_segment_v3(end, data.start,
sys->heat.root[source], sys->heat.tip[source]);
else /* vertex */
@@ -509,7 +509,7 @@ static float heat_source_distance(LaplacianSystem *sys, int vertex, int source)
float closest[3], d[3], dist, cosine;
/* compute euclidian distance */
- if(sys->heat.root) /* bone */
+ if (sys->heat.root) /* bone */
closest_to_line_segment_v3(closest, sys->heat.verts[vertex],
sys->heat.root[source], sys->heat.tip[source]);
else /* vertex */
@@ -530,8 +530,8 @@ static int heat_source_closest(LaplacianSystem *sys, int vertex, int source)
dist= heat_source_distance(sys, vertex, source);
- if(dist <= sys->heat.mindist[vertex]*(1.0f + DISTANCE_EPSILON))
- if(heat_ray_source_visible(sys, vertex, source))
+ if (dist <= sys->heat.mindist[vertex]*(1.0f + DISTANCE_EPSILON))
+ if (heat_ray_source_visible(sys, vertex, source))
return 1;
return 0;
@@ -545,24 +545,24 @@ static void heat_set_H(LaplacianSystem *sys, int vertex)
mindist= 1e10;
/* compute minimum distance */
- for(j=0; j<sys->heat.numsource; j++) {
+ for (j=0; j<sys->heat.numsource; j++) {
dist= heat_source_distance(sys, vertex, j);
- if(dist < mindist)
+ if (dist < mindist)
mindist= dist;
}
sys->heat.mindist[vertex]= mindist;
/* count number of sources with approximately this minimum distance */
- for(j=0; j<sys->heat.numsource; j++)
- if(heat_source_closest(sys, vertex, j))
+ for (j=0; j<sys->heat.numsource; j++)
+ if (heat_source_closest(sys, vertex, j))
numclosest++;
sys->heat.p[vertex]= (numclosest > 0)? 1.0f/numclosest: 0.0f;
/* compute H entry */
- if(numclosest > 0) {
+ if (numclosest > 0) {
mindist= maxf(mindist, 1e-4f);
h= numclosest*C_WEIGHT/(mindist*mindist);
}
@@ -579,7 +579,7 @@ static void heat_calc_vnormals(LaplacianSystem *sys)
sys->heat.vnors= MEM_callocN(sizeof(float)*3*sys->totvert, "HeatVNors");
- for(a=0, face=sys->faces; a<sys->totface; a++, face++) {
+ for (a=0, face=sys->faces; a<sys->totface; a++, face++) {
v1= (*face)[0];
v2= (*face)[1];
v3= (*face)[2];
@@ -591,7 +591,7 @@ static void heat_calc_vnormals(LaplacianSystem *sys)
add_v3_v3(sys->heat.vnors[v3], fnor);
}
- for(a=0; a<sys->totvert; a++)
+ for (a=0; a<sys->totvert; a++)
normalize_v3(sys->heat.vnors[a]);
}
@@ -608,19 +608,19 @@ static void heat_laplacian_create(LaplacianSystem *sys)
sys->heat.p= MEM_callocN(sizeof(float)*totvert, "HeatP");
/* add verts and faces to laplacian */
- for(a=0; a<totvert; a++)
+ for (a=0; a<totvert; a++)
laplacian_add_vertex(sys, sys->heat.verts[a], 0);
- for(a=0, mf=mface; a<totface; a++, mf++) {
+ for (a=0, mf=mface; a<totface; a++, mf++) {
laplacian_add_triangle(sys, mf->v1, mf->v2, mf->v3);
- if(mf->v4)
+ if (mf->v4)
laplacian_add_triangle(sys, mf->v1, mf->v3, mf->v4);
}
/* for distance computation in set_H */
heat_calc_vnormals(sys);
- for(a=0; a<totvert; a++)
+ for (a=0; a<totvert; a++)
heat_set_H(sys, a);
}
@@ -639,10 +639,10 @@ static float heat_limit_weight(float weight)
{
float t;
- if(weight < WEIGHT_LIMIT_END) {
+ if (weight < WEIGHT_LIMIT_END) {
return 0.0f;
}
- else if(weight < WEIGHT_LIMIT_START) {
+ else if (weight < WEIGHT_LIMIT_START) {
t= (weight - WEIGHT_LIMIT_END)/(WEIGHT_LIMIT_START - WEIGHT_LIMIT_END);
return t*WEIGHT_LIMIT_START;
}
@@ -667,15 +667,15 @@ void heat_bone_weighting(Object *ob, Mesh *me, float (*verts)[3], int numsource,
*err_str= NULL;
/* count triangles and create mask */
- if( (use_face_sel= (me->editflag & ME_EDIT_PAINT_MASK) != 0) ||
+ if ( (use_face_sel= (me->editflag & ME_EDIT_PAINT_MASK) != 0) ||
(use_vert_sel= ((me->editflag & ME_EDIT_VERT_SEL) != 0)))
{
mask= MEM_callocN(sizeof(int)*me->totvert, "heat_bone_weighting mask");
}
- for(a = 0, mp=me->mpoly; a < me->totpoly; mp++, a++) {
+ for (a = 0, mp=me->mpoly; a < me->totpoly; mp++, a++) {
/* (added selectedVerts content for vertex mask, they used to just equal 1) */
- if(use_vert_sel) {
+ if (use_vert_sel) {
for (j = 0, ml = me->mloop + mp->loopstart; j < mp->totloop; j++, ml++) {
if (use_vert_sel) {
mask[ml->v] = (mvert[ml->v].flag & SELECT) != 0;
@@ -694,9 +694,9 @@ void heat_bone_weighting(Object *ob, Mesh *me, float (*verts)[3], int numsource,
/* bone heat needs triangulated faces */
BKE_mesh_tessface_ensure(me);
- for(tottri = 0, a = 0, mf = me->mface; a < me->totface; mf++, a++) {
+ for (tottri = 0, a = 0, mf = me->mface; a < me->totface; mf++, a++) {
tottri++;
- if(mf->v4) tottri++;
+ if (mf->v4) tottri++;
}
/* create laplacian */
@@ -715,15 +715,15 @@ void heat_bone_weighting(Object *ob, Mesh *me, float (*verts)[3], int numsource,
laplacian_system_construct_end(sys);
- if(dgroupflip) {
+ if (dgroupflip) {
vertsflipped = MEM_callocN(sizeof(int)*me->totvert, "vertsflipped");
- for(a=0; a<me->totvert; a++)
+ for (a=0; a<me->totvert; a++)
vertsflipped[a] = mesh_get_x_mirror_vert(ob, a);
}
/* compute weights per bone */
- for(j=0; j<numsource; j++) {
- if(!selected[j])
+ for (j=0; j<numsource; j++) {
+ if (!selected[j])
continue;
firstsegment= (j == 0 || dgrouplist[j-1] != dgrouplist[j]);
@@ -731,13 +731,13 @@ void heat_bone_weighting(Object *ob, Mesh *me, float (*verts)[3], int numsource,
bbone= !(firstsegment && lastsegment);
/* clear weights */
- if(bbone && firstsegment) {
- for(a=0; a<me->totvert; a++) {
- if(mask && !mask[a])
+ if (bbone && firstsegment) {
+ for (a=0; a<me->totvert; a++) {
+ if (mask && !mask[a])
continue;
ED_vgroup_vert_remove(ob, dgrouplist[j], a);
- if(vertsflipped && dgroupflip[j] && vertsflipped[a] >= 0)
+ if (vertsflipped && dgroupflip[j] && vertsflipped[a] >= 0)
ED_vgroup_vert_remove(ob, dgroupflip[j], vertsflipped[a]);
}
}
@@ -745,28 +745,28 @@ void heat_bone_weighting(Object *ob, Mesh *me, float (*verts)[3], int numsource,
/* fill right hand side */
laplacian_begin_solve(sys, -1);
- for(a=0; a<me->totvert; a++)
- if(heat_source_closest(sys, a, j))
+ for (a=0; a<me->totvert; a++)
+ if (heat_source_closest(sys, a, j))
laplacian_add_right_hand_side(sys, a,
sys->heat.H[a]*sys->heat.p[a]);
/* solve */
- if(laplacian_system_solve(sys)) {
+ if (laplacian_system_solve(sys)) {
/* load solution into vertex groups */
- for(a=0; a<me->totvert; a++) {
- if(mask && !mask[a])
+ for (a=0; a<me->totvert; a++) {
+ if (mask && !mask[a])
continue;
solution= laplacian_system_get_solution(a);
- if(bbone) {
- if(solution > 0.0f)
+ if (bbone) {
+ if (solution > 0.0f)
ED_vgroup_vert_add(ob, dgrouplist[j], a, solution,
WEIGHT_ADD);
}
else {
weight= heat_limit_weight(solution);
- if(weight > 0.0f)
+ if (weight > 0.0f)
ED_vgroup_vert_add(ob, dgrouplist[j], a, weight,
WEIGHT_REPLACE);
else
@@ -774,15 +774,15 @@ void heat_bone_weighting(Object *ob, Mesh *me, float (*verts)[3], int numsource,
}
/* do same for mirror */
- if(vertsflipped && dgroupflip[j] && vertsflipped[a] >= 0) {
- if(bbone) {
- if(solution > 0.0f)
+ if (vertsflipped && dgroupflip[j] && vertsflipped[a] >= 0) {
+ if (bbone) {
+ if (solution > 0.0f)
ED_vgroup_vert_add(ob, dgroupflip[j], vertsflipped[a],
solution, WEIGHT_ADD);
}
else {
weight= heat_limit_weight(solution);
- if(weight > 0.0f)
+ if (weight > 0.0f)
ED_vgroup_vert_add(ob, dgroupflip[j], vertsflipped[a],
weight, WEIGHT_REPLACE);
else
@@ -791,26 +791,26 @@ void heat_bone_weighting(Object *ob, Mesh *me, float (*verts)[3], int numsource,
}
}
}
- else if(*err_str == NULL) {
+ else if (*err_str == NULL) {
*err_str= "Bone Heat Weighting: failed to find solution for one or more bones";
break;
}
/* remove too small vertex weights */
- if(bbone && lastsegment) {
- for(a=0; a<me->totvert; a++) {
- if(mask && !mask[a])
+ if (bbone && lastsegment) {
+ for (a=0; a<me->totvert; a++) {
+ if (mask && !mask[a])
continue;
weight= ED_vgroup_vert_weight(ob, dgrouplist[j], a);
weight= heat_limit_weight(weight);
- if(weight <= 0.0f)
+ if (weight <= 0.0f)
ED_vgroup_vert_remove(ob, dgrouplist[j], a);
- if(vertsflipped && dgroupflip[j] && vertsflipped[a] >= 0) {
+ if (vertsflipped && dgroupflip[j] && vertsflipped[a] >= 0) {
weight= ED_vgroup_vert_weight(ob, dgroupflip[j], vertsflipped[a]);
weight= heat_limit_weight(weight);
- if(weight <= 0.0f)
+ if (weight <= 0.0f)
ED_vgroup_vert_remove(ob, dgroupflip[j], vertsflipped[a]);
}
}
@@ -818,8 +818,8 @@ void heat_bone_weighting(Object *ob, Mesh *me, float (*verts)[3], int numsource,
}
/* free */
- if(vertsflipped) MEM_freeN(vertsflipped);
- if(mask) MEM_freeN(mask);
+ if (vertsflipped) MEM_freeN(vertsflipped);
+ if (mask) MEM_freeN(mask);
heat_system_free(sys);
@@ -903,7 +903,7 @@ void rigid_deform_iteration()
EditFace *efa;
int a, i;
- if(!sys)
+ if (!sys)
return;
nlMakeCurrent(sys->context);
@@ -913,12 +913,12 @@ void rigid_deform_iteration()
memset(sys->rigid.R, 0, sizeof(float)*3*3*sys->totvert);
memset(sys->rigid.rhs, 0, sizeof(float)*3*sys->totvert);
- for(a=0, efa=em->faces.first; efa; efa=efa->next, a++) {
+ for (a=0, efa=em->faces.first; efa; efa=efa->next, a++) {
rigid_add_edge_to_R(sys, efa->v1, efa->v2, sys->fweights[a][2]);
rigid_add_edge_to_R(sys, efa->v2, efa->v3, sys->fweights[a][0]);
rigid_add_edge_to_R(sys, efa->v3, efa->v1, sys->fweights[a][1]);
- if(efa->v4) {
+ if (efa->v4) {
a++;
rigid_add_edge_to_R(sys, efa->v1, efa->v3, sys->fweights[a][2]);
rigid_add_edge_to_R(sys, efa->v3, efa->v4, sys->fweights[a][0]);
@@ -926,18 +926,18 @@ void rigid_deform_iteration()
}
}
- for(a=0, eve=em->verts.first; eve; eve=eve->next, a++) {
+ for (a=0, eve=em->verts.first; eve; eve=eve->next, a++) {
rigid_orthogonalize_R(sys->rigid.R[a]);
eve->tmp.l= a;
}
/* compute right hand sides for solving */
- for(a=0, efa=em->faces.first; efa; efa=efa->next, a++) {
+ for (a=0, efa=em->faces.first; efa; efa=efa->next, a++) {
rigid_add_edge_to_rhs(sys, efa->v1, efa->v2, sys->fweights[a][2]);
rigid_add_edge_to_rhs(sys, efa->v2, efa->v3, sys->fweights[a][0]);
rigid_add_edge_to_rhs(sys, efa->v3, efa->v1, sys->fweights[a][1]);
- if(efa->v4) {
+ if (efa->v4) {
a++;
rigid_add_edge_to_rhs(sys, efa->v1, efa->v3, sys->fweights[a][2]);
rigid_add_edge_to_rhs(sys, efa->v3, efa->v4, sys->fweights[a][0]);
@@ -946,19 +946,19 @@ void rigid_deform_iteration()
}
/* solve for positions, for X,Y and Z separately */
- for(i=0; i<3; i++) {
+ for (i=0; i<3; i++) {
laplacian_begin_solve(sys, i);
- for(a=0; a<sys->totvert; a++)
- if(!sys->vpinned[a])
+ for (a=0; a<sys->totvert; a++)
+ if (!sys->vpinned[a])
laplacian_add_right_hand_side(sys, a, sys->rigid.rhs[a][i]);
- if(laplacian_system_solve(sys)) {
- for(a=0, eve=em->verts.first; eve; eve=eve->next, a++)
+ if (laplacian_system_solve(sys)) {
+ for (a=0, eve=em->verts.first; eve; eve=eve->next, a++)
eve->co[i]= laplacian_system_get_solution(a);
}
else {
- if(!sys->rigid.thrownerror) {
+ if (!sys->rigid.thrownerror) {
error("RigidDeform: failed to find solution");
sys->rigid.thrownerror= 1;
}
@@ -975,15 +975,15 @@ static void rigid_laplacian_create(LaplacianSystem *sys)
int a;
/* add verts and faces to laplacian */
- for(a=0, eve=em->verts.first; eve; eve=eve->next, a++) {
+ for (a=0, eve=em->verts.first; eve; eve=eve->next, a++) {
laplacian_add_vertex(sys, eve->co, eve->pinned);
eve->tmp.l= a;
}
- for(efa=em->faces.first; efa; efa=efa->next) {
+ for (efa=em->faces.first; efa; efa=efa->next) {
laplacian_add_triangle(sys,
efa->v1->tmp.l, efa->v2->tmp.l, efa->v3->tmp.l);
- if(efa->v4)
+ if (efa->v4)
laplacian_add_triangle(sys,
efa->v1->tmp.l, efa->v3->tmp.l, efa->v4->tmp.l);
}
@@ -997,12 +997,12 @@ void rigid_deform_begin(EditMesh *em)
int a, totvert, totface;
/* count vertices, triangles */
- for(totvert=0, eve=em->verts.first; eve; eve=eve->next)
+ for (totvert=0, eve=em->verts.first; eve; eve=eve->next)
totvert++;
- for(totface=0, efa=em->faces.first; efa; efa=efa->next) {
+ for (totface=0, efa=em->faces.first; efa; efa=efa->next) {
totface++;
- if(efa->v4) totface++;
+ if (efa->v4) totface++;
}
/* create laplacian */
@@ -1013,7 +1013,7 @@ void rigid_deform_begin(EditMesh *em)
sys->rigid.rhs = MEM_callocN(sizeof(float)*3*totvert, "RigidDeformRHS");
sys->rigid.origco = MEM_callocN(sizeof(float)*3*totvert, "RigidDeformCo");
- for(a=0, eve=em->verts.first; eve; eve=eve->next, a++)
+ for (a=0, eve=em->verts.first; eve; eve=eve->next, a++)
copy_v3_v3(sys->rigid.origco[a], eve->co);
sys->areaweights= 0;
@@ -1030,19 +1030,19 @@ void rigid_deform_end(int cancel)
{
LaplacianSystem *sys = RigidDeformSystem;
- if(sys) {
+ if (sys) {
EditMesh *em = sys->rigid.mesh;
EditVert *eve;
int a;
- if(cancel)
- for(a=0, eve=em->verts.first; eve; eve=eve->next, a++)
- if(!eve->pinned)
+ if (cancel)
+ for (a=0, eve=em->verts.first; eve; eve=eve->next, a++)
+ if (!eve->pinned)
copy_v3_v3(eve->co, sys->rigid.origco[a]);
- if(sys->rigid.R) MEM_freeN(sys->rigid.R);
- if(sys->rigid.rhs) MEM_freeN(sys->rigid.rhs);
- if(sys->rigid.origco) MEM_freeN(sys->rigid.origco);
+ if (sys->rigid.R) MEM_freeN(sys->rigid.R);
+ if (sys->rigid.rhs) MEM_freeN(sys->rigid.rhs);
+ if (sys->rigid.origco) MEM_freeN(sys->rigid.origco);
/* free */
laplacian_system_delete(sys);
@@ -1176,10 +1176,10 @@ static int meshdeform_tri_intersect(float orig[3], float end[3], float vert0[3],
/* check if it is within the length of the line segment */
sub_v3_v3v3(isectdir, isectco, orig);
- if(dot_v3v3(dir, isectdir) < -EPSILON)
+ if (dot_v3v3(dir, isectdir) < -EPSILON)
return 0;
- if(dot_v3v3(dir, dir) + EPSILON < dot_v3v3(isectdir, isectdir))
+ if (dot_v3v3(dir, dir) + EPSILON < dot_v3v3(isectdir, isectdir))
return 0;
return 1;
@@ -1198,16 +1198,16 @@ static int meshdeform_intersect(MeshDeformBind *mdb, MeshDeformIsect *isec)
add_v3_v3v3(end, isec->start, isec->vec);
- for(f=0; f<totface; f++, mface++) {
+ for (f=0; f<totface; f++, mface++) {
copy_v3_v3(face[0], mdb->cagecos[mface->v1]);
copy_v3_v3(face[1], mdb->cagecos[mface->v2]);
copy_v3_v3(face[2], mdb->cagecos[mface->v3]);
- if(mface->v4) {
+ if (mface->v4) {
copy_v3_v3(face[3], mdb->cagecos[mface->v4]);
hit = meshdeform_tri_intersect(isec->start, end, face[0], face[1], face[2], co, uvw);
- if(hit) {
+ if (hit) {
normal_tri_v3( nor,face[0], face[1], face[2]);
}
else {
@@ -1220,9 +1220,9 @@ static int meshdeform_intersect(MeshDeformBind *mdb, MeshDeformIsect *isec)
normal_tri_v3( nor,face[0], face[1], face[2]);
}
- if(hit) {
+ if (hit) {
len= len_v3v3(isec->start, co)/len_v3v3(isec->start, end);
- if(len < isec->labda) {
+ if (len < isec->labda) {
isec->labda= len;
isec->face = mface;
isec->isect= (dot_v3v3(isec->vec, nor) <= 0.0f);
@@ -1251,7 +1251,7 @@ static MDefBoundIsect *meshdeform_ray_tree_intersect(MeshDeformBind *mdb, float
add_v3_v3v3(end, co2, epsilon);
sub_v3_v3v3(isec.vec, end, isec.start);
- if(meshdeform_intersect(mdb, &isec)) {
+ if (meshdeform_intersect(mdb, &isec)) {
len= isec.labda;
mface=(MFace*)isec.face;
@@ -1264,7 +1264,7 @@ static MDefBoundIsect *meshdeform_ray_tree_intersect(MeshDeformBind *mdb, float
isect->co[2]= co1[2] + isec.vec[2]*len;
isect->len= len_v3v3(co1, isect->co);
- if(isect->len < MESHDEFORM_LEN_THRESHOLD)
+ if (isect->len < MESHDEFORM_LEN_THRESHOLD)
isect->len= MESHDEFORM_LEN_THRESHOLD;
isect->v[0]= mface->v1;
@@ -1280,7 +1280,7 @@ static MDefBoundIsect *meshdeform_ray_tree_intersect(MeshDeformBind *mdb, float
copy_v3_v3(vert[0], cagecos[mface->v1]);
copy_v3_v3(vert[1], cagecos[mface->v2]);
copy_v3_v3(vert[2], cagecos[mface->v3]);
- if(mface->v4) copy_v3_v3(vert[3], cagecos[mface->v4]);
+ if (mface->v4) copy_v3_v3(vert[3], cagecos[mface->v4]);
interp_weights_poly_v3( isect->uvw,vert, isect->nvert, isect->co);
return isect;
@@ -1295,7 +1295,7 @@ static int meshdeform_inside_cage(MeshDeformBind *mdb, float *co)
float outside[3], start[3], dir[3];
int i;
- for(i=1; i<=6; i++) {
+ for (i=1; i<=6; i++) {
outside[0] = co[0] + (mdb->max[0] - mdb->min[0] + 1.0f)*MESHDEFORM_OFFSET[i][0];
outside[1] = co[1] + (mdb->max[1] - mdb->min[1] + 1.0f)*MESHDEFORM_OFFSET[i][1];
outside[2] = co[2] + (mdb->max[2] - mdb->min[2] + 1.0f)*MESHDEFORM_OFFSET[i][2];
@@ -1305,7 +1305,7 @@ static int meshdeform_inside_cage(MeshDeformBind *mdb, float *co)
normalize_v3(dir);
isect = meshdeform_ray_tree_intersect(mdb, start, outside);
- if(isect && !isect->facing)
+ if (isect && !isect->facing)
return 1;
}
@@ -1322,11 +1322,11 @@ static int meshdeform_index(MeshDeformBind *mdb, int x, int y, int z, int n)
y += MESHDEFORM_OFFSET[n][1];
z += MESHDEFORM_OFFSET[n][2];
- if(x < 0 || x >= mdb->size)
+ if (x < 0 || x >= mdb->size)
return -1;
- if(y < 0 || y >= mdb->size)
+ if (y < 0 || y >= mdb->size)
return -1;
- if(z < 0 || z >= mdb->size)
+ if (z < 0 || z >= mdb->size)
return -1;
return x + y*size + z*size*size;
@@ -1353,14 +1353,14 @@ static void meshdeform_add_intersections(MeshDeformBind *mdb, int x, int y, int
meshdeform_cell_center(mdb, x, y, z, 0, center);
/* check each outgoing edge for intersection */
- for(i=1; i<=6; i++) {
- if(meshdeform_index(mdb, x, y, z, i) == -1)
+ for (i=1; i<=6; i++) {
+ if (meshdeform_index(mdb, x, y, z, i) == -1)
continue;
meshdeform_cell_center(mdb, x, y, z, i, ncenter);
isect= meshdeform_ray_tree_intersect(mdb, center, ncenter);
- if(isect) {
+ if (isect) {
mdb->boundisect[a][i-1]= isect;
mdb->tag[a]= MESHDEFORM_TAG_BOUNDARY;
}
@@ -1380,18 +1380,18 @@ static void meshdeform_bind_floodfill(MeshDeformBind *mdb)
stacksize= 1;
/* floodfill exterior tag */
- while(stacksize > 0) {
+ while (stacksize > 0) {
a= stack[--stacksize];
xyz[2]= a/(size*size);
xyz[1]= (a - xyz[2]*size*size)/size;
xyz[0]= a - xyz[1]*size - xyz[2]*size*size;
- for(i=1; i<=6; i++) {
+ for (i=1; i<=6; i++) {
b= meshdeform_index(mdb, xyz[0], xyz[1], xyz[2], i);
- if(b != -1) {
- if(tag[b] == MESHDEFORM_TAG_UNTYPED ||
+ if (b != -1) {
+ if (tag[b] == MESHDEFORM_TAG_UNTYPED ||
(tag[b] == MESHDEFORM_TAG_BOUNDARY && !mdb->boundisect[a][i-1])) {
tag[b]= MESHDEFORM_TAG_EXTERIOR;
stack[stacksize++]= b;
@@ -1401,23 +1401,23 @@ static void meshdeform_bind_floodfill(MeshDeformBind *mdb)
}
/* other cells are interior */
- for(a=0; a<size*size*size; a++)
- if(tag[a]==MESHDEFORM_TAG_UNTYPED)
+ for (a=0; a<size*size*size; a++)
+ if (tag[a]==MESHDEFORM_TAG_UNTYPED)
tag[a]= MESHDEFORM_TAG_INTERIOR;
#if 0
{
int tb, ti, te, ts;
tb= ti= te= ts= 0;
- for(a=0; a<size*size*size; a++)
- if(tag[a]==MESHDEFORM_TAG_BOUNDARY)
+ for (a=0; a<size*size*size; a++)
+ if (tag[a]==MESHDEFORM_TAG_BOUNDARY)
tb++;
- else if(tag[a]==MESHDEFORM_TAG_INTERIOR)
+ else if (tag[a]==MESHDEFORM_TAG_INTERIOR)
ti++;
- else if(tag[a]==MESHDEFORM_TAG_EXTERIOR) {
+ else if (tag[a]==MESHDEFORM_TAG_EXTERIOR) {
te++;
- if(mdb->semibound[a])
+ if (mdb->semibound[a])
ts++;
}
@@ -1432,8 +1432,8 @@ static float meshdeform_boundary_phi(MeshDeformBind *UNUSED(mdb), MDefBoundIsect
{
int a;
- for(a=0; a<isect->nvert; a++)
- if(isect->v[a] == cagevert)
+ for (a=0; a<isect->nvert; a++)
+ if (isect->v[a] == cagevert)
return isect->uvw[a];
return 0.0f;
@@ -1445,19 +1445,19 @@ static float meshdeform_interp_w(MeshDeformBind *mdb, float *gridvec, float *UNU
float weight, totweight= 0.0f;
int i, a, x, y, z;
- for(i=0; i<3; i++) {
+ for (i=0; i<3; i++) {
ivec[i]= (int)gridvec[i];
dvec[i]= gridvec[i] - ivec[i];
}
- for(i=0; i<8; i++) {
- if(i & 1) { x= ivec[0]+1; wx= dvec[0]; }
+ for (i=0; i<8; i++) {
+ if (i & 1) { x= ivec[0]+1; wx= dvec[0]; }
else { x= ivec[0]; wx= 1.0f-dvec[0]; }
- if(i & 2) { y= ivec[1]+1; wy= dvec[1]; }
+ if (i & 2) { y= ivec[1]+1; wy= dvec[1]; }
else { y= ivec[1]; wy= 1.0f-dvec[1]; }
- if(i & 4) { z= ivec[2]+1; wz= dvec[2]; }
+ if (i & 4) { z= ivec[2]+1; wz= dvec[2]; }
else { z= ivec[2]; wz= 1.0f-dvec[2]; }
CLAMP(x, 0, mdb->size-1);
@@ -1470,7 +1470,7 @@ static float meshdeform_interp_w(MeshDeformBind *mdb, float *gridvec, float *UNU
totweight += weight;
}
- if(totweight > 0.0f)
+ if (totweight > 0.0f)
result /= totweight;
return result;
@@ -1481,11 +1481,11 @@ static void meshdeform_check_semibound(MeshDeformBind *mdb, int x, int y, int z)
int i, a;
a= meshdeform_index(mdb, x, y, z, 0);
- if(mdb->tag[a] != MESHDEFORM_TAG_EXTERIOR)
+ if (mdb->tag[a] != MESHDEFORM_TAG_EXTERIOR)
return;
- for(i=1; i<=6; i++)
- if(mdb->boundisect[a][i-1])
+ for (i=1; i<=6; i++)
+ if (mdb->boundisect[a][i-1])
mdb->semibound[a]= 1;
}
@@ -1497,13 +1497,13 @@ static float meshdeform_boundary_total_weight(MeshDeformBind *mdb, int x, int y,
a= meshdeform_index(mdb, x, y, z, 0);
/* count weight for neighbor cells */
- for(i=1; i<=6; i++) {
- if(meshdeform_index(mdb, x, y, z, i) == -1)
+ for (i=1; i<=6; i++) {
+ if (meshdeform_index(mdb, x, y, z, i) == -1)
continue;
- if(mdb->boundisect[a][i-1])
+ if (mdb->boundisect[a][i-1])
weight= 1.0f/mdb->boundisect[a][i-1]->len;
- else if(!mdb->semibound[a])
+ else if (!mdb->semibound[a])
weight= 1.0f/mdb->width[0];
else
weight= 0.0f;
@@ -1521,15 +1521,15 @@ static void meshdeform_matrix_add_cell(MeshDeformBind *mdb, int x, int y, int z)
int i, a, acenter;
acenter= meshdeform_index(mdb, x, y, z, 0);
- if(mdb->tag[acenter] == MESHDEFORM_TAG_EXTERIOR)
+ if (mdb->tag[acenter] == MESHDEFORM_TAG_EXTERIOR)
return;
nlMatrixAdd(mdb->varidx[acenter], mdb->varidx[acenter], 1.0f);
totweight= meshdeform_boundary_total_weight(mdb, x, y, z);
- for(i=1; i<=6; i++) {
+ for (i=1; i<=6; i++) {
a= meshdeform_index(mdb, x, y, z, i);
- if(a == -1 || mdb->tag[a] == MESHDEFORM_TAG_EXTERIOR)
+ if (a == -1 || mdb->tag[a] == MESHDEFORM_TAG_EXTERIOR)
continue;
isect= mdb->boundisect[acenter][i-1];
@@ -1547,13 +1547,13 @@ static void meshdeform_matrix_add_rhs(MeshDeformBind *mdb, int x, int y, int z,
int i, a, acenter;
acenter= meshdeform_index(mdb, x, y, z, 0);
- if(mdb->tag[acenter] == MESHDEFORM_TAG_EXTERIOR)
+ if (mdb->tag[acenter] == MESHDEFORM_TAG_EXTERIOR)
return;
totweight= meshdeform_boundary_total_weight(mdb, x, y, z);
- for(i=1; i<=6; i++) {
+ for (i=1; i<=6; i++) {
a= meshdeform_index(mdb, x, y, z, i);
- if(a == -1)
+ if (a == -1)
continue;
isect= mdb->boundisect[acenter][i-1];
@@ -1573,13 +1573,13 @@ static void meshdeform_matrix_add_semibound_phi(MeshDeformBind *mdb, int x, int
int i, a;
a= meshdeform_index(mdb, x, y, z, 0);
- if(!mdb->semibound[a])
+ if (!mdb->semibound[a])
return;
mdb->phi[a]= 0.0f;
totweight= meshdeform_boundary_total_weight(mdb, x, y, z);
- for(i=1; i<=6; i++) {
+ for (i=1; i<=6; i++) {
isect= mdb->boundisect[a][i-1];
if (isect) {
@@ -1596,21 +1596,21 @@ static void meshdeform_matrix_add_exterior_phi(MeshDeformBind *mdb, int x, int y
int i, a, acenter;
acenter= meshdeform_index(mdb, x, y, z, 0);
- if(mdb->tag[acenter] != MESHDEFORM_TAG_EXTERIOR || mdb->semibound[acenter])
+ if (mdb->tag[acenter] != MESHDEFORM_TAG_EXTERIOR || mdb->semibound[acenter])
return;
phi= 0.0f;
totweight= 0.0f;
- for(i=1; i<=6; i++) {
+ for (i=1; i<=6; i++) {
a= meshdeform_index(mdb, x, y, z, i);
- if(a != -1 && mdb->semibound[a]) {
+ if (a != -1 && mdb->semibound[a]) {
phi += mdb->phi[a];
totweight += 1.0f;
}
}
- if(totweight != 0.0f)
+ if (totweight != 0.0f)
mdb->phi[acenter]= phi/totweight;
}
@@ -1623,10 +1623,10 @@ static void meshdeform_matrix_solve(MeshDeformModifierData *mmd, MeshDeformBind
/* setup variable indices */
mdb->varidx= MEM_callocN(sizeof(int)*mdb->size3, "MeshDeformDSvaridx");
- for(a=0, totvar=0; a<mdb->size3; a++)
+ for (a=0, totvar=0; a<mdb->size3; a++)
mdb->varidx[a]= (mdb->tag[a] == MESHDEFORM_TAG_EXTERIOR)? -1: totvar++;
- if(totvar == 0) {
+ if (totvar == 0) {
MEM_freeN(mdb->varidx);
return;
}
@@ -1645,22 +1645,22 @@ static void meshdeform_matrix_solve(MeshDeformModifierData *mmd, MeshDeformBind
nlBegin(NL_MATRIX);
/* build matrix */
- for(z=0; z<mdb->size; z++)
- for(y=0; y<mdb->size; y++)
- for(x=0; x<mdb->size; x++)
+ for (z=0; z<mdb->size; z++)
+ for (y=0; y<mdb->size; y++)
+ for (x=0; x<mdb->size; x++)
meshdeform_matrix_add_cell(mdb, x, y, z);
/* solve for each cage vert */
- for(a=0; a<mdb->totcagevert; a++) {
- if(a != 0) {
+ for (a=0; a<mdb->totcagevert; a++) {
+ if (a != 0) {
nlBegin(NL_SYSTEM);
nlBegin(NL_MATRIX);
}
/* fill in right hand side and solve */
- for(z=0; z<mdb->size; z++)
- for(y=0; y<mdb->size; y++)
- for(x=0; x<mdb->size; x++)
+ for (z=0; z<mdb->size; z++)
+ for (y=0; y<mdb->size; y++)
+ for (x=0; x<mdb->size; x++)
meshdeform_matrix_add_rhs(mdb, x, y, z, a);
nlEnd(NL_MATRIX);
@@ -1670,27 +1670,27 @@ static void meshdeform_matrix_solve(MeshDeformModifierData *mmd, MeshDeformBind
nlPrintMatrix();
#endif
- if(nlSolveAdvanced(NULL, NL_TRUE)) {
- for(z=0; z<mdb->size; z++)
- for(y=0; y<mdb->size; y++)
- for(x=0; x<mdb->size; x++)
+ if (nlSolveAdvanced(NULL, NL_TRUE)) {
+ for (z=0; z<mdb->size; z++)
+ for (y=0; y<mdb->size; y++)
+ for (x=0; x<mdb->size; x++)
meshdeform_matrix_add_semibound_phi(mdb, x, y, z, a);
- for(z=0; z<mdb->size; z++)
- for(y=0; y<mdb->size; y++)
- for(x=0; x<mdb->size; x++)
+ for (z=0; z<mdb->size; z++)
+ for (y=0; y<mdb->size; y++)
+ for (x=0; x<mdb->size; x++)
meshdeform_matrix_add_exterior_phi(mdb, x, y, z, a);
- for(b=0; b<mdb->size3; b++) {
- if(mdb->tag[b] != MESHDEFORM_TAG_EXTERIOR)
+ for (b=0; b<mdb->size3; b++) {
+ if (mdb->tag[b] != MESHDEFORM_TAG_EXTERIOR)
mdb->phi[b]= nlGetVariable(0, mdb->varidx[b]);
mdb->totalphi[b] += mdb->phi[b];
}
- if(mdb->weights) {
+ if (mdb->weights) {
/* static bind : compute weights for each vertex */
- for(b=0; b<mdb->totvert; b++) {
- if(mdb->inside[b]) {
+ for (b=0; b<mdb->totvert; b++) {
+ if (mdb->inside[b]) {
copy_v3_v3(vec, mdb->vertexcos[b]);
gridvec[0]= (vec[0] - mdb->min[0] - mdb->halfwidth[0])/mdb->width[0];
gridvec[1]= (vec[1] - mdb->min[1] - mdb->halfwidth[1])/mdb->width[1];
@@ -1704,8 +1704,8 @@ static void meshdeform_matrix_solve(MeshDeformModifierData *mmd, MeshDeformBind
MDefBindInfluence *inf;
/* dynamic bind */
- for(b=0; b<mdb->size3; b++) {
- if(mdb->phi[b] >= MESHDEFORM_MIN_INFLUENCE) {
+ for (b=0; b<mdb->size3; b++) {
+ if (mdb->phi[b] >= MESHDEFORM_MIN_INFLUENCE) {
inf= BLI_memarena_alloc(mdb->memarena, sizeof(*inf));
inf->vertex= a;
inf->weight= mdb->phi[b];
@@ -1727,9 +1727,9 @@ static void meshdeform_matrix_solve(MeshDeformModifierData *mmd, MeshDeformBind
#if 0
/* sanity check */
- for(b=0; b<mdb->size3; b++)
- if(mdb->tag[b] != MESHDEFORM_TAG_EXTERIOR)
- if(fabs(mdb->totalphi[b] - 1.0f) > 1e-4)
+ for (b=0; b<mdb->size3; b++)
+ if (mdb->tag[b] != MESHDEFORM_TAG_EXTERIOR)
+ if (fabs(mdb->totalphi[b] - 1.0f) > 1e-4)
printf("totalphi deficiency [%s|%d] %d: %.10f\n",
(mdb->tag[b] == MESHDEFORM_TAG_INTERIOR)? "interior": "boundary", mdb->semibound[b], mdb->varidx[b], mdb->totalphi[b]);
#endif
@@ -1751,7 +1751,7 @@ static void harmonic_coordinates_bind(Scene *UNUSED(scene), MeshDeformModifierDa
/* compute bounding box of the cage mesh */
INIT_MINMAX(mdb->min, mdb->max);
- for(a=0; a<mdb->totcagevert; a++)
+ for (a=0; a<mdb->totcagevert; a++)
DO_MINMAX(mdb->cagecos[a], mdb->min, mdb->max);
/* allocate memory */
@@ -1765,7 +1765,7 @@ static void harmonic_coordinates_bind(Scene *UNUSED(scene), MeshDeformModifierDa
mdb->inside= MEM_callocN(sizeof(int)*mdb->totvert, "MDefInside");
- if(mmd->flag & MOD_MDEF_DYNAMIC_BIND)
+ if (mmd->flag & MOD_MDEF_DYNAMIC_BIND)
mdb->dyngrid= MEM_callocN(sizeof(MDefBindInfluence*)*mdb->size3, "MDefDynGrid");
else
mdb->weights= MEM_callocN(sizeof(float)*mdb->totvert*mdb->totcagevert, "MDefWeights");
@@ -1776,11 +1776,11 @@ static void harmonic_coordinates_bind(Scene *UNUSED(scene), MeshDeformModifierDa
/* make bounding box equal size in all directions, add padding, and compute
* width of the cells */
maxwidth = -1.0f;
- for(a=0; a<3; a++)
- if(mdb->max[a]-mdb->min[a] > maxwidth)
+ for (a=0; a<3; a++)
+ if (mdb->max[a]-mdb->min[a] > maxwidth)
maxwidth= mdb->max[a]-mdb->min[a];
- for(a=0; a<3; a++) {
+ for (a=0; a<3; a++) {
center[a]= (mdb->min[a]+mdb->max[a])*0.5f;
mdb->min[a]= center[a] - maxwidth*0.5f;
mdb->max[a]= center[a] + maxwidth*0.5f;
@@ -1796,10 +1796,10 @@ static void harmonic_coordinates_bind(Scene *UNUSED(scene), MeshDeformModifierDa
progress_bar(0, "Setting up mesh deform system");
totinside= 0;
- for(a=0; a<mdb->totvert; a++) {
+ for (a=0; a<mdb->totvert; a++) {
copy_v3_v3(vec, mdb->vertexcos[a]);
mdb->inside[a]= meshdeform_inside_cage(mdb, vec);
- if(mdb->inside[a])
+ if (mdb->inside[a])
totinside++;
}
@@ -1808,53 +1808,53 @@ static void harmonic_coordinates_bind(Scene *UNUSED(scene), MeshDeformModifierDa
mdb->memarena= BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, "harmonic coords arena");
/* start with all cells untyped */
- for(a=0; a<mdb->size3; a++)
+ for (a=0; a<mdb->size3; a++)
mdb->tag[a]= MESHDEFORM_TAG_UNTYPED;
/* detect intersections and tag boundary cells */
- for(z=0; z<mdb->size; z++)
- for(y=0; y<mdb->size; y++)
- for(x=0; x<mdb->size; x++)
+ for (z=0; z<mdb->size; z++)
+ for (y=0; y<mdb->size; y++)
+ for (x=0; x<mdb->size; x++)
meshdeform_add_intersections(mdb, x, y, z);
/* compute exterior and interior tags */
meshdeform_bind_floodfill(mdb);
- for(z=0; z<mdb->size; z++)
- for(y=0; y<mdb->size; y++)
- for(x=0; x<mdb->size; x++)
+ for (z=0; z<mdb->size; z++)
+ for (y=0; y<mdb->size; y++)
+ for (x=0; x<mdb->size; x++)
meshdeform_check_semibound(mdb, x, y, z);
/* solve */
meshdeform_matrix_solve(mmd, mdb);
/* assign results */
- if(mmd->flag & MOD_MDEF_DYNAMIC_BIND) {
+ if (mmd->flag & MOD_MDEF_DYNAMIC_BIND) {
mmd->totinfluence= 0;
- for(a=0; a<mdb->size3; a++)
- for(inf=mdb->dyngrid[a]; inf; inf=inf->next)
+ for (a=0; a<mdb->size3; a++)
+ for (inf=mdb->dyngrid[a]; inf; inf=inf->next)
mmd->totinfluence++;
/* convert MDefBindInfluences to smaller MDefInfluences */
mmd->dyngrid= MEM_callocN(sizeof(MDefCell)*mdb->size3, "MDefDynGrid");
mmd->dyninfluences= MEM_callocN(sizeof(MDefInfluence)*mmd->totinfluence, "MDefInfluence");
offset= 0;
- for(a=0; a<mdb->size3; a++) {
+ for (a=0; a<mdb->size3; a++) {
cell= &mmd->dyngrid[a];
cell->offset= offset;
totweight= 0.0f;
mdinf= mmd->dyninfluences + cell->offset;
- for(inf=mdb->dyngrid[a]; inf; inf=inf->next, mdinf++) {
+ for (inf=mdb->dyngrid[a]; inf; inf=inf->next, mdinf++) {
mdinf->weight= inf->weight;
mdinf->vertex= inf->vertex;
totweight += mdinf->weight;
cell->totinfluence++;
}
- if(totweight > 0.0f) {
+ if (totweight > 0.0f) {
mdinf= mmd->dyninfluences + cell->offset;
- for(b=0; b<cell->totinfluence; b++, mdinf++)
+ for (b=0; b<cell->totinfluence; b++, mdinf++)
mdinf->weight /= totweight;
}
@@ -1893,9 +1893,9 @@ static void heat_weighting_bind(Scene *scene, DerivedMesh *dm, MeshDeformModifie
mdb->weights= MEM_callocN(sizeof(float)*mdb->totvert*mdb->totcagevert, "MDefWeights");
/* count triangles */
- for(tottri=0, a=0, mf=mface; a<totface; a++, mf++) {
+ for (tottri=0, a=0, mf=mface; a<totface; a++, mf++) {
tottri++;
- if(mf->v4) tottri++;
+ if (mf->v4) tottri++;
}
/* create laplacian */
@@ -1914,27 +1914,27 @@ static void heat_weighting_bind(Scene *scene, DerivedMesh *dm, MeshDeformModifie
laplacian_system_construct_end(sys);
/* compute weights per bone */
- for(j=0; j<mdb->totcagevert; j++) {
+ for (j=0; j<mdb->totcagevert; j++) {
/* fill right hand side */
laplacian_begin_solve(sys, -1);
- for(a=0; a<totvert; a++)
- if(heat_source_closest(sys, a, j))
+ for (a=0; a<totvert; a++)
+ if (heat_source_closest(sys, a, j))
laplacian_add_right_hand_side(sys, a,
sys->heat.H[a]*sys->heat.p[a]);
/* solve */
- if(laplacian_system_solve(sys)) {
+ if (laplacian_system_solve(sys)) {
/* load solution into vertex groups */
- for(a=0; a<totvert; a++) {
+ for (a=0; a<totvert; a++) {
solution= laplacian_system_get_solution(a);
weight= heat_limit_weight(solution);
- if(weight > 0.0f)
+ if (weight > 0.0f)
mdb->weights[a*mdb->totcagevert + j] = weight;
}
}
- else if(!thrownerror) {
+ else if (!thrownerror) {
error("Mesh Deform Heat Weighting:"
" failed to find solution for one or more vertices");
thrownerror= 1;
@@ -1971,14 +1971,14 @@ void mesh_deform_bind(Scene *scene, MeshDeformModifierData *mmd, float *vertexco
copy_m4_m4(mdb.cagemat, cagemat);
mvert= mdb.cagedm->getVertArray(mdb.cagedm);
- for(a=0; a<mdb.totcagevert; a++)
+ for (a=0; a<mdb.totcagevert; a++)
copy_v3_v3(mdb.cagecos[a], mvert[a].co);
- for(a=0; a<mdb.totvert; a++)
+ for (a=0; a<mdb.totvert; a++)
mul_v3_m4v3(mdb.vertexcos[a], mdb.cagemat, vertexcos + a*3);
/* solve */
#if 0
- if(mmd->mode == MOD_MDEF_VOLUME)
+ if (mmd->mode == MOD_MDEF_VOLUME)
harmonic_coordinates_bind(scene, mmd, &mdb);
else
heat_weighting_bind(scene, dm, mmd, &mdb);
@@ -1993,7 +1993,7 @@ void mesh_deform_bind(Scene *scene, MeshDeformModifierData *mmd, float *vertexco
copy_m4_m4(mmd->bindmat, mmd->object->obmat);
/* transform bindcagecos to world space */
- for(a=0; a<mdb.totcagevert; a++)
+ for (a=0; a<mdb.totcagevert; a++)
mul_m4_v3(mmd->object->obmat, mmd->bindcagecos+a*3);
/* free */
diff --git a/source/blender/editors/armature/poseSlide.c b/source/blender/editors/armature/poseSlide.c
index de7a243f75f..be520d1e8a0 100644
--- a/source/blender/editors/armature/poseSlide.c
+++ b/source/blender/editors/armature/poseSlide.c
@@ -1102,7 +1102,7 @@ static void pose_propagate_fcurve (wmOperator *op, Object *ob, FCurve *fcu,
* doesn't need to firstly keyframe the pose (though this doesn't mean that
* they can't either)
*/
- if( !pose_propagate_get_refVal(ob, fcu, &refVal))
+ if ( !pose_propagate_get_refVal(ob, fcu, &refVal))
return;
/* find the first keyframe to start propagating from
diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c
index 2689ec68563..3d33930fa49 100644
--- a/source/blender/editors/armature/poseobject.c
+++ b/source/blender/editors/armature/poseobject.c
@@ -109,7 +109,7 @@ void ED_armature_enter_posemode(bContext *C, Base *base)
void ED_armature_exit_posemode(bContext *C, Base *base)
{
- if(base) {
+ if (base) {
Object *ob= base->object;
ob->restore_mode = ob->mode;
@@ -154,18 +154,18 @@ static int pose_channel_in_IK_chain(Object *ob, bPoseChannel *pchan, int level)
/* No need to check if constraint is active (has influence),
* since all constraints with CONSTRAINT_IK_AUTO are active */
- for(con= pchan->constraints.first; con; con= con->next) {
- if(con->type==CONSTRAINT_TYPE_KINEMATIC) {
+ for (con= pchan->constraints.first; con; con= con->next) {
+ if (con->type==CONSTRAINT_TYPE_KINEMATIC) {
bKinematicConstraint *data= con->data;
- if(data->rootbone == 0 || data->rootbone > level) {
- if((data->flag & CONSTRAINT_IK_AUTO)==0)
+ if (data->rootbone == 0 || data->rootbone > level) {
+ if ((data->flag & CONSTRAINT_IK_AUTO)==0)
return 1;
}
}
}
- for(bone= pchan->bone->childbase.first; bone; bone= bone->next) {
+ for (bone= pchan->bone->childbase.first; bone; bone= bone->next) {
pchan= get_pose_channel(ob->pose, bone->name);
- if(pchan && pose_channel_in_IK_chain(ob, pchan, level + 1))
+ if (pchan && pose_channel_in_IK_chain(ob, pchan, level + 1))
return 1;
}
return 0;
@@ -338,7 +338,7 @@ static int pose_select_constraint_target_exec(bContext *C, wmOperator *UNUSED(op
for (ct= targets.first; ct; ct= ct->next) {
if ((ct->tar == ob) && (ct->subtarget[0])) {
bPoseChannel *pchanc= get_pose_channel(ob->pose, ct->subtarget);
- if((pchanc) && !(pchanc->bone->flag & BONE_UNSELECTABLE)) {
+ if ((pchanc) && !(pchanc->bone->flag & BONE_UNSELECTABLE)) {
pchanc->bone->flag |= BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL;
found= 1;
}
@@ -687,23 +687,23 @@ static int pose_bone_flip_active_exec (bContext *C, wmOperator *UNUSED(op))
Object *ob_act= CTX_data_active_object(C);
Object *ob= object_pose_armature_get(ob_act);
- if(ob && (ob->mode & OB_MODE_POSE)) {
+ if (ob && (ob->mode & OB_MODE_POSE)) {
bArmature *arm= ob->data;
- if(arm->act_bone) {
+ if (arm->act_bone) {
bPoseChannel *pchanf;
char name[MAXBONENAME];
flip_side_name(name, arm->act_bone->name, TRUE);
pchanf= get_pose_channel(ob->pose, name);
- if(pchanf && pchanf->bone != arm->act_bone) {
+ if (pchanf && pchanf->bone != arm->act_bone) {
arm->act_bone->flag &= ~BONE_SELECTED;
pchanf->bone->flag |= BONE_SELECTED;
arm->act_bone= pchanf->bone;
/* in weightpaint we select the associated vertex group too */
- if(ob_act->mode & OB_MODE_WEIGHT_PAINT) {
+ if (ob_act->mode & OB_MODE_WEIGHT_PAINT) {
ED_vgroup_select_by_name(ob_act, name);
DAG_id_tag_update(&ob_act->id, OB_RECALC_DATA);
}
@@ -876,7 +876,7 @@ static void pose_copy_menu(Scene *scene)
BLI_duplicatelist(&const_copy, &(pchanact->constraints));
/* build the puplist of constraints */
- for (con = pchanact->constraints.first, i=0; con; con=con->next, i++){
+ for (con = pchanact->constraints.first, i=0; con; con=con->next, i++) {
const_toggle[i]= 1;
// add_numbut(i, TOG|INT, con->name, 0, 0, &(const_toggle[i]), "");
}
@@ -946,7 +946,7 @@ void free_posebuf(void)
bPoseChannel *pchan;
for (pchan= g_posebuf->chanbase.first; pchan; pchan= pchan->next) {
- if(pchan->prop) {
+ if (pchan->prop) {
IDP_FreeProperty(pchan->prop);
MEM_freeN(pchan->prop);
}
@@ -968,8 +968,8 @@ static void set_pose_keys (Object *ob)
bArmature *arm= ob->data;
bPoseChannel *chan;
- if (ob->pose){
- for (chan=ob->pose->chanbase.first; chan; chan=chan->next){
+ if (ob->pose) {
+ for (chan=ob->pose->chanbase.first; chan; chan=chan->next) {
Bone *bone= chan->bone;
if ((bone) && (bone->flag & BONE_SELECTED) && (arm->layer & bone->layer))
chan->flag |= POSE_KEY;
@@ -1789,7 +1789,7 @@ static int pose_autoside_names_exec (bContext *C, wmOperator *op)
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]))
+ if (bone_autoside_name(newname, 1, axis, pchan->bone->head[axis], pchan->bone->tail[axis]))
ED_armature_bone_rename(arm, pchan->name, newname);
}
CTX_DATA_END;
@@ -2046,7 +2046,7 @@ static int pose_bone_layers_exec (bContext *C, wmOperator *op)
PointerRNA ptr;
int layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
- if(ob==NULL || ob->data==NULL) {
+ if (ob==NULL || ob->data==NULL) {
return OPERATOR_CANCELLED;
}
diff --git a/source/blender/editors/armature/reeb.c b/source/blender/editors/armature/reeb.c
index e832247e67c..30f929c9603 100644
--- a/source/blender/editors/armature/reeb.c
+++ b/source/blender/editors/armature/reeb.c
@@ -126,7 +126,7 @@ static VertexData *allocVertexData(EditMesh *em)
data = MEM_callocN(sizeof(VertexData) * totvert, "VertexData");
- for(index = 0, eve = em->verts.first; eve; index++, eve = eve->next)
+ for (index = 0, eve = em->verts.first; eve; index++, eve = eve->next)
{
data[index].i = index;
data[index].w = 0;
@@ -183,7 +183,7 @@ void REEB_freeGraph(ReebGraph *rg)
ReebNode *node;
// free nodes
- for( node = rg->nodes.first; node; node = node->next )
+ for ( node = rg->nodes.first; node; node = node->next )
{
BLI_freeNode((BGraph*)rg, (BNode*)node);
}
@@ -191,7 +191,7 @@ void REEB_freeGraph(ReebGraph *rg)
// free arcs
arc = rg->arcs.first;
- while( arc )
+ while ( arc )
{
ReebArc *next = arc->next;
REEB_freeArc((BArc*)arc);
@@ -407,7 +407,7 @@ ReebGraph *BIF_graphForMultiNode(ReebGraph *rg, ReebNode *node)
{
ReebGraph *multi_rg = rg;
- while(multi_rg && multi_rg->multi_level != node->multi_level)
+ while (multi_rg && multi_rg->multi_level != node->multi_level)
{
multi_rg = multi_rg->link_up;
}
@@ -436,7 +436,7 @@ static void printArc(ReebArc *arc)
ReebNode *tail = (ReebNode*)arc->tail;
printf("arc: (%i) %f -> (%i) %f\n", head->index, head->weight, tail->index, tail->weight);
- for(edge = arc->edges.first; edge ; edge = edge->next)
+ for (edge = arc->edges.first; edge ; edge = edge->next)
{
printf("\tedge (%i, %i)\n", edge->v1->index, edge->v2->index);
}
@@ -484,12 +484,12 @@ void repositionNodes(ReebGraph *rg)
BNode *node = NULL;
// Reset node positions
- for(node = rg->nodes.first; node; node = node->next)
+ for (node = rg->nodes.first; node; node = node->next)
{
node->p[0] = node->p[1] = node->p[2] = 0;
}
- for(arc = rg->arcs.first; arc; arc = arc->next)
+ for (arc = rg->arcs.first; arc; arc = arc->next)
{
if (((ReebArc*)arc)->bcount > 0)
{
@@ -512,10 +512,10 @@ void verifyNodeDegree(ReebGraph *rg)
ReebNode *node = NULL;
ReebArc *arc = NULL;
- for(node = rg->nodes.first; node; node = node->next)
+ for (node = rg->nodes.first; node; node = node->next)
{
int count = 0;
- for(arc = rg->arcs.first; arc; arc = arc->next)
+ for (arc = rg->arcs.first; arc; arc = arc->next)
{
if (arc->head == node || arc->tail == node)
{
@@ -542,7 +542,7 @@ static void verifyBucketsArc(ReebGraph *UNUSED(rg), ReebArc *arc)
if (arc->bcount > 0)
{
int i;
- for(i = 0; i < arc->bcount; i++)
+ for (i = 0; i < arc->bcount; i++)
{
if (arc->buckets[i].nv == 0)
{
@@ -568,7 +568,7 @@ void verifyBuckets(ReebGraph *rg)
{
#ifdef DEBUG_REEB
ReebArc *arc = NULL;
- for(arc = rg->arcs.first; arc; arc = arc->next)
+ for (arc = rg->arcs.first; arc; arc = arc->next)
{
verifyBucketsArc(rg, arc);
}
@@ -580,7 +580,7 @@ void verifyFaces(ReebGraph *rg)
#ifdef DEBUG_REEB
int total = 0;
ReebArc *arc = NULL;
- for(arc = rg->arcs.first; arc; arc = arc->next)
+ for (arc = rg->arcs.first; arc; arc = arc->next)
{
total += BLI_ghash_size(arc->faces);
}
@@ -667,17 +667,17 @@ static void mergeArcBuckets(ReebArc *aDst, ReebArc *aSrc, float start, float end
start = MAX3(start, aDst->buckets[0].val, aSrc->buckets[0].val);
- while(indexDst < aDst->bcount && aDst->buckets[indexDst].val < start)
+ while (indexDst < aDst->bcount && aDst->buckets[indexDst].val < start)
{
indexDst++;
}
- while(indexSrc < aSrc->bcount && aSrc->buckets[indexSrc].val < start)
+ while (indexSrc < aSrc->bcount && aSrc->buckets[indexSrc].val < start)
{
indexSrc++;
}
- for( ; indexDst < aDst->bcount &&
+ for ( ; indexDst < aDst->bcount &&
indexSrc < aSrc->bcount &&
aDst->buckets[indexDst].val <= end &&
aSrc->buckets[indexSrc].val <= end
@@ -718,7 +718,7 @@ static void allocArcBuckets(ReebArc *arc)
{
arc->buckets = MEM_callocN(sizeof(EmbedBucket) * arc->bcount, "embed bucket");
- for(i = 0; i < arc->bcount; i++)
+ for (i = 0; i < arc->bcount; i++)
{
arc->buckets[i].val = start + i;
}
@@ -779,7 +779,7 @@ static void reweightBuckets(ReebArc *arc)
if (arc->bcount > 0)
{
- for(i = 0; i < arc->bcount; i++)
+ for (i = 0; i < arc->bcount; i++)
{
arc->buckets[i].val = start + i;
}
@@ -810,7 +810,7 @@ static void fillArcEmptyBuckets(ReebArc *arc)
start_p = arc->head->p;
- for(i = 0; i < arc->bcount; i++)
+ for (i = 0; i < arc->bcount; i++)
{
EmbedBucket *bucket = arc->buckets + i;
@@ -1013,12 +1013,12 @@ void REEB_RadialSymmetry(BNode* root_node, RadialArc* ring, int count)
bucket2 = IT_next(iter2);
/* Make sure they both start at the same value */
- while(bucket1 && bucket2 && bucket1->val < bucket2->val)
+ while (bucket1 && bucket2 && bucket1->val < bucket2->val)
{
bucket1 = IT_next(iter1);
}
- while(bucket1 && bucket2 && bucket2->val < bucket1->val)
+ while (bucket1 && bucket2 && bucket2->val < bucket1->val)
{
bucket2 = IT_next(iter2);
}
@@ -1075,12 +1075,12 @@ void REEB_RadialSymmetry(BNode* root_node, RadialArc* ring, int count)
bucket2 = IT_next(iter2);
/* Make sure they both start at the same value */
- while(bucket1 && bucket1->val < bucket2->val)
+ while (bucket1 && bucket1->val < bucket2->val)
{
bucket1 = IT_next(iter1);
}
- while(bucket2 && bucket2->val < bucket1->val)
+ while (bucket2 && bucket2->val < bucket1->val)
{
bucket2 = IT_next(iter2);
}
@@ -1136,12 +1136,12 @@ void REEB_AxialSymmetry(BNode* root_node, BNode* node1, BNode* node2, struct BAr
bucket2 = IT_next(iter2);
/* Make sure they both start at the same value */
- while(bucket1 && bucket1->val < bucket2->val)
+ while (bucket1 && bucket1->val < bucket2->val)
{
bucket1 = IT_next(iter1);
}
- while(bucket2 && bucket2->val < bucket1->val)
+ while (bucket2 && bucket2->val < bucket1->val)
{
bucket2 = IT_next(iter2);
}
@@ -1194,13 +1194,13 @@ void postprocessGraph(ReebGraph *rg, char mode)
return;
}
- for(arc = rg->arcs.first; arc; arc = arc->next)
+ for (arc = rg->arcs.first; arc; arc = arc->next)
{
EmbedBucket *buckets = arc->buckets;
int bcount = arc->bcount;
int index;
- for(index = 1; index < bcount - 1; index++)
+ for (index = 1; index < bcount - 1; index++)
{
interp_v3_v3v3(buckets[index].p, buckets[index].p, buckets[index - 1].p, fac1 / (fac1 + fac2));
interp_v3_v3v3(buckets[index].p, buckets[index].p, buckets[index + 1].p, fac3 / (fac1 + fac2 + fac3));
@@ -1511,7 +1511,7 @@ static void filterArc(ReebGraph *rg, ReebNode *newNode, ReebNode *removedNode, R
if (merging)
{
/* first pass, merge buckets for arcs that spawned the two nodes into the source arc*/
- for(arc = rg->arcs.first; arc; arc = arc->next)
+ for (arc = rg->arcs.first; arc; arc = arc->next)
{
if (arc->head == srcArc->head && arc->tail == srcArc->tail && arc != srcArc)
{
@@ -1524,7 +1524,7 @@ static void filterArc(ReebGraph *rg, ReebNode *newNode, ReebNode *removedNode, R
/* second pass, replace removedNode by newNode, remove arcs that are collapsed in a loop */
arc = rg->arcs.first;
- while(arc)
+ while (arc)
{
nextArc = arc->next;
@@ -1587,7 +1587,7 @@ void filterNullReebGraph(ReebGraph *rg)
ReebArc *arc = NULL, *nextArc = NULL;
arc = rg->arcs.first;
- while(arc)
+ while (arc)
{
nextArc = arc->next;
// Only collapse arcs too short to have any embed bucket
@@ -1749,14 +1749,14 @@ int filterSmartReebGraph(ReebGraph *UNUSED(rg), float UNUSED(threshold))
#ifdef DEBUG_REEB
{
EditFace *efa;
- for(efa=G.editMesh->faces.first; efa; efa=efa->next) {
+ for (efa=G.editMesh->faces.first; efa; efa=efa->next) {
efa->tmp.fp = -1;
}
}
#endif
arc = rg->arcs.first;
- while(arc)
+ while (arc)
{
nextArc = arc->next;
@@ -1772,7 +1772,7 @@ int filterSmartReebGraph(ReebGraph *UNUSED(rg), float UNUSED(threshold))
float avg_angle = 0;
float avg_vec[3] = {0,0,0};
- for(BLI_ghashIterator_init(&ghi, arc->faces);
+ for (BLI_ghashIterator_init(&ghi, arc->faces);
!BLI_ghashIterator_isDone(&ghi);
BLI_ghashIterator_step(&ghi))
{
@@ -1963,7 +1963,7 @@ static void finalizeGraph(ReebGraph *rg, char passes, char method)
sortArcs(rg);
- for(i = 0; i < passes; i++)
+ for (i = 0; i < passes; i++)
{
postprocessGraph(rg, method);
}
@@ -2001,17 +2001,17 @@ static void spreadWeight(EditMesh *em)
verts = MEM_callocN(sizeof(EditVert*) * totvert, "verts array");
- for(eve = em->verts.first, i = 0; eve; eve = eve->next, i++)
+ for (eve = em->verts.first, i = 0; eve; eve = eve->next, i++)
{
verts[i] = eve;
}
- while(work_needed == 1)
+ while (work_needed == 1)
{
work_needed = 0;
qsort(verts, totvert, sizeof(EditVert*), compareVerts);
- for(i = 0; i < totvert; i++)
+ for (i = 0; i < totvert; i++)
{
eve = verts[i];
@@ -2053,14 +2053,14 @@ void REEB_exportGraph(ReebGraph *rg, int count)
}
f = BLI_fopen(filename, "w");
- for(arc = rg->arcs.first; arc; arc = arc->next)
+ for (arc = rg->arcs.first; arc; arc = arc->next)
{
int i;
float p[3];
exportNode(f, "v1", arc->head);
- for(i = 0; i < arc->bcount; i++)
+ for (i = 0; i < arc->bcount; i++)
{
fprintf(f, "b nv:%i %f %f %f\n", arc->buckets[i].nv, arc->buckets[i].p[0], arc->buckets[i].p[1], arc->buckets[i].p[2]);
}
@@ -2098,7 +2098,7 @@ void removeNormalNodes(ReebGraph *rg)
ReebArc *arc, *nextArc;
// Merge degree 2 nodes
- for(arc = rg->arcs.first; arc; arc = nextArc)
+ for (arc = rg->arcs.first; arc; arc = nextArc)
{
nextArc = arc->next;
@@ -2176,7 +2176,7 @@ static ReebArc *nextArcMappedToEdge(ReebArc *arc, ReebEdge *e)
ReebArc *result = NULL;
/* Find the ReebEdge in the edge list */
- for(edge = arc->edges.first; edge && !edgeEquals(edge, e); edge = edge->next)
+ for (edge = arc->edges.first; edge && !edgeEquals(edge, e); edge = edge->next)
{ }
nextEdge = edge->nextEdge;
@@ -2198,7 +2198,7 @@ void mergeArcFaces(ReebGraph *UNUSED(rg), ReebArc *aDst, ReebArc *aSrc)
{
GHashIterator ghi;
- for(BLI_ghashIterator_init(&ghi, aSrc->faces);
+ for (BLI_ghashIterator_init(&ghi, aSrc->faces);
!BLI_ghashIterator_isDone(&ghi);
BLI_ghashIterator_step(&ghi))
{
@@ -2213,7 +2213,7 @@ void mergeArcEdges(ReebGraph *rg, ReebArc *aDst, ReebArc *aSrc, MergeDirection d
if (direction == MERGE_APPEND)
{
- for(e = aSrc->edges.first; e; e = e->next)
+ for (e = aSrc->edges.first; e; e = e->next)
{
e->arc = aDst; // Edge is stolen by new arc
}
@@ -2222,7 +2222,7 @@ void mergeArcEdges(ReebGraph *rg, ReebArc *aDst, ReebArc *aSrc, MergeDirection d
}
else
{
- for(e = aSrc->edges.first; e; e = e->next)
+ for (e = aSrc->edges.first; e; e = e->next)
{
ReebEdge *newEdge = copyEdge(e);
@@ -2246,7 +2246,7 @@ void mergeArcEdges(ReebGraph *rg, ReebArc *aDst, ReebArc *aSrc, MergeDirection d
{
ReebEdge *previous = (ReebEdge*)*p;
- while(previous->nextEdge != e)
+ while (previous->nextEdge != e)
{
previous = previous->nextEdge;
}
@@ -2497,7 +2497,7 @@ static ReebEdge * createArc(ReebGraph *rg, ReebNode *node1, ReebNode *node2)
addVertToBucket(&(arc->buckets[arc->bcount - 1]), arc->tail->co);
}
#else
- for(i = 0; i < arc->bcount; i++)
+ for (i = 0; i < arc->bcount; i++)
{
float co[3];
float f = (arc->buckets[i].val - offset) / len;
@@ -2595,7 +2595,7 @@ ReebGraph * generateReebGraph(EditMesh *em, int subdivisions)
renormalizeWeight(em, (float)rg->resolution);
/* Adding vertice */
- for(index = 0, eve = em->verts.first; eve; eve = eve->next)
+ for (index = 0, eve = em->verts.first; eve; eve = eve->next)
{
if (eve->h == 0)
{
@@ -2606,7 +2606,7 @@ ReebGraph * generateReebGraph(EditMesh *em, int subdivisions)
}
/* Adding face, edge per edge */
- for(efa = em->faces.first; efa; efa = efa->next)
+ for (efa = em->faces.first; efa; efa = efa->next)
{
if (efa->h == 0)
{
@@ -2656,7 +2656,7 @@ void renormalizeWeight(EditMesh *em, float newmax)
eve = em->verts.first;
minimum = weightData(eve);
maximum = minimum;
- for(; eve; eve = eve->next)
+ for (; eve; eve = eve->next)
{
maximum = MAX2(maximum, weightData(eve));
minimum = MIN2(minimum, weightData(eve));
@@ -2665,7 +2665,7 @@ void renormalizeWeight(EditMesh *em, float newmax)
range = maximum - minimum;
/* Normalize weights */
- for(eve = em->verts.first; eve; eve = eve->next)
+ for (eve = em->verts.first; eve; eve = eve->next)
{
float weight = (weightData(eve) - minimum) / range * newmax;
weightSetData(eve, weight);
@@ -2681,7 +2681,7 @@ int weightFromLoc(EditMesh *em, int axis)
return 0;
/* Copy coordinate in weight */
- for(eve = em->verts.first; eve; eve = eve->next)
+ for (eve = em->verts.first; eve; eve = eve->next)
{
weightSetData(eve, eve->co[axis]);
}
@@ -2745,7 +2745,7 @@ int weightToHarmonic(EditMesh *em, EdgeIndex *indexed_edges)
int rval;
/* Find local extrema */
- for(eve = em->verts.first; eve; eve = eve->next)
+ for (eve = em->verts.first; eve; eve = eve->next)
{
totvert++;
}
@@ -2759,7 +2759,7 @@ int weightToHarmonic(EditMesh *em, EdgeIndex *indexed_edges)
nlBegin(NL_SYSTEM);
/* Find local extrema */
- for(index = 0, eve = em->verts.first; eve; index++, eve = eve->next)
+ for (index = 0, eve = em->verts.first; eve; index++, eve = eve->next)
{
if (eve->h == 0)
{
@@ -2768,7 +2768,7 @@ int weightToHarmonic(EditMesh *em, EdgeIndex *indexed_edges)
int minimum = 1;
NextEdgeForVert(indexed_edges, -1); /* Reset next edge */
- for(eed = NextEdgeForVert(indexed_edges, index); eed && (maximum || minimum); eed = NextEdgeForVert(indexed_edges, index))
+ for (eed = NextEdgeForVert(indexed_edges, index); eed && (maximum || minimum); eed = NextEdgeForVert(indexed_edges, index))
{
EditVert *eve2;
@@ -2813,13 +2813,13 @@ int weightToHarmonic(EditMesh *em, EdgeIndex *indexed_edges)
nlBegin(NL_MATRIX);
/* Zero edge weight */
- for(eed = em->edges.first; eed; eed = eed->next)
+ for (eed = em->edges.first; eed; eed = eed->next)
{
eed->tmp.l = 0;
}
/* Add faces count to the edge weight */
- for(efa = em->faces.first; efa; efa = efa->next)
+ for (efa = em->faces.first; efa; efa = efa->next)
{
if (efa->h == 0)
{
@@ -2835,7 +2835,7 @@ int weightToHarmonic(EditMesh *em, EdgeIndex *indexed_edges)
}
/* Add faces angle to the edge weight */
- for(efa = em->faces.first; efa; efa = efa->next)
+ for (efa = em->faces.first; efa; efa = efa->next)
{
if (efa->h == 0)
{
@@ -2860,7 +2860,7 @@ int weightToHarmonic(EditMesh *em, EdgeIndex *indexed_edges)
if (success)
{
rval = 1;
- for(index = 0, eve = em->verts.first; eve; index++, eve = eve->next)
+ for (index = 0, eve = em->verts.first; eve; index++, eve = eve->next)
{
weightSetData(eve, nlGetVariable(0, index));
}
@@ -2916,7 +2916,7 @@ static void shortestPathsFromVert(EditMesh *em, EditVert *starting_vert, EdgeInd
BLI_heap_insert(edge_heap, FLT_MAX, NULL);
/* Initialize edge flag */
- for(eed= em->edges.first; eed; eed= eed->next)
+ for (eed= em->edges.first; eed; eed= eed->next)
{
eed->f1 = 0;
}
@@ -2929,7 +2929,7 @@ static void shortestPathsFromVert(EditMesh *em, EditVert *starting_vert, EdgeInd
/* Add all new edges connected to current_eve to the list */
NextEdgeForVert(indexed_edges, -1); // Reset next edge
- for(eed = NextEdgeForVert(indexed_edges, indexData(current_eve)); eed; eed = NextEdgeForVert(indexed_edges, indexData(current_eve)))
+ for (eed = NextEdgeForVert(indexed_edges, indexData(current_eve)); eed; eed = NextEdgeForVert(indexed_edges, indexData(current_eve)))
{
if (eed->f1 == 0)
{
@@ -2983,7 +2983,7 @@ static void buildIndexedEdges(EditMesh *em, EdgeIndex *indexed_edges)
indexed_edges->offset = MEM_callocN(totvert * sizeof(int), "EdgeIndex offset");
- for(eed = em->edges.first; eed; eed = eed->next)
+ for (eed = em->edges.first; eed; eed = eed->next)
{
if (eed->v1->h == 0 && eed->v2->h == 0)
{
@@ -2998,7 +2998,7 @@ static void buildIndexedEdges(EditMesh *em, EdgeIndex *indexed_edges)
indexed_edges->edges = MEM_callocN(tot_indexed * sizeof(EditEdge*), "EdgeIndex edges");
/* setting vert offsets */
- for(eve = em->verts.first; eve; eve = eve->next)
+ for (eve = em->verts.first; eve; eve = eve->next)
{
if (eve->h == 0)
{
@@ -3009,7 +3009,7 @@ static void buildIndexedEdges(EditMesh *em, EdgeIndex *indexed_edges)
}
/* adding edges in array */
- for(eed = em->edges.first; eed; eed= eed->next)
+ for (eed = em->edges.first; eed; eed= eed->next)
{
if (eed->v1->h == 0 && eed->v2->h == 0)
{
@@ -3057,7 +3057,7 @@ int weightFromDistance(EditMesh *em, EdgeIndex *indexed_edges)
}
/* Initialize vertice flag and find at least one selected vertex */
- for(eve = em->verts.first; eve; eve = eve->next)
+ for (eve = em->verts.first; eve; eve = eve->next)
{
eve->f1 = 0;
if (eve->f & SELECT)
@@ -3076,7 +3076,7 @@ int weightFromDistance(EditMesh *em, EdgeIndex *indexed_edges)
int allDone = 0;
/* Calculate edge weight */
- for(eed = em->edges.first; eed; eed= eed->next)
+ for (eed = em->edges.first; eed; eed= eed->next)
{
if (eed->v1->h == 0 && eed->v2->h == 0)
{
@@ -3085,7 +3085,7 @@ int weightFromDistance(EditMesh *em, EdgeIndex *indexed_edges)
}
/* Apply dijkstra spf for each selected vert */
- for(eve = em->verts.first; eve; eve = eve->next)
+ for (eve = em->verts.first; eve; eve = eve->next)
{
if (eve->f & SELECT)
{
@@ -3137,7 +3137,7 @@ int weightFromDistance(EditMesh *em, EdgeIndex *indexed_edges)
}
}
- for(eve = em->verts.first; eve && vCount == 0; eve = eve->next)
+ for (eve = em->verts.first; eve && vCount == 0; eve = eve->next)
{
if (eve->f1 == 0)
{