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-02-22 20:52:06 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-02-22 20:52:06 +0400
commit1955407f7e85cc05601bc952f12de8464ee78ffa (patch)
tree86088aea5c02db3349af231b994c5fdc8513ee8a /source/blender/editors
parent34e2fb40c75f92532bdb4ceae955b38c998904ae (diff)
code cleanyp - no functional changes.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/space_view3d/drawanimviz.c2
-rw-r--r--source/blender/editors/space_view3d/drawarmature.c76
-rw-r--r--source/blender/editors/space_view3d/drawmesh.c140
-rw-r--r--source/blender/editors/space_view3d/drawobject.c1460
-rw-r--r--source/blender/editors/space_view3d/drawvolume.c24
-rw-r--r--source/blender/editors/space_view3d/space_view3d.c212
-rw-r--r--source/blender/editors/space_view3d/view3d_buttons.c245
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c509
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c433
-rw-r--r--source/blender/editors/space_view3d/view3d_fly.c10
-rw-r--r--source/blender/editors/space_view3d/view3d_header.c88
-rw-r--r--source/blender/editors/space_view3d/view3d_select.c573
-rw-r--r--source/blender/editors/space_view3d/view3d_snap.c181
-rw-r--r--source/blender/editors/space_view3d/view3d_toolbar.c30
-rw-r--r--source/blender/editors/space_view3d/view3d_view.c345
15 files changed, 2216 insertions, 2112 deletions
diff --git a/source/blender/editors/space_view3d/drawanimviz.c b/source/blender/editors/space_view3d/drawanimviz.c
index 638bf5b41a7..553a04206f7 100644
--- a/source/blender/editors/space_view3d/drawanimviz.c
+++ b/source/blender/editors/space_view3d/drawanimviz.c
@@ -116,7 +116,7 @@ void draw_motion_path_instance(Scene *scene,
mpv_start= mpath->points;
}
- if(len <= 0) {
+ if (len <= 0) {
return;
}
diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c
index 599e113ba97..705b3c52d4b 100644
--- a/source/blender/editors/space_view3d/drawarmature.c
+++ b/source/blender/editors/space_view3d/drawarmature.c
@@ -154,7 +154,7 @@ static short set_pchan_glColor (short colCode, int boneflag, short constflag)
if (boneflag & BONE_DRAW_ACTIVE) {
copy_v3_v3_char((char *)cp, bcolor->active);
- if(!(boneflag & BONE_SELECTED)) {
+ if (!(boneflag & BONE_SELECTED)) {
cp_shade_color3ub(cp, -80);
}
}
@@ -194,7 +194,7 @@ static short set_pchan_glColor (short colCode, int boneflag, short constflag)
case PCHAN_COLOR_CONSTS:
{
- if ( (bcolor == NULL) || (bcolor->flag & TH_WIRECOLOR_CONSTCOLS) ) {
+ if ((bcolor == NULL) || (bcolor->flag & TH_WIRECOLOR_CONSTCOLS)) {
if (constflag & PCHAN_HAS_TARGET) glColor4ub(255, 150, 0, 80);
else if (constflag & PCHAN_HAS_IK) glColor4ub(255, 255, 0, 80);
else if (constflag & PCHAN_HAS_SPLINEIK) glColor4ub(200, 255, 0, 80);
@@ -317,7 +317,7 @@ static void drawsolidcube_size(float xsize, float ysize, float zsize)
glScalef(xsize, ysize, zsize);
- if(displist==0) {
+ if (displist==0) {
displist= glGenLists(1);
glNewList(displist, GL_COMPILE);
@@ -356,7 +356,7 @@ static void drawcube_size(float xsize, float ysize, float zsize)
{
static GLuint displist=0;
- if(displist == 0) {
+ if (displist == 0) {
displist= glGenLists(1);
glNewList(displist, GL_COMPILE);
@@ -512,7 +512,7 @@ static void draw_bone_solid_octahedral(void)
#if 1
glBegin(GL_TRIANGLES);
- for(i= 0; i < 8; i++) {
+ for (i= 0; i < 8; i++) {
glNormal3fv(bone_octahedral_solid_normals[i]);
glVertex3fv(bone_octahedral_verts[bone_octahedral_solid_tris[i][0]]);
glVertex3fv(bone_octahedral_verts[bone_octahedral_solid_tris[i][1]]);
@@ -548,7 +548,7 @@ static void draw_bone_points(int dt, int armflag, unsigned int boneflag, int id)
if (id != -1)
glLoadName(id | BONESEL_ROOT);
- if(dt <= OB_WIRE) {
+ if (dt <= OB_WIRE) {
if (armflag & ARM_EDITMODE) {
if (boneflag & BONE_ROOTSEL) UI_ThemeColor(TH_VERTEX_SELECT);
else UI_ThemeColor(TH_VERTEX);
@@ -661,18 +661,18 @@ static void draw_sphere_bone_dist(float smat[][4], float imat[][4], bPoseChannel
/* clear zcomp */
dirvec[2]= 0.0f;
- if(head != tail) {
+ if (head != tail) {
/* correcyion when viewing along the bones axis
* it pops in and out but better then artifacts, [#23841] */
float view_dist= len_v2(dirvec);
- if(head - view_dist > tail) {
+ if (head - view_dist > tail) {
tailvec= headvec;
tail = head;
zero_v3(dirvec);
dirvec[0]= 0.00001; // XXX. weak but ok
}
- else if(tail - view_dist > head) {
+ else if (tail - view_dist > head) {
headvec= tailvec;
head = tail;
zero_v3(dirvec);
@@ -1350,7 +1350,7 @@ static void draw_bone(int dt, int armflag, int boneflag, short constflag, unsign
static void draw_custom_bone(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob,
int dt, int armflag, int boneflag, unsigned int id, float length)
{
- if(ob==NULL) return;
+ if (ob==NULL) return;
glScalef(length, length, length);
@@ -1400,7 +1400,7 @@ static void pchan_draw_IK_root_lines(bPoseChannel *pchan, short only_temp)
/* Find the chain's root */
while (parchan->parent) {
segcount++;
- if(segcount==data->rootbone || segcount>255) break; // 255 is weak
+ if (segcount==data->rootbone || segcount>255) break; // 255 is weak
parchan= parchan->parent;
}
if (parchan)
@@ -1425,7 +1425,7 @@ static void pchan_draw_IK_root_lines(bPoseChannel *pchan, short only_temp)
while (parchan->parent) {
segcount++;
// FIXME: revise the breaking conditions
- if(segcount==data->chainlen || segcount>255) break; // 255 is weak
+ if (segcount==data->chainlen || segcount>255) break; // 255 is weak
parchan= parchan->parent;
}
if (parchan) // XXX revise the breaking conditions to only stop at the tail?
@@ -1473,14 +1473,14 @@ static void draw_dof_ellipse(float ax, float az)
glBegin(GL_QUADS);
pz= 0.0f;
- for(i=1; i<n; i++) {
+ for (i=1; i<n; i++) {
z= staticSine[i];
px= 0.0f;
- for(j=1; j<n-i+1; j++) {
+ for (j=1; j<n-i+1; j++) {
x = staticSine[j];
- if(j == n-i) {
+ if (j == n-i) {
glEnd();
glBegin(GL_TRIANGLES);
bgl_sphere_project(ax*px, az*z);
@@ -1798,7 +1798,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
if ((dt < OB_SOLID) || (bone->flag & BONE_DRAWWIRE)) {
glPushMatrix();
- if(pchan->custom_tx) {
+ if (pchan->custom_tx) {
glMultMatrixf(pchan->custom_tx->pose_mat);
}
else {
@@ -1806,7 +1806,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
}
/* prepare colors */
- if(is_ghost) {
+ if (is_ghost) {
/* 13 October 2009, Disabled this to make ghosting show the right colors (Aligorith) */
}
else if (arm->flag & ARM_POSEMODE)
@@ -2054,7 +2054,7 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, int dt)
arm->layer_used= 0;
/* envelope (deform distance) */
- if(arm->drawtype==ARM_ENVELOPE) {
+ if (arm->drawtype==ARM_ENVELOPE) {
/* precalc inverse matrix for drawing screen aligned */
copy_m4_m4(smat, rv3d->viewmatob);
mul_mat3_m4_fl(smat, 1.0f/len_v3(ob->obmat[0]));
@@ -2100,7 +2100,7 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, int dt)
if (arm->drawtype==ARM_ENVELOPE)
draw_sphere_bone(OB_SOLID, arm->flag, flag, 0, index, NULL, eBone);
- else if(arm->drawtype==ARM_B_BONE)
+ else if (arm->drawtype==ARM_B_BONE)
draw_b_bone(OB_SOLID, arm->flag, flag, 0, index, NULL, eBone);
else if (arm->drawtype==ARM_WIRE)
draw_wire_bone(OB_SOLID, arm->flag, flag, 0, index, NULL, eBone);
@@ -2118,7 +2118,7 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, int dt)
index= -1;
glLoadName(-1);
if ELEM(arm->drawtype, ARM_LINE, ARM_WIRE) {
- if(G.f & G_PICKSEL)
+ if (G.f & G_PICKSEL)
index= 0;
}
else if (dt > OB_WIRE)
@@ -2176,11 +2176,11 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, int dt)
}
}
}
- if(index!=-1) index++;
+ if (index!=-1) index++;
}
/* restore */
- if(index!=-1) glLoadName(-1);
+ if (index!=-1) glLoadName(-1);
if ELEM(arm->drawtype,ARM_LINE,ARM_WIRE);
else if (dt>OB_WIRE) bglPolygonOffset(rv3d->dist, 0.0f);
@@ -2195,7 +2195,7 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, int dt)
if (v3d->zbuf) glDisable(GL_DEPTH_TEST);
for (eBone=arm->edbo->first; eBone; eBone=eBone->next) {
- if(eBone->layer & arm->layer) {
+ if (eBone->layer & arm->layer) {
if ((eBone->flag & BONE_HIDDEN_A)==0) {
UI_GetThemeColor3ubv((eBone->flag & BONE_SELECTED) ? TH_TEXT_HI : TH_TEXT, col);
@@ -2468,7 +2468,7 @@ static void draw_ghost_poses(Scene *scene, View3D *v3d, ARegion *ar, Base *base)
if (v3d->zbuf) glDisable(GL_DEPTH_TEST);
/* draw from darkest blend to lowest */
- for(cur= stepsize; cur<range; cur+=stepsize) {
+ for (cur= stepsize; cur<range; cur+=stepsize) {
ctime= cur - (float)fmod(cfrao, stepsize); /* ensures consistent stepping */
colfac= ctime/range;
UI_ThemeColorShadeAlpha(TH_WIRE, 0, -128-(int)(120.0*sqrt(colfac)));
@@ -2522,10 +2522,10 @@ int draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base, int dt, in
bArmature *arm= ob->data;
int retval= 0;
- if(v3d->flag2 & V3D_RENDER_OVERRIDE)
+ if (v3d->flag2 & V3D_RENDER_OVERRIDE)
return 1;
- if(dt>OB_WIRE && !ELEM(arm->drawtype, ARM_LINE, ARM_WIRE)) {
+ if (dt>OB_WIRE && !ELEM(arm->drawtype, ARM_LINE, ARM_WIRE)) {
/* we use color for solid lighting */
glColorMaterial(GL_FRONT_AND_BACK, GL_SPECULAR);
glEnable(GL_COLOR_MATERIAL);
@@ -2538,29 +2538,29 @@ int draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base, int dt, in
/* arm->flag is being used to detect mode... */
/* editmode? */
- if(arm->edbo) {
+ if (arm->edbo) {
arm->flag |= ARM_EDITMODE;
draw_ebones(v3d, ar, ob, dt);
arm->flag &= ~ARM_EDITMODE;
}
else{
/* Draw Pose */
- if(ob->pose && ob->pose->chanbase.first) {
+ if (ob->pose && ob->pose->chanbase.first) {
/* drawing posemode selection indices or colors only in these cases */
- if(!(base->flag & OB_FROMDUPLI)) {
- if(G.f & G_PICKSEL) {
+ if (!(base->flag & OB_FROMDUPLI)) {
+ if (G.f & G_PICKSEL) {
#if 0 /* nifty but actually confusing to allow bone selection out of posemode */
- if(OBACT && (OBACT->mode & OB_MODE_WEIGHT_PAINT)) {
- if(ob==modifiers_isDeformedByArmature(OBACT))
+ if (OBACT && (OBACT->mode & OB_MODE_WEIGHT_PAINT)) {
+ if (ob==modifiers_isDeformedByArmature(OBACT))
arm->flag |= ARM_POSEMODE;
}
else
#endif
- if(ob->mode & OB_MODE_POSE) {
+ if (ob->mode & OB_MODE_POSE) {
arm->flag |= ARM_POSEMODE;
}
}
- else if(ob->mode & OB_MODE_POSE) {
+ else if (ob->mode & OB_MODE_POSE) {
if (arm->ghosttype == ARM_GHOST_RANGE) {
draw_ghost_poses_range(scene, v3d, ar, base);
}
@@ -2572,10 +2572,10 @@ int draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base, int dt, in
draw_ghost_poses(scene, v3d, ar, base);
}
if ((flag & DRAW_SCENESET)==0) {
- if(ob==OBACT)
+ if (ob==OBACT)
arm->flag |= ARM_POSEMODE;
- else if(OBACT && (OBACT->mode & OB_MODE_WEIGHT_PAINT)) {
- if(ob==modifiers_isDeformedByArmature(OBACT))
+ else if (OBACT && (OBACT->mode & OB_MODE_WEIGHT_PAINT)) {
+ if (ob==modifiers_isDeformedByArmature(OBACT))
arm->flag |= ARM_POSEMODE;
}
draw_pose_paths(scene, v3d, ar, ob);
@@ -2585,7 +2585,7 @@ int draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base, int dt, in
draw_pose_bones(scene, v3d, ar, base, dt, FALSE, is_outline);
arm->flag &= ~ARM_POSEMODE;
- if(ob->mode & OB_MODE_POSE)
+ if (ob->mode & OB_MODE_POSE)
UI_ThemeColor(TH_WIRE); /* restore, for extra draw stuff */
}
else retval= 1;
diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c
index ca647d9962a..513df524872 100644
--- a/source/blender/editors/space_view3d/drawmesh.c
+++ b/source/blender/editors/space_view3d/drawmesh.c
@@ -105,7 +105,7 @@ static void get_marked_edge_info__orFlags(EdgeHash *eh, int v0, int v1, int flag
{
int *flags_p;
- if(!BLI_edgehash_haskey(eh, v0, v1))
+ if (!BLI_edgehash_haskey(eh, v0, v1))
BLI_edgehash_insert(eh, v0, v1, NULL);
flags_p = (int*) BLI_edgehash_lookup_p(eh, v0, v1);
@@ -120,7 +120,7 @@ static EdgeHash *get_tface_mesh_marked_edge_info(Mesh *me)
MLoop *ml_next;
int i, j;
- for(i=0; i<me->totpoly; i++) {
+ for (i=0; i<me->totpoly; i++) {
mp = &me->mpoly[i];
if (!(mp->flag & ME_HIDE)) {
@@ -146,8 +146,8 @@ static int draw_mesh_face_select__setHiddenOpts(void *userData, int index)
MEdge *med = &me->medge[index];
uintptr_t flags = (intptr_t) BLI_edgehash_lookup(data->eh, med->v1, med->v2);
- if(me->drawflag & ME_DRAWEDGES) {
- if(me->drawflag & ME_HIDDENEDGES)
+ if (me->drawflag & ME_DRAWEDGES) {
+ if (me->drawflag & ME_HIDDENEDGES)
return 1;
else
return (flags & eEdge_Visible);
@@ -171,7 +171,7 @@ static int draw_mesh_face_select__drawFaceOptsInv(void *userData, int index)
Mesh *me = (Mesh*)userData;
MPoly *mface = &me->mpoly[index];
- if(!(mface->flag&ME_HIDE) && !(mface->flag&ME_FACE_SEL))
+ if (!(mface->flag&ME_HIDE) && !(mface->flag&ME_FACE_SEL))
return 2; /* Don't set color */
else
return 0;
@@ -195,7 +195,7 @@ static void draw_mesh_face_select(RegionView3D *rv3d, Mesh *me, DerivedMesh *dm)
setlinestyle(0);
/* Draw Selected Faces */
- if(me->drawflag & ME_DRAWFACES) {
+ if (me->drawflag & ME_DRAWFACES) {
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
/* dull unselected faces so as not to get in the way of seeing color */
@@ -256,7 +256,8 @@ static int set_draw_settings_cached(int clearcache, MTFace *texface, Material *m
c_textured= c_lit= c_backculled= -1;
c_texface= (MTFace*) -1;
c_badtex= 0;
- } else {
+ }
+ else {
textured = gtexdraw.istex;
litob = gtexdraw.ob;
}
@@ -291,7 +292,7 @@ static int set_draw_settings_cached(int clearcache, MTFace *texface, Material *m
if (textured!=c_textured || texface!=c_texface) {
if (textured ) {
c_badtex= !GPU_set_tpage(texface, !(litob->mode & OB_MODE_TEXTURE_PAINT), alphablend);
- } else {
+ }else {
GPU_set_tpage(NULL, 0, 0);
c_badtex= 0;
}
@@ -335,11 +336,11 @@ static void draw_textured_begin(Scene *scene, View3D *v3d, RegionView3D *rv3d, O
/* texture draw is abused for mask selection mode, do this so wire draw
* with face selection in weight paint is not lit. */
- if((v3d->drawtype <= OB_WIRE) && (ob->mode & OB_MODE_WEIGHT_PAINT)) {
+ if ((v3d->drawtype <= OB_WIRE) && (ob->mode & OB_MODE_WEIGHT_PAINT)) {
solidtex= FALSE;
Gtexdraw.islit= 0;
}
- else if(v3d->drawtype==OB_SOLID || ((ob->mode & OB_MODE_EDIT) && v3d->drawtype!=OB_TEXTURE)) {
+ else if (v3d->drawtype==OB_SOLID || ((ob->mode & OB_MODE_EDIT) && v3d->drawtype!=OB_TEXTURE)) {
/* draw with default lights in solid draw mode and edit mode */
solidtex= TRUE;
Gtexdraw.islit= -1;
@@ -353,7 +354,7 @@ static void draw_textured_begin(Scene *scene, View3D *v3d, RegionView3D *rv3d, O
rgba_float_to_uchar(obcol, ob->col);
glCullFace(GL_BACK); glEnable(GL_CULL_FACE);
- if(solidtex || v3d->drawtype==OB_TEXTURE) istex= 1;
+ if (solidtex || v3d->drawtype==OB_TEXTURE) istex= 1;
else istex= 0;
Gtexdraw.ob = ob;
@@ -399,15 +400,17 @@ static int draw_tface__set_draw_legacy(MTFace *tface, int has_mcol, int matnr)
if (tface && validtexture) {
glColor3ub(0xFF, 0x00, 0xFF);
return 2; /* Don't set color */
- } else if (ma && ma->shade_flag&MA_OBCOLOR) {
+ }
+ else if (ma && ma->shade_flag&MA_OBCOLOR) {
glColor3ubv(Gtexdraw.obcol);
return 2; /* Don't set color */
- } else if (!has_mcol) {
+ }
+ else if (!has_mcol) {
if (tface) glColor3f(1.0, 1.0, 1.0);
else {
- if(ma) {
+ if (ma) {
float col[3];
- if(Gtexdraw.color_profile) linearrgb_to_srgb_v3_v3(col, &ma->r);
+ if (Gtexdraw.color_profile) linearrgb_to_srgb_v3_v3(col, &ma->r);
else copy_v3_v3(col, &ma->r);
glColor3fv(col);
@@ -415,7 +418,8 @@ static int draw_tface__set_draw_legacy(MTFace *tface, int has_mcol, int matnr)
else glColor3f(1.0, 1.0, 1.0);
}
return 2; /* Don't set color */
- } else {
+ }
+ else {
return 1; /* Set color from mcol */
}
}
@@ -434,11 +438,14 @@ static int draw_tface__set_draw(MTFace *tface, int has_mcol, int matnr)
if (tface && set_draw_settings_cached(0, tface, ma, Gtexdraw)) {
return 2; /* Don't set color */
- } else if (tface && tface->mode&TF_OBCOL) {
+ }
+ else if (tface && tface->mode&TF_OBCOL) {
return 2; /* Don't set color */
- } else if (!has_mcol) {
+ }
+ else if (!has_mcol) {
return 1; /* Don't set color */
- } else {
+ }
+ else {
return 1; /* Set color from mcol */
}
}
@@ -449,38 +456,40 @@ static void add_tface_color_layer(DerivedMesh *dm)
MCol *finalCol;
int i,j;
MCol *mcol = dm->getTessFaceDataArray(dm, CD_WEIGHT_MCOL);
- if(!mcol)
+ if (!mcol)
mcol = dm->getTessFaceDataArray(dm, CD_MCOL);
finalCol = MEM_mallocN(sizeof(MCol)*4*dm->getNumTessFaces(dm),"add_tface_color_layer");
- for(i=0;i<dm->getNumTessFaces(dm);i++) {
+ for (i=0;i<dm->getNumTessFaces(dm);i++) {
Material *ma= give_current_material(Gtexdraw.ob, mface[i].mat_nr+1);
if (ma && (ma->game.flag&GEMAT_INVISIBLE)) {
- if( mcol )
+ if ( mcol )
memcpy(&finalCol[i*4],&mcol[i*4],sizeof(MCol)*4);
else
- for(j=0;j<4;j++) {
+ for (j=0;j<4;j++) {
finalCol[i*4+j].b = 255;
finalCol[i*4+j].g = 255;
finalCol[i*4+j].r = 255;
}
}
else if (tface && mface && set_draw_settings_cached(0, tface, ma, Gtexdraw)) {
- for(j=0;j<4;j++) {
+ for (j=0;j<4;j++) {
finalCol[i*4+j].b = 255;
finalCol[i*4+j].g = 0;
finalCol[i*4+j].r = 255;
}
- } else if (tface && tface->mode&TF_OBCOL) {
- for(j=0;j<4;j++) {
+ }
+ else if (tface && tface->mode&TF_OBCOL) {
+ for (j=0;j<4;j++) {
finalCol[i*4+j].b = FTOCHAR(Gtexdraw.obcol[0]);
finalCol[i*4+j].g = FTOCHAR(Gtexdraw.obcol[1]);
finalCol[i*4+j].r = FTOCHAR(Gtexdraw.obcol[2]);
}
- } else if (!mcol) {
+ }
+ else if (!mcol) {
if (tface) {
- for(j=0;j<4;j++) {
+ for (j=0;j<4;j++) {
finalCol[i*4+j].b = 255;
finalCol[i*4+j].g = 255;
finalCol[i*4+j].r = 255;
@@ -490,25 +499,26 @@ static void add_tface_color_layer(DerivedMesh *dm)
float col[3];
Material *ma= give_current_material(Gtexdraw.ob, mface[i].mat_nr+1);
- if(ma) {
- if(Gtexdraw.color_profile) linearrgb_to_srgb_v3_v3(col, &ma->r);
+ if (ma) {
+ if (Gtexdraw.color_profile) linearrgb_to_srgb_v3_v3(col, &ma->r);
else copy_v3_v3(col, &ma->r);
- for(j=0;j<4;j++) {
+ for (j=0;j<4;j++) {
finalCol[i*4+j].b = FTOCHAR(col[0]);
finalCol[i*4+j].g = FTOCHAR(col[1]);
finalCol[i*4+j].r = FTOCHAR(col[2]);
}
}
else
- for(j=0;j<4;j++) {
+ for (j=0;j<4;j++) {
finalCol[i*4+j].b = 255;
finalCol[i*4+j].g = 255;
finalCol[i*4+j].r = 255;
}
}
- } else {
- for(j=0;j<4;j++) {
+ }
+ else {
+ for (j=0;j<4;j++) {
finalCol[i*4+j].r = mcol[i*4+j].r;
finalCol[i*4+j].g = mcol[i*4+j].g;
finalCol[i*4+j].b = mcol[i*4+j].b;
@@ -611,19 +621,19 @@ static void draw_mesh_text(Scene *scene, Object *ob, int glsl)
MTFace tmp_tf = {{{0}}};
/* don't draw without tfaces */
- if(!mtpoly || !mloopuv)
+ if (!mtpoly || !mloopuv)
return;
/* don't draw when editing */
- if(ob->mode & OB_MODE_EDIT)
+ if (ob->mode & OB_MODE_EDIT)
return;
- else if(ob==OBACT)
- if(paint_facesel_test(ob) || paint_vertsel_test(ob))
+ else if (ob==OBACT)
+ if (paint_facesel_test(ob) || paint_vertsel_test(ob))
return;
ddm = mesh_get_derived_deform(scene, ob, CD_MASK_BAREMESH);
- for(a=0, mp=mface; a<totpoly ; a++, mtpoly++, mp++) {
+ for (a=0, mp=mface; a<totpoly ; a++, mtpoly++, mp++) {
short matnr= mp->mat_nr;
int mf_smooth= mp->flag & ME_SMOOTH;
Material *mat = me->mat[matnr];
@@ -640,11 +650,11 @@ static void draw_mesh_text(Scene *scene, Object *ob, int glsl)
/* TEXFACE */
ME_MTEXFACE_CPY(&tmp_tf, mtpoly);
- if(glsl) {
+ if (glsl) {
GPU_enable_material(matnr+1, &gattribs);
- for(i=0; i<gattribs.totlayer; i++) {
- if(gattribs.layer[i].type == CD_MTFACE) {
+ for (i=0; i<gattribs.totlayer; i++) {
+ if (gattribs.layer[i].type == CD_MTFACE) {
glattrib = gattribs.layer[i].glindex;
break;
}
@@ -701,7 +711,7 @@ static void draw_mesh_text(Scene *scene, Object *ob, int glsl)
set_property_valstr(prop, string);
characters = strlen(string);
- if(!BKE_image_get_ibuf(mtpoly->tpage, NULL))
+ if (!BKE_image_get_ibuf(mtpoly->tpage, NULL))
characters = 0;
if (!mf_smooth) {
@@ -724,10 +734,10 @@ static int compareDrawOptions(void *userData, int cur_index, int next_index)
{
drawTFace_userData *data = userData;
- if(data->mf && data->mf[cur_index].mat_nr != data->mf[next_index].mat_nr)
+ if (data->mf && data->mf[cur_index].mat_nr != data->mf[next_index].mat_nr)
return 0;
- if(data->tf && data->tf[cur_index].tpage != data->tf[next_index].tpage)
+ if (data->tf && data->tf[cur_index].tpage != data->tf[next_index].tpage)
return 0;
return 1;
@@ -737,10 +747,10 @@ static int compareDrawOptionsEm(void *userData, int cur_index, int next_index)
{
drawEMTFMapped_userData *data= userData;
- if(data->mf && data->mf[cur_index].mat_nr != data->mf[next_index].mat_nr)
+ if (data->mf && data->mf[cur_index].mat_nr != data->mf[next_index].mat_nr)
return 0;
- if(data->tf && data->tf[cur_index].tpage != data->tf[next_index].tpage)
+ if (data->tf && data->tf[cur_index].tpage != data->tf[next_index].tpage)
return 0;
return 1;
@@ -751,7 +761,7 @@ void draw_mesh_textured_old(Scene *scene, View3D *v3d, RegionView3D *rv3d, Objec
Mesh *me= ob->data;
/* correct for negative scale */
- if(ob->transflag & OB_NEG_SCALE) glFrontFace(GL_CW);
+ if (ob->transflag & OB_NEG_SCALE) glFrontFace(GL_CW);
else glFrontFace(GL_CCW);
/* draw the textured mesh */
@@ -759,7 +769,7 @@ void draw_mesh_textured_old(Scene *scene, View3D *v3d, RegionView3D *rv3d, Objec
glColor4f(1.0f,1.0f,1.0f,1.0f);
- if(ob->mode & OB_MODE_EDIT) {
+ if (ob->mode & OB_MODE_EDIT) {
drawEMTFMapped_userData data;
data.em= me->edit_btmesh;
@@ -770,14 +780,14 @@ void draw_mesh_textured_old(Scene *scene, View3D *v3d, RegionView3D *rv3d, Objec
dm->drawMappedFacesTex(dm, draw_em_tf_mapped__set_draw, compareDrawOptionsEm, &data);
}
- else if(draw_flags & DRAW_FACE_SELECT) {
- if(ob->mode & OB_MODE_WEIGHT_PAINT)
+ else if (draw_flags & DRAW_FACE_SELECT) {
+ if (ob->mode & OB_MODE_WEIGHT_PAINT)
dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions_facemask, GPU_enable_material, NULL, me, 1);
else
dm->drawMappedFacesTex(dm, me->mpoly ? draw_tface_mapped__set_draw : NULL, NULL, me);
}
else {
- if(GPU_buffer_legacy(dm)) {
+ if (GPU_buffer_legacy(dm)) {
if (draw_flags & DRAW_MODIFIERS_PREVIEW)
dm->drawFacesTex(dm, draw_mcol__set_draw_legacy, NULL, NULL);
else
@@ -786,7 +796,7 @@ void draw_mesh_textured_old(Scene *scene, View3D *v3d, RegionView3D *rv3d, Objec
else {
drawTFace_userData userData;
- if(!CustomData_has_layer(&dm->faceData,CD_TEXTURE_MCOL))
+ if (!CustomData_has_layer(&dm->faceData,CD_TEXTURE_MCOL))
add_tface_color_layer(dm);
userData.mf = DM_get_tessface_data_layer(dm, CD_MFACE);
@@ -797,13 +807,13 @@ void draw_mesh_textured_old(Scene *scene, View3D *v3d, RegionView3D *rv3d, Objec
}
/* draw game engine text hack */
- if(get_ob_property(ob, "Text"))
+ if (get_ob_property(ob, "Text"))
draw_mesh_text(scene, ob, 0);
draw_textured_end();
/* draw edges and selected faces over textured mesh */
- if(!(ob == scene->obedit) && (draw_flags & DRAW_FACE_SELECT))
+ if (!(ob == scene->obedit) && (draw_flags & DRAW_FACE_SELECT))
draw_mesh_face_select(rv3d, me, dm);
/* reset from negative scale correction */
@@ -842,13 +852,13 @@ static void tex_mat_set_texture_cb(void *userData, int mat_nr, void *attribs)
int texture_set= 0;
/* draw image texture if we find one */
- if(ED_object_get_active_image(data->ob, mat_nr, &ima, &iuser, &node)) {
+ if (ED_object_get_active_image(data->ob, mat_nr, &ima, &iuser, &node)) {
/* get openl texture */
int mipmap= 1;
int bindcode= (ima)? GPU_verify_image(ima, iuser, 0, 0, mipmap): 0;
float zero[4] = {0.0f, 0.0f, 0.0f, 0.0f};
- if(bindcode) {
+ if (bindcode) {
NodeTexBase *texbase= node->storage;
/* disable existing material */
@@ -880,7 +890,7 @@ static void tex_mat_set_texture_cb(void *userData, int mat_nr, void *attribs)
}
}
- if(!texture_set) {
+ if (!texture_set) {
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
@@ -916,18 +926,18 @@ static int tex_mat_set_face_editmesh_cb(void *userData, int index)
void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob, DerivedMesh *dm, int draw_flags)
{
- if((!scene_use_new_shading_nodes(scene)) || (draw_flags & DRAW_MODIFIERS_PREVIEW)) {
+ if ((!scene_use_new_shading_nodes(scene)) || (draw_flags & DRAW_MODIFIERS_PREVIEW)) {
draw_mesh_textured_old(scene, v3d, rv3d, ob, dm, draw_flags);
return;
}
/* set opengl state for negative scale & color */
- if(ob->transflag & OB_NEG_SCALE) glFrontFace(GL_CW);
+ if (ob->transflag & OB_NEG_SCALE) glFrontFace(GL_CW);
else glFrontFace(GL_CCW);
glEnable(GL_LIGHTING);
- if(ob->mode & OB_MODE_WEIGHT_PAINT) {
+ if (ob->mode & OB_MODE_WEIGHT_PAINT) {
/* weight paint mode exception */
int useColors= 1;
@@ -941,9 +951,9 @@ void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *o
int glsl;
/* face hiding callback depending on mode */
- if(ob == scene->obedit)
+ if (ob == scene->obedit)
set_face_cb= tex_mat_set_face_editmesh_cb;
- else if(draw_flags & DRAW_FACE_SELECT)
+ else if (draw_flags & DRAW_FACE_SELECT)
set_face_cb= tex_mat_set_face_mesh_cb;
else
set_face_cb= NULL;
@@ -953,7 +963,7 @@ void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *o
GPU_begin_object_materials(v3d, rv3d, scene, ob, glsl, NULL);
- if(glsl) {
+ if (glsl) {
/* draw glsl */
dm->drawMappedFacesMat(dm,
tex_mat_set_material_cb,
@@ -987,7 +997,7 @@ void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *o
glMatrixMode(GL_MODELVIEW);
/* faceselect mode drawing over textured mesh */
- if(!(ob == scene->obedit) && (draw_flags & DRAW_FACE_SELECT))
+ if (!(ob == scene->obedit) && (draw_flags & DRAW_FACE_SELECT))
draw_mesh_face_select(rv3d, ob->data, dm);
}
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 1ef2226941e..497296748c6 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -184,20 +184,20 @@ static void draw_empty_cone(float size);
static int check_ob_drawface_dot(Scene *sce, View3D *vd, char dt)
{
- if((sce->toolsettings->selectmode & SCE_SELECT_FACE) == 0)
+ if ((sce->toolsettings->selectmode & SCE_SELECT_FACE) == 0)
return 0;
- if(G.f & G_BACKBUFSEL)
+ if (G.f & G_BACKBUFSEL)
return 0;
- if((vd->flag & V3D_ZBUF_SELECT) == 0)
+ if ((vd->flag & V3D_ZBUF_SELECT) == 0)
return 1;
/* if its drawing textures with zbuf sel, then dont draw dots */
- if(dt==OB_TEXTURE && vd->drawtype==OB_TEXTURE)
+ if (dt==OB_TEXTURE && vd->drawtype==OB_TEXTURE)
return 0;
- if(vd->drawtype>=OB_SOLID && vd->flag2 & V3D_SOLID_TEX)
+ if (vd->drawtype>=OB_SOLID && vd->flag2 & V3D_SOLID_TEX)
return 0;
return 1;
@@ -214,8 +214,8 @@ static void view3d_project_short_clip(ARegion *ar, const float vec[3], short adr
adr[0]= IS_CLIPPED;
/* clipplanes in eye space */
- if(rv3d->rflag & RV3D_CLIPPING) {
- if(ED_view3d_test_clipping(rv3d, vec, local))
+ if (rv3d->rflag & RV3D_CLIPPING) {
+ if (ED_view3d_test_clipping(rv3d, vec, local))
return;
}
@@ -225,14 +225,14 @@ static void view3d_project_short_clip(ARegion *ar, const float vec[3], short adr
mul_m4_v4(rv3d->persmatob, vec4);
/* clipplanes in window space */
- if( vec4[3] > (float)BL_NEAR_CLIP ) { /* is the NEAR clipping cutoff for picking */
+ if ( vec4[3] > (float)BL_NEAR_CLIP ) { /* is the NEAR clipping cutoff for picking */
fx= (ar->winx/2)*(1 + vec4[0]/vec4[3]);
- if( fx>0 && fx<ar->winx) {
+ if ( fx>0 && fx<ar->winx) {
fy= (ar->winy/2)*(1 + vec4[1]/vec4[3]);
- if(fy > 0.0f && fy < (float)ar->winy) {
+ if (fy > 0.0f && fy < (float)ar->winy) {
adr[0]= (short)floorf(fx);
adr[1]= (short)floorf(fy);
}
@@ -255,14 +255,14 @@ static void UNUSED_FUNCTION(view3d_project_short_noclip)(ARegion *ar, const floa
mul_m4_v4(rv3d->persmatob, vec4);
- if( vec4[3] > (float)BL_NEAR_CLIP ) { /* is the NEAR clipping cutoff for picking */
+ if ( vec4[3] > (float)BL_NEAR_CLIP ) { /* is the NEAR clipping cutoff for picking */
fx= (ar->winx/2)*(1 + vec4[0]/vec4[3]);
- if( fx>-32700 && fx<32700) {
+ if ( fx>-32700 && fx<32700) {
fy= (ar->winy/2)*(1 + vec4[1]/vec4[3]);
- if(fy > -32700.0f && fy < 32700.0f) {
+ if (fy > -32700.0f && fy < 32700.0f) {
adr[0]= (short)floorf(fx);
adr[1]= (short)floorf(fy);
}
@@ -279,8 +279,8 @@ static void view3d_project_short_clip_persmat(ARegion *ar, float *vec, short adr
adr[0]= IS_CLIPPED;
/* clipplanes in eye space */
- if(rv3d->rflag & RV3D_CLIPPING) {
- if(ED_view3d_test_clipping(rv3d, vec, local))
+ if (rv3d->rflag & RV3D_CLIPPING) {
+ if (ED_view3d_test_clipping(rv3d, vec, local))
return;
}
@@ -290,14 +290,14 @@ static void view3d_project_short_clip_persmat(ARegion *ar, float *vec, short adr
mul_m4_v4(rv3d->persmat, vec4);
/* clipplanes in window space */
- if( vec4[3] > (float)BL_NEAR_CLIP ) { /* is the NEAR clipping cutoff for picking */
+ if ( vec4[3] > (float)BL_NEAR_CLIP ) { /* is the NEAR clipping cutoff for picking */
fx= (ar->winx/2)*(1 + vec4[0]/vec4[3]);
- if( fx>0 && fx<ar->winx) {
+ if ( fx>0 && fx<ar->winx) {
fy= (ar->winy/2)*(1 + vec4[1]/vec4[3]);
- if(fy > 0.0f && fy < (float)ar->winy) {
+ if (fy > 0.0f && fy < (float)ar->winy) {
adr[0]= (short)floorf(fx);
adr[1]= (short)floorf(fy);
}
@@ -310,15 +310,15 @@ static void view3d_project_short_clip_persmat(ARegion *ar, float *vec, short adr
int draw_glsl_material(Scene *scene, Object *ob, View3D *v3d, int dt)
{
- if(!GPU_glsl_support())
+ if (!GPU_glsl_support())
return 0;
- if(G.f & G_PICKSEL)
+ if (G.f & G_PICKSEL)
return 0;
- if(!CHECK_OB_DRAWTEXTURE(v3d, dt))
+ if (!CHECK_OB_DRAWTEXTURE(v3d, dt))
return 0;
- if(ob==OBACT && (ob && ob->mode & OB_MODE_WEIGHT_PAINT))
+ if (ob==OBACT && (ob && ob->mode & OB_MODE_WEIGHT_PAINT))
return 0;
- if(scene_use_new_shading_nodes(scene))
+ if (scene_use_new_shading_nodes(scene))
return 0;
return (scene->gm.matmode == GAME_MAT_GLSL) && (dt > OB_SOLID);
@@ -326,10 +326,10 @@ int draw_glsl_material(Scene *scene, Object *ob, View3D *v3d, int dt)
static int check_alpha_pass(Base *base)
{
- if(base->flag & OB_FROMDUPLI)
+ if (base->flag & OB_FROMDUPLI)
return 0;
- if(G.f & G_PICKSEL)
+ if (G.f & G_PICKSEL)
return 0;
return (base->object->dtx & OB_DRAWTRANSP);
@@ -561,7 +561,8 @@ void drawaxes(float size, char drawtype)
if (axis % 2 == 1) {
v2[0] = -v2[0];
v3[1] = -v3[1];
- } else {
+ }
+ else {
v2[1] = -v2[1];
v3[0] = -v3[0];
}
@@ -634,12 +635,12 @@ static void draw_empty_image(Object *ob)
float scale, ofs_x, ofs_y, sca_x, sca_y;
int ima_x, ima_y;
- if(ibuf && (ibuf->rect == NULL) && (ibuf->rect_float != NULL)) {
+ if (ibuf && (ibuf->rect == NULL) && (ibuf->rect_float != NULL)) {
IMB_rect_from_float(ibuf);
}
/* Get the buffer dimensions so we can fallback to fake ones */
- if(ibuf && ibuf->rect) {
+ if (ibuf && ibuf->rect) {
ima_x= ibuf->x;
ima_y= ibuf->y;
}
@@ -649,12 +650,12 @@ static void draw_empty_image(Object *ob)
}
/* Get the image aspect even if the buffer is invalid */
- if(ima) {
- if(ima->aspx > ima->aspy) {
+ if (ima) {
+ if (ima->aspx > ima->aspy) {
sca_x= 1.0f;
sca_y= ima->aspy / ima->aspx;
}
- else if(ima->aspx < ima->aspy) {
+ else if (ima->aspx < ima->aspy) {
sca_x= ima->aspx / ima->aspy;
sca_y= 1.0f;
}
@@ -684,7 +685,7 @@ static void draw_empty_image(Object *ob)
/* Set the object scale */
glScalef(scale * sca_x, scale * sca_y, 1.0f);
- if(ibuf && ibuf->rect) {
+ if (ibuf && ibuf->rect) {
/* Setup GL params */
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
@@ -750,10 +751,10 @@ static void drawcentercircle(View3D *v3d, RegionView3D *rv3d, const float co[3],
/* using gldepthfunc guarantees that it does write z values,
* but not checks for it, so centers remain visible independt order of drawing */
- if(v3d->zbuf) glDepthFunc(GL_ALWAYS);
+ if (v3d->zbuf) glDepthFunc(GL_ALWAYS);
glEnable(GL_BLEND);
- if(special_color) {
+ if (special_color) {
if (selstate==ACTIVE || selstate==SELECT) glColor4ub(0x88, 0xFF, 0xFF, 155);
else glColor4ub(0x55, 0xCC, 0xCC, 155);
@@ -782,7 +783,7 @@ static void drawcentercircle(View3D *v3d, RegionView3D *rv3d, const float co[3],
glDisable(GL_BLEND);
- if(v3d->zbuf) glDepthFunc(GL_LEQUAL);
+ if (v3d->zbuf) glDepthFunc(GL_LEQUAL);
}
/* *********** text drawing for object/particles/armature ************* */
@@ -839,20 +840,20 @@ void view3d_cached_text_draw_end(View3D *v3d, ARegion *ar, int depth_write, floa
int a, tot= 0;
/* project first and test */
- for(vos= strings->first; vos; vos= vos->next) {
- if(mat && !(vos->flag & V3D_CACHE_TEXT_WORLDSPACE))
+ for (vos= strings->first; vos; vos= vos->next) {
+ if (mat && !(vos->flag & V3D_CACHE_TEXT_WORLDSPACE))
mul_m4_v3(mat, vos->vec);
- if(vos->flag&V3D_CACHE_TEXT_GLOBALSPACE)
+ if (vos->flag&V3D_CACHE_TEXT_GLOBALSPACE)
view3d_project_short_clip_persmat(ar, vos->vec, vos->sco, 0);
else
view3d_project_short_clip(ar, vos->vec, vos->sco, 0);
- if(vos->sco[0]!=IS_CLIPPED)
+ if (vos->sco[0]!=IS_CLIPPED)
tot++;
}
- if(tot) {
+ if (tot) {
int col_pack_prev= 0;
#if 0
@@ -860,11 +861,11 @@ void view3d_cached_text_draw_end(View3D *v3d, ARegion *ar, int depth_write, floa
double ux, uy, uz;
float depth;
- if(v3d->zbuf)
+ if (v3d->zbuf)
bgl_get_mats(&mats);
#endif
- if(rv3d->rflag & RV3D_CLIPPING)
- for(a=0; a<6; a++)
+ if (rv3d->rflag & RV3D_CLIPPING)
+ for (a=0; a<6; a++)
glDisable(GL_CLIP_PLANE0+a);
glMatrixMode(GL_PROJECTION);
@@ -873,27 +874,27 @@ void view3d_cached_text_draw_end(View3D *v3d, ARegion *ar, int depth_write, floa
glPushMatrix();
ED_region_pixelspace(ar);
- if(depth_write) {
- if(v3d->zbuf) glDisable(GL_DEPTH_TEST);
+ if (depth_write) {
+ if (v3d->zbuf) glDisable(GL_DEPTH_TEST);
}
else glDepthMask(0);
- for(vos= strings->first; vos; vos= vos->next) {
+ for (vos= strings->first; vos; vos= vos->next) {
/* too slow, reading opengl info while drawing is very bad,
* better to see if we can use the zbuffer while in pixel space - campbell */
#if 0
- if(v3d->zbuf && (vos->flag & V3D_CACHE_TEXT_ZBUF)) {
+ if (v3d->zbuf && (vos->flag & V3D_CACHE_TEXT_ZBUF)) {
gluProject(vos->vec[0], vos->vec[1], vos->vec[2], mats.modelview, mats.projection, (GLint *)mats.viewport, &ux, &uy, &uz);
glReadPixels(ar->winrct.xmin+vos->mval[0]+vos->xoffs, ar->winrct.ymin+vos->mval[1], 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &depth);
- if(uz > depth)
+ if (uz > depth)
continue;
}
#endif
- if(vos->sco[0]!=IS_CLIPPED) {
+ if (vos->sco[0]!=IS_CLIPPED) {
const char *str= (char *)(vos+1);
- if(col_pack_prev != vos->col.pack) {
+ if (col_pack_prev != vos->col.pack) {
glColor3ubv(vos->col.ub);
col_pack_prev= vos->col.pack;
}
@@ -908,8 +909,8 @@ void view3d_cached_text_draw_end(View3D *v3d, ARegion *ar, int depth_write, floa
}
}
- if(depth_write) {
- if(v3d->zbuf) glEnable(GL_DEPTH_TEST);
+ if (depth_write) {
+ if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
}
else glDepthMask(1);
@@ -918,12 +919,12 @@ void view3d_cached_text_draw_end(View3D *v3d, ARegion *ar, int depth_write, floa
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
- if(rv3d->rflag & RV3D_CLIPPING)
- for(a=0; a<6; a++)
+ if (rv3d->rflag & RV3D_CLIPPING)
+ for (a=0; a<6; a++)
glEnable(GL_CLIP_PLANE0+a);
}
- if(strings->first)
+ if (strings->first)
BLI_freelistN(strings);
CachedTextLevel--;
@@ -1049,7 +1050,7 @@ static void spotvolume(float lvec[3], float vvec[3], const float inp)
cross_v3_v3v3(plane,lvec,temp); /* a plane perpendicular to this, parrallel with lvec */
/* vectors are exactly aligned, use the X axis, this is arbitrary */
- if(normalize_v3(plane) == 0.0f)
+ if (normalize_v3(plane) == 0.0f)
plane[1]= 1.0f;
/* now we've got two equations: one of a cone and one of a plane, but we have
@@ -1109,7 +1110,7 @@ static void draw_spot_cone(Lamp *la, float x, float z)
glBegin(GL_TRIANGLE_FAN);
glVertex3f(0.0f, 0.0f, -x);
- if(la->mode & LA_SQUARE) {
+ if (la->mode & LA_SQUARE) {
glVertex3f(z, z, 0);
glVertex3f(-z, z, 0);
glVertex3f(-z, -z, 0);
@@ -1120,7 +1121,7 @@ static void draw_spot_cone(Lamp *la, float x, float z)
float angle;
int a;
- for(a=0; a<33; a++) {
+ for (a=0; a<33; a++) {
angle= a*M_PI*2/(33-1);
glVertex3f(z*cosf(angle), z*sinf(angle), 0);
}
@@ -1178,7 +1179,7 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
!(base->flag & OB_FROMDUPLI) &&
!is_view);
- if(drawcone && !v3d->transp) {
+ if (drawcone && !v3d->transp) {
/* in this case we need to draw delayed */
add_view3d_after(&v3d->afterdraw_transp, base, flag);
return;
@@ -1204,9 +1205,9 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
curcol[3]= 0.6;
glColor4fv(curcol);
- if(lampsize > 0.0f) {
+ if (lampsize > 0.0f) {
- if(ob->id.us>1) {
+ if (ob->id.us>1) {
if (ob==OBACT || (ob->flag & SELECT)) glColor4ub(0x88, 0xFF, 0xFF, 155);
else glColor4ub(0x77, 0xCC, 0xCC, 155);
}
@@ -1218,7 +1219,7 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
drawcircball(GL_POLYGON, vec, lampsize, imat);
/* restore */
- if(ob->id.us>1)
+ if (ob->id.us>1)
glColor4fv(curcol);
/* Outer circle */
@@ -1228,8 +1229,8 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
drawcircball(GL_LINE_LOOP, vec, circrad, imat);
/* draw dashed outer circle if shadow is on. remember some lamps can't have certain shadows! */
- if(la->type!=LA_HEMI) {
- if( (la->mode & LA_SHAD_RAY) ||
+ if (la->type!=LA_HEMI) {
+ if ( (la->mode & LA_SHAD_RAY) ||
((la->mode & LA_SHAD_BUF) && (la->type==LA_SPOT))
) {
drawcircball(GL_LINE_LOOP, vec, circrad + 3.0f*pixsize, imat);
@@ -1242,7 +1243,7 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
}
/* draw the pretty sun rays */
- if(la->type==LA_SUN) {
+ if (la->type==LA_SUN) {
float v1[3], v2[3], mat[3][3];
short axis;
@@ -1272,7 +1273,7 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
}
if (la->type==LA_LOCAL) {
- if(la->mode & LA_SPHERE) {
+ if (la->mode & LA_SPHERE) {
drawcircball(GL_LINE_LOOP, vec, la->dist, imat);
}
/* yafray: for photonlight also draw lightcone as for spot */
@@ -1281,7 +1282,7 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
glPopMatrix(); /* back in object space */
zero_v3(vec);
- if(is_view) {
+ if (is_view) {
/* skip drawing extra info */
}
else if ((la->type==LA_SPOT) || (la->type==LA_YF_PHOTON)) {
@@ -1312,7 +1313,7 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
/* draw the circle/square at the end of the cone */
glTranslatef(0.0, 0.0 , x);
- if(la->mode & LA_SQUARE) {
+ if (la->mode & LA_SQUARE) {
float tvec[3];
float z_abs= fabs(z);
@@ -1332,7 +1333,7 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
else circ(0.0, 0.0, fabsf(z));
/* draw the circle/square representing spotbl */
- if(la->type==LA_SPOT) {
+ if (la->type==LA_SPOT) {
float spotblcirc = fabs(z)*(1 - pow(la->spotblend, 2));
/* hide line if it is zero size or overlaps with outer border,
previously it adjusted to always to show it but that seems
@@ -1341,12 +1342,12 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
circ(0.0, 0.0, spotblcirc);
}
- if(drawcone)
+ if (drawcone)
draw_transp_spot_volume(la, x, z);
/* draw clip start, useful for wide cones where its not obvious where the start is */
glTranslatef(0.0, 0.0 , -x); /* reverse translation above */
- if(la->type==LA_SPOT && (la->mode & LA_SHAD_BUF) ) {
+ if (la->type==LA_SPOT && (la->mode & LA_SHAD_BUF) ) {
float lvec_clip[3];
float vvec_clip[3];
float clipsta_fac= la->clipsta / -x;
@@ -1370,7 +1371,7 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
glVertex3fv(vec);
glEnd();
- if(la->type==LA_HEMI) {
+ if (la->type==LA_HEMI) {
/* draw the hemisphere curves */
short axis, steps, dir;
float outdist, zdist, mul;
@@ -1390,7 +1391,8 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
/* make the arcs start at the edge of the energy circle */
if (steps == 0) v[0] = dir*circrad;
else v[0] = v[0] + dir*(steps*outdist);
- } else if (axis == 2 || axis == 3) { /* y axis up, y axis down */
+ }
+ else if (axis == 2 || axis == 3) { /* y axis up, y axis down */
/* make the arcs start at the edge of the energy circle */
if (steps == 0) v[1] = dir*circrad;
else v[1] = v[1] + dir*(steps*outdist);
@@ -1408,11 +1410,12 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
dir = -dir;
}
}
- } else if(la->type==LA_AREA) {
+ }
+ else if (la->type==LA_AREA) {
setlinestyle(3);
- if(la->area_shape==LA_AREA_SQUARE)
+ if (la->area_shape==LA_AREA_SQUARE)
fdrawbox(-la->area_size*0.5f, -la->area_size*0.5f, la->area_size*0.5f, la->area_size*0.5f);
- else if(la->area_shape==LA_AREA_RECT)
+ else if (la->area_shape==LA_AREA_RECT)
fdrawbox(-la->area_size*0.5f, -la->area_sizey*0.5f, la->area_size*0.5f, la->area_sizey*0.5f);
glBegin(GL_LINE_STRIP);
@@ -1427,7 +1430,7 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
setlinestyle(0);
- if((la->type == LA_SPOT) && (la->mode & LA_SHAD_BUF) && (is_view == FALSE)) {
+ if ((la->type == LA_SPOT) && (la->mode & LA_SHAD_BUF) && (is_view == FALSE)) {
drawshadbuflimits(la, ob->obmat);
}
@@ -1534,7 +1537,7 @@ static void draw_viewport_object_reconstruction(Scene *scene, Base *base, View3D
glPushMatrix();
- if(tracking_object->flag & TRACKING_OBJECT_CAMERA) {
+ if (tracking_object->flag & TRACKING_OBJECT_CAMERA) {
/* current ogl matrix is translated in camera space, bundles should
be rendered in world space, so camera matrix should be "removed"
from current ogl matrix */
@@ -1555,35 +1558,37 @@ static void draw_viewport_object_reconstruction(Scene *scene, Base *base, View3D
for (track= tracksbase->first; track; track= track->next) {
int selected= TRACK_SELECTED(track);
- if((track->flag&TRACK_HAS_BUNDLE)==0)
+ if ((track->flag&TRACK_HAS_BUNDLE)==0)
continue;
- if(flag&DRAW_PICKING)
+ if (flag&DRAW_PICKING)
glLoadName(base->selcol + (tracknr<<16));
glPushMatrix();
glTranslatef(track->bundle_pos[0], track->bundle_pos[1], track->bundle_pos[2]);
glScalef(v3d->bundle_size/0.05f, v3d->bundle_size/0.05f, v3d->bundle_size/0.05f);
- if(v3d->drawtype==OB_WIRE) {
+ if (v3d->drawtype==OB_WIRE) {
glDisable(GL_LIGHTING);
- if(selected) {
- if(base==BASACT) UI_ThemeColor(TH_ACTIVE);
+ if (selected) {
+ if (base==BASACT) UI_ThemeColor(TH_ACTIVE);
else UI_ThemeColor(TH_SELECT);
- } else {
- if(track->flag&TRACK_CUSTOMCOLOR) glColor3fv(track->color);
+ }
+ else {
+ if (track->flag&TRACK_CUSTOMCOLOR) glColor3fv(track->color);
else UI_ThemeColor(TH_WIRE);
}
drawaxes(0.05f, v3d->bundle_drawtype);
glEnable(GL_LIGHTING);
- } else if(v3d->drawtype>OB_WIRE) {
- if(v3d->bundle_drawtype==OB_EMPTY_SPHERE) {
+ }
+ else if (v3d->drawtype>OB_WIRE) {
+ if (v3d->bundle_drawtype==OB_EMPTY_SPHERE) {
/* selection outline */
- if(selected) {
- if(base==BASACT) UI_ThemeColor(TH_ACTIVE);
+ if (selected) {
+ if (base==BASACT) UI_ThemeColor(TH_ACTIVE);
else UI_ThemeColor(TH_SELECT);
glLineWidth(2.f);
@@ -1597,18 +1602,20 @@ static void draw_viewport_object_reconstruction(Scene *scene, Base *base, View3D
glLineWidth(1.f);
}
- if(track->flag&TRACK_CUSTOMCOLOR) glColor3fv(track->color);
+ if (track->flag&TRACK_CUSTOMCOLOR) glColor3fv(track->color);
else UI_ThemeColor(TH_BUNDLE_SOLID);
draw_bundle_sphere();
- } else {
+ }
+ else {
glDisable(GL_LIGHTING);
- if(selected) {
- if(base==BASACT) UI_ThemeColor(TH_ACTIVE);
+ if (selected) {
+ if (base==BASACT) UI_ThemeColor(TH_ACTIVE);
else UI_ThemeColor(TH_SELECT);
- } else {
- if(track->flag&TRACK_CUSTOMCOLOR) glColor3fv(track->color);
+ }
+ else {
+ if (track->flag&TRACK_CUSTOMCOLOR) glColor3fv(track->color);
else UI_ThemeColor(TH_WIRE);
}
@@ -1620,11 +1627,11 @@ static void draw_viewport_object_reconstruction(Scene *scene, Base *base, View3D
glPopMatrix();
- if((flag & DRAW_PICKING)==0 && (v3d->flag2&V3D_SHOW_BUNDLENAME)) {
+ if ((flag & DRAW_PICKING)==0 && (v3d->flag2&V3D_SHOW_BUNDLENAME)) {
float pos[3];
unsigned char tcol[4];
- if(selected) memcpy(tcol, scol, sizeof(tcol));
+ if (selected) memcpy(tcol, scol, sizeof(tcol));
else memcpy(tcol, col, sizeof(tcol));
mul_v3_m4v3(pos, mat, track->bundle_pos);
@@ -1634,12 +1641,12 @@ static void draw_viewport_object_reconstruction(Scene *scene, Base *base, View3D
tracknr++;
}
- if((flag & DRAW_PICKING)==0) {
- if((v3d->flag2&V3D_SHOW_CAMERAPATH) && (tracking_object->flag&TRACKING_OBJECT_CAMERA)) {
+ if ((flag & DRAW_PICKING)==0) {
+ if ((v3d->flag2&V3D_SHOW_CAMERAPATH) && (tracking_object->flag&TRACKING_OBJECT_CAMERA)) {
MovieTrackingReconstruction *reconstruction;
reconstruction= BKE_tracking_object_reconstruction(tracking, tracking_object);
- if(reconstruction->camnr) {
+ if (reconstruction->camnr) {
MovieReconstructedCamera *camera= reconstruction->cameras;
int a= 0;
@@ -1648,7 +1655,7 @@ static void draw_viewport_object_reconstruction(Scene *scene, Base *base, View3D
glLineWidth(2.0f);
glBegin(GL_LINE_STRIP);
- for(a= 0; a<reconstruction->camnr; a++, camera++) {
+ for (a= 0; a<reconstruction->camnr; a++, camera++) {
glVertex3fv(camera->mat[3]);
}
glEnd();
@@ -1671,10 +1678,10 @@ static void draw_viewport_reconstruction(Scene *scene, Base *base, View3D *v3d,
float curcol[4];
int global_track_index= 1;
- if((v3d->flag2&V3D_SHOW_RECONSTRUCTION)==0)
+ if ((v3d->flag2&V3D_SHOW_RECONSTRUCTION)==0)
return;
- if(v3d->flag2&V3D_RENDER_OVERRIDE)
+ if (v3d->flag2&V3D_RENDER_OVERRIDE)
return;
glGetFloatv(GL_CURRENT_COLOR, curcol);
@@ -1685,7 +1692,7 @@ static void draw_viewport_reconstruction(Scene *scene, Base *base, View3D *v3d,
glShadeModel(GL_SMOOTH);
tracking_object= tracking->objects.first;
- while(tracking_object) {
+ while (tracking_object) {
draw_viewport_object_reconstruction(scene, base, v3d, clip, tracking_object,
flag, &global_track_index);
@@ -1699,7 +1706,7 @@ static void draw_viewport_reconstruction(Scene *scene, Base *base, View3D *v3d,
glColor4fv(curcol);
- if(flag&DRAW_PICKING)
+ if (flag&DRAW_PICKING)
glLoadName(base->selcol);
}
@@ -1717,11 +1724,11 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base
MovieClip *clip= object_get_movieclip(scene, base->object, 0);
/* draw data for movie clip set as active for scene */
- if(clip)
+ if (clip)
draw_viewport_reconstruction(scene, base, v3d, clip, flag);
#ifdef VIEW3D_CAMERA_BORDER_HACK
- if(is_view && !(G.f & G_PICKSEL)) {
+ if (is_view && !(G.f & G_PICKSEL)) {
glGetFloatv(GL_CURRENT_COLOR, view3d_camera_border_hack_col);
view3d_camera_border_hack_test= TRUE;
return;
@@ -1748,7 +1755,7 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base
glVertex3fv(vec[3]);
glEnd();
- if(is_view)
+ if (is_view)
return;
zero_v3(tvec);
@@ -1790,8 +1797,8 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base
glEnd();
}
- if(flag==0) {
- if(cam->flag & (CAM_SHOWLIMITS+CAM_SHOWMIST)) {
+ if (flag==0) {
+ if (cam->flag & (CAM_SHOWLIMITS+CAM_SHOWMIST)) {
float nobmat[4][4];
World *wrld;
@@ -1803,15 +1810,15 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base
glLoadMatrixf(rv3d->viewmat);
glMultMatrixf(nobmat);
- if(cam->flag & CAM_SHOWLIMITS) {
+ if (cam->flag & CAM_SHOWLIMITS) {
draw_limit_line(cam->clipsta, cam->clipend, 0x77FFFF);
/* qdn: was yafray only, now also enabled for Blender to be used with defocus composit node */
draw_focus_cross(object_camera_dof_distance(ob), cam->drawsize);
}
wrld= scene->world;
- if(cam->flag & CAM_SHOWMIST)
- if(wrld) draw_limit_line(wrld->miststa, wrld->miststa+wrld->mistdist, 0xFFFFFF);
+ if (cam->flag & CAM_SHOWMIST)
+ if (wrld) draw_limit_line(wrld->miststa, wrld->miststa+wrld->mistdist, 0xFFFFFF);
glPopMatrix();
}
@@ -1829,11 +1836,11 @@ static void drawspeaker(Scene *UNUSED(scene), View3D *UNUSED(v3d), RegionView3D
glEnable(GL_BLEND);
- for(j = 0; j < 3; j++) {
+ for (j = 0; j < 3; j++) {
vec[2] = 0.25f * j -0.125f;
glBegin(GL_LINE_LOOP);
- for(i = 0; i < 16; i++) {
+ for (i = 0; i < 16; i++) {
vec[0] = cosf((float)M_PI * i / 8.0f) * (j == 0 ? 0.5f : 0.25f);
vec[1] = sinf((float)M_PI * i / 8.0f) * (j == 0 ? 0.5f : 0.25f);
glVertex3fv(vec);
@@ -1841,12 +1848,12 @@ static void drawspeaker(Scene *UNUSED(scene), View3D *UNUSED(v3d), RegionView3D
glEnd();
}
- for(j = 0; j < 4; j++) {
+ for (j = 0; j < 4; j++) {
vec[0] = (((j + 1) % 2) * (j - 1)) * 0.5f;
vec[1] = ((j % 2) * (j - 2)) * 0.5f;
glBegin(GL_LINE_STRIP);
- for(i = 0; i < 3; i++) {
- if(i == 1) {
+ for (i = 0; i < 3; i++) {
+ if (i == 1) {
vec[0] *= 0.5f;
vec[1] *= 0.5f;
}
@@ -1870,15 +1877,15 @@ static void lattice_draw_verts(Lattice *lt, DispList *dl, short sel)
glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE));
bglBegin(GL_POINTS);
- for(w=0; w<lt->pntsw; w++) {
+ for (w=0; w<lt->pntsw; w++) {
int wxt = (w==0 || w==lt->pntsw-1);
- for(v=0; v<lt->pntsv; v++) {
+ for (v=0; v<lt->pntsv; v++) {
int vxt = (v==0 || v==lt->pntsv-1);
- for(u=0; u<lt->pntsu; u++, bp++, co+=3) {
+ for (u=0; u<lt->pntsu; u++, bp++, co+=3) {
int uxt = (u==0 || u==lt->pntsu-1);
- if(!(lt->flag & LT_OUTSIDE) || uxt || vxt || wxt) {
- if(bp->hide==0) {
- if((bp->f1 & SELECT)==sel) {
+ if (!(lt->flag & LT_OUTSIDE) || uxt || vxt || wxt) {
+ if (bp->hide==0) {
+ if ((bp->f1 & SELECT)==sel) {
bglVertex3fv(dl?co:bp->vec);
}
}
@@ -1916,7 +1923,7 @@ static void drawlattice__point(Lattice *lt, DispList *dl, int u, int v, int w, i
{
int index = ((w*lt->pntsv + v)*lt->pntsu) + u;
- if(use_wcol) {
+ if (use_wcol) {
float col[3];
MDeformWeight *mdw= defvert_find_index (lt->dvert+index, use_wcol-1);
@@ -1927,7 +1934,8 @@ static void drawlattice__point(Lattice *lt, DispList *dl, int u, int v, int w, i
if (dl) {
glVertex3fv(&dl->verts[index*3]);
- } else {
+ }
+ else {
glVertex3fv(lt->def[index].vec);
}
}
@@ -1941,38 +1949,38 @@ static void drawlattice(Scene *scene, View3D *v3d, Object *ob)
int use_wcol= 0, is_edit= (lt->editlatt != NULL);
/* now we default make displist, this will modifiers work for non animated case */
- if(ob->disp.first==NULL)
+ if (ob->disp.first==NULL)
lattice_calc_modifiers(scene, ob);
dl= find_displist(&ob->disp, DL_VERTS);
- if(is_edit) {
+ if (is_edit) {
lt= lt->editlatt->latt;
cpack(0x004000);
- if(ob->defbase.first && lt->dvert) {
+ if (ob->defbase.first && lt->dvert) {
use_wcol= ob->actdef;
glShadeModel(GL_SMOOTH);
}
}
glBegin(GL_LINES);
- for(w=0; w<lt->pntsw; w++) {
+ for (w=0; w<lt->pntsw; w++) {
int wxt = (w==0 || w==lt->pntsw-1);
- for(v=0; v<lt->pntsv; v++) {
+ for (v=0; v<lt->pntsv; v++) {
int vxt = (v==0 || v==lt->pntsv-1);
- for(u=0; u<lt->pntsu; u++) {
+ for (u=0; u<lt->pntsu; u++) {
int uxt = (u==0 || u==lt->pntsu-1);
- if(w && ((uxt || vxt) || !(lt->flag & LT_OUTSIDE))) {
+ if (w && ((uxt || vxt) || !(lt->flag & LT_OUTSIDE))) {
drawlattice__point(lt, dl, u, v, w-1, use_wcol);
drawlattice__point(lt, dl, u, v, w, use_wcol);
}
- if(v && ((uxt || wxt) || !(lt->flag & LT_OUTSIDE))) {
+ if (v && ((uxt || wxt) || !(lt->flag & LT_OUTSIDE))) {
drawlattice__point(lt, dl, u, v-1, w, use_wcol);
drawlattice__point(lt, dl, u, v, w, use_wcol);
}
- if(u && ((vxt || wxt) || !(lt->flag & LT_OUTSIDE))) {
+ if (u && ((vxt || wxt) || !(lt->flag & LT_OUTSIDE))) {
drawlattice__point(lt, dl, u-1, v, w, use_wcol);
drawlattice__point(lt, dl, u, v, w, use_wcol);
}
@@ -1982,16 +1990,16 @@ static void drawlattice(Scene *scene, View3D *v3d, Object *ob)
glEnd();
/* restoration for weight colors */
- if(use_wcol)
+ if (use_wcol)
glShadeModel(GL_FLAT);
- if(is_edit) {
- if(v3d->zbuf) glDisable(GL_DEPTH_TEST);
+ if (is_edit) {
+ if (v3d->zbuf) glDisable(GL_DEPTH_TEST);
lattice_draw_verts(lt, dl, 0);
lattice_draw_verts(lt, dl, 1);
- if(v3d->zbuf) glEnable(GL_DEPTH_TEST);
+ if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
}
}
@@ -2011,7 +2019,8 @@ static void mesh_foreachScreenVert__mapFunc(void *userData, int index, float *co
if (data->clipVerts != V3D_CLIP_TEST_OFF) {
view3d_project_short_clip(data->vc.ar, co, s, 1);
- } else {
+ }
+ else {
float co2[2];
mul_v3_m4v3(co2, data->vc.obedit->obmat, co);
project_short_noclip(data->vc.ar, co2, s);
@@ -2035,7 +2044,7 @@ void mesh_foreachScreenVert(
data.userData = userData;
data.clipVerts = clipVerts;
- if(clipVerts != V3D_CLIP_TEST_OFF)
+ if (clipVerts != V3D_CLIP_TEST_OFF)
ED_view3d_local_clipping(vc->rv3d, vc->obedit->obmat); /* for local clipping lookups */
EDBM_init_index_arrays(vc->em, 1, 0, 0);
@@ -2050,11 +2059,11 @@ static void drawSelectedVertices__mapFunc(void *userData, int index, float *co,
{
MVert *mv = &((MVert *)userData)[index];
- if(!(mv->flag & ME_HIDE)) {
+ if (!(mv->flag & ME_HIDE)) {
const char sel= mv->flag & SELECT;
// TODO define selected color
- if(sel) {
+ if (sel) {
glColor3f(1.0f, 1.0f, 0.0f);
}
else {
@@ -2126,7 +2135,7 @@ void mesh_foreachScreenEdge(
data.userData = userData;
data.clipVerts = clipVerts;
- if(clipVerts != V3D_CLIP_TEST_OFF)
+ if (clipVerts != V3D_CLIP_TEST_OFF)
ED_view3d_local_clipping(vc->rv3d, vc->obedit->obmat); /* for local clipping lookups */
EDBM_init_index_arrays(vc->em, 0, 1, 0);
@@ -2166,7 +2175,7 @@ void mesh_foreachScreenFace(
data.func = func;
data.userData = userData;
- //if(clipVerts)
+ //if (clipVerts)
ED_view3d_local_clipping(vc->rv3d, vc->obedit->obmat); /* for local clipping lookups */
EDBM_init_index_arrays(vc->em, 0, 0, 1);
@@ -2190,17 +2199,18 @@ void nurbs_foreachScreenVert(
ED_view3d_local_clipping(vc->rv3d, vc->obedit->obmat); /* for local clipping lookups */
for (nu= nurbs->first; nu; nu=nu->next) {
- if(nu->type == CU_BEZIER) {
+ if (nu->type == CU_BEZIER) {
for (i=0; i<nu->pntsu; i++) {
BezTriple *bezt = &nu->bezt[i];
- if(bezt->hide==0) {
+ if (bezt->hide==0) {
- if(cu->drawflag & CU_HIDE_HANDLES) {
+ if (cu->drawflag & CU_HIDE_HANDLES) {
view3d_project_short_clip(vc->ar, bezt->vec[1], s, 1);
if (s[0] != IS_CLIPPED)
func(userData, nu, NULL, bezt, 1, s[0], s[1]);
- } else {
+ }
+ else {
view3d_project_short_clip(vc->ar, bezt->vec[0], s, 1);
if (s[0] != IS_CLIPPED)
func(userData, nu, NULL, bezt, 0, s[0], s[1]);
@@ -2218,7 +2228,7 @@ void nurbs_foreachScreenVert(
for (i=0; i<nu->pntsu*nu->pntsv; i++) {
BPoint *bp = &nu->bp[i];
- if(bp->hide==0) {
+ if (bp->hide==0) {
view3d_project_short_clip(vc->ar, bp->vec, s, 1);
if (s[0] != IS_CLIPPED)
func(userData, nu, bp, NULL, -1, s[0], s[1]);
@@ -2335,7 +2345,8 @@ static void draw_dm_verts__mapFunc(void *userData, int index, float *co, float *
UI_ThemeColor4(data->sel?TH_VERTEX_SELECT:TH_VERTEX);
glPointSize(size);
bglBegin(GL_POINTS);
- } else {
+ }
+ else {
bglVertex3fv(co);
}
}
@@ -2366,10 +2377,12 @@ static int draw_dm_edges_sel__setDrawOptions(void *userData, int index)
if (!BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) {
if (eed==data->eed_act) {
glColor4ubv(data->actCol);
- } else {
+ }
+ else {
if (BM_elem_flag_test(eed, BM_ELEM_SELECT)) {
col = data->selCol;
- } else {
+ }
+ else {
col = data->baseCol;
}
/* no alpha, this is used so a transparent color can disable drawing unselected edges in editmode */
@@ -2378,7 +2391,8 @@ static int draw_dm_edges_sel__setDrawOptions(void *userData, int index)
glColor4ubv(col);
}
return 1;
- } else {
+ }
+ else {
return 0;
}
}
@@ -2471,7 +2485,8 @@ static int draw_dm_faces_sel__setDrawOptions(void *userData, int index, int *UNU
if (efa == data->efa_act) {
glColor4ubv(data->cols[2]);
return 2; /* stipple */
- } else {
+ }
+ else {
col = data->cols[BM_elem_flag_test(efa, BM_ELEM_SELECT)?1:0];
if (col[3]==0) return 0;
glColor4ubv(col);
@@ -2490,22 +2505,22 @@ static int draw_dm_faces_sel__compareDrawOptions(void *userData, int index, int
unsigned char *col, *next_col;
- if(!data->orig_index)
+ if (!data->orig_index)
return 0;
efa= EDBM_get_face_for_index(data->em, data->orig_index[index]);
next_efa= EDBM_get_face_for_index(data->em, data->orig_index[next_index]);
- if(efa == next_efa)
+ if (efa == next_efa)
return 1;
- if(efa == data->efa_act || next_efa == data->efa_act)
+ if (efa == data->efa_act || next_efa == data->efa_act)
return 0;
col = data->cols[BM_elem_flag_test(efa, BM_ELEM_SELECT)?1:0];
next_col = data->cols[BM_elem_flag_test(next_efa, BM_ELEM_SELECT)?1:0];
- if(col[3]==0 || next_col[3]==0)
+ if (col[3]==0 || next_col[3]==0)
return 0;
return col == next_col;
@@ -2539,7 +2554,8 @@ static int draw_dm_creases__setDrawOptions(void *userData, int index)
if (!BM_elem_flag_test(eed, BM_ELEM_HIDDEN) && *crease!=0.0f) {
UI_ThemeColorBlend(TH_WIRE, TH_EDGE_CREASE, *crease);
return 1;
- } else {
+ }
+ else {
return 0;
}
}
@@ -2562,7 +2578,8 @@ static int draw_dm_bweights__setDrawOptions(void *userData, int index)
if (!BM_elem_flag_test(eed, BM_ELEM_HIDDEN) && *bweight!=0.0f) {
UI_ThemeColorBlend(TH_WIRE, TH_EDGE_SELECT, *bweight);
return 1;
- } else {
+ }
+ else {
return 0;
}
}
@@ -2612,7 +2629,7 @@ static void draw_em_fancy_verts(Scene *scene, View3D *v3d, Object *obedit,
ToolSettings *ts= scene->toolsettings;
int sel;
- if(v3d->zbuf) glDepthMask(0); // disable write in zbuffer, zbuf select
+ if (v3d->zbuf) glDepthMask(0); // disable write in zbuffer, zbuf select
for (sel=0; sel<2; sel++) {
unsigned char col[4], fcol[4];
@@ -2626,28 +2643,30 @@ static void draw_em_fancy_verts(Scene *scene, View3D *v3d, Object *obedit,
float fsize = UI_GetThemeValuef(TH_FACEDOT_SIZE);
if (pass==0) {
- if(v3d->zbuf && !(v3d->flag&V3D_ZBUF_SELECT)) {
+ if (v3d->zbuf && !(v3d->flag&V3D_ZBUF_SELECT)) {
glDisable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
- } else {
+ }
+ else {
continue;
}
size = (size > 2.1f ? size/2.0f:size);
fsize = (fsize > 2.1f ? fsize/2.0f:fsize);
col[3] = fcol[3] = 100;
- } else {
+ }
+ else {
col[3] = fcol[3] = 255;
}
- if(ts->selectmode & SCE_SELECT_VERTEX) {
+ if (ts->selectmode & SCE_SELECT_VERTEX) {
glPointSize(size);
glColor4ubv(col);
draw_dm_verts(em, cageDM, sel, eve_act);
}
- if(check_ob_drawface_dot(scene, v3d, obedit->dt)) {
+ if (check_ob_drawface_dot(scene, v3d, obedit->dt)) {
glPointSize(fsize);
glColor4ubv(fcol);
draw_dm_face_centers(em, cageDM, sel);
@@ -2660,7 +2679,7 @@ static void draw_em_fancy_verts(Scene *scene, View3D *v3d, Object *obedit,
}
}
- if(v3d->zbuf) glDepthMask(1);
+ if (v3d->zbuf) glDepthMask(1);
glPointSize(1.0);
}
@@ -2690,23 +2709,26 @@ static void draw_em_fancy_edges(BMEditMesh *em, Scene *scene, View3D *v3d,
glDisable(GL_DEPTH_TEST);
selCol[3] = 85;
if (!sel_only) wireCol[3] = 85;
- } else {
+ }
+ else {
continue;
}
- } else {
+ }
+ else {
selCol[3] = 255;
if (!sel_only) wireCol[3] = 255;
}
- if(ts->selectmode == SCE_SELECT_FACE) {
+ if (ts->selectmode == SCE_SELECT_FACE) {
draw_dm_edges_sel(em, cageDM, wireCol, selCol, actCol, eed_act);
}
- else if( (me->drawflag & ME_DRAWEDGES) || (ts->selectmode & SCE_SELECT_EDGE) ) {
- if(cageDM->drawMappedEdgesInterp && (ts->selectmode & SCE_SELECT_VERTEX)) {
+ else if ( (me->drawflag & ME_DRAWEDGES) || (ts->selectmode & SCE_SELECT_EDGE) ) {
+ if (cageDM->drawMappedEdgesInterp && (ts->selectmode & SCE_SELECT_VERTEX)) {
glShadeModel(GL_SMOOTH);
draw_dm_edges_sel_interp(em, cageDM, wireCol, selCol);
glShadeModel(GL_FLAT);
- } else {
+ }
+ else {
draw_dm_edges_sel(em, cageDM, wireCol, selCol, actCol, eed_act);
}
}
@@ -2748,15 +2770,15 @@ static void draw_em_measure_stats(View3D *v3d, Object *ob, BMEditMesh *em, UnitS
else if (grid < 10.0f) conv_float= "%.3g";
else conv_float= "%.2g";
- if(me->drawflag & ME_DRAWEXTRA_EDGELEN) {
+ if (me->drawflag & ME_DRAWEXTRA_EDGELEN) {
BMEdge *eed;
UI_GetThemeColor3ubv(TH_DRAWEXTRA_EDGELEN, col);
eed = BM_iter_new(&iter, em->bm, BM_EDGES_OF_MESH, NULL);
- for(; eed; eed=BM_iter_step(&iter)) {
+ for (; eed; eed=BM_iter_step(&iter)) {
/* draw selected edges, or edges next to selected verts while draging */
- if(BM_elem_flag_test(eed, BM_ELEM_SELECT) ||
+ if (BM_elem_flag_test(eed, BM_ELEM_SELECT) ||
(do_moving && (BM_elem_flag_test(eed->v1, BM_ELEM_SELECT) || BM_elem_flag_test(eed->v2, BM_ELEM_SELECT) ))) {
copy_v3_v3(v1, eed->v1->co);
@@ -2764,12 +2786,12 @@ static void draw_em_measure_stats(View3D *v3d, Object *ob, BMEditMesh *em, UnitS
mid_v3_v3v3(vmid, v1, v2);
- if(do_global) {
+ if (do_global) {
mul_mat3_m4_v3(ob->obmat, v1);
mul_mat3_m4_v3(ob->obmat, v2);
}
- if(unit->system) {
+ if (unit->system) {
bUnit_AsString(numstr, sizeof(numstr), len_v3v3(v1, v2) * unit->scale_length, 3,
unit->system, B_UNIT_LENGTH, do_split, FALSE);
}
@@ -2782,7 +2804,7 @@ static void draw_em_measure_stats(View3D *v3d, Object *ob, BMEditMesh *em, UnitS
}
}
- if(me->drawflag & ME_DRAWEXTRA_FACEAREA) {
+ if (me->drawflag & ME_DRAWEXTRA_FACEAREA) {
/* would be nice to use BM_face_area_calc, but that is for 2d faces
so instead add up tessalation triangle areas */
BMFace *f;
@@ -2791,7 +2813,7 @@ static void draw_em_measure_stats(View3D *v3d, Object *ob, BMEditMesh *em, UnitS
#define DRAW_EM_MEASURE_STATS_FACEAREA() \
if (BM_elem_flag_test(f, BM_ELEM_SELECT)) { \
mul_v3_fl(vmid, 1.0/n); \
- if(unit->system) \
+ if (unit->system) \
bUnit_AsString(numstr, sizeof(numstr), area*unit->scale_length, \
3, unit->system, B_UNIT_LENGTH, do_split, FALSE); \
else \
@@ -2805,9 +2827,9 @@ static void draw_em_measure_stats(View3D *v3d, Object *ob, BMEditMesh *em, UnitS
area = 0.0;
zero_v3(vmid);
n = 0;
- for(i = 0; i < em->tottri; i++) {
+ for (i = 0; i < em->tottri; i++) {
BMLoop **l = em->looptris[i];
- if(f && l[0]->f != f) {
+ if (f && l[0]->f != f) {
DRAW_EM_MEASURE_STATS_FACEAREA();
zero_v3(vmid);
area = 0.0;
@@ -2818,7 +2840,7 @@ static void draw_em_measure_stats(View3D *v3d, Object *ob, BMEditMesh *em, UnitS
copy_v3_v3(v1, l[0]->v->co);
copy_v3_v3(v2, l[1]->v->co);
copy_v3_v3(v3, l[2]->v->co);
- if(do_global) {
+ if (do_global) {
mul_mat3_m4_v3(ob->obmat, v1);
mul_mat3_m4_v3(ob->obmat, v2);
mul_mat3_m4_v3(ob->obmat, v3);
@@ -2830,26 +2852,26 @@ static void draw_em_measure_stats(View3D *v3d, Object *ob, BMEditMesh *em, UnitS
n += 3;
}
- if(f){
+ if (f) {
DRAW_EM_MEASURE_STATS_FACEAREA();
}
#undef DRAW_EM_MEASURE_STATS_FACEAREA
}
- if(me->drawflag & ME_DRAWEXTRA_FACEANG) {
+ if (me->drawflag & ME_DRAWEXTRA_FACEANG) {
BMFace *efa;
UI_GetThemeColor3ubv(TH_DRAWEXTRA_FACEANG, col);
- for(efa = BM_iter_new(&iter, em->bm, BM_FACES_OF_MESH, NULL);
+ for (efa = BM_iter_new(&iter, em->bm, BM_FACES_OF_MESH, NULL);
efa; efa=BM_iter_step(&iter)) {
BMIter liter;
BMLoop *loop;
BM_face_center_bounds_calc(em->bm, efa, vmid);
- for(loop = BM_iter_new(&liter, em->bm, BM_LOOPS_OF_FACE, efa);
+ for (loop = BM_iter_new(&liter, em->bm, BM_LOOPS_OF_FACE, efa);
loop; loop = BM_iter_step(&liter)) {
float v1[3], v2[3], v3[3];
@@ -2858,7 +2880,7 @@ static void draw_em_measure_stats(View3D *v3d, Object *ob, BMEditMesh *em, UnitS
copy_v3_v3(v2, loop->v->co);
copy_v3_v3(v3, loop->next->v->co);
- if(do_global){
+ if (do_global) {
mul_mat3_m4_v3(ob->obmat, v1);
mul_mat3_m4_v3(ob->obmat, v2);
mul_mat3_m4_v3(ob->obmat, v3);
@@ -2962,18 +2984,20 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d,
/* face is handeled above */
/*if (ese->type == BM_FACE ) {
efa_act = (BMFace *)ese->data;
- } else */ if ( ese->htype == BM_EDGE ) {
+ }
+ else */ if ( ese->htype == BM_EDGE ) {
eed_act = (BMEdge *)ese->data;
- } else if ( ese->htype == BM_VERT ) {
+ }
+ else if ( ese->htype == BM_VERT ) {
eve_act = (BMVert *)ese->data;
}
}
EDBM_init_index_arrays(em, 1, 1, 1);
- if(dt>OB_WIRE) {
- if(CHECK_OB_DRAWTEXTURE(v3d, dt)) {
- if(draw_glsl_material(scene, ob, v3d, dt)) {
+ if (dt>OB_WIRE) {
+ if (CHECK_OB_DRAWTEXTURE(v3d, dt)) {
+ if (draw_glsl_material(scene, ob, v3d, dt)) {
glFrontFace((ob->transflag&OB_NEG_SCALE)?GL_CW:GL_CCW);
finalDM->drawMappedFacesGLSL(finalDM, GPU_enable_material,
@@ -3013,7 +3037,7 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d,
}
}
- if(me->drawflag & ME_DRAWFACES) { /* transp faces */
+ if (me->drawflag & ME_DRAWFACES) { /* transp faces */
unsigned char col1[4], col2[4], col3[4];
UI_GetThemeColor4ubv(TH_FACE, col1);
@@ -3031,7 +3055,8 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d,
glDisable(GL_BLEND);
glDepthMask(1); // restore write in zbuffer
- } else if (efa_act) {
+ }
+ else if (efa_act) {
/* even if draw faces is off it would be nice to draw the stipple face
* Make all other faces zero alpha except for the active
* */
@@ -3050,14 +3075,15 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d,
}
/* here starts all fancy draw-extra over */
- if((me->drawflag & ME_DRAWEDGES)==0 && CHECK_OB_DRAWTEXTURE(v3d, dt)) {
+ if ((me->drawflag & ME_DRAWEDGES)==0 && CHECK_OB_DRAWTEXTURE(v3d, dt)) {
/* we are drawing textures and 'ME_DRAWEDGES' is disabled, dont draw any edges */
/* only draw selected edges otherwise there is no way of telling if a face is selected */
draw_em_fancy_edges(em, scene, v3d, me, cageDM, 1, eed_act);
- } else {
- if(me->drawflag & ME_DRAWSEAMS) {
+ }
+ else {
+ if (me->drawflag & ME_DRAWSEAMS) {
UI_ThemeColor(TH_EDGE_SEAM);
glLineWidth(2);
@@ -3067,7 +3093,7 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d,
glLineWidth(1);
}
- if(me->drawflag & ME_DRAWSHARP) {
+ if (me->drawflag & ME_DRAWSHARP) {
UI_ThemeColor(TH_EDGE_SHARP);
glLineWidth(2);
@@ -3077,23 +3103,23 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d,
glLineWidth(1);
}
- if(me->drawflag & ME_DRAWCREASES && CustomData_has_layer(&em->bm->edata, CD_CREASE)) {
+ if (me->drawflag & ME_DRAWCREASES && CustomData_has_layer(&em->bm->edata, CD_CREASE)) {
draw_dm_creases(em, cageDM);
}
- if(me->drawflag & ME_DRAWBWEIGHTS) {
+ if (me->drawflag & ME_DRAWBWEIGHTS) {
draw_dm_bweights(em, scene, cageDM);
}
draw_em_fancy_edges(em, scene, v3d, me, cageDM, 0, eed_act);
}
- if(em) {
+ if (em) {
draw_em_fancy_verts(scene, v3d, ob, em, cageDM, eve_act);
- if(me->drawflag & ME_DRAWNORMALS) {
+ if (me->drawflag & ME_DRAWNORMALS) {
UI_ThemeColor(TH_NORMAL);
draw_dm_face_normals(em, scene, cageDM);
}
- if(me->drawflag & ME_DRAW_VNORMALS) {
+ if (me->drawflag & ME_DRAW_VNORMALS) {
UI_ThemeColor(TH_VNORMAL);
draw_dm_vert_normals(em, scene, cageDM);
}
@@ -3110,7 +3136,7 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d,
}
}
- if(dt>OB_WIRE) {
+ if (dt>OB_WIRE) {
glDepthMask(1);
bglPolygonOffset(rv3d->dist, 0.0);
GPU_disable_material();
@@ -3124,13 +3150,13 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d,
static void draw_mesh_object_outline(View3D *v3d, Object *ob, DerivedMesh *dm)
{
- if(v3d->transp==0) { // not when we draw the transparent pass
+ if (v3d->transp==0) { // not when we draw the transparent pass
glLineWidth(UI_GetThemeValuef(TH_OUTLINE_WIDTH) * 2.0f);
glDepthMask(0);
/* if transparent, we cannot draw the edges for solid select... edges have no material info.
drawFacesSolid() doesn't draw the transparent faces */
- if(ob->dtx & OB_DRAWTRANSP) {
+ if (ob->dtx & OB_DRAWTRANSP) {
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
dm->drawFacesSolid(dm, NULL, 0, GPU_enable_material);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
@@ -3163,12 +3189,12 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
const short is_obact= (ob == OBACT);
int draw_flags = (is_obact && paint_facesel_test(ob)) ? DRAW_FACE_SELECT : 0;
- if(!dm)
+ if (!dm)
return;
/* Check to draw dynamic paint colors (or weights from WeightVG modifiers).
* Note: Last "preview-active" modifier in stack will win! */
- if(DM_get_tessface_data_layer(dm, CD_WEIGHT_MCOL) && modifiers_isPreview(ob))
+ if (DM_get_tessface_data_layer(dm, CD_WEIGHT_MCOL) && modifiers_isPreview(ob))
draw_flags |= DRAW_MODIFIERS_PREVIEW;
/* Unwanted combination */
@@ -3186,16 +3212,16 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
/* vertexpaint, faceselect wants this, but it doesnt work for shaded? */
glFrontFace((ob->transflag&OB_NEG_SCALE)?GL_CW:GL_CCW);
- if(dt==OB_BOUNDBOX) {
- if((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= OB_WIRE)==0)
+ if (dt==OB_BOUNDBOX) {
+ if ((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= OB_WIRE)==0)
draw_bounding_volume(scene, ob, ob->boundtype);
}
- else if(hasHaloMat || (totface==0 && totedge==0)) {
+ else if (hasHaloMat || (totface==0 && totedge==0)) {
glPointSize(1.5);
dm->drawVerts(dm);
glPointSize(1.0);
}
- else if(dt==OB_WIRE || totface==0) {
+ else if (dt==OB_WIRE || totface==0) {
draw_wire= OBDRAW_WIRE_ON; /* draw wire only, no depth buffer stuff */
}
else if ( (draw_flags & DRAW_FACE_SELECT || (is_obact && ob->mode & OB_MODE_TEXTURE_PAINT)) ||
@@ -3210,11 +3236,11 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
draw_mesh_object_outline(v3d, ob, dm);
}
- if(draw_glsl_material(scene, ob, v3d, dt) && !(draw_flags & DRAW_MODIFIERS_PREVIEW)) {
+ if (draw_glsl_material(scene, ob, v3d, dt) && !(draw_flags & DRAW_MODIFIERS_PREVIEW)) {
glFrontFace((ob->transflag&OB_NEG_SCALE)?GL_CW:GL_CCW);
dm->drawFacesGLSL(dm, GPU_enable_material);
-// if(get_ob_property(ob, "Text"))
+// if (get_ob_property(ob, "Text"))
// XXX draw_mesh_text(ob, 1);
GPU_disable_material();
@@ -3224,18 +3250,18 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
draw_mesh_textured(scene, v3d, rv3d, ob, dm, draw_flags);
}
- if(!(draw_flags & DRAW_FACE_SELECT)) {
- if(base->flag & SELECT)
+ if (!(draw_flags & DRAW_FACE_SELECT)) {
+ if (base->flag & SELECT)
UI_ThemeColor(is_obact ? TH_ACTIVE : TH_SELECT);
else
UI_ThemeColor(TH_WIRE);
- if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0)
+ if ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0)
dm->drawLooseEdges(dm);
}
}
- else if(dt==OB_SOLID) {
- if(is_obact && ob->mode & OB_MODE_WEIGHT_PAINT) {
+ else if (dt==OB_SOLID) {
+ if (is_obact && ob->mode & OB_MODE_WEIGHT_PAINT) {
/* weight paint in solid mode, special case. focus on making the weights clear
* rather than the shading, this is also forced in wire view */
GPU_enable_material(0, NULL);
@@ -3316,13 +3342,13 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
glEnable(GL_LIGHTING);
glFrontFace((ob->transflag&OB_NEG_SCALE)?GL_CW:GL_CCW);
- if(ob->sculpt && (p=paint_get_active(scene))) {
+ if (ob->sculpt && (p=paint_get_active(scene))) {
float planes[4][4];
float (*fpl)[4] = NULL;
int fast= (p->flags & PAINT_FAST_NAVIGATE) && (rv3d->rflag & RV3D_NAVIGATING);
- if(ob->sculpt->partial_redraw) {
- if(ar->do_draw & RGN_DRAW_PARTIAL) {
+ if (ob->sculpt->partial_redraw) {
+ if (ar->do_draw & RGN_DRAW_PARTIAL) {
sculpt_get_redraw_planes(planes, ar, rv3d, ob);
fpl = planes;
ob->sculpt->partial_redraw = 0;
@@ -3339,18 +3365,19 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
glFrontFace(GL_CCW);
glDisable(GL_LIGHTING);
- if(base->flag & SELECT) {
+ if (base->flag & SELECT) {
UI_ThemeColor(is_obact ? TH_ACTIVE : TH_SELECT);
- } else {
+ }
+ else {
UI_ThemeColor(TH_WIRE);
}
- if(!ob->sculpt && (v3d->flag2 & V3D_RENDER_OVERRIDE)==0)
+ if (!ob->sculpt && (v3d->flag2 & V3D_RENDER_OVERRIDE)==0)
dm->drawLooseEdges(dm);
}
}
- else if(dt==OB_PAINT) {
+ else if (dt==OB_PAINT) {
if (is_obact) {
- if(ob && ob->mode & OB_MODE_WEIGHT_PAINT) {
+ if (ob && ob->mode & OB_MODE_WEIGHT_PAINT) {
/* enforce default material settings */
GPU_enable_material(0, NULL);
@@ -3370,8 +3397,8 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
GPU_disable_material();
}
- else if(ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_TEXTURE_PAINT)) {
- if(me->mloopcol)
+ else if (ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_TEXTURE_PAINT)) {
+ if (me->mloopcol)
dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, GPU_enable_material, NULL, NULL, 1);
else {
glColor3f(1.0f, 1.0f, 1.0f);
@@ -3383,20 +3410,21 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
/* set default draw color back for wire or for draw-extra later on */
if (dt!=OB_WIRE) {
- if(base->flag & SELECT) {
+ if (base->flag & SELECT) {
if (is_obact && ob->flag & OB_FROMGROUP)
UI_ThemeColor(TH_GROUP_ACTIVE);
- else if(ob->flag & OB_FROMGROUP)
+ else if (ob->flag & OB_FROMGROUP)
UI_ThemeColorShade(TH_GROUP_ACTIVE, -16);
- else if(flag!=DRAW_CONSTCOLOR)
+ else if (flag!=DRAW_CONSTCOLOR)
UI_ThemeColor(is_obact ? TH_ACTIVE : TH_SELECT);
else
glColor3ub(80,80,80);
- } else {
+ }
+ else {
if (ob->flag & OB_FROMGROUP)
UI_ThemeColor(TH_GROUP);
else {
- if(ob->dtx & OB_DRAWWIRE && flag==DRAW_CONSTCOLOR)
+ if (ob->dtx & OB_DRAWWIRE && flag==DRAW_CONSTCOLOR)
glColor3ub(80,80,80);
else
UI_ThemeColor(TH_WIRE);
@@ -3408,7 +3436,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
/* When using wireframe object traw in particle edit mode
* the mesh gets in the way of seeing the particles, fade the wire color
* with the background. */
- if(is_obact && (ob->mode & OB_MODE_PARTICLE_EDIT)) {
+ if (is_obact && (ob->mode & OB_MODE_PARTICLE_EDIT)) {
float col_wire[4], col_bg[4], col[3];
UI_GetThemeColor3fv(TH_BACK, col_bg);
@@ -3431,7 +3459,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
glDepthMask(0); // disable write in zbuffer, selected edge wires show better
}
- if((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= OB_SOLID)==0)
+ if ((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= OB_SOLID)==0)
dm->drawEdges(dm, (dt==OB_WIRE || totface==0), me->drawflag & ME_ALLEDGES);
if (dt!=OB_WIRE && (draw_wire == OBDRAW_WIRE_ON_DEPTH)) {
@@ -3440,7 +3468,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
}
}
- if(is_obact && paint_vertsel_test(ob)) {
+ if (is_obact && paint_vertsel_test(ob)) {
glColor3f(0.0f, 0.0f, 0.0f);
glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE));
@@ -3464,7 +3492,7 @@ static int draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
/* If we are drawing shadows and any of the materials don't cast a shadow,
* then don't draw the object */
if (v3d->flag2 & V3D_RENDER_SHADOW) {
- for(i=0; i<ob->totcol; ++i) {
+ for (i=0; i<ob->totcol; ++i) {
Material *ma= give_current_material(ob, i);
if (ma && !(ma->mode & MA_SHADBUF)) {
return 1;
@@ -3472,13 +3500,13 @@ static int draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
}
}
- if(obedit && ob!=obedit && ob->data==obedit->data) {
- if(ob_get_key(ob) || ob_get_key(obedit));
- else if(ob->modifiers.first || obedit->modifiers.first);
+ if (obedit && ob!=obedit && ob->data==obedit->data) {
+ if (ob_get_key(ob) || ob_get_key(obedit));
+ else if (ob->modifiers.first || obedit->modifiers.first);
else drawlinked= 1;
}
- if(ob==obedit || drawlinked) {
+ if (ob==obedit || drawlinked) {
DerivedMesh *finalDM, *cageDM;
if (obedit!=ob)
@@ -3487,7 +3515,7 @@ static int draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
cageDM = editbmesh_get_derived_cage_and_final(scene, ob, em, &finalDM,
scene->customdata_mask);
- if(dt>OB_WIRE) {
+ if (dt>OB_WIRE) {
glsl = draw_glsl_material(scene, ob, v3d, dt);
GPU_begin_object_materials(v3d, rv3d, scene, ob, glsl, NULL);
@@ -3502,11 +3530,11 @@ static int draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
}
else {
/* don't create boundbox here with mesh_get_bb(), the derived system will make it, puts deformed bb's OK */
- if(me->totpoly <= 4 || ED_view3d_boundbox_clip(rv3d, ob->obmat, (ob->bb)? ob->bb: me->bb)) {
+ if (me->totpoly <= 4 || ED_view3d_boundbox_clip(rv3d, ob->obmat, (ob->bb)? ob->bb: me->bb)) {
glsl = draw_glsl_material(scene, ob, v3d, dt);
check_alpha = check_alpha_pass(base);
- if(dt==OB_SOLID || glsl) {
+ if (dt==OB_SOLID || glsl) {
GPU_begin_object_materials(v3d, rv3d, scene, ob, glsl,
(check_alpha)? &do_alpha_after: NULL);
}
@@ -3515,22 +3543,22 @@ static int draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
GPU_end_object_materials();
- if(me->totvert==0) retval= 1;
+ if (me->totvert==0) retval= 1;
}
}
/* GPU_begin_object_materials checked if this is needed */
- if(do_alpha_after) {
- if(ob->dtx & OB_DRAWXRAY) {
+ if (do_alpha_after) {
+ if (ob->dtx & OB_DRAWXRAY) {
add_view3d_after(&v3d->afterdraw_xraytransp, base, flag);
}
else {
add_view3d_after(&v3d->afterdraw_transp, base, flag);
}
}
- else if(ob->dtx & OB_DRAWXRAY && ob->dtx & OB_DRAWTRANSP) {
+ else if (ob->dtx & OB_DRAWXRAY && ob->dtx & OB_DRAWTRANSP) {
/* special case xray+transp when alpha is 1.0, without this the object vanishes */
- if(v3d->xray == 0 && v3d->transp == 0) {
+ if (v3d->xray == 0 && v3d->transp == 0) {
add_view3d_after(&v3d->afterdraw_xray, base, flag);
}
}
@@ -3550,13 +3578,13 @@ static int drawDispListwire(ListBase *dlbase)
int parts, nr;
float *data;
- if(dlbase==NULL) return 1;
+ if (dlbase==NULL) return 1;
glEnableClientState(GL_VERTEX_ARRAY);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
- for(dl= dlbase->first; dl; dl= dl->next) {
- if(dl->parts==0 || dl->nr==0)
+ for (dl= dlbase->first; dl; dl= dl->next) {
+ if (dl->parts==0 || dl->nr==0)
continue;
data= dl->verts;
@@ -3566,7 +3594,7 @@ static int drawDispListwire(ListBase *dlbase)
glVertexPointer(3, GL_FLOAT, 0, data);
- for(parts=0; parts<dl->parts; parts++)
+ for (parts=0; parts<dl->parts; parts++)
glDrawArrays(GL_LINE_STRIP, parts*dl->nr, dl->nr);
break;
@@ -3574,7 +3602,7 @@ static int drawDispListwire(ListBase *dlbase)
glVertexPointer(3, GL_FLOAT, 0, data);
- for(parts=0; parts<dl->parts; parts++)
+ for (parts=0; parts<dl->parts; parts++)
glDrawArrays(GL_LINE_LOOP, parts*dl->nr, dl->nr);
break;
@@ -3582,23 +3610,23 @@ static int drawDispListwire(ListBase *dlbase)
glVertexPointer(3, GL_FLOAT, 0, data);
- for(parts=0; parts<dl->parts; parts++) {
- if(dl->flag & DL_CYCL_U)
+ for (parts=0; parts<dl->parts; parts++) {
+ if (dl->flag & DL_CYCL_U)
glDrawArrays(GL_LINE_LOOP, parts*dl->nr, dl->nr);
else
glDrawArrays(GL_LINE_STRIP, parts*dl->nr, dl->nr);
}
- for(nr=0; nr<dl->nr; nr++) {
+ for (nr=0; nr<dl->nr; nr++) {
int ofs= 3*dl->nr;
data= ( dl->verts )+3*nr;
parts= dl->parts;
- if(dl->flag & DL_CYCL_V) glBegin(GL_LINE_LOOP);
+ if (dl->flag & DL_CYCL_V) glBegin(GL_LINE_LOOP);
else glBegin(GL_LINE_STRIP);
- while(parts--) {
+ while (parts--) {
glVertex3fv(data);
data+=ofs;
}
@@ -3606,7 +3634,7 @@ static int drawDispListwire(ListBase *dlbase)
/* (ton) this code crashes for me when resolv is 86 or higher... no clue */
// glVertexPointer(3, GL_FLOAT, sizeof(float)*3*dl->nr, data + 3*nr);
-// if(dl->flag & DL_CYCL_V)
+// if (dl->flag & DL_CYCL_V)
// glDrawArrays(GL_LINE_LOOP, 0, dl->parts);
// else
// glDrawArrays(GL_LINE_STRIP, 0, dl->parts);
@@ -3614,14 +3642,14 @@ static int drawDispListwire(ListBase *dlbase)
break;
case DL_INDEX3:
- if(draw_index_wire) {
+ if (draw_index_wire) {
glVertexPointer(3, GL_FLOAT, 0, dl->verts);
glDrawElements(GL_TRIANGLES, 3*dl->parts, GL_UNSIGNED_INT, dl->index);
}
break;
case DL_INDEX4:
- if(draw_index_wire) {
+ if (draw_index_wire) {
glVertexPointer(3, GL_FLOAT, 0, dl->verts);
glDrawElements(GL_QUADS, 4*dl->parts, GL_UNSIGNED_INT, dl->index);
}
@@ -3642,7 +3670,7 @@ static void drawDispListsolid(ListBase *lb, Object *ob, int glsl)
float *data, curcol[4];
float *ndata;
- if(lb==NULL) return;
+ if (lb==NULL) return;
/* for drawing wire */
glGetFloatv(GL_CURRENT_COLOR, curcol);
@@ -3650,21 +3678,21 @@ static void drawDispListsolid(ListBase *lb, Object *ob, int glsl)
glEnable(GL_LIGHTING);
glEnableClientState(GL_VERTEX_ARRAY);
- if(ob->transflag & OB_NEG_SCALE) glFrontFace(GL_CW);
+ if (ob->transflag & OB_NEG_SCALE) glFrontFace(GL_CW);
else glFrontFace(GL_CCW);
- if(ob->type==OB_MBALL) { // mball always smooth shaded
+ if (ob->type==OB_MBALL) { // mball always smooth shaded
glShadeModel(GL_SMOOTH);
}
dl= lb->first;
- while(dl) {
+ while (dl) {
data= dl->verts;
ndata= dl->nors;
switch(dl->type) {
case DL_SEGM:
- if(ob->type==OB_SURF) {
+ if (ob->type==OB_SURF) {
int nr;
glDisable(GL_LIGHTING);
@@ -3674,7 +3702,7 @@ static void drawDispListsolid(ListBase *lb, Object *ob, int glsl)
// glDrawArrays(GL_LINE_STRIP, 0, dl->nr);
glBegin(GL_LINE_STRIP);
- for(nr= dl->nr; nr; nr--, data+=3)
+ for (nr= dl->nr; nr; nr--, data+=3)
glVertex3fv(data);
glEnd();
@@ -3682,7 +3710,7 @@ static void drawDispListsolid(ListBase *lb, Object *ob, int glsl)
}
break;
case DL_POLY:
- if(ob->type==OB_SURF) {
+ if (ob->type==OB_SURF) {
int nr;
glDisable(GL_LIGHTING);
@@ -3692,7 +3720,7 @@ static void drawDispListsolid(ListBase *lb, Object *ob, int glsl)
//glDrawArrays(GL_LINE_LOOP, 0, dl->nr);
glBegin(GL_LINE_LOOP);
- for(nr= dl->nr; nr; nr--, data+=3)
+ for (nr= dl->nr; nr; nr--, data+=3)
glVertex3fv(data);
glEnd();
@@ -3701,10 +3729,10 @@ static void drawDispListsolid(ListBase *lb, Object *ob, int glsl)
}
case DL_SURF:
- if(dl->index) {
+ if (dl->index) {
GPU_enable_material(dl->col+1, (glsl)? &gattribs: NULL);
- if(dl->rt & CU_SMOOTH) glShadeModel(GL_SMOOTH);
+ if (dl->rt & CU_SMOOTH) glShadeModel(GL_SMOOTH);
else glShadeModel(GL_FLAT);
glEnableClientState(GL_NORMAL_ARRAY);
@@ -3721,7 +3749,7 @@ static void drawDispListsolid(ListBase *lb, Object *ob, int glsl)
glVertexPointer(3, GL_FLOAT, 0, dl->verts);
/* voor polys only one normal needed */
- if(index3_nors_incr) {
+ if (index3_nors_incr) {
glEnableClientState(GL_NORMAL_ARRAY);
glNormalPointer(GL_FLOAT, 0, dl->nors);
}
@@ -3730,7 +3758,7 @@ static void drawDispListsolid(ListBase *lb, Object *ob, int glsl)
glDrawElements(GL_TRIANGLES, 3*dl->parts, GL_UNSIGNED_INT, dl->index);
- if(index3_nors_incr)
+ if (index3_nors_incr)
glDisableClientState(GL_NORMAL_ARRAY);
break;
@@ -3771,11 +3799,11 @@ static int drawCurveDerivedMesh(Scene *scene, View3D *v3d, RegionView3D *rv3d, B
return 1;
}
- if(dt>OB_WIRE && dm->getNumTessFaces(dm)) {
+ if (dt>OB_WIRE && dm->getNumTessFaces(dm)) {
int glsl = draw_glsl_material(scene, ob, v3d, dt);
GPU_begin_object_materials(v3d, rv3d, scene, ob, glsl, NULL);
- if(!glsl) {
+ if (!glsl) {
glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 0);
glEnable(GL_LIGHTING);
dm->drawFacesSolid(dm, NULL, 0, GPU_enable_material);
@@ -3785,8 +3813,9 @@ static int drawCurveDerivedMesh(Scene *scene, View3D *v3d, RegionView3D *rv3d, B
dm->drawFacesGLSL(dm, GPU_enable_material);
GPU_end_object_materials();
- } else {
- if((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= OB_SOLID)==0)
+ }
+ else {
+ if ((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= OB_SOLID)==0)
drawCurveDMWired (ob);
}
@@ -3815,22 +3844,22 @@ static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *bas
lb= &ob->disp;
- if(solid) {
+ if (solid) {
dl= lb->first;
- if(dl==NULL) return 1;
+ if (dl==NULL) return 1;
- if(dl->nors==NULL) addnormalsDispList(lb);
+ if (dl->nors==NULL) addnormalsDispList(lb);
index3_nors_incr= 0;
- if( displist_has_faces(lb)==0) {
- if(!render_only) {
+ if ( displist_has_faces(lb)==0) {
+ if (!render_only) {
draw_index_wire= 0;
drawDispListwire(lb);
draw_index_wire= 1;
}
}
else {
- if(draw_glsl_material(scene, ob, v3d, dt)) {
+ if (draw_glsl_material(scene, ob, v3d, dt)) {
GPU_begin_object_materials(v3d, rv3d, scene, ob, 1, NULL);
drawDispListsolid(lb, ob, 1);
GPU_end_object_materials();
@@ -3841,7 +3870,7 @@ static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *bas
drawDispListsolid(lb, ob, 0);
GPU_end_object_materials();
}
- if(cu->editnurb && cu->bevobj==NULL && cu->taperobj==NULL && cu->ext1 == 0.0f && cu->ext2 == 0.0f) {
+ if (cu->editnurb && cu->bevobj==NULL && cu->taperobj==NULL && cu->ext1 == 0.0f && cu->ext2 == 0.0f) {
cpack(0);
draw_index_wire= 0;
drawDispListwire(lb);
@@ -3851,7 +3880,7 @@ static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *bas
index3_nors_incr= 1;
}
else {
- if(!render_only || (render_only && displist_has_faces(lb))) {
+ if (!render_only || (render_only && displist_has_faces(lb))) {
draw_index_wire= 0;
retval= drawDispListwire(lb);
draw_index_wire= 1;
@@ -3862,13 +3891,13 @@ static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *bas
lb= &ob->disp;
- if(solid) {
+ if (solid) {
dl= lb->first;
- if(dl==NULL) return 1;
+ if (dl==NULL) return 1;
- if(dl->nors==NULL) addnormalsDispList(lb);
+ if (dl->nors==NULL) addnormalsDispList(lb);
- if(draw_glsl_material(scene, ob, v3d, dt)) {
+ if (draw_glsl_material(scene, ob, v3d, dt)) {
GPU_begin_object_materials(v3d, rv3d, scene, ob, 1, NULL);
drawDispListsolid(lb, ob, 1);
GPU_end_object_materials();
@@ -3886,14 +3915,14 @@ static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *bas
break;
case OB_MBALL:
- if( is_basis_mball(ob)) {
+ if ( is_basis_mball(ob)) {
lb= &ob->disp;
- if(lb->first==NULL) makeDispListMBall(scene, ob);
- if(lb->first==NULL) return 1;
+ if (lb->first==NULL) makeDispListMBall(scene, ob);
+ if (lb->first==NULL) return 1;
- if(solid) {
+ if (solid) {
- if(draw_glsl_material(scene, ob, v3d, dt)) {
+ if (draw_glsl_material(scene, ob, v3d, dt)) {
GPU_begin_object_materials(v3d, rv3d, scene, ob, 1, NULL);
drawDispListsolid(lb, ob, 1);
GPU_end_object_materials();
@@ -3920,7 +3949,7 @@ static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *bas
static void draw_particle_arrays(int draw_as, int totpoint, int ob_dt, int select)
{
/* draw created data arrays */
- switch(draw_as){
+ switch(draw_as) {
case PART_DRAW_AXIS:
case PART_DRAW_CROSS:
glDrawArrays(GL_LINES, 0, 6*totpoint);
@@ -3929,7 +3958,7 @@ static void draw_particle_arrays(int draw_as, int totpoint, int ob_dt, int selec
glDrawArrays(GL_LINES, 0, 2*totpoint);
break;
case PART_DRAW_BB:
- if(ob_dt<=OB_WIRE || select)
+ if (ob_dt<=OB_WIRE || select)
glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
else
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
@@ -3950,22 +3979,22 @@ static void draw_particle(ParticleKey *state, int draw_as, short draw, float pix
float ma_col[3]= {0.0f, 0.0f, 0.0f};
/* null only for PART_DRAW_CIRC */
- if(pdd) {
+ if (pdd) {
vd = pdd->vd;
cd = pdd->cd;
- if(pdd->ma_col) {
+ if (pdd->ma_col) {
copy_v3_v3(ma_col, pdd->ma_col);
}
}
- switch(draw_as){
+ switch(draw_as) {
case PART_DRAW_DOT:
{
- if(vd) {
+ if (vd) {
copy_v3_v3(vd,state->co); pdd->vd+=3;
}
- if(cd) {
+ if (cd) {
copy_v3_v3(cd, pdd->ma_col);
pdd->cd+=3;
}
@@ -3977,8 +4006,8 @@ static void draw_particle(ParticleKey *state, int draw_as, short draw, float pix
vec[0]=2.0f*pixsize;
vec[1]=vec[2]=0.0;
mul_qt_v3(state->rot,vec);
- if(draw_as==PART_DRAW_AXIS) {
- if(cd) {
+ if (draw_as==PART_DRAW_AXIS) {
+ if (cd) {
cd[1]=cd[2]=cd[4]=cd[5]=0.0;
cd[0]=cd[3]=1.0;
cd[6]=cd[8]=cd[9]=cd[11]=0.0;
@@ -3991,7 +4020,7 @@ static void draw_particle(ParticleKey *state, int draw_as, short draw, float pix
copy_v3_v3(vec2,state->co);
}
else {
- if(cd) {
+ if (cd) {
cd[0]=cd[3]=cd[6]=cd[ 9]=cd[12]=cd[15]= ma_col[0];
cd[1]=cd[4]=cd[7]=cd[10]=cd[13]=cd[16]= ma_col[1];
cd[2]=cd[5]=cd[8]=cd[11]=cd[14]=cd[17]= ma_col[2];
@@ -4007,7 +4036,7 @@ static void draw_particle(ParticleKey *state, int draw_as, short draw, float pix
vec[1]=2.0f*pixsize;
vec[0]=vec[2]=0.0;
mul_qt_v3(state->rot,vec);
- if(draw_as==PART_DRAW_AXIS){
+ if (draw_as==PART_DRAW_AXIS) {
copy_v3_v3(vec2,state->co);
}
else sub_v3_v3v3(vec2, state->co, vec);
@@ -4019,7 +4048,7 @@ static void draw_particle(ParticleKey *state, int draw_as, short draw, float pix
vec[2]=2.0f*pixsize;
vec[0]=vec[1]=0.0;
mul_qt_v3(state->rot,vec);
- if(draw_as==PART_DRAW_AXIS){
+ if (draw_as==PART_DRAW_AXIS) {
copy_v3_v3(vec2,state->co);
}
else sub_v3_v3v3(vec2, state->co, vec);
@@ -4034,11 +4063,11 @@ static void draw_particle(ParticleKey *state, int draw_as, short draw, float pix
{
copy_v3_v3(vec,state->vel);
normalize_v3(vec);
- if(draw & PART_DRAW_VEL_LENGTH)
+ if (draw & PART_DRAW_VEL_LENGTH)
mul_v3_fl(vec,len_v3(state->vel));
madd_v3_v3v3fl(pdd->vd, state->co, vec, -draw_line[0]); pdd->vd+=3;
madd_v3_v3v3fl(pdd->vd, state->co, vec, draw_line[1]); pdd->vd+=3;
- if(cd) {
+ if (cd) {
cd[0]=cd[3]= ma_col[0];
cd[1]=cd[4]= ma_col[1];
cd[2]=cd[5]= ma_col[2];
@@ -4054,7 +4083,7 @@ static void draw_particle(ParticleKey *state, int draw_as, short draw, float pix
case PART_DRAW_BB:
{
float xvec[3], yvec[3], zvec[3], bb_center[3];
- if(cd) {
+ if (cd) {
cd[0]=cd[3]=cd[6]=cd[ 9]= ma_col[0];
cd[1]=cd[4]=cd[7]=cd[10]= ma_col[1];
cd[2]=cd[5]=cd[8]=cd[11]= ma_col[2];
@@ -4121,27 +4150,27 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
unsigned char tcol[4]= {0, 0, 0, 255};
/* 1. */
- if(psys==NULL)
+ if (psys==NULL)
return;
part=psys->part;
pars=psys->particles;
- if(part==NULL || !psys_check_enabled(ob, psys))
+ if (part==NULL || !psys_check_enabled(ob, psys))
return;
- if(pars==NULL) return;
+ if (pars==NULL) return;
/* don't draw normal paths in edit mode */
- if(psys_in_edit_mode(scene, psys) && (pset->flag & PE_DRAW_PART)==0)
+ if (psys_in_edit_mode(scene, psys) && (pset->flag & PE_DRAW_PART)==0)
return;
- if(part->draw_as == PART_DRAW_REND)
+ if (part->draw_as == PART_DRAW_REND)
draw_as = part->ren_as;
else
draw_as = part->draw_as;
- if(draw_as == PART_DRAW_NOT)
+ if (draw_as == PART_DRAW_NOT)
return;
/* 2. */
@@ -4150,32 +4179,32 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
sim.psys= psys;
sim.psmd = psys_get_modifier(ob,psys);
- if(part->phystype==PART_PHYS_KEYED){
- if(psys->flag&PSYS_KEYED){
+ if (part->phystype==PART_PHYS_KEYED) {
+ if (psys->flag&PSYS_KEYED) {
psys_count_keyed_targets(&sim);
- if(psys->totkeyed==0)
+ if (psys->totkeyed==0)
return;
}
}
- if(select){
+ if (select) {
select=0;
- if(psys_get_current(ob)==psys)
+ if (psys_get_current(ob)==psys)
select=1;
}
psys->flag|=PSYS_DRAWING;
- if(part->type==PART_HAIR && !psys->childcache)
+ if (part->type==PART_HAIR && !psys->childcache)
totchild=0;
else
totchild=psys->totchild*part->disp/100;
ma= give_current_material(ob,part->omat);
- if(v3d->zbuf) glDepthMask(1);
+ if (v3d->zbuf) glDepthMask(1);
- if((ma) && (part->draw_col == PART_DRAW_COL_MAT)) {
+ if ((ma) && (part->draw_col == PART_DRAW_COL_MAT)) {
rgb_float_to_uchar(tcol, &(ma->r));
copy_v3_v3(ma_col, &ma->r);
}
@@ -4184,7 +4213,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
timestep= psys_get_timestep(&sim);
- if( (base->flag & OB_FROMDUPLI) && (ob->flag & OB_FROMGROUP) ) {
+ if ( (base->flag & OB_FROMDUPLI) && (ob->flag & OB_FROMGROUP) ) {
float mat[4][4];
mult_m4_m4m4(mat, ob->obmat, psys->imat);
glMultMatrixf(mat);
@@ -4197,13 +4226,13 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
cfra= BKE_curframe(scene);
- if(draw_as==PART_DRAW_PATH && psys->pathcache==NULL && psys->childcache==NULL)
+ if (draw_as==PART_DRAW_PATH && psys->pathcache==NULL && psys->childcache==NULL)
draw_as=PART_DRAW_DOT;
/* 3. */
- switch(draw_as){
+ switch(draw_as) {
case PART_DRAW_DOT:
- if(part->draw_size)
+ if (part->draw_size)
glPointSize(part->draw_size);
else
glPointSize(2.0); /* default dot size */
@@ -4223,33 +4252,33 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
else
pixsize_scale = part->draw_size;
- if(draw_as==PART_DRAW_AXIS)
+ if (draw_as==PART_DRAW_AXIS)
create_cdata = 1;
break;
case PART_DRAW_OB:
- if(part->dup_ob==NULL)
+ if (part->dup_ob==NULL)
draw_as=PART_DRAW_DOT;
else
draw_as=0;
break;
case PART_DRAW_GR:
- if(part->dup_group==NULL)
+ if (part->dup_group==NULL)
draw_as=PART_DRAW_DOT;
else
draw_as=0;
break;
case PART_DRAW_BB:
- if(v3d->camera==NULL && part->bb_ob==NULL){
+ if (v3d->camera==NULL && part->bb_ob==NULL) {
printf("Billboards need an active camera or a target object!\n");
draw_as=part->draw_as=PART_DRAW_DOT;
- if(part->draw_size)
+ if (part->draw_size)
glPointSize(part->draw_size);
else
glPointSize(2.0); /* default dot size */
}
- else if(part->bb_ob)
+ else if (part->bb_ob)
bb.ob=part->bb_ob;
else
bb.ob=v3d->camera;
@@ -4264,30 +4293,30 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
need_v=1;
break;
}
- if(part->draw & PART_DRAW_SIZE && part->draw_as!=PART_DRAW_CIRC){
+ if (part->draw & PART_DRAW_SIZE && part->draw_as!=PART_DRAW_CIRC) {
copy_m4_m4(imat, rv3d->viewinv);
normalize_v3(imat[0]);
normalize_v3(imat[1]);
}
- if(ELEM3(draw_as, PART_DRAW_DOT, PART_DRAW_CROSS, PART_DRAW_LINE)
+ if (ELEM3(draw_as, PART_DRAW_DOT, PART_DRAW_CROSS, PART_DRAW_LINE)
&& part->draw_col > PART_DRAW_COL_MAT)
create_cdata = 1;
- if(!create_cdata && pdd && pdd->cdata) {
+ if (!create_cdata && pdd && pdd->cdata) {
MEM_freeN(pdd->cdata);
pdd->cdata = pdd->cd = NULL;
}
/* 4. */
- if(draw_as && ELEM(draw_as, PART_DRAW_PATH, PART_DRAW_CIRC)==0) {
+ if (draw_as && ELEM(draw_as, PART_DRAW_PATH, PART_DRAW_CIRC)==0) {
int tot_vec_size = (totpart + totchild) * 3 * sizeof(float);
int create_ndata = 0;
- if(!pdd)
+ if (!pdd)
pdd = psys->pdd = MEM_callocN(sizeof(ParticleDrawData), "ParticlDrawData");
- if(part->draw_as == PART_DRAW_REND && part->trail_count > 1) {
+ if (part->draw_as == PART_DRAW_REND && part->trail_count > 1) {
tot_vec_size *= part->trail_count;
psys_make_temp_pointcache(ob, psys);
}
@@ -4296,7 +4325,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
case PART_DRAW_AXIS:
case PART_DRAW_CROSS:
tot_vec_size *= 6;
- if(draw_as != PART_DRAW_CROSS)
+ if (draw_as != PART_DRAW_CROSS)
create_cdata = 1;
break;
case PART_DRAW_LINE:
@@ -4308,22 +4337,23 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
break;
}
- if(pdd->tot_vec_size != tot_vec_size)
+ if (pdd->tot_vec_size != tot_vec_size)
psys_free_pdd(psys);
- if(!pdd->vdata)
+ if (!pdd->vdata)
pdd->vdata = MEM_callocN(tot_vec_size, "particle_vdata");
- if(create_cdata && !pdd->cdata)
+ if (create_cdata && !pdd->cdata)
pdd->cdata = MEM_callocN(tot_vec_size, "particle_cdata");
- if(create_ndata && !pdd->ndata)
+ if (create_ndata && !pdd->ndata)
pdd->ndata = MEM_callocN(tot_vec_size, "particle_ndata");
- if(part->draw & PART_DRAW_VEL && draw_as != PART_DRAW_LINE) {
- if(!pdd->vedata)
+ if (part->draw & PART_DRAW_VEL && draw_as != PART_DRAW_LINE) {
+ if (!pdd->vedata)
pdd->vedata = MEM_callocN(2 * (totpart + totchild) * 3 * sizeof(float), "particle_vedata");
need_v = 1;
- } else if (pdd->vedata) {
+ }
+ else if (pdd->vedata) {
/* velocity data not needed, so free it */
MEM_freeN(pdd->vedata);
pdd->vedata= NULL;
@@ -4335,36 +4365,36 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
pdd->nd= pdd->ndata;
pdd->tot_vec_size= tot_vec_size;
}
- else if(psys->pdd) {
+ else if (psys->pdd) {
psys_free_pdd(psys);
MEM_freeN(psys->pdd);
pdd = psys->pdd = NULL;
}
- if(pdd) {
+ if (pdd) {
pdd->ma_col= ma_col;
}
psys->lattice= psys_get_lattice(&sim);
/* circles don't use drawdata, so have to add a special case here */
- if((pdd || draw_as==PART_DRAW_CIRC) && draw_as!=PART_DRAW_PATH){
+ if ((pdd || draw_as==PART_DRAW_CIRC) && draw_as!=PART_DRAW_PATH) {
/* 5. */
- if(pdd && (pdd->flag & PARTICLE_DRAW_DATA_UPDATED)
+ if (pdd && (pdd->flag & PARTICLE_DRAW_DATA_UPDATED)
&& (pdd->vedata || part->draw & (PART_DRAW_SIZE|PART_DRAW_NUM|PART_DRAW_HEALTH))==0) {
totpoint = pdd->totpoint; /* draw data is up to date */
}
- else for(a=0,pa=pars; a<totpart+totchild; a++, pa++){
+ else for (a=0,pa=pars; a<totpart+totchild; a++, pa++) {
/* setup per particle individual stuff */
- if(a<totpart){
- if(totchild && (part->draw&PART_DRAW_PARENT)==0) continue;
- if(pa->flag & PARS_NO_DISP || pa->flag & PARS_UNEXIST) continue;
+ if (a<totpart) {
+ if (totchild && (part->draw&PART_DRAW_PARENT)==0) continue;
+ if (pa->flag & PARS_NO_DISP || pa->flag & PARS_UNEXIST) continue;
pa_time=(cfra-pa->time)/pa->lifetime;
pa_birthtime=pa->time;
pa_dietime = pa->dietime;
pa_size=pa->size;
- if(part->phystype==PART_PHYS_BOIDS)
+ if (part->phystype==PART_PHYS_BOIDS)
pa_health = pa->boid->data.health;
else
pa_health = -1.0;
@@ -4372,7 +4402,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
r_tilt = 2.0f*(PSYS_FRAND(a + 21) - 0.5f);
r_length = PSYS_FRAND(a + 22);
- if(part->draw_col > PART_DRAW_COL_MAT) {
+ if (part->draw_col > PART_DRAW_COL_MAT) {
switch(part->draw_col) {
case PART_DRAW_COL_VEL:
intensity = len_v3(pa->state.vel)/part->color_vec_max;
@@ -4400,7 +4430,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
}
drawn = 0;
- if(part->draw_as == PART_DRAW_REND && part->trail_count > 1) {
+ if (part->draw_as == PART_DRAW_REND && part->trail_count > 1) {
float length = part->path_end * (1.0f - part->randlength * r_length);
int trail_count = part->trail_count * (1.0f - part->randlength * r_length);
float ct = ((part->draw & PART_ABS_PATH_TIME) ? cfra : pa_time) - length;
@@ -4408,24 +4438,24 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
int i=0;
ct+=dt;
- for(i=0; i < trail_count; i++, ct += dt) {
+ for (i=0; i < trail_count; i++, ct += dt) {
float pixsize;
- if(part->draw & PART_ABS_PATH_TIME) {
- if(ct < pa_birthtime || ct > pa_dietime)
+ if (part->draw & PART_ABS_PATH_TIME) {
+ if (ct < pa_birthtime || ct > pa_dietime)
continue;
}
- else if(ct < 0.0f || ct > 1.0f)
+ else if (ct < 0.0f || ct > 1.0f)
continue;
state.time = (part->draw & PART_ABS_PATH_TIME) ? -ct : -(pa_birthtime + ct * (pa_dietime - pa_birthtime));
psys_get_particle_on_path(&sim,a,&state,need_v);
- if(psys->parent)
+ if (psys->parent)
mul_m4_v3(psys->parent->obmat, state.co);
/* create actiual particle data */
- if(draw_as == PART_DRAW_BB) {
+ if (draw_as == PART_DRAW_BB) {
bb.offset[0] = part->bb_offset[0];
bb.offset[1] = part->bb_offset[1];
bb.size[0] = part->bb_size[0] * pa_size;
@@ -4455,14 +4485,14 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
else
{
state.time=cfra;
- if(psys_get_particle_state(&sim,a,&state,0)){
+ if (psys_get_particle_state(&sim,a,&state,0)) {
float pixsize;
- if(psys->parent)
+ if (psys->parent)
mul_m4_v3(psys->parent->obmat, state.co);
/* create actiual particle data */
- if(draw_as == PART_DRAW_BB) {
+ if (draw_as == PART_DRAW_BB) {
bb.offset[0] = part->bb_offset[0];
bb.offset[1] = part->bb_offset[1];
bb.size[0] = part->bb_size[0] * pa_size;
@@ -4490,10 +4520,10 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
}
}
- if(drawn) {
+ if (drawn) {
/* additional things to draw for each particle */
/* (velocity, size and number) */
- if((part->draw & PART_DRAW_VEL) && pdd && pdd->vedata){
+ if ((part->draw & PART_DRAW_VEL) && pdd && pdd->vedata) {
copy_v3_v3(pdd->ved,state.co);
pdd->ved += 3;
mul_v3_v3fl(vel, state.vel, timestep);
@@ -4503,20 +4533,20 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
totve++;
}
- if(part->draw & PART_DRAW_SIZE){
+ if (part->draw & PART_DRAW_SIZE) {
setlinestyle(3);
drawcircball(GL_LINE_LOOP, state.co, pa_size, imat);
setlinestyle(0);
}
- if((part->draw & PART_DRAW_NUM || part->draw & PART_DRAW_HEALTH) && (v3d->flag2 & V3D_RENDER_OVERRIDE)==0){
+ if ((part->draw & PART_DRAW_NUM || part->draw & PART_DRAW_HEALTH) && (v3d->flag2 & V3D_RENDER_OVERRIDE)==0) {
float vec_txt[3];
char *val_pos= numstr;
numstr[0]= '\0';
- if(part->draw&PART_DRAW_NUM) {
- if(a < totpart && (part->draw & PART_DRAW_HEALTH) && (part->phystype==PART_PHYS_BOIDS)) {
+ if (part->draw&PART_DRAW_NUM) {
+ if (a < totpart && (part->draw & PART_DRAW_HEALTH) && (part->phystype==PART_PHYS_BOIDS)) {
sprintf(val_pos, "%d:%.2f", a, pa_health);
}
else {
@@ -4524,7 +4554,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
}
}
else {
- if(a < totpart && (part->draw & PART_DRAW_HEALTH) && (part->phystype==PART_PHYS_BOIDS)) {
+ if (a < totpart && (part->draw & PART_DRAW_HEALTH) && (part->phystype==PART_PHYS_BOIDS)) {
sprintf(val_pos, "%.2f", pa_health);
}
}
@@ -4542,7 +4572,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
glGetIntegerv(GL_POLYGON_MODE, polygonmode);
glEnableClientState(GL_VERTEX_ARRAY);
- if(draw_as==PART_DRAW_PATH){
+ if (draw_as==PART_DRAW_PATH) {
ParticleCacheKey **cache, *path;
float /* *cd2=NULL, */ /* UNUSED */ *cdata2=NULL;
@@ -4550,7 +4580,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
if (1) { //ob_dt > OB_WIRE) {
glEnableClientState(GL_NORMAL_ARRAY);
- if(part->draw_col == PART_DRAW_COL_MAT)
+ if (part->draw_col == PART_DRAW_COL_MAT)
glEnableClientState(GL_COLOR_ARRAY);
glEnable(GL_LIGHTING);
@@ -4565,21 +4595,21 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
UI_ThemeColor(TH_WIRE);
}*/
- if(totchild && (part->draw&PART_DRAW_PARENT)==0)
+ if (totchild && (part->draw&PART_DRAW_PARENT)==0)
totpart=0;
- else if(psys->pathcache==NULL)
+ else if (psys->pathcache==NULL)
totpart=0;
/* draw actual/parent particles */
cache=psys->pathcache;
- for(a=0, pa=psys->particles; a<totpart; a++, pa++){
+ for (a=0, pa=psys->particles; a<totpart; a++, pa++) {
path=cache[a];
- if(path->steps > 0) {
+ if (path->steps > 0) {
glVertexPointer(3, GL_FLOAT, sizeof(ParticleCacheKey), path->co);
- if(1) { //ob_dt > OB_WIRE) {
+ if (1) { //ob_dt > OB_WIRE) {
glNormalPointer(GL_FLOAT, sizeof(ParticleCacheKey), path->vel);
- if(part->draw_col == PART_DRAW_COL_MAT)
+ if (part->draw_col == PART_DRAW_COL_MAT)
glColorPointer(3, GL_FLOAT, sizeof(ParticleCacheKey), path->col);
}
@@ -4589,13 +4619,13 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
/* draw child particles */
cache=psys->childcache;
- for(a=0; a<totchild; a++){
+ for (a=0; a<totchild; a++) {
path=cache[a];
glVertexPointer(3, GL_FLOAT, sizeof(ParticleCacheKey), path->co);
- if(1) { //ob_dt > OB_WIRE) {
+ if (1) { //ob_dt > OB_WIRE) {
glNormalPointer(GL_FLOAT, sizeof(ParticleCacheKey), path->vel);
- if(part->draw_col == PART_DRAW_COL_MAT)
+ if (part->draw_col == PART_DRAW_COL_MAT)
glColorPointer(3, GL_FLOAT, sizeof(ParticleCacheKey), path->col);
}
@@ -4604,22 +4634,22 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
/* restore & clean up */
- if(1) { //ob_dt > OB_WIRE) {
- if(part->draw_col == PART_DRAW_COL_MAT)
+ if (1) { //ob_dt > OB_WIRE) {
+ if (part->draw_col == PART_DRAW_COL_MAT)
glDisable(GL_COLOR_ARRAY);
glDisable(GL_COLOR_MATERIAL);
}
- if(cdata2)
+ if (cdata2)
MEM_freeN(cdata2);
/* cd2= */ /* UNUSED */ cdata2=NULL;
glLineWidth(1.0f);
- if((part->draw & PART_DRAW_NUM) && (v3d->flag2 & V3D_RENDER_OVERRIDE)==0){
+ if ((part->draw & PART_DRAW_NUM) && (v3d->flag2 & V3D_RENDER_OVERRIDE)==0) {
cache=psys->pathcache;
- for(a=0, pa=psys->particles; a<totpart; a++, pa++){
+ for (a=0, pa=psys->particles; a<totpart; a++, pa++) {
float vec_txt[3];
BLI_snprintf(numstr, sizeof(numstr), "%i", a);
/* use worldspace beause object matrix is already applied */
@@ -4628,21 +4658,21 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
}
}
}
- else if(pdd && ELEM(draw_as, 0, PART_DRAW_CIRC)==0){
+ else if (pdd && ELEM(draw_as, 0, PART_DRAW_CIRC)==0) {
glDisableClientState(GL_COLOR_ARRAY);
/* enable point data array */
- if(pdd->vdata){
+ if (pdd->vdata) {
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3, GL_FLOAT, 0, pdd->vdata);
}
else
glDisableClientState(GL_VERTEX_ARRAY);
- if(select) {
+ if (select) {
UI_ThemeColor(TH_ACTIVE);
- if(part->draw_size)
+ if (part->draw_size)
glPointSize(part->draw_size + 2);
else
glPointSize(4.0);
@@ -4660,7 +4690,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
/* enable other data arrays */
/* billboards are drawn this way */
- if(pdd->ndata && ob_dt>OB_WIRE){
+ if (pdd->ndata && ob_dt>OB_WIRE) {
glEnableClientState(GL_NORMAL_ARRAY);
glNormalPointer(GL_FLOAT, 0, pdd->ndata);
glEnable(GL_LIGHTING);
@@ -4670,7 +4700,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
glDisable(GL_LIGHTING);
}
- if(pdd->cdata){
+ if (pdd->cdata) {
glEnableClientState(GL_COLOR_ARRAY);
glColorPointer(3, GL_FLOAT, 0, pdd->cdata);
}
@@ -4681,7 +4711,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
pdd->totpoint = totpoint;
}
- if(pdd && pdd->vedata){
+ if (pdd && pdd->vedata) {
glDisableClientState(GL_COLOR_ARRAY);
cpack(0xC0C0C0);
@@ -4700,39 +4730,39 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_NORMAL_ARRAY);
- if(states)
+ if (states)
MEM_freeN(states);
psys->flag &= ~PSYS_DRAWING;
/* draw data can't be saved for billboards as they must update to target changes */
- if(draw_as == PART_DRAW_BB) {
+ if (draw_as == PART_DRAW_BB) {
psys_free_pdd(psys);
pdd->flag &= ~PARTICLE_DRAW_DATA_UPDATED;
}
- if(psys->lattice){
+ if (psys->lattice) {
end_latt_deform(psys->lattice);
psys->lattice= NULL;
}
- if(pdd) {
+ if (pdd) {
/* drop references to stack memory */
pdd->ma_col= NULL;
}
- if( (base->flag & OB_FROMDUPLI) && (ob->flag & OB_FROMGROUP) ) {
+ if ( (base->flag & OB_FROMDUPLI) && (ob->flag & OB_FROMGROUP) ) {
glLoadMatrixf(rv3d->viewmat);
}
}
static void draw_update_ptcache_edit(Scene *scene, Object *ob, PTCacheEdit *edit)
{
- if(edit->psys && edit->psys->flag & PSYS_HAIR_UPDATED)
+ if (edit->psys && edit->psys->flag & PSYS_HAIR_UPDATED)
PE_update_object(scene, ob, 0);
/* create path and child path cache if it doesn't exist already */
- if(edit->pathcache == NULL)
+ if (edit->pathcache == NULL)
psys_cache_edit_paths(scene, ob, edit, CFRA);
}
@@ -4748,13 +4778,13 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, PTCacheEdit *edit)
float nosel_col[3];
float *pathcol = NULL, *pcol;
- if(edit->pathcache == NULL)
+ if (edit->pathcache == NULL)
return;
PE_hide_keys_time(scene, edit, CFRA);
/* opengl setup */
- if((v3d->flag & V3D_ZBUF_SELECT)==0)
+ if ((v3d->flag & V3D_ZBUF_SELECT)==0)
glDisable(GL_DEPTH_TEST);
/* get selection theme colors */
@@ -4762,7 +4792,7 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, PTCacheEdit *edit)
UI_GetThemeColor3fv(TH_VERTEX, nosel_col);
/* draw paths */
- if(timed) {
+ if (timed) {
glEnable(GL_BLEND);
steps = (*edit->pathcache)->steps + 1;
pathcol = MEM_callocN(steps*4*sizeof(float), "particle path color data");
@@ -4775,18 +4805,18 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, PTCacheEdit *edit)
glEnable(GL_COLOR_MATERIAL);
glShadeModel(GL_SMOOTH);
- if(pset->brushtype == PE_BRUSH_WEIGHT) {
+ if (pset->brushtype == PE_BRUSH_WEIGHT) {
glLineWidth(2.0f);
glDisable(GL_LIGHTING);
}
cache=edit->pathcache;
- for(i=0; i<totpoint; i++){
+ for (i=0; i<totpoint; i++) {
path = cache[i];
glVertexPointer(3, GL_FLOAT, sizeof(ParticleCacheKey), path->co);
- if(timed) {
- for(k=0, pcol=pathcol, pkey=path; k<steps; k++, pkey++, pcol+=4){
+ if (timed) {
+ for (k=0, pcol=pathcol, pkey=path; k<steps; k++, pkey++, pcol+=4) {
copy_v3_v3(pcol, pkey->col);
pcol[3] = 1.0f - fabsf((float)(CFRA) - pkey->time)/(float)pset->fade_frames;
}
@@ -4799,44 +4829,44 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, PTCacheEdit *edit)
glDrawArrays(GL_LINE_STRIP, 0, path->steps + 1);
}
- if(pathcol) { MEM_freeN(pathcol); pathcol = pcol = NULL; }
+ if (pathcol) { MEM_freeN(pathcol); pathcol = pcol = NULL; }
/* draw edit vertices */
- if(pset->selectmode!=SCE_SELECT_PATH){
+ if (pset->selectmode!=SCE_SELECT_PATH) {
glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE));
- if(pset->selectmode==SCE_SELECT_POINT){
+ if (pset->selectmode==SCE_SELECT_POINT) {
float *pd=NULL,*pdata=NULL;
float *cd=NULL,*cdata=NULL;
int totkeys = 0;
for (i=0, point=edit->points; i<totpoint; i++, point++)
- if(!(point->flag & PEP_HIDE))
+ if (!(point->flag & PEP_HIDE))
totkeys += point->totkey;
- if(edit->points && !(edit->points->keys->flag & PEK_USE_WCO))
+ if (edit->points && !(edit->points->keys->flag & PEK_USE_WCO))
pd=pdata=MEM_callocN(totkeys*3*sizeof(float), "particle edit point data");
cd=cdata=MEM_callocN(totkeys*(timed?4:3)*sizeof(float), "particle edit color data");
- for(i=0, point=edit->points; i<totpoint; i++, point++){
- if(point->flag & PEP_HIDE)
+ for (i=0, point=edit->points; i<totpoint; i++, point++) {
+ if (point->flag & PEP_HIDE)
continue;
- for(k=0, key=point->keys; k<point->totkey; k++, key++){
- if(pd) {
+ for (k=0, key=point->keys; k<point->totkey; k++, key++) {
+ if (pd) {
copy_v3_v3(pd, key->co);
pd += 3;
}
- if(key->flag&PEK_SELECT){
+ if (key->flag&PEK_SELECT) {
copy_v3_v3(cd,sel_col);
}
else{
copy_v3_v3(cd,nosel_col);
}
- if(timed)
+ if (timed)
*(cd+3) = 1.0f - fabsf((float)CFRA - *key->time)/(float)pset->fade_frames;
cd += (timed?4:3);
@@ -4844,11 +4874,11 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, PTCacheEdit *edit)
}
cd=cdata;
pd=pdata;
- for(i=0, point=edit->points; i<totpoint; i++, point++){
- if(point->flag & PEP_HIDE)
+ for (i=0, point=edit->points; i<totpoint; i++, point++) {
+ if (point->flag & PEP_HIDE)
continue;
- if(point->keys->flag & PEK_USE_WCO)
+ if (point->keys->flag & PEK_USE_WCO)
glVertexPointer(3, GL_FLOAT, sizeof(PTCacheEditKey), point->keys->world_co);
else
glVertexPointer(3, GL_FLOAT, 3*sizeof(float), pd);
@@ -4860,14 +4890,14 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, PTCacheEdit *edit)
pd += pd ? 3 * point->totkey : 0;
cd += (timed?4:3) * point->totkey;
}
- if(pdata) { MEM_freeN(pdata); pd=pdata=NULL; }
- if(cdata) { MEM_freeN(cdata); cd=cdata=NULL; }
+ if (pdata) { MEM_freeN(pdata); pd=pdata=NULL; }
+ if (cdata) { MEM_freeN(cdata); cd=cdata=NULL; }
}
- else if(pset->selectmode == SCE_SELECT_END){
- for(i=0, point=edit->points; i<totpoint; i++, point++){
- if((point->flag & PEP_HIDE)==0){
+ else if (pset->selectmode == SCE_SELECT_END) {
+ for (i=0, point=edit->points; i<totpoint; i++, point++) {
+ if ((point->flag & PEP_HIDE)==0) {
key = point->keys + point->totkey - 1;
- if(key->flag & PEK_SELECT)
+ if (key->flag & PEK_SELECT)
glColor3fv(sel_col);
else
glColor3fv(nosel_col);
@@ -4887,7 +4917,7 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, PTCacheEdit *edit)
glDisableClientState(GL_NORMAL_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);
glShadeModel(GL_FLAT);
- if(v3d->zbuf) glEnable(GL_DEPTH_TEST);
+ if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
glLineWidth(1.0f);
glPointSize(1.0);
}
@@ -4934,8 +4964,8 @@ static void ob_draw_RE_motion(float com[3],float rotscale[3][3],float itw,float
glVertex3fv(tip);
glEnd();
- root[1] =tw; root[2] = 0.0f;
- root[0] =th;
+ root[1] = tw; root[2] = 0.0f;
+ root[0] = th;
glBegin(GL_LINES);
mul_m3_v3(tr,root);
add_v3_v3(root, com);
@@ -4976,7 +5006,7 @@ static void ob_draw_RE_motion(float com[3],float rotscale[3][3],float itw,float
glVertex3fv(tip);
glEnd();
- root[0] =0.0f; root[2] = -tw;
+ root[0] = 0.0f; root[2] = -tw;
root[1] = th;
glBegin(GL_LINES);
mul_m3_v3(tr,root);
@@ -4985,8 +5015,8 @@ static void ob_draw_RE_motion(float com[3],float rotscale[3][3],float itw,float
glVertex3fv(tip);
glEnd();
- root[0] =tw; root[2] = 0.0f;
- root[1] =th;
+ root[0] = tw; root[2] = 0.0f;
+ root[1] = th;
glBegin(GL_LINES);
mul_m3_v3(tr,root);
add_v3_v3(root, com);
@@ -5062,11 +5092,11 @@ static void tekenhandlesN(Nurb *nu, short sel, short hide_handles)
float *fp;
int a;
- if(nu->hide || hide_handles) return;
+ if (nu->hide || hide_handles) return;
glBegin(GL_LINES);
- if(nu->type == CU_BEZIER) {
+ if (nu->type == CU_BEZIER) {
#define TH_HANDLE_COL_TOT ((TH_HANDLE_SEL_FREE - TH_HANDLE_FREE) + 1)
/* use MIN2 when indexing to ensure newer files dont read outside the array */
@@ -5079,9 +5109,9 @@ static void tekenhandlesN(Nurb *nu, short sel, short hide_handles)
bezt= nu->bezt;
a= nu->pntsu;
- while(a--) {
- if(bezt->hide==0) {
- if( (bezt->f2 & SELECT)==sel) {
+ while (a--) {
+ if (bezt->hide==0) {
+ if ( (bezt->f2 & SELECT)==sel) {
fp= bezt->vec[0];
glColor3ubv(handle_cols[MIN2(bezt->h1, TH_HANDLE_COL_TOT-1)]);
@@ -5092,14 +5122,14 @@ static void tekenhandlesN(Nurb *nu, short sel, short hide_handles)
glVertex3fv(fp+3);
glVertex3fv(fp+6);
}
- else if( (bezt->f1 & SELECT)==sel) {
+ else if ( (bezt->f1 & SELECT)==sel) {
fp= bezt->vec[0];
glColor3ubv(handle_cols[MIN2(bezt->h1, TH_HANDLE_COL_TOT-1)]);
glVertex3fv(fp);
glVertex3fv(fp+3);
}
- else if( (bezt->f3 & SELECT)==sel) {
+ else if ( (bezt->f3 & SELECT)==sel) {
fp= bezt->vec[1];
glColor3ubv(handle_cols[MIN2(bezt->h2, TH_HANDLE_COL_TOT-1)]);
@@ -5122,18 +5152,18 @@ static void tekenhandlesN_active(Nurb *nu)
float *fp;
int a;
- if(nu->hide) return;
+ if (nu->hide) return;
UI_ThemeColor(TH_ACTIVE_SPLINE);
glLineWidth(2);
glBegin(GL_LINES);
- if(nu->type == CU_BEZIER) {
+ if (nu->type == CU_BEZIER) {
bezt= nu->bezt;
a= nu->pntsu;
- while(a--) {
- if(bezt->hide==0) {
+ while (a--) {
+ if (bezt->hide==0) {
fp= bezt->vec[0];
glVertex3fv(fp);
@@ -5158,9 +5188,9 @@ static void tekenvertsN(Nurb *nu, short sel, short hide_handles, void *lastsel)
float size;
int a, color;
- if(nu->hide) return;
+ if (nu->hide) return;
- if(sel) color= TH_VERTEX_SELECT;
+ if (sel) color= TH_VERTEX_SELECT;
else color= TH_VERTEX;
UI_ThemeColor(color);
@@ -5170,28 +5200,30 @@ static void tekenvertsN(Nurb *nu, short sel, short hide_handles, void *lastsel)
bglBegin(GL_POINTS);
- if(nu->type == CU_BEZIER) {
+ if (nu->type == CU_BEZIER) {
bezt= nu->bezt;
a= nu->pntsu;
- while(a--) {
- if(bezt->hide==0) {
+ while (a--) {
+ if (bezt->hide==0) {
if (sel == 1 && bezt == lastsel) {
UI_ThemeColor(TH_LASTSEL_POINT);
bglVertex3fv(bezt->vec[1]);
if (!hide_handles) {
- if(bezt->f1 & SELECT) bglVertex3fv(bezt->vec[0]);
- if(bezt->f3 & SELECT) bglVertex3fv(bezt->vec[2]);
+ if (bezt->f1 & SELECT) bglVertex3fv(bezt->vec[0]);
+ if (bezt->f3 & SELECT) bglVertex3fv(bezt->vec[2]);
}
UI_ThemeColor(color);
- } else if (hide_handles) {
- if((bezt->f2 & SELECT)==sel) bglVertex3fv(bezt->vec[1]);
- } else {
- if((bezt->f1 & SELECT)==sel) bglVertex3fv(bezt->vec[0]);
- if((bezt->f2 & SELECT)==sel) bglVertex3fv(bezt->vec[1]);
- if((bezt->f3 & SELECT)==sel) bglVertex3fv(bezt->vec[2]);
+ }
+ else if (hide_handles) {
+ if ((bezt->f2 & SELECT)==sel) bglVertex3fv(bezt->vec[1]);
+ }
+ else {
+ if ((bezt->f1 & SELECT)==sel) bglVertex3fv(bezt->vec[0]);
+ if ((bezt->f2 & SELECT)==sel) bglVertex3fv(bezt->vec[1]);
+ if ((bezt->f3 & SELECT)==sel) bglVertex3fv(bezt->vec[2]);
}
}
bezt++;
@@ -5200,14 +5232,15 @@ static void tekenvertsN(Nurb *nu, short sel, short hide_handles, void *lastsel)
else {
bp= nu->bp;
a= nu->pntsu*nu->pntsv;
- while(a--) {
- if(bp->hide==0) {
+ while (a--) {
+ if (bp->hide==0) {
if (bp == lastsel) {
UI_ThemeColor(TH_LASTSEL_POINT);
bglVertex3fv(bp->vec);
UI_ThemeColor(color);
- } else {
- if((bp->f1 & SELECT)==sel) bglVertex3fv(bp->vec);
+ }
+ else {
+ if ((bp->f1 & SELECT)==sel) bglVertex3fv(bp->vec);
}
}
bp++;
@@ -5227,11 +5260,11 @@ static void editnurb_draw_active_poly(Nurb *nu)
glLineWidth(2);
bp= nu->bp;
- for(b=0; b<nu->pntsv; b++) {
- if(nu->flagu & 1) glBegin(GL_LINE_LOOP);
+ for (b=0; b<nu->pntsv; b++) {
+ if (nu->flagu & 1) glBegin(GL_LINE_LOOP);
else glBegin(GL_LINE_STRIP);
- for(a=0; a<nu->pntsu; a++, bp++) {
+ for (a=0; a<nu->pntsu; a++, bp++) {
glVertex3fv(bp->vec);
}
@@ -5252,12 +5285,12 @@ static void editnurb_draw_active_nurbs(Nurb *nu)
glBegin(GL_LINES);
bp= nu->bp;
- for(b=0; b<nu->pntsv; b++) {
+ for (b=0; b<nu->pntsv; b++) {
bp1= bp;
bp++;
- for(a=nu->pntsu-1; a>0; a--, bp++) {
- if(bp->hide==0 && bp1->hide==0) {
+ for (a=nu->pntsu-1; a>0; a--, bp++) {
+ if (bp->hide==0 && bp1->hide==0) {
glVertex3fv(bp->vec);
glVertex3fv(bp1->vec);
}
@@ -5265,14 +5298,14 @@ static void editnurb_draw_active_nurbs(Nurb *nu)
}
}
- if(nu->pntsv > 1) { /* surface */
+ if (nu->pntsv > 1) { /* surface */
ofs= nu->pntsu;
- for(b=0; b<nu->pntsu; b++) {
+ for (b=0; b<nu->pntsu; b++) {
bp1= nu->bp+b;
bp= bp1+ofs;
- for(a=nu->pntsv-1; a>0; a--, bp+=ofs) {
- if(bp->hide==0 && bp1->hide==0) {
+ for (a=nu->pntsv-1; a>0; a--, bp+=ofs) {
+ if (bp->hide==0 && bp1->hide==0) {
glVertex3fv(bp->vec);
glVertex3fv(bp1->vec);
}
@@ -5296,8 +5329,8 @@ static void draw_editnurb(Object *ob, Nurb *nurb, int sel)
index= 0;
nu= nurb;
- while(nu) {
- if(nu->hide==0) {
+ while (nu) {
+ if (nu->hide==0) {
switch(nu->type) {
case CU_POLY:
if (!sel && index== cu->actnu) {
@@ -5307,11 +5340,11 @@ static void draw_editnurb(Object *ob, Nurb *nurb, int sel)
UI_ThemeColor(TH_NURB_ULINE);
bp= nu->bp;
- for(b=0; b<nu->pntsv; b++) {
- if(nu->flagu & 1) glBegin(GL_LINE_LOOP);
+ for (b=0; b<nu->pntsv; b++) {
+ if (nu->flagu & 1) glBegin(GL_LINE_LOOP);
else glBegin(GL_LINE_STRIP);
- for(a=0; a<nu->pntsu; a++, bp++) {
+ for (a=0; a<nu->pntsu; a++, bp++) {
glVertex3fv(bp->vec);
}
@@ -5325,13 +5358,13 @@ static void draw_editnurb(Object *ob, Nurb *nurb, int sel)
}
bp= nu->bp;
- for(b=0; b<nu->pntsv; b++) {
+ for (b=0; b<nu->pntsv; b++) {
bp1= bp;
bp++;
- for(a=nu->pntsu-1; a>0; a--, bp++) {
- if(bp->hide==0 && bp1->hide==0) {
- if(sel) {
- if( (bp->f1 & SELECT) && ( bp1->f1 & SELECT ) ) {
+ for (a=nu->pntsu-1; a>0; a--, bp++) {
+ if (bp->hide==0 && bp1->hide==0) {
+ if (sel) {
+ if ( (bp->f1 & SELECT) && ( bp1->f1 & SELECT ) ) {
UI_ThemeColor(TH_NURB_SEL_ULINE);
glBegin(GL_LINE_STRIP);
@@ -5341,7 +5374,7 @@ static void draw_editnurb(Object *ob, Nurb *nurb, int sel)
}
}
else {
- if( (bp->f1 & SELECT) && ( bp1->f1 & SELECT) );
+ if ( (bp->f1 & SELECT) && ( bp1->f1 & SELECT) );
else {
UI_ThemeColor(TH_NURB_ULINE);
@@ -5355,16 +5388,16 @@ static void draw_editnurb(Object *ob, Nurb *nurb, int sel)
bp1= bp;
}
}
- if(nu->pntsv > 1) { /* surface */
+ if (nu->pntsv > 1) { /* surface */
ofs= nu->pntsu;
- for(b=0; b<nu->pntsu; b++) {
+ for (b=0; b<nu->pntsu; b++) {
bp1= nu->bp+b;
bp= bp1+ofs;
- for(a=nu->pntsv-1; a>0; a--, bp+=ofs) {
- if(bp->hide==0 && bp1->hide==0) {
- if(sel) {
- if( (bp->f1 & SELECT) && ( bp1->f1 & SELECT) ) {
+ for (a=nu->pntsv-1; a>0; a--, bp+=ofs) {
+ if (bp->hide==0 && bp1->hide==0) {
+ if (sel) {
+ if ( (bp->f1 & SELECT) && ( bp1->f1 & SELECT) ) {
UI_ThemeColor(TH_NURB_SEL_VLINE);
glBegin(GL_LINE_STRIP);
@@ -5374,7 +5407,7 @@ static void draw_editnurb(Object *ob, Nurb *nurb, int sel)
}
}
else {
- if( (bp->f1 & SELECT) && ( bp1->f1 & SELECT) );
+ if ( (bp->f1 & SELECT) && ( bp1->f1 & SELECT) );
else {
UI_ThemeColor(TH_NURB_VLINE);
@@ -5413,12 +5446,12 @@ static void drawnurb(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
UI_ThemeColor(TH_WIRE);
drawDispList(scene, v3d, rv3d, base, dt);
- if(v3d->zbuf) glDisable(GL_DEPTH_TEST);
+ if (v3d->zbuf) glDisable(GL_DEPTH_TEST);
/* first non-selected and active handles */
index= 0;
- for(nu=nurb; nu; nu=nu->next) {
- if(nu->type == CU_BEZIER) {
+ for (nu=nurb; nu; nu=nu->next) {
+ if (nu->type == CU_BEZIER) {
if (index == cu->actnu && !hide_handles)
tekenhandlesN_active(nu);
tekenhandlesN(nu, 0, hide_handles);
@@ -5428,17 +5461,17 @@ static void drawnurb(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
draw_editnurb(ob, nurb, 0);
draw_editnurb(ob, nurb, 1);
/* selected handles */
- for(nu=nurb; nu; nu=nu->next) {
- if(nu->type == CU_BEZIER && (cu->drawflag & CU_HIDE_HANDLES)==0)
+ for (nu=nurb; nu; nu=nu->next) {
+ if (nu->type == CU_BEZIER && (cu->drawflag & CU_HIDE_HANDLES)==0)
tekenhandlesN(nu, 1, hide_handles);
tekenvertsN(nu, 0, hide_handles, NULL);
}
- if(v3d->zbuf) glEnable(GL_DEPTH_TEST);
+ if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
/* direction vectors for 3d curve paths
when at its lowest, dont render normals */
- if(cu->flag & CU_3D && ts->normalsize > 0.0015f && (cu->drawflag & CU_HIDE_NORMALS)==0) {
+ if (cu->flag & CU_3D && ts->normalsize > 0.0015f && (cu->drawflag & CU_HIDE_NORMALS)==0) {
UI_ThemeColor(TH_WIRE);
for (bl=cu->bev.first,nu=nurb; nu && bl; bl=bl->next,nu=nu->next) {
@@ -5479,13 +5512,13 @@ static void drawnurb(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
}
}
- if(v3d->zbuf) glDisable(GL_DEPTH_TEST);
+ if (v3d->zbuf) glDisable(GL_DEPTH_TEST);
- for(nu=nurb; nu; nu=nu->next) {
+ for (nu=nurb; nu; nu=nu->next) {
tekenvertsN(nu, 1, hide_handles, cu->lastsel);
}
- if(v3d->zbuf) glEnable(GL_DEPTH_TEST);
+ if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
}
/* draw a sphere for use as an empty drawtype */
@@ -5554,18 +5587,18 @@ static void curve_draw_speed(Scene *scene, Object *ob)
float loc[4], dir[3];
int a;
- if(cu->ipo==NULL)
+ if (cu->ipo==NULL)
return;
icu= cu->ipo->curve.first;
- if(icu==NULL || icu->totvert<2)
+ if (icu==NULL || icu->totvert<2)
return;
glPointSize( UI_GetThemeValuef(TH_VERTEX_SIZE) );
bglBegin(GL_POINTS);
- for(a=0, bezt= icu->bezt; a<icu->totvert; a++, bezt++) {
- if( where_on_path(ob, bezt->vec[1][1], loc, dir)) {
+ for (a=0, bezt= icu->bezt; a<icu->totvert; a++, bezt++) {
+ if ( where_on_path(ob, bezt->vec[1][1], loc, dir)) {
UI_ThemeColor((bezt->f2 & SELECT) && ob==OBACT?TH_VERTEX_SELECT:TH_VERTEX);
bglVertex3fv(loc);
}
@@ -5613,7 +5646,7 @@ static void drawspiral(const float cent[3], float rad, float tmat[][4], int star
copy_v3_v3(vec, cent);
glVertex3fv(vec);
- for(a=0; a<CIRCLE_RESOL; a++) {
+ for (a=0; a<CIRCLE_RESOL; a++) {
if (a+start>=CIRCLE_RESOL)
start=-a + 1;
@@ -5639,7 +5672,7 @@ static void drawspiral(const float cent[3], float rad, float tmat[][4], int star
glVertex3fv(vec);
- for(a=0; a<CIRCLE_RESOL; a++) {
+ for (a=0; a<CIRCLE_RESOL; a++) {
if (a+start>=CIRCLE_RESOL)
start=-a + 1;
@@ -5733,24 +5766,24 @@ static int drawmball(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
mb= ob->data;
- if(mb->editelems) {
+ if (mb->editelems) {
UI_ThemeColor(TH_WIRE);
- if((G.f & G_PICKSEL)==0 ) drawDispList(scene, v3d, rv3d, base, dt);
+ if ((G.f & G_PICKSEL)==0 ) drawDispList(scene, v3d, rv3d, base, dt);
ml= mb->editelems->first;
}
else {
- if((base->flag & OB_FROMDUPLI)==0)
+ if ((base->flag & OB_FROMDUPLI)==0)
drawDispList(scene, v3d, rv3d, base, dt);
ml= mb->elems.first;
}
- if(ml==NULL) return 1;
+ if (ml==NULL) return 1;
- if(v3d->flag2 & V3D_RENDER_OVERRIDE) return 0;
+ if (v3d->flag2 & V3D_RENDER_OVERRIDE) return 0;
/* in case solid draw, reset wire colors */
- if(ob->flag & SELECT) {
- if(ob==OBACT) UI_ThemeColor(TH_ACTIVE);
+ if (ob->flag & SELECT) {
+ if (ob==OBACT) UI_ThemeColor(TH_ACTIVE);
else UI_ThemeColor(TH_SELECT);
}
else UI_ThemeColor(TH_WIRE);
@@ -5759,14 +5792,14 @@ static int drawmball(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
normalize_v3(imat[0]);
normalize_v3(imat[1]);
- while(ml) {
+ while (ml) {
/* draw radius */
- if(mb->editelems) {
- if((ml->flag & SELECT) && (ml->flag & MB_SCALE_RAD)) cpack(0xA0A0F0);
+ if (mb->editelems) {
+ if ((ml->flag & SELECT) && (ml->flag & MB_SCALE_RAD)) cpack(0xA0A0F0);
else cpack(0x3030A0);
- if(G.f & G_PICKSEL) {
+ if (G.f & G_PICKSEL) {
ml->selcol1= code;
glLoadName(code++);
}
@@ -5774,11 +5807,11 @@ static int drawmball(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
drawcircball(GL_LINE_LOOP, &(ml->x), ml->rad, imat);
/* draw stiffness */
- if(mb->editelems) {
- if((ml->flag & SELECT) && !(ml->flag & MB_SCALE_RAD)) cpack(0xA0F0A0);
+ if (mb->editelems) {
+ if ((ml->flag & SELECT) && !(ml->flag & MB_SCALE_RAD)) cpack(0xA0F0A0);
else cpack(0x30A030);
- if(G.f & G_PICKSEL) {
+ if (G.f & G_PICKSEL) {
ml->selcol2= code;
glLoadName(code++);
}
@@ -5799,8 +5832,8 @@ static void draw_forcefield(Scene *scene, Object *ob, RegionView3D *rv3d)
float size;
/* XXX why? */
- if(ob!=scene->obedit && (ob->flag & SELECT)) {
- if(ob==OBACT) curcol= TH_ACTIVE;
+ if (ob!=scene->obedit && (ob->flag & SELECT)) {
+ if (ob==OBACT) curcol= TH_ACTIVE;
else curcol= TH_SELECT;
}
else curcol= TH_WIRE;
@@ -5876,7 +5909,7 @@ static void draw_forcefield(Scene *scene, Object *ob, RegionView3D *rv3d)
}
else if (pd->forcefield == PFIELD_GUIDE && ob->type==OB_CURVE) {
Curve *cu= ob->data;
- if((cu->flag & CU_PATH) && cu->path && cu->path->data) {
+ if ((cu->flag & CU_PATH) && cu->path && cu->path->data) {
float mindist, guidevec1[4], guidevec2[3];
//if (has_ipo_code(ob->ipo, OB_PD_FSTR))
@@ -5903,15 +5936,15 @@ static void draw_forcefield(Scene *scene, Object *ob, RegionView3D *rv3d)
setlinestyle(3);
UI_ThemeColorBlend(curcol, TH_BACK, 0.5);
- if(pd->falloff==PFIELD_FALL_SPHERE){
+ if (pd->falloff==PFIELD_FALL_SPHERE) {
/* as last, guide curve alters it */
- if(pd->flag & PFIELD_USEMAX)
+ if (pd->flag & PFIELD_USEMAX)
drawcircball(GL_LINE_LOOP, vec, pd->maxdist, imat);
- if(pd->flag & PFIELD_USEMIN)
+ if (pd->flag & PFIELD_USEMIN)
drawcircball(GL_LINE_LOOP, vec, pd->mindist, imat);
}
- else if(pd->falloff==PFIELD_FALL_TUBE){
+ else if (pd->falloff==PFIELD_FALL_TUBE) {
float radius,distance;
unit_m4(tmat);
@@ -5922,7 +5955,7 @@ static void draw_forcefield(Scene *scene, Object *ob, RegionView3D *rv3d)
vec[2]=distance;
distance=(pd->flag&PFIELD_POSZ)?-distance:-2.0f*distance;
- if(pd->flag & (PFIELD_USEMAX|PFIELD_USEMAXR))
+ if (pd->flag & (PFIELD_USEMAX|PFIELD_USEMAXR))
drawtube(vec,radius,distance,tmat);
radius=(pd->flag&PFIELD_USEMINR)?pd->minrad:1.0f;
@@ -5930,10 +5963,10 @@ static void draw_forcefield(Scene *scene, Object *ob, RegionView3D *rv3d)
vec[2]=distance;
distance=(pd->flag&PFIELD_POSZ)?-distance:-2.0f*distance;
- if(pd->flag & (PFIELD_USEMIN|PFIELD_USEMINR))
+ if (pd->flag & (PFIELD_USEMIN|PFIELD_USEMINR))
drawtube(vec,radius,distance,tmat);
}
- else if(pd->falloff==PFIELD_FALL_CONE){
+ else if (pd->falloff==PFIELD_FALL_CONE) {
float radius,distance;
unit_m4(tmat);
@@ -5941,18 +5974,18 @@ static void draw_forcefield(Scene *scene, Object *ob, RegionView3D *rv3d)
radius= DEG2RADF((pd->flag&PFIELD_USEMAXR) ? pd->maxrad : 1.0f);
distance=(pd->flag&PFIELD_USEMAX)?pd->maxdist:0.0f;
- if(pd->flag & (PFIELD_USEMAX|PFIELD_USEMAXR)){
+ if (pd->flag & (PFIELD_USEMAX|PFIELD_USEMAXR)) {
drawcone(vec, distance * sinf(radius),distance * cosf(radius), tmat);
- if((pd->flag & PFIELD_POSZ)==0)
+ if ((pd->flag & PFIELD_POSZ)==0)
drawcone(vec, distance * sinf(radius),-distance * cosf(radius),tmat);
}
radius= DEG2RADF((pd->flag&PFIELD_USEMINR) ? pd->minrad : 1.0f);
distance=(pd->flag&PFIELD_USEMIN)?pd->mindist:0.0f;
- if(pd->flag & (PFIELD_USEMIN|PFIELD_USEMINR)){
+ if (pd->flag & (PFIELD_USEMIN|PFIELD_USEMINR)) {
drawcone(vec,distance*sinf(radius),distance*cosf(radius),tmat);
- if((pd->flag & PFIELD_POSZ)==0)
+ if ((pd->flag & PFIELD_POSZ)==0)
drawcone(vec, distance * sinf(radius), -distance * cosf(radius), tmat);
}
}
@@ -5980,7 +6013,7 @@ static void get_local_bounds(Object *ob, float center[3], float size[3])
{
BoundBox *bb= object_get_boundbox(ob);
- if(bb==NULL) {
+ if (bb==NULL) {
zero_v3(center);
copy_v3_v3(size, ob->size);
}
@@ -6012,18 +6045,18 @@ static void draw_bb_quadric(BoundBox *bb, char type)
cent[2]= 0.5f*(bb->vec[0][2] + bb->vec[1][2]);
glPushMatrix();
- if(type==OB_BOUND_SPHERE) {
+ if (type==OB_BOUND_SPHERE) {
glTranslatef(cent[0], cent[1], cent[2]);
glScalef(size[0], size[1], size[2]);
gluSphere(qobj, 1.0, 8, 5);
}
- else if(type==OB_BOUND_CYLINDER) {
+ else if (type==OB_BOUND_CYLINDER) {
float radius = size[0] > size[1] ? size[0] : size[1];
glTranslatef(cent[0], cent[1], cent[2]-size[2]);
glScalef(radius, radius, 2.0f * size[2]);
gluCylinder(qobj, 1.0, 1.0, 1.0, 8, 1);
}
- else if(type==OB_BOUND_CONE) {
+ else if (type==OB_BOUND_CONE) {
float radius = size[0] > size[1] ? size[0] : size[1];
glTranslatef(cent[0], cent[1], cent[2]-size[2]);
glScalef(radius, radius, 2.0f * size[2]);
@@ -6038,16 +6071,16 @@ static void draw_bounding_volume(Scene *scene, Object *ob, char type)
{
BoundBox *bb= NULL;
- if(ob->type==OB_MESH) {
+ if (ob->type==OB_MESH) {
bb= mesh_get_bb(ob);
}
else if ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT) {
bb= ob->bb ? ob->bb : ( (Curve *)ob->data )->bb;
}
- else if(ob->type==OB_MBALL) {
- if(is_basis_mball(ob)) {
+ else if (ob->type==OB_MBALL) {
+ if (is_basis_mball(ob)) {
bb= ob->bb;
- if(bb==NULL) {
+ if (bb==NULL) {
makeDispListMBall(scene, ob);
bb= ob->bb;
}
@@ -6058,9 +6091,9 @@ static void draw_bounding_volume(Scene *scene, Object *ob, char type)
return;
}
- if(bb==NULL) return;
+ if (bb==NULL) return;
- if(type==OB_BOUND_BOX) draw_box(bb->vec);
+ if (type==OB_BOUND_BOX) draw_box(bb->vec);
else draw_bb_quadric(bb, type);
}
@@ -6069,7 +6102,7 @@ static void drawtexspace(Object *ob)
{
float vec[8][3], loc[3], size[3];
- if(ob->type==OB_MESH) {
+ if (ob->type==OB_MESH) {
mesh_get_texspace(ob->data, loc, NULL, size);
}
else if ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT) {
@@ -6077,7 +6110,7 @@ static void drawtexspace(Object *ob)
copy_v3_v3(size, cu->size);
copy_v3_v3(loc, cu->loc);
}
- else if(ob->type==OB_MBALL) {
+ else if (ob->type==OB_MBALL) {
MetaBall *mb= ob->data;
copy_v3_v3(size, mb->size);
copy_v3_v3(loc, mb->loc);
@@ -6109,14 +6142,15 @@ static void drawObjectSelect(Scene *scene, View3D *v3d, ARegion *ar, Base *base)
glLineWidth(2.0);
glDepthMask(0);
- if(ELEM3(ob->type, OB_FONT,OB_CURVE, OB_SURF)) {
+ if (ELEM3(ob->type, OB_FONT,OB_CURVE, OB_SURF)) {
Curve *cu = ob->data;
DerivedMesh *dm = ob->derivedFinal;
int hasfaces= 0;
if (dm) {
hasfaces= dm->getNumTessFaces(dm);
- } else {
+ }
+ else {
hasfaces= displist_has_faces(&ob->disp);
}
@@ -6124,19 +6158,21 @@ static void drawObjectSelect(Scene *scene, View3D *v3d, ARegion *ar, Base *base)
draw_index_wire= 0;
if (dm) {
draw_mesh_object_outline(v3d, ob, dm);
- } else {
+ }
+ else {
drawDispListwire(&ob->disp);
}
draw_index_wire= 1;
}
- } else if (ob->type==OB_MBALL) {
- if(is_basis_mball(ob)) {
- if((base->flag & OB_FROMDUPLI)==0)
+ }
+ else if (ob->type==OB_MBALL) {
+ if (is_basis_mball(ob)) {
+ if ((base->flag & OB_FROMDUPLI)==0)
drawDispListwire(&ob->disp);
}
}
- else if(ob->type==OB_ARMATURE) {
- if(!(ob->mode & OB_MODE_POSE && base == scene->basact))
+ else if (ob->type==OB_ARMATURE) {
+ if (!(ob->mode & OB_MODE_POSE && base == scene->basact))
draw_armature(scene, v3d, ar, base, OB_WIRE, FALSE, TRUE);
}
@@ -6146,23 +6182,24 @@ static void drawObjectSelect(Scene *scene, View3D *v3d, ARegion *ar, Base *base)
static void drawWireExtra(Scene *scene, RegionView3D *rv3d, Object *ob)
{
- if(ob!=scene->obedit && (ob->flag & SELECT)) {
- if(ob==OBACT) {
- if(ob->flag & OB_FROMGROUP) UI_ThemeColor(TH_GROUP_ACTIVE);
+ if (ob!=scene->obedit && (ob->flag & SELECT)) {
+ if (ob==OBACT) {
+ if (ob->flag & OB_FROMGROUP) UI_ThemeColor(TH_GROUP_ACTIVE);
else UI_ThemeColor(TH_ACTIVE);
}
- else if(ob->flag & OB_FROMGROUP)
+ else if (ob->flag & OB_FROMGROUP)
UI_ThemeColorShade(TH_GROUP_ACTIVE, -16);
else
UI_ThemeColor(TH_SELECT);
}
else {
- if(ob->flag & OB_FROMGROUP)
+ if (ob->flag & OB_FROMGROUP)
UI_ThemeColor(TH_GROUP);
else {
- if(ob->dtx & OB_DRAWWIRE) {
+ if (ob->dtx & OB_DRAWWIRE) {
glColor3ub(80,80,80);
- } else {
+ }
+ else {
UI_ThemeColor(TH_WIRE);
}
}
@@ -6179,15 +6216,17 @@ static void drawWireExtra(Scene *scene, RegionView3D *rv3d, Object *ob)
if (ob->derivedFinal) {
drawCurveDMWired(ob);
- } else {
+ }
+ else {
drawDispListwire(&ob->disp);
}
if (ob->type==OB_CURVE)
draw_index_wire= 1;
}
- } else if (ob->type==OB_MBALL) {
- if(is_basis_mball(ob)) {
+ }
+ else if (ob->type==OB_MBALL) {
+ if (is_basis_mball(ob)) {
drawDispListwire(&ob->disp);
}
}
@@ -6208,7 +6247,7 @@ static void draw_hooks(Object *ob)
mul_v3_m4v3(vec, ob->obmat, hmd->cent);
- if(hmd->object) {
+ if (hmd->object) {
setlinestyle(3);
glBegin(GL_LINES);
glVertex3fv(hmd->object->obmat[3]);
@@ -6292,15 +6331,15 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
}
/* XXX particles are not safe for simultaneous threaded render */
- if(G.rendering && ob->particlesystem.first)
+ if (G.rendering && ob->particlesystem.first)
return;
/* xray delay? */
- if((flag & DRAW_PICKING)==0 && (base->flag & OB_FROMDUPLI)==0) {
+ if ((flag & DRAW_PICKING)==0 && (base->flag & OB_FROMDUPLI)==0) {
/* don't do xray in particle mode, need the z-buffer */
- if(!(ob->mode & OB_MODE_PARTICLE_EDIT)) {
+ if (!(ob->mode & OB_MODE_PARTICLE_EDIT)) {
/* xray and transp are set when it is drawing the 2nd/3rd pass */
- if(!v3d->xray && !v3d->transp && (ob->dtx & OB_DRAWXRAY) && !(ob->dtx & OB_DRAWTRANSP)) {
+ if (!v3d->xray && !v3d->transp && (ob->dtx & OB_DRAWXRAY) && !(ob->dtx & OB_DRAWTRANSP)) {
add_view3d_after(&v3d->afterdraw_xray, base, flag);
return;
}
@@ -6311,7 +6350,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
view3d_cached_text_draw_begin();
/* patch? children objects with a timeoffs change the parents. How to solve! */
- /* if( ((int)ob->ctime) != F_(scene->r.cfra)) where_is_object(scene, ob); */
+ /* if ( ((int)ob->ctime) != F_(scene->r.cfra)) where_is_object(scene, ob); */
/* draw motion paths (in view space) */
if (ob->mpath && (v3d->flag2 & V3D_RENDER_OVERRIDE)==0) {
@@ -6332,7 +6371,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
ED_view3d_init_mats_rv3d_gl(ob, rv3d);
/* which wire color */
- if((flag & DRAW_CONSTCOLOR) == 0) {
+ if ((flag & DRAW_CONSTCOLOR) == 0) {
/* confusing logic here, there are 2 methods of setting the color
* 'colortab[colindex]' and 'theme_id', colindex overrides theme_id.
*
@@ -6342,7 +6381,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
project_short(ar, ob->obmat[3], &base->sx);
- if( (scene->obedit == NULL) &&
+ if ( (scene->obedit == NULL) &&
(G.moving & G_TRANSFORM_OBJ) &&
(base->flag & (SELECT+BA_WAS_SEL)))
{
@@ -6350,11 +6389,11 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
}
else {
/* Sets the 'colindex' */
- if(ob->id.lib) {
+ if (ob->id.lib) {
colindex= (base->flag & (SELECT+BA_WAS_SEL)) ? 4 : 3;
}
- else if(warning_recursive==1) {
- if(base->flag & (SELECT+BA_WAS_SEL)) {
+ else if (warning_recursive==1) {
+ if (base->flag & (SELECT+BA_WAS_SEL)) {
colindex= (scene->basact==base) ? 8 : 7;
}
else {
@@ -6363,12 +6402,12 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
}
/* Sets the 'theme_id' or fallback to wire */
else {
- if(ob->flag & OB_FROMGROUP) {
- if(base->flag & (SELECT+BA_WAS_SEL)) {
+ if (ob->flag & OB_FROMGROUP) {
+ if (base->flag & (SELECT+BA_WAS_SEL)) {
/* uses darker active color for non-active + selected*/
theme_id= TH_GROUP_ACTIVE;
- if(scene->basact != base) {
+ if (scene->basact != base) {
theme_shade= -16;
}
}
@@ -6377,12 +6416,12 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
}
}
else {
- if(base->flag & (SELECT+BA_WAS_SEL)) {
+ if (base->flag & (SELECT+BA_WAS_SEL)) {
theme_id= scene->basact == base ? TH_ACTIVE : TH_SELECT;
}
else {
- if(ob->type==OB_LAMP) theme_id= TH_LAMP;
- else if(ob->type==OB_SPEAKER) theme_id= TH_SPEAKER;
+ if (ob->type==OB_LAMP) theme_id= TH_LAMP;
+ else if (ob->type==OB_SPEAKER) theme_id= TH_SPEAKER;
/* fallback to TH_WIRE */
}
}
@@ -6390,8 +6429,8 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
}
/* finally set the color */
- if(colindex == 0) {
- if(theme_shade == 0) UI_ThemeColor(theme_id);
+ if (colindex == 0) {
+ if (theme_shade == 0) UI_ThemeColor(theme_id);
else UI_ThemeColorShade(theme_id, theme_shade);
}
else {
@@ -6402,18 +6441,18 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
/* maximum drawtype */
dt= v3d->drawtype;
- if(dt==OB_RENDER) dt= OB_SOLID;
+ if (dt==OB_RENDER) dt= OB_SOLID;
dt= MIN2(dt, ob->dt);
- if(v3d->zbuf==0 && dt>OB_WIRE) dt= OB_WIRE;
+ if (v3d->zbuf==0 && dt>OB_WIRE) dt= OB_WIRE;
dtx= 0;
/* faceselect exception: also draw solid when dt==wire, except in editmode */
if (is_obact && (ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT))) {
- if(ob->type==OB_MESH) {
+ if (ob->type==OB_MESH) {
- if(ob->mode & OB_MODE_EDIT);
+ if (ob->mode & OB_MODE_EDIT);
else {
- if(dt<OB_SOLID) {
+ if (dt<OB_SOLID) {
zbufoff= 1;
dt= OB_SOLID;
}
@@ -6425,7 +6464,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
}
}
else {
- if(dt<OB_SOLID) {
+ if (dt<OB_SOLID) {
dt= OB_SOLID;
glEnable(GL_DEPTH_TEST);
zbufoff= 1;
@@ -6434,10 +6473,10 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
}
/* draw-extra supported for boundbox drawmode too */
- if(dt>=OB_BOUNDBOX ) {
+ if (dt>=OB_BOUNDBOX ) {
dtx= ob->dtx;
- if(ob->mode & OB_MODE_EDIT) {
+ if (ob->mode & OB_MODE_EDIT) {
// the only 2 extra drawtypes alowed in editmode
dtx= dtx & (OB_DRAWWIRE|OB_TEXSPACE);
}
@@ -6445,14 +6484,14 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
}
/* bad exception, solve this! otherwise outline shows too late */
- if(ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT)) {
+ if (ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT)) {
/* still needed for curves hidden in other layers. depgraph doesnt handle that yet */
if (ob->disp.first==NULL) makeDispListCurveTypes(scene, ob, 0);
}
/* draw outline for selected objects, mesh does itself */
- if((v3d->flag & V3D_SELECT_OUTLINE) && ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) && ob->type!=OB_MESH) {
- if(dt>OB_WIRE && (ob->mode & OB_MODE_EDIT)==0 && (flag & DRAW_SCENESET)==0) {
+ if ((v3d->flag & V3D_SELECT_OUTLINE) && ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) && ob->type!=OB_MESH) {
+ if (dt>OB_WIRE && (ob->mode & OB_MODE_EDIT)==0 && (flag & DRAW_SCENESET)==0) {
if (!(ob->dtx&OB_DRAWWIRE) && (ob->flag&SELECT) && !(flag&DRAW_PICKING)) {
drawObjectSelect(scene, v3d, ar, base);
@@ -6463,12 +6502,12 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
switch( ob->type) {
case OB_MESH:
empty_object= draw_mesh_object(scene, ar, v3d, rv3d, base, dt, flag);
- if(flag!=DRAW_CONSTCOLOR) dtx &= ~OB_DRAWWIRE; // mesh draws wire itself
+ if (flag!=DRAW_CONSTCOLOR) dtx &= ~OB_DRAWWIRE; // mesh draws wire itself
break;
case OB_FONT:
cu= ob->data;
- if(cu->editfont) {
+ if (cu->editfont) {
draw_textcurs(cu->editfont->textcurs);
if (cu->flag & CU_FAST) {
@@ -6476,7 +6515,8 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
set_inverted_drawing(1);
drawDispList(scene, v3d, rv3d, base, OB_WIRE);
set_inverted_drawing(0);
- } else {
+ }
+ else {
drawDispList(scene, v3d, rv3d, base, dt);
}
@@ -6546,11 +6586,11 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
set_inverted_drawing(0);
}
}
- else if(dt==OB_BOUNDBOX) {
- if((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= OB_WIRE)==0)
+ else if (dt==OB_BOUNDBOX) {
+ if ((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= OB_WIRE)==0)
draw_bounding_volume(scene, ob, ob->boundtype);
}
- else if(ED_view3d_boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb))
+ else if (ED_view3d_boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb))
empty_object= drawDispList(scene, v3d, rv3d, base, dt);
break;
@@ -6558,18 +6598,18 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
case OB_SURF:
cu= ob->data;
- if(cu->editnurb) {
+ if (cu->editnurb) {
ListBase *nurbs= curve_editnurbs(cu);
drawnurb(scene, v3d, rv3d, base, nurbs->first, dt);
}
- else if(dt==OB_BOUNDBOX) {
- if((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= OB_WIRE)==0)
+ else if (dt==OB_BOUNDBOX) {
+ if ((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= OB_WIRE)==0)
draw_bounding_volume(scene, ob, ob->boundtype);
}
- else if(ED_view3d_boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb)) {
+ else if (ED_view3d_boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb)) {
empty_object= drawDispList(scene, v3d, rv3d, base, dt);
-//XXX old animsys if(cu->path)
+//XXX old animsys if (cu->path)
// curve_draw_speed(scene, ob);
}
break;
@@ -6577,10 +6617,10 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
{
MetaBall *mb= ob->data;
- if(mb->editelems)
+ if (mb->editelems)
drawmball(scene, v3d, rv3d, base, dt);
- else if(dt==OB_BOUNDBOX) {
- if((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= OB_WIRE)==0)
+ else if (dt==OB_BOUNDBOX) {
+ if ((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= OB_WIRE)==0)
draw_bounding_volume(scene, ob, ob->boundtype);
}
else
@@ -6588,7 +6628,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
break;
}
case OB_EMPTY:
- if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) {
+ if ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) {
if (ob->empty_drawtype == OB_EMPTY_IMAGE) {
draw_empty_image(ob);
}
@@ -6598,9 +6638,9 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
}
break;
case OB_LAMP:
- if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) {
+ if ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) {
drawlamp(scene, v3d, rv3d, base, dt, flag);
- if(dtx || (base->flag & SELECT)) glMultMatrixf(ob->obmat);
+ if (dtx || (base->flag & SELECT)) glMultMatrixf(ob->obmat);
}
break;
case OB_CAMERA:
@@ -6611,35 +6651,35 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
break;
}
case OB_SPEAKER:
- if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0)
+ if ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0)
drawspeaker(scene, v3d, rv3d, ob, flag);
break;
case OB_LATTICE:
- if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) {
+ if ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) {
drawlattice(scene, v3d, ob);
}
break;
case OB_ARMATURE:
- if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) {
- if(dt>OB_WIRE) GPU_enable_material(0, NULL); // we use default material
+ if ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) {
+ if (dt>OB_WIRE) GPU_enable_material(0, NULL); // we use default material
empty_object= draw_armature(scene, v3d, ar, base, dt, flag, FALSE);
- if(dt>OB_WIRE) GPU_disable_material();
+ if (dt>OB_WIRE) GPU_disable_material();
}
break;
default:
- if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) {
+ if ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) {
drawaxes(1.0, OB_ARROWS);
}
}
- if((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) {
+ if ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) {
- if(ob->soft /*&& flag & OB_SBMOTION*/){
+ if (ob->soft /*&& flag & OB_SBMOTION*/) {
float mrt[3][3],msc[3][3],mtr[3][3];
SoftBody *sb= NULL;
float tipw = 0.5f, tiph = 0.5f,drawsize = 4.0f;
- if ((sb= ob->soft)){
- if(sb->solverflags & SBSO_ESTIMATEIPO){
+ if ((sb= ob->soft)) {
+ if (sb->solverflags & SBSO_ESTIMATEIPO) {
glLoadMatrixf(rv3d->viewmat);
copy_m3_m3(msc,sb->lscale);
@@ -6651,31 +6691,31 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
}
}
- if(ob->pd && ob->pd->forcefield) {
+ if (ob->pd && ob->pd->forcefield) {
draw_forcefield(scene, ob, rv3d);
}
}
/* code for new particle system */
- if( (warning_recursive==0) &&
+ if ( (warning_recursive==0) &&
(ob->particlesystem.first) &&
(flag & DRAW_PICKING)==0 &&
(ob!=scene->obedit)
) {
ParticleSystem *psys;
- if(col || (ob->flag & SELECT)) cpack(0xFFFFFF); /* for visibility, also while wpaint */
+ if (col || (ob->flag & SELECT)) cpack(0xFFFFFF); /* for visibility, also while wpaint */
//glDepthMask(GL_FALSE);
glLoadMatrixf(rv3d->viewmat);
view3d_cached_text_draw_begin();
- for(psys=ob->particlesystem.first; psys; psys=psys->next) {
+ for (psys=ob->particlesystem.first; psys; psys=psys->next) {
/* run this so that possible child particles get cached */
if (ob->mode & OB_MODE_PARTICLE_EDIT && is_obact) {
PTCacheEdit *edit = PE_create_current(scene, ob);
- if(edit && edit->psys == psys)
+ if (edit && edit->psys == psys)
draw_update_ptcache_edit(scene, ob, edit);
}
@@ -6687,7 +6727,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
glMultMatrixf(ob->obmat);
//glDepthMask(GL_TRUE);
- if(col) cpack(col);
+ if (col) cpack(col);
}
/* draw edit particles last so that they can draw over child particles */
@@ -6698,7 +6738,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
if (ob->mode & OB_MODE_PARTICLE_EDIT && is_obact) {
PTCacheEdit *edit = PE_create_current(scene, ob);
- if(edit) {
+ if (edit) {
glLoadMatrixf(rv3d->viewmat);
draw_update_ptcache_edit(scene, ob, edit);
draw_ptcache_edit(scene, v3d, edit);
@@ -6708,20 +6748,20 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
}
/* draw code for smoke */
- if((md = modifiers_findByType(ob, eModifierType_Smoke))) {
+ if ((md = modifiers_findByType(ob, eModifierType_Smoke))) {
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)
{
/*SmokeCollSettings *scs = smd->coll;
- if(scs->points)
+ if (scs->points)
{
size_t i;
glLoadMatrixf(rv3d->viewmat);
- if(col || (ob->flag & SELECT)) cpack(0xFFFFFF);
+ if (col || (ob->flag & SELECT)) cpack(0xFFFFFF);
glDepthMask(GL_FALSE);
glEnable(GL_BLEND);
@@ -6729,7 +6769,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
// glPointSize(3.0);
bglBegin(GL_POINTS);
- for(i = 0; i < scs->numpoints; i++)
+ for (i = 0; i < scs->numpoints; i++)
{
bglVertex3fv(&scs->points[3*i]);
}
@@ -6740,18 +6780,18 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
glMultMatrixf(ob->obmat);
glDisable(GL_BLEND);
glDepthMask(GL_TRUE);
- if(col) cpack(col);
+ if (col) cpack(col);
}
*/
}
// only draw domains
- if(smd->domain && smd->domain->fluid)
+ if (smd->domain && smd->domain->fluid)
{
- if(CFRA < smd->domain->point_cache[0]->startframe)
+ 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))
+ else if (!smd->domain->wt || !(smd->domain->viewsettings & MOD_SMOKE_VIEW_SHOWBIG))
{
// #if 0
smd->domain->tex = NULL;
@@ -6769,7 +6809,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
glLoadMatrixf(rv3d->viewmat);
// glMultMatrixf(ob->obmat);
- if(col || (ob->flag & SELECT)) cpack(0xFFFFFF);
+ if (col || (ob->flag & SELECT)) cpack(0xFFFFFF);
glDepthMask(GL_FALSE);
glEnable(GL_BLEND);
@@ -6777,14 +6817,14 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
// glPointSize(3.0);
bglBegin(GL_POINTS);
- for(x = 0; x < smd->domain->res[0]; x++)
- for(y = 0; y < smd->domain->res[1]; y++)
- for(z = 0; z < smd->domain->res[2]; z++)
+ for (x = 0; x < smd->domain->res[0]; x++)
+ for (y = 0; y < smd->domain->res[1]; y++)
+ for (z = 0; z < smd->domain->res[2]; z++)
{
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);
@@ -6803,10 +6843,10 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
glMultMatrixf(ob->obmat);
glDisable(GL_BLEND);
glDepthMask(GL_TRUE);
- if(col) cpack(col);
+ 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);
@@ -6819,21 +6859,21 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
}
}
- if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) {
+ if ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) {
bConstraint *con;
- for(con=ob->constraints.first; con; con= con->next)
+ for (con=ob->constraints.first; con; con= con->next)
{
- if(con->type==CONSTRAINT_TYPE_RIGIDBODYJOINT)
+ if (con->type==CONSTRAINT_TYPE_RIGIDBODYJOINT)
{
bRigidBodyJointConstraint *data = (bRigidBodyJointConstraint*)con->data;
- if(data->flag&CONSTRAINT_DRAW_PIVOT)
+ if (data->flag&CONSTRAINT_DRAW_PIVOT)
drawRBpivot(data);
}
}
- if(ob->gameflag & OB_BOUNDS) {
- if(ob->boundtype!=ob->collision_boundtype || (dtx & OB_BOUNDBOX)==0) {
+ if (ob->gameflag & OB_BOUNDS) {
+ if (ob->boundtype!=ob->collision_boundtype || (dtx & OB_BOUNDBOX)==0) {
setlinestyle(2);
draw_bounding_volume(scene, ob, ob->collision_boundtype);
setlinestyle(0);
@@ -6841,19 +6881,19 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
}
/* draw extra: after normal draw because of makeDispList */
- if(dtx && (G.f & G_RENDER_OGL)==0) {
+ if (dtx && (G.f & G_RENDER_OGL)==0) {
- if(dtx & OB_AXIS) {
+ if (dtx & OB_AXIS) {
drawaxes(1.0f, OB_ARROWS);
}
- if(dtx & OB_BOUNDBOX) {
+ if (dtx & OB_BOUNDBOX) {
draw_bounding_volume(scene, ob, ob->boundtype);
}
- if(dtx & OB_TEXSPACE) drawtexspace(ob);
- if(dtx & OB_DRAWNAME) {
+ 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 */
- if(flag == 0) {
+ if (flag == 0) {
float zero[3]= {0,0,0};
float curcol[4];
unsigned char tcol[4];
@@ -6863,13 +6903,13 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
view3d_cached_text_draw_add(zero, ob->id.name+2, 10, 0, tcol);
}
}
- /*if(dtx & OB_DRAWIMAGE) drawDispListwire(&ob->disp);*/
- if((dtx & OB_DRAWWIRE) && dt>=OB_SOLID) drawWireExtra(scene, rv3d, ob);
+ /*if (dtx & OB_DRAWIMAGE) drawDispListwire(&ob->disp);*/
+ 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) ||
+ if (dt<=OB_SOLID && (v3d->flag2 & V3D_RENDER_OVERRIDE)==0) {
+ if ((ob->gameflag & OB_DYNAMIC) ||
((ob->gameflag & OB_BOUNDS) && (ob->boundtype == OB_BOUND_SPHERE))) {
float imat[4][4], vec[3]= {0.0f, 0.0f, 0.0f};
@@ -6887,35 +6927,36 @@ 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) return;
+ if (base->flag & OB_FROMDUPLI) return;
+ if (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))) {
int do_draw_center= -1; /* defines below are zero or positive... */
- if(v3d->flag2 & V3D_RENDER_OVERRIDE) {
+ if (v3d->flag2 & V3D_RENDER_OVERRIDE) {
/* dont draw */
- } else if((scene->basact)==base)
+ }
+ else if ((scene->basact)==base)
do_draw_center= ACTIVE;
- else if(base->flag & SELECT)
+ else if (base->flag & SELECT)
do_draw_center= SELECT;
- else if(empty_object || (v3d->flag & V3D_DRAW_CENTERS))
+ else if (empty_object || (v3d->flag & V3D_DRAW_CENTERS))
do_draw_center= DESELECT;
- if(do_draw_center != -1) {
- if(flag & DRAW_PICKING) {
+ if (do_draw_center != -1) {
+ if (flag & DRAW_PICKING) {
/* draw a single point for opengl selection */
glBegin(GL_POINTS);
glVertex3fv(ob->obmat[3]);
glEnd();
}
- else if((flag & DRAW_CONSTCOLOR)==0) {
+ else if ((flag & DRAW_CONSTCOLOR)==0) {
/* we don't draw centers for duplicators and sets */
- if(U.obcenter_dia > 0) {
+ if (U.obcenter_dia > 0) {
/* check > 0 otherwise grease pencil can draw into the circle select which is annoying. */
drawcentercircle(v3d, rv3d, ob->obmat[3], do_draw_center, ob->id.lib || ob->id.us>1);
}
@@ -6924,14 +6965,14 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
}
/* not for sets, duplicators or picking */
- if(flag==0 && (v3d->flag & V3D_HIDE_HELPLINES)== 0 && (v3d->flag2 & V3D_RENDER_OVERRIDE)== 0) {
+ if (flag==0 && (v3d->flag & V3D_HIDE_HELPLINES)== 0 && (v3d->flag2 & V3D_RENDER_OVERRIDE)== 0) {
ListBase *list;
/* draw hook center and offset line */
- if(ob!=scene->obedit) draw_hooks(ob);
+ if (ob!=scene->obedit) draw_hooks(ob);
/* help lines and so */
- if(ob!=scene->obedit && ob->parent && (ob->parent->lay & v3d->lay)) {
+ if (ob!=scene->obedit && ob->parent && (ob->parent->lay & v3d->lay)) {
setlinestyle(3);
glBegin(GL_LINES);
glVertex3fv(ob->obmat[3]);
@@ -6959,25 +7000,25 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
ListBase targets = {NULL, NULL};
bConstraintTarget *ct;
- if(ELEM(cti->type, CONSTRAINT_TYPE_FOLLOWTRACK, CONSTRAINT_TYPE_OBJECTSOLVER)) {
+ if (ELEM(cti->type, CONSTRAINT_TYPE_FOLLOWTRACK, CONSTRAINT_TYPE_OBJECTSOLVER)) {
/* special case for object solver and follow track constraints because they don't fill
constraint targets properly (design limitation -- scene is needed for their target
but it can't be accessed from get_targets callvack) */
Object *camob= NULL;
- if(cti->type==CONSTRAINT_TYPE_FOLLOWTRACK) {
+ if (cti->type==CONSTRAINT_TYPE_FOLLOWTRACK) {
bFollowTrackConstraint *data= (bFollowTrackConstraint *)curcon->data;
camob= data->camera ? data->camera : scene->camera;
}
- else if(cti->type==CONSTRAINT_TYPE_OBJECTSOLVER) {
+ else if (cti->type==CONSTRAINT_TYPE_OBJECTSOLVER) {
bObjectSolverConstraint *data= (bObjectSolverConstraint *)curcon->data;
camob= data->camera ? data->camera : scene->camera;
}
- if(camob) {
+ if (camob) {
setlinestyle(3);
glBegin(GL_LINES);
glVertex3fv(camob->obmat[3]);
@@ -7075,7 +7116,8 @@ static int bbs_mesh_wire__setDrawOptions(void *userData, int index)
if (!BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) {
WM_set_framebuffer_index_color(offset+index);
return 1;
- } else {
+ }
+ else {
return 0;
}
}
@@ -7094,7 +7136,8 @@ static int bbs_mesh_solid__setSolidDrawOptions(void *userData, int index, int *U
WM_set_framebuffer_index_color(index+1);
}
return 1;
- } else {
+ }
+ else {
return 0;
}
}
@@ -7121,7 +7164,7 @@ static void bbs_mesh_solid_EM(BMEditMesh *em, Scene *scene, View3D *v3d,
ptrs[1] = (void*)(intptr_t) 1;
dm->drawMappedFaces(dm, bbs_mesh_solid__setSolidDrawOptions, GPU_enable_material, NULL, ptrs, 0);
- if(check_ob_drawface_dot(scene, v3d, ob->dt)) {
+ if (check_ob_drawface_dot(scene, v3d, ob->dt)) {
glPointSize(UI_GetThemeValuef(TH_FACEDOT_SIZE));
bglBegin(GL_POINTS);
@@ -7129,7 +7172,8 @@ static void bbs_mesh_solid_EM(BMEditMesh *em, Scene *scene, View3D *v3d,
bglEnd();
}
- } else {
+ }
+ else {
dm->drawMappedFaces(dm, bbs_mesh_solid__setSolidDrawOptions, GPU_enable_material, NULL, ptrs, 0);
}
}
@@ -7147,7 +7191,8 @@ static int bbs_mesh_solid_hide__setDrawOpts(void *userData, int index, int *UNUS
if (!(me->mpoly[index].flag&ME_HIDE)) {
WM_set_framebuffer_index_color(index+1);
return 1;
- } else {
+ }
+ else {
return 0;
}
}
@@ -7159,7 +7204,8 @@ static int bbs_mesh_solid_hide2__setDrawOpts(void *userData, int index, int *UNU
if (!(me->mpoly[index].flag & ME_HIDE)) {
return 1;
- } else {
+ }
+ else {
return 0;
}
}
@@ -7170,7 +7216,7 @@ static void bbs_mesh_solid(Scene *scene, Object *ob)
glColor3ub(0, 0, 0);
- if((me->editflag & ME_EDIT_PAINT_MASK))
+ if ((me->editflag & ME_EDIT_PAINT_MASK))
dm->drawMappedFaces(dm, bbs_mesh_solid_hide__setDrawOpts, GPU_enable_material, NULL, me, 0);
else
dm->drawMappedFaces(dm, bbs_mesh_solid__setDrawOpts, GPU_enable_material, NULL, me, 0);
@@ -7189,7 +7235,7 @@ void draw_object_backbufsel(Scene *scene, View3D *v3d, RegionView3D *rv3d, Objec
switch( ob->type) {
case OB_MESH:
- if(ob->mode & OB_MODE_EDIT) {
+ if (ob->mode & OB_MODE_EDIT) {
Mesh *me= ob->data;
BMEditMesh *em= me->edit_btmesh;
@@ -7198,7 +7244,7 @@ void draw_object_backbufsel(Scene *scene, View3D *v3d, RegionView3D *rv3d, Objec
EDBM_init_index_arrays(em, 1, 1, 1);
bbs_mesh_solid_EM(em, scene, v3d, ob, dm, ts->selectmode & SCE_SELECT_FACE);
- if(ts->selectmode & SCE_SELECT_FACE)
+ if (ts->selectmode & SCE_SELECT_FACE)
bm_solidoffs = 1+em->bm->totface;
else
bm_solidoffs= 1;
@@ -7210,7 +7256,7 @@ void draw_object_backbufsel(Scene *scene, View3D *v3d, RegionView3D *rv3d, Objec
bm_wireoffs= bm_solidoffs + em->bm->totedge;
// we draw verts if vert select mode or if in transform (for snap).
- if(ts->selectmode & SCE_SELECT_VERTEX || G.moving & G_TRANSFORM_EDIT) {
+ if (ts->selectmode & SCE_SELECT_VERTEX || G.moving & G_TRANSFORM_EDIT) {
bbs_mesh_verts(em, dm, bm_wireoffs);
bm_vertoffs= bm_wireoffs + em->bm->totvert;
}
@@ -7224,7 +7270,7 @@ void draw_object_backbufsel(Scene *scene, View3D *v3d, RegionView3D *rv3d, Objec
}
else {
Mesh *me= ob->data;
- if( (me->editflag & ME_EDIT_VERT_SEL) &&
+ if ( (me->editflag & ME_EDIT_VERT_SEL) &&
/* currently vertex select only supports weight paint */
(ob->mode & OB_MODE_WEIGHT_PAINT))
{
@@ -7263,22 +7309,22 @@ static void draw_object_mesh_instance(Scene *scene, View3D *v3d, RegionView3D *r
DerivedMesh *dm=NULL, *edm=NULL;
int glsl;
- if(ob->mode & OB_MODE_EDIT)
+ if (ob->mode & OB_MODE_EDIT)
edm= editbmesh_get_derived_base(ob, me->edit_btmesh);
else
dm = mesh_get_derived_final(scene, ob, CD_MASK_BAREMESH);
- if(dt<=OB_WIRE) {
- if(dm)
+ if (dt<=OB_WIRE) {
+ if (dm)
dm->drawEdges(dm, 1, 0);
- else if(edm)
+ else if (edm)
edm->drawEdges(edm, 1, 0);
}
else {
- if(outline)
+ if (outline)
draw_mesh_object_outline(v3d, ob, dm?dm:edm);
- if(dm) {
+ if (dm) {
glsl = draw_glsl_material(scene, ob, v3d, dt);
GPU_begin_object_materials(v3d, rv3d, scene, ob, glsl, NULL);
}
@@ -7292,18 +7338,18 @@ static void draw_object_mesh_instance(Scene *scene, View3D *v3d, RegionView3D *r
glFrontFace((ob->transflag&OB_NEG_SCALE)?GL_CW:GL_CCW);
glEnable(GL_LIGHTING);
- if(dm) {
+ if (dm) {
dm->drawFacesSolid(dm, NULL, 0, GPU_enable_material);
GPU_end_object_materials();
}
- else if(edm)
+ else if (edm)
edm->drawMappedFaces(edm, NULL, GPU_enable_material, NULL, NULL, 0);
glDisable(GL_LIGHTING);
}
- if(edm) edm->release(edm);
- if(dm) dm->release(dm);
+ if (edm) edm->release(edm);
+ if (dm) dm->release(dm);
}
void draw_object_instance(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob, int dt, int outline)
diff --git a/source/blender/editors/space_view3d/drawvolume.c b/source/blender/editors/space_view3d/drawvolume.c
index 2ab4491baa2..9618e5aeef0 100644
--- a/source/blender/editors/space_view3d/drawvolume.c
+++ b/source/blender/editors/space_view3d/drawvolume.c
@@ -218,7 +218,7 @@ void draw_volume(ARegion *ar, GPUTexture *tex, float *min, float *max, int res[3
float size[3];
- if(!tex) {
+ if (!tex) {
printf("Could not allocate 3D texture for 3D View smoke drawing.\n");
return;
}
@@ -331,7 +331,7 @@ void draw_volume(ARegion *ar, GPUTexture *tex, float *min, float *max, int res[3
}
}
- if(i >= 8) {
+ if (i >= 8) {
/* fallback, avoid using buffer over-run */
i= 0;
}
@@ -356,7 +356,7 @@ void draw_volume(ARegion *ar, GPUTexture *tex, float *min, float *max, int res[3
printf("Your gfx card does not support 3D View smoke drawing.\n");
GPU_texture_bind(tex, 0);
- if(tex_shadow)
+ if (tex_shadow)
GPU_texture_bind(tex_shadow, 1);
else
printf("No volume shadow\n");
@@ -382,11 +382,11 @@ void draw_volume(ARegion *ar, GPUTexture *tex, float *min, float *max, int res[3
points = MEM_callocN(sizeof(float)*12*3, "smoke_points_preview");
- while(1) {
+ while (1) {
float p0[3];
float tmp_point[3], tmp_point2[3];
- if(dd*(float)n > ds)
+ if (dd*(float)n > ds)
break;
copy_v3_v3(tmp_point, viewnormal);
@@ -406,11 +406,11 @@ 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 (i = 1; i < numpoints - 1; i++)
{
- for(j = i + 1; j < numpoints; j++)
+ for (j = i + 1; j < numpoints; j++)
{
- if(!convex(p0, viewnormal, &points[j * 3], &points[i * 3]))
+ if (!convex(p0, viewnormal, &points[j * 3], &points[i * 3]))
{
float tmp2[3];
copy_v3_v3(tmp2, &points[j * 3]);
@@ -437,11 +437,11 @@ void draw_volume(ARegion *ar, GPUTexture *tex, float *min, float *max, int res[3
tend();
// printf ( "Draw Time: %f\n",( float ) tval() );
- if(tex_shadow)
+ if (tex_shadow)
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,9 +450,9 @@ 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/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index 72a068af095..28fc4ff6d54 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -71,13 +71,13 @@ ARegion *view3d_has_buttons_region(ScrArea *sa)
ARegion *ar, *arnew;
ar= BKE_area_find_region_type(sa, RGN_TYPE_UI);
- if(ar) return ar;
+ if (ar) return ar;
/* add subdiv level; after header */
ar= BKE_area_find_region_type(sa, RGN_TYPE_HEADER);
/* is error! */
- if(ar==NULL) return NULL;
+ if (ar==NULL) return NULL;
arnew= MEM_callocN(sizeof(ARegion), "buttons for view3d");
@@ -94,24 +94,24 @@ ARegion *view3d_has_tools_region(ScrArea *sa)
{
ARegion *ar, *artool=NULL, *arprops=NULL, *arhead;
- for(ar= sa->regionbase.first; ar; ar= ar->next) {
- if(ar->regiontype==RGN_TYPE_TOOLS)
+ for (ar= sa->regionbase.first; ar; ar= ar->next) {
+ if (ar->regiontype==RGN_TYPE_TOOLS)
artool= ar;
- if(ar->regiontype==RGN_TYPE_TOOL_PROPS)
+ if (ar->regiontype==RGN_TYPE_TOOL_PROPS)
arprops= ar;
}
/* tool region hide/unhide also hides props */
- if(arprops && artool) return artool;
+ if (arprops && artool) return artool;
- if(artool==NULL) {
+ if (artool==NULL) {
/* add subdiv level; after header */
- for(arhead= sa->regionbase.first; arhead; arhead= arhead->next)
- if(arhead->regiontype==RGN_TYPE_HEADER)
+ for (arhead= sa->regionbase.first; arhead; arhead= arhead->next)
+ if (arhead->regiontype==RGN_TYPE_HEADER)
break;
/* is error! */
- if(arhead==NULL) return NULL;
+ if (arhead==NULL) return NULL;
artool= MEM_callocN(sizeof(ARegion), "tools for view3d");
@@ -121,7 +121,7 @@ ARegion *view3d_has_tools_region(ScrArea *sa)
artool->flag = RGN_FLAG_HIDDEN;
}
- if(arprops==NULL) {
+ if (arprops==NULL) {
/* add extra subdivided region for tool properties */
arprops= MEM_callocN(sizeof(ARegion), "tool props for view3d");
@@ -140,12 +140,12 @@ RegionView3D *ED_view3d_context_rv3d(bContext *C)
{
RegionView3D *rv3d= CTX_wm_region_view3d(C);
- if(rv3d==NULL) {
- ScrArea *sa =CTX_wm_area(C);
- if(sa && sa->spacetype==SPACE_VIEW3D) {
+ if (rv3d==NULL) {
+ ScrArea *sa = CTX_wm_area(C);
+ if (sa && sa->spacetype == SPACE_VIEW3D) {
ARegion *ar= BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
- if(ar) {
- rv3d= ar->regiondata;
+ if (ar) {
+ rv3d = ar->regiondata;
}
}
}
@@ -161,13 +161,13 @@ int ED_view3d_context_user_region(bContext *C, View3D **v3d_r, ARegion **ar_r)
*v3d_r = NULL;
*ar_r = NULL;
- if(sa && sa->spacetype==SPACE_VIEW3D) {
+ if (sa && sa->spacetype==SPACE_VIEW3D) {
ARegion *ar= CTX_wm_region(C);
View3D *v3d = (View3D *)sa->spacedata.first;
- if(ar) {
+ if (ar) {
RegionView3D *rv3d= ar->regiondata;
- if(rv3d && rv3d->viewlock == 0) {
+ if (rv3d && rv3d->viewlock == 0) {
*v3d_r = v3d;
*ar_r = ar;
return 1;
@@ -175,13 +175,13 @@ int ED_view3d_context_user_region(bContext *C, View3D **v3d_r, ARegion **ar_r)
else {
ARegion *ar_unlock_user= NULL;
ARegion *ar_unlock= NULL;
- for(ar= sa->regionbase.first; ar; ar= ar->next) {
+ for (ar= sa->regionbase.first; ar; ar= ar->next) {
/* find the first unlocked rv3d */
- if(ar->regiondata && ar->regiontype == RGN_TYPE_WINDOW) {
+ if (ar->regiondata && ar->regiontype == RGN_TYPE_WINDOW) {
rv3d= ar->regiondata;
- if(rv3d->viewlock == 0) {
+ if (rv3d->viewlock == 0) {
ar_unlock= ar;
- if(rv3d->persp==RV3D_PERSP || rv3d->persp==RV3D_CAMOB) {
+ if (rv3d->persp==RV3D_PERSP || rv3d->persp==RV3D_CAMOB) {
ar_unlock_user= ar;
break;
}
@@ -190,13 +190,13 @@ int ED_view3d_context_user_region(bContext *C, View3D **v3d_r, ARegion **ar_r)
}
/* camera/perspective view get priority when the active region is locked */
- if(ar_unlock_user) {
+ if (ar_unlock_user) {
*v3d_r = v3d;
*ar_r = ar_unlock_user;
return 1;
}
- if(ar_unlock) {
+ if (ar_unlock) {
*v3d_r = v3d;
*ar_r = ar_unlock;
return 1;
@@ -252,7 +252,7 @@ static SpaceLink *view3d_new(const bContext *C)
v3d->spacetype= SPACE_VIEW3D;
v3d->blockscale= 0.7f;
v3d->lay= v3d->layact= 1;
- if(scene) {
+ if (scene) {
v3d->lay= v3d->layact= scene->lay;
v3d->camera= scene->camera;
}
@@ -334,14 +334,14 @@ static void view3d_free(SpaceLink *sl)
View3D *vd= (View3D *) sl;
BGpic *bgpic;
- for(bgpic= vd->bgpicbase.first; bgpic; bgpic= bgpic->next) {
- if(bgpic->ima) bgpic->ima->id.us--;
+ for (bgpic= vd->bgpicbase.first; bgpic; bgpic= bgpic->next) {
+ if (bgpic->ima) bgpic->ima->id.us--;
}
BLI_freelistN(&vd->bgpicbase);
- if(vd->localvd) MEM_freeN(vd->localvd);
+ if (vd->localvd) MEM_freeN(vd->localvd);
- if(vd->properties_storage) MEM_freeN(vd->properties_storage);
+ if (vd->properties_storage) MEM_freeN(vd->properties_storage);
}
@@ -361,21 +361,21 @@ static SpaceLink *view3d_duplicate(SpaceLink *sl)
// XXX BIF_view3d_previewrender_free(v3do);
- if(v3do->localvd) {
+ if (v3do->localvd) {
v3do->localvd= NULL;
v3do->properties_storage= NULL;
v3do->lay= v3dn->localvd->lay;
v3do->lay &= 0xFFFFFF;
}
- if(v3dn->drawtype == OB_RENDER)
+ if (v3dn->drawtype == OB_RENDER)
v3dn->drawtype = OB_SOLID;
/* copy or clear inside new stuff */
BLI_duplicatelist(&v3dn->bgpicbase, &v3do->bgpicbase);
- for(bgpic= v3dn->bgpicbase.first; bgpic; bgpic= bgpic->next)
- if(bgpic->ima)
+ for (bgpic= v3dn->bgpicbase.first; bgpic; bgpic= bgpic->next)
+ if (bgpic->ima)
bgpic->ima->id.us++;
v3dn->properties_storage= NULL;
@@ -469,9 +469,9 @@ static void view3d_main_area_init(wmWindowManager *wm, ARegion *ar)
static int view3d_ob_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event))
{
- if(drag->type==WM_DRAG_ID) {
+ if (drag->type==WM_DRAG_ID) {
ID *id= (ID *)drag->poin;
- if( GS(id->name)==ID_OB )
+ if ( GS(id->name)==ID_OB )
return 1;
}
return 0;
@@ -479,9 +479,9 @@ static int view3d_ob_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSE
static int view3d_mat_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event))
{
- if(drag->type==WM_DRAG_ID) {
+ if (drag->type==WM_DRAG_ID) {
ID *id= (ID *)drag->poin;
- if( GS(id->name)==ID_MA )
+ if ( GS(id->name)==ID_MA )
return 1;
}
return 0;
@@ -489,13 +489,13 @@ static int view3d_mat_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUS
static int view3d_ima_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event))
{
- if(drag->type==WM_DRAG_ID) {
+ if (drag->type==WM_DRAG_ID) {
ID *id= (ID *)drag->poin;
- if( GS(id->name)==ID_IM )
+ if ( GS(id->name)==ID_IM )
return 1;
}
- else if(drag->type==WM_DRAG_PATH){
- if(ELEM(drag->icon, 0, ICON_FILE_IMAGE)) /* rule might not work? */
+ else if (drag->type==WM_DRAG_PATH) {
+ if (ELEM(drag->icon, 0, ICON_FILE_IMAGE)) /* rule might not work? */
return 1;
}
return 0;
@@ -504,7 +504,7 @@ static int view3d_ima_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUS
static int view3d_ima_bg_drop_poll(bContext *C, wmDrag *drag, wmEvent *event)
{
- if( ED_view3d_give_base_under_cursor(C, event->mval) ) {
+ if ( ED_view3d_give_base_under_cursor(C, event->mval) ) {
return 0;
}
return view3d_ima_drop_poll(C, drag, event);
@@ -512,7 +512,7 @@ static int view3d_ima_bg_drop_poll(bContext *C, wmDrag *drag, wmEvent *event)
static int view3d_ima_ob_drop_poll(bContext *C, wmDrag *drag, wmEvent *event)
{
- if( ED_view3d_give_base_under_cursor(C, event->mval) ) {
+ if ( ED_view3d_give_base_under_cursor(C, event->mval) ) {
return view3d_ima_drop_poll(C, drag, event);
}
return 0;
@@ -525,7 +525,7 @@ static void view3d_ob_drop_copy(wmDrag *drag, wmDropBox *drop)
/* need to put name in sub-operator in macro */
ptr= RNA_pointer_get(drop->ptr, "OBJECT_OT_add_named");
- if(ptr.data)
+ if (ptr.data)
RNA_string_set(&ptr, "name", id->name+2);
else
RNA_string_set(drop->ptr, "name", id->name+2);
@@ -542,9 +542,9 @@ static void view3d_id_path_drop_copy(wmDrag *drag, wmDropBox *drop)
{
ID *id= (ID *)drag->poin;
- if(id)
+ if (id)
RNA_string_set(drop->ptr, "name", id->name+2);
- if(drag->path[0])
+ if (drag->path[0])
RNA_string_set(drop->ptr, "filepath", drag->path);
}
@@ -567,19 +567,19 @@ static void view3d_main_area_free(ARegion *ar)
{
RegionView3D *rv3d= ar->regiondata;
- if(rv3d) {
- if(rv3d->localvd) MEM_freeN(rv3d->localvd);
- if(rv3d->clipbb) MEM_freeN(rv3d->clipbb);
+ if (rv3d) {
+ if (rv3d->localvd) MEM_freeN(rv3d->localvd);
+ if (rv3d->clipbb) MEM_freeN(rv3d->clipbb);
- if(rv3d->ri) {
+ if (rv3d->ri) {
// XXX BIF_view3d_previewrender_free(rv3d);
}
- if(rv3d->render_engine)
+ if (rv3d->render_engine)
RE_engine_free(rv3d->render_engine);
- if(rv3d->depths) {
- if(rv3d->depths->depths) MEM_freeN(rv3d->depths->depths);
+ if (rv3d->depths) {
+ if (rv3d->depths->depths) MEM_freeN(rv3d->depths->depths);
MEM_freeN(rv3d->depths);
}
MEM_freeN(rv3d);
@@ -590,13 +590,13 @@ static void view3d_main_area_free(ARegion *ar)
/* copy regiondata */
static void *view3d_main_area_duplicate(void *poin)
{
- if(poin) {
+ if (poin) {
RegionView3D *rv3d= poin, *new;
new= MEM_dupallocN(rv3d);
- if(rv3d->localvd)
+ if (rv3d->localvd)
new->localvd= MEM_dupallocN(rv3d->localvd);
- if(rv3d->clipbb)
+ if (rv3d->clipbb)
new->clipbb= MEM_dupallocN(rv3d->clipbb);
new->depths= NULL;
@@ -621,7 +621,7 @@ static void view3d_recalc_used_layers(ARegion *ar, wmNotifier *wmn, Scene *scene
if (!win) return;
base= scene->base.first;
- while(base) {
+ while (base) {
lay_used |= base->lay & ((1<<20)-1); /* ignore localview */
if (lay_used == (1<<20)-1)
@@ -630,9 +630,9 @@ static void view3d_recalc_used_layers(ARegion *ar, wmNotifier *wmn, Scene *scene
base= base->next;
}
- for(sa= win->screen->areabase.first; sa; sa= sa->next) {
- if(sa->spacetype == SPACE_VIEW3D) {
- if(BLI_findindex(&sa->regionbase, ar) != -1) {
+ for (sa= win->screen->areabase.first; sa; sa= sa->next) {
+ if (sa->spacetype == SPACE_VIEW3D) {
+ if (BLI_findindex(&sa->regionbase, ar) != -1) {
View3D *v3d= sa->spacedata.first;
v3d->lay_used= lay_used;
break;
@@ -725,7 +725,7 @@ static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn)
ED_region_tag_redraw(ar);
break;
case NC_BRUSH:
- if(wmn->action == NA_EDITED)
+ if (wmn->action == NA_EDITED)
ED_region_tag_redraw_overlay(ar);
break;
case NC_MATERIAL:
@@ -743,7 +743,7 @@ static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn)
case ND_WORLD_STARS:
{
RegionView3D *rv3d= ar->regiondata;
- if(rv3d->persp == RV3D_CAMOB) {
+ if (rv3d->persp == RV3D_CAMOB) {
ED_region_tag_redraw(ar);
}
}
@@ -766,11 +766,11 @@ static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn)
ED_region_tag_redraw(ar);
break;
case NC_MOVIECLIP:
- if(wmn->data==ND_DISPLAY)
+ if (wmn->data==ND_DISPLAY)
ED_region_tag_redraw(ar);
break;
case NC_SPACE:
- if(wmn->data == ND_SPACE_VIEW3D) {
+ if (wmn->data == ND_SPACE_VIEW3D) {
if (wmn->subtype == NS_VIEW3D_GPU) {
RegionView3D *rv3d= ar->regiondata;
rv3d->rflag |= RV3D_GPULIGHT_UPDATE;
@@ -779,7 +779,7 @@ static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn)
}
break;
case NC_ID:
- if(wmn->action == NA_RENAME)
+ if (wmn->action == NA_RENAME)
ED_region_tag_redraw(ar);
break;
case NC_SCREEN:
@@ -809,7 +809,7 @@ static void view3d_main_area_cursor(wmWindow *win, ScrArea *UNUSED(sa), ARegion
{
Scene *scene= win->screen->scene;
- if(scene->obedit) {
+ if (scene->obedit) {
WM_cursor_set(win, CURSOR_EDIT);
}
else {
@@ -851,7 +851,7 @@ static void view3d_header_area_listener(ARegion *ar, wmNotifier *wmn)
}
break;
case NC_SPACE:
- if(wmn->data == ND_SPACE_VIEW3D)
+ if (wmn->data == ND_SPACE_VIEW3D)
ED_region_tag_redraw(ar);
break;
}
@@ -938,19 +938,19 @@ static void view3d_buttons_area_listener(ARegion *ar, wmNotifier *wmn)
ED_region_tag_redraw(ar);
break;
case NC_BRUSH:
- if(wmn->action==NA_EDITED)
+ if (wmn->action==NA_EDITED)
ED_region_tag_redraw(ar);
break;
case NC_SPACE:
- if(wmn->data == ND_SPACE_VIEW3D)
+ if (wmn->data == ND_SPACE_VIEW3D)
ED_region_tag_redraw(ar);
break;
case NC_ID:
- if(wmn->action == NA_RENAME)
+ if (wmn->action == NA_RENAME)
ED_region_tag_redraw(ar);
break;
case NC_SCREEN:
- if(wmn->data == ND_GPENCIL)
+ if (wmn->data == ND_GPENCIL)
ED_region_tag_redraw(ar);
break;
}
@@ -977,15 +977,15 @@ static void view3d_props_area_listener(ARegion *ar, wmNotifier *wmn)
/* context changes */
switch(wmn->category) {
case NC_WM:
- if(wmn->data == ND_HISTORY)
+ if (wmn->data == ND_HISTORY)
ED_region_tag_redraw(ar);
break;
case NC_SCENE:
- if(wmn->data == ND_MODE)
+ if (wmn->data == ND_MODE)
ED_region_tag_redraw(ar);
break;
case NC_SPACE:
- if(wmn->data == ND_SPACE_VIEW3D)
+ if (wmn->data == ND_SPACE_VIEW3D)
ED_region_tag_redraw(ar);
break;
}
@@ -1001,7 +1001,7 @@ static void space_view3d_listener(struct ScrArea *sa, struct wmNotifier *wmn)
case NC_SCENE:
switch(wmn->data) {
case ND_WORLD:
- if(v3d->flag2 & V3D_RENDER_OVERRIDE)
+ if (v3d->flag2 & V3D_RENDER_OVERRIDE)
ED_area_tag_redraw_regiontype(sa, RGN_TYPE_WINDOW);
break;
}
@@ -1009,7 +1009,7 @@ static void space_view3d_listener(struct ScrArea *sa, struct wmNotifier *wmn)
case NC_WORLD:
switch(wmn->data) {
case ND_WORLD_DRAW:
- if(v3d->flag2 & V3D_RENDER_OVERRIDE)
+ if (v3d->flag2 & V3D_RENDER_OVERRIDE)
ED_area_tag_redraw_regiontype(sa, RGN_TYPE_WINDOW);
break;
}
@@ -1017,7 +1017,7 @@ static void space_view3d_listener(struct ScrArea *sa, struct wmNotifier *wmn)
case NC_MATERIAL:
switch(wmn->data) {
case ND_NODES:
- if(v3d->drawtype == OB_TEXTURE)
+ if (v3d->drawtype == OB_TEXTURE)
ED_area_tag_redraw_regiontype(sa, RGN_TYPE_WINDOW);
break;
}
@@ -1053,16 +1053,16 @@ static int view3d_context(const bContext *C, const char *member, bContextDataRes
/* fallback to the scene layer, allows duplicate and other object operators to run outside the 3d view */
unsigned int lay = v3d ? v3d->lay:scene->lay;
- if(CTX_data_dir(member)) {
+ if (CTX_data_dir(member)) {
CTX_data_dir_set(result, view3d_context_dir);
}
- else if(CTX_data_equals(member, "selected_objects") || CTX_data_equals(member, "selected_bases")) {
+ else if (CTX_data_equals(member, "selected_objects") || CTX_data_equals(member, "selected_bases")) {
int selected_objects= CTX_data_equals(member, "selected_objects");
- for(base=scene->base.first; base; base=base->next) {
- if((base->flag & SELECT) && (base->lay & lay)) {
- if((base->object->restrictflag & OB_RESTRICT_VIEW)==0) {
- if(selected_objects)
+ for (base=scene->base.first; base; base=base->next) {
+ if ((base->flag & SELECT) && (base->lay & lay)) {
+ if ((base->object->restrictflag & OB_RESTRICT_VIEW)==0) {
+ if (selected_objects)
CTX_data_id_list_add(result, &base->object->id);
else
CTX_data_list_add(result, &scene->id, &RNA_ObjectBase, base);
@@ -1072,14 +1072,14 @@ static int view3d_context(const bContext *C, const char *member, bContextDataRes
CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
return 1;
}
- else if(CTX_data_equals(member, "selected_editable_objects") || CTX_data_equals(member, "selected_editable_bases")) {
+ else if (CTX_data_equals(member, "selected_editable_objects") || CTX_data_equals(member, "selected_editable_bases")) {
int selected_editable_objects= CTX_data_equals(member, "selected_editable_objects");
- for(base=scene->base.first; base; base=base->next) {
- if((base->flag & SELECT) && (base->lay & lay)) {
- if((base->object->restrictflag & OB_RESTRICT_VIEW)==0) {
- if(0==object_is_libdata(base->object)) {
- if(selected_editable_objects)
+ for (base=scene->base.first; base; base=base->next) {
+ if ((base->flag & SELECT) && (base->lay & lay)) {
+ if ((base->object->restrictflag & OB_RESTRICT_VIEW)==0) {
+ if (0==object_is_libdata(base->object)) {
+ if (selected_editable_objects)
CTX_data_id_list_add(result, &base->object->id);
else
CTX_data_list_add(result, &scene->id, &RNA_ObjectBase, base);
@@ -1090,13 +1090,13 @@ static int view3d_context(const bContext *C, const char *member, bContextDataRes
CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
return 1;
}
- else if(CTX_data_equals(member, "visible_objects") || CTX_data_equals(member, "visible_bases")) {
+ else if (CTX_data_equals(member, "visible_objects") || CTX_data_equals(member, "visible_bases")) {
int visible_objects= CTX_data_equals(member, "visible_objects");
- for(base=scene->base.first; base; base=base->next) {
- if(base->lay & lay) {
- if((base->object->restrictflag & OB_RESTRICT_VIEW)==0) {
- if(visible_objects)
+ for (base=scene->base.first; base; base=base->next) {
+ if (base->lay & lay) {
+ if ((base->object->restrictflag & OB_RESTRICT_VIEW)==0) {
+ if (visible_objects)
CTX_data_id_list_add(result, &base->object->id);
else
CTX_data_list_add(result, &scene->id, &RNA_ObjectBase, base);
@@ -1106,13 +1106,13 @@ static int view3d_context(const bContext *C, const char *member, bContextDataRes
CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
return 1;
}
- else if(CTX_data_equals(member, "selectable_objects") || CTX_data_equals(member, "selectable_bases")) {
+ else if (CTX_data_equals(member, "selectable_objects") || CTX_data_equals(member, "selectable_bases")) {
int selectable_objects= CTX_data_equals(member, "selectable_objects");
- for(base=scene->base.first; base; base=base->next) {
- if(base->lay & lay) {
- if((base->object->restrictflag & OB_RESTRICT_VIEW)==0 && (base->object->restrictflag & OB_RESTRICT_SELECT)==0) {
- if(selectable_objects)
+ for (base=scene->base.first; base; base=base->next) {
+ if (base->lay & lay) {
+ if ((base->object->restrictflag & OB_RESTRICT_VIEW)==0 && (base->object->restrictflag & OB_RESTRICT_SELECT)==0) {
+ if (selectable_objects)
CTX_data_id_list_add(result, &base->object->id);
else
CTX_data_list_add(result, &scene->id, &RNA_ObjectBase, base);
@@ -1122,16 +1122,16 @@ static int view3d_context(const bContext *C, const char *member, bContextDataRes
CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
return 1;
}
- else if(CTX_data_equals(member, "active_base")) {
- if(scene->basact && (scene->basact->lay & lay))
- if((scene->basact->object->restrictflag & OB_RESTRICT_VIEW)==0)
+ else if (CTX_data_equals(member, "active_base")) {
+ if (scene->basact && (scene->basact->lay & lay))
+ if ((scene->basact->object->restrictflag & OB_RESTRICT_VIEW)==0)
CTX_data_pointer_set(result, &scene->id, &RNA_ObjectBase, scene->basact);
return 1;
}
- else if(CTX_data_equals(member, "active_object")) {
- if(scene->basact && (scene->basact->lay & lay))
- if((scene->basact->object->restrictflag & OB_RESTRICT_VIEW)==0)
+ else if (CTX_data_equals(member, "active_object")) {
+ if (scene->basact && (scene->basact->lay & lay))
+ if ((scene->basact->object->restrictflag & OB_RESTRICT_VIEW)==0)
CTX_data_id_pointer_set(result, &scene->basact->object->id);
return 1;
diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c
index 35145064169..ad70ae78f51 100644
--- a/source/blender/editors/space_view3d/view3d_buttons.c
+++ b/source/blender/editors/space_view3d/view3d_buttons.c
@@ -148,11 +148,11 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
defstr[0]= 0;
/* make sure we got storage */
- if(v3d->properties_storage==NULL)
+ if (v3d->properties_storage==NULL)
v3d->properties_storage= MEM_callocN(sizeof(TransformProperties), "TransformProperties");
tfp= v3d->properties_storage;
- if(ob->type==OB_MESH) {
+ if (ob->type==OB_MESH) {
Mesh *me= ob->data;
BMEditMesh *em = me->edit_btmesh;
BMesh *bm = em->bm;
@@ -161,7 +161,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
BMIter iter;
BM_ITER(eve, &iter, bm, BM_VERTS_OF_MESH, NULL) {
- if(BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
+ if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
evedef= eve;
tot++;
add_v3_v3(median, eve->co);
@@ -169,7 +169,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
}
BM_ITER(eed, &iter, bm, BM_EDGES_OF_MESH, NULL) {
- if(BM_elem_flag_test(eed, BM_ELEM_SELECT)) {
+ if (BM_elem_flag_test(eed, BM_ELEM_SELECT)) {
float *f;
totedge++;
@@ -182,33 +182,33 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
}
/* check for defgroups */
- if(evedef)
+ if (evedef)
dvert= CustomData_bmesh_get(&bm->vdata, evedef->head.data, CD_MDEFORMVERT);
- if(tot==1 && dvert && dvert->totweight) {
+ if (tot==1 && dvert && dvert->totweight) {
bDeformGroup *dg;
int i, max=1, init=1;
char str[320];
- for (i=0; i<dvert->totweight; i++){
+ for (i=0; i<dvert->totweight; i++) {
dg = BLI_findlink (&ob->defbase, dvert->dw[i].def_nr);
- if(dg) {
+ if (dg) {
max+= BLI_snprintf(str, sizeof(str), "%s %%x%d|", dg->name, dvert->dw[i].def_nr);
if (max < sizeof(str)) strcat(defstr, str);
}
- if(tfp->curdef==dvert->dw[i].def_nr) {
+ if (tfp->curdef==dvert->dw[i].def_nr) {
init= 0;
tfp->defweightp= &dvert->dw[i].weight;
}
}
- if(init) { // needs new initialized
+ if (init) { // needs new initialized
tfp->curdef= dvert->dw[0].def_nr;
tfp->defweightp= &dvert->dw[0].weight;
}
}
}
- else if(ob->type==OB_CURVE || ob->type==OB_SURF) {
+ else if (ob->type==OB_CURVE || ob->type==OB_SURF) {
Curve *cu= ob->data;
Nurb *nu;
BPoint *bp;
@@ -219,12 +219,12 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
void *selp= NULL;
nu= nurbs->first;
- while(nu) {
- if(nu->type == CU_BEZIER) {
+ while (nu) {
+ if (nu->type == CU_BEZIER) {
bezt= nu->bezt;
a= nu->pntsu;
- while(a--) {
- if(bezt->f2 & SELECT) {
+ while (a--) {
+ if (bezt->f2 & SELECT) {
add_v3_v3(median, bezt->vec[1]);
tot++;
median[4]+= bezt->weight;
@@ -235,11 +235,11 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
seltype= &RNA_BezierSplinePoint;
}
else {
- if(bezt->f1 & SELECT) {
+ if (bezt->f1 & SELECT) {
add_v3_v3(median, bezt->vec[0]);
tot++;
}
- if(bezt->f3 & SELECT) {
+ if (bezt->f3 & SELECT) {
add_v3_v3(median, bezt->vec[2]);
tot++;
}
@@ -250,8 +250,8 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
else {
bp= nu->bp;
a= nu->pntsu*nu->pntsv;
- while(a--) {
- if(bp->f1 & SELECT) {
+ while (a--) {
+ if (bp->f1 & SELECT) {
add_v3_v3(median, bp->vec);
median[3]+= bp->vec[3];
totw++;
@@ -269,18 +269,18 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
nu= nu->next;
}
- if(totradius==1)
+ if (totradius==1)
RNA_pointer_create(&cu->id, seltype, selp, &radius_ptr);
}
- else if(ob->type==OB_LATTICE) {
+ else if (ob->type==OB_LATTICE) {
Lattice *lt= ob->data;
BPoint *bp;
int a;
a= lt->editlatt->latt->pntsu*lt->editlatt->latt->pntsv*lt->editlatt->latt->pntsw;
bp= lt->editlatt->latt->def;
- while(a--) {
- if(bp->f1 & SELECT) {
+ while (a--) {
+ if (bp->f1 & SELECT) {
add_v3_v3(median, bp->vec);
tot++;
median[4]+= bp->weight;
@@ -290,7 +290,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
}
}
- if(tot==0) {
+ if (tot==0) {
uiDefBut(block, LABEL, 0, "Nothing selected",0, 130, 200, 20, NULL, 0, 0, 0, 0, "");
return;
}
@@ -301,20 +301,20 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
median[3] /= (float)totedge;
median[6] /= (float)totedge;
}
- else if(totw) median[3] /= (float)totw;
- if(totweight) median[4] /= (float)totweight;
- if(totradius) median[5] /= (float)totradius;
+ else if (totw) median[3] /= (float)totw;
+ if (totweight) median[4] /= (float)totweight;
+ if (totradius) median[5] /= (float)totradius;
- if(v3d->flag & V3D_GLOBAL_STATS)
+ if (v3d->flag & V3D_GLOBAL_STATS)
mul_m4_v3(ob->obmat, median);
- if(block) { // buttons
+ if (block) { // buttons
uiBut *but;
memcpy(tfp->ve_median, median, sizeof(tfp->ve_median));
uiBlockBeginAlign(block);
- if(tot==1) {
+ if (tot==1) {
uiDefBut(block, LABEL, 0, "Vertex:", 0, 150, 200, 20, NULL, 0, 0, 0, 0, "");
uiBlockBeginAlign(block);
@@ -325,16 +325,16 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
but= uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Z:", 0, 90, 200, 20, &(tfp->ve_median[2]), -lim, lim, 10, 3, "");
uiButSetUnitType(but, PROP_UNIT_LENGTH);
- if(totw==1) {
+ if (totw==1) {
uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "W:", 0, 70, 200, 20, &(tfp->ve_median[3]), 0.01, 100.0, 1, 3, "");
uiBlockBeginAlign(block);
uiDefButBitS(block, TOG, V3D_GLOBAL_STATS, B_REDR, "Global", 0, 45, 100, 20, &v3d->flag, 0, 0, 0, 0, "Displays global values");
uiDefButBitS(block, TOGN, V3D_GLOBAL_STATS, B_REDR, "Local", 100, 45, 100, 20, &v3d->flag, 0, 0, 0, 0, "Displays local values");
uiBlockEndAlign(block);
- if(totweight)
+ if (totweight)
uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Weight:", 0, 20, 200, 20, &(tfp->ve_median[4]), 0.0, 1.0, 1, 3, "");
- if(totradius) {
- if(totradius==1) uiDefButR(block, NUM, 0, "Radius", 0, 20, 200, 20, &radius_ptr, "radius", 0, 0.0, 100.0, 10, 3, NULL);
+ if (totradius) {
+ if (totradius==1) uiDefButR(block, NUM, 0, "Radius", 0, 20, 200, 20, &radius_ptr, "radius", 0, 0.0, 100.0, 10, 3, NULL);
else uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Radius:", 0, 20, 200, 20, &(tfp->ve_median[5]), 0.0, 100.0, 1, 3, "Radius of curve CPs");
}
}
@@ -343,10 +343,10 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
uiDefButBitS(block, TOG, V3D_GLOBAL_STATS, B_REDR, "Global", 0, 65, 100, 20, &v3d->flag, 0, 0, 0, 0, "Displays global values");
uiDefButBitS(block, TOGN, V3D_GLOBAL_STATS, B_REDR, "Local", 100, 65, 100, 20, &v3d->flag, 0, 0, 0, 0, "Displays local values");
uiBlockEndAlign(block);
- if(totweight)
+ if (totweight)
uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Weight:", 0, 40, 200, 20, &(tfp->ve_median[4]), 0.0, 1.0, 10, 3, "");
- if(totradius) {
- if(totradius==1) uiDefButR(block, NUM, 0, "Radius", 0, 40, 200, 20, &radius_ptr, "radius", 0, 0.0, 100.0, 10, 3, NULL);
+ if (totradius) {
+ if (totradius==1) uiDefButR(block, NUM, 0, "Radius", 0, 40, 200, 20, &radius_ptr, "radius", 0, 0.0, 100.0, 10, 3, NULL);
else uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Radius:", 0, 40, 200, 20, &(tfp->ve_median[5]), 0.0, 100.0, 10, 3, "Radius of curve CPs");
}
}
@@ -360,16 +360,16 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
uiButSetUnitType(but, PROP_UNIT_LENGTH);
but= uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Z:", 0, 90, 200, 20, &(tfp->ve_median[2]), -lim, lim, 10, 3, "");
uiButSetUnitType(but, PROP_UNIT_LENGTH);
- if(totw==tot) {
+ if (totw==tot) {
uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "W:", 0, 70, 200, 20, &(tfp->ve_median[3]), 0.01, 100.0, 1, 3, "");
uiBlockEndAlign(block);
uiBlockBeginAlign(block);
uiDefButBitS(block, TOG, V3D_GLOBAL_STATS, B_REDR, "Global", 0, 45, 100, 20, &v3d->flag, 0, 0, 0, 0, "Displays global values");
uiDefButBitS(block, TOGN, V3D_GLOBAL_STATS, B_REDR, "Local", 100, 45, 100, 20, &v3d->flag, 0, 0, 0, 0, "Displays local values");
uiBlockEndAlign(block);
- if(totweight)
+ if (totweight)
uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Weight:", 0, 20, 200, 20, &(tfp->ve_median[4]), 0.0, 1.0, 10, 3, "Weight is used for SoftBody Goal");
- if(totradius)
+ if (totradius)
uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Radius:", 0, 20, 200, 20, &(tfp->ve_median[5]), 0.0, 100.0, 10, 3, "Radius of curve CPs");
uiBlockEndAlign(block);
}
@@ -378,19 +378,19 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
uiDefButBitS(block, TOG, V3D_GLOBAL_STATS, B_REDR, "Global", 0, 65, 100, 20, &v3d->flag, 0, 0, 0, 0, "Displays global values");
uiDefButBitS(block, TOGN, V3D_GLOBAL_STATS, B_REDR, "Local", 100, 65, 100, 20, &v3d->flag, 0, 0, 0, 0, "Displays local values");
uiBlockEndAlign(block);
- if(totweight)
+ if (totweight)
uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Weight:", 0, 40, 200, 20, &(tfp->ve_median[4]), 0.0, 1.0, 1, 3, "Weight is used for SoftBody Goal");
- if(totradius)
+ if (totradius)
uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Radius:", 0, 20, 200, 20, &(tfp->ve_median[5]), 0.0, 100.0, 1, 3, "Radius of curve CPs");
uiBlockEndAlign(block);
}
}
- if(totedge==1){
+ if (totedge==1) {
uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Crease:", 0, 40, 200, 20, &(tfp->ve_median[3]), 0.0, 1.0, 1, 3, "");
uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Bevel Weight:", 0, 20, 200, 20, &(tfp->ve_median[6]), 0.0, 1.0, 1, 3, "");
}
- else if(totedge>1){
+ else if (totedge>1) {
uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Mean Crease:", 0, 40, 200, 20, &(tfp->ve_median[3]), 0.0, 1.0, 1, 3, "");
uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Mean Bevel Weight:", 0, 20, 200, 20, &(tfp->ve_median[6]), 0.0, 1.0, 1, 3, "");
}
@@ -399,7 +399,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
else { // apply
memcpy(ve_median, tfp->ve_median, sizeof(tfp->ve_median));
- if(v3d->flag & V3D_GLOBAL_STATS) {
+ if (v3d->flag & V3D_GLOBAL_STATS) {
invert_m4_m4(ob->imat, ob->obmat);
mul_m4_v3(ob->imat, median);
mul_m4_v3(ob->imat, ve_median);
@@ -410,17 +410,17 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
median[5]= ve_median[5]-median[5];
median[6]= ve_median[6]-median[6];
- if(ob->type==OB_MESH) {
+ if (ob->type==OB_MESH) {
Mesh *me= ob->data;
BMEditMesh *em = me->edit_btmesh;
BMesh *bm = em->bm;
BMVert *eve;
BMIter iter;
- if(len_v3(median) > 0.000001f) {
+ if (len_v3(median) > 0.000001f) {
BM_ITER(eve, &iter, bm, BM_VERTS_OF_MESH, NULL) {
- if(BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
+ if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
add_v3_v3(eve->co, median);
}
}
@@ -428,15 +428,15 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
EDBM_RecalcNormals(em);
}
- if(median[3] != 0.0f) {
+ if (median[3] != 0.0f) {
BMEdge *eed;
const float fixed_crease= (ve_median[3] <= 0.0f ? 0.0f : (ve_median[3] >= 1.0f ? 1.0f : FLT_MAX));
- if(fixed_crease != FLT_MAX) {
+ if (fixed_crease != FLT_MAX) {
/* simple case */
BM_ITER(eed, &iter, bm, BM_EDGES_OF_MESH, NULL) {
- if(BM_elem_flag_test(eed, BM_ELEM_SELECT)) {
+ if (BM_elem_flag_test(eed, BM_ELEM_SELECT)) {
float *crease = (float *)CustomData_bmesh_get(&bm->edata, eed->head.data, CD_CREASE);
if (!crease) break;
@@ -453,12 +453,12 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
CLAMP(median_orig, 0.0f, 1.0f);
CLAMP(median_new, 0.0f, 1.0f);
- if(median_new < median_orig) {
+ if (median_new < median_orig) {
/* scale down */
const float sca= median_new / median_orig;
BM_ITER(eed, &iter, bm, BM_EDGES_OF_MESH, NULL) {
- if(BM_elem_flag_test(eed, BM_ELEM_SELECT) && !BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) {
+ if (BM_elem_flag_test(eed, BM_ELEM_SELECT) && !BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) {
float *crease = (float *)CustomData_bmesh_get(&bm->edata, eed->head.data, CD_CREASE);
if (!crease) break;
@@ -473,7 +473,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
const float sca= (1.0f - median_new) / (1.0f - median_orig);
BM_ITER(eed, &iter, bm, BM_EDGES_OF_MESH, NULL) {
- if(BM_elem_flag_test(eed, BM_ELEM_SELECT) && !BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) {
+ if (BM_elem_flag_test(eed, BM_ELEM_SELECT) && !BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) {
float *crease = (float *)CustomData_bmesh_get(&bm->edata, eed->head.data, CD_CREASE);
if (!crease) break;
@@ -485,17 +485,17 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
}
}
- if(median[6] != 0.0f) {
+ if (median[6] != 0.0f) {
BMEdge *eed;
const float fixed_bweight = (ve_median[6] <= 0.0f ? 0.0f : (ve_median[6] >= 1.0f ? 1.0f : FLT_MAX));
- if(fixed_bweight != FLT_MAX) {
+ if (fixed_bweight != FLT_MAX) {
/* simple case */
BM_ITER(eed, &iter, bm, BM_EDGES_OF_MESH, NULL) {
- if(BM_elem_flag_test(eed, BM_ELEM_SELECT)) {
+ if (BM_elem_flag_test(eed, BM_ELEM_SELECT)) {
float *bweight = (float *)CustomData_bmesh_get(&bm->edata, eed->head.data, CD_BWEIGHT);
- if(!bweight) break;
+ if (!bweight) break;
*bweight = fixed_bweight;
}
@@ -510,14 +510,14 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
CLAMP(median_orig, 0.0f, 1.0f);
CLAMP(median_new, 0.0f, 1.0f);
- if(median_new < median_orig) {
+ if (median_new < median_orig) {
/* scale down */
const float sca = median_new / median_orig;
BM_ITER(eed, &iter, bm, BM_EDGES_OF_MESH, NULL) {
- if(BM_elem_flag_test(eed, BM_ELEM_SELECT) && !BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) {
+ if (BM_elem_flag_test(eed, BM_ELEM_SELECT) && !BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) {
float *bweight = (float *)CustomData_bmesh_get(&bm->edata, eed->head.data, CD_BWEIGHT);
- if(!bweight) break;
+ if (!bweight) break;
*bweight *= sca;
CLAMP(*bweight, 0.0f, 1.0f);
@@ -529,9 +529,9 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
const float sca = (1.0f - median_new) / (1.0f - median_orig);
BM_ITER(eed, &iter, bm, BM_EDGES_OF_MESH, NULL) {
- if(BM_elem_flag_test(eed, BM_ELEM_SELECT) && !BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) {
+ if (BM_elem_flag_test(eed, BM_ELEM_SELECT) && !BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) {
float *bweight = (float *)CustomData_bmesh_get(&bm->edata, eed->head.data, CD_BWEIGHT);
- if(!bweight) break;
+ if (!bweight) break;
*bweight = 1.0f - ((1.0f - *bweight) * sca);
CLAMP(*bweight, 0.0f, 1.0f);
@@ -542,7 +542,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
}
EDBM_RecalcNormals(em);
}
- else if(ob->type==OB_CURVE || ob->type==OB_SURF) {
+ else if (ob->type==OB_CURVE || ob->type==OB_SURF) {
Curve *cu= ob->data;
Nurb *nu;
BPoint *bp;
@@ -551,12 +551,12 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
ListBase *nurbs= curve_editnurbs(cu);
nu= nurbs->first;
- while(nu) {
- if(nu->type == CU_BEZIER) {
+ while (nu) {
+ if (nu->type == CU_BEZIER) {
bezt= nu->bezt;
a= nu->pntsu;
- while(a--) {
- if(bezt->f2 & SELECT) {
+ while (a--) {
+ if (bezt->f2 & SELECT) {
add_v3_v3(bezt->vec[0], median);
add_v3_v3(bezt->vec[1], median);
add_v3_v3(bezt->vec[2], median);
@@ -564,10 +564,10 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
bezt->radius+= median[5];
}
else {
- if(bezt->f1 & SELECT) {
+ if (bezt->f1 & SELECT) {
add_v3_v3(bezt->vec[0], median);
}
- if(bezt->f3 & SELECT) {
+ if (bezt->f3 & SELECT) {
add_v3_v3(bezt->vec[2], median);
}
}
@@ -577,8 +577,8 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
else {
bp= nu->bp;
a= nu->pntsu*nu->pntsv;
- while(a--) {
- if(bp->f1 & SELECT) {
+ while (a--) {
+ if (bp->f1 & SELECT) {
add_v3_v3(bp->vec, median);
bp->vec[3]+= median[3];
bp->weight+= median[4];
@@ -593,15 +593,15 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
nu= nu->next;
}
}
- else if(ob->type==OB_LATTICE) {
+ else if (ob->type==OB_LATTICE) {
Lattice *lt= ob->data;
BPoint *bp;
int a;
a= lt->editlatt->latt->pntsu*lt->editlatt->latt->pntsv*lt->editlatt->latt->pntsw;
bp= lt->editlatt->latt->def;
- while(a--) {
- if(bp->f1 & SELECT) {
+ while (a--) {
+ if (bp->f1 & SELECT) {
add_v3_v3(bp->vec, median);
bp->weight+= median[4];
}
@@ -619,12 +619,12 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
static void act_vert_def(Object *ob, BMVert **eve, MDeformVert **dvert)
{
- if(ob && ob->mode & OB_MODE_EDIT && ob->type==OB_MESH && ob->defbase.first) {
+ if (ob && ob->mode & OB_MODE_EDIT && ob->type==OB_MESH && ob->defbase.first) {
Mesh *me= ob->data;
BMEditMesh *em = me->edit_btmesh;
BMEditSelection *ese= (BMEditSelection*)em->bm->selected.last;
- if(ese && ese->htype == BM_VERT) {
+ if (ese && ese->htype == BM_VERT) {
*eve= (BMVert*)ese->data;
*dvert= CustomData_bmesh_get(&em->bm->vdata, (*eve)->head.data, CD_MDEFORMVERT);
return;
@@ -643,11 +643,11 @@ static void editvert_mirror_update(Object *ob, BMVert *eve, int def_nr, int inde
eve_mirr= editbmesh_get_x_mirror_vert(ob, em, eve, eve->co, index);
- if(eve_mirr && eve_mirr != eve) {
+ if (eve_mirr && eve_mirr != eve) {
MDeformVert *dvert_src= CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
MDeformVert *dvert_dst= CustomData_bmesh_get(&em->bm->vdata, eve_mirr->head.data, CD_MDEFORMVERT);
- if(dvert_dst) {
- if(def_nr == -1) {
+ if (dvert_dst) {
+ if (def_nr == -1) {
/* all vgroups, add groups where neded */
int flip_map_len;
int *flip_map= defgroup_flip_map(ob, &flip_map_len, TRUE);
@@ -657,7 +657,7 @@ static void editvert_mirror_update(Object *ob, BMVert *eve, int def_nr, int inde
else {
/* single vgroup */
MDeformWeight *dw= defvert_verify_index(dvert_dst, defgroup_flip_index(ob, def_nr, 1));
- if(dw) {
+ if (dw) {
dw->weight= defvert_find_weight(dvert_src, def_nr);
}
}
@@ -672,8 +672,8 @@ static void vgroup_adjust_active(Object *ob, int def_nr)
act_vert_def(ob, &eve_act, &dvert_act);
- if(dvert_act) {
- if(((Mesh *)ob->data)->editflag & ME_EDIT_MIRROR_X)
+ if (dvert_act) {
+ if (((Mesh *)ob->data)->editflag & ME_EDIT_MIRROR_X)
editvert_mirror_update(ob, eve_act, def_nr, -1);
}
}
@@ -685,7 +685,7 @@ static void vgroup_copy_active_to_sel(Object *ob)
act_vert_def(ob, &eve_act, &dvert_act);
- if(dvert_act==NULL) {
+ if (dvert_act==NULL) {
return;
}
else {
@@ -697,12 +697,12 @@ static void vgroup_copy_active_to_sel(Object *ob)
int index= 0;
BM_ITER(eve, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
- if(BM_elem_flag_test(eve, BM_ELEM_SELECT) && eve != eve_act) {
+ if (BM_elem_flag_test(eve, BM_ELEM_SELECT) && eve != eve_act) {
dvert= CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
- if(dvert) {
+ if (dvert) {
defvert_copy(dvert, dvert_act);
- if(me->editflag & ME_EDIT_MIRROR_X)
+ if (me->editflag & ME_EDIT_MIRROR_X)
editvert_mirror_update(ob, eve, -1, index);
}
@@ -720,7 +720,7 @@ static void vgroup_copy_active_to_sel_single(Object *ob, const int def_nr)
act_vert_def(ob, &eve_act, &dv_act);
- if(dv_act==NULL) {
+ if (dv_act==NULL) {
return;
}
else {
@@ -735,14 +735,14 @@ static void vgroup_copy_active_to_sel_single(Object *ob, const int def_nr)
dw= defvert_find_index(dv_act, def_nr);
- if(dw == NULL)
+ if (dw == NULL)
return;
weight_act= dw->weight;
eve = BM_iter_new(&iter, em->bm, BM_VERTS_OF_MESH, NULL);
for (index=0; eve; eve=BM_iter_step(&iter), index++) {
- if(BM_elem_flag_test(eve, BM_ELEM_SELECT) && eve != eve_act) {
+ if (BM_elem_flag_test(eve, BM_ELEM_SELECT) && eve != eve_act) {
dv= CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
dw= defvert_find_index(dv, def_nr);
if (dw) {
@@ -755,7 +755,7 @@ static void vgroup_copy_active_to_sel_single(Object *ob, const int def_nr)
}
}
- if(me->editflag & ME_EDIT_MIRROR_X) {
+ if (me->editflag & ME_EDIT_MIRROR_X) {
editvert_mirror_update(ob, eve_act, -1, -1);
}
}
@@ -768,12 +768,12 @@ static void vgroup_normalize_active(Object *ob)
act_vert_def(ob, &eve_act, &dvert_act);
- if(dvert_act==NULL)
+ if (dvert_act==NULL)
return;
defvert_normalize(dvert_act);
- if(((Mesh *)ob->data)->editflag & ME_EDIT_MIRROR_X)
+ if (((Mesh *)ob->data)->editflag & ME_EDIT_MIRROR_X)
editvert_mirror_update(ob, eve_act, -1, -1);
@@ -785,21 +785,21 @@ static void do_view3d_vgroup_buttons(bContext *C, void *UNUSED(arg), int event)
Scene *scene= CTX_data_scene(C);
Object *ob= OBACT;
- if(event==B_VGRP_PNL_NORMALIZE) {
+ if (event==B_VGRP_PNL_NORMALIZE) {
vgroup_normalize_active(ob);
}
- else if(event == B_VGRP_PNL_COPY) {
+ else if (event == B_VGRP_PNL_COPY) {
vgroup_copy_active_to_sel(ob);
}
- else if(event >= B_VGRP_PNL_COPY_SINGLE) {
+ else if (event >= B_VGRP_PNL_COPY_SINGLE) {
vgroup_copy_active_to_sel_single(ob, event - B_VGRP_PNL_COPY_SINGLE);
}
- else if(event >= B_VGRP_PNL_EDIT_SINGLE) {
+ else if (event >= B_VGRP_PNL_EDIT_SINGLE) {
vgroup_adjust_active(ob, event - B_VGRP_PNL_EDIT_SINGLE);
}
// todo
-// if(((Mesh *)ob->data)->editflag & ME_EDIT_MIRROR_X)
+// if (((Mesh *)ob->data)->editflag & ME_EDIT_MIRROR_X)
// ED_vgroup_mirror(ob, 1, 1, 0);
/* default for now */
@@ -831,7 +831,7 @@ static void view3d_panel_vgroup(const bContext *C, Panel *pa)
act_vert_def(ob, &eve, &dv);
- if(dv && dv->totweight) {
+ if (dv && dv->totweight) {
uiLayout *col;
bDeformGroup *dg;
MDeformWeight *dw = dv->dw;
@@ -847,7 +847,7 @@ static void view3d_panel_vgroup(const bContext *C, Panel *pa)
for (i= dv->totweight; i != 0; i--, dw++) {
dg = BLI_findlink (&ob->defbase, dw->def_nr);
- if(dg) {
+ if (dg) {
uiDefButF(block, NUM, B_VGRP_PNL_EDIT_SINGLE + dw->def_nr, dg->name, 0, yco, 180, 20, &dw->weight, 0.0, 1.0, 1, 3, "");
uiDefBut(block, BUT, B_VGRP_PNL_COPY_SINGLE + dw->def_nr, "C", 180,yco,20,20, NULL, 0, 0, 0, 0, "Copy this groups weight to other selected verts");
yco -= 20;
@@ -1068,7 +1068,8 @@ static void v3d_editarmature_buts(uiLayout *layout, Object *ob)
if (ebone->parent && ebone->flag & BONE_CONNECTED ) {
PointerRNA parptr = RNA_pointer_get(&eboneptr, "parent");
uiItemR(col, &parptr, "tail_radius", 0, "Radius (Parent)", ICON_NONE);
- } else {
+ }
+ else {
uiItemR(col, &eboneptr, "head_radius", 0, "Radius", ICON_NONE);
}
@@ -1152,7 +1153,7 @@ static void do_view3d_region_buttons(bContext *C, void *UNUSED(index), int event
case B_OBJECTPANELMEDIAN:
- if(ob) {
+ if (ob) {
v3d_editvertex_buts(NULL, v3d, ob, 1.0);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
}
@@ -1160,7 +1161,7 @@ static void do_view3d_region_buttons(bContext *C, void *UNUSED(index), int event
/* note; this case also used for parbone */
case B_OBJECTPANELPARENT:
- if(ob) {
+ if (ob) {
if (ob->id.lib || BKE_object_parent_loop_check(ob->parent, ob))
ob->parent= NULL;
else {
@@ -1247,13 +1248,13 @@ static void do_view3d_region_buttons(bContext *C, void *UNUSED(index), int event
break;
#endif
case B_CLR_WPAINT:
-// if(!multires_level1_test()) {
+// if (!multires_level1_test()) {
{
bDeformGroup *defGroup = BLI_findlink(&ob->defbase, ob->actdef-1);
- if(defGroup) {
+ if (defGroup) {
Mesh *me= ob->data;
int a;
- for(a=0; a<me->totvert; a++)
+ for (a=0; a<me->totvert; a++)
ED_vgroup_vert_remove (ob, defGroup, a);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
}
@@ -1272,19 +1273,19 @@ static void do_view3d_region_buttons(bContext *C, void *UNUSED(index), int event
rv3d= ar->regiondata;
viewlock= rv3d->viewlock;
- if((viewlock & RV3D_LOCKED)==0)
+ if ((viewlock & RV3D_LOCKED)==0)
viewlock= 0;
- else if((viewlock & RV3D_BOXVIEW)==0)
+ else if ((viewlock & RV3D_BOXVIEW)==0)
viewlock &= ~RV3D_BOXCLIP;
- for(; ar; ar= ar->prev) {
- if(ar->alignment==RGN_ALIGN_QSPLIT) {
+ for (; ar; ar= ar->prev) {
+ if (ar->alignment==RGN_ALIGN_QSPLIT) {
rv3d= ar->regiondata;
rv3d->viewlock= viewlock;
}
}
- if(rv3d->viewlock & RV3D_BOXVIEW)
+ if (rv3d->viewlock & RV3D_BOXVIEW)
view3d_boxview_copy(sa, sa->regionbase.last);
ED_area_tag_redraw(sa);
@@ -1309,20 +1310,20 @@ static void view3d_panel_object(const bContext *C, Panel *pa)
uiLayout *col /* , *row */ /* UNUSED */;
float lim;
- if(ob==NULL) return;
+ if (ob==NULL) return;
/* make sure we got storage */
/*
- if(v3d->properties_storage==NULL)
+ if (v3d->properties_storage==NULL)
v3d->properties_storage= MEM_callocN(sizeof(TransformProperties), "TransformProperties");
tfp= v3d->properties_storage;
// XXX uiSetButLock(object_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
- if(ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT)) {
+ if (ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT)) {
}
else {
- if((ob->mode & OB_MODE_PARTICLE_EDIT)==0) {
+ if ((ob->mode & OB_MODE_PARTICLE_EDIT)==0) {
uiBlockEndAlign(block);
}
}
@@ -1337,12 +1338,12 @@ static void view3d_panel_object(const bContext *C, Panel *pa)
/* row= uiLayoutRow(col, 0); */ /* UNUSED */
RNA_id_pointer_create(&ob->id, &obptr);
- if(ob==obedit) {
- if(ob->type==OB_ARMATURE) v3d_editarmature_buts(col, ob);
- else if(ob->type==OB_MBALL) v3d_editmetaball_buts(col, ob);
+ if (ob==obedit) {
+ if (ob->type==OB_ARMATURE) v3d_editarmature_buts(col, ob);
+ else if (ob->type==OB_MBALL) v3d_editmetaball_buts(col, ob);
else v3d_editvertex_buts(col, v3d, ob, lim);
}
- else if(ob->mode & OB_MODE_POSE) {
+ else if (ob->mode & OB_MODE_POSE) {
v3d_posearmature_buts(col, ob);
}
else {
@@ -1364,11 +1365,11 @@ static void view3d_panel_preview(bContext *C, ARegion *ar, short cntrl) // VIEW3
ofsx= -150+(sa->winx/2)/v3d->blockscale;
ofsy= -100+(sa->winy/2)/v3d->blockscale;
- if(uiNewPanel(C, ar, block, "Preview", "View3d", ofsx, ofsy, 300, 200)==0) return;
+ if (uiNewPanel(C, ar, block, "Preview", "View3d", ofsx, ofsy, 300, 200)==0) return;
uiBlockSetDrawExtraFunc(block, BIF_view3d_previewdraw);
- if(scene->recalc & SCE_PRV_CHANGED) {
+ if (scene->recalc & SCE_PRV_CHANGED) {
scene->recalc &= ~SCE_PRV_CHANGED;
//printf("found recalc\n");
BIF_view3d_previewrender_free(sa->spacedata.first);
@@ -1408,7 +1409,7 @@ static int view3d_properties(bContext *C, wmOperator *UNUSED(op))
ScrArea *sa= CTX_wm_area(C);
ARegion *ar= view3d_has_buttons_region(sa);
- if(ar)
+ if (ar)
ED_region_toggle_hidden(C, ar);
return OPERATOR_FINISHED;
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index c73d8e14f05..63d93108877 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -152,7 +152,7 @@ static void view3d_draw_clipping(RegionView3D *rv3d)
{
BoundBox *bb= rv3d->clipbb;
- if(bb) {
+ if (bb) {
static unsigned int clipping_index[6][4]= {{0, 1, 2, 3},
{0, 4, 5, 1},
{4, 7, 6, 5},
@@ -175,9 +175,9 @@ void view3d_set_clipping(RegionView3D *rv3d)
double plane[4];
int a, tot=4;
- if(rv3d->viewlock) tot= 6;
+ if (rv3d->viewlock) tot= 6;
- for(a=0; a<tot; a++) {
+ for (a=0; a<tot; a++) {
QUATCOPY(plane, rv3d->clip[a]);
glClipPlane(GL_CLIP_PLANE0+a, plane);
glEnable(GL_CLIP_PLANE0+a);
@@ -188,7 +188,7 @@ void view3d_clr_clipping(void)
{
int a;
- for(a=0; a<6; a++) {
+ for (a=0; a<6; a++) {
glDisable(GL_CLIP_PLANE0+a);
}
}
@@ -198,10 +198,10 @@ static int test_clipping(const float vec[3], float clip[][4])
float view[3];
copy_v3_v3(view, vec);
- if(0.0f < clip[0][3] + dot_v3v3(view, clip[0]))
- if(0.0f < clip[1][3] + dot_v3v3(view, clip[1]))
- if(0.0f < clip[2][3] + dot_v3v3(view, clip[2]))
- if(0.0f < clip[3][3] + dot_v3v3(view, clip[3]))
+ if (0.0f < clip[0][3] + dot_v3v3(view, clip[0]))
+ if (0.0f < clip[1][3] + dot_v3v3(view, clip[1]))
+ if (0.0f < clip[2][3] + dot_v3v3(view, clip[2]))
+ if (0.0f < clip[3][3] + dot_v3v3(view, clip[3]))
return 0;
return 1;
@@ -233,7 +233,7 @@ static void drawgrid_draw(ARegion *ar, float wx, float wy, float x, float y, flo
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(2, GL_FLOAT, 0, verts);
- while(verts[0][0] < ar->winx) {
+ while (verts[0][0] < ar->winx) {
glDrawArrays(GL_LINES, 0, 2);
verts[0][0] = verts[1][0] = verts[0][0] + dx;
}
@@ -244,7 +244,7 @@ static void drawgrid_draw(ARegion *ar, float wx, float wy, float x, float y, flo
/* iter over 'Y' */
verts[0][1]= verts[1][1]= y-dx*floorf(y/dx);
- while(verts[0][1] < ar->winy) {
+ while (verts[0][1] < ar->winy) {
glDrawArrays(GL_LINES, 0, 2);
verts[0][1] = verts[1][1] = verts[0][1] + dx;
}
@@ -285,14 +285,14 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char **
fw= vec4[3];
dx= fabs(x-(wx)*fx/fw);
- if(dx==0) dx= fabs(y-(wy)*fy/fw);
+ if (dx==0) dx= fabs(y-(wy)*fy/fw);
glDepthMask(0); // disable write in zbuffer
/* check zoom out */
UI_ThemeColor(TH_GRID);
- if(unit->system) {
+ if (unit->system) {
/* Use GRID_MIN_PX*2 for units because very very small grid
* items are less useful when dealing with units */
void *usys;
@@ -302,9 +302,9 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char **
bUnit_GetSystem(&usys, &len, unit->system, B_UNIT_LENGTH);
- if(usys) {
+ if (usys) {
i= len;
- while(i--) {
+ while (i--) {
float scalar= bUnit_GetScaler(usys, i);
dx_scalar = dx * scalar / unit->scale_length;
@@ -312,7 +312,7 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char **
continue;
/* Store the smallest drawn grid size units name so users know how big each grid cell is */
- if(*grid_unit==NULL) {
+ if (*grid_unit==NULL) {
*grid_unit= bUnit_GetNameDisplay(usys, i);
rv3d->gridview= (scalar * v3d->grid) / unit->scale_length;
}
@@ -332,18 +332,18 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char **
else {
short sublines = v3d->gridsubdiv;
- if(dx<GRID_MIN_PX) {
+ if (dx<GRID_MIN_PX) {
rv3d->gridview*= sublines;
dx*= sublines;
- if(dx<GRID_MIN_PX) {
+ if (dx<GRID_MIN_PX) {
rv3d->gridview*= sublines;
dx*= sublines;
- if(dx<GRID_MIN_PX) {
+ if (dx<GRID_MIN_PX) {
rv3d->gridview*= sublines;
dx*=sublines;
- if(dx<GRID_MIN_PX);
+ if (dx<GRID_MIN_PX);
else {
UI_ThemeColor(TH_GRID);
drawgrid_draw(ar, wx, wy, x, y, dx);
@@ -366,13 +366,13 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char **
}
}
else {
- if(dx>(GRID_MIN_PX*10)) { // start blending in
+ if (dx>(GRID_MIN_PX*10)) { // start blending in
rv3d->gridview/= sublines;
dx/= sublines;
- if(dx>(GRID_MIN_PX*10)) { // start blending in
+ if (dx>(GRID_MIN_PX*10)) { // start blending in
rv3d->gridview/= sublines;
dx/= sublines;
- if(dx>(GRID_MIN_PX*10)) {
+ if (dx>(GRID_MIN_PX*10)) {
UI_ThemeColor(TH_GRID);
drawgrid_draw(ar, wx, wy, x, y, dx);
}
@@ -408,7 +408,7 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char **
/* center cross */
/* horizontal line */
- if( ELEM(rv3d->view, RV3D_VIEW_RIGHT, RV3D_VIEW_LEFT))
+ if ( ELEM(rv3d->view, RV3D_VIEW_RIGHT, RV3D_VIEW_LEFT))
UI_make_axis_color(col, col2, 'Y');
else UI_make_axis_color(col, col2, 'X');
glColor3ubv(col2);
@@ -416,7 +416,7 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char **
fdrawline(0.0, y, (float)ar->winx, y);
/* vertical line */
- if( ELEM(rv3d->view, RV3D_VIEW_TOP, RV3D_VIEW_BOTTOM))
+ if ( ELEM(rv3d->view, RV3D_VIEW_TOP, RV3D_VIEW_BOTTOM))
UI_make_axis_color(col, col2, 'Y');
else UI_make_axis_color(col, col2, 'Z');
glColor3ubv(col2);
@@ -433,19 +433,19 @@ static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit)
unsigned char col_grid[3];
const int gridlines= v3d->gridlines/2;
- if(v3d->gridlines<3) return;
+ if (v3d->gridlines<3) return;
grid_scale= v3d->grid;
/* use 'grid_scale' instead of 'v3d->grid' from now on */
/* apply units */
- if(scene->unit.system) {
+ if (scene->unit.system) {
void *usys;
int len;
bUnit_GetSystem(&usys, &len, scene->unit.system, B_UNIT_LENGTH);
- if(usys) {
+ if (usys) {
int i= bUnit_GetBaseUnit(usys);
*grid_unit= bUnit_GetNameDisplay(usys, i);
grid_scale = (grid_scale * (float)bUnit_GetScaler(usys, i)) / scene->unit.scale_length;
@@ -454,12 +454,12 @@ static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit)
grid= gridlines * grid_scale;
- if(v3d->zbuf && scene->obedit) glDepthMask(0); // for zbuffer-select
+ if (v3d->zbuf && scene->obedit) glDepthMask(0); // for zbuffer-select
UI_GetThemeColor3ubv(TH_GRID, col_grid);
/* draw the Y axis and/or grid lines */
- if(v3d->gridflag & V3D_SHOW_FLOOR) {
+ if (v3d->gridflag & V3D_SHOW_FLOOR) {
float vert[4][3]= {{0.0f}};
unsigned char col_bg[3];
unsigned char col_grid_emphasise[3], col_grid_light[3];
@@ -481,11 +481,11 @@ static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit)
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3, GL_FLOAT, 0, vert);
- for(a= -gridlines;a<=gridlines;a++) {
+ for (a= -gridlines;a<=gridlines;a++) {
const float line= a * grid_scale;
const int is_emphasise= (a % 10) == 0;
- if(is_emphasise != prev_emphasise) {
+ if (is_emphasise != prev_emphasise) {
glColor3ubv(is_emphasise ? col_grid_emphasise : col_grid_light);
prev_emphasise= is_emphasise;
}
@@ -506,7 +506,7 @@ static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit)
/* check for the 'show Z axis' preference */
if (v3d->gridflag & (V3D_SHOW_X | V3D_SHOW_Y | V3D_SHOW_Z)) {
int axis;
- for(axis= 0; axis < 3; axis++)
+ for (axis= 0; axis < 3; axis++)
if (v3d->gridflag & (V3D_SHOW_X << axis)) {
float vert[3];
unsigned char tcol[3];
@@ -527,7 +527,7 @@ static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit)
- if(v3d->zbuf && scene->obedit) glDepthMask(1);
+ if (v3d->zbuf && scene->obedit) glDepthMask(1);
}
@@ -545,7 +545,7 @@ static void drawcursor(Scene *scene, ARegion *ar, View3D *v3d)
mx = co[0];
my = co[1];
- if(mx!=IS_CLIPPED) {
+ if (mx!=IS_CLIPPED) {
setlinestyle(0);
cpack(0xFF);
circ((float)mx, (float)my, 10.0);
@@ -749,11 +749,11 @@ static void draw_view_icon(RegionView3D *rv3d)
{
BIFIconID icon;
- if( ELEM(rv3d->view, RV3D_VIEW_TOP, RV3D_VIEW_BOTTOM))
+ if ( ELEM(rv3d->view, RV3D_VIEW_TOP, RV3D_VIEW_BOTTOM))
icon= ICON_AXIS_TOP;
- else if( ELEM(rv3d->view, RV3D_VIEW_FRONT, RV3D_VIEW_BACK))
+ else if ( ELEM(rv3d->view, RV3D_VIEW_FRONT, RV3D_VIEW_BACK))
icon= ICON_AXIS_FRONT;
- else if( ELEM(rv3d->view, RV3D_VIEW_RIGHT, RV3D_VIEW_LEFT))
+ else if ( ELEM(rv3d->view, RV3D_VIEW_RIGHT, RV3D_VIEW_LEFT))
icon= ICON_AXIS_SIDE;
else return ;
@@ -801,10 +801,12 @@ static const char *view3d_get_name(View3D *v3d, RegionView3D *rv3d)
Camera *cam;
cam = v3d->camera->data;
name = (cam->type != CAM_ORTHO) ? "Camera Persp" : "Camera Ortho";
- } else {
+ }
+ else {
name = "Object as Camera";
}
- } else {
+ }
+ else {
name = (rv3d->persp == RV3D_ORTHO) ? "User Ortho" : "User Persp";
}
break;
@@ -842,35 +844,35 @@ static void draw_selected_name(Scene *scene, Object *ob)
markern= scene_find_marker_name(scene, CFRA);
/* check if there is an object */
- if(ob) {
+ if (ob) {
/* name(s) to display depends on type of object */
- if(ob->type==OB_ARMATURE) {
+ if (ob->type==OB_ARMATURE) {
bArmature *arm= ob->data;
char *name= NULL;
/* show name of active bone too (if possible) */
- if(arm->edbo) {
+ if (arm->edbo) {
- if(arm->act_edbone)
+ if (arm->act_edbone)
name= ((EditBone *)arm->act_edbone)->name;
}
- else if(ob->mode & OB_MODE_POSE) {
- if(arm->act_bone) {
+ else if (ob->mode & OB_MODE_POSE) {
+ if (arm->act_bone) {
- if(arm->act_bone->layer & arm->layer)
+ if (arm->act_bone->layer & arm->layer)
name= arm->act_bone->name;
}
}
- if(name && markern)
+ if (name && markern)
BLI_snprintf(info, sizeof(info), "(%d) %s %s <%s>", CFRA, ob->id.name+2, name, markern);
- else if(name)
+ else if (name)
BLI_snprintf(info, sizeof(info), "(%d) %s %s", CFRA, ob->id.name+2, name);
else
BLI_snprintf(info, sizeof(info), "(%d) %s", CFRA, ob->id.name+2);
}
- else if(ELEM3(ob->type, OB_MESH, OB_LATTICE, OB_CURVE)) {
+ else if (ELEM3(ob->type, OB_MESH, OB_LATTICE, OB_CURVE)) {
Key *key= NULL;
KeyBlock *kb = NULL;
char shapes[MAX_NAME + 10];
@@ -878,17 +880,17 @@ static void draw_selected_name(Scene *scene, Object *ob)
/* try to display active shapekey too */
shapes[0] = '\0';
key = ob_get_key(ob);
- if(key){
+ if (key) {
kb = BLI_findlink(&key->block, ob->shapenr-1);
- if(kb){
+ if (kb) {
BLI_snprintf(shapes, sizeof(shapes), ": %s ", kb->name);
- if(ob->shapeflag == OB_SHAPE_LOCK){
+ if (ob->shapeflag == OB_SHAPE_LOCK) {
strcat(shapes, " (Pinned)");
}
}
}
- if(markern)
+ if (markern)
BLI_snprintf(info, sizeof(info), "(%d) %s %s <%s>", CFRA, ob->id.name+2, shapes, markern);
else
BLI_snprintf(info, sizeof(info), "(%d) %s %s", CFRA, ob->id.name+2, shapes);
@@ -933,7 +935,7 @@ static void view3d_camera_border(Scene *scene, ARegion *ar, View3D *v3d, RegionV
/* get viewport viewplane */
camera_params_init(&params);
camera_params_from_view3d(&params, v3d, rv3d);
- if(no_zoom)
+ if (no_zoom)
params.zoom= 1.0f;
camera_params_compute_viewplane(&params, ar->winx, ar->winy, 1.0f, 1.0f);
rect_view= params.viewplane;
@@ -941,7 +943,7 @@ static void view3d_camera_border(Scene *scene, ARegion *ar, View3D *v3d, RegionV
/* get camera viewplane */
camera_params_init(&params);
camera_params_from_object(&params, v3d->camera);
- if(no_shift) {
+ if (no_shift) {
params.shiftx= 0.0f;
params.shifty= 0.0f;
}
@@ -1002,14 +1004,14 @@ static void drawviewborder_triangle(float x1, float x2, float y1, float y2, cons
float h= y2 - y1;
glBegin(GL_LINES);
- if(w > h) {
- if(golden) {
+ if (w > h) {
+ if (golden) {
ofs = w * (1.0f-(1.0f/1.61803399f));
}
else {
ofs = h * (h / w);
}
- if(dir == 'B') SWAP(float, y1, y2);
+ if (dir == 'B') SWAP(float, y1, y2);
glVertex2f(x1, y1);
glVertex2f(x2, y2);
@@ -1021,13 +1023,13 @@ static void drawviewborder_triangle(float x1, float x2, float y1, float y2, cons
glVertex2f(x1 + ofs, y1);
}
else {
- if(golden) {
+ if (golden) {
ofs = h * (1.0f-(1.0f/1.61803399f));
}
else {
ofs = w * (w / h);
}
- if(dir == 'B') SWAP(float, x1, x2);
+ if (dir == 'B') SWAP(float, x1, x2);
glVertex2f(x1, y1);
glVertex2f(x2, y2);
@@ -1051,9 +1053,9 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d)
Camera *ca= NULL;
RegionView3D *rv3d= (RegionView3D *)ar->regiondata;
- if(v3d->camera==NULL)
+ if (v3d->camera==NULL)
return;
- if(v3d->camera->type==OB_CAMERA)
+ if (v3d->camera->type==OB_CAMERA)
ca = v3d->camera->data;
ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &viewborder, FALSE);
@@ -1079,7 +1081,8 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d)
if (ca && (ca->flag & CAM_SHOWPASSEPARTOUT) && ca->passepartalpha > 0.000001f) {
if (ca->passepartalpha == 1.0f) {
glColor3f(0, 0, 0);
- } else {
+ }
+ else {
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
glEnable(GL_BLEND);
glColor4f(0, 0, 0, ca->passepartalpha);
@@ -1106,7 +1109,7 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d)
glRectf(x1i, y1i, x2i, y2i);
#ifdef VIEW3D_CAMERA_BORDER_HACK
- if(view3d_camera_border_hack_test == TRUE) {
+ if (view3d_camera_border_hack_test == TRUE) {
glColor4fv(view3d_camera_border_hack_col);
glRectf(x1i+1, y1i+1, x2i-1, y2i-1);
view3d_camera_border_hack_test= FALSE;
@@ -1125,7 +1128,7 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d)
glRectf(x1i, y1i, x2i, y2i);
/* border */
- if(scene->r.mode & R_BORDER) {
+ if (scene->r.mode & R_BORDER) {
cpack(0);
x3= x1+ scene->r.border.xmin*(x2-x1);
@@ -1138,7 +1141,7 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d)
}
/* safety border */
- if(ca) {
+ if (ca) {
if (ca->dtx & CAM_DTX_CENTER) {
UI_ThemeColorBlendShade(TH_WIRE, TH_BACK, 0.25, 0);
@@ -1224,7 +1227,7 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d)
/* determine sensor plane */
rctf rect;
- if(sensor_fit == CAMERA_SENSOR_FIT_HOR) {
+ if (sensor_fit == CAMERA_SENSOR_FIT_HOR) {
float sensor_scale = (x2i-x1i) / sensor_x;
float sensor_height = sensor_scale * sensor_y;
@@ -1271,22 +1274,22 @@ static void backdrawview3d(Scene *scene, ARegion *ar, View3D *v3d)
BLI_assert(ar->regiontype == RGN_TYPE_WINDOW);
- if(base && (base->object->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT) ||
+ if (base && (base->object->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT) ||
paint_facesel_test(base->object)))
{
/* do nothing */
}
- else if((base && (base->object->mode & OB_MODE_TEXTURE_PAINT)) &&
+ else if ((base && (base->object->mode & OB_MODE_TEXTURE_PAINT)) &&
scene->toolsettings && (scene->toolsettings->imapaint.flag & IMAGEPAINT_PROJECT_DISABLE))
{
/* do nothing */
}
- else if((base && (base->object->mode & OB_MODE_PARTICLE_EDIT)) &&
+ else if ((base && (base->object->mode & OB_MODE_PARTICLE_EDIT)) &&
v3d->drawtype > OB_WIRE && (v3d->flag & V3D_ZBUF_SELECT))
{
/* do nothing */
}
- else if(scene->obedit && v3d->drawtype>OB_WIRE &&
+ else if (scene->obedit && v3d->drawtype>OB_WIRE &&
(v3d->flag & V3D_ZBUF_SELECT)) {
/* do nothing */
}
@@ -1295,29 +1298,29 @@ static void backdrawview3d(Scene *scene, ARegion *ar, View3D *v3d)
return;
}
- if( !(v3d->flag & V3D_INVALID_BACKBUF) ) return;
+ if ( !(v3d->flag & V3D_INVALID_BACKBUF) ) return;
-// if(test) {
-// if(qtest()) {
+// if (test) {
+// if (qtest()) {
// addafterqueue(ar->win, BACKBUFDRAW, 1);
// return;
// }
// }
- if(v3d->drawtype > OB_WIRE) v3d->zbuf= TRUE;
+ if (v3d->drawtype > OB_WIRE) v3d->zbuf= TRUE;
/* dithering and AA break color coding, so disable */
glDisable(GL_DITHER);
multisample_enabled= glIsEnabled(GL_MULTISAMPLE_ARB);
- if(multisample_enabled)
+ if (multisample_enabled)
glDisable(GL_MULTISAMPLE_ARB);
region_scissor_winrct(ar, &winrct);
glScissor(winrct.xmin, winrct.ymin, winrct.xmax - winrct.xmin, winrct.ymax - winrct.ymin);
glClearColor(0.0, 0.0, 0.0, 0.0);
- if(v3d->zbuf) {
+ if (v3d->zbuf) {
glEnable(GL_DEPTH_TEST);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
}
@@ -1326,12 +1329,12 @@ static void backdrawview3d(Scene *scene, ARegion *ar, View3D *v3d)
glDisable(GL_DEPTH_TEST);
}
- if(rv3d->rflag & RV3D_CLIPPING)
+ if (rv3d->rflag & RV3D_CLIPPING)
view3d_set_clipping(rv3d);
G.f |= G_BACKBUFSEL;
- if(base && (base->lay & v3d->lay))
+ if (base && (base->lay & v3d->lay))
draw_object_backbufsel(scene, v3d, rv3d, base->object);
v3d->flag &= ~V3D_INVALID_BACKBUF;
@@ -1341,10 +1344,10 @@ static void backdrawview3d(Scene *scene, ARegion *ar, View3D *v3d)
v3d->zbuf= FALSE;
glDisable(GL_DEPTH_TEST);
glEnable(GL_DITHER);
- if(multisample_enabled)
+ if (multisample_enabled)
glEnable(GL_MULTISAMPLE_ARB);
- if(rv3d->rflag & RV3D_CLIPPING)
+ if (rv3d->rflag & RV3D_CLIPPING)
view3d_clr_clipping();
/* it is important to end a view in a transform compatible with buttons */
@@ -1354,7 +1357,7 @@ static void backdrawview3d(Scene *scene, ARegion *ar, View3D *v3d)
void view3d_validate_backbuf(ViewContext *vc)
{
- if(vc->v3d->flag & V3D_INVALID_BACKBUF)
+ if (vc->v3d->flag & V3D_INVALID_BACKBUF)
backdrawview3d(vc->scene, vc->ar, vc->v3d);
}
@@ -1363,7 +1366,7 @@ unsigned int view3d_sample_backbuf(ViewContext *vc, int x, int y)
{
unsigned int col;
- if(x >= vc->ar->winx || y >= vc->ar->winy) return 0;
+ if (x >= vc->ar->winx || y >= vc->ar->winy) return 0;
x+= vc->ar->winrct.xmin;
y+= vc->ar->winrct.ymin;
@@ -1372,7 +1375,7 @@ unsigned int view3d_sample_backbuf(ViewContext *vc, int x, int y)
glReadPixels(x, y, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &col);
glReadBuffer(GL_BACK);
- if(ENDIAN_ORDER==B_ENDIAN) SWITCH_INT(col);
+ if (ENDIAN_ORDER==B_ENDIAN) SWITCH_INT(col);
return WM_framebuffer_to_index(col);
}
@@ -1386,13 +1389,13 @@ ImBuf *view3d_read_backbuf(ViewContext *vc, short xmin, short ymin, short xmax,
short xminc, yminc, xmaxc, ymaxc, xs, ys;
/* clip */
- if(xmin<0) xminc= 0; else xminc= xmin;
- if(xmax >= vc->ar->winx) xmaxc= vc->ar->winx-1; else xmaxc= xmax;
- if(xminc > xmaxc) return NULL;
+ if (xmin<0) xminc= 0; else xminc= xmin;
+ if (xmax >= vc->ar->winx) xmaxc= vc->ar->winx-1; else xmaxc= xmax;
+ if (xminc > xmaxc) return NULL;
- if(ymin<0) yminc= 0; else yminc= ymin;
- if(ymax >= vc->ar->winy) ymaxc= vc->ar->winy-1; else ymaxc= ymax;
- if(yminc > ymaxc) return NULL;
+ if (ymin<0) yminc= 0; else yminc= ymin;
+ if (ymax >= vc->ar->winy) ymaxc= vc->ar->winy-1; else ymaxc= ymax;
+ if (yminc > ymaxc) return NULL;
ibuf= IMB_allocImBuf((xmaxc-xminc+1), (ymaxc-yminc+1), 32, IB_rect);
@@ -1406,26 +1409,26 @@ ImBuf *view3d_read_backbuf(ViewContext *vc, short xmin, short ymin, short xmax,
glReadBuffer(GL_BACK);
- if(ENDIAN_ORDER==B_ENDIAN) IMB_convert_rgba_to_abgr(ibuf);
+ if (ENDIAN_ORDER==B_ENDIAN) IMB_convert_rgba_to_abgr(ibuf);
a= (xmaxc-xminc+1)*(ymaxc-yminc+1);
dr= ibuf->rect;
- while(a--) {
- if(*dr) *dr= WM_framebuffer_to_index(*dr);
+ while (a--) {
+ if (*dr) *dr= WM_framebuffer_to_index(*dr);
dr++;
}
/* put clipped result back, if needed */
- if(xminc==xmin && xmaxc==xmax && yminc==ymin && ymaxc==ymax)
+ if (xminc==xmin && xmaxc==xmax && yminc==ymin && ymaxc==ymax)
return ibuf;
ibuf1= IMB_allocImBuf( (xmax-xmin+1),(ymax-ymin+1),32,IB_rect);
rd= ibuf->rect;
dr= ibuf1->rect;
- for(ys= ymin; ys<=ymax; ys++) {
- for(xs= xmin; xs<=xmax; xs++, dr++) {
- if( xs>=xminc && xs<=xmaxc && ys>=yminc && ys<=ymaxc) {
+ for (ys= ymin; ys<=ymax; ys++) {
+ for (xs= xmin; xs<=xmax; xs++, dr++) {
+ if ( xs>=xminc && xs<=xmaxc && ys>=yminc && ys<=ymaxc) {
*dr= *rd;
rd++;
}
@@ -1467,14 +1470,14 @@ unsigned int view3d_sample_backbuf_rect(ViewContext *vc, const int mval[2], int
bufmax = buf->rect + size*size;
tbuf+= amount*size+ amount;
- for(nr=1; nr<=size; nr++) {
+ for (nr=1; nr<=size; nr++) {
- for(a=0; a<2; a++) {
- for(b=0; b<nr; b++, distance++) {
+ for (a=0; a<2; a++) {
+ for (b=0; b<nr; b++, distance++) {
if (*tbuf && *tbuf>=min && *tbuf<max) { //we got a hit
- if(strict){
+ if (strict) {
indexok = indextest(handle, *tbuf - min+1);
- if(indexok){
+ if (indexok) {
*dist= (short) sqrt( (float)distance );
index = *tbuf - min+1;
goto exit;
@@ -1489,7 +1492,7 @@ unsigned int view3d_sample_backbuf_rect(ViewContext *vc, const int mval[2], int
tbuf+= (dirvec[rc][0]+dirvec[rc][1]);
- if(tbuf<bufmin || tbuf>=bufmax) {
+ if (tbuf<bufmin || tbuf>=bufmax) {
goto exit;
}
}
@@ -1519,30 +1522,32 @@ static void draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d)
for ( bgpic= v3d->bgpicbase.first; bgpic; bgpic= bgpic->next ) {
- if( (bgpic->view == 0) || /* zero for any */
+ if ( (bgpic->view == 0) || /* zero for any */
(bgpic->view & (1<<rv3d->view)) || /* check agaist flags */
(rv3d->persp==RV3D_CAMOB && bgpic->view == (1<<RV3D_VIEW_CAMERA))
) {
/* disable individual images */
- if((bgpic->flag&V3D_BGPIC_DISABLED))
+ if ((bgpic->flag&V3D_BGPIC_DISABLED))
continue;
freeibuf= NULL;
- if(bgpic->source==V3D_BGPIC_IMAGE) {
+ if (bgpic->source==V3D_BGPIC_IMAGE) {
ima= bgpic->ima;
- if(ima==NULL)
+ if (ima==NULL)
continue;
BKE_image_user_calc_frame(&bgpic->iuser, CFRA, 0);
ibuf= BKE_image_get_ibuf(ima, &bgpic->iuser);
- } else {
+ }
+ else {
clip= NULL;
- if(bgpic->flag&V3D_BGPIC_CAMERACLIP) {
- if(scene->camera)
+ if (bgpic->flag&V3D_BGPIC_CAMERACLIP) {
+ if (scene->camera)
clip= object_get_movieclip(scene, scene->camera, 1);
- } else clip= bgpic->clip;
+ }
+ else clip= bgpic->clip;
- if(clip==NULL)
+ if (clip==NULL)
continue;
BKE_movieclip_user_set_frame(&bgpic->cuser, CFRA);
@@ -1554,20 +1559,20 @@ static void draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d)
freeibuf= ibuf;
}
- if(ibuf==NULL)
+ if (ibuf==NULL)
continue;
- if((ibuf->rect==NULL && ibuf->rect_float==NULL) || ibuf->channels!=4) { /* invalid image format */
- if(freeibuf)
+ if ((ibuf->rect==NULL && ibuf->rect_float==NULL) || ibuf->channels!=4) { /* invalid image format */
+ if (freeibuf)
IMB_freeImBuf(freeibuf);
continue;
}
- if(ibuf->rect==NULL)
+ if (ibuf->rect==NULL)
IMB_rect_from_float(ibuf);
- if(rv3d->persp==RV3D_CAMOB) {
+ if (rv3d->persp==RV3D_CAMOB) {
rctf vb;
ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &vb, FALSE);
@@ -1602,8 +1607,8 @@ static void draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d)
/* complete clip? */
- if(x2 < 0 || y2 < 0 || x1 > ar->winx || y1 > ar->winy) {
- if(freeibuf)
+ if (x2 < 0 || y2 < 0 || x1 > ar->winx || y1 > ar->winy) {
+ if (freeibuf)
IMB_freeImBuf(freeibuf);
continue;
@@ -1613,28 +1618,28 @@ static void draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d)
zoomy= (y2-y1)/ibuf->y;
/* for some reason; zoomlevels down refuses to use GL_ALPHA_SCALE */
- if(zoomx < 1.0f || zoomy < 1.0f) {
+ if (zoomx < 1.0f || zoomy < 1.0f) {
float tzoom= MIN2(zoomx, zoomy);
int mip= 0;
- if((ibuf->userflags&IB_MIPMAP_INVALID) != 0) {
+ if ((ibuf->userflags&IB_MIPMAP_INVALID) != 0) {
IMB_remakemipmap(ibuf, 0);
ibuf->userflags&= ~IB_MIPMAP_INVALID;
}
- else if(ibuf->mipmap[0]==NULL)
+ else if (ibuf->mipmap[0]==NULL)
IMB_makemipmap(ibuf, 0);
- while(tzoom < 1.0f && mip<8 && ibuf->mipmap[mip]) {
+ while (tzoom < 1.0f && mip<8 && ibuf->mipmap[mip]) {
tzoom*= 2.0f;
zoomx*= 2.0f;
zoomy*= 2.0f;
mip++;
}
- if(mip>0)
+ if (mip>0)
ibuf= ibuf->mipmap[mip-1];
}
- if(v3d->zbuf) glDisable(GL_DEPTH_TEST);
+ if (v3d->zbuf) glDisable(GL_DEPTH_TEST);
glDepthMask(0);
glEnable(GL_BLEND);
@@ -1661,9 +1666,9 @@ static void draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d)
glDisable(GL_BLEND);
glDepthMask(1);
- if(v3d->zbuf) glEnable(GL_DEPTH_TEST);
+ if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
- if(freeibuf)
+ if (freeibuf)
IMB_freeImBuf(freeibuf);
}
}
@@ -1694,7 +1699,7 @@ static void view3d_draw_transp(Scene *scene, ARegion *ar, View3D *v3d)
glDepthMask(0);
v3d->transp= TRUE;
- for(v3da= v3d->afterdraw_transp.first; v3da; v3da= next) {
+ for (v3da= v3d->afterdraw_transp.first; v3da; v3da= next) {
next= v3da->next;
draw_object(scene, ar, v3d, v3da->base, v3da->flag);
BLI_remlink(&v3d->afterdraw_transp, v3da);
@@ -1711,11 +1716,11 @@ static void view3d_draw_xray(Scene *scene, ARegion *ar, View3D *v3d, int clear)
{
View3DAfter *v3da, *next;
- if(clear && v3d->zbuf)
+ if (clear && v3d->zbuf)
glClear(GL_DEPTH_BUFFER_BIT);
v3d->xray= TRUE;
- for(v3da= v3d->afterdraw_xray.first; v3da; v3da= next) {
+ for (v3da= v3d->afterdraw_xray.first; v3da; v3da= next) {
next= v3da->next;
draw_object(scene, ar, v3d, v3da->base, v3da->flag);
BLI_remlink(&v3d->afterdraw_xray, v3da);
@@ -1730,13 +1735,13 @@ static void view3d_draw_xraytransp(Scene *scene, ARegion *ar, View3D *v3d, int c
{
View3DAfter *v3da, *next;
- if(clear && v3d->zbuf)
+ if (clear && v3d->zbuf)
glClear(GL_DEPTH_BUFFER_BIT);
v3d->xray= TRUE;
v3d->transp= TRUE;
- for(v3da= v3d->afterdraw_xraytransp.first; v3da; v3da= next) {
+ for (v3da= v3d->afterdraw_xraytransp.first; v3da; v3da= next) {
next= v3da->next;
draw_object(scene, ar, v3d, v3da->base, v3da->flag);
BLI_remlink(&v3d->afterdraw_xraytransp, v3da);
@@ -1771,7 +1776,7 @@ int dupli_ob_sort(void *arg1, void *arg2)
static DupliObject *dupli_step(DupliObject *dob)
{
- while(dob && dob->no_draw)
+ while (dob && dob->no_draw)
dob= dob->next;
return dob;
}
@@ -1794,9 +1799,9 @@ static void draw_dupli_objects_color(Scene *scene, ARegion *ar, View3D *v3d, Bas
// BLI_sortlist(lb, dupli_ob_sort); // might be nice to have if we have a dupli list with mixed objects.
dob=dupli_step(lb->first);
- if(dob) dob_next= dupli_step(dob->next);
+ if (dob) dob_next= dupli_step(dob->next);
- for( ; dob ; dob_prev= dob, dob= dob_next, dob_next= dob_next ? dupli_step(dob_next->next) : NULL) {
+ for ( ; dob ; dob_prev= dob, dob= dob_next, dob_next= dob_next ? dupli_step(dob_next->next) : NULL) {
tbase.object= dob->ob;
/* extra service: draw the duplicator in drawtype of parent */
@@ -1806,21 +1811,21 @@ static void draw_dupli_objects_color(Scene *scene, ARegion *ar, View3D *v3d, Bas
/* negative scale flag has to propagate */
transflag= tbase.object->transflag;
- if(base->object->transflag & OB_NEG_SCALE)
+ if (base->object->transflag & OB_NEG_SCALE)
tbase.object->transflag ^= OB_NEG_SCALE;
UI_ThemeColorBlend(color, TH_BACK, 0.5);
/* generate displist, test for new object */
- if(dob_prev && dob_prev->ob != dob->ob) {
- if(use_displist==1)
+ if (dob_prev && dob_prev->ob != dob->ob) {
+ if (use_displist==1)
glDeleteLists(displist, 1);
use_displist= -1;
}
/* generate displist */
- if(use_displist == -1) {
+ if (use_displist == -1) {
/* note, since this was added, its checked dob->type==OB_DUPLIGROUP
* however this is very slow, it was probably needed for the NLA
@@ -1855,9 +1860,9 @@ static void draw_dupli_objects_color(Scene *scene, ARegion *ar, View3D *v3d, Bas
object_boundbox_flag(dob->ob, OB_BB_DISABLED, 0);
}
}
- if(use_displist) {
+ if (use_displist) {
glMultMatrixf(dob->mat);
- if(ED_view3d_boundbox_clip(rv3d, dob->mat, &bb))
+ if (ED_view3d_boundbox_clip(rv3d, dob->mat, &bb))
glCallList(displist);
glLoadMatrixf(rv3d->viewmat);
}
@@ -1875,7 +1880,7 @@ static void draw_dupli_objects_color(Scene *scene, ARegion *ar, View3D *v3d, Bas
free_object_duplilist(lb); /* does restore */
- if(use_displist)
+ if (use_displist)
glDeleteLists(displist, 1);
}
@@ -1886,7 +1891,7 @@ static void draw_dupli_objects(Scene *scene, ARegion *ar, View3D *v3d, Base *bas
int color= (base->flag & SELECT)?TH_SELECT:TH_WIRE;
/* debug */
- if(base->object->dup_group && base->object->dup_group->id.us<1)
+ if (base->object->dup_group && base->object->dup_group->id.us<1)
color= TH_REDALERT;
draw_dupli_objects_color(scene, ar, v3d, base, color);
@@ -1913,14 +1918,14 @@ void view3d_update_depths_rect(ARegion *ar, ViewDepths *d, rcti *rect)
w= rect->xmax - rect->xmin;
h= rect->ymax - rect->ymin;
- if(w <= 0 || h <= 0) {
- if(d->depths)
+ if (w <= 0 || h <= 0) {
+ if (d->depths)
MEM_freeN(d->depths);
d->depths= NULL;
d->damaged= FALSE;
}
- else if( d->w != w ||
+ else if ( d->w != w ||
d->h != h ||
d->x != x ||
d->y != y ||
@@ -1931,7 +1936,7 @@ void view3d_update_depths_rect(ARegion *ar, ViewDepths *d, rcti *rect)
d->w= w;
d->h= h;
- if(d->depths)
+ if (d->depths)
MEM_freeN(d->depths);
d->depths= MEM_mallocN(sizeof(float)*d->w*d->h,"View depths Subset");
@@ -1939,7 +1944,7 @@ void view3d_update_depths_rect(ARegion *ar, ViewDepths *d, rcti *rect)
d->damaged= TRUE;
}
- if(d->damaged) {
+ if (d->damaged) {
glReadPixels(ar->winrct.xmin+d->x,ar->winrct.ymin+d->y, d->w,d->h, GL_DEPTH_COMPONENT,GL_FLOAT, d->depths);
glGetDoublev(GL_DEPTH_RANGE,d->depth_range);
d->damaged= FALSE;
@@ -1952,21 +1957,21 @@ void ED_view3d_depth_update(ARegion *ar)
RegionView3D *rv3d= ar->regiondata;
/* Create storage for, and, if necessary, copy depth buffer */
- if(!rv3d->depths) rv3d->depths= MEM_callocN(sizeof(ViewDepths),"ViewDepths");
- if(rv3d->depths) {
+ if (!rv3d->depths) rv3d->depths= MEM_callocN(sizeof(ViewDepths),"ViewDepths");
+ if (rv3d->depths) {
ViewDepths *d= rv3d->depths;
- if(d->w != ar->winx ||
+ if (d->w != ar->winx ||
d->h != ar->winy ||
!d->depths) {
d->w= ar->winx;
d->h= ar->winy;
- if(d->depths)
+ if (d->depths)
MEM_freeN(d->depths);
d->depths= MEM_mallocN(sizeof(float)*d->w*d->h,"View depths");
d->damaged= 1;
}
- if(d->damaged) {
+ if (d->damaged) {
glReadPixels(ar->winrct.xmin,ar->winrct.ymin,d->w,d->h,
GL_DEPTH_COMPONENT,GL_FLOAT, d->depths);
@@ -1991,9 +1996,9 @@ float view3d_depth_near(ViewDepths *d)
/* far is both the starting 'far' value
* and the closest value found. */
- while(i--) {
+ while (i--) {
depth= *depths++;
- if((depth < far) && (depth > near)) {
+ if ((depth < far) && (depth > near)) {
far= depth;
}
}
@@ -2053,7 +2058,7 @@ void draw_depth(Scene *scene, ARegion *ar, View3D *v3d, int (* func)(void *))
glLoadMatrixf(rv3d->viewmat);
// persp(PERSP_STORE); // store correct view for persp(PERSP_VIEW) calls
- if(rv3d->rflag & RV3D_CLIPPING) {
+ if (rv3d->rflag & RV3D_CLIPPING) {
view3d_set_clipping(rv3d);
}
@@ -2061,13 +2066,13 @@ void draw_depth(Scene *scene, ARegion *ar, View3D *v3d, int (* func)(void *))
glEnable(GL_DEPTH_TEST);
/* draw set first */
- if(scene->set) {
+ if (scene->set) {
Scene *sce_iter;
- for(SETLOOPER(scene->set, sce_iter, base)) {
- if(v3d->lay & base->lay) {
+ for (SETLOOPER(scene->set, sce_iter, base)) {
+ if (v3d->lay & base->lay) {
if (func == NULL || func(base)) {
draw_object(scene, ar, v3d, base, 0);
- if(base->object->transflag & OB_DUPLI) {
+ if (base->object->transflag & OB_DUPLI) {
draw_dupli_objects_color(scene, ar, v3d, base, TH_WIRE);
}
}
@@ -2075,11 +2080,11 @@ void draw_depth(Scene *scene, ARegion *ar, View3D *v3d, int (* func)(void *))
}
}
- for(base= scene->base.first; base; base= base->next) {
- if(v3d->lay & base->lay) {
+ for (base= scene->base.first; base; base= base->next) {
+ if (v3d->lay & base->lay) {
if (func == NULL || func(base)) {
/* dupli drawing */
- if(base->object->transflag & OB_DUPLI) {
+ if (base->object->transflag & OB_DUPLI) {
draw_dupli_objects(scene, ar, v3d, base);
}
draw_object(scene, ar, v3d, base, 0);
@@ -2101,9 +2106,9 @@ void draw_depth(Scene *scene, ARegion *ar, View3D *v3d, int (* func)(void *))
glGetIntegerv(GL_DEPTH_WRITEMASK, &mask_orig);
- if(v3d->afterdraw_xray.first || v3d->afterdraw_xraytransp.first) {
+ if (v3d->afterdraw_xray.first || v3d->afterdraw_xraytransp.first) {
glDepthFunc(GL_ALWAYS); /* always write into the depth bufer, overwriting front z values */
- for(v3da= v3d->afterdraw_xray.first; v3da; v3da= next) {
+ for (v3da= v3d->afterdraw_xray.first; v3da; v3da= next) {
next= v3da->next;
draw_object(scene, ar, v3d, v3da->base, 0);
}
@@ -2113,7 +2118,7 @@ void draw_depth(Scene *scene, ARegion *ar, View3D *v3d, int (* func)(void *))
/* draw 3 passes, transp/xray/xraytransp */
v3d->xray= FALSE;
v3d->transp= TRUE;
- for(v3da= v3d->afterdraw_transp.first; v3da; v3da= next) {
+ for (v3da= v3d->afterdraw_transp.first; v3da; v3da= next) {
next= v3da->next;
draw_object(scene, ar, v3d, v3da->base, 0);
BLI_remlink(&v3d->afterdraw_transp, v3da);
@@ -2122,7 +2127,7 @@ void draw_depth(Scene *scene, ARegion *ar, View3D *v3d, int (* func)(void *))
v3d->xray= TRUE;
v3d->transp= FALSE;
- for(v3da= v3d->afterdraw_xray.first; v3da; v3da= next) {
+ for (v3da= v3d->afterdraw_xray.first; v3da; v3da= next) {
next= v3da->next;
draw_object(scene, ar, v3d, v3da->base, 0);
BLI_remlink(&v3d->afterdraw_xray, v3da);
@@ -2131,7 +2136,7 @@ void draw_depth(Scene *scene, ARegion *ar, View3D *v3d, int (* func)(void *))
v3d->xray= TRUE;
v3d->transp= TRUE;
- for(v3da= v3d->afterdraw_xraytransp.first; v3da; v3da= next) {
+ for (v3da= v3d->afterdraw_xraytransp.first; v3da; v3da= next) {
next= v3da->next;
draw_object(scene, ar, v3d, v3da->base, 0);
BLI_remlink(&v3d->afterdraw_xraytransp, v3da);
@@ -2145,11 +2150,11 @@ void draw_depth(Scene *scene, ARegion *ar, View3D *v3d, int (* func)(void *))
glDepthMask(mask_orig);
}
- if(rv3d->rflag & RV3D_CLIPPING)
+ if (rv3d->rflag & RV3D_CLIPPING)
view3d_clr_clipping();
v3d->zbuf = zbuf;
- if(!v3d->zbuf) glDisable(GL_DEPTH_TEST);
+ if (!v3d->zbuf) glDisable(GL_DEPTH_TEST);
U.glalphaclip = glalphaclip;
v3d->flag = flag;
@@ -2170,11 +2175,11 @@ static void gpu_render_lamp_update(Scene *scene, View3D *v3d, Object *ob, Object
lamp = GPU_lamp_from_blender(scene, ob, par);
- if(lamp) {
+ if (lamp) {
GPU_lamp_update(lamp, ob->lay, (ob->restrictflag & OB_RESTRICT_RENDER), obmat);
GPU_lamp_update_colors(lamp, la->r, la->g, la->b, la->energy);
- if((ob->lay & v3d->lay) && GPU_lamp_has_shadow_buffer(lamp)) {
+ if ((ob->lay & v3d->lay) && GPU_lamp_has_shadow_buffer(lamp)) {
shadow= MEM_callocN(sizeof(View3DShadow), "View3DShadow");
shadow->lamp = lamp;
BLI_addtail(shadows, shadow);
@@ -2193,18 +2198,18 @@ static void gpu_update_lamps_shadows(Scene *scene, View3D *v3d)
shadows.first= shadows.last= NULL;
/* update lamp transform and gather shadow lamps */
- for(SETLOOPER(scene, sce_iter, base)) {
+ for (SETLOOPER(scene, sce_iter, base)) {
ob= base->object;
- if(ob->type == OB_LAMP)
+ if (ob->type == OB_LAMP)
gpu_render_lamp_update(scene, v3d, ob, NULL, ob->obmat, &shadows);
if (ob->transflag & OB_DUPLI) {
DupliObject *dob;
ListBase *lb = object_duplilist(scene, ob);
- for(dob=lb->first; dob; dob=dob->next)
- if(dob->ob->type==OB_LAMP)
+ for (dob=lb->first; dob; dob=dob->next)
+ if (dob->ob->type==OB_LAMP)
gpu_render_lamp_update(scene, v3d, dob->ob, ob, dob->mat, &shadows);
free_object_duplilist(lb);
@@ -2213,7 +2218,7 @@ static void gpu_update_lamps_shadows(Scene *scene, View3D *v3d)
/* render shadows after updating all lamps, nested object_duplilist
* don't work correct since it's replacing object matrices */
- for(shadow=shadows.first; shadow; shadow=shadow->next) {
+ for (shadow=shadows.first; shadow; shadow=shadow->next) {
/* this needs to be done better .. */
float viewmat[4][4], winmat[4][4];
int drawtype, lay, winsize, flag2=v3d->flag2;
@@ -2261,12 +2266,12 @@ CustomDataMask ED_view3d_datamask(Scene *scene, View3D *v3d)
{
mask |= CD_MASK_MTFACE | CD_MASK_MCOL;
- if(scene_use_new_shading_nodes(scene)) {
- if(v3d->drawtype == OB_MATERIAL)
+ if (scene_use_new_shading_nodes(scene)) {
+ if (v3d->drawtype == OB_MATERIAL)
mask |= CD_MASK_ORCO;
}
else {
- if(scene->gm.matmode == GAME_MAT_GLSL)
+ if (scene->gm.matmode == GAME_MAT_GLSL)
mask |= CD_MASK_ORCO;
}
}
@@ -2306,8 +2311,8 @@ CustomDataMask ED_view3d_screen_datamask(bScreen *screen)
ScrArea *sa;
/* check if we need tfaces & mcols due to view mode */
- for(sa = screen->areabase.first; sa; sa = sa->next) {
- if(sa->spacetype == SPACE_VIEW3D) {
+ for (sa = screen->areabase.first; sa; sa = sa->next) {
+ if (sa->spacetype == SPACE_VIEW3D) {
mask |= ED_view3d_datamask(scene, (View3D *)sa->spacedata.first);
}
}
@@ -2322,13 +2327,13 @@ static void view3d_main_area_setup_view(Scene *scene, View3D *v3d, ARegion *ar,
RegionView3D *rv3d= ar->regiondata;
/* setup window matrices */
- if(winmat)
+ if (winmat)
copy_m4_m4(rv3d->winmat, winmat);
else
setwinmatrixview3d(ar, v3d, NULL); /* NULL= no pickrect */
/* setup view matrix */
- if(viewmat)
+ if (viewmat)
copy_m4_m4(rv3d->viewmat, viewmat);
else
setviewmatrixview3d(scene, v3d, rv3d); /* note: calls where_is_object for camera... */
@@ -2398,12 +2403,12 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar,
GPU_free_images_anim();
/* shadow buffers, before we setup matrices */
- if(draw_glsl_material(scene, NULL, v3d, v3d->drawtype))
+ if (draw_glsl_material(scene, NULL, v3d, v3d->drawtype))
gpu_update_lamps_shadows(scene, v3d);
/* set background color, fallback on the view background color */
- if(scene->world) {
- if(scene->r.color_mgt_flag & R_COLOR_MANAGEMENT)
+ if (scene->world) {
+ if (scene->r.color_mgt_flag & R_COLOR_MANAGEMENT)
linearrgb_to_srgb_v3_v3(backcol, &scene->world->horr);
else
copy_v3_v3(backcol, &scene->world->horr);
@@ -2418,39 +2423,39 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar,
/* setup view matrices */
view3d_main_area_setup_view(scene, v3d, ar, viewmat, winmat);
- if(rv3d->rflag & RV3D_CLIPPING)
+ if (rv3d->rflag & RV3D_CLIPPING)
view3d_draw_clipping(rv3d);
/* set zbuffer */
- if(v3d->drawtype > OB_WIRE) {
+ if (v3d->drawtype > OB_WIRE) {
v3d->zbuf= TRUE;
glEnable(GL_DEPTH_TEST);
}
else
v3d->zbuf= FALSE;
- if(rv3d->rflag & RV3D_CLIPPING)
+ if (rv3d->rflag & RV3D_CLIPPING)
view3d_set_clipping(rv3d);
/* draw set first */
- if(scene->set) {
+ if (scene->set) {
Scene *sce_iter;
- for(SETLOOPER(scene->set, sce_iter, base)) {
- if(v3d->lay & base->lay) {
+ for (SETLOOPER(scene->set, sce_iter, base)) {
+ if (v3d->lay & base->lay) {
UI_ThemeColorBlend(TH_WIRE, TH_BACK, 0.6f);
draw_object(scene, ar, v3d, base, DRAW_CONSTCOLOR|DRAW_SCENESET);
- if(base->object->transflag & OB_DUPLI)
+ if (base->object->transflag & OB_DUPLI)
draw_dupli_objects_color(scene, ar, v3d, base, TH_WIRE);
}
}
}
/* then draw not selected and the duplis, but skip editmode object */
- for(base= scene->base.first; base; base= base->next) {
- if(v3d->lay & base->lay) {
+ for (base= scene->base.first; base; base= base->next) {
+ if (v3d->lay & base->lay) {
/* dupli drawing */
- if(base->object->transflag & OB_DUPLI)
+ if (base->object->transflag & OB_DUPLI)
draw_dupli_objects(scene, ar, v3d, base);
draw_object(scene, ar, v3d, base, 0);
@@ -2458,20 +2463,20 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar,
}
/* must be before xray draw which clears the depth buffer */
- if(v3d->zbuf) glDisable(GL_DEPTH_TEST);
+ if (v3d->zbuf) glDisable(GL_DEPTH_TEST);
draw_gpencil_view3d(scene, v3d, ar, 1);
- if(v3d->zbuf) glEnable(GL_DEPTH_TEST);
+ if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
/* transp and X-ray afterdraw stuff */
- if(v3d->afterdraw_transp.first) view3d_draw_transp(scene, ar, v3d);
- if(v3d->afterdraw_xray.first) view3d_draw_xray(scene, ar, v3d, 1); // clears zbuffer if it is used!
- if(v3d->afterdraw_xraytransp.first) view3d_draw_xraytransp(scene, ar, v3d, 1);
+ if (v3d->afterdraw_transp.first) view3d_draw_transp(scene, ar, v3d);
+ if (v3d->afterdraw_xray.first) view3d_draw_xray(scene, ar, v3d, 1); // clears zbuffer if it is used!
+ if (v3d->afterdraw_xraytransp.first) view3d_draw_xraytransp(scene, ar, v3d, 1);
- if(rv3d->rflag & RV3D_CLIPPING)
+ if (rv3d->rflag & RV3D_CLIPPING)
view3d_clr_clipping();
/* cleanup */
- if(v3d->zbuf) {
+ if (v3d->zbuf) {
v3d->zbuf= FALSE;
glDisable(GL_DEPTH_TEST);
}
@@ -2511,13 +2516,13 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(Scene *scene, View3D *v3d, ARegion *ar,
/* bind */
ofs= GPU_offscreen_create(sizex, sizey, err_out);
- if(ofs == NULL)
+ if (ofs == NULL)
return NULL;
GPU_offscreen_bind(ofs);
/* render 3d view */
- if(rv3d->persp==RV3D_CAMOB && v3d->camera) {
+ if (rv3d->persp==RV3D_CAMOB && v3d->camera) {
CameraParams params;
camera_params_init(&params);
@@ -2534,12 +2539,12 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(Scene *scene, View3D *v3d, ARegion *ar,
/* read in pixels & stamp */
ibuf= IMB_allocImBuf(sizex, sizey, 32, flag);
- if(ibuf->rect_float)
+ if (ibuf->rect_float)
GPU_offscreen_read_pixels(ofs, GL_FLOAT, ibuf->rect_float);
- else if(ibuf->rect)
+ else if (ibuf->rect)
GPU_offscreen_read_pixels(ofs, GL_UNSIGNED_BYTE, ibuf->rect);
- //if((scene->r.stamp & R_STAMP_ALL) && (scene->r.stamp & R_STAMP_DRAW))
+ //if ((scene->r.stamp & R_STAMP_ALL) && (scene->r.stamp & R_STAMP_DRAW))
// BKE_stamp_buf(scene, NULL, rr->rectf, rr->rectx, rr->recty, 4);
/* unbind */
@@ -2548,7 +2553,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(Scene *scene, View3D *v3d, ARegion *ar,
glPopAttrib();
- if(ibuf->rect_float && ibuf->rect)
+ if (ibuf->rect_float && ibuf->rect)
IMB_rect_from_float(ibuf);
return ibuf;
@@ -2659,10 +2664,10 @@ static int view3d_main_area_draw_engine(const bContext *C, ARegion *ar)
RegionView3D *rv3d= CTX_wm_region_view3d(C);
RenderEngineType *type;
- if(!rv3d->render_engine) {
+ if (!rv3d->render_engine) {
type= RE_engines_find(scene->r.engine);
- if(!(type->view_update && type->view_draw))
+ if (!(type->view_update && type->view_draw))
return 0;
rv3d->render_engine= RE_engine_create(type);
@@ -2684,7 +2689,7 @@ static int view3d_main_area_draw_engine(const bContext *C, ARegion *ar)
static void view3d_main_area_draw_engine_info(RegionView3D *rv3d, ARegion *ar)
{
- if(!rv3d->render_engine || !rv3d->render_engine->text)
+ if (!rv3d->render_engine || !rv3d->render_engine->text)
return;
ED_region_info_draw(ar, rv3d->render_engine->text, 1, 0.25);
@@ -2701,7 +2706,7 @@ static void view3d_main_area_draw_objects(const bContext *C, ARegion *ar, const
unsigned int lay_used;
/* shadow buffers, before we setup matrices */
- if(draw_glsl_material(scene, NULL, v3d, v3d->drawtype))
+ if (draw_glsl_material(scene, NULL, v3d, v3d->drawtype))
gpu_update_lamps_shadows(scene, v3d);
/* reset default OpenGL lights if needed (i.e. after preferences have been altered) */
@@ -2711,8 +2716,8 @@ static void view3d_main_area_draw_objects(const bContext *C, ARegion *ar, const
}
/* clear background */
- if((v3d->flag2 & V3D_RENDER_OVERRIDE) && scene->world) {
- if(scene->r.color_mgt_flag & R_COLOR_MANAGEMENT)
+ if ((v3d->flag2 & V3D_RENDER_OVERRIDE) && scene->world) {
+ if (scene->r.color_mgt_flag & R_COLOR_MANAGEMENT)
linearrgb_to_srgb_v3_v3(backcol, &scene->world->horr);
else
copy_v3_v3(backcol, &scene->world->horr);
@@ -2728,11 +2733,11 @@ static void view3d_main_area_draw_objects(const bContext *C, ARegion *ar, const
ED_region_draw_cb_draw(C, ar, REGION_DRAW_PRE_VIEW);
- if(rv3d->rflag & RV3D_CLIPPING)
+ if (rv3d->rflag & RV3D_CLIPPING)
view3d_draw_clipping(rv3d);
/* set zbuffer after we draw clipping region */
- if(v3d->drawtype > OB_WIRE) {
+ if (v3d->drawtype > OB_WIRE) {
v3d->zbuf= TRUE;
glEnable(GL_DEPTH_TEST);
}
@@ -2746,19 +2751,19 @@ static void view3d_main_area_draw_objects(const bContext *C, ARegion *ar, const
// needs to be done always, gridview is adjusted in drawgrid() now
rv3d->gridview= v3d->grid;
- if((rv3d->view == RV3D_VIEW_USER) || (rv3d->persp != RV3D_ORTHO)) {
+ if ((rv3d->view == RV3D_VIEW_USER) || (rv3d->persp != RV3D_ORTHO)) {
if ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) {
drawfloor(scene, v3d, grid_unit);
}
- if(rv3d->persp==RV3D_CAMOB) {
- if(scene->world) {
- if(scene->world->mode & WO_STARS) {
+ if (rv3d->persp==RV3D_CAMOB) {
+ if (scene->world) {
+ if (scene->world->mode & WO_STARS) {
RE_make_stars(NULL, scene, star_stuff_init_func, star_stuff_vertex_func,
star_stuff_term_func);
}
}
if ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) {
- if(v3d->flag & V3D_DISPBGPICS) draw_bgpic(scene, ar, v3d);
+ if (v3d->flag & V3D_DISPBGPICS) draw_bgpic(scene, ar, v3d);
}
}
}
@@ -2772,26 +2777,26 @@ static void view3d_main_area_draw_objects(const bContext *C, ARegion *ar, const
glMatrixMode(GL_MODELVIEW);
glLoadMatrixf(rv3d->viewmat);
- if(v3d->flag & V3D_DISPBGPICS) {
+ if (v3d->flag & V3D_DISPBGPICS) {
draw_bgpic(scene, ar, v3d);
}
}
}
- if(rv3d->rflag & RV3D_CLIPPING)
+ if (rv3d->rflag & RV3D_CLIPPING)
view3d_set_clipping(rv3d);
/* draw set first */
- if(scene->set) {
+ if (scene->set) {
Scene *sce_iter;
- for(SETLOOPER(scene->set, sce_iter, base)) {
+ for (SETLOOPER(scene->set, sce_iter, base)) {
- if(v3d->lay & base->lay) {
+ if (v3d->lay & base->lay) {
UI_ThemeColorBlend(TH_WIRE, TH_BACK, 0.6f);
draw_object(scene, ar, v3d, base, DRAW_CONSTCOLOR|DRAW_SCENESET);
- if(base->object->transflag & OB_DUPLI) {
+ if (base->object->transflag & OB_DUPLI) {
draw_dupli_objects_color(scene, ar, v3d, base, TH_WIRE);
}
}
@@ -2803,23 +2808,23 @@ static void view3d_main_area_draw_objects(const bContext *C, ARegion *ar, const
lay_used= 0;
/* then draw not selected and the duplis, but skip editmode object */
- for(base= scene->base.first; base; base= base->next) {
+ for (base= scene->base.first; base; base= base->next) {
lay_used |= base->lay & ((1<<20)-1);
- if(v3d->lay & base->lay) {
+ if (v3d->lay & base->lay) {
/* dupli drawing */
- if(base->object->transflag & OB_DUPLI) {
+ if (base->object->transflag & OB_DUPLI) {
draw_dupli_objects(scene, ar, v3d, base);
}
- if((base->flag & SELECT)==0) {
- if(base->object!=scene->obedit)
+ if ((base->flag & SELECT)==0) {
+ if (base->object!=scene->obedit)
draw_object(scene, ar, v3d, base, 0);
}
}
}
- if(v3d->lay_used != lay_used) { /* happens when loading old files or loading with UI load */
+ if (v3d->lay_used != lay_used) { /* happens when loading old files or loading with UI load */
/* find header and force tag redraw */
ScrArea *sa= CTX_wm_area(C);
ARegion *ar_header= BKE_area_find_region_type(sa, RGN_TYPE_HEADER);
@@ -2828,8 +2833,8 @@ static void view3d_main_area_draw_objects(const bContext *C, ARegion *ar, const
}
/* draw selected and editmode */
- for(base= scene->base.first; base; base= base->next) {
- if(v3d->lay & base->lay) {
+ for (base= scene->base.first; base; base= base->next) {
+ if (v3d->lay & base->lay) {
if (base->object==scene->obedit || ( base->flag & SELECT) )
draw_object(scene, ar, v3d, base, 0);
}
@@ -2839,19 +2844,19 @@ static void view3d_main_area_draw_objects(const bContext *C, ARegion *ar, const
if ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) {
/* must be before xray draw which clears the depth buffer */
- if(v3d->zbuf) glDisable(GL_DEPTH_TEST);
+ if (v3d->zbuf) glDisable(GL_DEPTH_TEST);
draw_gpencil_view3d(scene, v3d, ar, 1);
- if(v3d->zbuf) glEnable(GL_DEPTH_TEST);
+ if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
}
/* Transp and X-ray afterdraw stuff */
- if(v3d->afterdraw_transp.first) view3d_draw_transp(scene, ar, v3d);
- if(v3d->afterdraw_xray.first) view3d_draw_xray(scene, ar, v3d, 1); // clears zbuffer if it is used!
- if(v3d->afterdraw_xraytransp.first) view3d_draw_xraytransp(scene, ar, v3d, 1);
+ if (v3d->afterdraw_transp.first) view3d_draw_transp(scene, ar, v3d);
+ if (v3d->afterdraw_xray.first) view3d_draw_xray(scene, ar, v3d, 1); // clears zbuffer if it is used!
+ if (v3d->afterdraw_xraytransp.first) view3d_draw_xraytransp(scene, ar, v3d, 1);
ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_VIEW);
- if(rv3d->rflag & RV3D_CLIPPING)
+ if (rv3d->rflag & RV3D_CLIPPING)
view3d_clr_clipping();
BIF_draw_manipulator(C);
@@ -2860,7 +2865,7 @@ static void view3d_main_area_draw_objects(const bContext *C, ARegion *ar, const
/*if (!(U.gameflags & USER_DISABLE_AA))
glDisable(GL_MULTISAMPLE_ARB);*/
- if(v3d->zbuf) {
+ if (v3d->zbuf) {
v3d->zbuf= FALSE;
glDisable(GL_DEPTH_TEST);
}
@@ -2884,7 +2889,7 @@ static void view3d_main_area_draw_info(const bContext *C, ARegion *ar, const cha
Object *ob;
- if(rv3d->persp==RV3D_CAMOB)
+ if (rv3d->persp==RV3D_CAMOB)
drawviewborder(scene, ar, v3d);
if ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) {
@@ -2895,24 +2900,24 @@ static void view3d_main_area_draw_info(const bContext *C, ARegion *ar, const cha
drawcursor(scene, ar, v3d);
}
- if(U.uiflag & USER_SHOW_ROTVIEWICON)
+ if (U.uiflag & USER_SHOW_ROTVIEWICON)
draw_view_axis(rv3d);
else
draw_view_icon(rv3d);
ob= OBACT;
- if(U.uiflag & USER_DRAWVIEWINFO)
+ if (U.uiflag & USER_DRAWVIEWINFO)
draw_selected_name(scene, ob);
- if(rv3d->render_engine) {
+ if (rv3d->render_engine) {
view3d_main_area_draw_engine_info(rv3d, ar);
return;
}
- if((U.uiflag & USER_SHOW_FPS) && screen->animtimer) {
+ if ((U.uiflag & USER_SHOW_FPS) && screen->animtimer) {
draw_viewport_fps(scene, ar);
}
- else if(U.uiflag & USER_SHOW_VIEWPORTNAME) {
+ else if (U.uiflag & USER_SHOW_VIEWPORTNAME) {
draw_viewport_name(ar, v3d);
}
@@ -2920,7 +2925,7 @@ static void view3d_main_area_draw_info(const bContext *C, ARegion *ar, const cha
char numstr[32]= "";
UI_ThemeColor(TH_TEXT_HI);
- if(v3d->grid != 1.0f) {
+ if (v3d->grid != 1.0f) {
BLI_snprintf(numstr, sizeof(numstr), "%s x %.4g", grid_unit, v3d->grid);
}
@@ -2935,7 +2940,7 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar)
const char *grid_unit= NULL;
/* draw viewport using external renderer? */
- if(!(v3d->drawtype == OB_RENDER && view3d_main_area_draw_engine(C, ar))) {
+ if (!(v3d->drawtype == OB_RENDER && view3d_main_area_draw_engine(C, ar))) {
/* draw viewport using opengl */
view3d_main_area_draw_objects(C, ar, &grid_unit);
ED_region_pixelspace(ar);
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index f617f673397..807fdddb22f 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -91,7 +91,7 @@ int ED_view3d_camera_lock_check(View3D *v3d, RegionView3D *rv3d)
void ED_view3d_camera_lock_init(View3D *v3d, RegionView3D *rv3d)
{
- if(ED_view3d_camera_lock_check(v3d, rv3d)) {
+ if (ED_view3d_camera_lock_check(v3d, rv3d)) {
ED_view3d_from_object(v3d->camera, rv3d->ofs, rv3d->viewquat, &rv3d->dist, NULL);
}
}
@@ -99,17 +99,17 @@ void ED_view3d_camera_lock_init(View3D *v3d, RegionView3D *rv3d)
/* return TRUE if the camera is moved */
int ED_view3d_camera_lock_sync(View3D *v3d, RegionView3D *rv3d)
{
- if(ED_view3d_camera_lock_check(v3d, rv3d)) {
+ if (ED_view3d_camera_lock_check(v3d, rv3d)) {
ObjectTfmProtectedChannels obtfm;
Object *root_parent;
- if((U.uiflag & USER_CAM_LOCK_NO_PARENT)==0 && (root_parent= v3d->camera->parent)) {
+ if ((U.uiflag & USER_CAM_LOCK_NO_PARENT)==0 && (root_parent= v3d->camera->parent)) {
Object *ob_update;
float view_mat[4][4];
float diff_mat[4][4];
float parent_mat[4][4];
- while(root_parent->parent) {
+ while (root_parent->parent) {
root_parent= root_parent->parent;
}
@@ -125,7 +125,7 @@ int ED_view3d_camera_lock_sync(View3D *v3d, RegionView3D *rv3d)
object_tfm_protected_restore(root_parent, &obtfm, root_parent->protectflag);
ob_update= v3d->camera;
- while(ob_update) {
+ while (ob_update) {
DAG_id_tag_update(&ob_update->id, OB_RECALC_OB);
WM_main_add_notifier(NC_OBJECT|ND_TRANSFORM, ob_update);
ob_update= ob_update->parent;
@@ -159,41 +159,41 @@ static void view3d_boxview_clip(ScrArea *sa)
int val;
/* create bounding box */
- for(ar= sa->regionbase.first; ar; ar= ar->next) {
- if(ar->regiontype==RGN_TYPE_WINDOW) {
+ for (ar= sa->regionbase.first; ar; ar= ar->next) {
+ if (ar->regiontype==RGN_TYPE_WINDOW) {
RegionView3D *rv3d= ar->regiondata;
- if(rv3d->viewlock & RV3D_BOXCLIP) {
- if(ELEM(rv3d->view, RV3D_VIEW_TOP, RV3D_VIEW_BOTTOM)) {
- if(ar->winx>ar->winy) x1= rv3d->dist;
+ if (rv3d->viewlock & RV3D_BOXCLIP) {
+ if (ELEM(rv3d->view, RV3D_VIEW_TOP, RV3D_VIEW_BOTTOM)) {
+ if (ar->winx>ar->winy) x1= rv3d->dist;
else x1= ar->winx*rv3d->dist/ar->winy;
- if(ar->winx>ar->winy) y1= ar->winy*rv3d->dist/ar->winx;
+ if (ar->winx>ar->winy) y1= ar->winy*rv3d->dist/ar->winx;
else y1= rv3d->dist;
copy_v2_v2(ofs, rv3d->ofs);
}
- else if(ELEM(rv3d->view, RV3D_VIEW_FRONT, RV3D_VIEW_BACK)) {
+ else if (ELEM(rv3d->view, RV3D_VIEW_FRONT, RV3D_VIEW_BACK)) {
ofs[2]= rv3d->ofs[2];
- if(ar->winx>ar->winy) z1= ar->winy*rv3d->dist/ar->winx;
+ if (ar->winx>ar->winy) z1= ar->winy*rv3d->dist/ar->winx;
else z1= rv3d->dist;
}
}
}
}
- for(val=0; val<8; val++) {
- if(ELEM4(val, 0, 3, 4, 7))
+ for (val=0; val<8; val++) {
+ if (ELEM4(val, 0, 3, 4, 7))
bb->vec[val][0]= -x1 - ofs[0];
else
bb->vec[val][0]= x1 - ofs[0];
- if(ELEM4(val, 0, 1, 4, 5))
+ if (ELEM4(val, 0, 1, 4, 5))
bb->vec[val][1]= -y1 - ofs[1];
else
bb->vec[val][1]= y1 - ofs[1];
- if(val > 3)
+ if (val > 3)
bb->vec[val][2]= -z1 - ofs[2];
else
bb->vec[val][2]= z1 - ofs[2];
@@ -208,19 +208,19 @@ static void view3d_boxview_clip(ScrArea *sa)
normal_tri_v3( clip[5],bb->vec[0], bb->vec[2], bb->vec[1]);
/* then plane equations */
- for(val=0; val<6; val++) {
+ for (val=0; val<6; val++) {
clip[val][3] = -dot_v3v3(clip[val], bb->vec[val % 5]);
}
/* create bounding box */
- for(ar= sa->regionbase.first; ar; ar= ar->next) {
- if(ar->regiontype==RGN_TYPE_WINDOW) {
+ for (ar= sa->regionbase.first; ar; ar= ar->next) {
+ if (ar->regiontype==RGN_TYPE_WINDOW) {
RegionView3D *rv3d= ar->regiondata;
- if(rv3d->viewlock & RV3D_BOXCLIP) {
+ if (rv3d->viewlock & RV3D_BOXCLIP) {
rv3d->rflag |= RV3D_CLIPPING;
memcpy(rv3d->clip, clip, sizeof(clip));
- if(rv3d->clipbb) MEM_freeN(rv3d->clipbb);
+ if (rv3d->clipbb) MEM_freeN(rv3d->clipbb);
rv3d->clipbb= MEM_dupallocN(bb);
}
}
@@ -235,29 +235,29 @@ static void view3d_boxview_sync(ScrArea *sa, ARegion *ar)
RegionView3D *rv3d= ar->regiondata;
short clip= 0;
- for(artest= sa->regionbase.first; artest; artest= artest->next) {
- if(artest!=ar && artest->regiontype==RGN_TYPE_WINDOW) {
+ for (artest= sa->regionbase.first; artest; artest= artest->next) {
+ if (artest!=ar && artest->regiontype==RGN_TYPE_WINDOW) {
RegionView3D *rv3dtest= artest->regiondata;
- if(rv3dtest->viewlock) {
+ if (rv3dtest->viewlock) {
rv3dtest->dist= rv3d->dist;
- if( ELEM(rv3d->view, RV3D_VIEW_TOP, RV3D_VIEW_BOTTOM) ) {
- if( ELEM(rv3dtest->view, RV3D_VIEW_FRONT, RV3D_VIEW_BACK))
+ if ( ELEM(rv3d->view, RV3D_VIEW_TOP, RV3D_VIEW_BOTTOM) ) {
+ if ( ELEM(rv3dtest->view, RV3D_VIEW_FRONT, RV3D_VIEW_BACK))
rv3dtest->ofs[0]= rv3d->ofs[0];
- else if( ELEM(rv3dtest->view, RV3D_VIEW_RIGHT, RV3D_VIEW_LEFT))
+ else if ( ELEM(rv3dtest->view, RV3D_VIEW_RIGHT, RV3D_VIEW_LEFT))
rv3dtest->ofs[1]= rv3d->ofs[1];
}
- else if( ELEM(rv3d->view, RV3D_VIEW_FRONT, RV3D_VIEW_BACK) ) {
- if( ELEM(rv3dtest->view, RV3D_VIEW_TOP, RV3D_VIEW_BOTTOM))
+ else if ( ELEM(rv3d->view, RV3D_VIEW_FRONT, RV3D_VIEW_BACK) ) {
+ if ( ELEM(rv3dtest->view, RV3D_VIEW_TOP, RV3D_VIEW_BOTTOM))
rv3dtest->ofs[0]= rv3d->ofs[0];
- else if( ELEM(rv3dtest->view, RV3D_VIEW_RIGHT, RV3D_VIEW_LEFT))
+ else if ( ELEM(rv3dtest->view, RV3D_VIEW_RIGHT, RV3D_VIEW_LEFT))
rv3dtest->ofs[2]= rv3d->ofs[2];
}
- else if( ELEM(rv3d->view, RV3D_VIEW_RIGHT, RV3D_VIEW_LEFT) ) {
- if( ELEM(rv3dtest->view, RV3D_VIEW_TOP, RV3D_VIEW_BOTTOM))
+ else if ( ELEM(rv3d->view, RV3D_VIEW_RIGHT, RV3D_VIEW_LEFT) ) {
+ if ( ELEM(rv3dtest->view, RV3D_VIEW_TOP, RV3D_VIEW_BOTTOM))
rv3dtest->ofs[1]= rv3d->ofs[1];
- if( ELEM(rv3dtest->view, RV3D_VIEW_FRONT, RV3D_VIEW_BACK))
+ if ( ELEM(rv3dtest->view, RV3D_VIEW_FRONT, RV3D_VIEW_BACK))
rv3dtest->ofs[2]= rv3d->ofs[2];
}
@@ -268,7 +268,7 @@ static void view3d_boxview_sync(ScrArea *sa, ARegion *ar)
}
}
- if(clip) {
+ if (clip) {
view3d_boxview_clip(sa);
}
}
@@ -280,11 +280,11 @@ void view3d_boxview_copy(ScrArea *sa, ARegion *ar)
RegionView3D *rv3d= ar->regiondata;
short clip= 0;
- for(artest= sa->regionbase.first; artest; artest= artest->next) {
- if(artest!=ar && artest->regiontype==RGN_TYPE_WINDOW) {
+ for (artest= sa->regionbase.first; artest; artest= artest->next) {
+ if (artest!=ar && artest->regiontype==RGN_TYPE_WINDOW) {
RegionView3D *rv3dtest= artest->regiondata;
- if(rv3dtest->viewlock) {
+ if (rv3dtest->viewlock) {
rv3dtest->dist= rv3d->dist;
copy_v3_v3(rv3dtest->ofs, rv3d->ofs);
ED_region_tag_redraw(artest);
@@ -294,7 +294,7 @@ void view3d_boxview_copy(ScrArea *sa, ARegion *ar)
}
}
- if(clip) {
+ if (clip) {
view3d_boxview_clip(sa);
}
}
@@ -310,19 +310,19 @@ void ED_view3d_quadview_update(ScrArea *sa, ARegion *ar, short do_clip)
properties are always being edited, weak */
viewlock= rv3d->viewlock;
- if((viewlock & RV3D_LOCKED)==0)
+ if ((viewlock & RV3D_LOCKED)==0)
viewlock= 0;
- else if((viewlock & RV3D_BOXVIEW)==0) {
+ else if ((viewlock & RV3D_BOXVIEW)==0) {
viewlock &= ~RV3D_BOXCLIP;
do_clip= TRUE;
}
- for(; ar; ar= ar->prev) {
- if(ar->alignment==RGN_ALIGN_QSPLIT) {
+ for (; ar; ar= ar->prev) {
+ if (ar->alignment==RGN_ALIGN_QSPLIT) {
rv3d= ar->regiondata;
rv3d->viewlock= viewlock;
- if(do_clip && (viewlock & RV3D_BOXCLIP)==0) {
+ if (do_clip && (viewlock & RV3D_BOXCLIP)==0) {
rv3d->rflag &= ~RV3D_BOXCLIP;
}
@@ -333,7 +333,7 @@ void ED_view3d_quadview_update(ScrArea *sa, ARegion *ar, short do_clip)
}
}
- if(rv3d->viewlock & RV3D_BOXVIEW) {
+ if (rv3d->viewlock & RV3D_BOXVIEW) {
view3d_boxview_copy(sa, arsync ? arsync : sa->regionbase.last);
}
@@ -433,7 +433,7 @@ static void viewops_data_create(bContext *C, wmOperator *op, wmEvent *event)
view3d_operator_needs_opengl(C); /* needed for zbuf drawing */
- if((vod->use_dyn_ofs=ED_view3d_autodist(CTX_data_scene(C), vod->ar, vod->v3d, event->mval, vod->dyn_ofs))) {
+ if ((vod->use_dyn_ofs=ED_view3d_autodist(CTX_data_scene(C), vod->ar, vod->v3d, event->mval, vod->dyn_ofs))) {
if (rv3d->is_persp) {
float my_origin[3]; /* original G.vd->ofs */
float my_pivot[3]; /* view */
@@ -495,12 +495,12 @@ static void viewops_data_free(bContext *C, wmOperator *op)
ARegion *ar;
Paint *p = paint_get_active(CTX_data_scene(C));
- if(op->customdata) {
+ if (op->customdata) {
ViewOpsData *vod= op->customdata;
ar= vod->ar;
vod->rv3d->rflag &= ~RV3D_NAVIGATING;
- if(vod->timer)
+ if (vod->timer)
WM_event_remove_timer(CTX_wm_manager(C), vod->timer->win, vod->timer);
MEM_freeN(vod);
@@ -510,7 +510,7 @@ static void viewops_data_free(bContext *C, wmOperator *op)
ar= CTX_wm_region(C);
}
- if(p && (p->flags & PAINT_FAST_NAVIGATE))
+ if (p && (p->flags & PAINT_FAST_NAVIGATE))
ED_region_tag_redraw(ar);
}
@@ -599,7 +599,7 @@ void viewrotate_modal_keymap(wmKeyConfig *keyconf)
wmKeyMap *keymap= WM_modalkeymap_get(keyconf, "View3D Rotate Modal");
/* this function is called for each spacetype, only needs to add map once */
- if(keymap) return;
+ if (keymap) return;
keymap= WM_modalkeymap_add(keyconf, "View3D Rotate Modal", modal_items);
@@ -718,7 +718,7 @@ static void viewrotate_apply(ViewOpsData *vod, int x, int y)
}
/* check for view snap */
- if (vod->axis_snap){
+ if (vod->axis_snap) {
int i;
float viewquat_inv[4];
float zaxis[3]={0,0,1};
@@ -726,7 +726,7 @@ static void viewrotate_apply(ViewOpsData *vod, int x, int y)
mul_qt_v3(viewquat_inv, zaxis);
- for (i = 0 ; i < NUM_SNAP_QUATS; i++){
+ for (i = 0 ; i < NUM_SNAP_QUATS; i++) {
float view = (int)snapquats[i][4];
float viewquat_inv_test[4];
@@ -735,7 +735,7 @@ static void viewrotate_apply(ViewOpsData *vod, int x, int y)
invert_qt_qt(viewquat_inv_test, snapquats[i]);
mul_qt_v3(viewquat_inv_test, zaxis_test);
- if(angle_v3v3(zaxis_test, zaxis) < DEG2RADF(45/3)) {
+ if (angle_v3v3(zaxis_test, zaxis) < DEG2RADF(45/3)) {
/* find the best roll */
float quat_roll[4], quat_final[4], quat_best[4];
float viewquat_align[4]; /* viewquat aligned to zaxis_test */
@@ -752,7 +752,7 @@ static void viewrotate_apply(ViewOpsData *vod, int x, int y)
invert_qt_qt(viewquat_align_inv, viewquat_align);
/* find best roll */
- for(j= 0; j<8; j++) {
+ for (j= 0; j<8; j++) {
float angle;
float xaxis1[3]={1,0,0};
float xaxis2[3]={1,0,0};
@@ -770,10 +770,10 @@ static void viewrotate_apply(ViewOpsData *vod, int x, int y)
mul_qt_v3(quat_final_inv, xaxis2);
angle= angle_v3v3(xaxis1, xaxis2);
- if(angle <= best_angle) {
+ if (angle <= best_angle) {
best_angle= angle;
copy_qt_qt(quat_best, quat_final);
- if(j) view= 0; /* view grid assumes certain up axis */
+ if (j) view= 0; /* view grid assumes certain up axis */
}
}
@@ -805,10 +805,10 @@ static int viewrotate_modal(bContext *C, wmOperator *op, wmEvent *event)
short event_code= VIEW_PASS;
/* execute the events */
- if(event->type==MOUSEMOVE) {
+ if (event->type==MOUSEMOVE) {
event_code= VIEW_APPLY;
}
- else if(event->type==EVT_MODAL_MAP) {
+ else if (event->type==EVT_MODAL_MAP) {
switch (event->val) {
case VIEW_MODAL_CONFIRM:
event_code= VIEW_CONFIRM;
@@ -831,11 +831,11 @@ static int viewrotate_modal(bContext *C, wmOperator *op, wmEvent *event)
break;
}
}
- else if(event->type==vod->origkey && event->val==KM_RELEASE) {
+ else if (event->type==vod->origkey && event->val==KM_RELEASE) {
event_code= VIEW_CONFIRM;
}
- if(event_code==VIEW_APPLY) {
+ if (event_code==VIEW_APPLY) {
viewrotate_apply(vod, event->x, event->y);
}
else if (event_code==VIEW_CONFIRM) {
@@ -858,27 +858,27 @@ static int viewrotate_invoke(bContext *C, wmOperator *op, wmEvent *event)
vod= op->customdata;
rv3d= vod->rv3d;
- if(rv3d->viewlock) { /* poll should check but in some cases fails, see poll func for details */
+ if (rv3d->viewlock) { /* poll should check but in some cases fails, see poll func for details */
viewops_data_free(C, op);
return OPERATOR_PASS_THROUGH;
}
/* switch from camera view when: */
- if(rv3d->persp != RV3D_PERSP) {
+ if (rv3d->persp != RV3D_PERSP) {
if (U.uiflag & USER_AUTOPERSP) {
- if(!ED_view3d_camera_lock_check(vod->v3d, vod->rv3d)) {
+ if (!ED_view3d_camera_lock_check(vod->v3d, vod->rv3d)) {
rv3d->persp= RV3D_PERSP;
}
}
- else if(rv3d->persp==RV3D_CAMOB) {
+ else if (rv3d->persp==RV3D_CAMOB) {
/* changed since 2.4x, use the camera view */
- if(vod->v3d->camera) {
+ if (vod->v3d->camera) {
ED_view3d_from_object(vod->v3d->camera, rv3d->ofs, rv3d->viewquat, &rv3d->dist, NULL);
}
- if(!ED_view3d_camera_lock_check(vod->v3d, vod->rv3d)) {
+ if (!ED_view3d_camera_lock_check(vod->v3d, vod->rv3d)) {
rv3d->persp= rv3d->lpersp;
}
}
@@ -912,9 +912,9 @@ static int viewrotate_invoke(bContext *C, wmOperator *op, wmEvent *event)
static int view3d_camera_active_poll(bContext *C)
{
- if(ED_operator_view3d_active(C)) {
+ if (ED_operator_view3d_active(C)) {
RegionView3D *rv3d= CTX_wm_region_view3d(C);
- if(rv3d && rv3d->persp==RV3D_CAMOB) {
+ if (rv3d && rv3d->persp==RV3D_CAMOB) {
return 1;
}
}
@@ -930,7 +930,7 @@ static int view3d_camera_user_poll(bContext *C)
if (ED_view3d_context_user_region(C, &v3d, &ar)) {
RegionView3D *rv3d = ar->regiondata;
- if(rv3d->persp==RV3D_CAMOB) {
+ if (rv3d->persp==RV3D_CAMOB) {
return 1;
}
}
@@ -1073,7 +1073,8 @@ static int ndof_orbit_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event
/* apply rotation */
mul_qt_qtqt(rv3d->viewquat, rv3d->viewquat, rot);
- } else {
+ }
+ else {
/* turntable view code by John Aughey, adapted for 3D mouse by [mce] */
float angle, rot[4];
@@ -1245,7 +1246,7 @@ void viewmove_modal_keymap(wmKeyConfig *keyconf)
wmKeyMap *keymap= WM_modalkeymap_get(keyconf, "View3D Move Modal");
/* this function is called for each spacetype, only needs to add map once */
- if(keymap) return;
+ if (keymap) return;
keymap= WM_modalkeymap_add(keyconf, "View3D Move Modal", modal_items);
@@ -1266,7 +1267,7 @@ void viewmove_modal_keymap(wmKeyConfig *keyconf)
static void viewmove_apply(ViewOpsData *vod, int x, int y)
{
- if((vod->rv3d->persp==RV3D_CAMOB) && !ED_view3d_camera_lock_check(vod->v3d, vod->rv3d)) {
+ if ((vod->rv3d->persp==RV3D_CAMOB) && !ED_view3d_camera_lock_check(vod->v3d, vod->rv3d)) {
const float zoomfac= BKE_screen_view3d_zoom_to_fac((float)vod->rv3d->camzoom) * 2.0f;
vod->rv3d->camdx += (vod->oldx - x)/(vod->ar->winx * zoomfac);
vod->rv3d->camdy += (vod->oldy - y)/(vod->ar->winy * zoomfac);
@@ -1283,7 +1284,7 @@ static void viewmove_apply(ViewOpsData *vod, int x, int y)
add_v3_v3(vod->rv3d->ofs, dvec);
- if(vod->rv3d->viewlock & RV3D_BOXVIEW)
+ if (vod->rv3d->viewlock & RV3D_BOXVIEW)
view3d_boxview_sync(vod->sa, vod->ar);
}
@@ -1303,10 +1304,10 @@ static int viewmove_modal(bContext *C, wmOperator *op, wmEvent *event)
short event_code= VIEW_PASS;
/* execute the events */
- if(event->type==MOUSEMOVE) {
+ if (event->type==MOUSEMOVE) {
event_code= VIEW_APPLY;
}
- else if(event->type==EVT_MODAL_MAP) {
+ else if (event->type==EVT_MODAL_MAP) {
switch (event->val) {
case VIEW_MODAL_CONFIRM:
event_code= VIEW_CONFIRM;
@@ -1321,11 +1322,11 @@ static int viewmove_modal(bContext *C, wmOperator *op, wmEvent *event)
break;
}
}
- else if(event->type==vod->origkey && event->val==KM_RELEASE) {
+ else if (event->type==vod->origkey && event->val==KM_RELEASE) {
event_code= VIEW_CONFIRM;
}
- if(event_code==VIEW_APPLY) {
+ if (event_code==VIEW_APPLY) {
viewmove_apply(vod, event->x, event->y);
}
else if (event_code==VIEW_CONFIRM) {
@@ -1405,7 +1406,7 @@ void viewzoom_modal_keymap(wmKeyConfig *keyconf)
wmKeyMap *keymap= WM_modalkeymap_get(keyconf, "View3D Zoom Modal");
/* this function is called for each spacetype, only needs to add map once */
- if(keymap) return;
+ if (keymap) return;
keymap= WM_modalkeymap_add(keyconf, "View3D Zoom Modal", modal_items);
@@ -1427,7 +1428,7 @@ static void view_zoom_mouseloc(ARegion *ar, float dfac, int mx, int my)
{
RegionView3D *rv3d= ar->regiondata;
- if(U.uiflag & USER_ZOOM_TO_MOUSEPOS) {
+ if (U.uiflag & USER_ZOOM_TO_MOUSEPOS) {
float dvec[3];
float tvec[3];
float tpos[3];
@@ -1455,7 +1456,8 @@ static void view_zoom_mouseloc(ARegion *ar, float dfac, int mx, int my)
/* Calculate final offset */
madd_v3_v3v3fl(rv3d->ofs, tvec, dvec, dfac);
- } else {
+ }
+ else {
rv3d->dist *= dfac;
}
}
@@ -1465,7 +1467,7 @@ static void viewzoom_apply(ViewOpsData *vod, int x, int y, const short viewzoom,
{
float zfac=1.0;
- if(viewzoom==USER_ZOOM_CONT) {
+ if (viewzoom==USER_ZOOM_CONT) {
double time= PIL_check_seconds_timer();
float time_step= (float)(time - vod->timer_lastdraw);
float fac;
@@ -1477,7 +1479,7 @@ static void viewzoom_apply(ViewOpsData *vod, int x, int y, const short viewzoom,
fac= (float)(y - vod->origy);
}
- if(zoom_invert) {
+ if (zoom_invert) {
fac= -fac;
}
@@ -1485,7 +1487,7 @@ static void viewzoom_apply(ViewOpsData *vod, int x, int y, const short viewzoom,
zfac = 1.0f + ((fac / 20.0f) * time_step);
vod->timer_lastdraw= time;
}
- else if(viewzoom==USER_ZOOM_SCALE) {
+ else if (viewzoom==USER_ZOOM_SCALE) {
int ctr[2], len1, len2;
// method which zooms based on how far you move the mouse
@@ -1515,15 +1517,15 @@ static void viewzoom_apply(ViewOpsData *vod, int x, int y, const short viewzoom,
zfac = vod->dist0 * (2.0f * ((len2/len1)-1.0f) + 1.0f) / vod->rv3d->dist;
}
- if(zfac != 1.0f && zfac*vod->rv3d->dist > 0.001f * vod->grid &&
+ if (zfac != 1.0f && zfac*vod->rv3d->dist > 0.001f * vod->grid &&
zfac * vod->rv3d->dist < 10.0f * vod->far)
view_zoom_mouseloc(vod->ar, zfac, vod->oldx, vod->oldy);
/* these limits were in old code too */
- if(vod->rv3d->dist<0.001f * vod->grid) vod->rv3d->dist= 0.001f * vod->grid;
- if(vod->rv3d->dist>10.0f * vod->far) vod->rv3d->dist=10.0f * vod->far;
+ if (vod->rv3d->dist<0.001f * vod->grid) vod->rv3d->dist= 0.001f * vod->grid;
+ if (vod->rv3d->dist>10.0f * vod->far) vod->rv3d->dist=10.0f * vod->far;
- if(vod->rv3d->viewlock & RV3D_BOXVIEW)
+ if (vod->rv3d->viewlock & RV3D_BOXVIEW)
view3d_boxview_sync(vod->sa, vod->ar);
ED_view3d_camera_lock_sync(vod->v3d, vod->rv3d);
@@ -1542,10 +1544,10 @@ static int viewzoom_modal(bContext *C, wmOperator *op, wmEvent *event)
/* continuous zoom */
event_code= VIEW_APPLY;
}
- else if(event->type==MOUSEMOVE) {
+ else if (event->type==MOUSEMOVE) {
event_code= VIEW_APPLY;
}
- else if(event->type==EVT_MODAL_MAP) {
+ else if (event->type==EVT_MODAL_MAP) {
switch (event->val) {
case VIEW_MODAL_CONFIRM:
event_code= VIEW_CONFIRM;
@@ -1560,11 +1562,11 @@ static int viewzoom_modal(bContext *C, wmOperator *op, wmEvent *event)
break;
}
}
- else if(event->type==vod->origkey && event->val==KM_RELEASE) {
+ else if (event->type==vod->origkey && event->val==KM_RELEASE) {
event_code= VIEW_CONFIRM;
}
- if(event_code==VIEW_APPLY) {
+ if (event_code==VIEW_APPLY) {
viewzoom_apply(vod, event->x, event->y, U.viewzoom, (U.uiflag & USER_ZOOM_INVERT) != 0);
}
else if (event_code==VIEW_CONFIRM) {
@@ -1588,7 +1590,7 @@ static int viewzoom_exec(bContext *C, wmOperator *op)
int delta= RNA_int_get(op->ptr, "delta");
int mx, my;
- if(op->customdata) {
+ if (op->customdata) {
ViewOpsData *vod= op->customdata;
sa= vod->sa;
@@ -1607,27 +1609,27 @@ static int viewzoom_exec(bContext *C, wmOperator *op)
use_cam_zoom= (rv3d->persp==RV3D_CAMOB) && !(rv3d->is_persp && ED_view3d_camera_lock_check(v3d, rv3d));
- if(delta < 0) {
+ if (delta < 0) {
/* this min and max is also in viewmove() */
- if(use_cam_zoom) {
+ if (use_cam_zoom) {
rv3d->camzoom-= 10;
- if(rv3d->camzoom < RV3D_CAMZOOM_MIN) rv3d->camzoom= RV3D_CAMZOOM_MIN;
+ if (rv3d->camzoom < RV3D_CAMZOOM_MIN) rv3d->camzoom= RV3D_CAMZOOM_MIN;
}
- else if(rv3d->dist < 10.0f * v3d->far) {
+ else if (rv3d->dist < 10.0f * v3d->far) {
view_zoom_mouseloc(ar, 1.2f, mx, my);
}
}
else {
- if(use_cam_zoom) {
+ if (use_cam_zoom) {
rv3d->camzoom+= 10;
- if(rv3d->camzoom > RV3D_CAMZOOM_MAX) rv3d->camzoom= RV3D_CAMZOOM_MAX;
+ if (rv3d->camzoom > RV3D_CAMZOOM_MAX) rv3d->camzoom= RV3D_CAMZOOM_MAX;
}
- else if(rv3d->dist> 0.001f * v3d->grid) {
+ else if (rv3d->dist> 0.001f * v3d->grid) {
view_zoom_mouseloc(ar, .83333f, mx, my);
}
}
- if(rv3d->viewlock & RV3D_BOXVIEW)
+ if (rv3d->viewlock & RV3D_BOXVIEW)
view3d_boxview_sync(sa, ar);
ED_view3d_depth_tag_update(rv3d);
@@ -1656,7 +1658,7 @@ void viewdolly_modal_keymap(wmKeyConfig *keyconf)
wmKeyMap *keymap= WM_modalkeymap_get(keyconf, "View3D Dolly Modal");
/* this function is called for each spacetype, only needs to add map once */
- if(keymap) return;
+ if (keymap) return;
keymap= WM_modalkeymap_add(keyconf, "View3D Dolly Modal", modal_items);
@@ -1689,7 +1691,7 @@ static int viewzoom_invoke(bContext *C, wmOperator *op, wmEvent *event)
RNA_int_set(op->ptr, "my", event->y);
}
- if(RNA_struct_property_is_set(op->ptr, "delta")) {
+ if (RNA_struct_property_is_set(op->ptr, "delta")) {
viewzoom_exec(C, op);
}
else {
@@ -1711,7 +1713,7 @@ static int viewzoom_invoke(bContext *C, wmOperator *op, wmEvent *event)
return OPERATOR_FINISHED;
}
else {
- if(U.viewzoom == USER_ZOOM_CONT) {
+ if (U.viewzoom == USER_ZOOM_CONT) {
/* needs a timer to continue redrawing */
vod->timer= WM_event_add_timer(CTX_wm_manager(C), CTX_wm_window(C), TIMER, 0.01f);
vod->timer_lastdraw= PIL_check_seconds_timer();
@@ -1784,10 +1786,10 @@ static void viewdolly_apply(ViewOpsData *vod, int x, int y, const short zoom_inv
zfac = 1.0f + ((len2 - len1) * 0.01f * vod->rv3d->dist);
}
- if(zfac != 1.0f)
+ if (zfac != 1.0f)
view_dolly_mouseloc(vod->ar, vod->ofs, vod->mousevec, zfac);
- if(vod->rv3d->viewlock & RV3D_BOXVIEW)
+ if (vod->rv3d->viewlock & RV3D_BOXVIEW)
view3d_boxview_sync(vod->sa, vod->ar);
ED_view3d_camera_lock_sync(vod->v3d, vod->rv3d);
@@ -1802,10 +1804,10 @@ static int viewdolly_modal(bContext *C, wmOperator *op, wmEvent *event)
short event_code= VIEW_PASS;
/* execute the events */
- if(event->type==MOUSEMOVE) {
+ if (event->type==MOUSEMOVE) {
event_code= VIEW_APPLY;
}
- else if(event->type==EVT_MODAL_MAP) {
+ else if (event->type==EVT_MODAL_MAP) {
switch (event->val) {
case VIEW_MODAL_CONFIRM:
event_code= VIEW_CONFIRM;
@@ -1820,11 +1822,11 @@ static int viewdolly_modal(bContext *C, wmOperator *op, wmEvent *event)
break;
}
}
- else if(event->type==vod->origkey && event->val==KM_RELEASE) {
+ else if (event->type==vod->origkey && event->val==KM_RELEASE) {
event_code= VIEW_CONFIRM;
}
- if(event_code==VIEW_APPLY) {
+ if (event_code==VIEW_APPLY) {
viewdolly_apply(vod, event->x, event->y, (U.uiflag & USER_ZOOM_INVERT) != 0);
}
else if (event_code==VIEW_CONFIRM) {
@@ -1847,7 +1849,7 @@ static int viewdolly_exec(bContext *C, wmOperator *op)
int delta= RNA_int_get(op->ptr, "delta");
- if(op->customdata) {
+ if (op->customdata) {
ViewOpsData *vod= op->customdata;
sa= vod->sa;
@@ -1865,18 +1867,18 @@ static int viewdolly_exec(bContext *C, wmOperator *op)
rv3d= ar->regiondata;
/* overwrite the mouse vector with the view direction (zoom into the center) */
- if((U.uiflag & USER_ZOOM_TO_MOUSEPOS) == 0) {
+ if ((U.uiflag & USER_ZOOM_TO_MOUSEPOS) == 0) {
normalize_v3_v3(mousevec, rv3d->viewinv[2]);
}
- if(delta < 0) {
+ if (delta < 0) {
view_dolly_mouseloc(ar, rv3d->ofs, mousevec, 1.2f);
}
else {
view_dolly_mouseloc(ar, rv3d->ofs, mousevec, .83333f);
}
- if(rv3d->viewlock & RV3D_BOXVIEW)
+ if (rv3d->viewlock & RV3D_BOXVIEW)
view3d_boxview_sync(sa, ar);
ED_view3d_depth_tag_update(rv3d);
@@ -1902,12 +1904,12 @@ static int viewdolly_invoke(bContext *C, wmOperator *op, wmEvent *event)
RNA_int_set(op->ptr, "my", event->y);
}
- if(RNA_struct_property_is_set(op->ptr, "delta")) {
+ if (RNA_struct_property_is_set(op->ptr, "delta")) {
viewdolly_exec(C, op);
}
else {
/* overwrite the mouse vector with the view direction (zoom into the center) */
- if((U.uiflag & USER_ZOOM_TO_MOUSEPOS) == 0) {
+ if ((U.uiflag & USER_ZOOM_TO_MOUSEPOS) == 0) {
negate_v3_v3(vod->mousevec, vod->rv3d->viewinv[2]);
normalize_v3(vod->mousevec);
}
@@ -1945,7 +1947,7 @@ static int viewdolly_poll(bContext *C)
{
RegionView3D *rv3d= CTX_wm_region_view3d(C);
- if(rv3d) {
+ if (rv3d) {
if (rv3d->persp == RV3D_PERSP) {
return 1;
}
@@ -2005,7 +2007,7 @@ static int view3d_all_exec(bContext *C, wmOperator *op) /* was view3d_home() in
float size, min[3], max[3], afm[3];
int ok= 1, onedone=0;
- if(center) {
+ if (center) {
/* in 2.4x this also move the cursor to (0, 0, 0) (with shift+c). */
curs= give_cursor(scene, v3d);
zero_v3(min);
@@ -2016,18 +2018,18 @@ static int view3d_all_exec(bContext *C, wmOperator *op) /* was view3d_home() in
INIT_MINMAX(min, max);
}
- for(base= scene->base.first; base; base= base->next) {
- if(BASE_VISIBLE(v3d, base)) {
+ for (base= scene->base.first; base; base= base->next) {
+ if (BASE_VISIBLE(v3d, base)) {
onedone= 1;
- if(skip_camera && base->object == v3d->camera) {
+ if (skip_camera && base->object == v3d->camera) {
continue;
}
minmax_object(base->object, min, max);
}
}
- if(!onedone) {
+ if (!onedone) {
ED_region_tag_redraw(ar);
/* TODO - should this be cancel?
* I think no, because we always move the cursor, with or without
@@ -2041,9 +2043,9 @@ static int view3d_all_exec(bContext *C, wmOperator *op) /* was view3d_home() in
sub_v3_v3v3(afm, max, min);
size= 0.7f*MAX3(afm[0], afm[1], afm[2]);
- if(size == 0.0f) ok= 0;
+ if (size == 0.0f) ok= 0;
- if(ok) {
+ if (ok) {
float new_dist;
float new_ofs[3];
@@ -2053,9 +2055,9 @@ static int view3d_all_exec(bContext *C, wmOperator *op) /* was view3d_home() in
new_ofs[2]= -(min[2]+max[2])/2.0f;
// correction for window aspect ratio
- if(ar->winy>2 && ar->winx>2) {
+ if (ar->winy>2 && ar->winx>2) {
size= (float)ar->winx/(float)ar->winy;
- if(size < 1.0f) size= 1.0f/size;
+ if (size < 1.0f) size= 1.0f/size;
new_dist*= size;
}
@@ -2115,30 +2117,30 @@ static int viewselected_exec(bContext *C, wmOperator *UNUSED(op))
/* hardcoded exception, we look for the one selected armature */
/* this is weak code this way, we should make a generic active/selection callback interface once... */
Base *base;
- for(base=scene->base.first; base; base= base->next) {
- if(TESTBASELIB(v3d, base)) {
- if(base->object->type==OB_ARMATURE)
- if(base->object->mode & OB_MODE_POSE)
+ for (base=scene->base.first; base; base= base->next) {
+ if (TESTBASELIB(v3d, base)) {
+ if (base->object->type==OB_ARMATURE)
+ if (base->object->mode & OB_MODE_POSE)
break;
}
}
- if(base)
+ if (base)
ob= base->object;
}
- if(obedit) {
+ if (obedit) {
ok = minmax_verts(obedit, min, max); /* only selected */
}
- else if(ob && (ob->mode & OB_MODE_POSE)) {
- if(ob->pose) {
+ else if (ob && (ob->mode & OB_MODE_POSE)) {
+ if (ob->pose) {
bArmature *arm= ob->data;
bPoseChannel *pchan;
float vec[3];
- for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
- if(pchan->bone->flag & BONE_SELECTED) {
- if(pchan->bone->layer & arm->layer) {
+ for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
+ if (pchan->bone->flag & BONE_SELECTED) {
+ if (pchan->bone->layer & arm->layer) {
bPoseChannel *pchan_tx= pchan->custom_tx ? pchan->custom_tx : pchan;
ok= 1;
mul_v3_m4v3(vec, ob->obmat, pchan_tx->pose_head);
@@ -2158,10 +2160,10 @@ static int viewselected_exec(bContext *C, wmOperator *UNUSED(op))
}
else {
Base *base;
- for(base= FIRSTBASE; base; base = base->next) {
- if(TESTBASE(v3d, base)) {
+ for (base= FIRSTBASE; base; base = base->next) {
+ if (TESTBASE(v3d, base)) {
- if(skip_camera && base->object == v3d->camera) {
+ if (skip_camera && base->object == v3d->camera) {
continue;
}
@@ -2174,13 +2176,13 @@ static int viewselected_exec(bContext *C, wmOperator *UNUSED(op))
}
}
- if(ok==0) return OPERATOR_FINISHED;
+ if (ok==0) return OPERATOR_FINISHED;
sub_v3_v3v3(afm, max, min);
size= MAX3(afm[0], afm[1], afm[2]);
- if(!rv3d->is_persp) {
- if(size < 0.0001f) { /* if its a sinble point. dont even re-scale */
+ if (!rv3d->is_persp) {
+ if (size < 0.0001f) { /* if its a sinble point. dont even re-scale */
ok_dist= 0;
}
else {
@@ -2189,7 +2191,7 @@ static int viewselected_exec(bContext *C, wmOperator *UNUSED(op))
}
}
else {
- if(size <= v3d->near*1.5f) {
+ if (size <= v3d->near*1.5f) {
size= v3d->near*1.5f;
}
}
@@ -2200,9 +2202,9 @@ static int viewselected_exec(bContext *C, wmOperator *UNUSED(op))
new_dist = size;
/* correction for window aspect ratio */
- if(ar->winy>2 && ar->winx>2) {
+ if (ar->winy>2 && ar->winx>2) {
size= (float)ar->winx/(float)ar->winy;
- if(size<1.0f) size= 1.0f/size;
+ if (size<1.0f) size= 1.0f/size;
new_dist*= size;
}
@@ -2357,7 +2359,8 @@ static int render_border_exec(bContext *C, wmOperator *op)
scene->r.border.ymin == scene->r.border.ymax ))
{
scene->r.mode &= ~R_BORDER;
- } else {
+ }
+ else {
scene->r.mode |= R_BORDER;
}
@@ -2447,7 +2450,7 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op)
double p_corner[3];
/* no depths to use, we cant do anything! */
- if (depth_close==FLT_MAX){
+ if (depth_close==FLT_MAX) {
BKE_report(op->reports, RPT_ERROR, "Depth Too Large");
return OPERATOR_CANCELLED;
}
@@ -2467,13 +2470,14 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op)
dvec[2] = p[2]-p_corner[2];
new_dist = len_v3(dvec);
- if(new_dist <= v3d->near * 1.5f) new_dist= v3d->near * 1.5f;
+ if (new_dist <= v3d->near * 1.5f) new_dist= v3d->near * 1.5f;
new_ofs[0] = -p[0];
new_ofs[1] = -p[1];
new_ofs[2] = -p[2];
- } else { /* othographic */
+ }
+ else { /* othographic */
/* find the current window width and height */
vb[0] = ar->winx;
vb[1] = ar->winy;
@@ -2514,7 +2518,7 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op)
smooth_view(C, v3d, ar, NULL, NULL, new_ofs, NULL, &new_dist, NULL);
- if(rv3d->viewlock & RV3D_BOXVIEW)
+ if (rv3d->viewlock & RV3D_BOXVIEW)
view3d_boxview_sync(CTX_wm_area(C), ar);
return OPERATOR_FINISHED;
@@ -2629,7 +2633,7 @@ static void axis_set_view(bContext *C, View3D *v3d, ARegion *ar,
new_quat[2]= q3; new_quat[3]= q4;
normalize_qt(new_quat);
- if(align_active) {
+ if (align_active) {
/* align to active object */
Object *obact= CTX_data_active_object(C);
if (obact==NULL) {
@@ -2651,23 +2655,23 @@ static void axis_set_view(bContext *C, View3D *v3d, ARegion *ar,
}
}
- if(align_active==FALSE) {
+ if (align_active==FALSE) {
/* normal operation */
- if(rv3d->viewlock) {
+ if (rv3d->viewlock) {
/* only pass on if */
- if(rv3d->view==RV3D_VIEW_FRONT && view==RV3D_VIEW_BACK);
- else if(rv3d->view==RV3D_VIEW_BACK && view==RV3D_VIEW_FRONT);
- else if(rv3d->view==RV3D_VIEW_RIGHT && view==RV3D_VIEW_LEFT);
- else if(rv3d->view==RV3D_VIEW_LEFT && view==RV3D_VIEW_RIGHT);
- else if(rv3d->view==RV3D_VIEW_BOTTOM && view==RV3D_VIEW_TOP);
- else if(rv3d->view==RV3D_VIEW_TOP && view==RV3D_VIEW_BOTTOM);
+ if (rv3d->view==RV3D_VIEW_FRONT && view==RV3D_VIEW_BACK);
+ else if (rv3d->view==RV3D_VIEW_BACK && view==RV3D_VIEW_FRONT);
+ else if (rv3d->view==RV3D_VIEW_RIGHT && view==RV3D_VIEW_LEFT);
+ else if (rv3d->view==RV3D_VIEW_LEFT && view==RV3D_VIEW_RIGHT);
+ else if (rv3d->view==RV3D_VIEW_BOTTOM && view==RV3D_VIEW_TOP);
+ else if (rv3d->view==RV3D_VIEW_TOP && view==RV3D_VIEW_BOTTOM);
else return;
}
rv3d->view= view;
}
- if(rv3d->viewlock) {
+ if (rv3d->viewlock) {
ED_region_tag_redraw(ar);
return;
}
@@ -2675,14 +2679,14 @@ static void axis_set_view(bContext *C, View3D *v3d, ARegion *ar,
if (rv3d->persp==RV3D_CAMOB && v3d->camera) {
if (U.uiflag & USER_AUTOPERSP) rv3d->persp= view ? RV3D_ORTHO : RV3D_PERSP;
- else if(rv3d->persp==RV3D_CAMOB) rv3d->persp= perspo;
+ else if (rv3d->persp==RV3D_CAMOB) rv3d->persp= perspo;
smooth_view(C, v3d, ar, v3d->camera, NULL, rv3d->ofs, new_quat, NULL, NULL);
}
else {
if (U.uiflag & USER_AUTOPERSP) rv3d->persp= view ? RV3D_ORTHO : RV3D_PERSP;
- else if(rv3d->persp==RV3D_CAMOB) rv3d->persp= perspo;
+ else if (rv3d->persp==RV3D_CAMOB) rv3d->persp= perspo;
smooth_view(C, v3d, ar, NULL, NULL, NULL, new_quat, NULL, NULL);
}
@@ -2706,14 +2710,15 @@ static int viewnumpad_exec(bContext *C, wmOperator *op)
align_active = RNA_boolean_get(op->ptr, "align_active");
/* set this to zero, gets handled in axis_set_view */
- if(rv3d->viewlock)
+ if (rv3d->viewlock)
align_active= 0;
/* Use this to test if we started out with a camera */
if (rv3d->persp == RV3D_CAMOB) {
nextperspo= rv3d->lpersp;
- } else {
+ }
+ else {
nextperspo= perspo;
}
@@ -2749,10 +2754,10 @@ static int viewnumpad_exec(bContext *C, wmOperator *op)
break;
case RV3D_VIEW_CAMERA:
- if(rv3d->viewlock==0) {
+ if (rv3d->viewlock==0) {
/* lastview - */
- if(rv3d->persp != RV3D_CAMOB) {
+ if (rv3d->persp != RV3D_CAMOB) {
Object *ob= OBACT;
if (!rv3d->smooth_timer) {
@@ -2764,8 +2769,8 @@ static int viewnumpad_exec(bContext *C, wmOperator *op)
}
#if 0
- if(G.qual==LR_ALTKEY) {
- if(oldcamera && is_an_active_object(oldcamera)) {
+ if (G.qual==LR_ALTKEY) {
+ if (oldcamera && is_an_active_object(oldcamera)) {
v3d->camera= oldcamera;
}
handle_view3d_lock();
@@ -2773,30 +2778,30 @@ static int viewnumpad_exec(bContext *C, wmOperator *op)
#endif
/* first get the default camera for the view lock type */
- if(v3d->scenelock) {
+ if (v3d->scenelock) {
/* sets the camera view if available */
v3d->camera= scene->camera;
}
else {
/* use scene camera if one is not set (even though we're unlocked) */
- if(v3d->camera==NULL) {
+ if (v3d->camera==NULL) {
v3d->camera= scene->camera;
}
}
/* if the camera isnt found, check a number of options */
- if(v3d->camera==NULL && ob && ob->type==OB_CAMERA)
+ if (v3d->camera==NULL && ob && ob->type==OB_CAMERA)
v3d->camera= ob;
- if(v3d->camera==NULL)
+ if (v3d->camera==NULL)
v3d->camera= scene_find_camera(scene);
/* couldnt find any useful camera, bail out */
- if(v3d->camera==NULL)
+ if (v3d->camera==NULL)
return OPERATOR_CANCELLED;
/* important these dont get out of sync for locked scenes */
- if(v3d->scenelock)
+ if (v3d->scenelock)
scene->camera= v3d->camera;
/* finally do snazzy view zooming */
@@ -2818,7 +2823,7 @@ static int viewnumpad_exec(bContext *C, wmOperator *op)
break;
}
- if(rv3d->persp != RV3D_CAMOB) perspo= rv3d->persp;
+ if (rv3d->persp != RV3D_CAMOB) perspo= rv3d->persp;
return OPERATOR_FINISHED;
}
@@ -2863,13 +2868,13 @@ static int vieworbit_exec(bContext *C, wmOperator *op)
orbitdir = RNA_enum_get(op->ptr, "type");
- if(rv3d->viewlock==0) {
- if((rv3d->persp != RV3D_CAMOB) || ED_view3d_camera_lock_check(v3d, rv3d)) {
- if(orbitdir == V3D_VIEW_STEPLEFT || orbitdir == V3D_VIEW_STEPRIGHT) {
+ if (rv3d->viewlock==0) {
+ if ((rv3d->persp != RV3D_CAMOB) || ED_view3d_camera_lock_check(v3d, rv3d)) {
+ if (orbitdir == V3D_VIEW_STEPLEFT || orbitdir == V3D_VIEW_STEPRIGHT) {
float si;
/* z-axis */
phi= (float)(M_PI/360.0)*U.pad_rot_angle;
- if(orbitdir == V3D_VIEW_STEPRIGHT) phi= -phi;
+ if (orbitdir == V3D_VIEW_STEPRIGHT) phi= -phi;
si= (float)sin(phi);
q1[0]= (float)cos(phi);
q1[1]= q1[2]= 0.0;
@@ -2877,13 +2882,13 @@ static int vieworbit_exec(bContext *C, wmOperator *op)
mul_qt_qtqt(new_quat, rv3d->viewquat, q1);
rv3d->view= RV3D_VIEW_USER;
}
- else if(orbitdir == V3D_VIEW_STEPDOWN || orbitdir == V3D_VIEW_STEPUP) {
+ else if (orbitdir == V3D_VIEW_STEPDOWN || orbitdir == V3D_VIEW_STEPUP) {
/* horizontal axis */
copy_v3_v3(q1+1, rv3d->viewinv[0]);
normalize_v3(q1+1);
phi= (float)(M_PI/360.0)*U.pad_rot_angle;
- if(orbitdir == V3D_VIEW_STEPDOWN) phi= -phi;
+ if (orbitdir == V3D_VIEW_STEPDOWN) phi= -phi;
q1[0]= (float)cos(phi);
mul_v3_fl(q1+1, sin(phi));
mul_qt_qtqt(new_quat, rv3d->viewquat, q1);
@@ -2931,13 +2936,13 @@ static int viewpan_exec(bContext *C, wmOperator *op)
pandir = RNA_enum_get(op->ptr, "type");
initgrabz(rv3d, 0.0, 0.0, 0.0);
- if(pandir == V3D_VIEW_PANRIGHT) { mval_f[0]= -32.0f; ED_view3d_win_to_delta(ar, mval_f, vec); }
- else if(pandir == V3D_VIEW_PANLEFT) { mval_f[0]= 32.0f; ED_view3d_win_to_delta(ar, mval_f, vec); }
- else if(pandir == V3D_VIEW_PANUP) { mval_f[1]= -25.0f; ED_view3d_win_to_delta(ar, mval_f, vec); }
- else if(pandir == V3D_VIEW_PANDOWN) { mval_f[1]= 25.0f; ED_view3d_win_to_delta(ar, mval_f, vec); }
+ if (pandir == V3D_VIEW_PANRIGHT) { mval_f[0]= -32.0f; ED_view3d_win_to_delta(ar, mval_f, vec); }
+ else if (pandir == V3D_VIEW_PANLEFT) { mval_f[0]= 32.0f; ED_view3d_win_to_delta(ar, mval_f, vec); }
+ else if (pandir == V3D_VIEW_PANUP) { mval_f[1]= -25.0f; ED_view3d_win_to_delta(ar, mval_f, vec); }
+ else if (pandir == V3D_VIEW_PANDOWN) { mval_f[1]= 25.0f; ED_view3d_win_to_delta(ar, mval_f, vec); }
add_v3_v3(rv3d->ofs, vec);
- if(rv3d->viewlock & RV3D_BOXVIEW)
+ if (rv3d->viewlock & RV3D_BOXVIEW)
view3d_boxview_sync(CTX_wm_area(C), ar);
ED_region_tag_redraw(ar);
@@ -2971,8 +2976,8 @@ static int viewpersportho_exec(bContext *C, wmOperator *UNUSED(op))
ED_view3d_context_user_region(C, &v3d_dummy, &ar);
rv3d = ar->regiondata;
- if(rv3d->viewlock==0) {
- if(rv3d->persp!=RV3D_ORTHO)
+ if (rv3d->viewlock==0) {
+ if (rv3d->persp!=RV3D_ORTHO)
rv3d->persp=RV3D_ORTHO;
else rv3d->persp=RV3D_PERSP;
ED_region_tag_redraw(ar);
@@ -3022,13 +3027,13 @@ static int background_image_add_invoke(bContext *C, wmOperator *op, wmEvent *UNU
char name[MAX_ID_NAME-2];
/* 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);
ima= BKE_add_image_file(path);
}
- else if(RNA_struct_property_is_set(op->ptr, "name")) {
+ else if (RNA_struct_property_is_set(op->ptr, "name")) {
RNA_string_get(op->ptr, "name", name);
ima= (Image *)find_id("IM", name);
}
@@ -3038,7 +3043,7 @@ static int background_image_add_invoke(bContext *C, wmOperator *op, wmEvent *UNU
if (ima) {
bgpic->ima = ima;
- if(ima->id.us==0) id_us_plus(&ima->id);
+ if (ima->id.us==0) id_us_plus(&ima->id);
else id_lib_extern(&ima->id);
if (!(v3d->flag & V3D_DISPBGPICS))
@@ -3078,7 +3083,7 @@ static int background_image_remove_exec(bContext *C, wmOperator *op)
int index = RNA_int_get(op->ptr, "index");
BGpic *bgpic_rem= BLI_findlink(&v3d->bgpicbase, index);
- if(bgpic_rem) {
+ if (bgpic_rem) {
ED_view3D_background_image_remove(v3d, bgpic_rem);
WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, v3d);
return OPERATOR_FINISHED;
@@ -3112,7 +3117,7 @@ static void calc_clipping_plane(float clip[6][4], BoundBox *clipbb)
{
int val;
- for(val=0; val<4; val++) {
+ for (val=0; val<4; val++) {
normal_tri_v3( clip[val],clipbb->vec[val], clipbb->vec[val==3?0:val+1], clipbb->vec[val+4]);
@@ -3131,7 +3136,7 @@ static void calc_local_clipping(float clip_local[][4], BoundBox *clipbb, float m
invert_m4_m4(imat, mat);
- for(i=0; i<8; i++) {
+ for (i=0; i<8; i++) {
mul_v3_m4v3(clipbb_local.vec[i], imat, clipbb->vec[i]);
}
@@ -3140,7 +3145,7 @@ static void calc_local_clipping(float clip_local[][4], BoundBox *clipbb, float m
void ED_view3d_local_clipping(RegionView3D *rv3d, float mat[][4])
{
- if(rv3d->rflag & RV3D_CLIPPING)
+ if (rv3d->rflag & RV3D_CLIPPING)
calc_local_clipping(rv3d->clip_local, rv3d->clipbb, mat);
}
@@ -3174,10 +3179,10 @@ static int view3d_clipping_invoke(bContext *C, wmOperator *op, wmEvent *event)
RegionView3D *rv3d= CTX_wm_region_view3d(C);
ARegion *ar= CTX_wm_region(C);
- if(rv3d->rflag & RV3D_CLIPPING) {
+ if (rv3d->rflag & RV3D_CLIPPING) {
rv3d->rflag &= ~RV3D_CLIPPING;
ED_region_tag_redraw(ar);
- if(rv3d->clipbb) MEM_freeN(rv3d->clipbb);
+ if (rv3d->clipbb) MEM_freeN(rv3d->clipbb);
rv3d->clipbb= NULL;
return OPERATOR_FINISHED;
}
@@ -3228,14 +3233,14 @@ static int set_3dcursor_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *eve
int flip;
fp= give_cursor(scene, v3d);
-// if(obedit && ctrl) lr_click= 1;
+// if (obedit && ctrl) lr_click= 1;
copy_v3_v3(oldcurs, fp);
project_int_noclip(ar, fp, mval);
flip= initgrabz(rv3d, fp[0], fp[1], fp[2]);
/* reset the depth based on the view offset */
- if(flip) {
+ if (flip) {
negate_v3_v3(fp, rv3d->ofs);
/* re initialize */
@@ -3244,7 +3249,7 @@ static int set_3dcursor_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *eve
(void)flip;
}
- if(mval[0]!=IS_CLIPPED) {
+ if (mval[0]!=IS_CLIPPED) {
short depth_used = 0;
if (U.uiflag & USER_ORBIT_ZBUF) { /* maybe this should be accessed some other way */
@@ -3253,7 +3258,7 @@ static int set_3dcursor_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *eve
depth_used= 1;
}
- if(depth_used==0) {
+ if (depth_used==0) {
float mval_f[2];
VECSUB2D(mval_f, mval, event->mval);
ED_view3d_win_to_delta(ar, mval_f, dvec);
@@ -3273,7 +3278,7 @@ static int set_3dcursor_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *eve
fp[2]= (rv3d->persinv[0][2]*dx + rv3d->persinv[1][2]*dy+ rv3d->persinv[2][2]*fz)-rv3d->ofs[2];
}
- if(v3d && v3d->localvd)
+ if (v3d && v3d->localvd)
WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, v3d);
else
WM_event_add_notifier(C, NC_SCENE|NA_EDITED, scene);
@@ -3308,16 +3313,16 @@ static int manipulator_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
View3D *v3d = CTX_wm_view3d(C);
- if(!(v3d->twflag & V3D_USE_MANIPULATOR)) return OPERATOR_PASS_THROUGH;
- if(!(v3d->twflag & V3D_DRAW_MANIPULATOR)) return OPERATOR_PASS_THROUGH;
+ if (!(v3d->twflag & V3D_USE_MANIPULATOR)) return OPERATOR_PASS_THROUGH;
+ if (!(v3d->twflag & V3D_DRAW_MANIPULATOR)) return OPERATOR_PASS_THROUGH;
/* only no modifier or shift */
- if(event->keymodifier != 0 && event->keymodifier != KM_SHIFT) return OPERATOR_PASS_THROUGH;
+ if (event->keymodifier != 0 && event->keymodifier != KM_SHIFT) return OPERATOR_PASS_THROUGH;
/* note; otherwise opengl won't work */
view3d_operator_needs_opengl(C);
- if(0==BIF_do_manipulator(C, event, op))
+ if (0==BIF_do_manipulator(C, event, op))
return OPERATOR_PASS_THROUGH;
return OPERATOR_FINISHED;
@@ -3384,7 +3389,7 @@ static float view_autodist_depth_margin(ARegion *ar, const int mval[2], int marg
rcti rect;
float depth_close;
- if(margin==0) {
+ if (margin==0) {
/* Get Z Depths, needed for perspective, nice for ortho */
rect.xmin= mval[0];
rect.ymin= mval[1];
@@ -3401,7 +3406,7 @@ static float view_autodist_depth_margin(ARegion *ar, const int mval[2], int marg
view3d_update_depths_rect(ar, &depth_temp, &rect);
depth_close= view3d_depth_near(&depth_temp);
- if(depth_temp.depths) MEM_freeN(depth_temp.depths);
+ if (depth_temp.depths) MEM_freeN(depth_temp.depths);
return depth_close;
}
@@ -3460,7 +3465,7 @@ int ED_view3d_autodist_simple(ARegion *ar, const int mval[2], float mouse_worldl
double cent[2], p[3];
/* Get Z Depths, needed for perspective, nice for ortho */
- if(force_depth)
+ if (force_depth)
depth= *force_depth;
else
depth= view_autodist_depth_margin(ar, mval, margin);
@@ -3503,7 +3508,7 @@ static int depth_segment_cb(int x, int y, void *userData)
depth= view_autodist_depth_margin(data->ar, mval, data->margin);
- if(depth != FLT_MAX) {
+ if (depth != FLT_MAX) {
data->depth= depth;
return 0;
}
@@ -3583,7 +3588,7 @@ void ED_view3d_from_object(Object *ob, float ofs[3], float quat[4], float *dist,
{
ED_view3d_from_m4(ob->obmat, ofs, quat, dist);
- if(lens) {
+ if (lens) {
CameraParams params;
camera_params_init(&params);
@@ -3620,10 +3625,10 @@ void ED_view3D_background_image_remove(View3D *v3d, BGpic *bgpic)
{
BLI_remlink(&v3d->bgpicbase, bgpic);
- if(bgpic->ima)
+ if (bgpic->ima)
id_us_min(&bgpic->ima->id);
- if(bgpic->clip)
+ if (bgpic->clip)
id_us_min(&bgpic->clip->id);
MEM_freeN(bgpic);
@@ -3633,7 +3638,7 @@ void ED_view3D_background_image_clear(View3D *v3d)
{
BGpic *bgpic= v3d->bgpicbase.first;
- while(bgpic) {
+ while (bgpic) {
BGpic *next_bgpic= bgpic->next;
ED_view3D_background_image_remove(v3d, bgpic);
diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c
index 801f2d5c8eb..2993dbeee22 100644
--- a/source/blender/editors/space_view3d/view3d_fly.c
+++ b/source/blender/editors/space_view3d/view3d_fly.c
@@ -339,7 +339,7 @@ static int initFlyInfo (bContext *C, FlyInfo *fly, wmOperator *op, wmEvent *even
/* check for flying ortho camera - which we cant support well
* we _could_ also check for an ortho camera but this is easier */
- if( (fly->rv3d->persp == RV3D_CAMOB) &&
+ if ( (fly->rv3d->persp == RV3D_CAMOB) &&
(fly->v3d->camera != NULL) &&
(fly->rv3d->is_persp == FALSE))
{
@@ -350,7 +350,7 @@ static int initFlyInfo (bContext *C, FlyInfo *fly, wmOperator *op, wmEvent *even
if (fly->rv3d->persp==RV3D_CAMOB) {
Object *ob_back;
if ((U.uiflag & USER_CAM_LOCK_NO_PARENT)==0 && (fly->root_parent=fly->v3d->camera->parent)) {
- while(fly->root_parent->parent)
+ while (fly->root_parent->parent)
fly->root_parent= fly->root_parent->parent;
ob_back= fly->root_parent;
}
@@ -450,7 +450,7 @@ static int flyEnd(bContext *C, FlyInfo *fly)
/*Done with correcting for the dist */
}
- if(fly->is_ortho_cam) {
+ if (fly->is_ortho_cam) {
((Camera *)fly->v3d->camera->data)->type= CAM_ORTHO;
}
@@ -674,7 +674,7 @@ static void move_camera(bContext* C, RegionView3D* rv3d, FlyInfo* fly, int orien
// where_is_object(scene, fly->root_parent);
ob_update= v3d->camera->parent;
- while(ob_update) {
+ while (ob_update) {
DAG_id_tag_update(&ob_update->id, OB_RECALC_OB);
ob_update= ob_update->parent;
}
@@ -945,7 +945,7 @@ static int flyApply(bContext *C, FlyInfo *fly)
}
else {
normalize_v3_v3(dvec_tmp, fly->dvec_prev);
- if(fly->speed < 0.0f) {
+ if (fly->speed < 0.0f) {
negate_v3(dvec_tmp);
}
}
diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c
index 9bbf4744b8c..29ef1f1b617 100644
--- a/source/blender/editors/space_view3d/view3d_header.c
+++ b/source/blender/editors/space_view3d/view3d_header.c
@@ -124,7 +124,7 @@ static void handle_view3d_lock(bContext *C)
View3D *v3d= CTX_wm_view3d(C);
if (v3d != NULL && sa != NULL) {
- if(v3d->localvd==NULL && v3d->scenelock && sa->spacetype==SPACE_VIEW3D) {
+ if (v3d->localvd==NULL && v3d->scenelock && sa->spacetype==SPACE_VIEW3D) {
/* copy to scene */
scene->lay= v3d->lay;
scene->layact= v3d->layact;
@@ -149,10 +149,10 @@ static void view3d_layers_editmode_ensure(Scene *scene, View3D *v3d)
{
/* sanity check - when in editmode disallow switching the editmode layer off since its confusing
* an alternative would be to always draw the editmode object. */
- if(scene->obedit && (scene->obedit->lay & v3d->lay)==0) {
+ if (scene->obedit && (scene->obedit->lay & v3d->lay)==0) {
int bit;
- for(bit=0; bit<32; bit++) {
- if(scene->obedit->lay & (1<<bit)) {
+ for (bit=0; bit<32; bit++) {
+ if (scene->obedit->lay & (1<<bit)) {
v3d->lay |= 1<<bit;
break;
}
@@ -168,12 +168,12 @@ static int view3d_layers_exec(bContext *C, wmOperator *op)
int nr= RNA_int_get(op->ptr, "nr");
int toggle= RNA_boolean_get(op->ptr, "toggle");
- if(nr < 0)
+ if (nr < 0)
return OPERATOR_CANCELLED;
- if(nr == 0) {
+ if (nr == 0) {
/* all layers */
- if(!v3d->layact)
+ if (!v3d->layact)
v3d->layact= 1;
if (toggle && v3d->lay == ((1<<20)-1)) {
@@ -190,23 +190,24 @@ static int view3d_layers_exec(bContext *C, wmOperator *op)
int bit;
nr--;
- if(RNA_boolean_get(op->ptr, "extend")) {
- if(toggle && v3d->lay & (1<<nr) && (v3d->lay & ~(1<<nr)))
+ if (RNA_boolean_get(op->ptr, "extend")) {
+ if (toggle && v3d->lay & (1<<nr) && (v3d->lay & ~(1<<nr)))
v3d->lay &= ~(1<<nr);
else
v3d->lay |= (1<<nr);
- } else {
+ }
+ else {
v3d->lay = (1<<nr);
}
view3d_layers_editmode_ensure(scene, v3d);
/* set active layer, ensure to always have one */
- if(v3d->lay & (1<<nr))
+ if (v3d->lay & (1<<nr))
v3d->layact= 1<<nr;
- else if((v3d->lay & v3d->layact)==0) {
- for(bit=0; bit<32; bit++) {
- if(v3d->lay & (1<<bit)) {
+ else if ((v3d->lay & v3d->layact)==0) {
+ for (bit=0; bit<32; bit++) {
+ if (v3d->lay & (1<<bit)) {
v3d->layact= 1<<bit;
break;
}
@@ -214,7 +215,7 @@ static int view3d_layers_exec(bContext *C, wmOperator *op)
}
}
- if(v3d->scenelock) handle_view3d_lock(C);
+ if (v3d->scenelock) handle_view3d_lock(C);
DAG_on_visible_update(CTX_data_main(C), FALSE);
@@ -227,15 +228,15 @@ static int view3d_layers_exec(bContext *C, wmOperator *op)
/* the local per-keymap-entry keymap will solve it */
static int view3d_layers_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
- if(event->ctrl || event->oskey)
+ if (event->ctrl || event->oskey)
return OPERATOR_PASS_THROUGH;
- if(event->shift)
+ if (event->shift)
RNA_boolean_set(op->ptr, "extend", TRUE);
else
RNA_boolean_set(op->ptr, "extend", FALSE);
- if(event->alt) {
+ if (event->alt) {
int nr= RNA_int_get(op->ptr, "nr") + 10;
RNA_int_set(op->ptr, "nr", nr);
}
@@ -287,10 +288,10 @@ static char *view3d_modeselect_pup(Scene *scene)
str += modeselect_addmode(str, N_("Object Mode"), OB_MODE_OBJECT, ICON_OBJECT_DATA);
- if(ob==NULL || ob->data==NULL) return string;
- if(ob->id.lib) return string;
+ if (ob==NULL || ob->data==NULL) return string;
+ if (ob->id.lib) return string;
- if(!((ID *)ob->data)->lib) {
+ if (!((ID *)ob->data)->lib) {
/* if active object is editable */
if ( ((ob->type == OB_MESH)
|| (ob->type == OB_CURVE) || (ob->type == OB_SURF) || (ob->type == OB_FONT)
@@ -341,7 +342,7 @@ static void do_view3d_header_buttons(bContext *C, void *UNUSED(arg), int event)
int ctrl= win->eventstate->ctrl, shift= win->eventstate->shift;
PointerRNA props_ptr;
- if(obedit && obedit->type==OB_MESH) {
+ if (obedit && obedit->type==OB_MESH) {
em= ((Mesh *)obedit->data)->edit_btmesh;
}
/* watch it: if sa->win does not exist, check that when calling direct drawing routines */
@@ -359,8 +360,8 @@ static void do_view3d_header_buttons(bContext *C, void *UNUSED(arg), int event)
break;
case B_SEL_VERT:
- if(em) {
- if(shift==0 || em->selectmode==0)
+ if (em) {
+ if (shift==0 || em->selectmode==0)
em->selectmode= SCE_SELECT_VERTEX;
ts->selectmode= em->selectmode;
EDBM_selectmode_set(em);
@@ -369,10 +370,10 @@ static void do_view3d_header_buttons(bContext *C, void *UNUSED(arg), int event)
}
break;
case B_SEL_EDGE:
- if(em) {
- if(shift==0 || em->selectmode==0){
- if( (em->selectmode ^ SCE_SELECT_EDGE) == SCE_SELECT_VERTEX){
- if(ctrl) EDBM_convertsel(em, SCE_SELECT_VERTEX,SCE_SELECT_EDGE);
+ if (em) {
+ if (shift==0 || em->selectmode==0) {
+ if ( (em->selectmode ^ SCE_SELECT_EDGE) == SCE_SELECT_VERTEX) {
+ if (ctrl) EDBM_convertsel(em, SCE_SELECT_VERTEX,SCE_SELECT_EDGE);
}
em->selectmode = SCE_SELECT_EDGE;
}
@@ -383,10 +384,10 @@ static void do_view3d_header_buttons(bContext *C, void *UNUSED(arg), int event)
}
break;
case B_SEL_FACE:
- if(em) {
- if( shift==0 || em->selectmode==0){
- if( ((ts->selectmode ^ SCE_SELECT_FACE) == SCE_SELECT_VERTEX) || ((ts->selectmode ^ SCE_SELECT_FACE) == SCE_SELECT_EDGE)){
- if(ctrl) EDBM_convertsel(em, (ts->selectmode ^ SCE_SELECT_FACE),SCE_SELECT_FACE);
+ if (em) {
+ if ( shift==0 || em->selectmode==0) {
+ if ( ((ts->selectmode ^ SCE_SELECT_FACE) == SCE_SELECT_VERTEX) || ((ts->selectmode ^ SCE_SELECT_FACE) == SCE_SELECT_EDGE)) {
+ if (ctrl) EDBM_convertsel(em, (ts->selectmode ^ SCE_SELECT_FACE),SCE_SELECT_FACE);
}
em->selectmode = SCE_SELECT_FACE;
}
@@ -398,19 +399,19 @@ static void do_view3d_header_buttons(bContext *C, void *UNUSED(arg), int event)
break;
case B_MAN_TRANS:
- if( shift==0 || v3d->twtype==0) {
+ if ( shift==0 || v3d->twtype==0) {
v3d->twtype= V3D_MANIP_TRANSLATE;
}
ED_area_tag_redraw(sa);
break;
case B_MAN_ROT:
- if( shift==0 || v3d->twtype==0) {
+ if ( shift==0 || v3d->twtype==0) {
v3d->twtype= V3D_MANIP_ROTATE;
}
ED_area_tag_redraw(sa);
break;
case B_MAN_SCALE:
- if( shift==0 || v3d->twtype==0) {
+ if ( shift==0 || v3d->twtype==0) {
v3d->twtype= V3D_MANIP_SCALE;
}
ED_area_tag_redraw(sa);
@@ -431,8 +432,8 @@ static int object_mode_icon(int mode)
{
EnumPropertyItem *item = object_mode_items;
- while(item->name != NULL) {
- if(item->value == mode)
+ while (item->name != NULL) {
+ if (item->value == mode)
return item->icon;
++item;
}
@@ -447,7 +448,7 @@ void uiTemplateEditModeSelection(uiLayout *layout, struct bContext *C)
uiBlockSetHandleFunc(block, do_view3d_header_buttons, NULL);
- if(obedit && (obedit->type == OB_MESH)) {
+ if (obedit && (obedit->type == OB_MESH)) {
BMEditMesh *em= ((Mesh *)obedit->data)->edit_btmesh;
uiLayout *row;
@@ -486,7 +487,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
uiBlockSetEmboss(block, UI_EMBOSS);
/* mode */
- if(ob) {
+ if (ob) {
v3d->modeselect = ob->mode;
is_paint = ELEM4(ob->mode, OB_MODE_SCULPT, OB_MODE_VERTEX_PAINT, OB_MODE_WEIGHT_PAINT,OB_MODE_TEXTURE_PAINT);
}
@@ -508,7 +509,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
PointerRNA meshptr;
RNA_pointer_create(&ob->id, &RNA_Mesh, ob->data, &meshptr);
- if(ob->mode & (OB_MODE_TEXTURE_PAINT|OB_MODE_VERTEX_PAINT)) {
+ if (ob->mode & (OB_MODE_TEXTURE_PAINT|OB_MODE_VERTEX_PAINT)) {
uiItemR(layout, &meshptr, "use_paint_mask", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
}
else {
@@ -517,7 +518,8 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
uiItemR(row, &meshptr, "use_paint_mask_vertex", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
}
}
- } else {
+ }
+ else {
const char *str_menu;
row= uiLayoutRow(layout, 1);
@@ -534,7 +536,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
uiItemR(row, &v3dptr, "show_manipulator", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
block= uiLayoutGetBlock(row);
- if(v3d->twflag & V3D_USE_MANIPULATOR) {
+ if (v3d->twflag & V3D_USE_MANIPULATOR) {
but= uiDefIconButBitC(block, TOG, V3D_MANIP_TRANSLATE, B_MAN_TRANS, ICON_MAN_TRANS, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, TIP_("Translate manipulator mode"));
uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */
but= uiDefIconButBitC(block, TOG, V3D_MANIP_ROTATE, B_MAN_ROT, ICON_MAN_ROT, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, TIP_("Rotate manipulator mode"));
@@ -553,7 +555,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
MEM_freeN((void *)str_menu);
}
- if(obedit==NULL && v3d->localvd==NULL) {
+ if (obedit==NULL && v3d->localvd==NULL) {
unsigned int ob_lay = ob ? ob->lay : 0;
/* Layers */
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c
index 079db789a3c..a4a0d332c51 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -114,7 +114,7 @@ int view3d_get_view_aligned_coordinate(ViewContext *vc, float fp[3], const int m
initgrabz(vc->rv3d, fp[0], fp[1], fp[2]);
- if(mval_cpy[0]!=IS_CLIPPED) {
+ if (mval_cpy[0]!=IS_CLIPPED) {
float mval_f[2];
VECSUB2D(mval_f, mval_cpy, mval);
ED_view3d_win_to_delta(vc->ar, mval_f, dvec);
@@ -124,7 +124,7 @@ int view3d_get_view_aligned_coordinate(ViewContext *vc, float fp[3], const int m
}
else {
/* fallback to the view center */
- if(do_fallback) {
+ if (do_fallback) {
negate_v3_v3(fp, vc->rv3d->ofs);
return view3d_get_view_aligned_coordinate(vc, fp, mval, FALSE);
}
@@ -144,12 +144,13 @@ void view3d_get_transformation(const ARegion *ar, RegionView3D *rv3d, Object *ob
if (ob) {
mult_m4_m4m4(cpy, rv3d->viewmat, ob->obmat);
- } else {
+ }
+ else {
copy_m4_m4(cpy, rv3d->viewmat);
}
- for(i = 0; i < 4; ++i) {
- for(j = 0; j < 4; ++j) {
+ for (i = 0; i < 4; ++i) {
+ for (j = 0; j < 4; ++j) {
mats->projection[i*4+j] = rv3d->winmat[i][j];
mats->modelview[i*4+j] = cpy[i][j];
}
@@ -173,8 +174,8 @@ static void EDBM_backbuf_checkAndSelectVerts(BMEditMesh *em, int select)
eve = BM_iter_new(&iter, em->bm, BM_VERTS_OF_MESH, NULL);
for ( ; eve; eve=BM_iter_step(&iter), index++) {
- if(!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) {
- if(EDBM_check_backbuf(index)) {
+ if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) {
+ if (EDBM_check_backbuf(index)) {
BM_vert_select_set(em->bm, eve, select);
}
}
@@ -189,8 +190,8 @@ static void EDBM_backbuf_checkAndSelectEdges(BMEditMesh *em, int select)
eed = BM_iter_new(&iter, em->bm, BM_EDGES_OF_MESH, NULL);
for ( ; eed; eed=BM_iter_step(&iter), index++) {
- if(!BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) {
- if(EDBM_check_backbuf(index)) {
+ if (!BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) {
+ if (EDBM_check_backbuf(index)) {
BM_edge_select_set(em->bm, eed, select);
}
}
@@ -205,8 +206,8 @@ static void EDBM_backbuf_checkAndSelectFaces(BMEditMesh *em, int select)
efa = BM_iter_new(&iter, em->bm, BM_FACES_OF_MESH, NULL);
for ( ; efa; efa=BM_iter_step(&iter), index++) {
- if(!BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) {
- if(EDBM_check_backbuf(index)) {
+ if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) {
+ if (EDBM_check_backbuf(index)) {
BM_face_select_set(em->bm, efa, select);
}
}
@@ -221,9 +222,9 @@ static void EDBM_backbuf_checkAndSelectVerts_obmode(Mesh *me, int select)
int a;
if (mv) {
- for(a=1; a<=me->totvert; a++, mv++) {
- if(EDBM_check_backbuf(a)) {
- if(!(mv->flag & ME_HIDE)) {
+ for (a=1; a<=me->totvert; a++, mv++) {
+ if (EDBM_check_backbuf(a)) {
+ if (!(mv->flag & ME_HIDE)) {
mv->flag = select?(mv->flag|SELECT):(mv->flag&~SELECT);
}
}
@@ -238,8 +239,8 @@ static void EDBM_backbuf_checkAndSelectTFaces(Mesh *me, int select)
int a;
if (mpoly) {
- for(a=1; a<=me->totpoly; a++, mpoly++) {
- if(EDBM_check_backbuf(a)) {
+ for (a=1; a<=me->totpoly; a++, mpoly++) {
+ if (EDBM_check_backbuf(a)) {
mpoly->flag = select?(mpoly->flag|ME_FACE_SEL):(mpoly->flag&~ME_FACE_SEL);
}
}
@@ -261,9 +262,9 @@ static int view3d_selectable_data(bContext *C)
if (!ED_operator_region_view3d_active(C))
return 0;
- if(ob) {
+ if (ob) {
if (ob->mode & OB_MODE_EDIT) {
- if(ob->type == OB_FONT) {
+ if (ob->type == OB_FONT) {
return 0;
}
}
@@ -294,13 +295,13 @@ static int edge_inside_rect(rcti *rect, short x1, short y1, short x2, short y2)
int d1, d2, d3, d4;
/* check points in rect */
- if(edge_fully_inside_rect(rect, x1, y1, x2, y2)) return 1;
+ if (edge_fully_inside_rect(rect, x1, y1, x2, y2)) return 1;
/* check points completely out rect */
- if(x1<rect->xmin && x2<rect->xmin) return 0;
- if(x1>rect->xmax && x2>rect->xmax) return 0;
- if(y1<rect->ymin && y2<rect->ymin) return 0;
- if(y1>rect->ymax && y2>rect->ymax) return 0;
+ if (x1<rect->xmin && x2<rect->xmin) return 0;
+ if (x1>rect->xmax && x2>rect->xmax) return 0;
+ if (y1<rect->ymin && y2<rect->ymin) return 0;
+ if (y1>rect->ymax && y2>rect->ymax) return 0;
/* simple check lines intersecting. */
d1= (y1-y2)*(x1- rect->xmin ) + (x2-x1)*(y1- rect->ymin );
@@ -308,8 +309,8 @@ static int edge_inside_rect(rcti *rect, short x1, short y1, short x2, short y2)
d3= (y1-y2)*(x1- rect->xmax ) + (x2-x1)*(y1- rect->ymax );
d4= (y1-y2)*(x1- rect->xmax ) + (x2-x1)*(y1- rect->ymin );
- if(d1<0 && d2<0 && d3<0 && d4<0) return 0;
- if(d1>0 && d2>0 && d3>0 && d4>0) return 0;
+ if (d1<0 && d2<0 && d3<0 && d4<0) return 0;
+ if (d1>0 && d2>0 && d3>0 && d4>0) return 0;
return 1;
}
@@ -325,7 +326,7 @@ int lasso_inside(int mcords[][2], short moves, int sx, int sy)
int a;
int *p1, *p2;
- if(sx==IS_CLIPPED)
+ if (sx==IS_CLIPPED)
return 0;
p1= mcords[moves-1];
@@ -338,7 +339,7 @@ int lasso_inside(int mcords[][2], short moves, int sx, int sy)
fp1[0]/= len;
fp1[1]/= len;
- for(a=0; a<moves; a++) {
+ for (a=0; a<moves; a++) {
/* second vector */
fp2[0]= (float)(p2[0]-sx);
fp2[1]= (float)(p2[1]-sy);
@@ -352,7 +353,7 @@ int lasso_inside(int mcords[][2], short moves, int sx, int sy)
cross= (float)((p1[1]-p2[1])*(p1[0]-sx) + (p2[0]-p1[0])*(p1[1]-sy));
- if(cross<0.0f) angletot-= ang;
+ if (cross<0.0f) angletot-= ang;
else angletot+= ang;
/* circulate */
@@ -361,7 +362,7 @@ int lasso_inside(int mcords[][2], short moves, int sx, int sy)
p2= mcords[a+1];
}
- if( fabs(angletot) > 4.0 ) return 1;
+ if ( fabs(angletot) > 4.0 ) return 1;
return 0;
}
@@ -371,21 +372,21 @@ int lasso_inside_edge(int mcords[][2], short moves, int x0, int y0, int x1, int
int v1[2], v2[2];
int a;
- if(x0==IS_CLIPPED || x1==IS_CLIPPED)
+ if (x0==IS_CLIPPED || x1==IS_CLIPPED)
return 0;
v1[0] = x0, v1[1] = y0;
v2[0] = x1, v2[1] = y1;
/* check points in lasso */
- if(lasso_inside(mcords, moves, v1[0], v1[1])) return 1;
- if(lasso_inside(mcords, moves, v2[0], v2[1])) return 1;
+ if (lasso_inside(mcords, moves, v1[0], v1[1])) return 1;
+ if (lasso_inside(mcords, moves, v2[0], v2[1])) return 1;
/* no points in lasso, so we have to intersect with lasso edge */
- if( isect_line_line_v2_int(mcords[0], mcords[moves-1], v1, v2) > 0) return 1;
- for(a=0; a<moves-1; a++) {
- if( isect_line_line_v2_int(mcords[a], mcords[a+1], v1, v2) > 0) return 1;
+ if ( isect_line_line_v2_int(mcords[0], mcords[moves-1], v1, v2) > 0) return 1;
+ for (a=0; a<moves-1; a++) {
+ if ( isect_line_line_v2_int(mcords[a], mcords[a+1], v1, v2) > 0) return 1;
}
return 0;
@@ -402,17 +403,17 @@ static void do_lasso_select_pose(ViewContext *vc, Object *ob, int mcords[][2], s
int sco1[2], sco2[2];
bArmature *arm= ob->data;
- if(ob->type!=OB_ARMATURE || ob->pose==NULL) return;
+ if (ob->type!=OB_ARMATURE || ob->pose==NULL) return;
- for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
+ for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
if (PBONE_VISIBLE(arm, pchan->bone) && (pchan->bone->flag & BONE_UNSELECTABLE)==0) {
mul_v3_m4v3(vec, ob->obmat, pchan->pose_head);
project_int(vc->ar, vec, sco1);
mul_v3_m4v3(vec, ob->obmat, pchan->pose_tail);
project_int(vc->ar, vec, sco2);
- if(lasso_inside_edge(mcords, moves, sco1[0], sco1[1], sco2[0], sco2[1])) {
- if(select) pchan->bone->flag |= BONE_SELECTED;
+ if (lasso_inside_edge(mcords, moves, sco1[0], sco1[1], sco2[0], sco2[1])) {
+ if (select) pchan->bone->flag |= BONE_SELECTED;
else pchan->bone->flag &= ~BONE_SELECTED;
}
}
@@ -423,8 +424,8 @@ static void object_deselect_all_visible(Scene *scene, View3D *v3d)
{
Base *base;
- for(base= scene->base.first; base; base= base->next) {
- if(BASE_SELECTABLE(v3d, base)) {
+ for (base= scene->base.first; base; base= base->next) {
+ if (BASE_SELECTABLE(v3d, base)) {
ED_base_object_select(base, BA_DESELECT);
}
}
@@ -437,16 +438,16 @@ static void do_lasso_select_objects(ViewContext *vc, int mcords[][2], short move
if (extend == 0 && select)
object_deselect_all_visible(vc->scene, vc->v3d);
- for(base= vc->scene->base.first; base; base= base->next) {
- if(BASE_SELECTABLE(vc->v3d, base)) { /* use this to avoid un-needed lasso lookups */
+ for (base= vc->scene->base.first; base; base= base->next) {
+ if (BASE_SELECTABLE(vc->v3d, base)) { /* use this to avoid un-needed lasso lookups */
project_short(vc->ar, base->object->obmat[3], &base->sx);
- if(lasso_inside(mcords, moves, base->sx, base->sy)) {
+ if (lasso_inside(mcords, moves, base->sx, base->sy)) {
- if(select) ED_base_object_select(base, BA_SELECT);
+ if (select) ED_base_object_select(base, BA_SELECT);
else ED_base_object_select(base, BA_DESELECT);
base->object->flag= base->flag;
}
- if(base->object->mode & OB_MODE_POSE) {
+ if (base->object->mode & OB_MODE_POSE) {
do_lasso_select_pose(vc, base->object, mcords, moves, select);
}
}
@@ -460,11 +461,11 @@ static void lasso_select_boundbox(rcti *rect, int mcords[][2], short moves)
rect->xmin= rect->xmax= mcords[0][0];
rect->ymin= rect->ymax= mcords[0][1];
- for(a=1; a<moves; a++) {
- if(mcords[a][0]<rect->xmin) rect->xmin= mcords[a][0];
- else if(mcords[a][0]>rect->xmax) rect->xmax= mcords[a][0];
- if(mcords[a][1]<rect->ymin) rect->ymin= mcords[a][1];
- else if(mcords[a][1]>rect->ymax) rect->ymax= mcords[a][1];
+ for (a=1; a<moves; a++) {
+ if (mcords[a][0]<rect->xmin) rect->xmin= mcords[a][0];
+ else if (mcords[a][0]>rect->xmax) rect->xmax= mcords[a][0];
+ if (mcords[a][1]<rect->ymin) rect->ymin= mcords[a][1];
+ else if (mcords[a][1]>rect->ymax) rect->ymax= mcords[a][1];
}
}
@@ -488,7 +489,8 @@ static void do_lasso_select_mesh__doSelectEdge(void *userData, BMEdge *eed, int
BM_elem_select_set(data->vc->em->bm, eed, data->select);
data->done = 1;
}
- } else {
+ }
+ else {
if (lasso_inside_edge(data->mcords, data->moves, x0, y0, x1, y1)) {
BM_elem_select_set(data->vc->em->bm, eed, data->select);
}
@@ -533,7 +535,7 @@ static void do_lasso_select_mesh(ViewContext *vc, int mcords[][2], short moves,
glLoadMatrixf(vc->rv3d->viewmat);
bbsel= EDBM_mask_init_backbuf_border(vc, mcords, moves, rect.xmin, rect.ymin, rect.xmax, rect.ymax);
- if(ts->selectmode & SCE_SELECT_VERTEX) {
+ if (ts->selectmode & SCE_SELECT_VERTEX) {
if (bbsel) {
EDBM_backbuf_checkAndSelectVerts(vc->em, select);
}
@@ -541,7 +543,7 @@ static void do_lasso_select_mesh(ViewContext *vc, int mcords[][2], short moves,
mesh_foreachScreenVert(vc, do_lasso_select_mesh__doSelectVert, &data, V3D_CLIP_TEST_RV3D_CLIPPING);
}
}
- if(ts->selectmode & SCE_SELECT_EDGE) {
+ if (ts->selectmode & SCE_SELECT_EDGE) {
/* Does both bbsel and non-bbsel versions (need screen cos for both) */
data.pass = 0;
mesh_foreachScreenEdge(vc, do_lasso_select_mesh__doSelectEdge, &data, V3D_CLIP_TEST_OFF);
@@ -552,7 +554,7 @@ static void do_lasso_select_mesh(ViewContext *vc, int mcords[][2], short moves,
}
}
- if(ts->selectmode & SCE_SELECT_FACE) {
+ if (ts->selectmode & SCE_SELECT_FACE) {
if (bbsel) {
EDBM_backbuf_checkAndSelectFaces(vc->em, select);
}
@@ -595,18 +597,20 @@ static void do_lasso_select_mesh_uv(int mcords[][2], short moves, short select)
if (ok)
uvface_setsel__internal(select);
- } else { /* Vert Sel*/
+ }
+ else { /* Vert Sel*/
for (efa= em->faces.first; efa; efa= efa->next) {
tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
if (uvedit_face_visible(scene, ima, efa, tf)) {
nverts= efa->v4? 4: 3;
- for(i=0; i<nverts; i++) {
+ for (i=0; i<nverts; i++) {
if ((select) != (simaUVSel_Check(efa, tf, i))) {
uvco_to_areaco_noclip(tf->uv[i], screenUV);
if (BLI_in_rcti(&rect, screenUV[0], screenUV[1]) && lasso_inside(mcords, moves, screenUV[0], screenUV[1])) {
if (select) {
simaUVSel_Set(efa, tf, i);
- } else {
+ }
+ else {
simaUVSel_UnSet(efa, tf, i);
}
}
@@ -632,16 +636,20 @@ static void do_lasso_select_curve__doSelect(void *userData, Nurb *UNUSED(nu), BP
if (bp) {
bp->f1 = data->select?(bp->f1|SELECT):(bp->f1&~SELECT);
if (bp == cu->lastsel && !(bp->f1 & 1)) cu->lastsel = NULL;
- } else {
+ }
+ else {
if (cu->drawflag & CU_HIDE_HANDLES) {
/* can only be beztindex==0 here since handles are hidden */
bezt->f1 = bezt->f2 = bezt->f3 = data->select?(bezt->f2|SELECT):(bezt->f2&~SELECT);
- } else {
+ }
+ else {
if (beztindex==0) {
bezt->f1 = data->select?(bezt->f1|SELECT):(bezt->f1&~SELECT);
- } else if (beztindex==1) {
+ }
+ else if (beztindex==1) {
bezt->f2 = data->select?(bezt->f2|SELECT):(bezt->f2&~SELECT);
- } else {
+ }
+ else {
bezt->f3 = data->select?(bezt->f3|SELECT):(bezt->f3&~SELECT);
}
}
@@ -713,28 +721,28 @@ static void do_lasso_select_armature(ViewContext *vc, int mcords[][2], short mov
project_short(vc->ar, vec, sco2);
didpoint= 0;
- if(lasso_inside(mcords, moves, sco1[0], sco1[1])) {
- if(select) ebone->flag |= BONE_ROOTSEL;
+ if (lasso_inside(mcords, moves, sco1[0], sco1[1])) {
+ if (select) ebone->flag |= BONE_ROOTSEL;
else ebone->flag &= ~BONE_ROOTSEL;
didpoint= 1;
change= TRUE;
}
- if(lasso_inside(mcords, moves, sco2[0], sco2[1])) {
- if(select) ebone->flag |= BONE_TIPSEL;
+ if (lasso_inside(mcords, moves, sco2[0], sco2[1])) {
+ if (select) ebone->flag |= BONE_TIPSEL;
else ebone->flag &= ~BONE_TIPSEL;
didpoint= 1;
change= TRUE;
}
/* if one of points selected, we skip the bone itself */
- if(didpoint==0 && lasso_inside_edge(mcords, moves, sco1[0], sco1[1], sco2[0], sco2[1])) {
- if(select) ebone->flag |= BONE_TIPSEL|BONE_ROOTSEL|BONE_SELECTED;
+ if (didpoint==0 && lasso_inside_edge(mcords, moves, sco1[0], sco1[1], sco2[0], sco2[1])) {
+ if (select) ebone->flag |= BONE_TIPSEL|BONE_ROOTSEL|BONE_SELECTED;
else ebone->flag &= ~(BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL);
change= TRUE;
}
}
}
- if(change) {
+ if (change) {
ED_armature_sync_selection(arm->edbo);
ED_armature_validate_active(arm);
WM_main_add_notifier(NC_OBJECT|ND_BONE_SELECT, vc->obedit);
@@ -752,18 +760,18 @@ static void do_lasso_select_meta(ViewContext *vc, int mcords[][2], short moves,
short sco[2];
if (extend == 0 && select) {
- for(ml= mb->editelems->first; ml; ml= ml->next) {
+ for (ml= mb->editelems->first; ml; ml= ml->next) {
ml->flag &= ~SELECT;
}
}
- for(ml= mb->editelems->first; ml; ml= ml->next) {
+ for (ml= mb->editelems->first; ml; ml= ml->next) {
mul_v3_m4v3(vec, vc->obedit->obmat, &ml->x);
project_short(vc->ar, vec, sco);
- if(lasso_inside(mcords, moves, sco[0], sco[1])) {
- if(select) ml->flag |= SELECT;
+ if (lasso_inside(mcords, moves, sco[0], sco[1])) {
+ if (select) ml->flag |= SELECT;
else ml->flag &= ~SELECT;
}
}
@@ -782,7 +790,7 @@ int do_paintvert_box_select(ViewContext *vc, rcti *rect, int select, int extend)
me= vc->obact->data;
- if(me==NULL || me->totvert==0 || sx*sy <= 0)
+ if (me==NULL || me->totvert==0 || sx*sy <= 0)
return OPERATOR_CANCELLED;
selar= MEM_callocN(me->totvert+1, "selar");
@@ -795,23 +803,23 @@ int do_paintvert_box_select(ViewContext *vc, rcti *rect, int select, int extend)
ibuf = IMB_allocImBuf(sx,sy,32,IB_rect);
rt = ibuf->rect;
glReadPixels(rect->xmin+vc->ar->winrct.xmin, rect->ymin+vc->ar->winrct.ymin, sx, sy, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect);
- if(ENDIAN_ORDER==B_ENDIAN) IMB_convert_rgba_to_abgr(ibuf);
+ if (ENDIAN_ORDER==B_ENDIAN) IMB_convert_rgba_to_abgr(ibuf);
a= sx*sy;
- while(a--) {
- if(*rt) {
+ while (a--) {
+ if (*rt) {
index= WM_framebuffer_to_index(*rt);
- if(index<=me->totvert) selar[index]= 1;
+ if (index<=me->totvert) selar[index]= 1;
}
rt++;
}
mvert= me->mvert;
- for(a=1; a<=me->totvert; a++, mvert++) {
- if(selar[a]) {
- if(mvert->flag & ME_HIDE);
+ for (a=1; a<=me->totvert; a++, mvert++) {
+ if (selar[a]) {
+ if (mvert->flag & ME_HIDE);
else {
- if(select) mvert->flag |= SELECT;
+ if (select) mvert->flag |= SELECT;
else mvert->flag &= ~SELECT;
}
}
@@ -835,10 +843,10 @@ static void do_lasso_select_paintvert(ViewContext *vc, int mcords[][2], short mo
Mesh *me= ob?ob->data:NULL;
rcti rect;
- if(me==NULL || me->totvert==0)
+ if (me==NULL || me->totvert==0)
return;
- if(extend==0 && select)
+ if (extend==0 && select)
paintvert_deselect_all_visible(ob, SEL_DESELECT, FALSE); /* flush selection at the end */
bm_vertoffs= me->totvert+1; /* max index array */
@@ -857,10 +865,10 @@ static void do_lasso_select_paintface(ViewContext *vc, int mcords[][2], short mo
Mesh *me= ob?ob->data:NULL;
rcti rect;
- if(me==NULL || me->totpoly==0)
+ if (me==NULL || me->totpoly==0)
return;
- if(extend==0 && select)
+ if (extend==0 && select)
paintface_deselect_all_visible(ob, SEL_DESELECT, FALSE); /* flush selection at the end */
bm_vertoffs= me->totpoly+1; /* max index array */
@@ -888,7 +896,7 @@ static void do_lasso_select_node(int mcords[][2], short moves, short select)
lasso_select_boundbox(&rect, mcords, moves);
/* store selection in temp test flag */
- for(node= snode->edittree->nodes.first; node; node= node->next) {
+ for (node= snode->edittree->nodes.first; node; node= node->next) {
node_centf[0] = (node->totr.xmin+node->totr.xmax)/2;
node_centf[1] = (node->totr.ymin+node->totr.ymax)/2;
@@ -897,7 +905,8 @@ static void do_lasso_select_node(int mcords[][2], short moves, short select)
if (BLI_in_rcti(&rect, node_cent[0], node_cent[1]) && lasso_inside(mcords, moves, node_cent[0], node_cent[1])) {
if (select) {
node->flag |= SELECT;
- } else {
+ }
+ else {
node->flag &= ~SELECT;
}
}
@@ -910,14 +919,14 @@ static void view3d_lasso_select(bContext *C, ViewContext *vc, int mcords[][2], s
{
Object *ob = CTX_data_active_object(C);
- if(vc->obedit==NULL) { /* Object Mode */
- if(paint_facesel_test(ob))
+ if (vc->obedit==NULL) { /* Object Mode */
+ if (paint_facesel_test(ob))
do_lasso_select_paintface(vc, mcords, moves, extend, select);
- else if(paint_vertsel_test(ob))
+ else if (paint_vertsel_test(ob))
do_lasso_select_paintvert(vc, mcords, moves, extend, select);
- else if(ob && ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT))
+ else if (ob && ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT))
;
- else if(ob && ob->mode & OB_MODE_PARTICLE_EDIT)
+ else if (ob && ob->mode & OB_MODE_PARTICLE_EDIT)
PE_lasso_select(C, mcords, moves, extend, select);
else {
do_lasso_select_objects(vc, mcords, moves, extend, select);
@@ -966,11 +975,11 @@ static int view3d_lasso_select_exec(bContext *C, wmOperator *op)
mcords[i][0]= (int)loc[0];
mcords[i][1]= (int)loc[1];
i++;
- if(i>=1024) break;
+ if (i>=1024) break;
}
RNA_END;
- if(i>1) {
+ if (i>1) {
short extend, select;
view3d_operator_needs_opengl(C);
@@ -1019,7 +1028,7 @@ static unsigned int samplerect(unsigned int *buf, int size, unsigned int dontdo)
unsigned int retval=0;
base= LASTBASE;
- if(base==0) return 0;
+ if (base==0) return 0;
maxob= base->selcol;
len= (size-1)/2;
@@ -1038,17 +1047,17 @@ static unsigned int samplerect(unsigned int *buf, int size, unsigned int dontdo)
bufmax= buf+ size*size;
buf+= len*size+ len;
- for(tel=1;tel<=size;tel++) {
+ for (tel=1;tel<=size;tel++) {
- for(a=0;a<2;a++) {
- for(b=0;b<tel;b++) {
+ for (a=0;a<2;a++) {
+ for (b=0;b<tel;b++) {
- if(*buf && *buf<=maxob && *buf!=dontdo) return *buf;
- if( *buf==dontdo ) retval= dontdo; /* if only color dontdo is available, still return dontdo */
+ if (*buf && *buf<=maxob && *buf!=dontdo) return *buf;
+ if ( *buf==dontdo ) retval= dontdo; /* if only color dontdo is available, still return dontdo */
buf+= (dirvec[rc][0]+dirvec[rc][1]);
- if(buf<bufmin || buf>=bufmax) return retval;
+ if (buf<bufmin || buf>=bufmax) return retval;
}
rc++;
rc &= 3;
@@ -1103,9 +1112,9 @@ static int object_select_menu_exec(bContext *C, wmOperator *op)
short changed = 0;
const char *name= object_mouse_select_menu_data[name_index].idname;
- if(!extend) {
+ if (!extend) {
CTX_DATA_BEGIN(C, Base*, base, selectable_bases) {
- if(base->flag & SELECT) {
+ if (base->flag & SELECT) {
ED_base_object_select(base, BA_DESELECT);
changed= 1;
}
@@ -1115,7 +1124,7 @@ static int object_select_menu_exec(bContext *C, wmOperator *op)
CTX_DATA_BEGIN(C, Base*, base, selectable_bases) {
/* this is a bit dodjy, there should only be ONE object with this name, but library objects can mess this up */
- if(strcmp(name, base->object->id.name+2)==0) {
+ if (strcmp(name, base->object->id.name+2)==0) {
ED_base_object_activate(C, base);
ED_base_object_select(base, BA_SELECT);
changed= 1;
@@ -1127,7 +1136,7 @@ static int object_select_menu_exec(bContext *C, wmOperator *op)
memset(object_mouse_select_menu_data, 0, sizeof(object_mouse_select_menu_data));
/* undo? */
- if(changed) {
+ if (changed) {
WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, CTX_data_scene(C));
return OPERATOR_FINISHED;
}
@@ -1165,9 +1174,9 @@ static void deselectall_except(Scene *scene, Base *b) /* deselect all except b
{
Base *base;
- for(base= FIRSTBASE; base; base= base->next) {
+ for (base= FIRSTBASE; base; base= base->next) {
if (base->flag & SELECT) {
- if(b!=base) {
+ if (b!=base) {
ED_base_object_select(base, BA_DESELECT);
}
}
@@ -1184,11 +1193,11 @@ static Base *object_mouse_select_menu(bContext *C, ViewContext *vc, unsigned int
ok= FALSE;
/* two selection methods, the CTRL select uses max dist of 15 */
- if(buffer) {
+ if (buffer) {
int a;
- for(a=0; a<hits; a++) {
+ for (a=0; a<hits; a++) {
/* index was converted */
- if(base->selcol==buffer[ (4 * a) + 3 ])
+ if (base->selcol==buffer[ (4 * a) + 3 ])
ok= TRUE;
}
}
@@ -1198,11 +1207,11 @@ static Base *object_mouse_select_menu(bContext *C, ViewContext *vc, unsigned int
project_short(vc->ar, base->object->obmat[3], &base->sx);
temp= abs(base->sx -mval[0]) + abs(base->sy -mval[1]);
- if(temp < dist)
+ if (temp < dist)
ok= TRUE;
}
- if(ok) {
+ if (ok) {
baseCount++;
BLI_linklist_prepend(&linklist, base);
@@ -1212,10 +1221,10 @@ static Base *object_mouse_select_menu(bContext *C, ViewContext *vc, unsigned int
}
CTX_DATA_END;
- if(baseCount==0) {
+ if (baseCount==0) {
return NULL;
}
- if(baseCount == 1) {
+ if (baseCount == 1) {
Base *base= (Base *)linklist->link;
BLI_linklist_free(linklist, NULL);
return base;
@@ -1261,43 +1270,43 @@ static short mixed_bones_object_selectbuffer(ViewContext *vc, unsigned int *buff
BLI_init_rcti(&rect, mval[0]-14, mval[0]+14, mval[1]-14, mval[1]+14);
hits15= view3d_opengl_select(vc, buffer, MAXPICKBUF, &rect);
- if(hits15>0) {
- for(a=0; a<hits15; a++) if(buffer[4*a+3] & 0xFFFF0000) has_bones15= 1;
+ if (hits15>0) {
+ for (a=0; a<hits15; a++) if (buffer[4*a+3] & 0xFFFF0000) has_bones15= 1;
offs= 4*hits15;
BLI_init_rcti(&rect, mval[0]-9, mval[0]+9, mval[1]-9, mval[1]+9);
hits9= view3d_opengl_select(vc, buffer+offs, MAXPICKBUF-offs, &rect);
- if(hits9>0) {
- for(a=0; a<hits9; a++) if(buffer[offs+4*a+3] & 0xFFFF0000) has_bones9= 1;
+ if (hits9>0) {
+ for (a=0; a<hits9; a++) if (buffer[offs+4*a+3] & 0xFFFF0000) has_bones9= 1;
offs+= 4*hits9;
BLI_init_rcti(&rect, mval[0]-5, mval[0]+5, mval[1]-5, mval[1]+5);
hits5= view3d_opengl_select(vc, buffer+offs, MAXPICKBUF-offs, &rect);
- if(hits5>0) {
- for(a=0; a<hits5; a++) if(buffer[offs+4*a+3] & 0xFFFF0000) has_bones5= 1;
+ if (hits5>0) {
+ for (a=0; a<hits5; a++) if (buffer[offs+4*a+3] & 0xFFFF0000) has_bones5= 1;
}
}
- if(has_bones5) {
+ if (has_bones5) {
offs= 4*hits15 + 4*hits9;
memcpy(buffer, buffer+offs, 4*offs);
return hits5;
}
- if(has_bones9) {
+ if (has_bones9) {
offs= 4*hits15;
memcpy(buffer, buffer+offs, 4*offs);
return hits9;
}
- if(has_bones15) {
+ if (has_bones15) {
return hits15;
}
- if(hits5>0) {
+ if (hits5>0) {
offs= 4*hits15 + 4*hits9;
memcpy(buffer, buffer+offs, 4*offs);
return hits5;
}
- if(hits9>0) {
+ if (hits9>0) {
offs= 4*hits15;
memcpy(buffer, buffer+offs, 4*offs);
return hits9;
@@ -1318,24 +1327,24 @@ static Base *mouse_select_eval_buffer(ViewContext *vc, unsigned int *buffer, int
int a, donearest= 0;
/* define if we use solid nearest select or not */
- if(v3d->drawtype>OB_WIRE) {
+ if (v3d->drawtype>OB_WIRE) {
donearest= 1;
- if( ABS(mval[0]-lastmval[0])<3 && ABS(mval[1]-lastmval[1])<3) {
- if(!has_bones) /* hrms, if theres bones we always do nearest */
+ if ( ABS(mval[0]-lastmval[0])<3 && ABS(mval[1]-lastmval[1])<3) {
+ if (!has_bones) /* hrms, if theres bones we always do nearest */
donearest= 0;
}
}
lastmval[0]= mval[0]; lastmval[1]= mval[1];
- if(donearest) {
+ if (donearest) {
unsigned int min= 0xFFFFFFFF;
int selcol= 0, notcol=0;
- if(has_bones) {
+ if (has_bones) {
/* we skip non-bone hits */
- for(a=0; a<hits; a++) {
- if( min > buffer[4*a+1] && (buffer[4*a+3] & 0xFFFF0000) ) {
+ for (a=0; a<hits; a++) {
+ if ( min > buffer[4*a+1] && (buffer[4*a+3] & 0xFFFF0000) ) {
min= buffer[4*a+1];
selcol= buffer[4*a+3] & 0xFFFF;
}
@@ -1343,10 +1352,10 @@ static Base *mouse_select_eval_buffer(ViewContext *vc, unsigned int *buffer, int
}
else {
/* only exclude active object when it is selected... */
- if(BASACT && (BASACT->flag & SELECT) && hits>1) notcol= BASACT->selcol;
+ if (BASACT && (BASACT->flag & SELECT) && hits>1) notcol= BASACT->selcol;
- for(a=0; a<hits; a++) {
- if( min > buffer[4*a+1] && notcol!=(buffer[4*a+3] & 0xFFFF)) {
+ for (a=0; a<hits; a++) {
+ if ( min > buffer[4*a+1] && notcol!=(buffer[4*a+3] & 0xFFFF)) {
min= buffer[4*a+1];
selcol= buffer[4*a+3] & 0xFFFF;
}
@@ -1354,47 +1363,47 @@ static Base *mouse_select_eval_buffer(ViewContext *vc, unsigned int *buffer, int
}
base= FIRSTBASE;
- while(base) {
- if(BASE_SELECTABLE(v3d, base)) {
- if(base->selcol==selcol) break;
+ while (base) {
+ if (BASE_SELECTABLE(v3d, base)) {
+ if (base->selcol==selcol) break;
}
base= base->next;
}
- if(base) basact= base;
+ if (base) basact= base;
}
else {
base= startbase;
- while(base) {
+ while (base) {
/* skip objects with select restriction, to prevent prematurely ending this loop
* with an un-selectable choice */
if (base->object->restrictflag & OB_RESTRICT_SELECT) {
base=base->next;
- if(base==NULL) base= FIRSTBASE;
- if(base==startbase) break;
+ if (base==NULL) base= FIRSTBASE;
+ if (base==startbase) break;
}
- if(BASE_SELECTABLE(v3d, base)) {
- for(a=0; a<hits; a++) {
- if(has_bones) {
+ if (BASE_SELECTABLE(v3d, base)) {
+ for (a=0; a<hits; a++) {
+ if (has_bones) {
/* skip non-bone objects */
- if((buffer[4*a+3] & 0xFFFF0000)) {
- if(base->selcol== (buffer[(4*a)+3] & 0xFFFF))
+ if ((buffer[4*a+3] & 0xFFFF0000)) {
+ if (base->selcol== (buffer[(4*a)+3] & 0xFFFF))
basact= base;
}
}
else {
- if(base->selcol== (buffer[(4*a)+3] & 0xFFFF))
+ if (base->selcol== (buffer[(4*a)+3] & 0xFFFF))
basact= base;
}
}
}
- if(basact) break;
+ if (basact) break;
base= base->next;
- if(base==NULL) base= FIRSTBASE;
- if(base==startbase) break;
+ if (base==NULL) base= FIRSTBASE;
+ if (base==startbase) break;
}
}
@@ -1415,10 +1424,10 @@ Base *ED_view3d_give_base_under_cursor(bContext *C, const int mval[2])
hits= mixed_bones_object_selectbuffer(&vc, buffer, mval);
- if(hits>0) {
+ if (hits>0) {
int a, has_bones= 0;
- for(a=0; a<hits; a++) if(buffer[4*a+3] & 0xFFFF0000) has_bones= 1;
+ for (a=0; a<hits; a++) if (buffer[4*a+3] & 0xFFFF0000) has_bones= 1;
basact= mouse_select_eval_buffer(&vc, buffer, hits, mval, vc.scene->base.first, has_bones);
}
@@ -1431,11 +1440,11 @@ static void deselect_all_tracks(MovieTracking *tracking)
MovieTrackingObject *object;
object= tracking->objects.first;
- while(object) {
+ while (object) {
ListBase *tracksbase= BKE_tracking_object_tracks(tracking, object);
MovieTrackingTrack *track= tracksbase->first;
- while(track) {
+ while (track) {
BKE_tracking_deselect_track(track, TRACK_AREA_ALL);
track= track->next;
@@ -1462,24 +1471,25 @@ static int mouse_select(bContext *C, const int mval[2], short extend, short obce
/* always start list from basact in wire mode */
startbase= FIRSTBASE;
- if(BASACT && BASACT->next) startbase= BASACT->next;
+ if (BASACT && BASACT->next) startbase= BASACT->next;
/* This block uses the control key to make the object selected by its center point rather than its contents */
/* in editmode do not activate */
- if(obcenter) {
+ if (obcenter) {
/* note; shift+alt goes to group-flush-selecting */
- if(enumerate) {
+ if (enumerate) {
basact= object_mouse_select_menu(C, &vc, NULL, 0, mval, extend);
- } else {
+ }
+ else {
base= startbase;
- while(base) {
+ while (base) {
if (BASE_SELECTABLE(v3d, base)) {
project_short(ar, base->object->obmat[3], &base->sx);
temp= abs(base->sx -mval[0]) + abs(base->sy -mval[1]);
- if(base==BASACT) temp+=10;
- if(temp<dist ) {
+ if (base==BASACT) temp+=10;
+ if (temp<dist ) {
dist= temp;
basact= base;
@@ -1487,8 +1497,8 @@ static int mouse_select(bContext *C, const int mval[2], short extend, short obce
}
base= base->next;
- if(base==NULL) base= FIRSTBASE;
- if(base==startbase) break;
+ if (base==NULL) base= FIRSTBASE;
+ if (base==startbase) break;
}
}
}
@@ -1499,22 +1509,23 @@ static int mouse_select(bContext *C, const int mval[2], short extend, short obce
hits= mixed_bones_object_selectbuffer(&vc, buffer, mval);
- if(hits>0) {
+ if (hits>0) {
int has_bones= 0;
/* note: bundles are handling in the same way as bones */
- for(a=0; a<hits; a++) if(buffer[4*a+3] & 0xFFFF0000) has_bones= 1;
+ for (a=0; a<hits; a++) if (buffer[4*a+3] & 0xFFFF0000) has_bones= 1;
/* note; shift+alt goes to group-flush-selecting */
- if(has_bones==0 && enumerate) {
+ if (has_bones==0 && enumerate) {
basact= object_mouse_select_menu(C, &vc, buffer, hits, mval, extend);
- } else {
+ }
+ else {
basact= mouse_select_eval_buffer(&vc, buffer, hits, mval, startbase, has_bones);
}
- if(has_bones && basact) {
- if(basact->object->type==OB_CAMERA) {
- if(BASACT==basact) {
+ if (has_bones && basact) {
+ if (basact->object->type==OB_CAMERA) {
+ if (BASACT==basact) {
int i, hitresult;
int changed= 0;
@@ -1523,13 +1534,13 @@ static int mouse_select(bContext *C, const int mval[2], short extend, short obce
/* if there's bundles in buffer select bundles first,
so non-camera elements should be ignored in buffer */
- if(basact->selcol != (hitresult & 0xFFFF)) {
+ if (basact->selcol != (hitresult & 0xFFFF)) {
continue;
}
/* index of bundle is 1<<16-based. if there's no "bone" index
in hight word, this buffer value belongs to camera,. not to bundle */
- if(buffer[4*i+3] & 0xFFFF0000) {
+ if (buffer[4*i+3] & 0xFFFF0000) {
MovieClip *clip= object_get_movieclip(scene, basact->object, 0);
MovieTracking *tracking= &clip->tracking;
ListBase *tracksbase;
@@ -1537,18 +1548,18 @@ static int mouse_select(bContext *C, const int mval[2], short extend, short obce
track= BKE_tracking_indexed_track(&clip->tracking, hitresult >> 16, &tracksbase);
- if(TRACK_SELECTED(track) && extend) {
+ if (TRACK_SELECTED(track) && extend) {
changed= 0;
BKE_tracking_deselect_track(track, TRACK_AREA_ALL);
}
else {
int oldsel= TRACK_SELECTED(track) ? 1 : 0;
- if(!extend)
+ if (!extend)
deselect_all_tracks(tracking);
BKE_tracking_select_track(tracksbase, track, TRACK_AREA_ALL, extend);
- if(oldsel!=(TRACK_SELECTED(track) ? 1 : 0))
+ if (oldsel!=(TRACK_SELECTED(track) ? 1 : 0))
changed= 1;
}
@@ -1564,14 +1575,14 @@ static int mouse_select(bContext *C, const int mval[2], short extend, short obce
}
}
- if(!changed) {
+ if (!changed) {
/* fallback to regular object selection if no new bundles were selected,
allows to select object parented to reconstruction object */
basact= mouse_select_eval_buffer(&vc, buffer, hits, mval, startbase, 0);
}
}
}
- else if(ED_do_pose_selectbuffer(scene, basact, buffer, hits, extend) ) { /* then bone is found */
+ else if (ED_do_pose_selectbuffer(scene, basact, buffer, hits, extend) ) { /* then bone is found */
/* we make the armature selected:
not-selected active object in posemode won't work well for tools */
@@ -1583,24 +1594,24 @@ static int mouse_select(bContext *C, const int mval[2], short extend, short obce
WM_event_add_notifier(C, NC_OBJECT|ND_BONE_ACTIVE, basact->object);
/* in weightpaint, we use selected bone to select vertexgroup, so no switch to new active object */
- if(BASACT && BASACT->object->mode & OB_MODE_WEIGHT_PAINT) {
+ if (BASACT && BASACT->object->mode & OB_MODE_WEIGHT_PAINT) {
/* prevent activating */
basact= NULL;
}
}
/* prevent bone selecting to pass on to object selecting */
- if(basact==BASACT)
+ if (basact==BASACT)
basact= NULL;
}
}
}
/* so, do we have something selected? */
- if(basact) {
+ if (basact) {
retval = 1;
- if(vc.obedit) {
+ if (vc.obedit) {
/* only do select */
deselectall_except(scene, basact);
ED_base_object_select(basact, BA_SELECT);
@@ -1610,22 +1621,22 @@ static int mouse_select(bContext *C, const int mval[2], short extend, short obce
oldbasact= BASACT;
- if(!extend) {
+ if (!extend) {
deselectall_except(scene, basact);
ED_base_object_select(basact, BA_SELECT);
}
- else if(0) {
+ else if (0) {
// XXX select_all_from_groups(basact);
}
else {
- if(basact->flag & SELECT) {
- if(basact==oldbasact)
+ if (basact->flag & SELECT) {
+ if (basact==oldbasact)
ED_base_object_select(basact, BA_DESELECT);
}
else ED_base_object_select(basact, BA_SELECT);
}
- if(oldbasact != basact) {
+ if (oldbasact != basact) {
ED_base_object_activate(C, basact); /* adds notifier */
}
}
@@ -1650,8 +1661,8 @@ int edge_inside_circle(short centx, short centy, short rad, short x1, short y1,
float v1[2], v2[2], v3[2];
/* check points in circle itself */
- if( (x1-centx)*(x1-centx) + (y1-centy)*(y1-centy) <= radsq ) return 1;
- if( (x2-centx)*(x2-centx) + (y2-centy)*(y2-centy) <= radsq ) return 1;
+ if ( (x1-centx)*(x1-centx) + (y1-centy)*(y1-centy) <= radsq ) return 1;
+ if ( (x2-centx)*(x2-centx) + (y2-centy)*(y2-centy) <= radsq ) return 1;
/* pointdistline */
v3[0]= centx;
@@ -1661,7 +1672,7 @@ int edge_inside_circle(short centx, short centy, short rad, short x1, short y1,
v2[0]= x2;
v2[1]= y2;
- if( dist_to_line_segment_v2(v3, v1, v2) < (float)rad ) return 1;
+ if ( dist_to_line_segment_v2(v3, v1, v2) < (float)rad ) return 1;
return 0;
}
@@ -1676,16 +1687,20 @@ static void do_nurbs_box_select__doSelect(void *userData, Nurb *UNUSED(nu), BPoi
if (bp) {
bp->f1 = data->select?(bp->f1|SELECT):(bp->f1&~SELECT);
if (bp == cu->lastsel && !(bp->f1 & 1)) cu->lastsel = NULL;
- } else {
+ }
+ else {
if (cu->drawflag & CU_HIDE_HANDLES) {
/* can only be beztindex==0 here since handles are hidden */
bezt->f1 = bezt->f2 = bezt->f3 = data->select?(bezt->f2|SELECT):(bezt->f2&~SELECT);
- } else {
+ }
+ else {
if (beztindex==0) {
bezt->f1 = data->select?(bezt->f1|SELECT):(bezt->f1&~SELECT);
- } else if (beztindex==1) {
+ }
+ else if (beztindex==1) {
bezt->f2 = data->select?(bezt->f2|SELECT):(bezt->f2&~SELECT);
- } else {
+ }
+ else {
bezt->f3 = data->select?(bezt->f3|SELECT):(bezt->f3&~SELECT);
}
}
@@ -1748,13 +1763,14 @@ static void do_mesh_box_select__doSelectEdge(void *userData, BMEdge *eed, int x0
{
BoxSelectUserData *data = userData;
- if(EDBM_check_backbuf(bm_solidoffs+index)) {
+ if (EDBM_check_backbuf(bm_solidoffs+index)) {
if (data->pass==0) {
if (edge_fully_inside_rect(data->rect, x0, y0, x1, y1)) {
BM_elem_select_set(data->vc->em->bm, eed, data->select);
data->done = 1;
}
- } else {
+ }
+ else {
if (edge_inside_rect(data->rect, x0, y0, x1, y1)) {
BM_elem_select_set(data->vc->em->bm, eed, data->select);
}
@@ -1790,14 +1806,15 @@ static int do_mesh_box_select(ViewContext *vc, rcti *rect, int select, int exten
glLoadMatrixf(vc->rv3d->viewmat);
bbsel= EDBM_init_backbuf_border(vc, rect->xmin, rect->ymin, rect->xmax, rect->ymax);
- if(ts->selectmode & SCE_SELECT_VERTEX) {
+ if (ts->selectmode & SCE_SELECT_VERTEX) {
if (bbsel) {
EDBM_backbuf_checkAndSelectVerts(vc->em, select);
- } else {
+ }
+ else {
mesh_foreachScreenVert(vc, do_mesh_box_select__doSelectVert, &data, V3D_CLIP_TEST_RV3D_CLIPPING);
}
}
- if(ts->selectmode & SCE_SELECT_EDGE) {
+ if (ts->selectmode & SCE_SELECT_EDGE) {
/* Does both bbsel and non-bbsel versions (need screen cos for both) */
data.pass = 0;
@@ -1809,10 +1826,11 @@ static int do_mesh_box_select(ViewContext *vc, rcti *rect, int select, int exten
}
}
- if(ts->selectmode & SCE_SELECT_FACE) {
- if(bbsel) {
+ if (ts->selectmode & SCE_SELECT_FACE) {
+ if (bbsel) {
EDBM_backbuf_checkAndSelectFaces(vc->em, select);
- } else {
+ }
+ else {
mesh_foreachScreenFace(vc, do_mesh_box_select__doSelectFace, &data);
}
}
@@ -1836,22 +1854,22 @@ static int do_meta_box_select(ViewContext *vc, rcti *rect, int select, int exten
hits= view3d_opengl_select(vc, buffer, MAXPICKBUF, rect);
if (extend == 0 && select) {
- for(ml= mb->editelems->first; ml; ml= ml->next) {
+ for (ml= mb->editelems->first; ml; ml= ml->next) {
ml->flag &= ~SELECT;
}
}
- for(ml= mb->editelems->first; ml; ml= ml->next) {
- for(a=0; a<hits; a++) {
- if(ml->selcol1==buffer[ (4 * a) + 3 ]) {
+ for (ml= mb->editelems->first; ml; ml= ml->next) {
+ for (a=0; a<hits; a++) {
+ if (ml->selcol1==buffer[ (4 * a) + 3 ]) {
ml->flag |= MB_SCALE_RAD;
- if(select) ml->flag |= SELECT;
+ if (select) ml->flag |= SELECT;
else ml->flag &= ~SELECT;
break;
}
- if(ml->selcol2==buffer[ (4 * a) + 3 ]) {
+ if (ml->selcol2==buffer[ (4 * a) + 3 ]) {
ml->flag &= ~MB_SCALE_RAD;
- if(select) ml->flag |= SELECT;
+ if (select) ml->flag |= SELECT;
else ml->flag &= ~SELECT;
break;
}
@@ -1873,14 +1891,14 @@ static int do_armature_box_select(ViewContext *vc, rcti *rect, short select, sho
hits= view3d_opengl_select(vc, buffer, MAXPICKBUF, rect);
/* clear flag we use to detect point was affected */
- for(ebone= arm->edbo->first; ebone; ebone= ebone->next)
+ for (ebone= arm->edbo->first; ebone; ebone= ebone->next)
ebone->flag &= ~BONE_DONE;
if (extend==0 && select)
ED_armature_deselect_all_visible(vc->obedit);
/* first we only check points inside the border */
- for (a=0; a<hits; a++){
+ for (a=0; a<hits; a++) {
int index = buffer[(4*a)+3];
if (index!=-1) {
ebone = BLI_findlink(arm->edbo, index & ~(BONESEL_ANY));
@@ -1901,21 +1919,21 @@ static int do_armature_box_select(ViewContext *vc, rcti *rect, short select, sho
}
/* now we have to flush tag from parents... */
- for(ebone= arm->edbo->first; ebone; ebone= ebone->next) {
- if(ebone->parent && (ebone->flag & BONE_CONNECTED)) {
- if(ebone->parent->flag & BONE_DONE)
+ for (ebone= arm->edbo->first; ebone; ebone= ebone->next) {
+ if (ebone->parent && (ebone->flag & BONE_CONNECTED)) {
+ if (ebone->parent->flag & BONE_DONE)
ebone->flag |= BONE_DONE;
}
}
/* only select/deselect entire bones when no points where in the rect */
- for (a=0; a<hits; a++){
+ for (a=0; a<hits; a++) {
int index = buffer[(4*a)+3];
if (index!=-1) {
ebone = BLI_findlink(arm->edbo, index & ~(BONESEL_ANY));
if (index & BONESEL_BONE) {
if ((ebone->flag & BONE_UNSELECTABLE)==0) {
- if(!(ebone->flag & BONE_DONE)) {
+ if (!(ebone->flag & BONE_DONE)) {
if (select)
ebone->flag |= (BONE_ROOTSEL|BONE_TIPSEL|BONE_SELECTED);
else
@@ -1942,7 +1960,7 @@ static int do_object_pose_box_select(bContext *C, ViewContext *vc, rcti *rect, i
int totobj= MAXPICKBUF; // XXX solve later
short hits;
- if((ob) && (ob->mode & OB_MODE_POSE))
+ if ((ob) && (ob->mode & OB_MODE_POSE))
bone_only= 1;
else
bone_only= 0;
@@ -1955,7 +1973,8 @@ static int do_object_pose_box_select(bContext *C, ViewContext *vc, rcti *rect, i
}
}
CTX_DATA_END;
- } else {
+ }
+ else {
object_deselect_all_visible(vc->scene, vc->v3d);
}
}
@@ -1979,14 +1998,14 @@ static int do_object_pose_box_select(bContext *C, ViewContext *vc, rcti *rect, i
Base *base;
col = vbuffer + 3;
- for(base= vc->scene->base.first; base && hits; base= base->next) {
- if(BASE_SELECTABLE(vc->v3d, base)) {
+ for (base= vc->scene->base.first; base && hits; base= base->next) {
+ if (BASE_SELECTABLE(vc->v3d, base)) {
while (base->selcol == (*col & 0xFFFF)) { /* we got an object */
- if(*col & 0xFFFF0000) { /* we got a bone */
+ if (*col & 0xFFFF0000) { /* we got a bone */
bone = get_indexed_bone(base->object, *col & ~(BONESEL_ANY));
- if(bone) {
- if(select) {
+ if (bone) {
+ if (select) {
if ((bone->flag & BONE_UNSELECTABLE)==0) {
bone->flag |= BONE_SELECTED;
bone_selected=1;
@@ -1997,13 +2016,13 @@ static int do_object_pose_box_select(bContext *C, ViewContext *vc, rcti *rect, i
bArmature *arm= base->object->data;
bone->flag &= ~BONE_SELECTED;
// XXX select_actionchannel_by_name(base->object->action, bone->name, 0);
- if(arm->act_bone==bone)
+ if (arm->act_bone==bone)
arm->act_bone= NULL;
}
}
}
- else if(!bone_only) {
+ else if (!bone_only) {
if (select)
ED_base_object_select(base, BA_SELECT);
else
@@ -2012,7 +2031,7 @@ static int do_object_pose_box_select(bContext *C, ViewContext *vc, rcti *rect, i
col+=4; /* next color */
hits--;
- if(hits==0) break;
+ if (hits==0) break;
}
}
@@ -2050,38 +2069,38 @@ static int view3d_borderselect_exec(bContext *C, wmOperator *op)
rect.ymax= RNA_int_get(op->ptr, "ymax");
extend = RNA_boolean_get(op->ptr, "extend");
- if(vc.obedit) {
+ if (vc.obedit) {
switch(vc.obedit->type) {
case OB_MESH:
vc.em= ((Mesh *)vc.obedit->data)->edit_btmesh;
ret= do_mesh_box_select(&vc, &rect, select, extend);
// if (EM_texFaceCheck())
- if(ret & OPERATOR_FINISHED) {
+ if (ret & OPERATOR_FINISHED) {
WM_event_add_notifier(C, NC_GEOM|ND_SELECT, vc.obedit->data);
}
break;
case OB_CURVE:
case OB_SURF:
ret= do_nurbs_box_select(&vc, &rect, select, extend);
- if(ret & OPERATOR_FINISHED) {
+ if (ret & OPERATOR_FINISHED) {
WM_event_add_notifier(C, NC_GEOM|ND_SELECT, vc.obedit->data);
}
break;
case OB_MBALL:
ret= do_meta_box_select(&vc, &rect, select, extend);
- if(ret & OPERATOR_FINISHED) {
+ if (ret & OPERATOR_FINISHED) {
WM_event_add_notifier(C, NC_GEOM|ND_SELECT, vc.obedit->data);
}
break;
case OB_ARMATURE:
ret= do_armature_box_select(&vc, &rect, select, extend);
- if(ret & OPERATOR_FINISHED) {
+ if (ret & OPERATOR_FINISHED) {
WM_event_add_notifier(C, NC_OBJECT|ND_BONE_SELECT, vc.obedit);
}
break;
case OB_LATTICE:
ret= do_lattice_box_select(&vc, &rect, select, extend);
- if(ret & OPERATOR_FINISHED) {
+ if (ret & OPERATOR_FINISHED) {
WM_event_add_notifier(C, NC_GEOM|ND_SELECT, vc.obedit->data);
}
break;
@@ -2090,16 +2109,16 @@ static int view3d_borderselect_exec(bContext *C, wmOperator *op)
}
}
else { /* no editmode, unified for bones and objects */
- if(vc.obact && vc.obact->mode & OB_MODE_SCULPT) {
+ if (vc.obact && vc.obact->mode & OB_MODE_SCULPT) {
/* pass */
}
- else if(vc.obact && paint_facesel_test(vc.obact)) {
+ else if (vc.obact && paint_facesel_test(vc.obact)) {
ret= do_paintface_box_select(&vc, &rect, select, extend);
}
- else if(vc.obact && paint_vertsel_test(vc.obact)) {
+ else if (vc.obact && paint_vertsel_test(vc.obact)) {
ret= do_paintvert_box_select(&vc, &rect, select, extend);
}
- else if(vc.obact && vc.obact->mode & OB_MODE_PARTICLE_EDIT) {
+ else if (vc.obact && vc.obact->mode & OB_MODE_PARTICLE_EDIT) {
ret= PE_border_select(C, &rect, select, extend);
}
else { /* object mode with none active */
@@ -2173,11 +2192,12 @@ static int mouse_weight_paint_vertex_select(bContext *C, const int mval[2], shor
unsigned int index = 0;
MVert *mv;
- if(vertsel_vert_pick(C, me, mval, &index, 50)) {
+ if (vertsel_vert_pick(C, me, mval, &index, 50)) {
mv = me->mvert+index;
- if(extend) {
+ if (extend) {
mv->flag ^= SELECT;
- } else {
+ }
+ else {
paintvert_deselect_all_visible(obact, SEL_DESELECT, FALSE);
mv->flag |= SELECT;
}
@@ -2203,7 +2223,7 @@ static int view3d_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
view3d_operator_needs_opengl(C);
- if(object) {
+ if (object) {
obedit= NULL;
obact= NULL;
@@ -2213,24 +2233,24 @@ static int view3d_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
center= FALSE;
}
- if(obedit && object==FALSE) {
- if(obedit->type==OB_MESH)
+ if (obedit && object==FALSE) {
+ if (obedit->type==OB_MESH)
retval = mouse_mesh(C, event->mval, extend);
- else if(obedit->type==OB_ARMATURE)
+ else if (obedit->type==OB_ARMATURE)
retval = mouse_armature(C, event->mval, extend);
- else if(obedit->type==OB_LATTICE)
+ else if (obedit->type==OB_LATTICE)
retval = mouse_lattice(C, event->mval, extend);
- else if(ELEM(obedit->type, OB_CURVE, OB_SURF))
+ else if (ELEM(obedit->type, OB_CURVE, OB_SURF))
retval = mouse_nurb(C, event->mval, extend);
- else if(obedit->type==OB_MBALL)
+ else if (obedit->type==OB_MBALL)
retval = mouse_mball(C, event->mval, extend);
}
- else if(obact && obact->mode & OB_MODE_SCULPT)
+ else if (obact && obact->mode & OB_MODE_SCULPT)
return OPERATOR_CANCELLED;
- else if(obact && obact->mode & OB_MODE_PARTICLE_EDIT)
+ else if (obact && obact->mode & OB_MODE_PARTICLE_EDIT)
return PE_mouse_particles(C, event->mval, extend);
- else if(obact && paint_facesel_test(obact))
+ else if (obact && paint_facesel_test(obact))
retval = paintface_mouse_select(C, obact, event->mval, extend);
else if (paint_vertsel_test(obact))
retval = mouse_weight_paint_vertex_select(C, event->mval, extend, obact);
@@ -2323,26 +2343,29 @@ static void mesh_circle_select(ViewContext *vc, int select, const int mval[2], f
data.mval[1] = mval[1];
data.radius = rad;
- if(ts->selectmode & SCE_SELECT_VERTEX) {
- if(bbsel) {
+ if (ts->selectmode & SCE_SELECT_VERTEX) {
+ if (bbsel) {
EDBM_backbuf_checkAndSelectVerts(vc->em, select==LEFTMOUSE);
- } else {
+ }
+ else {
mesh_foreachScreenVert(vc, mesh_circle_doSelectVert, &data, V3D_CLIP_TEST_RV3D_CLIPPING);
}
}
- if(ts->selectmode & SCE_SELECT_EDGE) {
+ if (ts->selectmode & SCE_SELECT_EDGE) {
if (bbsel) {
EDBM_backbuf_checkAndSelectEdges(vc->em, select==LEFTMOUSE);
- } else {
+ }
+ else {
mesh_foreachScreenEdge(vc, mesh_circle_doSelectEdge, &data, V3D_CLIP_TEST_OFF);
}
}
- if(ts->selectmode & SCE_SELECT_FACE) {
- if(bbsel) {
+ if (ts->selectmode & SCE_SELECT_FACE) {
+ if (bbsel) {
EDBM_backbuf_checkAndSelectFaces(vc->em, select==LEFTMOUSE);
- } else {
+ }
+ else {
mesh_foreachScreenFace(vc, mesh_circle_doSelectFace, &data);
}
}
@@ -2398,16 +2421,20 @@ static void nurbscurve_circle_doSelect(void *userData, Nurb *UNUSED(nu), BPoint
bp->f1 = data->select?(bp->f1|SELECT):(bp->f1&~SELECT);
if (bp == cu->lastsel && !(bp->f1 & 1)) cu->lastsel = NULL;
- } else {
+ }
+ else {
if (cu->drawflag & CU_HIDE_HANDLES) {
/* can only be beztindex==0 here since handles are hidden */
bezt->f1 = bezt->f2 = bezt->f3 = data->select?(bezt->f2|SELECT):(bezt->f2&~SELECT);
- } else {
+ }
+ else {
if (beztindex==0) {
bezt->f1 = data->select?(bezt->f1|SELECT):(bezt->f1&~SELECT);
- } else if (beztindex==1) {
+ }
+ else if (beztindex==1) {
bezt->f2 = data->select?(bezt->f2|SELECT):(bezt->f2&~SELECT);
- } else {
+ }
+ else {
bezt->f3 = data->select?(bezt->f3|SELECT):(bezt->f3&~SELECT);
}
}
@@ -2598,7 +2625,7 @@ static void armature_circle_select(ViewContext *vc, int select, const int mval[2
change |= didpoint;
}
- if(change) {
+ if (change) {
ED_armature_sync_selection(arm->edbo);
ED_armature_validate_active(arm);
WM_main_add_notifier(NC_OBJECT|ND_BONE_SELECT, vc->obedit);
@@ -2644,7 +2671,7 @@ static int view3d_circle_select_exec(bContext *C, wmOperator *op)
select= (gesture_mode==GESTURE_MODAL_SELECT);
- if( CTX_data_edit_object(C) || paint_facesel_test(obact) || paint_vertsel_test(obact) ||
+ if ( CTX_data_edit_object(C) || paint_facesel_test(obact) || paint_vertsel_test(obact) ||
(obact && (obact->mode & (OB_MODE_PARTICLE_EDIT|OB_MODE_POSE))) )
{
ViewContext vc;
@@ -2656,36 +2683,36 @@ static int view3d_circle_select_exec(bContext *C, wmOperator *op)
mval[0]= x;
mval[1]= y;
- if(CTX_data_edit_object(C)) {
+ if (CTX_data_edit_object(C)) {
obedit_circle_select(&vc, select, mval, (float)radius);
WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obact->data);
}
- else if(paint_facesel_test(obact)) {
+ else if (paint_facesel_test(obact)) {
paint_facesel_circle_select(&vc, select, mval, (float)radius);
WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obact->data);
}
- else if(paint_vertsel_test(obact)) {
+ else if (paint_vertsel_test(obact)) {
paint_vertsel_circle_select(&vc, select, mval, (float)radius);
WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obact->data);
}
- else if(obact->mode & OB_MODE_POSE)
+ else if (obact->mode & OB_MODE_POSE)
pose_circle_select(&vc, select, mval, (float)radius);
else
return PE_circle_select(C, select, mval, (float)radius);
}
- else if(obact && obact->mode & OB_MODE_SCULPT) {
+ else if (obact && obact->mode & OB_MODE_SCULPT) {
return OPERATOR_CANCELLED;
}
else {
Base *base;
select= select?BA_SELECT:BA_DESELECT;
- for(base= FIRSTBASE; base; base= base->next) {
- if(BASE_SELECTABLE(v3d, base)) {
+ for (base= FIRSTBASE; base; base= base->next) {
+ if (BASE_SELECTABLE(v3d, base)) {
project_short(ar, base->object->obmat[3], &base->sx);
- if(base->sx!=IS_CLIPPED) {
+ if (base->sx!=IS_CLIPPED) {
int dx= base->sx-x;
int dy= base->sy-y;
- if( dx*dx + dy*dy < radius*radius)
+ if ( dx*dx + dy*dy < radius*radius)
ED_base_object_select(base, select);
}
}
diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c
index 9d2f549458f..978d32be48a 100644
--- a/source/blender/editors/space_view3d/view3d_snap.c
+++ b/source/blender/editors/space_view3d/view3d_snap.c
@@ -97,10 +97,10 @@ static int tottrans= 0;
/* copied from editobject.c, now uses (almost) proper depgraph */
static void special_transvert_update(Object *obedit)
{
- if(obedit) {
+ if (obedit) {
DAG_id_tag_update(obedit->data, 0);
- if(obedit->type==OB_MESH) {
+ if (obedit->type==OB_MESH) {
Mesh *me= obedit->data;
BM_mesh_normals_update(me->edit_btmesh->bm); // does face centers too
}
@@ -109,25 +109,25 @@ static void special_transvert_update(Object *obedit)
ListBase *nurbs= curve_editnurbs(cu);
Nurb *nu= nurbs->first;
- while(nu) {
+ while (nu) {
/* keep handles' vectors unchanged */
- if(nu->bezt) {
+ if (nu->bezt) {
int a= nu->pntsu;
TransVert *tv= transvmain;
BezTriple *bezt= nu->bezt;
- while(a--) {
- if(bezt->f1 & SELECT) tv++;
+ while (a--) {
+ if (bezt->f1 & SELECT) tv++;
- if(bezt->f2 & SELECT) {
+ if (bezt->f2 & SELECT) {
float v[3];
- if(bezt->f1 & SELECT) {
+ if (bezt->f1 & SELECT) {
sub_v3_v3v3(v, (tv-1)->oldloc, tv->oldloc);
add_v3_v3v3(bezt->vec[0], bezt->vec[1], v);
}
- if(bezt->f3 & SELECT) {
+ if (bezt->f3 & SELECT) {
sub_v3_v3v3(v, (tv+1)->oldloc, tv->oldloc);
add_v3_v3v3(bezt->vec[2], bezt->vec[1], v);
}
@@ -135,7 +135,7 @@ static void special_transvert_update(Object *obedit)
tv++;
}
- if(bezt->f3 & SELECT) tv++;
+ if (bezt->f3 & SELECT) tv++;
bezt++;
}
@@ -146,7 +146,7 @@ static void special_transvert_update(Object *obedit)
nu= nu->next;
}
}
- else if(obedit->type==OB_ARMATURE){
+ else if (obedit->type==OB_ARMATURE) {
bArmature *arm= obedit->data;
EditBone *ebo;
TransVert *tv= transvmain;
@@ -170,9 +170,9 @@ static void special_transvert_update(Object *obedit)
/* Ensure all bones are correctly adjusted */
for (ebo= arm->edbo->first; ebo; ebo=ebo->next) {
- if ((ebo->flag & BONE_CONNECTED) && ebo->parent){
+ if ((ebo->flag & BONE_CONNECTED) && ebo->parent) {
/* If this bone has a parent tip that has been moved */
- if (ebo->parent->flag & BONE_TIPSEL){
+ if (ebo->parent->flag & BONE_TIPSEL) {
copy_v3_v3(ebo->head, ebo->parent->tail);
}
/* If this bone has a parent tip that has NOT been moved */
@@ -181,13 +181,13 @@ static void special_transvert_update(Object *obedit)
}
}
}
- if(arm->flag & ARM_MIRROR_EDIT)
+ if (arm->flag & ARM_MIRROR_EDIT)
transform_armature_mirror_update(obedit);
}
- else if(obedit->type==OB_LATTICE) {
+ else if (obedit->type==OB_LATTICE) {
Lattice *lt= obedit->data;
- if(lt->editlatt->latt->flag & LT_OUTSIDE)
+ if (lt->editlatt->latt->flag & LT_OUTSIDE)
outside_lattice(lt->editlatt->latt);
}
}
@@ -227,7 +227,7 @@ static void make_trans_verts(Object *obedit, float *min, float *max, int mode)
INIT_MINMAX(min, max);
centroid[0]=centroid[1]=centroid[2]= 0.0;
- if(obedit->type==OB_MESH) {
+ if (obedit->type==OB_MESH) {
Mesh *me= obedit->data;
BMEditMesh *em= me->edit_btmesh;
BMesh *bm = em->bm;
@@ -240,30 +240,30 @@ static void make_trans_verts(Object *obedit, float *min, float *max, int mode)
// transform now requires awareness for select mode, so we tag the f1 flags in verts
tottrans= 0;
- if(em->selectmode & SCE_SELECT_VERTEX) {
+ if (em->selectmode & SCE_SELECT_VERTEX) {
BM_ITER(eve, &iter, bm, BM_VERTS_OF_MESH, NULL) {
- if(!BM_elem_flag_test(eve, BM_ELEM_HIDDEN) && BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
+ if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN) && BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
BM_elem_index_set(eve, 1); /* set_dirty! */
tottrans++;
}
else BM_elem_index_set(eve, 0); /* set_dirty! */
}
}
- else if(em->selectmode & SCE_SELECT_EDGE) {
+ else if (em->selectmode & SCE_SELECT_EDGE) {
BMEdge *eed;
BM_ITER(eve, &iter, bm, BM_VERTS_OF_MESH, NULL)
BM_elem_index_set(eve, 0); /* set_dirty! */
BM_ITER(eed, &iter, bm, BM_EDGES_OF_MESH, NULL) {
- if(!BM_elem_flag_test(eed, BM_ELEM_HIDDEN) && BM_elem_flag_test(eed, BM_ELEM_SELECT)) {
+ if (!BM_elem_flag_test(eed, BM_ELEM_HIDDEN) && BM_elem_flag_test(eed, BM_ELEM_SELECT)) {
BM_elem_index_set(eed->v1, 1); /* set_dirty! */
BM_elem_index_set(eed->v2, 1); /* set_dirty! */
}
}
BM_ITER(eve, &iter, bm, BM_VERTS_OF_MESH, NULL)
- if(BM_elem_index_get(eve)) tottrans++;
+ if (BM_elem_index_get(eve)) tottrans++;
}
else {
BMFace *efa;
@@ -272,7 +272,7 @@ static void make_trans_verts(Object *obedit, float *min, float *max, int mode)
BM_elem_index_set(eve, 0); /* set_dirty! */
BM_ITER(efa, &iter, bm, BM_FACES_OF_MESH, NULL) {
- if(!BM_elem_flag_test(efa, BM_ELEM_HIDDEN) && BM_elem_flag_test(efa, BM_ELEM_SELECT)) {
+ if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN) && BM_elem_flag_test(efa, BM_ELEM_SELECT)) {
BMIter liter;
BMLoop *l;
@@ -283,27 +283,30 @@ static void make_trans_verts(Object *obedit, float *min, float *max, int mode)
}
BM_ITER(eve, &iter, bm, BM_VERTS_OF_MESH, NULL)
- if(BM_elem_index_get(eve)) tottrans++;
+ if (BM_elem_index_get(eve)) tottrans++;
}
/* for any of the 3 loops above which all dirty the indicies */
bm->elem_index_dirty |= BM_VERT;
/* and now make transverts */
- if(tottrans) {
+ if (tottrans) {
tv=transvmain= MEM_callocN(tottrans*sizeof(TransVert), "maketransverts");
a = 0;
BM_ITER(eve, &iter, bm, BM_VERTS_OF_MESH, NULL) {
- if(BM_elem_index_get(eve)) {
+ if (BM_elem_index_get(eve)) {
BM_elem_index_set(eve, a); /* set_dirty! */
copy_v3_v3(tv->oldloc, eve->co);
tv->loc= eve->co;
- if(eve->no[0] != 0.0f || eve->no[1] != 0.0f ||eve->no[2] != 0.0f)
+ if (eve->no[0] != 0.0f || eve->no[1] != 0.0f ||eve->no[2] != 0.0f)
tv->nor= eve->no; // note this is a hackish signal (ton)
tv->flag= BM_elem_index_get(eve) & SELECT;
tv++;
a++;
- } else BM_elem_index_set(eve, -1); /* set_dirty! */
+ }
+ else {
+ BM_elem_index_set(eve, -1); /* set_dirty! */
+ }
}
/* set dirty already, above */
@@ -316,7 +319,7 @@ static void make_trans_verts(Object *obedit, float *min, float *max, int mode)
EDBM_free_index_arrays(em);
}
}
- else if (obedit->type==OB_ARMATURE){
+ else if (obedit->type==OB_ARMATURE) {
bArmature *arm= obedit->data;
int totmalloc= BLI_countlist(arm->edbo);
@@ -324,8 +327,8 @@ static void make_trans_verts(Object *obedit, float *min, float *max, int mode)
tv=transvmain= MEM_callocN(totmalloc*sizeof(TransVert), "maketransverts armature");
- for (ebo= arm->edbo->first; ebo; ebo=ebo->next){
- if(ebo->layer & arm->layer) {
+ for (ebo= arm->edbo->first; ebo; ebo=ebo->next) {
+ if (ebo->layer & arm->layer) {
short tipsel= (ebo->flag & BONE_TIPSEL);
short rootsel= (ebo->flag & BONE_ROOTSEL);
short rootok= (!(ebo->parent && (ebo->flag & BONE_CONNECTED) && ebo->parent->flag & BONE_TIPSEL));
@@ -369,8 +372,8 @@ static void make_trans_verts(Object *obedit, float *min, float *max, int mode)
int totmalloc= 0;
ListBase *nurbs= curve_editnurbs(cu);
- for(nu= nurbs->first; nu; nu= nu->next) {
- if(nu->type == CU_BEZIER)
+ for (nu= nurbs->first; nu; nu= nu->next) {
+ if (nu->type == CU_BEZIER)
totmalloc += 3*nu->pntsu;
else
totmalloc += nu->pntsu*nu->pntsv;
@@ -378,24 +381,24 @@ static void make_trans_verts(Object *obedit, float *min, float *max, int mode)
tv=transvmain= MEM_callocN(totmalloc*sizeof(TransVert), "maketransverts curve");
nu= nurbs->first;
- while(nu) {
- if(nu->type == CU_BEZIER) {
+ while (nu) {
+ if (nu->type == CU_BEZIER) {
a= nu->pntsu;
bezt= nu->bezt;
- while(a--) {
- if(bezt->hide==0) {
+ while (a--) {
+ if (bezt->hide==0) {
int skip_handle= 0;
- if(bezt->f2 & SELECT)
+ if (bezt->f2 & SELECT)
skip_handle= mode & TM_SKIP_HANDLES;
- if((bezt->f1 & SELECT) && !skip_handle) {
+ if ((bezt->f1 & SELECT) && !skip_handle) {
copy_v3_v3(tv->oldloc, bezt->vec[0]);
tv->loc= bezt->vec[0];
tv->flag= bezt->f1 & SELECT;
tv++;
tottrans++;
}
- if(bezt->f2 & SELECT) {
+ if (bezt->f2 & SELECT) {
copy_v3_v3(tv->oldloc, bezt->vec[1]);
tv->loc= bezt->vec[1];
tv->val= &(bezt->alfa);
@@ -404,7 +407,7 @@ static void make_trans_verts(Object *obedit, float *min, float *max, int mode)
tv++;
tottrans++;
}
- if((bezt->f3 & SELECT) && !skip_handle) {
+ if ((bezt->f3 & SELECT) && !skip_handle) {
copy_v3_v3(tv->oldloc, bezt->vec[2]);
tv->loc= bezt->vec[2];
tv->flag= bezt->f3 & SELECT;
@@ -418,9 +421,9 @@ static void make_trans_verts(Object *obedit, float *min, float *max, int mode)
else {
a= nu->pntsu*nu->pntsv;
bp= nu->bp;
- while(a--) {
- if(bp->hide==0) {
- if(bp->f1 & SELECT) {
+ while (a--) {
+ if (bp->hide==0) {
+ if (bp->f1 & SELECT) {
copy_v3_v3(tv->oldloc, bp->vec);
tv->loc= bp->vec;
tv->val= &(bp->alfa);
@@ -436,15 +439,15 @@ static void make_trans_verts(Object *obedit, float *min, float *max, int mode)
nu= nu->next;
}
}
- else if(obedit->type==OB_MBALL) {
+ else if (obedit->type==OB_MBALL) {
MetaBall *mb= obedit->data;
int totmalloc= BLI_countlist(mb->editelems);
tv=transvmain= MEM_callocN(totmalloc*sizeof(TransVert), "maketransverts mball");
ml= mb->editelems->first;
- while(ml) {
- if(ml->flag & SELECT) {
+ while (ml) {
+ if (ml->flag & SELECT) {
tv->loc= &ml->x;
copy_v3_v3(tv->oldloc, tv->loc);
tv->val= &(ml->rad);
@@ -456,7 +459,7 @@ static void make_trans_verts(Object *obedit, float *min, float *max, int mode)
ml= ml->next;
}
}
- else if(obedit->type==OB_LATTICE) {
+ else if (obedit->type==OB_LATTICE) {
Lattice *lt= obedit->data;
bp= lt->editlatt->latt->def;
@@ -465,9 +468,9 @@ static void make_trans_verts(Object *obedit, float *min, float *max, int mode)
tv=transvmain= MEM_callocN(a*sizeof(TransVert), "maketransverts latt");
- while(a--) {
- if(bp->f1 & SELECT) {
- if(bp->hide==0) {
+ while (a--) {
+ if (bp->f1 & SELECT) {
+ if (bp->hide==0) {
copy_v3_v3(tv->oldloc, bp->vec);
tv->loc= bp->vec;
tv->flag= bp->f1 & SELECT;
@@ -479,7 +482,7 @@ static void make_trans_verts(Object *obedit, float *min, float *max, int mode)
}
}
- if(!tottrans && transvmain) {
+ if (!tottrans && transvmain) {
/* prevent memory leak. happens for curves/latticies due to */
/* difficult condition of adding points to trans data */
MEM_freeN(transvmain);
@@ -489,14 +492,14 @@ static void make_trans_verts(Object *obedit, float *min, float *max, int mode)
/* cent etc */
tv= transvmain;
total= 0.0;
- for(a=0; a<tottrans; a++, tv++) {
- if(tv->flag & SELECT) {
+ for (a=0; a<tottrans; a++, tv++) {
+ if (tv->flag & SELECT) {
add_v3_v3(centroid, tv->oldloc);
total += 1.0f;
DO_MINMAX(tv->oldloc, min, max);
}
}
- if(total != 0.0f) {
+ if (total != 0.0f) {
mul_v3_fl(centroid, 1.0f/total);
}
@@ -517,18 +520,18 @@ static int snap_sel_to_grid(bContext *C, wmOperator *UNUSED(op))
gridf= rv3d->gridview;
- if(obedit) {
+ if (obedit) {
tottrans= 0;
if ELEM6(obedit->type, OB_ARMATURE, OB_LATTICE, OB_MESH, OB_SURF, OB_CURVE, OB_MBALL)
make_trans_verts(obedit, bmat[0], bmat[1], 0);
- if(tottrans==0) return OPERATOR_CANCELLED;
+ if (tottrans==0) return OPERATOR_CANCELLED;
copy_m3_m4(bmat, obedit->obmat);
invert_m3_m3(imat, bmat);
tv= transvmain;
- for(a=0; a<tottrans; a++, tv++) {
+ for (a=0; a<tottrans; a++, tv++) {
copy_v3_v3(vec, tv->loc);
mul_m3_v3(bmat, vec);
add_v3_v3(vec, obedit->obmat[3]);
@@ -550,16 +553,16 @@ static int snap_sel_to_grid(bContext *C, wmOperator *UNUSED(op))
struct KeyingSet *ks = ANIM_get_keyingset_for_autokeying(scene, ANIM_KS_LOCATION_ID);
CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
- if(ob->mode & OB_MODE_POSE) {
+ if (ob->mode & OB_MODE_POSE) {
bPoseChannel *pchan;
bArmature *arm= ob->data;
invert_m4_m4(ob->imat, ob->obmat);
for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
- if(pchan->bone->flag & BONE_SELECTED) {
- if(pchan->bone->layer & arm->layer) {
- if((pchan->bone->flag & BONE_CONNECTED)==0) {
+ if (pchan->bone->flag & BONE_SELECTED) {
+ if (pchan->bone->layer & arm->layer) {
+ if ((pchan->bone->flag & BONE_CONNECTED)==0) {
float nLoc[3];
/* get nearest grid point to snap to */
@@ -603,7 +606,7 @@ static int snap_sel_to_grid(bContext *C, wmOperator *UNUSED(op))
vec[1]= -ob->obmat[3][1]+gridf*floorf(0.5f+ ob->obmat[3][1]/gridf);
vec[2]= -ob->obmat[3][2]+gridf*floorf(0.5f+ ob->obmat[3][2]/gridf);
- if(ob->parent) {
+ if (ob->parent) {
where_is_object(scene, ob);
invert_m3_m3(imat, originmat);
@@ -658,18 +661,18 @@ static int snap_sel_to_curs(bContext *C, wmOperator *UNUSED(op))
curs= give_cursor(scene, v3d);
- if(obedit) {
+ if (obedit) {
tottrans= 0;
if ELEM6(obedit->type, OB_ARMATURE, OB_LATTICE, OB_MESH, OB_SURF, OB_CURVE, OB_MBALL)
make_trans_verts(obedit, bmat[0], bmat[1], 0);
- if(tottrans==0) return OPERATOR_CANCELLED;
+ if (tottrans==0) return OPERATOR_CANCELLED;
copy_m3_m4(bmat, obedit->obmat);
invert_m3_m3(imat, bmat);
tv= transvmain;
- for(a=0; a<tottrans; a++, tv++) {
+ for (a=0; a<tottrans; a++, tv++) {
sub_v3_v3v3(vec, curs, obedit->obmat[3]);
mul_m3_v3(imat, vec);
copy_v3_v3(tv->loc, vec);
@@ -684,7 +687,7 @@ static int snap_sel_to_curs(bContext *C, wmOperator *UNUSED(op))
struct KeyingSet *ks = ANIM_get_keyingset_for_autokeying(scene, ANIM_KS_LOCATION_ID);
CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
- if(ob->mode & OB_MODE_POSE) {
+ if (ob->mode & OB_MODE_POSE) {
bPoseChannel *pchan;
bArmature *arm= ob->data;
@@ -693,9 +696,9 @@ static int snap_sel_to_curs(bContext *C, wmOperator *UNUSED(op))
mul_m4_v3(ob->imat, vec);
for (pchan = ob->pose->chanbase.first; pchan; pchan=pchan->next) {
- if(pchan->bone->flag & BONE_SELECTED) {
- if(pchan->bone->layer & arm->layer) {
- if((pchan->bone->flag & BONE_CONNECTED)==0) {
+ if (pchan->bone->flag & BONE_SELECTED) {
+ if (pchan->bone->layer & arm->layer) {
+ if ((pchan->bone->flag & BONE_CONNECTED)==0) {
/* Get position in pchan (pose) space. */
armature_loc_pose_to_bone(pchan, vec, vec);
@@ -727,7 +730,7 @@ static int snap_sel_to_curs(bContext *C, wmOperator *UNUSED(op))
vec[1]= -ob->obmat[3][1] + curs[1];
vec[2]= -ob->obmat[3][2] + curs[2];
- if(ob->parent) {
+ if (ob->parent) {
where_is_object(scene, ob);
invert_m3_m3(imat, originmat);
@@ -814,7 +817,7 @@ static void bundle_midpoint(Scene *scene, Object *ob, float vec[3])
int ok= 0;
float min[3], max[3], mat[4][4], pos[3], cammat[4][4] = MAT4_UNITY;
- if(!clip)
+ if (!clip)
return;
tracking= &clip->tracking;
@@ -830,7 +833,7 @@ static void bundle_midpoint(Scene *scene, Object *ob, float vec[3])
MovieTrackingTrack *track= tracksbase->first;
float obmat[4][4];
- if(object->flag & TRACKING_OBJECT_CAMERA) {
+ if (object->flag & TRACKING_OBJECT_CAMERA) {
copy_m4_m4(obmat, mat);
}
else {
@@ -842,8 +845,8 @@ static void bundle_midpoint(Scene *scene, Object *ob, float vec[3])
mult_m4_m4m4(obmat, cammat, imat);
}
- while(track) {
- if((track->flag&TRACK_HAS_BUNDLE) && TRACK_SELECTED(track)) {
+ while (track) {
+ if ((track->flag&TRACK_HAS_BUNDLE) && TRACK_SELECTED(track)) {
ok= 1;
mul_v3_m4v3(pos, obmat, track->bundle_pos);
DO_MINMAX(pos, min, max);
@@ -853,7 +856,7 @@ static void bundle_midpoint(Scene *scene, Object *ob, float vec[3])
}
}
- if(ok) {
+ if (ok) {
mid_v3_v3v3(vec, min, max);
}
}
@@ -873,17 +876,17 @@ static int snap_curs_to_sel(bContext *C, wmOperator *UNUSED(op))
INIT_MINMAX(min, max);
centroid[0]= centroid[1]= centroid[2]= 0.0;
- if(obedit) {
+ if (obedit) {
tottrans=0;
if ELEM6(obedit->type, OB_ARMATURE, OB_LATTICE, OB_MESH, OB_SURF, OB_CURVE, OB_MBALL)
make_trans_verts(obedit, bmat[0], bmat[1], TM_ALL_JOINTS|TM_SKIP_HANDLES);
- if(tottrans==0) return OPERATOR_CANCELLED;
+ if (tottrans==0) return OPERATOR_CANCELLED;
copy_m3_m4(bmat, obedit->obmat);
tv= transvmain;
- for(a=0; a<tottrans; a++, tv++) {
+ for (a=0; a<tottrans; a++, tv++) {
copy_v3_v3(vec, tv->loc);
mul_m3_v3(bmat, vec);
add_v3_v3(vec, obedit->obmat[3]);
@@ -891,7 +894,7 @@ static int snap_curs_to_sel(bContext *C, wmOperator *UNUSED(op))
DO_MINMAX(vec, min, max);
}
- if(v3d->around==V3D_CENTROID) {
+ if (v3d->around==V3D_CENTROID) {
mul_v3_fl(centroid, 1.0f/(float)tottrans);
copy_v3_v3(curs, centroid);
}
@@ -904,12 +907,12 @@ static int snap_curs_to_sel(bContext *C, wmOperator *UNUSED(op))
else {
Object *obact= CTX_data_active_object(C);
- if(obact && (obact->mode & OB_MODE_POSE)) {
+ if (obact && (obact->mode & OB_MODE_POSE)) {
bArmature *arm= obact->data;
bPoseChannel *pchan;
for (pchan = obact->pose->chanbase.first; pchan; pchan=pchan->next) {
- if(arm->layer & pchan->bone->layer) {
- if(pchan->bone->flag & BONE_SELECTED) {
+ if (arm->layer & pchan->bone->layer) {
+ if (pchan->bone->flag & BONE_SELECTED) {
copy_v3_v3(vec, pchan->pose_head);
mul_m4_v3(obact->obmat, vec);
add_v3_v3(centroid, vec);
@@ -924,9 +927,9 @@ static int snap_curs_to_sel(bContext *C, wmOperator *UNUSED(op))
copy_v3_v3(vec, ob->obmat[3]);
/* special case for camera -- snap to bundles */
- if(ob->type==OB_CAMERA) {
+ if (ob->type==OB_CAMERA) {
/* snap to bundles should happen only when bundles are visible */
- if(v3d->flag2&V3D_SHOW_RECONSTRUCTION) {
+ if (v3d->flag2&V3D_SHOW_RECONSTRUCTION) {
bundle_midpoint(scene, ob, vec);
}
}
@@ -937,8 +940,8 @@ static int snap_curs_to_sel(bContext *C, wmOperator *UNUSED(op))
}
CTX_DATA_END;
}
- if(count) {
- if(v3d->around==V3D_CENTROID) {
+ if (count) {
+ if (v3d->around==V3D_CENTROID) {
mul_v3_fl(centroid, 1.0f/(float)count);
copy_v3_v3(curs, centroid);
}
@@ -1063,12 +1066,12 @@ int minmax_verts(Object *obedit, float *min, float *max)
if ELEM5(obedit->type, OB_ARMATURE, OB_LATTICE, OB_MESH, OB_SURF, OB_CURVE)
make_trans_verts(obedit, bmat[0], bmat[1], TM_ALL_JOINTS);
- if(tottrans==0) return 0;
+ if (tottrans==0) return 0;
copy_m3_m4(bmat, obedit->obmat);
tv= transvmain;
- for(a=0; a<tottrans; a++, tv++) {
+ for (a=0; a<tottrans; a++, tv++) {
copy_v3_v3(vec, (tv->flag & TX_VERT_USE_MAPLOC) ? tv->maploc : tv->loc);
mul_m3_v3(bmat, vec);
add_v3_v3(vec, obedit->obmat[3]);
diff --git a/source/blender/editors/space_view3d/view3d_toolbar.c b/source/blender/editors/space_view3d/view3d_toolbar.c
index e14946da28a..355febcde5d 100644
--- a/source/blender/editors/space_view3d/view3d_toolbar.c
+++ b/source/blender/editors/space_view3d/view3d_toolbar.c
@@ -78,14 +78,14 @@ static void view3d_panel_operator_redo_header(const bContext *C, Panel *pa)
{
wmOperator *op= WM_operator_last_redo(C);
- if(op) BLI_strncpy(pa->drawname, op->type->name, sizeof(pa->drawname));
+ if (op) BLI_strncpy(pa->drawname, op->type->name, sizeof(pa->drawname));
else BLI_strncpy(pa->drawname, IFACE_("Operator"), sizeof(pa->drawname));
}
static void view3d_panel_operator_redo_operator(const bContext *C, Panel *pa, wmOperator *op)
{
- if(op->type->flag & OPTYPE_MACRO) {
- for(op= op->macro.first; op; op= op->next) {
+ if (op->type->flag & OPTYPE_MACRO) {
+ for (op= op->macro.first; op; op= op->next) {
uiItemL(pa->layout, op->type->name, ICON_NONE);
view3d_panel_operator_redo_operator(C, pa, op);
}
@@ -101,9 +101,9 @@ static void view3d_panel_operator_redo(const bContext *C, Panel *pa)
wmOperator *op= WM_operator_last_redo(C);
uiBlock *block;
- if(op==NULL)
+ if (op==NULL)
return;
- if(WM_operator_poll((bContext*)C, op->type) == 0)
+ if (WM_operator_poll((bContext*)C, op->type) == 0)
return;
block= uiLayoutGetBlock(pa->layout);
@@ -129,7 +129,7 @@ static void operator_call_cb(struct bContext *C, void *arg_listbase, void *arg2)
{
wmOperatorType *ot= arg2;
- if(ot) {
+ if (ot) {
CustomTool *ct= MEM_callocN(sizeof(CustomTool), "CustomTool");
BLI_addtail(arg_listbase, ct);
@@ -143,13 +143,13 @@ static void operator_search_cb(const struct bContext *C, void *UNUSED(arg), cons
{
GHashIterator *iter= WM_operatortype_iter();
- for( ; !BLI_ghashIterator_isDone(iter); BLI_ghashIterator_step(iter)) {
+ for ( ; !BLI_ghashIterator_isDone(iter); BLI_ghashIterator_step(iter)) {
wmOperatorType *ot= BLI_ghashIterator_getValue(iter);
- if(BLI_strcasestr(ot->name, str)) {
- if(WM_operator_poll((bContext*)C, ot)) {
+ if (BLI_strcasestr(ot->name, str)) {
+ if (WM_operator_poll((bContext*)C, ot)) {
- if(0==uiSearchItemAdd(items, ot->name, ot, 0))
+ if (0==uiSearchItemAdd(items, ot->name, ot, 0))
break;
}
}
@@ -201,14 +201,14 @@ static void view3d_panel_tool_shelf(const bContext *C, Panel *pa)
uiLayout *col;
const char *context= CTX_data_mode_string(C);
- if(sl)
+ if (sl)
st= BKE_spacetype_from_id(sl->spacetype);
- if(st && st->toolshelf.first) {
+ if (st && st->toolshelf.first) {
CustomTool *ct;
- for(ct= st->toolshelf.first; ct; ct= ct->next) {
- if(0==strncmp(context, ct->context, OP_MAX_TYPENAME)) {
+ for (ct= st->toolshelf.first; ct; ct= ct->next) {
+ if (0==strncmp(context, ct->context, OP_MAX_TYPENAME)) {
col= uiLayoutColumn(pa->layout, 1);
uiItemFullO(col, ct->opname, NULL, ICON_NONE, NULL, WM_OP_INVOKE_REGION_WIN, 0);
}
@@ -249,7 +249,7 @@ static int view3d_toolshelf(bContext *C, wmOperator *UNUSED(op))
ScrArea *sa= CTX_wm_area(C);
ARegion *ar= view3d_has_tools_region(sa);
- if(ar)
+ if (ar)
ED_region_toggle_hidden(C, ar);
return OPERATOR_FINISHED;
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index c05f9de691b..915a1fae412 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -102,7 +102,7 @@ void view3d_region_operator_needs_opengl(wmWindow *win, ARegion *ar)
float *give_cursor(Scene *scene, View3D *v3d)
{
- if(v3d && v3d->localvd) return v3d->cursor;
+ if (v3d && v3d->localvd) return v3d->cursor;
else return scene->cursor;
}
@@ -149,15 +149,15 @@ void smooth_view(bContext *C, View3D *v3d, ARegion *ar, Object *oldcamera, Objec
* camera to be moved or changed, so only when the camera is not being set should
* we allow camera option locking to initialize the view settings from the camera.
*/
- if(camera == NULL && oldcamera == NULL) {
+ if (camera == NULL && oldcamera == NULL) {
ED_view3d_camera_lock_init(v3d, rv3d);
}
/* store the options we want to end with */
- if(ofs) copy_v3_v3(sms.new_ofs, ofs);
- if(quat) copy_qt_qt(sms.new_quat, quat);
- if(dist) sms.new_dist= *dist;
- if(lens) sms.new_lens= *lens;
+ if (ofs) copy_v3_v3(sms.new_ofs, ofs);
+ if (quat) copy_qt_qt(sms.new_quat, quat);
+ if (dist) sms.new_dist= *dist;
+ if (lens) sms.new_lens= *lens;
if (camera) {
ED_view3d_from_object(camera, sms.new_ofs, sms.new_quat, &sms.new_dist, &sms.new_lens);
@@ -194,7 +194,7 @@ void smooth_view(bContext *C, View3D *v3d, ARegion *ar, Object *oldcamera, Objec
sms.orig_lens= v3d->lens;
}
/* grid draw as floor */
- if((rv3d->viewlock & RV3D_LOCKED)==0) {
+ if ((rv3d->viewlock & RV3D_LOCKED)==0) {
/* use existing if exists, means multiple calls to smooth view wont loose the original 'view' setting */
sms.orig_view= rv3d->sms ? rv3d->sms->orig_view : rv3d->view;
rv3d->view= RV3D_VIEW_USER;
@@ -221,15 +221,15 @@ void smooth_view(bContext *C, View3D *v3d, ARegion *ar, Object *oldcamera, Objec
}
/* ensure it shows correct */
- if(sms.to_camera) rv3d->persp= RV3D_PERSP;
+ if (sms.to_camera) rv3d->persp= RV3D_PERSP;
rv3d->rflag |= RV3D_NAVIGATING;
/* keep track of running timer! */
- if(rv3d->sms==NULL)
+ if (rv3d->sms==NULL)
rv3d->sms= MEM_mallocN(sizeof(struct SmoothViewStore), "smoothview v3d");
*rv3d->sms= sms;
- if(rv3d->smooth_timer)
+ if (rv3d->smooth_timer)
WM_event_remove_timer(wm, win, rv3d->smooth_timer);
/* TIMER1 is hardcoded in keymap */
rv3d->smooth_timer= WM_event_add_timer(wm, win, TIMER1, 1.0/100.0); /* max 30 frs/sec */
@@ -239,15 +239,15 @@ void smooth_view(bContext *C, View3D *v3d, ARegion *ar, Object *oldcamera, Objec
}
/* if we get here nothing happens */
- if(ok == FALSE) {
- if(sms.to_camera==0) {
+ if (ok == FALSE) {
+ if (sms.to_camera==0) {
copy_v3_v3(rv3d->ofs, sms.new_ofs);
copy_qt_qt(rv3d->viewquat, sms.new_quat);
rv3d->dist = sms.new_dist;
v3d->lens = sms.new_lens;
}
- if(rv3d->viewlock & RV3D_BOXVIEW)
+ if (rv3d->viewlock & RV3D_BOXVIEW)
view3d_boxview_copy(sa, ar);
ED_region_tag_redraw(ar);
@@ -263,19 +263,19 @@ static int view3d_smoothview_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent
float step, step_inv;
/* escape if not our timer */
- if(rv3d->smooth_timer==NULL || rv3d->smooth_timer!=event->customdata)
+ if (rv3d->smooth_timer==NULL || rv3d->smooth_timer!=event->customdata)
return OPERATOR_PASS_THROUGH;
- if(sms->time_allowed != 0.0)
+ if (sms->time_allowed != 0.0)
step = (float)((rv3d->smooth_timer->duration)/sms->time_allowed);
else
step = 1.0f;
/* end timer */
- if(step >= 1.0f) {
+ if (step >= 1.0f) {
/* if we went to camera, store the original */
- if(sms->to_camera) {
+ if (sms->to_camera) {
rv3d->persp= RV3D_CAMOB;
copy_v3_v3(rv3d->ofs, sms->orig_ofs);
copy_qt_qt(rv3d->viewquat, sms->orig_quat);
@@ -291,7 +291,7 @@ static int view3d_smoothview_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent
ED_view3d_camera_lock_sync(v3d, rv3d);
}
- if((rv3d->viewlock & RV3D_LOCKED)==0) {
+ if ((rv3d->viewlock & RV3D_LOCKED)==0) {
rv3d->view= sms->orig_view;
}
@@ -322,7 +322,7 @@ static int view3d_smoothview_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent
ED_view3d_camera_lock_sync(v3d, rv3d);
}
- if(rv3d->viewlock & RV3D_BOXVIEW)
+ if (rv3d->viewlock & RV3D_BOXVIEW)
view3d_boxview_copy(CTX_wm_area(C), CTX_wm_region(C));
WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, v3d);
@@ -354,7 +354,7 @@ static int view3d_camera_to_view_exec(bContext *C, wmOperator *UNUSED(op))
copy_qt_qt(rv3d->lviewquat, rv3d->viewquat);
rv3d->lview= rv3d->view;
- if(rv3d->persp != RV3D_CAMOB) {
+ if (rv3d->persp != RV3D_CAMOB) {
rv3d->lpersp= rv3d->persp;
}
@@ -376,9 +376,9 @@ static int view3d_camera_to_view_exec(bContext *C, wmOperator *UNUSED(op))
static int view3d_camera_to_view_poll(bContext *C)
{
View3D *v3d= CTX_wm_view3d(C);
- if(v3d && v3d->camera && v3d->camera->id.lib==NULL) {
+ if (v3d && v3d->camera && v3d->camera->id.lib==NULL) {
RegionView3D *rv3d= CTX_wm_region_view3d(C);
- if(rv3d && !rv3d->viewlock) {
+ if (rv3d && !rv3d->viewlock) {
return 1;
}
}
@@ -438,9 +438,9 @@ static int view3d_camera_to_view_selected_exec(bContext *C, wmOperator *UNUSED(o
static int view3d_camera_to_view_selected_poll(bContext *C)
{
View3D *v3d= CTX_wm_view3d(C);
- if(v3d && v3d->camera && v3d->camera->id.lib==NULL) {
+ if (v3d && v3d->camera && v3d->camera->id.lib==NULL) {
RegionView3D *rv3d= CTX_wm_region_view3d(C);
- if(rv3d) {
+ if (rv3d) {
if (rv3d->is_persp == FALSE) {
CTX_wm_operator_poll_msg_set(C, "Only valid for a perspective camera view");
}
@@ -482,14 +482,14 @@ static int view3d_setobjectascamera_exec(bContext *C, wmOperator *UNUSED(op))
ED_view3d_context_user_region(C, &v3d, &ar);
rv3d = ar->regiondata;
- if(ob) {
+ if (ob) {
Object *camera_old= (rv3d->persp == RV3D_CAMOB) ? V3D_CAMERA_SCENE(scene, v3d) : NULL;
rv3d->persp= RV3D_CAMOB;
v3d->camera= ob;
- if(v3d->scenelock)
+ if (v3d->scenelock)
scene->camera= ob;
- if(camera_old != ob) /* unlikely but looks like a glitch when set to the same */
+ if (camera_old != ob) /* unlikely but looks like a glitch when set to the same */
smooth_view(C, v3d, ar, camera_old, v3d->camera, rv3d->ofs, rv3d->viewquat, &rv3d->dist, &v3d->lens);
WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS|NC_OBJECT|ND_DRAW, CTX_data_scene(C));
@@ -532,8 +532,8 @@ void ED_view3d_calc_clipping(BoundBox *bb, float planes[4][4], bglMats *mats, co
/* near zero floating point values can give issues with gluUnProject
in side view on some implementations */
- if(fabs(mats->modelview[0]) < 1e-6) mats->modelview[0]= 0.0;
- if(fabs(mats->modelview[5]) < 1e-6) mats->modelview[5]= 0.0;
+ if (fabs(mats->modelview[0]) < 1e-6) mats->modelview[0]= 0.0;
+ if (fabs(mats->modelview[5]) < 1e-6) mats->modelview[5]= 0.0;
/* Set up viewport so that gluUnProject will give correct values */
mats->viewport[0] = 0;
@@ -541,7 +541,7 @@ void ED_view3d_calc_clipping(BoundBox *bb, float planes[4][4], bglMats *mats, co
/* four clipping planes and bounding volume */
/* first do the bounding volume */
- for(val=0; val<4; val++) {
+ for (val=0; val<4; val++) {
xs= (val==0||val==3)?rect->xmin:rect->xmax;
ys= (val==0||val==1)?rect->ymin:rect->ymax;
@@ -555,16 +555,16 @@ void ED_view3d_calc_clipping(BoundBox *bb, float planes[4][4], bglMats *mats, co
/* verify if we have negative scale. doing the transform before cross
product flips the sign of the vector compared to doing cross product
before transform then, so we correct for that. */
- for(a=0; a<16; a++)
+ for (a=0; a<16; a++)
((float*)modelview)[a] = mats->modelview[a];
flip_sign = is_negative_m4(modelview);
/* then plane equations */
- for(val=0; val<4; val++) {
+ for (val=0; val<4; val++) {
normal_tri_v3(planes[val], bb->vec[val], bb->vec[val==3?0:val+1], bb->vec[val+4]);
- if(flip_sign)
+ if (flip_sign)
negate_v3(planes[val]);
planes[val][3]= - planes[val][0]*bb->vec[val][0]
@@ -578,7 +578,7 @@ void ED_view3d_win_to_segment_clip(ARegion *ar, View3D *v3d, const float mval[2]
{
RegionView3D *rv3d= ar->regiondata;
- if(rv3d->is_persp) {
+ if (rv3d->is_persp) {
float vec[3];
ED_view3d_win_to_vector(ar, mval, vec);
@@ -600,9 +600,9 @@ void ED_view3d_win_to_segment_clip(ARegion *ar, View3D *v3d, const float mval[2]
}
/* clipping */
- if(rv3d->rflag & RV3D_CLIPPING) {
+ if (rv3d->rflag & RV3D_CLIPPING) {
int a;
- for(a=0; a<4; a++) {
+ for (a=0; a<4; a++) {
clip_line_plane(ray_start, ray_end, rv3d->clip[a]);
}
}
@@ -644,7 +644,7 @@ void ED_view3d_global_to_vector(RegionView3D *rv3d, const float coord[3], float
int initgrabz(RegionView3D *rv3d, float x, float y, float z)
{
int flip= FALSE;
- if(rv3d==NULL) return flip;
+ if (rv3d==NULL) return flip;
rv3d->zfac= rv3d->persmat[0][3]*x+ rv3d->persmat[1][3]*y+ rv3d->persmat[2][3]*z+ rv3d->persmat[3][3];
if (rv3d->zfac < 0.0f)
flip= TRUE;
@@ -671,13 +671,13 @@ void ED_view3d_win_to_3d(ARegion *ar, const float depth_pt[3], const float mval[
float line_sta[3];
float line_end[3];
- if(rv3d->is_persp) {
+ if (rv3d->is_persp) {
float mousevec[3];
copy_v3_v3(line_sta, rv3d->viewinv[3]);
ED_view3d_win_to_vector(ar, mval, mousevec);
add_v3_v3v3(line_end, line_sta, mousevec);
- if(isect_line_plane_v3(out, line_sta, line_end, depth_pt, rv3d->viewinv[2], TRUE) == 0) {
+ if (isect_line_plane_v3(out, line_sta, line_end, depth_pt, rv3d->viewinv[2], TRUE) == 0) {
/* highly unlikely to ever happen, mouse vec paralelle with view plane */
zero_v3(out);
}
@@ -716,7 +716,7 @@ void ED_view3d_win_to_vector(ARegion *ar, const float mval[2], float out[3])
{
RegionView3D *rv3d= ar->regiondata;
- if(rv3d->is_persp) {
+ if (rv3d->is_persp) {
out[0]= 2.0f * (mval[0] / ar->winx) - 1.0f;
out[1]= 2.0f * (mval[1] / ar->winy) - 1.0f;
out[2]= -0.5f;
@@ -736,7 +736,7 @@ float ED_view3d_depth_read_cached(ViewContext *vc, int x, int y)
x -= vc->ar->winrct.xmin;
y -= vc->ar->winrct.ymin;
- if(vd && vd->depths && x > 0 && y > 0 && x < vd->w && y < vd->h)
+ if (vd && vd->depths && x > 0 && y > 0 && x < vd->w && y < vd->h)
return vd->depths[y * vd->w + x];
else
return 1;
@@ -744,7 +744,7 @@ float ED_view3d_depth_read_cached(ViewContext *vc, int x, int y)
void ED_view3d_depth_tag_update(RegionView3D *rv3d)
{
- if(rv3d->depths)
+ if (rv3d->depths)
rv3d->depths->damaged= 1;
}
@@ -780,10 +780,11 @@ void ED_view3d_project_float(const ARegion *ar, const float vec[3], float adr[2]
mul_m4_v4(mat, vec4);
- if( vec4[3]>FLT_EPSILON ) {
+ if ( vec4[3]>FLT_EPSILON ) {
adr[0] = (float)(ar->winx/2.0f)+(ar->winx/2.0f)*vec4[0]/vec4[3];
adr[1] = (float)(ar->winy/2.0f)+(ar->winy/2.0f)*vec4[1]/vec4[3];
- } else {
+ }
+ else {
adr[0] = adr[1] = 0.0f;
}
}
@@ -799,11 +800,12 @@ void ED_view3d_project_float_v3(ARegion *ar, float *vec, float *adr, float mat[4
mul_m4_v4(mat, vec4);
- if( vec4[3]>FLT_EPSILON ) {
+ if ( vec4[3]>FLT_EPSILON ) {
adr[0] = (float)(ar->winx/2.0f)+(ar->winx/2.0f)*vec4[0]/vec4[3];
adr[1] = (float)(ar->winy/2.0f)+(ar->winy/2.0f)*vec4[1]/vec4[3];
adr[2] = vec4[2]/vec4[3];
- } else {
+ }
+ else {
adr[0] = adr[1] = adr[2] = 0.0f;
}
}
@@ -816,12 +818,12 @@ int ED_view3d_boundbox_clip(RegionView3D *rv3d, float obmat[][4], BoundBox *bb)
float vec[4], min, max;
int a, flag= -1, fl;
- if(bb==NULL) return 1;
- if(bb->flag & OB_BB_DISABLED) return 1;
+ if (bb==NULL) return 1;
+ if (bb->flag & OB_BB_DISABLED) return 1;
mult_m4_m4m4(mat, rv3d->persmat, obmat);
- for(a=0; a<8; a++) {
+ for (a=0; a<8; a++) {
copy_v3_v3(vec, bb->vec[a]);
vec[3]= 1.0;
mul_m4_v4(mat, vec);
@@ -829,15 +831,15 @@ int ED_view3d_boundbox_clip(RegionView3D *rv3d, float obmat[][4], BoundBox *bb)
min= -vec[3];
fl= 0;
- if(vec[0] < min) fl+= 1;
- if(vec[0] > max) fl+= 2;
- if(vec[1] < min) fl+= 4;
- if(vec[1] > max) fl+= 8;
- if(vec[2] < min) fl+= 16;
- if(vec[2] > max) fl+= 32;
+ if (vec[0] < min) fl+= 1;
+ if (vec[0] > max) fl+= 2;
+ if (vec[1] < min) fl+= 4;
+ if (vec[1] > max) fl+= 8;
+ if (vec[2] < min) fl+= 16;
+ if (vec[2] > max) fl+= 32;
flag &= fl;
- if(flag==0) return 1;
+ if (flag==0) return 1;
}
return 0;
@@ -850,8 +852,8 @@ void project_short(ARegion *ar, const float vec[3], short adr[2]) /* clips */
adr[0]= IS_CLIPPED;
- if(rv3d->rflag & RV3D_CLIPPING) {
- if(ED_view3d_test_clipping(rv3d, vec, 0))
+ if (rv3d->rflag & RV3D_CLIPPING) {
+ if (ED_view3d_test_clipping(rv3d, vec, 0))
return;
}
@@ -859,14 +861,14 @@ void project_short(ARegion *ar, const float vec[3], short adr[2]) /* clips */
vec4[3]= 1.0;
mul_m4_v4(rv3d->persmat, vec4);
- if( vec4[3] > (float)BL_NEAR_CLIP ) { /* 0.001 is the NEAR clipping cutoff for picking */
+ if ( vec4[3] > (float)BL_NEAR_CLIP ) { /* 0.001 is the NEAR clipping cutoff for picking */
fx= (ar->winx/2)*(1 + vec4[0]/vec4[3]);
- if( fx>0 && fx<ar->winx) {
+ if ( fx>0 && fx<ar->winx) {
fy= (ar->winy/2)*(1 + vec4[1]/vec4[3]);
- if(fy > 0.0f && fy < (float)ar->winy) {
+ if (fy > 0.0f && fy < (float)ar->winy) {
adr[0]= (short)floor(fx);
adr[1]= (short)floor(fy);
}
@@ -885,13 +887,13 @@ void project_int(ARegion *ar, const float vec[3], int adr[2])
mul_m4_v4(rv3d->persmat, vec4);
- if( vec4[3] > (float)BL_NEAR_CLIP ) { /* 0.001 is the NEAR clipping cutoff for picking */
+ if ( vec4[3] > (float)BL_NEAR_CLIP ) { /* 0.001 is the NEAR clipping cutoff for picking */
fx= (ar->winx/2)*(1 + vec4[0]/vec4[3]);
- if( fx>-2140000000.0f && fx<2140000000.0f) {
+ if ( fx>-2140000000.0f && fx<2140000000.0f) {
fy= (ar->winy/2)*(1 + vec4[1]/vec4[3]);
- if(fy>-2140000000.0f && fy<2140000000.0f) {
+ if (fy>-2140000000.0f && fy<2140000000.0f) {
adr[0]= (int)floor(fx);
adr[1]= (int)floor(fy);
}
@@ -909,7 +911,7 @@ void project_int_noclip(ARegion *ar, const float vec[3], int adr[2])
mul_m4_v4(rv3d->persmat, vec4);
- if( fabs(vec4[3]) > BL_NEAR_CLIP ) {
+ if ( fabs(vec4[3]) > BL_NEAR_CLIP ) {
fx = (ar->winx/2)*(1 + vec4[0]/vec4[3]);
fy = (ar->winy/2)*(1 + vec4[1]/vec4[3]);
@@ -933,14 +935,14 @@ void project_short_noclip(ARegion *ar, const float vec[3], short adr[2])
mul_m4_v4(rv3d->persmat, vec4);
- if( vec4[3] > (float)BL_NEAR_CLIP ) { /* 0.001 is the NEAR clipping cutoff for picking */
+ if ( vec4[3] > (float)BL_NEAR_CLIP ) { /* 0.001 is the NEAR clipping cutoff for picking */
fx= (ar->winx/2)*(1 + vec4[0]/vec4[3]);
- if( fx>-32700 && fx<32700) {
+ if ( fx>-32700 && fx<32700) {
fy= (ar->winy/2)*(1 + vec4[1]/vec4[3]);
- if(fy > -32700.0f && fy < 32700.0f) {
+ if (fy > -32700.0f && fy < 32700.0f) {
adr[0]= (short)floor(fx);
adr[1]= (short)floor(fy);
}
@@ -958,7 +960,7 @@ void apply_project_float(float persmat[4][4], int winx, int winy, const float ve
mul_m4_v4(persmat, vec4);
- if(vec4[3] > (float)BL_NEAR_CLIP) {
+ if (vec4[3] > (float)BL_NEAR_CLIP) {
adr[0] = (float)(winx/2.0f)+(winx/2.0f)*vec4[0]/vec4[3];
adr[1] = (float)(winy/2.0f)+(winy/2.0f)*vec4[1]/vec4[3];
}
@@ -981,7 +983,7 @@ void project_float_noclip(ARegion *ar, const float vec[3], float adr[2])
mul_m4_v4(rv3d->persmat, vec4);
- if( fabs(vec4[3]) > BL_NEAR_CLIP ) {
+ if ( fabs(vec4[3]) > BL_NEAR_CLIP ) {
adr[0] = (float)(ar->winx/2.0f)+(ar->winx/2.0f)*vec4[0]/vec4[3];
adr[1] = (float)(ar->winy/2.0f)+(ar->winy/2.0f)*vec4[1]/vec4[3];
}
@@ -999,8 +1001,8 @@ int ED_view3d_clip_range_get(View3D *v3d, RegionView3D *rv3d, float *clipsta, fl
camera_params_init(&params);
camera_params_from_view3d(&params, v3d, rv3d);
- if(clipsta) *clipsta= params.clipsta;
- if(clipend) *clipend= params.clipend;
+ if (clipsta) *clipsta= params.clipsta;
+ if (clipend) *clipend= params.clipend;
return params.is_ortho;
}
@@ -1015,9 +1017,9 @@ int ED_view3d_viewplane_get(View3D *v3d, RegionView3D *rv3d, int winx, int winy,
camera_params_from_view3d(&params, v3d, rv3d);
camera_params_compute_viewplane(&params, winx, winy, 1.0f, 1.0f);
- if(viewplane) *viewplane= params.viewplane;
- if(clipsta) *clipsta= params.clipsta;
- if(clipend) *clipend= params.clipend;
+ if (viewplane) *viewplane= params.viewplane;
+ if (clipsta) *clipsta= params.clipsta;
+ if (clipend) *clipend= params.clipend;
return params.is_ortho;
}
@@ -1043,7 +1045,7 @@ void setwinmatrixview3d(ARegion *ar, View3D *v3d, rctf *rect) /* rect: for pick
x2= viewplane.xmax;
y2= viewplane.ymax;
- if(rect) { /* picking */
+ if (rect) { /* picking */
rect->xmin/= (float)ar->winx;
rect->xmin= x1+rect->xmin*(x2-x1);
rect->ymin/= (float)ar->winy;
@@ -1053,12 +1055,12 @@ void setwinmatrixview3d(ARegion *ar, View3D *v3d, rctf *rect) /* rect: for pick
rect->ymax/= (float)ar->winy;
rect->ymax= y1+rect->ymax*(y2-y1);
- if(orth) wmOrtho(rect->xmin, rect->xmax, rect->ymin, rect->ymax, -clipend, clipend);
+ if (orth) wmOrtho(rect->xmin, rect->xmax, rect->ymin, rect->ymax, -clipend, clipend);
else wmFrustum(rect->xmin, rect->xmax, rect->ymin, rect->ymax, clipsta, clipend);
}
else {
- if(orth) wmOrtho(x1, x2, y1, y2, clipsta, clipend);
+ if (orth) wmOrtho(x1, x2, y1, y2, clipsta, clipend);
else wmFrustum(x1, x2, y1, y2, clipsta, clipend);
}
@@ -1100,11 +1102,13 @@ static void obmat_to_viewmat(View3D *v3d, RegionView3D *rv3d, Object *ob, short
rv3d->persp=RV3D_CAMOB; /* just to be polite, not needed */
- } else {
+ }
+ else {
mat3_to_quat( new_quat,tmat);
smooth_view(NULL, NULL, NULL, NULL, NULL, NULL, new_quat, NULL, NULL); // XXX
}
- } else {
+ }
+ else {
mat3_to_quat( rv3d->viewquat,tmat);
}
}
@@ -1147,8 +1151,8 @@ int ED_view3d_lock(RegionView3D *rv3d)
/* dont set windows active in here, is used by renderwin too */
void setviewmatrixview3d(Scene *scene, View3D *v3d, RegionView3D *rv3d)
{
- if(rv3d->persp==RV3D_CAMOB) { /* obs/camera */
- if(v3d->camera) {
+ if (rv3d->persp==RV3D_CAMOB) { /* obs/camera */
+ if (v3d->camera) {
where_is_object(scene, v3d->camera);
obmat_to_viewmat(v3d, rv3d, v3d->camera, 0);
}
@@ -1159,19 +1163,19 @@ void setviewmatrixview3d(Scene *scene, View3D *v3d, RegionView3D *rv3d)
}
else {
/* should be moved to better initialize later on XXX */
- if(rv3d->viewlock)
+ if (rv3d->viewlock)
ED_view3d_lock(rv3d);
quat_to_mat4( rv3d->viewmat,rv3d->viewquat);
- if(rv3d->persp==RV3D_PERSP) rv3d->viewmat[3][2]-= rv3d->dist;
- if(v3d->ob_centre) {
+ if (rv3d->persp==RV3D_PERSP) rv3d->viewmat[3][2]-= rv3d->dist;
+ if (v3d->ob_centre) {
Object *ob= v3d->ob_centre;
float vec[3];
copy_v3_v3(vec, ob->obmat[3]);
- if(ob->type==OB_ARMATURE && v3d->ob_centre_bone[0]) {
+ if (ob->type==OB_ARMATURE && v3d->ob_centre_bone[0]) {
bPoseChannel *pchan= get_pose_channel(ob->pose, v3d->ob_centre_bone);
- if(pchan) {
+ if (pchan) {
copy_v3_v3(vec, pchan->pose_mat[3]);
mul_m4_v3(ob->obmat, vec);
}
@@ -1204,7 +1208,7 @@ short view3d_opengl_select(ViewContext *vc, unsigned int *buffer, unsigned int b
G.f |= G_PICKSEL;
/* case not a border select */
- if(input->xmin==input->xmax) {
+ if (input->xmin==input->xmax) {
rect.xmin= input->xmin-12; // seems to be default value for bones only now
rect.xmax= input->xmin+12;
rect.ymin= input->ymin-12;
@@ -1220,12 +1224,12 @@ short view3d_opengl_select(ViewContext *vc, unsigned int *buffer, unsigned int b
setwinmatrixview3d(ar, v3d, &rect);
mult_m4_m4m4(vc->rv3d->persmat, vc->rv3d->winmat, vc->rv3d->viewmat);
- if(v3d->drawtype > OB_WIRE) {
+ if (v3d->drawtype > OB_WIRE) {
v3d->zbuf= TRUE;
glEnable(GL_DEPTH_TEST);
}
- if(vc->rv3d->rflag & RV3D_CLIPPING)
+ if (vc->rv3d->rflag & RV3D_CLIPPING)
view3d_set_clipping(vc->rv3d);
glSelectBuffer( bufsize, (GLuint *)buffer);
@@ -1234,12 +1238,12 @@ short view3d_opengl_select(ViewContext *vc, unsigned int *buffer, unsigned int b
glPushName(-1);
code= 1;
- if(vc->obedit && vc->obedit->type==OB_MBALL) {
+ if (vc->obedit && vc->obedit->type==OB_MBALL) {
draw_object(scene, ar, v3d, BASACT, DRAW_PICKING|DRAW_CONSTCOLOR);
}
- else if((vc->obedit && vc->obedit->type==OB_ARMATURE)) {
+ else if ((vc->obedit && vc->obedit->type==OB_ARMATURE)) {
/* if not drawing sketch, draw bones */
- if(!BDR_drawSketchNames(vc)) {
+ if (!BDR_drawSketchNames(vc)) {
draw_object(scene, ar, v3d, BASACT, DRAW_PICKING|DRAW_CONSTCOLOR);
}
}
@@ -1247,8 +1251,8 @@ short view3d_opengl_select(ViewContext *vc, unsigned int *buffer, unsigned int b
Base *base;
v3d->xray= TRUE; // otherwise it postpones drawing
- for(base= scene->base.first; base; base= base->next) {
- if(base->lay & v3d->lay) {
+ for (base= scene->base.first; base; base= base->next) {
+ if (base->lay & v3d->lay) {
if (base->object->restrictflag & OB_RESTRICT_SELECT)
base->selcol= 0;
@@ -1258,7 +1262,7 @@ short view3d_opengl_select(ViewContext *vc, unsigned int *buffer, unsigned int b
draw_object(scene, ar, v3d, base, DRAW_PICKING|DRAW_CONSTCOLOR);
/* we draw group-duplicators for selection too */
- if((base->object->transflag & OB_DUPLI) && base->object->dup_group) {
+ if ((base->object->transflag & OB_DUPLI) && base->object->dup_group) {
ListBase *lb;
DupliObject *dob;
Base tbase;
@@ -1266,7 +1270,7 @@ short view3d_opengl_select(ViewContext *vc, unsigned int *buffer, unsigned int b
tbase.flag= OB_FROMDUPLI;
lb= object_duplilist(scene, base->object);
- for(dob= lb->first; dob; dob= dob->next) {
+ for (dob= lb->first; dob; dob= dob->next) {
tbase.object= dob->ob;
copy_m4_m4(dob->ob->obmat, dob->mat);
@@ -1298,16 +1302,16 @@ short view3d_opengl_select(ViewContext *vc, unsigned int *buffer, unsigned int b
setwinmatrixview3d(ar, v3d, NULL);
mult_m4_m4m4(vc->rv3d->persmat, vc->rv3d->winmat, vc->rv3d->viewmat);
- if(v3d->drawtype > OB_WIRE) {
+ if (v3d->drawtype > OB_WIRE) {
v3d->zbuf= 0;
glDisable(GL_DEPTH_TEST);
}
// XXX persp(PERSP_WIN);
- if(vc->rv3d->rflag & RV3D_CLIPPING)
+ if (vc->rv3d->rflag & RV3D_CLIPPING)
view3d_clr_clipping();
- if(hits<0) printf("Too many objects in select buffer\n"); // XXX make error message
+ if (hits<0) printf("Too many objects in select buffer\n"); // XXX make error message
return hits;
}
@@ -1324,11 +1328,11 @@ static unsigned int free_localbit(Main *bmain)
/* sometimes we loose a localview: when an area is closed */
/* check all areas: which localviews are in use? */
- for(sc= bmain->screen.first; sc; sc= sc->id.next) {
- for(sa= sc->areabase.first; sa; sa= sa->next) {
+ for (sc= bmain->screen.first; sc; sc= sc->id.next) {
+ for (sa= sc->areabase.first; sa; sa= sa->next) {
SpaceLink *sl= sa->spacedata.first;
- for(; sl; sl= sl->next) {
- if(sl->spacetype==SPACE_VIEW3D) {
+ for (; sl; sl= sl->next) {
+ if (sl->spacetype==SPACE_VIEW3D) {
View3D *v3d= (View3D*) sl;
lay |= v3d->lay;
}
@@ -1336,14 +1340,14 @@ static unsigned int free_localbit(Main *bmain)
}
}
- if( (lay & 0x01000000)==0) return 0x01000000;
- if( (lay & 0x02000000)==0) return 0x02000000;
- if( (lay & 0x04000000)==0) return 0x04000000;
- if( (lay & 0x08000000)==0) return 0x08000000;
- if( (lay & 0x10000000)==0) return 0x10000000;
- if( (lay & 0x20000000)==0) return 0x20000000;
- if( (lay & 0x40000000)==0) return 0x40000000;
- if( (lay & 0x80000000)==0) return 0x80000000;
+ if ( (lay & 0x01000000)==0) return 0x01000000;
+ if ( (lay & 0x02000000)==0) return 0x02000000;
+ if ( (lay & 0x04000000)==0) return 0x04000000;
+ if ( (lay & 0x08000000)==0) return 0x08000000;
+ if ( (lay & 0x10000000)==0) return 0x10000000;
+ if ( (lay & 0x20000000)==0) return 0x20000000;
+ if ( (lay & 0x40000000)==0) return 0x40000000;
+ if ( (lay & 0x80000000)==0) return 0x80000000;
return 0;
}
@@ -1353,14 +1357,14 @@ int ED_view3d_scene_layer_set(int lay, const int *values, int *active)
int i, tot= 0;
/* ensure we always have some layer selected */
- for(i=0; i<20; i++)
- if(values[i])
+ for (i=0; i<20; i++)
+ if (values[i])
tot++;
- if(tot==0)
+ if (tot==0)
return lay;
- for(i=0; i<20; i++) {
+ for (i=0; i<20; i++) {
if (active) {
/* if this value has just been switched on, make that layer active */
@@ -1375,8 +1379,8 @@ int ED_view3d_scene_layer_set(int lay, const int *values, int *active)
/* ensure always an active layer */
if (active && (lay & *active)==0) {
- for(i=0; i<20; i++) {
- if(lay & (1<<i)) {
+ for (i=0; i<20; i++) {
+ if (lay & (1<<i)) {
*active= 1<<i;
break;
}
@@ -1394,18 +1398,18 @@ static void initlocalview(Main *bmain, Scene *scene, ScrArea *sa)
unsigned int locallay;
int ok=0;
- if(v3d->localvd) return;
+ if (v3d->localvd) return;
INIT_MINMAX(min, max);
locallay= free_localbit(bmain);
- if(locallay==0) {
+ if (locallay==0) {
printf("Sorry, no more than 8 localviews\n"); // XXX error
ok= 0;
}
else {
- if(scene->obedit) {
+ if (scene->obedit) {
minmax_object(scene->obedit, min, max);
ok= 1;
@@ -1414,8 +1418,8 @@ static void initlocalview(Main *bmain, Scene *scene, ScrArea *sa)
scene->obedit->lay= BASACT->lay;
}
else {
- for(base= FIRSTBASE; base; base= base->next) {
- if(TESTBASE(v3d, base)) {
+ for (base= FIRSTBASE; base; base= base->next) {
+ if (TESTBASE(v3d, base)) {
minmax_object(base->object, min, max);
base->lay |= locallay;
base->object->lay= base->lay;
@@ -1428,18 +1432,18 @@ static void initlocalview(Main *bmain, Scene *scene, ScrArea *sa)
box[1]= (max[1]-min[1]);
box[2]= (max[2]-min[2]);
size= MAX3(box[0], box[1], box[2]);
- if(size <= 0.01f) size= 0.01f;
+ if (size <= 0.01f) size= 0.01f;
}
- if(ok) {
+ if (ok) {
ARegion *ar;
v3d->localvd= MEM_mallocN(sizeof(View3D), "localview");
memcpy(v3d->localvd, v3d, sizeof(View3D));
- for(ar= sa->regionbase.first; ar; ar= ar->next) {
- if(ar->regiontype == RGN_TYPE_WINDOW) {
+ for (ar= sa->regionbase.first; ar; ar= ar->next) {
+ if (ar->regiontype == RGN_TYPE_WINDOW) {
RegionView3D *rv3d= ar->regiondata;
rv3d->localvd= MEM_mallocN(sizeof(RegionView3D), "localview region");
@@ -1451,13 +1455,13 @@ static void initlocalview(Main *bmain, Scene *scene, ScrArea *sa)
rv3d->dist= size;
/* perspective should be a bit farther away to look nice */
- if(rv3d->persp==RV3D_ORTHO)
+ if (rv3d->persp==RV3D_ORTHO)
rv3d->dist*= 0.7f;
// correction for window aspect ratio
- if(ar->winy>2 && ar->winx>2) {
+ if (ar->winy>2 && ar->winx>2) {
float asp= (float)ar->winx/(float)ar->winy;
- if(asp < 1.0f) asp= 1.0f/asp;
+ if (asp < 1.0f) asp= 1.0f/asp;
rv3d->dist*= asp;
}
@@ -1473,11 +1477,11 @@ static void initlocalview(Main *bmain, Scene *scene, ScrArea *sa)
}
else {
/* clear flags */
- for(base= FIRSTBASE; base; base= base->next) {
- if( base->lay & locallay ) {
+ for (base= FIRSTBASE; base; base= base->next) {
+ if ( base->lay & locallay ) {
base->lay-= locallay;
- if(base->lay==0) base->lay= v3d->layact;
- if(base->object != scene->obedit) base->flag |= SELECT;
+ if (base->lay==0) base->lay= v3d->layact;
+ if (base->object != scene->obedit) base->flag |= SELECT;
base->object->lay= base->lay;
}
}
@@ -1490,7 +1494,7 @@ static void restore_localviewdata(ScrArea *sa, int free)
ARegion *ar;
View3D *v3d= sa->spacedata.first;
- if(v3d->localvd==NULL) return;
+ if (v3d->localvd==NULL) return;
v3d->near= v3d->localvd->near;
v3d->far= v3d->localvd->far;
@@ -1499,16 +1503,16 @@ static void restore_localviewdata(ScrArea *sa, int free)
v3d->drawtype= v3d->localvd->drawtype;
v3d->camera= v3d->localvd->camera;
- if(free) {
+ if (free) {
MEM_freeN(v3d->localvd);
v3d->localvd= NULL;
}
- for(ar= sa->regionbase.first; ar; ar= ar->next) {
- if(ar->regiontype == RGN_TYPE_WINDOW) {
+ for (ar= sa->regionbase.first; ar; ar= ar->next) {
+ if (ar->regiontype == RGN_TYPE_WINDOW) {
RegionView3D *rv3d= ar->regiondata;
- if(rv3d->localvd) {
+ if (rv3d->localvd) {
rv3d->dist= rv3d->localvd->dist;
copy_v3_v3(rv3d->ofs, rv3d->localvd->ofs);
copy_qt_qt(rv3d->viewquat, rv3d->localvd->viewquat);
@@ -1516,7 +1520,7 @@ static void restore_localviewdata(ScrArea *sa, int free)
rv3d->persp= rv3d->localvd->persp;
rv3d->camzoom= rv3d->localvd->camzoom;
- if(free) {
+ if (free) {
MEM_freeN(rv3d->localvd);
rv3d->localvd= NULL;
}
@@ -1531,20 +1535,20 @@ static void endlocalview(Main *bmain, Scene *scene, ScrArea *sa)
struct Base *base;
unsigned int locallay;
- if(v3d->localvd) {
+ if (v3d->localvd) {
locallay= v3d->lay & 0xFF000000;
restore_localviewdata(sa, 1); // 1 = free
/* for when in other window the layers have changed */
- if(v3d->scenelock) v3d->lay= scene->lay;
+ if (v3d->scenelock) v3d->lay= scene->lay;
- for(base= FIRSTBASE; base; base= base->next) {
- if( base->lay & locallay ) {
+ for (base= FIRSTBASE; base; base= base->next) {
+ if ( base->lay & locallay ) {
base->lay-= locallay;
- if(base->lay==0) base->lay= v3d->layact;
- if(base->object != scene->obedit) {
+ if (base->lay==0) base->lay= v3d->layact;
+ if (base->object != scene->obedit) {
base->flag |= SELECT;
base->object->flag |= SELECT;
}
@@ -1560,7 +1564,7 @@ static int localview_exec(bContext *C, wmOperator *UNUSED(unused))
{
View3D *v3d= CTX_wm_view3d(C);
- if(v3d->localvd)
+ if (v3d->localvd)
endlocalview(CTX_data_main(C), CTX_data_scene(C), CTX_wm_area(C));
else
initlocalview(CTX_data_main(C), CTX_data_scene(C), CTX_wm_area(C));
@@ -1594,7 +1598,7 @@ static void SaveState(bContext *C, wmWindow *win)
glPushAttrib(GL_ALL_ATTRIB_BITS);
- if(obact && obact->mode & OB_MODE_TEXTURE_PAINT)
+ if (obact && obact->mode & OB_MODE_TEXTURE_PAINT)
GPU_paint_set_mipmap(1);
queue_back= win->queue;
@@ -1608,7 +1612,7 @@ static void RestoreState(bContext *C, wmWindow *win)
{
Object *obact = CTX_data_active_object(C);
- if(obact && obact->mode & OB_MODE_TEXTURE_PAINT)
+ if (obact && obact->mode & OB_MODE_TEXTURE_PAINT)
GPU_paint_set_mipmap(0);
//XXX curarea->win_swap = 0;
@@ -1619,7 +1623,7 @@ static void RestoreState(bContext *C, wmWindow *win)
//XXX waitcursor(0);
//XXX G.qual= 0;
- if(win) /* check because closing win can set to NULL */
+ if (win) /* check because closing win can set to NULL */
win->queue= queue_back;
GPU_state_init();
@@ -1682,11 +1686,11 @@ static int game_engine_poll(bContext *C)
if we try to auto run the BGE. Ideally we want the
context to be set as soon as we load the file. */
- if(CTX_wm_window(C)==NULL) return 0;
- if(CTX_wm_screen(C)==NULL) return 0;
- if(CTX_wm_area(C)==NULL) return 0;
+ if (CTX_wm_window(C)==NULL) return 0;
+ if (CTX_wm_screen(C)==NULL) return 0;
+ if (CTX_wm_area(C)==NULL) return 0;
- if(CTX_data_mode_enum(C)!=CTX_MODE_OBJECT)
+ if (CTX_data_mode_enum(C)!=CTX_MODE_OBJECT)
return 0;
return 1;
@@ -1699,19 +1703,19 @@ int ED_view3d_context_activate(bContext *C)
ARegion *ar;
/* sa can be NULL when called from python */
- if(sa==NULL || sa->spacetype != SPACE_VIEW3D)
- for(sa=sc->areabase.first; sa; sa= sa->next)
- if(sa->spacetype==SPACE_VIEW3D)
+ if (sa==NULL || sa->spacetype != SPACE_VIEW3D)
+ for (sa=sc->areabase.first; sa; sa= sa->next)
+ if (sa->spacetype==SPACE_VIEW3D)
break;
- if(!sa)
+ if (!sa)
return 0;
- for(ar=sa->regionbase.first; ar; ar=ar->next)
- if(ar->regiontype == RGN_TYPE_WINDOW)
+ for (ar=sa->regionbase.first; ar; ar=ar->next)
+ if (ar->regiontype == RGN_TYPE_WINDOW)
break;
- if(!ar)
+ if (!ar)
return 0;
// bad context switch ..
@@ -1734,7 +1738,7 @@ static int game_engine_exec(bContext *C, wmOperator *op)
(void)op; /* unused */
// bad context switch ..
- if(!ED_view3d_context_activate(C))
+ if (!ED_view3d_context_activate(C))
return OPERATOR_CANCELLED;
/* redraw to hide any menus/popups, we don't go back to
@@ -1749,7 +1753,7 @@ static int game_engine_exec(bContext *C, wmOperator *op)
game_set_commmandline_options(&startscene->gm);
- if((rv3d->persp == RV3D_CAMOB) &&
+ if ((rv3d->persp == RV3D_CAMOB) &&
(startscene->gm.framing.type == SCE_GAMEFRAMING_BARS) &&
(startscene->gm.stereoflag != STEREO_DOME))
{
@@ -1775,14 +1779,14 @@ static int game_engine_exec(bContext *C, wmOperator *op)
StartKetsjiShell(C, ar, &cam_frame, 1);
/* window wasnt closed while the BGE was running */
- if(BLI_findindex(&CTX_wm_manager(C)->windows, prevwin) == -1) {
+ if (BLI_findindex(&CTX_wm_manager(C)->windows, prevwin) == -1) {
prevwin= NULL;
CTX_wm_window_set(C, NULL);
}
ED_area_tag_redraw(CTX_wm_area(C));
- if(prevwin) {
+ if (prevwin) {
/* restore context, in case it changed in the meantime, for
example by working in another window or closing it */
CTX_wm_region_set(C, prevar);
@@ -1825,7 +1829,7 @@ void view3d_align_axis_to_vector(View3D *v3d, RegionView3D *rv3d, int axisidx, f
float alignaxis[3] = {0.0, 0.0, 0.0};
float norm[3], axis[3], angle, new_quat[4];
- if(axisidx > 0) alignaxis[axisidx-1]= 1.0;
+ if (axisidx > 0) alignaxis[axisidx-1]= 1.0;
else alignaxis[-axisidx-1]= -1.0;
normalize_v3_v3(norm, vec);
@@ -1847,7 +1851,8 @@ void view3d_align_axis_to_vector(View3D *v3d, RegionView3D *rv3d, int axisidx, f
rv3d->dist= 0.0;
ED_view3d_from_object(v3d->camera, rv3d->ofs, NULL, NULL, &v3d->lens);
smooth_view(NULL, NULL, NULL, NULL, NULL, orig_ofs, new_quat, &orig_dist, &orig_lens); // XXX
- } else {
+ }
+ else {
if (rv3d->persp==RV3D_CAMOB) rv3d->persp= RV3D_PERSP; /* switch out of camera mode */
smooth_view(NULL, NULL, NULL, NULL, NULL, NULL, new_quat, NULL, NULL); // XXX
}
@@ -1883,13 +1888,13 @@ void ED_view3d_operator_properties_viewmat_set(bContext *C, wmOperator *op)
ARegion *ar= CTX_wm_region(C);
RegionView3D *rv3d= ED_view3d_context_rv3d(C);
- if(!RNA_struct_property_is_set(op->ptr, "region_width"))
+ if (!RNA_struct_property_is_set(op->ptr, "region_width"))
RNA_int_set(op->ptr, "region_width", ar->winx);
- if(!RNA_struct_property_is_set(op->ptr, "region_height"))
+ if (!RNA_struct_property_is_set(op->ptr, "region_height"))
RNA_int_set(op->ptr, "region_height", ar->winy);
- if(!RNA_struct_property_is_set(op->ptr, "perspective_matrix"))
+ if (!RNA_struct_property_is_set(op->ptr, "perspective_matrix"))
RNA_float_set_array(op->ptr, "perspective_matrix", (float *)rv3d->persmat);
}