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:
authorJoseph Eagar <joeedh@gmail.com>2011-04-15 05:19:13 +0400
committerJoseph Eagar <joeedh@gmail.com>2011-04-15 05:19:13 +0400
commitc98148a963d37fc2f25e125afeb4cf21df6fbf14 (patch)
tree691a051e27f08e35bf09d35b6fb9c88e4c37b8d2 /source/blender/editors/space_view3d
parent0bba684d08952d0be822f3906ffb2a03b2674cc2 (diff)
parentfa63c297753636c149fbb1a3877d9b3d93601357 (diff)
=bmesh= merge from trunk at r36153
Diffstat (limited to 'source/blender/editors/space_view3d')
-rw-r--r--source/blender/editors/space_view3d/CMakeLists.txt1
-rw-r--r--source/blender/editors/space_view3d/drawanimviz.c5
-rw-r--r--source/blender/editors/space_view3d/drawarmature.c19
-rw-r--r--source/blender/editors/space_view3d/drawmesh.c10
-rw-r--r--source/blender/editors/space_view3d/drawobject.c324
-rw-r--r--source/blender/editors/space_view3d/drawvolume.c5
-rw-r--r--source/blender/editors/space_view3d/space_view3d.c19
-rw-r--r--source/blender/editors/space_view3d/view3d_buttons.c147
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c114
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c69
-rw-r--r--source/blender/editors/space_view3d/view3d_fly.c46
-rw-r--r--source/blender/editors/space_view3d/view3d_header.c66
-rw-r--r--source/blender/editors/space_view3d/view3d_intern.h5
-rw-r--r--source/blender/editors/space_view3d/view3d_ops.c26
-rw-r--r--source/blender/editors/space_view3d/view3d_select.c35
-rw-r--r--source/blender/editors/space_view3d/view3d_snap.c39
-rw-r--r--source/blender/editors/space_view3d/view3d_toolbar.c9
-rw-r--r--source/blender/editors/space_view3d/view3d_view.c131
18 files changed, 574 insertions, 496 deletions
diff --git a/source/blender/editors/space_view3d/CMakeLists.txt b/source/blender/editors/space_view3d/CMakeLists.txt
index 3e611ab406e..8c1ad00742d 100644
--- a/source/blender/editors/space_view3d/CMakeLists.txt
+++ b/source/blender/editors/space_view3d/CMakeLists.txt
@@ -34,6 +34,7 @@ set(INC
../../render/extern/include
../../../../intern/guardedalloc
../../../../intern/smoke/extern
+ ${GLEW_INCLUDE_PATH}
)
set(SRC
diff --git a/source/blender/editors/space_view3d/drawanimviz.c b/source/blender/editors/space_view3d/drawanimviz.c
index 3c72547bd66..ee78fd92b79 100644
--- a/source/blender/editors/space_view3d/drawanimviz.c
+++ b/source/blender/editors/space_view3d/drawanimviz.c
@@ -27,6 +27,11 @@
* ***** END GPL LICENSE BLOCK *****
*/
+/** \file blender/editors/space_view3d/drawanimviz.c
+ * \ingroup spview3d
+ */
+
+
#include <stdlib.h>
#include <string.h>
#include <math.h>
diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c
index 93a08af6903..98bf1e9877f 100644
--- a/source/blender/editors/space_view3d/drawarmature.c
+++ b/source/blender/editors/space_view3d/drawarmature.c
@@ -27,6 +27,11 @@
* ***** END GPL LICENSE BLOCK *****
*/
+/** \file blender/editors/space_view3d/drawarmature.c
+ * \ingroup spview3d
+ */
+
+
#include <stdlib.h>
#include <string.h>
#include <math.h>
@@ -1510,7 +1515,7 @@ static void draw_pose_dofs(Object *ob)
/* arcs */
if (pchan->ikflag & BONE_IK_ZLIMIT) {
/* OpenGL requires rotations in degrees; so we're taking the average angle here */
- theta= 0.5f*(pchan->limitmin[2]+pchan->limitmax[2]) * (float)(180.0f/M_PI);
+ theta= RAD2DEGF(0.5f * (pchan->limitmin[2]+pchan->limitmax[2]));
glRotatef(theta, 0.0f, 0.0f, 1.0f);
glColor3ub(50, 50, 255); // blue, Z axis limit
@@ -1533,7 +1538,7 @@ static void draw_pose_dofs(Object *ob)
if (pchan->ikflag & BONE_IK_XLIMIT) {
/* OpenGL requires rotations in degrees; so we're taking the average angle here */
- theta= 0.5f*(pchan->limitmin[0] + pchan->limitmax[0]) * (float)(180.0f/M_PI);
+ theta= RAD2DEGF(0.5f * (pchan->limitmin[0] + pchan->limitmax[0]));
glRotatef(theta, 1.0f, 0.0f, 0.0f);
glColor3ub(255, 50, 50); // Red, X axis limit
@@ -1591,7 +1596,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
/* hacky... prevent outline select from drawing dashed helplines */
glGetFloatv(GL_LINE_WIDTH, &tmp);
- if (tmp > 1.1) do_dashed &= ~1;
+ if (tmp > 1.1f) do_dashed &= ~1;
if (v3d->flag & V3D_HIDE_HELPLINES) do_dashed &= ~2;
/* precalc inverse matrix for drawing screen aligned */
@@ -1889,7 +1894,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
float vec[3];
unsigned char col[4];
- float col_f[3];
+ float col_f[4];
glGetFloatv(GL_CURRENT_COLOR, col_f); /* incase this is not set below */
rgb_float_to_byte(col_f, col);
col[3]= 255;
@@ -2455,12 +2460,16 @@ int draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base, int dt, in
/* drawing posemode selection indices or colors only in these cases */
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))
arm->flag |= ARM_POSEMODE;
}
- else if(ob->mode & OB_MODE_POSE)
+ else
+#endif
+ if(ob->mode & OB_MODE_POSE) {
arm->flag |= ARM_POSEMODE;
+ }
}
else if(ob->mode & OB_MODE_POSE) {
if (arm->ghosttype == ARM_GHOST_RANGE) {
diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c
index 456e1a390ff..66137520a06 100644
--- a/source/blender/editors/space_view3d/drawmesh.c
+++ b/source/blender/editors/space_view3d/drawmesh.c
@@ -25,6 +25,11 @@
* ***** END GPL LICENSE BLOCK *****
*/
+/** \file blender/editors/space_view3d/drawmesh.c
+ * \ingroup spview3d
+ */
+
+
#include <string.h>
#include <math.h>
@@ -83,7 +88,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)) {
- BLI_edgehash_insert(eh, v0, v1, 0);
+ BLI_edgehash_insert(eh, v0, v1, NULL);
}
flags_p = (int*) BLI_edgehash_lookup_p(eh, v0, v1);
@@ -325,6 +330,7 @@ static int set_draw_settings_cached(int clearcache, int textured, MTFace *texfac
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, spec);
glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
+ glMateriali(GL_FRONT_AND_BACK, GL_SHININESS, CLAMPIS(ma->har, 0, 128));
glEnable(GL_LIGHTING);
glEnable(GL_COLOR_MATERIAL);
}
@@ -378,7 +384,7 @@ static void draw_textured_begin(Scene *scene, View3D *v3d, RegionView3D *rv3d, O
Gtexdraw.istex = istex;
Gtexdraw.color_profile = scene->r.color_mgt_flag & R_COLOR_MANAGEMENT;
memcpy(Gtexdraw.obcol, obcol, sizeof(obcol));
- set_draw_settings_cached(1, 0, 0, Gtexdraw.islit, 0, 0, 0);
+ set_draw_settings_cached(1, 0, NULL, Gtexdraw.islit, NULL, 0, 0);
glShadeModel(GL_SMOOTH);
}
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 11a1658b30d..48923cc9593 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -25,6 +25,11 @@
* ***** END GPL LICENSE BLOCK *****
*/
+/** \file blender/editors/space_view3d/drawobject.c
+ * \ingroup spview3d
+ */
+
+
#include <string.h>
#include <math.h>
@@ -150,16 +155,16 @@ static void view3d_project_short_clip(ARegion *ar, float *vec, short *adr, int l
mul_m4_v4(rv3d->persmatob, vec4);
/* clipplanes in window space */
- if( vec4[3]>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) {
fy= (ar->winy/2)*(1 + vec4[1]/vec4[3]);
- if(fy>0.0 && fy< (float)ar->winy) {
- adr[0]= (short)floor(fx);
- adr[1]= (short)floor(fy);
+ if(fy > 0.0f && fy < (float)ar->winy) {
+ adr[0]= (short)floorf(fx);
+ adr[1]= (short)floorf(fy);
}
}
}
@@ -178,16 +183,16 @@ static void view3d_project_short_noclip(ARegion *ar, float *vec, short *adr)
mul_m4_v4(rv3d->persmatob, vec4);
- if( vec4[3]>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) {
fy= (ar->winy/2)*(1 + vec4[1]/vec4[3]);
- if(fy>-32700.0 && fy<32700.0) {
- adr[0]= (short)floor(fx);
- adr[1]= (short)floor(fy);
+ if(fy > -32700.0f && fy < 32700.0f) {
+ adr[0]= (short)floorf(fx);
+ adr[1]= (short)floorf(fy);
}
}
}
@@ -322,7 +327,7 @@ static float cosval[32] ={
static void draw_xyz_wire(const float c[3], float size, int axis)
{
float v1[3]= {0.f, 0.f, 0.f}, v2[3] = {0.f, 0.f, 0.f};
- float dim = size * 0.1;
+ float dim = size * 0.1f;
float dx[3], dy[3], dz[3];
dx[0]=dim; dx[1]=0.f; dx[2]=0.f;
@@ -441,9 +446,9 @@ void drawaxes(float size, char drawtype)
/* square pyramid */
glBegin(GL_TRIANGLES);
- v2[0]= size*0.035; v2[1] = size*0.035;
- v3[0]= size*-0.035; v3[1] = size*0.035;
- v2[2]= v3[2]= size*0.75;
+ v2[0]= size * 0.035f; v2[1] = size * 0.035f;
+ v3[0]= size * -0.035f; v3[1] = size * 0.035f;
+ v2[2]= v3[2]= size * 0.75f;
for (axis=0; axis<4; axis++) {
if (axis % 2 == 1) {
@@ -489,18 +494,18 @@ void drawaxes(float size, char drawtype)
glVertex3fv(v1);
glVertex3fv(v2);
- v1[axis]= size*0.85;
- v1[arrow_axis]= -size*0.08;
+ v1[axis]= size*0.85f;
+ v1[arrow_axis]= -size*0.08f;
glVertex3fv(v1);
glVertex3fv(v2);
- v1[arrow_axis]= size*0.08;
+ v1[arrow_axis]= size*0.08f;
glVertex3fv(v1);
glVertex3fv(v2);
glEnd();
- v2[axis]+= size*0.125;
+ v2[axis]+= size*0.125f;
draw_xyz_wire(v2, size, axis);
@@ -572,6 +577,7 @@ typedef struct ViewCachedString {
short mval[2];
short xoffs;
short flag;
+ int str_len, pad;
/* str is allocated past the end */
} ViewCachedString;
@@ -593,6 +599,7 @@ void view3d_cached_text_draw_add(const float co[3], const char *str, short xoffs
vos->col.pack= *((int *)col);
vos->xoffs= xoffs;
vos->flag= flag;
+ vos->str_len= alloc_len-1;
/* allocate past the end */
memcpy(++vos, str, alloc_len);
@@ -658,10 +665,10 @@ void view3d_cached_text_draw_end(View3D *v3d, ARegion *ar, int depth_write, floa
col_pack_prev= vos->col.pack;
}
if(vos->flag & V3D_CACHE_TEXT_ASCII) {
- BLF_draw_default_ascii((float)vos->mval[0]+vos->xoffs, (float)vos->mval[1], (depth_write)? 0.0f: 2.0f, str, 65535); /* XXX, use real length */
+ BLF_draw_default_ascii((float)vos->mval[0]+vos->xoffs, (float)vos->mval[1], (depth_write)? 0.0f: 2.0f, str, vos->str_len);
}
else {
- BLF_draw_default((float)vos->mval[0]+vos->xoffs, (float)vos->mval[1], (depth_write)? 0.0f: 2.0f, str, 65535); /* XXX, use real length */
+ BLF_draw_default((float)vos->mval[0]+vos->xoffs, (float)vos->mval[1], (depth_write)? 0.0f: 2.0f, str, vos->str_len);
}
}
}
@@ -819,7 +826,7 @@ static void spotvolume(float *lvec, float *vvec, float inp)
q[3] = 0 ;
normalize_v3(&q[1]);
- angle = saacos(plane[2])/2.0;
+ angle = saacos(plane[2])/2.0f;
co = cos(angle);
si = sqrt(1-co*co);
@@ -876,7 +883,7 @@ static void draw_spot_cone(Lamp *la, float x, float z)
for(a=0; a<33; a++) {
angle= a*M_PI*2/(33-1);
- glVertex3f(z*cos(angle), z*sin(angle), 0);
+ glVertex3f(z*cosf(angle), z*sinf(angle), 0);
}
}
@@ -996,7 +1003,7 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
short axis;
/* setup a 45 degree rotation matrix */
- vec_rot_to_mat3( mat,imat[2], M_PI/4.0f);
+ vec_rot_to_mat3(mat, imat[2], (float)M_PI/4.0f);
/* vectors */
mul_v3_v3fl(v1, imat[0], circrad * 1.2f);
@@ -1043,7 +1050,7 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
vvec[1]= x*ob->obmat[1][0] + y*ob->obmat[1][1] + z*ob->obmat[1][2];
vvec[2]= x*ob->obmat[2][0] + y*ob->obmat[2][1] + z*ob->obmat[2][2];
- y = cos( M_PI*la->spotsize/360.0 );
+ y = cosf(la->spotsize*(float)(M_PI/360.0));
spotvolume(lvec, vvec, y);
x = -la->dist;
mul_v3_fl(lvec, x);
@@ -1056,7 +1063,7 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
glVertex3fv(lvec);
glEnd();
- z = x*sqrt(1.0 - y*y);
+ z = x*sqrtf(1.0f - y*y);
x *= y;
/* draw the circle/square at the end of the cone */
@@ -1078,7 +1085,7 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
glVertex3fv(tvec);
glEnd();
}
- else circ(0.0, 0.0, fabs(z));
+ else circ(0.0, 0.0, fabsf(z));
/* draw the circle/square representing spotbl */
if(la->type==LA_SPOT) {
@@ -1086,7 +1093,7 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
/* hide line if it is zero size or overlaps with outer border,
previously it adjusted to always to show it but that seems
confusing because it doesn't show the actual blend size */
- if (spotblcirc != 0 && spotblcirc != fabs(z))
+ if (spotblcirc != 0 && spotblcirc != fabsf(z))
circ(0.0, 0.0, spotblcirc);
}
@@ -1160,9 +1167,9 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
} else if(la->type==LA_AREA) {
setlinestyle(3);
if(la->area_shape==LA_AREA_SQUARE)
- fdrawbox(-la->area_size*0.5, -la->area_size*0.5, la->area_size*0.5, la->area_size*0.5);
+ 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)
- fdrawbox(-la->area_size*0.5, -la->area_sizey*0.5, la->area_size*0.5, la->area_sizey*0.5);
+ 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);
glVertex3f(0.0,0.0,-circrad);
@@ -1282,7 +1289,7 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob
if(is_view) {
/* fixed depth, variable size (avoids exceeding clipping range) */
- depth = -(cam->clipsta + 0.1);
+ depth = -(cam->clipsta + 0.1f);
fac = depth / (cam->lens/-16.0f * scaz);
}
else {
@@ -1337,15 +1344,15 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob
else if (i==1 && (ob == v3d->camera)) glBegin(GL_TRIANGLES);
else break;
- vec[0][0]= shx + ((-0.7 * drawsize) * scax);
- vec[0][1]= shy + ((drawsize * (caspy + 0.1)) * scay);
+ vec[0][0]= shx + ((-0.7f * drawsize) * scax);
+ vec[0][1]= shy + ((drawsize * (caspy + 0.1f)) * scay);
glVertex3fv(vec[0]); /* left */
- vec[0][0]= shx + ((0.7 * drawsize) * scax);
+ vec[0][0]= shx + ((0.7f * drawsize) * scax);
glVertex3fv(vec[0]); /* right */
vec[0][0]= shx;
- vec[0][1]= shy + ((1.1 * drawsize * (caspy + 0.7)) * scay);
+ vec[0][1]= shy + ((1.1f * drawsize * (caspy + 0.7f)) * scay);
glVertex3fv(vec[0]); /* top */
glEnd();
@@ -2102,7 +2109,7 @@ static int draw_dm_creases__setDrawOptions(void *userData, int index)
if (!crease)
return 0;
- if (!BM_TestHFlag(eed, BM_HIDDEN) && *crease!=0.0) {
+ if (!BM_TestHFlag(eed, BM_HIDDEN) && *crease!=0.0f) {
UI_ThemeColorBlend(TH_WIRE, TH_EDGE_CREASE, *crease);
return 1;
} else {
@@ -2125,7 +2132,7 @@ static int draw_dm_bweights__setDrawOptions(void *userData, int index)
if (!bweight)
return 0;
- if (!BM_TestHFlag(eed, BM_HIDDEN) && *bweight!=0.0) {
+ if (!BM_TestHFlag(eed, BM_HIDDEN) && *bweight!=0.0f) {
UI_ThemeColorBlend(TH_WIRE, TH_EDGE_SELECT, *bweight);
return 1;
} else {
@@ -2141,7 +2148,7 @@ static void draw_dm_bweights__mapFunc(void *userData, int index, float *co, floa
if (!bweight)
return;
- if (!BM_TestHFlag(eve, BM_HIDDEN) && *bweight!=0.0) {
+ if (!BM_TestHFlag(eve, BM_HIDDEN) && *bweight!=0.0f) {
UI_ThemeColorBlend(TH_VERTEX, TH_VERTEX_SELECT, *bweight);
bglVertex3fv(co);
}
@@ -2200,8 +2207,8 @@ static void draw_em_fancy_verts(Scene *scene, View3D *v3d, Object *obedit,
continue;
}
- size = (size>2.1?size/2.0:size);
- fsize = (fsize>2.1?fsize/2.0:fsize);
+ size = (size > 2.1f ? size/2.0f:size);
+ fsize = (fsize > 2.1f ? fsize/2.0f:fsize);
col[3] = fcol[3] = 100;
} else {
col[3] = fcol[3] = 255;
@@ -2301,7 +2308,7 @@ static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d,
float fvec[3];
char val[32]; /* Stores the measurement display text here */
const char *conv_float; /* Use a float conversion matching the grid size */
- unsigned char col[3]; /* color of the text to draw */
+ unsigned char col[4]= {0, 0, 0, 255}; /* color of the text to draw */
float area; /* area of the face */
float grid= unit->system ? unit->scale_length : v3d->grid;
const int do_split= unit->flag & USER_UNIT_OPT_SPLIT;
@@ -2340,7 +2347,7 @@ static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d,
bUnit_AsString(val, sizeof(val), len_v3v3(v1, v2)*unit->scale_length, 3, unit->system, B_UNIT_LENGTH, do_split, FALSE);
else
sprintf(val, conv_float, len_v3v3(v1, v2));
-
+
view3d_cached_text_draw_add(vmid, val, 0, V3D_CACHE_TEXT_ASCII, col);
}
}
@@ -2409,29 +2416,29 @@ static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d,
if( (e4->f & e1->f & SELECT) || (do_moving && (efa->v1->f & SELECT)) ) {
/* Vec 1 */
- sprintf(val,"%.3g", RAD2DEG(angle_v3v3v3(v4, v1, v2)));
+ sprintf(val,"%.3g", RAD2DEGF(angle_v3v3v3(v4, v1, v2)));
interp_v3_v3v3(fvec, efa->cent, efa->v1->co, 0.8f);
view3d_cached_text_draw_add(fvec, val, 0, V3D_CACHE_TEXT_ASCII, col);
}
if( (e1->f & e2->f & SELECT) || (do_moving && (efa->v2->f & SELECT)) ) {
/* Vec 2 */
- sprintf(val,"%.3g", RAD2DEG(angle_v3v3v3(v1, v2, v3)));
+ sprintf(val,"%.3g", RAD2DEGF(angle_v3v3v3(v1, v2, v3)));
interp_v3_v3v3(fvec, efa->cent, efa->v2->co, 0.8f);
view3d_cached_text_draw_add(fvec, val, 0, V3D_CACHE_TEXT_ASCII, col);
}
if( (e2->f & e3->f & SELECT) || (do_moving && (efa->v3->f & SELECT)) ) {
/* Vec 3 */
if(efa->v4)
- sprintf(val,"%.3g", RAD2DEG(angle_v3v3v3(v2, v3, v4)));
+ sprintf(val,"%.3g", RAD2DEGF(angle_v3v3v3(v2, v3, v4)));
else
- sprintf(val,"%.3g", RAD2DEG(angle_v3v3v3(v2, v3, v1)));
+ sprintf(val,"%.3g", RAD2DEGF(angle_v3v3v3(v2, v3, v1)));
interp_v3_v3v3(fvec, efa->cent, efa->v3->co, 0.8f);
view3d_cached_text_draw_add(fvec, val, 0, V3D_CACHE_TEXT_ASCII, col);
}
/* Vec 4 */
if(efa->v4) {
if( (e3->f & e4->f & SELECT) || (do_moving && (efa->v4->f & SELECT)) ) {
- sprintf(val,"%.3g", RAD2DEG(angle_v3v3v3(v3, v4, v1)));
+ sprintf(val,"%.3g", RAD2DEGF(angle_v3v3v3(v3, v4, v1)));
interp_v3_v3v3(fvec, efa->cent, efa->v4->co, 0.8f);
view3d_cached_text_draw_add(fvec, val, 0, V3D_CACHE_TEXT_ASCII, col);
}
@@ -2649,7 +2656,7 @@ static void draw_mesh_object_outline(View3D *v3d, Object *ob, DerivedMesh *dm)
{
if(v3d->transp==0) { // not when we draw the transparent pass
- glLineWidth(2.0);
+ 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.
@@ -3332,12 +3339,12 @@ static int drawCurveDerivedMesh(Scene *scene, View3D *v3d, RegionView3D *rv3d, B
static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, int dt)
{
Object *ob= base->object;
- ListBase *lb=0;
+ ListBase *lb=NULL;
DispList *dl;
Curve *cu;
- int solid, retval= 0;
-
- solid= (dt > OB_WIRE);
+ const short render_only= (v3d->flag2 & V3D_RENDER_OVERRIDE);
+ const short solid= (dt > OB_WIRE);
+ int retval= 0;
if (drawCurveDerivedMesh(scene, v3d, rv3d, base, dt) == 0) {
return 0;
@@ -3354,13 +3361,15 @@ static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *bas
dl= lb->first;
if(dl==NULL) return 1;
- if(dl->nors==0) addnormalsDispList(lb);
+ if(dl->nors==NULL) addnormalsDispList(lb);
index3_nors_incr= 0;
if( displist_has_faces(lb)==0) {
- draw_index_wire= 0;
- drawDispListwire(lb);
- draw_index_wire= 1;
+ if(!render_only) {
+ draw_index_wire= 0;
+ drawDispListwire(lb);
+ draw_index_wire= 1;
+ }
}
else {
if(draw_glsl_material(scene, ob, v3d, dt)) {
@@ -3369,7 +3378,7 @@ static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *bas
GPU_end_object_materials();
}
else if(dt == OB_SHADED) {
- if(ob->disp.first==0) shadeDispList(scene, base);
+ if(ob->disp.first==NULL) shadeDispList(scene, base);
drawDispListshaded(lb, ob);
}
else {
@@ -3378,7 +3387,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.0 && cu->ext2 == 0.0) {
+ 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);
@@ -3388,9 +3397,11 @@ static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *bas
index3_nors_incr= 1;
}
else {
- draw_index_wire= 0;
- retval= drawDispListwire(lb);
- draw_index_wire= 1;
+ if(!render_only || (render_only && displist_has_faces(lb))) {
+ draw_index_wire= 0;
+ retval= drawDispListwire(lb);
+ draw_index_wire= 1;
+ }
}
break;
case OB_SURF:
@@ -3439,7 +3450,7 @@ static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *bas
}
else if(dt == OB_SHADED) {
dl= lb->first;
- if(dl && dl->col1==0) shadeDispList(scene, base);
+ if(dl && dl->col1==NULL) shadeDispList(scene, base);
drawDispListshaded(lb, ob);
}
else {
@@ -3652,14 +3663,14 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
ParticleEditSettings *pset = PE_settings(scene);
ParticleSettings *part;
ParticleData *pars, *pa;
- ParticleKey state, *states=0;
+ ParticleKey state, *states=NULL;
ParticleBillboardData bb;
- ParticleSimulationData sim= {0};
+ ParticleSimulationData sim= {NULL};
ParticleDrawData *pdd = psys->pdd;
Material *ma;
float vel[3], imat[4][4];
float timestep, pixsize=1.0, pa_size, r_tilt, r_length;
- float pa_time, pa_birthtime, pa_dietime, pa_health;
+ float pa_time, pa_birthtime, pa_dietime, pa_health, intensity;
float cfra;
float ma_r=0.0f, ma_g=0.0f, ma_b=0.0f;
int a, totpart, totpoint=0, totve=0, drawn, draw_as, totchild=0;
@@ -3669,16 +3680,16 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
unsigned char tcol[4]= {0, 0, 0, 255};
/* 1. */
- if(psys==0)
+ if(psys==NULL)
return;
part=psys->part;
pars=psys->particles;
- if(part==0 || !psys_check_enabled(ob, psys))
+ if(part==NULL || !psys_check_enabled(ob, psys))
return;
- if(pars==0) 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)
@@ -3723,7 +3734,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
if(v3d->zbuf) glDepthMask(1);
- if((ma) && (part->draw&PART_DRAW_MAT_COL)) {
+ if((ma) && (part->draw_col == PART_DRAW_COL_MAT)) {
rgb_float_to_byte(&(ma->r), tcol);
ma_r = ma->r;
@@ -3746,7 +3757,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
totpart=psys->totpart;
- cfra=bsystem_time(scene, 0, (float)CFRA, 0.0f);
+ cfra= bsystem_time(scene, NULL, (float)CFRA, 0.0f);
if(draw_as==PART_DRAW_PATH && psys->pathcache==NULL && psys->childcache==NULL)
draw_as=PART_DRAW_DOT;
@@ -3771,7 +3782,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
pixsize= view3d_pixel_size(rv3d, ob->obmat[3]);
if(part->draw_size==0.0)
- pixsize*=2.0;
+ pixsize *= 2.0f;
else
pixsize*=part->draw_size;
@@ -3779,19 +3790,19 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
create_cdata = 1;
break;
case PART_DRAW_OB:
- if(part->dup_ob==0)
+ if(part->dup_ob==NULL)
draw_as=PART_DRAW_DOT;
else
draw_as=0;
break;
case PART_DRAW_GR:
- if(part->dup_group==0)
+ if(part->dup_group==NULL)
draw_as=PART_DRAW_DOT;
else
draw_as=0;
break;
case PART_DRAW_BB:
- if(v3d->camera==0 && part->bb_ob==0){
+ 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;
@@ -3824,6 +3835,10 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
normalize_v3(imat[1]);
}
+ 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) {
MEM_freeN(pdd->cdata);
pdd->cdata = pdd->cd = NULL;
@@ -3866,7 +3881,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
if(create_cdata && !pdd->cdata)
pdd->cdata = MEM_callocN(tot_vec_size, "particle_cdata");
if(create_ndata && !pdd->ndata)
- pdd->ndata = MEM_callocN(tot_vec_size, "particle_vdata");
+ pdd->ndata = MEM_callocN(tot_vec_size, "particle_ndata");
if(part->draw & PART_DRAW_VEL && draw_as != PART_DRAW_LINE) {
if(!pdd->vedata)
@@ -3921,66 +3936,27 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
else
pa_health = -1.0;
-#if 0 // XXX old animation system
- if((part->flag&PART_ABS_TIME)==0){
- if(ma && ma->ipo){
- IpoCurve *icu;
-
- /* correction for lifetime */
- calc_ipo(ma->ipo, 100.0f*pa_time);
-
- for(icu = ma->ipo->curve.first; icu; icu=icu->next) {
- if(icu->adrcode == MA_COL_R)
- ma_r = icu->curval;
- else if(icu->adrcode == MA_COL_G)
- ma_g = icu->curval;
- else if(icu->adrcode == MA_COL_B)
- ma_b = icu->curval;
- }
- }
- if(part->ipo) {
- IpoCurve *icu;
-
- /* correction for lifetime */
- calc_ipo(part->ipo, 100*pa_time);
+ r_tilt = 2.0f*(PSYS_FRAND(a + 21) - 0.5f);
+ r_length = PSYS_FRAND(a + 22);
- for(icu = part->ipo->curve.first; icu; icu=icu->next) {
- if(icu->adrcode == PART_SIZE)
- pa_size = icu->curval;
- }
+ 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;
+ break;
+ case PART_DRAW_COL_ACC:
+ intensity = len_v3v3(pa->state.vel, pa->prev_state.vel)/((pa->state.time-pa->prev_state.time)*part->color_vec_max);
+ break;
}
+ CLAMP(intensity, 0.f, 1.f);
+ weight_to_rgb(intensity, &ma_r, &ma_g, &ma_b);
}
-#endif // XXX old animation system
-
- r_tilt = 2.0f*(PSYS_FRAND(a + 21) - 0.5f);
- r_length = PSYS_FRAND(a + 22);
}
else{
ChildParticle *cpa= &psys->child[a-totpart];
pa_time=psys_get_child_time(psys,cpa,cfra,&pa_birthtime,&pa_dietime);
-
-#if 0 // XXX old animation system
- if((part->flag&PART_ABS_TIME)==0) {
- if(ma && ma->ipo){
- IpoCurve *icu;
-
- /* correction for lifetime */
- calc_ipo(ma->ipo, 100.0f*pa_time);
-
- for(icu = ma->ipo->curve.first; icu; icu=icu->next) {
- if(icu->adrcode == MA_COL_R)
- ma_r = icu->curval;
- else if(icu->adrcode == MA_COL_G)
- ma_g = icu->curval;
- else if(icu->adrcode == MA_COL_B)
- ma_b = icu->curval;
- }
- }
- }
-#endif // XXX old animation system
-
- pa_size=psys_get_child_size(psys,cpa,cfra,0);
+ pa_size=psys_get_child_size(psys,cpa,cfra,NULL);
pa_health = -1.0;
@@ -3990,8 +3966,8 @@ 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) {
- float length = part->path_end * (1.0 - part->randlength * r_length);
- int trail_count = part->trail_count * (1.0 - part->randlength * r_length);
+ 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;
float dt = length / (trail_count ? (float)trail_count : 1.0f);
int i=0;
@@ -4099,13 +4075,13 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
if(draw_as==PART_DRAW_PATH){
ParticleCacheKey **cache, *path;
- float *cd2=0,*cdata2=0;
+ float *cd2=NULL,*cdata2=NULL;
/* setup gl flags */
if (1) { //ob_dt > OB_WIRE) {
glEnableClientState(GL_NORMAL_ARRAY);
- if(part->draw&PART_DRAW_MAT_COL)
+ if(part->draw_col == PART_DRAW_COL_MAT)
glEnableClientState(GL_COLOR_ARRAY);
glEnable(GL_LIGHTING);
@@ -4134,7 +4110,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
if(1) { //ob_dt > OB_WIRE) {
glNormalPointer(GL_FLOAT, sizeof(ParticleCacheKey), path->vel);
- if(part->draw&PART_DRAW_MAT_COL)
+ if(part->draw_col == PART_DRAW_COL_MAT)
glColorPointer(3, GL_FLOAT, sizeof(ParticleCacheKey), path->col);
}
@@ -4150,7 +4126,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
if(1) { //ob_dt > OB_WIRE) {
glNormalPointer(GL_FLOAT, sizeof(ParticleCacheKey), path->vel);
- if(part->draw&PART_DRAW_MAT_COL)
+ if(part->draw_col == PART_DRAW_COL_MAT)
glColorPointer(3, GL_FLOAT, sizeof(ParticleCacheKey), path->col);
}
@@ -4160,14 +4136,14 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
/* restore & clean up */
if(1) { //ob_dt > OB_WIRE) {
- if(part->draw&PART_DRAW_MAT_COL)
+ if(part->draw_col == PART_DRAW_COL_MAT)
glDisable(GL_COLOR_ARRAY);
glDisable(GL_COLOR_MATERIAL);
}
if(cdata2)
MEM_freeN(cdata2);
- cd2=cdata2=0;
+ cd2=cdata2=NULL;
glLineWidth(1.0f);
@@ -4287,7 +4263,7 @@ static void draw_update_ptcache_edit(Scene *scene, Object *ob, PTCacheEdit *edit
PE_update_object(scene, ob, 0);
/* create path and child path cache if it doesn't exist already */
- if(edit->pathcache==0)
+ if(edit->pathcache == NULL)
psys_cache_edit_paths(scene, ob, edit, CFRA);
}
@@ -4303,7 +4279,7 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, PTCacheEdit *edit)
float nosel_col[3];
float *pathcol = NULL, *pcol;
- if(edit->pathcache==0)
+ if(edit->pathcache == NULL)
return;
PE_hide_keys_time(scene, edit, CFRA);
@@ -4343,7 +4319,7 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, PTCacheEdit *edit)
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 - fabs((float)CFRA - pkey->time)/(float)pset->fade_frames;
+ pcol[3] = 1.0f - fabsf((float)(CFRA) - pkey->time)/(float)pset->fade_frames;
}
glColorPointer(4, GL_FLOAT, 4*sizeof(float), pathcol);
@@ -4362,8 +4338,8 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, PTCacheEdit *edit)
glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE));
if(pset->selectmode==SCE_SELECT_POINT){
- float *pd=0,*pdata=0;
- float *cd=0,*cdata=0;
+ float *pd=NULL,*pdata=NULL;
+ float *cd=NULL,*cdata=NULL;
int totkeys = 0;
for (i=0, point=edit->points; i<totpoint; i++, point++)
@@ -4392,7 +4368,7 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, PTCacheEdit *edit)
}
if(timed)
- *(cd+3) = 1.0f - fabs((float)CFRA - *key->time)/(float)pset->fade_frames;
+ *(cd+3) = 1.0f - fabsf((float)CFRA - *key->time)/(float)pset->fade_frames;
cd += (timed?4:3);
}
@@ -4415,8 +4391,8 @@ 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=0; }
- if(cdata) { MEM_freeN(cdata); cd=cdata=0; }
+ 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++){
@@ -4986,7 +4962,7 @@ static void drawnurb(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
/* direction vectors for 3d curve paths
when at its lowest, dont render normals */
- if(cu->flag & CU_3D && ts->normalsize > 0.0015 && (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) {
@@ -5083,7 +5059,7 @@ static void draw_empty_cone (float size)
radius = size;
glTranslatef(cent,cent, cent);
- glScalef(radius, 2.0*size, radius);
+ glScalef(radius, size * 2.0f, radius);
glRotatef(-90., 1.0, 0.0, 0.0);
gluCylinder(qobj, 1.0, 0.0, 1.0, 8, 1);
@@ -5312,7 +5288,7 @@ static int drawmball(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
ml->selcol2= code;
glLoadName(code++);
}
- drawcircball(GL_LINE_LOOP, &(ml->x), ml->rad*atan(ml->s)/M_PI_2, imat);
+ drawcircball(GL_LINE_LOOP, &(ml->x), ml->rad*atanf(ml->s)/(float)M_PI_2, imat);
}
ml= ml->next;
@@ -5354,15 +5330,15 @@ static void draw_forcefield(Scene *scene, Object *ob, RegionView3D *rv3d)
// force_val = IPO_GetFloatValue(ob->ipo, OB_PD_FSTR, scene->r.cfra);
//else
force_val = pd->f_strength;
- force_val*= 0.1;
+ force_val *= 0.1f;
drawcircball(GL_LINE_LOOP, vec, size, tmat);
- vec[2]= 0.5*force_val;
+ vec[2]= 0.5f * force_val;
drawcircball(GL_LINE_LOOP, vec, size, tmat);
- vec[2]= 1.0*force_val;
+ vec[2]= 1.0f * force_val;
drawcircball(GL_LINE_LOOP, vec, size, tmat);
- vec[2]= 1.5*force_val;
+ vec[2]= 1.5f * force_val;
drawcircball(GL_LINE_LOOP, vec, size, tmat);
- vec[2] = 0; /* reset vec for max dist circle */
+ vec[2] = 0.0f; /* reset vec for max dist circle */
}
else if (pd->forcefield == PFIELD_FORCE) {
@@ -5375,33 +5351,33 @@ static void draw_forcefield(Scene *scene, Object *ob, RegionView3D *rv3d)
UI_ThemeColorBlend(curcol, TH_BACK, 0.5);
drawcircball(GL_LINE_LOOP, vec, size, imat);
- UI_ThemeColorBlend(curcol, TH_BACK, 0.9 - 0.4 / pow(1.5, (double)ffall_val));
- drawcircball(GL_LINE_LOOP, vec, size*1.5, imat);
- UI_ThemeColorBlend(curcol, TH_BACK, 0.9 - 0.4 / pow(2.0, (double)ffall_val));
- drawcircball(GL_LINE_LOOP, vec, size*2.0, imat);
+ UI_ThemeColorBlend(curcol, TH_BACK, 0.9f - 0.4f / powf(1.5f, ffall_val));
+ drawcircball(GL_LINE_LOOP, vec, size * 1.5f, imat);
+ UI_ThemeColorBlend(curcol, TH_BACK, 0.9f - 0.4f / powf(2.0f, ffall_val));
+ drawcircball(GL_LINE_LOOP, vec, size*2.0f, imat);
}
else if (pd->forcefield == PFIELD_VORTEX) {
- float ffall_val, force_val;
+ float /*ffall_val,*/ force_val;
unit_m4(tmat);
//if (has_ipo_code(ob->ipo, OB_PD_FFALL))
// ffall_val = IPO_GetFloatValue(ob->ipo, OB_PD_FFALL, scene->r.cfra);
//else
- ffall_val = pd->f_power;
+ // ffall_val = pd->f_power;
//if (has_ipo_code(ob->ipo, OB_PD_FSTR))
// force_val = IPO_GetFloatValue(ob->ipo, OB_PD_FSTR, scene->r.cfra);
//else
force_val = pd->f_strength;
- UI_ThemeColorBlend(curcol, TH_BACK, 0.7);
+ UI_ThemeColorBlend(curcol, TH_BACK, 0.7f);
if (force_val < 0) {
- drawspiral(vec, size*1.0, tmat, 1);
- drawspiral(vec, size*1.0, tmat, 16);
+ drawspiral(vec, size, tmat, 1);
+ drawspiral(vec, size, tmat, 16);
}
else {
- drawspiral(vec, size*1.0, tmat, -1);
- drawspiral(vec, size*1.0, tmat, -16);
+ drawspiral(vec, size, tmat, -1);
+ drawspiral(vec, size, tmat, -16);
}
}
else if (pd->forcefield == PFIELD_GUIDE && ob->type==OB_CURVE) {
@@ -5473,9 +5449,9 @@ static void draw_forcefield(Scene *scene, Object *ob, RegionView3D *rv3d)
distance=(pd->flag&PFIELD_USEMAX)?pd->maxdist:0.0f;
if(pd->flag & (PFIELD_USEMAX|PFIELD_USEMAXR)){
- drawcone(vec,distance*sin(radius),distance*cos(radius),tmat);
+ drawcone(vec, distance * sinf(radius),distance * cosf(radius), tmat);
if((pd->flag & PFIELD_POSZ)==0)
- drawcone(vec,distance*sin(radius),-distance*cos(radius),tmat);
+ drawcone(vec, distance * sinf(radius),-distance * cosf(radius),tmat);
}
radius=(pd->flag&PFIELD_USEMINR)?pd->minrad:1.0f;
@@ -5483,9 +5459,9 @@ static void draw_forcefield(Scene *scene, Object *ob, RegionView3D *rv3d)
distance=(pd->flag&PFIELD_USEMIN)?pd->mindist:0.0f;
if(pd->flag & (PFIELD_USEMIN|PFIELD_USEMINR)){
- drawcone(vec,distance*sin(radius),distance*cos(radius),tmat);
+ drawcone(vec,distance*sinf(radius),distance*cosf(radius),tmat);
if((pd->flag & PFIELD_POSZ)==0)
- drawcone(vec,distance*sin(radius),-distance*cos(radius),tmat);
+ drawcone(vec, distance * sinf(radius), -distance * cosf(radius), tmat);
}
}
setlinestyle(0);
@@ -5535,13 +5511,13 @@ static void draw_bb_quadric(BoundBox *bb, short type)
gluQuadricDrawStyle(qobj, GLU_SILHOUETTE);
- size[0]= 0.5*fabs(bb->vec[0][0] - bb->vec[4][0]);
- size[1]= 0.5*fabs(bb->vec[0][1] - bb->vec[2][1]);
- size[2]= 0.5*fabs(bb->vec[0][2] - bb->vec[1][2]);
+ size[0]= 0.5f*fabsf(bb->vec[0][0] - bb->vec[4][0]);
+ size[1]= 0.5f*fabsf(bb->vec[0][1] - bb->vec[2][1]);
+ size[2]= 0.5f*fabsf(bb->vec[0][2] - bb->vec[1][2]);
- cent[0]= (bb->vec[0][0] + bb->vec[4][0])/2.0;
- cent[1]= (bb->vec[0][1] + bb->vec[2][1])/2.0;
- cent[2]= (bb->vec[0][2] + bb->vec[1][2])/2.0;
+ cent[0]= 0.5f*(bb->vec[0][0] + bb->vec[4][0]);
+ cent[1]= 0.5f*(bb->vec[0][1] + bb->vec[2][1]);
+ cent[2]= 0.5f*(bb->vec[0][2] + bb->vec[1][2]);
glPushMatrix();
if(type==OB_BOUND_SPHERE) {
@@ -5552,13 +5528,13 @@ static void draw_bb_quadric(BoundBox *bb, short type)
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.0*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) {
float radius = size[0] > size[1] ? size[0] : size[1];
glTranslatef(cent[0], cent[2]-size[2], cent[1]);
- glScalef(radius, 2.0*size[2], radius);
+ glScalef(radius, 2.0f * size[2], radius);
glRotatef(-90., 1.0, 0.0, 0.0);
gluCylinder(qobj, 1.0, 0.0, 1.0, 8, 1);
}
@@ -6067,7 +6043,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
drawDispList(scene, v3d, rv3d, base, dt);
}
- if (cu->linewidth != 0.0) {
+ if (cu->linewidth != 0.0f) {
cpack(0xff44ff);
UI_ThemeColor(TH_WIRE);
copy_v3_v3(vec1, ob->orig);
@@ -6086,7 +6062,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
setlinestyle(3);
for (i=0; i<cu->totbox; i++) {
- if (cu->tb[i].w != 0.0) {
+ if (cu->tb[i].w != 0.0f) {
if (i == (cu->actbox-1))
UI_ThemeColor(TH_ACTIVE);
else
@@ -6214,7 +6190,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
if(ob->soft /*&& flag & OB_SBMOTION*/){
float mrt[3][3],msc[3][3],mtr[3][3];
- SoftBody *sb = 0;
+ SoftBody *sb= NULL;
float tipw = 0.5f, tiph = 0.5f,drawsize = 4.0f;
if ((sb= ob->soft)){
if(sb->solverflags & SBSO_ESTIMATEIPO){
diff --git a/source/blender/editors/space_view3d/drawvolume.c b/source/blender/editors/space_view3d/drawvolume.c
index a2eefa2aad1..acdbcb0d06d 100644
--- a/source/blender/editors/space_view3d/drawvolume.c
+++ b/source/blender/editors/space_view3d/drawvolume.c
@@ -25,6 +25,11 @@
* ***** END GPL LICENSE BLOCK *****
*/
+/** \file blender/editors/space_view3d/drawvolume.c
+ * \ingroup spview3d
+ */
+
+
#include <string.h>
#include <math.h>
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index dd3b5f42b89..3d29d9d0fda 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -26,6 +26,11 @@
* ***** END GPL LICENSE BLOCK *****
*/
+/** \file blender/editors/space_view3d/space_view3d.c
+ * \ingroup spview3d
+ */
+
+
#include <string.h>
#include <stdio.h>
@@ -209,7 +214,7 @@ static SpaceLink *view3d_new(const bContext *C)
v3d->lens= 35.0f;
v3d->near= 0.01f;
- v3d->far= 500.0f;
+ v3d->far= 1000.0f;
v3d->twflag |= U.tw_flag & V3D_USE_MANIPULATOR;
v3d->twtype= V3D_MANIP_TRANSLATE;
@@ -526,7 +531,6 @@ static void *view3d_main_area_duplicate(void *poin)
new->clipbb= MEM_dupallocN(rv3d->clipbb);
new->depths= NULL;
- new->retopo_view_data= NULL;
new->ri= NULL;
new->gpd= NULL;
new->sms= NULL;
@@ -1075,7 +1079,7 @@ void ED_spacetype_view3d(void)
st->context= view3d_context;
/* regions: main window */
- art= MEM_callocN(sizeof(ARegionType), "spacetype view3d region");
+ art= MEM_callocN(sizeof(ARegionType), "spacetype view3d main region");
art->regionid = RGN_TYPE_WINDOW;
art->keymapflag= ED_KEYMAP_GPENCIL;
art->draw= view3d_main_area_draw;
@@ -1084,10 +1088,11 @@ void ED_spacetype_view3d(void)
art->duplicate= view3d_main_area_duplicate;
art->listener= view3d_main_area_listener;
art->cursor= view3d_main_area_cursor;
+ art->lock= 1; /* can become flag, see BKE_spacedata_draw_locks */
BLI_addhead(&st->regiontypes, art);
/* regions: listview/buttons */
- art= MEM_callocN(sizeof(ARegionType), "spacetype view3d region");
+ art= MEM_callocN(sizeof(ARegionType), "spacetype view3d buttons region");
art->regionid = RGN_TYPE_UI;
art->prefsizex= 180; // XXX
art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_FRAMES;
@@ -1099,7 +1104,7 @@ void ED_spacetype_view3d(void)
view3d_buttons_register(art);
/* regions: tool(bar) */
- art= MEM_callocN(sizeof(ARegionType), "spacetype view3d region");
+ art= MEM_callocN(sizeof(ARegionType), "spacetype view3d tools region");
art->regionid = RGN_TYPE_TOOLS;
art->prefsizex= 160; // XXX
art->prefsizey= 50; // XXX
@@ -1115,7 +1120,7 @@ void ED_spacetype_view3d(void)
#endif
/* regions: tool properties */
- art= MEM_callocN(sizeof(ARegionType), "spacetype view3d region");
+ art= MEM_callocN(sizeof(ARegionType), "spacetype view3d tool properties region");
art->regionid = RGN_TYPE_TOOL_PROPS;
art->prefsizex= 0;
art->prefsizey= 120;
@@ -1129,7 +1134,7 @@ void ED_spacetype_view3d(void)
/* regions: header */
- art= MEM_callocN(sizeof(ARegionType), "spacetype view3d region");
+ art= MEM_callocN(sizeof(ARegionType), "spacetype view3d header region");
art->regionid = RGN_TYPE_HEADER;
art->prefsizey= HEADERY;
art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES|ED_KEYMAP_HEADER;
diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c
index 7c80db76e9e..c278646698f 100644
--- a/source/blender/editors/space_view3d/view3d_buttons.c
+++ b/source/blender/editors/space_view3d/view3d_buttons.c
@@ -26,6 +26,11 @@
* ***** END GPL LICENSE BLOCK *****
*/
+/** \file blender/editors/space_view3d/view3d_buttons.c
+ * \ingroup spview3d
+ */
+
+
#include <string.h>
#include <stdio.h>
#include <math.h>
@@ -133,7 +138,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
{
uiBlock *block= (layout)? uiLayoutAbsoluteBlock(layout): NULL;
MDeformVert *dvert=NULL;
- TransformProperties *tfp= v3d->properties_storage;
+ TransformProperties *tfp;
float median[6], ve_median[6];
int tot, totw, totweight, totedge, totradius;
char defstr[320];
@@ -142,6 +147,11 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
tot= totw= totweight= totedge= totradius= 0;
defstr[0]= 0;
+ /* make sure we got storage */
+ if(v3d->properties_storage==NULL)
+ v3d->properties_storage= MEM_callocN(sizeof(TransformProperties), "TransformProperties");
+ tfp= v3d->properties_storage;
+
if(ob->type==OB_MESH) {
Mesh *me= ob->data;
BMEditMesh *em = me->edit_btmesh;
@@ -267,8 +277,10 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
}
}
- if(tot==0) return;
-
+ if(tot==0) {
+ uiDefBut(block, LABEL, 0, "Nothing selected",0, 130, 200, 20, NULL, 0, 0, 0, 0, "");
+ return;
+ }
median[0] /= (float)tot;
median[1] /= (float)tot;
median[2] /= (float)tot;
@@ -287,7 +299,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
uiBlockBeginAlign(block);
if(tot==1) {
- uiDefBut(block, LABEL, 0, "Vertex:", 0, 130, 200, 20, 0, 0, 0, 0, 0, "");
+ uiDefBut(block, LABEL, 0, "Vertex:", 0, 130, 200, 20, NULL, 0, 0, 0, 0, "");
uiBlockBeginAlign(block);
but= uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "X:", 0, 110, 200, 20, &(tfp->ve_median[0]), -lim, lim, 10, 3, "");
@@ -320,7 +332,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
}
}
else {
- uiDefBut(block, LABEL, 0, "Median:", 0, 130, 200, 20, 0, 0, 0, 0, 0, "");
+ uiDefBut(block, LABEL, 0, "Median:", 0, 130, 200, 20, NULL, 0, 0, 0, 0, "");
uiBlockBeginAlign(block);
but= uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "X:", 0, 110, 200, 20, &(tfp->ve_median[0]), -lim, lim, 10, 3, "");
uiButSetUnitType(but, PROP_UNIT_LENGTH);
@@ -379,7 +391,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
BMVert *eve;
BMIter iter;
- if(len_v3(median) > 0.000001) {
+ if(len_v3(median) > 0.000001f) {
BM_ITER(eve, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
if(BM_TestHFlag(eve, BM_SELECT)) {
@@ -392,7 +404,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
if(median[3] != 0.0f) {
BMEdge *eed;
- const float fixed_crease= (ve_median[3] <= 0.0f ? 0.0 : (ve_median[3] >= 1.0f ? 1.0 : FLT_MAX));
+ 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) {
/* simple case */
@@ -412,21 +424,21 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
float median_orig= ve_median[3] - median[3]; /* previous median value */
/* incase of floating point error */
- CLAMP(median_orig, 0.0, 1.0);
- CLAMP(median_new, 0.0, 1.0);
+ CLAMP(median_orig, 0.0f, 1.0f);
+ CLAMP(median_new, 0.0f, 1.0f);
if(median_new < median_orig) {
/* scale down */
const float sca= median_new / median_orig;
BM_ITER(eed, &iter, em->bm, BM_EDGES_OF_MESH, NULL) {
- if(BM_TestHFlag(eed, BM_SELECT)) {
+ if(BM_TestHFlag(eed, BM_SELECT) && !BM_TestHFlag(eed, BM_HIDDEN)) {
float *crease = CustomData_bmesh_get(&em->bm->edata, eed->head.data, CD_CREASE);
if (!crease) break;
*crease *= sca;
- CLAMP(*crease, 0.0, 1.0);
+ CLAMP(*crease, 0.0f, 1.0f);
}
}
}
@@ -435,12 +447,12 @@ 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, em->bm, BM_EDGES_OF_MESH, NULL) {
- if(BM_TestHFlag(eed, BM_SELECT)) {
+ if(BM_TestHFlag(eed, BM_SELECT) && !BM_TestHFlag(eed, BM_HIDDEN)) {
float *crease = CustomData_bmesh_get(&em->bm->edata, eed->head.data, CD_CREASE);
if (!crease) break;
*crease = 1.0f - ((1.0f - *crease) * sca);
- CLAMP(*crease, 0.0, 1.0);
+ CLAMP(*crease, 0.0f, 1.0f);
}
}
}
@@ -763,7 +775,7 @@ static void view3d_panel_vgroup(const bContext *C, Panel *pa)
dg = BLI_findlink (&ob->defbase, dvert->dw[i].def_nr);
if(dg) {
uiDefButF(block, NUM, B_VGRP_PNL_EDIT_SINGLE + dvert->dw[i].def_nr, dg->name, 0, yco, 180, 20, &dvert->dw[i].weight, 0.0, 1.0, 1, 3, "");
- uiDefBut(block, BUT, B_VGRP_PNL_COPY_SINGLE + dvert->dw[i].def_nr, "C", 180,yco,20,20, 0, 0, 0, 0, 0, "Copy this groups weight to other selected verts");
+ uiDefBut(block, BUT, B_VGRP_PNL_COPY_SINGLE + dvert->dw[i].def_nr, "C", 180,yco,20,20, NULL, 0, 0, 0, 0, "Copy this groups weight to other selected verts");
yco -= 20;
}
}
@@ -771,8 +783,8 @@ static void view3d_panel_vgroup(const bContext *C, Panel *pa)
uiBlockEndAlign(block);
uiBlockBeginAlign(block);
- uiDefBut(block, BUT, B_VGRP_PNL_NORMALIZE, "Normalize", 0, yco,100,20, 0, 0, 0, 0, 0, "Normalize active vertex weights");
- uiDefBut(block, BUT, B_VGRP_PNL_COPY, "Copy", 100,yco,100,20, 0, 0, 0, 0, 0, "Copy active vertex to other seleted verts");
+ uiDefBut(block, BUT, B_VGRP_PNL_NORMALIZE, "Normalize", 0, yco,100,20, NULL, 0, 0, 0, 0, "Normalize active vertex weights");
+ uiDefBut(block, BUT, B_VGRP_PNL_COPY, "Copy", 100,yco,100,20, NULL, 0, 0, 0, 0, "Copy active vertex to other seleted verts");
uiBlockEndAlign(block);
}
}
@@ -792,57 +804,57 @@ static void v3d_transform_butsR(uiLayout *layout, PointerRNA *ptr)
uiLayoutSetActive(split, !(bone->parent && bone->flag & BONE_CONNECTED));
}
colsub = uiLayoutColumn(split, 1);
- uiItemR(colsub, ptr, "location", 0, "Location", ICON_NULL);
+ uiItemR(colsub, ptr, "location", 0, "Location", ICON_NONE);
colsub = uiLayoutColumn(split, 1);
- uiItemL(colsub, "", ICON_NULL);
- uiItemR(colsub, ptr, "lock_location", UI_ITEM_R_TOGGLE+UI_ITEM_R_ICON_ONLY, "", ICON_NULL);
+ uiItemL(colsub, "", ICON_NONE);
+ uiItemR(colsub, ptr, "lock_location", UI_ITEM_R_TOGGLE+UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
split = uiLayoutSplit(layout, 0.8, 0);
switch(RNA_enum_get(ptr, "rotation_mode")) {
case ROT_MODE_QUAT: /* quaternion */
colsub = uiLayoutColumn(split, 1);
- uiItemR(colsub, ptr, "rotation_quaternion", 0, "Rotation", ICON_NULL);
+ uiItemR(colsub, ptr, "rotation_quaternion", 0, "Rotation", ICON_NONE);
colsub = uiLayoutColumn(split, 1);
- uiItemR(colsub, ptr, "lock_rotations_4d", UI_ITEM_R_TOGGLE, "4L", ICON_NULL);
+ uiItemR(colsub, ptr, "lock_rotations_4d", UI_ITEM_R_TOGGLE, "4L", ICON_NONE);
if (RNA_boolean_get(ptr, "lock_rotations_4d"))
- uiItemR(colsub, ptr, "lock_rotation_w", UI_ITEM_R_TOGGLE+UI_ITEM_R_ICON_ONLY, "", ICON_NULL);
+ uiItemR(colsub, ptr, "lock_rotation_w", UI_ITEM_R_TOGGLE+UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
else
- uiItemL(colsub, "", ICON_NULL);
- uiItemR(colsub, ptr, "lock_rotation", UI_ITEM_R_TOGGLE+UI_ITEM_R_ICON_ONLY, "", ICON_NULL);
+ uiItemL(colsub, "", ICON_NONE);
+ uiItemR(colsub, ptr, "lock_rotation", UI_ITEM_R_TOGGLE+UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
break;
case ROT_MODE_AXISANGLE: /* axis angle */
colsub = uiLayoutColumn(split, 1);
- uiItemR(colsub, ptr, "rotation_axis_angle", 0, "Rotation", ICON_NULL);
+ uiItemR(colsub, ptr, "rotation_axis_angle", 0, "Rotation", ICON_NONE);
colsub = uiLayoutColumn(split, 1);
- uiItemR(colsub, ptr, "lock_rotations_4d", UI_ITEM_R_TOGGLE, "4L", ICON_NULL);
+ uiItemR(colsub, ptr, "lock_rotations_4d", UI_ITEM_R_TOGGLE, "4L", ICON_NONE);
if (RNA_boolean_get(ptr, "lock_rotations_4d"))
- uiItemR(colsub, ptr, "lock_rotation_w", UI_ITEM_R_TOGGLE+UI_ITEM_R_ICON_ONLY, "", ICON_NULL);
+ uiItemR(colsub, ptr, "lock_rotation_w", UI_ITEM_R_TOGGLE+UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
else
- uiItemL(colsub, "", ICON_NULL);
- uiItemR(colsub, ptr, "lock_rotation", UI_ITEM_R_TOGGLE+UI_ITEM_R_ICON_ONLY, "", ICON_NULL);
+ uiItemL(colsub, "", ICON_NONE);
+ uiItemR(colsub, ptr, "lock_rotation", UI_ITEM_R_TOGGLE+UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
break;
default: /* euler rotations */
colsub = uiLayoutColumn(split, 1);
- uiItemR(colsub, ptr, "rotation_euler", 0, "Rotation", ICON_NULL);
+ uiItemR(colsub, ptr, "rotation_euler", 0, "Rotation", ICON_NONE);
colsub = uiLayoutColumn(split, 1);
- uiItemL(colsub, "", ICON_NULL);
- uiItemR(colsub, ptr, "lock_rotation", UI_ITEM_R_TOGGLE+UI_ITEM_R_ICON_ONLY, "", ICON_NULL);
+ uiItemL(colsub, "", ICON_NONE);
+ uiItemR(colsub, ptr, "lock_rotation", UI_ITEM_R_TOGGLE+UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
break;
}
- uiItemR(layout, ptr, "rotation_mode", 0, "", ICON_NULL);
+ uiItemR(layout, ptr, "rotation_mode", 0, "", ICON_NONE);
split = uiLayoutSplit(layout, 0.8, 0);
colsub = uiLayoutColumn(split, 1);
- uiItemR(colsub, ptr, "scale", 0, "Scale", ICON_NULL);
+ uiItemR(colsub, ptr, "scale", 0, "Scale", ICON_NONE);
colsub = uiLayoutColumn(split, 1);
- uiItemL(colsub, "", ICON_NULL);
- uiItemR(colsub, ptr, "lock_scale", UI_ITEM_R_TOGGLE+UI_ITEM_R_ICON_ONLY, "", ICON_NULL);
+ uiItemL(colsub, "", ICON_NONE);
+ uiItemR(colsub, ptr, "lock_scale", UI_ITEM_R_TOGGLE+UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
if (ptr->type == &RNA_Object) {
Object *ob = ptr->data;
if (ELEM5(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_MBALL))
- uiItemR(layout, ptr, "dimensions", 0, "Dimensions", ICON_NULL);
+ uiItemR(layout, ptr, "dimensions", 0, "Dimensions", ICON_NONE);
}
}
@@ -862,7 +874,7 @@ static void v3d_posearmature_buts(uiLayout *layout, Object *ob)
// row= uiLayoutRow(layout, 0);
if (!pchan) {
- uiItemL(layout, "No Bone Active", ICON_NULL);
+ uiItemL(layout, "No Bone Active", ICON_NONE);
return;
}
@@ -975,18 +987,18 @@ static void v3d_editarmature_buts(uiLayout *layout, Object *ob)
col= uiLayoutColumn(layout, 0);
- uiItemR(col, &eboneptr, "head", 0, "Head", ICON_NULL);
+ uiItemR(col, &eboneptr, "head", 0, "Head", ICON_NONE);
if (ebone->parent && ebone->flag & BONE_CONNECTED ) {
PointerRNA parptr = RNA_pointer_get(&eboneptr, "parent");
- uiItemR(col, &parptr, "tail_radius", 0, "Radius (Parent)", ICON_NULL);
+ uiItemR(col, &parptr, "tail_radius", 0, "Radius (Parent)", ICON_NONE);
} else {
- uiItemR(col, &eboneptr, "head_radius", 0, "Radius", ICON_NULL);
+ uiItemR(col, &eboneptr, "head_radius", 0, "Radius", ICON_NONE);
}
- uiItemR(col, &eboneptr, "tail", 0, "Tail", ICON_NULL);
- uiItemR(col, &eboneptr, "tail_radius", 0, "Radius", ICON_NULL);
+ uiItemR(col, &eboneptr, "tail", 0, "Tail", ICON_NONE);
+ uiItemR(col, &eboneptr, "tail_radius", 0, "Radius", ICON_NONE);
- uiItemR(col, &eboneptr, "roll", 0, "Roll", ICON_NULL);
+ uiItemR(col, &eboneptr, "roll", 0, "Roll", ICON_NONE);
}
static void v3d_editmetaball_buts(uiLayout *layout, Object *ob)
@@ -1005,37 +1017,37 @@ static void v3d_editmetaball_buts(uiLayout *layout, Object *ob)
RNA_pointer_create(&mball->id, &RNA_MetaElement, mball->lastelem, &ptr);
col= uiLayoutColumn(layout, 0);
- uiItemR(col, &ptr, "co", 0, "Location", ICON_NULL);
+ uiItemR(col, &ptr, "co", 0, "Location", ICON_NONE);
- uiItemR(col, &ptr, "radius", 0, "Radius", ICON_NULL);
- uiItemR(col, &ptr, "stiffness", 0, "Stiffness", ICON_NULL);
+ uiItemR(col, &ptr, "radius", 0, "Radius", ICON_NONE);
+ uiItemR(col, &ptr, "stiffness", 0, "Stiffness", ICON_NONE);
- uiItemR(col, &ptr, "type", 0, "Type", ICON_NULL);
+ uiItemR(col, &ptr, "type", 0, "Type", ICON_NONE);
col= uiLayoutColumn(layout, 1);
switch (RNA_enum_get(&ptr, "type")) {
case MB_BALL:
break;
case MB_CUBE:
- uiItemL(col, "Size:", ICON_NULL);
- uiItemR(col, &ptr, "size_x", 0, "X", ICON_NULL);
- uiItemR(col, &ptr, "size_y", 0, "Y", ICON_NULL);
- uiItemR(col, &ptr, "size_z", 0, "Z", ICON_NULL);
+ uiItemL(col, "Size:", ICON_NONE);
+ uiItemR(col, &ptr, "size_x", 0, "X", ICON_NONE);
+ uiItemR(col, &ptr, "size_y", 0, "Y", ICON_NONE);
+ uiItemR(col, &ptr, "size_z", 0, "Z", ICON_NONE);
break;
case MB_TUBE:
- uiItemL(col, "Size:", ICON_NULL);
- uiItemR(col, &ptr, "size_x", 0, "X", ICON_NULL);
+ uiItemL(col, "Size:", ICON_NONE);
+ uiItemR(col, &ptr, "size_x", 0, "X", ICON_NONE);
break;
case MB_PLANE:
- uiItemL(col, "Size:", ICON_NULL);
- uiItemR(col, &ptr, "size_x", 0, "X", ICON_NULL);
- uiItemR(col, &ptr, "size_y", 0, "Y", ICON_NULL);
+ uiItemL(col, "Size:", ICON_NONE);
+ uiItemR(col, &ptr, "size_x", 0, "X", ICON_NONE);
+ uiItemR(col, &ptr, "size_y", 0, "Y", ICON_NONE);
break;
case MB_ELIPSOID:
- uiItemL(col, "Size:", ICON_NULL);
- uiItemR(col, &ptr, "size_x", 0, "X", ICON_NULL);
- uiItemR(col, &ptr, "size_y", 0, "Y", ICON_NULL);
- uiItemR(col, &ptr, "size_z", 0, "Z", ICON_NULL);
+ uiItemL(col, "Size:", ICON_NONE);
+ uiItemR(col, &ptr, "size_x", 0, "X", ICON_NONE);
+ uiItemR(col, &ptr, "size_y", 0, "Y", ICON_NONE);
+ uiItemR(col, &ptr, "size_z", 0, "Z", ICON_NONE);
break;
}
}
@@ -1098,9 +1110,9 @@ static void do_view3d_region_buttons(bContext *C, void *UNUSED(index), int event
if (!pchan) return;
/* make a copy to eul[3], to allow TAB on buttons to work */
- eul[0]= M_PI*tfp->ob_eul[0]/180.0;
- eul[1]= M_PI*tfp->ob_eul[1]/180.0;
- eul[2]= M_PI*tfp->ob_eul[2]/180.0;
+ eul[0]= (float)M_PI*tfp->ob_eul[0]/180.0f;
+ eul[1]= (float)M_PI*tfp->ob_eul[1]/180.0f;
+ eul[2]= (float)M_PI*tfp->ob_eul[2]/180.0f;
if (pchan->rotmode == ROT_MODE_AXISANGLE) {
float quat[4];
@@ -1222,7 +1234,7 @@ static void view3d_panel_object(const bContext *C, Panel *pa)
View3D *v3d= CTX_wm_view3d(C);
//uiBut *bt;
Object *ob= OBACT;
- TransformProperties *tfp;
+ // TransformProperties *tfp; // UNUSED
PointerRNA obptr;
uiLayout *col, *row;
float lim;
@@ -1230,12 +1242,13 @@ static void view3d_panel_object(const bContext *C, Panel *pa)
if(ob==NULL) return;
/* make sure we got storage */
+ /*
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)) {
}
else {
@@ -1245,7 +1258,7 @@ static void view3d_panel_object(const bContext *C, Panel *pa)
}
*/
- lim= 10000.0f*MAX2(1.0, v3d->grid);
+ lim= 10000.0f * MAX2(1.0f, v3d->grid);
block= uiLayoutGetBlock(pa->layout);
uiBlockSetHandleFunc(block, do_view3d_region_buttons, NULL);
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 4d591645679..1c830b7022a 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -26,6 +26,11 @@
* ***** END GPL LICENSE BLOCK *****
*/
+/** \file blender/editors/space_view3d/view3d_draw.c
+ * \ingroup spview3d
+ */
+
+
#include <string.h>
#include <stdio.h>
#include <math.h>
@@ -218,7 +223,7 @@ static void drawgrid_draw(ARegion *ar, float wx, float wy, float x, float y, flo
v1[1]= 0.0f;
v2[1]= (float)ar->winy;
- v1[0] = v2[0] = x-dx*floor(x/dx);
+ v1[0] = v2[0] = x-dx*floorf(x/dx);
glBegin(GL_LINES);
@@ -231,7 +236,7 @@ static void drawgrid_draw(ARegion *ar, float wx, float wy, float x, float y, flo
v1[0]= 0.0f;
v2[0]= (float)ar->winx;
- v1[1]= v2[1]= y-dx*floor(y/dx);
+ v1[1]= v2[1]= y-dx*floorf(y/dx);
while(v1[1] < ar->winy) {
glVertex2fv(v1);
@@ -287,7 +292,6 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char **
* items are less useful when dealing with units */
void *usys;
int len, i;
- double scalar;
float dx_scalar;
float blend_fac;
@@ -296,7 +300,7 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char **
if(usys) {
i= len;
while(i--) {
- scalar= bUnit_GetScaler(usys, i);
+ float scalar= bUnit_GetScaler(usys, i);
dx_scalar = dx * scalar / unit->scale_length;
if (dx_scalar < (GRID_MIN_PX*2))
@@ -442,7 +446,7 @@ static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit)
if(usys) {
int i= bUnit_GetBaseUnit(usys);
*grid_unit= bUnit_GetNameDisplay(usys, i);
- grid_scale = (grid_scale * bUnit_GetScaler(usys, i)) / scene->unit.scale_length;
+ grid_scale = (grid_scale * (float)bUnit_GetScaler(usys, i)) / scene->unit.scale_length;
}
}
@@ -595,7 +599,7 @@ static void draw_view_axis(RegionView3D *rv3d)
{
const float k = U.rvisize; /* axis size */
const float toll = 0.5; /* used to see when view is quasi-orthogonal */
- const float start = k + 1.0; /* axis center in screen coordinates, x=y */
+ const float start = k + 1.0f;/* axis center in screen coordinates, x=y */
float ydisp = 0.0; /* vertical displacement to allow obj info text */
int bright = 25*(float)U.rvibright + 5; /* axis alpha (rvibright has range 0-10) */
@@ -621,7 +625,7 @@ static void draw_view_axis(RegionView3D *rv3d)
glVertex2f(start + dx, start + dy + ydisp);
glEnd();
- if (fabs(dx) > toll || fabs(dy) > toll) {
+ if (fabsf(dx) > toll || fabsf(dy) > toll) {
BLF_draw_default(start + dx + 2, start + dy + ydisp + 2, 0.0f, "x", 1);
}
@@ -641,7 +645,7 @@ static void draw_view_axis(RegionView3D *rv3d)
glVertex2f(start + dx, start + dy + ydisp);
glEnd();
- if (fabs(dx) > toll || fabs(dy) > toll) {
+ if (fabsf(dx) > toll || fabsf(dy) > toll) {
BLF_draw_default(start + dx + 2, start + dy + ydisp + 2, 0.0f, "y", 1);
}
@@ -660,7 +664,7 @@ static void draw_view_axis(RegionView3D *rv3d)
glVertex2f(start + dx, start + dy + ydisp);
glEnd();
- if (fabs(dx) > toll || fabs(dy) > toll) {
+ if (fabsf(dx) > toll || fabsf(dy) > toll) {
BLF_draw_default(start + dx + 2, start + dy + ydisp + 2, 0.0f, "z", 1);
}
@@ -855,7 +859,7 @@ void view3d_viewborder_size_get(Scene *scene, ARegion *ar, float size_r[2])
float winmax= MAX2(ar->winx, ar->winy);
float aspect= (scene->r.xsch*scene->r.xasp) / (scene->r.ysch*scene->r.yasp);
- if(aspect>1.0) {
+ if(aspect > 1.0f) {
size_r[0]= winmax;
size_r[1]= winmax/aspect;
} else {
@@ -882,15 +886,15 @@ void view3d_calc_camera_border(Scene *scene, ARegion *ar, RegionView3D *rv3d, Vi
* with multiple keypad presses (ton)
*/
- zoomfac= (M_SQRT2 + rv3d->camzoom/50.0);
- zoomfac= (zoomfac*zoomfac)*0.25;
+ zoomfac= ((float)M_SQRT2 + rv3d->camzoom/50.0f);
+ zoomfac= (zoomfac*zoomfac) * 0.25f;
size[0]= size[0]*zoomfac;
size[1]= size[1]*zoomfac;
/* center in window */
- viewborder_r->xmin= 0.5*ar->winx - 0.5*size[0];
- viewborder_r->ymin= 0.5*ar->winy - 0.5*size[1];
+ viewborder_r->xmin= 0.5f * ar->winx - 0.5f * size[0];
+ viewborder_r->ymin= 0.5f * ar->winy - 0.5f * size[1];
viewborder_r->xmax= viewborder_r->xmin + size[0];
viewborder_r->ymax= viewborder_r->ymin + size[1];
@@ -946,21 +950,21 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d)
y2i= (int)(y2 + 1.0f);
/* passepartout, specified in camera edit buttons */
- if (ca && (ca->flag & CAM_SHOWPASSEPARTOUT) && ca->passepartalpha > 0.000001) {
- if (ca->passepartalpha == 1.0) {
+ if (ca && (ca->flag & CAM_SHOWPASSEPARTOUT) && ca->passepartalpha > 0.000001f) {
+ if (ca->passepartalpha == 1.0f) {
glColor3f(0, 0, 0);
} else {
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
glEnable(GL_BLEND);
glColor4f(0, 0, 0, ca->passepartalpha);
}
- if (x1i > 0.0)
+ if (x1i > 0.0f)
glRectf(0.0, (float)ar->winy, x1i, 0.0);
if (x2i < (float)ar->winx)
glRectf(x2i, (float)ar->winy, (float)ar->winx, 0.0);
if (y2i < (float)ar->winy)
glRectf(x1i, (float)ar->winy, x2i, y2i);
- if (y2i > 0.0)
+ if (y2i > 0.0f)
glRectf(x1i, y1i, x2i, 0.0);
glDisable(GL_BLEND);
@@ -1283,7 +1287,7 @@ static void draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d)
initgrabz(rv3d, 0.0, 0.0, 0.0);
window_to_3d_delta(ar, vec, 1, 0);
fac= MAX3( fabs(vec[0]), fabs(vec[1]), fabs(vec[1]) );
- fac= 1.0/fac;
+ fac= 1.0f/fac;
asp= ( (float)ibuf->y)/(float)ibuf->x;
@@ -1339,7 +1343,7 @@ static void draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d)
ED_region_pixelspace(ar);
glPixelZoom(zoomx, zoomy);
- glColor4f(1.0, 1.0, 1.0, 1.0-bgpic->blend);
+ glColor4f(1.0f, 1.0f, 1.0f, 1.0f-bgpic->blend);
glaDrawPixelsTex(x1, y1, ibuf->x, ibuf->y, GL_UNSIGNED_BYTE, ibuf->rect);
glPixelZoom(1.0, 1.0);
@@ -1903,7 +1907,7 @@ static void gpu_update_lamps_shadows(Scene *scene, View3D *v3d)
/* this needs to be done better .. */
float viewmat[4][4], winmat[4][4];
int drawtype, lay, winsize, flag2=v3d->flag2;
- ARegion ar= {0};
+ ARegion ar= {NULL};
RegionView3D rv3d= {{{0}}};
drawtype= v3d->drawtype;
@@ -1938,6 +1942,22 @@ static void gpu_update_lamps_shadows(Scene *scene, View3D *v3d)
/* *********************** customdata **************** */
+CustomDataMask ED_view3d_datamask(Scene *scene, View3D *v3d)
+{
+ CustomDataMask mask= 0;
+ if(v3d->drawtype == OB_SHADED) {
+ /* this includes normals for mesh_create_shadedColors */
+ mask |= CD_MASK_MTFACE | CD_MASK_MCOL | CD_MASK_NORMAL | CD_MASK_ORCO;
+ }
+ if((v3d->drawtype == OB_TEXTURE) || ((v3d->drawtype == OB_SOLID) && (v3d->flag2 & V3D_SOLID_TEX))) {
+ mask |= CD_MASK_MTFACE | CD_MASK_MCOL;
+
+ if(scene->gm.matmode == GAME_MAT_GLSL)
+ mask |= CD_MASK_ORCO;
+ }
+
+ return mask;
+}
/* goes over all modes and view3d settings */
CustomDataMask ED_viewedit_datamask(bScreen *screen)
{
@@ -1953,17 +1973,7 @@ CustomDataMask ED_viewedit_datamask(bScreen *screen)
/* check if we need tfaces & mcols due to view mode */
for(sa = screen->areabase.first; sa; sa = sa->next) {
if(sa->spacetype == SPACE_VIEW3D) {
- View3D *view = sa->spacedata.first;
- if(view->drawtype == OB_SHADED) {
- /* this includes normals for mesh_create_shadedColors */
- mask |= CD_MASK_MTFACE | CD_MASK_MCOL | CD_MASK_NORMAL | CD_MASK_ORCO;
- }
- if((view->drawtype == OB_TEXTURE) || ((view->drawtype == OB_SOLID) && (view->flag2 & V3D_SOLID_TEX))) {
- mask |= CD_MASK_MTFACE | CD_MASK_MCOL;
-
- if(scene->gm.matmode == GAME_MAT_GLSL)
- mask |= CD_MASK_ORCO;
- }
+ mask |= ED_view3d_datamask(scene, (View3D *)sa->spacedata.first);
}
}
@@ -2110,6 +2120,11 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, int winx,
}
}
+ /* must be before xray draw which clears the depth buffer */
+ if(v3d->zbuf) glDisable(GL_DEPTH_TEST);
+ draw_gpencil_view3d_ext(scene, v3d, ar, 1);
+ 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!
@@ -2122,8 +2137,6 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, int winx,
}
/* draw grease-pencil stuff */
- draw_gpencil_view3d_ext(scene, v3d, ar, 1);
-
ED_region_pixelspace(ar);
/* draw grease-pencil stuff - needed to get paint-buffer shown too (since it's 2D) */
@@ -2145,7 +2158,7 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, int winx,
}
/* utility func for ED_view3d_draw_offscreen */
-ImBuf *ED_view3d_draw_offscreen_imbuf(Scene *scene, View3D *v3d, ARegion *ar, int sizex, int sizey, unsigned int flag)
+ImBuf *ED_view3d_draw_offscreen_imbuf(Scene *scene, View3D *v3d, ARegion *ar, int sizex, int sizey, unsigned int flag, char err_out[256])
{
RegionView3D *rv3d= ar->regiondata;
ImBuf *ibuf;
@@ -2155,7 +2168,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(Scene *scene, View3D *v3d, ARegion *ar, in
glPushAttrib(GL_LIGHTING_BIT);
/* bind */
- ofs= GPU_offscreen_create(&sizex, &sizey);
+ ofs= GPU_offscreen_create(&sizex, &sizey, err_out);
if(ofs == NULL)
return NULL;
@@ -2199,10 +2212,10 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(Scene *scene, View3D *v3d, ARegion *ar, in
}
/* creates own 3d views, used by the sequencer */
-ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, int width, int height, unsigned int flag, int drawtype)
+ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, int width, int height, unsigned int flag, int drawtype, char err_out[256])
{
- View3D v3d= {0};
- ARegion ar= {0};
+ View3D v3d= {NULL};
+ ARegion ar= {NULL};
RegionView3D rv3d= {{{0}}};
/* connect data */
@@ -2230,7 +2243,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, int width, int height
mul_m4_m4m4(rv3d.persmat, rv3d.viewmat, rv3d.winmat);
invert_m4_m4(rv3d.persinv, rv3d.viewinv);
- return ED_view3d_draw_offscreen_imbuf(scene, &v3d, &ar, width, height, flag);
+ return ED_view3d_draw_offscreen_imbuf(scene, &v3d, &ar, width, height, flag, err_out);
// seq_view3d_cb(scene, cfra, render_size, seqrectx, seqrecty);
}
@@ -2275,13 +2288,13 @@ static void draw_viewport_fps(Scene *scene, ARegion *ar)
#endif
/* is this more then half a frame behind? */
- if (fps+0.5 < FPS) {
+ if (fps+0.5f < (float)(FPS)) {
UI_ThemeColor(TH_REDALERT);
- BLI_snprintf(printable, sizeof(printable), "fps: %.2f", (float)fps);
+ BLI_snprintf(printable, sizeof(printable), "fps: %.2f", fps);
}
else {
UI_ThemeColor(TH_TEXT_HI);
- BLI_snprintf(printable, sizeof(printable), "fps: %i", (int)(fps+0.5));
+ BLI_snprintf(printable, sizeof(printable), "fps: %i", (int)(fps+0.5f));
}
BLF_draw_default(22, ar->winy-17, 0.0f, printable, sizeof(printable)-1);
@@ -2441,7 +2454,14 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar)
}
// REEB_draw();
-
+
+ if ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) {
+ /* must be before xray draw which clears the depth buffer */
+ if(v3d->zbuf) glDisable(GL_DEPTH_TEST);
+ draw_gpencil_view3d((bContext *)C, 1);
+ 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!
@@ -2462,12 +2482,8 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar)
v3d->zbuf= FALSE;
glDisable(GL_DEPTH_TEST);
}
-
- if ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) {
- /* draw grease-pencil stuff (3d-space strokes) */
- //if (v3d->flag2 & V3D_DISPGP)
- draw_gpencil_view3d((bContext *)C, 1);
+ if ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) {
BDR_drawSketch(C);
}
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index 7e93f8999f4..7d0312a79f2 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -26,6 +26,11 @@
* ***** END GPL LICENSE BLOCK *****
*/
+/** \file blender/editors/space_view3d/view3d_edit.c
+ * \ingroup spview3d
+ */
+
+
#include <string.h>
#include <stdio.h>
#include <math.h>
@@ -309,11 +314,11 @@ static void calctrackballvec(rcti *rect, int mx, int my, float *vec)
y/= (float)((rect->ymax - rect->ymin)/2);
d = sqrt(x*x + y*y);
- if (d < radius*M_SQRT1_2) /* Inside sphere */
+ if (d < radius * (float)M_SQRT1_2) /* Inside sphere */
z = sqrt(radius*radius - d*d);
else
{ /* On hyperbola */
- t = radius / M_SQRT2;
+ t = radius / (float)M_SQRT2;
z = t*t / d;
}
@@ -548,22 +553,22 @@ static void viewrotate_apply(ViewOpsData *vod, int x, int y)
sub_v3_v3v3(dvec, newvec, vod->trackvec);
si= sqrt(dvec[0]*dvec[0]+ dvec[1]*dvec[1]+ dvec[2]*dvec[2]);
- si/= (2.0*TRACKBALLSIZE);
+ si /= (float)(2.0 * TRACKBALLSIZE);
cross_v3_v3v3(q1+1, vod->trackvec, newvec);
normalize_v3(q1+1);
/* Allow for rotation beyond the interval
* [-pi, pi] */
- while (si > 1.0)
- si -= 2.0;
+ while (si > 1.0f)
+ si -= 2.0f;
/* This relation is used instead of
* phi = asin(si) so that the angle
* of rotation is linearly proportional
* to the distance that the mouse is
* dragged. */
- phi = si * M_PI / 2.0;
+ phi = si * (float)(M_PI / 2.0);
q1[0]= cos(phi);
mul_v3_fl(q1+1, sin(phi));
@@ -587,12 +592,12 @@ static void viewrotate_apply(ViewOpsData *vod, int x, int y)
float phi, q1[4];
float m[3][3];
float m_inv[3][3];
- float xvec[3] = {1,0,0};
+ float xvec[3] = {1.0f, 0.0f, 0.0f};
/* Sensitivity will control how fast the viewport rotates. 0.0035 was
obtained experimentally by looking at viewport rotation sensitivities
on other modeling programs. */
/* Perhaps this should be a configurable user parameter. */
- const float sensitivity = 0.0035;
+ const float sensitivity = 0.0035f;
/* Get the 3x3 matrix and its inverse from the quaternion */
quat_to_mat3( m,rv3d->viewquat);
@@ -648,7 +653,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) < DEG2RAD(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 */
@@ -671,7 +676,7 @@ static void viewrotate_apply(ViewOpsData *vod, int x, int y)
float xaxis2[3]={1,0,0};
float quat_final_inv[4];
- axis_angle_to_quat(quat_roll, zaxis_test, j * DEG2RAD(45.0));
+ axis_angle_to_quat(quat_roll, zaxis_test, (float)j * DEG2RADF(45.0f));
normalize_qt(quat_roll);
mul_qt_qtqt(quat_final, snapquats[i], quat_roll);
@@ -887,8 +892,8 @@ void viewmove_modal_keymap(wmKeyConfig *keyconf)
static void viewmove_apply(ViewOpsData *vod, int x, int y)
{
if(vod->rv3d->persp==RV3D_CAMOB) {
- float zoomfac= (M_SQRT2 + vod->rv3d->camzoom/50.0);
- zoomfac= (zoomfac*zoomfac)*0.5;
+ float zoomfac= ((float)M_SQRT2 + (float)vod->rv3d->camzoom / 50.0f);
+ zoomfac= (zoomfac * zoomfac) * 0.5f;
vod->rv3d->camdx += (vod->oldx - x)/(vod->ar->winx * zoomfac);
vod->rv3d->camdy += (vod->oldy - y)/(vod->ar->winy * zoomfac);
@@ -1080,7 +1085,7 @@ static void viewzoom_apply(ViewOpsData *vod, int x, int y, short viewzoom)
float time_step= (float)(time - vod->timer_lastdraw);
// oldstyle zoom
- zfac = 1.0f + (((float)(vod->origx - x + vod->origy - y)/20.0) * time_step);
+ zfac = 1.0f + (((float)(vod->origx - x + vod->origy - y) / 20.0f) * time_step);
vod->timer_lastdraw= time;
}
else if(viewzoom==USER_ZOOM_SCALE) {
@@ -1109,11 +1114,11 @@ static void viewzoom_apply(ViewOpsData *vod, int x, int y, short viewzoom)
if (U.uiflag & USER_ZOOM_INVERT)
SWAP(float, len1, len2);
- zfac = vod->dist0 * (2.0*((len2/len1)-1.0) + 1.0) / vod->rv3d->dist;
+ zfac = vod->dist0 * (2.0f * ((len2/len1)-1.0f) + 1.0f) / vod->rv3d->dist;
}
- if(zfac != 1.0 && zfac*vod->rv3d->dist > 0.001*vod->grid &&
- zfac*vod->rv3d->dist < 10.0*vod->far)
+ 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);
@@ -1129,8 +1134,8 @@ static void viewzoom_apply(ViewOpsData *vod, int x, int y, short viewzoom)
add_v3_v3(vod->rv3d->ofs, upvec);
} else {
/* these limits were in old code too */
- if(vod->rv3d->dist<0.001*vod->grid) vod->rv3d->dist= 0.001*vod->grid;
- if(vod->rv3d->dist>10.0*vod->far) vod->rv3d->dist=10.0*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;
}
// XXX if(vod->rv3d->persp==RV3D_ORTHO || vod->rv3d->persp==RV3D_CAMOB) preview3d_event= 0;
@@ -1220,7 +1225,7 @@ static int viewzoom_exec(bContext *C, wmOperator *op)
rv3d->camzoom-= 10;
if(rv3d->camzoom < RV3D_CAMZOOM_MIN) rv3d->camzoom= RV3D_CAMZOOM_MIN;
}
- else if(rv3d->dist<10.0*v3d->far) {
+ else if(rv3d->dist < 10.0f * v3d->far) {
view_zoom_mouseloc(ar, 1.2f, mx, my);
}
}
@@ -1229,7 +1234,7 @@ static int viewzoom_exec(bContext *C, wmOperator *op)
rv3d->camzoom+= 10;
if(rv3d->camzoom > RV3D_CAMZOOM_MAX) rv3d->camzoom= RV3D_CAMZOOM_MAX;
}
- else if(rv3d->dist> 0.001*v3d->grid) {
+ else if(rv3d->dist> 0.001f * v3d->grid) {
view_zoom_mouseloc(ar, .83333f, mx, my);
}
}
@@ -1369,7 +1374,7 @@ 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.0) ok= 0;
+ if(size == 0.0f) ok= 0;
if(ok) {
float new_dist;
@@ -1383,7 +1388,7 @@ static int view3d_all_exec(bContext *C, wmOperator *op) /* was view3d_home() in
// correction for window aspect ratio
if(ar->winy>2 && ar->winx>2) {
size= (float)ar->winx/(float)ar->winy;
- if(size<1.0) size= 1.0f/size;
+ if(size < 1.0f) size= 1.0f/size;
new_dist*= size;
}
@@ -1647,15 +1652,15 @@ static int render_border_exec(bContext *C, wmOperator *op)
scene->r.border.ymax= ((float)rect.ymax-vb.ymin)/(vb.ymax-vb.ymin);
/* actually set border */
- CLAMP(scene->r.border.xmin, 0.0, 1.0);
- CLAMP(scene->r.border.ymin, 0.0, 1.0);
- CLAMP(scene->r.border.xmax, 0.0, 1.0);
- CLAMP(scene->r.border.ymax, 0.0, 1.0);
+ CLAMP(scene->r.border.xmin, 0.0f, 1.0f);
+ CLAMP(scene->r.border.ymin, 0.0f, 1.0f);
+ CLAMP(scene->r.border.xmax, 0.0f, 1.0f);
+ CLAMP(scene->r.border.ymax, 0.0f, 1.0f);
/* drawing a border surrounding the entire camera view switches off border rendering
* or the border covers no pixels */
- if ((scene->r.border.xmin <= 0.0 && scene->r.border.xmax >= 1.0 &&
- scene->r.border.ymin <= 0.0 && scene->r.border.ymax >= 1.0) ||
+ if ((scene->r.border.xmin <= 0.0f && scene->r.border.xmax >= 1.0f &&
+ scene->r.border.ymin <= 0.0f && scene->r.border.ymax >= 1.0f) ||
(scene->r.border.xmin == scene->r.border.xmax ||
scene->r.border.ymin == scene->r.border.ymax ))
{
@@ -1763,7 +1768,7 @@ 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.5) new_dist= v3d->near*1.5;
+ if(new_dist <= v3d->near * 1.5f) new_dist= v3d->near * 1.5f;
new_ofs[0] = -p[0];
new_ofs[1] = -p[1];
@@ -1798,7 +1803,7 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op)
scale = (xscale >= yscale)?xscale:yscale;
/* zoom in as required, or as far as we can go */
- new_dist = ((new_dist*scale) >= 0.001*v3d->grid)? new_dist*scale:0.001*v3d->grid;
+ new_dist = ((new_dist*scale) >= 0.001f * v3d->grid)? new_dist*scale:0.001f * v3d->grid;
}
smooth_view(C, NULL, NULL, new_ofs, NULL, &new_dist, NULL);
@@ -1854,7 +1859,7 @@ static void view3d_set_1_to_1_viewborder(Scene *scene, ARegion *ar)
view3d_viewborder_size_get(scene, ar, size);
- rv3d->camzoom= (sqrt(4.0*im_width/size[0]) - M_SQRT2)*50.0;
+ rv3d->camzoom= (sqrtf(4.0f * (float)im_width/size[0]) - (float)M_SQRT2) * 50.0f;
rv3d->camzoom= CLAMPIS(rv3d->camzoom, RV3D_CAMZOOM_MIN, RV3D_CAMZOOM_MAX);
}
@@ -2774,7 +2779,7 @@ static int depth_segment_cb(int x, int y, void *userData)
int view_autodist_depth_segment(struct ARegion *ar, short mval_sta[2], short mval_end[2], int margin, float *depth)
{
- struct { struct ARegion *ar; int margin; float depth; } data = {0};
+ struct { struct ARegion *ar; int margin; float depth; } data = {NULL};
int p1[2];
int p2[2];
diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c
index 7a4fb86a4dd..7d84a47bddf 100644
--- a/source/blender/editors/space_view3d/view3d_fly.c
+++ b/source/blender/editors/space_view3d/view3d_fly.c
@@ -22,6 +22,11 @@
* ***** END GPL LICENSE BLOCK *****
*/
+/** \file blender/editors/space_view3d/view3d_fly.c
+ * \ingroup spview3d
+ */
+
+
/* defines VIEW3D_OT_fly modal operator */
#include "DNA_anim_types.h"
@@ -199,10 +204,10 @@ static void drawFlyPixel(const struct bContext *UNUSED(C), struct ARegion *UNUSE
mouse can move during fly mode without spinning the view */
float x1, x2, y1, y2;
- x1= 0.45*(float)fly->ar->winx;
- y1= 0.45*(float)fly->ar->winy;
- x2= 0.55*(float)fly->ar->winx;
- y2= 0.55*(float)fly->ar->winy;
+ x1= 0.45f * (float)fly->ar->winx;
+ y1= 0.45f * (float)fly->ar->winy;
+ x2= 0.55f * (float)fly->ar->winx;
+ y2= 0.55f * (float)fly->ar->winy;
cpack(0);
@@ -435,14 +440,14 @@ static void flyEvent(FlyInfo *fly, wmEvent *event)
fly->time_lastwheel = time_currwheel;
/*printf("Wheel %f\n", time_wheel);*/
/*Mouse wheel delays range from 0.5==slow to 0.01==fast*/
- time_wheel = 1+ (10 - (20*MIN2(time_wheel, 0.5))); /* 0-0.5 -> 0-5.0 */
+ time_wheel = 1.0f + (10.0f - (20.0f * MIN2(time_wheel, 0.5f))); /* 0-0.5 -> 0-5.0 */
if (fly->speed<0.0f) fly->speed= 0.0f;
else {
if (event->shift)
- fly->speed+= fly->grid*time_wheel*0.1;
+ fly->speed += fly->grid*time_wheel * 0.1f;
else
- fly->speed+= fly->grid*time_wheel;
+ fly->speed += fly->grid*time_wheel;
}
break;
}
@@ -454,12 +459,12 @@ static void flyEvent(FlyInfo *fly, wmEvent *event)
time_currwheel= PIL_check_seconds_timer();
time_wheel = (float)(time_currwheel - fly->time_lastwheel);
fly->time_lastwheel = time_currwheel;
- time_wheel = 1+ (10 - (20*MIN2(time_wheel, 0.5))); /* 0-0.5 -> 0-5.0 */
+ time_wheel = 1.0f + (10.0f - (20.0f * MIN2(time_wheel, 0.5f))); /* 0-0.5 -> 0-5.0 */
if (fly->speed>0) fly->speed=0;
else {
if (event->shift)
- fly->speed-= fly->grid*time_wheel*0.1;
+ fly->speed-= fly->grid*time_wheel * 0.1f;
else
fly->speed-= fly->grid*time_wheel;
}
@@ -558,7 +563,8 @@ static int flyApply(bContext *C, FlyInfo *fly)
moffset[2], /* mouse offset from the views center */
tmp_quat[4]; /* used for rotating the view */
- int cent_orig[2], /* view center */
+ int
+// cent_orig[2], /* view center */
//XXX- can avoid using // cent[2], /* view center modified */
xmargin, ymargin; /* x and y margin are define the safe area where the mouses movement wont rotate the view */
unsigned char
@@ -577,8 +583,9 @@ static int flyApply(bContext *C, FlyInfo *fly)
xmargin= ar->winx/20.0f;
ymargin= ar->winy/20.0f;
- cent_orig[0]= ar->winrct.xmin + ar->winx/2;
- cent_orig[1]= ar->winrct.ymin + ar->winy/2;
+ // UNUSED
+ // cent_orig[0]= ar->winrct.xmin + ar->winx/2;
+ // cent_orig[1]= ar->winrct.ymin + ar->winy/2;
{
@@ -603,18 +610,19 @@ static int flyApply(bContext *C, FlyInfo *fly)
if(moffset[0]) {
moffset[0] /= ar->winx - (xmargin*2);
- moffset[0] *= fabs(moffset[0]);
+ moffset[0] *= fabsf(moffset[0]);
}
if(moffset[1]) {
moffset[1] /= ar->winy - (ymargin*2);
- moffset[1] *= fabs(moffset[1]);
+ moffset[1] *= fabsf(moffset[1]);
}
/* Should we redraw? */
if(fly->speed != 0.0f || moffset[0] || moffset[1] || fly->zlock || fly->xlock || dvec[0] || dvec[1] || dvec[2] ) {
float dvec_tmp[3];
- double time_current, time_redraw; /*time how fast it takes for us to redraw, this is so simple scenes dont fly too fast */
+ double time_current; /*time how fast it takes for us to redraw, this is so simple scenes dont fly too fast */
+ float time_redraw;
float time_redraw_clamped;
time_current= PIL_check_seconds_timer();
@@ -637,12 +645,12 @@ static int flyApply(bContext *C, FlyInfo *fly)
dvec_tmp[2]= 0;
if (fly->use_precision) {
- dvec_tmp[0] *= 0.1;
- dvec_tmp[1] *= 0.1;
+ dvec_tmp[0] *= 0.1f;
+ dvec_tmp[1] *= 0.1f;
}
mul_m3_v3(mat, dvec_tmp);
- mul_v3_fl(dvec_tmp, time_redraw*200.0 * fly->grid);
+ mul_v3_fl(dvec_tmp, time_redraw * 200.0f * fly->grid);
} else {
float roll; /* similar to the angle between the camera's up and the Z-up, but its very rough so just roll*/
@@ -699,7 +707,7 @@ static int flyApply(bContext *C, FlyInfo *fly)
mul_m3_v3(mat, upvec);
/*make sure we have some z rolling*/
- if (fabs(upvec[2]) > 0.00001f) {
+ if (fabsf(upvec[2]) > 0.00001f) {
roll= upvec[2]*5;
upvec[0]=0; /*rotate the view about this axis*/
upvec[1]=0;
diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c
index 05735d810d3..fea3ac20ca9 100644
--- a/source/blender/editors/space_view3d/view3d_header.c
+++ b/source/blender/editors/space_view3d/view3d_header.c
@@ -26,6 +26,11 @@
* ***** END GPL LICENSE BLOCK *****
*/
+/** \file blender/editors/space_view3d/view3d_header.c
+ * \ingroup spview3d
+ */
+
+
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
@@ -138,13 +143,31 @@ static void handle_view3d_lock(bContext *C)
}
}
+/* layer code is on three levels actually:
+- here for operator
+- uiTemplateLayers in interface/ code for buttons
+- ED_view3d_scene_layer_set for RNA
+ */
+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) {
+ int bit;
+ for(bit=0; bit<32; bit++) {
+ if(scene->obedit->lay & (1<<bit)) {
+ v3d->lay |= 1<<bit;
+ break;
+ }
+ }
+ }
+}
+
static int view3d_layers_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
ScrArea *sa= CTX_wm_area(C);
View3D *v3d= sa->spacedata.first;
- Base *base;
- int oldlay= v3d->lay;
int nr= RNA_int_get(op->ptr, "nr");
int toggle= RNA_boolean_get(op->ptr, "toggle");
@@ -159,7 +182,10 @@ static int view3d_layers_exec(bContext *C, wmOperator *op)
if (toggle && v3d->lay == ((1<<20)-1)) {
/* return to active layer only */
v3d->lay = v3d->layact;
- } else {
+
+ view3d_layers_editmode_ensure(scene, v3d);
+ }
+ else {
v3d->lay |= (1<<20)-1;
}
}
@@ -174,19 +200,10 @@ static int view3d_layers_exec(bContext *C, wmOperator *op)
v3d->lay |= (1<<nr);
} else {
v3d->lay = (1<<nr);
-
- /* 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) {
- for(bit=0; bit<32; bit++) {
- if(scene->obedit->lay & (1<<bit)) {
- v3d->lay |= 1<<bit;
- break;
- }
- }
- }
}
-
+
+ view3d_layers_editmode_ensure(scene, v3d);
+
/* set active layer, ensure to always have one */
if(v3d->lay & (1<<nr))
v3d->layact= 1<<nr;
@@ -202,12 +219,7 @@ static int view3d_layers_exec(bContext *C, wmOperator *op)
if(v3d->scenelock) handle_view3d_lock(C);
- /* XXX new layers might need updates, there is no provision yet to detect if that's needed */
- oldlay= ~oldlay & v3d->lay;
- for (base= scene->base.first; base; base= base->next) {
- if(base->lay & oldlay)
- base->object->recalc= OB_RECALC_OB|OB_RECALC_DATA;
- }
+ DAG_on_visible_update(CTX_data_main(C), FALSE);
ED_area_tag_redraw(sa);
@@ -458,7 +470,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
uiBlockEndAlign(block);
/* Draw type */
- uiItemR(layout, &v3dptr, "viewport_shade", UI_ITEM_R_ICON_ONLY, "", ICON_NULL);
+ uiItemR(layout, &v3dptr, "viewport_shade", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
if (obedit==NULL && ((ob && ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT)))) {
/* Manipulators aren't used in weight paint mode */
@@ -466,13 +478,13 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
PointerRNA meshptr;
RNA_pointer_create(&ob->id, &RNA_Mesh, ob->data, &meshptr);
- uiItemR(layout, &meshptr, "use_paint_mask", UI_ITEM_R_ICON_ONLY, "", ICON_NULL);
+ uiItemR(layout, &meshptr, "use_paint_mask", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
} else {
const char *str_menu;
row= uiLayoutRow(layout, 1);
- uiItemR(row, &v3dptr, "pivot_point", UI_ITEM_R_ICON_ONLY, "", ICON_NULL);
- uiItemR(row, &v3dptr, "use_pivot_point_align", UI_ITEM_R_ICON_ONLY, "", ICON_NULL);
+ uiItemR(row, &v3dptr, "pivot_point", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
+ uiItemR(row, &v3dptr, "use_pivot_point_align", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
/* NDOF */
/* Not implemented yet
@@ -487,7 +499,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
/* Transform widget / manipulators */
row= uiLayoutRow(layout, 1);
- uiItemR(row, &v3dptr, "show_manipulator", UI_ITEM_R_ICON_ONLY, "", ICON_NULL);
+ uiItemR(row, &v3dptr, "show_manipulator", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
block= uiLayoutGetBlock(row);
if(v3d->twflag & V3D_USE_MANIPULATOR) {
@@ -515,7 +527,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
uiTemplateLayers(layout, &v3dptr, "layers", &v3dptr, "layers_used", ob_lay);
/* Scene lock */
- uiItemR(layout, &v3dptr, "lock_camera_and_layers", UI_ITEM_R_ICON_ONLY, "", ICON_NULL);
+ uiItemR(layout, &v3dptr, "lock_camera_and_layers", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
}
/* selection modus, dont use python for this since it cant do the toggle buttons with shift+click as well as clicking to set one. */
diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h
index 8cd07916b7b..4ad0b6acbc3 100644
--- a/source/blender/editors/space_view3d/view3d_intern.h
+++ b/source/blender/editors/space_view3d/view3d_intern.h
@@ -25,6 +25,11 @@
*
* ***** END GPL LICENSE BLOCK *****
*/
+
+/** \file blender/editors/space_view3d/view3d_intern.h
+ * \ingroup spview3d
+ */
+
#ifndef ED_VIEW3D_INTERN_H
#define ED_VIEW3D_INTERN_H
diff --git a/source/blender/editors/space_view3d/view3d_ops.c b/source/blender/editors/space_view3d/view3d_ops.c
index dc1d2e26de0..1b1a66db95e 100644
--- a/source/blender/editors/space_view3d/view3d_ops.c
+++ b/source/blender/editors/space_view3d/view3d_ops.c
@@ -26,6 +26,11 @@
* ***** END GPL LICENSE BLOCK *****
*/
+/** \file blender/editors/space_view3d/view3d_ops.c
+ * \ingroup spview3d
+ */
+
+
#include <stdlib.h>
#include <math.h>
@@ -187,26 +192,6 @@ void view3d_keymap(wmKeyConfig *keyconf)
RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_orbit", WHEELDOWNMOUSE, KM_PRESS, KM_SHIFT|KM_ALT, 0)->ptr, "type", V3D_VIEW_STEPDOWN);
/* active aligned, replaces '*' key in 2.4x */
-#ifdef WIN32
- kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD1, KM_PRESS, KM_ALT, 0);
- RNA_enum_set(kmi->ptr, "type", RV3D_VIEW_FRONT);
- RNA_boolean_set(kmi->ptr, "align_active", TRUE);
- kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD3, KM_PRESS, KM_ALT, 0);
- RNA_enum_set(kmi->ptr, "type", RV3D_VIEW_RIGHT);
- RNA_boolean_set(kmi->ptr, "align_active", TRUE);
- kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD7, KM_PRESS, KM_ALT, 0);
- RNA_enum_set(kmi->ptr, "type", RV3D_VIEW_TOP);
- RNA_boolean_set(kmi->ptr, "align_active", TRUE);
- kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD1, KM_PRESS, KM_ALT|KM_CTRL, 0);
- RNA_enum_set(kmi->ptr, "type", RV3D_VIEW_BACK);
- RNA_boolean_set(kmi->ptr, "align_active", TRUE);
- kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD3, KM_PRESS, KM_ALT|KM_CTRL, 0);
- RNA_enum_set(kmi->ptr, "type", RV3D_VIEW_LEFT);
- RNA_boolean_set(kmi->ptr, "align_active", TRUE);
- kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD7, KM_PRESS, KM_ALT|KM_CTRL, 0);
- RNA_enum_set(kmi->ptr, "type", RV3D_VIEW_BOTTOM);
- RNA_boolean_set(kmi->ptr, "align_active", TRUE);
-#else
kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD1, KM_PRESS, KM_SHIFT, 0);
RNA_enum_set(kmi->ptr, "type", RV3D_VIEW_FRONT);
RNA_boolean_set(kmi->ptr, "align_active", TRUE);
@@ -225,7 +210,6 @@ void view3d_keymap(wmKeyConfig *keyconf)
kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD7, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
RNA_enum_set(kmi->ptr, "type", RV3D_VIEW_BOTTOM);
RNA_boolean_set(kmi->ptr, "align_active", TRUE);
-#endif
WM_keymap_add_item(keymap, "VIEW3D_OT_localview", PADSLASHKEY, KM_PRESS, 0, 0);
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c
index c557952a454..522ec117b37 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -26,6 +26,11 @@
* ***** END GPL LICENSE BLOCK *****
*/
+/** \file blender/editors/space_view3d/view3d_select.c
+ * \ingroup spview3d
+ */
+
+
#include <string.h>
#include <stdio.h>
#include <math.h>
@@ -72,7 +77,7 @@
#include "ED_mball.h"
#include "UI_interface.h"
-
+#include "UI_resources.h"
#include "view3d_intern.h" // own include
@@ -199,26 +204,6 @@ void EDBM_backbuf_checkAndSelectTFaces(Mesh *me, int select)
}
}
-#if 0
-void arrows_move_cursor(unsigned short event)
-{
- short mval[2];
-
- getmouseco_sc(mval);
-
- if(event==UPARROWKEY) {
- warp_pointer(mval[0], mval[1]+1);
- } else if(event==DOWNARROWKEY) {
- warp_pointer(mval[0], mval[1]-1);
- } else if(event==LEFTARROWKEY) {
- warp_pointer(mval[0]-1, mval[1]);
- } else if(event==RIGHTARROWKEY) {
- warp_pointer(mval[0]+1, mval[1]);
- }
-}
-#endif
-
-
/* *********************** GESTURE AND LASSO ******************* */
static int view3d_selectable_data(bContext *C)
@@ -317,7 +302,7 @@ int lasso_inside(short mcords[][2], short moves, short sx, short sy)
cross= (float)((p1[1]-p2[1])*(p1[0]-sx) + (p2[0]-p1[0])*(p1[1]-sy));
- if(cross<0.0) angletot-= ang;
+ if(cross<0.0f) angletot-= ang;
else angletot+= ang;
/* circulate */
@@ -1013,7 +998,7 @@ static Base *mouse_select_menu(bContext *C, ViewContext *vc, unsigned int *buffe
}
else {
/* UI */
- uiPopupMenu *pup= uiPupMenuBegin(C, "Select Object", ICON_NULL);
+ uiPopupMenu *pup= uiPupMenuBegin(C, "Select Object", ICON_NONE);
uiLayout *layout= uiPupMenuLayout(pup);
uiLayout *split= uiLayoutSplit(layout, 0, 0);
uiLayout *column= uiLayoutColumn(split, 0);
@@ -1264,7 +1249,7 @@ static int mouse_select(bContext *C, short *mval, short extend, short obcenter,
}
base= base->next;
- if(base==0) base= FIRSTBASE;
+ if(base==NULL) base= FIRSTBASE;
if(base==startbase) break;
}
}
@@ -1993,7 +1978,7 @@ static void paint_facesel_circle_select(ViewContext *vc, int select, short *mval
int bbsel;
if (me) {
- bm_vertoffs= me->totface+1; /* max index array */
+ bm_vertoffs= me->totpoly+1; /* max index array */
bbsel= EDBM_init_backbuf_circle(vc, mval[0], mval[1], (short)(rad+1.0));
EDBM_backbuf_checkAndSelectTFaces(me, select==LEFTMOUSE);
diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c
index 84985a7b81e..a2fb58d386a 100644
--- a/source/blender/editors/space_view3d/view3d_snap.c
+++ b/source/blender/editors/space_view3d/view3d_snap.c
@@ -27,6 +27,11 @@
* ***** END GPL LICENSE BLOCK *****
*/
+/** \file blender/editors/space_view3d/view3d_snap.c
+ * \ingroup spview3d
+ */
+
+
#include <math.h>
#include <string.h>
@@ -266,7 +271,7 @@ static void make_trans_verts(Object *obedit, float *min, float *max, int mode)
if(BMINDEX_GET(eve)) {
VECCOPY(tv->oldloc, eve->co);
tv->loc= eve->co;
- if(eve->no[0]!=0.0 || eve->no[1]!=0.0 ||eve->no[2]!=0.0)
+ 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= BMINDEX_GET(eve) & SELECT;
tv++;
@@ -450,11 +455,11 @@ static void make_trans_verts(Object *obedit, float *min, float *max, int mode)
for(a=0; a<tottrans; a++, tv++) {
if(tv->flag & SELECT) {
add_v3_v3(centroid, tv->oldloc);
- total+= 1.0;
+ total += 1.0f;
DO_MINMAX(tv->oldloc, min, max);
}
}
- if(total!=0.0) {
+ if(total != 0.0f) {
mul_v3_fl(centroid, 1.0f/total);
}
@@ -492,9 +497,9 @@ static int snap_sel_to_grid(bContext *C, wmOperator *UNUSED(op))
VECCOPY(vec, tv->loc);
mul_m3_v3(bmat, vec);
add_v3_v3(vec, obedit->obmat[3]);
- vec[0]= gridf*floor(.5+ vec[0]/gridf);
- vec[1]= gridf*floor(.5+ vec[1]/gridf);
- vec[2]= gridf*floor(.5+ vec[2]/gridf);
+ vec[0]= gridf*floorf(0.5f+ vec[0]/gridf);
+ vec[1]= gridf*floorf(0.5f+ vec[1]/gridf);
+ vec[2]= gridf*floorf(0.5f+ vec[2]/gridf);
sub_v3_v3(vec, obedit->obmat[3]);
mul_m3_v3(imat, vec);
@@ -522,9 +527,9 @@ static int snap_sel_to_grid(bContext *C, wmOperator *UNUSED(op))
/* get nearest grid point to snap to */
VECCOPY(nLoc, pchan->pose_mat[3]);
- vec[0]= gridf * (float)(floor(.5+ nLoc[0]/gridf));
- vec[1]= gridf * (float)(floor(.5+ nLoc[1]/gridf));
- vec[2]= gridf * (float)(floor(.5+ nLoc[2]/gridf));
+ vec[0]= gridf * (float)(floor(0.5f+ nLoc[0]/gridf));
+ vec[1]= gridf * (float)(floor(0.5f+ nLoc[1]/gridf));
+ vec[2]= gridf * (float)(floor(0.5f+ nLoc[2]/gridf));
/* get bone-space location of grid point */
armature_loc_pose_to_bone(pchan, vec, vecN);
@@ -552,9 +557,9 @@ static int snap_sel_to_grid(bContext *C, wmOperator *UNUSED(op))
else {
ob->recalc |= OB_RECALC_OB;
- vec[0]= -ob->obmat[3][0]+gridf*floor(.5+ ob->obmat[3][0]/gridf);
- vec[1]= -ob->obmat[3][1]+gridf*floor(.5+ ob->obmat[3][1]/gridf);
- vec[2]= -ob->obmat[3][2]+gridf*floor(.5+ ob->obmat[3][2]/gridf);
+ vec[0]= -ob->obmat[3][0]+gridf*floorf(0.5f+ ob->obmat[3][0]/gridf);
+ 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) {
where_is_object(scene, ob);
@@ -737,9 +742,9 @@ static int snap_curs_to_grid(bContext *C, wmOperator *UNUSED(op))
gridf= rv3d->gridview;
curs= give_cursor(scene, v3d);
- curs[0]= gridf*floor(.5+curs[0]/gridf);
- curs[1]= gridf*floor(.5+curs[1]/gridf);
- curs[2]= gridf*floor(.5+curs[2]/gridf);
+ curs[0]= gridf*floorf(0.5f+curs[0]/gridf);
+ curs[1]= gridf*floorf(0.5f+curs[1]/gridf);
+ curs[2]= gridf*floorf(0.5f+curs[2]/gridf);
WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, v3d); // hrm
@@ -798,7 +803,7 @@ static int snap_curs_to_sel(bContext *C, wmOperator *UNUSED(op))
}
if(v3d->around==V3D_CENTROID) {
- mul_v3_fl(centroid, 1.0/(float)tottrans);
+ mul_v3_fl(centroid, 1.0f/(float)tottrans);
VECCOPY(curs, centroid);
}
else {
@@ -838,7 +843,7 @@ static int snap_curs_to_sel(bContext *C, wmOperator *UNUSED(op))
}
if(count) {
if(v3d->around==V3D_CENTROID) {
- mul_v3_fl(centroid, 1.0/(float)count);
+ mul_v3_fl(centroid, 1.0f/(float)count);
VECCOPY(curs, centroid);
}
else {
diff --git a/source/blender/editors/space_view3d/view3d_toolbar.c b/source/blender/editors/space_view3d/view3d_toolbar.c
index 3292c5d396c..20d3db2b599 100644
--- a/source/blender/editors/space_view3d/view3d_toolbar.c
+++ b/source/blender/editors/space_view3d/view3d_toolbar.c
@@ -26,6 +26,11 @@
* ***** END GPL LICENSE BLOCK *****
*/
+/** \file blender/editors/space_view3d/view3d_toolbar.c
+ * \ingroup spview3d
+ */
+
+
#include <string.h>
#include <stdio.h>
#include <math.h>
@@ -94,7 +99,7 @@ static void view3d_panel_operator_redo_operator(const bContext *C, Panel *pa, wm
{
if(op->type->flag & OPTYPE_MACRO) {
for(op= op->macro.first; op; op= op->next) {
- uiItemL(pa->layout, op->type->name, ICON_NULL);
+ uiItemL(pa->layout, op->type->name, ICON_NONE);
view3d_panel_operator_redo_operator(C, pa, op);
}
}
@@ -215,7 +220,7 @@ static void view3d_panel_tool_shelf(const bContext *C, Panel *pa)
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_NULL, NULL, WM_OP_INVOKE_REGION_WIN, 0);
+ uiItemFullO(col, ct->opname, NULL, ICON_NONE, NULL, WM_OP_INVOKE_REGION_WIN, 0);
}
}
}
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index 794088de20c..1d93f5ebc83 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -26,6 +26,11 @@
* ***** END GPL LICENSE BLOCK *****
*/
+/** \file blender/editors/space_view3d/view3d_view.c
+ * \ingroup spview3d
+ */
+
+
#include "DNA_camera_types.h"
#include "DNA_lamp_types.h"
#include "DNA_scene_types.h"
@@ -41,6 +46,7 @@
#include "BKE_anim.h"
#include "BKE_action.h"
#include "BKE_context.h"
+#include "BKE_depsgraph.h"
#include "BKE_object.h"
#include "BKE_global.h"
#include "BKE_main.h"
@@ -107,9 +113,9 @@ static void object_lens_clip_settings(Object *ob, float *lens, float *clipsta, f
Lamp *la = ob->data;
if (lens) {
float x1, fac;
- fac= cos( M_PI*la->spotsize/360.0);
+ fac= cosf((float)M_PI*la->spotsize/360.0f);
x1= saacos(fac);
- *lens= 16.0*fac/sin(x1);
+ *lens= 16.0f*fac/sinf(x1);
}
if (clipsta) *clipsta= la->clipsta;
if (clipend) *clipend= la->clipend;
@@ -261,7 +267,7 @@ void smooth_view(bContext *C, Object *oldcamera, Object *camera, float *ofs, flo
mul_qt_v3(q2, vec2);
/* scale the time allowed by the rotation */
- sms.time_allowed *= angle_v3v3(vec1, vec2) / M_PI; /* 180deg == 1.0 */
+ sms.time_allowed *= (double)angle_v3v3(vec1, vec2) / M_PI; /* 180deg == 1.0 */
}
/* ensure it shows correct */
@@ -306,14 +312,14 @@ static int view3d_smoothview_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent
View3D *v3d = CTX_wm_view3d(C);
RegionView3D *rv3d= CTX_wm_region_view3d(C);
struct SmoothViewStore *sms= rv3d->sms;
- double step, step_inv;
+ float step, step_inv;
/* escape if not our timer */
if(rv3d->smooth_timer==NULL || rv3d->smooth_timer!=event->customdata)
return OPERATOR_PASS_THROUGH;
- if(sms->time_allowed != 0.0f)
- step = (rv3d->smooth_timer->duration)/sms->time_allowed;
+ if(sms->time_allowed != 0.0)
+ step = (float)((rv3d->smooth_timer->duration)/sms->time_allowed);
else
step = 1.0f;
@@ -350,18 +356,18 @@ static int view3d_smoothview_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent
int i;
/* ease in/out */
- if (step < 0.5) step = (float)pow(step*2, 2)/2;
- else step = (float)1-(pow(2*(1-step),2)/2);
+ if (step < 0.5f) step = (float)pow(step*2.0f, 2.0)/2.0f;
+ else step = (float)1.0f-(powf(2.0f*(1.0f-step),2.0f)/2.0f);
- step_inv = 1.0-step;
+ step_inv = 1.0f-step;
for (i=0; i<3; i++)
- rv3d->ofs[i] = sms->new_ofs[i]*step + sms->orig_ofs[i]*step_inv;
+ rv3d->ofs[i] = sms->new_ofs[i] * step + sms->orig_ofs[i]*step_inv;
interp_qt_qtqt(rv3d->viewquat, sms->orig_quat, sms->new_quat, step);
- rv3d->dist = sms->new_dist*step + sms->orig_dist*step_inv;
- v3d->lens = sms->new_lens*step + sms->orig_lens*step_inv;
+ rv3d->dist = sms->new_dist * step + sms->orig_dist*step_inv;
+ v3d->lens = sms->new_lens * step + sms->orig_lens*step_inv;
}
if(rv3d->viewlock & RV3D_BOXVIEW)
@@ -419,6 +425,7 @@ static int view3d_setcameratoview_exec(bContext *C, wmOperator *UNUSED(op))
}
setcameratoview3d(rv3d, v3d->camera);
+ DAG_id_tag_update(&v3d->camera->id, OB_RECALC_OB);
rv3d->persp = RV3D_CAMOB;
WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, v3d->camera);
@@ -670,6 +677,28 @@ void window_to_3d_delta(ARegion *ar, float *vec, short mx, short my)
vec[2]= (rv3d->persinv[0][2]*dx + rv3d->persinv[1][2]*dy);
}
+/* doesn't rely on initgrabz */
+/* for perspective view, get the vector direction to
+ * the mouse cursor as a normalized vector */
+void window_to_3d_vector(ARegion *ar, float *vec, short mx, short my)
+{
+ RegionView3D *rv3d= ar->regiondata;
+ float dx, dy;
+ float viewvec[3];
+
+ dx= 2.0f*mx/ar->winx;
+ dy= 2.0f*my/ar->winy;
+
+ /* normalize here so vecs are proportional to eachother */
+ normalize_v3_v3(viewvec, rv3d->viewinv[2]);
+
+ vec[0]= viewvec[0] - (rv3d->persinv[0][0]*dx + rv3d->persinv[1][0]*dy);
+ vec[1]= viewvec[1] - (rv3d->persinv[0][1]*dx + rv3d->persinv[1][1]*dy);
+ vec[2]= viewvec[2] - (rv3d->persinv[0][2]*dx + rv3d->persinv[1][2]*dy);
+
+ normalize_v3(vec);
+}
+
float read_cached_depth(ViewContext *vc, int x, int y)
{
ViewDepths *vd = vc->rv3d->depths;
@@ -801,14 +830,14 @@ void project_short(ARegion *ar, float *vec, short *adr) /* clips */
vec4[3]= 1.0;
mul_m4_v4(rv3d->persmat, vec4);
- if( vec4[3]>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) {
fy= (ar->winy/2)*(1 + vec4[1]/vec4[3]);
- if(fy>0.0 && fy< (float)ar->winy) {
+ if(fy > 0.0f && fy < (float)ar->winy) {
adr[0]= (short)floor(fx);
adr[1]= (short)floor(fy);
}
@@ -827,7 +856,7 @@ void project_int(ARegion *ar, float *vec, int *adr)
mul_m4_v4(rv3d->persmat, vec4);
- if( vec4[3]>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) {
@@ -876,14 +905,14 @@ void project_short_noclip(ARegion *ar, float *vec, short *adr)
mul_m4_v4(rv3d->persmat, vec4);
- if( vec4[3]>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) {
fy= (ar->winy/2)*(1 + vec4[1]/vec4[3]);
- if(fy>-32700.0 && fy<32700.0) {
+ if(fy > -32700.0f && fy < 32700.0f) {
adr[0]= (short)floor(fx);
adr[1]= (short)floor(fy);
}
@@ -902,9 +931,9 @@ void project_float(ARegion *ar, float *vec, float *adr)
mul_m4_v4(rv3d->persmat, vec4);
- if( vec4[3]>BL_NEAR_CLIP ) {
- adr[0] = (float)(ar->winx/2.0)+(ar->winx/2.0)*vec4[0]/vec4[3];
- adr[1] = (float)(ar->winy/2.0)+(ar->winy/2.0)*vec4[1]/vec4[3];
+ if(vec4[3] > (float)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];
}
}
@@ -919,8 +948,8 @@ void project_float_noclip(ARegion *ar, float *vec, float *adr)
mul_m4_v4(rv3d->persmat, vec4);
if( fabs(vec4[3]) > BL_NEAR_CLIP ) {
- adr[0] = (float)(ar->winx/2.0)+(ar->winx/2.0)*vec4[0]/vec4[3];
- adr[1] = (float)(ar->winy/2.0)+(ar->winy/2.0)*vec4[1]/vec4[3];
+ 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
{
@@ -979,7 +1008,7 @@ int get_view3d_cliprange(View3D *v3d, RegionView3D *rv3d, float *clipsta, float
}
if(rv3d->persp==RV3D_ORTHO) {
- *clipend *= 0.5; // otherwise too extreme low zbuffer quality
+ *clipend *= 0.5f; // otherwise too extreme low zbuffer quality
*clipsta= - *clipend;
orth= 1;
}
@@ -1006,10 +1035,10 @@ int get_view3d_viewplane(View3D *v3d, RegionView3D *rv3d, int winxi, int winyi,
Lamp *la;
la= v3d->camera->data;
- fac= cos( M_PI*la->spotsize/360.0);
+ fac= cosf(((float)M_PI)*la->spotsize/360.0f);
x1= saacos(fac);
- lens= 16.0*fac/sin(x1);
+ lens= 16.0f*fac/sinf(x1);
*clipsta= la->clipsta;
*clipend= la->clipend;
@@ -1032,14 +1061,14 @@ int get_view3d_viewplane(View3D *v3d, RegionView3D *rv3d, int winxi, int winyi,
else y1= -rv3d->dist;
y2= -y1;
- *clipend *= 0.5; // otherwise too extreme low zbuffer quality
+ *clipend *= 0.5f; // otherwise too extreme low zbuffer quality
*clipsta= - *clipend;
orth= 1;
}
else {
/* fac for zoom, also used for camdx */
if(rv3d->persp==RV3D_CAMOB) {
- fac= (1.41421+( (float)rv3d->camzoom )/50.0);
+ fac= (1.41421f + ( (float)rv3d->camzoom )/50.0f);
fac*= fac;
}
else fac= 2.0;
@@ -1047,7 +1076,7 @@ int get_view3d_viewplane(View3D *v3d, RegionView3D *rv3d, int winxi, int winyi,
/* viewplane size depends... */
if(cam && cam->type==CAM_ORTHO) {
/* ortho_scale == 1 means exact 1 to 1 mapping */
- float dfac= 2.0*cam->ortho_scale/fac;
+ float dfac= 2.0f*cam->ortho_scale/fac;
if(winx>winy) x1= -dfac;
else x1= -winx*dfac/winy;
@@ -1061,8 +1090,8 @@ int get_view3d_viewplane(View3D *v3d, RegionView3D *rv3d, int winxi, int winyi,
else {
float dfac;
- if(winx>winy) dfac= 64.0/(fac*winx*lens);
- else dfac= 64.0/(fac*winy*lens);
+ if(winx>winy) dfac= 64.0f/(fac*winx*lens);
+ else dfac= 64.0f/(fac*winy*lens);
x1= - *clipsta * winx*dfac;
x2= -x1;
@@ -1072,8 +1101,8 @@ int get_view3d_viewplane(View3D *v3d, RegionView3D *rv3d, int winxi, int winyi,
}
/* cam view offset */
if(cam) {
- float dx= 0.5*fac*rv3d->camdx*(x2-x1);
- float dy= 0.5*fac*rv3d->camdy*(y2-y1);
+ float dx= 0.5f*fac*rv3d->camdx*(x2-x1);
+ float dy= 0.5f*fac*rv3d->camdy*(y2-y1);
/* shift offset */
if(cam->type==CAM_ORTHO) {
@@ -1081,8 +1110,8 @@ int get_view3d_viewplane(View3D *v3d, RegionView3D *rv3d, int winxi, int winyi,
dy += cam->shifty * cam->ortho_scale;
}
else {
- dx += cam->shiftx * (cam->clipsta / cam->lens) * 32.0;
- dy += cam->shifty * (cam->clipsta / cam->lens) * 32.0;
+ dx += cam->shiftx * (cam->clipsta / cam->lens) * 32.0f;
+ dy += cam->shifty * (cam->clipsta / cam->lens) * 32.0f;
}
x1+= dx;
@@ -1100,7 +1129,7 @@ int get_view3d_viewplane(View3D *v3d, RegionView3D *rv3d, int winxi, int winyi,
*pixsize= 1.0f/viewfac;
}
else {
- viewfac= (((winx >= winy)? winx: winy)*lens)/32.0;
+ viewfac= (((winx >= winy)? winx: winy)*lens)/32.0f;
*pixsize= *clipsta/viewfac;
}
}
@@ -1195,33 +1224,37 @@ static void obmat_to_viewmat(View3D *v3d, RegionView3D *rv3d, Object *ob, short
#define QUATSET(a, b, c, d, e) a[0]=b; a[1]=c; a[2]=d; a[3]=e;
-static void view3d_viewlock(RegionView3D *rv3d)
+int ED_view3d_lock(RegionView3D *rv3d)
{
switch(rv3d->view) {
case RV3D_VIEW_BOTTOM :
QUATSET(rv3d->viewquat,0.0, -1.0, 0.0, 0.0);
break;
-
+
case RV3D_VIEW_BACK:
QUATSET(rv3d->viewquat,0.0, 0.0, (float)-cos(M_PI/4.0), (float)-cos(M_PI/4.0));
break;
-
+
case RV3D_VIEW_LEFT:
QUATSET(rv3d->viewquat,0.5, -0.5, 0.5, 0.5);
break;
-
+
case RV3D_VIEW_TOP:
QUATSET(rv3d->viewquat,1.0, 0.0, 0.0, 0.0);
break;
-
+
case RV3D_VIEW_FRONT:
QUATSET(rv3d->viewquat,(float)cos(M_PI/4.0), (float)-sin(M_PI/4.0), 0.0, 0.0);
break;
-
+
case RV3D_VIEW_RIGHT:
QUATSET(rv3d->viewquat, 0.5, -0.5, -0.5, -0.5);
break;
+ default:
+ return FALSE;
}
+
+ return TRUE;
}
/* dont set windows active in in here, is used by renderwin too */
@@ -1240,7 +1273,7 @@ void setviewmatrixview3d(Scene *scene, View3D *v3d, RegionView3D *rv3d)
else {
/* should be moved to better initialize later on XXX */
if(rv3d->viewlock)
- view3d_viewlock(rv3d);
+ ED_view3d_lock(rv3d);
quat_to_mat4( rv3d->viewmat,rv3d->viewquat);
if(rv3d->persp==RV3D_PERSP) rv3d->viewmat[3][2]-= rv3d->dist;
@@ -1508,7 +1541,7 @@ 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.01) size= 0.01;
+ if(size <= 0.01f) size= 0.01f;
}
if(ok) {
@@ -1525,19 +1558,19 @@ static void initlocalview(Main *bmain, Scene *scene, ScrArea *sa)
rv3d->localvd= MEM_mallocN(sizeof(RegionView3D), "localview region");
memcpy(rv3d->localvd, rv3d, sizeof(RegionView3D));
- rv3d->ofs[0]= -(min[0]+max[0])/2.0;
- rv3d->ofs[1]= -(min[1]+max[1])/2.0;
- rv3d->ofs[2]= -(min[2]+max[2])/2.0;
+ rv3d->ofs[0]= -(min[0]+max[0])/2.0f;
+ rv3d->ofs[1]= -(min[1]+max[1])/2.0f;
+ rv3d->ofs[2]= -(min[2]+max[2])/2.0f;
rv3d->dist= size;
/* perspective should be a bit farther away to look nice */
if(rv3d->persp==RV3D_ORTHO)
- rv3d->dist*= 0.7;
+ rv3d->dist*= 0.7f;
// correction for window aspect ratio
if(ar->winy>2 && ar->winx>2) {
float asp= (float)ar->winx/(float)ar->winy;
- if(asp<1.0) asp= 1.0/asp;
+ if(asp < 1.0f) asp= 1.0f/asp;
rv3d->dist*= asp;
}
@@ -1706,7 +1739,7 @@ static void RestoreState(bContext *C, wmWindow *win)
}
/* was space_set_commmandline_options in 2.4x */
-void game_set_commmandline_options(GameData *gm)
+static void game_set_commmandline_options(GameData *gm)
{
SYS_SystemHandle syshandle;
int test;