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:
authorNathan Letwory <nathan@letworyinteractive.com>2011-07-21 13:40:59 +0400
committerNathan Letwory <nathan@letworyinteractive.com>2011-07-21 13:40:59 +0400
commiteea7c358c7d606f9a4df8f11d42ac5b0df28a6d4 (patch)
tree32c72886e2007dad65c71b89c90dee891c08e5c3 /source/blender/editors/space_view3d
parentc89379e7e15aeb50a7d7106218821a17e5a7dac9 (diff)
parent314fdb941e28d5f1fbe2acace6133d6216f4e36c (diff)
svn merge -r37276:38555 https://svn.blender.org/svnroot/bf-blender/trunk/blender .
Diffstat (limited to 'source/blender/editors/space_view3d')
-rw-r--r--source/blender/editors/space_view3d/CMakeLists.txt8
-rw-r--r--source/blender/editors/space_view3d/drawanimviz.c6
-rw-r--r--source/blender/editors/space_view3d/drawarmature.c28
-rw-r--r--source/blender/editors/space_view3d/drawobject.c157
-rw-r--r--source/blender/editors/space_view3d/space_view3d.c11
-rw-r--r--source/blender/editors/space_view3d/view3d_buttons.c8
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c30
-rw-r--r--source/blender/editors/space_view3d/view3d_intern.h12
-rw-r--r--source/blender/editors/space_view3d/view3d_select.c29
-rw-r--r--source/blender/editors/space_view3d/view3d_view.c19
10 files changed, 136 insertions, 172 deletions
diff --git a/source/blender/editors/space_view3d/CMakeLists.txt b/source/blender/editors/space_view3d/CMakeLists.txt
index 0a12a28af8d..c6e936606c8 100644
--- a/source/blender/editors/space_view3d/CMakeLists.txt
+++ b/source/blender/editors/space_view3d/CMakeLists.txt
@@ -23,14 +23,14 @@ set(INC
../include
../../blenfont
../../blenkernel
- ../../blenloader
../../blenlib
+ ../../blenloader
../../gpu
../../imbuf
../../makesdna
../../makesrna
- ../../windowmanager
../../render/extern/include
+ ../../windowmanager
../../../../intern/guardedalloc
../../../../intern/smoke/extern
)
@@ -61,7 +61,9 @@ set(SRC
)
if(WITH_GAMEENGINE)
- list(APPEND INC ../../../../source/gameengine/BlenderRoutines)
+ list(APPEND INC
+ ../../../gameengine/BlenderRoutines
+ )
add_definitions(-DWITH_GAMEENGINE)
endif()
diff --git a/source/blender/editors/space_view3d/drawanimviz.c b/source/blender/editors/space_view3d/drawanimviz.c
index ee78fd92b79..aa3ba1a3062 100644
--- a/source/blender/editors/space_view3d/drawanimviz.c
+++ b/source/blender/editors/space_view3d/drawanimviz.c
@@ -117,7 +117,11 @@ void draw_motion_path_instance(Scene *scene,
len = mpath->length;
mpv_start= mpath->points;
}
-
+
+ if(len <= 0) {
+ return;
+ }
+
/* draw curve-line of path */
glShadeModel(GL_SMOOTH);
diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c
index 7c66cec5730..ad621257602 100644
--- a/source/blender/editors/space_view3d/drawarmature.c
+++ b/source/blender/editors/space_view3d/drawarmature.c
@@ -197,8 +197,7 @@ static short set_pchan_glColor (short colCode, int boneflag, int constflag)
case PCHAN_COLOR_CONSTS:
{
if ( (bcolor == NULL) || (bcolor->flag & TH_WIRECOLOR_CONSTCOLS) ) {
- if (constflag & PCHAN_HAS_STRIDE) glColor4ub(0, 0, 200, 80);
- else if (constflag & PCHAN_HAS_TARGET) glColor4ub(255, 150, 0, 80);
+ if (constflag & PCHAN_HAS_TARGET) glColor4ub(255, 150, 0, 80);
else if (constflag & PCHAN_HAS_IK) glColor4ub(255, 255, 0, 80);
else if (constflag & PCHAN_HAS_SPLINEIK) glColor4ub(200, 255, 0, 80);
else if (constflag & PCHAN_HAS_CONST) glColor4ub(0, 255, 120, 80);
@@ -269,8 +268,7 @@ static short set_pchan_glColor (short colCode, int boneflag, int constflag)
{
/* inner part in background color or constraint */
if ( (constflag) && ((bcolor==NULL) || (bcolor->flag & TH_WIRECOLOR_CONSTCOLS)) ) {
- if (constflag & PCHAN_HAS_STRIDE) glColor3ub(0, 0, 200);
- else if (constflag & PCHAN_HAS_TARGET) glColor3ub(255, 150, 0);
+ if (constflag & PCHAN_HAS_TARGET) glColor3ub(255, 150, 0);
else if (constflag & PCHAN_HAS_IK) glColor3ub(255, 255, 0);
else if (constflag & PCHAN_HAS_SPLINEIK) glColor3ub(200, 255, 0);
else if (constflag & PCHAN_HAS_CONST) glColor3ub(0, 255, 120);
@@ -1577,7 +1575,7 @@ static void bone_matrix_translate_y(float mat[][4], float y)
}
/* assumes object is Armature with pose */
-static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, int dt, short ghost)
+static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, int dt, const short is_ghost, const short is_outline)
{
RegionView3D *rv3d= ar->regiondata;
Object *ob= base->object;
@@ -1737,7 +1735,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
}
/* prepare colors */
- if(ghost) {
+ if(is_ghost) {
/* 13 October 2009, Disabled this to make ghosting show the right colors (Aligorith) */
}
else if (arm->flag & ARM_POSEMODE)
@@ -1865,9 +1863,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
constflag= pchan->constflag;
if (pchan->flag & (POSE_ROT|POSE_LOC|POSE_SIZE))
constflag |= PCHAN_HAS_ACTION;
- if (pchan->flag & POSE_STRIDE)
- constflag |= PCHAN_HAS_STRIDE;
-
+
/* set color-set to use */
set_pchan_colorset(ob, pchan);
@@ -1905,7 +1901,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
draw_pose_dofs(ob);
/* finally names and axes */
- if (arm->flag & (ARM_DRAWNAMES|ARM_DRAWAXES)) {
+ if (arm->flag & (ARM_DRAWNAMES|ARM_DRAWAXES) && is_outline == 0) {
/* patch for several 3d cards (IBM mostly) that crash on glSelect with text drawing */
if ((G.f & G_PICKSEL) == 0) {
float vec[3];
@@ -2259,7 +2255,7 @@ static void draw_ghost_poses_range(Scene *scene, View3D *v3d, ARegion *ar, Base
BKE_animsys_evaluate_animdata(&ob->id, adt, (float)CFRA, ADT_RECALC_ALL);
where_is_pose(scene, ob);
- draw_pose_bones(scene, v3d, ar, base, OB_WIRE, TRUE);
+ draw_pose_bones(scene, v3d, ar, base, OB_WIRE, TRUE, FALSE);
}
glDisable(GL_BLEND);
if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
@@ -2338,7 +2334,7 @@ static void draw_ghost_poses_keys(Scene *scene, View3D *v3d, ARegion *ar, Base *
BKE_animsys_evaluate_animdata(&ob->id, adt, (float)CFRA, ADT_RECALC_ALL);
where_is_pose(scene, ob);
- draw_pose_bones(scene, v3d, ar, base, OB_WIRE, TRUE);
+ draw_pose_bones(scene, v3d, ar, base, OB_WIRE, TRUE, FALSE);
}
glDisable(GL_BLEND);
if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
@@ -2408,7 +2404,7 @@ static void draw_ghost_poses(Scene *scene, View3D *v3d, ARegion *ar, Base *base)
if (CFRA != cfrao) {
BKE_animsys_evaluate_animdata(&ob->id, adt, (float)CFRA, ADT_RECALC_ALL);
where_is_pose(scene, ob);
- draw_pose_bones(scene, v3d, ar, base, OB_WIRE, TRUE);
+ draw_pose_bones(scene, v3d, ar, base, OB_WIRE, TRUE, FALSE);
}
}
@@ -2423,7 +2419,7 @@ static void draw_ghost_poses(Scene *scene, View3D *v3d, ARegion *ar, Base *base)
if (CFRA != cfrao) {
BKE_animsys_evaluate_animdata(&ob->id, adt, (float)CFRA, ADT_RECALC_ALL);
where_is_pose(scene, ob);
- draw_pose_bones(scene, v3d, ar, base, OB_WIRE, TRUE);
+ draw_pose_bones(scene, v3d, ar, base, OB_WIRE, TRUE, FALSE);
}
}
}
@@ -2444,7 +2440,7 @@ static void draw_ghost_poses(Scene *scene, View3D *v3d, ARegion *ar, Base *base)
/* ********************************** Armature Drawing - Main ************************* */
/* called from drawobject.c, return 1 if nothing was drawn */
-int draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base, int dt, int flag)
+int draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base, int dt, int flag, const short is_outline)
{
Object *ob= base->object;
bArmature *arm= ob->data;
@@ -2510,7 +2506,7 @@ int draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base, int dt, in
}
}
}
- draw_pose_bones(scene, v3d, ar, base, dt, FALSE);
+ draw_pose_bones(scene, v3d, ar, base, dt, FALSE, is_outline);
arm->flag &= ~ARM_POSEMODE;
if(ob->mode & OB_MODE_POSE)
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 391eecbbbae..e6889f4563f 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -215,7 +215,7 @@ int draw_glsl_material(Scene *scene, Object *ob, View3D *v3d, int dt)
if(ob==OBACT && (ob && ob->mode & OB_MODE_WEIGHT_PAINT))
return 0;
- return (scene->gm.matmode == GAME_MAT_GLSL) && (dt >= OB_SHADED);
+ return (scene->gm.matmode == GAME_MAT_GLSL) && (dt > OB_SOLID);
}
static int check_material_alpha(Base *base, Mesh *me, int glsl)
@@ -1335,6 +1335,11 @@ static void draw_focus_cross(float dist, float size)
glEnd();
}
+#ifdef VIEW3D_CAMERA_BORDER_HACK
+float view3d_camera_border_hack_col[4];
+short view3d_camera_border_hack_test= FALSE;
+#endif
+
/* flag similar to draw_object() */
static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob, int flag)
{
@@ -1348,7 +1353,15 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob
const float scax= 1.0f / len_v3(ob->obmat[0]);
const float scay= 1.0f / len_v3(ob->obmat[1]);
const float scaz= 1.0f / len_v3(ob->obmat[2]);
-
+
+#ifdef VIEW3D_CAMERA_BORDER_HACK
+ if(is_view && !(G.f & G_PICKSEL)) {
+ glGetFloatv(GL_CURRENT_COLOR, view3d_camera_border_hack_col);
+ view3d_camera_border_hack_test= TRUE;
+ return;
+ }
+#endif
+
cam= ob->data;
aspx= (float) scene->r.xsch*scene->r.xasp;
aspy= (float) scene->r.ysch*scene->r.yasp;
@@ -2584,7 +2597,6 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
const short is_paint_sel= (ob==OBACT && paint_facesel_test(ob));
int draw_wire = 0;
int /* totvert,*/ totedge, totface;
- DispList *dl;
DerivedMesh *dm= mesh_get_derived_final(scene, ob, scene->customdata_mask);
if(!dm)
@@ -2718,10 +2730,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
}
}
else if(dt==OB_SHADED) {
- int do_draw= 1; /* to resolve all G.f settings below... */
-
if(ob==OBACT) {
- do_draw= 0;
if(ob && ob->mode & OB_MODE_WEIGHT_PAINT) {
/* enforce default material settings */
GPU_enable_material(0, NULL);
@@ -2750,38 +2759,6 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, NULL, 0, GPU_enable_material);
}
}
- else do_draw= 1;
- }
- if(do_draw) {
- dl = ob->disp.first;
- if (!dl || !dl->col1) {
- /* release and reload derivedmesh because it might be freed in
- shadeDispList due to a different datamask */
- dm->release(dm);
- shadeDispList(scene, base);
- dl = find_displist(&ob->disp, DL_VERTCOL);
- dm= mesh_get_derived_final(scene, ob, scene->customdata_mask);
- }
-
- if ((v3d->flag&V3D_SELECT_OUTLINE) && ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) && (base->flag&SELECT) && !draw_wire) {
- draw_mesh_object_outline(v3d, ob, dm);
- }
-
- /* False for dupliframe objects */
- if (dl) {
- unsigned int *obCol1 = dl->col1;
- unsigned int *obCol2 = dl->col2;
-
- dm->drawFacesColored(dm, me->flag&ME_TWOSIDED, (unsigned char*) obCol1, (unsigned char*) obCol2);
- }
-
- if(base->flag & SELECT) {
- UI_ThemeColor((ob==OBACT)?TH_ACTIVE:TH_SELECT);
- } else {
- UI_ThemeColor(TH_WIRE);
- }
- if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0)
- dm->drawLooseEdges(dm);
}
}
@@ -3139,57 +3116,6 @@ static void drawDispListsolid(ListBase *lb, Object *ob, int glsl)
glFrontFace(GL_CCW);
}
-static void drawDispListshaded(ListBase *lb, Object *ob)
-{
- DispList *dl, *dlob;
- unsigned int *cdata;
-
- if(lb==NULL) return;
-
- glShadeModel(GL_SMOOTH);
- glEnableClientState(GL_VERTEX_ARRAY);
- glEnableClientState(GL_COLOR_ARRAY);
-
- dl= lb->first;
- dlob= ob->disp.first;
- while(dl && dlob) {
-
- cdata= dlob->col1;
- if(cdata==NULL) break;
-
- switch(dl->type) {
- case DL_SURF:
- if(dl->index) {
- glVertexPointer(3, GL_FLOAT, 0, dl->verts);
- glColorPointer(4, GL_UNSIGNED_BYTE, 0, cdata);
- glDrawElements(GL_QUADS, 4*dl->totindex, GL_UNSIGNED_INT, dl->index);
- }
- break;
-
- case DL_INDEX3:
-
- glVertexPointer(3, GL_FLOAT, 0, dl->verts);
- glColorPointer(4, GL_UNSIGNED_BYTE, 0, cdata);
- glDrawElements(GL_TRIANGLES, 3*dl->parts, GL_UNSIGNED_INT, dl->index);
- break;
-
- case DL_INDEX4:
-
- glVertexPointer(3, GL_FLOAT, 0, dl->verts);
- glColorPointer(4, GL_UNSIGNED_BYTE, 0, cdata);
- glDrawElements(GL_QUADS, 4*dl->parts, GL_UNSIGNED_INT, dl->index);
- break;
- }
-
- dl= dl->next;
- dlob= dlob->next;
- }
-
- glShadeModel(GL_FLAT);
- glDisableClientState(GL_VERTEX_ARRAY);
- glDisableClientState(GL_COLOR_ARRAY);
-}
-
static void drawCurveDMWired(Object *ob)
{
DerivedMesh *dm = ob->derivedFinal;
@@ -3270,10 +3196,6 @@ static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *bas
drawDispListsolid(lb, ob, 1);
GPU_end_object_materials();
}
- else if(dt == OB_SHADED) {
- if(ob->disp.first==NULL) shadeDispList(scene, base);
- drawDispListshaded(lb, ob);
- }
else {
GPU_begin_object_materials(v3d, rv3d, scene, ob, 0, NULL);
glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 0);
@@ -3312,10 +3234,6 @@ static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *bas
drawDispListsolid(lb, ob, 1);
GPU_end_object_materials();
}
- else if(dt==OB_SHADED) {
- if(ob->disp.first==NULL) shadeDispList(scene, base);
- drawDispListshaded(lb, ob);
- }
else {
GPU_begin_object_materials(v3d, rv3d, scene, ob, 0, NULL);
glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 0);
@@ -3341,11 +3259,6 @@ static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *bas
drawDispListsolid(lb, ob, 1);
GPU_end_object_materials();
}
- else if(dt == OB_SHADED) {
- dl= lb->first;
- if(dl && dl->col1==NULL) shadeDispList(scene, base);
- drawDispListshaded(lb, ob);
- }
else {
GPU_begin_object_materials(v3d, rv3d, scene, ob, 0, NULL);
glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 0);
@@ -3713,8 +3626,6 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
bb.align = part->bb_align;
bb.anim = part->bb_anim;
bb.lock = part->draw & PART_DRAW_BB_LOCK;
- bb.offset[0] = part->bb_offset[0];
- bb.offset[1] = part->bb_offset[1];
break;
case PART_DRAW_PATH:
break;
@@ -3884,7 +3795,20 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
/* create actiual particle data */
if(draw_as == PART_DRAW_BB) {
- bb.size = pa_size;
+ bb.offset[0] = part->bb_offset[0];
+ bb.offset[1] = part->bb_offset[1];
+ bb.size[0] = part->bb_size[0] * pa_size;
+ if (part->bb_align==PART_BB_VEL) {
+ float pa_vel = len_v3(state.vel);
+ float head = part->bb_vel_head*pa_vel;
+ float tail = part->bb_vel_tail*pa_vel;
+ bb.size[1] = part->bb_size[1]*pa_size + head + tail;
+ /* use offset to adjust the particle center. this is relative to size, so need to divide! */
+ if (bb.size[1] > 0.0f)
+ bb.offset[1] += (head-tail) / bb.size[1];
+ }
+ else
+ bb.size[1] = part->bb_size[1] * pa_size;
bb.tilt = part->bb_tilt * (1.0f - part->bb_rand_tilt * r_tilt);
bb.time = ct;
}
@@ -3904,7 +3828,20 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
/* create actiual particle data */
if(draw_as == PART_DRAW_BB) {
- bb.size = pa_size;
+ bb.offset[0] = part->bb_offset[0];
+ bb.offset[1] = part->bb_offset[1];
+ bb.size[0] = part->bb_size[0] * pa_size;
+ if (part->bb_align==PART_BB_VEL) {
+ float pa_vel = len_v3(state.vel);
+ float head = part->bb_vel_head*pa_vel;
+ float tail = part->bb_vel_tail*pa_vel;
+ bb.size[1] = part->bb_size[1]*pa_size + head + tail;
+ /* use offset to adjust the particle center. this is relative to size, so need to divide! */
+ if (bb.size[1] > 0.0f)
+ bb.offset[1] += (head-tail) / bb.size[1];
+ }
+ else
+ bb.size[1] = part->bb_size[1] * pa_size;
bb.tilt = part->bb_tilt * (1.0f - part->bb_rand_tilt * r_tilt);
bb.time = pa_time;
}
@@ -5541,7 +5478,7 @@ static void drawObjectSelect(Scene *scene, View3D *v3d, ARegion *ar, Base *base)
}
else if(ob->type==OB_ARMATURE) {
if(!(ob->mode & OB_MODE_POSE))
- draw_armature(scene, v3d, ar, base, OB_WIRE, 0);
+ draw_armature(scene, v3d, ar, base, OB_WIRE, FALSE, TRUE);
}
glLineWidth(1.0);
@@ -5812,7 +5749,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
/* multiply view with object matrix.
* local viewmat and persmat, to calculate projections */
- ED_view3d_init_mats_rv3d(ob, rv3d);
+ ED_view3d_init_mats_rv3d_gl(ob, rv3d);
/* which wire color */
if((flag & DRAW_CONSTCOLOR) == 0) {
@@ -6077,7 +6014,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
case OB_ARMATURE:
if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) {
if(dt>OB_WIRE) GPU_enable_material(0, NULL); // we use default material
- empty_object= draw_armature(scene, v3d, ar, base, dt, flag);
+ empty_object= draw_armature(scene, v3d, ar, base, dt, flag, FALSE);
if(dt>OB_WIRE) GPU_disable_material();
}
break;
@@ -6311,7 +6248,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
}
}
- if(dt<OB_SHADED && (v3d->flag2 & V3D_RENDER_OVERRIDE)==0) {
+ if(dt<=OB_SOLID && (v3d->flag2 & V3D_RENDER_OVERRIDE)==0) {
if((ob->gameflag & OB_DYNAMIC) ||
((ob->gameflag & OB_BOUNDS) && (ob->boundtype == OB_BOUND_SPHERE))) {
float imat[4][4], vec[3]= {0.0f, 0.0f, 0.0f};
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index fb67e38cbf7..6833dec2e43 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -208,13 +208,18 @@ void ED_view3d_init_mats_rv3d(struct Object *ob, struct RegionView3D *rv3d)
mul_m4_m4m4(rv3d->viewmatob, ob->obmat, rv3d->viewmat);
mul_m4_m4m4(rv3d->persmatob, ob->obmat, rv3d->persmat);
+ /* initializes object space clipping, speeds up clip tests */
+ ED_view3d_local_clipping(rv3d, ob->obmat);
+}
+
+void ED_view3d_init_mats_rv3d_gl(struct Object *ob, struct RegionView3D *rv3d)
+{
+ ED_view3d_init_mats_rv3d(ob, rv3d);
+
/* we have to multiply instead of loading viewmatob to make
it work with duplis using displists, otherwise it will
override the dupli-matrix */
glMultMatrixf(ob->obmat);
-
- /* initializes object space clipping, speeds up clip tests */
- ED_view3d_local_clipping(rv3d, ob->obmat);
}
/* ******************** default callbacks for view3d space ***************** */
diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c
index 549a547b846..6e03866153f 100644
--- a/source/blender/editors/space_view3d/view3d_buttons.c
+++ b/source/blender/editors/space_view3d/view3d_buttons.c
@@ -966,13 +966,13 @@ static void v3d_editarmature_buts(uiLayout *layout, Object *ob)
ebone= arm->act_edbone;
- if (!ebone || (ebone->layer & arm->layer)==0)
+ if (!ebone || (ebone->layer & arm->layer)==0) {
+ uiItemL(layout, "Nothing selected", ICON_NONE);
return;
-
+ }
// row= uiLayoutRow(layout, 0);
RNA_pointer_create(&arm->id, &RNA_EditBone, ebone, &eboneptr);
-
col= uiLayoutColumn(layout, 0);
uiItemR(col, &eboneptr, "head", 0, "Head", ICON_NONE);
if (ebone->parent && ebone->flag & BONE_CONNECTED ) {
@@ -1256,7 +1256,7 @@ static void view3d_panel_object(const bContext *C, Panel *pa)
if(ob==obedit) {
if(ob->type==OB_ARMATURE) v3d_editarmature_buts(col, ob);
- if(ob->type==OB_MBALL) v3d_editmetaball_buts(col, ob);
+ else if(ob->type==OB_MBALL) v3d_editmetaball_buts(col, ob);
else v3d_editvertex_buts(col, v3d, ob, lim);
}
else if(ob->mode & OB_MODE_POSE) {
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 573951da4ca..d2ff6eef097 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -627,7 +627,7 @@ static void draw_view_axis(RegionView3D *rv3d)
glEnd();
if (fabsf(dx) > toll || fabsf(dy) > toll) {
- BLF_draw_default(start + dx + 2, start + dy + ydisp + 2, 0.0f, "x", 1);
+ BLF_draw_default_ascii(start + dx + 2, start + dy + ydisp + 2, 0.0f, "x", 1);
}
/* BLF_draw_default disables blending */
@@ -647,7 +647,7 @@ static void draw_view_axis(RegionView3D *rv3d)
glEnd();
if (fabsf(dx) > toll || fabsf(dy) > toll) {
- BLF_draw_default(start + dx + 2, start + dy + ydisp + 2, 0.0f, "y", 1);
+ BLF_draw_default_ascii(start + dx + 2, start + dy + ydisp + 2, 0.0f, "y", 1);
}
glEnable(GL_BLEND);
@@ -666,7 +666,7 @@ static void draw_view_axis(RegionView3D *rv3d)
glEnd();
if (fabsf(dx) > toll || fabsf(dy) > toll) {
- BLF_draw_default(start + dx + 2, start + dy + ydisp + 2, 0.0f, "z", 1);
+ BLF_draw_default_ascii(start + dx + 2, start + dy + ydisp + 2, 0.0f, "z", 1);
}
/* restore line-width */
@@ -757,7 +757,7 @@ static void draw_viewport_name(ARegion *ar, View3D *v3d)
if (name) {
UI_ThemeColor(TH_TEXT_HI);
- BLF_draw_default(22, ar->winy-17, 0.0f, name, sizeof(tmpstr));
+ BLF_draw_default_ascii(22, ar->winy-17, 0.0f, name, sizeof(tmpstr));
}
}
@@ -1007,6 +1007,8 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d)
/* note: quite un-scientific but without this bit extra
* 0.0001 on the lower left the 2D border sometimes
* obscures the 3D camera border */
+ /* note: with VIEW3D_CAMERA_BORDER_HACK defined this error isn't noticable
+ * but keep it here incase we need to remove the workaround */
x1i= (int)(x1 - 1.0001f);
y1i= (int)(y1 - 1.0001f);
x2i= (int)(x2 + (1.0f-0.0001f));
@@ -1039,7 +1041,17 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d)
setlinestyle(0);
UI_ThemeColor(TH_BACK);
glRectf(x1i, y1i, x2i, y2i);
-
+
+#ifdef VIEW3D_CAMERA_BORDER_HACK
+ {
+ if(view3d_camera_border_hack_test == TRUE) {
+ glColor4fv(view3d_camera_border_hack_col);
+ glRectf(x1i+1, y1i+1, x2i-1, y2i-1);
+ view3d_camera_border_hack_test= FALSE;
+ }
+ }
+#endif
+
setlinestyle(3);
UI_ThemeColor(TH_WIRE);
glRectf(x1i, y1i, x2i, y2i);
@@ -2074,10 +2086,6 @@ static void gpu_update_lamps_shadows(Scene *scene, View3D *v3d)
CustomDataMask ED_view3d_datamask(Scene *scene, View3D *v3d)
{
CustomDataMask mask= 0;
- if(v3d->drawtype == OB_SHADED) {
- /* this includes normals for mesh_create_shadedColors */
- mask |= CD_MASK_MTFACE | CD_MASK_MCOL | CD_MASK_NORMAL | CD_MASK_ORCO;
- }
if((v3d->drawtype == OB_TEXTURE) || ((v3d->drawtype == OB_SOLID) && (v3d->flag2 & V3D_SOLID_TEX))) {
mask |= CD_MASK_MTFACE | CD_MASK_MCOL;
@@ -2426,7 +2434,7 @@ static void draw_viewport_fps(Scene *scene, ARegion *ar)
BLI_snprintf(printable, sizeof(printable), "fps: %i", (int)(fps+0.5f));
}
- BLF_draw_default(22, ar->winy-17, 0.0f, printable, sizeof(printable)-1);
+ BLF_draw_default_ascii(22, ar->winy-17, 0.0f, printable, sizeof(printable)-1);
}
/* warning: this function has duplicate drawing in ED_view3d_draw_offscreen() */
@@ -2648,7 +2656,7 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar)
BLI_snprintf(tstr, sizeof(tstr), "%s x %.4g", grid_unit, v3d->grid);
}
- BLF_draw_default(22, ar->winy-(USER_SHOW_VIEWPORTNAME?40:20), 0.0f, tstr[0]?tstr : grid_unit, sizeof(tstr)); /* XXX, use real length */
+ BLF_draw_default_ascii(22, ar->winy-(USER_SHOW_VIEWPORTNAME?40:20), 0.0f, tstr[0]?tstr : grid_unit, sizeof(tstr)); /* XXX, use real length */
}
ob= OBACT;
diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h
index 3658a481bdf..28e0e48f220 100644
--- a/source/blender/editors/space_view3d/view3d_intern.h
+++ b/source/blender/editors/space_view3d/view3d_intern.h
@@ -124,7 +124,7 @@ void view3d_cached_text_draw_end(View3D *v3d, ARegion *ar, int depth_write, floa
#define V3D_CACHE_TEXT_ASCII (1<<2)
/* drawarmature.c */
-int draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base, int dt, int flag);
+int draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base, int dt, int flag, const short is_outline);
/* drawmesh.c */
void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, struct Object *ob, struct DerivedMesh *dm, int faceselect);
@@ -198,6 +198,16 @@ extern const char *view3d_context_dir[]; /* doc access */
/* draw_volume.c */
void draw_volume(struct ARegion *ar, struct GPUTexture *tex, float *min, float *max, int res[3], float dx, struct GPUTexture *tex_shadow);
+/* workaround for trivial but noticable camera bug caused by imprecision
+ * between view border calculation in 2D/3D space, workaround for bug [#28037].
+ * without this deifne we get the old behavior which is to try and align them
+ * both which _mostly_ works fine, but when the camera moves beyond ~1000 in
+ * any direction it starts to fail */
+#define VIEW3D_CAMERA_BORDER_HACK
+#ifdef VIEW3D_CAMERA_BORDER_HACK
+extern float view3d_camera_border_hack_col[4];
+extern short view3d_camera_border_hack_test;
+#endif
#endif /* ED_VIEW3D_INTERN_H */
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c
index 6391db7ae5e..9290e1fc631 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -485,11 +485,8 @@ static void do_lasso_select_mesh(ViewContext *vc, int mcords[][2], short moves,
if (extend == 0 && select)
EM_deselect_all(vc->em);
- /* workaround: init mats first, EM_mask_init_backbuf_border can change
- view matrix to pixel space, breaking edge select with backbuf. fixes bug [#20936] */
-
- /* [#21018] breaks zbuf select. run below. only if bbsel fails */
- /* ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d) */
+ /* for non zbuf projections, dont change the GL state */
+ ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d);
glLoadMatrixf(vc->rv3d->viewmat);
bbsel= EM_mask_init_backbuf_border(vc, mcords, moves, rect.xmin, rect.ymin, rect.xmax, rect.ymax);
@@ -497,15 +494,13 @@ static void do_lasso_select_mesh(ViewContext *vc, int mcords[][2], short moves,
if(ts->selectmode & SCE_SELECT_VERTEX) {
if (bbsel) {
EM_backbuf_checkAndSelectVerts(vc->em, select);
- } else {
- ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); /* for foreach's screen/vert projection */
+ }
+ else {
mesh_foreachScreenVert(vc, do_lasso_select_mesh__doSelectVert, &data, 1);
}
}
if(ts->selectmode & SCE_SELECT_EDGE) {
- /* Does both bbsel and non-bbsel versions (need screen cos for both) */
- ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); /* for foreach's screen/vert projection */
-
+ /* Does both bbsel and non-bbsel versions (need screen cos for both) */
data.pass = 0;
mesh_foreachScreenEdge(vc, do_lasso_select_mesh__doSelectEdge, &data, 0);
@@ -518,8 +513,8 @@ static void do_lasso_select_mesh(ViewContext *vc, int mcords[][2], short moves,
if(ts->selectmode & SCE_SELECT_FACE) {
if (bbsel) {
EM_backbuf_checkAndSelectFaces(vc->em, select);
- } else {
- ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); /* for foreach's screen/vert projection */
+ }
+ else {
mesh_foreachScreenFace(vc, do_lasso_select_mesh__doSelectFace, &data);
}
}
@@ -1491,12 +1486,8 @@ static int do_mesh_box_select(ViewContext *vc, rcti *rect, int select, int exten
if (extend == 0 && select)
EM_deselect_all(vc->em);
- /* workaround: init mats first, EM_mask_init_backbuf_border can change
- view matrix to pixel space, breaking edge select with backbuf. fixes bug #20936 */
- /*ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d);*/ /* for foreach's screen/vert projection */
-
- /* [#21018] breaks zbuf select. run below. only if bbsel fails */
- /* ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d) */
+ /* for non zbuf projections, dont change the GL state */
+ ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d);
glLoadMatrixf(vc->rv3d->viewmat);
bbsel= EM_init_backbuf_border(vc, rect->xmin, rect->ymin, rect->xmax, rect->ymax);
@@ -1505,7 +1496,6 @@ static int do_mesh_box_select(ViewContext *vc, rcti *rect, int select, int exten
if (bbsel) {
EM_backbuf_checkAndSelectVerts(vc->em, select);
} else {
- ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d);
mesh_foreachScreenVert(vc, do_mesh_box_select__doSelectVert, &data, 1);
}
}
@@ -1525,7 +1515,6 @@ static int do_mesh_box_select(ViewContext *vc, rcti *rect, int select, int exten
if(bbsel) {
EM_backbuf_checkAndSelectFaces(vc->em, select);
} else {
- ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d);
mesh_foreachScreenFace(vc, do_mesh_box_select__doSelectFace, &data);
}
}
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index 0c4ab161e71..eeaf87757ce 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -468,8 +468,9 @@ void VIEW3D_OT_object_as_camera(wmOperatorType *ot)
void ED_view3d_calc_clipping(BoundBox *bb, float planes[4][4], bglMats *mats, rcti *rect)
{
+ float modelview[4][4];
double xs, ys, p[3];
- short val;
+ int val, flip_sign, a;
/* near zero floating point values can give issues with gluUnProject
in side view on some implementations */
@@ -493,11 +494,21 @@ void ED_view3d_calc_clipping(BoundBox *bb, float planes[4][4], bglMats *mats, rc
VECCOPY(bb->vec[4+val], p);
}
+ /* verify if we have negative scale. doing the transform before cross
+ product flips the sign of the vector compared to doing cross product
+ before transform then, so we correct for that. */
+ for(a=0; a<16; a++)
+ ((float*)modelview)[a] = mats->modelview[a];
+ flip_sign = is_negative_m4(modelview);
+
/* then plane equations */
for(val=0; val<4; val++) {
normal_tri_v3(planes[val], bb->vec[val], bb->vec[val==3?0:val+1], bb->vec[val+4]);
+ if(flip_sign)
+ negate_v3(planes[val]);
+
planes[val][3]= - planes[val][0]*bb->vec[val][0]
- planes[val][1]*bb->vec[val][1]
- planes[val][2]*bb->vec[val][2];
@@ -1560,7 +1571,7 @@ static void restore_localviewdata(ScrArea *sa, int free)
}
}
-static void endlocalview(Scene *scene, ScrArea *sa)
+static void endlocalview(Main *bmain, Scene *scene, ScrArea *sa)
{
View3D *v3d= sa->spacedata.first;
struct Base *base;
@@ -1586,6 +1597,8 @@ static void endlocalview(Scene *scene, ScrArea *sa)
base->object->lay= base->lay;
}
}
+
+ DAG_on_visible_update(bmain, FALSE);
}
}
@@ -1594,7 +1607,7 @@ static int localview_exec(bContext *C, wmOperator *UNUSED(unused))
View3D *v3d= CTX_wm_view3d(C);
if(v3d->localvd)
- endlocalview(CTX_data_scene(C), CTX_wm_area(C));
+ endlocalview(CTX_data_main(C), CTX_data_scene(C), CTX_wm_area(C));
else
initlocalview(CTX_data_main(C), CTX_data_scene(C), CTX_wm_area(C));