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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-03-24 10:38:07 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-03-24 10:38:07 +0400
commitab4a2aaf4a4b2b4e416aa1f113b30362cbe0dec3 (patch)
tree81af4c18519181490074508dbe9a8d515eab634f /source/blender/editors/util
parent5a90ea77bc1333efe4e1e54984a080550ed3f707 (diff)
style cleanup: follow style guide for formatting of if/for/while loops, and else if's
Diffstat (limited to 'source/blender/editors/util')
-rw-r--r--source/blender/editors/util/crazyspace.c102
-rw-r--r--source/blender/editors/util/ed_util.c36
-rw-r--r--source/blender/editors/util/editmode_undo.c80
-rw-r--r--source/blender/editors/util/numinput.c9
-rw-r--r--source/blender/editors/util/undo.c104
5 files changed, 166 insertions, 165 deletions
diff --git a/source/blender/editors/util/crazyspace.c b/source/blender/editors/util/crazyspace.c
index 544a1c77d50..cef440668e6 100644
--- a/source/blender/editors/util/crazyspace.c
+++ b/source/blender/editors/util/crazyspace.c
@@ -78,7 +78,7 @@ static void make_vertexcos__mapFunc(void *userData, int index, float *co, float
float *vec = mappedData->vertexcos;
vec+= 3*index;
- if(!mappedData->flags[index]) {
+ if (!mappedData->flags[index]) {
/* we need coord from prototype vertex, not it clones or images,
* suppose they stored in the beginning of vertex array stored in DM */
copy_v3_v3(vec, co);
@@ -91,9 +91,9 @@ static int modifiers_disable_subsurf_temporary(Object *ob)
ModifierData *md;
int disabled = 0;
- for(md=ob->modifiers.first; md; md=md->next)
- if(md->type==eModifierType_Subsurf)
- if(md->mode & eModifierMode_OnCage) {
+ for (md=ob->modifiers.first; md; md=md->next)
+ if (md->type==eModifierType_Subsurf)
+ if (md->mode & eModifierMode_OnCage) {
md->mode ^= eModifierMode_DisableTemporary;
disabled= 1;
}
@@ -112,7 +112,7 @@ float *crazyspace_get_mapped_editverts(Scene *scene, Object *obedit)
MappedUserData userData;
/* disable subsurf temporal, get mapped cos, and enable it */
- if(modifiers_disable_subsurf_temporary(obedit)) {
+ if (modifiers_disable_subsurf_temporary(obedit)) {
/* need to make new derivemesh */
makeDerivedMesh(scene, obedit, me->edit_btmesh, CD_MASK_BAREMESH, 0);
}
@@ -194,13 +194,13 @@ void crazyspace_set_quats_editmesh(BMEditMesh *em, float *origcos, float *mapped
intptr_t index= 0;
/* two abused locations in vertices */
- for(eve= em->verts.first; eve; eve= eve->next, index++) {
+ for (eve= em->verts.first; eve; eve= eve->next, index++) {
eve->tmp.p = NULL;
eve->prev= (EditVert *)index;
}
/* first store two sets of tangent vectors in vertices, we derive it just from the face-edges */
- for(efa= em->faces.first; efa; efa= efa->next) {
+ for (efa= em->faces.first; efa; efa= efa->next) {
/* retrieve mapped coordinates */
v1= mappedcos + 3*(intptr_t)(efa->v1->prev);
@@ -211,39 +211,39 @@ void crazyspace_set_quats_editmesh(BMEditMesh *em, float *origcos, float *mapped
co2= (origcos)? origcos + 3*(intptr_t)(efa->v2->prev): efa->v2->co;
co3= (origcos)? origcos + 3*(intptr_t)(efa->v3->prev): efa->v3->co;
- if(efa->v2->tmp.p==NULL && efa->v2->f1) {
+ if (efa->v2->tmp.p==NULL && efa->v2->f1) {
set_crazy_vertex_quat(quats, co2, co3, co1, v2, v3, v1);
efa->v2->tmp.p= (void*)quats;
quats+= 4;
}
- if(efa->v4) {
+ if (efa->v4) {
v4= mappedcos + 3*(intptr_t)(efa->v4->prev);
co4= (origcos)? origcos + 3*(intptr_t)(efa->v4->prev): efa->v4->co;
- if(efa->v1->tmp.p==NULL && efa->v1->f1) {
+ if (efa->v1->tmp.p==NULL && efa->v1->f1) {
set_crazy_vertex_quat(quats, co1, co2, co4, v1, v2, v4);
efa->v1->tmp.p= (void*)quats;
quats+= 4;
}
- if(efa->v3->tmp.p==NULL && efa->v3->f1) {
+ if (efa->v3->tmp.p==NULL && efa->v3->f1) {
set_crazy_vertex_quat(quats, co3, co4, co2, v3, v4, v2);
efa->v3->tmp.p= (void*)quats;
quats+= 4;
}
- if(efa->v4->tmp.p==NULL && efa->v4->f1) {
+ if (efa->v4->tmp.p==NULL && efa->v4->f1) {
set_crazy_vertex_quat(quats, co4, co1, co3, v4, v1, v3);
efa->v4->tmp.p= (void*)quats;
quats+= 4;
}
}
else {
- if(efa->v1->tmp.p==NULL && efa->v1->f1) {
+ if (efa->v1->tmp.p==NULL && efa->v1->f1) {
set_crazy_vertex_quat(quats, co1, co2, co3, v1, v2, v3);
efa->v1->tmp.p= (void*)quats;
quats+= 4;
}
- if(efa->v3->tmp.p==NULL && efa->v3->f1) {
+ if (efa->v3->tmp.p==NULL && efa->v3->f1) {
set_crazy_vertex_quat(quats, co3, co1, co2, v3, v1, v2);
efa->v3->tmp.p= (void*)quats;
quats+= 4;
@@ -252,7 +252,7 @@ void crazyspace_set_quats_editmesh(BMEditMesh *em, float *origcos, float *mapped
}
/* restore abused prev pointer */
- for(prev= NULL, eve= em->verts.first; eve; prev= eve, eve= eve->next)
+ for (prev= NULL, eve= em->verts.first; eve; prev= eve, eve= eve->next)
eve->prev= prev;
#endif
}
@@ -267,13 +267,13 @@ void crazyspace_set_quats_mesh(Mesh *me, float *origcos, float *mappedcos, float
float *v1, *v2, *v3, *v4, *co1, *co2, *co3, *co4;
mvert= me->mvert;
- for(i=0; i<me->totvert; i++, mvert++)
+ for (i=0; i<me->totvert; i++, mvert++)
mvert->flag&= ~ME_VERT_TMP_TAG;
/* first store two sets of tangent vectors in vertices, we derive it just from the face-edges */
mvert= me->mvert;
mface= me->mface;
- for(i=0; i<me->totface; i++, mface++) {
+ for (i=0; i<me->totface; i++, mface++) {
/* retrieve mapped coordinates */
v1= mappedcos + 3*mface->v1;
@@ -284,34 +284,34 @@ void crazyspace_set_quats_mesh(Mesh *me, float *origcos, float *mappedcos, float
co2= (origcos)? origcos + 3*mface->v2: mvert[mface->v2].co;
co3= (origcos)? origcos + 3*mface->v3: mvert[mface->v3].co;
- if((mvert[mface->v2].flag&ME_VERT_TMP_TAG)==0) {
+ if ((mvert[mface->v2].flag&ME_VERT_TMP_TAG)==0) {
set_crazy_vertex_quat(&quats[mface->v2*4], co2, co3, co1, v2, v3, v1);
mvert[mface->v2].flag|= ME_VERT_TMP_TAG;
}
- if(mface->v4) {
+ if (mface->v4) {
v4= mappedcos + 3*mface->v4;
co4= (origcos)? origcos + 3*mface->v4: mvert[mface->v4].co;
- if((mvert[mface->v1].flag&ME_VERT_TMP_TAG)==0) {
+ if ((mvert[mface->v1].flag&ME_VERT_TMP_TAG)==0) {
set_crazy_vertex_quat(&quats[mface->v1*4], co1, co2, co4, v1, v2, v4);
mvert[mface->v1].flag|= ME_VERT_TMP_TAG;
}
- if((mvert[mface->v3].flag&ME_VERT_TMP_TAG)==0) {
+ if ((mvert[mface->v3].flag&ME_VERT_TMP_TAG)==0) {
set_crazy_vertex_quat(&quats[mface->v3*4], co3, co4, co2, v3, v4, v2);
mvert[mface->v3].flag|= ME_VERT_TMP_TAG;
}
- if((mvert[mface->v4].flag&ME_VERT_TMP_TAG)==0) {
+ if ((mvert[mface->v4].flag&ME_VERT_TMP_TAG)==0) {
set_crazy_vertex_quat(&quats[mface->v4*4], co4, co1, co3, v4, v1, v3);
mvert[mface->v4].flag|= ME_VERT_TMP_TAG;
}
}
else {
- if((mvert[mface->v1].flag&ME_VERT_TMP_TAG)==0) {
+ if ((mvert[mface->v1].flag&ME_VERT_TMP_TAG)==0) {
set_crazy_vertex_quat(&quats[mface->v1*4], co1, co2, co3, v1, v2, v3);
mvert[mface->v1].flag|= ME_VERT_TMP_TAG;
}
- if((mvert[mface->v3].flag&ME_VERT_TMP_TAG)==0) {
+ if ((mvert[mface->v3].flag&ME_VERT_TMP_TAG)==0) {
set_crazy_vertex_quat(&quats[mface->v3*4], co3, co1, co2, v3, v1, v2);
mvert[mface->v3].flag|= ME_VERT_TMP_TAG;
}
@@ -336,19 +336,19 @@ int editbmesh_get_first_deform_matrices(Scene *scene, Object *ob, BMEditMesh *em
/* compute the deformation matrices and coordinates for the first
* modifiers with on cage editing that are enabled and support computing
* deform matrices */
- for(i = 0; md && i <= cageIndex; i++, md = md->next) {
+ for (i = 0; md && i <= cageIndex; i++, md = md->next) {
ModifierTypeInfo *mti = modifierType_getInfo(md->type);
- if(!editbmesh_modifier_is_enabled(scene, md, dm))
+ if (!editbmesh_modifier_is_enabled(scene, md, dm))
continue;
- if(mti->type==eModifierTypeType_OnlyDeform && mti->deformMatricesEM) {
- if(!defmats) {
+ if (mti->type==eModifierTypeType_OnlyDeform && mti->deformMatricesEM) {
+ if (!defmats) {
dm= getEditDerivedBMesh(em, ob, NULL);
deformedVerts= editbmesh_get_vertex_cos(em, &numVerts);
defmats= MEM_callocN(sizeof(*defmats)*numVerts, "defmats");
- for(a=0; a<numVerts; a++)
+ for (a=0; a<numVerts; a++)
unit_m3(defmats[a]);
}
@@ -359,11 +359,11 @@ int editbmesh_get_first_deform_matrices(Scene *scene, Object *ob, BMEditMesh *em
break;
}
- for(; md && i <= cageIndex; md = md->next, i++)
- if(editbmesh_modifier_is_enabled(scene, md, dm) && modifier_isCorrectableDeformed(md))
+ for (; md && i <= cageIndex; md = md->next, i++)
+ if (editbmesh_modifier_is_enabled(scene, md, dm) && modifier_isCorrectableDeformed(md))
numleft++;
- if(dm)
+ if (dm)
dm->release(dm);
*deformmats= defmats;
@@ -382,7 +382,7 @@ int sculpt_get_first_deform_matrices(Scene *scene, Object *ob, float (**deformma
int has_multires = mmd != NULL && mmd->sculptlvl > 0;
int numleft= 0;
- if(has_multires) {
+ if (has_multires) {
*deformmats= NULL;
*deformcos= NULL;
return numleft;
@@ -391,37 +391,37 @@ int sculpt_get_first_deform_matrices(Scene *scene, Object *ob, float (**deformma
dm= NULL;
md= modifiers_getVirtualModifierList(ob);
- for(; md; md= md->next) {
+ for (; md; md= md->next) {
ModifierTypeInfo *mti= modifierType_getInfo(md->type);
- if(!modifier_isEnabled(scene, md, eModifierMode_Realtime)) continue;
+ if (!modifier_isEnabled(scene, md, eModifierMode_Realtime)) continue;
- if(mti->type==eModifierTypeType_OnlyDeform) {
- if(!defmats) {
+ if (mti->type==eModifierTypeType_OnlyDeform) {
+ if (!defmats) {
Mesh *me= (Mesh*)ob->data;
dm= mesh_create_derived(me, ob, NULL);
deformedVerts= mesh_getVertexCos(me, &numVerts);
defmats= MEM_callocN(sizeof(*defmats)*numVerts, "defmats");
- for(a=0; a<numVerts; a++)
+ for (a=0; a<numVerts; a++)
unit_m3(defmats[a]);
}
- if(mti->deformMatrices) mti->deformMatrices(md, ob, dm, deformedVerts, defmats, numVerts);
+ if (mti->deformMatrices) mti->deformMatrices(md, ob, dm, deformedVerts, defmats, numVerts);
else break;
}
}
- for(; md; md= md->next) {
+ for (; md; md= md->next) {
ModifierTypeInfo *mti= modifierType_getInfo(md->type);
- if(!modifier_isEnabled(scene, md, eModifierMode_Realtime)) continue;
+ if (!modifier_isEnabled(scene, md, eModifierMode_Realtime)) continue;
- if(mti->type==eModifierTypeType_OnlyDeform)
+ if (mti->type==eModifierTypeType_OnlyDeform)
numleft++;
}
- if(dm)
+ if (dm)
dm->release(dm);
*deformmats= defmats;
@@ -434,7 +434,7 @@ void crazyspace_build_sculpt(Scene *scene, Object *ob, float (**deformmats)[3][3
{
int totleft= sculpt_get_first_deform_matrices(scene, ob, deformmats, deformcos);
- if(totleft) {
+ if (totleft) {
/* there are deformation modifier which doesn't support deformation matrices
* calculation. Need additional crazyspace correction */
@@ -445,15 +445,15 @@ void crazyspace_build_sculpt(Scene *scene, Object *ob, float (**deformmats)[3][3
ModifierData *md= modifiers_getVirtualModifierList(ob);
Mesh *me= (Mesh*)ob->data;
- for(; md; md= md->next) {
+ for (; md; md= md->next) {
ModifierTypeInfo *mti= modifierType_getInfo(md->type);
- if(!modifier_isEnabled(scene, md, eModifierMode_Realtime)) continue;
+ if (!modifier_isEnabled(scene, md, eModifierMode_Realtime)) continue;
- if(mti->type==eModifierTypeType_OnlyDeform) {
+ if (mti->type==eModifierTypeType_OnlyDeform) {
/* skip leading modifiers which have been already
* handled in sculpt_get_first_deform_matrices */
- if(mti->deformMatrices && !deformed)
+ if (mti->deformMatrices && !deformed)
continue;
mti->deformVerts(md, ob, NULL, deformedVerts, me->totvert, 0, 0);
@@ -465,7 +465,7 @@ void crazyspace_build_sculpt(Scene *scene, Object *ob, float (**deformmats)[3][3
crazyspace_set_quats_mesh(me, (float*)origVerts, (float*)deformedVerts, quats);
- for(i=0; i<me->totvert; i++) {
+ for (i=0; i<me->totvert; i++) {
float qmat[3][3], tmat[3][3];
quat_to_mat3(qmat, &quats[i*4]);
@@ -477,14 +477,14 @@ void crazyspace_build_sculpt(Scene *scene, Object *ob, float (**deformmats)[3][3
MEM_freeN(quats);
}
- if(!*deformmats) {
+ if (!*deformmats) {
int a, numVerts;
Mesh *me= (Mesh*)ob->data;
*deformcos= mesh_getVertexCos(me, &numVerts);
*deformmats= MEM_callocN(sizeof(*(*deformmats))*numVerts, "defmats");
- for(a=0; a<numVerts; a++)
+ for (a=0; a<numVerts; a++)
unit_m3((*deformmats)[a]);
}
}
diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c
index 15dced2f448..fcf95047414 100644
--- a/source/blender/editors/util/ed_util.c
+++ b/source/blender/editors/util/ed_util.c
@@ -75,14 +75,14 @@ void ED_editors_init(bContext *C)
/* toggle on modes for objects that were saved with these enabled. for
* e.g. linked objects we have to ensure that they are actually the
* active object in this scene. */
- for(ob=bmain->object.first; ob; ob=ob->id.next) {
+ for (ob=bmain->object.first; ob; ob=ob->id.next) {
int mode= ob->mode;
- if(mode && (mode != OB_MODE_POSE)) {
+ if (mode && (mode != OB_MODE_POSE)) {
ob->mode= 0;
data= ob->data;
- if(ob == obact && !ob->id.lib && !(data && data->lib))
+ if (ob == obact && !ob->id.lib && !(data && data->lib))
ED_object_toggle_modes(C, mode);
}
}
@@ -94,27 +94,27 @@ void ED_editors_exit(bContext *C)
Main *bmain= CTX_data_main(C);
Scene *sce;
- if(!bmain)
+ if (!bmain)
return;
/* frees all editmode undos */
undo_editmode_clear();
ED_undo_paint_free();
- for(sce=bmain->scene.first; sce; sce= sce->id.next) {
- if(sce->obedit) {
+ for (sce=bmain->scene.first; sce; sce= sce->id.next) {
+ if (sce->obedit) {
Object *ob= sce->obedit;
- if(ob) {
- if(ob->type==OB_MESH) {
+ if (ob) {
+ if (ob->type==OB_MESH) {
Mesh *me= ob->data;
- if(me->edit_btmesh) {
+ if (me->edit_btmesh) {
EDBM_FreeEditBMesh(me->edit_btmesh);
MEM_freeN(me->edit_btmesh);
me->edit_btmesh= NULL;
}
}
- else if(ob->type==OB_ARMATURE) {
+ else if (ob->type==OB_ARMATURE) {
ED_armature_edit_free(ob);
}
}
@@ -135,17 +135,17 @@ void ED_editors_exit(bContext *C)
void apply_keyb_grid(int shift, int ctrl, float *val, float fac1, float fac2, float fac3, int invert)
{
/* fac1 is for 'nothing', fac2 for CTRL, fac3 for SHIFT */
- if(invert)
+ if (invert)
ctrl= !ctrl;
- if(ctrl && shift) {
- if(fac3 != 0.0f) *val= fac3*floorf(*val/fac3 +0.5f);
+ if (ctrl && shift) {
+ if (fac3 != 0.0f) *val= fac3*floorf(*val/fac3 +0.5f);
}
- else if(ctrl) {
- if(fac2 != 0.0f) *val= fac2*floorf(*val/fac2 +0.5f);
+ else if (ctrl) {
+ if (fac2 != 0.0f) *val= fac2*floorf(*val/fac2 +0.5f);
}
else {
- if(fac1 != 0.0f) *val= fac1*floorf(*val/fac1 +0.5f);
+ if (fac1 != 0.0f) *val= fac1*floorf(*val/fac1 +0.5f);
}
}
@@ -176,13 +176,13 @@ void unpack_menu(bContext *C, const char *opname, const char *id_name, const cha
RNA_enum_set(&props_ptr, "method", PF_REMOVE);
RNA_string_set(&props_ptr, "id", id_name);
- if(G.relbase_valid) {
+ if (G.relbase_valid) {
char local_name[FILE_MAXDIR + FILE_MAX], fi[FILE_MAX];
BLI_strncpy(local_name, abs_name, sizeof(local_name));
BLI_splitdirstring(local_name, fi);
BLI_snprintf(local_name, sizeof(local_name), "//%s/%s", folder, fi);
- if(strcmp(abs_name, local_name)!=0) {
+ if (strcmp(abs_name, local_name)!=0) {
switch(checkPackedFile(local_name, pf)) {
case PF_NOFILE:
BLI_snprintf(line, sizeof(line), "Create %s", local_name);
diff --git a/source/blender/editors/util/editmode_undo.c b/source/blender/editors/util/editmode_undo.c
index 8c0eb06be67..4416228e2d3 100644
--- a/source/blender/editors/util/editmode_undo.c
+++ b/source/blender/editors/util/editmode_undo.c
@@ -107,7 +107,7 @@ static UndoElem *curundo= NULL;
static void undo_restore(UndoElem *undo, void *editdata, void *obdata)
{
- if(undo) {
+ if (undo) {
undo->to_editmode(undo->undodata, editdata, obdata);
}
}
@@ -130,7 +130,7 @@ void undo_editmode_push(bContext *C, const char *name,
* this was giving conflicts for example when mesh changed due to keys or apply */
/* remove all undos after (also when curundo==NULL) */
- while(undobase.last != curundo) {
+ while (undobase.last != curundo) {
uel= undobase.last;
uel->freedata(uel->undodata);
BLI_freelinkN(&undobase, uel);
@@ -150,13 +150,13 @@ void undo_editmode_push(bContext *C, const char *name,
/* limit amount to the maximum amount*/
nr= 0;
uel= undobase.last;
- while(uel) {
+ while (uel) {
nr++;
- if(nr==U.undosteps) break;
+ if (nr==U.undosteps) break;
uel= uel->prev;
}
- if(uel) {
- while(undobase.first!=uel) {
+ if (uel) {
+ while (undobase.first!=uel) {
UndoElem *first= undobase.first;
first->freedata(first->undodata);
BLI_freelinkN(&undobase, first);
@@ -172,23 +172,23 @@ void undo_editmode_push(bContext *C, const char *name,
curundo->id= obedit->id;
curundo->type= obedit->type;
- if(U.undomemory != 0) {
+ if (U.undomemory != 0) {
/* limit to maximum memory (afterwards, we can't know in advance) */
totmem= 0;
maxmem= ((uintptr_t)U.undomemory)*1024*1024;
uel= undobase.last;
- while(uel && uel->prev) {
+ while (uel && uel->prev) {
totmem+= uel->undosize;
- if(totmem>maxmem) break;
+ if (totmem>maxmem) break;
uel= uel->prev;
}
- if(uel) {
- if(uel->prev && uel->prev->prev)
+ if (uel) {
+ if (uel->prev && uel->prev->prev)
uel= uel->prev;
- while(undobase.first!=uel) {
+ while (undobase.first!=uel) {
UndoElem *first= undobase.first;
first->freedata(first->undodata);
BLI_freelinkN(&undobase, first);
@@ -207,24 +207,24 @@ static void undo_clean_stack(bContext *C)
/* side effect: when deleting/renaming object and start editing new one with same name */
uel= undobase.first;
- while(uel) {
+ while (uel) {
void *editdata= uel->getdata(C);
int isvalid= 0;
next= uel->next;
/* for when objects are converted, renamed, or global undo changes pointers... */
- if(uel->type==obedit->type) {
- if(strcmp(uel->id.name, obedit->id.name)==0) {
- if(uel->validate_undo==NULL)
+ if (uel->type==obedit->type) {
+ if (strcmp(uel->id.name, obedit->id.name)==0) {
+ if (uel->validate_undo==NULL)
isvalid= 1;
- else if(uel->validate_undo(uel->undodata, editdata))
+ else if (uel->validate_undo(uel->undodata, editdata))
isvalid= 1;
}
}
- if(isvalid)
+ if (isvalid)
uel->ob= obedit;
else {
- if(uel == curundo)
+ if (uel == curundo)
curundo= NULL;
uel->freedata(uel->undodata);
@@ -234,7 +234,7 @@ static void undo_clean_stack(bContext *C)
uel= next;
}
- if(curundo == NULL) curundo= undobase.last;
+ if (curundo == NULL) curundo= undobase.last;
}
/* 1= an undo, -1 is a redo. we have to make sure 'curundo' remains at current situation */
@@ -245,14 +245,14 @@ void undo_editmode_step(bContext *C, int step)
/* prevent undo to happen on wrong object, stack can be a mix */
undo_clean_stack(C);
- if(step==0) {
+ if (step==0) {
undo_restore(curundo, curundo->getdata(C), obedit->data);
}
- else if(step==1) {
+ else if (step==1) {
- if(curundo==NULL || curundo->prev==NULL) error("No more steps to undo");
+ if (curundo==NULL || curundo->prev==NULL) error("No more steps to undo");
else {
- if(G.f & G_DEBUG) printf("undo %s\n", curundo->name);
+ if (G.f & G_DEBUG) printf("undo %s\n", curundo->name);
curundo= curundo->prev;
undo_restore(curundo, curundo->getdata(C), obedit->data);
}
@@ -260,16 +260,16 @@ void undo_editmode_step(bContext *C, int step)
else {
/* curundo has to remain current situation! */
- if(curundo==NULL || curundo->next==NULL) error("No more steps to redo");
+ if (curundo==NULL || curundo->next==NULL) error("No more steps to redo");
else {
undo_restore(curundo->next, curundo->getdata(C), obedit->data);
curundo= curundo->next;
- if(G.f & G_DEBUG) printf("redo %s\n", curundo->name);
+ if (G.f & G_DEBUG) printf("redo %s\n", curundo->name);
}
}
/* special case for editmesh, mode must be copied back to the scene */
- if(obedit->type == OB_MESH) {
+ if (obedit->type == OB_MESH) {
EDBM_selectmode_to_scene(C);
}
@@ -283,7 +283,7 @@ void undo_editmode_clear(void)
UndoElem *uel;
uel= undobase.first;
- while(uel) {
+ while (uel) {
uel->freedata(uel->undodata);
uel= uel->next;
}
@@ -297,8 +297,8 @@ void undo_editmode_number(bContext *C, int nr)
UndoElem *uel;
int a=1;
- for(uel= undobase.first; uel; uel= uel->next, a++) {
- if(a==nr) break;
+ for (uel= undobase.first; uel; uel= uel->next, a++) {
+ if (a==nr) break;
}
curundo= uel;
undo_editmode_step(C, 0);
@@ -308,11 +308,11 @@ void undo_editmode_name(bContext *C, const char *undoname)
{
UndoElem *uel;
- for(uel= undobase.last; uel; uel= uel->prev) {
- if(strcmp(undoname, uel->name)==0)
+ for (uel= undobase.last; uel; uel= uel->prev) {
+ if (strcmp(undoname, uel->name)==0)
break;
}
- if(uel && uel->prev) {
+ if (uel && uel->prev) {
curundo= uel->prev;
undo_editmode_step(C, 0);
}
@@ -321,11 +321,11 @@ void undo_editmode_name(bContext *C, const char *undoname)
/* undoname optionally, if NULL it just checks for existing undo steps */
int undo_editmode_valid(const char *undoname)
{
- if(undoname) {
+ if (undoname) {
UndoElem *uel;
- for(uel= undobase.last; uel; uel= uel->prev) {
- if(strcmp(undoname, uel->name)==0)
+ for (uel= undobase.last; uel; uel= uel->prev) {
+ if (strcmp(undoname, uel->name)==0)
break;
}
return uel != NULL;
@@ -343,11 +343,11 @@ const char *undo_editmode_get_name(bContext *C, int nr, int *active)
/* prevent wrong numbers to be returned */
undo_clean_stack(C);
- if(active) *active= 0;
+ if (active) *active= 0;
uel= BLI_findlink(&undobase, nr);
- if(uel) {
- if(active && uel==curundo)
+ if (uel) {
+ if (active && uel==curundo)
*active= 1;
return uel->name;
}
@@ -358,6 +358,6 @@ const char *undo_editmode_get_name(bContext *C, int nr, int *active)
void *undo_editmode_get_prev(Object *ob)
{
UndoElem *ue= undobase.last;
- if(ue && ue->prev && ue->prev->ob==ob) return ue->prev->undodata;
+ if (ue && ue->prev && ue->prev->ob==ob) return ue->prev->undodata;
return NULL;
}
diff --git a/source/blender/editors/util/numinput.c b/source/blender/editors/util/numinput.c
index a477a11e6c7..1d9e053376a 100644
--- a/source/blender/editors/util/numinput.c
+++ b/source/blender/editors/util/numinput.c
@@ -84,7 +84,7 @@ void outputNumInput(NumInput *n, char *str)
else
inv[0] = 0;
- if( n->val[i] > 1e10f || n->val[i] < -1e10f )
+ if ( n->val[i] > 1e10f || n->val[i] < -1e10f )
BLI_snprintf(&str[j*20], 20, "%s%.4e%c", inv, n->val[i], cur);
else
switch (n->ctrl[i]) {
@@ -181,7 +181,8 @@ char handleNumInput(NumInput *n, wmEvent *event)
default:
return 0;
}
- } else {
+ }
+ else {
switch (event->type) {
case BACKSPACEKEY:
if (n->ctrl[idx] == 0) {
@@ -217,7 +218,7 @@ char handleNumInput(NumInput *n, wmEvent *event)
}
break;
case PADMINUS:
- if(event->alt)
+ if (event->alt)
break;
case MINUSKEY:
if (n->flag & NUM_NO_NEGATIVE)
@@ -289,7 +290,7 @@ char handleNumInput(NumInput *n, wmEvent *event)
}
else {
/* float resolution breaks when over six digits after comma */
- if( ABS(n->ctrl[idx]) < 10000000) {
+ if ( ABS(n->ctrl[idx]) < 10000000) {
n->val[idx] += Val / (float)n->ctrl[idx];
n->ctrl[idx] *= 10;
}
diff --git a/source/blender/editors/util/undo.c b/source/blender/editors/util/undo.c
index 5478da31f7a..e46fe19d306 100644
--- a/source/blender/editors/util/undo.c
+++ b/source/blender/editors/util/undo.c
@@ -87,7 +87,7 @@ void ED_undo_push(bContext *C, const char *str)
if (G.f & G_DEBUG)
printf("undo push %s\n", str);
- if(obedit) {
+ if (obedit) {
#ifdef BMESH_EM_UNDO_RECALC_TESSFACE_WORKAROUND
/* undo is causing tessface recalc, so without we need to do explicitly */
@@ -103,7 +103,7 @@ void ED_undo_push(bContext *C, const char *str)
if (U.undosteps == 0) return;
- if(obedit->type==OB_MESH)
+ if (obedit->type==OB_MESH)
undo_push_mesh(C, str);
else if ELEM(obedit->type, OB_CURVE, OB_SURF)
undo_push_curve(C, str);
@@ -116,17 +116,17 @@ void ED_undo_push(bContext *C, const char *str)
else if (obedit->type==OB_ARMATURE)
undo_push_armature(C, str);
}
- else if(obact && obact->mode & OB_MODE_PARTICLE_EDIT) {
+ else if (obact && obact->mode & OB_MODE_PARTICLE_EDIT) {
if (U.undosteps == 0) return;
PE_undo_push(CTX_data_scene(C), str);
}
else {
- if(U.uiflag & USER_GLOBALUNDO)
+ if (U.uiflag & USER_GLOBALUNDO)
BKE_write_undo(C, str);
}
- if(wm->file_saved) {
+ if (wm->file_saved) {
wm->file_saved= 0;
/* notifier that data changed, for save-over warning or header */
WM_event_add_notifier(C, NC_WM|ND_DATACHANGED, NULL);
@@ -147,16 +147,16 @@ static int ed_undo_step(bContext *C, int step, const char *undoname)
}
/* grease pencil can be can be used in plenty of spaces, so check it first */
- if(ED_gpencil_session_active()) {
+ if (ED_gpencil_session_active()) {
return ED_undo_gpencil_step(C, step, undoname);
}
- if(sa && sa->spacetype==SPACE_IMAGE) {
+ if (sa && sa->spacetype==SPACE_IMAGE) {
SpaceImage *sima= (SpaceImage *)sa->spacedata.first;
- if((obact && obact->mode & OB_MODE_TEXTURE_PAINT) || sima->flag & SI_DRAWTOOL) {
- if(!ED_undo_paint_step(C, UNDO_PAINT_IMAGE, step, undoname) && undoname)
- if(U.uiflag & USER_GLOBALUNDO)
+ if ((obact && obact->mode & OB_MODE_TEXTURE_PAINT) || sima->flag & SI_DRAWTOOL) {
+ if (!ED_undo_paint_step(C, UNDO_PAINT_IMAGE, step, undoname) && undoname)
+ if (U.uiflag & USER_GLOBALUNDO)
BKE_undo_name(C, undoname);
WM_event_add_notifier(C, NC_WINDOW, NULL);
@@ -164,12 +164,12 @@ static int ed_undo_step(bContext *C, int step, const char *undoname)
}
}
- if(sa && sa->spacetype==SPACE_TEXT) {
+ if (sa && sa->spacetype==SPACE_TEXT) {
ED_text_undo_step(C, step);
}
- else if(obedit) {
+ else if (obedit) {
if ELEM7(obedit->type, OB_MESH, OB_FONT, OB_CURVE, OB_SURF, OB_MBALL, OB_LATTICE, OB_ARMATURE) {
- if(undoname)
+ if (undoname)
undo_editmode_name(C, undoname);
else
undo_editmode_step(C, step);
@@ -180,16 +180,16 @@ static int ed_undo_step(bContext *C, int step, const char *undoname)
else {
int do_glob_undo= 0;
- if(obact && obact->mode & OB_MODE_TEXTURE_PAINT) {
- if(!ED_undo_paint_step(C, UNDO_PAINT_IMAGE, step, undoname))
+ if (obact && obact->mode & OB_MODE_TEXTURE_PAINT) {
+ if (!ED_undo_paint_step(C, UNDO_PAINT_IMAGE, step, undoname))
do_glob_undo= 1;
}
- else if(obact && obact->mode & OB_MODE_SCULPT) {
- if(!ED_undo_paint_step(C, UNDO_PAINT_MESH, step, undoname))
+ else if (obact && obact->mode & OB_MODE_SCULPT) {
+ if (!ED_undo_paint_step(C, UNDO_PAINT_MESH, step, undoname))
do_glob_undo= 1;
}
- else if(obact && obact->mode & OB_MODE_PARTICLE_EDIT) {
- if(step==1)
+ else if (obact && obact->mode & OB_MODE_PARTICLE_EDIT) {
+ if (step==1)
PE_undo(CTX_data_scene(C));
else
PE_redo(CTX_data_scene(C));
@@ -198,13 +198,13 @@ static int ed_undo_step(bContext *C, int step, const char *undoname)
do_glob_undo= 1;
}
- if(do_glob_undo) {
- if(U.uiflag & USER_GLOBALUNDO) {
+ if (do_glob_undo) {
+ if (U.uiflag & USER_GLOBALUNDO) {
// note python defines not valid here anymore.
//#ifdef WITH_PYTHON
// XXX BPY_scripts_clear_pyobjects();
//#endif
- if(undoname)
+ if (undoname)
BKE_undo_name(C, undoname);
else
BKE_undo_step(C, step);
@@ -248,18 +248,18 @@ int ED_undo_valid(const bContext *C, const char *undoname)
Object *obact= CTX_data_active_object(C);
ScrArea *sa= CTX_wm_area(C);
- if(sa && sa->spacetype==SPACE_IMAGE) {
+ if (sa && sa->spacetype==SPACE_IMAGE) {
SpaceImage *sima= (SpaceImage *)sa->spacedata.first;
- if((obact && obact->mode & OB_MODE_TEXTURE_PAINT) || sima->flag & SI_DRAWTOOL) {
+ if ((obact && obact->mode & OB_MODE_TEXTURE_PAINT) || sima->flag & SI_DRAWTOOL) {
return 1;
}
}
- if(sa && sa->spacetype==SPACE_TEXT) {
+ if (sa && sa->spacetype==SPACE_TEXT) {
return 1;
}
- else if(obedit) {
+ else if (obedit) {
if ELEM7(obedit->type, OB_MESH, OB_FONT, OB_CURVE, OB_SURF, OB_MBALL, OB_LATTICE, OB_ARMATURE) {
return undo_editmode_valid(undoname);
}
@@ -268,19 +268,19 @@ int ED_undo_valid(const bContext *C, const char *undoname)
/* if below tests fail, global undo gets executed */
- if(obact && obact->mode & OB_MODE_TEXTURE_PAINT) {
- if( ED_undo_paint_valid(UNDO_PAINT_IMAGE, undoname) )
+ if (obact && obact->mode & OB_MODE_TEXTURE_PAINT) {
+ if ( ED_undo_paint_valid(UNDO_PAINT_IMAGE, undoname) )
return 1;
}
- else if(obact && obact->mode & OB_MODE_SCULPT) {
- if( ED_undo_paint_valid(UNDO_PAINT_MESH, undoname) )
+ else if (obact && obact->mode & OB_MODE_SCULPT) {
+ if ( ED_undo_paint_valid(UNDO_PAINT_MESH, undoname) )
return 1;
}
- else if(obact && obact->mode & OB_MODE_PARTICLE_EDIT) {
+ else if (obact && obact->mode & OB_MODE_PARTICLE_EDIT) {
return PE_undo_valid(CTX_data_scene(C));
}
- if(U.uiflag & USER_GLOBALUNDO) {
+ if (U.uiflag & USER_GLOBALUNDO) {
return BKE_undo_valid(undoname);
}
}
@@ -355,14 +355,14 @@ int ED_undo_operator_repeat(bContext *C, struct wmOperator *op)
{
int ret= 0;
- if(op) {
+ if (op) {
wmWindowManager *wm= CTX_wm_manager(C);
struct Scene *scene= CTX_data_scene(C);
ARegion *ar= CTX_wm_region(C);
ARegion *ar1= BKE_area_find_region_type(CTX_wm_area(C), RGN_TYPE_WINDOW);
- if(ar1)
+ if (ar1)
CTX_wm_region_set(C, ar1);
if ( (WM_operator_repeat_check(C, op)) &&
@@ -380,12 +380,12 @@ int ED_undo_operator_repeat(bContext *C, struct wmOperator *op)
printf("redo_cb: operator redo %s\n", op->type->name);
ED_undo_pop_op(C, op);
- if(op->type->check) {
+ if (op->type->check) {
op->type->check(C, op); /* ignore return value since its running again anyway */
}
retval= WM_operator_repeat(C, op);
- if((retval & OPERATOR_FINISHED)==0) {
+ if ((retval & OPERATOR_FINISHED)==0) {
if (G.f & G_DEBUG)
printf("redo_cb: operator redo failed: %s, return %d\n", op->type->name, retval);
ED_undo_redo(C);
@@ -435,16 +435,16 @@ static int get_undo_system(bContext *C)
Object *obedit= CTX_data_edit_object(C);
/* find out which undo system */
- if(obedit) {
+ if (obedit) {
if (ELEM7(obedit->type, OB_MESH, OB_FONT, OB_CURVE, OB_SURF, OB_MBALL, OB_LATTICE, OB_ARMATURE))
return UNDOSYSTEM_EDITMODE;
}
else {
Object *obact= CTX_data_active_object(C);
- if(obact && obact->mode & OB_MODE_PARTICLE_EDIT)
+ if (obact && obact->mode & OB_MODE_PARTICLE_EDIT)
return UNDOSYSTEM_PARTICLE;
- else if(U.uiflag & USER_GLOBALUNDO)
+ else if (U.uiflag & USER_GLOBALUNDO)
return UNDOSYSTEM_GLOBAL;
}
@@ -457,22 +457,22 @@ static EnumPropertyItem *rna_undo_itemf(bContext *C, int undosys, int *totitem)
EnumPropertyItem item_tmp= {0}, *item= NULL;
int active, i= 0;
- while(TRUE) {
+ while (TRUE) {
const char *name= NULL;
- if(undosys==UNDOSYSTEM_PARTICLE) {
+ if (undosys==UNDOSYSTEM_PARTICLE) {
name= PE_undo_get_name(CTX_data_scene(C), i, &active);
}
- else if(undosys==UNDOSYSTEM_EDITMODE) {
+ else if (undosys==UNDOSYSTEM_EDITMODE) {
name= undo_editmode_get_name(C, i, &active);
}
else {
name= BKE_undo_get_name(i, &active);
}
- if(name) {
+ if (name) {
item_tmp.identifier= item_tmp.name= name;
- if(active)
+ if (active)
item_tmp.icon= ICON_RESTRICT_VIEW_OFF;
else
item_tmp.icon= ICON_NONE;
@@ -495,19 +495,19 @@ static int undo_history_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(even
undosys= get_undo_system(C);
- if(undosys) {
+ if (undosys) {
EnumPropertyItem *item= rna_undo_itemf(C, undosys, &totitem);
- if(totitem > 0) {
+ if (totitem > 0) {
uiPopupMenu *pup= uiPupMenuBegin(C, op->type->name, ICON_NONE);
uiLayout *layout= uiPupMenuLayout(pup);
uiLayout *split= uiLayoutSplit(layout, 0, 0), *column = NULL;
int i, c;
- for(c=0, i=totitem-1; i >= 0; i--, c++) {
- if( (c % 20)==0 )
+ for (c=0, i=totitem-1; i >= 0; i--, c++) {
+ if ( (c % 20)==0 )
column= uiLayoutColumn(split, 0);
- if(item[i].identifier)
+ if (item[i].identifier)
uiItemIntO(column, item[i].name, item[i].icon, op->type->idname, "item", item[i].value);
}
@@ -524,14 +524,14 @@ static int undo_history_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(even
/* note: also check ed_undo_step() in top if you change notifiers */
static int undo_history_exec(bContext *C, wmOperator *op)
{
- if(RNA_struct_property_is_set(op->ptr, "item")) {
+ if (RNA_struct_property_is_set(op->ptr, "item")) {
int undosys= get_undo_system(C);
int item= RNA_int_get(op->ptr, "item");
- if(undosys==UNDOSYSTEM_PARTICLE) {
+ if (undosys==UNDOSYSTEM_PARTICLE) {
PE_undo_number(CTX_data_scene(C), item);
}
- else if(undosys==UNDOSYSTEM_EDITMODE) {
+ else if (undosys==UNDOSYSTEM_EDITMODE) {
undo_editmode_number(C, item+1);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, NULL);
}