diff options
Diffstat (limited to 'source/blender/editors')
47 files changed, 293 insertions, 486 deletions
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index f15ce721081..9e3630aea67 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -2600,8 +2600,7 @@ short ANIM_channel_setting_get (bAnimContext *ac, bAnimListElem *ale, int settin bAnimChannelType *acf= ANIM_channel_get_typeinfo(ale); /* 1) check that the setting exists for the current context */ - if ( (acf) && (!acf->has_setting || acf->has_setting(ac, ale, setting)) ) - { + if ((acf) && (!acf->has_setting || acf->has_setting(ac, ale, setting))) { /* 2) get pointer to check for flag in, and the flag to check for */ short negflag, ptrsize; int flag; @@ -2678,8 +2677,7 @@ void ANIM_channel_setting_set (bAnimContext *ac, bAnimListElem *ale, int setting bAnimChannelType *acf= ANIM_channel_get_typeinfo(ale); /* 1) check that the setting exists for the current context */ - if ( (acf) && (!acf->has_setting || acf->has_setting(ac, ale, setting)) ) - { + if ((acf) && (!acf->has_setting || acf->has_setting(ac, ale, setting))) { /* 2) get pointer to check for flag in, and the flag to check for */ short negflag, ptrsize; int flag; @@ -2831,8 +2829,7 @@ void ANIM_channel_draw (bAnimContext *ac, bAnimListElem *ale, float yminc, float UI_DrawString(offset, ytext, name); /* draw red underline if channel is disabled */ - if ((ale->type == ANIMTYPE_FCURVE) && (ale->flag & FCURVE_DISABLED)) - { + if ((ale->type == ANIMTYPE_FCURVE) && (ale->flag & FCURVE_DISABLED)) { // FIXME: replace hardcoded color here, and check on extents! glColor3f(1.0f, 0.0f, 0.0f); glLineWidth(2.0); diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index 74ae587218b..ec1583f2aa3 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -541,8 +541,7 @@ void ANIM_fcurve_delete_from_animdata (bAnimContext *ac, AnimData *adt, FCurve * /* XXX: there's a problem where many actions could build up in the file if multiple * full add/delete cycles are performed on the same objects, but assume that this is rare */ - if ((adt->action->curves.first == NULL) && (adt->flag & ADT_NLA_EDIT_ON)==0) - { + if ((adt->action->curves.first == NULL) && (adt->flag & ADT_NLA_EDIT_ON)==0) { id_us_min(&adt->action->id); adt->action = NULL; } diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c index 714c3276769..1ef02f46000 100644 --- a/source/blender/editors/animation/anim_draw.c +++ b/source/blender/editors/animation/anim_draw.c @@ -367,18 +367,15 @@ void ANIM_nla_mapping_apply_fcurve (AnimData *adt, FCurve *fcu, short restore, s float ANIM_unit_mapping_get_factor (Scene *scene, ID *id, FCurve *fcu, short restore) { /* sanity checks */ - if (id && fcu && fcu->rna_path) - { + if (id && fcu && fcu->rna_path) { PointerRNA ptr, id_ptr; PropertyRNA *prop; /* get RNA property that F-Curve affects */ RNA_id_pointer_create(id, &id_ptr); - if (RNA_path_resolve(&id_ptr, fcu->rna_path, &ptr, &prop)) - { + if (RNA_path_resolve(&id_ptr, fcu->rna_path, &ptr, &prop)) { /* rotations: radians <-> degrees? */ - if (RNA_SUBTYPE_UNIT(RNA_property_subtype(prop)) == PROP_UNIT_ROTATION) - { + if (RNA_SUBTYPE_UNIT(RNA_property_subtype(prop)) == PROP_UNIT_ROTATION) { /* if the radians flag is not set, default to using degrees which need conversions */ if ((scene) && (scene->unit.system_rotation == USER_UNIT_ROT_RADIANS) == 0) { if (restore) diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index 81836d83b95..05a2cc33fac 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -1038,8 +1038,7 @@ static size_t animfilter_act_group (bAnimContext *ac, ListBase *anim_data, bDope * but to do this, we need to check that the group doesn't have it's not-visible flag set preventing * all its sub-curves to be shown */ - if ( !(filter_mode & ANIMFILTER_CURVE_VISIBLE) || !(agrp->flag & AGRP_NOTVISIBLE) ) - { + if (!(filter_mode & ANIMFILTER_CURVE_VISIBLE) || !(agrp->flag & AGRP_NOTVISIBLE)) { /* group must be editable for its children to be editable (if we care about this) */ if (!(filter_mode & ANIMFILTER_FOREDIT) || EDITABLE_AGRP(agrp)) { /* get first F-Curve which can be used here */ diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c index 7f7b1b28319..b3efeffe1d9 100644 --- a/source/blender/editors/animation/anim_markers.c +++ b/source/blender/editors/animation/anim_markers.c @@ -83,10 +83,10 @@ static ListBase *context_get_markers(Scene *scene, ScrArea *sa) /* local markers can only be shown when there's only a single active action to grab them from * - flag only takes effect when there's an action, otherwise it can get too confusing? */ - if (ELEM(saction->mode, SACTCONT_ACTION, SACTCONT_SHAPEKEY) && (saction->action)) - { - if (saction->flag & SACTION_POSEMARKERS_SHOW) + if (ELEM(saction->mode, SACTCONT_ACTION, SACTCONT_SHAPEKEY) && (saction->action)) { + if (saction->flag & SACTION_POSEMARKERS_SHOW) { return &saction->action->markers; + } } } } @@ -851,8 +851,7 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt) float vec[3]; char str_tx[256]; - if (handleNumInput(&mm->num, evt)) - { + if (handleNumInput(&mm->num, evt)) { applyNumInput(&mm->num, vec); outputNumInput(&mm->num, str_tx); diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index 161f549e257..2a66a6c0aba 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -105,8 +105,7 @@ short ANIM_get_keyframing_flags (Scene *scene, short incl_mode) } /* only if including settings from the autokeying mode... */ - if (incl_mode) - { + if (incl_mode) { /* keyframing mode - only replace existing keyframes */ if (IS_AUTOKEY_MODE(scene, EDITKEYS)) flag |= INSERTKEY_REPLACE; diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index 6a128abea18..365eb28278d 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -2533,8 +2533,7 @@ EditBone *duplicateEditBoneObjects(EditBone *curBone, const char *name, ListBase curBone->temp = eBone; eBone->temp = curBone; - if (name != NULL) - { + if (name != NULL) { BLI_strncpy(eBone->name, name, sizeof(eBone->name)); } @@ -5557,8 +5556,7 @@ void transform_armature_mirror_update(Object *obedit) eboflip->roll= -ebo->roll; /* Also move connected parent, in case parent's name isn't mirrored properly */ - if (eboflip->parent && eboflip->flag & BONE_CONNECTED) - { + if (eboflip->parent && eboflip->flag & BONE_CONNECTED) { EditBone *parent = eboflip->parent; copy_v3_v3(parent->tail, eboflip->head); parent->rad_tail = ebo->rad_head; @@ -5589,8 +5587,7 @@ EditBone * subdivideByAngle(Scene *scene, Object *obedit, ReebArc *arc, ReebNode bArmature *arm= obedit->data; EditBone *lastBone = NULL; - if (scene->toolsettings->skgen_options & SKGEN_CUT_ANGLE) - { + if (scene->toolsettings->skgen_options & SKGEN_CUT_ANGLE) { ReebArcIterator arc_iter; BArcIterator *iter = (BArcIterator*)&arc_iter; float *previous = NULL, *current = NULL; @@ -5624,8 +5621,7 @@ EditBone * subdivideByAngle(Scene *scene, Object *obedit, ReebArc *arc, ReebNode len1 = normalize_v3(vec1); len2 = normalize_v3(vec2); - if (len1 > 0.0f && len2 > 0.0f && dot_v3v3(vec1, vec2) < angleLimit) - { + if (len1 > 0.0f && len2 > 0.0f && dot_v3v3(vec1, vec2) < angleLimit) { copy_v3_v3(parent->tail, previous); child = ED_armature_edit_bone_add(arm, "Bone"); @@ -5641,8 +5637,7 @@ EditBone * subdivideByAngle(Scene *scene, Object *obedit, ReebArc *arc, ReebNode /* If the bone wasn't subdivided, delete it and return NULL * to let subsequent subdivision methods do their thing. * */ - if (parent == root) - { + if (parent == root) { if(parent==arm->act_edbone) arm->act_edbone= NULL; ED_armature_edit_bone_remove(arm, parent); parent = NULL; @@ -5658,8 +5653,7 @@ EditBone * test_subdivideByCorrelation(Scene *scene, Object *obedit, ReebArc *ar { EditBone *lastBone = NULL; - if (scene->toolsettings->skgen_options & SKGEN_CUT_CORRELATION) - { + if (scene->toolsettings->skgen_options & SKGEN_CUT_CORRELATION) { float invmat[4][4]= MAT4_UNITY; float tmat[3][3]= MAT3_UNITY; ReebArcIterator arc_iter; @@ -5682,19 +5676,16 @@ float arcLengthRatio(ReebArc *arc) arcLength = len_v3v3(arc->head->p, arc->tail->p); - if (arc->bcount > 0) - { + if (arc->bcount > 0) { /* Add the embedding */ - for ( i = 1; i < arc->bcount; i++) - { + for ( i = 1; i < arc->bcount; i++) { embedLength += len_v3v3(arc->buckets[i - 1].p, arc->buckets[i].p); } /* Add head and tail -> embedding vectors */ embedLength += len_v3v3(arc->head->p, arc->buckets[0].p); embedLength += len_v3v3(arc->tail->p, arc->buckets[arc->bcount - 1].p); } - else - { + else { embedLength = arcLength; } @@ -5734,8 +5725,7 @@ void generateSkeletonFromReebGraph(Scene *scene, ReebGraph *rg) src = scene->basact->object; - if (obedit != NULL) - { + if (obedit != NULL) { ED_armature_from_edit(obedit); ED_armature_edit_free(obedit); } @@ -5772,32 +5762,28 @@ void generateSkeletonFromReebGraph(Scene *scene, ReebGraph *rg) * Finally, the arc direction is stored in its flag: 1 (low -> high), -1 (high -> low) */ - /* if arc is a symmetry axis, internal bones go up the tree */ - if (arc->symmetry_level == 1 && arc->tail->degree != 1) - { + /* if arc is a symmetry axis, internal bones go up the tree */ + if (arc->symmetry_level == 1 && arc->tail->degree != 1) { head = arc->tail; tail = arc->head; arc->flag = -1; /* mark arc direction */ } /* Bones point AWAY from the symmetry axis */ - else if (arc->head->symmetry_level == 1) - { + else if (arc->head->symmetry_level == 1) { head = arc->head; tail = arc->tail; arc->flag = 1; /* mark arc direction */ } - else if (arc->tail->symmetry_level == 1) - { + else if (arc->tail->symmetry_level == 1) { head = arc->tail; tail = arc->head; arc->flag = -1; /* mark arc direction */ } /* otherwise, always go from low weight to high weight */ - else - { + else { head = arc->head; tail = arc->tail; @@ -5805,10 +5791,8 @@ void generateSkeletonFromReebGraph(Scene *scene, ReebGraph *rg) } /* Loop over subdivision methods */ - for (i = 0; lastBone == NULL && i < SKGEN_SUB_TOTAL; i++) - { - switch(scene->toolsettings->skgen_subdivisions[i]) - { + for (i = 0; lastBone == NULL && i < SKGEN_SUB_TOTAL; i++) { + switch(scene->toolsettings->skgen_subdivisions[i]) { case SKGEN_SUB_LENGTH: lastBone = test_subdivideByLength(scene, obedit, arc, head, tail); break; @@ -5821,8 +5805,7 @@ void generateSkeletonFromReebGraph(Scene *scene, ReebGraph *rg) } } - if (lastBone == NULL) - { + if (lastBone == NULL) { EditBone *bone; bone = ED_armature_edit_bone_add(obedit->data, "Bone"); bone->flag |= BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL; @@ -5843,20 +5826,18 @@ void generateSkeletonFromReebGraph(Scene *scene, ReebGraph *rg) ReebArc *incomingArc = NULL; int i; - for (i = 0; i < node->degree; i++) - { + for (i = 0; i < node->degree; i++) { arc = (ReebArc*)node->arcs[i]; /* if arc is incoming into the node */ - if ((arc->head == node && arc->flag == -1) || (arc->tail == node && arc->flag == 1)) + if ((arc->head == node && arc->flag == -1) || + (arc->tail == node && arc->flag == 1)) { - if (incomingArc == NULL) - { + if (incomingArc == NULL) { incomingArc = arc; /* loop further to make sure there's only one incoming arc */ } - else - { + else { /* skip this node if more than one incomingArc */ incomingArc = NULL; break; /* No need to look further, we are skipping already */ @@ -5864,8 +5845,7 @@ void generateSkeletonFromReebGraph(Scene *scene, ReebGraph *rg) } } - if (incomingArc != NULL) - { + if (incomingArc != NULL) { EditBone *parentBone = BLI_ghash_lookup(arcBoneMap, incomingArc); /* Look for outgoing arcs and parent their bones */ @@ -5874,8 +5854,7 @@ void generateSkeletonFromReebGraph(Scene *scene, ReebGraph *rg) arc = node->arcs[i]; /* if arc is outgoing from the node */ - if ((arc->head == node && arc->flag == 1) || (arc->tail == node && arc->flag == -1)) - { + if ((arc->head == node && arc->flag == 1) || (arc->tail == node && arc->flag == -1)) { EditBone *childBone = BLI_ghash_lookup(arcBoneMap, arc); /* find the root bone */ diff --git a/source/blender/editors/armature/editarmature_retarget.c b/source/blender/editors/armature/editarmature_retarget.c index f1ea39e45b9..375184d3229 100644 --- a/source/blender/editors/armature/editarmature_retarget.c +++ b/source/blender/editors/armature/editarmature_retarget.c @@ -2901,12 +2901,10 @@ void BIF_retargetArc(bContext *C, ReebArc *earc, RigGraph *template_rigg) char *num_string = scene->toolsettings->skgen_num_string; int free_template = 0; - if (template_rigg) - { - ob = template_rigg->ob; + if (template_rigg) { + ob = template_rigg->ob; } - else - { + else { free_template = 1; ob = obedit; template_rigg = armatureSelectedToGraph(C, ob, ob->data); diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c index 5e9acc5b84f..76af016b6c6 100644 --- a/source/blender/editors/gpencil/drawgpencil.c +++ b/source/blender/editors/gpencil/drawgpencil.c @@ -189,8 +189,7 @@ static void gp_draw_stroke_point (bGPDspoint *points, short thickness, short dfl glVertex2fv(co); glEnd(); } - else - { + else { /* draw filled circle as is done in circf (but without the matrix push/pops which screwed things up) */ GLUquadricObj *qobj = gluNewQuadric(); @@ -289,8 +288,7 @@ static void gp_draw_stroke (bGPDspoint *points, int totpoints, short thickness_s /* tessellation code - draw stroke as series of connected quads with connection * edges rotated to minimise shrinking artifacts, and rounded endcaps */ - else - { + else { bGPDspoint *pt1, *pt2; float pm[2]; int i; @@ -384,8 +382,8 @@ static void gp_draw_stroke (bGPDspoint *points, int totpoints, short thickness_s mt[1]= mb[1] * pthick; athick= len_v2(mt); dfac= pthick - (athick * 2); - if ( ((athick * 2.0f) < pthick) && (IS_EQF(athick, pthick)==0) ) - { + + if (((athick * 2.0f) < pthick) && (IS_EQF(athick, pthick)==0)) { mt[0] += (mb[0] * dfac); mt[1] += (mb[1] * dfac); } diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index 84d3162434a..535a0f947f1 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -194,8 +194,7 @@ static void gp_get_3d_reference (tGPsdata *p, float vec[3]) /* the reference point used depends on the owner... */ #if 0 // XXX: disabled for now, since we can't draw relative to the owner yet - if (p->ownerPtr.type == &RNA_Object) - { + if (p->ownerPtr.type == &RNA_Object) { Object *ob= (Object *)p->ownerPtr.data; /* active Object @@ -517,10 +516,8 @@ static void gp_stroke_simplify (tGPsdata *p) pressure += old_points[offs].pressure * sfac; \ } - for (i = 0, j = 0; i < num_points; i++) - { - if (i - j == 3) - { + for (i = 0, j = 0; i < num_points; i++) { + if (i - j == 3) { float co[2], pressure; int mco[2]; @@ -1855,8 +1852,7 @@ static int gpencil_draw_modal (bContext *C, wmOperator *op, wmEvent *event) /* handle mode-specific events */ if (p->status == GP_STATUS_PAINTING) { /* handle painting mouse-movements? */ - if (ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE) || (p->flags & GP_PAINTFLAG_FIRSTRUN)) - { + if (ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE) || (p->flags & GP_PAINTFLAG_FIRSTRUN)) { /* handle drawing event */ //printf("\t\tGP - add point\n"); gpencil_draw_apply_event(op, event); diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index 97248e8710c..1cf93ba8b11 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -557,24 +557,21 @@ static void ui_draw_but_CHARTAB(uiBut *but) // Set the font to be either unicode or FO_BUILTIN_NAME wstr[0] = cs; - if(strcmp(G.selfont->name, FO_BUILTIN_NAME)) - { + if (strcmp(G.selfont->name, FO_BUILTIN_NAME)) { BLI_strncpy_wchar_as_utf8((char *)ustr, (wchar_t *)wstr, sizeof(ustr)); } - else - { - if(G.ui_international == TRUE) - { + else { + if (G.ui_international == TRUE) { BLI_strncpy_wchar_as_utf8((char *)ustr, (wchar_t *)wstr, sizeof(ustr)); } - else - { + else { ustr[0] = cs; ustr[1] = 0; } } - if((G.selfont && strcmp(G.selfont->name, FO_BUILTIN_NAME)) || (G.selfont && !strcmp(G.selfont->name, FO_BUILTIN_NAME) && G.ui_international == TRUE)) + if ((G.selfont && strcmp(G.selfont->name, FO_BUILTIN_NAME)) || + (G.selfont && !strcmp(G.selfont->name, FO_BUILTIN_NAME) && G.ui_international == TRUE)) { float wid; float llx, lly, llz, urx, ury, urz; @@ -595,8 +592,7 @@ static void ui_draw_but_CHARTAB(uiBut *but) ui_rasterpos_safe(px, py, but->aspect); FTF_DrawString((char *) ustr, FTF_USE_GETTEXT | FTF_INPUT_UTF8); } - else - { + else { ui_rasterpos_safe(sx + butw/2, sy + buth/2, but->aspect); UI_DrawString(but->font, (char *) ustr, 0); } diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index cc30cda78be..0496c8c5c36 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -4193,8 +4193,7 @@ static int ui_do_but_CHARTAB(bContext *UNUSED(C), uiBlock *UNUSED(block), uiBut if(che > G.charmax) che = 0; - if(G.obedit) - { + if(G.obedit) { do_textedit(0,0,che); } @@ -4227,10 +4226,8 @@ static int ui_do_but_CHARTAB(bContext *UNUSED(C), uiBlock *UNUSED(block), uiBut return WM_UI_HANDLER_BREAK; } else if(ELEM(event->type, WHEELDOWNMOUSE, PAGEDOWNKEY)) { - for(but= block->buttons.first; but; but= but->next) - { - if(but->type == CHARTAB) - { + for(but= block->buttons.first; but; but= but->next) { + if(but->type == CHARTAB) { G.charstart = G.charstart + (12*6); if(G.charstart > (0xffff - 12*6)) G.charstart = 0xffff - (12*6); diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index bde2c334444..552d5b0d221 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -1015,8 +1015,7 @@ static void icon_draw_size(float x, float y, int icon_id, float aspect, float al static void ui_id_preview_image_render_size(bContext *C, ID *id, PreviewImage *pi, int size) { - if ((pi->changed[size] ||!pi->rect[size])) /* changed only ever set by dynamic icons */ - { + if ((pi->changed[size] ||!pi->rect[size])) { /* changed only ever set by dynamic icons */ /* create the rect if necessary */ icon_set_image(C, id, pi, size); diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 70336eb9e0f..aa2d939d5f1 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -774,8 +774,7 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob, } if (ob->type==OB_MESH) { - if (modifier_couldBeCage(scene, md) && (index <= lastCageIndex)) - { + if (modifier_couldBeCage(scene, md) && (index <= lastCageIndex)) { /* -- convert to rna ? */ but = uiDefIconButBitI(block, TOG, eModifierMode_OnCage, 0, ICON_MESH_DATA, 0, 0, UI_UNIT_X-2, UI_UNIT_Y, &md->mode, 0.0, 0.0, 0.0, 0.0, TIP_("Apply modifier to editing cage during Editmode")); diff --git a/source/blender/editors/mesh/loopcut.c b/source/blender/editors/mesh/loopcut.c index 59151cf107c..358cd8d2012 100644 --- a/source/blender/editors/mesh/loopcut.c +++ b/source/blender/editors/mesh/loopcut.c @@ -514,8 +514,7 @@ static int loopcut_modal (bContext *C, wmOperator *op, wmEvent *event) if (event->val==KM_PRESS) { float value; - if (handleNumInput(&lcd->num, event)) - { + if (handleNumInput(&lcd->num, event)) { applyNumInput(&lcd->num, &value); cuts= CLAMPIS(value, 1, 32); diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c index a90edb29c29..b7b2033b2ed 100644 --- a/source/blender/editors/object/object_constraint.c +++ b/source/blender/editors/object/object_constraint.c @@ -391,8 +391,7 @@ static void test_constraints (Object *owner, bPoseChannel *pchan) /* if the number of points does not match the amount required by the chain length, * free the points array and request a rebind... */ - if ((data->points == NULL) || (data->numpoints != data->chainlen+1)) - { + if ((data->points == NULL) || (data->numpoints != data->chainlen+1)) { /* free the points array */ if (data->points) { MEM_freeN(data->points); diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index 2945075b9de..931896ed916 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -319,13 +319,11 @@ static int make_proxy_exec (bContext *C, wmOperator *op) GroupObject *go; Scene *scene= CTX_data_scene(C); - if (gob->dup_group != NULL) - { + if (gob->dup_group != NULL) { go= BLI_findlink(&gob->dup_group->gobject, RNA_enum_get(op->ptr, "object")); ob= go->ob; } - else - { + else { ob= gob; gob = NULL; } @@ -598,8 +596,7 @@ int ED_object_parent_set(ReportList *reports, Main *bmain, Scene *scene, Object /* BUT, to keep the deforms, we need a modifier, and then we need to set the object that it uses */ // XXX currently this should only happen for meshes, curves, surfaces, and lattices - this stuff isn't available for metas yet - if (ELEM5(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_LATTICE)) - { + if (ELEM5(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_LATTICE)) { ModifierData *md; switch (partype) { diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index 3cc7c8a944e..e08139e9a78 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -252,9 +252,8 @@ static PTCacheEdit *pe_get_current(Scene *scene, Object *ob, int create) break; } } - else if(pset->edittype == PE_TYPE_SOFTBODY && pid->type == PTCACHE_TYPE_SOFTBODY) { - if(create && pid->cache->flag & PTCACHE_BAKED && !pid->cache->edit) - { + else if (pset->edittype == PE_TYPE_SOFTBODY && pid->type == PTCACHE_TYPE_SOFTBODY) { + if (create && pid->cache->flag & PTCACHE_BAKED && !pid->cache->edit) { pset->flag |= PE_FADE_TIME; // NICE TO HAVE but doesn't work: pset->brushtype = PE_BRUSH_COMB; PE_create_particle_edit(scene, ob, pid->cache, NULL); @@ -262,9 +261,8 @@ static PTCacheEdit *pe_get_current(Scene *scene, Object *ob, int create) edit = pid->cache->edit; break; } - else if(pset->edittype == PE_TYPE_CLOTH && pid->type == PTCACHE_TYPE_CLOTH) { - if(create && pid->cache->flag & PTCACHE_BAKED && !pid->cache->edit) - { + else if (pset->edittype == PE_TYPE_CLOTH && pid->type == PTCACHE_TYPE_CLOTH) { + if (create && pid->cache->flag & PTCACHE_BAKED && !pid->cache->edit) { pset->flag |= PE_FADE_TIME; // NICE TO HAVE but doesn't work: pset->brushtype = PE_BRUSH_COMB; PE_create_particle_edit(scene, ob, pid->cache, NULL); @@ -3632,10 +3630,10 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr) PE_update_object(scene, ob, 1); } - if(edit->psys) + if (edit->psys) { WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE|NA_EDITED, ob); - else - { + } + else { DAG_id_tag_update(&ob->id, OB_RECALC_DATA); WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob); } diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c index d3af007d2e6..96a59ee4542 100644 --- a/source/blender/editors/physics/physics_fluid.c +++ b/source/blender/editors/physics/physics_fluid.c @@ -860,8 +860,7 @@ static void fluidsim_delete_until_lastframe(FluidsimSettings *fss, const char *r curFrame++; - if((exists = BLI_exists(targetFile))) - { + if ((exists = BLI_exists(targetFile))) { BLI_delete(targetFile, 0, 0); BLI_delete(targetFileVel, 0, 0); BLI_delete(previewFile, 0, 0); diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 5504434e6b5..a8ad50b2f53 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -2907,10 +2907,13 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), wmEvent *e else if (sad->flag & ANIMPLAY_FLAG_NO_SYNC) sync= 0; else sync= (scene->flag & SCE_FRAME_DROP); - if((scene->audio.flag & AUDIO_SYNC) && !(sad->flag & ANIMPLAY_FLAG_REVERSE) && finite(time = sound_sync_scene(scene))) - scene->r.cfra = (double)time * FPS + 0.5; - else + if ((scene->audio.flag & AUDIO_SYNC) && + (sad->flag & ANIMPLAY_FLAG_REVERSE) == FALSE && + finite(time = sound_sync_scene(scene))) { + scene->r.cfra = (double)time * FPS + 0.5; + } + else { if (sync) { int step = floor(wt->duration * FPS); /* skip frames */ diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index b5ecff74448..9c78b6126e7 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -1543,11 +1543,10 @@ static void do_layer_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode unode= sculpt_undo_push_node(ob, nodes[n]); origco=unode->co; - if(!unode->layer_disp) - { - #pragma omp critical - unode->layer_disp= MEM_callocN(sizeof(float)*unode->totvert, "layer disp"); - } + if (!unode->layer_disp) { + #pragma omp critical + unode->layer_disp= MEM_callocN(sizeof(float)*unode->totvert, "layer disp"); + } layer_disp= unode->layer_disp; diff --git a/source/blender/editors/sculpt_paint/sculpt_uv.c b/source/blender/editors/sculpt_paint/sculpt_uv.c index f0aedae88ac..72e9f861aa9 100644 --- a/source/blender/editors/sculpt_paint/sculpt_uv.c +++ b/source/blender/editors/sculpt_paint/sculpt_uv.c @@ -414,8 +414,7 @@ static void uv_sculpt_stroke_exit(bContext *C, wmOperator *op) if (data->timer) { WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), data->timer); } - if (data->elementMap) - { + if (data->elementMap) { EDBM_free_uv_element_map(data->elementMap); } if (data->uv) { diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c index 205b2064f51..8f6a01dc6cd 100644 --- a/source/blender/editors/sound/sound_ops.c +++ b/source/blender/editors/sound/sound_ops.c @@ -345,8 +345,7 @@ static int sound_mixdown_exec(bContext *C, wmOperator *op) result = AUD_mixdown(scene->sound_scene, SFRA * specs.rate / FPS, (EFRA - SFRA) * specs.rate / FPS, accuracy, filename, specs, container, codec, bitrate); - if(result) - { + if (result) { BKE_report(op->reports, RPT_ERROR, result); return OPERATOR_CANCELLED; } diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index 05de70b99ab..f663307507a 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -215,8 +215,7 @@ static FileSelect file_select(bContext* C, const rcti* rect, FileSelType select, if (sel.first != sel.last) select = 0; /* Do we have a valid selection and are we actually selecting */ - if ( (sel.last >= 0) && ((select == FILE_SEL_ADD) || (select == FILE_SEL_TOGGLE)) ) - { + if ((sel.last >= 0) && ((select == FILE_SEL_ADD) || (select == FILE_SEL_TOGGLE))) { /* Check last selection, if selected, act on the file or dir */ if (filelist_is_selected(sfile->files, sel.last, check_type)) { retval = file_select_do(C, sel.last); @@ -1171,9 +1170,8 @@ int file_filename_exec(bContext *C, wmOperator *UNUSED(unused)) { SpaceFile *sfile= CTX_wm_space_file(C); - if(sfile->params) { - if (file_select_match(sfile, sfile->params->file)) - { + if (sfile->params) { + if (file_select_match(sfile, sfile->params->file)) { sfile->params->file[0] = '\0'; WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_PARAMS, NULL); } diff --git a/source/blender/editors/space_file/fsmenu.c b/source/blender/editors/space_file/fsmenu.c index 4f4ad52e4a4..4c9d2be791b 100644 --- a/source/blender/editors/space_file/fsmenu.c +++ b/source/blender/editors/space_file/fsmenu.c @@ -334,8 +334,8 @@ void fsmenu_read_system(struct FSMenu* fsmenu) continue; FSRefMakePath(&dir, path, FILE_MAX); - if (strcmp((char*)path, "/home") && strcmp((char*)path, "/net")) - { /* /net and /home are meaningless on OSX, home folders are stored in /Users */ + if (strcmp((char*)path, "/home") && strcmp((char*)path, "/net")) { + /* /net and /home are meaningless on OSX, home folders are stored in /Users */ fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM, (char *)path, 1, 0); } } diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c index 7821547aaf3..9eafd4533d2 100644 --- a/source/blender/editors/space_file/space_file.c +++ b/source/blender/editors/space_file/space_file.c @@ -196,8 +196,8 @@ static void file_refresh(const bContext *C, ScrArea *UNUSED(sa)) filelist_hidedot(sfile->files, params->flag & FILE_HIDE_DOT); filelist_setfilter(sfile->files, params->flag & FILE_FILTER ? params->filter : 0); filelist_setfilter_types(sfile->files, params->filter_glob); - if (filelist_empty(sfile->files)) - { + + if (filelist_empty(sfile->files)) { thumbnails_stop(sfile->files, C); filelist_readdir(sfile->files); if(params->sort!=FILE_SORT_NONE) { diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index f1afb3c82db..8af16bd1aec 100644 --- a/source/blender/editors/space_graph/graph_draw.c +++ b/source/blender/editors/space_graph/graph_draw.c @@ -292,8 +292,7 @@ static void draw_fcurve_vertices (SpaceIpo *sipo, ARegion *ar, FCurve *fcu, shor glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE)); /* draw the two handles first (if they're shown, the curve doesn't have just a single keyframe, and the curve is being edited) */ - if (do_handles) - { + if (do_handles) { set_fcurve_vertex_color(fcu, 0); draw_fcurve_vertices_handles(fcu, sipo, v2d, 0, sel_handle_only); @@ -327,8 +326,7 @@ static int draw_fcurve_handles_check(SpaceIpo *sipo, FCurve *fcu) { return 0; } - else - { + else { return 1; } } @@ -368,8 +366,7 @@ static void draw_fcurve_handles (SpaceIpo *sipo, FCurve *fcu) fp= bezt->vec[0]; /* only draw first handle if previous segment had handles */ - if ( (!prevbezt && (bezt->ipo==BEZT_IPO_BEZ)) || (prevbezt && (prevbezt->ipo==BEZT_IPO_BEZ)) ) - { + if ((!prevbezt && (bezt->ipo==BEZT_IPO_BEZ)) || (prevbezt && (prevbezt->ipo==BEZT_IPO_BEZ))) { UI_GetThemeColor3ubv(basecol + bezt->h1, col); col[3]= drawFCurveFade(fcu) * 255; glColor4ubv((GLubyte *)col); @@ -378,8 +375,7 @@ static void draw_fcurve_handles (SpaceIpo *sipo, FCurve *fcu) } /* only draw second handle if this segment is bezier */ - if (bezt->ipo == BEZT_IPO_BEZ) - { + if (bezt->ipo == BEZT_IPO_BEZ) { UI_GetThemeColor3ubv(basecol + bezt->h2, col); col[3]= drawFCurveFade(fcu) * 255; glColor4ubv((GLubyte *)col); diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c index e44f1abd262..bdd3497a931 100644 --- a/source/blender/editors/space_graph/graph_select.c +++ b/source/blender/editors/space_graph/graph_select.c @@ -1006,14 +1006,12 @@ static void get_nearest_fcurve_verts_list (bAnimContext *ac, const int mval[2], /* handles - only do them if they're visible */ if (fcurve_handle_sel_check(sipo, bezt1) && (fcu->totvert > 1)) { /* first handle only visible if previous segment had handles */ - if ( (!prevbezt && (bezt1->ipo==BEZT_IPO_BEZ)) || (prevbezt && (prevbezt->ipo==BEZT_IPO_BEZ)) ) - { + if ((!prevbezt && (bezt1->ipo==BEZT_IPO_BEZ)) || (prevbezt && (prevbezt->ipo==BEZT_IPO_BEZ))) { nearest_fcurve_vert_store(matches, v2d, fcu, bezt1, NULL, NEAREST_HANDLE_LEFT, mval); } /* second handle only visible if this segment is bezier */ - if (bezt1->ipo == BEZT_IPO_BEZ) - { + if (bezt1->ipo == BEZT_IPO_BEZ) { nearest_fcurve_vert_store(matches, v2d, fcu, bezt1, NULL, NEAREST_HANDLE_RIGHT, mval); } } diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c index 26c56e9948f..07d47e64be2 100644 --- a/source/blender/editors/space_logic/logic_window.c +++ b/source/blender/editors/space_logic/logic_window.c @@ -1359,11 +1359,12 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short uiDefBut(block, TEX, 1, "Max: ", xco+width/2,yco-92,width/2, 19, ps->maxvalue, 0, MAX_NAME, 0, 0, "check for max value"); } - else if(ps->type == SENS_PROP_CHANGED); - else - { + else if(ps->type == SENS_PROP_CHANGED) { + /* pass */ + } + else { uiDefBut(block, TEX, 1, "Value: ", xco+30,yco-92,width-60, 19, - ps->value, 0, MAX_NAME, 0, 0, "check for value"); + ps->value, 0, MAX_NAME, 0, 0, "check for value"); } yco-= ysize; @@ -1511,14 +1512,12 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short &raySens->mode, 0.0, 0.0, 0, 0, "Toggle collision on material or property"); - if (raySens->mode & SENS_COLLISION_MATERIAL) - { + if (raySens->mode & SENS_COLLISION_MATERIAL) { uiDefBut(block, TEX, 1, "Material:", xco + 10 + 0.20 * (width-20), yco-44, 0.8*(width-20), 19, &raySens->matname, 0, MAX_NAME, 0, 0, "Only look for Objects with this material"); } - else - { + else { uiDefBut(block, TEX, 1, "Property:", xco + 10 + 0.20 * (width-20), yco-44, 0.8*(width-20), 19, &raySens->propname, 0, MAX_NAME, 0, 0, "Only look for Objects with this property"); @@ -1878,12 +1877,10 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo wval = (width-100)/3; if (oa->type == ACT_OBJECT_NORMAL) { - if ( ob->gameflag & OB_DYNAMIC ) - { + if (ob->gameflag & OB_DYNAMIC) { ysize= 175; } - else - { + else { ysize= 72; } @@ -2031,12 +2028,10 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo &aa->end_reset, 0.0, 0.0, 0, 0, "Restore last frame when switching on/off, otherwise play from the start each time"); - if(aa->type == ACT_ACTION_FROM_PROP) - { + if(aa->type == ACT_ACTION_FROM_PROP) { uiDefBut(block, TEX, 0, "Prop: ",xco+10, yco-44, width-20, 19, aa->name, 0.0, MAX_NAME, 0, 0, "Use this property to define the Action position"); } - else - { + else { uiDefButF(block, NUM, 0, "Sta: ",xco+10, yco-44, (width-20)/2, 19, &aa->sta, 1.0, MAXFRAMEF, 0, 0, "Start frame"); uiDefButF(block, NUM, 0, "End: ",xco+10+(width-20)/2, yco-44, (width-20)/2, 19, &aa->end, 1.0, MAXFRAMEF, 0, 0, "End frame"); } @@ -2048,8 +2043,7 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo #ifdef __NLA_ACTION_BY_MOTION_ACTUATOR - if(aa->type == ACT_ACTION_MOTION) - { + if (aa->type == ACT_ACTION_MOTION) { uiDefButF(block, NUM, 0, "Cycle: ",xco+30, yco-84, (width-60)/2, 19, &aa->stridelength, 0.0, 2500.0, 0, 0, "Distance covered by a single cycle of the action"); } #endif @@ -2185,8 +2179,7 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo 12.0, 0, 0, "Sets the pitch of this sound"); uiDefButS(block, TOG | BIT, 0, "3D Sound", xco+10, yco-88, width-20, 19, &sa->flag, 0.0, 1.0, 0.0, 0.0, "Plays the sound positioned in 3D space"); - if(sa->flag & ACT_SND_3D_SOUND) - { + if(sa->flag & ACT_SND_3D_SOUND) { uiDefButF(block, NUM, 0, "Minimum Gain: ", xco+10, yco-110, wval, 19, &sa->sound3D.min_gain, 0.0, 1.0, 0.0, 0.0, "The minimum gain of the sound, no matter how far it is away"); @@ -2395,14 +2388,12 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo &coa->flag, 0.0, 0.0, 0, 0, "Set object axis along (local axis) or parallel (global axis) to the normal at hit position"); uiDefButBitS(block, TOG, ACT_CONST_MATERIAL, B_REDR, "M/P", xco+10, yco-84, 40, 19, &coa->flag, 0.0, 0.0, 0, 0, "Detect material instead of property"); - if (coa->flag & ACT_CONST_MATERIAL) - { + if (coa->flag & ACT_CONST_MATERIAL) { uiDefBut(block, TEX, 1, "Material:", xco + 50, yco-84, (width-60), 19, coa->matprop, 0, MAX_NAME, 0, 0, "Ray detects only Objects with this material"); } - else - { + else { uiDefBut(block, TEX, 1, "Property:", xco + 50, yco-84, (width-60), 19, coa->matprop, 0, MAX_NAME, 0, 0, "Ray detect only Objects with this property"); @@ -2454,14 +2445,12 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo &coa->flag, 0.0, 0.0, 0, 0, "Add a horizontal spring force on slopes"); uiDefButBitS(block, TOG, ACT_CONST_MATERIAL, B_REDR, "M/P", xco+10, yco-84, 40, 19, &coa->flag, 0.0, 0.0, 0, 0, "Detect material instead of property"); - if (coa->flag & ACT_CONST_MATERIAL) - { + if (coa->flag & ACT_CONST_MATERIAL) { uiDefBut(block, TEX, 1, "Material:", xco + 50, yco-84, (width-60), 19, coa->matprop, 0, MAX_NAME, 0, 0, "Ray detects only Objects with this material"); } - else - { + else { uiDefBut(block, TEX, 1, "Property:", xco + 50, yco-84, (width-60), 19, coa->matprop, 0, MAX_NAME, 0, 0, "Ray detect only Objects with this property"); @@ -2548,9 +2537,8 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo break; case ACT_GAME: { - gma = act->data; - if (gma->type == ACT_GAME_LOAD) - { + gma = act->data; + if (gma->type == ACT_GAME_LOAD) { //ysize = 68; ysize = 48; glRects(xco, yco-ysize, xco+width, yco); @@ -2807,15 +2795,14 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo &ma->bodyType, 0.0, 0.0, 0, 0, "Toggle message type: either Text or a PropertyName"); - if (ma->bodyType == ACT_MESG_MESG) - { + if (ma->bodyType == ACT_MESG_MESG) { /* line 3: Message Body */ uiDefBut(block, TEX, 1, "Body: ", (xco+10+(0.20*(width-20))),(yco-(myline++*24)),(0.8*(width-20)),19, &ma->body, 0, MAX_NAME, 0, 0, "Optional message body Text"); - } else - { + } + else { /* line 3: Property body (set by property) */ uiDefBut(block, TEX, 1, "Propname: ", (xco+10+(0.20*(width-20))),(yco-(myline++*24)),(0.8*(width-20)),19, @@ -2829,8 +2816,7 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo tdfa = act->data; ysize = 50; - if(tdfa->type == ACT_2DFILTER_CUSTOMFILTER) - { + if (tdfa->type == ACT_2DFILTER_CUSTOMFILTER) { ysize +=20; } glRects( xco, yco-ysize, xco+width, yco ); @@ -2839,13 +2825,11 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo switch(tdfa->type) { case ACT_2DFILTER_MOTIONBLUR: - if(!tdfa->flag) - { + if (!tdfa->flag) { uiDefButS(block, TOG, B_REDR, "D", xco+30,yco-44,19, 19, &tdfa->flag, 0.0, 0.0, 0.0, 0.0, "Disable Motion Blur"); uiDefButF(block, NUM, B_REDR, "Value:", xco+52,yco-44,width-82,19,&tdfa->float_arg,0.0,1.0,0.0,0.0,"Set motion blur value"); } - else - { + else { uiDefButS(block, TOG, B_REDR, "Disabled", xco+30,yco-44,width-60, 19, &tdfa->flag, 0.0, 0.0, 0.0, 0.0, "Enable Motion Blur"); } break; @@ -4187,11 +4171,11 @@ static void draw_actuator_property(uiLayout *layout, PointerRNA *ptr) case ACT_PROP_COPY: row = uiLayoutRow(layout, 0); uiItemR(row, ptr, "object", 0, NULL, ICON_NONE); - if(ob_from){ + if (ob_from) { RNA_pointer_create((ID *)ob_from, &RNA_GameObjectSettings, ob_from, &obj_settings_ptr); uiItemPointerR(row, ptr, "object_property", &obj_settings_ptr, "properties", NULL, ICON_NONE); - }else - { + } + else { sub= uiLayoutRow(row, 0); uiLayoutSetActive(sub, 0); uiItemR(sub, ptr, "object_property", 0, NULL, ICON_NONE); @@ -4325,8 +4309,7 @@ static void draw_actuator_sound(uiLayout *layout, PointerRNA *ptr, bContext *C) uiLayout *row, *col; uiTemplateID(layout, C, ptr, "sound", NULL, "SOUND_OT_open", NULL); - if (!RNA_pointer_get(ptr, "sound").data) - { + if (!RNA_pointer_get(ptr, "sound").data) { uiItemL(layout, "Select a sound from the list or load a new one", ICON_NONE); return; } @@ -4402,21 +4385,18 @@ static void draw_actuator_steering(uiLayout *layout, PointerRNA *ptr) uiItemR(col, ptr, "facing", 0, NULL, 0); col = uiLayoutColumn(row, 0); uiItemR(col, ptr, "facing_axis", 0, NULL, 0); - if (!RNA_boolean_get(ptr, "facing")) - { + if (!RNA_boolean_get(ptr, "facing")) { uiLayoutSetActive(col, 0); } col = uiLayoutColumn(row, 0); uiItemR(col, ptr, "normal_up", 0, NULL, 0); - if (!RNA_pointer_get(ptr, "navmesh").data) - { + if (!RNA_pointer_get(ptr, "navmesh").data) { uiLayoutSetActive(col, 0); } row = uiLayoutRow(layout, 0); uiItemR(row, ptr, "self_terminated", 0, NULL, 0); - if (RNA_enum_get(ptr, "mode")==ACT_STEERING_PATHFOLLOWING) - { + if (RNA_enum_get(ptr, "mode")==ACT_STEERING_PATHFOLLOWING) { uiItemR(row, ptr, "update_period", 0, NULL, 0); row = uiLayoutRow(layout, 0); } @@ -5040,8 +5020,7 @@ void logic_buttons(bContext *C, ARegion *ar) uiDefIconButBitS(block, ICONTOG, SENS_SHOW, B_REDR, ICON_RIGHTARROW, (short)(xco+width-22), yco, 22, UI_UNIT_Y, &sens->flag, 0, 0, 0, 0, "Sensor settings"); ycoo= yco; - if(sens->flag & SENS_SHOW) - { + if (sens->flag & SENS_SHOW) { uiDefButS(block, MENU, B_CHANGE_SENS, sensor_pup(), (short)(xco+22), yco, 80, UI_UNIT_Y, &sens->type, 0, 0, 0, 0, "Sensor type"); but= uiDefBut(block, TEX, 1, "", (short)(xco+102), yco, (short)(width-(pin?146:124)), UI_UNIT_Y, sens->name, 0, MAX_NAME, 0, 0, "Sensor name"); uiButSetFunc(but, make_unique_prop_names_cb, sens->name, (void*) 0); diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c index 0253f04a05d..f94918e4b4a 100644 --- a/source/blender/editors/space_nla/nla_draw.c +++ b/source/blender/editors/space_nla/nla_draw.c @@ -692,8 +692,7 @@ static void draw_nla_channel_list_gl (bAnimContext *ac, ListBase *anim_data, Vie /* if this track is active and we're tweaking it, don't draw these toggles */ // TODO: need a special macro for this... - if ( ((nlt->flag & NLATRACK_ACTIVE) && (nlt->flag & NLATRACK_DISABLED)) == 0 ) - { + if (((nlt->flag & NLATRACK_ACTIVE) && (nlt->flag & NLATRACK_DISABLED)) == 0) { if (nlt->flag & NLATRACK_MUTED) mute = ICON_MUTE_IPO_ON; else diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c index a142119d685..c0e9b7a3a57 100644 --- a/source/blender/editors/space_nla/nla_edit.c +++ b/source/blender/editors/space_nla/nla_edit.c @@ -1282,8 +1282,7 @@ static int nlaedit_swap_exec (bContext *C, wmOperator *op) if ((nlt->strips.first == nlt->strips.last) && (nlt->strips.first != NULL)) { NlaStrip *mstrip = (NlaStrip *)nlt->strips.first; - if ((mstrip->flag & NLASTRIP_FLAG_TEMP_META) && (BLI_countlist(&mstrip->strips) == 2)) - { + if ((mstrip->flag & NLASTRIP_FLAG_TEMP_META) && (BLI_countlist(&mstrip->strips) == 2)) { /* remove this temp meta, so that we can see the strips inside */ BKE_nlastrips_clear_metas(&nlt->strips, 0, 1); } diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index 1d8cbec2cb3..a423322edd5 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -3389,8 +3389,7 @@ static int node_add_file_exec(bContext *C, wmOperator *op) ntemp.type = -1; /* check input variables */ - if (RNA_struct_property_is_set(op->ptr, "filepath")) - { + if (RNA_struct_property_is_set(op->ptr, "filepath")) { char path[FILE_MAX]; RNA_string_get(op->ptr, "filepath", path); diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index f740a3c4875..e50d1ae6fc9 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -171,8 +171,7 @@ static void drawseqwave(Scene *scene, Sequence *seq, float x1, float y1, float x * x2 the end x value, same for y1 and y2 * stepsize is width of a pixel. */ - if(seq->flag & SEQ_AUDIO_DRAW_WAVEFORM) - { + if(seq->flag & SEQ_AUDIO_DRAW_WAVEFORM) { int i, j, pos; int length = floor((x2-x1)/stepsize)+1; float ymid = (y1+y2)/2; diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index 1975e4ca633..9fed3db7f16 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -1132,8 +1132,8 @@ static int text_convert_whitespace_exec(bContext *C, wmOperator *op) tmp = tmp->next; } - if(type == TO_TABS) // Converting to tabs - { //start over from the beginning + if (type == TO_TABS) { // Converting to tabs + //start over from the beginning tmp = text->lines.first; while(tmp) { diff --git a/source/blender/editors/space_text/text_python.c b/source/blender/editors/space_text/text_python.c index efe744696df..88bd6b9c4c0 100644 --- a/source/blender/editors/space_text/text_python.c +++ b/source/blender/editors/space_text/text_python.c @@ -355,9 +355,10 @@ static short UNUSED_FUNCTION(do_texttools)(SpaceText *st, char ascii, unsigned s } } - if(draw) - {}; // XXX redraw_alltext(); - + if (draw) { + // XXX redraw_alltext(); + } + return swallow; } @@ -540,8 +541,9 @@ static short UNUSED_FUNCTION(do_textmarkers)(SpaceText *st, char ascii, unsigned } } - if(draw) - {}; // XXX redraw_alltext(); + if (draw) { + // XXX redraw_alltext(); + } return swallow; } diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 2596ba3f4bc..0cc5d877b44 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -4493,8 +4493,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv drawn = 1; } } - else - { + else { state.time=cfra; if (psys_get_particle_state(&sim,a,&state,0)) { float pixsize; @@ -6769,12 +6768,10 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) SmokeModifierData *smd = (SmokeModifierData *)md; // draw collision objects - if ((smd->type & MOD_SMOKE_TYPE_COLL) && smd->coll) - { + if ((smd->type & MOD_SMOKE_TYPE_COLL) && smd->coll) { #if 0 SmokeCollSettings *scs = smd->coll; - if (scs->points) - { + if (scs->points) { size_t i; glLoadMatrixf(rv3d->viewmat); @@ -6805,8 +6802,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) } // only draw domains - if (smd->domain && smd->domain->fluid) - { + if (smd->domain && smd->domain->fluid) { if (CFRA < smd->domain->point_cache[0]->startframe) ; /* don't show smoke before simulation starts, this could be made an option in the future */ else if (!smd->domain->wt || !(smd->domain->viewsettings & MOD_SMOKE_VIEW_SHOWBIG)) @@ -6842,8 +6838,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) float tmp[3]; int index = smoke_get_index(x, smd->domain->res[0], y, smd->domain->res[1], z); - if (density[index] > FLT_EPSILON) - { + if (density[index] > FLT_EPSILON) { float color[3]; copy_v3_v3(tmp, smd->domain->p0); tmp[0] += smd->domain->dx * x + smd->domain->dx * 0.5; @@ -6864,8 +6859,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) if (col) cpack(col); #endif } - else if (smd->domain->wt && (smd->domain->viewsettings & MOD_SMOKE_VIEW_SHOWBIG)) - { + else if (smd->domain->wt && (smd->domain->viewsettings & MOD_SMOKE_VIEW_SHOWBIG)) { smd->domain->tex = NULL; GPU_create_smoke(smd, 1); draw_volume(ar, smd->domain->tex, @@ -6878,12 +6872,10 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) } if ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) { - bConstraint *con; - for (con=ob->constraints.first; con; con= con->next) - { - if (con->type==CONSTRAINT_TYPE_RIGIDBODYJOINT) - { + + for (con=ob->constraints.first; con; con= con->next) { + if (con->type==CONSTRAINT_TYPE_RIGIDBODYJOINT) { bRigidBodyJointConstraint *data = (bRigidBodyJointConstraint*)con->data; if (data->flag&CONSTRAINT_DRAW_PIVOT) drawRBpivot(data); @@ -6907,7 +6899,9 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) if (dtx & OB_BOUNDBOX) { draw_bounding_volume(scene, ob, ob->boundtype); } - if (dtx & OB_TEXSPACE) drawtexspace(ob); + if (dtx & OB_TEXSPACE) { + drawtexspace(ob); + } if (dtx & OB_DRAWNAME) { /* patch for several 3d cards (IBM mostly) that crash on glSelect with text drawing */ /* but, we also dont draw names for sets or duplicators */ @@ -6922,13 +6916,16 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) } } /*if (dtx & OB_DRAWIMAGE) drawDispListwire(&ob->disp);*/ - if ((dtx & OB_DRAWWIRE) && dt>=OB_SOLID) drawWireExtra(scene, rv3d, ob); + if ((dtx & OB_DRAWWIRE) && dt>=OB_SOLID) { + drawWireExtra(scene, rv3d, ob); + } } } if (dt<=OB_SOLID && (v3d->flag2 & V3D_RENDER_OVERRIDE)==0) { if ((ob->gameflag & OB_DYNAMIC) || - ((ob->gameflag & OB_BOUNDS) && (ob->boundtype == OB_BOUND_SPHERE))) { + ((ob->gameflag & OB_BOUNDS) && (ob->boundtype == OB_BOUND_SPHERE))) + { float imat[4][4], vec[3]= {0.0f, 0.0f, 0.0f}; invert_m4_m4(imat, rv3d->viewmatob); @@ -6945,11 +6942,16 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) glLoadMatrixf(rv3d->viewmat); - if (zbufoff) glDisable(GL_DEPTH_TEST); + if (zbufoff) { + glDisable(GL_DEPTH_TEST); + } - if (warning_recursive) return; - if (base->flag & OB_FROMDUPLI) return; - if (v3d->flag2 & V3D_RENDER_OVERRIDE) return; + if ((warning_recursive) || + (base->flag & OB_FROMDUPLI) || + (v3d->flag2 & V3D_RENDER_OVERRIDE)) + { + return; + } /* object centers, need to be drawn in viewmat space for speed, but OK for picking select */ if (!is_obact || !(ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT))) { diff --git a/source/blender/editors/space_view3d/drawvolume.c b/source/blender/editors/space_view3d/drawvolume.c index b36ce6656b2..52f432c2e7d 100644 --- a/source/blender/editors/space_view3d/drawvolume.c +++ b/source/blender/editors/space_view3d/drawvolume.c @@ -339,8 +339,7 @@ void draw_volume(ARegion *ar, GPUTexture *tex, float *min, float *max, int res[3 // printf("i: %d\n", i); // printf("point %f, %f, %f\n", cv[i][0], cv[i][1], cv[i][2]); - if (GL_TRUE == glewIsSupported("GL_ARB_fragment_program")) - { + if (GL_TRUE == glewIsSupported("GL_ARB_fragment_program")) { glEnable(GL_FRAGMENT_PROGRAM_ARB); glGenProgramsARB(1, &prog); @@ -406,12 +405,9 @@ void draw_volume(ARegion *ar, GPUTexture *tex, float *min, float *max, int res[3 copy_v3_v3(p0, points); // sort points to get a convex polygon - for (i = 1; i < numpoints - 1; i++) - { - for (j = i + 1; j < numpoints; j++) - { - if (!convex(p0, viewnormal, &points[j * 3], &points[i * 3])) - { + for (i = 1; i < numpoints - 1; i++) { + for (j = i + 1; j < numpoints; j++) { + if (!convex(p0, viewnormal, &points[j * 3], &points[i * 3])) { float tmp2[3]; copy_v3_v3(tmp2, &points[j * 3]); copy_v3_v3(&points[j * 3], &points[i * 3]); @@ -441,8 +437,7 @@ void draw_volume(ARegion *ar, GPUTexture *tex, float *min, float *max, int res[3 GPU_texture_unbind(tex_shadow); GPU_texture_unbind(tex); - if (GLEW_ARB_fragment_program) - { + if (GLEW_ARB_fragment_program) { glDisable(GL_FRAGMENT_PROGRAM_ARB); glDeleteProgramsARB(1, &prog); } @@ -450,10 +445,11 @@ void draw_volume(ARegion *ar, GPUTexture *tex, float *min, float *max, int res[3 MEM_freeN(points); - if (!gl_blend) + if (!gl_blend) { glDisable(GL_BLEND); - if (gl_depth) - { + } + + if (gl_depth) { glEnable(GL_DEPTH_TEST); glDepthMask(GL_TRUE); } diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 8c690268444..979e3820018 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -1827,8 +1827,7 @@ int transformEnd(bContext *C, TransInfo *t) exit_code = OPERATOR_CANCELLED; restoreTransObjects(t); // calls recalcData() } - else - { + else { exit_code = OPERATOR_FINISHED; } @@ -2447,8 +2446,7 @@ int handleEventShear(TransInfo *t, wmEvent *event) initMouseInputMode(t, &t->mouse, INPUT_VERTICAL_ABSOLUTE); t->customData = (void*)1; } - else - { + else { initMouseInputMode(t, &t->mouse, INPUT_HORIZONTAL_ABSOLUTE); t->customData = NULL; } @@ -2732,8 +2730,7 @@ int Resize(TransInfo *t, const int mval[2]) { ratio = 1.0f - ((t->imval[0] - mval[0]) + (t->imval[1] - mval[1]))/100.0f; } - else - { + else { ratio = t->values[0]; } @@ -3451,10 +3448,8 @@ static void applyTranslation(TransInfo *t, float vec[3]) continue; /* handle snapping rotation before doing the translation */ - if (usingSnappingNormal(t)) - { - if (validSnappingNormal(t)) - { + if (usingSnappingNormal(t)) { + if (validSnappingNormal(t)) { float *original_normal = td->axismtx[2]; float axis[3]; float quat[4]; @@ -3470,8 +3465,7 @@ static void applyTranslation(TransInfo *t, float vec[3]) ElementRotation(t, td, mat, V3D_LOCAL); } - else - { + else { float mat[3][3]; unit_m3(mat); @@ -4174,12 +4168,10 @@ int BoneSize(TransInfo *t, const int mval[2]) // TRANSFORM_FIX_ME MOVE TO MOUSE INPUT /* for manipulator, center handle, the scaling can't be done relative to center */ - if( (t->flag & T_USES_MANIPULATOR) && t->con.mode==0) - { + if ((t->flag & T_USES_MANIPULATOR) && t->con.mode==0) { ratio = 1.0f - ((t->imval[0] - mval[0]) + (t->imval[1] - mval[1]))/100.0f; } - else - { + else { ratio = t->values[0]; } @@ -5103,8 +5095,7 @@ int Mirror(TransInfo *t, const int UNUSED(mval[2])) ED_area_headerprint(t->sa, str); } - else - { + else { size[0] = size[1] = size[2] = 1; size_to_mat3( mat,size); diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c index a0e4c5897db..1292a058f41 100644 --- a/source/blender/editors/transform/transform_constraints.c +++ b/source/blender/editors/transform/transform_constraints.c @@ -721,8 +721,7 @@ void drawPropCircle(const struct bContext *C, TransInfo *t) copy_m4_m4(tmat, rv3d->viewmat); invert_m4_m4(imat, tmat); } - else - { + else { unit_m4(tmat); unit_m4(imat); } diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 4e51462921c..ed01de848ae 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -721,8 +721,7 @@ static void bone_children_clear_transflag(int mode, short around, ListBase *lb) { bone->flag |= BONE_TRANSFORM_CHILD; } - else - { + else { bone->flag &= ~BONE_TRANSFORM; } @@ -1132,8 +1131,7 @@ static void createTransArmatureVerts(TransInfo *t) if (ebo->flag & BONE_SELECTED) t->total++; } - else - { + else { if (ebo->flag & BONE_TIPSEL) t->total++; if (ebo->flag & BONE_ROOTSEL) @@ -1201,8 +1199,7 @@ static void createTransArmatureVerts(TransInfo *t) td->val= &ebo->dist; td->ival= ebo->dist; } - else - { + else { // abusive storage of scale in the loc pointer :) td->loc= &ebo->xwidth; copy_v3_v3(td->iloc, td->loc); @@ -1243,8 +1240,7 @@ static void createTransArmatureVerts(TransInfo *t) td++; } } - else - { + else { if (ebo->flag & BONE_TIPSEL) { copy_v3_v3(td->iloc, ebo->tail); diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index 47989f756e1..f3cede75786 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -797,8 +797,7 @@ static void recalcData_view3d(TransInfo *t) rotation_between_vecs_to_quat(qrot, td->axismtx[1], vec); mul_qt_v3(qrot, up_axis); } - else - { + else { mul_m3_v3(t->mat, up_axis); } @@ -811,8 +810,7 @@ static void recalcData_view3d(TransInfo *t) transform_armature_mirror_update(t->obedit); } - else - { + else { if(t->state != TRANS_CANCEL) { applyProject(t); } @@ -993,8 +991,7 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event) copy_v2_v2_int(t->imval, event->mval); t->event_type = event->type; } - else - { + else { t->imval[0] = 0; t->imval[1] = 0; } @@ -1074,8 +1071,7 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event) t->current_orientation = V3D_MANIP_GLOBAL; } } - else - { + else { t->current_orientation = v3d->twmode; } @@ -1121,8 +1117,7 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event) t->view = &ar->v2d; t->around = sipo->around; } - else - { + else { if(ar) { // XXX for now, get View2D from the active region t->view = &ar->v2d; @@ -1141,10 +1136,8 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event) t->flag |= T_RELEASE_CONFIRM; } } - else - { - if (U.flag & USER_RELEASECONFIRM) - { + else { + if (U.flag & USER_RELEASECONFIRM) { t->flag |= T_RELEASE_CONFIRM; } } @@ -1181,22 +1174,18 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event) break; } } - else - { + else { /* use settings from scene only if modal */ - if (t->flag & T_MODAL) - { - if ((t->options & CTX_NO_PET) == 0) - { - if (t->obedit && ts->proportional != PROP_EDIT_OFF) - { + if (t->flag & T_MODAL) { + if ((t->options & CTX_NO_PET) == 0) { + if (t->obedit && ts->proportional != PROP_EDIT_OFF) { t->flag |= T_PROP_EDIT; - if(ts->proportional == PROP_EDIT_CONNECTED) + if (ts->proportional == PROP_EDIT_CONNECTED) { t->flag |= T_PROP_CONNECTED; + } } - else if (t->obedit == NULL && ts->proportional_objects) - { + else if (t->obedit == NULL && ts->proportional_objects) { t->flag |= T_PROP_EDIT; } } @@ -1207,8 +1196,7 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event) { t->prop_size = RNA_float_get(op->ptr, "proportional_size"); } - else - { + else { t->prop_size = ts->proportional_size; } @@ -1224,8 +1212,7 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event) { t->prop_mode = RNA_enum_get(op->ptr, "proportional_edit_falloff"); } - else - { + else { t->prop_mode = ts->prop_mode; } } diff --git a/source/blender/editors/transform/transform_input.c b/source/blender/editors/transform/transform_input.c index a4f03e76fd1..3faddeb6639 100644 --- a/source/blender/editors/transform/transform_input.c +++ b/source/blender/editors/transform/transform_input.c @@ -44,16 +44,14 @@ static void InputVector(TransInfo *t, MouseInput *mi, const int mval[2], float output[3]) { float vec[3], dvec[3]; - if(mi->precision) - { + if (mi->precision) { /* calculate the main translation and the precise one separate */ convertViewVec(t, dvec, (mval[0] - mi->precision_mval[0]), (mval[1] - mi->precision_mval[1])); mul_v3_fl(dvec, 0.1f); convertViewVec(t, vec, (mi->precision_mval[0] - t->imval[0]), (mi->precision_mval[1] - t->imval[1])); add_v3_v3v3(output, vec, dvec); } - else - { + else { convertViewVec(t, output, (mval[0] - t->imval[0]), (mval[1] - t->imval[1])); } @@ -62,8 +60,7 @@ static void InputVector(TransInfo *t, MouseInput *mi, const int mval[2], float o static void InputSpring(TransInfo *UNUSED(t), MouseInput *mi, const int mval[2], float output[3]) { float ratio, precise_ratio, dx, dy; - if(mi->precision) - { + if (mi->precision) { /* calculate ratio for shiftkey pos, and for total, and blend these for precision */ dx = (float)(mi->center[0] - mi->precision_mval[0]); dy = (float)(mi->center[1] - mi->precision_mval[1]); @@ -75,8 +72,7 @@ static void InputSpring(TransInfo *UNUSED(t), MouseInput *mi, const int mval[2], ratio = (ratio + (precise_ratio - ratio) / 10.0f) / mi->factor; } - else - { + else { dx = (float)(mi->center[0] - mval[0]); dy = (float)(mi->center[1] - mval[1]); ratio = (float)sqrt( dx*dx + dy*dy) / mi->factor; @@ -101,13 +97,11 @@ static void InputSpringFlip(TransInfo *t, MouseInput *mi, const int mval[2], flo static void InputTrackBall(TransInfo *UNUSED(t), MouseInput *mi, const int mval[2], float output[3]) { - if(mi->precision) - { + if (mi->precision) { output[0] = ( mi->imval[1] - mi->precision_mval[1] ) + ( mi->precision_mval[1] - mval[1] ) * 0.1f; output[1] = ( mi->precision_mval[0] - mi->imval[0] ) + ( mval[0] - mi->precision_mval[0] ) * 0.1f; } - else - { + else { output[0] = (float)( mi->imval[1] - mval[1] ); output[1] = (float)( mval[0] - mi->imval[0] ); } @@ -122,8 +116,7 @@ static void InputHorizontalRatio(TransInfo *t, MouseInput *mi, const int mval[2] pad = t->ar->winx / 10; - if (mi->precision) - { + if (mi->precision) { /* deal with Shift key by adding motion / 10 to motion before shift press */ x = mi->precision_mval[0] + (float)(mval[0] - mi->precision_mval[0]) / 10.0f; } @@ -249,9 +242,8 @@ static void InputAngle(TransInfo *UNUSED(t), MouseInput *mi, const int mval[2], * approximate the angle with the opposite side of the normalized triangle * This is a good approximation here since the smallest acos value seems to be around * 0.02 degree and lower values don't even have a 0.01% error compared to the approximation - * */ - if (dphi == 0) - { + */ + if (dphi == 0) { double dx, dy; dx2 /= A; @@ -267,11 +259,12 @@ static void InputAngle(TransInfo *UNUSED(t), MouseInput *mi, const int mval[2], if( (dx1*dy2-dx2*dy1)>0.0 ) dphi= -dphi; } - if(mi->precision) dphi = dphi/30.0f; + if (mi->precision) { + dphi = dphi/30.0f; + } /* if no delta angle, don't update initial position */ - if (dphi != 0) - { + if (dphi != 0) { mi->imval[0] = mval[0]; mi->imval[1] = mval[1]; } @@ -385,13 +378,11 @@ void setInputPostFct(MouseInput *mi, void (*post)(struct TransInfo *, float [3]) void applyMouseInput(TransInfo *t, MouseInput *mi, const int mval[2], float output[3]) { - if (mi->apply != NULL) - { + if (mi->apply != NULL) { mi->apply(t, mi, mval, output); } - if (mi->post) - { + if (mi->post) { mi->post(t, output); } } @@ -404,16 +395,14 @@ int handleMouseInput(TransInfo *t, MouseInput *mi, wmEvent *event) { case LEFTSHIFTKEY: case RIGHTSHIFTKEY: - if (event->val==KM_PRESS) - { + if (event->val == KM_PRESS) { t->modifiers |= MOD_PRECISION; /* shift is modifier for higher precision transform * store the mouse position where the normal movement ended */ copy_v2_v2_int(mi->precision_mval, event->mval); mi->precision = 1; } - else - { + else { t->modifiers &= ~MOD_PRECISION; mi->precision = 0; } diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c index bdb0b3dfd7c..cdbf130377a 100644 --- a/source/blender/editors/transform/transform_manipulator.c +++ b/source/blender/editors/transform/transform_manipulator.c @@ -202,8 +202,7 @@ static int test_rotmode_euler(short rotmode) int gimbal_axis(Object *ob, float gmat[][3]) { if (ob) { - if(ob->mode & OB_MODE_POSE) - { + if (ob->mode & OB_MODE_POSE) { bPoseChannel *pchan= get_active_posechannel(ob); if(pchan) { @@ -222,8 +221,7 @@ int gimbal_axis(Object *ob, float gmat[][3]) /* apply bone transformation */ mul_m3_m3m3(tmat, pchan->bone->bone_mat, mat); - if (pchan->parent) - { + if (pchan->parent) { float parent_mat[3][3]; copy_m3_m4(parent_mat, pchan->parent->pose_mat); @@ -233,8 +231,7 @@ int gimbal_axis(Object *ob, float gmat[][3]) copy_m3_m4(obmat, ob->obmat); mul_m3_m3m3(gmat, obmat, mat); } - else - { + else { /* needed if object transformation isn't identity */ copy_m3_m4(obmat, ob->obmat); mul_m3_m3m3(gmat, obmat, tmat); @@ -255,8 +252,7 @@ int gimbal_axis(Object *ob, float gmat[][3]) return 0; } - if (ob->parent) - { + if (ob->parent) { float parent_mat[3][3]; copy_m3_m4(parent_mat, ob->parent->obmat); normalize_m3(parent_mat); diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index 5f83bb4c29c..6b3380ea42e 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -276,12 +276,10 @@ TransformOrientation* addMatrixSpace(bContext *C, float mat[3][3], char name[], ListBase *transform_spaces = &CTX_data_scene(C)->transform_spaces; TransformOrientation *ts = NULL; - if (overwrite) - { + if (overwrite) { ts = findOrientationName(transform_spaces, name); } - else - { + else { uniqueOrientationName(transform_spaces, name); } @@ -537,8 +535,7 @@ void initTransformOrientation(bContext *C, TransInfo *t) break; case V3D_MANIP_VIEW: - if (t->ar->regiontype == RGN_TYPE_WINDOW) - { + if (t->ar->regiontype == RGN_TYPE_WINDOW) { RegionView3D *rv3d = t->ar->regiondata; float mat[3][3]; @@ -547,8 +544,7 @@ void initTransformOrientation(bContext *C, TransInfo *t) normalize_m3(mat); copy_m3_m3(t->spacemtx, mat); } - else - { + else { unit_m3(t->spacemtx); } break; @@ -609,10 +605,8 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3], break; } } - else - { - if (em->bm->totfacesel >= 1) - { + else { + if (em->bm->totfacesel >= 1) { BMFace *efa; BMIter iter; @@ -752,18 +746,14 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3], while(a--) { /* exception */ - if ( (bezt->f1 & SELECT) + (bezt->f2 & SELECT) + (bezt->f3 & SELECT) > SELECT ) - { + if ((bezt->f1 & SELECT) + (bezt->f2 & SELECT) + (bezt->f3 & SELECT) > SELECT) { sub_v3_v3v3(normal, bezt->vec[0], bezt->vec[2]); } - else - { - if(bezt->f1) - { + else { + if (bezt->f1) { sub_v3_v3v3(normal, bezt->vec[0], bezt->vec[1]); } - if(bezt->f2) - { + if (bezt->f2) { sub_v3_v3v3(normal, bezt->vec[0], bezt->vec[2]); } if(bezt->f3) @@ -792,12 +782,10 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3], for (ml = editelems.first; ml; ml = ml->next) { if (ml->flag & SELECT) { - if (ml_sel == NULL) - { + if (ml_sel == NULL) { ml_sel = ml; } - else - { + else { ml_sel = NULL; break; } @@ -845,21 +833,18 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3], normalize_v3(normal); normalize_v3(plane); - if (plane[0] != 0 || plane[1] != 0 || plane[2] != 0) - { + if (plane[0] != 0 || plane[1] != 0 || plane[2] != 0) { result = ORIENTATION_EDGE; } } /* Vectors from edges don't need the special transpose inverse multiplication */ - if (result == ORIENTATION_EDGE) - { + if (result == ORIENTATION_EDGE) { mul_mat3_m4_v3(ob->obmat, normal); mul_mat3_m4_v3(ob->obmat, plane); } - else - { + else { mul_m3_v3(mat, normal); mul_m3_v3(mat, plane); } @@ -933,33 +918,28 @@ void ED_getTransformOrientationMatrix(const bContext *C, float orientation_mat[] switch (type) { case ORIENTATION_NORMAL: - if (createSpaceNormalTangent(orientation_mat, normal, plane) == 0) - { + if (createSpaceNormalTangent(orientation_mat, normal, plane) == 0) { type = ORIENTATION_NONE; } break; case ORIENTATION_VERT: - if (createSpaceNormal(orientation_mat, normal) == 0) - { + if (createSpaceNormal(orientation_mat, normal) == 0) { type = ORIENTATION_NONE; } break; case ORIENTATION_EDGE: - if (createSpaceNormalTangent(orientation_mat, normal, plane) == 0) - { + if (createSpaceNormalTangent(orientation_mat, normal, plane) == 0) { type = ORIENTATION_NONE; } break; case ORIENTATION_FACE: - if (createSpaceNormalTangent(orientation_mat, normal, plane) == 0) - { + if (createSpaceNormalTangent(orientation_mat, normal, plane) == 0) { type = ORIENTATION_NONE; } break; } - if (type == ORIENTATION_NONE) - { + if (type == ORIENTATION_NONE) { unit_m3(orientation_mat); } } diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index 265af47db80..1ee87b395b2 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -388,8 +388,7 @@ static void initSnappingMode(TransInfo *t) Scene *scene = t->scene; /* force project off when not supported */ - if (ts->snap_mode != SCE_SNAP_MODE_FACE) - { + if (ts->snap_mode != SCE_SNAP_MODE_FACE) { t->tsnap.project = 0; } @@ -404,12 +403,10 @@ static void initSnappingMode(TransInfo *t) (obedit != NULL && ELEM4(obedit->type, OB_MESH, OB_ARMATURE, OB_CURVE, OB_LATTICE)) ) // Temporary limited to edit mode meshes, armature, curves { /* Exclude editmesh if using proportional edit */ - if ((obedit->type == OB_MESH) && (t->flag & T_PROP_EDIT)) - { + if ((obedit->type == OB_MESH) && (t->flag & T_PROP_EDIT)) { t->tsnap.modeSelect = SNAP_NOT_OBEDIT; } - else - { + else { t->tsnap.modeSelect = t->tsnap.snap_self ? SNAP_ALL : SNAP_NOT_OBEDIT; } } @@ -425,14 +422,12 @@ static void initSnappingMode(TransInfo *t) { t->tsnap.modeSelect = SNAP_NOT_SELECTED; } - else - { + else { /* Grid if snap is not possible */ t->tsnap.mode = SCE_SNAP_MODE_INCREMENT; } } - else - { + else { /* Always grid outside of 3D view */ t->tsnap.mode = SCE_SNAP_MODE_INCREMENT; } @@ -831,23 +826,20 @@ static void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec)) } } /* otherwise, pair first with second and so on */ - else - { + else { for (p2 = p1->next; p2 && p2->ob != p1->ob; p2 = p2->next) { /* nothing to do here */ } } - if (p2) - { + if (p2) { p2->flag = 1; add_v3_v3v3(vec, p1->p, p2->p); mul_v3_fl(vec, 0.5f); } - else - { + else { copy_v3_v3(vec, p1->p); } @@ -860,8 +852,7 @@ static void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec)) new_dist = len_v3v3(last_p, vec); - if (new_dist < max_dist) - { + if (new_dist < max_dist) { copy_v3_v3(p, vec); max_dist = new_dist; } @@ -880,13 +871,11 @@ static void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec)) BLI_freelistN(&depth_peels); } - else - { + else { found = snapObjectsTransform(t, mval, &dist, loc, no, t->tsnap.modeSelect); } - if (found == 1) - { + if (found == 1) { float tangent[3]; sub_v3_v3v3(tangent, loc, t->tsnap.snapPoint); @@ -902,8 +891,7 @@ static void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec)) t->tsnap.status |= POINT_INIT; } - else - { + else { t->tsnap.status &= ~POINT_INIT; } } @@ -923,8 +911,7 @@ static void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec)) t->tsnap.status |= POINT_INIT; } - else - { + else { t->tsnap.status &= ~POINT_INIT; } } @@ -977,8 +964,7 @@ static void TargetSnapActive(TransInfo *t) t->tsnap.status |= TARGET_INIT; } /* No active, default to median */ - else - { + else { t->tsnap.target = SCE_SNAP_TARGET_MEDIAN; t->tsnap.targetSnap = TargetSnapMedian; TargetSnapMedian(t); @@ -1043,8 +1029,7 @@ static void TargetSnapClosest(TransInfo *t) dist = t->tsnap.distance(t, loc, t->tsnap.snapPoint); - if (closest == NULL || fabs(dist) < fabs(t->tsnap.dist)) - { + if (closest == NULL || fabs(dist) < fabs(t->tsnap.dist)) { copy_v3_v3(t->tsnap.snapTarget, loc); closest = td; t->tsnap.dist = dist; @@ -1052,8 +1037,7 @@ static void TargetSnapClosest(TransInfo *t) } } /* use element center otherwise */ - else - { + else { float loc[3]; float dist; @@ -1070,11 +1054,9 @@ static void TargetSnapClosest(TransInfo *t) } } } - else - { + else { int i; - for(td = t->data, i = 0 ; i < t->total && td->flag & TD_SELECTED ; i++, td++) - { + for(td = t->data, i = 0 ; i < t->total && td->flag & TD_SELECTED ; i++, td++) { float loc[3]; float dist; @@ -1446,21 +1428,17 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh if (em != NULL) { - if (index_array) - { + if (index_array) { index = index_array[i]; } - else - { + else { index = i; } - if (index == ORIGINDEX_NONE) - { + if (index == ORIGINDEX_NONE) { test = 0; } - else - { + else { efa = EDBM_get_face_for_index(em, index); if (efa && BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) @@ -1528,23 +1506,18 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh test = 1; /* reset for every vert */ - if (em != NULL) - { - if (index_array) - { + if (em != NULL) { + if (index_array) { index = index_array[i]; } - else - { + else { index = i; } - if (index == ORIGINDEX_NONE) - { + if (index == ORIGINDEX_NONE) { test = 0; } - else - { + else { eve = EDBM_get_vert_for_index(em, index); if (eve && (BM_elem_flag_test(eve, BM_ELEM_HIDDEN) || BM_elem_flag_test(eve, BM_ELEM_SELECT))) @@ -1590,21 +1563,17 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh if (em != NULL) { - if (index_array) - { + if (index_array) { index = index_array[i]; } - else - { + else { index = i; } - if (index == ORIGINDEX_NONE) - { + if (index == ORIGINDEX_NONE) { test = 0; } - else - { + else { eed = EDBM_get_edge_for_index(em, index); if (eed && (BM_elem_flag_test(eed, BM_ELEM_HIDDEN) || @@ -1647,14 +1616,12 @@ static int snapObject(Scene *scene, ARegion *ar, Object *ob, int editobject, flo BMEditMesh *em; DerivedMesh *dm; - if (editobject) - { + if (editobject) { em = BMEdit_FromObject(ob); /* dm = editbmesh_get_derived_cage(scene, ob, em, CD_MASK_BAREMESH); */ dm = editbmesh_get_derived_base(ob, em); /* limitation, em & dm MUST have the same number of faces */ } - else - { + else { em = NULL; dm = mesh_get_derived_final(scene, ob, CD_MASK_BAREMESH); } @@ -1938,14 +1905,12 @@ static int peelObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, L DerivedMesh *dm = NULL; int val; - if (dob != obedit) - { + if (dob != obedit) { dm = mesh_get_derived_final(scene, dob, CD_MASK_BAREMESH); val = peelDerivedMesh(dob, dm, dob->obmat, ray_start, ray_normal, mval, depth_peels); } - else - { + else { em = ((Mesh *)dob->data)->edit_mesh; dm = editmesh_get_derived_cage(scene, obedit, em, CD_MASK_BAREMESH); @@ -1967,14 +1932,12 @@ static int peelObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, L DerivedMesh *dm = NULL; int val; - if (ob != obedit) - { + if (ob != obedit) { dm = mesh_get_derived_final(scene, ob, CD_MASK_BAREMESH); val = peelDerivedMesh(ob, dm, ob->obmat, ray_start, ray_normal, mval, depth_peels); } - else - { + else { em = BMEdit_FromObject(ob); dm = editbmesh_get_derived_cage(scene, obedit, em, CD_MASK_BAREMESH); diff --git a/source/blender/editors/util/numinput.c b/source/blender/editors/util/numinput.c index 52422d37f29..a477a11e6c7 100644 --- a/source/blender/editors/util/numinput.c +++ b/source/blender/editors/util/numinput.c @@ -148,12 +148,10 @@ void applyNumInput(NumInput *n, float *vec) vec[j] = 0.0001f; } else { - if (n->inv[i]) - { + if (n->inv[i]) { vec[j] = 1.0f / n->val[i]; } - else - { + else { vec[j] = n->val[i]; } } diff --git a/source/blender/editors/uvedit/uvedit_smart_stitch.c b/source/blender/editors/uvedit/uvedit_smart_stitch.c index f7dd90e6084..676701b9c2a 100644 --- a/source/blender/editors/uvedit/uvedit_smart_stitch.c +++ b/source/blender/editors/uvedit/uvedit_smart_stitch.c @@ -185,8 +185,7 @@ static StitchPreviewer * stitch_preview_init(void) /* destructor...yeah this should be C++ :) */ static void stitch_preview_delete(void) { - if(_stitch_preview) - { + if(_stitch_preview) { if(_stitch_preview->preview_polys){ MEM_freeN(_stitch_preview->preview_polys); _stitch_preview->preview_polys = NULL; @@ -507,8 +506,7 @@ static void stitch_set_face_preview_buffer_position(BMFace *efa, StitchPreviewer { int index = BM_elem_index_get(efa); - if(preview_position[index].data_position == STITCH_NO_PREVIEW) - { + if(preview_position[index].data_position == STITCH_NO_PREVIEW) { preview_position[index].data_position = preview->preview_uvs*2; preview_position[index].polycount_position = preview->num_polys++; preview->preview_uvs += efa->len; @@ -1294,8 +1292,7 @@ static void stitch_select(bContext *C, Scene *scene, wmEvent *event, StitchState UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &co[0], &co[1]); uv_find_nearest_vert(scene, ima, stitch_state->em, co, NULL, &hit); - if(hit.efa) - { + if (hit.efa) { /* Add vertex to selection, deselect all common uv's of vert other * than selected and update the preview. This behavior was decided so that * you can do stuff like deselect the opposite stitchable vertex and the initial still gets deselected */ |