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/object/object_hook.c')
-rw-r--r--source/blender/editors/object/object_hook.c121
1 files changed, 61 insertions, 60 deletions
diff --git a/source/blender/editors/object/object_hook.c b/source/blender/editors/object/object_hook.c
index 6c0df7a2076..7bb2be8e248 100644
--- a/source/blender/editors/object/object_hook.c
+++ b/source/blender/editors/object/object_hook.c
@@ -79,9 +79,9 @@ static int return_editmesh_indexar(BMEditMesh *em, int *tot, int **indexar, floa
int *index, nr, totvert=0;
BM_ITER(eve, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
- if(BM_elem_flag_test(eve, BM_ELEM_SELECT)) totvert++;
+ if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) totvert++;
}
- if(totvert==0) return 0;
+ if (totvert==0) return 0;
*indexar= index= MEM_mallocN(4*totvert, "hook indexar");
*tot= totvert;
@@ -89,7 +89,7 @@ static int return_editmesh_indexar(BMEditMesh *em, int *tot, int **indexar, floa
zero_v3(cent);
BM_ITER(eve, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
- if(BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
+ if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
*index= nr; index++;
add_v3_v3(cent, eve->co);
}
@@ -105,7 +105,7 @@ static int return_editmesh_vgroup(Object *obedit, BMEditMesh *em, char *name, fl
{
zero_v3(cent);
- if(obedit->actdef) {
+ if (obedit->actdef) {
const int defgrp_index= obedit->actdef-1;
int totvert=0;
@@ -117,14 +117,14 @@ static int return_editmesh_vgroup(Object *obedit, BMEditMesh *em, char *name, fl
BM_ITER(eve, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
dvert= CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
- if(dvert) {
- if(defvert_find_weight(dvert, defgrp_index) > 0.0f) {
+ if (dvert) {
+ if (defvert_find_weight(dvert, defgrp_index) > 0.0f) {
add_v3_v3(cent, eve->co);
totvert++;
}
}
}
- if(totvert) {
+ if (totvert) {
bDeformGroup *dg = BLI_findlink(&obedit->defbase, defgrp_index);
BLI_strncpy(name, dg->name, sizeof(dg->name));
mul_v3_fl(cent, 1.0f/(float)totvert);
@@ -147,9 +147,9 @@ static void select_editbmesh_hook(Object *ob, HookModifierData *hmd)
return;
BM_ITER(eve, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
- if(nr==hmd->indexar[index]) {
+ if (nr==hmd->indexar[index]) {
BM_elem_select_set(em->bm, eve, TRUE);
- if(index < hmd->totindex-1) index++;
+ if (index < hmd->totindex-1) index++;
}
nr++;
@@ -166,14 +166,14 @@ static int return_editlattice_indexar(Lattice *editlatt, int *tot, int **indexar
/* count */
a= editlatt->pntsu*editlatt->pntsv*editlatt->pntsw;
bp= editlatt->def;
- while(a--) {
- if(bp->f1 & SELECT) {
- if(bp->hide==0) totvert++;
+ while (a--) {
+ if (bp->f1 & SELECT) {
+ if (bp->hide==0) totvert++;
}
bp++;
}
- if(totvert==0) return 0;
+ if (totvert==0) return 0;
*indexar= index= MEM_mallocN(4*totvert, "hook indexar");
*tot= totvert;
@@ -182,9 +182,9 @@ static int return_editlattice_indexar(Lattice *editlatt, int *tot, int **indexar
a= editlatt->pntsu*editlatt->pntsv*editlatt->pntsw;
bp= editlatt->def;
- while(a--) {
- if(bp->f1 & SELECT) {
- if(bp->hide==0) {
+ while (a--) {
+ if (bp->f1 & SELECT) {
+ if (bp->hide==0) {
*index= nr; index++;
add_v3_v3(cent, bp->vec);
}
@@ -208,10 +208,10 @@ static void select_editlattice_hook(Object *obedit, HookModifierData *hmd)
/* count */
a= editlt->pntsu*editlt->pntsv*editlt->pntsw;
bp= editlt->def;
- while(a--) {
- if(hmd->indexar[index]==nr) {
+ while (a--) {
+ if (hmd->indexar[index]==nr) {
bp->f1 |= SELECT;
- if(index < hmd->totindex-1) index++;
+ if (index < hmd->totindex-1) index++;
}
nr++;
bp++;
@@ -226,49 +226,49 @@ static int return_editcurve_indexar(Object *obedit, int *tot, int **indexar, flo
BezTriple *bezt;
int *index, a, nr, totvert=0;
- for(nu= editnurb->first; nu; nu= nu->next) {
- if(nu->type == CU_BEZIER) {
+ for (nu= editnurb->first; nu; nu= nu->next) {
+ if (nu->type == CU_BEZIER) {
bezt= nu->bezt;
a= nu->pntsu;
- while(a--) {
- if(bezt->f1 & SELECT) totvert++;
- if(bezt->f2 & SELECT) totvert++;
- if(bezt->f3 & SELECT) totvert++;
+ while (a--) {
+ if (bezt->f1 & SELECT) totvert++;
+ if (bezt->f2 & SELECT) totvert++;
+ if (bezt->f3 & SELECT) totvert++;
bezt++;
}
}
else {
bp= nu->bp;
a= nu->pntsu*nu->pntsv;
- while(a--) {
- if(bp->f1 & SELECT) totvert++;
+ while (a--) {
+ if (bp->f1 & SELECT) totvert++;
bp++;
}
}
}
- if(totvert==0) return 0;
+ if (totvert==0) return 0;
*indexar= index= MEM_mallocN(4*totvert, "hook indexar");
*tot= totvert;
nr= 0;
zero_v3(cent);
- for(nu= editnurb->first; nu; nu= nu->next) {
- if(nu->type == CU_BEZIER) {
+ for (nu= editnurb->first; nu; nu= nu->next) {
+ if (nu->type == CU_BEZIER) {
bezt= nu->bezt;
a= nu->pntsu;
- while(a--) {
- if(bezt->f1 & SELECT) {
+ while (a--) {
+ if (bezt->f1 & SELECT) {
*index= nr; index++;
add_v3_v3(cent, bezt->vec[0]);
}
nr++;
- if(bezt->f2 & SELECT) {
+ if (bezt->f2 & SELECT) {
*index= nr; index++;
add_v3_v3(cent, bezt->vec[1]);
}
nr++;
- if(bezt->f3 & SELECT) {
+ if (bezt->f3 & SELECT) {
*index= nr; index++;
add_v3_v3(cent, bezt->vec[2]);
}
@@ -279,8 +279,8 @@ static int return_editcurve_indexar(Object *obedit, int *tot, int **indexar, flo
else {
bp= nu->bp;
a= nu->pntsu*nu->pntsv;
- while(a--) {
- if(bp->f1 & SELECT) {
+ while (a--) {
+ if (bp->f1 & SELECT) {
*index= nr; index++;
add_v3_v3(cent, bp->vec);
}
@@ -314,9 +314,10 @@ static int object_hook_index_array(Scene *scene, Object *obedit, int *tot, int *
em = me->edit_btmesh;
/* check selected vertices first */
- if( return_editmesh_indexar(em, tot, indexar, cent_r)) {
+ if ( return_editmesh_indexar(em, tot, indexar, cent_r)) {
return 1;
- } else {
+ }
+ else {
int ret = return_editmesh_vgroup(obedit, em, name, cent_r);
return ret;
}
@@ -342,24 +343,24 @@ static void select_editcurve_hook(Object *obedit, HookModifierData *hmd)
BezTriple *bezt;
int index=0, a, nr=0;
- for(nu= editnurb->first; nu; nu= nu->next) {
- if(nu->type == CU_BEZIER) {
+ for (nu= editnurb->first; nu; nu= nu->next) {
+ if (nu->type == CU_BEZIER) {
bezt= nu->bezt;
a= nu->pntsu;
- while(a--) {
- if(nr == hmd->indexar[index]) {
+ while (a--) {
+ if (nr == hmd->indexar[index]) {
bezt->f1 |= SELECT;
- if(index<hmd->totindex-1) index++;
+ if (index<hmd->totindex-1) index++;
}
nr++;
- if(nr == hmd->indexar[index]) {
+ if (nr == hmd->indexar[index]) {
bezt->f2 |= SELECT;
- if(index<hmd->totindex-1) index++;
+ if (index<hmd->totindex-1) index++;
}
nr++;
- if(nr == hmd->indexar[index]) {
+ if (nr == hmd->indexar[index]) {
bezt->f3 |= SELECT;
- if(index<hmd->totindex-1) index++;
+ if (index<hmd->totindex-1) index++;
}
nr++;
@@ -369,10 +370,10 @@ static void select_editcurve_hook(Object *obedit, HookModifierData *hmd)
else {
bp= nu->bp;
a= nu->pntsu*nu->pntsv;
- while(a--) {
- if(nr == hmd->indexar[index]) {
+ while (a--) {
+ if (nr == hmd->indexar[index]) {
bp->f1 |= SELECT;
- if(index<hmd->totindex-1) index++;
+ if (index<hmd->totindex-1) index++;
}
nr++;
bp++;
@@ -386,10 +387,10 @@ static void object_hook_select(Object *ob, HookModifierData *hmd)
if (hmd->indexar == NULL)
return;
- if(ob->type==OB_MESH) select_editbmesh_hook(ob, hmd);
- else if(ob->type==OB_LATTICE) select_editlattice_hook(ob, hmd);
- else if(ob->type==OB_CURVE) select_editcurve_hook(ob, hmd);
- else if(ob->type==OB_SURF) select_editcurve_hook(ob, hmd);
+ if (ob->type==OB_MESH) select_editbmesh_hook(ob, hmd);
+ else if (ob->type==OB_LATTICE) select_editlattice_hook(ob, hmd);
+ else if (ob->type==OB_CURVE) select_editcurve_hook(ob, hmd);
+ else if (ob->type==OB_SURF) select_editcurve_hook(ob, hmd);
}
/* special poll operators for hook operators */
@@ -578,10 +579,10 @@ static EnumPropertyItem *hook_mod_itemf(bContext *C, PointerRNA *UNUSED(ptr), Pr
ModifierData *md = NULL;
int a, totitem= 0;
- if(!ob)
+ if (!ob)
return DummyRNA_NULL_items;
- for(a=0, md=ob->modifiers.first; md; md= md->next, a++) {
+ for (a=0, md=ob->modifiers.first; md; md= md->next, a++) {
if (md->type==eModifierType_Hook) {
tmp.value= a;
tmp.icon = ICON_HOOK;
@@ -643,10 +644,10 @@ static int object_hook_reset_exec(bContext *C, wmOperator *op)
}
/* reset functionality */
- if(hmd->object) {
+ if (hmd->object) {
bPoseChannel *pchan= get_pose_channel(hmd->object->pose, hmd->subtarget);
- if(hmd->subtarget[0] && pchan) {
+ if (hmd->subtarget[0] && pchan) {
float imat[4][4], mat[4][4];
/* calculate the world-space matrix for the pose-channel target first, then carry on as usual */
@@ -770,11 +771,11 @@ static int object_hook_assign_exec(bContext *C, wmOperator *op)
/* assign functionality */
- if(!object_hook_index_array(scene, ob, &tot, &indexar, name, cent)) {
+ if (!object_hook_index_array(scene, ob, &tot, &indexar, name, cent)) {
BKE_report(op->reports, RPT_WARNING, "Requires selected vertices or active vertex group");
return OPERATOR_CANCELLED;
}
- if(hmd->indexar)
+ if (hmd->indexar)
MEM_freeN(hmd->indexar);
copy_v3_v3(hmd->cent, cent);