Colored wireframes
Moderators: jesterKing, stiv
Colored wireframes
Been waiting for colored wireframes? Here they are:
http://tinus.ath.cx/temp/blendercolor.png
Trying to make some on/off-switch somewhere, any suggestions? I was thinking of adding another mode to the 'drawtype' icon in the toolbar below the edit screen.
--
tinus
http://tinus.ath.cx/temp/blendercolor.png
Trying to make some on/off-switch somewhere, any suggestions? I was thinking of adding another mode to the 'drawtype' icon in the toolbar below the edit screen.
--
tinus
Crap - you beat me to it. Actually, I haven't had a chance to start yet. Kids take up even more time than usual getting close to Halloween.
I was thinking about linking the wireframe colors to different layers. If you want to tackle that, go ahead. If not, I'd still like to. If you don't mind, could you email me (harkyman@attbi.com) your code modifications (and where they're from) so I don't completely reinvent the wheel.
Thanks and nice job!
I was thinking about linking the wireframe colors to different layers. If you want to tackle that, go ahead. If not, I'd still like to. If you don't mind, could you email me (harkyman@attbi.com) your code modifications (and where they're from) so I don't completely reinvent the wheel.
Thanks and nice job!
Hmm, seems my previous message got sumbitted multiple times, yet I received an error every time I submitted them ...
I -could- email, but I'd rather paste it here, so others can do-it-themselves too. Since I've done multiple modifications I cannot paste the exact line numbers.
blender/src/drawobject.c:
in function void draw_object(Base *base) define:
in same function, just after:
define:
The two lines containing:
should get:
Note: this is unconditional: the user has no choice whether to display the meshes in color or not.
I -did- implement a choice option, too, when pressing the Dkey, when you choose BoundBox or Mesh mode, you'll get a second option to display the objects in color or not.
This by adding:
to the typedef struct View3D in blender/makesdna/include/DNA_view3d_types.h and edit blender/src/space.c:633 to be like:
and changing
into
in blender/src/drawobject.c.
This all is coded very sloppy and fast, but it works.
Good luck!
--
tinus
I -could- email, but I'd rather paste it here, so others can do-it-themselves too. Since I've done multiple modifications I cannot paste the exact line numbers.
blender/src/drawobject.c:
in function void draw_object(Base *base) define:
Code: Select all
Material ma*;
int color;
Code: Select all
mymultmatrix(ob->obmat);
Code: Select all
if (give_current_material(ob, 1) != 0) {
ma = give_current_material(ob, 1);
color = ((int)(ma->b*255) << 16) + ((int)(ma->g*255) << 8) + ((int)(ma->r*255));
}
Code: Select all
col = colortab[colindex];
cpack(col);
Code: Select all
if (colindex == 0)
col = color;
else
col = colortab[colindex];
cpack(col);
I -did- implement a choice option, too, when pressing the Dkey, when you choose BoundBox or Mesh mode, you'll get a second option to display the objects in color or not.
This by adding:
Code: Select all
short color;
Code: Select all
pupval= pupmenu("Draw mode%t|BoundBox %x1|Wire %x2|OpenGL Solid %x3|Shaded Solid %x4");
if(pupval>0) {
G.vd->drawtype= pupval;
if (pupval < 3) {
pupval= pupmenu("Display in color%t|Yes %x1|No%x0");
G.vd->color = pupval;
}
doredraw= 1;
}
Code: Select all
if (colindex == 0)
Code: Select all
if (colindex == 0 && G.vd->color)
This all is coded very sloppy and fast, but it works.
Good luck!
--
tinus
What should be improved in Blender is the way it displays 'selected' items. Curently it only works nice in wireframe.
When you adopt colors for wirerframe, you have to solve that. For the time being, I prefer 'context' based wireframe colors. Like having blue for library objects, grey for linked from other scenes, yellow for Ipo keys, etc.
When you adopt colors for wirerframe, you have to solve that. For the time being, I prefer 'context' based wireframe colors. Like having blue for library objects, grey for linked from other scenes, yellow for Ipo keys, etc.
-
- Posts: 13
- Joined: Sun Oct 20, 2002 12:16 am
- Location: Georgia Tech, Atlanta
- Contact:
Code: Select all
#define makeColor(r,g,b) ((int)(b) << 16) + ((int)(g) << 8) + ((int)(r))
(This is as good a place as any.)[/code]
I'll second that. While having layer colors is nice, it could turn ugly if it makes more difficult the task of seeing what object is selected or not.ton wrote:For the time being, I prefer 'context' based wireframe colors. Like having blue for library objects, grey for linked from other scenes, yellow for Ipo keys, etc.
about back face culling, it is, all in all, a good idea, but there might be some technical difficulties. While a quick hack using the dot product of the face normal and the view vector to determine if the face is facing back might work most of the time, it would probably cause some problems with open shapes (take, for example, the cube in Tinus' pic and delete the top face. now, the two "back" face would need to be part visible part invisible) or complex concave objects.
I don't want to sound like the devil's advocate, I'm merely saying that these thing will probably not happen overnight (although I'd really love to be proven wrong).
Martin
Life is what happens to you when you're busy making other plans.
- John Lennon
- John Lennon
button in button bar
with an options list kinda like all the others (plus hotkeys)
mat (colour from material)
mir (colour from mir colour)
con (colour from context like ton says)
lay (colour from layer)
-------(oh yeah and last but not least)
stan (for the standard grey and pink)
-------(and another i just thought of)
dyn (for seperation between dynamic realtime oblects and objects which ignor physics in the realtime engine. between objects and settings)
makes everyone happy!!!!!!
cause it depends on what you are doing doesn't it.
for me i rarely link objects between scenes so wouldn't normaly use the con button but i may decied to use the layer button.
i think colours are a great idea!!!!!!!
and can you only use this kinda new adition to blender in LINUX.
should i get linux with my new machine?
with an options list kinda like all the others (plus hotkeys)
mat (colour from material)
mir (colour from mir colour)
con (colour from context like ton says)
lay (colour from layer)
-------(oh yeah and last but not least)
stan (for the standard grey and pink)
-------(and another i just thought of)
dyn (for seperation between dynamic realtime oblects and objects which ignor physics in the realtime engine. between objects and settings)
makes everyone happy!!!!!!
cause it depends on what you are doing doesn't it.
for me i rarely link objects between scenes so wouldn't normaly use the con button but i may decied to use the layer button.
i think colours are a great idea!!!!!!!
and can you only use this kinda new adition to blender in LINUX.
should i get linux with my new machine?