diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-04-28 19:42:27 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-04-28 19:42:27 +0400 |
commit | e2c453b5f9d3a0a26333b6585f07ebf9e3a24819 (patch) | |
tree | 837b0b4f8756f9b0dec4b8bae1891e21cd230227 /source/blender/editors/object/object_hook.c | |
parent | ef054e165cad35715a5b2388aac3db68a65ea275 (diff) |
style cleanup: editors / mesh & object
Diffstat (limited to 'source/blender/editors/object/object_hook.c')
-rw-r--r-- | source/blender/editors/object/object_hook.c | 318 |
1 files changed, 159 insertions, 159 deletions
diff --git a/source/blender/editors/object/object_hook.c b/source/blender/editors/object/object_hook.c index 495f0b40802..4ffc3e8c19f 100644 --- a/source/blender/editors/object/object_hook.c +++ b/source/blender/editors/object/object_hook.c @@ -76,27 +76,27 @@ static int return_editmesh_indexar(BMEditMesh *em, int *tot, int **indexar, floa { BMVert *eve; BMIter iter; - int *index, nr, totvert=0; + int *index, nr, totvert = 0; BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) { 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; - nr= 0; + *indexar = index = MEM_mallocN(4 * totvert, "hook indexar"); + *tot = totvert; + nr = 0; zero_v3(cent); BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) { if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) { - *index= nr; index++; + *index = nr; index++; add_v3_v3(cent, eve->co); } nr++; } - mul_v3_fl(cent, 1.0f/(float)totvert); + mul_v3_fl(cent, 1.0f / (float)totvert); return totvert; } @@ -106,8 +106,8 @@ static int return_editmesh_vgroup(Object *obedit, BMEditMesh *em, char *name, fl zero_v3(cent); if (obedit->actdef) { - const int defgrp_index= obedit->actdef-1; - int totvert=0; + const int defgrp_index = obedit->actdef - 1; + int totvert = 0; MDeformVert *dvert; BMVert *eve; @@ -115,7 +115,7 @@ static int return_editmesh_vgroup(Object *obedit, BMEditMesh *em, char *name, fl /* find the vertices */ BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) { - dvert= CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT); + dvert = CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT); if (dvert) { if (defvert_find_weight(dvert, defgrp_index) > 0.0f) { @@ -127,7 +127,7 @@ static int return_editmesh_vgroup(Object *obedit, BMEditMesh *em, char *name, fl 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); + mul_v3_fl(cent, 1.0f / (float)totvert); return 1; } } @@ -137,19 +137,19 @@ static int return_editmesh_vgroup(Object *obedit, BMEditMesh *em, char *name, fl static void select_editbmesh_hook(Object *ob, HookModifierData *hmd) { - Mesh *me= ob->data; - BMEditMesh *em= me->edit_btmesh; + Mesh *me = ob->data; + BMEditMesh *em = me->edit_btmesh; BMVert *eve; BMIter iter; - int index=0, nr=0; + int index = 0, nr = 0; if (hmd->indexar == NULL) return; BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) { - if (nr==hmd->indexar[index]) { + if (nr == hmd->indexar[index]) { BM_vert_select_set(em->bm, eve, TRUE); - if (index < hmd->totindex-1) index++; + if (index < hmd->totindex - 1) index++; } nr++; @@ -161,31 +161,31 @@ static void select_editbmesh_hook(Object *ob, HookModifierData *hmd) static int return_editlattice_indexar(Lattice *editlatt, int *tot, int **indexar, float *cent) { BPoint *bp; - int *index, nr, totvert=0, a; + int *index, nr, totvert = 0, a; /* count */ - a= editlatt->pntsu*editlatt->pntsv*editlatt->pntsw; - bp= editlatt->def; + a = editlatt->pntsu * editlatt->pntsv * editlatt->pntsw; + bp = editlatt->def; while (a--) { if (bp->f1 & SELECT) { - if (bp->hide==0) totvert++; + 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; - nr= 0; + *indexar = index = MEM_mallocN(4 * totvert, "hook indexar"); + *tot = totvert; + nr = 0; zero_v3(cent); - a= editlatt->pntsu*editlatt->pntsv*editlatt->pntsw; - bp= editlatt->def; + a = editlatt->pntsu * editlatt->pntsv * editlatt->pntsw; + bp = editlatt->def; while (a--) { if (bp->f1 & SELECT) { - if (bp->hide==0) { - *index= nr; index++; + if (bp->hide == 0) { + *index = nr; index++; add_v3_v3(cent, bp->vec); } } @@ -193,25 +193,25 @@ static int return_editlattice_indexar(Lattice *editlatt, int *tot, int **indexar nr++; } - mul_v3_fl(cent, 1.0f/(float)totvert); + mul_v3_fl(cent, 1.0f / (float)totvert); return totvert; } static void select_editlattice_hook(Object *obedit, HookModifierData *hmd) { - Lattice *lt= obedit->data, *editlt; + Lattice *lt = obedit->data, *editlt; BPoint *bp; - int index=0, nr=0, a; + int index = 0, nr = 0, a; - editlt= lt->editlatt->latt; + editlt = lt->editlatt->latt; /* count */ - a= editlt->pntsu*editlt->pntsv*editlt->pntsw; - bp= editlt->def; + a = editlt->pntsu * editlt->pntsv * editlt->pntsw; + bp = editlt->def; while (a--) { - if (hmd->indexar[index]==nr) { + if (hmd->indexar[index] == nr) { bp->f1 |= SELECT; - if (index < hmd->totindex-1) index++; + if (index < hmd->totindex - 1) index++; } nr++; bp++; @@ -220,16 +220,16 @@ static void select_editlattice_hook(Object *obedit, HookModifierData *hmd) static int return_editcurve_indexar(Object *obedit, int *tot, int **indexar, float *cent) { - ListBase *editnurb= object_editcurve_get(obedit); + ListBase *editnurb = object_editcurve_get(obedit); Nurb *nu; BPoint *bp; BezTriple *bezt; - int *index, a, nr, totvert=0; + int *index, a, nr, totvert = 0; - for (nu= editnurb->first; nu; nu= nu->next) { + for (nu = editnurb->first; nu; nu = nu->next) { if (nu->type == CU_BEZIER) { - bezt= nu->bezt; - a= nu->pntsu; + bezt = nu->bezt; + a = nu->pntsu; while (a--) { if (bezt->f1 & SELECT) totvert++; if (bezt->f2 & SELECT) totvert++; @@ -238,38 +238,38 @@ static int return_editcurve_indexar(Object *obedit, int *tot, int **indexar, flo } } else { - bp= nu->bp; - a= nu->pntsu*nu->pntsv; + bp = nu->bp; + a = nu->pntsu * nu->pntsv; 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; + *indexar = index = MEM_mallocN(4 * totvert, "hook indexar"); + *tot = totvert; + nr = 0; zero_v3(cent); - for (nu= editnurb->first; nu; nu= nu->next) { + for (nu = editnurb->first; nu; nu = nu->next) { if (nu->type == CU_BEZIER) { - bezt= nu->bezt; - a= nu->pntsu; + bezt = nu->bezt; + a = nu->pntsu; while (a--) { if (bezt->f1 & SELECT) { - *index= nr; index++; + *index = nr; index++; add_v3_v3(cent, bezt->vec[0]); } nr++; if (bezt->f2 & SELECT) { - *index= nr; index++; + *index = nr; index++; add_v3_v3(cent, bezt->vec[1]); } nr++; if (bezt->f3 & SELECT) { - *index= nr; index++; + *index = nr; index++; add_v3_v3(cent, bezt->vec[2]); } nr++; @@ -277,11 +277,11 @@ static int return_editcurve_indexar(Object *obedit, int *tot, int **indexar, flo } } else { - bp= nu->bp; - a= nu->pntsu*nu->pntsv; + bp = nu->bp; + a = nu->pntsu * nu->pntsv; while (a--) { if (bp->f1 & SELECT) { - *index= nr; index++; + *index = nr; index++; add_v3_v3(cent, bp->vec); } nr++; @@ -290,21 +290,21 @@ static int return_editcurve_indexar(Object *obedit, int *tot, int **indexar, flo } } - mul_v3_fl(cent, 1.0f/(float)totvert); + mul_v3_fl(cent, 1.0f / (float)totvert); return totvert; } static int object_hook_index_array(Scene *scene, Object *obedit, int *tot, int **indexar, char *name, float *cent_r) { - *indexar= NULL; - *tot= 0; - name[0]= 0; + *indexar = NULL; + *tot = 0; + name[0] = 0; switch (obedit->type) { case OB_MESH: { - Mesh *me= obedit->data; + Mesh *me = obedit->data; BMEditMesh *em; @@ -314,7 +314,7 @@ 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 { @@ -327,7 +327,7 @@ static int object_hook_index_array(Scene *scene, Object *obedit, int *tot, int * return return_editcurve_indexar(obedit, tot, indexar, cent_r); case OB_LATTICE: { - Lattice *lt= obedit->data; + Lattice *lt = obedit->data; return return_editlattice_indexar(lt->editlatt->latt, tot, indexar, cent_r); } default: @@ -337,30 +337,30 @@ static int object_hook_index_array(Scene *scene, Object *obedit, int *tot, int * static void select_editcurve_hook(Object *obedit, HookModifierData *hmd) { - ListBase *editnurb= object_editcurve_get(obedit); + ListBase *editnurb = object_editcurve_get(obedit); Nurb *nu; BPoint *bp; BezTriple *bezt; - int index=0, a, nr=0; + int index = 0, a, nr = 0; - for (nu= editnurb->first; nu; nu= nu->next) { + for (nu = editnurb->first; nu; nu = nu->next) { if (nu->type == CU_BEZIER) { - bezt= nu->bezt; - a= nu->pntsu; + bezt = nu->bezt; + a = nu->pntsu; 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]) { bezt->f2 |= SELECT; - if (index<hmd->totindex-1) index++; + if (index < hmd->totindex - 1) index++; } nr++; if (nr == hmd->indexar[index]) { bezt->f3 |= SELECT; - if (index<hmd->totindex-1) index++; + if (index < hmd->totindex - 1) index++; } nr++; @@ -368,12 +368,12 @@ static void select_editcurve_hook(Object *obedit, HookModifierData *hmd) } } else { - bp= nu->bp; - a= nu->pntsu*nu->pntsv; + bp = nu->bp; + a = nu->pntsu * nu->pntsv; while (a--) { if (nr == hmd->indexar[index]) { bp->f1 |= SELECT; - if (index<hmd->totindex-1) index++; + if (index < hmd->totindex - 1) index++; } nr++; bp++; @@ -387,17 +387,17 @@ 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 */ // TODO: check for properties window modifier context too as alternative? static int hook_op_edit_poll(bContext *C) { - Object *obedit= CTX_data_edit_object(C); + Object *obedit = CTX_data_edit_object(C); if (obedit) { if (ED_operator_editmesh(C)) return 1; @@ -414,7 +414,7 @@ static Object *add_hook_object_new(Scene *scene, Object *obedit) Base *base, *basedit; Object *ob; - ob= add_object(scene, OB_EMPTY); + ob = add_object(scene, OB_EMPTY); basedit = object_in_scene(obedit, scene); base = object_in_scene(ob, scene); @@ -429,7 +429,7 @@ static Object *add_hook_object_new(Scene *scene, Object *obedit) static void add_hook_object(Main *bmain, Scene *scene, Object *obedit, Object *ob, int mode) { - ModifierData *md=NULL; + ModifierData *md = NULL; HookModifierData *hmd = NULL; float cent[3]; int tot, ok, *indexar; @@ -437,9 +437,9 @@ static void add_hook_object(Main *bmain, Scene *scene, Object *obedit, Object *o ok = object_hook_index_array(scene, obedit, &tot, &indexar, name, cent); - if (!ok) return; // XXX error("Requires selected vertices or active Vertex Group"); + if (!ok) return; // XXX error("Requires selected vertices or active Vertex Group"); - if (mode==OBJECT_ADDHOOK_NEWOB && !ob) { + if (mode == OBJECT_ADDHOOK_NEWOB && !ob) { ob = add_hook_object_new(scene, obedit); @@ -448,19 +448,19 @@ static void add_hook_object(Main *bmain, Scene *scene, Object *obedit, Object *o } md = obedit->modifiers.first; - while (md && modifierType_getInfo(md->type)->type==eModifierTypeType_OnlyDeform) { + while (md && modifierType_getInfo(md->type)->type == eModifierTypeType_OnlyDeform) { md = md->next; } - hmd = (HookModifierData*) modifier_new(eModifierType_Hook); + hmd = (HookModifierData *) modifier_new(eModifierType_Hook); BLI_insertlinkbefore(&obedit->modifiers, md, hmd); - BLI_snprintf(hmd->modifier.name, sizeof(hmd->modifier.name), "Hook-%s", ob->id.name+2); - modifier_unique_name(&obedit->modifiers, (ModifierData*)hmd); + BLI_snprintf(hmd->modifier.name, sizeof(hmd->modifier.name), "Hook-%s", ob->id.name + 2); + modifier_unique_name(&obedit->modifiers, (ModifierData *)hmd); - hmd->object= ob; - hmd->indexar= indexar; + hmd->object = ob; + hmd->indexar = indexar; copy_v3_v3(hmd->cent, cent); - hmd->totindex= tot; + hmd->totindex = tot; BLI_strncpy(hmd->name, name, sizeof(hmd->name)); /* matrix calculus */ @@ -478,12 +478,12 @@ static void add_hook_object(Main *bmain, Scene *scene, Object *obedit, Object *o static int object_add_hook_selob_exec(bContext *C, wmOperator *op) { - Main *bmain= CTX_data_main(C); - Scene *scene= CTX_data_scene(C); + Main *bmain = CTX_data_main(C); + Scene *scene = CTX_data_scene(C); Object *obedit = CTX_data_edit_object(C); - Object *obsel=NULL; + Object *obsel = NULL; - CTX_DATA_BEGIN (C, Object*, ob, selected_objects) { + CTX_DATA_BEGIN (C, Object *, ob, selected_objects) { if (ob != obedit) { obsel = ob; break; @@ -498,7 +498,7 @@ static int object_add_hook_selob_exec(bContext *C, wmOperator *op) add_hook_object(bmain, scene, obedit, obsel, OBJECT_ADDHOOK_SELOB); - WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, obedit); + WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, obedit); return OPERATOR_FINISHED; } @@ -514,19 +514,19 @@ void OBJECT_OT_hook_add_selobj(wmOperatorType *ot) ot->poll = hook_op_edit_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } static int object_add_hook_newob_exec(bContext *C, wmOperator *UNUSED(op)) { - Main *bmain= CTX_data_main(C); - Scene *scene= CTX_data_scene(C); + Main *bmain = CTX_data_main(C); + Scene *scene = CTX_data_scene(C); Object *obedit = CTX_data_edit_object(C); add_hook_object(bmain, scene, obedit, NULL, OBJECT_ADDHOOK_NEWOB); - WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene); - WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, obedit); + WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene); + WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, obedit); return OPERATOR_FINISHED; } @@ -542,14 +542,14 @@ void OBJECT_OT_hook_add_newobj(wmOperatorType *ot) ot->poll = hook_op_edit_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } static int object_hook_remove_exec(bContext *C, wmOperator *op) { - int num= RNA_enum_get(op->ptr, "modifier"); - Object *ob=NULL; - HookModifierData *hmd=NULL; + int num = RNA_enum_get(op->ptr, "modifier"); + Object *ob = NULL; + HookModifierData *hmd = NULL; ob = CTX_data_edit_object(C); hmd = (HookModifierData *)BLI_findlink(&ob->modifiers, num); @@ -565,7 +565,7 @@ static int object_hook_remove_exec(bContext *C, wmOperator *op) modifier_free((ModifierData *)hmd); DAG_id_tag_update(&ob->id, OB_RECALC_DATA); - WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob); + WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob); return OPERATOR_FINISHED; } @@ -574,25 +574,25 @@ static EnumPropertyItem *hook_mod_itemf(bContext *C, PointerRNA *UNUSED(ptr), Pr { Object *ob = CTX_data_edit_object(C); EnumPropertyItem tmp = {0, "", 0, "", ""}; - EnumPropertyItem *item= NULL; + EnumPropertyItem *item = NULL; ModifierData *md = NULL; - int a, totitem= 0; + int a, totitem = 0; if (!ob) return DummyRNA_NULL_items; - for (a=0, md=ob->modifiers.first; md; md= md->next, a++) { - if (md->type==eModifierType_Hook) { - tmp.value= 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; - tmp.identifier= md->name; - tmp.name= md->name; + tmp.identifier = md->name; + tmp.name = md->name; RNA_enum_item_add(&item, &totitem, &tmp); } } RNA_enum_item_end(&item, &totitem); - *free= 1; + *free = 1; return item; } @@ -614,26 +614,26 @@ void OBJECT_OT_hook_remove(wmOperatorType *ot) /* flags */ /* this operator removes modifier which isn't stored in local undo stack, * so redoing it from redo panel gives totally weird results */ - ot->flag = /*OPTYPE_REGISTER|*/OPTYPE_UNDO; + ot->flag = /*OPTYPE_REGISTER|*/ OPTYPE_UNDO; /* properties */ - prop= RNA_def_enum(ot->srna, "modifier", DummyRNA_NULL_items, 0, "Modifier", "Modifier number to remove"); + prop = RNA_def_enum(ot->srna, "modifier", DummyRNA_NULL_items, 0, "Modifier", "Modifier number to remove"); RNA_def_enum_funcs(prop, hook_mod_itemf); ot->prop = prop; } static int object_hook_reset_exec(bContext *C, wmOperator *op) { - PointerRNA ptr= CTX_data_pointer_get_type(C, "modifier", &RNA_HookModifier); - int num= RNA_enum_get(op->ptr, "modifier"); - Object *ob=NULL; - HookModifierData *hmd=NULL; + PointerRNA ptr = CTX_data_pointer_get_type(C, "modifier", &RNA_HookModifier); + int num = RNA_enum_get(op->ptr, "modifier"); + Object *ob = NULL; + HookModifierData *hmd = NULL; - if (ptr.data) { /* if modifier context is available, use that */ + if (ptr.data) { /* if modifier context is available, use that */ ob = ptr.id.data; - hmd= ptr.data; + hmd = ptr.data; } - else { /* use the provided property */ + else { /* use the provided property */ ob = CTX_data_edit_object(C); hmd = (HookModifierData *)BLI_findlink(&ob->modifiers, num); } @@ -644,7 +644,7 @@ static int object_hook_reset_exec(bContext *C, wmOperator *op) /* reset functionality */ if (hmd->object) { - bPoseChannel *pchan= get_pose_channel(hmd->object->pose, hmd->subtarget); + bPoseChannel *pchan = get_pose_channel(hmd->object->pose, hmd->subtarget); if (hmd->subtarget[0] && pchan) { float imat[4][4], mat[4][4]; @@ -662,7 +662,7 @@ static int object_hook_reset_exec(bContext *C, wmOperator *op) } DAG_id_tag_update(&ob->id, OB_RECALC_DATA); - WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob); + WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob); return OPERATOR_FINISHED; } @@ -681,27 +681,27 @@ void OBJECT_OT_hook_reset(wmOperatorType *ot) ot->poll = hook_op_edit_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ - prop= RNA_def_enum(ot->srna, "modifier", DummyRNA_NULL_items, 0, "Modifier", "Modifier number to assign to"); + prop = RNA_def_enum(ot->srna, "modifier", DummyRNA_NULL_items, 0, "Modifier", "Modifier number to assign to"); RNA_def_enum_funcs(prop, hook_mod_itemf); } static int object_hook_recenter_exec(bContext *C, wmOperator *op) { - PointerRNA ptr= CTX_data_pointer_get_type(C, "modifier", &RNA_HookModifier); - int num= RNA_enum_get(op->ptr, "modifier"); - Object *ob=NULL; - HookModifierData *hmd=NULL; + PointerRNA ptr = CTX_data_pointer_get_type(C, "modifier", &RNA_HookModifier); + int num = RNA_enum_get(op->ptr, "modifier"); + Object *ob = NULL; + HookModifierData *hmd = NULL; Scene *scene = CTX_data_scene(C); float bmat[3][3], imat[3][3]; - if (ptr.data) { /* if modifier context is available, use that */ + if (ptr.data) { /* if modifier context is available, use that */ ob = ptr.id.data; - hmd= ptr.data; + hmd = ptr.data; } - else { /* use the provided property */ + else { /* use the provided property */ ob = CTX_data_edit_object(C); hmd = (HookModifierData *)BLI_findlink(&ob->modifiers, num); } @@ -718,7 +718,7 @@ static int object_hook_recenter_exec(bContext *C, wmOperator *op) mul_m3_v3(imat, hmd->cent); DAG_id_tag_update(&ob->id, OB_RECALC_DATA); - WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob); + WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob); return OPERATOR_FINISHED; } @@ -737,29 +737,29 @@ void OBJECT_OT_hook_recenter(wmOperatorType *ot) ot->poll = hook_op_edit_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ - prop= RNA_def_enum(ot->srna, "modifier", DummyRNA_NULL_items, 0, "Modifier", "Modifier number to assign to"); + prop = RNA_def_enum(ot->srna, "modifier", DummyRNA_NULL_items, 0, "Modifier", "Modifier number to assign to"); RNA_def_enum_funcs(prop, hook_mod_itemf); } static int object_hook_assign_exec(bContext *C, wmOperator *op) { - Scene *scene= CTX_data_scene(C); - PointerRNA ptr= CTX_data_pointer_get_type(C, "modifier", &RNA_HookModifier); - int num= RNA_enum_get(op->ptr, "modifier"); - Object *ob=NULL; - HookModifierData *hmd=NULL; + Scene *scene = CTX_data_scene(C); + PointerRNA ptr = CTX_data_pointer_get_type(C, "modifier", &RNA_HookModifier); + int num = RNA_enum_get(op->ptr, "modifier"); + Object *ob = NULL; + HookModifierData *hmd = NULL; float cent[3]; char name[MAX_NAME]; int *indexar, tot; - if (ptr.data) { /* if modifier context is available, use that */ + if (ptr.data) { /* if modifier context is available, use that */ ob = ptr.id.data; - hmd= ptr.data; + hmd = ptr.data; } - else { /* use the provided property */ + else { /* use the provided property */ ob = CTX_data_edit_object(C); hmd = (HookModifierData *)BLI_findlink(&ob->modifiers, num); } @@ -778,11 +778,11 @@ static int object_hook_assign_exec(bContext *C, wmOperator *op) MEM_freeN(hmd->indexar); copy_v3_v3(hmd->cent, cent); - hmd->indexar= indexar; - hmd->totindex= tot; + hmd->indexar = indexar; + hmd->totindex = tot; DAG_id_tag_update(&ob->id, OB_RECALC_DATA); - WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob); + WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob); return OPERATOR_FINISHED; } @@ -803,25 +803,25 @@ void OBJECT_OT_hook_assign(wmOperatorType *ot) /* flags */ /* this operator changes data stored in modifier which doesn't get pushed to undo stack, * so redoing it from redo panel gives totally weird results */ - ot->flag = /*OPTYPE_REGISTER|*/OPTYPE_UNDO; + ot->flag = /*OPTYPE_REGISTER|*/ OPTYPE_UNDO; /* properties */ - prop= RNA_def_enum(ot->srna, "modifier", DummyRNA_NULL_items, 0, "Modifier", "Modifier number to assign to"); + prop = RNA_def_enum(ot->srna, "modifier", DummyRNA_NULL_items, 0, "Modifier", "Modifier number to assign to"); RNA_def_enum_funcs(prop, hook_mod_itemf); } static int object_hook_select_exec(bContext *C, wmOperator *op) { - PointerRNA ptr= CTX_data_pointer_get_type(C, "modifier", &RNA_HookModifier); - int num= RNA_enum_get(op->ptr, "modifier"); - Object *ob=NULL; - HookModifierData *hmd=NULL; + PointerRNA ptr = CTX_data_pointer_get_type(C, "modifier", &RNA_HookModifier); + int num = RNA_enum_get(op->ptr, "modifier"); + Object *ob = NULL; + HookModifierData *hmd = NULL; - if (ptr.data) { /* if modifier context is available, use that */ + if (ptr.data) { /* if modifier context is available, use that */ ob = ptr.id.data; - hmd= ptr.data; + hmd = ptr.data; } - else { /* use the provided property */ + else { /* use the provided property */ ob = CTX_data_edit_object(C); hmd = (HookModifierData *)BLI_findlink(&ob->modifiers, num); } @@ -833,7 +833,7 @@ static int object_hook_select_exec(bContext *C, wmOperator *op) /* select functionality */ object_hook_select(ob, hmd); - WM_event_add_notifier(C, NC_GEOM|ND_SELECT, ob->data); + WM_event_add_notifier(C, NC_GEOM | ND_SELECT, ob->data); return OPERATOR_FINISHED; } @@ -852,10 +852,10 @@ void OBJECT_OT_hook_select(wmOperatorType *ot) ot->poll = hook_op_edit_poll; /* flags */ - ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ - prop= RNA_def_enum(ot->srna, "modifier", DummyRNA_NULL_items, 0, "Modifier", "Modifier number to remove"); + prop = RNA_def_enum(ot->srna, "modifier", DummyRNA_NULL_items, 0, "Modifier", "Modifier number to remove"); RNA_def_enum_funcs(prop, hook_mod_itemf); } |