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:
authorTon Roosendaal <ton@blender.org>2005-11-19 13:55:07 +0300
committerTon Roosendaal <ton@blender.org>2005-11-19 13:55:07 +0300
commitec2e8d53801fad23e30294e28f1b83681d4d0f1f (patch)
tree7a73b33c1b5e8e6775b2b4791332653763e469ed
parent97c13508ff67ed95eb9a87f3173992115bcd3f82 (diff)
Finally switched to porting UI stuff from tuhopuu!
This commit is based on the patch & cool design work of Matt. It includes the new Lamp drawing style, and replaces the Object center dots with a similar styled OpenGL drawn dot. Important side-note is that removing the old glDrawPixels() for centers or lamps will not only make Blender faster, but also prevents crashing on a couple of cheaper 3d cards (as reported for S3 and Intel on-board cards) Notes: - The new default only draws Object centers when selected or active. If you like to see them always, use the View Properties Panel. You can also save that in the .B.blend - The size for centers (and lamps) is in the User settings "View & Controls" - Unselected Lamps, and their offset lines from zero Z, are drawn in a new Theme color Changes and additions in Matt's patch: - Lamps and centers are drawn fixed size, in pixels. Also the 'sun' lamp draws screen aligned now. - Center dots now also draw in blue to denote Library linkage or to show that an Object has been linked to other scenes. - When objects are empty (no vertices) they will always draw a center dot. Otherwise these objects would never be selectable anymore! - Added theme setting for center size, and initialization - Removed the old redundant code for drawing centers - Cleanup of drawing routines, made center dots faster - Started removing calls to glBlendFunc(). Regular alpha drawing should become standard, and the (very) occasional exception should return this to default after usage.
-rw-r--r--source/blender/include/BDR_drawobject.h1
-rw-r--r--source/blender/include/BIF_editarmature.h2
-rw-r--r--source/blender/include/BIF_resources.h4
-rw-r--r--source/blender/include/blendef.h1
-rw-r--r--source/blender/makesdna/DNA_userdef_types.h2
-rw-r--r--source/blender/makesdna/DNA_view3d_types.h3
-rw-r--r--source/blender/python/api2_2x/windowTheme.c4
-rw-r--r--source/blender/src/buttons_shading.c1
-rw-r--r--source/blender/src/drawarmature.c12
-rw-r--r--source/blender/src/drawobject.c480
-rw-r--r--source/blender/src/drawview.c19
-rw-r--r--source/blender/src/resources.c4
-rw-r--r--source/blender/src/space.c39
-rw-r--r--source/blender/src/usiblender.c13
14 files changed, 371 insertions, 214 deletions
diff --git a/source/blender/include/BDR_drawobject.h b/source/blender/include/BDR_drawobject.h
index 48477382690..839c1f45f42 100644
--- a/source/blender/include/BDR_drawobject.h
+++ b/source/blender/include/BDR_drawobject.h
@@ -49,7 +49,6 @@ struct BezTriple;
struct EditVert;
struct EditFace;
-void init_draw_rects(void);
void drawaxes(float size);
void drawcamera(struct Object *ob);
diff --git a/source/blender/include/BIF_editarmature.h b/source/blender/include/BIF_editarmature.h
index a079dd0ec2b..baf215a4ce2 100644
--- a/source/blender/include/BIF_editarmature.h
+++ b/source/blender/include/BIF_editarmature.h
@@ -81,7 +81,7 @@ void clear_armature(struct Object *ob, char mode);
void delete_armature(void);
void deselectall_armature(int toggle);
void deselectall_posearmature (struct Object *ob, int test);
-void draw_armature(struct Base *base, int dt);
+int draw_armature(struct Base *base, int dt);
void extrude_armature(int forked);
void subdivide_armature(void);
diff --git a/source/blender/include/BIF_resources.h b/source/blender/include/BIF_resources.h
index f7a075e55b1..8df1117c6d4 100644
--- a/source/blender/include/BIF_resources.h
+++ b/source/blender/include/BIF_resources.h
@@ -450,7 +450,9 @@ enum {
TH_BONE_POSE,
TH_STRIP,
- TH_STRIP_SELECT
+ TH_STRIP_SELECT,
+
+ TH_LAMP
};
/* XXX WARNING: previous is saved in file, so do not change order! */
diff --git a/source/blender/include/blendef.h b/source/blender/include/blendef.h
index f2f62997194..dc8c33a10ce 100644
--- a/source/blender/include/blendef.h
+++ b/source/blender/include/blendef.h
@@ -89,6 +89,7 @@
#define SELECT 1
#define ACTIVE 2
+#define DESELECT 0
#define NOT_YET 0
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 6aac12ea622..0958b3142e8 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -79,6 +79,7 @@ typedef struct ThemeSpace {
char grid[4];
char wire[4], select[4];
+ char lamp[4];
char active[4], transform[4];
char vertex[4], vertex_select[4];
char edge[4], edge_select[4];
@@ -159,6 +160,7 @@ typedef struct UserDef {
struct SolidLight light[3];
short tw_hotspot, tw_flag, tw_handlesize, tw_size;
int textimeout, texcollectrate;
+ short obcenter_dia, pad1, pad2, pad3;
} UserDef;
extern UserDef U; /* from usiblender.c !!!! */
diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h
index b745a1f59e0..bf4f44a421d 100644
--- a/source/blender/makesdna/DNA_view3d_types.h
+++ b/source/blender/makesdna/DNA_view3d_types.h
@@ -113,7 +113,7 @@ typedef struct View3D {
int lay, layact;
short scenelock, around, camzoom, flag;
- float lens, grid, gridview, pad, near, far;
+ float lens, grid, gridview, pixsize, near, far;
float ofs[3], cursor[3];
short gridlines, viewbut;
@@ -151,6 +151,7 @@ typedef struct View3D {
#define V3D_ZBUF_SELECT 4096
#define V3D_GLOBAL_STATS 8192
#define V3D_CLIPPING 16384
+#define V3D_DRAW_CENTERS 32768
/* View3D->around */
#define V3D_CENTRE 0
diff --git a/source/blender/python/api2_2x/windowTheme.c b/source/blender/python/api2_2x/windowTheme.c
index 32e59ddaee6..ca4d1603bb7 100644
--- a/source/blender/python/api2_2x/windowTheme.c
+++ b/source/blender/python/api2_2x/windowTheme.c
@@ -156,6 +156,7 @@ static PyObject *ThemeSpace_getAttr( BPy_ThemeSpace * self, char *name )
ELSEIF_TSP_RGBA( hilite )
ELSEIF_TSP_RGBA( grid )
ELSEIF_TSP_RGBA( wire )
+ ELSEIF_TSP_RGBA( lamp )
ELSEIF_TSP_RGBA( select )
ELSEIF_TSP_RGBA( active )
ELSEIF_TSP_RGBA( transform )
@@ -182,7 +183,7 @@ static PyObject *ThemeSpace_getAttr( BPy_ThemeSpace * self, char *name )
attrib = Py_BuildValue( "[sssssssssssssssssssssssssssssss]", "theme",
"back", "text", "text_hi", "header",
"panel", "shade1", "shade2", "hilite",
- "grid", "wire", "select", "active",
+ "grid", "wire", "lamp", "select", "active",
"transform", "vertex", "vertex_select",
"edge", "edge_select", "edge_seam",
"edge_facesel", "face", "face_select",
@@ -215,6 +216,7 @@ static int ThemeSpace_setAttr( BPy_ThemeSpace * self, char *name,
ELSEIF_TSP_RGBA( hilite )
ELSEIF_TSP_RGBA( grid )
ELSEIF_TSP_RGBA( wire )
+ ELSEIF_TSP_RGBA( lamp )
ELSEIF_TSP_RGBA( select )
ELSEIF_TSP_RGBA( active )
ELSEIF_TSP_RGBA( transform )
diff --git a/source/blender/src/buttons_shading.c b/source/blender/src/buttons_shading.c
index 446f85a148a..0e1ec2bfbe3 100644
--- a/source/blender/src/buttons_shading.c
+++ b/source/blender/src/buttons_shading.c
@@ -2089,6 +2089,7 @@ void do_lampbuts(unsigned short event)
Must be cleared here too when switching from ray shadow */
la->mode &= ~LA_YF_SOFT;
allqueue(REDRAWBUTSSHADING, 0);
+ allqueue(REDRAWVIEW3D, 0);
break;
}
diff --git a/source/blender/src/drawarmature.c b/source/blender/src/drawarmature.c
index 8834fa52514..e2edf634d30 100644
--- a/source/blender/src/drawarmature.c
+++ b/source/blender/src/drawarmature.c
@@ -1815,14 +1815,12 @@ static void draw_ghost_poses(Base *base)
}
-/* called from drawobject.c */
-void draw_armature(Base *base, int dt)
+/* called from drawobject.c, return 1 if nothing was drawn */
+int draw_armature(Base *base, int dt)
{
Object *ob= base->object;
bArmature *arm= ob->data;
-
- /* only set once */
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ int retval= 0;
if(dt>OB_WIRE && arm->drawtype!=ARM_LINE) {
/* we use color for solid lighting */
@@ -1844,7 +1842,7 @@ void draw_armature(Base *base, int dt)
}
else{
/* Draw Pose */
- if(ob->pose) {
+ if(ob->pose && ob->pose->chanbase.first) {
/* drawing posemode selection indices or colors only in these cases */
if(G.f & G_PICKSEL) {
if(ob->flag & OB_POSEMODE) arm->flag |= ARM_POSEMODE;
@@ -1869,10 +1867,12 @@ void draw_armature(Base *base, int dt)
if(ob->flag & OB_POSEMODE)
BIF_ThemeColor(TH_WIRE); /* restore, for extra draw stuff */
}
+ else retval= 1;
}
/* restore */
glFrontFace(GL_CCW);
+ return retval;
}
/* *************** END Armature drawing ******************* */
diff --git a/source/blender/src/drawobject.c b/source/blender/src/drawobject.c
index 3290457165c..dc11ae44f25 100644
--- a/source/blender/src/drawobject.c
+++ b/source/blender/src/drawobject.c
@@ -64,6 +64,7 @@
#include "DNA_space_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
+#include "DNA_userdef_types.h"
#include "DNA_view3d_types.h"
#include "DNA_world_types.h"
@@ -146,7 +147,6 @@ static int set_gl_material(int nr)
/* matbuf alpha: 0.0 = skip draw, 1.0 = no blending, else blend */
if(matbuf[nr][0][3]!= 0.0 && matbuf[nr][0][3]!= 1.0) {
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
}
else
@@ -218,30 +218,13 @@ static int init_gl_materials(Object *ob)
/***/
-
-unsigned int rect_desel[16]= {0x707070,0x0,0x0,0x707070,0x407070,0x70cccc,0x407070,0x0,0xaaffff,0xffffff,0x70cccc,0x0,0x70cccc,0xaaffff,0x407070,0x707070};
-unsigned int rect_sel[16]= {0x707070,0x0,0x0,0x707070,0x702070,0xcc50cc,0x702070,0x0,0xff80ff,0xffffff,0xcc50cc,0x0,0xcc50cc,0xff80ff,0x702070,0x707070};
-
-unsigned int rectu_desel[16]= {0xff4e4e4e,0xff5c2309,0xff000000,0xff4e4f4d,0xff000000,0xffff9d72,0xffff601c,0xff000000,0xff5d2409,0xffffffff,0xffff9d72,0xff5b2209,0xff4e4e4e,0xff5c2309,0xff010100,0xff4f4f4f};
-unsigned int rectu_sel[16]= {0xff4e4e4e,0xff403c00,0xff000000,0xff4e4e4d,0xff000000,0xfffff64c,0xffaaa100,0xff000000,0xff403c00,0xffffffff,0xfffff64c,0xff403c00,0xff4f4f4f,0xff403c00,0xff010100,0xff4e4e4e};
-
-unsigned int rectl_desel[81]= {0x777777,0x777777,0xa9fefe,0xaaffff,0xaaffff,0xaaffff,0xaaffff,0x777777,0x777777,0x777777,0xa9fefe,0xaafefe,0x777777,0x777777,0x777777,0xa9fefe,0xa9fefe,0x777777,0xaaffff,0xa9fefe,0x4e4e4e,0x0,0x124040,0x0,0x4e4e4e,0xaafefe,0xaaffff,0xaaffff,0x777777,0x0,0x227777,0x55cccc,0x227777,0x0,0x777777,0xaaffff,0xaaffff,0x777777,0x124040,0x88ffff,0xffffff,0x55cccc,0x124040,0x777777,0xaaffff,0xaaffff,0x777777,0x0,0x55cccc,0x88ffff,0x227777,0x0,0x777777,0xaaffff,0xaafefe,0xaafefe,0x4f4f4f,0x0,0x124040,0x0,0x4e4e4e,0xa9fefe,0xaaffff,0x777777,0xa9fefe,0xa9fefe,0x777777,0x777777,0x777777,0xa9fefe,0xa9fefe,0x777777,0x777777,0x777777,0xa9fefe,0xa9fefe,0xaaffff,0xaaffff,0xaaffff,0x777777,0x777777};
-unsigned int rectl_sel[81]= {0x777777,0x777777,0xffaaff,0xffaaff,0xffaaff,0xffaaff,0xffaaff,0x777777,0x777777,0x777777,0xffaaff,0xffaaff,0x777777,0x777777,0x777777,0xffaaff,0xffaaff,0x777777,0xffaaff,0xffaaff,0x4e4e4e,0x10101,0x402440,0x0,0x4e4e4e,0xffaaff,0xffaaff,0xffaaff,0x777777,0x0,0x774477,0xcc77cc,0x774477,0x0,0x777777,0xffaaff,0xffaaff,0x777777,0x402440,0xffaaff,0xffffff,0xcc77cc,0x412541,0x777777,0xffaaff,0xffaaff,0x777777,0x10101,0xcc77cc,0xffaaff,0x774477,0x0,0x777777,0xffaaff,0xffaaff,0xffaaff,0x4e4e4e,0x10101,0x402440,0x0,0x4e4e4e,0xffaaff,0xffaaff,0x777777,0xffaaff,0xffaaff,0x777777,0x777777,0x777777,0xffaaff,0xffaaff,0x777777,0x777777,0x777777,0xffaaff,0xffaaff,0xffaaff,0xffaaff,0xffaaff,0x777777,0x777777};
-unsigned int rectlus_desel[81]= {0x777777,0x777777,0xa9fefe,0xaaffff,0xaaffff,0xaaffff,0xaaffff,0x777777,0x777777,0x777777,0xa9fefe,0xaafefe,0x777777,0x777777,0x777777,0xa9fefe,0xa9fefe,0x777777,0xaaffff,0xa9fefe,0x4e4e4e,0x0,0x5c2309,0x0,0x4e4f4d,0xaafefe,0xaaffff,0xaaffff,0x777777,0x0,0xff601c,0xff9d72,0xff601c,0x0,0x777777,0xaaffff,0xaaffff,0x777777,0x5d2409,0xffceb8,0xff9d72,0xff9d72,0x5b2209,0x777777,0xaaffff,0xaaffff,0x777777,0x10100,0xffceb8,0xffceb8,0xff601c,0x0,0x777777,0xaaffff,0xaafefe,0xaafefe,0x4e4e4e,0x0,0x5c2309,0x10100,0x4f4f4f,0xa9fefe,0xaaffff,0x777777,0xa9fefe,0xa9fefe,0x777777,0x777777,0x777777,0xa9fefe,0xa9fefe,0x777777,0x777777,0x777777,0xa9fefe,0xa9fefe,0xaaffff,0xaaffff,0xaaffff,0x777777,0x777777};
-unsigned int rectlus_sel[81]= {0x777777,0x777777,0xffaaff,0xffaaff,0xffaaff,0xffaaff,0xffaaff,0x777777,0x777777,0x777777,0xffaaff,0xffaaff,0x777777,0x777777,0x777777,0xffaaff,0xffaaff,0x777777,0xffaaff,0xffaaff,0x4e4e4e,0x10100,0x403c00,0x0,0x4e4e4d,0xffaaff,0xffaaff,0xffaaff,0x777777,0x0,0xaaa100,0xfff64c,0xaaa100,0x0,0x777777,0xffaaff,0xffaaff,0x777777,0x403c00,0xfffde2,0xffffff,0xfff64c,0x403c00,0x777777,0xffaaff,0xffaaff,0x777777,0x10100,0xfff64c,0xfffde2,0xaaa100,0x0,0x777777,0xffaaff,0xffaaff,0xffaaff,0x4f4f4f,0x0,0x403c00,0x10100,0x4e4e4e,0xffaaff,0xffaaff,0x777777,0xffaaff,0xffaaff,0x777777,0x777777,0x777777,0xffaaff,0xffaaff,0x777777,0x777777,0x777777,0xffaaff,0xffaaff,0xffaaff,0xffaaff,0xffaaff,0x777777,0x777777};
-unsigned int rectllib_desel[81]= {0xff777777,0xff777777,0xb9b237,0xb9b237,0xb9b237,0xb9b237,0xb9b237,0xff777777,0xff777777,0xff777777,0xb9b237,0xb9b237,0xff777777,0xff777777,0xff777777,0xb9b237,0xb9b237,0xff777777,0xb9b237,0xb9b237,0x4e4e4e,0x0,0x5c2309,0x0,0x4e4f4d,0xb9b237,0xb9b237,0xb9b237,0xff777777,0x0,0xff601c,0xff9d72,0xff601c,0x0,0xff777777,0xb9b237,0xb9b237,0xff777777,0x5d2409,0xffceb8,0xff9d72,0xff9d72,0x5b2209,0xff777777,0xb9b237,0xb9b237,0xff777777,0x10100,0xffceb8,0xffceb8,0xff601c,0x0,0xff777777,0xb9b237,0xb9b237,0xb9b237,0x4e4e4e,0x0,0x5c2309,0x10100,0x4f4f4f,0xb9b237,0xb9b237,0xff777777,0xb9b237,0xb9b237,0xff777777,0xff777777,0xff777777,0xb9b237,0xb9b237,0xff777777,0xff777777,0xff777777,0xb9b237,0xb9b237,0xb9b237,0xb9b237,0xb9b237,0xff777777,0xff777777};
-unsigned int rectllib_sel[81]= {0xff777777,0xff777777,0xfff64c,0xfff64c,0xfff64c,0xfff64c,0xfff64c,0xff777777,0xff777777,0xff777777,0xfff64c,0xfff64c,0xff777777,0xff777777,0xff777777,0xfff64c,0xfff64c,0xff777777,0xfff64c,0xfff64c,0x4e4e4e,0x10100,0x403c00,0x0,0x4e4e4d,0xfff64c,0xfff64c,0xfff64c,0xff777777,0x0,0xaaa100,0xfff64c,0xaaa100,0x0,0xff777777,0xfff64c,0xfff64c,0xff777777,0x403c00,0xfffde2,0xffffff,0xfff64c,0x403c00,0xff777777,0xfff64c,0xfff64c,0xff777777,0x10100,0xfff64c,0xfffde2,0xaaa100,0x0,0xff777777,0xfff64c,0xfff64c,0xfff64c,0x4f4f4f,0x0,0x403c00,0x10100,0x4e4e4e,0xfff64c,0xfff64c,0xff777777,0xfff64c,0xfff64c,0xff777777,0xff777777,0xff777777,0xfff64c,0xfff64c,0xff777777,0xff777777,0xff777777,0xfff64c,0xfff64c,0xfff64c,0xfff64c,0xfff64c,0xff777777,0xff777777};
-
-unsigned int rectl_set[81]= {0xff777777,0xff777777,0xaaaaaa,0xaaaaaa,0xaaaaaa,0xaaaaaa,0xaaaaaa,0xff777777,0xff777777,0xff777777,0xaaaaaa,0xaaaaaa,0xff777777,0xff777777,0xff777777,0xaaaaaa,0xaaaaaa,0xff777777,0xaaaaaa,0xaaaaaa,0x4e4e4e,0x10100,0x202020,0x0,0x4e4e4d,0xaaaaaa,0xaaaaaa,0xaaaaaa,0xff777777,0x0,0xaaa100,0xaaaaaa,0xaaa100,0x0,0xff777777,0xaaaaaa,0xaaaaaa,0xff777777,0x202020,0xfffde2,0xffffff,0xaaaaaa,0x202020,0xff777777,0xaaaaaa,0xaaaaaa,0xff777777,0x10100,0xaaaaaa,0xfffde2,0xaaa100,0x0,0xff777777,0xaaaaaa,0xaaaaaa,0xaaaaaa,0x4f4f4f,0x0,0x202020,0x10100,0x4e4e4e,0xaaaaaa,0xaaaaaa,0xff777777,0xaaaaaa,0xaaaaaa,0xff777777,0xff777777,0xff777777,0xaaaaaa,0xaaaaaa,0xff777777,0xff777777,0xff777777,0xaaaaaa,0xaaaaaa,0xaaaaaa,0xaaaaaa,0xaaaaaa,0xff777777,0xff777777};
-
-
static unsigned int colortab[24]=
{0x0, 0xFF88FF, 0xFFBBFF,
0x403000, 0xFFFF88, 0xFFFFBB,
0x104040, 0x66CCCC, 0x77CCCC,
0x101040, 0x5588FF, 0x88BBFF,
0xFFFFFF
- };
+};
static float cube[8][3] = {
@@ -255,48 +238,6 @@ static float cube[8][3] = {
{ 1.0, 1.0, -1.0},
};
-void init_draw_rects(void)
-{
- if(G.order==B_ENDIAN) {
- IMB_convert_rgba_to_abgr(16, rect_desel);
- IMB_convert_rgba_to_abgr(16, rect_sel);
-
- IMB_convert_rgba_to_abgr(16, rectu_desel);
- IMB_convert_rgba_to_abgr(16, rectu_sel);
-
- IMB_convert_rgba_to_abgr(81, rectl_desel);
- IMB_convert_rgba_to_abgr(81, rectl_sel);
-
- IMB_convert_rgba_to_abgr(81, rectlus_desel);
- IMB_convert_rgba_to_abgr(81, rectlus_sel);
-
- IMB_convert_rgba_to_abgr(81, rectllib_desel);
- IMB_convert_rgba_to_abgr(81, rectllib_sel);
-
- IMB_convert_rgba_to_abgr(81, rectl_set);
- }
-}
-
-static void draw_icon_centered(float *pos, unsigned int *rect, int rectsize)
-{
- float hsize= (float) rectsize/2.0f;
-// float vals[4];
- GLubyte dummy= 0;
-
- glRasterPos3fv(pos);
-// glGetFloatv(GL_CURRENT_RASTER_POSITION_VALID, vals);
-// printf("rasterpos %f\n", vals[0]);
-// glGetFloatv(GL_CURRENT_RASTER_POSITION, vals);
-// printf("pos %f %f %f %f\n", vals[0], vals[1], vals[2], vals[3]);
-
- /* use bitmap to shift rasterpos in pixels */
- glBitmap(0, 0, 0.0, 0.0, -hsize, -hsize, &dummy);
-#if defined (__sun__) || defined ( __sun ) || defined (__sparc) || defined (__sparc__)
- glFlush();
-#endif
- glDrawPixels(rectsize, rectsize, GL_RGBA, GL_UNSIGNED_BYTE, rect);
-}
-
void drawaxes(float size)
{
int axis;
@@ -338,6 +279,37 @@ void drawaxes(float size)
}
}
+/* circle for object centers, special_color is for library or ob users */
+static void drawcentercircle(float *vec, int selstate, int special_color)
+{
+ View3D *v3d= G.vd;
+ float size;
+
+ size= v3d->persmat[0][3]*vec[0]+ v3d->persmat[1][3]*vec[1]+ v3d->persmat[2][3]*vec[2]+ v3d->persmat[3][3];
+ size*= v3d->pixsize*((float)U.obcenter_dia*0.5f);
+
+ if(v3d->zbuf) glDisable(GL_DEPTH_TEST);
+ glEnable(GL_BLEND);
+
+ if(special_color) {
+ if (selstate==ACTIVE || selstate==SELECT) glColor4ub(0x88, 0xFF, 0xFF, 155);
+ else glColor4ub(0x55, 0xCC, 0xCC, 155);
+ }
+ else {
+ if (selstate == ACTIVE) BIF_ThemeColorShadeAlpha(TH_ACTIVE, 0, -100);
+ else if (selstate == SELECT) BIF_ThemeColorShadeAlpha(TH_SELECT, 0, -100);
+ else if (selstate == DESELECT) BIF_ThemeColorShadeAlpha(TH_WIRE, 0, -100);
+ }
+ drawcircball(GL_POLYGON, vec, size, v3d->viewinv);
+
+ if (selstate == ACTIVE) glColor4ub(255, 255, 255, 80);
+ else if ((selstate == SELECT) || (selstate == DESELECT)) glColor4ub(0, 0, 0, 80);
+ drawcircball(GL_LINE_LOOP, vec, size, v3d->viewinv);
+
+ glDisable(GL_BLEND);
+ if(v3d->zbuf) glEnable(GL_DEPTH_TEST);
+}
+
void drawsolidcube(float size)
{
@@ -443,7 +415,7 @@ static void drawcube_size(float *size)
}
#endif
-static void tekenshadbuflimits(Lamp *la, float mat[][4])
+static void drawshadbuflimits(Lamp *la, float mat[][4])
{
float sta[3], end[3], lavec[3];
@@ -542,21 +514,106 @@ static void spotvolume(float *lvec, float *vvec, float inp)
return;
}
-
-
static void drawlamp(Object *ob)
{
Lamp *la;
- float vec[3], lvec[3], vvec[3],x,y,z;
+ View3D *v3d= G.vd;
+ float vec[3], lvec[3], vvec[3], circrad, x,y,z;
+ float pixsize, lampsize;
+ float imat[4][4], curcol[4];
+ char col[4];
la= ob->data;
- vec[0]=vec[1]=vec[2]= 0.0;
- setlinestyle(4);
+ /* we first draw only the screen aligned & fixed scale stuff */
+ glPushMatrix();
+ myloadmatrix(G.vd->viewmat);
+
+ /* lets calculate the scale: */
+ pixsize= v3d->persmat[0][3]*ob->obmat[3][0]+ v3d->persmat[1][3]*ob->obmat[3][1]+ v3d->persmat[2][3]*ob->obmat[3][2]+ v3d->persmat[3][3];
+ pixsize*= v3d->pixsize;
+ lampsize= pixsize*((float)U.obcenter_dia*0.5f);
+
+ /* and view aligned matrix: */
+ Mat4CpyMat4(imat, G.vd->viewinv);
+ Normalise(imat[0]);
+ Normalise(imat[1]);
+
+ /* for AA effects */
+ glGetFloatv(GL_CURRENT_COLOR, curcol);
+ curcol[3]= 0.6;
+ glColor4fv(curcol);
- /* yafray: for photonlight also draw lightcone as for spot */
- if ((la->type==LA_SPOT) || (la->type==LA_YF_PHOTON)) {
+ if(ob->id.us>1) {
+ if (ob==OBACT || (ob->flag & SELECT)) glColor4ub(0x88, 0xFF, 0xFF, 155);
+ else glColor4ub(0x77, 0xCC, 0xCC, 155);
+ }
+
+ /* Inner Circle */
+ VECCOPY(vec, ob->obmat[3]);
+ glEnable(GL_BLEND);
+ drawcircball(GL_LINE_LOOP, vec, lampsize, imat);
+ glDisable(GL_BLEND);
+ drawcircball(GL_POLYGON, vec, lampsize, imat);
+
+ /* restore */
+ if(ob->id.us>1)
+ glColor4fv(curcol);
+
+ /* Outer circle */
+ circrad = 3.0f*lampsize;
+ drawcircball(GL_LINE_LOOP, vec, circrad, imat);
+
+ setlinestyle(3);
+
+ /* draw dashed outer circle if shadow is on */
+ if ((la->mode & LA_SHAD) || (la->mode & LA_SHAD_RAY)) {
+ drawcircball(GL_LINE_LOOP, vec, circrad + 3.0f*pixsize, imat);
+ }
+
+ /* 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 */
+ VecRotToMat3(imat[2], M_PI/4.0f, mat);
+ /* vectors */
+ VECCOPY(v1, imat[0]);
+ VecMulf(v1, circrad*1.2f);
+ VECCOPY(v2, imat[0]);
+ VecMulf(v2, circrad*2.5f);
+
+ /* center */
+ glTranslatef(vec[0], vec[1], vec[2]);
+
+ setlinestyle(3);
+
+ glBegin(GL_LINES);
+ for (axis=0; axis<8; axis++) {
+ glVertex3fv(v1);
+ glVertex3fv(v2);
+ Mat3MulVecfl(mat, v1);
+ Mat3MulVecfl(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);
+ }
+ /* yafray: for photonlight also draw lightcone as for spot */
+ }
+
+ glPopMatrix(); /* back in object space */
+ vec[0]= vec[1]= vec[2]= 0.0f;
+
+ if ((la->type==LA_SPOT) || (la->type==LA_YF_PHOTON)) {
lvec[0]=lvec[1]= 0.0;
lvec[2] = 1.0;
x = G.vd->persmat[0][2];
@@ -576,6 +633,7 @@ static void drawlamp(Object *ob)
vvec[1] *= x ;
vvec[2] *= x;
+ /* draw the angled sides of the cone */
glBegin(GL_LINE_STRIP);
glVertex3fv(vvec);
glVertex3fv(vec);
@@ -585,7 +643,8 @@ static void drawlamp(Object *ob)
z = x*sqrt(1.0 - y*y);
x *= y;
- glTranslatef(0.0 , 0.0 , x);
+ /* draw the circle/square at the end of the cone */
+ glTranslatef(0.0, 0.0 , x);
if(la->mode & LA_SQUARE) {
vvec[0]= fabs(z);
vvec[1]= fabs(z);
@@ -602,58 +661,111 @@ static void drawlamp(Object *ob)
}
else circ(0.0, 0.0, fabs(z));
+ /* draw the circle/square representing spotbl */
+ if(la->type==LA_SPOT) {
+ float spotblcirc = fabs(z)*(1 - pow(la->spotblend, 2));
+ /* make sure the line is always visible - prevent it from reaching the outer border (or 0)
+ * values are kinda arbitrary - just what seemed to work well */
+ if (spotblcirc == 0) spotblcirc = 0.15;
+ else if (spotblcirc == fabs(z)) spotblcirc = fabs(z) - 0.07;
+ circ(0.0, 0.0, spotblcirc);
+ }
+
}
else if ELEM(la->type, LA_HEMI, LA_SUN) {
+
+ /* draw the line from the circle along the dist */
glBegin(GL_LINE_STRIP);
+ vec[2] = -circrad;
glVertex3fv(vec);
vec[2]= -la->dist;
glVertex3fv(vec);
glEnd();
- }
- else {
- if(la->type==LA_AREA) {
- setlinestyle(0);
- if(la->area_shape==LA_AREA_SQUARE)
- fdrawbox(-la->area_size*0.5, -la->area_size*0.5, la->area_size*0.5, la->area_size*0.5);
- else if(la->area_shape==LA_AREA_RECT)
- fdrawbox(-la->area_size*0.5, -la->area_sizey*0.5, la->area_size*0.5, la->area_sizey*0.5);
- setlinestyle(3);
- glBegin(GL_LINE_STRIP);
- glVertex3f(0.0,0.0,0.0);
- glVertex3f(0.0,0.0,-la->dist);
- glEnd();
- setlinestyle(0);
- }
- else if(la->mode & LA_SPHERE) {
-
- float tmat[4][4], imat[4][4];
-
- vec[0]= vec[1]= vec[2]= 0.0;
- mygetmatrix(tmat);
- Mat4Invert(imat, tmat);
+
+ if(la->type==LA_HEMI) {
+ /* draw the hemisphere curves */
+ short axis, steps, dir;
+ float outdist, zdist, mul;
+ vec[0]=vec[1]=vec[2]= 0.0;
+ outdist = 0.18; mul = 1.4; dir = 1;
- drawcircball(GL_LINE_LOOP, vec, la->dist, imat);
-
+ 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 */
+ if (steps == 0) v[0] = dir*circrad;
+ else v[0] = v[0] + dir*(steps*outdist);
+ } else if (axis == 2 || axis == 3) { /* y axis up, y axis down */
+ /* make the arcs start at the edge of the energy circle */
+ if (steps == 0) v[1] = dir*circrad;
+ else v[1] = v[1] + dir*(steps*outdist);
+ }
+
+ v[2] = v[2] - steps*zdist;
+
+ glVertex3fv(v);
+
+ zdist = zdist * mul;
+ }
+
+ glEnd();
+ /* flip the direction */
+ dir = -dir;
+ }
}
+ } else if(la->type==LA_AREA) {
+ setlinestyle(3);
+ if(la->area_shape==LA_AREA_SQUARE)
+ fdrawbox(-la->area_size*0.5, -la->area_size*0.5, la->area_size*0.5, la->area_size*0.5);
+ else if(la->area_shape==LA_AREA_RECT)
+ fdrawbox(-la->area_size*0.5, -la->area_sizey*0.5, la->area_size*0.5, la->area_sizey*0.5);
+
+ glBegin(GL_LINE_STRIP);
+ glVertex3f(0.0,0.0,-circrad);
+ glVertex3f(0.0,0.0,-la->dist);
+ glEnd();
}
-
- glPushMatrix();
- glLoadMatrixf(G.vd->viewmat);
+ /* and back to viewspace */
+ myloadmatrix(G.vd->viewmat);
VECCOPY(vec, ob->obmat[3]);
+
+ setlinestyle(0);
+
+ if(la->type==LA_SPOT && (la->mode & LA_SHAD) ) {
+ drawshadbuflimits(la, ob->obmat);
+ }
+
+ BIF_GetThemeColor4ubv(TH_LAMP, col);
+ glColor4ub(col[0], col[1], col[2], col[3]);
+
+ glEnable(GL_BLEND);
+
+ if (vec[2]>0) vec[2] -= circrad;
+ else vec[2] += circrad;
- setlinestyle(3);
glBegin(GL_LINE_STRIP);
glVertex3fv(vec);
vec[2]= 0;
glVertex3fv(vec);
glEnd();
- setlinestyle(0);
- if(la->type==LA_SPOT && (la->mode & LA_SHAD) ) {
- tekenshadbuflimits(la, ob->obmat);
- }
- glPopMatrix();
+ glPointSize(2.0);
+ glBegin(GL_POINTS);
+ glVertex3fv(vec);
+ glEnd();
+ glPointSize(1.0);
+
+ glDisable(GL_BLEND);
+
+
}
static void draw_limit_line(float sta, float end, unsigned int col)
@@ -1270,7 +1382,6 @@ static void draw_em_fancy_verts(EditMesh *em, DerivedMesh *cageDM)
if(G.vd->zbuf && !(G.vd->flag&V3D_ZBUF_SELECT)) {
glDisable(GL_DEPTH_TEST);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
} else {
continue;
@@ -1319,7 +1430,6 @@ static void draw_em_fancy_edges(DerivedMesh *cageDM)
/* show wires in transparant when no zbuf clipping for select */
if (pass==0) {
if (G.vd->zbuf && (G.vd->flag & V3D_ZBUF_SELECT)==0) {
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
glDisable(GL_DEPTH_TEST);
@@ -1554,7 +1664,6 @@ static void draw_em_fancy(Object *ob, EditMesh *em, DerivedMesh *cageDM, Derived
BIF_GetThemeColor4ubv(TH_FACE, col1);
BIF_GetThemeColor4ubv(TH_FACE_SELECT, col2);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
glDepthMask(0); // disable write in zbuffer, needed for nice transp
@@ -1773,11 +1882,12 @@ static void draw_mesh_fancy(Object *ob, DerivedMesh *baseDM, DerivedMesh *dm, in
}
}
-static void draw_mesh_object(Base *base, int dt)
+/* returns 1 if nothing was drawn, for detecting to draw an object center */
+static int draw_mesh_object(Base *base, int dt)
{
Object *ob= base->object;
Mesh *me= ob->data;
- int has_alpha= 0, drawlinked= 0;
+ int has_alpha= 0, drawlinked= 0, retval= 0;
if(G.obedit && ob!=G.obedit && ob->data==G.obedit->data) {
if(ob_get_key(ob));
@@ -1812,7 +1922,9 @@ static void draw_mesh_object(Base *base, int dt)
if(dt==OB_SOLID) has_alpha= init_gl_materials(ob);
if(baseDM && realDM) draw_mesh_fancy(ob, baseDM, realDM, dt);
-
+
+ if(me->totvert==0) retval= 1;
+
if (baseDMneedsFree) baseDM->release(baseDM);
if (realDMneedsFree) realDM->release(realDM);
}
@@ -1820,6 +1932,8 @@ static void draw_mesh_object(Base *base, int dt)
/* init_gl_materials did the proper checking if this is needed */
if(has_alpha) add_view3d_after(G.vd, base, V3D_TRANSP);
+
+ return retval;
}
/* ************** DRAW DISPLIST ****************** */
@@ -1827,13 +1941,14 @@ static void draw_mesh_object(Base *base, int dt)
static int draw_index_wire= 1;
static int index3_nors_incr= 1;
-static void drawDispListwire(ListBase *dlbase)
+/* returns 1 when nothing was drawn */
+static int drawDispListwire(ListBase *dlbase)
{
DispList *dl;
int parts, nr, ofs, *index;
float *data;
- if(dlbase==0) return;
+ if(dlbase==NULL) return 1;
dl= dlbase->first;
while(dl) {
@@ -1930,6 +2045,7 @@ static void drawDispListwire(ListBase *dlbase)
}
dl= dl->next;
}
+ return 0;
}
static void drawDispListsolid(ListBase *lb, Object *ob)
@@ -2227,13 +2343,13 @@ static void drawDispListshaded(ListBase *lb, Object *ob)
glShadeModel(GL_FLAT);
}
-static void drawDispList(Object *ob, int dt)
+/* returns 1 when nothing was drawn */
+static int drawDispList(Object *ob, int dt)
{
ListBase *lb=0;
DispList *dl;
Curve *cu;
- int solid;
-
+ int solid, retval= 0;
solid= (dt > OB_WIRE);
@@ -2246,7 +2362,7 @@ static void drawDispList(Object *ob, int dt)
if(solid) {
dl= lb->first;
- if(dl==0) return;
+ if(dl==NULL) return 1;
if(dl->nors==0) addnormalsDispList(ob, lb);
index3_nors_incr= 0;
@@ -2277,7 +2393,7 @@ static void drawDispList(Object *ob, int dt)
}
else {
draw_index_wire= 0;
- drawDispListwire(lb);
+ retval= drawDispListwire(lb);
draw_index_wire= 1;
}
break;
@@ -2287,12 +2403,12 @@ static void drawDispList(Object *ob, int dt)
if(solid) {
dl= lb->first;
- if(dl==0) return;
+ if(dl==NULL) return 1;
- if(dl->nors==0) addnormalsDispList(ob, lb);
+ if(dl->nors==NULL) addnormalsDispList(ob, lb);
if(dt==OB_SHADED) {
- if(ob->disp.first==0) shadeDispList(ob);
+ if(ob->disp.first==NULL) shadeDispList(ob);
drawDispListshaded(lb, ob);
}
else {
@@ -2303,15 +2419,16 @@ static void drawDispList(Object *ob, int dt)
}
}
else {
- drawDispListwire(lb);
+ retval= drawDispListwire(lb);
}
break;
case OB_MBALL:
if( is_basis_mball(ob)) {
lb= &ob->disp;
- if(lb->first==0) makeDispListMBall(ob);
-
+ if(lb->first==NULL) makeDispListMBall(ob);
+ if(lb->first==NULL) return 1;
+
if(solid) {
if(dt==OB_SHADED) {
@@ -2328,12 +2445,13 @@ static void drawDispList(Object *ob, int dt)
}
else{
/* MetaBalls use DL_INDEX4 type of DispList */
- drawDispListwire(lb);
+ retval= drawDispListwire(lb);
}
}
break;
}
+ return retval;
}
/* ******************************** */
@@ -2937,7 +3055,8 @@ void drawcircball(int mode, float *cent, float rad, float tmat[][4])
glEnd();
}
-static void drawmball(Object *ob, int dt)
+/* return 1 if nothing was drawn */
+static int drawmball(Object *ob, int dt)
{
MetaBall *mb;
MetaElem *ml;
@@ -2956,6 +3075,8 @@ static void drawmball(Object *ob, int dt)
ml= mb->elems.first;
}
+ if(ml==NULL) return 1;
+
/* in case solid draw, reset wire colors */
if(ob!=G.obedit && (ob->flag & SELECT)) {
if(ob==OBACT) BIF_ThemeColor(TH_ACTIVE);
@@ -2996,6 +3117,7 @@ static void drawmball(Object *ob, int dt)
ml= ml->next;
}
+ return 0;
}
static void draw_forcefield(Object *ob)
@@ -3346,19 +3468,18 @@ static void draw_hooks(Object *ob)
void draw_object(Base *base)
{
+ static int warning_recursive= 0;
Object *ob;
Curve *cu;
- ListBase elems;
- CfraElem *ce;
- float cfraont, axsize=1.0;
- unsigned int *rect, col=0;
- static int warning_recursive= 0;
+ float cfraont;
+ float vec1[3], vec2[3];
+ unsigned int col=0;
int sel, drawtype, colindex= 0, ipoflag;
+ int i, selstart, selend, empty_object=0;
short dt, dtx, zbufoff= 0;
- float vec1[3], vec2[3];
- int i, selstart, selend;
- SelBox *sb;
- float selboxw;
+
+ /* only once set now, will be removed too, should become a global standard */
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
ob= base->object;
@@ -3374,6 +3495,8 @@ void draw_object(Base *base)
if(base==(G.scene->basact) || (base->flag & (SELECT+BA_WAS_SEL))) {
if(warning_recursive==0 && ob!=G.obedit) {
if(ob->ipo && ob->ipo->showkey && (ob->ipoflag & OB_DRAWKEY)) {
+ ListBase elems;
+ CfraElem *ce;
float temp[7][3];
warning_recursive= 1;
@@ -3453,7 +3576,9 @@ void draw_object(Base *base)
if((G.moving & G_TRANSFORM_OBJ) && (base->flag & (SELECT+BA_WAS_SEL))) BIF_ThemeColor(TH_TRANSFORM);
else {
- BIF_ThemeColor(TH_WIRE);
+ if(ob->type==OB_LAMP) BIF_ThemeColor(TH_LAMP);
+ else BIF_ThemeColor(TH_WIRE);
+
if((G.scene->basact)==base) {
if(base->flag & (SELECT+BA_WAS_SEL)) BIF_ThemeColor(TH_ACTIVE);
}
@@ -3531,7 +3656,7 @@ void draw_object(Base *base)
switch( ob->type) {
case OB_MESH:
if (!(base->flag&OB_RADIO)) {
- draw_mesh_object(base, dt);
+ empty_object= draw_mesh_object(base, dt);
dtx &= ~OB_DRAWWIRE; // mesh draws wire itself
if(G.obedit!=ob && warning_recursive==0) {
@@ -3605,10 +3730,13 @@ void draw_object(Base *base)
if (getselection(&selstart, &selend) && selboxes) {
+ float selboxw;
+
cpack(0xffffff);
set_inverted_drawing(1);
for (i=0; i<(selend-selstart+1); i++) {
- sb = &(selboxes[i]);
+ SelBox *sb = &(selboxes[i]);
+
if (i<(selend-selstart)) {
if (selboxes[i+1].y == sb->y)
selboxw= selboxes[i+1].x - sb->x;
@@ -3628,8 +3756,10 @@ void draw_object(Base *base)
set_inverted_drawing(0);
}
}
- else if(dt==OB_BOUNDBOX) draw_bounding_volume(ob);
- else if(boundbox_clip(ob->obmat, cu->bb)) drawDispList(ob, dt);
+ else if(dt==OB_BOUNDBOX)
+ draw_bounding_volume(ob);
+ else if(boundbox_clip(ob->obmat, cu->bb))
+ empty_object= drawDispList(ob, dt);
break;
case OB_CURVE:
@@ -3641,20 +3771,26 @@ void draw_object(Base *base)
if(ob==G.obedit) {
drawnurb(ob, editNurb.first, dt);
}
- else if(dt==OB_BOUNDBOX) draw_bounding_volume(ob);
- else if(boundbox_clip(ob->obmat, cu->bb)) drawDispList(ob, dt);
+ else if(dt==OB_BOUNDBOX)
+ draw_bounding_volume(ob);
+ else if(boundbox_clip(ob->obmat, cu->bb))
+ empty_object= drawDispList(ob, dt);
break;
case OB_MBALL:
- if(ob==G.obedit) drawmball(ob, dt);
- else if(dt==OB_BOUNDBOX) draw_bounding_volume(ob);
- else drawmball(ob, dt);
+ if(ob==G.obedit)
+ drawmball(ob, dt);
+ else if(dt==OB_BOUNDBOX)
+ draw_bounding_volume(ob);
+ else
+ empty_object= drawmball(ob, dt);
break;
case OB_EMPTY:
drawaxes(1.0);
break;
case OB_LAMP:
drawlamp(ob);
+ if(dtx || (base->flag & SELECT)) mymultmatrix(ob->obmat);
break;
case OB_CAMERA:
drawcamera(ob);
@@ -3664,7 +3800,7 @@ void draw_object(Base *base)
break;
case OB_ARMATURE:
if(dt>OB_WIRE) set_gl_material(0); // we use defmaterial
- draw_armature(base, dt);
+ empty_object= draw_armature(base, dt);
break;
default:
drawaxes(1.0);
@@ -3676,7 +3812,7 @@ void draw_object(Base *base)
if(dtx) {
if(G.f & G_SIMULATION);
else if(dtx & OB_AXIS) {
- drawaxes(axsize);
+ drawaxes(1.0f);
}
if(dtx & OB_BOUNDBOX) draw_bounding_volume(ob);
if(dtx & OB_TEXSPACE) drawtexspace(ob);
@@ -3714,6 +3850,18 @@ void draw_object(Base *base)
if(warning_recursive) return;
if(base->flag & (OB_FROMDUPLI|OB_RADIO)) return;
if(G.f & G_SIMULATION) return;
+
+ /* object centers, need to be drawn in viewmat space for speed, but OK for picking select */
+ if((G.f & (G_VERTEXPAINT|G_FACESELECT|G_TEXTUREPAINT|G_WEIGHTPAINT))==0) {
+ if(ob->type!=OB_LAMP) {
+ if((G.scene->basact)==base)
+ drawcentercircle(ob->obmat[3], ACTIVE, ob->id.lib || ob->id.us>1);
+ else if(base->flag & SELECT)
+ drawcentercircle(ob->obmat[3], SELECT, ob->id.lib || ob->id.us>1);
+ else if(empty_object || (G.vd->flag & V3D_DRAW_CENTERS))
+ drawcentercircle(ob->obmat[3], DESELECT, ob->id.lib || ob->id.us>1);
+ }
+ }
if((G.f & (G_PICKSEL))==0) {
ListBase *list;
@@ -3757,48 +3905,6 @@ void draw_object(Base *base)
}
}
}
-
- /* object centers */
- if(G.vd->zbuf) glDisable(GL_DEPTH_TEST);
- if(ob->type == OB_LAMP) {
- if(ob->id.lib) {
- if(base->flag & SELECT) rect= rectllib_sel;
- else rect= rectllib_desel;
- }
- else if(ob->id.us>1) {
- if(base->flag & SELECT) rect= rectlus_sel;
- else rect= rectlus_desel;
- }
- else {
- if(base->flag & SELECT) rect= rectl_sel;
- else rect= rectl_desel;
- }
- draw_icon_centered(ob->obmat[3], rect, 9);
- }
- else {
- if(ob->id.lib || ob->id.us>1) {
- if(base->flag & SELECT) rect= rectu_sel;
- else rect= rectu_desel;
- }
- else {
- if(base->flag & SELECT) rect= rect_sel;
- /* The center of the active object (which need not
- * be selected) gets drawn as if it were selected
- */
- else if(base==(G.scene->basact)) rect= rect_sel;
- else rect= rect_desel;
- }
- draw_icon_centered(ob->obmat[3], rect, 4);
- }
- if(G.vd->zbuf) glEnable(GL_DEPTH_TEST);
-
- }
- else if((G.f & (G_VERTEXPAINT|G_FACESELECT|G_TEXTUREPAINT|G_WEIGHTPAINT))==0) {
-
- glBegin(GL_POINTS);
- glVertex3fv(ob->obmat[3]);
- glEnd();
-
}
free_old_images();
diff --git a/source/blender/src/drawview.c b/source/blender/src/drawview.c
index 1bc6fdf6d80..5c5b7a94a80 100644
--- a/source/blender/src/drawview.c
+++ b/source/blender/src/drawview.c
@@ -2003,7 +2003,8 @@ static void view3d_panel_properties(short cntrl) // VIEW3D_HANDLER_SETTINGS
uiDefButF(block, NUM, REDRAWVIEW3D, "Z:", 160, 46, 150, 22, curs+2, -1000.0*vd->grid, 1000.0*vd->grid, 10, 0, "Z co-ordinate of the 3D cursor");
uiBlockEndAlign(block);
- uiDefButBitS(block, TOG, V3D_SELECT_OUTLINE, REDRAWVIEW3D, "Outline Selected Objects", 10, 10, 300, 19, &vd->flag, 0, 0, 0, 0, "Highlight selected objects with an outline, in Solid, Shaded or Textured viewport shading modes");
+ uiDefButBitS(block, TOG, V3D_SELECT_OUTLINE, REDRAWVIEW3D, "Outline Selected", 10, 10, 140, 19, &vd->flag, 0, 0, 0, 0, "Highlight selected objects with an outline, in Solid, Shaded or Textured viewport shading modes");
+ uiDefButBitS(block, TOG, V3D_DRAW_CENTERS, REDRAWVIEW3D, "All Object Centers", 160, 10, 140, 19, &vd->flag, 0, 0, 0, 0, "Draw the center points on all objects");
}
@@ -2110,6 +2111,22 @@ void drawview3dspace(ScrArea *sa, void *spacedata)
Mat4Invert(v3d->persinv, v3d->persmat);
Mat4Invert(v3d->viewinv, v3d->viewmat);
+ /* calculate pixelsize factor once, is used for lamps and obcenters */
+ {
+ float len1, len2, vec[3];
+
+ VECCOPY(vec, v3d->persinv[0]);
+ len1= Normalise(vec);
+ VECCOPY(vec, v3d->persinv[1]);
+ len2= Normalise(vec);
+
+ v3d->pixsize= 2.0f*(len1>len2?len1:len2);
+
+ /* correct for window size */
+ if(curarea->winx > sa->winy) v3d->pixsize/= (float)sa->winx;
+ else v3d->pixsize/= (float)sa->winy;
+ }
+
if(v3d->drawtype > OB_WIRE) {
if(G.f & G_SIMULATION)
glClearColor(0.0, 0.0, 0.0, 0.0);
diff --git a/source/blender/src/resources.c b/source/blender/src/resources.c
index 84e9359e7b9..2fc269f3c99 100644
--- a/source/blender/src/resources.c
+++ b/source/blender/src/resources.c
@@ -778,6 +778,8 @@ char *BIF_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid)
cp= ts->grid; break;
case TH_WIRE:
cp= ts->wire; break;
+ case TH_LAMP:
+ cp= ts->lamp; break;
case TH_SELECT:
cp= ts->select; break;
case TH_ACTIVE:
@@ -892,6 +894,7 @@ void BIF_InitTheme(void)
SETCOL(btheme->tv3d.grid, 92, 92, 92, 255);
SETCOL(btheme->tv3d.wire, 0x0, 0x0, 0x0, 255);
+ SETCOL(btheme->tv3d.lamp, 0, 0, 0, 40);
SETCOL(btheme->tv3d.select, 0xff, 0x88, 0xff, 255);
SETCOL(btheme->tv3d.active, 0xff, 0xbb, 0xff, 255);
SETCOL(btheme->tv3d.transform, 0xff, 0xff, 0xff, 255);
@@ -1057,6 +1060,7 @@ char *BIF_ThemeColorsPup(int spacetype)
strcat(cp,"%l|");
sprintf(str, "Grid %%x%d|", TH_GRID); strcat(cp, str);
sprintf(str, "Wire %%x%d|", TH_WIRE); strcat(cp, str);
+ sprintf(str, "Lamp %%x%d|", TH_LAMP); strcat(cp, str);
sprintf(str, "Object Selected %%x%d|", TH_SELECT); strcat(cp, str);
sprintf(str, "Object Active %%x%d|", TH_ACTIVE); strcat(cp, str);
sprintf(str, "Transform %%x%d|", TH_TRANSFORM); strcat(cp, str);
diff --git a/source/blender/src/space.c b/source/blender/src/space.c
index 32568446770..af538a4a3d8 100644
--- a/source/blender/src/space.c
+++ b/source/blender/src/space.c
@@ -2288,7 +2288,7 @@ static void info_user_themebuts(uiBlock *block, short y1, short y2, short y3)
}
else {
uiBlockBeginAlign(block);
- if ELEM6(th_curcol, TH_PANEL, TH_FACE, TH_FACE_SELECT, TH_MENU_BACK, TH_MENU_HILITE, TH_MENU_ITEM) {
+ if ELEM7(th_curcol, TH_PANEL, TH_LAMP, TH_FACE, TH_FACE_SELECT, TH_MENU_BACK, TH_MENU_HILITE, TH_MENU_ITEM) {
uiDefButC(block, NUMSLI, B_UPDATE_THEME,"A ", 465,y3+25,200,20, col+3, 0.0, 255.0, B_THEMECOL, 0, "");
}
uiDefButC(block, NUMSLI, B_UPDATE_THEME,"R ", 465,y3,200,20, col, 0.0, 255.0, B_THEMECOL, 0, "");
@@ -2617,16 +2617,26 @@ void drawinfospace(ScrArea *sa, void *spacedata)
uiBlockBeginAlign(block);
uiDefButS(block, NUM, B_REDRCURW3D, "Size:",
(xpos+edgsp+(5*mpref)+(6*midsp)),y5,(mpref/2),buth,
- &(U.tw_size), 2, 40, 0, 0, "Size of widget as percentage of window size");
+ &(U.tw_size), 2, 40, 0, 0, "Diameter of widget, in 10 pixel units");
uiDefButS(block, NUM, B_REDRCURW3D, "Handle:",
(xpos+edgsp+(5*mpref)+(6*midsp)+(mpref/2)),y5,(mpref/2),buth,
&(U.tw_handlesize), 2, 40, 0, 0, "Size of widget handles as percentage of widget radius");
uiDefButS(block, NUM, B_REDRCURW3D, "Hotspot:",
(xpos+edgsp+(5*mpref)+(6*midsp)),y4,(mpref),buth,
&(U.tw_hotspot), 4, 40, 0, 0, "Hotspot in pixels for clicking widget handles");
-
uiBlockEndAlign(block);
+
+ uiDefBut(block, LABEL,0,"Object center diameter",
+ (xpos+(2*edgsp)+(5*mpref)+(5*midsp)),y3label,mpref,buth,
+ 0, 0, 0, 0, 0, "");
+ uiBlockBeginAlign(block);
+ uiDefButS(block, NUM, B_REDRCURW3D, "Size",
+ (xpos+(2*edgsp)+(5*mpref)+(5*midsp)),y2,mpref,buth,
+ &(U.obcenter_dia), 4, 10, 0, 0,
+ "Diameter in Pixels for Object/Lamp center drawing");
+
+
} else if (U.userpref == 1) { /* edit methods */
@@ -3305,17 +3315,6 @@ void extern_set_butspace(int fkey)
sbuts->mainb= CONTEXT_LOGIC;
}
else if(fkey==F5KEY) {
-
- /* if we're coming in from outside the shading context, just go to the 'default' */
- if(OBACT && sbuts->mainb!= CONTEXT_SHADING) {
- if(OBACT->type==OB_CAMERA)
- sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_WORLD;
- else if(OBACT->type==OB_LAMP)
- sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_LAMP;
- else
- sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_MAT;
- }
-
/* if it's already in shading context, cycle between tabs with the same key */
if (sbuts->oldkeypress == F5KEY) {
@@ -3334,6 +3333,18 @@ void extern_set_butspace(int fkey)
else if (sbuts->oldkeypress == F6KEY) {
sbuts->tab[CONTEXT_SHADING]=TAB_SHADING_MAT;
}
+
+ /* if we're coming in from outside the shading context, just go to the 'default' */
+ else if(OBACT && sbuts->mainb!= CONTEXT_SHADING) {
+ sbuts->mainb= CONTEXT_SHADING;
+
+ if(OBACT->type==OB_CAMERA)
+ sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_WORLD;
+ else if(OBACT->type==OB_LAMP)
+ sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_LAMP;
+ else
+ sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_MAT;
+ }
else {
sbuts->mainb= CONTEXT_SHADING;
sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_MAT;
diff --git a/source/blender/src/usiblender.c b/source/blender/src/usiblender.c
index f60737aa200..1f9dc88321e 100644
--- a/source/blender/src/usiblender.c
+++ b/source/blender/src/usiblender.c
@@ -249,6 +249,18 @@ static void init_userdef_file(void)
}
}
}
+ if (G.main->versionfile <= 239) {
+ bTheme *btheme;
+
+ for(btheme= U.themes.first; btheme; btheme= btheme->next) {
+ /* Lamp theme, check for alpha==0 is safe, then color was never set */
+ if(btheme->tv3d.lamp[3]==0) {
+ SETCOL(btheme->tv3d.lamp, 0, 0, 0, 40);
+ }
+ }
+ if(U.obcenter_dia==0) U.obcenter_dia= 6;
+ }
+
if (U.undosteps==0) U.undosteps=32;
@@ -641,7 +653,6 @@ void BIF_init(void)
InitCursorData();
sound_init_listener();
- init_draw_rects(); /* drawobject.c */
BIF_read_homefile();
init_gl_stuff(); /* drawview.c, after homefile */
readBlog();