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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2018-06-04 10:31:30 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-06-04 10:31:30 +0300
commit44505b38df557a5711703613685a1dec9fc2c3d9 (patch)
tree3f05bebcc7bfadf56569f2dcca7f95fc56b1b0d0 /source/blender/editors/space_view3d
parent6654e109df952be3a3128fae2508a02c196ae593 (diff)
Cleanup: strip trailing space in editors
Diffstat (limited to 'source/blender/editors/space_view3d')
-rw-r--r--source/blender/editors/space_view3d/drawanimviz.c86
-rw-r--r--source/blender/editors/space_view3d/drawarmature.c702
-rw-r--r--source/blender/editors/space_view3d/drawmesh.c36
-rw-r--r--source/blender/editors/space_view3d/drawobject.c376
-rw-r--r--source/blender/editors/space_view3d/drawsimdebug.c52
-rw-r--r--source/blender/editors/space_view3d/space_view3d.c138
-rw-r--r--source/blender/editors/space_view3d/view3d_buttons.c4
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c278
-rw-r--r--source/blender/editors/space_view3d/view3d_fly.c8
-rw-r--r--source/blender/editors/space_view3d/view3d_header.c30
-rw-r--r--source/blender/editors/space_view3d/view3d_ops.c54
-rw-r--r--source/blender/editors/space_view3d/view3d_project.c16
-rw-r--r--source/blender/editors/space_view3d/view3d_ruler.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_select.c180
-rw-r--r--source/blender/editors/space_view3d/view3d_snap.c80
-rw-r--r--source/blender/editors/space_view3d/view3d_toolbar.c36
-rw-r--r--source/blender/editors/space_view3d/view3d_view.c120
17 files changed, 1099 insertions, 1099 deletions
diff --git a/source/blender/editors/space_view3d/drawanimviz.c b/source/blender/editors/space_view3d/drawanimviz.c
index 7d279b95e3b..ba75ae6f766 100644
--- a/source/blender/editors/space_view3d/drawanimviz.c
+++ b/source/blender/editors/space_view3d/drawanimviz.c
@@ -65,12 +65,12 @@
* - include support for editing the path verts */
/* Set up drawing environment for drawing motion paths */
-void draw_motion_paths_init(View3D *v3d, ARegion *ar)
+void draw_motion_paths_init(View3D *v3d, ARegion *ar)
{
RegionView3D *rv3d = ar->regiondata;
-
+
if (v3d->zbuf) glDisable(GL_DEPTH_TEST);
-
+
glPushMatrix();
glLoadMatrixf(rv3d->viewmat);
}
@@ -97,7 +97,7 @@ static void set_motion_path_color(Scene *scene, bMotionPath *mpath, int i, short
if (frame < CFRA) {
if (mpath->flag & MOTIONPATH_FLAG_CUSTOM) {
/* Custom color: previous frames color is darker than current frame */
- glColor3fv(prev_color);
+ glColor3fv(prev_color);
}
else {
/* black - before cfra */
@@ -115,7 +115,7 @@ static void set_motion_path_color(Scene *scene, bMotionPath *mpath, int i, short
else if (frame > CFRA) {
if (mpath->flag & MOTIONPATH_FLAG_CUSTOM) {
/* Custom color: next frames color is equal to user selected color */
- glColor3fv(next_color);
+ glColor3fv(next_color);
}
else {
/* blue - after cfra */
@@ -133,7 +133,7 @@ static void set_motion_path_color(Scene *scene, bMotionPath *mpath, int i, short
else {
if (mpath->flag & MOTIONPATH_FLAG_CUSTOM) {
/* Custom color: current frame color is slightly darker than user selected color */
- glColor3fv(frame_color);
+ glColor3fv(frame_color);
}
else {
/* green - on cfra */
@@ -149,11 +149,11 @@ static void set_motion_path_color(Scene *scene, bMotionPath *mpath, int i, short
#undef SET_INTENSITY
}
-/* Draw the given motion path for an Object or a Bone
+/* Draw the given motion path for an Object or a Bone
* - assumes that the viewport has already been initialized properly
* i.e. draw_motion_paths_init() has been called
*/
-void draw_motion_path_instance(Scene *scene,
+void draw_motion_path_instance(Scene *scene,
Object *ob, bPoseChannel *pchan, bAnimVizSettings *avs, bMotionPath *mpath)
{
//RegionView3D *rv3d = ar->regiondata;
@@ -182,10 +182,10 @@ void draw_motion_path_instance(Scene *scene,
/* Save old line width */
GLfloat old_width;
glGetFloatv(GL_LINE_WIDTH, &old_width);
-
+
/* get frame ranges */
if (avs->path_type == MOTIONPATH_TYPE_ACFRA) {
- /* With "Around Current", we only choose frames from around
+ /* With "Around Current", we only choose frames from around
* the current frame to draw.
*/
sfra = CFRA - avs->path_bc;
@@ -196,8 +196,8 @@ void draw_motion_path_instance(Scene *scene,
sfra = avs->path_sf;
efra = avs->path_ef;
}
-
- /* no matter what, we can only show what is in the cache and no more
+
+ /* no matter what, we can only show what is in the cache and no more
* - abort if whole range is past ends of path
* - otherwise clamp endpoints to extents of path
*/
@@ -209,22 +209,22 @@ void draw_motion_path_instance(Scene *scene,
/* end clamp */
efra = mpath->end_frame;
}
-
+
if ((sfra > mpath->end_frame) || (efra < mpath->start_frame)) {
/* whole path is out of bounds */
return;
}
-
+
len = efra - sfra;
-
+
if ((len <= 0) || (mpath->points == NULL)) {
return;
}
-
+
/* get pointers to parts of path */
sind = sfra - mpath->start_frame;
mpv_start = (mpath->points + sind);
-
+
/* draw curve-line of path */
/* Draw lines only if line drawing option is enabled */
if (mpath->flag & MOTIONPATH_FLAG_LINES) {
@@ -247,7 +247,7 @@ void draw_motion_path_instance(Scene *scene,
/* Point must be bigger than line thickness */
glPointSize(mpath->line_thickness + 1.0);
-
+
/* draw little black point at each frame
* NOTE: this is not really visible/noticeable
*/
@@ -255,7 +255,7 @@ void draw_motion_path_instance(Scene *scene,
for (i = 0, mpv = mpv_start; i < len; i++, mpv++)
glVertex3fv(mpv->co);
glEnd();
-
+
/* Draw little white dots at each framestep value or replace with custom color */
if (mpath->flag & MOTIONPATH_FLAG_CUSTOM) {
glColor4fv(mpath->color);
@@ -267,39 +267,39 @@ void draw_motion_path_instance(Scene *scene,
for (i = 0, mpv = mpv_start; i < len; i += stepsize, mpv += stepsize)
glVertex3fv(mpv->co);
glEnd();
-
- /* Draw big green dot where the current frame is
+
+ /* Draw big green dot where the current frame is
* NOTE: this is only done when keyframes are shown, since this adds similar types of clutter
*/
if ((avs->path_viewflag & MOTIONPATH_VIEW_KFRAS) &&
- (sfra < CFRA) && (CFRA <= efra))
+ (sfra < CFRA) && (CFRA <= efra))
{
UI_ThemeColor(TH_CFRAME);
-
+
glPointSize(mpath->line_thickness + 5.0);
glBegin(GL_POINTS);
mpv = mpv_start + (CFRA - sfra);
glVertex3fv(mpv->co);
glEnd();
-
+
UI_ThemeColor(TH_TEXT_HI);
}
-
+
/* XXX, this isn't up to date but probably should be kept so. */
invert_m4_m4(ob->imat, ob->obmat);
-
+
/* Draw frame numbers at each framestep value */
if (avs->path_viewflag & MOTIONPATH_VIEW_FNUMS) {
unsigned char col[4];
UI_GetThemeColor3ubv(TH_TEXT_HI, col);
col[3] = 255;
-
+
for (i = 0, mpv = mpv_start; i < len; i += stepsize, mpv += stepsize) {
int frame = sfra + i;
char numstr[32];
size_t numstr_len;
float co[3];
-
+
/* only draw framenum if several consecutive highlighted points don't occur on same point */
if (i == 0) {
numstr_len = sprintf(numstr, " %d", frame);
@@ -310,7 +310,7 @@ void draw_motion_path_instance(Scene *scene,
else if ((i >= stepsize) && (i < len - stepsize)) {
bMotionPathVert *mpvP = (mpv - stepsize);
bMotionPathVert *mpvN = (mpv + stepsize);
-
+
if ((equals_v3v3(mpv->co, mpvP->co) == 0) || (equals_v3v3(mpv->co, mpvN->co) == 0)) {
numstr_len = sprintf(numstr, " %d", frame);
mul_v3_m4v3(co, ob->imat, mpv->co);
@@ -320,24 +320,24 @@ void draw_motion_path_instance(Scene *scene,
}
}
}
-
+
/* Keyframes - dots and numbers */
if (avs->path_viewflag & MOTIONPATH_VIEW_KFRAS) {
unsigned char col[4];
-
+
AnimData *adt = BKE_animdata_from_id(&ob->id);
DLRBT_Tree keys;
-
+
/* build list of all keyframes in active action for object or pchan */
BLI_dlrbTree_init(&keys);
-
+
if (adt) {
/* it is assumed that keyframes for bones are all grouped in a single group
* unless an option is set to always use the whole action
*/
if ((pchan) && (avs->path_viewflag & MOTIONPATH_VIEW_KFACT) == 0) {
bActionGroup *agrp = BKE_action_group_find_name(adt->action, pchan->name);
-
+
if (agrp) {
agroup_to_keylist(adt, agrp, &keys, NULL);
BLI_dlrbTree_linkedlist_sync(&keys);
@@ -348,11 +348,11 @@ void draw_motion_path_instance(Scene *scene,
BLI_dlrbTree_linkedlist_sync(&keys);
}
}
-
+
/* Draw slightly-larger yellow dots at each keyframe */
UI_GetThemeColor3ubv(TH_VERTEX_SELECT, col);
col[3] = 255;
-
+
/* if custom, point must be bigger than line */
if (mpath->flag & MOTIONPATH_FLAG_CUSTOM) {
glPointSize(mpath->line_thickness + 3.0);
@@ -361,27 +361,27 @@ void draw_motion_path_instance(Scene *scene,
glPointSize(4.0f);
}
glColor3ubv(col);
-
+
glBegin(GL_POINTS);
for (i = 0, mpv = mpv_start; i < len; i++, mpv++) {
- int frame = sfra + i;
+ int frame = sfra + i;
float mframe = (float)(frame);
-
+
if (BLI_dlrbTree_search_exact(&keys, compare_ak_cfraPtr, &mframe))
glVertex3fv(mpv->co);
}
glEnd();
-
+
/* Draw frame numbers of keyframes */
if (avs->path_viewflag & MOTIONPATH_VIEW_KFNOS) {
float co[3];
for (i = 0, mpv = mpv_start; i < len; i++, mpv++) {
float mframe = (float)(sfra + i);
-
+
if (BLI_dlrbTree_search_exact(&keys, compare_ak_cfraPtr, &mframe)) {
char numstr[32];
size_t numstr_len;
-
+
numstr_len = sprintf(numstr, " %d", (sfra + i));
mul_v3_m4v3(co, ob->imat, mpv->co);
view3d_cached_text_draw_add(co, numstr, numstr_len,
@@ -389,7 +389,7 @@ void draw_motion_path_instance(Scene *scene,
}
}
}
-
+
BLI_dlrbTree_free(&keys);
}
}
diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c
index 9a2dfd82609..bbda002eb8d 100644
--- a/source/blender/editors/space_view3d/drawarmature.c
+++ b/source/blender/editors/space_view3d/drawarmature.c
@@ -93,13 +93,13 @@ static void set_pchan_colorset(Object *ob, bPoseChannel *pchan)
bArmature *arm = (ob) ? ob->data : NULL;
bActionGroup *grp = NULL;
short color_index = 0;
-
+
/* sanity check */
if (ELEM(NULL, ob, arm, pose, pchan)) {
bcolor = NULL;
return;
}
-
+
/* only try to set custom color if enabled for armature */
if (arm->flag & ARM_COL_CUSTOM) {
/* currently, a bone can only use a custom color set if it's group (if it has one),
@@ -111,9 +111,9 @@ static void set_pchan_colorset(Object *ob, bPoseChannel *pchan)
color_index = grp->customCol;
}
}
-
+
/* bcolor is a pointer to the color set to use. If NULL, then the default
- * color set (based on the theme colors for 3d-view) is used.
+ * color set (based on the theme colors for 3d-view) is used.
*/
if (color_index > 0) {
bTheme *btheme = UI_GetTheme();
@@ -132,14 +132,14 @@ static void set_pchan_colorset(Object *ob, bPoseChannel *pchan)
static void cp_shade_color3ub(unsigned char cp[3], const int offset)
{
int r, g, b;
-
+
r = offset + (int) cp[0];
CLAMP(r, 0, 255);
g = offset + (int) cp[1];
CLAMP(g, 0, 255);
b = offset + (int) cp[2];
CLAMP(b, 0, 255);
-
+
cp[0] = r;
cp[1] = g;
cp[2] = b;
@@ -153,7 +153,7 @@ static bool set_pchan_glColor(short colCode, int boneflag, short constflag)
{
if (bcolor) {
unsigned char cp[3];
-
+
if (boneflag & BONE_DRAW_ACTIVE) {
copy_v3_v3_char((char *)cp, bcolor->active);
if (!(boneflag & BONE_SELECTED)) {
@@ -168,7 +168,7 @@ static bool set_pchan_glColor(short colCode, int boneflag, short constflag)
copy_v3_v3_char((char *)cp, bcolor->solid);
cp_shade_color3ub(cp, -50);
}
-
+
glColor3ubv(cp);
}
else {
@@ -185,7 +185,7 @@ static bool set_pchan_glColor(short colCode, int boneflag, short constflag)
UI_ThemeColor(TH_WIRE);
}
}
-
+
return true;
}
case PCHAN_COLOR_SOLID:
@@ -195,7 +195,7 @@ static bool set_pchan_glColor(short colCode, int boneflag, short constflag)
}
else
UI_ThemeColor(TH_BONE_SOLID);
-
+
return true;
}
case PCHAN_COLOR_CONSTS:
@@ -205,7 +205,7 @@ static bool set_pchan_glColor(short colCode, int boneflag, short constflag)
else if (constflag & PCHAN_HAS_IK) glColor4ub(255, 255, 0, 80);
else if (constflag & PCHAN_HAS_SPLINEIK) glColor4ub(200, 255, 0, 80);
else if (constflag & PCHAN_HAS_CONST) glColor4ub(0, 255, 120, 80);
-
+
return true;
}
return false;
@@ -232,7 +232,7 @@ static bool set_pchan_glColor(short colCode, int boneflag, short constflag)
else if (boneflag & BONE_SELECTED) UI_ThemeColor(TH_BONE_POSE);
else UI_ThemeColor(TH_BONE_SOLID);
}
-
+
return true;
}
case PCHAN_COLOR_SPHEREBONE_END:
@@ -252,7 +252,7 @@ static bool set_pchan_glColor(short colCode, int boneflag, short constflag)
copy_v3_v3_char((char *)cp, bcolor->solid);
cp_shade_color3ub(cp, -30);
}
-
+
glColor3ubv(cp);
}
else {
@@ -280,11 +280,11 @@ static bool set_pchan_glColor(short colCode, int boneflag, short constflag)
else
UI_ThemeColorShade(TH_BACK, -30);
}
-
+
return true;
}
}
-
+
return false;
}
@@ -322,7 +322,7 @@ static void drawsolidcube_size(float xsize, float ysize, float zsize)
{
static GLuint displist = 0;
float n[3] = {0.0f};
-
+
glScalef(xsize, ysize, zsize);
if (displist == 0) {
@@ -331,26 +331,26 @@ static void drawsolidcube_size(float xsize, float ysize, float zsize)
glBegin(GL_QUADS);
n[0] = -1.0;
- glNormal3fv(n);
+ glNormal3fv(n);
glVertex3fv(cube[0]); glVertex3fv(cube[1]); glVertex3fv(cube[2]); glVertex3fv(cube[3]);
n[0] = 0;
n[1] = -1.0;
- glNormal3fv(n);
+ glNormal3fv(n);
glVertex3fv(cube[0]); glVertex3fv(cube[4]); glVertex3fv(cube[5]); glVertex3fv(cube[1]);
n[1] = 0;
n[0] = 1.0;
- glNormal3fv(n);
+ glNormal3fv(n);
glVertex3fv(cube[4]); glVertex3fv(cube[7]); glVertex3fv(cube[6]); glVertex3fv(cube[5]);
n[0] = 0;
n[1] = 1.0;
- glNormal3fv(n);
+ glNormal3fv(n);
glVertex3fv(cube[7]); glVertex3fv(cube[3]); glVertex3fv(cube[2]); glVertex3fv(cube[6]);
n[1] = 0;
n[2] = 1.0;
- glNormal3fv(n);
+ glNormal3fv(n);
glVertex3fv(cube[1]); glVertex3fv(cube[5]); glVertex3fv(cube[6]); glVertex3fv(cube[2]);
n[2] = -1.0;
- glNormal3fv(n);
+ glNormal3fv(n);
glVertex3fv(cube[7]); glVertex3fv(cube[4]); glVertex3fv(cube[0]); glVertex3fv(cube[3]);
glEnd();
@@ -363,56 +363,56 @@ static void drawsolidcube_size(float xsize, float ysize, float zsize)
static void drawcube_size(float xsize, float ysize, float zsize)
{
static GLuint displist = 0;
-
+
if (displist == 0) {
displist = glGenLists(1);
glNewList(displist, GL_COMPILE);
-
+
glBegin(GL_LINE_STRIP);
glVertex3fv(cube[0]); glVertex3fv(cube[1]); glVertex3fv(cube[2]); glVertex3fv(cube[3]);
glVertex3fv(cube[0]); glVertex3fv(cube[4]); glVertex3fv(cube[5]); glVertex3fv(cube[6]);
glVertex3fv(cube[7]); glVertex3fv(cube[4]);
glEnd();
-
+
glBegin(GL_LINES);
glVertex3fv(cube[1]); glVertex3fv(cube[5]);
glVertex3fv(cube[2]); glVertex3fv(cube[6]);
glVertex3fv(cube[3]); glVertex3fv(cube[7]);
glEnd();
-
+
glEndList();
}
glScalef(xsize, ysize, zsize);
glCallList(displist);
-
+
}
static void draw_bonevert(void)
{
static GLuint displist = 0;
-
+
if (displist == 0) {
GLUquadricObj *qobj;
-
+
displist = glGenLists(1);
glNewList(displist, GL_COMPILE);
-
+
glPushMatrix();
-
+
qobj = gluNewQuadric();
- gluQuadricDrawStyle(qobj, GLU_SILHOUETTE);
+ gluQuadricDrawStyle(qobj, GLU_SILHOUETTE);
gluDisk(qobj, 0.0, 0.05, 16, 1);
-
+
glRotatef(90, 0, 1, 0);
gluDisk(qobj, 0.0, 0.05, 16, 1);
-
+
glRotatef(90, 1, 0, 0);
gluDisk(qobj, 0.0, 0.05, 16, 1);
-
- gluDeleteQuadric(qobj);
-
+
+ gluDeleteQuadric(qobj);
+
glPopMatrix();
glEndList();
}
@@ -423,19 +423,19 @@ static void draw_bonevert(void)
static void draw_bonevert_solid(void)
{
static GLuint displist = 0;
-
+
if (displist == 0) {
GLUquadricObj *qobj;
-
+
displist = glGenLists(1);
glNewList(displist, GL_COMPILE);
-
+
qobj = gluNewQuadric();
gluQuadricDrawStyle(qobj, GLU_FILL);
/* Draw tips of a bone */
gluSphere(qobj, 0.05, 8, 5);
- gluDeleteQuadric(qobj);
-
+ gluDeleteQuadric(qobj);
+
glEndList();
}
@@ -481,7 +481,7 @@ static const float bone_octahedral_solid_normals[8][3] = {
static void draw_bone_octahedral(void)
{
static GLuint displist = 0;
-
+
if (displist == 0) {
displist = glGenLists(1);
glNewList(displist, GL_COMPILE);
@@ -500,12 +500,12 @@ static void draw_bone_octahedral(void)
GL_UNSIGNED_INT,
bone_octahedral_wire_square);
glDisableClientState(GL_VERTEX_ARRAY);
-
+
glEndList();
}
glCallList(displist);
-}
+}
static void draw_bone_solid_octahedral(void)
{
@@ -543,7 +543,7 @@ static void draw_bone_solid_octahedral(void)
}
glCallList(displist);
-}
+}
/* *************** Armature drawing, bones ******************* */
@@ -554,7 +554,7 @@ static void draw_bone_points(const short dt, int armflag, unsigned int boneflag,
if ((boneflag & BONE_CONNECTED) == 0) {
if (id != -1)
GPU_select_load_id(id | BONESEL_ROOT);
-
+
if (dt <= OB_WIRE) {
if (armflag & ARM_EDITMODE) {
if (boneflag & BONE_ROOTSEL) UI_ThemeColor(TH_VERTEX_SELECT);
@@ -562,22 +562,22 @@ static void draw_bone_points(const short dt, int armflag, unsigned int boneflag,
}
}
else {
- if (armflag & ARM_POSEMODE)
+ if (armflag & ARM_POSEMODE)
set_pchan_glColor(PCHAN_COLOR_SOLID, boneflag, 0);
else
UI_ThemeColor(TH_BONE_SOLID);
}
-
- if (dt > OB_WIRE)
+
+ if (dt > OB_WIRE)
draw_bonevert_solid();
- else
+ else
draw_bonevert();
}
-
+
/* Draw tip point */
if (id != -1)
GPU_select_load_id(id | BONESEL_TIP);
-
+
if (dt <= OB_WIRE) {
if (armflag & ARM_EDITMODE) {
if (boneflag & BONE_TIPSEL) UI_ThemeColor(TH_VERTEX_SELECT);
@@ -585,19 +585,19 @@ static void draw_bone_points(const short dt, int armflag, unsigned int boneflag,
}
}
else {
- if (armflag & ARM_POSEMODE)
+ if (armflag & ARM_POSEMODE)
set_pchan_glColor(PCHAN_COLOR_SOLID, boneflag, 0);
else
UI_ThemeColor(TH_BONE_SOLID);
}
-
+
glTranslatef(0.0f, 1.0f, 0.0f);
- if (dt > OB_WIRE)
+ if (dt > OB_WIRE)
draw_bonevert_solid();
- else
+ else
draw_bonevert();
glTranslatef(0.0f, -1.0f, 0.0f);
-
+
}
/* 16 values of sin function (still same result!) */
@@ -632,7 +632,7 @@ static void draw_sphere_bone_dist(float smat[4][4], float imat[4][4], bPoseChann
{
float head, tail, dist /*, length*/;
float *headvec, *tailvec, dirvec[3];
-
+
/* figure out the sizes of spheres */
if (ebone) {
/* this routine doesn't call get_matrix_editbone() that calculates it */
@@ -659,9 +659,9 @@ static void draw_sphere_bone_dist(float smat[4][4], float imat[4][4], bPoseChann
headvec = pchan->pose_head;
tailvec = pchan->pose_tail;
}
-
+
/* ***** draw it ***** */
-
+
/* move vector to viewspace */
sub_v3_v3v3(dirvec, tailvec, headvec);
mul_mat3_m4_v3(smat, dirvec);
@@ -689,16 +689,16 @@ static void draw_sphere_bone_dist(float smat[4][4], float imat[4][4], bPoseChann
/* move vector back */
mul_mat3_m4_v3(imat, dirvec);
-
+
if (0.0f != normalize_v3(dirvec)) {
float norvec[3], vec1[3], vec2[3], vec[3];
int a;
-
+
//mul_v3_fl(dirvec, head);
cross_v3_v3v3(norvec, dirvec, imat[2]);
-
+
glBegin(GL_QUAD_STRIP);
-
+
for (a = 0; a < 16; a++) {
vec[0] = -si[a] * dirvec[0] + co[a] * norvec[0];
vec[1] = -si[a] * dirvec[1] + co[a] * norvec[1];
@@ -706,13 +706,13 @@ static void draw_sphere_bone_dist(float smat[4][4], float imat[4][4], bPoseChann
madd_v3_v3v3fl(vec1, headvec, vec, head);
madd_v3_v3v3fl(vec2, headvec, vec, head + dist);
-
+
glColor4ub(255, 255, 255, 50);
glVertex3fv(vec1);
//glColor4ub(255, 255, 255, 0);
glVertex3fv(vec2);
}
-
+
for (a = 15; a >= 0; a--) {
vec[0] = si[a] * dirvec[0] + co[a] * norvec[0];
vec[1] = si[a] * dirvec[1] + co[a] * norvec[1];
@@ -720,14 +720,14 @@ static void draw_sphere_bone_dist(float smat[4][4], float imat[4][4], bPoseChann
madd_v3_v3v3fl(vec1, tailvec, vec, tail);
madd_v3_v3v3fl(vec2, tailvec, vec, tail + dist);
-
+
//glColor4ub(255, 255, 255, 50);
glVertex3fv(vec1);
//glColor4ub(255, 255, 255, 0);
glVertex3fv(vec2);
}
/* make it cyclic... */
-
+
vec[0] = -si[0] * dirvec[0] + co[0] * norvec[0];
vec[1] = -si[0] * dirvec[1] + co[0] * norvec[1];
vec[2] = -si[0] * dirvec[2] + co[0] * norvec[2];
@@ -739,7 +739,7 @@ static void draw_sphere_bone_dist(float smat[4][4], float imat[4][4], bPoseChann
glVertex3fv(vec1);
//glColor4ub(255, 255, 255, 0);
glVertex3fv(vec2);
-
+
glEnd();
}
}
@@ -752,12 +752,12 @@ static void draw_sphere_bone_wire(float smat[4][4], float imat[4][4],
{
float head, tail /*, length*/;
float *headvec, *tailvec, dirvec[3];
-
+
/* figure out the sizes of spheres */
if (ebone) {
/* this routine doesn't call get_matrix_editbone() that calculates it */
ebone->length = len_v3v3(ebone->head, ebone->tail);
-
+
/*length = ebone->length;*/ /*UNUSED*/
tail = ebone->rad_tail;
if (ebone->parent && (boneflag & BONE_CONNECTED))
@@ -777,7 +777,7 @@ static void draw_sphere_bone_wire(float smat[4][4], float imat[4][4],
headvec = pchan->pose_head;
tailvec = pchan->pose_tail;
}
-
+
/* sphere root color */
if (armflag & ARM_EDITMODE) {
if (boneflag & BONE_ROOTSEL) UI_ThemeColor(TH_VERTEX_SELECT);
@@ -785,55 +785,55 @@ static void draw_sphere_bone_wire(float smat[4][4], float imat[4][4],
}
else if (armflag & ARM_POSEMODE)
set_pchan_glColor(PCHAN_COLOR_NORMAL, boneflag, constflag);
-
+
/* Draw root point if we are not connected */
if ((boneflag & BONE_CONNECTED) == 0) {
if (id != -1)
GPU_select_load_id(id | BONESEL_ROOT);
-
+
drawcircball(GL_LINE_LOOP, headvec, head, imat);
}
-
+
/* Draw tip point */
if (armflag & ARM_EDITMODE) {
if (boneflag & BONE_TIPSEL) UI_ThemeColor(TH_VERTEX_SELECT);
else UI_ThemeColor(TH_VERTEX);
}
-
+
if (id != -1)
GPU_select_load_id(id | BONESEL_TIP);
-
+
drawcircball(GL_LINE_LOOP, tailvec, tail, imat);
-
+
/* base */
if (armflag & ARM_EDITMODE) {
if (boneflag & BONE_SELECTED) UI_ThemeColor(TH_SELECT);
else UI_ThemeColor(TH_WIRE_EDIT);
}
-
+
sub_v3_v3v3(dirvec, tailvec, headvec);
-
+
/* move vector to viewspace */
mul_mat3_m4_v3(smat, dirvec);
/* clear zcomp */
dirvec[2] = 0.0f;
/* move vector back */
mul_mat3_m4_v3(imat, dirvec);
-
+
if (0.0f != normalize_v3(dirvec)) {
float norvech[3], norvect[3], vec[3];
-
+
copy_v3_v3(vec, dirvec);
-
+
mul_v3_fl(dirvec, head);
cross_v3_v3v3(norvech, dirvec, imat[2]);
-
+
mul_v3_fl(vec, tail);
cross_v3_v3v3(norvect, vec, imat[2]);
-
+
if (id != -1)
GPU_select_load_id(id | BONESEL_BONE);
-
+
glBegin(GL_LINES);
add_v3_v3v3(vec, headvec, norvech);
@@ -847,7 +847,7 @@ static void draw_sphere_bone_wire(float smat[4][4], float imat[4][4],
sub_v3_v3v3(vec, tailvec, norvect);
glVertex3fv(vec);
-
+
glEnd();
}
}
@@ -859,7 +859,7 @@ static void draw_sphere_bone(const short dt, int armflag, int boneflag, short co
GLUquadricObj *qobj;
float head, tail, length;
float fac1, fac2;
-
+
glPushMatrix();
qobj = gluNewQuadric();
@@ -880,20 +880,20 @@ static void draw_sphere_bone(const short dt, int armflag, int boneflag, short co
else
head = pchan->bone->rad_head;
}
-
+
/* move to z-axis space */
glRotatef(-90.0f, 1.0f, 0.0f, 0.0f);
if (dt == OB_SOLID) {
/* set up solid drawing */
GPU_basic_shader_bind(GPU_SHADER_LIGHTING | GPU_SHADER_USE_COLOR);
-
- gluQuadricDrawStyle(qobj, GLU_FILL);
+
+ gluQuadricDrawStyle(qobj, GLU_FILL);
}
else {
- gluQuadricDrawStyle(qobj, GLU_SILHOUETTE);
+ gluQuadricDrawStyle(qobj, GLU_SILHOUETTE);
}
-
+
/* sphere root color */
if (armflag & ARM_EDITMODE) {
if (boneflag & BONE_ROOTSEL) UI_ThemeColor(TH_VERTEX_SELECT);
@@ -903,14 +903,14 @@ static void draw_sphere_bone(const short dt, int armflag, int boneflag, short co
set_pchan_glColor(PCHAN_COLOR_SPHEREBONE_END, boneflag, constflag);
else if (dt == OB_SOLID)
UI_ThemeColorShade(TH_BONE_SOLID, -30);
-
+
/* Draw root point if we are not connected */
if ((boneflag & BONE_CONNECTED) == 0) {
if (id != -1)
GPU_select_load_id(id | BONESEL_ROOT);
gluSphere(qobj, head, 16, 10);
}
-
+
/* Draw tip point */
if (armflag & ARM_EDITMODE) {
if (boneflag & BONE_TIPSEL) UI_ThemeColor(TH_VERTEX_SELECT);
@@ -919,11 +919,11 @@ static void draw_sphere_bone(const short dt, int armflag, int boneflag, short co
if (id != -1)
GPU_select_load_id(id | BONESEL_TIP);
-
+
glTranslatef(0.0f, 0.0f, length);
gluSphere(qobj, tail, 16, 10);
glTranslatef(0.0f, 0.0f, -length);
-
+
/* base */
if (armflag & ARM_EDITMODE) {
if (boneflag & BONE_SELECTED) UI_ThemeColor(TH_SELECT);
@@ -933,28 +933,28 @@ static void draw_sphere_bone(const short dt, int armflag, int boneflag, short co
set_pchan_glColor(PCHAN_COLOR_SPHEREBONE_BASE, boneflag, constflag);
else if (dt == OB_SOLID)
UI_ThemeColor(TH_BONE_SOLID);
-
+
fac1 = (length - head) / length;
fac2 = (length - tail) / length;
-
+
if (length > (head + tail)) {
if (id != -1)
GPU_select_load_id(id | BONESEL_BONE);
-
+
glEnable(GL_POLYGON_OFFSET_FILL);
glPolygonOffset(-1.0f, -1.0f);
-
+
glTranslatef(0.0f, 0.0f, head);
gluCylinder(qobj, fac1 * head + (1.0f - fac1) * tail, fac2 * tail + (1.0f - fac2) * head, length - head - tail, 16, 1);
glTranslatef(0.0f, 0.0f, -head);
-
+
glDisable(GL_POLYGON_OFFSET_FILL);
-
+
/* draw sphere on extrema */
glTranslatef(0.0f, 0.0f, length - tail);
gluSphere(qobj, fac2 * tail + (1.0f - fac2) * head, 16, 10);
glTranslatef(0.0f, 0.0f, -length + tail);
-
+
glTranslatef(0.0f, 0.0f, head);
gluSphere(qobj, fac1 * head + (1.0f - fac1) * tail, 16, 10);
}
@@ -963,14 +963,14 @@ static void draw_sphere_bone(const short dt, int armflag, int boneflag, short co
glTranslatef(0.0f, 0.0f, (head + length - tail) / 2.0f);
gluSphere(qobj, fac1 * head + (1.0f - fac1) * tail, 16, 10);
}
-
+
/* restore */
if (dt == OB_SOLID) {
GPU_basic_shader_bind(GPU_SHADER_USE_COLOR);
}
-
+
glPopMatrix();
- gluDeleteQuadric(qobj);
+ gluDeleteQuadric(qobj);
}
static GLubyte bm_dot6[] = {0x0, 0x18, 0x3C, 0x7E, 0x7E, 0x3C, 0x18, 0x0};
@@ -987,15 +987,15 @@ static void draw_line_bone(int armflag, int boneflag, short constflag, unsigned
BLI_assert(glaGetOneInt(GL_UNPACK_ALIGNMENT) == 1);
float length;
-
- if (pchan)
+
+ if (pchan)
length = pchan->bone->length;
- else
+ else
length = ebone->length;
-
+
glPushMatrix();
glScalef(length, length, length);
-
+
/* this chunk not in object mode */
if (armflag & (ARM_EDITMODE | ARM_POSEMODE)) {
glLineWidth(4.0f);
@@ -1010,7 +1010,7 @@ static void draw_line_bone(int armflag, int boneflag, short constflag, unsigned
else if (armflag & ARM_EDITMODE) {
UI_ThemeColor(TH_WIRE_EDIT);
}
-
+
/* Draw root point if we are not connected */
if ((boneflag & BONE_CONNECTED) == 0) {
if (G.f & G_PICKSEL) {
@@ -1024,15 +1024,15 @@ static void draw_line_bone(int armflag, int boneflag, short constflag, unsigned
glBitmap(8, 8, 4, 4, 0, 0, bm_dot8);
}
}
-
+
if (id != -1)
GPU_select_load_id((GLuint) id | BONESEL_BONE);
-
+
glBegin(GL_LINES);
glVertex3f(0.0f, 0.0f, 0.0f);
glVertex3f(0.0f, 1.0f, 0.0f);
glEnd();
-
+
/* tip */
if (G.f & G_PICKSEL) {
/* no bitmap in selection mode, crashes 3d cards... */
@@ -1045,17 +1045,17 @@ static void draw_line_bone(int armflag, int boneflag, short constflag, unsigned
glRasterPos3f(0.0f, 1.0f, 0.0f);
glBitmap(8, 8, 4, 4, 0, 0, bm_dot7);
}
-
+
/* further we send no names */
if (id != -1)
GPU_select_load_id(id & 0xFFFF); /* object tag, for bordersel optim */
-
+
if (armflag & ARM_POSEMODE)
set_pchan_glColor(PCHAN_COLOR_LINEBONE, boneflag, constflag);
}
-
+
glLineWidth(2.0);
-
+
/*Draw root point if we are not connected */
if ((boneflag & BONE_CONNECTED) == 0) {
if ((G.f & G_PICKSEL) == 0) {
@@ -1068,7 +1068,7 @@ static void draw_line_bone(int armflag, int boneflag, short constflag, unsigned
glBitmap(8, 8, 4, 4, 0, 0, bm_dot6);
}
}
-
+
if (armflag & ARM_EDITMODE) {
if (boneflag & BONE_SELECTED) UI_ThemeColor(TH_EDGE_SELECT);
else UI_ThemeColorShade(TH_BACK, -30);
@@ -1077,7 +1077,7 @@ static void draw_line_bone(int armflag, int boneflag, short constflag, unsigned
glVertex3f(0.0f, 0.0f, 0.0f);
glVertex3f(0.0f, 1.0f, 0.0f);
glEnd();
-
+
/* tip */
if ((G.f & G_PICKSEL) == 0) {
/* no bitmap in selection mode, crashes 3d cards... */
@@ -1088,11 +1088,11 @@ static void draw_line_bone(int armflag, int boneflag, short constflag, unsigned
glRasterPos3f(0.0f, 1.0f, 0.0f);
glBitmap(8, 8, 4, 4, 0, 0, bm_dot5);
}
-
+
glPopMatrix();
}
-/* A partial copy of b_bone_spline_setup(), with just the parts for previewing editmode curve settings
+/* A partial copy of b_bone_spline_setup(), with just the parts for previewing editmode curve settings
*
* This assumes that prev/next bones don't have any impact (since they should all still be in the "straight"
* position here anyway), and that we can simply apply the bbone settings to get the desired effect...
@@ -1103,12 +1103,12 @@ static void ebone_spline_preview(EditBone *ebone, Mat4 result_array[MAX_BBONE_SU
float mat3[3][3];
float data[MAX_BBONE_SUBDIV + 1][4], *fp;
int a;
-
+
length = ebone->length;
-
+
hlength1 = ebone->ease1 * length * 0.390464f; /* 0.5f * sqrt(2) * kappa, the handle length for near-perfect circles */
hlength2 = ebone->ease2 * length * 0.390464f;
-
+
/* find the handle points, since this is inside bone space, the
* first point = (0, 0, 0)
* last point = (0, length, 0)
@@ -1119,12 +1119,12 @@ static void ebone_spline_preview(EditBone *ebone, Mat4 result_array[MAX_BBONE_SU
h1[1] = hlength1;
h1[2] = ebone->curveInY;
roll1 = ebone->roll1;
-
+
h2[0] = ebone->curveOutX;
h2[1] = -hlength2;
h2[2] = ebone->curveOutY;
roll2 = ebone->roll2;
-
+
/* make curve */
if (ebone->segments > MAX_BBONE_SUBDIV)
ebone->segments = MAX_BBONE_SUBDIV;
@@ -1140,26 +1140,26 @@ static void ebone_spline_preview(EditBone *ebone, Mat4 result_array[MAX_BBONE_SU
for (a = 0, fp = data[0]; a < ebone->segments; a++, fp += 4) {
sub_v3_v3v3(h1, fp + 4, fp);
vec_roll_to_mat3(h1, fp[3], mat3); /* fp[3] is roll */
-
+
copy_m4_m3(result_array[a].mat, mat3);
copy_v3_v3(result_array[a].mat[3], fp);
-
+
/* "extra" scale facs... */
{
const int num_segments = ebone->segments;
-
+
const float scaleFactorIn = 1.0f + (ebone->scaleIn - 1.0f) * ((float)(num_segments - a) / (float)num_segments);
const float scaleFactorOut = 1.0f + (ebone->scaleOut - 1.0f) * ((float)(a + 1) / (float)num_segments);
-
+
const float scalefac = scaleFactorIn * scaleFactorOut;
float bscalemat[4][4], bscale[3];
-
+
bscale[0] = scalefac;
bscale[1] = 1.0f;
bscale[2] = scalefac;
-
+
size_to_mat4(bscalemat, bscale);
-
+
/* Note: don't multiply by inverse scale mat here, as it causes problems with scaling shearing and breaking segment chains */
mul_m4_series(result_array[a].mat, result_array[a].mat, bscalemat);
}
@@ -1169,24 +1169,24 @@ static void ebone_spline_preview(EditBone *ebone, Mat4 result_array[MAX_BBONE_SU
static void draw_b_bone_boxes(const short dt, bPoseChannel *pchan, EditBone *ebone, float xwidth, float length, float zwidth)
{
int segments = 0;
-
- if (pchan)
+
+ if (pchan)
segments = pchan->bone->segments;
else if (ebone)
segments = ebone->segments;
-
+
if (segments > 1) {
float dlen = length / (float)segments;
Mat4 bbone[MAX_BBONE_SUBDIV];
int a;
-
+
if (pchan) {
b_bone_spline_setup(pchan, 0, bbone);
}
else if (ebone) {
ebone_spline_preview(ebone, bbone);
}
-
+
for (a = 0; a < segments; a++) {
glPushMatrix();
glMultMatrixf(bbone[a].mat);
@@ -1207,7 +1207,7 @@ static void draw_b_bone(const short dt, int armflag, int boneflag, short constfl
bPoseChannel *pchan, EditBone *ebone)
{
float xwidth, length, zwidth;
-
+
if (pchan) {
xwidth = pchan->bone->xwidth;
length = pchan->bone->length;
@@ -1218,7 +1218,7 @@ static void draw_b_bone(const short dt, int armflag, int boneflag, short constfl
length = ebone->length;
zwidth = ebone->zwidth;
}
-
+
/* draw points only if... */
if (armflag & ARM_EDITMODE) {
/* move to unitspace */
@@ -1233,32 +1233,32 @@ static void draw_b_bone(const short dt, int armflag, int boneflag, short constfl
if (armflag & ARM_POSEMODE) {
if (dt <= OB_WIRE)
set_pchan_glColor(PCHAN_COLOR_NORMAL, boneflag, constflag);
- else
+ else
set_pchan_glColor(PCHAN_COLOR_SOLID, boneflag, constflag);
}
else if (armflag & ARM_EDITMODE) {
if (dt == OB_WIRE) {
set_ebone_glColor(boneflag);
}
- else
+ else
UI_ThemeColor(TH_BONE_SOLID);
}
-
+
if (id != -1) {
GPU_select_load_id((GLuint) id | BONESEL_BONE);
}
-
+
/* set up solid drawing */
if (dt > OB_WIRE) {
GPU_basic_shader_bind(GPU_SHADER_LIGHTING | GPU_SHADER_USE_COLOR);
-
+
if (armflag & ARM_POSEMODE)
set_pchan_glColor(PCHAN_COLOR_SOLID, boneflag, constflag);
else
UI_ThemeColor(TH_BONE_SOLID);
-
+
draw_b_bone_boxes(OB_SOLID, pchan, ebone, xwidth, length, zwidth);
-
+
/* disable solid drawing */
GPU_basic_shader_bind(GPU_SHADER_USE_COLOR);
}
@@ -1269,17 +1269,17 @@ static void draw_b_bone(const short dt, int armflag, int boneflag, short constfl
/* set constraint colors */
if (set_pchan_glColor(PCHAN_COLOR_CONSTS, boneflag, constflag)) {
glEnable(GL_BLEND);
-
+
draw_b_bone_boxes(OB_SOLID, pchan, ebone, xwidth, length, zwidth);
-
+
glDisable(GL_BLEND);
}
-
+
/* restore colors */
set_pchan_glColor(PCHAN_COLOR_NORMAL, boneflag, constflag);
}
}
-
+
draw_b_bone_boxes(OB_WIRE, pchan, ebone, xwidth, length, zwidth);
}
}
@@ -1290,27 +1290,27 @@ static void draw_wire_bone_segments(bPoseChannel *pchan, Mat4 *bbones, float len
float dlen = length / (float)segments;
Mat4 *bbone = bbones;
int a;
-
+
for (a = 0; a < segments; a++, bbone++) {
glPushMatrix();
glMultMatrixf(bbone->mat);
-
+
glBegin(GL_LINES);
glVertex3f(0.0f, 0.0f, 0.0f);
glVertex3f(0.0f, dlen, 0.0f);
glEnd(); /* GL_LINES */
-
+
glPopMatrix();
}
}
else {
glPushMatrix();
-
+
glBegin(GL_LINES);
glVertex3f(0.0f, 0.0f, 0.0f);
glVertex3f(0.0f, length, 0.0f);
glEnd();
-
+
glPopMatrix();
}
}
@@ -1322,19 +1322,19 @@ static void draw_wire_bone(const short dt, int armflag, int boneflag, short cons
Mat4 *bbones = NULL;
int segments = 0;
float length;
-
+
if (pchan) {
segments = pchan->bone->segments;
length = pchan->bone->length;
-
+
if (segments > 1) {
b_bone_spline_setup(pchan, 0, bbones_array);
bbones = bbones_array;
}
}
- else
+ else
length = ebone->length;
-
+
/* draw points only if... */
if (armflag & ARM_EDITMODE) {
/* move to unitspace */
@@ -1344,19 +1344,19 @@ static void draw_wire_bone(const short dt, int armflag, int boneflag, short cons
glPopMatrix();
length *= 0.95f; /* make vertices visible */
}
-
+
/* this chunk not in object mode */
if (armflag & (ARM_EDITMODE | ARM_POSEMODE)) {
if (id != -1)
GPU_select_load_id((GLuint) id | BONESEL_BONE);
-
+
draw_wire_bone_segments(pchan, bbones, length, segments);
-
+
/* further we send no names */
if (id != -1)
GPU_select_load_id(id & 0xFFFF); /* object tag, for bordersel optim */
}
-
+
/* colors for modes */
if (armflag & ARM_POSEMODE) {
set_pchan_glColor(PCHAN_COLOR_NORMAL, boneflag, constflag);
@@ -1364,17 +1364,17 @@ static void draw_wire_bone(const short dt, int armflag, int boneflag, short cons
else if (armflag & ARM_EDITMODE) {
set_ebone_glColor(boneflag);
}
-
+
/* draw normal */
draw_wire_bone_segments(pchan, bbones, length, segments);
}
static void draw_bone(const short dt, int armflag, int boneflag, short constflag, unsigned int id, float length)
{
-
+
/* Draw a 3d octahedral bone, we use normalized space based on length,
* for display-lists */
-
+
glScalef(length, length, length);
/* set up solid drawing */
@@ -1382,23 +1382,23 @@ static void draw_bone(const short dt, int armflag, int boneflag, short constflag
GPU_basic_shader_bind(GPU_SHADER_LIGHTING | GPU_SHADER_USE_COLOR);
UI_ThemeColor(TH_BONE_SOLID);
}
-
+
/* colors for posemode */
if (armflag & ARM_POSEMODE) {
if (dt <= OB_WIRE)
set_pchan_glColor(PCHAN_COLOR_NORMAL, boneflag, constflag);
- else
+ else
set_pchan_glColor(PCHAN_COLOR_SOLID, boneflag, constflag);
}
-
-
+
+
draw_bone_points(dt, armflag, boneflag, id);
-
+
/* now draw the bone itself */
if (id != -1) {
GPU_select_load_id((GLuint) id | BONESEL_BONE);
}
-
+
/* wire? */
if (dt <= OB_WIRE) {
/* colors */
@@ -1410,12 +1410,12 @@ static void draw_bone(const short dt, int armflag, int boneflag, short constflag
/* draw constraint colors */
if (set_pchan_glColor(PCHAN_COLOR_CONSTS, boneflag, constflag)) {
glEnable(GL_BLEND);
-
+
draw_bone_solid_octahedral();
-
+
glDisable(GL_BLEND);
}
-
+
/* restore colors */
set_pchan_glColor(PCHAN_COLOR_NORMAL, boneflag, constflag);
}
@@ -1441,18 +1441,18 @@ static void draw_custom_bone(Scene *scene, View3D *v3d, RegionView3D *rv3d, Obje
const short dt, int armflag, int boneflag, unsigned int id, float length)
{
if (ob == NULL) return;
-
+
glScalef(length, length, length);
-
+
/* colors for posemode */
if (armflag & ARM_POSEMODE) {
set_pchan_glColor(PCHAN_COLOR_NORMAL, boneflag, 0);
}
-
+
if (id != -1) {
GPU_select_load_id((GLuint) id | BONESEL_BONE);
}
-
+
draw_object_instance(scene, v3d, rv3d, ob, dt, armflag & ARM_POSEMODE);
}
@@ -1461,32 +1461,32 @@ static void pchan_draw_IK_root_lines(bPoseChannel *pchan, short only_temp)
{
bConstraint *con;
bPoseChannel *parchan;
-
+
for (con = pchan->constraints.first; con; con = con->next) {
if (con->enforce == 0.0f)
continue;
-
+
switch (con->type) {
case CONSTRAINT_TYPE_KINEMATIC:
{
bKinematicConstraint *data = (bKinematicConstraint *)con->data;
int segcount = 0;
-
+
/* if only_temp, only draw if it is a temporary ik-chain */
if ((only_temp) && !(data->flag & CONSTRAINT_IK_TEMP))
continue;
-
+
setlinestyle(3);
glBegin(GL_LINES);
-
+
/* exclude tip from chain? */
if ((data->flag & CONSTRAINT_IK_TIP) == 0)
parchan = pchan->parent;
else
parchan = pchan;
-
+
glVertex3fv(parchan->pose_tail);
-
+
/* Find the chain's root */
while (parchan->parent) {
segcount++;
@@ -1497,22 +1497,22 @@ static void pchan_draw_IK_root_lines(bPoseChannel *pchan, short only_temp)
}
if (parchan)
glVertex3fv(parchan->pose_head);
-
+
glEnd();
setlinestyle(0);
break;
}
- case CONSTRAINT_TYPE_SPLINEIK:
+ case CONSTRAINT_TYPE_SPLINEIK:
{
bSplineIKConstraint *data = (bSplineIKConstraint *)con->data;
int segcount = 0;
-
+
setlinestyle(3);
glBegin(GL_LINES);
-
+
parchan = pchan;
glVertex3fv(parchan->pose_tail);
-
+
/* Find the chain's root */
while (parchan->parent) {
segcount++;
@@ -1568,11 +1568,11 @@ static void draw_dof_ellipse(float ax, float az)
pz = 0.0f;
for (i = 1; i < n; i++) {
z = staticSine[i];
-
+
px = 0.0f;
for (j = 1; j <= (n - i); j++) {
x = staticSine[j];
-
+
if (j == n - i) {
glEnd();
glBegin(GL_TRIANGLES);
@@ -1588,7 +1588,7 @@ static void draw_dof_ellipse(float ax, float az)
bgl_sphere_project(ax * px, az * pz);
bgl_sphere_project(ax * px, az * z);
}
-
+
px = x;
}
pz = z;
@@ -1611,10 +1611,10 @@ static void draw_pose_dofs(Object *ob)
bArmature *arm = ob->data;
bPoseChannel *pchan;
Bone *bone;
-
+
for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
bone = pchan->bone;
-
+
if ((bone != NULL) && !(bone->flag & (BONE_HIDDEN_P | BONE_HIDDEN_PG))) {
if (bone->flag & BONE_SELECTED) {
if (bone->layer & arm->layer) {
@@ -1623,35 +1623,35 @@ static void draw_pose_dofs(Object *ob)
float corner[4][3], posetrans[3], mat[4][4];
float phi = 0.0f, theta = 0.0f, scale;
int a, i;
-
+
/* in parent-bone pose, but own restspace */
glPushMatrix();
-
+
copy_v3_v3(posetrans, pchan->pose_mat[3]);
glTranslate3fv(posetrans);
-
+
if (pchan->parent) {
copy_m4_m4(mat, pchan->parent->pose_mat);
mat[3][0] = mat[3][1] = mat[3][2] = 0.0f;
glMultMatrixf(mat);
}
-
+
copy_m4_m3(mat, pchan->bone->bone_mat);
glMultMatrixf(mat);
-
+
scale = bone->length * pchan->size[1];
glScalef(scale, scale, scale);
-
+
if (pchan->ikflag & BONE_IK_XLIMIT) {
if (pchan->ikflag & BONE_IK_ZLIMIT) {
float amin[3], amax[3];
-
+
for (i = 0; i < 3; i++) {
/* *0.5f here comes from M_PI/360.0f when rotations were still in degrees */
amin[i] = sinf(pchan->limitmin[i] * 0.5f);
amax[i] = sinf(pchan->limitmax[i] * 0.5f);
}
-
+
glScalef(1.0f, -1.0f, 1.0f);
if ((amin[0] != 0.0f) && (amin[2] != 0.0f))
draw_dof_ellipse(amin[0], amin[2]);
@@ -1664,21 +1664,21 @@ static void draw_pose_dofs(Object *ob)
glScalef(1.0f, -1.0f, 1.0f);
}
}
-
+
/* arcs */
if (pchan->ikflag & BONE_IK_ZLIMIT) {
/* OpenGL requires rotations in degrees; so we're taking the average angle here */
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 */
glBegin(GL_LINE_STRIP);
for (a = -16; a <= 16; a++) {
/* *0.5f here comes from M_PI/360.0f when rotations were still in degrees */
float fac = ((float)a) / 16.0f * 0.5f;
-
+
phi = fac * (pchan->limitmax[2] - pchan->limitmin[2]);
-
+
i = (a == -16) ? 0 : 1;
corner[i][0] = sinf(phi);
corner[i][1] = cosf(phi);
@@ -1686,22 +1686,22 @@ static void draw_pose_dofs(Object *ob)
glVertex3fv(corner[i]);
}
glEnd();
-
+
glRotatef(-theta, 0.0f, 0.0f, 1.0f);
}
-
+
if (pchan->ikflag & BONE_IK_XLIMIT) {
/* OpenGL requires rotations in degrees; so we're taking the average angle here */
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 */
glBegin(GL_LINE_STRIP);
for (a = -16; a <= 16; a++) {
/* *0.5f here comes from M_PI/360.0f when rotations were still in degrees */
float fac = ((float)a) / 16.0f * 0.5f;
phi = (float)M_PI_2 + fac * (pchan->limitmax[0] - pchan->limitmin[0]);
-
+
i = (a == -16) ? 2 : 3;
corner[i][0] = 0.0f;
corner[i][1] = sinf(phi);
@@ -1709,12 +1709,12 @@ static void draw_pose_dofs(Object *ob)
glVertex3fv(corner[i]);
}
glEnd();
-
+
glRotatef(-theta, 1.0f, 0.0f, 0.0f);
}
-
+
/* out of cone, out of bone */
- glPopMatrix();
+ glPopMatrix();
}
}
}
@@ -1753,27 +1753,27 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
bool draw_wire = false;
int flag;
bool is_cull_enabled;
-
+
/* being set below */
arm->layer_used = 0;
-
+
/* precalc inverse matrix for drawing screen aligned */
if (arm->drawtype == ARM_ENVELOPE) {
/* precalc inverse matrix for drawing screen aligned */
copy_m4_m4(smat, rv3d->viewmatob);
mul_mat3_m4_fl(smat, 1.0f / len_v3(ob->obmat[0]));
invert_m4_m4(imat, smat);
-
+
/* and draw blended distances */
if (arm->flag & ARM_POSEMODE) {
glEnable(GL_BLEND);
-
+
if (v3d->zbuf) glDisable(GL_DEPTH_TEST);
-
+
for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
bone = pchan->bone;
if (bone) {
- /* 1) bone must be visible, 2) for OpenGL select-drawing cannot have unselectable [#27194]
+ /* 1) bone must be visible, 2) for OpenGL select-drawing cannot have unselectable [#27194]
* NOTE: this is the only case with (NO_DEFORM == 0) flag, as this is for envelope influence drawing
*/
if (((bone->flag & (BONE_HIDDEN_P | BONE_NO_DEFORM | BONE_HIDDEN_PG)) == 0) &&
@@ -1786,12 +1786,12 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
}
}
}
-
+
if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
glDisable(GL_BLEND);
}
}
-
+
/* little speedup, also make sure transparent only draws once */
glCullFace(GL_BACK);
if (v3d->flag2 & V3D_BACKFACE_CULLING) {
@@ -1804,13 +1804,13 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
/* if solid we draw that first, with selection codes, but without names, axes etc */
if (dt > OB_WIRE) {
- if (arm->flag & ARM_POSEMODE)
+ if (arm->flag & ARM_POSEMODE)
index = base->selcol;
-
+
for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
bone = pchan->bone;
arm->layer_used |= bone->layer;
-
+
/* 1) bone must be visible, 2) for OpenGL select-drawing cannot have unselectable [#27194] */
if (((bone->flag & (BONE_HIDDEN_P | BONE_HIDDEN_PG)) == 0) &&
((G.f & G_PICKSEL) == 0 || (bone->flag & BONE_UNSELECTABLE) == 0))
@@ -1818,24 +1818,24 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
if (bone->layer & arm->layer) {
const bool use_custom = (pchan->custom) && !(arm->flag & ARM_NO_CUSTOM);
glPushMatrix();
-
+
if (use_custom && pchan->custom_tx) {
glMultMatrixf(pchan->custom_tx->pose_mat);
}
else {
glMultMatrixf(pchan->pose_mat);
}
-
+
/* catch exception for bone with hidden parent */
flag = bone->flag;
if ((bone->parent) && (bone->parent->flag & (BONE_HIDDEN_P | BONE_HIDDEN_PG))) {
flag &= ~BONE_CONNECTED;
}
-
+
/* set temporary flag for drawing bone as active, but only if selected */
if (bone == arm->act_bone)
flag |= BONE_DRAW_ACTIVE;
-
+
if (do_const_color) {
/* keep color */
}
@@ -1888,13 +1888,13 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
glPopMatrix();
}
}
-
+
if (index != -1)
index += 0x10000; /* pose bones count in higher 2 bytes only */
}
-
+
/* very very confusing... but in object mode, solid draw, we cannot do GPU_select_load_id yet,
- * stick bones and/or wire custom-shapes are drawn in next loop
+ * stick bones and/or wire custom-shapes are drawn in next loop
*/
if (ELEM(arm->drawtype, ARM_LINE, ARM_WIRE) == 0 && (draw_wire == false) && index != -1) {
/* object tag, for bordersel optim */
@@ -1902,7 +1902,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
index = -1;
}
}
-
+
/* custom bone may draw outline double-width */
if (arm->flag & ARM_POSEMODE) {
glLineWidth(1.0f);
@@ -1914,11 +1914,11 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
{
if (arm->flag & ARM_POSEMODE)
index = base->selcol;
-
+
/* only draw custom bone shapes that need to be drawn as wires */
for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
bone = pchan->bone;
-
+
/* 1) bone must be visible, 2) for OpenGL select-drawing cannot have unselectable [#27194] */
if (((bone->flag & (BONE_HIDDEN_P | BONE_HIDDEN_PG)) == 0) &&
((G.f & G_PICKSEL) == 0 || (bone->flag & BONE_UNSELECTABLE) == 0) )
@@ -1927,14 +1927,14 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
if (pchan->custom) {
if ((dt < OB_SOLID) || (bone->flag & BONE_DRAWWIRE)) {
glPushMatrix();
-
+
if (pchan->custom_tx) {
glMultMatrixf(pchan->custom_tx->pose_mat);
}
else {
glMultMatrixf(pchan->pose_mat);
}
-
+
/* prepare colors */
if (do_const_color) {
/* 13 October 2009, Disabled this to make ghosting show the right colors (Aligorith) */
@@ -1944,26 +1944,26 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
else {
glColor3ubv(ob_wire_col);
}
-
+
/* catch exception for bone with hidden parent */
flag = bone->flag;
if ((bone->parent) && (bone->parent->flag & (BONE_HIDDEN_P | BONE_HIDDEN_PG)))
flag &= ~BONE_CONNECTED;
-
+
/* set temporary flag for drawing bone as active, but only if selected */
if (bone == arm->act_bone)
flag |= BONE_DRAW_ACTIVE;
-
+
draw_custom_bone(scene, v3d, rv3d, pchan->custom,
OB_WIRE, arm->flag, flag, index, PCHAN_CUSTOM_DRAW_SIZE(pchan));
-
+
glPopMatrix();
}
}
}
}
-
- if (index != -1)
+
+ if (index != -1)
index += 0x10000; /* pose bones count in higher 2 bytes only */
}
/* stick or wire bones have not been drawn yet so don't clear object selection in this case */
@@ -1978,7 +1978,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
if ((dt <= OB_WIRE) || (arm->flag & ARM_POSEMODE) || ELEM(arm->drawtype, ARM_LINE, ARM_WIRE)) {
/* draw line check first. we do selection indices */
if (ELEM(arm->drawtype, ARM_LINE, ARM_WIRE)) {
- if (arm->flag & ARM_POSEMODE)
+ if (arm->flag & ARM_POSEMODE)
index = base->selcol;
}
/* if solid && posemode, we draw again with polygonoffset */
@@ -1987,7 +1987,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
}
else {
/* and we use selection indices if not done yet */
- if (arm->flag & ARM_POSEMODE)
+ if (arm->flag & ARM_POSEMODE)
index = base->selcol;
}
@@ -1999,7 +1999,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
bone = pchan->bone;
arm->layer_used |= bone->layer;
-
+
/* 1) bone must be visible, 2) for OpenGL select-drawing cannot have unselectable [#27194] */
if (((bone->flag & (BONE_HIDDEN_P | BONE_HIDDEN_PG)) == 0) &&
((G.f & G_PICKSEL) == 0 || (bone->flag & BONE_UNSELECTABLE) == 0))
@@ -2007,7 +2007,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
if (bone->layer & arm->layer) {
const short constflag = pchan->constflag;
if ((do_dashed & DASH_RELATIONSHIP_LINES) && (pchan->parent)) {
- /* Draw a line from our root to the parent's tip
+ /* Draw a line from our root to the parent's tip
* - only if V3D_HIDE_HELPLINES is enabled...
*/
if ((do_dashed & DASH_HELP_LINES) && ((bone->flag & BONE_CONNECTED) == 0)) {
@@ -2022,8 +2022,8 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
glEnd();
setlinestyle(0);
}
-
- /* Draw a line to IK root bone
+
+ /* Draw a line to IK root bone
* - only if temporary chain (i.e. "autoik")
*/
if (arm->flag & ARM_POSEMODE) {
@@ -2039,27 +2039,27 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
else if (constflag & PCHAN_HAS_SPLINEIK) {
if (bone->flag & BONE_SELECTED) {
glColor3ub(150, 200, 50); /* add theme! */
-
+
GPU_select_load_id(index & 0xFFFF);
pchan_draw_IK_root_lines(pchan, !(do_dashed & DASH_HELP_LINES));
}
}
}
}
-
+
glPushMatrix();
if (arm->drawtype != ARM_ENVELOPE)
glMultMatrixf(pchan->pose_mat);
-
+
/* catch exception for bone with hidden parent */
flag = bone->flag;
if ((bone->parent) && (bone->parent->flag & (BONE_HIDDEN_P | BONE_HIDDEN_PG)))
flag &= ~BONE_CONNECTED;
-
+
/* set temporary flag for drawing bone as active, but only if selected */
if (bone == arm->act_bone)
flag |= BONE_DRAW_ACTIVE;
-
+
/* extra draw service for pose mode */
/* set color-set to use */
@@ -2069,7 +2069,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
else {
set_pchan_colorset(ob, pchan);
}
-
+
if ((pchan->custom) && !(arm->flag & ARM_NO_CUSTOM)) {
/* custom bone shapes should not be drawn here! */
}
@@ -2085,25 +2085,25 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
draw_b_bone(OB_WIRE, arm->flag, flag, constflag, index, pchan, NULL);
else
draw_bone(OB_WIRE, arm->flag, flag, constflag, index, bone->length);
-
+
glPopMatrix();
}
}
-
+
/* pose bones count in higher 2 bytes only */
- if (index != -1)
+ if (index != -1)
index += 0x10000;
}
/* restore things */
if (!ELEM(arm->drawtype, ARM_WIRE, ARM_LINE) && (dt > OB_WIRE) && (arm->flag & ARM_POSEMODE))
ED_view3d_polygon_offset(rv3d, 0.0);
}
-
+
/* restore */
if (is_cull_enabled) {
glDisable(GL_CULL_FACE);
}
-
+
/* draw DoFs */
if (arm->flag & ARM_POSEMODE) {
if (((base->flag & OB_FROMDUPLI) == 0) && ((v3d->flag & V3D_HIDE_HELPLINES) == 0)) {
@@ -2134,9 +2134,9 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
col[2] = ob_wire_col[2];
col[3] = 255;
}
-
+
if (v3d->zbuf) glDisable(GL_DEPTH_TEST);
-
+
for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
if ((pchan->bone->flag & (BONE_HIDDEN_P | BONE_HIDDEN_PG)) == 0) {
if (pchan->bone->layer & arm->layer) {
@@ -2147,32 +2147,32 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
else if (dt > OB_WIRE) {
UI_GetThemeColor3ubv(TH_TEXT, col);
}
-
+
/* Draw names of bone */
if (arm->flag & ARM_DRAWNAMES) {
mid_v3_v3v3(vec, pchan->pose_head, pchan->pose_tail);
view3d_cached_text_draw_add(vec, pchan->name, strlen(pchan->name), 10, 0, col);
}
-
+
/* Draw additional axes on the bone tail */
if ((arm->flag & ARM_DRAWAXES) && (arm->flag & ARM_POSEMODE)) {
glPushMatrix();
copy_m4_m4(bmat, pchan->pose_mat);
bone_matrix_translate_y(bmat, pchan->bone->length);
glMultMatrixf(bmat);
-
+
glColor3ubv(col);
float viewmat_pchan[4][4];
mul_m4_m4m4(viewmat_pchan, rv3d->viewmatob, bmat);
drawaxes(viewmat_pchan, pchan->bone->length * 0.25f, OB_ARROWS);
-
+
glPopMatrix();
}
}
}
}
-
+
if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
}
}
@@ -2197,7 +2197,7 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, const short dt)
float smat[4][4], imat[4][4], bmat[4][4];
unsigned int index;
int flag;
-
+
/* being set in code below */
arm->layer_used = 0;
@@ -2209,10 +2209,10 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, const short dt)
copy_m4_m4(smat, rv3d->viewmatob);
mul_mat3_m4_fl(smat, 1.0f / len_v3(ob->obmat[0]));
invert_m4_m4(imat, smat);
-
+
/* and draw blended distances */
glEnable(GL_BLEND);
-
+
if (v3d->zbuf) glDisable(GL_DEPTH_TEST);
for (eBone = arm->edbo->first; eBone; eBone = eBone->next) {
@@ -2223,11 +2223,11 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, const short dt)
}
}
}
-
+
if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
glDisable(GL_BLEND);
}
-
+
/* if solid we draw it first */
if ((dt > OB_WIRE) && (arm->drawtype != ARM_LINE)) {
for (eBone = arm->edbo->first, index = 0; eBone; eBone = eBone->next, index++) {
@@ -2236,17 +2236,17 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, const short dt)
glPushMatrix();
get_matrix_editbone(eBone, bmat);
glMultMatrixf(bmat);
-
+
/* catch exception for bone with hidden parent */
flag = eBone->flag;
if ((eBone->parent) && !EBONE_VISIBLE(arm, eBone->parent)) {
flag &= ~BONE_CONNECTED;
}
-
+
/* set temporary flag for drawing bone as active, but only if selected */
if (eBone == arm->act_edbone)
flag |= BONE_DRAW_ACTIVE;
-
+
if (arm->drawtype == ARM_ENVELOPE)
draw_sphere_bone(OB_SOLID, arm->flag, flag, 0, index, NULL, eBone);
else if (arm->drawtype == ARM_B_BONE)
@@ -2256,13 +2256,13 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, const short dt)
else {
draw_bone(OB_SOLID, arm->flag, flag, 0, index, eBone->length);
}
-
+
glPopMatrix();
}
}
}
}
-
+
/* if wire over solid, set offset */
index = -1;
GPU_select_load_id(-1);
@@ -2270,26 +2270,26 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, const short dt)
if (G.f & G_PICKSEL)
index = 0;
}
- else if (dt > OB_WIRE)
+ else if (dt > OB_WIRE)
ED_view3d_polygon_offset(rv3d, 1.0);
- else if (arm->flag & ARM_EDITMODE)
+ else if (arm->flag & ARM_EDITMODE)
index = 0; /* do selection codes */
-
+
for (eBone = arm->edbo->first; eBone; eBone = eBone->next) {
arm->layer_used |= eBone->layer;
if (eBone->layer & arm->layer) {
if ((eBone->flag & BONE_HIDDEN_A) == 0) {
-
+
/* catch exception for bone with hidden parent */
flag = eBone->flag;
if ((eBone->parent) && !EBONE_VISIBLE(arm, eBone->parent)) {
flag &= ~BONE_CONNECTED;
}
-
+
/* set temporary flag for drawing bone as active, but only if selected */
if (eBone == arm->act_edbone)
flag |= BONE_DRAW_ACTIVE;
-
+
if (arm->drawtype == ARM_ENVELOPE) {
if (dt < OB_SOLID)
draw_sphere_bone_wire(smat, imat, arm->flag, flag, 0, index, NULL, eBone);
@@ -2298,8 +2298,8 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, const short dt)
glPushMatrix();
get_matrix_editbone(eBone, bmat);
glMultMatrixf(bmat);
-
- if (arm->drawtype == ARM_LINE)
+
+ if (arm->drawtype == ARM_LINE)
draw_line_bone(arm->flag, flag, 0, index, NULL, eBone);
else if (arm->drawtype == ARM_WIRE)
draw_wire_bone(OB_WIRE, arm->flag, flag, 0, index, NULL, eBone);
@@ -2307,28 +2307,28 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, const short dt)
draw_b_bone(OB_WIRE, arm->flag, flag, 0, index, NULL, eBone);
else
draw_bone(OB_WIRE, arm->flag, flag, 0, index, eBone->length);
-
+
glPopMatrix();
}
-
+
/* offset to parent */
if (eBone->parent) {
UI_ThemeColor(TH_WIRE_EDIT);
GPU_select_load_id(-1); /* -1 here is OK! */
setlinestyle(3);
-
+
glBegin(GL_LINES);
glVertex3fv(eBone->parent->tail);
glVertex3fv(eBone->head);
glEnd();
-
+
setlinestyle(0);
}
}
}
if (index != -1) index++;
}
-
+
/* restore */
if (index != -1) {
GPU_select_load_id(-1);
@@ -2340,7 +2340,7 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, const short dt)
else if (dt > OB_WIRE) {
ED_view3d_polygon_offset(rv3d, 0.0);
}
-
+
/* finally names and axes */
if (arm->flag & (ARM_DRAWNAMES | ARM_DRAWAXES)) {
/* patch for several 3d cards (IBM mostly) that crash on GL_SELECT with text drawing */
@@ -2348,9 +2348,9 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, const short dt)
float vec[3];
unsigned char col[4];
col[3] = 255;
-
+
if (v3d->zbuf) glDisable(GL_DEPTH_TEST);
-
+
for (eBone = arm->edbo->first; eBone; eBone = eBone->next) {
if (eBone->layer & arm->layer) {
if ((eBone->flag & BONE_HIDDEN_A) == 0) {
@@ -2374,14 +2374,14 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, const short dt)
float viewmat_ebone[4][4];
mul_m4_m4m4(viewmat_ebone, rv3d->viewmatob, bmat);
drawaxes(viewmat_ebone, eBone->length * 0.25f, OB_ARROWS);
-
+
glPopMatrix();
}
-
+
}
}
}
-
+
if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
}
}
@@ -2399,16 +2399,16 @@ static void draw_pose_paths(Scene *scene, View3D *v3d, ARegion *ar, Object *ob)
bAnimVizSettings *avs = &ob->pose->avs;
bArmature *arm = ob->data;
bPoseChannel *pchan;
-
+
/* setup drawing environment for paths */
draw_motion_paths_init(v3d, ar);
-
+
/* draw paths where they exist and they releated bone is visible */
for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
if ((pchan->bone->layer & arm->layer) && (pchan->mpath))
draw_motion_path_instance(scene, ob, pchan, avs, pchan->mpath);
}
-
+
/* cleanup after drawing */
draw_motion_paths_cleanup(v3d);
}
@@ -2416,7 +2416,7 @@ static void draw_pose_paths(Scene *scene, View3D *v3d, ARegion *ar, Object *ob)
/* ---------- Ghosts --------- */
-/* helper function for ghost drawing - sets/removes flags for temporarily
+/* helper function for ghost drawing - sets/removes flags for temporarily
* hiding unselected bones while drawing ghosts
*/
static void ghost_poses_tag_unselected(Object *ob, short unset)
@@ -2424,11 +2424,11 @@ static void ghost_poses_tag_unselected(Object *ob, short unset)
bArmature *arm = ob->data;
bPose *pose = ob->pose;
bPoseChannel *pchan;
-
+
/* don't do anything if no hiding any bones */
if ((arm->flag & ARM_GHOST_ONLYSEL) == 0)
return;
-
+
/* loop over all pchans, adding/removing tags as appropriate */
for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) {
if ((pchan->bone) && (arm->layer & pchan->bone->layer)) {
@@ -2445,7 +2445,7 @@ static void ghost_poses_tag_unselected(Object *ob, short unset)
}
}
-/* draw ghosts that occur within a frame range
+/* draw ghosts that occur within a frame range
* note: object should be in posemode
*/
static void draw_ghost_poses_range(Scene *scene, View3D *v3d, ARegion *ar, Base *base)
@@ -2456,54 +2456,54 @@ static void draw_ghost_poses_range(Scene *scene, View3D *v3d, ARegion *ar, Base
bPose *posen, *poseo;
float start, end, stepsize, range, colfac;
int cfrao, flago;
-
+
start = (float)arm->ghostsf;
end = (float)arm->ghostef;
if (end <= start)
return;
-
+
/* prevent infinite loops if this is set to 0 - T49527 */
if (arm->ghostsize < 1)
arm->ghostsize = 1;
-
+
stepsize = (float)(arm->ghostsize);
range = (float)(end - start);
-
+
/* store values */
ob->mode &= ~OB_MODE_POSE;
cfrao = CFRA;
flago = arm->flag;
arm->flag &= ~(ARM_DRAWNAMES | ARM_DRAWAXES);
-
+
/* copy the pose */
poseo = ob->pose;
BKE_pose_copy_data(&posen, ob->pose, 1);
ob->pose = posen;
BKE_pose_rebuild(ob, ob->data); /* child pointers for IK */
ghost_poses_tag_unselected(ob, 0); /* hide unselected bones if need be */
-
+
glEnable(GL_BLEND);
if (v3d->zbuf) glDisable(GL_DEPTH_TEST);
-
+
/* draw from first frame of range to last */
for (CFRA = (int)start; CFRA <= end; CFRA += (int)stepsize) {
colfac = (end - (float)CFRA) / range;
UI_ThemeColorShadeAlpha(TH_WIRE, 0, -128 - (int)(120.0f * sqrtf(colfac)));
-
+
BKE_animsys_evaluate_animdata(scene, &ob->id, adt, (float)CFRA, ADT_RECALC_ALL);
BKE_pose_where_is(scene, ob);
draw_pose_bones(scene, v3d, ar, base, OB_WIRE, NULL, true, false);
}
glDisable(GL_BLEND);
if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
-
+
/* before disposing of temp pose, use it to restore object to a sane state */
BKE_animsys_evaluate_animdata(scene, &ob->id, adt, (float)cfrao, ADT_RECALC_ALL);
-
+
/* clean up temporary pose */
ghost_poses_tag_unselected(ob, 1); /* unhide unselected bones if need be */
BKE_pose_free(posen);
-
+
/* restore */
CFRA = cfrao;
ob->pose = poseo;
@@ -2511,7 +2511,7 @@ static void draw_ghost_poses_range(Scene *scene, View3D *v3d, ARegion *ar, Base
ob->mode |= OB_MODE_POSE;
}
-/* draw ghosts on keyframes in action within range
+/* draw ghosts on keyframes in action within range
* - object should be in posemode
*/
static void draw_ghost_poses_keys(Scene *scene, View3D *v3d, ARegion *ar, Base *base)
@@ -2525,28 +2525,28 @@ static void draw_ghost_poses_keys(Scene *scene, View3D *v3d, ARegion *ar, Base *
ActKeyColumn *ak, *akn;
float start, end, range, colfac, i;
int cfrao, flago;
-
+
start = (float)arm->ghostsf;
end = (float)arm->ghostef;
if (end <= start)
return;
-
+
/* get keyframes - then clip to only within range */
BLI_dlrbTree_init(&keys);
action_to_keylist(adt, act, &keys, NULL);
BLI_dlrbTree_linkedlist_sync(&keys);
-
+
range = 0;
for (ak = keys.first; ak; ak = akn) {
akn = ak->next;
-
+
if ((ak->cfra < start) || (ak->cfra > end))
BLI_freelinkN((ListBase *)&keys, ak);
else
range++;
}
if (range == 0) return;
-
+
/* store values */
ob->mode &= ~OB_MODE_POSE;
cfrao = CFRA;
@@ -2559,32 +2559,32 @@ static void draw_ghost_poses_keys(Scene *scene, View3D *v3d, ARegion *ar, Base *
ob->pose = posen;
BKE_pose_rebuild(ob, ob->data); /* child pointers for IK */
ghost_poses_tag_unselected(ob, 0); /* hide unselected bones if need be */
-
+
glEnable(GL_BLEND);
if (v3d->zbuf) glDisable(GL_DEPTH_TEST);
-
+
/* draw from first frame of range to last */
for (ak = keys.first, i = 0; ak; ak = ak->next, i++) {
colfac = i / range;
UI_ThemeColorShadeAlpha(TH_WIRE, 0, -128 - (int)(120.0f * sqrtf(colfac)));
-
+
CFRA = (int)ak->cfra;
-
+
BKE_animsys_evaluate_animdata(scene, &ob->id, adt, (float)CFRA, ADT_RECALC_ALL);
BKE_pose_where_is(scene, ob);
draw_pose_bones(scene, v3d, ar, base, OB_WIRE, NULL, true, false);
}
glDisable(GL_BLEND);
if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
-
+
/* before disposing of temp pose, use it to restore object to a sane state */
BKE_animsys_evaluate_animdata(scene, &ob->id, adt, (float)cfrao, ADT_RECALC_ALL);
-
+
/* clean up temporary pose */
ghost_poses_tag_unselected(ob, 1); /* unhide unselected bones if need be */
BLI_dlrbTree_free(&keys);
BKE_pose_free(posen);
-
+
/* restore */
CFRA = cfrao;
ob->pose = poseo;
@@ -2603,7 +2603,7 @@ static void draw_ghost_poses(Scene *scene, View3D *v3d, ARegion *ar, Base *base)
bPose *posen, *poseo;
float cur, start, end, stepsize, range, colfac, actframe, ctime;
int cfrao, flago;
-
+
/* pre conditions, get an action with sufficient frames */
if (ELEM(NULL, adt, adt->action))
return;
@@ -2611,56 +2611,56 @@ static void draw_ghost_poses(Scene *scene, View3D *v3d, ARegion *ar, Base *base)
calc_action_range(adt->action, &start, &end, 0);
if (start == end)
return;
-
+
/* prevent infinite loops if this is set to 0 - T49527 */
if (arm->ghostsize < 1)
arm->ghostsize = 1;
-
+
stepsize = (float)(arm->ghostsize);
range = (float)(arm->ghostep) * stepsize + 0.5f; /* plus half to make the for loop end correct */
-
+
/* store values */
ob->mode &= ~OB_MODE_POSE;
cfrao = CFRA;
actframe = BKE_nla_tweakedit_remap(adt, (float)CFRA, 0);
flago = arm->flag;
arm->flag &= ~(ARM_DRAWNAMES | ARM_DRAWAXES);
-
+
/* copy the pose */
poseo = ob->pose;
BKE_pose_copy_data(&posen, ob->pose, 1);
ob->pose = posen;
BKE_pose_rebuild(ob, ob->data); /* child pointers for IK */
ghost_poses_tag_unselected(ob, 0); /* hide unselected bones if need be */
-
+
glEnable(GL_BLEND);
if (v3d->zbuf) glDisable(GL_DEPTH_TEST);
-
+
/* draw from darkest blend to lowest */
for (cur = stepsize; cur < range; cur += stepsize) {
ctime = cur - (float)fmod(cfrao, stepsize); /* ensures consistent stepping */
colfac = ctime / range;
UI_ThemeColorShadeAlpha(TH_WIRE, 0, -128 - (int)(120.0f * sqrtf(colfac)));
-
+
/* only within action range */
if (actframe + ctime >= start && actframe + ctime <= end) {
CFRA = (int)BKE_nla_tweakedit_remap(adt, actframe + ctime, NLATIME_CONVERT_MAP);
-
+
if (CFRA != cfrao) {
BKE_animsys_evaluate_animdata(scene, &ob->id, adt, (float)CFRA, ADT_RECALC_ALL);
BKE_pose_where_is(scene, ob);
draw_pose_bones(scene, v3d, ar, base, OB_WIRE, NULL, true, false);
}
}
-
+
ctime = cur + (float)fmod((float)cfrao, stepsize) - stepsize + 1.0f; /* ensures consistent stepping */
colfac = ctime / range;
UI_ThemeColorShadeAlpha(TH_WIRE, 0, -128 - (int)(120.0f * sqrtf(colfac)));
-
+
/* only within action range */
if ((actframe - ctime >= start) && (actframe - ctime <= end)) {
CFRA = (int)BKE_nla_tweakedit_remap(adt, actframe - ctime, NLATIME_CONVERT_MAP);
-
+
if (CFRA != cfrao) {
BKE_animsys_evaluate_animdata(scene, &ob->id, adt, (float)CFRA, ADT_RECALC_ALL);
BKE_pose_where_is(scene, ob);
@@ -2670,14 +2670,14 @@ static void draw_ghost_poses(Scene *scene, View3D *v3d, ARegion *ar, Base *base)
}
glDisable(GL_BLEND);
if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
-
+
/* before disposing of temp pose, use it to restore object to a sane state */
BKE_animsys_evaluate_animdata(scene, &ob->id, adt, (float)cfrao, ADT_RECALC_ALL);
-
+
/* clean up temporary pose */
ghost_poses_tag_unselected(ob, 1); /* unhide unselected bones if need be */
BKE_pose_free(posen);
-
+
/* restore */
CFRA = cfrao;
ob->pose = poseo;
@@ -2719,7 +2719,7 @@ bool draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
glFrontFace((ob->transflag & OB_NEG_SCALE) ? GL_CW : GL_CCW); /* only for lighting... */
}
}
-
+
/* arm->flag is being used to detect mode... */
/* editmode? */
if (arm->edbo) {
@@ -2773,8 +2773,8 @@ bool draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
}
}
draw_pose_bones(scene, v3d, ar, base, dt, ob_wire_col, (dflag & DRAW_CONSTCOLOR), is_outline);
- arm->flag &= ~ARM_POSEMODE;
-
+ arm->flag &= ~ARM_POSEMODE;
+
if (ob->mode & OB_MODE_POSE)
UI_ThemeColor(TH_WIRE); /* restore, for extra draw stuff */
}
diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c
index b6bcc592cc8..27180097107 100644
--- a/source/blender/editors/space_view3d/drawmesh.c
+++ b/source/blender/editors/space_view3d/drawmesh.c
@@ -104,7 +104,7 @@ static BLI_bitmap *get_tface_mesh_marked_edge_info(Mesh *me, bool draw_select_ed
MLoop *ml;
int i, j;
bool select_set;
-
+
for (i = 0; i < me->totpoly; i++) {
mp = &me->mpoly[i];
@@ -197,7 +197,7 @@ void draw_mesh_face_select(RegionView3D *rv3d, Mesh *me, DerivedMesh *dm, bool d
dm->drawMappedFaces(dm, draw_mesh_face_select__drawFaceOptsInv, NULL, NULL, (void *)me, DM_DRAW_SKIP_HIDDEN);
glDisable(GL_BLEND);
}
-
+
ED_view3d_polygon_offset(rv3d, 1.0);
/* Draw Stippled Outline for selected faces */
@@ -330,7 +330,7 @@ static bool set_draw_settings_cached(
glTexEnvi(GL_TEXTURE_ENV, GL_SRC1_RGB, GL_PRIMARY_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE);
glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_ALPHA, GL_TEXTURE);
-
+
glActiveTexture(GL_TEXTURE1);
glEnable(GL_TEXTURE_2D);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
@@ -342,14 +342,14 @@ static bool set_draw_settings_cached(
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE);
glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_ALPHA, GL_PREVIOUS);
glBindTexture(GL_TEXTURE_2D, ima->bindcode[TEXTARGET_TEXTURE_2D]);
- glActiveTexture(GL_TEXTURE0);
+ glActiveTexture(GL_TEXTURE0);
}
else {
glActiveTexture(GL_TEXTURE1);
glDisable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, 0);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
- glActiveTexture(GL_TEXTURE0);
+ glActiveTexture(GL_TEXTURE0);
c_badtex = true;
GPU_clear_tpage(true);
@@ -457,9 +457,9 @@ static void draw_textured_begin(Scene *scene, View3D *v3d, RegionView3D *rv3d, O
Gtexdraw.canvas = (Gtexdraw.texpaint_material) ? NULL : imapaint->canvas;
Gtexdraw.is_tex = is_tex;
- /* naughty multitexturing hacks to quickly support stencil + shading + alpha blending
+ /* naughty multitexturing hacks to quickly support stencil + shading + alpha blending
* in new texpaint code. The better solution here would be to support GLSL */
- if (Gtexdraw.is_texpaint) {
+ if (Gtexdraw.is_texpaint) {
glActiveTexture(GL_TEXTURE1);
glEnable(GL_TEXTURE_2D);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
@@ -470,7 +470,7 @@ static void draw_textured_begin(Scene *scene, View3D *v3d, RegionView3D *rv3d, O
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB, GL_SRC_ALPHA);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE);
glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_ALPHA, GL_PREVIOUS);
-
+
/* load the stencil texture here */
if (Gtexdraw.stencil != NULL) {
glActiveTexture(GL_TEXTURE2);
@@ -496,7 +496,7 @@ static void draw_textured_begin(Scene *scene, View3D *v3d, RegionView3D *rv3d, O
}
glActiveTexture(GL_TEXTURE0);
}
-
+
Gtexdraw.color_profile = BKE_scene_check_color_management_enabled(scene);
Gtexdraw.use_game_mat = (RE_engines_find(scene->r.engine)->flag & RE_GAME) != 0;
Gtexdraw.use_backface_culling = (v3d->flag2 & V3D_BACKFACE_CULLING) != 0;
@@ -522,7 +522,7 @@ static void draw_textured_end(void)
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glBindTexture(GL_TEXTURE_2D, 0);
- }
+ }
glActiveTexture(GL_TEXTURE0);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
/* manual reset, since we don't use tpage */
@@ -542,7 +542,7 @@ static void draw_textured_end(void)
* glLightfv(GL_POSITION, ...) which
* is transformed by the current matrix... we
* need to make sure that matrix is identity.
- *
+ *
* It would be better if drawmesh.c kept track
* of and restored the light settings it changed.
* - zr
@@ -710,7 +710,7 @@ static void update_tface_color_layer(DerivedMesh *dm, bool use_mcol)
else copy_v3_v3(col, &ma->r);
rgb_float_to_uchar((unsigned char *)&lcol.r, col);
lcol.a = 255;
-
+
for (j = 0; j < mp->totloop; j++, loop_index++) {
finalCol[loop_index] = lcol;
}
@@ -741,7 +741,7 @@ static DMDrawOption draw_tface_mapped__set_draw(void *userData, int origindex, i
else {
MTexPoly *tpoly = (me->mtpoly) ? &me->mtpoly[origindex] : NULL;
int matnr = mpoly->mat_nr;
-
+
return draw_tface__set_draw(tpoly, (me->mloopcol != NULL), matnr);
}
}
@@ -899,7 +899,7 @@ static void draw_mesh_text(Scene *scene, Object *ob, int glsl)
BKE_bproperty_set_valstr(prop, string);
characters = strlen(string);
-
+
if (!BKE_image_has_ibuf(mtpoly->tpage, NULL))
characters = 0;
@@ -957,7 +957,7 @@ static void draw_mesh_textured_old(Scene *scene, View3D *v3d, RegionView3D *rv3d
/* correct for negative scale */
if (ob->transflag & OB_NEG_SCALE) glFrontFace(GL_CW);
else glFrontFace(GL_CCW);
-
+
/* draw the textured mesh */
draw_textured_begin(scene, v3d, rv3d, ob);
@@ -1047,7 +1047,7 @@ static void draw_mesh_textured_old(Scene *scene, View3D *v3d, RegionView3D *rv3d
}
draw_textured_end();
-
+
/* draw edges and selected faces over textured mesh */
if (!(ob == scene->obedit) && (draw_flags & DRAW_FACE_SELECT)) {
bool draw_select_edges = (ob->mode & OB_MODE_TEXTURE_PAINT) == 0;
@@ -1056,7 +1056,7 @@ static void draw_mesh_textured_old(Scene *scene, View3D *v3d, RegionView3D *rv3d
/* reset from negative scale correction */
glFrontFace(GL_CCW);
-
+
/* in editmode, the blend mode needs to be set in case it was ADD */
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
@@ -1207,7 +1207,7 @@ void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d,
TexMatCallback data = {scene, ob, me, dm, shadeless, two_sided_lighting};
bool (*set_face_cb)(void *, int);
bool picking = (G.f & G_PICKSEL) != 0;
-
+
/* face hiding callback depending on mode */
if (ob == scene->obedit)
set_face_cb = tex_mat_set_face_editmesh_cb;
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index c3823627009..cb45a049e11 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -251,11 +251,11 @@ bool check_object_draw_texture(Scene *scene, View3D *v3d, const char drawtype)
{
return true;
}
-
+
if (v3d->flag2 & V3D_SHOW_SOLID_MATCAP) {
return true;
}
-
+
return false;
}
@@ -304,7 +304,7 @@ bool draw_glsl_material(Scene *scene, Object *ob, View3D *v3d, const char dt)
return false;
if (ob == OBACT && (ob && ob->mode & OB_MODE_WEIGHT_PAINT))
return false;
-
+
if (v3d->flag2 & V3D_SHOW_SOLID_MATCAP)
return true;
@@ -439,62 +439,62 @@ static void draw_xyz_wire(const float viewmat_local_unit[3][3], const float c[3]
copy_v3_v3(buffer[n++], v1);
copy_v3_v3(buffer[n++], v2);
-
+
/* top left to bottom right */
mul_v3_fl(dy, 2.0f);
add_v3_v3(v1, dy);
sub_v3_v3(v2, dy);
-
+
copy_v3_v3(buffer[n++], v1);
copy_v3_v3(buffer[n++], v2);
break;
case 1: /* y axis */
line_type = GL_LINES;
-
+
/* bottom left to top right */
mul_v3_fl(dx, 0.75f);
negate_v3_v3(v1, dx);
sub_v3_v3(v1, dy);
copy_v3_v3(v2, dx);
add_v3_v3(v2, dy);
-
+
copy_v3_v3(buffer[n++], v1);
copy_v3_v3(buffer[n++], v2);
-
+
/* top left to center */
mul_v3_fl(dy, 2.0f);
add_v3_v3(v1, dy);
zero_v3(v2);
-
+
copy_v3_v3(buffer[n++], v1);
copy_v3_v3(buffer[n++], v2);
-
+
break;
case 2: /* z axis */
line_type = GL_LINE_STRIP;
-
+
/* start at top left */
negate_v3_v3(v1, dx);
add_v3_v3(v1, dy);
-
+
copy_v3_v3(buffer[n++], v1);
-
+
mul_v3_fl(dx, 2.0f);
add_v3_v3(v1, dx);
copy_v3_v3(buffer[n++], v1);
-
+
mul_v3_fl(dy, 2.0f);
sub_v3_v3(v1, dx);
sub_v3_v3(v1, dy);
-
+
copy_v3_v3(buffer[n++], v1);
-
+
add_v3_v3(v1, dx);
-
+
copy_v3_v3(buffer[n++], v1);
-
+
break;
default:
BLI_assert(0);
@@ -604,18 +604,18 @@ void drawaxes(const float viewmat_local[4][4], float size, char drawtype)
v2[axis] = size;
glVertex3fv(v1);
glVertex3fv(v2);
-
+
v1[axis] = size * 0.85f;
v1[arrow_axis] = -size * 0.08f;
glVertex3fv(v1);
glVertex3fv(v2);
-
+
v1[arrow_axis] = size * 0.08f;
glVertex3fv(v1);
glVertex3fv(v2);
glEnd();
-
+
v2[axis] += size * 0.125f;
draw_xyz_wire(viewmat_local_unit, v2, size, axis);
@@ -771,7 +771,7 @@ static void drawcentercircle(View3D *v3d, RegionView3D *rv3d, const float co[3],
/* write to near buffer always */
glDepthRange(0.0, 0.0);
glEnable(GL_BLEND);
-
+
if (special_color) {
if (selstate == ACTIVE || selstate == SELECT) glColor4ub(0x88, 0xFF, 0xFF, 155);
else glColor4ub(0x55, 0xCC, 0xCC, 155);
@@ -872,7 +872,7 @@ void view3d_cached_text_draw_end(View3D *v3d, ARegion *ar, bool depth_write)
RegionView3D *rv3d = ar->regiondata;
ViewCachedString *vos;
int tot = 0;
-
+
BLI_assert(g_v3d_string_level >= 0 && g_v3d_string_level <= 2);
/* project first and test */
@@ -911,14 +911,14 @@ void view3d_cached_text_draw_end(View3D *v3d, ARegion *ar, bool depth_write)
glPushMatrix();
wmOrtho2_region_pixelspace(ar);
glLoadIdentity();
-
+
if (depth_write) {
if (v3d->zbuf) glDisable(GL_DEPTH_TEST);
}
else {
glDepthMask(0);
}
-
+
for (vos = g_v3d_strings[g_v3d_string_level]; vos; vos = vos->next) {
if (vos->sco[0] != IS_CLIPPED) {
if (col_pack_prev != vos->col.pack) {
@@ -941,7 +941,7 @@ void view3d_cached_text_draw_end(View3D *v3d, ARegion *ar, bool depth_write)
else {
glDepthMask(1);
}
-
+
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
@@ -1034,7 +1034,7 @@ static void spotvolume(float lvec[3], float vvec[3], const float inp)
/* according definition, we derive cross product is (plane[1],-plane[0],0), en cos = plane[2]);*/
/* translating this comment to english didnt really help me understanding the math! :-) (ton) */
-
+
q[1] = plane[1];
q[2] = -plane[0];
q[3] = 0;
@@ -1203,7 +1203,7 @@ static void drawlamp(View3D *v3d, RegionView3D *rv3d, Base *base,
(dt > OB_WIRE) &&
!(G.f & G_PICKSEL) &&
(la->type == LA_SUN) &&
- ((la->mode & LA_SHAD_BUF) ||
+ ((la->mode & LA_SHAD_BUF) ||
(la->mode & LA_SHAD_RAY)) &&
(la->mode & LA_SHOW_SHADOW_BOX) &&
!(base->flag & OB_FROMDUPLI) &&
@@ -1217,7 +1217,7 @@ static void drawlamp(View3D *v3d, RegionView3D *rv3d, Base *base,
ED_view3d_after_add(v3d->xray ? &v3d->afterdraw_xraytransp : &v3d->afterdraw_transp, base, dflag);
return;
}
-
+
/* we first draw only the screen aligned & fixed scale stuff */
glPushMatrix();
glLoadMatrixf(rv3d->viewmat);
@@ -1256,13 +1256,13 @@ static void drawlamp(View3D *v3d, RegionView3D *rv3d, Base *base,
}
}
}
-
+
/* Inner Circle */
glEnable(GL_BLEND);
drawcircball(GL_LINE_LOOP, vec, lampsize, imat);
glDisable(GL_BLEND);
drawcircball(GL_POLYGON, vec, lampsize, imat);
-
+
/* restore */
if ((dflag & DRAW_CONSTCOLOR) == 0) {
if (ob->id.us > 1)
@@ -1286,24 +1286,24 @@ static void drawlamp(View3D *v3d, RegionView3D *rv3d, Base *base,
setlinestyle(3);
circrad = 0.0f;
}
-
+
/* draw the pretty sun rays */
if (la->type == LA_SUN) {
float v1[3], v2[3], mat[3][3];
short axis;
-
+
/* setup a 45 degree rotation matrix */
axis_angle_normalized_to_mat3_ex(mat, imat[2], M_SQRT1_2, M_SQRT1_2);
/* vectors */
mul_v3_v3fl(v1, imat[0], circrad * 1.2f);
mul_v3_v3fl(v2, imat[0], circrad * 2.5f);
-
+
/* center */
glTranslate3fv(vec);
-
+
setlinestyle(3);
-
+
glBegin(GL_LINES);
for (axis = 0; axis < 8; axis++) {
glVertex3fv(v1);
@@ -1312,20 +1312,20 @@ static void drawlamp(View3D *v3d, RegionView3D *rv3d, Base *base,
mul_m3_v3(mat, v2);
}
glEnd();
-
+
glTranslatef(-vec[0], -vec[1], -vec[2]);
}
-
+
if (la->type == LA_LOCAL) {
if (la->mode & LA_SPHERE) {
drawcircball(GL_LINE_LOOP, vec, la->dist, imat);
}
}
-
+
glPopMatrix(); /* back in object space */
zero_v3(vec);
-
+
if (is_view) {
/* skip drawing extra info */
}
@@ -1439,7 +1439,7 @@ static void drawlamp(View3D *v3d, RegionView3D *rv3d, Base *base,
glEnd();
}
else if (ELEM(la->type, LA_HEMI, LA_SUN)) {
-
+
/* draw the line from the circle along the dist */
glBegin(GL_LINES);
vec[2] = -circrad;
@@ -1447,22 +1447,22 @@ static void drawlamp(View3D *v3d, RegionView3D *rv3d, Base *base,
vec[2] = -la->dist;
glVertex3fv(vec);
glEnd();
-
+
if (la->type == LA_HEMI) {
/* draw the hemisphere curves */
short axis, steps, dir;
float outdist, zdist, mul;
zero_v3(vec);
outdist = 0.14; mul = 1.4; dir = 1;
-
+
setlinestyle(4);
/* loop over the 4 compass points, and draw each arc as a LINE_STRIP */
for (axis = 0; axis < 4; axis++) {
float v[3] = {0.0, 0.0, 0.0};
zdist = 0.02;
-
+
glBegin(GL_LINE_STRIP);
-
+
for (steps = 0; steps < 6; steps++) {
if (axis == 0 || axis == 1) { /* x axis up, x axis down */
/* make the arcs start at the edge of the energy circle */
@@ -1475,12 +1475,12 @@ static void drawlamp(View3D *v3d, RegionView3D *rv3d, Base *base,
}
v[2] = v[2] - steps * zdist;
-
+
glVertex3fv(v);
-
+
zdist = zdist * mul;
}
-
+
glEnd();
/* flip the direction */
dir = -dir;
@@ -1506,41 +1506,41 @@ static void drawlamp(View3D *v3d, RegionView3D *rv3d, Base *base,
glVertex3f(0.0, 0.0, -la->dist);
glEnd();
}
-
+
/* and back to viewspace */
glPushMatrix();
glLoadMatrixf(rv3d->viewmat);
copy_v3_v3(vec, ob->obmat[3]);
setlinestyle(0);
-
+
if ((la->type == LA_SPOT) && (la->mode & LA_SHAD_BUF) && (is_view == false)) {
drawshadbuflimits(la, ob->obmat);
}
-
+
if ((dflag & DRAW_CONSTCOLOR) == 0) {
UI_GetThemeColor4ubv(TH_LAMP, col);
glColor4ubv(col);
}
glEnable(GL_BLEND);
-
+
if (vec[2] > 0) vec[2] -= circrad;
else vec[2] += circrad;
-
+
glBegin(GL_LINES);
glVertex3fv(vec);
vec[2] = 0;
glVertex3fv(vec);
glEnd();
-
+
glPointSize(2.0);
glBegin(GL_POINTS);
glVertex3fv(vec);
glEnd();
-
+
glDisable(GL_BLEND);
-
+
if ((dflag & DRAW_CONSTCOLOR) == 0) {
/* restore for drawing extra stuff */
glColor3ubv(ob_wire_col);
@@ -2140,10 +2140,10 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base
tvec[0] = shift[0] + ((-0.7f * drawsize) * scale[0]);
tvec[1] = shift[1] + ((drawsize * (asp[1] + 0.1f)) * scale[1]);
glVertex3fv(tvec); /* left */
-
+
tvec[0] = shift[0] + ((0.7f * drawsize) * scale[0]);
glVertex3fv(tvec); /* right */
-
+
tvec[0] = shift[0];
tvec[1] = shift[1] + ((1.1f * drawsize * (asp[1] + 0.7f)) * scale[1]);
glVertex3fv(tvec); /* top */
@@ -2263,7 +2263,7 @@ static void lattice_draw_verts(Lattice *lt, DispList *dl, BPoint *actbp, short s
}
}
}
-
+
glEnd();
}
@@ -2274,12 +2274,12 @@ static void drawlattice__point(Lattice *lt, DispList *dl, int u, int v, int w, i
if (actdef_wcol) {
float col[3];
MDeformWeight *mdw = defvert_find_index(lt->dvert + index, actdef_wcol - 1);
-
+
weight_to_rgb(col, mdw ? mdw->weight : 0.0f);
glColor3fv(col);
}
-
+
if (dl) {
glVertex3fv(&dl->verts[index * 3]);
}
@@ -2341,12 +2341,12 @@ static void drawlattice(View3D *v3d, Object *ob)
const bool is_edit = (lt->editlatt != NULL);
dl = BKE_displist_find(&ob->curve_cache->disp, DL_VERTS);
-
+
if (is_edit) {
lt = lt->editlatt->latt;
UI_ThemeColor(TH_WIRE_EDIT);
-
+
if (ob->defbase.first && lt->dvert) {
actdef_wcol = ob->actdef;
}
@@ -2382,10 +2382,10 @@ static void drawlattice(View3D *v3d, Object *ob)
BPoint *actbp = BKE_lattice_active_point_get(lt);
if (v3d->zbuf) glDisable(GL_DEPTH_TEST);
-
+
lattice_draw_verts(lt, dl, actbp, 0);
lattice_draw_verts(lt, dl, actbp, 1);
-
+
if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
}
}
@@ -2509,7 +2509,7 @@ static void draw_dm_face_centers__mapFunc(void *userData, int index, const float
{
drawBMSelect_userData *data = userData;
BMFace *efa = BM_face_at_index(data->bm, index);
-
+
if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN) &&
(BM_elem_flag_test(efa, BM_ELEM_SELECT) == data->select))
{
@@ -2584,7 +2584,7 @@ static void draw_dm_verts__mapFunc(void *userData, int index, const float co[3],
if (vs->flag & MVERT_SKIN_ROOT) {
float radius = (vs->radius[0] + vs->radius[1]) * 0.5f;
glEnd();
-
+
glColor4ubv(data->th_skin_root);
drawcircball(GL_LINES, co, radius, data->imat);
@@ -2656,7 +2656,7 @@ static DMDrawOption draw_dm_edges_sel__setDrawOptions(void *userData, int index)
/* no alpha, this is used so a transparent color can disable drawing unselected edges in editmode */
if (col[3] == 0)
return DM_DRAW_OPTION_SKIP;
-
+
glColor4ubv(col);
}
return DM_DRAW_OPTION_NORMAL;
@@ -2670,7 +2670,7 @@ static void draw_dm_edges_sel(BMEditMesh *em, DerivedMesh *dm, unsigned char *ba
unsigned char *selCol, unsigned char *actCol, BMEdge *eed_act)
{
drawDMEdgesSel_userData data;
-
+
data.baseCol = baseCol;
data.selCol = selCol;
data.actCol = actCol;
@@ -2963,7 +2963,7 @@ static DMDrawOption draw_dm_faces_sel__setDrawOptions(void *userData, int index)
drawDMFacesSel_userData *data = userData;
BMFace *efa = BM_face_at_index(data->bm, index);
unsigned char *col;
-
+
if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) {
if (efa == data->efa_act) {
glColor4ubv(data->cols[2]);
@@ -3052,7 +3052,7 @@ static DMDrawOption draw_dm_creases__setDrawOptions(void *userData, int index)
drawDMLayer_userData *data = userData;
BMesh *bm = data->bm;
BMEdge *eed = BM_edge_at_index(bm, index);
-
+
if (!BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) {
const float crease = BM_ELEM_CD_GET_FLOAT(eed, data->cd_layer_offset);
if (crease != 0.0f) {
@@ -3184,13 +3184,13 @@ static void draw_em_fancy_verts(Scene *scene, View3D *v3d, Object *obedit,
glColor4ubv(col);
draw_dm_verts(em, cageDM, sel, eve_act, rv3d);
}
-
+
if (check_ob_drawface_dot(scene, v3d, obedit->dt)) {
glPointSize(fsize);
glColor4ubv(fcol);
draw_dm_face_centers(em, cageDM, sel);
}
-
+
if (pass == 0) {
glDisable(GL_BLEND);
glEnable(GL_DEPTH_TEST);
@@ -3212,7 +3212,7 @@ static void draw_em_fancy_edges(BMEditMesh *em, Scene *scene, View3D *v3d,
UI_GetThemeColor4ubv(TH_EDGE_SELECT, selCol);
UI_GetThemeColor4ubv(TH_WIRE_EDIT, wireCol);
UI_GetThemeColor4ubv(TH_EDITMESH_ACTIVE, actCol);
-
+
/* when sel only is used, don't render wire, only selected, this is used for
* textured draw mode when the 'edges' option is disabled */
if (sel_only)
@@ -3461,7 +3461,7 @@ static void draw_em_measure_stats(ARegion *ar, View3D *v3d, Object *ob, BMEditMe
} (void)0
UI_GetThemeColor3ubv(TH_DRAWEXTRA_FACEAREA, col);
-
+
if (dm) {
BM_mesh_elem_index_ensure(em->bm, BM_VERT);
}
@@ -3681,9 +3681,9 @@ static void draw_em_fancy(Scene *scene, ARegion *ar, View3D *v3d,
Mesh *me = ob->data;
const bool use_occlude_wire = (dt > OB_WIRE) && (v3d->flag2 & V3D_OCCLUDE_WIRE);
bool use_depth_offset = false;
-
+
glLineWidth(1);
-
+
BM_mesh_elem_table_ensure(em->bm, BM_VERT | BM_EDGE | BM_FACE);
if (check_object_draw_editweight(me, finalDM)) {
@@ -3989,7 +3989,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
else if (ob->dtx & OB_DRAWWIRE) {
draw_wire = OBDRAW_WIRE_ON_DEPTH; /* draw wire after solid using zoffset and depth buffer adjusment */
}
-
+
/* check polys instead of tessfaces because of dyntopo where tessfaces don't exist */
if (dm->type == DM_TYPE_CCGDM) {
no_edges = !subsurf_has_edges(dm);
@@ -4195,7 +4195,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
ED_view3d_polygon_offset(rv3d, 1.0);
glDepthMask(0); /* disable write in zbuffer, selected edge wires show better */
}
-
+
glLineWidth(1.0f);
dm->drawEdges(dm, ((dt == OB_WIRE) || no_faces), (ob->dtx & OB_DRAW_ALL_EDGES) != 0);
@@ -4204,7 +4204,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
ED_view3d_polygon_offset(rv3d, 0.0);
}
}
-
+
if (is_obact && BKE_paint_select_vert_test(ob)) {
const bool use_depth = (v3d->flag & V3D_ZBUF_SELECT) != 0;
glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE));
@@ -4238,7 +4238,7 @@ static bool draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3
}
}
}
-
+
if (obedit && ob != obedit && ob->data == obedit->data) {
if (BKE_key_from_object(ob) || BKE_key_from_object(obedit)) {}
else if (ob->modifiers.first || obedit->modifiers.first) {}
@@ -4253,7 +4253,7 @@ static bool draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3
if (ob == obedit || drawlinked) {
DerivedMesh *finalDM, *cageDM;
-
+
if (obedit != ob) {
finalDM = cageDM = editbmesh_get_derived_base(
ob, em, scene->customdata_mask);
@@ -4304,11 +4304,11 @@ static bool draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3
draw_mesh_fancy(scene, ar, v3d, rv3d, base, dt, ob_wire_col, dflag);
GPU_end_object_materials();
-
+
if (me->totvert == 0) retval = true;
}
}
-
+
if ((dflag & DRAW_PICKING) == 0 && (base->flag & OB_FROMDUPLI) == 0 && (v3d->flag2 & V3D_RENDER_SHADOW) == 0) {
/* GPU_begin_object_materials checked if this is needed */
if (do_alpha_after) {
@@ -4329,7 +4329,7 @@ static bool draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3
if (v3d->flag2 & V3D_BACKFACE_CULLING)
glDisable(GL_CULL_FACE);
-
+
return retval;
}
@@ -4343,7 +4343,7 @@ static bool draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3
static bool drawDispListwire_ex(ListBase *dlbase, unsigned int dl_type_mask)
{
if (dlbase == NULL) return true;
-
+
glEnableClientState(GL_VERTEX_ARRAY);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
@@ -4355,7 +4355,7 @@ static bool drawDispListwire_ex(ListBase *dlbase, unsigned int dl_type_mask)
if ((dl_type_mask & (1 << dl->type)) == 0) {
continue;
}
-
+
const float *data = dl->verts;
int parts;
@@ -4366,7 +4366,7 @@ static bool drawDispListwire_ex(ListBase *dlbase, unsigned int dl_type_mask)
for (parts = 0; parts < dl->parts; parts++)
glDrawArrays(GL_LINE_STRIP, parts * dl->nr, dl->nr);
-
+
break;
case DL_POLY:
@@ -4424,10 +4424,10 @@ static bool drawDispListwire_ex(ListBase *dlbase, unsigned int dl_type_mask)
break;
}
}
-
+
glDisableClientState(GL_VERTEX_ARRAY);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
-
+
return false;
}
@@ -4449,14 +4449,14 @@ static void drawDispListsolid(ListBase *lb, Object *ob, const short dflag,
const unsigned char ob_wire_col[4], const bool use_glsl)
{
GPUVertexAttribs gattribs;
-
+
if (lb == NULL) return;
glEnableClientState(GL_VERTEX_ARRAY);
/* track current material, -1 for none (needed for lines) */
short col = -1;
-
+
DispList *dl = lb->first;
while (dl) {
const float *data = dl->verts;
@@ -4928,7 +4928,7 @@ static void draw_particle(ParticleKey *state, int draw_as, short draw, float pix
copy_v3_v3(bb->vel, state->vel);
psys_make_billboard(bb, xvec, yvec, zvec, bb_center);
-
+
add_v3_v3v3(pdd->vd, bb_center, xvec);
add_v3_v3(pdd->vd, yvec); pdd->vd += 3;
@@ -5124,7 +5124,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
case PART_DRAW_CROSS:
case PART_DRAW_AXIS:
/* lets calculate the scale: */
-
+
if (part->draw_size == 0.0)
pixsize_scale = 2.0f;
else
@@ -5461,14 +5461,14 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
if (part->type == PART_HAIR) {
if (part->draw & PART_DRAW_GUIDE_HAIRS) {
DerivedMesh *hair_dm = psys->hair_out_dm;
-
+
glDisableClientState(GL_NORMAL_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
-
+
for (a = 0, pa = psys->particles; a < totpart; a++, pa++) {
if (pa->totkey > 1) {
HairKey *hkey = pa->hair;
-
+
glVertexPointer(3, GL_FLOAT, sizeof(HairKey), hkey->world_co);
#if 0 /* XXX use proper theme color here */
@@ -5480,37 +5480,37 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
glDrawArrays(GL_LINE_STRIP, 0, pa->totkey);
}
}
-
+
if (hair_dm) {
MVert *mvert = hair_dm->getVertArray(hair_dm);
int i;
-
+
glColor3f(0.9f, 0.4f, 0.4f);
-
+
glBegin(GL_LINES);
for (a = 0, pa = psys->particles; a < totpart; a++, pa++) {
for (i = 1; i < pa->totkey; ++i) {
float v1[3], v2[3];
-
+
copy_v3_v3(v1, mvert[pa->hair_index + i - 1].co);
copy_v3_v3(v2, mvert[pa->hair_index + i].co);
-
+
mul_m4_v3(ob->obmat, v1);
mul_m4_v3(ob->obmat, v2);
-
+
glVertex3fv(v1);
glVertex3fv(v2);
}
}
glEnd();
}
-
+
glEnableClientState(GL_NORMAL_ARRAY);
if ((dflag & DRAW_CONSTCOLOR) == 0)
if (part->draw_col == PART_DRAW_COL_MAT)
glEnableClientState(GL_COLOR_ARRAY);
}
-
+
if (part->draw & PART_DRAW_HAIR_GRID) {
ClothModifierData *clmd = psys->clmd;
if (clmd) {
@@ -5518,10 +5518,10 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
float *gmax = clmd->hair_grid_max;
int *res = clmd->hair_grid_res;
int i;
-
+
glDisableClientState(GL_NORMAL_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
-
+
if (select)
UI_ThemeColor(TH_ACTIVE);
else
@@ -5531,18 +5531,18 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
glVertex3f(gmax[0], gmin[1], gmin[2]); glVertex3f(gmax[0], gmax[1], gmin[2]);
glVertex3f(gmax[0], gmax[1], gmin[2]); glVertex3f(gmin[0], gmax[1], gmin[2]);
glVertex3f(gmin[0], gmax[1], gmin[2]); glVertex3f(gmin[0], gmin[1], gmin[2]);
-
+
glVertex3f(gmin[0], gmin[1], gmax[2]); glVertex3f(gmax[0], gmin[1], gmax[2]);
glVertex3f(gmax[0], gmin[1], gmax[2]); glVertex3f(gmax[0], gmax[1], gmax[2]);
glVertex3f(gmax[0], gmax[1], gmax[2]); glVertex3f(gmin[0], gmax[1], gmax[2]);
glVertex3f(gmin[0], gmax[1], gmax[2]); glVertex3f(gmin[0], gmin[1], gmax[2]);
-
+
glVertex3f(gmin[0], gmin[1], gmin[2]); glVertex3f(gmin[0], gmin[1], gmax[2]);
glVertex3f(gmax[0], gmin[1], gmin[2]); glVertex3f(gmax[0], gmin[1], gmax[2]);
glVertex3f(gmin[0], gmax[1], gmin[2]); glVertex3f(gmin[0], gmax[1], gmax[2]);
glVertex3f(gmax[0], gmax[1], gmin[2]); glVertex3f(gmax[0], gmax[1], gmax[2]);
glEnd();
-
+
if (select)
UI_ThemeColorShadeAlpha(TH_ACTIVE, 0, -100);
else
@@ -5572,7 +5572,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
}
glEnd();
glDisable(GL_BLEND);
-
+
glEnableClientState(GL_NORMAL_ARRAY);
if ((dflag & DRAW_CONSTCOLOR) == 0)
if (part->draw_col == PART_DRAW_COL_MAT)
@@ -5580,7 +5580,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
}
}
}
-
+
/* draw child particles */
cache = psys->childcache;
for (a = 0; a < totchild; a++) {
@@ -5684,9 +5684,9 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
glDisableClientState(GL_COLOR_ARRAY);
cpack(0xC0C0C0);
}
-
+
glVertexPointer(3, GL_FLOAT, 0, pdd->vedata);
-
+
glDrawArrays(GL_LINES, 0, 2 * totve);
}
@@ -5694,7 +5694,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
glPolygonMode(GL_BACK, polygonmode[1]);
/* 7. */
-
+
GPU_basic_shader_bind(GPU_SHADER_USE_COLOR);
glDisableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);
@@ -6124,9 +6124,9 @@ static void drawvertsN(Nurb *nu, const char sel, const bool hide_handles, const
UI_ThemeColor(color);
glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE));
-
+
glBegin(GL_POINTS);
-
+
if (nu->type == CU_BEZIER) {
BezTriple *bezt = nu->bezt;
@@ -6173,7 +6173,7 @@ static void drawvertsN(Nurb *nu, const char sel, const bool hide_handles, const
bp++;
}
}
-
+
glEnd();
}
@@ -6375,7 +6375,7 @@ static void draw_editnurb(
return;
if (v3d->zbuf) glDepthFunc(GL_ALWAYS);
-
+
/* first non-selected and active handles */
int index = 0;
for (nu = nurb; nu; nu = nu->next) {
@@ -6394,7 +6394,7 @@ static void draw_editnurb(
drawhandlesN(nu, 1, hide_handles);
drawvertsN(nu, 0, hide_handles, NULL);
}
-
+
if (v3d->zbuf) glDepthFunc(GL_LEQUAL);
glColor3ubv(wire_col);
@@ -6408,7 +6408,7 @@ static void draw_editnurb(
BevPoint *bevp = bl->bevpoints;
int nr = bl->nr;
int skip = nu->resolu / 16;
-
+
while (nr-- > 0) { /* accounts for empty bevel lists */
const float fac = bevp->radius * ts->normalsize;
float vec_a[3]; /* Offset perpendicular to the curve */
@@ -6417,7 +6417,7 @@ static void draw_editnurb(
vec_a[0] = fac;
vec_a[1] = 0.0f;
vec_a[2] = 0.0f;
-
+
mul_qt_v3(bevp->quat, vec_a);
madd_v3_v3fl(vec_a, bevp->dir, -fac);
@@ -6432,7 +6432,7 @@ static void draw_editnurb(
glVertex3fv(bevp->vec);
glVertex3fv(vec_b);
glEnd();
-
+
bevp += skip + 1;
nr -= skip;
}
@@ -6440,11 +6440,11 @@ static void draw_editnurb(
}
if (v3d->zbuf) glDepthFunc(GL_ALWAYS);
-
+
for (nu = nurb; nu; nu = nu->next) {
drawvertsN(nu, 1, hide_handles, vert);
}
-
+
if (v3d->zbuf) glDepthFunc(GL_LEQUAL);
}
@@ -6593,31 +6593,31 @@ static void draw_editfont(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *b
static void draw_empty_sphere(float size)
{
static GLuint displist = 0;
-
+
if (displist == 0) {
GLUquadricObj *qobj;
-
+
displist = glGenLists(1);
glNewList(displist, GL_COMPILE);
-
+
glPushMatrix();
-
+
qobj = gluNewQuadric();
gluQuadricDrawStyle(qobj, GLU_SILHOUETTE);
gluDisk(qobj, 0.0, 1, 16, 1);
-
+
glRotatef(90, 0, 1, 0);
gluDisk(qobj, 0.0, 1, 16, 1);
-
+
glRotatef(90, 1, 0, 0);
gluDisk(qobj, 0.0, 1, 16, 1);
-
+
gluDeleteQuadric(qobj);
-
+
glPopMatrix();
glEndList();
}
-
+
glScalef(size, size, size);
glCallList(displist);
glScalef(1.0f / size, 1.0f / size, 1.0f / size);
@@ -6630,15 +6630,15 @@ static void draw_empty_cone(float size)
GLUquadricObj *qobj = gluNewQuadric();
gluQuadricDrawStyle(qobj, GLU_SILHOUETTE);
-
+
glPushMatrix();
-
+
glScalef(radius, size * 2.0f, radius);
glRotatef(-90.0, 1.0, 0.0, 0.0);
gluCylinder(qobj, 1.0, 0.0, 1.0, 8, 1);
glPopMatrix();
-
+
gluDeleteQuadric(qobj);
}
@@ -6718,10 +6718,10 @@ static void drawcircle_size(float size)
for (short degrees = 0; degrees < CIRCLE_RESOL; degrees++) {
float x = cosval[degrees];
float y = sinval[degrees];
-
+
glVertex3f(x * size, 0.0f, y * size);
}
-
+
glEnd();
}
@@ -6779,7 +6779,7 @@ static bool drawmball(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
MetaElem *ml;
float imat[4][4];
int code = 1;
-
+
MetaBall *mb = ob->data;
if (mb->editelems) {
@@ -6816,7 +6816,7 @@ static bool drawmball(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
glColor3ubv(ob_wire_col);
}
}
-
+
glLineWidth(1.0f);
while (ml) {
@@ -6826,7 +6826,7 @@ static bool drawmball(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
if ((ml->flag & SELECT) && (ml->flag & MB_SCALE_RAD)) cpack(0xA0A0F0);
else cpack(0x3030A0);
}
-
+
if (G.f & G_PICKSEL) {
ml->selcol1 = code;
GPU_select_load_id(code++);
@@ -6840,14 +6840,14 @@ static bool drawmball(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
if ((ml->flag & SELECT) && !(ml->flag & MB_SCALE_RAD)) cpack(0xA0F0A0);
else cpack(0x30A030);
}
-
+
if (G.f & G_PICKSEL) {
ml->selcol2 = code;
GPU_select_load_id(code++);
}
drawcircball(GL_LINE_LOOP, &(ml->x), ml->rad * atanf(ml->s) / (float)M_PI_2, imat);
}
-
+
ml = ml->next;
}
return false;
@@ -6861,14 +6861,14 @@ static void draw_forcefield(Object *ob, RegionView3D *rv3d,
float vec[3] = {0.0, 0.0, 0.0};
/* scale size of circle etc with the empty drawsize */
const float size = (ob->type == OB_EMPTY) ? ob->empty_drawsize : 1.0f;
-
+
/* calculus here, is reused in PFIELD_FORCE */
invert_m4_m4(imat, rv3d->viewmatob);
#if 0
normalize_v3(imat[0]); /* we don't do this because field doesnt scale either... apart from wind! */
normalize_v3(imat[1]);
#endif
-
+
if (pd->forcefield == PFIELD_WIND) {
float force_val = pd->f_strength;
@@ -6886,7 +6886,7 @@ static void draw_forcefield(Object *ob, RegionView3D *rv3d,
vec[2] = 1.5f * force_val;
drawcircball(GL_LINE_LOOP, vec, size, tmat);
vec[2] = 0.0f; /* reset vec for max dist circle */
-
+
}
else if (pd->forcefield == PFIELD_FORCE) {
float ffall_val = pd->f_power;
@@ -6935,7 +6935,7 @@ static void draw_forcefield(Object *ob, RegionView3D *rv3d,
setlinestyle(0);
where_on_path(ob, 0.0f, guidevec1, guidevec2, NULL, NULL, NULL);
drawcircball(GL_LINE_LOOP, guidevec1, mindist, imat);
-
+
copy_v3_v3(vec, guidevec1); /* max center */
}
}
@@ -7006,7 +7006,7 @@ static void draw_box(const float vec[8][3], bool solid)
{
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3, GL_FLOAT, 0, vec);
-
+
if (solid) {
const GLubyte indices[24] = {0, 1, 2, 3, 7, 6, 5, 4, 4, 5, 1, 0, 3, 2, 6, 7, 3, 7, 4, 0, 1, 5, 6, 2};
glDrawRangeElements(GL_QUADS, 0, 7, 24, GL_UNSIGNED_BYTE, indices);
@@ -7023,9 +7023,9 @@ static void draw_bb_quadric(BoundBox *bb, char type, bool around_origin)
{
float size[3], cent[3];
GLUquadricObj *qobj = gluNewQuadric();
-
+
gluQuadricDrawStyle(qobj, GLU_SILHOUETTE);
-
+
BKE_boundbox_calc_size_aabb(bb, size);
if (around_origin) {
@@ -7034,7 +7034,7 @@ static void draw_bb_quadric(BoundBox *bb, char type, bool around_origin)
else {
BKE_boundbox_calc_center_aabb(bb, cent);
}
-
+
glPushMatrix();
if (type == OB_BOUND_SPHERE) {
float scale = MAX3(size[0], size[1], size[2]);
@@ -7064,7 +7064,7 @@ static void draw_bb_quadric(BoundBox *bb, char type, bool around_origin)
gluSphere(qobj, radius, 8, 4);
}
glPopMatrix();
-
+
gluDeleteQuadric(qobj);
}
@@ -7072,7 +7072,7 @@ static void draw_bounding_volume(Object *ob, char type)
{
BoundBox bb_local;
BoundBox *bb = NULL;
-
+
if (ob->type == OB_MESH) {
bb = BKE_mesh_boundbox_get(ob);
}
@@ -7095,24 +7095,24 @@ static void draw_bounding_volume(Object *ob, char type)
bb = &bb_local;
BKE_boundbox_init_from_minmax(bb, min, max);
}
-
+
if (bb == NULL)
return;
-
+
if (ob->gameflag & OB_BOUNDS) { /* bounds need to be drawn around origin for game engine */
if (type == OB_BOUND_BOX) {
float vec[8][3], size[3];
-
+
BKE_boundbox_calc_size_aabb(bb, size);
-
+
vec[0][0] = vec[1][0] = vec[2][0] = vec[3][0] = -size[0];
vec[4][0] = vec[5][0] = vec[6][0] = vec[7][0] = +size[0];
vec[0][1] = vec[1][1] = vec[4][1] = vec[5][1] = -size[1];
vec[2][1] = vec[3][1] = vec[6][1] = vec[7][1] = +size[1];
vec[0][2] = vec[3][2] = vec[4][2] = vec[7][2] = -size[2];
vec[1][2] = vec[2][2] = vec[5][2] = vec[6][2] = +size[2];
-
+
draw_box(vec, false);
}
else {
@@ -7130,7 +7130,7 @@ static void draw_bounding_volume(Object *ob, char type)
static void drawtexspace(Object *ob)
{
float vec[8][3], loc[3], size[3];
-
+
if (ob->type == OB_MESH) {
BKE_mesh_texspace_get(ob->data, loc, NULL, size);
}
@@ -7148,13 +7148,13 @@ static void drawtexspace(Object *ob)
vec[0][0] = vec[1][0] = vec[2][0] = vec[3][0] = loc[0] - size[0];
vec[4][0] = vec[5][0] = vec[6][0] = vec[7][0] = loc[0] + size[0];
-
+
vec[0][1] = vec[1][1] = vec[4][1] = vec[5][1] = loc[1] - size[1];
vec[2][1] = vec[3][1] = vec[6][1] = vec[7][1] = loc[1] + size[1];
vec[0][2] = vec[3][2] = vec[4][2] = vec[7][2] = loc[2] - size[2];
vec[1][2] = vec[2][2] = vec[5][2] = vec[6][2] = loc[2] + size[2];
-
+
setlinestyle(2);
draw_box(vec, false);
@@ -7169,9 +7169,9 @@ static void draw_object_selected_outline(
{
RegionView3D *rv3d = ar->regiondata;
Object *ob = base->object;
-
+
glDepthMask(0);
-
+
if (ELEM(ob->type, OB_FONT, OB_CURVE, OB_SURF)) {
bool has_faces = false;
@@ -7426,14 +7426,14 @@ static void draw_rigidbody_shape(Object *ob)
switch (ob->rigidbody_object->shape) {
case RB_SHAPE_BOX:
BKE_boundbox_calc_size_aabb(bb, size);
-
+
vec[0][0] = vec[1][0] = vec[2][0] = vec[3][0] = -size[0];
vec[4][0] = vec[5][0] = vec[6][0] = vec[7][0] = +size[0];
vec[0][1] = vec[1][1] = vec[4][1] = vec[5][1] = -size[1];
vec[2][1] = vec[3][1] = vec[6][1] = vec[7][1] = +size[1];
vec[0][2] = vec[3][2] = vec[4][2] = vec[7][2] = -size[2];
vec[1][2] = vec[2][2] = vec[5][2] = vec[6][2] = +size[2];
-
+
draw_box(vec, false);
break;
case RB_SHAPE_SPHERE:
@@ -7475,11 +7475,11 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short
if (ob != scene->obedit) {
if (ob->restrictflag & OB_RESTRICT_VIEW)
return;
-
+
if (render_override) {
if (ob->restrictflag & OB_RESTRICT_RENDER)
return;
-
+
if (!has_particles && (ob->transflag & (OB_DUPLI & ~OB_DUPLIFRAMES)))
return;
}
@@ -7558,17 +7558,17 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short
glLineWidth(1.0f);
view3d_cached_text_draw_begin();
-
+
/* draw motion paths (in view space) */
if (ob->mpath && !render_override) {
bAnimVizSettings *avs = &ob->avs;
-
+
/* setup drawing environment for paths */
draw_motion_paths_init(v3d, ar);
-
+
/* draw motion path for object */
draw_motion_path_instance(scene, ob, NULL, avs, ob->mpath);
-
+
/* cleanup after drawing */
draw_motion_paths_cleanup(v3d);
}
@@ -7693,7 +7693,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short
case OB_MBALL:
{
MetaBall *mb = ob->data;
-
+
if (mb->editelems)
drawmball(scene, v3d, rv3d, base, dt, dflag, ob_wire_col);
else if (dt == OB_BOUNDBOX) {
@@ -7810,7 +7810,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short
//glDepthMask(GL_FALSE);
glLoadMatrixf(rv3d->viewmat);
-
+
view3d_cached_text_draw_begin();
for (psys = ob->particlesystem.first; psys; psys = psys->next) {
@@ -7827,7 +7827,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short
view3d_cached_text_draw_end(v3d, ar, 0);
glMultMatrixf(ob->obmat);
-
+
//glDepthMask(GL_TRUE);
if (col) cpack(col);
}
@@ -7996,13 +7996,13 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short
setlinestyle(0);
}
}
-
+
/* return warning, this is cached text draw */
invert_m4_m4(ob->imat, ob->obmat);
view3d_cached_text_draw_end(v3d, ar, 1);
/* return warning, clear temp flag */
v3d->flag2 &= ~V3D_SHOW_SOLID_MATCAP;
-
+
glLoadMatrixf(rv3d->viewmat);
if (zbufoff) {
@@ -8057,7 +8057,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short
if (dflag == 0 && (v3d->flag & V3D_HIDE_HELPLINES) == 0 && !render_override) {
ListBase *list;
RigidBodyCon *rbc = ob->rigidbody_constraint;
-
+
/* draw hook center and offset line */
if (ob != scene->obedit)
draw_hooks(ob);
@@ -8077,15 +8077,15 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short
bConstraint *curcon;
bConstraintOb *cob;
unsigned char col1[4], col2[4];
-
+
list = &ob->constraints;
-
+
UI_GetThemeColor3ubv(TH_GRID, col1);
UI_make_axis_color(col1, col2, 'Z');
glColor3ubv(col2);
-
+
cob = BKE_constraints_make_evalob(scene, ob, NULL, CONSTRAINT_OBTYPE_OBJECT);
-
+
for (curcon = list->first; curcon; curcon = curcon->next) {
if (ELEM(curcon->type, CONSTRAINT_TYPE_FOLLOWTRACK, CONSTRAINT_TYPE_OBJECTSOLVER)) {
/* special case for object solver and follow track constraints because they don't fill
@@ -8143,7 +8143,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short
}
}
}
-
+
BKE_constraints_clear_evalob(cob);
}
/* draw rigid body constraint lines */
@@ -8284,7 +8284,7 @@ static void bbs_mesh_wire(BMEditMesh *em, DerivedMesh *dm, int offset)
static DMDrawOption bbs_mesh_mask__setSolidDrawOptions(void *userData, int index)
{
BMFace *efa = BM_face_at_index(userData, index);
-
+
if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) {
return DM_DRAW_OPTION_NORMAL;
}
@@ -8397,7 +8397,7 @@ static void bbs_mesh_solid_faces(Scene *scene, Object *ob)
{
DerivedMesh *dm = mesh_get_derived_final(scene, ob, scene->customdata_mask);
Mesh *me = ob->data;
-
+
glColor3ub(0, 0, 0);
DM_update_materials(dm, ob);
@@ -8494,7 +8494,7 @@ static void draw_object_mesh_instance(Scene *scene, View3D *v3d, RegionView3D *r
{
Mesh *me = ob->data;
DerivedMesh *dm = NULL, *edm = NULL;
-
+
if (ob->mode & OB_MODE_EDIT) {
edm = editbmesh_get_derived_base(ob, me->edit_btmesh, CD_MASK_BAREMESH);
DM_update_materials(edm, ob);
@@ -8518,9 +8518,9 @@ static void draw_object_mesh_instance(Scene *scene, View3D *v3d, RegionView3D *r
bool glsl = draw_glsl_material(scene, ob, v3d, dt);
GPU_begin_object_materials(v3d, rv3d, scene, ob, glsl, NULL);
}
-
+
glFrontFace((ob->transflag & OB_NEG_SCALE) ? GL_CW : GL_CCW);
-
+
if (dm) {
dm->drawFacesSolid(dm, NULL, 0, GPU_object_material_bind);
GPU_end_object_materials();
diff --git a/source/blender/editors/space_view3d/drawsimdebug.c b/source/blender/editors/space_view3d/drawsimdebug.c
index f8cb031107d..9165147736a 100644
--- a/source/blender/editors/space_view3d/drawsimdebug.c
+++ b/source/blender/editors/space_view3d/drawsimdebug.c
@@ -48,23 +48,23 @@
static void draw_sim_debug_elements(SimDebugData *debug_data, float imat[4][4])
{
GHashIterator iter;
-
+
/**** dots ****/
-
+
glPointSize(3.0f);
glBegin(GL_POINTS);
for (BLI_ghashIterator_init(&iter, debug_data->gh); !BLI_ghashIterator_done(&iter); BLI_ghashIterator_step(&iter)) {
SimDebugElement *elem = BLI_ghashIterator_getValue(&iter);
if (elem->type != SIM_DEBUG_ELEM_DOT)
continue;
-
+
glColor3f(elem->color[0], elem->color[1], elem->color[2]);
glVertex3f(elem->v1[0], elem->v1[1], elem->v1[2]);
}
glEnd();
-
+
/**** circles ****/
-
+
{
float circle[16][2] = {
{0.000000, 1.000000}, {0.382683, 0.923880}, {0.707107, 0.707107}, {0.923880, 0.382683},
@@ -76,10 +76,10 @@ static void draw_sim_debug_elements(SimDebugData *debug_data, float imat[4][4])
float radius = elem->v2[0];
float co[3];
int i;
-
+
if (elem->type != SIM_DEBUG_ELEM_CIRCLE)
continue;
-
+
glColor3f(elem->color[0], elem->color[1], elem->color[2]);
glBegin(GL_LINE_LOOP);
for (i = 0; i < 16; ++i) {
@@ -88,62 +88,62 @@ static void draw_sim_debug_elements(SimDebugData *debug_data, float imat[4][4])
co[2] = 0.0f;
mul_mat3_m4_v3(imat, co);
add_v3_v3(co, elem->v1);
-
+
glVertex3f(co[0], co[1], co[2]);
}
glEnd();
}
}
-
+
/**** lines ****/
-
+
glBegin(GL_LINES);
for (BLI_ghashIterator_init(&iter, debug_data->gh); !BLI_ghashIterator_done(&iter); BLI_ghashIterator_step(&iter)) {
SimDebugElement *elem = BLI_ghashIterator_getValue(&iter);
if (elem->type != SIM_DEBUG_ELEM_LINE)
continue;
-
+
glColor3f(elem->color[0], elem->color[1], elem->color[2]);
glVertex3f(elem->v1[0], elem->v1[1], elem->v1[2]);
glVertex3f(elem->v2[0], elem->v2[1], elem->v2[2]);
}
glEnd();
-
+
/**** vectors ****/
-
+
glPointSize(2.0f);
glBegin(GL_POINTS);
for (BLI_ghashIterator_init(&iter, debug_data->gh); !BLI_ghashIterator_done(&iter); BLI_ghashIterator_step(&iter)) {
SimDebugElement *elem = BLI_ghashIterator_getValue(&iter);
if (elem->type != SIM_DEBUG_ELEM_VECTOR)
continue;
-
+
glColor3f(elem->color[0], elem->color[1], elem->color[2]);
glVertex3f(elem->v1[0], elem->v1[1], elem->v1[2]);
}
glEnd();
-
+
glBegin(GL_LINES);
for (BLI_ghashIterator_init(&iter, debug_data->gh); !BLI_ghashIterator_done(&iter); BLI_ghashIterator_step(&iter)) {
SimDebugElement *elem = BLI_ghashIterator_getValue(&iter);
float t[3];
if (elem->type != SIM_DEBUG_ELEM_VECTOR)
continue;
-
+
glColor3f(elem->color[0], elem->color[1], elem->color[2]);
glVertex3f(elem->v1[0], elem->v1[1], elem->v1[2]);
add_v3_v3v3(t, elem->v1, elem->v2);
glVertex3f(t[0], t[1], t[2]);
}
glEnd();
-
+
/**** strings ****/
-
+
for (BLI_ghashIterator_init(&iter, debug_data->gh); !BLI_ghashIterator_done(&iter); BLI_ghashIterator_step(&iter)) {
SimDebugElement *elem = BLI_ghashIterator_getValue(&iter);
if (elem->type != SIM_DEBUG_ELEM_STRING)
continue;
-
+
unsigned char col[4];
rgb_float_to_uchar(col, elem->color);
col[3] = 255;
@@ -157,24 +157,24 @@ void draw_sim_debug_data(Scene *UNUSED(scene), View3D *v3d, ARegion *ar)
RegionView3D *rv3d = ar->regiondata;
/*Object *ob = base->object;*/
float imat[4][4];
-
+
if (!_sim_debug_data)
return;
-
+
invert_m4_m4(imat, rv3d->viewmatob);
-
+
// glDepthMask(GL_FALSE);
// glEnable(GL_BLEND);
-
+
glPushMatrix();
glLoadMatrixf(rv3d->viewmat);
-
+
view3d_cached_text_draw_begin();
draw_sim_debug_elements(_sim_debug_data, imat);
view3d_cached_text_draw_end(v3d, ar, false);
-
+
glPopMatrix();
-
+
// glDepthMask(GL_TRUE);
// glDisable(GL_BLEND);
}
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index d999b9fef0a..833d54efd75 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -86,49 +86,49 @@ ARegion *view3d_has_buttons_region(ScrArea *sa)
ar = BKE_area_find_region_type(sa, RGN_TYPE_UI);
if (ar) return ar;
-
+
/* add subdiv level; after header */
ar = BKE_area_find_region_type(sa, RGN_TYPE_HEADER);
/* is error! */
if (ar == NULL) return NULL;
-
+
arnew = MEM_callocN(sizeof(ARegion), "buttons for view3d");
-
+
BLI_insertlinkafter(&sa->regionbase, ar, arnew);
arnew->regiontype = RGN_TYPE_UI;
arnew->alignment = RGN_ALIGN_RIGHT;
-
+
arnew->flag = RGN_FLAG_HIDDEN;
-
+
return arnew;
}
ARegion *view3d_has_tools_region(ScrArea *sa)
{
ARegion *ar, *artool = NULL, *arprops = NULL, *arhead;
-
+
for (ar = sa->regionbase.first; ar; ar = ar->next) {
if (ar->regiontype == RGN_TYPE_TOOLS)
artool = ar;
if (ar->regiontype == RGN_TYPE_TOOL_PROPS)
arprops = ar;
}
-
+
/* tool region hide/unhide also hides props */
if (arprops && artool) return artool;
-
+
if (artool == NULL) {
/* add subdiv level; after header */
for (arhead = sa->regionbase.first; arhead; arhead = arhead->next)
if (arhead->regiontype == RGN_TYPE_HEADER)
break;
-
+
/* is error! */
if (arhead == NULL) return NULL;
-
+
artool = MEM_callocN(sizeof(ARegion), "tools for view3d");
-
+
BLI_insertlinkafter(&sa->regionbase, arhead, artool);
artool->regiontype = RGN_TYPE_TOOLS;
artool->alignment = RGN_ALIGN_LEFT;
@@ -138,12 +138,12 @@ ARegion *view3d_has_tools_region(ScrArea *sa)
if (arprops == NULL) {
/* add extra subdivided region for tool properties */
arprops = MEM_callocN(sizeof(ARegion), "tool props for view3d");
-
+
BLI_insertlinkafter(&sa->regionbase, artool, arprops);
arprops->regiontype = RGN_TYPE_TOOL_PROPS;
arprops->alignment = RGN_ALIGN_BOTTOM | RGN_SPLIT_PREV;
}
-
+
return artool;
}
@@ -153,7 +153,7 @@ ARegion *view3d_has_tools_region(ScrArea *sa)
RegionView3D *ED_view3d_context_rv3d(bContext *C)
{
RegionView3D *rv3d = CTX_wm_region_view3d(C);
-
+
if (rv3d == NULL) {
ScrArea *sa = CTX_wm_area(C);
if (sa && sa->spacetype == SPACE_VIEW3D) {
@@ -312,7 +312,7 @@ static SpaceLink *view3d_new(const bContext *C)
ARegion *ar;
View3D *v3d;
RegionView3D *rv3d;
-
+
v3d = MEM_callocN(sizeof(View3D), "initview3d");
v3d->spacetype = SPACE_VIEW3D;
v3d->lay = v3d->layact = 1;
@@ -327,10 +327,10 @@ static SpaceLink *view3d_new(const bContext *C)
v3d->drawtype = OB_SOLID;
v3d->gridflag = V3D_SHOW_X | V3D_SHOW_Y | V3D_SHOW_FLOOR;
-
+
v3d->flag = V3D_SELECT_OUTLINE;
v3d->flag2 = V3D_SHOW_RECONSTRUCTION | V3D_SHOW_GPENCIL;
-
+
v3d->lens = 35.0f;
v3d->near = 0.01f;
v3d->far = 1000.0f;
@@ -338,7 +338,7 @@ static SpaceLink *view3d_new(const bContext *C)
v3d->twflag |= U.tw_flag & V3D_USE_MANIPULATOR;
v3d->twtype = V3D_MANIP_TRANSLATE;
v3d->around = V3D_AROUND_CENTER_MEAN;
-
+
v3d->bundle_size = 0.2f;
v3d->bundle_drawtype = OB_PLAINAXES;
@@ -350,48 +350,48 @@ static SpaceLink *view3d_new(const bContext *C)
/* header */
ar = MEM_callocN(sizeof(ARegion), "header for view3d");
-
+
BLI_addtail(&v3d->regionbase, ar);
ar->regiontype = RGN_TYPE_HEADER;
ar->alignment = RGN_ALIGN_BOTTOM;
-
+
/* tool shelf */
ar = MEM_callocN(sizeof(ARegion), "toolshelf for view3d");
-
+
BLI_addtail(&v3d->regionbase, ar);
ar->regiontype = RGN_TYPE_TOOLS;
ar->alignment = RGN_ALIGN_LEFT;
ar->flag = RGN_FLAG_HIDDEN;
-
+
/* tool properties */
ar = MEM_callocN(sizeof(ARegion), "tool properties for view3d");
-
+
BLI_addtail(&v3d->regionbase, ar);
ar->regiontype = RGN_TYPE_TOOL_PROPS;
ar->alignment = RGN_ALIGN_BOTTOM | RGN_SPLIT_PREV;
ar->flag = RGN_FLAG_HIDDEN;
-
+
/* buttons/list view */
ar = MEM_callocN(sizeof(ARegion), "buttons for view3d");
-
+
BLI_addtail(&v3d->regionbase, ar);
ar->regiontype = RGN_TYPE_UI;
ar->alignment = RGN_ALIGN_RIGHT;
ar->flag = RGN_FLAG_HIDDEN;
-
+
/* main region */
ar = MEM_callocN(sizeof(ARegion), "main region for view3d");
-
+
BLI_addtail(&v3d->regionbase, ar);
ar->regiontype = RGN_TYPE_WINDOW;
-
+
ar->regiondata = MEM_callocN(sizeof(RegionView3D), "region view3d");
rv3d = ar->regiondata;
rv3d->viewquat[0] = 1.0f;
rv3d->persp = RV3D_PERSP;
rv3d->view = RV3D_VIEW_USER;
rv3d->dist = 10.0;
-
+
return (SpaceLink *)v3d;
}
@@ -412,9 +412,9 @@ static void view3d_free(SpaceLink *sl)
BLI_freelistN(&vd->bgpicbase);
if (vd->localvd) MEM_freeN(vd->localvd);
-
+
if (vd->properties_storage) MEM_freeN(vd->properties_storage);
-
+
/* matcap material, its preview rect gets freed via icons */
if (vd->defmaterial) {
if (vd->defmaterial->gpumaterial.first)
@@ -441,7 +441,7 @@ static SpaceLink *view3d_duplicate(SpaceLink *sl)
View3D *v3do = (View3D *)sl;
View3D *v3dn = MEM_dupallocN(sl);
BGpic *bgpic;
-
+
/* clear or remove stuff from old */
if (v3dn->localvd) {
@@ -452,7 +452,7 @@ static SpaceLink *view3d_duplicate(SpaceLink *sl)
if (v3dn->drawtype == OB_RENDER)
v3dn->drawtype = OB_SOLID;
-
+
/* copy or clear inside new stuff */
v3dn->defmaterial = NULL;
@@ -483,19 +483,19 @@ static void view3d_main_region_init(wmWindowManager *wm, ARegion *ar)
wmKeyMap *keymap;
/* object ops. */
-
+
/* important to be before Pose keymap since they can both be enabled at once */
keymap = WM_keymap_find(wm->defaultconf, "Face Mask", 0, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
-
-
+
+
keymap = WM_keymap_find(wm->defaultconf, "Weight Paint Vertex Selection", 0, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
/* pose is not modal, operator poll checks for this */
keymap = WM_keymap_find(wm->defaultconf, "Pose", 0, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
-
+
keymap = WM_keymap_find(wm->defaultconf, "Object Mode", 0, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
@@ -516,13 +516,13 @@ static void view3d_main_region_init(wmWindowManager *wm, ARegion *ar)
keymap = WM_keymap_find(wm->defaultconf, "Sculpt", 0, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
-
+
keymap = WM_keymap_find(wm->defaultconf, "Mesh", 0, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
-
+
keymap = WM_keymap_find(wm->defaultconf, "Curve", 0, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
-
+
keymap = WM_keymap_find(wm->defaultconf, "Armature", 0, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
@@ -531,7 +531,7 @@ static void view3d_main_region_init(wmWindowManager *wm, ARegion *ar)
keymap = WM_keymap_find(wm->defaultconf, "Metaball", 0, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
-
+
keymap = WM_keymap_find(wm->defaultconf, "Lattice", 0, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
@@ -554,12 +554,12 @@ static void view3d_main_region_init(wmWindowManager *wm, ARegion *ar)
keymap = WM_keymap_find(wm->defaultconf, "3D View", SPACE_VIEW3D, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
-
+
/* add drop boxes */
lb = WM_dropboxmap_find("View3D", SPACE_VIEW3D, RGN_TYPE_WINDOW);
-
+
WM_event_add_dropbox_handler(&ar->handlers, lb);
-
+
}
static void view3d_main_region_exit(wmWindowManager *wm, ARegion *ar)
@@ -572,7 +572,7 @@ static void view3d_main_region_exit(wmWindowManager *wm, ARegion *ar)
GPU_offscreen_free(rv3d->gpuoffscreen);
rv3d->gpuoffscreen = NULL;
}
-
+
if (rv3d->compositor) {
GPU_fx_compositor_destroy(rv3d->compositor);
rv3d->compositor = NULL;
@@ -667,7 +667,7 @@ static void view3d_ob_drop_copy(wmDrag *drag, wmDropBox *drop)
static void view3d_group_drop_copy(wmDrag *drag, wmDropBox *drop)
{
ID *id = drag->poin;
-
+
drop->opcontext = WM_OP_EXEC_DEFAULT;
RNA_string_set(drop->ptr, "name", id->name + 2);
}
@@ -675,14 +675,14 @@ static void view3d_group_drop_copy(wmDrag *drag, wmDropBox *drop)
static void view3d_id_drop_copy(wmDrag *drag, wmDropBox *drop)
{
ID *id = drag->poin;
-
+
RNA_string_set(drop->ptr, "name", id->name + 2);
}
static void view3d_id_path_drop_copy(wmDrag *drag, wmDropBox *drop)
{
ID *id = drag->poin;
-
+
if (id) {
RNA_string_set(drop->ptr, "name", id->name + 2);
RNA_struct_property_unset(drop->ptr, "filepath");
@@ -698,13 +698,13 @@ static void view3d_id_path_drop_copy(wmDrag *drag, wmDropBox *drop)
static void view3d_dropboxes(void)
{
ListBase *lb = WM_dropboxmap_find("View3D", SPACE_VIEW3D, RGN_TYPE_WINDOW);
-
+
WM_dropbox_add(lb, "OBJECT_OT_add_named", view3d_ob_drop_poll, view3d_ob_drop_copy);
WM_dropbox_add(lb, "OBJECT_OT_drop_named_material", view3d_mat_drop_poll, view3d_id_drop_copy);
WM_dropbox_add(lb, "MESH_OT_drop_named_image", view3d_ima_mesh_drop_poll, view3d_id_path_drop_copy);
WM_dropbox_add(lb, "OBJECT_OT_drop_named_image", view3d_ima_empty_drop_poll, view3d_id_path_drop_copy);
WM_dropbox_add(lb, "VIEW3D_OT_background_image_add", view3d_ima_bg_drop_poll, view3d_id_path_drop_copy);
- WM_dropbox_add(lb, "OBJECT_OT_group_instance_add", view3d_group_drop_poll, view3d_group_drop_copy);
+ WM_dropbox_add(lb, "OBJECT_OT_group_instance_add", view3d_group_drop_poll, view3d_group_drop_copy);
}
@@ -713,14 +713,14 @@ static void view3d_dropboxes(void)
static void view3d_main_region_free(ARegion *ar)
{
RegionView3D *rv3d = ar->regiondata;
-
+
if (rv3d) {
if (rv3d->localvd) MEM_freeN(rv3d->localvd);
if (rv3d->clipbb) MEM_freeN(rv3d->clipbb);
if (rv3d->render_engine)
RE_engine_free(rv3d->render_engine);
-
+
if (rv3d->depths) {
if (rv3d->depths->depths) MEM_freeN(rv3d->depths->depths);
MEM_freeN(rv3d->depths);
@@ -745,20 +745,20 @@ static void *view3d_main_region_duplicate(void *poin)
{
if (poin) {
RegionView3D *rv3d = poin, *new;
-
+
new = MEM_dupallocN(rv3d);
if (rv3d->localvd)
new->localvd = MEM_dupallocN(rv3d->localvd);
if (rv3d->clipbb)
new->clipbb = MEM_dupallocN(rv3d->clipbb);
-
+
new->depths = NULL;
new->gpuoffscreen = NULL;
new->render_engine = NULL;
new->sms = NULL;
new->smooth_timer = NULL;
new->compositor = NULL;
-
+
return new;
}
return NULL;
@@ -798,7 +798,7 @@ static void view3d_main_region_listener(bScreen *sc, ScrArea *sa, ARegion *ar, w
{
Scene *scene = sc->scene;
View3D *v3d = sa->spacedata.first;
-
+
/* context changes */
switch (wmn->category) {
case NC_ANIMATION:
@@ -1037,7 +1037,7 @@ static void view3d_main_region_cursor(wmWindow *win, ScrArea *UNUSED(sa), ARegio
static void view3d_header_region_init(wmWindowManager *wm, ARegion *ar)
{
wmKeyMap *keymap = WM_keymap_find(wm->defaultconf, "3D View Generic", SPACE_VIEW3D, 0);
-
+
WM_event_add_keymap_handler(&ar->handlers, keymap);
ED_region_header_init(ar);
@@ -1084,7 +1084,7 @@ static void view3d_buttons_region_init(wmWindowManager *wm, ARegion *ar)
wmKeyMap *keymap;
ED_region_panels_init(wm, ar);
-
+
keymap = WM_keymap_find(wm->defaultconf, "3D View Generic", SPACE_VIEW3D, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
}
@@ -1188,7 +1188,7 @@ static void view3d_buttons_region_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(
static void view3d_tools_region_init(wmWindowManager *wm, ARegion *ar)
{
wmKeyMap *keymap;
-
+
ED_region_panels_init(wm, ar);
keymap = WM_keymap_find(wm->defaultconf, "3D View Generic", SPACE_VIEW3D, 0);
@@ -1359,7 +1359,7 @@ static int view3d_context(const bContext *C, const char *member, bContextDataRes
if ((ob->restrictflag & OB_RESTRICT_VIEW) == 0 || (ob->mode & OB_MODE_EDIT))
CTX_data_pointer_set(result, &scene->id, &RNA_ObjectBase, scene->basact);
}
-
+
return 1;
}
else if (CTX_data_equals(member, "active_object")) {
@@ -1371,7 +1371,7 @@ static int view3d_context(const bContext *C, const char *member, bContextDataRes
if ((ob->restrictflag & OB_RESTRICT_VIEW) == 0 || (ob->mode & OB_MODE_EDIT))
CTX_data_id_pointer_set(result, &scene->basact->object->id);
}
-
+
return 1;
}
else {
@@ -1447,10 +1447,10 @@ void ED_spacetype_view3d(void)
{
SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype view3d");
ARegionType *art;
-
+
st->spaceid = SPACE_VIEW3D;
strncpy(st->name, "View3D", BKE_ST_MAXNAME);
-
+
st->new = view3d_new;
st->free = view3d_free;
st->init = view3d_init;
@@ -1475,7 +1475,7 @@ void ED_spacetype_view3d(void)
art->cursor = view3d_main_region_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 buttons region");
art->regionid = RGN_TYPE_UI;
@@ -1498,7 +1498,7 @@ void ED_spacetype_view3d(void)
art->init = view3d_tools_region_init;
art->draw = view3d_tools_region_draw;
BLI_addhead(&st->regiontypes, art);
-
+
#if 0
/* unfinished still */
view3d_toolshelf_register(art);
@@ -1514,10 +1514,10 @@ void ED_spacetype_view3d(void)
art->init = view3d_tools_region_init;
art->draw = view3d_tools_region_draw;
BLI_addhead(&st->regiontypes, art);
-
+
view3d_tool_props_register(art);
-
-
+
+
/* regions: header */
art = MEM_callocN(sizeof(ARegionType), "spacetype view3d header region");
art->regionid = RGN_TYPE_HEADER;
@@ -1527,7 +1527,7 @@ void ED_spacetype_view3d(void)
art->init = view3d_header_region_init;
art->draw = view3d_header_region_draw;
BLI_addhead(&st->regiontypes, art);
-
+
BKE_spacetype_register(st);
}
diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c
index 0c67776693d..fbbc5bd7bb9 100644
--- a/source/blender/editors/space_view3d/view3d_buttons.c
+++ b/source/blender/editors/space_view3d/view3d_buttons.c
@@ -833,7 +833,7 @@ static void view3d_panel_vgroup(const bContext *C, Panel *pa)
bcol = uiLayoutColumn(pa->layout, true);
row = uiLayoutRow(bcol, true); /* The filter button row */
-
+
RNA_pointer_create(NULL, &RNA_ToolSettings, ts, &tools_ptr);
uiItemR(row, &tools_ptr, "vertex_group_subset", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
@@ -862,7 +862,7 @@ static void view3d_panel_vgroup(const bContext *C, Panel *pa)
UI_but_flag_enable(but, UI_BUT_INACTIVE);
}
xco += x;
-
+
row = uiLayoutRow(split, true);
uiLayoutSetEnabled(row, !locked);
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index b167f731852..d8247caa5c2 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -124,35 +124,35 @@ extern void bl_debug_color_set(const unsigned int col);
void circf(float x, float y, float rad)
{
- GLUquadricObj *qobj = gluNewQuadric();
-
- gluQuadricDrawStyle(qobj, GLU_FILL);
-
- glPushMatrix();
-
+ GLUquadricObj *qobj = gluNewQuadric();
+
+ gluQuadricDrawStyle(qobj, GLU_FILL);
+
+ glPushMatrix();
+
glTranslatef(x, y, 0.0);
-
+
gluDisk(qobj, 0.0, rad, 32, 1);
-
- glPopMatrix();
-
+
+ glPopMatrix();
+
gluDeleteQuadric(qobj);
}
void circ(float x, float y, float rad)
{
- GLUquadricObj *qobj = gluNewQuadric();
-
- gluQuadricDrawStyle(qobj, GLU_SILHOUETTE);
-
- glPushMatrix();
-
+ GLUquadricObj *qobj = gluNewQuadric();
+
+ gluQuadricDrawStyle(qobj, GLU_SILHOUETTE);
+
+ glPushMatrix();
+
glTranslatef(x, y, 0.0);
-
+
gluDisk(qobj, 0.0, rad, 32, 1);
-
- glPopMatrix();
-
+
+ glPopMatrix();
+
gluDeleteQuadric(qobj);
}
@@ -240,7 +240,7 @@ bool ED_view3d_clipping_test(const RegionView3D *rv3d, const float co[3], const
static void drawgrid_draw(ARegion *ar, double wx, double wy, double x, double y, double dx)
-{
+{
double verts[2][2];
x += (wx);
@@ -306,14 +306,14 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char **
dx = fabs(x - (wx) * fx / fw);
if (dx == 0) dx = fabs(y - (wy) * fy / fw);
-
+
glLineWidth(1.0f);
glDepthMask(GL_FALSE); /* disable write in zbuffer */
/* check zoom out */
UI_ThemeColor(TH_GRID);
-
+
if (unit->system) {
/* Use GRID_MIN_PX * 2 for units because very very small grid
* items are less useful when dealing with units */
@@ -430,23 +430,23 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char **
UI_GetThemeColor3ubv(TH_GRID, col);
setlinestyle(0);
-
+
/* center cross */
/* horizontal line */
if (ELEM(rv3d->view, RV3D_VIEW_RIGHT, RV3D_VIEW_LEFT))
UI_make_axis_color(col, col2, 'Y');
else UI_make_axis_color(col, col2, 'X');
glColor3ubv(col2);
-
- fdrawline(0.0, y, (float)ar->winx, y);
-
+
+ fdrawline(0.0, y, (float)ar->winx, y);
+
/* vertical line */
if (ELEM(rv3d->view, RV3D_VIEW_TOP, RV3D_VIEW_BOTTOM))
UI_make_axis_color(col, col2, 'Y');
else UI_make_axis_color(col, col2, 'Z');
glColor3ubv(col2);
- fdrawline(x, 0.0, x, (float)ar->winy);
+ fdrawline(x, 0.0, x, (float)ar->winy);
glDepthMask(GL_TRUE); /* enable write in zbuffer */
}
@@ -485,7 +485,7 @@ static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit, bool wr
const int gridlines = v3d->gridlines / 2;
if (v3d->gridlines < 3) return;
-
+
/* use 'grid_scale' instead of 'v3d->grid' from now on */
grid_scale = ED_view3d_grid_scale(scene, v3d, grid_unit);
grid = gridlines * grid_scale;
@@ -538,7 +538,7 @@ static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit, bool wr
glDisableClientState(GL_VERTEX_ARRAY);
}
-
+
/* draw the Z axis line */
/* check for the 'show Z axis' preference */
if (v3d->gridflag & (V3D_SHOW_X | V3D_SHOW_Y | V3D_SHOW_Z)) {
@@ -561,7 +561,7 @@ static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit, bool wr
}
glEnd();
}
-
+
glDepthMask(GL_TRUE);
}
@@ -575,9 +575,9 @@ static void drawcursor(Scene *scene, ARegion *ar, View3D *v3d)
const float f5 = 0.25f * U.widget_unit;
const float f10 = 0.5f * U.widget_unit;
const float f20 = U.widget_unit;
-
+
glLineWidth(1);
- setlinestyle(0);
+ setlinestyle(0);
cpack(0xFF);
circ((float)co[0], (float)co[1], f10);
setlinestyle(4);
@@ -691,7 +691,7 @@ static void draw_rotation_guide(RegionView3D *rv3d)
sub_v3_v3v3(end, o, scaled_axis);
glVertex3fv(end);
glEnd();
-
+
/* -- draw ring around rotation center -- */
{
#define ROT_AXIS_DETAIL 13
@@ -757,7 +757,7 @@ static void draw_rotation_guide(RegionView3D *rv3d)
static void draw_view_icon(RegionView3D *rv3d, rcti *rect)
{
BIFIconID icon;
-
+
if (ELEM(rv3d->view, RV3D_VIEW_TOP, RV3D_VIEW_BOTTOM))
icon = ICON_AXIS_TOP;
else if (ELEM(rv3d->view, RV3D_VIEW_FRONT, RV3D_VIEW_BACK))
@@ -765,19 +765,19 @@ static void draw_view_icon(RegionView3D *rv3d, rcti *rect)
else if (ELEM(rv3d->view, RV3D_VIEW_RIGHT, RV3D_VIEW_LEFT))
icon = ICON_AXIS_SIDE;
else return;
-
+
glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+
UI_icon_draw(5.0 + rect->xmin, 5.0 + rect->ymin, icon);
-
+
glDisable(GL_BLEND);
}
static const char *view3d_get_name(View3D *v3d, RegionView3D *rv3d)
{
const char *name = NULL;
-
+
switch (rv3d->view) {
case RV3D_VIEW_FRONT:
if (rv3d->persp == RV3D_ORTHO) name = IFACE_("Front Ortho");
@@ -803,7 +803,7 @@ static const char *view3d_get_name(View3D *v3d, RegionView3D *rv3d)
if (rv3d->persp == RV3D_ORTHO) name = IFACE_("Left Ortho");
else name = IFACE_("Left Persp");
break;
-
+
default:
if (rv3d->persp == RV3D_CAMOB) {
if ((v3d->camera) && (v3d->camera->type == OB_CAMERA)) {
@@ -829,7 +829,7 @@ static const char *view3d_get_name(View3D *v3d, RegionView3D *rv3d)
}
break;
}
-
+
return name;
}
@@ -857,7 +857,7 @@ static void draw_viewport_name(ARegion *ar, View3D *v3d, rcti *rect)
#endif
}
-/* draw info beside axes in bottom left-corner:
+/* draw info beside axes in bottom left-corner:
* framenum, object name, bone name (if available), marker name (if available)
*/
@@ -874,7 +874,7 @@ static void draw_selected_name(Scene *scene, Object *ob, const rcti *rect)
s += sprintf(s, "(%d)", cfra);
- /*
+ /*
* info can contain:
* - a frame (7 + 2)
* - 3 object names (MAX_NAME)
@@ -885,7 +885,7 @@ static void draw_selected_name(Scene *scene, Object *ob, const rcti *rect)
/* get name of marker on current frame (if available) */
markern = BKE_scene_find_marker_name(scene, cfra);
-
+
/* check if there is an object */
if (ob) {
*s++ = ' ';
@@ -894,7 +894,7 @@ static void draw_selected_name(Scene *scene, Object *ob, const rcti *rect)
/* name(s) to display depends on type of object */
if (ob->type == OB_ARMATURE) {
bArmature *arm = ob->data;
-
+
/* show name of active bone too (if possible) */
if (arm->edbo) {
if (arm->act_edbone) {
@@ -943,7 +943,7 @@ static void draw_selected_name(Scene *scene, Object *ob, const rcti *rect)
}
}
}
-
+
/* color depends on whether there is a keyframe */
if (id_frame_has_keyframe((ID *)ob, /* BKE_scene_frame_get(scene) */ (float)cfra, ANIMFILTER_KEYS_LOCAL))
UI_ThemeColor(TH_TIME_KEYFRAME);
@@ -963,7 +963,7 @@ static void draw_selected_name(Scene *scene, Object *ob, const rcti *rect)
if (markern) {
s += sprintf(s, " <%s>", markern);
}
-
+
if (U.uiflag & USER_SHOW_ROTVIEWICON)
offset = U.widget_unit + (U.rvisize * 2) + rect->xmin;
@@ -1107,14 +1107,14 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d)
return;
if (v3d->camera->type == OB_CAMERA)
ca = v3d->camera->data;
-
+
ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &viewborder, false);
/* the offsets */
x1 = viewborder.xmin;
y1 = viewborder.ymin;
x2 = viewborder.xmax;
y2 = viewborder.ymax;
-
+
glLineWidth(1.0f);
/* apply offsets so the real 3D camera shows through */
@@ -1128,7 +1128,7 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d)
y1i = (int)(y1 - 1.0001f);
x2i = (int)(x2 + (1.0f - 0.0001f));
y2i = (int)(y2 + (1.0f - 0.0001f));
-
+
/* passepartout, specified in camera edit buttons */
if (ca && (ca->flag & CAM_SHOWPASSEPARTOUT) && ca->passepartalpha > 0.000001f) {
const float winx = (ar->winx + 1);
@@ -1151,14 +1151,14 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d)
glRectf(x1i, winy, x2i, y2i);
if (y2i > 0.0f)
glRectf(x1i, y1i, x2i, 0.0);
-
+
glDisable(GL_BLEND);
}
setlinestyle(0);
UI_ThemeColor(TH_BACK);
-
+
fdrawbox(x1i, y1i, x2i, y2i);
#ifdef VIEW3D_CAMERA_BORDER_HACK
@@ -1364,7 +1364,7 @@ static void backdrawview3d(Scene *scene, wmWindow *win, ARegion *ar, View3D *v3d
#endif
if (v3d->drawtype > OB_WIRE) v3d->zbuf = true;
-
+
/* dithering and AA break color coding, so disable */
glDisable(GL_DITHER);
@@ -1411,10 +1411,10 @@ static void backdrawview3d(Scene *scene, wmWindow *win, ARegion *ar, View3D *v3d
glClear(GL_COLOR_BUFFER_BIT);
glDisable(GL_DEPTH_TEST);
}
-
+
if (rv3d->rflag & RV3D_CLIPPING)
ED_view3d_clipping_set(rv3d);
-
+
G.f |= G_BACKBUFSEL;
if (obact && (obact->lay & v3d->lay)) {
@@ -1481,7 +1481,7 @@ int ED_view3d_backbuf_sample_size_clamp(ARegion *ar, const float dist)
unsigned int ED_view3d_backbuf_sample(ViewContext *vc, int x, int y)
{
unsigned int col;
-
+
if (x >= vc->ar->winx || y >= vc->ar->winy) {
return 0;
}
@@ -1490,11 +1490,11 @@ unsigned int ED_view3d_backbuf_sample(ViewContext *vc, int x, int y)
view3d_opengl_read_pixels(vc->ar, x, y, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &col);
glReadBuffer(GL_BACK);
-
+
if (ENDIAN_ORDER == B_ENDIAN) {
BLI_endian_switch_uint32(&col);
}
-
+
return GPU_select_to_index(col);
}
@@ -1529,7 +1529,7 @@ ImBuf *ED_view3d_backbuf_read(ViewContext *vc, int xmin, int ymin, int xmax, int
}
GPU_select_to_index_array(ibuf_clip->rect, size_clip[0] * size_clip[1]);
-
+
if ((clip.xmin == xmin) &&
(clip.xmax == xmax) &&
(clip.ymin == ymin) &&
@@ -1577,19 +1577,19 @@ uint ED_view3d_backbuf_sample_rect(
if (!buf) return 0;
rc = 0;
-
+
dirvec[0][0] = 1; dirvec[0][1] = 0;
dirvec[1][0] = 0; dirvec[1][1] = -size;
dirvec[2][0] = -1; dirvec[2][1] = 0;
dirvec[3][0] = 0; dirvec[3][1] = size;
-
+
bufmin = buf->rect;
tbuf = buf->rect;
bufmax = buf->rect + size * size;
tbuf += amount * size + amount;
-
+
for (nr = 1; nr <= size; nr++) {
-
+
for (a = 0; a < 2; a++) {
for (b = 0; b < nr; b++) {
if (*tbuf && *tbuf >= min && *tbuf < max) {
@@ -1605,9 +1605,9 @@ uint ED_view3d_backbuf_sample_rect(
index = (*tbuf - min) + 1;
goto exit;
}
-
+
tbuf += (dirvec[rc][0] + dirvec[rc][1]);
-
+
if (tbuf < bufmin || tbuf >= bufmax) {
goto exit;
}
@@ -1971,18 +1971,18 @@ void ED_view3d_after_add(ListBase *lb, Base *base, const short dflag)
static void view3d_draw_transp(Scene *scene, ARegion *ar, View3D *v3d)
{
View3DAfter *v3da;
-
+
glDepthMask(GL_FALSE);
v3d->transp = true;
-
+
while ((v3da = BLI_pophead(&v3d->afterdraw_transp))) {
draw_object(scene, ar, v3d, v3da->base, v3da->dflag);
MEM_freeN(v3da);
}
v3d->transp = false;
-
+
glDepthMask(GL_TRUE);
-
+
}
/* clears zbuffer and draws it over */
@@ -2014,7 +2014,7 @@ static void view3d_draw_xraytransp(Scene *scene, ARegion *ar, View3D *v3d, const
v3d->xray = true;
v3d->transp = true;
-
+
glDepthMask(GL_FALSE);
while ((v3da = BLI_pophead(&v3d->afterdraw_xraytransp))) {
@@ -2156,20 +2156,20 @@ static void draw_dupli_objects_color(
tbase.object->transflag |= OB_NEG_SCALE;
else
tbase.object->transflag &= ~OB_NEG_SCALE;
-
+
/* should move outside the loop but possible color is set in draw_object still */
if ((dflag & DRAW_CONSTCOLOR) == 0) {
glColor3ubv(color_rgb);
}
-
+
/* generate displist, test for new object */
if (dob_prev && dob_prev->ob != dob->ob) {
if (use_displist == true)
glDeleteLists(displist, 1);
-
+
use_displist = false;
}
-
+
if ((bb_tmp = BKE_object_boundbox_get(dob->ob))) {
bb = *bb_tmp; /* must make a copy */
testbb = true;
@@ -2178,12 +2178,12 @@ static void draw_dupli_objects_color(
if (!testbb || ED_view3d_boundbox_clip_ex(rv3d, &bb, dob->mat)) {
/* generate displist */
if (use_displist == false) {
-
+
/* note, since this was added, its checked (dob->type == OB_DUPLIGROUP)
* however this is very slow, it was probably needed for the NLA
* offset feature (used in group-duplicate.blend but no longer works in 2.5)
* so for now it should be ok to - campbell */
-
+
if ( /* if this is the last no need to make a displist */
(dob_next == NULL || dob_next->ob != dob->ob) ||
/* lamp drawing messes with matrices, could be handled smarter... but this works */
@@ -2199,28 +2199,28 @@ static void draw_dupli_objects_color(
}
else {
// printf("draw_dupli_objects_color: using displist for %s\n", dob->ob->id.name + 2);
-
+
/* disable boundbox check for list creation */
BKE_object_boundbox_flag(dob->ob, BOUNDBOX_DISABLED, 1);
/* need this for next part of code */
unit_m4(dob->ob->obmat); /* obmat gets restored */
-
+
displist = glGenLists(1);
glNewList(displist, GL_COMPILE);
draw_object(scene, ar, v3d, &tbase, dflag_dupli);
glEndList();
-
+
use_displist = true;
BKE_object_boundbox_flag(dob->ob, BOUNDBOX_DISABLED, 0);
- }
+ }
}
-
+
if (use_displist) {
glPushMatrix();
glMultMatrixf(dob->mat);
glCallList(displist);
glPopMatrix();
- }
+ }
else {
copy_m4_m4(dob->ob->obmat, dob->mat);
GPU_begin_dupli_object(dob);
@@ -2228,7 +2228,7 @@ static void draw_dupli_objects_color(
GPU_end_dupli_object();
}
}
-
+
tbase.object->dt = dt;
tbase.object->dtx = dtx;
tbase.object->transflag = transflag;
@@ -2241,7 +2241,7 @@ static void draw_dupli_objects_color(
}
free_object_duplilist(lb);
-
+
if (use_displist)
glDeleteLists(displist, 1);
}
@@ -2250,12 +2250,12 @@ static void draw_dupli_objects(Scene *scene, ARegion *ar, View3D *v3d, Base *bas
{
/* define the color here so draw_dupli_objects_color can be called
* from the set loop */
-
+
int color = (base->flag & SELECT) ? TH_SELECT : TH_WIRE;
/* debug */
if (base->object->dup_group && base->object->dup_group->id.us < 1)
color = TH_REDALERT;
-
+
draw_dupli_objects_color(scene, ar, v3d, base, 0, color);
}
@@ -2304,7 +2304,7 @@ void view3d_update_depths_rect(ARegion *ar, ViewDepths *d, rcti *rect)
MEM_freeN(d->depths);
d->depths = MEM_mallocN(sizeof(float) * d->w * d->h, "View depths Subset");
-
+
d->damaged = true;
}
@@ -2320,7 +2320,7 @@ void view3d_update_depths_rect(ARegion *ar, ViewDepths *d, rcti *rect)
void ED_view3d_depth_update(ARegion *ar)
{
RegionView3D *rv3d = ar->regiondata;
-
+
/* Create storage for, and, if necessary, copy depth buffer */
if (!rv3d->depths) rv3d->depths = MEM_callocN(sizeof(ViewDepths), "ViewDepths");
if (rv3d->depths) {
@@ -2336,11 +2336,11 @@ void ED_view3d_depth_update(ARegion *ar)
d->depths = MEM_mallocN(sizeof(float) * d->w * d->h, "View depths");
d->damaged = true;
}
-
+
if (d->damaged) {
view3d_opengl_read_pixels(ar, 0, 0, d->w, d->h, GL_DEPTH_COMPONENT, GL_FLOAT, d->depths);
glGetDoublev(GL_DEPTH_RANGE, d->depth_range);
-
+
d->damaged = false;
}
}
@@ -2386,7 +2386,7 @@ void ED_view3d_draw_depth_gpencil(Scene *scene, ARegion *ar, View3D *v3d)
if (v3d->flag2 & V3D_SHOW_GPENCIL) {
ED_gpencil_draw_view3d(NULL, scene, v3d, ar, true);
}
-
+
v3d->zbuf = zbuf;
}
@@ -2409,7 +2409,7 @@ static void view3d_draw_depth_loop(Scene *scene, ARegion *ar, View3D *v3d)
}
}
}
-
+
for (base = scene->base.first; base; base = base->next) {
if (v3d->lay & base->lay) {
/* dupli drawing */
@@ -2419,7 +2419,7 @@ static void view3d_draw_depth_loop(Scene *scene, ARegion *ar, View3D *v3d)
draw_object(scene, ar, v3d, base, dflag_depth);
}
}
-
+
/* this isn't that nice, draw xray objects as if they are normal */
if (v3d->afterdraw_transp.first ||
v3d->afterdraw_xray.first ||
@@ -2429,7 +2429,7 @@ static void view3d_draw_depth_loop(Scene *scene, ARegion *ar, View3D *v3d)
int mask_orig;
v3d->xray = true;
-
+
/* transp materials can change the depth mask, see #21388 */
glGetIntegerv(GL_DEPTH_WRITEMASK, &mask_orig);
@@ -2464,7 +2464,7 @@ static void view3d_draw_depth_loop(Scene *scene, ARegion *ar, View3D *v3d)
MEM_freeN(v3da);
}
-
+
v3d->xray = false;
v3d->transp = false;
@@ -2481,21 +2481,21 @@ void ED_view3d_draw_depth(Scene *scene, ARegion *ar, View3D *v3d, bool alphaover
float glalphaclip = U.glalphaclip;
int obcenter_dia = U.obcenter_dia;
/* temp set drawtype to solid */
-
+
/* Setting these temporarily is not nice */
v3d->flag &= ~V3D_SELECT_OUTLINE;
U.glalphaclip = alphaoverride ? 0.5f : glalphaclip; /* not that nice but means we wont zoom into billboards */
U.obcenter_dia = 0;
-
+
/* Tools may request depth outside of regular drawing code. */
UI_Theme_Store(&theme_state);
UI_SetTheme(SPACE_VIEW3D, RGN_TYPE_WINDOW);
/* Setup view matrix. */
ED_view3d_draw_setup_view(NULL, scene, ar, v3d, rv3d->viewmat, rv3d->winmat, NULL);
-
+
glClear(GL_DEPTH_BUFFER_BIT);
-
+
if (rv3d->rflag & RV3D_CLIPPING) {
ED_view3d_clipping_set(rv3d);
}
@@ -2511,7 +2511,7 @@ void ED_view3d_draw_depth(Scene *scene, ARegion *ar, View3D *v3d, bool alphaover
ED_view3d_clipping_disable();
}
rv3d->rflag &= ~RV3D_ZOFFSET_DISABLED;
-
+
v3d->zbuf = zbuf;
if (!v3d->zbuf) glDisable(GL_DEPTH_TEST);
@@ -2588,13 +2588,13 @@ static void gpu_render_lamp_update(Scene *scene, View3D *v3d,
Lamp *la = (Lamp *)ob->data;
View3DShadow *shadow;
unsigned int layers;
-
+
lamp = GPU_lamp_from_blender(scene, ob, par);
-
+
if (lamp) {
GPU_lamp_update(lamp, lay, (ob->restrictflag & OB_RESTRICT_RENDER), obmat);
GPU_lamp_update_colors(lamp, la->r, la->g, la->b, la->energy);
-
+
layers = lay & v3d->lay;
if (srl)
layers &= srl->lay;
@@ -2620,28 +2620,28 @@ static void gpu_update_lamps_shadows_world(Scene *scene, View3D *v3d)
Object *ob;
World *world = scene->world;
SceneRenderLayer *srl = v3d->scenelock ? BLI_findlink(&scene->r.layers, scene->r.actlay) : NULL;
-
+
BLI_listbase_clear(&shadows);
-
+
/* update lamp transform and gather shadow lamps */
for (SETLOOPER(scene, sce_iter, base)) {
ob = base->object;
-
+
if (ob->type == OB_LAMP)
gpu_render_lamp_update(scene, v3d, ob, NULL, ob->obmat, ob->lay, &shadows, srl);
-
+
if (ob->transflag & OB_DUPLI) {
DupliObject *dob;
ListBase *lb = object_duplilist(G.main->eval_ctx, scene, ob);
-
+
for (dob = lb->first; dob; dob = dob->next)
if (dob->ob->type == OB_LAMP)
gpu_render_lamp_update(scene, v3d, dob->ob, ob, dob->mat, ob->lay, &shadows, srl);
-
+
free_object_duplilist(lb);
}
}
-
+
/* render shadows after updating all lamps, nested object_duplilist
* don't work correct since it's replacing object matrices */
for (shadow = shadows.first; shadow; shadow = shadow->next) {
@@ -2650,15 +2650,15 @@ static void gpu_update_lamps_shadows_world(Scene *scene, View3D *v3d)
int drawtype, lay, winsize, flag2 = v3d->flag2;
ARegion ar = {NULL};
RegionView3D rv3d = {{{0}}};
-
+
drawtype = v3d->drawtype;
lay = v3d->lay;
-
+
v3d->drawtype = OB_SOLID;
v3d->lay &= GPU_lamp_shadow_layer(shadow->lamp);
v3d->flag2 &= ~(V3D_SOLID_TEX | V3D_SHOW_SOLID_MATCAP);
v3d->flag2 |= V3D_RENDER_OVERRIDE | V3D_RENDER_SHADOW;
-
+
GPU_lamp_shadow_buffer_bind(shadow->lamp, viewmat, &winsize, winmat);
ar.regiondata = &rv3d;
@@ -2676,12 +2676,12 @@ static void gpu_update_lamps_shadows_world(Scene *scene, View3D *v3d)
false, false, true,
NULL, NULL, NULL, NULL);
GPU_lamp_shadow_buffer_unbind(shadow->lamp);
-
+
v3d->drawtype = drawtype;
v3d->lay = lay;
v3d->flag2 = flag2;
}
-
+
BLI_freelistN(&shadows);
/* update world values */
@@ -2711,7 +2711,7 @@ CustomDataMask ED_view3d_datamask(const Scene *scene, const View3D *v3d)
mask |= CD_MASK_ORCO;
}
else {
- if ((scene->gm.matmode == GAME_MAT_GLSL && drawtype == OB_TEXTURE) ||
+ if ((scene->gm.matmode == GAME_MAT_GLSL && drawtype == OB_TEXTURE) ||
(drawtype == OB_MATERIAL))
{
mask |= CD_MASK_ORCO;
@@ -2728,7 +2728,7 @@ CustomDataMask ED_view3d_screen_datamask(const bScreen *screen)
const Scene *scene = screen->scene;
CustomDataMask mask = CD_MASK_BAREMESH;
const ScrArea *sa;
-
+
/* check if we need tfaces & mcols due to view mode */
for (sa = screen->areabase.first; sa; sa = sa->next) {
if (sa->spacetype == SPACE_VIEW3D) {
@@ -2770,7 +2770,7 @@ void ED_view3d_update_viewmat(
mul_m4_m4m4(rv3d->persmat, rv3d->winmat, rv3d->viewmat);
invert_m4_m4(rv3d->persinv, rv3d->persmat);
invert_m4_m4(rv3d->viewinv, rv3d->viewmat);
-
+
/* calculate GLSL view dependent values */
/* store window coordinates scaling/offset */
@@ -2779,7 +2779,7 @@ void ED_view3d_update_viewmat(
ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &cameraborder, false);
rv3d->viewcamtexcofac[0] = (float)ar->winx / BLI_rctf_size_x(&cameraborder);
rv3d->viewcamtexcofac[1] = (float)ar->winy / BLI_rctf_size_y(&cameraborder);
-
+
rv3d->viewcamtexcofac[2] = -rv3d->viewcamtexcofac[0] * cameraborder.xmin / (float)ar->winx;
rv3d->viewcamtexcofac[3] = -rv3d->viewcamtexcofac[1] * cameraborder.ymin / (float)ar->winy;
}
@@ -2971,7 +2971,7 @@ static void view3d_draw_objects(
/* must be before xray draw which clears the depth buffer */
if (v3d->flag2 & V3D_SHOW_GPENCIL) {
wmWindowManager *wm = (C != NULL) ? CTX_wm_manager(C) : NULL;
-
+
/* must be before xray draw which clears the depth buffer */
if (v3d->zbuf) glDisable(GL_DEPTH_TEST);
ED_gpencil_draw_view3d(wm, scene, v3d, ar, true);
@@ -3093,7 +3093,7 @@ static void view3d_main_region_clear(Scene *scene, View3D *v3d, ARegion *ar)
/* calculate full shader for background */
GPU_material_bind(gpumat, 1, 1, 1.0, false, rv3d->viewmat, rv3d->viewinv, rv3d->viewcamtexcofac, (v3d->scenelock != 0));
-
+
bool material_not_bound = !GPU_material_bound(gpumat);
if (material_not_bound) {
@@ -3124,7 +3124,7 @@ static void view3d_main_region_clear(Scene *scene, View3D *v3d, ARegion *ar)
}
GPU_material_unbind(gpumat);
-
+
glDepthFunc(GL_LEQUAL);
glDisable(GL_DEPTH_TEST);
}
@@ -3541,18 +3541,18 @@ void ED_scene_draw_fps(Scene *scene, const rcti *rect)
float fps;
char printable[16];
int i, tot;
-
+
if (!fpsi || !fpsi->lredrawtime || !fpsi->redrawtime)
return;
-
+
printable[0] = '\0';
-
+
#if 0
/* this is too simple, better do an average */
fps = (float)(1.0 / (fpsi->lredrawtime - fpsi->redrawtime))
#else
fpsi->redrawtimes_fps[fpsi->redrawtime_index] = (float)(1.0 / (fpsi->lredrawtime - fpsi->redrawtime));
-
+
for (i = 0, tot = 0, fps = 0.0f; i < REDRAW_FRAME_AVERAGE; i++) {
if (fpsi->redrawtimes_fps[i]) {
fps += fpsi->redrawtimes_fps[i];
@@ -3561,11 +3561,11 @@ void ED_scene_draw_fps(Scene *scene, const rcti *rect)
}
if (tot) {
fpsi->redrawtime_index = (fpsi->redrawtime_index + 1) % REDRAW_FRAME_AVERAGE;
-
+
//fpsi->redrawtime_index++;
//if (fpsi->redrawtime >= REDRAW_FRAME_AVERAGE)
// fpsi->redrawtime = 0;
-
+
fps = fps / tot;
}
#endif
@@ -3611,7 +3611,7 @@ bool ED_view3d_calc_render_border(
use_border = (scene->r.mode & R_BORDER) != 0;
else
use_border = (v3d->flag2 & V3D_RENDER_BORDER) != 0;
-
+
if (!use_border)
return false;
@@ -3711,7 +3711,7 @@ static void view3d_main_region_draw_engine_info(View3D *v3d, RegionView3D *rv3d,
if (!rv3d->render_engine || !rv3d->render_engine->text[0])
return;
-
+
if (render_border) {
/* draw darkened background color. no alpha because border render does
* partial redraw and will not redraw the region behind this info bar */
@@ -3861,10 +3861,10 @@ static void view3d_main_region_draw_objects(const bContext *C, Scene *scene, Vie
wmWindow *win = CTX_wm_window(C);
RegionView3D *rv3d = ar->regiondata;
unsigned int lay_used = v3d->lay_used;
-
+
/* post processing */
bool do_compositing = false;
-
+
/* shadow buffers, before we setup matrices */
if (draw_glsl_material(scene, NULL, v3d, v3d->drawtype))
gpu_update_lamps_shadows_world(scene, v3d);
@@ -3895,7 +3895,7 @@ static void view3d_main_region_draw_objects(const bContext *C, Scene *scene, Vie
fx_settings = v3d->fx_settings;
if (!rv3d->compositor)
rv3d->compositor = GPU_fx_compositor_create();
-
+
if (rv3d->persp == RV3D_CAMOB && v3d->camera)
BKE_camera_to_gpu_dof(v3d->camera, &fx_settings);
else {
@@ -3904,7 +3904,7 @@ static void view3d_main_region_draw_objects(const bContext *C, Scene *scene, Vie
do_compositing = GPU_fx_compositor_initialize_passes(rv3d->compositor, &ar->winrct, &ar->drawrct, &fx_settings);
}
-
+
/* clear the background */
view3d_main_region_clear(scene, v3d, ar);
@@ -3985,7 +3985,7 @@ static void view3d_main_region_draw_info(const bContext *C, Scene *scene,
wmWindowManager *wm = CTX_wm_manager(C);
RegionView3D *rv3d = ar->regiondata;
rcti rect;
-
+
/* local coordinate visible rect inside region, to accomodate overlapping ui */
ED_region_visible_rect(ar, &rect);
@@ -4070,20 +4070,20 @@ void view3d_main_region_draw(const bContext *C, ARegion *ar)
/* draw viewport using opengl */
if (v3d->drawtype != OB_RENDER || !view3d_main_region_do_render_draw(scene) || clip_border) {
view3d_main_region_draw_objects(C, scene, v3d, ar, &grid_unit);
-
+
#ifdef DEBUG_DRAW
bl_debug_draw();
#endif
if (G.debug & G_DEBUG_SIMDATA)
draw_sim_debug_data(scene, v3d, ar);
-
+
ED_region_pixelspace(ar);
}
/* draw viewport using external renderer */
if (v3d->drawtype == OB_RENDER)
view3d_main_region_draw_engine(C, scene, ar, v3d, clip_border, &border_rect);
-
+
view3d_main_region_draw_info(C, scene, ar, v3d, grid_unit, render_border);
v3d->flag |= V3D_INVALID_BACKBUF;
diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c
index aea6aa093af..65d66df4824 100644
--- a/source/blender/editors/space_view3d/view3d_fly.c
+++ b/source/blender/editors/space_view3d/view3d_fly.c
@@ -147,7 +147,7 @@ void fly_modal_keymap(wmKeyConfig *keyconf)
WM_modalkeymap_add_item(keymap, WHEELDOWNMOUSE, KM_PRESS, KM_ANY, 0, FLY_MODAL_DECELERATE);
WM_modalkeymap_add_item(keymap, MOUSEPAN, 0, 0, 0, FLY_MODAL_SPEED);
-
+
WM_modalkeymap_add_item(keymap, MIDDLEMOUSE, KM_PRESS, KM_ANY, 0, FLY_MODAL_PAN_ENABLE);
/* XXX - Bug in the event system, middle mouse release doesnt work */
WM_modalkeymap_add_item(keymap, MIDDLEMOUSE, KM_RELEASE, KM_ANY, 0, FLY_MODAL_PAN_DISABLE);
@@ -534,12 +534,12 @@ static void flyEvent(bContext *C, wmOperator *op, FlyInfo *fly, const wmEvent *e
case FLY_MODAL_CONFIRM:
fly->state = FLY_CONFIRM;
break;
-
+
/* speed adjusting with mousepan (trackpad) */
case FLY_MODAL_SPEED:
{
float fac = 0.02f * (event->prevy - event->y);
-
+
/* allowing to brake immediate */
if (fac > 0.0f && fly->speed < 0.0f)
fly->speed = 0.0f;
@@ -547,7 +547,7 @@ static void flyEvent(bContext *C, wmOperator *op, FlyInfo *fly, const wmEvent *e
fly->speed = 0.0f;
else
fly->speed += fly->grid * fac;
-
+
break;
}
case FLY_MODAL_ACCELERATE:
diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c
index de7ffd223f5..124bd33f227 100644
--- a/source/blender/editors/space_view3d/view3d_header.c
+++ b/source/blender/editors/space_view3d/view3d_header.c
@@ -75,7 +75,7 @@ static void handle_view3d_lock(bContext *C)
Scene *scene = CTX_data_scene(C);
ScrArea *sa = CTX_wm_area(C);
View3D *v3d = CTX_wm_view3d(C);
-
+
if (v3d != NULL && sa != NULL) {
if (v3d->localvd == NULL && v3d->scenelock && sa->spacetype == SPACE_VIEW3D) {
/* copy to scene */
@@ -86,7 +86,7 @@ static void handle_view3d_lock(bContext *C)
/* not through notifier, listener don't have context
* and non-open screens or spaces need to be updated too */
BKE_screen_view3d_main_sync(&bmain->screen, scene);
-
+
/* notifiers for scene update */
WM_event_add_notifier(C, NC_SCENE | ND_LAYER, scene);
}
@@ -121,7 +121,7 @@ static int view3d_layers_exec(bContext *C, wmOperator *op)
View3D *v3d = sa->spacedata.first;
int nr = RNA_int_get(op->ptr, "nr");
const bool toggle = RNA_boolean_get(op->ptr, "toggle");
-
+
if (nr < 0)
return OPERATOR_CANCELLED;
@@ -169,13 +169,13 @@ static int view3d_layers_exec(bContext *C, wmOperator *op)
}
}
}
-
+
if (v3d->scenelock) handle_view3d_lock(C);
-
+
DAG_on_visible_update(CTX_data_main(C), false);
ED_area_tag_redraw(sa);
-
+
return OPERATOR_FINISHED;
}
@@ -185,18 +185,18 @@ static int view3d_layers_invoke(bContext *C, wmOperator *op, const wmEvent *even
{
if (event->ctrl || event->oskey)
return OPERATOR_PASS_THROUGH;
-
+
if (event->shift)
RNA_boolean_set(op->ptr, "extend", true);
else
RNA_boolean_set(op->ptr, "extend", false);
-
+
if (event->alt) {
const int nr = RNA_int_get(op->ptr, "nr") + 10;
RNA_int_set(op->ptr, "nr", nr);
}
view3d_layers_exec(C, op);
-
+
return OPERATOR_FINISHED;
}
@@ -211,15 +211,15 @@ void VIEW3D_OT_layers(wmOperatorType *ot)
ot->name = "Layers";
ot->description = "Toggle layer(s) visibility";
ot->idname = "VIEW3D_OT_layers";
-
+
/* api callbacks */
ot->invoke = view3d_layers_invoke;
ot->exec = view3d_layers_exec;
ot->poll = view3d_layers_poll;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+
RNA_def_int(ot->srna, "nr", 1, 0, 20, "Number", "The layer number to set, zero for all layers", 0, 20);
RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Add this layer to the current view layers");
RNA_def_boolean(ot->srna, "toggle", 1, "Toggle", "Toggle the layer");
@@ -293,7 +293,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
uiLayout *row;
bool is_paint = false;
int modeselect;
-
+
RNA_pointer_create(&screen->id, &RNA_SpaceView3D, v3d, &v3dptr);
RNA_pointer_create(&scene->id, &RNA_ToolSettings, ts, &toolsptr);
RNA_pointer_create(&scene->id, &RNA_Scene, scene, &sceneptr);
@@ -303,7 +303,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
/* other buttons: */
UI_block_emboss_set(block, UI_EMBOSS);
-
+
/* mode */
if ((gpd) && (gpd->flag & GP_DATA_STROKE_EDITMODE)) {
modeselect = OB_MODE_GPENCIL;
@@ -379,6 +379,6 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
/* Scene lock */
uiItemR(layout, &v3dptr, "lock_camera_and_layers", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
}
-
+
uiTemplateEditModeSelection(layout, C);
}
diff --git a/source/blender/editors/space_view3d/view3d_ops.c b/source/blender/editors/space_view3d/view3d_ops.c
index 7240b15e51d..5734fba84b5 100644
--- a/source/blender/editors/space_view3d/view3d_ops.c
+++ b/source/blender/editors/space_view3d/view3d_ops.c
@@ -70,9 +70,9 @@ static int view3d_copybuffer_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
char str[FILE_MAX];
-
+
BKE_copybuffer_begin(bmain);
-
+
/* context, selection, could be generalized */
CTX_DATA_BEGIN (C, Object *, ob, selected_objects)
{
@@ -90,10 +90,10 @@ static int view3d_copybuffer_exec(bContext *C, wmOperator *op)
}
}
}
-
+
BLI_make_file_string("/", str, BKE_tempdir_base(), "copybuffer.blend");
BKE_copybuffer_save(bmain, str, op->reports);
-
+
BKE_report(op->reports, RPT_INFO, "Copied selected objects to buffer");
return OPERATOR_FINISHED;
@@ -101,12 +101,12 @@ static int view3d_copybuffer_exec(bContext *C, wmOperator *op)
static void VIEW3D_OT_copybuffer(wmOperatorType *ot)
{
-
+
/* identifiers */
ot->name = "Copy Selection to Buffer";
ot->idname = "VIEW3D_OT_copybuffer";
ot->description = "Selected objects are saved in a temp file";
-
+
/* api callbacks */
ot->exec = view3d_copybuffer_exec;
ot->poll = ED_operator_scene;
@@ -138,16 +138,16 @@ static int view3d_pastebuffer_exec(bContext *C, wmOperator *op)
static void VIEW3D_OT_pastebuffer(wmOperatorType *ot)
{
-
+
/* identifiers */
ot->name = "Paste Selection from Buffer";
ot->idname = "VIEW3D_OT_pastebuffer";
ot->description = "Contents of copy buffer gets pasted";
-
+
/* api callbacks */
ot->exec = view3d_pastebuffer_exec;
ot->poll = ED_operator_scene_editable;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -210,10 +210,10 @@ void view3d_operatortypes(void)
WM_operatortype_append(VIEW3D_OT_layers);
WM_operatortype_append(VIEW3D_OT_copybuffer);
WM_operatortype_append(VIEW3D_OT_pastebuffer);
-
+
WM_operatortype_append(VIEW3D_OT_properties);
WM_operatortype_append(VIEW3D_OT_toolshelf);
-
+
WM_operatortype_append(VIEW3D_OT_snap_selected_to_grid);
WM_operatortype_append(VIEW3D_OT_snap_selected_to_cursor);
WM_operatortype_append(VIEW3D_OT_snap_selected_to_active);
@@ -231,12 +231,12 @@ void view3d_keymap(wmKeyConfig *keyconf)
{
wmKeyMap *keymap;
wmKeyMapItem *kmi;
-
+
keymap = WM_keymap_find(keyconf, "3D View Generic", SPACE_VIEW3D, 0);
WM_keymap_add_item(keymap, "VIEW3D_OT_properties", NKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "VIEW3D_OT_toolshelf", TKEY, KM_PRESS, 0, 0);
-
+
/* only for region 3D window */
keymap = WM_keymap_find(keyconf, "3D View", SPACE_VIEW3D, 0);
@@ -258,7 +258,7 @@ void view3d_keymap(wmKeyConfig *keyconf)
RNA_boolean_set(kmi->ptr, "use_accurate", false);
WM_keymap_verify_item(keymap, "VIEW3D_OT_cursor3d", ACTIONMOUSE, KM_PRESS, 0, 0);
-
+
WM_keymap_verify_item(keymap, "VIEW3D_OT_rotate", MIDDLEMOUSE, KM_PRESS, 0, 0);
WM_keymap_verify_item(keymap, "VIEW3D_OT_move", MIDDLEMOUSE, KM_PRESS, KM_SHIFT, 0);
WM_keymap_verify_item(keymap, "VIEW3D_OT_zoom", MIDDLEMOUSE, KM_PRESS, KM_CTRL, 0);
@@ -274,20 +274,20 @@ void view3d_keymap(wmKeyConfig *keyconf)
WM_keymap_verify_item(keymap, "VIEW3D_OT_navigate", FKEY, KM_PRESS, KM_SHIFT, 0);
WM_keymap_verify_item(keymap, "VIEW3D_OT_smoothview", TIMER1, KM_ANY, KM_ANY, 0);
-
+
WM_keymap_add_item(keymap, "VIEW3D_OT_rotate", MOUSEPAN, 0, 0, 0);
WM_keymap_add_item(keymap, "VIEW3D_OT_rotate", MOUSEROTATE, 0, 0, 0);
WM_keymap_add_item(keymap, "VIEW3D_OT_move", MOUSEPAN, 0, KM_SHIFT, 0);
WM_keymap_add_item(keymap, "VIEW3D_OT_zoom", MOUSEZOOM, 0, 0, 0);
WM_keymap_add_item(keymap, "VIEW3D_OT_zoom", MOUSEPAN, 0, KM_CTRL, 0);
-
+
/*numpad +/-*/
RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_zoom", PADPLUSKEY, KM_PRESS, 0, 0)->ptr, "delta", 1);
RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_zoom", PADMINUS, KM_PRESS, 0, 0)->ptr, "delta", -1);
/*ctrl +/-*/
RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_zoom", EQUALKEY, KM_PRESS, KM_CTRL, 0)->ptr, "delta", 1);
RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_zoom", MINUSKEY, KM_PRESS, KM_CTRL, 0)->ptr, "delta", -1);
-
+
/*wheel mouse forward/back*/
RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_zoom", WHEELINMOUSE, KM_PRESS, 0, 0)->ptr, "delta", 1);
RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_zoom", WHEELOUTMOUSE, KM_PRESS, 0, 0)->ptr, "delta", -1);
@@ -323,7 +323,7 @@ void view3d_keymap(wmKeyConfig *keyconf)
RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD3, KM_PRESS, 0, 0)->ptr, "type", RV3D_VIEW_RIGHT);
RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_orbit", PAD4, KM_PRESS, 0, 0)->ptr, "type", V3D_VIEW_STEPLEFT);
WM_keymap_add_item(keymap, "VIEW3D_OT_view_persportho", PAD5, KM_PRESS, 0, 0);
-
+
RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_orbit", PAD6, KM_PRESS, 0, 0)->ptr, "type", V3D_VIEW_STEPRIGHT);
RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD7, KM_PRESS, 0, 0)->ptr, "type", RV3D_VIEW_TOP);
RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_orbit", PAD8, KM_PRESS, 0, 0)->ptr, "type", V3D_VIEW_STEPUP);
@@ -349,7 +349,7 @@ void view3d_keymap(wmKeyConfig *keyconf)
RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_orbit", WHEELDOWNMOUSE, KM_PRESS, KM_CTRL | KM_ALT, 0)->ptr, "type", V3D_VIEW_STEPRIGHT);
RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_orbit", WHEELUPMOUSE, KM_PRESS, KM_SHIFT | KM_ALT, 0)->ptr, "type", V3D_VIEW_STEPUP);
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);
-
+
RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_roll", WHEELUPMOUSE, KM_PRESS, KM_CTRL | KM_SHIFT, 0)->ptr, "type", V3D_VIEW_STEPLEFT);
RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_roll", WHEELDOWNMOUSE, KM_PRESS, KM_CTRL | KM_SHIFT, 0)->ptr, "type", V3D_VIEW_STEPRIGHT);
@@ -374,7 +374,7 @@ void view3d_keymap(wmKeyConfig *keyconf)
RNA_boolean_set(kmi->ptr, "align_active", true);
WM_keymap_add_item(keymap, "VIEW3D_OT_localview", PADSLASHKEY, KM_PRESS, 0, 0);
-
+
#ifdef WITH_INPUT_NDOF
/* note: positioned here so keymaps show keyboard keys if assigned */
/* 3D mouse */
@@ -393,7 +393,7 @@ void view3d_keymap(wmKeyConfig *keyconf)
RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", NDOF_BUTTON_RIGHT, KM_PRESS, 0, 0)->ptr, "type", RV3D_VIEW_RIGHT);
RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", NDOF_BUTTON_TOP, KM_PRESS, 0, 0)->ptr, "type", RV3D_VIEW_TOP);
RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", NDOF_BUTTON_BOTTOM, KM_PRESS, 0, 0)->ptr, "type", RV3D_VIEW_BOTTOM);
-
+
/* 3D mouse align */
kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", NDOF_BUTTON_FRONT, KM_PRESS, KM_SHIFT, 0);
RNA_enum_set(kmi->ptr, "type", RV3D_VIEW_FRONT);
@@ -418,7 +418,7 @@ void view3d_keymap(wmKeyConfig *keyconf)
RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_layers", EIGHTKEY, KM_PRESS, KM_ANY, 0)->ptr, "nr", 8);
RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_layers", NINEKEY, KM_PRESS, KM_ANY, 0)->ptr, "nr", 9);
RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_layers", ZEROKEY, KM_PRESS, KM_ANY, 0)->ptr, "nr", 10);
-
+
/* drawtype */
kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle_enum", ZKEY, KM_PRESS, 0, 0);
@@ -499,7 +499,7 @@ void view3d_keymap(wmKeyConfig *keyconf)
kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_select_lasso", EVT_TWEAK_A, KM_ANY, KM_SHIFT | KM_CTRL, 0);
RNA_boolean_set(kmi->ptr, "deselect", true);
WM_keymap_add_item(keymap, "VIEW3D_OT_select_circle", CKEY, KM_PRESS, 0, 0);
-
+
WM_keymap_add_item(keymap, "VIEW3D_OT_clip_border", BKEY, KM_PRESS, KM_ALT, 0);
WM_keymap_add_item(keymap, "VIEW3D_OT_zoom_border", BKEY, KM_PRESS, KM_SHIFT, 0);
@@ -509,19 +509,19 @@ void view3d_keymap(wmKeyConfig *keyconf)
RNA_boolean_set(kmi->ptr, "camera_only", false);
WM_keymap_add_item(keymap, "VIEW3D_OT_clear_render_border", BKEY, KM_PRESS, KM_CTRL | KM_ALT, 0);
-
+
WM_keymap_add_item(keymap, "VIEW3D_OT_camera_to_view", PAD0, KM_PRESS, KM_ALT | KM_CTRL, 0);
WM_keymap_add_item(keymap, "VIEW3D_OT_object_as_camera", PAD0, KM_PRESS, KM_CTRL, 0);
-
+
WM_keymap_add_menu(keymap, "VIEW3D_MT_snap", SKEY, KM_PRESS, KM_SHIFT, 0);
-
+
#ifdef __APPLE__
WM_keymap_add_item(keymap, "VIEW3D_OT_copybuffer", CKEY, KM_PRESS, KM_OSKEY, 0);
WM_keymap_add_item(keymap, "VIEW3D_OT_pastebuffer", VKEY, KM_PRESS, KM_OSKEY, 0);
#endif
WM_keymap_add_item(keymap, "VIEW3D_OT_copybuffer", CKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "VIEW3D_OT_pastebuffer", VKEY, KM_PRESS, KM_CTRL, 0);
-
+
/* context ops */
kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", COMMAKEY, KM_PRESS, 0, 0);
RNA_string_set(kmi->ptr, "data_path", "space_data.pivot_point");
diff --git a/source/blender/editors/space_view3d/view3d_project.c b/source/blender/editors/space_view3d/view3d_project.c
index e6688b56b2c..767df04c0b0 100644
--- a/source/blender/editors/space_view3d/view3d_project.c
+++ b/source/blender/editors/space_view3d/view3d_project.c
@@ -58,13 +58,13 @@
void ED_view3d_project_float_v2_m4(const ARegion *ar, const float co[3], float r_co[2], float mat[4][4])
{
float vec4[4];
-
+
copy_v3_v3(vec4, co);
vec4[3] = 1.0;
/* r_co[0] = IS_CLIPPED; */ /* always overwritten */
-
+
mul_m4_v4(mat, vec4);
-
+
if (vec4[3] > FLT_EPSILON) {
r_co[0] = (float)(ar->winx / 2.0f) + (ar->winx / 2.0f) * vec4[0] / vec4[3];
r_co[1] = (float)(ar->winy / 2.0f) + (ar->winy / 2.0f) * vec4[1] / vec4[3];
@@ -80,13 +80,13 @@ void ED_view3d_project_float_v2_m4(const ARegion *ar, const float co[3], float r
void ED_view3d_project_float_v3_m4(const ARegion *ar, const float vec[3], float r_co[3], float mat[4][4])
{
float vec4[4];
-
+
copy_v3_v3(vec4, vec);
vec4[3] = 1.0;
/* r_co[0] = IS_CLIPPED; */ /* always overwritten */
-
+
mul_m4_v4(mat, vec4);
-
+
if (vec4[3] > FLT_EPSILON) {
r_co[0] = (float)(ar->winx / 2.0f) + (ar->winx / 2.0f) * vec4[0] / vec4[3];
r_co[1] = (float)(ar->winy / 2.0f) + (ar->winy / 2.0f) * vec4[1] / vec4[3];
@@ -549,10 +549,10 @@ void ED_view3d_win_to_delta(const ARegion *ar, const float mval[2], float out[3]
{
RegionView3D *rv3d = ar->regiondata;
float dx, dy;
-
+
dx = 2.0f * mval[0] * zfac / ar->winx;
dy = 2.0f * mval[1] * zfac / ar->winy;
-
+
out[0] = (rv3d->persinv[0][0] * dx + rv3d->persinv[1][0] * dy);
out[1] = (rv3d->persinv[0][1] * dx + rv3d->persinv[1][1] * dy);
out[2] = (rv3d->persinv[0][2] * dx + rv3d->persinv[1][2] * dy);
diff --git a/source/blender/editors/space_view3d/view3d_ruler.c b/source/blender/editors/space_view3d/view3d_ruler.c
index f2c87953302..bcd4da94257 100644
--- a/source/blender/editors/space_view3d/view3d_ruler.c
+++ b/source/blender/editors/space_view3d/view3d_ruler.c
@@ -323,7 +323,7 @@ static bool view3d_ruler_to_gpencil(bContext *C, RulerInfo *ruler_info)
if (palcolor == NULL) {
palcolor = BKE_gpencil_palettecolor_addnew(palette, (char *)ruler_name, true);
}
-
+
gpf = BKE_gpencil_layer_getframe(gpl, CFRA, true);
BKE_gpencil_free_strokes(gpf);
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c
index 02a26dca6d2..06481231259 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -303,25 +303,25 @@ static bool edge_fully_inside_rect(const rctf *rect, const float v1[2], const fl
static bool edge_inside_rect(const rctf *rect, const float v1[2], const float v2[2])
{
int d1, d2, d3, d4;
-
+
/* check points in rect */
if (edge_fully_inside_rect(rect, v1, v2)) return 1;
-
+
/* check points completely out rect */
if (v1[0] < rect->xmin && v2[0] < rect->xmin) return 0;
if (v1[0] > rect->xmax && v2[0] > rect->xmax) return 0;
if (v1[1] < rect->ymin && v2[1] < rect->ymin) return 0;
if (v1[1] > rect->ymax && v2[1] > rect->ymax) return 0;
-
+
/* simple check lines intersecting. */
d1 = (v1[1] - v2[1]) * (v1[0] - rect->xmin) + (v2[0] - v1[0]) * (v1[1] - rect->ymin);
d2 = (v1[1] - v2[1]) * (v1[0] - rect->xmin) + (v2[0] - v1[0]) * (v1[1] - rect->ymax);
d3 = (v1[1] - v2[1]) * (v1[0] - rect->xmax) + (v2[0] - v1[0]) * (v1[1] - rect->ymax);
d4 = (v1[1] - v2[1]) * (v1[0] - rect->xmax) + (v2[0] - v1[0]) * (v1[1] - rect->ymin);
-
+
if (d1 < 0 && d2 < 0 && d3 < 0 && d4 < 0) return 0;
if (d1 > 0 && d2 > 0 && d3 > 0 && d4 > 0) return 0;
-
+
return 1;
}
@@ -377,7 +377,7 @@ static void do_lasso_select_pose(ViewContext *vc, Object *ob, const int mcords[]
ViewContext vc_tmp;
LassoSelectUserData data;
rcti rect;
-
+
if ((ob->type != OB_ARMATURE) || (ob->pose == NULL)) {
return;
}
@@ -418,7 +418,7 @@ static void do_lasso_select_objects(
const bool extend, const bool select)
{
Base *base;
-
+
if (extend == false && select)
object_deselect_all_visible(vc->scene, vc->v3d);
@@ -492,7 +492,7 @@ static void do_lasso_select_mesh(ViewContext *vc, const int mcords[][2], short m
ToolSettings *ts = vc->scene->toolsettings;
rcti rect;
int bbsel;
-
+
/* set editmesh */
vc->em = BKE_editmesh_from_object(vc->obedit);
@@ -508,7 +508,7 @@ static void do_lasso_select_mesh(ViewContext *vc, const int mcords[][2], short m
glLoadMatrixf(vc->rv3d->viewmat);
bbsel = EDBM_backbuf_border_mask_init(vc, mcords, moves, rect.xmin, rect.ymin, rect.xmax, rect.ymax);
-
+
if (ts->selectmode & SCE_SELECT_VERTEX) {
if (bbsel) {
edbm_backbuf_check_and_select_verts(vc->em, select);
@@ -527,7 +527,7 @@ static void do_lasso_select_mesh(ViewContext *vc, const int mcords[][2], short m
mesh_foreachScreenEdge(vc, do_lasso_select_mesh__doSelectEdge, &data, V3D_PROJ_TEST_CLIP_NEAR);
}
}
-
+
if (ts->selectmode & SCE_SELECT_FACE) {
if (bbsel) {
edbm_backbuf_check_and_select_faces(vc->em, select);
@@ -536,7 +536,7 @@ static void do_lasso_select_mesh(ViewContext *vc, const int mcords[][2], short m
mesh_foreachScreenFace(vc, do_lasso_select_mesh__doSelectFace, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
}
}
-
+
EDBM_backbuf_free();
EDBM_selectmode_flush(vc->em);
}
@@ -791,7 +791,7 @@ static void do_lasso_select_paintface(ViewContext *vc, const int mcords[][2], sh
BLI_lasso_boundbox(&rect, mcords, moves);
EDBM_backbuf_border_mask_init(vc, mcords, moves, rect.xmin, rect.ymin, rect.xmax, rect.ymax);
-
+
edbm_backbuf_check_and_select_tfaces(me, select);
EDBM_backbuf_free();
@@ -803,19 +803,19 @@ static void do_lasso_select_paintface(ViewContext *vc, const int mcords[][2], sh
static void do_lasso_select_node(int mcords[][2], short moves, const bool select)
{
SpaceNode *snode = sa->spacedata.first;
-
+
bNode *node;
rcti rect;
int node_cent[2];
float node_centf[2];
-
+
BLI_lasso_boundbox(&rect, mcords, moves);
-
+
/* store selection in temp test flag */
for (node = snode->edittree->nodes.first; node; node = node->next) {
node_centf[0] = BLI_RCT_CENTER_X(&node->totr);
node_centf[1] = BLI_RCT_CENTER_Y(&node->totr);
-
+
ipoco_to_areaco_noclip(G.v2d, node_centf, node_cent);
if (BLI_rcti_isect_pt_v(&rect, node_cent) && BLI_lasso_is_point_inside(mcords, moves, node_cent[0], node_cent[1])) {
if (select) {
@@ -887,18 +887,18 @@ static int view3d_lasso_select_exec(bContext *C, wmOperator *op)
ViewContext vc;
int mcords_tot;
const int (*mcords)[2] = WM_gesture_lasso_path_to_array(C, op, &mcords_tot);
-
+
if (mcords) {
bool extend, select;
view3d_operator_needs_opengl(C);
-
+
/* setup view context for argument to callbacks */
ED_view3d_viewcontext_init(C, &vc);
-
+
extend = RNA_boolean_get(op->ptr, "extend");
select = !RNA_boolean_get(op->ptr, "deselect");
view3d_lasso_select(C, &vc, mcords, mcords_tot, extend, select);
-
+
MEM_freeN((void *)mcords);
return OPERATOR_FINISHED;
@@ -911,16 +911,16 @@ void VIEW3D_OT_select_lasso(wmOperatorType *ot)
ot->name = "Lasso Select";
ot->description = "Select items using lasso selection";
ot->idname = "VIEW3D_OT_select_lasso";
-
+
ot->invoke = WM_gesture_lasso_invoke;
ot->modal = WM_gesture_lasso_modal;
ot->exec = view3d_lasso_select_exec;
ot->poll = view3d_selectable_data;
ot->cancel = WM_gesture_lasso_cancel;
-
+
/* flags */
ot->flag = OPTYPE_UNDO;
-
+
/* properties */
WM_operator_properties_gesture_lasso_select(ot);
}
@@ -1033,7 +1033,7 @@ void VIEW3D_OT_select_menu(wmOperatorType *ot)
static void deselectall_except(Scene *scene, Base *b) /* deselect all except b */
{
Base *base;
-
+
for (base = FIRSTBASE; base; base = base->next) {
if (base->flag & SELECT) {
if (b != base) {
@@ -1050,7 +1050,7 @@ static Base *object_mouse_select_menu(
short baseCount = 0;
bool ok;
LinkNode *linklist = NULL;
-
+
CTX_DATA_BEGIN (C, Base *, base, selectable_bases)
{
ok = false;
@@ -1253,12 +1253,12 @@ static Base *mouse_select_eval_buffer(
View3D *v3d = vc->v3d;
Base *base, *basact = NULL;
int a;
-
+
if (do_nearest) {
unsigned int min = 0xFFFFFFFF;
int selcol = 0, notcol = 0;
-
-
+
+
if (has_bones) {
/* we skip non-bone hits */
for (a = 0; a < hits; a++) {
@@ -1271,7 +1271,7 @@ static Base *mouse_select_eval_buffer(
else {
/* only exclude active object when it is selected... */
if (BASACT && (BASACT->flag & SELECT) && hits > 1) notcol = BASACT->selcol;
-
+
for (a = 0; a < hits; a++) {
if (min > buffer[4 * a + 1] && notcol != (buffer[4 * a + 3] & 0xFFFF)) {
min = buffer[4 * a + 1];
@@ -1279,7 +1279,7 @@ static Base *mouse_select_eval_buffer(
}
}
}
-
+
base = FIRSTBASE;
while (base) {
if (BASE_SELECTABLE(v3d, base)) {
@@ -1290,7 +1290,7 @@ static Base *mouse_select_eval_buffer(
if (base) basact = base;
}
else {
-
+
base = startbase;
while (base) {
/* skip objects with select restriction, to prevent prematurely ending this loop
@@ -1300,7 +1300,7 @@ static Base *mouse_select_eval_buffer(
if (base == NULL) base = FIRSTBASE;
if (base == startbase) break;
}
-
+
if (BASE_SELECTABLE(v3d, base)) {
for (a = 0; a < hits; a++) {
if (has_bones) {
@@ -1316,15 +1316,15 @@ static Base *mouse_select_eval_buffer(
}
}
}
-
+
if (basact) break;
-
+
base = base->next;
if (base == NULL) base = FIRSTBASE;
if (base == startbase) break;
}
}
-
+
return basact;
}
@@ -1336,18 +1336,18 @@ Base *ED_view3d_give_base_under_cursor(bContext *C, const int mval[2])
unsigned int buffer[MAXPICKBUF];
int hits;
bool do_nearest;
-
+
/* setup view context for argument to callbacks */
view3d_operator_needs_opengl(C);
ED_view3d_viewcontext_init(C, &vc);
-
+
hits = mixed_bones_object_selectbuffer(&vc, buffer, mval, false, false, &do_nearest);
-
+
if (hits > 0) {
const bool has_bones = selectbuffer_has_bones(buffer, hits);
basact = mouse_select_eval_buffer(&vc, buffer, hits, vc.scene->base.first, has_bones, do_nearest);
}
-
+
return basact;
}
@@ -1386,7 +1386,7 @@ static bool ed_object_select_pick(
int hits;
const float mval_fl[2] = {(float)mval[0], (float)mval[1]};
-
+
/* setup view context for argument to callbacks */
ED_view3d_viewcontext_init(C, &vc);
@@ -1395,15 +1395,15 @@ static bool ed_object_select_pick(
/* signal for view3d_opengl_select to skip editmode objects */
vc.obedit = NULL;
}
-
+
/* always start list from basact in wire mode */
startbase = FIRSTBASE;
if (BASACT && BASACT->next) startbase = BASACT->next;
-
+
/* This block uses the control key to make the object selected by its center point rather than its contents */
/* in editmode do not activate */
if (obcenter) {
-
+
/* note; shift+alt goes to group-flush-selecting */
if (enumerate) {
basact = object_mouse_select_menu(C, &vc, NULL, 0, mval, toggle);
@@ -1426,7 +1426,7 @@ static bool ed_object_select_pick(
}
}
base = base->next;
-
+
if (base == NULL) base = FIRSTBASE;
if (base == startbase) break;
}
@@ -1454,7 +1454,7 @@ static bool ed_object_select_pick(
else {
basact = mouse_select_eval_buffer(&vc, buffer, hits, startbase, has_bones, do_nearest);
}
-
+
if (has_bones && basact) {
if (basact->object->type == OB_CAMERA) {
if (BASACT == basact) {
@@ -1518,16 +1518,16 @@ static bool ed_object_select_pick(
scene, basact, buffer, hits, extend, deselect, toggle, do_nearest))
{
/* then bone is found */
-
- /* we make the armature selected:
+
+ /* we make the armature selected:
* not-selected active object in posemode won't work well for tools */
basact->flag |= SELECT;
basact->object->flag = basact->flag;
-
+
retval = true;
WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, basact->object);
WM_event_add_notifier(C, NC_OBJECT | ND_BONE_ACTIVE, basact->object);
-
+
/* in weightpaint, we use selected bone to select vertexgroup, so no switch to new active object */
if (BASACT && (BASACT->object->mode & OB_MODE_WEIGHT_PAINT)) {
/* prevent activating */
@@ -1541,11 +1541,11 @@ static bool ed_object_select_pick(
}
}
}
-
+
/* so, do we have something selected? */
if (basact) {
retval = true;
-
+
if (vc.obedit) {
/* only do select */
deselectall_except(scene, basact);
@@ -1555,7 +1555,7 @@ static bool ed_object_select_pick(
else if (BASE_SELECTABLE(v3d, basact)) {
oldbasact = BASACT;
-
+
if (extend) {
ED_base_object_select(basact, BA_SELECT);
}
@@ -1751,7 +1751,7 @@ static void do_nurbs_box_select__doSelect(
static int do_nurbs_box_select(ViewContext *vc, rcti *rect, bool select, bool extend)
{
BoxSelectUserData data;
-
+
view3d_userdata_boxselect_init(&data, vc, rect, select);
if (extend == false && select) {
@@ -1785,7 +1785,7 @@ static int do_lattice_box_select(ViewContext *vc, rcti *rect, bool select, bool
ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); /* for foreach's screen/vert projection */
lattice_foreachScreenVert(vc, do_lattice_box_select__doSelect, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
-
+
return OPERATOR_FINISHED;
}
@@ -1829,7 +1829,7 @@ static int do_mesh_box_select(ViewContext *vc, rcti *rect, bool select, bool ext
BoxSelectUserData data;
ToolSettings *ts = vc->scene->toolsettings;
int bbsel;
-
+
view3d_userdata_boxselect_init(&data, vc, rect, select);
if (extend == false && select)
@@ -1860,7 +1860,7 @@ static int do_mesh_box_select(ViewContext *vc, rcti *rect, bool select, bool ext
mesh_foreachScreenEdge(vc, do_mesh_box_select__doSelectEdge, &data, V3D_PROJ_TEST_CLIP_NEAR);
}
}
-
+
if (ts->selectmode & SCE_SELECT_FACE) {
if (bbsel) {
edbm_backbuf_check_and_select_faces(vc->em, select);
@@ -1869,11 +1869,11 @@ static int do_mesh_box_select(ViewContext *vc, rcti *rect, bool select, bool ext
mesh_foreachScreenFace(vc, do_mesh_box_select__doSelectFace, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
}
}
-
+
EDBM_backbuf_free();
-
+
EDBM_selectmode_flush(vc->em);
-
+
return OPERATOR_FINISHED;
}
@@ -1890,7 +1890,7 @@ static int do_meta_box_select(ViewContext *vc, rcti *rect, bool select, bool ext
if (extend == false && select)
BKE_mball_deselect_all(mb);
-
+
for (ml = mb->editelems->first; ml; ml = ml->next) {
for (a = 0; a < hits; a++) {
if (ml->selcol1 == buffer[(4 * a) + 3]) {
@@ -1920,11 +1920,11 @@ static int do_armature_box_select(ViewContext *vc, rcti *rect, bool select, bool
int hits;
hits = view3d_opengl_select(vc, buffer, MAXPICKBUF, rect, VIEW3D_SELECT_ALL);
-
+
/* clear flag we use to detect point was affected */
for (EditBone *ebone = arm->edbo->first; ebone; ebone = ebone->next)
ebone->flag &= ~BONE_DONE;
-
+
if (extend == false && select)
ED_armature_edit_deselect_all_visible(vc->obedit);
@@ -1980,9 +1980,9 @@ static int do_armature_box_select(ViewContext *vc, rcti *rect, bool select, bool
}
}
}
-
+
ED_armature_edit_sync_selection(arm->edbo);
-
+
return hits > 0 ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
}
@@ -1996,12 +1996,12 @@ static int do_object_pose_box_select(bContext *C, ViewContext *vc, rcti *rect, b
int bone_selected = 0;
int totobj = MAXPICKBUF; /* XXX solve later */
int hits;
-
+
if ((ob) && (ob->mode & OB_MODE_POSE))
bone_only = 1;
else
bone_only = 0;
-
+
if (extend == false && select) {
if (bone_only) {
CTX_DATA_BEGIN (C, bPoseChannel *, pchan, visible_pose_bones)
@@ -2027,7 +2027,7 @@ static int do_object_pose_box_select(bContext *C, ViewContext *vc, rcti *rect, b
* is the same as the object, we have a hit and can move to the next color
* and object pair, if not, just move to the next object,
* keeping the same color until we have a hit.
- *
+ *
* The buffer order is defined by OGL standard, hopefully no stupid GFX card
* does it incorrectly.
*/
@@ -2035,7 +2035,7 @@ static int do_object_pose_box_select(bContext *C, ViewContext *vc, rcti *rect, b
if (hits > 0) { /* no need to loop if there's no hit */
Base *base;
col = vbuffer + 3;
-
+
for (base = vc->scene->base.first; base && hits; base = base->next) {
if (BASE_SELECTABLE(vc->v3d, base)) {
while (base->selcol == (*col & 0xFFFF)) { /* we got an object */
@@ -2059,19 +2059,19 @@ static int do_object_pose_box_select(bContext *C, ViewContext *vc, rcti *rect, b
else if (!bone_only) {
ED_base_object_select(base, select ? BA_SELECT : BA_DESELECT);
}
-
+
col += 4; /* next color */
hits--;
if (hits == 0) break;
}
}
-
+
if (bone_selected) {
if (base->object && (base->object->type == OB_ARMATURE)) {
bArmature *arm = base->object->data;
-
+
WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, base->object);
-
+
if (arm && (arm->flag & ARM_HAS_VIZ_DEPS)) {
/* mask modifier ('armature' mode), etc. */
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
@@ -2079,7 +2079,7 @@ static int do_object_pose_box_select(bContext *C, ViewContext *vc, rcti *rect, b
}
}
}
-
+
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, vc->scene);
}
MEM_freeN(vbuffer);
@@ -2100,7 +2100,7 @@ static int view3d_borderselect_exec(bContext *C, wmOperator *op)
/* setup view context for argument to callbacks */
ED_view3d_viewcontext_init(C, &vc);
-
+
select = !RNA_boolean_get(op->ptr, "deselect");
extend = RNA_boolean_get(op->ptr, "extend");
WM_operator_properties_border_to_rcti(op, &rect);
@@ -2164,7 +2164,7 @@ static int view3d_borderselect_exec(bContext *C, wmOperator *op)
}
return ret;
-}
+}
/* *****************Selection Operators******************* */
@@ -2176,17 +2176,17 @@ void VIEW3D_OT_select_border(wmOperatorType *ot)
ot->name = "Border Select";
ot->description = "Select items using border selection";
ot->idname = "VIEW3D_OT_select_border";
-
+
/* api callbacks */
ot->invoke = WM_gesture_border_invoke;
ot->exec = view3d_borderselect_exec;
ot->modal = WM_gesture_border_modal;
ot->poll = view3d_selectable_data;
ot->cancel = WM_gesture_border_cancel;
-
+
/* flags */
ot->flag = OPTYPE_UNDO;
-
+
/* rna */
WM_operator_properties_gesture_border_select(ot);
}
@@ -2286,7 +2286,7 @@ static int view3d_select_exec(bContext *C, wmOperator *op)
retval = ED_mball_select_pick(C, location, extend, deselect, toggle);
else if (obedit->type == OB_FONT)
retval = ED_curve_editfont_select_pick(C, location, extend, deselect, toggle);
-
+
}
else if (obact && obact->mode & OB_MODE_PARTICLE_EDIT)
return PE_mouse_particles(C, location, extend, deselect, toggle);
@@ -2321,15 +2321,15 @@ void VIEW3D_OT_select(wmOperatorType *ot)
ot->name = "Activate/Select";
ot->description = "Activate/select item(s)";
ot->idname = "VIEW3D_OT_select";
-
+
/* api callbacks */
ot->invoke = view3d_select_invoke;
ot->exec = view3d_select_exec;
ot->poll = ED_operator_view3d_active;
-
+
/* flags */
ot->flag = OPTYPE_UNDO;
-
+
/* properties */
WM_operator_properties_mouse_select(ot);
@@ -2404,7 +2404,7 @@ static void mesh_circle_select(ViewContext *vc, const bool select, const int mva
ToolSettings *ts = vc->scene->toolsettings;
int bbsel;
CircleSelectUserData data;
-
+
bbsel = EDBM_backbuf_circle_init(vc, mval[0], mval[1], (short)(rad + 1.0f));
ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); /* for foreach's screen/vert projection */
@@ -2429,7 +2429,7 @@ static void mesh_circle_select(ViewContext *vc, const bool select, const int mva
mesh_foreachScreenEdge(vc, mesh_circle_doSelectEdge, &data, V3D_PROJ_TEST_CLIP_NEAR);
}
}
-
+
if (ts->selectmode & SCE_SELECT_FACE) {
if (bbsel) {
edbm_backbuf_check_and_select_faces(vc->em, select);
@@ -2623,11 +2623,11 @@ static void do_circle_select_pose__doSelectBone(
static void pose_circle_select(ViewContext *vc, const bool select, const int mval[2], float rad)
{
CircleSelectUserData data;
-
+
view3d_userdata_circleselect_init(&data, vc, select, mval, rad);
ED_view3d_init_mats_rv3d(vc->obact, vc->rv3d); /* for foreach's screen/vert projection */
-
+
pose_foreachScreenBone(vc, do_circle_select_pose__doSelectBone, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
if (data.is_changed) {
@@ -2650,13 +2650,13 @@ static bool armature_circle_doSelectJoint(void *userData, EditBone *ebone, const
if (head) {
if (data->select)
ebone->flag |= BONE_ROOTSEL;
- else
+ else
ebone->flag &= ~BONE_ROOTSEL;
}
else {
if (data->select)
ebone->flag |= BONE_TIPSEL;
- else
+ else
ebone->flag &= ~BONE_TIPSEL;
}
return 1;
@@ -2853,13 +2853,13 @@ void VIEW3D_OT_select_circle(wmOperatorType *ot)
ot->name = "Circle Select";
ot->description = "Select items using circle selection";
ot->idname = "VIEW3D_OT_select_circle";
-
+
ot->invoke = WM_gesture_circle_invoke;
ot->modal = WM_gesture_circle_modal;
ot->exec = view3d_circle_select_exec;
ot->poll = view3d_selectable_data;
ot->cancel = WM_gesture_circle_cancel;
-
+
/* flags */
ot->flag = OPTYPE_UNDO;
diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c
index 5dd69cc66eb..80586217691 100644
--- a/source/blender/editors/space_view3d/view3d_snap.c
+++ b/source/blender/editors/space_view3d/view3d_snap.c
@@ -86,7 +86,7 @@ static int snap_sel_to_grid_exec(bContext *C, wmOperator *UNUSED(op))
copy_m3_m4(bmat, obedit->obmat);
invert_m3_m3(imat, bmat);
-
+
tv = tvs.transverts;
for (a = 0; a < tvs.transverts_tot; a++, tv++) {
copy_v3_v3(vec, tv->loc);
@@ -96,11 +96,11 @@ static int snap_sel_to_grid_exec(bContext *C, wmOperator *UNUSED(op))
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);
copy_v3_v3(tv->loc, vec);
}
-
+
ED_transverts_update_obedit(&tvs, obedit);
ED_transverts_free(&tvs);
}
@@ -112,15 +112,15 @@ static int snap_sel_to_grid_exec(bContext *C, wmOperator *UNUSED(op))
if (ob->mode & OB_MODE_POSE) {
bPoseChannel *pchan;
bArmature *arm = ob->data;
-
+
invert_m4_m4(ob->imat, ob->obmat);
-
+
for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
if (pchan->bone->flag & BONE_SELECTED) {
if (pchan->bone->layer & arm->layer) {
if ((pchan->bone->flag & BONE_CONNECTED) == 0) {
float nLoc[3];
-
+
/* get nearest grid point to snap to */
copy_v3_v3(nLoc, pchan->pose_mat[3]);
/* We must operate in world space! */
@@ -130,10 +130,10 @@ static int snap_sel_to_grid_exec(bContext *C, wmOperator *UNUSED(op))
vec[2] = gridf * floorf(0.5f + nLoc[2] / gridf);
/* Back in object space... */
mul_m4_v3(ob->imat, vec);
-
+
/* Get location of grid point in pose space. */
BKE_armature_loc_pose_to_bone(pchan, vec, vec);
-
+
/* adjust location */
if ((pchan->protectflag & OB_LOCK_LOCX) == 0)
pchan->loc[0] = vec[0];
@@ -152,18 +152,18 @@ static int snap_sel_to_grid_exec(bContext *C, wmOperator *UNUSED(op))
}
}
ob->pose->flag |= (POSE_LOCKED | POSE_DO_UNLOCK);
-
+
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
}
else {
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) {
float originmat[3][3];
BKE_object_where_is_calc_ex(scene, NULL, ob, originmat);
-
+
invert_m3_m3(imat, originmat);
mul_m3_v3(imat, vec);
}
@@ -173,7 +173,7 @@ static int snap_sel_to_grid_exec(bContext *C, wmOperator *UNUSED(op))
ob->loc[1] += vec[1];
if ((ob->protectflag & OB_LOCK_LOCZ) == 0)
ob->loc[2] += vec[2];
-
+
/* auto-keyframing */
ED_autokeyframe_object(C, scene, ob, ks);
@@ -184,7 +184,7 @@ static int snap_sel_to_grid_exec(bContext *C, wmOperator *UNUSED(op))
}
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
-
+
return OPERATOR_FINISHED;
}
@@ -194,11 +194,11 @@ void VIEW3D_OT_snap_selected_to_grid(wmOperatorType *ot)
ot->name = "Snap Selection to Grid";
ot->description = "Snap selected item(s) to nearest grid division";
ot->idname = "VIEW3D_OT_snap_selected_to_grid";
-
+
/* api callbacks */
ot->exec = snap_sel_to_grid_exec;
ot->poll = ED_operator_region_view3d_active;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
@@ -232,7 +232,7 @@ static int snap_selected_to_location(bContext *C, const float snap_target_global
if (obedit) {
float snap_target_local[3];
-
+
if (ED_transverts_check_obedit(obedit))
ED_transverts_create_from_obedit(&tvs, obedit, 0);
if (tvs.transverts_tot == 0)
@@ -240,7 +240,7 @@ static int snap_selected_to_location(bContext *C, const float snap_target_global
copy_m3_m4(bmat, obedit->obmat);
invert_m3_m3(imat, bmat);
-
+
/* get the cursor in object space */
sub_v3_v3v3(snap_target_local, snap_target_global, obedit->obmat[3]);
mul_m3_v3(imat, snap_target_local);
@@ -261,7 +261,7 @@ static int snap_selected_to_location(bContext *C, const float snap_target_global
copy_v3_v3(tv->loc, snap_target_local);
}
}
-
+
ED_transverts_update_obedit(&tvs, obedit);
ED_transverts_free(&tvs);
}
@@ -393,7 +393,7 @@ static int snap_selected_to_location(bContext *C, const float snap_target_global
}
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
-
+
return OPERATOR_FINISHED;
}
@@ -415,11 +415,11 @@ void VIEW3D_OT_snap_selected_to_cursor(wmOperatorType *ot)
ot->name = "Snap Selection to Cursor";
ot->description = "Snap selected item(s) to cursor";
ot->idname = "VIEW3D_OT_snap_selected_to_cursor";
-
+
/* api callbacks */
ot->exec = snap_selected_to_cursor_exec;
ot->poll = ED_operator_view3d_active;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -470,7 +470,7 @@ static int snap_curs_to_grid_exec(bContext *C, wmOperator *UNUSED(op))
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 */
return OPERATOR_FINISHED;
@@ -482,11 +482,11 @@ void VIEW3D_OT_snap_cursor_to_grid(wmOperatorType *ot)
ot->name = "Snap Cursor to Grid";
ot->description = "Snap cursor to nearest grid division";
ot->idname = "VIEW3D_OT_snap_cursor_to_grid";
-
+
/* api callbacks */
ot->exec = snap_curs_to_grid_exec;
ot->poll = ED_operator_region_view3d_active;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
@@ -569,7 +569,7 @@ static bool snap_curs_to_sel_ex(bContext *C, float cursor[3])
}
copy_m3_m4(bmat, obedit->obmat);
-
+
tv = tvs.transverts;
for (a = 0; a < tvs.transverts_tot; a++, tv++) {
copy_v3_v3(vec, tv->loc);
@@ -578,7 +578,7 @@ static bool snap_curs_to_sel_ex(bContext *C, float cursor[3])
add_v3_v3(centroid, vec);
minmax_v3v3_v3(min, max, vec);
}
-
+
if (v3d->around == V3D_AROUND_CENTER_MEAN) {
mul_v3_fl(centroid, 1.0f / (float)tvs.transverts_tot);
copy_v3_v3(cursor, centroid);
@@ -591,7 +591,7 @@ static bool snap_curs_to_sel_ex(bContext *C, float cursor[3])
}
else {
Object *obact = CTX_data_active_object(C);
-
+
if (obact && (obact->mode & OB_MODE_POSE)) {
bArmature *arm = obact->data;
bPoseChannel *pchan;
@@ -666,11 +666,11 @@ void VIEW3D_OT_snap_cursor_to_selected(wmOperatorType *ot)
ot->name = "Snap Cursor to Selected";
ot->description = "Snap cursor to center of selected item(s)";
ot->idname = "VIEW3D_OT_snap_cursor_to_selected";
-
+
/* api callbacks */
ot->exec = snap_curs_to_sel_exec;
ot->poll = ED_operator_view3d_active;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
@@ -721,7 +721,7 @@ static int snap_curs_to_active_exec(bContext *C, wmOperator *UNUSED(op))
Scene *scene = CTX_data_scene(C);
View3D *v3d = CTX_wm_view3d(C);
float *curs;
-
+
curs = ED_view3d_cursor3d_get(scene, v3d);
if (snap_calc_active_center(C, false, curs)) {
@@ -739,11 +739,11 @@ void VIEW3D_OT_snap_cursor_to_active(wmOperatorType *ot)
ot->name = "Snap Cursor to Active";
ot->description = "Snap cursor to active item";
ot->idname = "VIEW3D_OT_snap_cursor_to_active";
-
+
/* api callbacks */
ot->exec = snap_curs_to_active_exec;
ot->poll = ED_operator_view3d_active;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
@@ -758,9 +758,9 @@ static int snap_curs_to_center_exec(bContext *C, wmOperator *UNUSED(op))
curs = ED_view3d_cursor3d_get(scene, v3d);
zero_v3(curs);
-
+
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, v3d);
-
+
return OPERATOR_FINISHED;
}
@@ -770,11 +770,11 @@ void VIEW3D_OT_snap_cursor_to_center(wmOperatorType *ot)
ot->name = "Snap Cursor to Center";
ot->description = "Snap cursor to the Center";
ot->idname = "VIEW3D_OT_snap_cursor_to_center";
-
+
/* api callbacks */
ot->exec = snap_curs_to_center_exec;
ot->poll = ED_operator_view3d_active;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
@@ -804,12 +804,12 @@ bool ED_view3d_minmax_verts(Object *obedit, float min[3], float max[3])
if (ED_transverts_check_obedit(obedit))
ED_transverts_create_from_obedit(&tvs, obedit, TM_ALL_JOINTS);
-
+
if (tvs.transverts_tot == 0)
return false;
copy_m3_m4(bmat, obedit->obmat);
-
+
tv = tvs.transverts;
for (a = 0; a < tvs.transverts_tot; a++, tv++) {
copy_v3_v3(vec, (tv->flag & TX_VERT_USE_MAPLOC) ? tv->maploc : tv->loc);
@@ -818,8 +818,8 @@ bool ED_view3d_minmax_verts(Object *obedit, float min[3], float max[3])
add_v3_v3(centroid, vec);
minmax_v3v3_v3(min, max, vec);
}
-
+
ED_transverts_free(&tvs);
-
+
return true;
}
diff --git a/source/blender/editors/space_view3d/view3d_toolbar.c b/source/blender/editors/space_view3d/view3d_toolbar.c
index 3e61809671a..e7ae0d39a2b 100644
--- a/source/blender/editors/space_view3d/view3d_toolbar.c
+++ b/source/blender/editors/space_view3d/view3d_toolbar.c
@@ -137,15 +137,15 @@ typedef struct CustomTool {
static void operator_call_cb(struct bContext *C, void *arg_listbase, void *arg2)
{
wmOperatorType *ot = arg2;
-
+
if (ot) {
CustomTool *ct = MEM_callocN(sizeof(CustomTool), "CustomTool");
-
+
BLI_addtail(arg_listbase, ct);
BLI_strncpy(ct->opname, ot->idname, OP_MAX_TYPENAME);
BLI_strncpy(ct->context, CTX_data_mode_string(C), OP_MAX_TYPENAME);
}
-
+
}
static void operator_search_cb(const struct bContext *C, void *UNUSED(arg), const char *str, uiSearchItems *items)
@@ -157,7 +157,7 @@ static void operator_search_cb(const struct bContext *C, void *UNUSED(arg), cons
if (BLI_strcasestr(ot->name, str)) {
if (WM_operator_poll((bContext *)C, ot)) {
-
+
if (false == UI_search_item_add(items, ot->name, ot, 0))
break;
}
@@ -174,30 +174,30 @@ static uiBlock *tool_search_menu(bContext *C, ARegion *ar, void *arg_listbase)
wmWindow *win = CTX_wm_window(C);
uiBlock *block;
uiBut *but;
-
+
/* clear initial search string, then all items show */
search[0] = 0;
-
+
block = UI_block_begin(C, ar, "_popup", UI_EMBOSS);
UI_block_flag_enable(block, UI_BLOCK_LOOP | UI_BLOCK_SEARCH_MENU);
-
+
/* fake button, it holds space for search items */
uiDefBut(block, UI_BTYPE_LABEL, 0, "", 10, 15, UI_searchbox_size_x(), UI_searchbox_size_y(), NULL, 0, 0, 0, 0, NULL);
-
+
but = uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 10, 0, 150, 19, 0, 0, "");
UI_but_func_search_set(but, NULL, operator_search_cb, arg_listbase, operator_call_cb, NULL);
-
+
UI_block_bounds_set_normal(block, 6);
UI_block_direction_set(block, UI_DIR_DOWN);
UI_block_end(C, block);
-
+
wm_event_init_from_window(win, &event);
event.type = EVT_BUT_OPEN;
event.val = KM_PRESS;
event.customdata = but;
event.customdatafree = false;
wm_event_add(win, &event);
-
+
return block;
}
@@ -208,13 +208,13 @@ static void view3d_panel_tool_shelf(const bContext *C, Panel *pa)
SpaceType *st = NULL;
uiLayout *col;
const char *context = CTX_data_mode_string(C);
-
+
if (sl)
st = BKE_spacetype_from_id(sl->spacetype);
-
+
if (st && st->toolshelf.first) {
CustomTool *ct;
-
+
for (ct = st->toolshelf.first; ct; ct = ct->next) {
if (STREQLEN(context, ct->context, OP_MAX_TYPENAME)) {
col = uiLayoutColumn(pa->layout, true);
@@ -242,7 +242,7 @@ void view3d_toolshelf_register(ARegionType *art)
void view3d_tool_props_register(ARegionType *art)
{
PanelType *pt;
-
+
pt = MEM_callocN(sizeof(PanelType), "spacetype view3d panel last operator");
strcpy(pt->idname, "VIEW3D_PT_last_operator");
strcpy(pt->label, N_("Operator"));
@@ -258,7 +258,7 @@ static int view3d_toolshelf_toggle_exec(bContext *C, wmOperator *UNUSED(op))
{
ScrArea *sa = CTX_wm_area(C);
ARegion *ar = view3d_has_tools_region(sa);
-
+
if (ar)
ED_region_toggle_hidden(C, ar);
@@ -270,10 +270,10 @@ void VIEW3D_OT_toolshelf(wmOperatorType *ot)
ot->name = "Tool Shelf";
ot->description = "Toggles tool shelf display";
ot->idname = "VIEW3D_OT_toolshelf";
-
+
ot->exec = view3d_toolshelf_toggle_exec;
ot->poll = ED_operator_view3d_active;
-
+
/* flags */
ot->flag = 0;
}
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index e48ecd7797a..608580c0a08 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -132,7 +132,7 @@ void ED_view3d_smooth_view_ex(
RegionView3D *rv3d = ar->regiondata;
struct SmoothView3DStore sms = {{0}};
bool ok = false;
-
+
/* initialize sms */
view3d_smooth_view_state_backup(&sms.dst, v3d, rv3d);
view3d_smooth_view_state_backup(&sms.src, v3d, rv3d);
@@ -185,11 +185,11 @@ void ED_view3d_smooth_view_ex(
ED_view3d_from_object(sview->camera, sms.dst.ofs, sms.dst.quat, &sms.dst.dist, &sms.dst.lens);
sms.to_camera = true; /* restore view3d values in end */
}
-
+
/* skip smooth viewing for render engine draw */
if (smooth_viewtx && v3d->drawtype != OB_RENDER) {
bool changed = false; /* zero means no difference */
-
+
if (sview->camera_old != sview->camera)
changed = true;
else if (sms.dst.dist != rv3d->dist)
@@ -200,7 +200,7 @@ void ED_view3d_smooth_view_ex(
changed = true;
else if (!equals_v4v4(sms.dst.quat, rv3d->viewquat))
changed = true;
-
+
/* The new view is different from the old one
* so animate the view */
if (changed) {
@@ -217,10 +217,10 @@ void ED_view3d_smooth_view_ex(
}
sms.time_allowed = (double)smooth_viewtx / 1000.0;
-
+
/* if this is view rotation only
* we can decrease the time allowed by
- * the angle between quats
+ * the angle between quats
* this means small rotations wont lag */
if (sview->quat && !sview->ofs && !sview->dist) {
/* scale the time allowed by the rotation */
@@ -237,7 +237,7 @@ void ED_view3d_smooth_view_ex(
}
rv3d->rflag |= RV3D_NAVIGATING;
-
+
/* not essential but in some cases the caller will tag the area for redraw,
* and in that case we can get a flicker of the 'org' user view but we want to see 'src' */
view3d_smooth_view_state_restore(&sms.src, v3d, rv3d);
@@ -256,7 +256,7 @@ void ED_view3d_smooth_view_ex(
ok = true;
}
}
-
+
/* if we get here nothing happens */
if (ok == false) {
if (sms.to_camera == false) {
@@ -297,15 +297,15 @@ static void view3d_smoothview_apply(bContext *C, View3D *v3d, ARegion *ar, bool
RegionView3D *rv3d = ar->regiondata;
struct SmoothView3DStore *sms = rv3d->sms;
float step, step_inv;
-
+
if (sms->time_allowed != 0.0)
step = (float)((rv3d->smooth_timer->duration) / sms->time_allowed);
else
step = 1.0f;
-
+
/* end timer */
if (step >= 1.0f) {
-
+
/* if we went to camera, store the original */
if (sms->to_camera) {
rv3d->persp = RV3D_CAMOB;
@@ -317,14 +317,14 @@ static void view3d_smoothview_apply(bContext *C, View3D *v3d, ARegion *ar, bool
ED_view3d_camera_lock_sync(v3d, rv3d);
ED_view3d_camera_lock_autokey(v3d, rv3d, C, true, true);
}
-
+
if ((rv3d->viewlock & RV3D_LOCKED) == 0) {
rv3d->view = sms->org_view;
}
MEM_freeN(rv3d->sms);
rv3d->sms = NULL;
-
+
WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), rv3d->smooth_timer);
rv3d->smooth_timer = NULL;
rv3d->rflag &= ~RV3D_NAVIGATING;
@@ -343,7 +343,7 @@ static void view3d_smoothview_apply(bContext *C, View3D *v3d, ARegion *ar, bool
else {
interp_v3_v3v3(rv3d->ofs, sms->src.ofs, sms->dst.ofs, step);
}
-
+
rv3d->dist = sms->dst.dist * step + sms->src.dist * step_inv;
v3d->lens = sms->dst.lens * step + sms->src.lens * step_inv;
@@ -355,7 +355,7 @@ static void view3d_smoothview_apply(bContext *C, View3D *v3d, ARegion *ar, bool
/* Event handling won't know if a UI item has been moved under the pointer. */
WM_event_add_mousemove(C);
}
-
+
if (sync_boxview && (rv3d->viewlock & RV3D_BOXVIEW)) {
view3d_boxview_copy(CTX_wm_area(C), ar);
}
@@ -453,9 +453,9 @@ static int view3d_camera_to_view_exec(bContext *C, wmOperator *UNUSED(op))
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);
-
+
return OPERATOR_FINISHED;
}
@@ -485,11 +485,11 @@ void VIEW3D_OT_camera_to_view(wmOperatorType *ot)
ot->name = "Align Camera To View";
ot->description = "Set camera view to active view";
ot->idname = "VIEW3D_OT_camera_to_view";
-
+
/* api callbacks */
ot->exec = view3d_camera_to_view_exec;
ot->poll = view3d_camera_to_view_poll;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
@@ -654,7 +654,7 @@ static int view3d_setobjectascamera_exec(bContext *C, wmOperator *op)
}
WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, scene);
}
-
+
return OPERATOR_FINISHED;
}
@@ -672,11 +672,11 @@ void VIEW3D_OT_object_as_camera(wmOperatorType *ot)
ot->name = "Set Active Object as Camera";
ot->description = "Set the active object as the active camera for this view or scene";
ot->idname = "VIEW3D_OT_object_as_camera";
-
+
/* api callbacks */
ot->exec = view3d_setobjectascamera_exec;
ot->poll = ED_operator_rv3d_user_region_poll;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
@@ -696,7 +696,7 @@ void view3d_winmatrix_set(ARegion *ar, const View3D *v3d, const rcti *rect)
rctf viewplane;
float clipsta, clipend;
bool is_ortho;
-
+
is_ortho = ED_view3d_viewplane_get(v3d, rv3d, ar->winx, ar->winy, &viewplane, &clipsta, &clipend, NULL);
rv3d->is_persp = !is_ortho;
@@ -771,13 +771,13 @@ void view3d_viewmatrix_set(
/* should be moved to better initialize later on XXX */
if (rv3d->viewlock & RV3D_LOCKED)
ED_view3d_lock(rv3d);
-
+
quat_to_mat4(rv3d->viewmat, rv3d->viewquat);
if (rv3d->persp == RV3D_PERSP) rv3d->viewmat[3][2] -= rv3d->dist;
if (v3d->ob_centre) {
Object *ob = v3d->ob_centre;
float vec[3];
-
+
copy_v3_v3(vec, ob->obmat[3]);
if (ob->type == OB_ARMATURE && v3d->ob_centre_bone[0]) {
bPoseChannel *pchan = BKE_pose_channel_find_name(ob->pose, v3d->ob_centre_bone);
@@ -929,16 +929,16 @@ int view3d_opengl_select(
v3d->zbuf = true;
glEnable(GL_DEPTH_TEST);
}
-
+
if (vc->rv3d->rflag & RV3D_CLIPPING)
ED_view3d_clipping_set(vc->rv3d);
-
+
GPU_select_begin(buffer, bufsize, &rect, gpu_select_mode, 0);
ED_view3d_draw_select_loop(vc, scene, v3d, ar, use_obedit_skip, use_nearest);
hits = GPU_select_end();
-
+
/* second pass, to get the closest object to camera */
if (do_passes && (hits > 0)) {
GPU_select_begin(buffer, bufsize, &rect, GPU_SELECT_NEAREST_SECOND_PASS, hits);
@@ -950,12 +950,12 @@ int view3d_opengl_select(
G.f &= ~G_PICKSEL;
ED_view3d_draw_setup_view(vc->win, scene, ar, v3d, vc->rv3d->viewmat, NULL, NULL);
-
+
if (v3d->drawtype > OB_WIRE) {
v3d->zbuf = 0;
glDisable(GL_DEPTH_TEST);
}
-
+
if (vc->rv3d->rflag & RV3D_CLIPPING)
ED_view3d_clipping_disable();
@@ -978,9 +978,9 @@ static unsigned int free_localbit(Main *bmain)
unsigned int lay;
ScrArea *sa;
bScreen *sc;
-
+
lay = 0;
-
+
/* sometimes we loose a localview: when an area is closed */
/* check all areas: which localviews are in use? */
for (sc = bmain->screen.first; sc; sc = sc->id.next) {
@@ -994,7 +994,7 @@ static unsigned int free_localbit(Main *bmain)
}
}
}
-
+
if ((lay & 0x01000000) == 0) return 0x01000000;
if ((lay & 0x02000000) == 0) return 0x02000000;
if ((lay & 0x04000000) == 0) return 0x04000000;
@@ -1003,35 +1003,35 @@ static unsigned int free_localbit(Main *bmain)
if ((lay & 0x20000000) == 0) return 0x20000000;
if ((lay & 0x40000000) == 0) return 0x40000000;
if ((lay & 0x80000000) == 0) return 0x80000000;
-
+
return 0;
}
int ED_view3d_scene_layer_set(int lay, const int *values, int *active)
{
int i, tot = 0;
-
+
/* ensure we always have some layer selected */
for (i = 0; i < 20; i++)
if (values[i])
tot++;
-
+
if (tot == 0)
return lay;
-
+
for (i = 0; i < 20; i++) {
-
+
if (active) {
/* if this value has just been switched on, make that layer active */
if (values[i] && (lay & (1 << i)) == 0) {
*active = (1 << i);
}
}
-
+
if (values[i]) lay |= (1 << i);
else lay &= ~(1 << i);
}
-
+
/* ensure always an active layer */
if (active && (lay & *active) == 0) {
for (i = 0; i < 20; i++) {
@@ -1041,7 +1041,7 @@ int ED_view3d_scene_layer_set(int lay, const int *values, int *active)
}
}
}
-
+
return lay;
}
@@ -1072,9 +1072,9 @@ static bool view3d_localview_init(
else {
if (scene->obedit) {
BKE_object_minmax(scene->obedit, min, max, false);
-
+
ok = true;
-
+
BASACT->lay |= locallay;
scene->obedit->lay = BASACT->lay;
}
@@ -1092,12 +1092,12 @@ static bool view3d_localview_init(
sub_v3_v3v3(box, max, min);
size = max_fff(box[0], box[1], box[2]);
}
-
+
if (ok == true) {
ARegion *ar;
-
+
v3d->localvd = MEM_mallocN(sizeof(View3D), "localview");
-
+
memcpy(v3d->localvd, v3d, sizeof(View3D));
mid_v3_v3v3(mid, min, max);
@@ -1145,11 +1145,11 @@ static bool view3d_localview_init(
.dist = ok_dist ? &dist_new : NULL, .lens = &v3d->lens});
}
}
-
+
v3d->lay = locallay;
}
else {
- /* clear flags */
+ /* clear flags */
for (base = FIRSTBASE; base; base = base->next) {
if (base->lay & locallay) {
base->lay -= locallay;
@@ -1171,9 +1171,9 @@ static void restore_localviewdata(wmWindowManager *wm, wmWindow *win, Main *bmai
ARegion *ar;
View3D *v3d = sa->spacedata.first;
Object *camera_old, *camera_new;
-
+
if (v3d->localvd == NULL) return;
-
+
camera_old = v3d->camera;
camera_new = v3d->localvd->camera;
@@ -1181,16 +1181,16 @@ static void restore_localviewdata(wmWindowManager *wm, wmWindow *win, Main *bmai
v3d->layact = v3d->localvd->layact;
v3d->drawtype = v3d->localvd->drawtype;
v3d->camera = v3d->localvd->camera;
-
+
if (free) {
MEM_freeN(v3d->localvd);
v3d->localvd = NULL;
}
-
+
for (ar = sa->regionbase.first; ar; ar = ar->next) {
if (ar->regiontype == RGN_TYPE_WINDOW) {
RegionView3D *rv3d = ar->regiondata;
-
+
if (rv3d->localvd) {
Object *camera_old_rv3d, *camera_new_rv3d;
@@ -1227,16 +1227,16 @@ static bool view3d_localview_exit(
View3D *v3d = sa->spacedata.first;
struct Base *base;
unsigned int locallay;
-
+
if (v3d->localvd) {
-
+
locallay = v3d->lay & 0xFF000000;
restore_localviewdata(wm, win, bmain, sa, smooth_viewtx);
/* for when in other window the layers have changed */
if (v3d->scenelock) v3d->lay = scene->lay;
-
+
for (base = FIRSTBASE; base; base = base->next) {
if (base->lay & locallay) {
base->lay -= locallay;
@@ -1248,7 +1248,7 @@ static bool view3d_localview_exit(
base->object->lay = base->lay;
}
}
-
+
DAG_on_visible_update(bmain, false);
return true;
@@ -1268,7 +1268,7 @@ static int localview_exec(bContext *C, wmOperator *op)
ScrArea *sa = CTX_wm_area(C);
View3D *v3d = CTX_wm_view3d(C);
bool changed;
-
+
if (v3d->localvd) {
changed = view3d_localview_exit(wm, win, bmain, scene, sa, smooth_viewtx);
}
@@ -1298,11 +1298,11 @@ void VIEW3D_OT_localview(wmOperatorType *ot)
ot->name = "Local View";
ot->description = "Toggle display of selected object(s) separately and centered in view";
ot->idname = "VIEW3D_OT_localview";
-
+
/* api callbacks */
ot->exec = localview_exec;
ot->flag = OPTYPE_UNDO; /* localview changes object layer bitflags */
-
+
ot->poll = ED_operator_view3d_active;
}