2005-09-14 14:02:21 +00:00
|
|
|
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
/**
|
|
|
|
|
* $Id$
|
|
|
|
|
*
|
2008-04-16 22:40:48 +00:00
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
2008-04-16 22:40:48 +00:00
|
|
|
* of the License, or (at your option) any later version.
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
|
|
|
|
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
*
|
|
|
|
|
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
|
|
|
|
* All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
* The Original Code is: all of this file.
|
|
|
|
|
*
|
|
|
|
|
* Contributor(s): none yet.
|
|
|
|
|
*
|
2008-04-16 22:40:48 +00:00
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
a full doc with API notes can be found in bf-blender/blender/doc/interface_API.txt
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <math.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <string.h>
|
|
|
|
|
#include <ctype.h>
|
|
|
|
|
|
|
|
|
|
#ifndef WIN32
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
#else
|
|
|
|
|
#include <io.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
|
|
|
|
|
|
#include "PIL_time.h"
|
|
|
|
|
|
|
|
|
|
#include "BLI_blenlib.h"
|
|
|
|
|
#include "BLI_arithb.h"
|
|
|
|
|
|
Orange:
- New UI element: the "Curve Button".
For mapping ranges (like 0 - 1) to another range, the curve button can be
used for proportional falloff, bone influences, painting density, etc.
Most evident use is of course to map RGB color with curves.
To be able to use it, you have to allocate a CurveMapping struct and pass
this on to the button. The CurveMapping API is in the new C file
blenkernel/intern/colortools.c
It's as simple as calling:
curvemap= curvemapping_add(3, 0, 0, 1, 1)
Which will create 3 curves, and sets a default 0-1 range. The current code
only supports up to 4 curves maximum per mapping struct.
The CurveMap button in Blender than handles allmost all editing.
Evaluating a single channel:
float newvalue= curvemapping_evaluateF(curvemap, 0, oldval);
Where the second argument is the channel index, here 0-1-2 are possible.
Or mapping a vector:
curvemapping_evaluate3F(curvemap, newvec, oldvec);
Optimized versions for byte or short mapping is possible too, not done yet.
In butspace.c I've added a template wrapper for buttons around the curve, to
reveil settings or show tools; check this screenie:
http://www.blender.org/bf/curves.jpg
- Buttons R, G, B: select channel
- icons + and -: zoom in, out
- icon 'wrench': menu with tools, like clear curve, set handle type
- icon 'clipping': menu with clip values, and to dis/enable clipping
- icon 'x': delete selection
In the curve button itself, only LMB clicks are handled (like all UI elements
in Blender).
- click on point: select
- shift+click on point: swap select
- click on point + drag: select point (if not selected) and move it
- click outside point + drag: translate view
- CTRL+click: add new point
- hold SHIFT while dragging to snap to grid
(Yes I know... either one of these can be Blender compliant, not both!)
- if you drag a point exactly on top of another, it merges them
Other fixes:
- Icons now draw using "Safe RasterPos", so they align with pixel boundary.
the old code made ints from the raster pos coordinate, which doesn't work
well for zoom in/out situations
- bug in Node editing: buttons could not get freed, causing in memory error
prints at end of a Blender session. That one was a very simple, but nasty
error causing me all evening last night to find!
(Hint; check diff of editnode.c, where uiDoButtons is called)
Last note: this adds 3 new files in our tree, I did scons, but not MSVC!
2006-01-08 11:41:06 +00:00
|
|
|
#include "DNA_color_types.h"
|
|
|
|
|
#include "DNA_key_types.h"
|
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
|
|
|
#include "DNA_packedFile_types.h"
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
#include "DNA_screen_types.h"
|
|
|
|
|
#include "DNA_space_types.h"
|
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
|
|
|
#include "DNA_texture_types.h"
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
#include "DNA_userdef_types.h"
|
|
|
|
|
#include "DNA_vec_types.h"
|
2005-09-14 14:02:21 +00:00
|
|
|
#include "DNA_vfont_types.h"
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
|
|
|
|
|
#include "BKE_blender.h"
|
Orange:
- New UI element: the "Curve Button".
For mapping ranges (like 0 - 1) to another range, the curve button can be
used for proportional falloff, bone influences, painting density, etc.
Most evident use is of course to map RGB color with curves.
To be able to use it, you have to allocate a CurveMapping struct and pass
this on to the button. The CurveMapping API is in the new C file
blenkernel/intern/colortools.c
It's as simple as calling:
curvemap= curvemapping_add(3, 0, 0, 1, 1)
Which will create 3 curves, and sets a default 0-1 range. The current code
only supports up to 4 curves maximum per mapping struct.
The CurveMap button in Blender than handles allmost all editing.
Evaluating a single channel:
float newvalue= curvemapping_evaluateF(curvemap, 0, oldval);
Where the second argument is the channel index, here 0-1-2 are possible.
Or mapping a vector:
curvemapping_evaluate3F(curvemap, newvec, oldvec);
Optimized versions for byte or short mapping is possible too, not done yet.
In butspace.c I've added a template wrapper for buttons around the curve, to
reveil settings or show tools; check this screenie:
http://www.blender.org/bf/curves.jpg
- Buttons R, G, B: select channel
- icons + and -: zoom in, out
- icon 'wrench': menu with tools, like clear curve, set handle type
- icon 'clipping': menu with clip values, and to dis/enable clipping
- icon 'x': delete selection
In the curve button itself, only LMB clicks are handled (like all UI elements
in Blender).
- click on point: select
- shift+click on point: swap select
- click on point + drag: select point (if not selected) and move it
- click outside point + drag: translate view
- CTRL+click: add new point
- hold SHIFT while dragging to snap to grid
(Yes I know... either one of these can be Blender compliant, not both!)
- if you drag a point exactly on top of another, it merges them
Other fixes:
- Icons now draw using "Safe RasterPos", so they align with pixel boundary.
the old code made ints from the raster pos coordinate, which doesn't work
well for zoom in/out situations
- bug in Node editing: buttons could not get freed, causing in memory error
prints at end of a Blender session. That one was a very simple, but nasty
error causing me all evening last night to find!
(Hint; check diff of editnode.c, where uiDoButtons is called)
Last note: this adds 3 new files in our tree, I did scons, but not MSVC!
2006-01-08 11:41:06 +00:00
|
|
|
#include "BKE_colortools.h"
|
2005-09-15 17:32:24 +00:00
|
|
|
#include "BKE_font.h"
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
#include "BKE_global.h"
|
Orange:
- New UI element: the "Curve Button".
For mapping ranges (like 0 - 1) to another range, the curve button can be
used for proportional falloff, bone influences, painting density, etc.
Most evident use is of course to map RGB color with curves.
To be able to use it, you have to allocate a CurveMapping struct and pass
this on to the button. The CurveMapping API is in the new C file
blenkernel/intern/colortools.c
It's as simple as calling:
curvemap= curvemapping_add(3, 0, 0, 1, 1)
Which will create 3 curves, and sets a default 0-1 range. The current code
only supports up to 4 curves maximum per mapping struct.
The CurveMap button in Blender than handles allmost all editing.
Evaluating a single channel:
float newvalue= curvemapping_evaluateF(curvemap, 0, oldval);
Where the second argument is the channel index, here 0-1-2 are possible.
Or mapping a vector:
curvemapping_evaluate3F(curvemap, newvec, oldvec);
Optimized versions for byte or short mapping is possible too, not done yet.
In butspace.c I've added a template wrapper for buttons around the curve, to
reveil settings or show tools; check this screenie:
http://www.blender.org/bf/curves.jpg
- Buttons R, G, B: select channel
- icons + and -: zoom in, out
- icon 'wrench': menu with tools, like clear curve, set handle type
- icon 'clipping': menu with clip values, and to dis/enable clipping
- icon 'x': delete selection
In the curve button itself, only LMB clicks are handled (like all UI elements
in Blender).
- click on point: select
- shift+click on point: swap select
- click on point + drag: select point (if not selected) and move it
- click outside point + drag: translate view
- CTRL+click: add new point
- hold SHIFT while dragging to snap to grid
(Yes I know... either one of these can be Blender compliant, not both!)
- if you drag a point exactly on top of another, it merges them
Other fixes:
- Icons now draw using "Safe RasterPos", so they align with pixel boundary.
the old code made ints from the raster pos coordinate, which doesn't work
well for zoom in/out situations
- bug in Node editing: buttons could not get freed, causing in memory error
prints at end of a Blender session. That one was a very simple, but nasty
error causing me all evening last night to find!
(Hint; check diff of editnode.c, where uiDoButtons is called)
Last note: this adds 3 new files in our tree, I did scons, but not MSVC!
2006-01-08 11:41:06 +00:00
|
|
|
#include "BKE_key.h"
|
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
|
|
|
#include "BKE_utildefines.h"
|
|
|
|
|
|
2005-10-28 15:36:09 +00:00
|
|
|
#include "datatoc.h" /* std font */
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
|
|
|
|
|
#include "BIF_gl.h"
|
|
|
|
|
#include "BIF_graphics.h"
|
|
|
|
|
#include "BIF_keyval.h"
|
|
|
|
|
#include "BIF_mainqueue.h"
|
|
|
|
|
|
|
|
|
|
#include "BIF_screen.h"
|
|
|
|
|
#include "BIF_toolbox.h"
|
|
|
|
|
#include "BIF_mywindow.h"
|
|
|
|
|
#include "BIF_space.h"
|
|
|
|
|
#include "BIF_glutil.h"
|
|
|
|
|
#include "BIF_interface.h"
|
2005-12-21 22:21:43 +00:00
|
|
|
#include "BIF_interface_icons.h"
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
#include "BIF_butspace.h"
|
|
|
|
|
#include "BIF_language.h"
|
|
|
|
|
|
|
|
|
|
#include "BSE_view.h"
|
|
|
|
|
|
2005-09-19 10:15:26 +00:00
|
|
|
#ifdef INTERNATIONAL
|
2005-09-14 14:02:21 +00:00
|
|
|
#include "FTF_Api.h"
|
2005-09-19 10:15:26 +00:00
|
|
|
#endif
|
2005-09-14 14:02:21 +00:00
|
|
|
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
#include "mydevice.h"
|
|
|
|
|
#include "interface.h"
|
|
|
|
|
#include "blendef.h"
|
|
|
|
|
|
|
|
|
|
// globals
|
|
|
|
|
extern float UIwinmat[4][4];
|
|
|
|
|
|
2005-03-09 19:45:59 +00:00
|
|
|
|
2004-10-03 13:49:54 +00:00
|
|
|
/* ************** safe rasterpos for pixmap alignment with pixels ************* */
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
|
2004-10-03 13:49:54 +00:00
|
|
|
void ui_rasterpos_safe(float x, float y, float aspect)
|
|
|
|
|
{
|
|
|
|
|
float vals[4], remainder;
|
|
|
|
|
int doit=0;
|
|
|
|
|
|
|
|
|
|
glRasterPos2f(x, y);
|
|
|
|
|
glGetFloatv(GL_CURRENT_RASTER_POSITION, vals);
|
|
|
|
|
|
|
|
|
|
remainder= vals[0] - floor(vals[0]);
|
|
|
|
|
if(remainder > 0.4 && remainder < 0.6) {
|
|
|
|
|
if(remainder < 0.5) x -= 0.1*aspect;
|
|
|
|
|
else x += 0.1*aspect;
|
|
|
|
|
doit= 1;
|
|
|
|
|
}
|
|
|
|
|
remainder= vals[1] - floor(vals[1]);
|
|
|
|
|
if(remainder > 0.4 && remainder < 0.6) {
|
|
|
|
|
if(remainder < 0.5) y -= 0.1*aspect;
|
|
|
|
|
else y += 0.1*aspect;
|
|
|
|
|
doit= 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(doit) glRasterPos2f(x, y);
|
2005-01-19 13:53:43 +00:00
|
|
|
|
|
|
|
|
BIF_RasterPos(x, y);
|
2005-01-21 14:48:03 +00:00
|
|
|
BIF_SetScale(aspect);
|
2004-10-03 13:49:54 +00:00
|
|
|
}
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
|
|
|
|
|
/* ************** generic embossed rect, for window sliders etc ************* */
|
|
|
|
|
|
|
|
|
|
void uiEmboss(float x1, float y1, float x2, float y2, int sel)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
/* below */
|
|
|
|
|
if(sel) glColor3ub(200,200,200);
|
|
|
|
|
else glColor3ub(50,50,50);
|
|
|
|
|
fdrawline(x1, y1, x2, y1);
|
|
|
|
|
|
|
|
|
|
/* right */
|
|
|
|
|
fdrawline(x2, y1, x2, y2);
|
|
|
|
|
|
|
|
|
|
/* top */
|
|
|
|
|
if(sel) glColor3ub(50,50,50);
|
|
|
|
|
else glColor3ub(200,200,200);
|
|
|
|
|
fdrawline(x1, y2, x2, y2);
|
|
|
|
|
|
|
|
|
|
/* left */
|
|
|
|
|
fdrawline(x1, y1, x1, y2);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* ************** GENERIC ICON DRAW, NO THEME HERE ************* */
|
|
|
|
|
|
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
|
|
|
/* icons have been standardized... and this call draws in untransformed coordinates */
|
|
|
|
|
#define ICON_HEIGHT 16.0f
|
|
|
|
|
|
2006-12-07 14:17:38 +00:00
|
|
|
static void ui_draw_icon(uiBut *but, BIFIconID icon, int blend)
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
{
|
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
|
|
|
float xs=0, ys=0, aspect, height;
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
|
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
|
|
|
/* this icon doesn't need draw... */
|
2004-08-31 13:43:18 +00:00
|
|
|
if(icon==ICON_BLANK1) return;
|
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
|
|
|
|
|
|
|
|
/* we need aspect from block, for menus... these buttons are scaled in uiPositionBlock() */
|
|
|
|
|
aspect= but->block->aspect;
|
2006-01-06 19:18:31 +00:00
|
|
|
if(aspect != but->aspect) {
|
|
|
|
|
/* prevent scaling up icon in pupmenu */
|
|
|
|
|
if (aspect < 1.0f) {
|
|
|
|
|
height= ICON_HEIGHT;
|
|
|
|
|
aspect = 1.0f;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
height= ICON_HEIGHT/aspect;
|
|
|
|
|
}
|
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
|
|
|
else
|
|
|
|
|
height= ICON_HEIGHT;
|
|
|
|
|
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
if(but->flag & UI_ICON_LEFT) {
|
2008-07-04 19:00:56 +00:00
|
|
|
if (but->type==BUT_TOGDUAL) {
|
|
|
|
|
if (but->drawstr[0]) {
|
|
|
|
|
xs= but->x1-1.0;
|
|
|
|
|
} else {
|
|
|
|
|
xs= (but->x1+but->x2- height)/2.0;
|
|
|
|
|
}
|
2006-12-07 14:17:38 +00:00
|
|
|
}
|
|
|
|
|
else if (but->type==BUTM ) {
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
xs= but->x1+1.0;
|
|
|
|
|
}
|
|
|
|
|
else if ((but->type==ICONROW) || (but->type==ICONTEXTROW)) {
|
2006-06-08 19:05:58 +00:00
|
|
|
xs= but->x1+3.0;
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2006-06-08 19:05:58 +00:00
|
|
|
xs= but->x1+4.0;
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
}
|
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
|
|
|
ys= (but->y1+but->y2- height)/2.0;
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
}
|
|
|
|
|
if(but->flag & UI_ICON_RIGHT) {
|
|
|
|
|
xs= but->x2-17.0;
|
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
|
|
|
ys= (but->y1+but->y2- height)/2.0;
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
}
|
|
|
|
|
if (!((but->flag & UI_ICON_RIGHT) || (but->flag & UI_ICON_LEFT))) {
|
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
|
|
|
xs= (but->x1+but->x2- height)/2.0;
|
|
|
|
|
ys= (but->y1+but->y2- height)/2.0;
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
glEnable(GL_BLEND);
|
|
|
|
|
|
|
|
|
|
/* calculate blend color */
|
2006-11-20 05:12:58 +00:00
|
|
|
if ELEM3(but->type, TOG, ROW, TOGN) {
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
if(but->flag & UI_SELECT);
|
|
|
|
|
else if(but->flag & UI_ACTIVE);
|
|
|
|
|
else blend= -60;
|
|
|
|
|
}
|
Bugfix from own testing:
In outliner, the icons sometimes were drawing too large or too small.
Same happened in NLA, Action, Image window etc. And it happened
for "International fonts" when set to use 'texture drawing'.
Reason: the API call for setting icon size BIF_icon_set_aspect() was not
used consistantly. Sometimes it was set, sometimes not. And even worse,
for every icon drawn in UI buttons, the icon lookup had to be done twice
because of the aspect function.
Solved it by removing this call, and adding a new function:
BIF_icon_draw_aspect()
The old BIF_icon_draw() call now draws with aspect 1.0 always. The icons
code already had optimal checking for changed sizes, zo a change in aspect
won't result in much cpu overhead. Plus it saves calling icons lookup code,
which will make it all a bit faster.
Andrea: I've added this aspect function a long while ago, I think you also
like it better how it is now? Please check!
2006-06-29 09:44:08 +00:00
|
|
|
BIF_icon_draw_aspect_blended(xs, ys, icon, aspect, blend);
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
|
|
|
|
|
glDisable(GL_BLEND);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2003-12-07 06:05:08 +00:00
|
|
|
|
2003-10-21 07:02:04 +00:00
|
|
|
/* ************** DEFAULT THEME, SHADED BUTTONS ************* */
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
|
|
|
|
|
|
2003-12-07 06:05:08 +00:00
|
|
|
#define M_WHITE BIF_ThemeColorShade(colorid, 80)
|
2003-10-21 07:02:04 +00:00
|
|
|
|
2003-12-07 06:05:08 +00:00
|
|
|
#define M_ACT_LIGHT BIF_ThemeColorShade(colorid, 55)
|
|
|
|
|
#define M_LIGHT BIF_ThemeColorShade(colorid, 45)
|
|
|
|
|
#define M_HILITE BIF_ThemeColorShade(colorid, 25)
|
|
|
|
|
#define M_LMEDIUM BIF_ThemeColorShade(colorid, 10)
|
|
|
|
|
#define M_MEDIUM BIF_ThemeColor(colorid)
|
|
|
|
|
#define M_LGREY BIF_ThemeColorShade(colorid, -20)
|
|
|
|
|
#define M_GREY BIF_ThemeColorShade(colorid, -45)
|
|
|
|
|
#define M_DARK BIF_ThemeColorShade(colorid, -80)
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
|
2003-12-07 06:05:08 +00:00
|
|
|
#define M_NUMTEXT BIF_ThemeColorShade(colorid, 25)
|
|
|
|
|
#define M_NUMTEXT_ACT_LIGHT BIF_ThemeColorShade(colorid, 35)
|
2003-10-21 07:02:04 +00:00
|
|
|
|
|
|
|
|
#define MM_WHITE BIF_ThemeColorShade(TH_BUT_NEUTRAL, 120)
|
2003-12-08 10:48:28 +00:00
|
|
|
|
2004-01-28 12:16:05 +00:00
|
|
|
/* Used for the subtle sunken effect around buttons.
|
|
|
|
|
* One option is to hardcode to white, with alpha, however it causes a
|
|
|
|
|
* weird 'building up' efect, so it's commented out for now.
|
2003-12-08 10:48:28 +00:00
|
|
|
*/
|
2004-01-28 12:16:05 +00:00
|
|
|
|
|
|
|
|
/*
|
2003-12-08 10:48:28 +00:00
|
|
|
#define MM_WHITE_OP glColor4ub(255, 255, 255, 60)
|
|
|
|
|
#define MM_WHITE_TR glColor4ub(255, 255, 255, 0)
|
2004-01-28 12:16:05 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#define MM_WHITE_OP BIF_ThemeColorShadeAlpha(TH_BACK, 55, -100)
|
|
|
|
|
#define MM_WHITE_TR BIF_ThemeColorShadeAlpha(TH_BACK, 55, -255)
|
2003-12-08 10:48:28 +00:00
|
|
|
|
2004-01-10 13:41:03 +00:00
|
|
|
#define MM_LIGHT BIF_ThemeColorShade(TH_BUT_OUTLINE, 45)
|
|
|
|
|
#define MM_MEDIUM BIF_ThemeColor(TH_BUT_OUTLINE)
|
|
|
|
|
#define MM_GREY BIF_ThemeColorShade(TH_BUT_OUTLINE, -45)
|
|
|
|
|
#define MM_DARK BIF_ThemeColorShade(TH_BUT_OUTLINE, -80)
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
|
2003-12-07 06:05:08 +00:00
|
|
|
/* base shaded button */
|
|
|
|
|
static void shaded_button(float x1, float y1, float x2, float y2, float asp, int colorid, int flag, int mid)
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
{
|
2003-12-07 06:05:08 +00:00
|
|
|
/* 'mid' arg determines whether the button is in the middle of
|
|
|
|
|
* an alignment group or not. 0 = not middle, 1 = is in the middle.
|
|
|
|
|
* Done to allow cleaner drawing
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/* *** SHADED BUTTON BASE *** */
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
glShadeModel(GL_SMOOTH);
|
|
|
|
|
glBegin(GL_QUADS);
|
|
|
|
|
|
|
|
|
|
if(flag & UI_SELECT) {
|
|
|
|
|
if(flag & UI_ACTIVE) M_MEDIUM;
|
|
|
|
|
else M_LGREY;
|
2003-12-07 06:05:08 +00:00
|
|
|
} else {
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
if(flag & UI_ACTIVE) M_LIGHT;
|
|
|
|
|
else M_HILITE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
glVertex2f(x1,y1);
|
|
|
|
|
glVertex2f(x2,y1);
|
|
|
|
|
|
|
|
|
|
if(flag & UI_SELECT) {
|
|
|
|
|
if(flag & UI_ACTIVE) M_LGREY;
|
|
|
|
|
else M_GREY;
|
2003-12-07 06:05:08 +00:00
|
|
|
} else {
|
2003-10-21 07:02:04 +00:00
|
|
|
if(flag & UI_ACTIVE) M_ACT_LIGHT;
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
else M_LIGHT;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
glVertex2f(x2,(y2-(y2-y1)/3));
|
|
|
|
|
glVertex2f(x1,(y2-(y2-y1)/3));
|
|
|
|
|
glEnd();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
glShadeModel(GL_FLAT);
|
|
|
|
|
glBegin(GL_QUADS);
|
|
|
|
|
|
|
|
|
|
if(flag & UI_SELECT) {
|
|
|
|
|
if(flag & UI_ACTIVE) M_LGREY;
|
|
|
|
|
else M_GREY;
|
2003-12-07 06:05:08 +00:00
|
|
|
} else {
|
2003-10-21 07:02:04 +00:00
|
|
|
if(flag & UI_ACTIVE) M_ACT_LIGHT;
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
else M_LIGHT;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
glVertex2f(x1,(y2-(y2-y1)/3));
|
|
|
|
|
glVertex2f(x2,(y2-(y2-y1)/3));
|
|
|
|
|
glVertex2f(x2,y2);
|
|
|
|
|
glVertex2f(x1,y2);
|
|
|
|
|
|
|
|
|
|
glEnd();
|
2003-12-07 06:05:08 +00:00
|
|
|
/* *** END SHADED BUTTON BASE *** */
|
2003-10-21 07:02:04 +00:00
|
|
|
|
2003-12-07 06:05:08 +00:00
|
|
|
/* *** INNER OUTLINE *** */
|
|
|
|
|
/* left */
|
|
|
|
|
if(!(flag & UI_SELECT)) {
|
|
|
|
|
glShadeModel(GL_SMOOTH);
|
|
|
|
|
glBegin(GL_LINES);
|
|
|
|
|
M_MEDIUM;
|
|
|
|
|
glVertex2f(x1+1,y1+2);
|
|
|
|
|
M_WHITE;
|
|
|
|
|
glVertex2f(x1+1,y2);
|
|
|
|
|
glEnd();
|
|
|
|
|
}
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
|
|
|
|
|
/* right */
|
2003-12-07 06:05:08 +00:00
|
|
|
if(!(flag & UI_SELECT)) {
|
|
|
|
|
glShadeModel(GL_SMOOTH);
|
|
|
|
|
glBegin(GL_LINES);
|
|
|
|
|
M_MEDIUM;
|
|
|
|
|
glVertex2f(x2-1,y1+2);
|
|
|
|
|
M_WHITE;
|
|
|
|
|
glVertex2f(x2-1,y2);
|
|
|
|
|
glEnd();
|
|
|
|
|
}
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
|
|
|
|
|
glShadeModel(GL_FLAT);
|
|
|
|
|
|
|
|
|
|
/* top */
|
|
|
|
|
if(flag & UI_SELECT) {
|
2003-10-21 07:02:04 +00:00
|
|
|
if(flag & UI_ACTIVE) M_LGREY;
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
else M_GREY;
|
2003-12-07 06:05:08 +00:00
|
|
|
} else {
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
if(flag & UI_ACTIVE) M_WHITE;
|
|
|
|
|
else M_WHITE;
|
|
|
|
|
}
|
|
|
|
|
|
2003-12-07 06:05:08 +00:00
|
|
|
fdrawline(x1, (y2-1), x2, (y2-1));
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
|
|
|
|
|
/* bottom */
|
|
|
|
|
if(flag & UI_SELECT) {
|
2003-10-21 07:02:04 +00:00
|
|
|
if(flag & UI_ACTIVE) M_MEDIUM;
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
else M_LGREY;
|
2003-12-07 06:05:08 +00:00
|
|
|
} else {
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
if(flag & UI_ACTIVE) M_LMEDIUM;
|
2003-12-07 06:05:08 +00:00
|
|
|
else M_MEDIUM;
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
}
|
2003-12-07 06:05:08 +00:00
|
|
|
fdrawline(x1, (y1+1), x2, (y1+1));
|
|
|
|
|
/* *** END INNER OUTLINE *** */
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
|
2003-12-07 06:05:08 +00:00
|
|
|
/* *** OUTER OUTLINE *** */
|
|
|
|
|
if (mid) {
|
|
|
|
|
// we draw full outline, its not AA, and it works better button mouse-over hilite
|
|
|
|
|
MM_DARK;
|
|
|
|
|
|
|
|
|
|
// left right
|
|
|
|
|
fdrawline(x1, y1, x1, y2);
|
|
|
|
|
fdrawline(x2, y1, x2, y2);
|
|
|
|
|
|
|
|
|
|
// top down
|
|
|
|
|
fdrawline(x1, y2, x2, y2);
|
|
|
|
|
fdrawline(x1, y1, x2, y1);
|
|
|
|
|
} else {
|
|
|
|
|
MM_DARK;
|
2004-08-31 13:43:18 +00:00
|
|
|
gl_round_box(GL_LINE_LOOP, x1, y1, x2, y2, 1.5);
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
}
|
|
|
|
|
/* END OUTER OUTLINE */
|
|
|
|
|
}
|
|
|
|
|
|
2003-12-07 06:05:08 +00:00
|
|
|
/* base flat button */
|
|
|
|
|
static void flat_button(float x1, float y1, float x2, float y2, float asp, int colorid, int flag, int mid)
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
{
|
2003-12-07 06:05:08 +00:00
|
|
|
/* 'mid' arg determines whether the button is in the middle of
|
|
|
|
|
* an alignment group or not. 0 = not middle, 1 = is in the middle.
|
|
|
|
|
* Done to allow cleaner drawing
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/* *** FLAT TEXT/NUM FIELD *** */
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
glShadeModel(GL_FLAT);
|
|
|
|
|
if(flag & UI_SELECT) {
|
|
|
|
|
if(flag & UI_ACTIVE) M_LGREY;
|
|
|
|
|
else M_GREY;
|
|
|
|
|
}
|
|
|
|
|
else {
|
2003-10-21 07:02:04 +00:00
|
|
|
if(flag & UI_ACTIVE) M_NUMTEXT_ACT_LIGHT;
|
|
|
|
|
else M_NUMTEXT;
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
}
|
|
|
|
|
|
2003-12-07 06:05:08 +00:00
|
|
|
glRectf(x1, y1, x2, y2);
|
|
|
|
|
/* *** END FLAT TEXT/NUM FIELD *** */
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
|
2003-12-07 06:05:08 +00:00
|
|
|
/* *** OUTER OUTLINE *** */
|
|
|
|
|
if (mid) {
|
|
|
|
|
// we draw full outline, its not AA, and it works better button mouse-over hilite
|
|
|
|
|
MM_DARK;
|
|
|
|
|
|
|
|
|
|
// left right
|
|
|
|
|
fdrawline(x1, y1, x1, y2);
|
|
|
|
|
fdrawline(x2, y1, x2, y2);
|
|
|
|
|
|
|
|
|
|
// top down
|
|
|
|
|
fdrawline(x1, y2, x2, y2);
|
|
|
|
|
fdrawline(x1, y1, x2, y1);
|
|
|
|
|
} else {
|
|
|
|
|
MM_DARK;
|
2004-08-31 13:43:18 +00:00
|
|
|
gl_round_box(GL_LINE_LOOP, x1, y1, x2, y2, 1.5);
|
2003-12-07 06:05:08 +00:00
|
|
|
}
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
/* END OUTER OUTLINE */
|
|
|
|
|
}
|
|
|
|
|
|
2003-12-07 06:05:08 +00:00
|
|
|
/* small side double arrow for iconrow */
|
|
|
|
|
static void ui_default_iconrow_arrows(float x1, float y1, float x2, float y2)
|
2003-11-14 00:44:48 +00:00
|
|
|
{
|
|
|
|
|
glEnable( GL_POLYGON_SMOOTH );
|
|
|
|
|
glEnable( GL_BLEND );
|
|
|
|
|
|
|
|
|
|
glShadeModel(GL_FLAT);
|
|
|
|
|
glBegin(GL_TRIANGLES);
|
2003-12-07 06:05:08 +00:00
|
|
|
glVertex2f((short)x2-2,(short)(y2-(y2-y1)/2)+1);
|
|
|
|
|
glVertex2f((short)x2-6,(short)(y2-(y2-y1)/2)+1);
|
|
|
|
|
glVertex2f((short)x2-4,(short)(y2-(y2-y1)/2)+4);
|
2003-11-14 00:44:48 +00:00
|
|
|
glEnd();
|
2003-12-07 06:05:08 +00:00
|
|
|
|
2003-11-14 00:44:48 +00:00
|
|
|
glBegin(GL_TRIANGLES);
|
2003-12-07 06:05:08 +00:00
|
|
|
glVertex2f((short)x2-2,(short)(y2-(y2-y1)/2) -1);
|
|
|
|
|
glVertex2f((short)x2-6,(short)(y2-(y2-y1)/2) -1);
|
|
|
|
|
glVertex2f((short)x2-4,(short)(y2-(y2-y1)/2) -4);
|
2003-11-14 00:44:48 +00:00
|
|
|
glEnd();
|
|
|
|
|
|
|
|
|
|
glDisable( GL_BLEND );
|
|
|
|
|
glDisable( GL_POLYGON_SMOOTH );
|
|
|
|
|
}
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
|
2003-12-07 06:05:08 +00:00
|
|
|
/* side double arrow for menu */
|
2003-11-14 00:44:48 +00:00
|
|
|
static void ui_default_menu_arrows(float x1, float y1, float x2, float y2)
|
|
|
|
|
{
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
glEnable( GL_POLYGON_SMOOTH );
|
|
|
|
|
glEnable( GL_BLEND );
|
|
|
|
|
|
|
|
|
|
glShadeModel(GL_FLAT);
|
|
|
|
|
glBegin(GL_TRIANGLES);
|
2003-11-14 00:44:48 +00:00
|
|
|
glVertex2f((short)x2-4,(short)(y2-(y2-y1)/2)+1);
|
|
|
|
|
glVertex2f((short)x2-12,(short)(y2-(y2-y1)/2)+1);
|
|
|
|
|
glVertex2f((short)x2-8,(short)(y2-(y2-y1)/2)+4);
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
glEnd();
|
2003-11-14 00:44:48 +00:00
|
|
|
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
glBegin(GL_TRIANGLES);
|
2003-11-14 00:44:48 +00:00
|
|
|
glVertex2f((short)x2-4,(short)(y2-(y2-y1)/2) -1);
|
|
|
|
|
glVertex2f((short)x2-12,(short)(y2-(y2-y1)/2) -1);
|
|
|
|
|
glVertex2f((short)x2-8,(short)(y2-(y2-y1)/2) -4);
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
glEnd();
|
|
|
|
|
|
|
|
|
|
glDisable( GL_BLEND );
|
|
|
|
|
glDisable( GL_POLYGON_SMOOTH );
|
|
|
|
|
}
|
|
|
|
|
|
2003-12-07 06:05:08 +00:00
|
|
|
/* left/right arrows for number fields */
|
|
|
|
|
static void ui_default_num_arrows(float x1, float y1, float x2, float y2)
|
2003-11-14 00:44:48 +00:00
|
|
|
{
|
2004-11-08 15:46:57 +00:00
|
|
|
if( x2-x1 > 25) { // 25 is a bit arbitrary, but small buttons cant have arrows
|
2003-12-07 06:05:08 +00:00
|
|
|
|
2004-11-08 15:46:57 +00:00
|
|
|
glEnable( GL_POLYGON_SMOOTH );
|
|
|
|
|
glEnable( GL_BLEND );
|
|
|
|
|
|
|
|
|
|
glShadeModel(GL_FLAT);
|
|
|
|
|
glBegin(GL_TRIANGLES);
|
|
|
|
|
|
|
|
|
|
glVertex2f((short)x1+5,(short)(y2-(y2-y1)/2));
|
|
|
|
|
glVertex2f((short)x1+10,(short)(y2-(y2-y1)/2)+4);
|
|
|
|
|
glVertex2f((short)x1+10,(short)(y2-(y2-y1)/2)-4);
|
|
|
|
|
glEnd();
|
2003-12-07 06:05:08 +00:00
|
|
|
|
2004-11-08 15:46:57 +00:00
|
|
|
/* right */
|
|
|
|
|
glShadeModel(GL_FLAT);
|
|
|
|
|
glBegin(GL_TRIANGLES);
|
|
|
|
|
|
|
|
|
|
glVertex2f((short)x2-5,(short)(y2-(y2-y1)/2));
|
|
|
|
|
glVertex2f((short)x2-10,(short)(y2-(y2-y1)/2)-4);
|
|
|
|
|
glVertex2f((short)x2-10,(short)(y2-(y2-y1)/2)+4);
|
|
|
|
|
glEnd();
|
|
|
|
|
|
|
|
|
|
glDisable( GL_BLEND );
|
|
|
|
|
glDisable( GL_POLYGON_SMOOTH );
|
|
|
|
|
}
|
2003-12-08 10:48:28 +00:00
|
|
|
}
|
2003-12-07 06:05:08 +00:00
|
|
|
|
2003-12-08 10:48:28 +00:00
|
|
|
/* changing black/white for TOG3 buts */
|
|
|
|
|
static void ui_tog3_invert(float x1, float y1, float x2, float y2, int seltype)
|
|
|
|
|
{
|
|
|
|
|
short alpha = 30;
|
|
|
|
|
|
|
|
|
|
if (seltype == 0) {
|
|
|
|
|
glEnable(GL_BLEND);
|
|
|
|
|
|
|
|
|
|
glColor4ub(0, 0, 0, alpha);
|
|
|
|
|
glRectf(x2-6, y1, x2, (y1+(y2-y1)/2));
|
|
|
|
|
|
|
|
|
|
glColor4ub(255, 255, 255, alpha);
|
|
|
|
|
glRectf(x2-6, (y1+(y2-y1)/2), x2, y2);
|
|
|
|
|
|
|
|
|
|
glDisable(GL_BLEND);
|
|
|
|
|
} else {
|
|
|
|
|
glEnable(GL_BLEND);
|
|
|
|
|
|
|
|
|
|
glColor4ub(255, 255, 255, alpha);
|
|
|
|
|
glRectf(x2-6, y1, x2, (y1+(y2-y1)/2));
|
|
|
|
|
|
|
|
|
|
glColor4ub(0, 0, 0, alpha);
|
|
|
|
|
glRectf(x2-6, (y1+(y2-y1)/2), x2, y2);
|
|
|
|
|
|
|
|
|
|
glDisable(GL_BLEND);
|
|
|
|
|
}
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
}
|
|
|
|
|
|
2003-12-07 06:05:08 +00:00
|
|
|
/* button/popup menu/iconrow drawing code */
|
|
|
|
|
static void ui_default_button(int type, int colorid, float asp, float x1, float y1, float x2, float y2, int flag)
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
{
|
2003-12-07 06:05:08 +00:00
|
|
|
int align= (flag & UI_BUT_ALIGN);
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
|
2003-12-07 06:05:08 +00:00
|
|
|
if(align) {
|
2003-10-21 07:02:04 +00:00
|
|
|
|
2003-12-07 06:05:08 +00:00
|
|
|
/* *** BOTTOM OUTER SUNKEN EFFECT *** */
|
2003-12-08 10:48:28 +00:00
|
|
|
if (!((align == UI_BUT_ALIGN_DOWN) ||
|
|
|
|
|
(align == (UI_BUT_ALIGN_DOWN|UI_BUT_ALIGN_RIGHT)) ||
|
|
|
|
|
(align == (UI_BUT_ALIGN_DOWN|UI_BUT_ALIGN_LEFT)))) {
|
2003-12-07 06:05:08 +00:00
|
|
|
glEnable(GL_BLEND);
|
|
|
|
|
MM_WHITE_OP;
|
|
|
|
|
fdrawline(x1, y1-1, x2, y1-1);
|
|
|
|
|
glDisable(GL_BLEND);
|
|
|
|
|
}
|
|
|
|
|
/* *** END BOTTOM OUTER SUNKEN EFFECT *** */
|
|
|
|
|
|
|
|
|
|
switch(align) {
|
|
|
|
|
case UI_BUT_ALIGN_TOP:
|
|
|
|
|
uiSetRoundBox(12);
|
|
|
|
|
|
|
|
|
|
/* last arg in shaded_button() determines whether the button is in the middle of
|
|
|
|
|
* an alignment group or not. 0 = not middle, 1 = is in the middle.
|
|
|
|
|
* Done to allow cleaner drawing
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
shaded_button(x1, y1, x2, y2, asp, colorid, flag, 0);
|
|
|
|
|
break;
|
|
|
|
|
case UI_BUT_ALIGN_DOWN:
|
|
|
|
|
uiSetRoundBox(3);
|
|
|
|
|
shaded_button(x1, y1, x2, y2, asp, colorid, flag, 0);
|
|
|
|
|
break;
|
|
|
|
|
case UI_BUT_ALIGN_LEFT:
|
|
|
|
|
|
|
|
|
|
/* RIGHT OUTER SUNKEN EFFECT */
|
|
|
|
|
glEnable(GL_BLEND);
|
|
|
|
|
glShadeModel(GL_SMOOTH);
|
|
|
|
|
glBegin(GL_LINES);
|
|
|
|
|
MM_WHITE_OP;
|
|
|
|
|
glVertex2f(x2+1,y1);
|
|
|
|
|
MM_WHITE_TR;
|
|
|
|
|
glVertex2f(x2+1,y2);
|
|
|
|
|
glEnd();
|
|
|
|
|
glDisable(GL_BLEND);
|
|
|
|
|
|
|
|
|
|
uiSetRoundBox(6);
|
|
|
|
|
shaded_button(x1, y1, x2, y2, asp, colorid, flag, 0);
|
|
|
|
|
break;
|
|
|
|
|
case UI_BUT_ALIGN_RIGHT:
|
|
|
|
|
|
|
|
|
|
/* LEFT OUTER SUNKEN EFFECT */
|
|
|
|
|
glEnable(GL_BLEND);
|
|
|
|
|
glShadeModel(GL_SMOOTH);
|
|
|
|
|
glBegin(GL_LINES);
|
|
|
|
|
MM_WHITE_OP;
|
|
|
|
|
glVertex2f(x1-1,y1);
|
|
|
|
|
MM_WHITE_TR;
|
|
|
|
|
glVertex2f(x1-1,y2);
|
|
|
|
|
glEnd();
|
|
|
|
|
glDisable(GL_BLEND);
|
|
|
|
|
|
|
|
|
|
uiSetRoundBox(9);
|
|
|
|
|
shaded_button(x1, y1, x2, y2, asp, colorid, flag, 0);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case UI_BUT_ALIGN_DOWN|UI_BUT_ALIGN_RIGHT:
|
|
|
|
|
uiSetRoundBox(1);
|
|
|
|
|
shaded_button(x1, y1, x2, y2, asp, colorid, flag, 0);
|
|
|
|
|
break;
|
|
|
|
|
case UI_BUT_ALIGN_DOWN|UI_BUT_ALIGN_LEFT:
|
|
|
|
|
uiSetRoundBox(2);
|
|
|
|
|
shaded_button(x1, y1, x2, y2, asp, colorid, flag, 0);
|
|
|
|
|
break;
|
|
|
|
|
case UI_BUT_ALIGN_TOP|UI_BUT_ALIGN_RIGHT:
|
|
|
|
|
|
|
|
|
|
/* LEFT OUTER SUNKEN EFFECT */
|
|
|
|
|
glEnable(GL_BLEND);
|
|
|
|
|
glShadeModel(GL_SMOOTH);
|
|
|
|
|
glBegin(GL_LINES);
|
|
|
|
|
MM_WHITE_OP;
|
|
|
|
|
glVertex2f(x1-1,y1);
|
|
|
|
|
MM_WHITE_TR;
|
|
|
|
|
glVertex2f(x1-1,y2);
|
|
|
|
|
glEnd();
|
|
|
|
|
glDisable(GL_BLEND);
|
|
|
|
|
|
|
|
|
|
uiSetRoundBox(8);
|
|
|
|
|
shaded_button(x1, y1, x2, y2, asp, colorid, flag, 0);
|
|
|
|
|
break;
|
|
|
|
|
case UI_BUT_ALIGN_TOP|UI_BUT_ALIGN_LEFT:
|
|
|
|
|
|
|
|
|
|
/* RIGHT OUTER SUNKEN EFFECT */
|
|
|
|
|
glEnable(GL_BLEND);
|
|
|
|
|
glShadeModel(GL_SMOOTH);
|
|
|
|
|
glBegin(GL_LINES);
|
|
|
|
|
MM_WHITE_OP;
|
|
|
|
|
glVertex2f(x2+1,y1);
|
|
|
|
|
MM_WHITE_TR;
|
|
|
|
|
glVertex2f(x2+1,y2);
|
|
|
|
|
glEnd();
|
|
|
|
|
glDisable(GL_BLEND);
|
|
|
|
|
|
|
|
|
|
uiSetRoundBox(4);
|
|
|
|
|
shaded_button(x1, y1, x2, y2, asp, colorid, flag, 0);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
shaded_button(x1, y1, x2, y2, asp, colorid, flag, 1);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2003-12-08 10:48:28 +00:00
|
|
|
else {
|
|
|
|
|
glEnable(GL_BLEND);
|
|
|
|
|
glShadeModel(GL_SMOOTH);
|
|
|
|
|
|
|
|
|
|
/* BOTTOM OUTER SUNKEN EFFECT */
|
|
|
|
|
MM_WHITE_OP;
|
|
|
|
|
fdrawline(x1, y1-1, x2, y1-1);
|
|
|
|
|
|
|
|
|
|
/* LEFT OUTER SUNKEN EFFECT */
|
|
|
|
|
glBegin(GL_LINES);
|
|
|
|
|
MM_WHITE_OP;
|
|
|
|
|
glVertex2f(x1-1,y1);
|
|
|
|
|
MM_WHITE_TR;
|
|
|
|
|
glVertex2f(x1-1,y2);
|
|
|
|
|
glEnd();
|
|
|
|
|
|
|
|
|
|
/* RIGHT OUTER SUNKEN EFFECT */
|
|
|
|
|
glBegin(GL_LINES);
|
|
|
|
|
MM_WHITE_OP;
|
|
|
|
|
glVertex2f(x2+1,y1);
|
|
|
|
|
MM_WHITE_TR;
|
|
|
|
|
glVertex2f(x2+1,y2);
|
|
|
|
|
glEnd();
|
|
|
|
|
|
|
|
|
|
glDisable(GL_BLEND);
|
|
|
|
|
|
2003-12-07 06:05:08 +00:00
|
|
|
uiSetRoundBox(15);
|
|
|
|
|
shaded_button(x1, y1, x2, y2, asp, colorid, flag, 0);
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
}
|
|
|
|
|
|
2003-12-07 06:05:08 +00:00
|
|
|
/* *** EXTRA DRAWING FOR SPECIFIC CONTROL TYPES *** */
|
|
|
|
|
switch(type) {
|
|
|
|
|
case ICONROW:
|
|
|
|
|
case ICONTEXTROW:
|
|
|
|
|
/* DARKENED AREA */
|
|
|
|
|
glEnable(GL_BLEND);
|
|
|
|
|
|
|
|
|
|
glColor4ub(0, 0, 0, 30);
|
|
|
|
|
glRectf(x2-9, y1, x2, y2);
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
|
2003-12-07 06:05:08 +00:00
|
|
|
glDisable(GL_BLEND);
|
|
|
|
|
/* END DARKENED AREA */
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
|
2003-12-07 06:05:08 +00:00
|
|
|
/* ICONROW DOUBLE-ARROW */
|
|
|
|
|
M_DARK;
|
|
|
|
|
ui_default_iconrow_arrows(x1, y1, x2, y2);
|
|
|
|
|
/* END ICONROW DOUBLE-ARROW */
|
|
|
|
|
break;
|
|
|
|
|
case MENU:
|
|
|
|
|
/* DARKENED AREA */
|
|
|
|
|
glEnable(GL_BLEND);
|
|
|
|
|
|
|
|
|
|
glColor4ub(0, 0, 0, 30);
|
|
|
|
|
glRectf(x2-18, y1, x2, y2);
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
|
2003-12-07 06:05:08 +00:00
|
|
|
glDisable(GL_BLEND);
|
|
|
|
|
/* END DARKENED AREA */
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
|
2003-12-07 06:05:08 +00:00
|
|
|
/* MENU DOUBLE-ARROW */
|
|
|
|
|
M_DARK;
|
|
|
|
|
ui_default_menu_arrows(x1, y1, x2, y2);
|
|
|
|
|
/* MENU DOUBLE-ARROW */
|
2003-12-08 10:48:28 +00:00
|
|
|
break;
|
|
|
|
|
}
|
2003-12-07 06:05:08 +00:00
|
|
|
}
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
|
|
|
|
|
|
2003-12-08 10:48:28 +00:00
|
|
|
/* number/text field drawing code */
|
2003-12-07 06:05:08 +00:00
|
|
|
static void ui_default_flat(int type, int colorid, float asp, float x1, float y1, float x2, float y2, int flag)
|
|
|
|
|
{
|
|
|
|
|
int align= (flag & UI_BUT_ALIGN);
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
|
2003-12-07 06:05:08 +00:00
|
|
|
if(align) {
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
|
2003-12-07 06:05:08 +00:00
|
|
|
/* *** BOTTOM OUTER SUNKEN EFFECT *** */
|
2003-12-08 10:48:28 +00:00
|
|
|
if (!((align == UI_BUT_ALIGN_DOWN) ||
|
|
|
|
|
(align == (UI_BUT_ALIGN_DOWN|UI_BUT_ALIGN_RIGHT)) ||
|
|
|
|
|
(align == (UI_BUT_ALIGN_DOWN|UI_BUT_ALIGN_LEFT)))) {
|
2003-12-07 06:05:08 +00:00
|
|
|
glEnable(GL_BLEND);
|
|
|
|
|
MM_WHITE_OP;
|
|
|
|
|
fdrawline(x1, y1-1, x2, y1-1);
|
|
|
|
|
glDisable(GL_BLEND);
|
|
|
|
|
}
|
|
|
|
|
/* *** END BOTTOM OUTER SUNKEN EFFECT *** */
|
|
|
|
|
|
|
|
|
|
switch(align) {
|
|
|
|
|
case UI_BUT_ALIGN_TOP:
|
|
|
|
|
uiSetRoundBox(12);
|
|
|
|
|
|
|
|
|
|
/* last arg in shaded_button() determines whether the button is in the middle of
|
|
|
|
|
* an alignment group or not. 0 = not middle, 1 = is in the middle.
|
|
|
|
|
* Done to allow cleaner drawing
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
flat_button(x1, y1, x2, y2, asp, colorid, flag, 0);
|
|
|
|
|
break;
|
|
|
|
|
case UI_BUT_ALIGN_DOWN:
|
|
|
|
|
uiSetRoundBox(3);
|
|
|
|
|
flat_button(x1, y1, x2, y2, asp, colorid, flag, 0);
|
|
|
|
|
break;
|
|
|
|
|
case UI_BUT_ALIGN_LEFT:
|
|
|
|
|
|
|
|
|
|
/* RIGHT OUTER SUNKEN EFFECT */
|
|
|
|
|
glEnable(GL_BLEND);
|
|
|
|
|
glShadeModel(GL_SMOOTH);
|
|
|
|
|
glBegin(GL_LINES);
|
|
|
|
|
MM_WHITE_OP;
|
|
|
|
|
glVertex2f(x2+1,y1);
|
|
|
|
|
MM_WHITE_TR;
|
|
|
|
|
glVertex2f(x2+1,y2);
|
|
|
|
|
glEnd();
|
|
|
|
|
glDisable(GL_BLEND);
|
|
|
|
|
|
|
|
|
|
uiSetRoundBox(6);
|
|
|
|
|
flat_button(x1, y1, x2, y2, asp, colorid, flag, 0);
|
|
|
|
|
break;
|
|
|
|
|
case UI_BUT_ALIGN_RIGHT:
|
|
|
|
|
|
|
|
|
|
/* LEFT OUTER SUNKEN EFFECT */
|
|
|
|
|
glEnable(GL_BLEND);
|
|
|
|
|
glShadeModel(GL_SMOOTH);
|
|
|
|
|
glBegin(GL_LINES);
|
|
|
|
|
MM_WHITE_OP;
|
|
|
|
|
glVertex2f(x1-1,y1);
|
|
|
|
|
MM_WHITE_TR;
|
|
|
|
|
glVertex2f(x1-1,y2);
|
|
|
|
|
glEnd();
|
|
|
|
|
glDisable(GL_BLEND);
|
|
|
|
|
|
|
|
|
|
uiSetRoundBox(9);
|
|
|
|
|
flat_button(x1, y1, x2, y2, asp, colorid, flag, 0);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case UI_BUT_ALIGN_DOWN|UI_BUT_ALIGN_RIGHT:
|
|
|
|
|
uiSetRoundBox(1);
|
|
|
|
|
flat_button(x1, y1, x2, y2, asp, colorid, flag, 0);
|
|
|
|
|
break;
|
|
|
|
|
case UI_BUT_ALIGN_DOWN|UI_BUT_ALIGN_LEFT:
|
|
|
|
|
uiSetRoundBox(2);
|
|
|
|
|
flat_button(x1, y1, x2, y2, asp, colorid, flag, 0);
|
|
|
|
|
break;
|
|
|
|
|
case UI_BUT_ALIGN_TOP|UI_BUT_ALIGN_RIGHT:
|
|
|
|
|
|
|
|
|
|
/* LEFT OUTER SUNKEN EFFECT */
|
|
|
|
|
glEnable(GL_BLEND);
|
|
|
|
|
glShadeModel(GL_SMOOTH);
|
|
|
|
|
glBegin(GL_LINES);
|
|
|
|
|
MM_WHITE_OP;
|
|
|
|
|
glVertex2f(x1-1,y1);
|
|
|
|
|
MM_WHITE_TR;
|
|
|
|
|
glVertex2f(x1-1,y2);
|
|
|
|
|
glEnd();
|
|
|
|
|
glDisable(GL_BLEND);
|
|
|
|
|
|
|
|
|
|
uiSetRoundBox(8);
|
|
|
|
|
flat_button(x1, y1, x2, y2, asp, colorid, flag, 0);
|
|
|
|
|
break;
|
|
|
|
|
case UI_BUT_ALIGN_TOP|UI_BUT_ALIGN_LEFT:
|
|
|
|
|
|
|
|
|
|
/* RIGHT OUTER SUNKEN EFFECT */
|
|
|
|
|
glEnable(GL_BLEND);
|
|
|
|
|
glShadeModel(GL_SMOOTH);
|
|
|
|
|
glBegin(GL_LINES);
|
|
|
|
|
MM_WHITE_OP;
|
|
|
|
|
glVertex2f(x2+1,y1);
|
|
|
|
|
MM_WHITE_TR;
|
|
|
|
|
glVertex2f(x2+1,y2);
|
|
|
|
|
glEnd();
|
|
|
|
|
glDisable(GL_BLEND);
|
|
|
|
|
|
|
|
|
|
uiSetRoundBox(4);
|
|
|
|
|
flat_button(x1, y1, x2, y2, asp, colorid, flag, 0);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
flat_button(x1, y1, x2, y2, asp, colorid, flag, 1);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
2003-12-08 10:48:28 +00:00
|
|
|
|
|
|
|
|
glEnable(GL_BLEND);
|
|
|
|
|
glShadeModel(GL_SMOOTH);
|
|
|
|
|
|
|
|
|
|
/* BOTTOM OUTER SUNKEN EFFECT */
|
|
|
|
|
MM_WHITE_OP;
|
|
|
|
|
fdrawline(x1, y1-1, x2, y1-1);
|
|
|
|
|
|
|
|
|
|
/* LEFT OUTER SUNKEN EFFECT */
|
|
|
|
|
glBegin(GL_LINES);
|
|
|
|
|
MM_WHITE_OP;
|
|
|
|
|
glVertex2f(x1-1,y1);
|
|
|
|
|
MM_WHITE_TR;
|
|
|
|
|
glVertex2f(x1-1,y2);
|
|
|
|
|
glEnd();
|
|
|
|
|
|
|
|
|
|
/* RIGHT OUTER SUNKEN EFFECT */
|
|
|
|
|
glBegin(GL_LINES);
|
|
|
|
|
MM_WHITE_OP;
|
|
|
|
|
glVertex2f(x2+1,y1);
|
|
|
|
|
MM_WHITE_TR;
|
|
|
|
|
glVertex2f(x2+1,y2);
|
|
|
|
|
glEnd();
|
|
|
|
|
|
|
|
|
|
glDisable(GL_BLEND);
|
|
|
|
|
|
2003-12-07 06:05:08 +00:00
|
|
|
uiSetRoundBox(15);
|
|
|
|
|
flat_button(x1, y1, x2, y2, asp, colorid, flag, 0);
|
|
|
|
|
}
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
|
2003-12-07 06:05:08 +00:00
|
|
|
/* *** EXTRA DRAWING FOR SPECIFIC CONTROL TYPES *** */
|
|
|
|
|
switch(type) {
|
|
|
|
|
case NUM:
|
2008-05-08 08:59:36 +00:00
|
|
|
case NUMABS:
|
2003-12-07 06:05:08 +00:00
|
|
|
/* SIDE ARROWS */
|
|
|
|
|
/* left */
|
|
|
|
|
if(flag & UI_SELECT) {
|
|
|
|
|
if(flag & UI_ACTIVE) M_DARK;
|
|
|
|
|
else M_DARK;
|
|
|
|
|
} else {
|
|
|
|
|
if(flag & UI_ACTIVE) M_GREY;
|
|
|
|
|
else M_LGREY;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ui_default_num_arrows(x1, y1, x2, y2);
|
|
|
|
|
/* END SIDE ARROWS */
|
|
|
|
|
}
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void ui_default_slider(int colorid, float fac, float aspect, float x1, float y1, float x2, float y2, int flag)
|
|
|
|
|
{
|
|
|
|
|
float ymid, yc;
|
|
|
|
|
|
|
|
|
|
/* the slider background line */
|
|
|
|
|
ymid= (y1+y2)/2.0;
|
2003-12-07 06:05:08 +00:00
|
|
|
//yc= 2.5*aspect; // height of center line
|
|
|
|
|
yc = 2.3; // height of center line
|
|
|
|
|
|
|
|
|
|
if(flag & UI_SELECT)
|
|
|
|
|
BIF_ThemeColorShade(TH_BUT_NUM, -5);
|
2008-05-08 08:59:36 +00:00
|
|
|
else {
|
2003-12-07 06:05:08 +00:00
|
|
|
if(flag & UI_ACTIVE)
|
|
|
|
|
BIF_ThemeColorShade(TH_BUT_NUM, +35);
|
|
|
|
|
else
|
|
|
|
|
BIF_ThemeColorShade(TH_BUT_NUM, +25);
|
2008-05-08 08:59:36 +00:00
|
|
|
}
|
2003-12-07 06:05:08 +00:00
|
|
|
|
|
|
|
|
glRectf(x1, ymid-yc, x2, ymid+yc);
|
|
|
|
|
|
|
|
|
|
/* top inner bevel */
|
|
|
|
|
if(flag & UI_SELECT) BIF_ThemeColorShade(TH_BUT_NUM, -40);
|
2003-12-08 10:48:28 +00:00
|
|
|
else BIF_ThemeColorShade(TH_BUT_NUM, -5);
|
2003-12-07 06:05:08 +00:00
|
|
|
fdrawline(x1+1, ymid+yc, x2, ymid+yc);
|
|
|
|
|
|
|
|
|
|
/* bottom inner bevel */
|
2003-12-08 10:48:28 +00:00
|
|
|
if(flag & UI_SELECT) BIF_ThemeColorShade(TH_BUT_NUM, +15);
|
2003-12-07 06:05:08 +00:00
|
|
|
else BIF_ThemeColorShade(TH_BUT_NUM, +45);
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
fdrawline(x1+1, ymid-yc, x2, ymid-yc);
|
|
|
|
|
|
2003-12-07 06:05:08 +00:00
|
|
|
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
/* the movable slider */
|
|
|
|
|
if(flag & UI_SELECT) BIF_ThemeColorShade(TH_BUT_NUM, +80);
|
|
|
|
|
else BIF_ThemeColorShade(TH_BUT_NUM, -45);
|
|
|
|
|
|
|
|
|
|
glShadeModel(GL_SMOOTH);
|
|
|
|
|
glBegin(GL_QUADS);
|
|
|
|
|
|
|
|
|
|
BIF_ThemeColorShade(TH_BUT_NUM, -45);
|
|
|
|
|
|
|
|
|
|
glVertex2f(x1, y1+2.5);
|
|
|
|
|
glVertex2f(x1+fac, y1+2.5);
|
|
|
|
|
|
|
|
|
|
BIF_ThemeColor(TH_BUT_NUM);
|
|
|
|
|
|
|
|
|
|
glVertex2f(x1+fac, y2-2.5);
|
|
|
|
|
glVertex2f(x1, y2-2.5);
|
|
|
|
|
|
|
|
|
|
glEnd();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* slider handle center */
|
|
|
|
|
glShadeModel(GL_SMOOTH);
|
|
|
|
|
glBegin(GL_QUADS);
|
|
|
|
|
|
|
|
|
|
BIF_ThemeColor(TH_BUT_NUM);
|
|
|
|
|
glVertex2f(x1+fac-3, y1+2);
|
|
|
|
|
glVertex2f(x1+fac, y1+4);
|
|
|
|
|
BIF_ThemeColorShade(TH_BUT_NUM, +80);
|
|
|
|
|
glVertex2f(x1+fac, y2-2);
|
|
|
|
|
glVertex2f(x1+fac-3, y2-2);
|
|
|
|
|
|
|
|
|
|
glEnd();
|
|
|
|
|
|
|
|
|
|
/* slider handle left bevel */
|
2003-12-08 10:48:28 +00:00
|
|
|
BIF_ThemeColorShade(TH_BUT_NUM, +70);
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
fdrawline(x1+fac-3, y2-2, x1+fac-3, y1+2);
|
|
|
|
|
|
|
|
|
|
/* slider handle right bevel */
|
2003-12-08 10:48:28 +00:00
|
|
|
BIF_ThemeColorShade(TH_BUT_NUM, -35);
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
fdrawline(x1+fac, y2-2, x1+fac, y1+2);
|
|
|
|
|
|
|
|
|
|
glShadeModel(GL_FLAT);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* default theme callback */
|
|
|
|
|
static void ui_draw_default(int type, int colorid, float aspect, float x1, float y1, float x2, float y2, int flag)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
switch(type) {
|
2003-12-07 06:05:08 +00:00
|
|
|
case TEX:
|
2003-12-08 10:48:28 +00:00
|
|
|
case IDPOIN:
|
|
|
|
|
case NUM:
|
2008-05-08 08:59:36 +00:00
|
|
|
case NUMABS:
|
2003-12-07 06:05:08 +00:00
|
|
|
ui_default_flat(type, colorid, aspect, x1, y1, x2, y2, flag);
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
break;
|
|
|
|
|
case ICONROW:
|
|
|
|
|
case ICONTEXTROW:
|
|
|
|
|
case MENU:
|
|
|
|
|
default:
|
2003-12-07 06:05:08 +00:00
|
|
|
ui_default_button(type, colorid, aspect, x1, y1, x2, y2, flag);
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2003-11-14 00:44:48 +00:00
|
|
|
/* *************** OLDSKOOL THEME ***************** */
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
|
2003-11-14 00:44:48 +00:00
|
|
|
static void ui_draw_outlineX(float x1, float y1, float x2, float y2, float asp1)
|
2003-10-21 11:46:12 +00:00
|
|
|
{
|
2003-11-14 00:44:48 +00:00
|
|
|
float vec[2];
|
|
|
|
|
|
|
|
|
|
glBegin(GL_LINE_LOOP);
|
|
|
|
|
vec[0]= x1+asp1; vec[1]= y1-asp1;
|
|
|
|
|
glVertex2fv(vec);
|
|
|
|
|
vec[0]= x2-asp1;
|
|
|
|
|
glVertex2fv(vec);
|
|
|
|
|
vec[0]= x2+asp1; vec[1]= y1+asp1;
|
|
|
|
|
glVertex2fv(vec);
|
|
|
|
|
vec[1]= y2-asp1;
|
|
|
|
|
glVertex2fv(vec);
|
|
|
|
|
vec[0]= x2-asp1; vec[1]= y2+asp1;
|
|
|
|
|
glVertex2fv(vec);
|
|
|
|
|
vec[0]= x1+asp1;
|
|
|
|
|
glVertex2fv(vec);
|
|
|
|
|
vec[0]= x1-asp1; vec[1]= y2-asp1;
|
|
|
|
|
glVertex2fv(vec);
|
|
|
|
|
vec[1]= y1+asp1;
|
|
|
|
|
glVertex2fv(vec);
|
|
|
|
|
glEnd();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void ui_draw_oldskool(int type, int colorid, float asp, float x1, float y1, float x2, float y2, int flag)
|
|
|
|
|
{
|
|
|
|
|
/* paper */
|
2003-10-21 11:46:12 +00:00
|
|
|
if(flag & UI_SELECT) {
|
|
|
|
|
if(flag & UI_ACTIVE) BIF_ThemeColorShade(colorid, -40);
|
|
|
|
|
else BIF_ThemeColorShade(colorid, -30);
|
|
|
|
|
}
|
|
|
|
|
else {
|
2003-11-14 00:44:48 +00:00
|
|
|
if(flag & UI_ACTIVE) BIF_ThemeColorShade(colorid, +30);
|
|
|
|
|
else BIF_ThemeColorShade(colorid, +20);
|
2003-10-21 11:46:12 +00:00
|
|
|
}
|
|
|
|
|
|
2003-11-14 00:44:48 +00:00
|
|
|
glRectf(x1+1, y1+1, x2-1, y2-1);
|
|
|
|
|
|
|
|
|
|
x1+= asp;
|
|
|
|
|
x2-= asp;
|
|
|
|
|
y1+= asp;
|
|
|
|
|
y2-= asp;
|
|
|
|
|
|
|
|
|
|
/* below */
|
|
|
|
|
if(flag & UI_SELECT) BIF_ThemeColorShade(colorid, 0);
|
|
|
|
|
else BIF_ThemeColorShade(colorid, -30);
|
|
|
|
|
fdrawline(x1, y1, x2, y1);
|
2003-10-21 11:46:12 +00:00
|
|
|
|
2003-11-14 00:44:48 +00:00
|
|
|
/* right */
|
|
|
|
|
fdrawline(x2, y1, x2, y2);
|
|
|
|
|
|
|
|
|
|
/* top */
|
|
|
|
|
if(flag & UI_SELECT) BIF_ThemeColorShade(colorid, -30);
|
|
|
|
|
else BIF_ThemeColorShade(colorid, 0);
|
|
|
|
|
fdrawline(x1, y2, x2, y2);
|
|
|
|
|
|
|
|
|
|
/* left */
|
|
|
|
|
fdrawline(x1, y1, x1, y2);
|
|
|
|
|
|
|
|
|
|
/* outline */
|
|
|
|
|
glColor3ub(0,0,0);
|
|
|
|
|
ui_draw_outlineX(x1, y1, x2, y2, asp);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* special type decorations */
|
|
|
|
|
switch(type) {
|
|
|
|
|
case NUM:
|
2008-05-08 08:59:36 +00:00
|
|
|
case NUMABS:
|
2003-11-14 00:44:48 +00:00
|
|
|
if(flag & UI_SELECT) BIF_ThemeColorShade(colorid, -60);
|
|
|
|
|
else BIF_ThemeColorShade(colorid, -30);
|
|
|
|
|
ui_default_num_arrows(x1, y1, x2, y2);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ICONROW:
|
|
|
|
|
case ICONTEXTROW:
|
|
|
|
|
if(flag & UI_ACTIVE) BIF_ThemeColorShade(colorid, 0);
|
|
|
|
|
else BIF_ThemeColorShade(colorid, -10);
|
|
|
|
|
glRectf(x2-9, y1+asp, x2-asp, y2-asp);
|
|
|
|
|
|
|
|
|
|
BIF_ThemeColorShade(colorid, -50);
|
|
|
|
|
ui_default_iconrow_arrows(x1, y1, x2, y2);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case MENU:
|
|
|
|
|
if(flag & UI_ACTIVE) BIF_ThemeColorShade(colorid, 0);
|
|
|
|
|
else BIF_ThemeColorShade(colorid, -10);
|
|
|
|
|
glRectf(x2-17, y1+asp, x2-asp, y2-asp);
|
|
|
|
|
|
|
|
|
|
BIF_ThemeColorShade(colorid, -50);
|
|
|
|
|
ui_default_menu_arrows(x1, y1, x2, y2);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* *************** BASIC ROUNDED THEME ***************** */
|
|
|
|
|
|
2004-10-04 12:37:16 +00:00
|
|
|
static void round_button(float x1, float y1, float x2, float y2, float asp,
|
|
|
|
|
int colorid, int round, int menudeco, int curshade)
|
2003-11-14 00:44:48 +00:00
|
|
|
{
|
|
|
|
|
float rad;
|
2004-10-04 12:37:16 +00:00
|
|
|
char col[4];
|
2003-11-14 00:44:48 +00:00
|
|
|
|
|
|
|
|
rad= (y2-y1)/2.0;
|
|
|
|
|
if(rad>7.0) rad= 7.0;
|
|
|
|
|
|
2004-10-04 12:37:16 +00:00
|
|
|
uiSetRoundBox(round);
|
2004-08-31 13:43:18 +00:00
|
|
|
gl_round_box(GL_POLYGON, x1, y1, x2, y2, rad);
|
|
|
|
|
|
2004-10-04 12:37:16 +00:00
|
|
|
if(menudeco) {
|
|
|
|
|
uiSetRoundBox(round & ~9);
|
|
|
|
|
BIF_ThemeColorShade(colorid, curshade-20);
|
|
|
|
|
gl_round_box(GL_POLYGON, x2-menudeco, y1, x2, y2, rad);
|
|
|
|
|
}
|
2003-11-14 00:44:48 +00:00
|
|
|
|
2004-10-04 12:37:16 +00:00
|
|
|
/* fake AA */
|
|
|
|
|
uiSetRoundBox(round);
|
2004-10-03 13:49:54 +00:00
|
|
|
glEnable( GL_BLEND );
|
2004-10-04 12:37:16 +00:00
|
|
|
|
|
|
|
|
BIF_GetThemeColor3ubv(colorid, col);
|
|
|
|
|
|
|
|
|
|
if(col[0]<100) col[0]= 0; else col[0]-= 100;
|
|
|
|
|
if(col[1]<100) col[1]= 0; else col[1]-= 100;
|
|
|
|
|
if(col[2]<100) col[2]= 0; else col[2]-= 100;
|
|
|
|
|
col[3]= 80;
|
2007-03-17 14:15:02 +00:00
|
|
|
glColor4ubv((GLubyte *)col);
|
2004-10-04 12:37:16 +00:00
|
|
|
gl_round_box(GL_LINE_LOOP, x1, y1, x2, y2, rad - asp);
|
|
|
|
|
gl_round_box(GL_LINE_LOOP, x1, y1, x2, y2, rad + asp);
|
|
|
|
|
col[3]= 180;
|
2007-03-17 14:15:02 +00:00
|
|
|
glColor4ubv((GLubyte *)col);
|
2004-08-31 13:43:18 +00:00
|
|
|
gl_round_box(GL_LINE_LOOP, x1, y1, x2, y2, rad);
|
2004-10-04 12:37:16 +00:00
|
|
|
|
2004-10-03 13:49:54 +00:00
|
|
|
glDisable( GL_BLEND );
|
2003-11-14 00:44:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* button in midst of alignment row */
|
2004-10-04 12:37:16 +00:00
|
|
|
static void round_button_mid(float x1, float y1, float x2, float y2, float asp,
|
|
|
|
|
int colorid, int align, int menudeco, int curshade)
|
2003-11-14 00:44:48 +00:00
|
|
|
{
|
|
|
|
|
glRectf(x1, y1, x2, y2);
|
|
|
|
|
|
2004-10-04 12:37:16 +00:00
|
|
|
if(menudeco) {
|
|
|
|
|
BIF_ThemeColorShade(colorid, curshade-20);
|
|
|
|
|
glRectf(x2-menudeco, y1, x2, y2);
|
|
|
|
|
}
|
|
|
|
|
|
2003-11-17 14:31:25 +00:00
|
|
|
BIF_ThemeColorBlendShade(colorid, TH_BACK, 0.5, -70);
|
2003-11-14 00:44:48 +00:00
|
|
|
// we draw full outline, its not AA, and it works better button mouse-over hilite
|
|
|
|
|
|
|
|
|
|
// left right
|
|
|
|
|
fdrawline(x1, y1, x1, y2);
|
|
|
|
|
fdrawline(x2, y1, x2, y2);
|
|
|
|
|
|
|
|
|
|
// top down
|
|
|
|
|
fdrawline(x1, y2, x2, y2);
|
2003-12-07 06:05:08 +00:00
|
|
|
fdrawline(x1, y1, x2, y1);
|
2003-11-14 00:44:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void ui_draw_round(int type, int colorid, float asp, float x1, float y1, float x2, float y2, int flag)
|
|
|
|
|
{
|
|
|
|
|
int align= (flag & UI_BUT_ALIGN);
|
2004-10-04 12:37:16 +00:00
|
|
|
int curshade= 0, menudeco= 0;
|
|
|
|
|
|
|
|
|
|
if(type==ICONROW || type==ICONTEXTROW) menudeco= 9;
|
|
|
|
|
else if((type==MENU || type==BLOCK) && x2-x1>24) menudeco= 16;
|
2003-11-14 00:44:48 +00:00
|
|
|
|
|
|
|
|
/* paper */
|
2003-10-21 11:46:12 +00:00
|
|
|
if(flag & UI_SELECT) {
|
2004-10-04 12:37:16 +00:00
|
|
|
if(flag & UI_ACTIVE) curshade= -40;
|
|
|
|
|
else curshade= -30;
|
2003-10-21 11:46:12 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2004-10-04 12:37:16 +00:00
|
|
|
if(flag & UI_ACTIVE) curshade= 30;
|
|
|
|
|
else curshade= +20;
|
2003-11-14 00:44:48 +00:00
|
|
|
}
|
|
|
|
|
|
2004-10-04 12:37:16 +00:00
|
|
|
BIF_ThemeColorShade(colorid, curshade);
|
|
|
|
|
|
2003-11-14 00:44:48 +00:00
|
|
|
if(align) {
|
2003-11-14 15:49:26 +00:00
|
|
|
switch(align) {
|
|
|
|
|
case UI_BUT_ALIGN_TOP:
|
2004-10-04 12:37:16 +00:00
|
|
|
round_button(x1, y1, x2, y2, asp, colorid, 12, menudeco, curshade);
|
2003-11-14 15:49:26 +00:00
|
|
|
break;
|
|
|
|
|
case UI_BUT_ALIGN_DOWN:
|
2004-10-04 12:37:16 +00:00
|
|
|
round_button(x1, y1, x2, y2, asp, colorid, 3, menudeco, curshade);
|
2003-11-14 15:49:26 +00:00
|
|
|
break;
|
|
|
|
|
case UI_BUT_ALIGN_LEFT:
|
2004-10-04 12:37:16 +00:00
|
|
|
round_button(x1, y1, x2, y2, asp, colorid, 6, menudeco, curshade);
|
2003-11-14 15:49:26 +00:00
|
|
|
break;
|
|
|
|
|
case UI_BUT_ALIGN_RIGHT:
|
2004-10-04 12:37:16 +00:00
|
|
|
round_button(x1, y1, x2, y2, asp, colorid, 9, menudeco, curshade);
|
2003-11-14 15:49:26 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case UI_BUT_ALIGN_DOWN|UI_BUT_ALIGN_RIGHT:
|
2004-10-04 12:37:16 +00:00
|
|
|
round_button(x1, y1, x2, y2, asp, colorid, 1, menudeco, curshade);
|
2003-11-14 15:49:26 +00:00
|
|
|
break;
|
|
|
|
|
case UI_BUT_ALIGN_DOWN|UI_BUT_ALIGN_LEFT:
|
2004-10-04 12:37:16 +00:00
|
|
|
round_button(x1, y1, x2, y2, asp, colorid, 2, menudeco, curshade);
|
2003-11-14 15:49:26 +00:00
|
|
|
break;
|
|
|
|
|
case UI_BUT_ALIGN_TOP|UI_BUT_ALIGN_RIGHT:
|
2004-10-04 12:37:16 +00:00
|
|
|
round_button(x1, y1, x2, y2, asp, colorid, 8, menudeco, curshade);
|
2003-11-14 15:49:26 +00:00
|
|
|
break;
|
|
|
|
|
case UI_BUT_ALIGN_TOP|UI_BUT_ALIGN_LEFT:
|
2004-10-04 12:37:16 +00:00
|
|
|
round_button(x1, y1, x2, y2, asp, colorid, 4, menudeco, curshade);
|
2003-11-14 15:49:26 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
2004-10-04 12:37:16 +00:00
|
|
|
round_button_mid(x1, y1, x2, y2, asp, colorid, align, menudeco, curshade);
|
2003-11-14 15:49:26 +00:00
|
|
|
break;
|
2003-11-14 00:44:48 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
2004-10-04 12:37:16 +00:00
|
|
|
round_button(x1, y1, x2, y2, asp, colorid, 15, menudeco, curshade);
|
2003-11-14 00:44:48 +00:00
|
|
|
}
|
2004-10-04 12:37:16 +00:00
|
|
|
|
2003-11-14 00:44:48 +00:00
|
|
|
/* special type decorations */
|
|
|
|
|
switch(type) {
|
|
|
|
|
case NUM:
|
2008-05-08 08:59:36 +00:00
|
|
|
case NUMABS:
|
2004-10-04 12:37:16 +00:00
|
|
|
BIF_ThemeColorShade(colorid, curshade-60);
|
2003-11-14 00:44:48 +00:00
|
|
|
ui_default_num_arrows(x1, y1, x2, y2);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ICONROW:
|
|
|
|
|
case ICONTEXTROW:
|
2004-10-04 12:37:16 +00:00
|
|
|
BIF_ThemeColorShade(colorid, curshade-60);
|
2003-11-14 00:44:48 +00:00
|
|
|
ui_default_iconrow_arrows(x1, y1, x2, y2);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case MENU:
|
2004-10-04 12:37:16 +00:00
|
|
|
case BLOCK:
|
|
|
|
|
BIF_ThemeColorShade(colorid, curshade-60);
|
2003-11-14 00:44:48 +00:00
|
|
|
ui_default_menu_arrows(x1, y1, x2, y2);
|
|
|
|
|
break;
|
2003-10-21 11:46:12 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2003-11-14 00:44:48 +00:00
|
|
|
/* *************** MINIMAL THEME ***************** */
|
|
|
|
|
|
|
|
|
|
// theme can define an embosfunc and sliderfunc, text+icon drawing is standard, no theme.
|
|
|
|
|
|
|
|
|
|
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
|
|
|
|
|
/* super minimal button as used in logic menu */
|
|
|
|
|
static void ui_draw_minimal(int type, int colorid, float asp, float x1, float y1, float x2, float y2, int flag)
|
|
|
|
|
{
|
2006-01-19 14:42:04 +00:00
|
|
|
/* too much space between buttons */
|
|
|
|
|
|
2007-04-28 17:21:00 +00:00
|
|
|
if (type==TEX || type==IDPOIN) {
|
|
|
|
|
x1+= asp;
|
|
|
|
|
x2-= (asp*2);
|
|
|
|
|
//y1+= asp;
|
|
|
|
|
y2-= asp;
|
|
|
|
|
} else {
|
|
|
|
|
/* Less space between buttons looks nicer */
|
|
|
|
|
y2-= asp;
|
|
|
|
|
x2-= asp;
|
|
|
|
|
}
|
2006-01-19 14:42:04 +00:00
|
|
|
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
/* paper */
|
|
|
|
|
if(flag & UI_SELECT) {
|
|
|
|
|
if(flag & UI_ACTIVE) BIF_ThemeColorShade(colorid, -40);
|
|
|
|
|
else BIF_ThemeColorShade(colorid, -30);
|
|
|
|
|
}
|
|
|
|
|
else {
|
2003-11-14 00:44:48 +00:00
|
|
|
if(flag & UI_ACTIVE) BIF_ThemeColorShade(colorid, +20);
|
|
|
|
|
else BIF_ThemeColorShade(colorid, +10);
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
glRectf(x1, y1, x2, y2);
|
2007-04-28 17:21:00 +00:00
|
|
|
|
|
|
|
|
if (type==TEX || type==IDPOIN) {
|
2003-11-14 00:44:48 +00:00
|
|
|
BIF_ThemeColorShade(colorid, -60);
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
|
|
|
|
|
/* top */
|
|
|
|
|
fdrawline(x1, y2, x2, y2);
|
|
|
|
|
/* left */
|
|
|
|
|
fdrawline(x1, y1, x1, y2);
|
|
|
|
|
|
2007-04-28 17:21:00 +00:00
|
|
|
|
|
|
|
|
/* text underline, some */
|
|
|
|
|
BIF_ThemeColorShade(colorid, +50);
|
|
|
|
|
glEnable(GL_LINE_STIPPLE);
|
|
|
|
|
glLineStipple(1, 0x8888);
|
|
|
|
|
fdrawline(x1+(asp*2), y1+(asp*3), x2-(asp*2), y1+(asp*3));
|
|
|
|
|
glDisable(GL_LINE_STIPPLE);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BIF_ThemeColorShade(colorid, +60);
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
/* below */
|
|
|
|
|
fdrawline(x1, y1, x2, y1);
|
|
|
|
|
/* right */
|
|
|
|
|
fdrawline(x2, y1, x2, y2);
|
2007-04-28 17:21:00 +00:00
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
if(flag & UI_SELECT) {
|
|
|
|
|
BIF_ThemeColorShade(colorid, -60);
|
|
|
|
|
|
|
|
|
|
/* top */
|
|
|
|
|
fdrawline(x1, y2, x2, y2);
|
|
|
|
|
/* left */
|
|
|
|
|
fdrawline(x1, y1, x1, y2);
|
|
|
|
|
BIF_ThemeColorShade(colorid, +40);
|
|
|
|
|
|
|
|
|
|
/* below */
|
|
|
|
|
fdrawline(x1, y1, x2, y1);
|
|
|
|
|
/* right */
|
|
|
|
|
fdrawline(x2, y1, x2, y2);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
BIF_ThemeColorShade(colorid, +40);
|
|
|
|
|
|
|
|
|
|
/* top */
|
|
|
|
|
fdrawline(x1, y2, x2, y2);
|
|
|
|
|
/* left */
|
|
|
|
|
fdrawline(x1, y1, x1, y2);
|
|
|
|
|
|
|
|
|
|
BIF_ThemeColorShade(colorid, -60);
|
|
|
|
|
/* below */
|
|
|
|
|
fdrawline(x1, y1, x2, y1);
|
|
|
|
|
/* right */
|
|
|
|
|
fdrawline(x2, y1, x2, y2);
|
|
|
|
|
}
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
}
|
2003-11-14 00:44:48 +00:00
|
|
|
|
|
|
|
|
/* special type decorations */
|
|
|
|
|
switch(type) {
|
|
|
|
|
case NUM:
|
2008-05-08 08:59:36 +00:00
|
|
|
case NUMABS:
|
2003-11-14 00:44:48 +00:00
|
|
|
if(flag & UI_SELECT) BIF_ThemeColorShade(colorid, -60);
|
|
|
|
|
else BIF_ThemeColorShade(colorid, -30);
|
|
|
|
|
ui_default_num_arrows(x1, y1, x2, y2);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ICONROW:
|
|
|
|
|
case ICONTEXTROW:
|
|
|
|
|
if(flag & UI_ACTIVE) BIF_ThemeColorShade(colorid, 0);
|
|
|
|
|
else BIF_ThemeColorShade(colorid, -10);
|
|
|
|
|
glRectf(x2-9, y1+asp, x2-asp, y2-asp);
|
|
|
|
|
|
|
|
|
|
BIF_ThemeColorShade(colorid, -50);
|
|
|
|
|
ui_default_iconrow_arrows(x1, y1, x2, y2);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case MENU:
|
2004-10-04 12:37:16 +00:00
|
|
|
case BLOCK:
|
2003-11-14 00:44:48 +00:00
|
|
|
if(flag & UI_ACTIVE) BIF_ThemeColorShade(colorid, 0);
|
|
|
|
|
else BIF_ThemeColorShade(colorid, -10);
|
|
|
|
|
glRectf(x2-17, y1+asp, x2-asp, y2-asp);
|
|
|
|
|
|
|
|
|
|
BIF_ThemeColorShade(colorid, -50);
|
|
|
|
|
ui_default_menu_arrows(x1, y1, x2, y2);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* fac is the slider handle position between x1 and x2 */
|
|
|
|
|
static void ui_draw_slider(int colorid, float fac, float aspect, float x1, float y1, float x2, float y2, int flag)
|
|
|
|
|
{
|
|
|
|
|
float ymid, yc;
|
|
|
|
|
|
|
|
|
|
/* the slider background line */
|
|
|
|
|
ymid= (y1+y2)/2.0;
|
|
|
|
|
yc= 1.7*aspect;
|
|
|
|
|
|
|
|
|
|
if(flag & UI_ACTIVE)
|
|
|
|
|
BIF_ThemeColorShade(colorid, -50);
|
|
|
|
|
else
|
|
|
|
|
BIF_ThemeColorShade(colorid, -40);
|
|
|
|
|
|
2003-11-23 12:22:59 +00:00
|
|
|
/* left part */
|
|
|
|
|
glRectf(x1, ymid-2.0*yc, x1+fac, ymid+2.0*yc);
|
|
|
|
|
/* right part */
|
|
|
|
|
glRectf(x1+fac, ymid-yc, x2, ymid+yc);
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
|
|
|
|
|
/* the movable slider */
|
2003-11-23 12:22:59 +00:00
|
|
|
|
|
|
|
|
BIF_ThemeColorShade(colorid, +70);
|
|
|
|
|
glRectf(x1+fac-aspect, ymid-2.0*yc, x1+fac+aspect, ymid+2.0*yc);
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2004-10-03 13:49:54 +00:00
|
|
|
/* ************** STANDARD MENU DRAWING FUNCTION ************* */
|
|
|
|
|
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
|
2004-10-03 13:49:54 +00:00
|
|
|
static void ui_shadowbox(float minx, float miny, float maxx, float maxy, float shadsize, unsigned char alpha)
|
|
|
|
|
{
|
|
|
|
|
glEnable(GL_BLEND);
|
|
|
|
|
glShadeModel(GL_SMOOTH);
|
|
|
|
|
|
|
|
|
|
/* right quad */
|
|
|
|
|
glBegin(GL_POLYGON);
|
|
|
|
|
glColor4ub(0, 0, 0, alpha);
|
|
|
|
|
glVertex2f(maxx, miny);
|
|
|
|
|
glVertex2f(maxx, maxy-shadsize);
|
|
|
|
|
glColor4ub(0, 0, 0, 0);
|
|
|
|
|
glVertex2f(maxx+shadsize, maxy-shadsize-shadsize);
|
|
|
|
|
glVertex2f(maxx+shadsize, miny);
|
|
|
|
|
glEnd();
|
|
|
|
|
|
|
|
|
|
/* corner shape */
|
|
|
|
|
glBegin(GL_POLYGON);
|
|
|
|
|
glColor4ub(0, 0, 0, alpha);
|
|
|
|
|
glVertex2f(maxx, miny);
|
|
|
|
|
glColor4ub(0, 0, 0, 0);
|
|
|
|
|
glVertex2f(maxx+shadsize, miny);
|
|
|
|
|
glVertex2f(maxx+0.7*shadsize, miny-0.7*shadsize);
|
|
|
|
|
glVertex2f(maxx, miny-shadsize);
|
|
|
|
|
glEnd();
|
|
|
|
|
|
|
|
|
|
/* bottom quad */
|
|
|
|
|
glBegin(GL_POLYGON);
|
|
|
|
|
glColor4ub(0, 0, 0, alpha);
|
|
|
|
|
glVertex2f(minx+shadsize, miny);
|
|
|
|
|
glVertex2f(maxx, miny);
|
|
|
|
|
glColor4ub(0, 0, 0, 0);
|
|
|
|
|
glVertex2f(maxx, miny-shadsize);
|
|
|
|
|
glVertex2f(minx+shadsize+shadsize, miny-shadsize);
|
|
|
|
|
glEnd();
|
|
|
|
|
|
|
|
|
|
glDisable(GL_BLEND);
|
|
|
|
|
glShadeModel(GL_FLAT);
|
|
|
|
|
}
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
|
2004-11-30 13:06:00 +00:00
|
|
|
void uiDrawBoxShadow(unsigned char alpha, float minx, float miny, float maxx, float maxy)
|
|
|
|
|
{
|
|
|
|
|
/* accumulated outline boxes to make shade not linear, is more pleasant */
|
|
|
|
|
ui_shadowbox(minx, miny, maxx, maxy, 6.0, (30*alpha)>>8);
|
|
|
|
|
ui_shadowbox(minx, miny, maxx, maxy, 4.0, (70*alpha)>>8);
|
|
|
|
|
ui_shadowbox(minx, miny, maxx, maxy, 2.0, (100*alpha)>>8);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2004-10-03 13:49:54 +00:00
|
|
|
// background for pulldowns, pullups, and other drawing temporal menus....
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
// has to be made themable still (now only color)
|
|
|
|
|
|
2004-07-05 08:48:17 +00:00
|
|
|
void uiDrawMenuBox(float minx, float miny, float maxx, float maxy, short flag)
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
{
|
2004-10-26 12:52:20 +00:00
|
|
|
char col[4];
|
|
|
|
|
BIF_GetThemeColor4ubv(TH_MENU_BACK, col);
|
|
|
|
|
|
2004-07-05 08:48:17 +00:00
|
|
|
if( (flag & UI_BLOCK_NOSHADOW)==0) {
|
2004-10-03 13:49:54 +00:00
|
|
|
/* accumulated outline boxes to make shade not linear, is more pleasant */
|
2004-10-26 12:52:20 +00:00
|
|
|
ui_shadowbox(minx, miny, maxx, maxy, 6.0, (30*col[3])>>8);
|
|
|
|
|
ui_shadowbox(minx, miny, maxx, maxy, 4.0, (70*col[3])>>8);
|
|
|
|
|
ui_shadowbox(minx, miny, maxx, maxy, 2.0, (100*col[3])>>8);
|
2004-07-05 08:48:17 +00:00
|
|
|
|
2004-10-26 12:52:20 +00:00
|
|
|
glEnable(GL_BLEND);
|
2007-03-17 14:15:02 +00:00
|
|
|
glColor4ubv((GLubyte *)col);
|
2004-10-26 12:52:20 +00:00
|
|
|
glRectf(minx-1, miny, minx, maxy); // 1 pixel on left, to distinguish sublevel menus
|
2004-07-05 08:48:17 +00:00
|
|
|
}
|
2004-10-26 12:52:20 +00:00
|
|
|
glEnable(GL_BLEND);
|
2007-03-17 14:15:02 +00:00
|
|
|
glColor4ubv((GLubyte *)col);
|
2003-10-21 07:02:04 +00:00
|
|
|
glRectf(minx, miny, maxx, maxy);
|
2004-10-26 12:52:20 +00:00
|
|
|
glDisable(GL_BLEND);
|
2003-10-21 07:02:04 +00:00
|
|
|
}
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
|
2004-11-30 13:06:00 +00:00
|
|
|
|
|
|
|
|
|
2004-10-03 13:49:54 +00:00
|
|
|
/* pulldown menu item */
|
|
|
|
|
static void ui_draw_pulldown_item(int type, int colorid, float asp, float x1, float y1, float x2, float y2, int flag)
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
{
|
2004-10-26 12:52:20 +00:00
|
|
|
char col[4];
|
|
|
|
|
|
|
|
|
|
BIF_GetThemeColor4ubv(TH_MENU_BACK, col);
|
2004-10-26 18:47:54 +00:00
|
|
|
if(col[3]!=255) {
|
|
|
|
|
glEnable(GL_BLEND);
|
|
|
|
|
}
|
2004-10-26 12:52:20 +00:00
|
|
|
|
|
|
|
|
if((flag & UI_ACTIVE) && type!=LABEL) {
|
|
|
|
|
BIF_ThemeColor4(TH_MENU_HILITE);
|
|
|
|
|
glRectf(x1, y1, x2, y2);
|
2004-10-03 13:49:54 +00:00
|
|
|
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
|
|
|
|
|
} else {
|
2004-10-26 12:52:20 +00:00
|
|
|
BIF_ThemeColor4(colorid); // is set at TH_MENU_ITEM when pulldown opened.
|
|
|
|
|
glRectf(x1, y1, x2, y2);
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
}
|
|
|
|
|
|
2004-10-26 12:52:20 +00:00
|
|
|
glDisable(GL_BLEND);
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
}
|
|
|
|
|
|
2004-10-03 13:49:54 +00:00
|
|
|
/* pulldown menu calling button */
|
|
|
|
|
static void ui_draw_pulldown_round(int type, int colorid, float asp, float x1, float y1, float x2, float y2, int flag)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if(flag & UI_ACTIVE) {
|
|
|
|
|
BIF_ThemeColor(TH_MENU_HILITE);
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
|
2004-10-03 13:49:54 +00:00
|
|
|
uiSetRoundBox(15);
|
|
|
|
|
gl_round_box(GL_POLYGON, x1, y1+3, x2, y2-3, 7.0);
|
|
|
|
|
|
|
|
|
|
glEnable( GL_LINE_SMOOTH );
|
|
|
|
|
glEnable( GL_BLEND );
|
|
|
|
|
gl_round_box(GL_LINE_LOOP, x1, y1+3, x2, y2-3, 7.0);
|
|
|
|
|
glDisable( GL_LINE_SMOOTH );
|
|
|
|
|
glDisable( GL_BLEND );
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
BIF_ThemeColor(colorid); // is set at TH_MENU_ITEM when pulldown opened.
|
|
|
|
|
glRectf(x1-1, y1+2, x2+1, y2-2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/* ************** TEXT AND ICON DRAWING FUNCTIONS ************* */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* draws text and icons for buttons */
|
|
|
|
|
static void ui_draw_text_icon(uiBut *but)
|
|
|
|
|
{
|
|
|
|
|
float x;
|
|
|
|
|
int len;
|
|
|
|
|
char *cpoin;
|
Patch by Matt Ebb: upgraded usablitiy of text button.
Textbuttons now allow a selection too (like any textbutton in other UIs).
By default, on activating a textbutton, the entire button text is selected
when you enter the button. A single arrowkey or LMB click reveils the
cursor then. Here's more user notes:
LMB click: If inside the button, places the text cursor at the clicked
position. If outside the button, confirms/finishes editing
LMB drag: Selects the text between the start and end point of the drag.
Backspace: Deletes selected text, or backspaces a character
Shift Backspace: Deletes all, as before.
Delete: Deletes selected text or forward deletes a character
Shift LeftArrow: Extends the selection left
Shift RightArrow: Extends the selection right
LeftArrow: If there's a selection, move the cursor to the left edge of the
selection, otherwise move the cursor left a character.
RightArrow: If there's a selection, move the cursor to the right edge of
the selection, otherwise move the cursor right a character.
UpArrow/Home: Move the cursor to the beginning of the line
DownArrow/End: Move the cursor to the end of the line
Ctrl Left arrow and Ctrl Right arrow to jump between directory separators
2005-11-20 10:04:45 +00:00
|
|
|
short t, pos, ch;
|
|
|
|
|
short selsta_tmp, selend_tmp, selsta_draw, selwidth_draw;
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
|
|
|
|
|
/* check for button text label */
|
|
|
|
|
if (but->type == ICONTEXTROW) {
|
2006-12-07 14:17:38 +00:00
|
|
|
ui_draw_icon(but, (BIFIconID) (but->icon+but->iconadd), 0);
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
}
|
2004-10-11 11:54:14 +00:00
|
|
|
else {
|
2004-09-29 18:08:04 +00:00
|
|
|
|
Patch by Matt Ebb: upgraded usablitiy of text button.
Textbuttons now allow a selection too (like any textbutton in other UIs).
By default, on activating a textbutton, the entire button text is selected
when you enter the button. A single arrowkey or LMB click reveils the
cursor then. Here's more user notes:
LMB click: If inside the button, places the text cursor at the clicked
position. If outside the button, confirms/finishes editing
LMB drag: Selects the text between the start and end point of the drag.
Backspace: Deletes selected text, or backspaces a character
Shift Backspace: Deletes all, as before.
Delete: Deletes selected text or forward deletes a character
Shift LeftArrow: Extends the selection left
Shift RightArrow: Extends the selection right
LeftArrow: If there's a selection, move the cursor to the left edge of the
selection, otherwise move the cursor left a character.
RightArrow: If there's a selection, move the cursor to the right edge of
the selection, otherwise move the cursor right a character.
UpArrow/Home: Move the cursor to the beginning of the line
DownArrow/End: Move the cursor to the end of the line
Ctrl Left arrow and Ctrl Right arrow to jump between directory separators
2005-11-20 10:04:45 +00:00
|
|
|
/* text button selection and cursor */
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
if(but->pos != -1) {
|
2004-10-11 11:54:14 +00:00
|
|
|
|
2006-12-26 10:18:38 +00:00
|
|
|
if ((but->selend - but->selsta) > 0) {
|
Patch by Matt Ebb: upgraded usablitiy of text button.
Textbuttons now allow a selection too (like any textbutton in other UIs).
By default, on activating a textbutton, the entire button text is selected
when you enter the button. A single arrowkey or LMB click reveils the
cursor then. Here's more user notes:
LMB click: If inside the button, places the text cursor at the clicked
position. If outside the button, confirms/finishes editing
LMB drag: Selects the text between the start and end point of the drag.
Backspace: Deletes selected text, or backspaces a character
Shift Backspace: Deletes all, as before.
Delete: Deletes selected text or forward deletes a character
Shift LeftArrow: Extends the selection left
Shift RightArrow: Extends the selection right
LeftArrow: If there's a selection, move the cursor to the left edge of the
selection, otherwise move the cursor left a character.
RightArrow: If there's a selection, move the cursor to the right edge of
the selection, otherwise move the cursor right a character.
UpArrow/Home: Move the cursor to the beginning of the line
DownArrow/End: Move the cursor to the end of the line
Ctrl Left arrow and Ctrl Right arrow to jump between directory separators
2005-11-20 10:04:45 +00:00
|
|
|
/* text button selection */
|
|
|
|
|
selsta_tmp = but->selsta + strlen(but->str);
|
|
|
|
|
selend_tmp = but->selend + strlen(but->str);
|
|
|
|
|
|
|
|
|
|
if(but->drawstr[0]!=0) {
|
|
|
|
|
ch= but->drawstr[selsta_tmp];
|
|
|
|
|
but->drawstr[selsta_tmp]= 0;
|
|
|
|
|
|
|
|
|
|
selsta_draw = but->aspect*BIF_GetStringWidth(but->font, but->drawstr+but->ofs, (U.transopts & USER_TR_BUTTONS)) + 3;
|
|
|
|
|
|
|
|
|
|
but->drawstr[selsta_tmp]= ch;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ch= but->drawstr[selend_tmp];
|
|
|
|
|
but->drawstr[selend_tmp]= 0;
|
|
|
|
|
|
|
|
|
|
selwidth_draw = but->aspect*BIF_GetStringWidth(but->font, but->drawstr+but->ofs, (U.transopts & USER_TR_BUTTONS)) + 3;
|
|
|
|
|
|
|
|
|
|
but->drawstr[selend_tmp]= ch;
|
|
|
|
|
|
|
|
|
|
BIF_ThemeColor(TH_BUT_TEXTFIELD_HI);
|
|
|
|
|
glRects(but->x1+selsta_draw+1, but->y1+2, but->x1+selwidth_draw+1, but->y2-2);
|
2004-10-11 11:54:14 +00:00
|
|
|
}
|
Patch by Matt Ebb: upgraded usablitiy of text button.
Textbuttons now allow a selection too (like any textbutton in other UIs).
By default, on activating a textbutton, the entire button text is selected
when you enter the button. A single arrowkey or LMB click reveils the
cursor then. Here's more user notes:
LMB click: If inside the button, places the text cursor at the clicked
position. If outside the button, confirms/finishes editing
LMB drag: Selects the text between the start and end point of the drag.
Backspace: Deletes selected text, or backspaces a character
Shift Backspace: Deletes all, as before.
Delete: Deletes selected text or forward deletes a character
Shift LeftArrow: Extends the selection left
Shift RightArrow: Extends the selection right
LeftArrow: If there's a selection, move the cursor to the left edge of the
selection, otherwise move the cursor left a character.
RightArrow: If there's a selection, move the cursor to the right edge of
the selection, otherwise move the cursor right a character.
UpArrow/Home: Move the cursor to the beginning of the line
DownArrow/End: Move the cursor to the end of the line
Ctrl Left arrow and Ctrl Right arrow to jump between directory separators
2005-11-20 10:04:45 +00:00
|
|
|
} else {
|
|
|
|
|
/* text cursor */
|
|
|
|
|
pos= but->pos+strlen(but->str);
|
|
|
|
|
if(pos >= but->ofs) {
|
|
|
|
|
if(but->drawstr[0]!=0) {
|
|
|
|
|
ch= but->drawstr[pos];
|
|
|
|
|
but->drawstr[pos]= 0;
|
|
|
|
|
|
|
|
|
|
t= but->aspect*BIF_GetStringWidth(but->font, but->drawstr+but->ofs, (U.transopts & USER_TR_BUTTONS)) + 3;
|
|
|
|
|
|
|
|
|
|
but->drawstr[pos]= ch;
|
|
|
|
|
}
|
|
|
|
|
else t= 3;
|
|
|
|
|
|
|
|
|
|
glColor3ub(255,0,0);
|
|
|
|
|
glRects(but->x1+t, but->y1+2, but->x1+t+2, but->y2-2);
|
|
|
|
|
}
|
|
|
|
|
}
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
}
|
2006-11-11 16:45:17 +00:00
|
|
|
|
|
|
|
|
if(but->type==BUT_TOGDUAL) {
|
|
|
|
|
int dualset= 0;
|
|
|
|
|
if(but->pointype==SHO)
|
|
|
|
|
dualset= BTST( *(((short *)but->poin)+1), but->bitnr);
|
|
|
|
|
else if(but->pointype==INT)
|
|
|
|
|
dualset= BTST( *(((int *)but->poin)+1), but->bitnr);
|
2006-12-07 14:17:38 +00:00
|
|
|
|
|
|
|
|
ui_draw_icon(but, ICON_DOT, dualset?0:-100);
|
2006-11-11 16:45:17 +00:00
|
|
|
}
|
|
|
|
|
|
2004-10-11 11:54:14 +00:00
|
|
|
if(but->drawstr[0]!=0) {
|
2004-12-03 15:28:48 +00:00
|
|
|
int transopts;
|
2005-05-29 10:59:50 +00:00
|
|
|
int tog3= 0;
|
2004-12-03 15:28:48 +00:00
|
|
|
|
2004-10-11 11:54:14 +00:00
|
|
|
// cut string in 2 parts
|
|
|
|
|
cpoin= strchr(but->drawstr, '|');
|
|
|
|
|
if(cpoin) *cpoin= 0;
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
|
2004-10-11 11:54:14 +00:00
|
|
|
/* If there's an icon too (made with uiDefIconTextBut) then draw the icon
|
|
|
|
|
and offset the text label to accomodate it */
|
|
|
|
|
|
|
|
|
|
if ( (but->flag & UI_HAS_ICON) && (but->flag & UI_ICON_LEFT) ) {
|
2006-12-07 14:17:38 +00:00
|
|
|
ui_draw_icon(but, but->icon, 0);
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
|
2006-02-14 11:28:13 +00:00
|
|
|
if(but->flag & UI_TEXT_LEFT) x= but->x1 + but->aspect*BIF_icon_get_width(but->icon)+5.0;
|
2004-10-11 11:54:14 +00:00
|
|
|
else x= (but->x1+but->x2-but->strwidth+1)/2.0;
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
}
|
2004-10-11 11:54:14 +00:00
|
|
|
else {
|
|
|
|
|
if(but->flag & UI_TEXT_LEFT) x= but->x1+4.0;
|
|
|
|
|
else x= (but->x1+but->x2-but->strwidth+1)/2.0;
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
}
|
|
|
|
|
|
2005-05-29 10:59:50 +00:00
|
|
|
/* tog3 button exception; draws with glColor! */
|
|
|
|
|
if(but->type==TOG3 && (but->flag & UI_SELECT)) {
|
|
|
|
|
|
|
|
|
|
if( but->pointype==CHA ) {
|
|
|
|
|
if( BTST( *(but->poin+2), but->bitnr )) tog3= 1;
|
|
|
|
|
}
|
|
|
|
|
else if( but->pointype ==SHO ) {
|
|
|
|
|
short *sp= (short *)but->poin;
|
|
|
|
|
if( BTST( sp[1], but->bitnr )) tog3= 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ui_tog3_invert(but->x1,but->y1,but->x2,but->y2, tog3);
|
|
|
|
|
if (tog3) glColor3ub(255, 255, 0);
|
|
|
|
|
}
|
|
|
|
|
|
2004-10-11 11:54:14 +00:00
|
|
|
/* text color, with pulldown item exception */
|
2005-05-29 10:59:50 +00:00
|
|
|
if(tog3); // color already set
|
|
|
|
|
else if(but->dt==UI_EMBOSSP) {
|
2004-10-26 12:52:20 +00:00
|
|
|
if((but->flag & (UI_SELECT|UI_ACTIVE)) && but->type!=LABEL) { // LABEL = title in pulldowns
|
2004-10-11 11:54:14 +00:00
|
|
|
BIF_ThemeColor(TH_MENU_TEXT_HI);
|
|
|
|
|
} else {
|
|
|
|
|
BIF_ThemeColor(TH_MENU_TEXT);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
if(but->flag & UI_SELECT) {
|
|
|
|
|
BIF_ThemeColor(TH_BUT_TEXT_HI);
|
|
|
|
|
} else {
|
|
|
|
|
BIF_ThemeColor(TH_BUT_TEXT);
|
|
|
|
|
}
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
}
|
2004-10-11 11:54:14 +00:00
|
|
|
|
|
|
|
|
/* LABEL button exception */
|
|
|
|
|
if(but->type==LABEL && but->min!=0.0) BIF_ThemeColor(TH_BUT_TEXT_HI);
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
|
2004-10-11 11:54:14 +00:00
|
|
|
ui_rasterpos_safe(x, (but->y1+but->y2- 9.0)/2.0, but->aspect);
|
2006-11-09 15:45:19 +00:00
|
|
|
if(but->type==IDPOIN) transopts= 0; // no translation, of course!
|
2004-12-03 15:28:48 +00:00
|
|
|
else transopts= (U.transopts & USER_TR_BUTTONS);
|
2007-08-01 10:33:01 +00:00
|
|
|
|
|
|
|
|
#ifdef INTERNATIONAL
|
2007-07-30 15:59:16 +00:00
|
|
|
if (but->type == FTPREVIEW)
|
|
|
|
|
FTF_DrawNewFontString (but->drawstr+but->ofs, FTF_INPUT_UTF8);
|
|
|
|
|
else
|
|
|
|
|
BIF_DrawString(but->font, but->drawstr+but->ofs, transopts);
|
2007-08-01 10:33:01 +00:00
|
|
|
#else
|
|
|
|
|
BIF_DrawString(but->font, but->drawstr+but->ofs, transopts);
|
|
|
|
|
#endif
|
2004-10-11 11:54:14 +00:00
|
|
|
|
|
|
|
|
/* part text right aligned */
|
|
|
|
|
if(cpoin) {
|
|
|
|
|
len= BIF_GetStringWidth(but->font, cpoin+1, (U.transopts & USER_TR_BUTTONS));
|
|
|
|
|
ui_rasterpos_safe( but->x2 - len*but->aspect-3, (but->y1+but->y2- 9.0)/2.0, but->aspect);
|
|
|
|
|
BIF_DrawString(but->font, cpoin+1, (U.transopts & USER_TR_BUTTONS));
|
|
|
|
|
*cpoin= '|';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/* if there's no text label, then check to see if there's an icon only and draw it */
|
|
|
|
|
else if( but->flag & UI_HAS_ICON ) {
|
2006-12-07 14:17:38 +00:00
|
|
|
ui_draw_icon(but, (BIFIconID) (but->icon+but->iconadd), 0);
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void ui_draw_but_COL(uiBut *but)
|
|
|
|
|
{
|
|
|
|
|
float *fp;
|
|
|
|
|
char colr, colg, colb;
|
|
|
|
|
|
|
|
|
|
if( but->pointype==FLO ) {
|
|
|
|
|
fp= (float *)but->poin;
|
|
|
|
|
colr= floor(255.0*fp[0]+0.5);
|
|
|
|
|
colg= floor(255.0*fp[1]+0.5);
|
|
|
|
|
colb= floor(255.0*fp[2]+0.5);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
char *cp= (char *)but->poin;
|
|
|
|
|
colr= cp[0];
|
|
|
|
|
colg= cp[1];
|
|
|
|
|
colb= cp[2];
|
|
|
|
|
}
|
2003-11-22 18:38:53 +00:00
|
|
|
|
|
|
|
|
/* exception... hrms, but can't simply use the emboss callback for this now. */
|
|
|
|
|
/* this button type needs review, and nice integration with rest of API here */
|
|
|
|
|
if(but->embossfunc == ui_draw_round) {
|
|
|
|
|
char *cp= BIF_ThemeGetColorPtr(U.themes.first, 0, TH_CUSTOM);
|
|
|
|
|
cp[0]= colr; cp[1]= colg; cp[2]= colb;
|
Area lights and more...
- New lamp type added "Area". This uses the radiosity formula (Stoke) to
calculate the amount of energy which is received from a plane. Result
is very nice local light, which nicely spreads out.
- Area lamps have a 'gamma' option to control the light spread
- Area lamp builtin sizes: square, rect, cube & box. Only first 2 are
implemented. Set a type, and define area size
- Button area size won't affect the amount of energy. But scaling the lamp
in 3d window will do. This is to cover the case when you scale an entire
scene, the light then will remain identical
If you just want to change area lamp size, use buttons when you dont want
to make the scene too bright or too dark
- Since area lights realistically are sensitive for distance (quadratic), the
effect it has is quickly too much, or too less. For this the "Dist" value
in Lamp can be used. Set it at Dist=10 to have reasonable light on distance
10 Blender units (assumed you didnt scale lamp object).
- I tried square sized specularity, but this looked totally weird. Not
committed
- Plan is to extend area light with 3d dimensions, boxes and cubes.
- Note that area light is one-sided, towards negative Z. I need to design
a nice drawing method for it.
Area Shadow
- Since there are a lot of variables associated with soft shadow, they now
only are available for Area lights. Allowing spot & normal lamp to have
soft shadow is possible though, but will require a reorganisation of the
Lamp buttons. Is a point of research & feedback still.
- Apart from area size, you now can individually set amount of samples in
X and Y direction (for area lamp type 'Rect'). For box type area lamp,
this will become 3 dimensions
- Area shadows have four options:
"Clip circle" : only uses a circular shape of samples, gives smoother
results
"Dither" : use a 2x2 dither mask
"Jitter" : applys a pseudo-random offset to samples
"Umbra" : extra emphasis on area that's fully in shadow.
Raytrace speedup
- improved filling in faces in Octree. Large faces occupied too many nodes
- added a coherence check; rays fired sequentially that begin and end in
same octree nodes, and that don't intersect, are quickly rejected
- rendering shadow scenes benefits from this 20-40%. My statue test monkey
file now renders in 19 seconds (was 30).
Plus:
- adjusted specular max to 511, and made sure Blinn spec has again this
incredible small spec size
- for UI rounded theme: the color "button" displayed RGB color too dark
- fixed countall() function, to also include Subsurf totals
- removed setting the 'near' clipping for pressing dot-key numpad
- when you press the buttons-window icon for 'Shading Context' the context
automaticilly switches as with F5 hotkey
Please be warned that this is not a release... settings in files might not
work as it did, nor guaranteed to work when we do a release. :)
2003-12-29 16:52:51 +00:00
|
|
|
but->flag &= ~UI_SELECT;
|
2003-11-22 18:38:53 +00:00
|
|
|
but->embossfunc(but->type, TH_CUSTOM, but->aspect, but->x1, but->y1, but->x2, but->y2, but->flag);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
|
|
glColor3ub(colr, colg, colb);
|
|
|
|
|
glRectf((but->x1), (but->y1), (but->x2), (but->y2));
|
|
|
|
|
glColor3ub(0, 0, 0);
|
|
|
|
|
fdrawbox((but->x1), (but->y1), (but->x2), (but->y2));
|
|
|
|
|
}
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
}
|
|
|
|
|
|
2004-07-05 08:48:17 +00:00
|
|
|
/* draws in resolution of 20x4 colors */
|
|
|
|
|
static void ui_draw_but_HSVCUBE(uiBut *but)
|
|
|
|
|
{
|
|
|
|
|
int a;
|
2004-10-14 14:20:24 +00:00
|
|
|
float h,s,v;
|
2004-07-05 08:48:17 +00:00
|
|
|
float dx, dy, sx1, sx2, sy, x, y;
|
|
|
|
|
float col0[4][3]; // left half, rect bottom to top
|
|
|
|
|
float col1[4][3]; // right half, rect bottom to top
|
|
|
|
|
|
2004-10-14 14:20:24 +00:00
|
|
|
h= but->hsv[0];
|
|
|
|
|
s= but->hsv[1];
|
|
|
|
|
v= but->hsv[2];
|
2004-07-05 08:48:17 +00:00
|
|
|
|
|
|
|
|
/* draw series of gouraud rects */
|
|
|
|
|
glShadeModel(GL_SMOOTH);
|
|
|
|
|
|
|
|
|
|
if(but->a1==0) { // H and V vary
|
|
|
|
|
hsv_to_rgb(0.0, s, 0.0, &col1[0][0], &col1[0][1], &col1[0][2]);
|
|
|
|
|
hsv_to_rgb(0.0, s, 0.333, &col1[1][0], &col1[1][1], &col1[1][2]);
|
|
|
|
|
hsv_to_rgb(0.0, s, 0.666, &col1[2][0], &col1[2][1], &col1[2][2]);
|
|
|
|
|
hsv_to_rgb(0.0, s, 1.0, &col1[3][0], &col1[3][1], &col1[3][2]);
|
|
|
|
|
x= h; y= v;
|
|
|
|
|
}
|
|
|
|
|
else if(but->a1==1) { // H and S vary
|
|
|
|
|
hsv_to_rgb(0.0, 0.0, v, &col1[0][0], &col1[0][1], &col1[0][2]);
|
|
|
|
|
hsv_to_rgb(0.0, 0.333, v, &col1[1][0], &col1[1][1], &col1[1][2]);
|
|
|
|
|
hsv_to_rgb(0.0, 0.666, v, &col1[2][0], &col1[2][1], &col1[2][2]);
|
|
|
|
|
hsv_to_rgb(0.0, 1.0, v, &col1[3][0], &col1[3][1], &col1[3][2]);
|
|
|
|
|
x= h; y= s;
|
|
|
|
|
}
|
2004-07-05 22:15:27 +00:00
|
|
|
else if(but->a1==2) { // S and V vary
|
2004-07-05 08:48:17 +00:00
|
|
|
hsv_to_rgb(h, 0.0, 0.0, &col1[0][0], &col1[0][1], &col1[0][2]);
|
|
|
|
|
hsv_to_rgb(h, 0.333, 0.0, &col1[1][0], &col1[1][1], &col1[1][2]);
|
|
|
|
|
hsv_to_rgb(h, 0.666, 0.0, &col1[2][0], &col1[2][1], &col1[2][2]);
|
|
|
|
|
hsv_to_rgb(h, 1.0, 0.0, &col1[3][0], &col1[3][1], &col1[3][2]);
|
|
|
|
|
x= v; y= s;
|
|
|
|
|
}
|
2004-07-05 22:15:27 +00:00
|
|
|
else { // only hue slider
|
|
|
|
|
hsv_to_rgb(0.0, 1.0, 1.0, &col1[0][0], &col1[0][1], &col1[0][2]);
|
|
|
|
|
VECCOPY(col1[1], col1[0]);
|
|
|
|
|
VECCOPY(col1[2], col1[0]);
|
|
|
|
|
VECCOPY(col1[3], col1[0]);
|
|
|
|
|
x= h; y= 0.5;
|
|
|
|
|
}
|
2004-07-05 08:48:17 +00:00
|
|
|
|
|
|
|
|
for(dx=0.0; dx<1.0; dx+= 0.05) {
|
|
|
|
|
// previous color
|
|
|
|
|
VECCOPY(col0[0], col1[0]);
|
|
|
|
|
VECCOPY(col0[1], col1[1]);
|
|
|
|
|
VECCOPY(col0[2], col1[2]);
|
|
|
|
|
VECCOPY(col0[3], col1[3]);
|
|
|
|
|
|
|
|
|
|
// new color
|
|
|
|
|
if(but->a1==0) { // H and V vary
|
|
|
|
|
hsv_to_rgb(dx, s, 0.0, &col1[0][0], &col1[0][1], &col1[0][2]);
|
|
|
|
|
hsv_to_rgb(dx, s, 0.333, &col1[1][0], &col1[1][1], &col1[1][2]);
|
|
|
|
|
hsv_to_rgb(dx, s, 0.666, &col1[2][0], &col1[2][1], &col1[2][2]);
|
|
|
|
|
hsv_to_rgb(dx, s, 1.0, &col1[3][0], &col1[3][1], &col1[3][2]);
|
|
|
|
|
}
|
|
|
|
|
else if(but->a1==1) { // H and S vary
|
|
|
|
|
hsv_to_rgb(dx, 0.0, v, &col1[0][0], &col1[0][1], &col1[0][2]);
|
|
|
|
|
hsv_to_rgb(dx, 0.333, v, &col1[1][0], &col1[1][1], &col1[1][2]);
|
|
|
|
|
hsv_to_rgb(dx, 0.666, v, &col1[2][0], &col1[2][1], &col1[2][2]);
|
|
|
|
|
hsv_to_rgb(dx, 1.0, v, &col1[3][0], &col1[3][1], &col1[3][2]);
|
|
|
|
|
}
|
2004-07-05 22:15:27 +00:00
|
|
|
else if(but->a1==2) { // S and V vary
|
2004-07-05 08:48:17 +00:00
|
|
|
hsv_to_rgb(h, 0.0, dx, &col1[0][0], &col1[0][1], &col1[0][2]);
|
|
|
|
|
hsv_to_rgb(h, 0.333, dx, &col1[1][0], &col1[1][1], &col1[1][2]);
|
|
|
|
|
hsv_to_rgb(h, 0.666, dx, &col1[2][0], &col1[2][1], &col1[2][2]);
|
|
|
|
|
hsv_to_rgb(h, 1.0, dx, &col1[3][0], &col1[3][1], &col1[3][2]);
|
|
|
|
|
}
|
2004-07-05 22:15:27 +00:00
|
|
|
else { // only H
|
|
|
|
|
hsv_to_rgb(dx, 1.0, 1.0, &col1[0][0], &col1[0][1], &col1[0][2]);
|
|
|
|
|
VECCOPY(col1[1], col1[0]);
|
|
|
|
|
VECCOPY(col1[2], col1[0]);
|
|
|
|
|
VECCOPY(col1[3], col1[0]);
|
|
|
|
|
}
|
2004-07-05 08:48:17 +00:00
|
|
|
|
|
|
|
|
// rect
|
|
|
|
|
sx1= but->x1 + dx*(but->x2-but->x1);
|
|
|
|
|
sx2= but->x1 + (dx+0.05)*(but->x2-but->x1);
|
|
|
|
|
sy= but->y1;
|
|
|
|
|
dy= (but->y2-but->y1)/3.0;
|
|
|
|
|
|
|
|
|
|
glBegin(GL_QUADS);
|
|
|
|
|
for(a=0; a<3; a++, sy+=dy) {
|
|
|
|
|
glColor3fv(col0[a]);
|
|
|
|
|
glVertex2f(sx1, sy);
|
|
|
|
|
|
|
|
|
|
glColor3fv(col1[a]);
|
|
|
|
|
glVertex2f(sx2, sy);
|
|
|
|
|
|
|
|
|
|
glColor3fv(col1[a+1]);
|
|
|
|
|
glVertex2f(sx2, sy+dy);
|
|
|
|
|
|
|
|
|
|
glColor3fv(col0[a+1]);
|
|
|
|
|
glVertex2f(sx1, sy+dy);
|
|
|
|
|
}
|
|
|
|
|
glEnd();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
glShadeModel(GL_FLAT);
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
|
2004-07-05 08:48:17 +00:00
|
|
|
/* cursor */
|
2004-07-05 10:22:00 +00:00
|
|
|
x= but->x1 + x*(but->x2-but->x1);
|
|
|
|
|
y= but->y1 + y*(but->y2-but->y1);
|
|
|
|
|
CLAMP(x, but->x1+3.0, but->x2-3.0);
|
|
|
|
|
CLAMP(y, but->y1+3.0, but->y2-3.0);
|
|
|
|
|
|
2004-07-29 13:57:59 +00:00
|
|
|
fdrawXORcirc(x, y, 3.1);
|
2004-07-05 08:48:17 +00:00
|
|
|
|
|
|
|
|
/* outline */
|
|
|
|
|
glColor3ub(0, 0, 0);
|
|
|
|
|
fdrawbox((but->x1), (but->y1), (but->x2), (but->y2));
|
|
|
|
|
}
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
|
2005-09-14 14:02:21 +00:00
|
|
|
#ifdef INTERNATIONAL
|
|
|
|
|
static void ui_draw_but_CHARTAB(uiBut *but)
|
|
|
|
|
{
|
|
|
|
|
/* Some local variables */
|
|
|
|
|
float sx, sy, ex, ey;
|
|
|
|
|
float width, height;
|
|
|
|
|
float butw, buth;
|
2005-09-24 16:02:56 +00:00
|
|
|
int x, y, cs;
|
2005-09-14 14:02:21 +00:00
|
|
|
wchar_t wstr[2];
|
|
|
|
|
unsigned char ustr[16];
|
|
|
|
|
PackedFile *pf;
|
2005-10-28 15:36:09 +00:00
|
|
|
int result = 0;
|
2006-01-23 15:14:01 +00:00
|
|
|
int charmax = G.charmax;
|
2007-06-04 10:53:37 +00:00
|
|
|
|
2006-03-09 16:57:19 +00:00
|
|
|
/* <builtin> font in use. There are TTF <builtin> and non-TTF <builtin> fonts */
|
2006-01-23 15:14:01 +00:00
|
|
|
if(!strcmp(G.selfont->name, "<builtin>"))
|
2006-03-09 16:57:19 +00:00
|
|
|
{
|
|
|
|
|
if(G.ui_international == TRUE)
|
|
|
|
|
{
|
|
|
|
|
charmax = 0xff;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
charmax = 0xff;
|
|
|
|
|
}
|
|
|
|
|
}
|
2005-09-14 14:02:21 +00:00
|
|
|
|
2006-01-23 12:52:53 +00:00
|
|
|
/* Category list exited without selecting the area */
|
|
|
|
|
if(G.charmax == 0)
|
2006-01-23 15:14:01 +00:00
|
|
|
charmax = G.charmax = 0xffff;
|
2005-09-14 14:02:21 +00:00
|
|
|
|
|
|
|
|
/* Calculate the size of the button */
|
|
|
|
|
width = abs(but->x2 - but->x1);
|
|
|
|
|
height = abs(but->y2 - but->y1);
|
|
|
|
|
|
|
|
|
|
butw = floor(width / 12);
|
|
|
|
|
buth = floor(height / 6);
|
|
|
|
|
|
|
|
|
|
/* Initialize variables */
|
|
|
|
|
sx = but->x1;
|
|
|
|
|
ex = but->x1 + butw;
|
|
|
|
|
sy = but->y1 + height - buth;
|
|
|
|
|
ey = but->y1 + height;
|
|
|
|
|
|
|
|
|
|
cs = G.charstart;
|
|
|
|
|
|
2006-03-09 16:57:19 +00:00
|
|
|
/* Set the font, in case it is not <builtin> font */
|
2005-09-14 14:02:21 +00:00
|
|
|
if(G.selfont && strcmp(G.selfont->name, "<builtin>"))
|
|
|
|
|
{
|
|
|
|
|
char tmpStr[256];
|
|
|
|
|
|
|
|
|
|
// Is the font file packed, if so then use the packed file
|
|
|
|
|
if(G.selfont->packedfile)
|
|
|
|
|
{
|
|
|
|
|
pf = G.selfont->packedfile;
|
|
|
|
|
FTF_SetFont(pf->data, pf->size, 14.0);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
int err;
|
|
|
|
|
|
|
|
|
|
strcpy(tmpStr, G.selfont->name);
|
2008-05-04 09:41:15 +00:00
|
|
|
BLI_convertstringcode(tmpStr, G.sce);
|
2006-01-23 15:14:01 +00:00
|
|
|
err = FTF_SetFont((unsigned char *)tmpStr, 0, 14.0);
|
2005-09-14 14:02:21 +00:00
|
|
|
}
|
|
|
|
|
}
|
2006-03-09 16:57:19 +00:00
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if(G.ui_international == TRUE)
|
|
|
|
|
{
|
|
|
|
|
FTF_SetFont((unsigned char *) datatoc_bfont_ttf, datatoc_bfont_ttf_size, 14.0);
|
|
|
|
|
}
|
|
|
|
|
}
|
2005-09-14 14:02:21 +00:00
|
|
|
|
|
|
|
|
/* Start drawing the button itself */
|
|
|
|
|
glShadeModel(GL_SMOOTH);
|
|
|
|
|
|
|
|
|
|
glColor3ub(200, 200, 200);
|
|
|
|
|
glRectf((but->x1), (but->y1), (but->x2), (but->y2));
|
|
|
|
|
|
|
|
|
|
glColor3ub(0, 0, 0);
|
|
|
|
|
for(y = 0; y < 6; y++)
|
|
|
|
|
{
|
|
|
|
|
// Do not draw more than the category allows
|
2006-01-23 15:14:01 +00:00
|
|
|
if(cs > charmax) break;
|
2005-09-14 14:02:21 +00:00
|
|
|
|
|
|
|
|
for(x = 0; x < 12; x++)
|
|
|
|
|
{
|
|
|
|
|
// Do not draw more than the category allows
|
2006-01-23 15:14:01 +00:00
|
|
|
if(cs > charmax) break;
|
2005-09-14 14:02:21 +00:00
|
|
|
|
|
|
|
|
// Draw one grid cell
|
|
|
|
|
glBegin(GL_LINE_LOOP);
|
|
|
|
|
glVertex2f(sx, sy);
|
|
|
|
|
glVertex2f(ex, sy);
|
|
|
|
|
glVertex2f(ex, ey);
|
|
|
|
|
glVertex2f(sx, ey);
|
|
|
|
|
glEnd();
|
|
|
|
|
|
|
|
|
|
// Draw character inside the cell
|
|
|
|
|
memset(wstr, 0, sizeof(wchar_t)*2);
|
|
|
|
|
memset(ustr, 0, 16);
|
2006-01-23 15:14:01 +00:00
|
|
|
|
|
|
|
|
// Set the font to be either unicode or <builtin>
|
2005-09-14 14:02:21 +00:00
|
|
|
wstr[0] = cs;
|
2006-01-23 15:14:01 +00:00
|
|
|
if(strcmp(G.selfont->name, "<builtin>"))
|
|
|
|
|
{
|
|
|
|
|
wcs2utf8s((char *)ustr, (wchar_t *)wstr);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2006-03-09 16:57:19 +00:00
|
|
|
if(G.ui_international == TRUE)
|
|
|
|
|
{
|
|
|
|
|
wcs2utf8s((char *)ustr, (wchar_t *)wstr);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ustr[0] = cs;
|
|
|
|
|
ustr[1] = 0;
|
|
|
|
|
}
|
2006-01-23 15:14:01 +00:00
|
|
|
}
|
2005-09-14 14:02:21 +00:00
|
|
|
|
2006-03-09 16:57:19 +00:00
|
|
|
if((G.selfont && strcmp(G.selfont->name, "<builtin>")) || (G.selfont && !strcmp(G.selfont->name, "<builtin>") && G.ui_international == TRUE))
|
2005-09-14 14:02:21 +00:00
|
|
|
{
|
|
|
|
|
float wid;
|
|
|
|
|
float llx, lly, llz, urx, ury, urz;
|
|
|
|
|
float dx, dy;
|
|
|
|
|
float px, py;
|
|
|
|
|
|
|
|
|
|
// Calculate the position
|
2006-01-23 15:14:01 +00:00
|
|
|
wid = FTF_GetStringWidth((char *) ustr, FTF_USE_GETTEXT | FTF_INPUT_UTF8);
|
|
|
|
|
FTF_GetBoundingBox((char *) ustr, &llx,&lly,&llz,&urx,&ury,&urz, FTF_USE_GETTEXT | FTF_INPUT_UTF8);
|
2005-09-14 14:02:21 +00:00
|
|
|
dx = urx-llx;
|
|
|
|
|
dy = ury-lly;
|
|
|
|
|
|
|
|
|
|
// This isn't fully functional since the but->aspect isn't working like I suspected
|
|
|
|
|
px = sx + ((butw/but->aspect)-dx)/2;
|
|
|
|
|
py = sy + ((buth/but->aspect)-dy)/2;
|
|
|
|
|
|
|
|
|
|
// Set the position and draw the character
|
|
|
|
|
ui_rasterpos_safe(px, py, but->aspect);
|
2006-01-23 15:14:01 +00:00
|
|
|
FTF_DrawString((char *) ustr, FTF_USE_GETTEXT | FTF_INPUT_UTF8);
|
2005-09-14 14:02:21 +00:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ui_rasterpos_safe(sx + butw/2, sy + buth/2, but->aspect);
|
2006-01-23 15:14:01 +00:00
|
|
|
BIF_DrawString(but->font, (char *) ustr, 0);
|
2005-09-14 14:02:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Calculate the next position and character
|
|
|
|
|
sx += butw; ex +=butw;
|
|
|
|
|
cs++;
|
|
|
|
|
}
|
|
|
|
|
/* Add the y position and reset x position */
|
|
|
|
|
sy -= buth;
|
|
|
|
|
ey -= buth;
|
|
|
|
|
sx = but->x1;
|
|
|
|
|
ex = but->x1 + butw;
|
|
|
|
|
}
|
|
|
|
|
glShadeModel(GL_FLAT);
|
2005-10-28 15:36:09 +00:00
|
|
|
|
|
|
|
|
/* Return Font Settings to original */
|
|
|
|
|
if(U.fontsize && U.fontname[0])
|
|
|
|
|
{
|
2006-01-23 15:14:01 +00:00
|
|
|
result = FTF_SetFont((unsigned char *)U.fontname, 0, U.fontsize);
|
2005-10-28 15:36:09 +00:00
|
|
|
}
|
|
|
|
|
else if (U.fontsize)
|
|
|
|
|
{
|
2006-01-23 15:14:01 +00:00
|
|
|
result = FTF_SetFont((unsigned char *) datatoc_bfont_ttf, datatoc_bfont_ttf_size, U.fontsize);
|
2005-10-28 15:36:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (result == 0)
|
|
|
|
|
{
|
2006-01-23 15:14:01 +00:00
|
|
|
result = FTF_SetFont((unsigned char *) datatoc_bfont_ttf, datatoc_bfont_ttf_size, 11);
|
2005-10-28 15:36:09 +00:00
|
|
|
}
|
2007-06-04 10:53:37 +00:00
|
|
|
|
|
|
|
|
/* resets the font size */
|
|
|
|
|
if(G.ui_international == TRUE)
|
|
|
|
|
{
|
|
|
|
|
uiSetCurFont(but->block, UI_HELV);
|
|
|
|
|
}
|
2005-09-14 14:02:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif // INTERNATIONAL
|
|
|
|
|
|
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
|
|
|
static void ui_draw_but_COLORBAND(uiBut *but)
|
|
|
|
|
{
|
|
|
|
|
ColorBand *coba= (ColorBand *)but->poin;
|
|
|
|
|
CBData *cbd;
|
|
|
|
|
float x1, y1, sizex, sizey;
|
2008-02-04 00:14:06 +00:00
|
|
|
float dx, v3[2], v1[2], v2[2], v1a[2], v2a[2];
|
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
|
|
|
int a;
|
|
|
|
|
|
|
|
|
|
if(coba==NULL) return;
|
|
|
|
|
|
|
|
|
|
x1= but->x1;
|
|
|
|
|
y1= but->y1;
|
|
|
|
|
sizex= but->x2-x1;
|
|
|
|
|
sizey= but->y2-y1;
|
|
|
|
|
|
|
|
|
|
/* first background, to show tranparency */
|
|
|
|
|
dx= sizex/12.0;
|
|
|
|
|
v1[0]= x1;
|
|
|
|
|
for(a=0; a<12; a++) {
|
|
|
|
|
if(a & 1) glColor3f(0.3, 0.3, 0.3); else glColor3f(0.8, 0.8, 0.8);
|
|
|
|
|
glRectf(v1[0], y1, v1[0]+dx, y1+0.5*sizey);
|
|
|
|
|
if(a & 1) glColor3f(0.8, 0.8, 0.8); else glColor3f(0.3, 0.3, 0.3);
|
|
|
|
|
glRectf(v1[0], y1+0.5*sizey, v1[0]+dx, y1+sizey);
|
|
|
|
|
v1[0]+= dx;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
glShadeModel(GL_SMOOTH);
|
|
|
|
|
glEnable(GL_BLEND);
|
|
|
|
|
|
|
|
|
|
cbd= coba->data;
|
|
|
|
|
|
|
|
|
|
v1[0]= v2[0]= x1;
|
|
|
|
|
v1[1]= y1;
|
|
|
|
|
v2[1]= y1+sizey;
|
|
|
|
|
|
|
|
|
|
glBegin(GL_QUAD_STRIP);
|
|
|
|
|
|
|
|
|
|
glColor4fv( &cbd->r );
|
|
|
|
|
glVertex2fv(v1); glVertex2fv(v2);
|
|
|
|
|
|
|
|
|
|
for(a=0; a<coba->tot; a++, cbd++) {
|
|
|
|
|
|
|
|
|
|
v1[0]=v2[0]= x1+ cbd->pos*sizex;
|
|
|
|
|
|
|
|
|
|
glColor4fv( &cbd->r );
|
|
|
|
|
glVertex2fv(v1); glVertex2fv(v2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
v1[0]=v2[0]= x1+ sizex;
|
|
|
|
|
glVertex2fv(v1); glVertex2fv(v2);
|
|
|
|
|
|
|
|
|
|
glEnd();
|
|
|
|
|
glShadeModel(GL_FLAT);
|
|
|
|
|
glDisable(GL_BLEND);
|
|
|
|
|
|
|
|
|
|
/* outline */
|
|
|
|
|
v1[0]= x1; v1[1]= y1;
|
|
|
|
|
|
|
|
|
|
cpack(0x0);
|
|
|
|
|
glBegin(GL_LINE_LOOP);
|
|
|
|
|
glVertex2fv(v1);
|
|
|
|
|
v1[0]+= sizex;
|
|
|
|
|
glVertex2fv(v1);
|
|
|
|
|
v1[1]+= sizey;
|
|
|
|
|
glVertex2fv(v1);
|
|
|
|
|
v1[0]-= sizex;
|
|
|
|
|
glVertex2fv(v1);
|
|
|
|
|
glEnd();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* help lines */
|
|
|
|
|
v1[0]= v2[0]=v3[0]= x1;
|
|
|
|
|
v1[1]= y1;
|
2008-02-04 00:14:06 +00:00
|
|
|
v1a[1]= y1+0.25*sizey;
|
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
|
|
|
v2[1]= y1+0.5*sizey;
|
2008-02-04 00:14:06 +00:00
|
|
|
v2a[1]= y1+0.75*sizey;
|
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
|
|
|
v3[1]= y1+sizey;
|
|
|
|
|
|
2008-02-04 00:14:06 +00:00
|
|
|
|
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
|
|
|
cbd= coba->data;
|
|
|
|
|
glBegin(GL_LINES);
|
|
|
|
|
for(a=0; a<coba->tot; a++, cbd++) {
|
2008-02-04 00:14:06 +00:00
|
|
|
v1[0]=v2[0]=v3[0]=v1a[0]=v2a[0]= x1+ cbd->pos*sizex;
|
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
|
|
|
|
|
|
|
|
if(a==coba->cur) {
|
2008-02-04 00:14:06 +00:00
|
|
|
glColor3ub(0, 0, 0);
|
|
|
|
|
glVertex2fv(v1);
|
|
|
|
|
glVertex2fv(v3);
|
|
|
|
|
glEnd();
|
|
|
|
|
|
|
|
|
|
setlinestyle(2);
|
|
|
|
|
glBegin(GL_LINES);
|
|
|
|
|
glColor3ub(255, 255, 255);
|
|
|
|
|
glVertex2fv(v1);
|
|
|
|
|
glVertex2fv(v3);
|
|
|
|
|
glEnd();
|
|
|
|
|
setlinestyle(0);
|
|
|
|
|
glBegin(GL_LINES);
|
|
|
|
|
|
|
|
|
|
/* glColor3ub(0, 0, 0);
|
|
|
|
|
glVertex2fv(v1);
|
|
|
|
|
glVertex2fv(v1a);
|
|
|
|
|
glColor3ub(255, 255, 255);
|
|
|
|
|
glVertex2fv(v1a);
|
|
|
|
|
glVertex2fv(v2);
|
|
|
|
|
glColor3ub(0, 0, 0);
|
|
|
|
|
glVertex2fv(v2);
|
|
|
|
|
glVertex2fv(v2a);
|
|
|
|
|
glColor3ub(255, 255, 255);
|
|
|
|
|
glVertex2fv(v2a);
|
|
|
|
|
glVertex2fv(v3);
|
|
|
|
|
*/
|
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
|
|
|
}
|
2008-02-04 00:14:06 +00:00
|
|
|
else {
|
|
|
|
|
glColor3ub(0, 0, 0);
|
|
|
|
|
glVertex2fv(v1);
|
|
|
|
|
glVertex2fv(v2);
|
|
|
|
|
|
|
|
|
|
glColor3ub(255, 255, 255);
|
|
|
|
|
glVertex2fv(v2);
|
|
|
|
|
glVertex2fv(v3);
|
|
|
|
|
}
|
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
|
|
|
}
|
|
|
|
|
glEnd();
|
|
|
|
|
}
|
|
|
|
|
|
2005-12-30 11:25:15 +00:00
|
|
|
static void ui_draw_but_NORMAL(uiBut *but)
|
|
|
|
|
{
|
|
|
|
|
static GLuint displist=0;
|
|
|
|
|
int a, old[8];
|
2005-12-30 15:56:42 +00:00
|
|
|
GLfloat diff[4], diffn[4]={1.0f, 1.0f, 1.0f, 1.0f};
|
|
|
|
|
float vec0[4]={0.0f, 0.0f, 0.0f, 0.0f};
|
2005-12-30 11:25:15 +00:00
|
|
|
float dir[4], size;
|
|
|
|
|
|
2005-12-30 15:56:42 +00:00
|
|
|
/* store stuff */
|
|
|
|
|
glGetMaterialfv(GL_FRONT, GL_DIFFUSE, diff);
|
|
|
|
|
|
2005-12-30 11:25:15 +00:00
|
|
|
/* backdrop */
|
|
|
|
|
BIF_ThemeColor(TH_BUT_NEUTRAL);
|
|
|
|
|
uiSetRoundBox(15);
|
|
|
|
|
gl_round_box(GL_POLYGON, but->x1, but->y1, but->x2, but->y2, 5.0f);
|
|
|
|
|
|
|
|
|
|
/* sphere color */
|
2005-12-30 15:56:42 +00:00
|
|
|
glMaterialfv(GL_FRONT, GL_DIFFUSE, diffn);
|
2005-12-30 11:25:15 +00:00
|
|
|
glCullFace(GL_BACK); glEnable(GL_CULL_FACE);
|
|
|
|
|
|
|
|
|
|
/* disable blender light */
|
|
|
|
|
for(a=0; a<8; a++) {
|
|
|
|
|
old[a]= glIsEnabled(GL_LIGHT0+a);
|
|
|
|
|
glDisable(GL_LIGHT0+a);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* own light */
|
|
|
|
|
glEnable(GL_LIGHT7);
|
|
|
|
|
glEnable(GL_LIGHTING);
|
|
|
|
|
|
|
|
|
|
VECCOPY(dir, (float *)but->poin);
|
|
|
|
|
dir[3]= 0.0f; /* glLight needs 4 args, 0.0 is sun */
|
|
|
|
|
glLightfv(GL_LIGHT7, GL_POSITION, dir);
|
2005-12-30 15:56:42 +00:00
|
|
|
glLightfv(GL_LIGHT7, GL_DIFFUSE, diffn);
|
2005-12-30 11:25:15 +00:00
|
|
|
glLightfv(GL_LIGHT7, GL_SPECULAR, vec0);
|
|
|
|
|
glLightf(GL_LIGHT7, GL_CONSTANT_ATTENUATION, 1.0f);
|
|
|
|
|
glLightf(GL_LIGHT7, GL_LINEAR_ATTENUATION, 0.0f);
|
|
|
|
|
|
|
|
|
|
/* transform to button */
|
|
|
|
|
glPushMatrix();
|
|
|
|
|
glTranslatef(but->x1 + 0.5f*(but->x2-but->x1), but->y1+ 0.5f*(but->y2-but->y1), 0.0f);
|
|
|
|
|
size= (but->x2-but->x1)/200.f;
|
|
|
|
|
glScalef(size, size, size);
|
|
|
|
|
|
|
|
|
|
if(displist==0) {
|
|
|
|
|
GLUquadricObj *qobj;
|
|
|
|
|
|
|
|
|
|
displist= glGenLists(1);
|
|
|
|
|
glNewList(displist, GL_COMPILE_AND_EXECUTE);
|
|
|
|
|
|
2005-12-30 15:56:42 +00:00
|
|
|
qobj= gluNewQuadric();
|
2005-12-30 11:25:15 +00:00
|
|
|
gluQuadricDrawStyle(qobj, GLU_FILL);
|
|
|
|
|
glShadeModel(GL_SMOOTH);
|
|
|
|
|
gluSphere( qobj, 100.0, 32, 24);
|
|
|
|
|
glShadeModel(GL_FLAT);
|
|
|
|
|
gluDeleteQuadric(qobj);
|
|
|
|
|
|
|
|
|
|
glEndList();
|
|
|
|
|
}
|
|
|
|
|
else glCallList(displist);
|
|
|
|
|
|
2005-12-30 15:56:42 +00:00
|
|
|
/* restore */
|
2005-12-30 11:25:15 +00:00
|
|
|
glPopMatrix();
|
|
|
|
|
glDisable(GL_LIGHTING);
|
|
|
|
|
glDisable(GL_CULL_FACE);
|
2005-12-30 15:56:42 +00:00
|
|
|
glMaterialfv(GL_FRONT, GL_DIFFUSE, diff);
|
|
|
|
|
|
|
|
|
|
glDisable(GL_LIGHT7);
|
2005-12-30 11:25:15 +00:00
|
|
|
|
|
|
|
|
/* enable blender light */
|
|
|
|
|
for(a=0; a<8; a++) {
|
|
|
|
|
if(old[a])
|
|
|
|
|
glEnable(GL_LIGHT0+a);
|
|
|
|
|
}
|
Orange:
- New UI element: the "Curve Button".
For mapping ranges (like 0 - 1) to another range, the curve button can be
used for proportional falloff, bone influences, painting density, etc.
Most evident use is of course to map RGB color with curves.
To be able to use it, you have to allocate a CurveMapping struct and pass
this on to the button. The CurveMapping API is in the new C file
blenkernel/intern/colortools.c
It's as simple as calling:
curvemap= curvemapping_add(3, 0, 0, 1, 1)
Which will create 3 curves, and sets a default 0-1 range. The current code
only supports up to 4 curves maximum per mapping struct.
The CurveMap button in Blender than handles allmost all editing.
Evaluating a single channel:
float newvalue= curvemapping_evaluateF(curvemap, 0, oldval);
Where the second argument is the channel index, here 0-1-2 are possible.
Or mapping a vector:
curvemapping_evaluate3F(curvemap, newvec, oldvec);
Optimized versions for byte or short mapping is possible too, not done yet.
In butspace.c I've added a template wrapper for buttons around the curve, to
reveil settings or show tools; check this screenie:
http://www.blender.org/bf/curves.jpg
- Buttons R, G, B: select channel
- icons + and -: zoom in, out
- icon 'wrench': menu with tools, like clear curve, set handle type
- icon 'clipping': menu with clip values, and to dis/enable clipping
- icon 'x': delete selection
In the curve button itself, only LMB clicks are handled (like all UI elements
in Blender).
- click on point: select
- shift+click on point: swap select
- click on point + drag: select point (if not selected) and move it
- click outside point + drag: translate view
- CTRL+click: add new point
- hold SHIFT while dragging to snap to grid
(Yes I know... either one of these can be Blender compliant, not both!)
- if you drag a point exactly on top of another, it merges them
Other fixes:
- Icons now draw using "Safe RasterPos", so they align with pixel boundary.
the old code made ints from the raster pos coordinate, which doesn't work
well for zoom in/out situations
- bug in Node editing: buttons could not get freed, causing in memory error
prints at end of a Blender session. That one was a very simple, but nasty
error causing me all evening last night to find!
(Hint; check diff of editnode.c, where uiDoButtons is called)
Last note: this adds 3 new files in our tree, I did scons, but not MSVC!
2006-01-08 11:41:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void ui_draw_but_curve_grid(uiBut *but, float zoomx, float zoomy, float offsx, float offsy, float step)
|
|
|
|
|
{
|
|
|
|
|
float dx, dy, fx, fy;
|
|
|
|
|
|
|
|
|
|
glBegin(GL_LINES);
|
|
|
|
|
dx= step*zoomx;
|
|
|
|
|
fx= but->x1 + zoomx*(-offsx);
|
|
|
|
|
if(fx > but->x1) fx -= dx*( floor(fx-but->x1));
|
|
|
|
|
while(fx < but->x2) {
|
|
|
|
|
glVertex2f(fx, but->y1);
|
|
|
|
|
glVertex2f(fx, but->y2);
|
|
|
|
|
fx+= dx;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dy= step*zoomy;
|
|
|
|
|
fy= but->y1 + zoomy*(-offsy);
|
|
|
|
|
if(fy > but->y1) fy -= dy*( floor(fy-but->y1));
|
|
|
|
|
while(fy < but->y2) {
|
|
|
|
|
glVertex2f(but->x1, fy);
|
|
|
|
|
glVertex2f(but->x2, fy);
|
|
|
|
|
fy+= dy;
|
|
|
|
|
}
|
|
|
|
|
glEnd();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void ui_draw_but_CURVE(uiBut *but)
|
|
|
|
|
{
|
|
|
|
|
CurveMapping *cumap= (CurveMapping *)but->poin;
|
|
|
|
|
CurveMap *cuma= cumap->cm+cumap->cur;
|
|
|
|
|
CurveMapPoint *cmp;
|
|
|
|
|
float fx, fy, dx, dy, fac[2], zoomx, zoomy, offsx, offsy;
|
|
|
|
|
GLint scissor[4];
|
|
|
|
|
int a;
|
|
|
|
|
|
|
|
|
|
/* need scissor test, curve can draw outside of boundary */
|
|
|
|
|
glGetIntegerv(GL_VIEWPORT, scissor);
|
|
|
|
|
fx= but->x1; fy= but->y1;
|
|
|
|
|
ui_graphics_to_window(but->win, &fx, &fy);
|
|
|
|
|
dx= but->x2; dy= but->y2;
|
|
|
|
|
ui_graphics_to_window(but->win, &dx, &dy);
|
|
|
|
|
glScissor((int)floor(fx), (int)floor(fy), (int)ceil(dx-fx), (int)ceil(dy-fy));
|
|
|
|
|
|
|
|
|
|
/* calculate offset and zoom */
|
|
|
|
|
zoomx= (but->x2-but->x1-2.0*but->aspect)/(cumap->curr.xmax - cumap->curr.xmin);
|
|
|
|
|
zoomy= (but->y2-but->y1-2.0*but->aspect)/(cumap->curr.ymax - cumap->curr.ymin);
|
|
|
|
|
offsx= cumap->curr.xmin-but->aspect/zoomx;
|
|
|
|
|
offsy= cumap->curr.ymin-but->aspect/zoomy;
|
|
|
|
|
|
|
|
|
|
/* backdrop */
|
|
|
|
|
if(cumap->flag & CUMA_DO_CLIP) {
|
|
|
|
|
BIF_ThemeColorShade(TH_BUT_NEUTRAL, -20);
|
|
|
|
|
glRectf(but->x1, but->y1, but->x2, but->y2);
|
|
|
|
|
BIF_ThemeColor(TH_BUT_NEUTRAL);
|
|
|
|
|
glRectf(but->x1 + zoomx*(cumap->clipr.xmin-offsx),
|
|
|
|
|
but->y1 + zoomy*(cumap->clipr.ymin-offsy),
|
|
|
|
|
but->x1 + zoomx*(cumap->clipr.xmax-offsx),
|
|
|
|
|
but->y1 + zoomy*(cumap->clipr.ymax-offsy));
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
BIF_ThemeColor(TH_BUT_NEUTRAL);
|
|
|
|
|
glRectf(but->x1, but->y1, but->x2, but->y2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* grid, every .25 step */
|
2006-05-09 07:45:06 +00:00
|
|
|
BIF_ThemeColorShade(TH_BUT_NEUTRAL, -16);
|
Orange:
- New UI element: the "Curve Button".
For mapping ranges (like 0 - 1) to another range, the curve button can be
used for proportional falloff, bone influences, painting density, etc.
Most evident use is of course to map RGB color with curves.
To be able to use it, you have to allocate a CurveMapping struct and pass
this on to the button. The CurveMapping API is in the new C file
blenkernel/intern/colortools.c
It's as simple as calling:
curvemap= curvemapping_add(3, 0, 0, 1, 1)
Which will create 3 curves, and sets a default 0-1 range. The current code
only supports up to 4 curves maximum per mapping struct.
The CurveMap button in Blender than handles allmost all editing.
Evaluating a single channel:
float newvalue= curvemapping_evaluateF(curvemap, 0, oldval);
Where the second argument is the channel index, here 0-1-2 are possible.
Or mapping a vector:
curvemapping_evaluate3F(curvemap, newvec, oldvec);
Optimized versions for byte or short mapping is possible too, not done yet.
In butspace.c I've added a template wrapper for buttons around the curve, to
reveil settings or show tools; check this screenie:
http://www.blender.org/bf/curves.jpg
- Buttons R, G, B: select channel
- icons + and -: zoom in, out
- icon 'wrench': menu with tools, like clear curve, set handle type
- icon 'clipping': menu with clip values, and to dis/enable clipping
- icon 'x': delete selection
In the curve button itself, only LMB clicks are handled (like all UI elements
in Blender).
- click on point: select
- shift+click on point: swap select
- click on point + drag: select point (if not selected) and move it
- click outside point + drag: translate view
- CTRL+click: add new point
- hold SHIFT while dragging to snap to grid
(Yes I know... either one of these can be Blender compliant, not both!)
- if you drag a point exactly on top of another, it merges them
Other fixes:
- Icons now draw using "Safe RasterPos", so they align with pixel boundary.
the old code made ints from the raster pos coordinate, which doesn't work
well for zoom in/out situations
- bug in Node editing: buttons could not get freed, causing in memory error
prints at end of a Blender session. That one was a very simple, but nasty
error causing me all evening last night to find!
(Hint; check diff of editnode.c, where uiDoButtons is called)
Last note: this adds 3 new files in our tree, I did scons, but not MSVC!
2006-01-08 11:41:06 +00:00
|
|
|
ui_draw_but_curve_grid(but, zoomx, zoomy, offsx, offsy, 0.25f);
|
|
|
|
|
/* grid, every 1.0 step */
|
2006-05-09 07:45:06 +00:00
|
|
|
BIF_ThemeColorShade(TH_BUT_NEUTRAL, -24);
|
Orange:
- New UI element: the "Curve Button".
For mapping ranges (like 0 - 1) to another range, the curve button can be
used for proportional falloff, bone influences, painting density, etc.
Most evident use is of course to map RGB color with curves.
To be able to use it, you have to allocate a CurveMapping struct and pass
this on to the button. The CurveMapping API is in the new C file
blenkernel/intern/colortools.c
It's as simple as calling:
curvemap= curvemapping_add(3, 0, 0, 1, 1)
Which will create 3 curves, and sets a default 0-1 range. The current code
only supports up to 4 curves maximum per mapping struct.
The CurveMap button in Blender than handles allmost all editing.
Evaluating a single channel:
float newvalue= curvemapping_evaluateF(curvemap, 0, oldval);
Where the second argument is the channel index, here 0-1-2 are possible.
Or mapping a vector:
curvemapping_evaluate3F(curvemap, newvec, oldvec);
Optimized versions for byte or short mapping is possible too, not done yet.
In butspace.c I've added a template wrapper for buttons around the curve, to
reveil settings or show tools; check this screenie:
http://www.blender.org/bf/curves.jpg
- Buttons R, G, B: select channel
- icons + and -: zoom in, out
- icon 'wrench': menu with tools, like clear curve, set handle type
- icon 'clipping': menu with clip values, and to dis/enable clipping
- icon 'x': delete selection
In the curve button itself, only LMB clicks are handled (like all UI elements
in Blender).
- click on point: select
- shift+click on point: swap select
- click on point + drag: select point (if not selected) and move it
- click outside point + drag: translate view
- CTRL+click: add new point
- hold SHIFT while dragging to snap to grid
(Yes I know... either one of these can be Blender compliant, not both!)
- if you drag a point exactly on top of another, it merges them
Other fixes:
- Icons now draw using "Safe RasterPos", so they align with pixel boundary.
the old code made ints from the raster pos coordinate, which doesn't work
well for zoom in/out situations
- bug in Node editing: buttons could not get freed, causing in memory error
prints at end of a Blender session. That one was a very simple, but nasty
error causing me all evening last night to find!
(Hint; check diff of editnode.c, where uiDoButtons is called)
Last note: this adds 3 new files in our tree, I did scons, but not MSVC!
2006-01-08 11:41:06 +00:00
|
|
|
ui_draw_but_curve_grid(but, zoomx, zoomy, offsx, offsy, 1.0f);
|
|
|
|
|
/* axes */
|
2006-05-09 07:45:06 +00:00
|
|
|
BIF_ThemeColorShade(TH_BUT_NEUTRAL, -50);
|
Orange:
- New UI element: the "Curve Button".
For mapping ranges (like 0 - 1) to another range, the curve button can be
used for proportional falloff, bone influences, painting density, etc.
Most evident use is of course to map RGB color with curves.
To be able to use it, you have to allocate a CurveMapping struct and pass
this on to the button. The CurveMapping API is in the new C file
blenkernel/intern/colortools.c
It's as simple as calling:
curvemap= curvemapping_add(3, 0, 0, 1, 1)
Which will create 3 curves, and sets a default 0-1 range. The current code
only supports up to 4 curves maximum per mapping struct.
The CurveMap button in Blender than handles allmost all editing.
Evaluating a single channel:
float newvalue= curvemapping_evaluateF(curvemap, 0, oldval);
Where the second argument is the channel index, here 0-1-2 are possible.
Or mapping a vector:
curvemapping_evaluate3F(curvemap, newvec, oldvec);
Optimized versions for byte or short mapping is possible too, not done yet.
In butspace.c I've added a template wrapper for buttons around the curve, to
reveil settings or show tools; check this screenie:
http://www.blender.org/bf/curves.jpg
- Buttons R, G, B: select channel
- icons + and -: zoom in, out
- icon 'wrench': menu with tools, like clear curve, set handle type
- icon 'clipping': menu with clip values, and to dis/enable clipping
- icon 'x': delete selection
In the curve button itself, only LMB clicks are handled (like all UI elements
in Blender).
- click on point: select
- shift+click on point: swap select
- click on point + drag: select point (if not selected) and move it
- click outside point + drag: translate view
- CTRL+click: add new point
- hold SHIFT while dragging to snap to grid
(Yes I know... either one of these can be Blender compliant, not both!)
- if you drag a point exactly on top of another, it merges them
Other fixes:
- Icons now draw using "Safe RasterPos", so they align with pixel boundary.
the old code made ints from the raster pos coordinate, which doesn't work
well for zoom in/out situations
- bug in Node editing: buttons could not get freed, causing in memory error
prints at end of a Blender session. That one was a very simple, but nasty
error causing me all evening last night to find!
(Hint; check diff of editnode.c, where uiDoButtons is called)
Last note: this adds 3 new files in our tree, I did scons, but not MSVC!
2006-01-08 11:41:06 +00:00
|
|
|
glBegin(GL_LINES);
|
|
|
|
|
glVertex2f(but->x1, but->y1 + zoomy*(-offsy));
|
|
|
|
|
glVertex2f(but->x2, but->y1 + zoomy*(-offsy));
|
|
|
|
|
glVertex2f(but->x1 + zoomx*(-offsx), but->y1);
|
|
|
|
|
glVertex2f(but->x1 + zoomx*(-offsx), but->y2);
|
|
|
|
|
glEnd();
|
|
|
|
|
|
2006-11-24 16:56:02 +00:00
|
|
|
/* cfra option */
|
|
|
|
|
if(cumap->flag & CUMA_DRAW_CFRA) {
|
|
|
|
|
glColor3ub(0x60, 0xc0, 0x40);
|
|
|
|
|
glBegin(GL_LINES);
|
2008-01-14 19:03:27 +00:00
|
|
|
glVertex2f(but->x1 + zoomx*(cumap->sample[0]-offsx), but->y1);
|
|
|
|
|
glVertex2f(but->x1 + zoomx*(cumap->sample[0]-offsx), but->y2);
|
2006-11-24 16:56:02 +00:00
|
|
|
glEnd();
|
|
|
|
|
}
|
2008-01-14 19:03:27 +00:00
|
|
|
/* sample option */
|
|
|
|
|
if(cumap->flag & CUMA_DRAW_SAMPLE) {
|
|
|
|
|
if(cumap->cur==3) {
|
|
|
|
|
float lum= cumap->sample[0]*0.35f + cumap->sample[1]*0.45f + cumap->sample[2]*0.2f;
|
|
|
|
|
glColor3ub(240, 240, 240);
|
|
|
|
|
|
|
|
|
|
glBegin(GL_LINES);
|
|
|
|
|
glVertex2f(but->x1 + zoomx*(lum-offsx), but->y1);
|
|
|
|
|
glVertex2f(but->x1 + zoomx*(lum-offsx), but->y2);
|
|
|
|
|
glEnd();
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
if(cumap->cur==0)
|
|
|
|
|
glColor3ub(240, 100, 100);
|
|
|
|
|
else if(cumap->cur==1)
|
|
|
|
|
glColor3ub(100, 240, 100);
|
|
|
|
|
else
|
|
|
|
|
glColor3ub(100, 100, 240);
|
|
|
|
|
|
|
|
|
|
glBegin(GL_LINES);
|
|
|
|
|
glVertex2f(but->x1 + zoomx*(cumap->sample[cumap->cur]-offsx), but->y1);
|
|
|
|
|
glVertex2f(but->x1 + zoomx*(cumap->sample[cumap->cur]-offsx), but->y2);
|
|
|
|
|
glEnd();
|
|
|
|
|
}
|
|
|
|
|
}
|
2006-11-24 16:56:02 +00:00
|
|
|
|
Orange:
- New UI element: the "Curve Button".
For mapping ranges (like 0 - 1) to another range, the curve button can be
used for proportional falloff, bone influences, painting density, etc.
Most evident use is of course to map RGB color with curves.
To be able to use it, you have to allocate a CurveMapping struct and pass
this on to the button. The CurveMapping API is in the new C file
blenkernel/intern/colortools.c
It's as simple as calling:
curvemap= curvemapping_add(3, 0, 0, 1, 1)
Which will create 3 curves, and sets a default 0-1 range. The current code
only supports up to 4 curves maximum per mapping struct.
The CurveMap button in Blender than handles allmost all editing.
Evaluating a single channel:
float newvalue= curvemapping_evaluateF(curvemap, 0, oldval);
Where the second argument is the channel index, here 0-1-2 are possible.
Or mapping a vector:
curvemapping_evaluate3F(curvemap, newvec, oldvec);
Optimized versions for byte or short mapping is possible too, not done yet.
In butspace.c I've added a template wrapper for buttons around the curve, to
reveil settings or show tools; check this screenie:
http://www.blender.org/bf/curves.jpg
- Buttons R, G, B: select channel
- icons + and -: zoom in, out
- icon 'wrench': menu with tools, like clear curve, set handle type
- icon 'clipping': menu with clip values, and to dis/enable clipping
- icon 'x': delete selection
In the curve button itself, only LMB clicks are handled (like all UI elements
in Blender).
- click on point: select
- shift+click on point: swap select
- click on point + drag: select point (if not selected) and move it
- click outside point + drag: translate view
- CTRL+click: add new point
- hold SHIFT while dragging to snap to grid
(Yes I know... either one of these can be Blender compliant, not both!)
- if you drag a point exactly on top of another, it merges them
Other fixes:
- Icons now draw using "Safe RasterPos", so they align with pixel boundary.
the old code made ints from the raster pos coordinate, which doesn't work
well for zoom in/out situations
- bug in Node editing: buttons could not get freed, causing in memory error
prints at end of a Blender session. That one was a very simple, but nasty
error causing me all evening last night to find!
(Hint; check diff of editnode.c, where uiDoButtons is called)
Last note: this adds 3 new files in our tree, I did scons, but not MSVC!
2006-01-08 11:41:06 +00:00
|
|
|
/* the curve */
|
2007-09-25 06:36:02 +00:00
|
|
|
BIF_ThemeColorBlend(TH_TEXT, TH_BUT_NEUTRAL, 0.35);
|
|
|
|
|
glEnable(GL_LINE_SMOOTH);
|
|
|
|
|
glEnable(GL_BLEND);
|
Orange:
- New UI element: the "Curve Button".
For mapping ranges (like 0 - 1) to another range, the curve button can be
used for proportional falloff, bone influences, painting density, etc.
Most evident use is of course to map RGB color with curves.
To be able to use it, you have to allocate a CurveMapping struct and pass
this on to the button. The CurveMapping API is in the new C file
blenkernel/intern/colortools.c
It's as simple as calling:
curvemap= curvemapping_add(3, 0, 0, 1, 1)
Which will create 3 curves, and sets a default 0-1 range. The current code
only supports up to 4 curves maximum per mapping struct.
The CurveMap button in Blender than handles allmost all editing.
Evaluating a single channel:
float newvalue= curvemapping_evaluateF(curvemap, 0, oldval);
Where the second argument is the channel index, here 0-1-2 are possible.
Or mapping a vector:
curvemapping_evaluate3F(curvemap, newvec, oldvec);
Optimized versions for byte or short mapping is possible too, not done yet.
In butspace.c I've added a template wrapper for buttons around the curve, to
reveil settings or show tools; check this screenie:
http://www.blender.org/bf/curves.jpg
- Buttons R, G, B: select channel
- icons + and -: zoom in, out
- icon 'wrench': menu with tools, like clear curve, set handle type
- icon 'clipping': menu with clip values, and to dis/enable clipping
- icon 'x': delete selection
In the curve button itself, only LMB clicks are handled (like all UI elements
in Blender).
- click on point: select
- shift+click on point: swap select
- click on point + drag: select point (if not selected) and move it
- click outside point + drag: translate view
- CTRL+click: add new point
- hold SHIFT while dragging to snap to grid
(Yes I know... either one of these can be Blender compliant, not both!)
- if you drag a point exactly on top of another, it merges them
Other fixes:
- Icons now draw using "Safe RasterPos", so they align with pixel boundary.
the old code made ints from the raster pos coordinate, which doesn't work
well for zoom in/out situations
- bug in Node editing: buttons could not get freed, causing in memory error
prints at end of a Blender session. That one was a very simple, but nasty
error causing me all evening last night to find!
(Hint; check diff of editnode.c, where uiDoButtons is called)
Last note: this adds 3 new files in our tree, I did scons, but not MSVC!
2006-01-08 11:41:06 +00:00
|
|
|
glBegin(GL_LINE_STRIP);
|
|
|
|
|
|
|
|
|
|
if(cuma->table==NULL)
|
|
|
|
|
curvemapping_changed(cumap, 0); /* 0 = no remove doubles */
|
|
|
|
|
cmp= cuma->table;
|
|
|
|
|
|
2006-10-27 20:27:13 +00:00
|
|
|
/* first point */
|
|
|
|
|
if((cuma->flag & CUMA_EXTEND_EXTRAPOLATE)==0)
|
|
|
|
|
glVertex2f(but->x1, but->y1 + zoomy*(cmp[0].y-offsy));
|
|
|
|
|
else {
|
|
|
|
|
fx= but->x1 + zoomx*(cmp[0].x-offsx + cuma->ext_in[0]);
|
|
|
|
|
fy= but->y1 + zoomy*(cmp[0].y-offsy + cuma->ext_in[1]);
|
|
|
|
|
glVertex2f(fx, fy);
|
|
|
|
|
}
|
Orange:
- New UI element: the "Curve Button".
For mapping ranges (like 0 - 1) to another range, the curve button can be
used for proportional falloff, bone influences, painting density, etc.
Most evident use is of course to map RGB color with curves.
To be able to use it, you have to allocate a CurveMapping struct and pass
this on to the button. The CurveMapping API is in the new C file
blenkernel/intern/colortools.c
It's as simple as calling:
curvemap= curvemapping_add(3, 0, 0, 1, 1)
Which will create 3 curves, and sets a default 0-1 range. The current code
only supports up to 4 curves maximum per mapping struct.
The CurveMap button in Blender than handles allmost all editing.
Evaluating a single channel:
float newvalue= curvemapping_evaluateF(curvemap, 0, oldval);
Where the second argument is the channel index, here 0-1-2 are possible.
Or mapping a vector:
curvemapping_evaluate3F(curvemap, newvec, oldvec);
Optimized versions for byte or short mapping is possible too, not done yet.
In butspace.c I've added a template wrapper for buttons around the curve, to
reveil settings or show tools; check this screenie:
http://www.blender.org/bf/curves.jpg
- Buttons R, G, B: select channel
- icons + and -: zoom in, out
- icon 'wrench': menu with tools, like clear curve, set handle type
- icon 'clipping': menu with clip values, and to dis/enable clipping
- icon 'x': delete selection
In the curve button itself, only LMB clicks are handled (like all UI elements
in Blender).
- click on point: select
- shift+click on point: swap select
- click on point + drag: select point (if not selected) and move it
- click outside point + drag: translate view
- CTRL+click: add new point
- hold SHIFT while dragging to snap to grid
(Yes I know... either one of these can be Blender compliant, not both!)
- if you drag a point exactly on top of another, it merges them
Other fixes:
- Icons now draw using "Safe RasterPos", so they align with pixel boundary.
the old code made ints from the raster pos coordinate, which doesn't work
well for zoom in/out situations
- bug in Node editing: buttons could not get freed, causing in memory error
prints at end of a Blender session. That one was a very simple, but nasty
error causing me all evening last night to find!
(Hint; check diff of editnode.c, where uiDoButtons is called)
Last note: this adds 3 new files in our tree, I did scons, but not MSVC!
2006-01-08 11:41:06 +00:00
|
|
|
for(a=0; a<=CM_TABLE; a++) {
|
|
|
|
|
fx= but->x1 + zoomx*(cmp[a].x-offsx);
|
|
|
|
|
fy= but->y1 + zoomy*(cmp[a].y-offsy);
|
|
|
|
|
glVertex2f(fx, fy);
|
|
|
|
|
}
|
2006-10-27 20:27:13 +00:00
|
|
|
/* last point */
|
|
|
|
|
if((cuma->flag & CUMA_EXTEND_EXTRAPOLATE)==0)
|
|
|
|
|
glVertex2f(but->x2, but->y1 + zoomy*(cmp[CM_TABLE].y-offsy));
|
|
|
|
|
else {
|
|
|
|
|
fx= but->x1 + zoomx*(cmp[CM_TABLE].x-offsx - cuma->ext_out[0]);
|
|
|
|
|
fy= but->y1 + zoomy*(cmp[CM_TABLE].y-offsy - cuma->ext_out[1]);
|
|
|
|
|
glVertex2f(fx, fy);
|
|
|
|
|
}
|
Orange:
- New UI element: the "Curve Button".
For mapping ranges (like 0 - 1) to another range, the curve button can be
used for proportional falloff, bone influences, painting density, etc.
Most evident use is of course to map RGB color with curves.
To be able to use it, you have to allocate a CurveMapping struct and pass
this on to the button. The CurveMapping API is in the new C file
blenkernel/intern/colortools.c
It's as simple as calling:
curvemap= curvemapping_add(3, 0, 0, 1, 1)
Which will create 3 curves, and sets a default 0-1 range. The current code
only supports up to 4 curves maximum per mapping struct.
The CurveMap button in Blender than handles allmost all editing.
Evaluating a single channel:
float newvalue= curvemapping_evaluateF(curvemap, 0, oldval);
Where the second argument is the channel index, here 0-1-2 are possible.
Or mapping a vector:
curvemapping_evaluate3F(curvemap, newvec, oldvec);
Optimized versions for byte or short mapping is possible too, not done yet.
In butspace.c I've added a template wrapper for buttons around the curve, to
reveil settings or show tools; check this screenie:
http://www.blender.org/bf/curves.jpg
- Buttons R, G, B: select channel
- icons + and -: zoom in, out
- icon 'wrench': menu with tools, like clear curve, set handle type
- icon 'clipping': menu with clip values, and to dis/enable clipping
- icon 'x': delete selection
In the curve button itself, only LMB clicks are handled (like all UI elements
in Blender).
- click on point: select
- shift+click on point: swap select
- click on point + drag: select point (if not selected) and move it
- click outside point + drag: translate view
- CTRL+click: add new point
- hold SHIFT while dragging to snap to grid
(Yes I know... either one of these can be Blender compliant, not both!)
- if you drag a point exactly on top of another, it merges them
Other fixes:
- Icons now draw using "Safe RasterPos", so they align with pixel boundary.
the old code made ints from the raster pos coordinate, which doesn't work
well for zoom in/out situations
- bug in Node editing: buttons could not get freed, causing in memory error
prints at end of a Blender session. That one was a very simple, but nasty
error causing me all evening last night to find!
(Hint; check diff of editnode.c, where uiDoButtons is called)
Last note: this adds 3 new files in our tree, I did scons, but not MSVC!
2006-01-08 11:41:06 +00:00
|
|
|
glEnd();
|
2007-09-25 06:36:02 +00:00
|
|
|
glDisable(GL_LINE_SMOOTH);
|
2007-09-26 13:40:38 +00:00
|
|
|
glDisable(GL_BLEND);
|
Orange:
- New UI element: the "Curve Button".
For mapping ranges (like 0 - 1) to another range, the curve button can be
used for proportional falloff, bone influences, painting density, etc.
Most evident use is of course to map RGB color with curves.
To be able to use it, you have to allocate a CurveMapping struct and pass
this on to the button. The CurveMapping API is in the new C file
blenkernel/intern/colortools.c
It's as simple as calling:
curvemap= curvemapping_add(3, 0, 0, 1, 1)
Which will create 3 curves, and sets a default 0-1 range. The current code
only supports up to 4 curves maximum per mapping struct.
The CurveMap button in Blender than handles allmost all editing.
Evaluating a single channel:
float newvalue= curvemapping_evaluateF(curvemap, 0, oldval);
Where the second argument is the channel index, here 0-1-2 are possible.
Or mapping a vector:
curvemapping_evaluate3F(curvemap, newvec, oldvec);
Optimized versions for byte or short mapping is possible too, not done yet.
In butspace.c I've added a template wrapper for buttons around the curve, to
reveil settings or show tools; check this screenie:
http://www.blender.org/bf/curves.jpg
- Buttons R, G, B: select channel
- icons + and -: zoom in, out
- icon 'wrench': menu with tools, like clear curve, set handle type
- icon 'clipping': menu with clip values, and to dis/enable clipping
- icon 'x': delete selection
In the curve button itself, only LMB clicks are handled (like all UI elements
in Blender).
- click on point: select
- shift+click on point: swap select
- click on point + drag: select point (if not selected) and move it
- click outside point + drag: translate view
- CTRL+click: add new point
- hold SHIFT while dragging to snap to grid
(Yes I know... either one of these can be Blender compliant, not both!)
- if you drag a point exactly on top of another, it merges them
Other fixes:
- Icons now draw using "Safe RasterPos", so they align with pixel boundary.
the old code made ints from the raster pos coordinate, which doesn't work
well for zoom in/out situations
- bug in Node editing: buttons could not get freed, causing in memory error
prints at end of a Blender session. That one was a very simple, but nasty
error causing me all evening last night to find!
(Hint; check diff of editnode.c, where uiDoButtons is called)
Last note: this adds 3 new files in our tree, I did scons, but not MSVC!
2006-01-08 11:41:06 +00:00
|
|
|
|
|
|
|
|
/* the points, use aspect to make them visible on edges */
|
|
|
|
|
cmp= cuma->curve;
|
|
|
|
|
glPointSize(3.0f);
|
|
|
|
|
bglBegin(GL_POINTS);
|
|
|
|
|
for(a=0; a<cuma->totpoint; a++) {
|
|
|
|
|
if(cmp[a].flag & SELECT)
|
|
|
|
|
BIF_ThemeColor(TH_TEXT_HI);
|
|
|
|
|
else
|
|
|
|
|
BIF_ThemeColor(TH_TEXT);
|
|
|
|
|
fac[0]= but->x1 + zoomx*(cmp[a].x-offsx);
|
|
|
|
|
fac[1]= but->y1 + zoomy*(cmp[a].y-offsy);
|
|
|
|
|
bglVertex2fv(fac);
|
|
|
|
|
}
|
|
|
|
|
bglEnd();
|
|
|
|
|
glPointSize(1.0f);
|
|
|
|
|
|
|
|
|
|
/* restore scissortest */
|
|
|
|
|
glScissor(scissor[0], scissor[1], scissor[2], scissor[3]);
|
|
|
|
|
|
|
|
|
|
/* outline */
|
|
|
|
|
BIF_ThemeColor(TH_BUT_OUTLINE);
|
|
|
|
|
fdrawbox(but->x1, but->y1, but->x2, but->y2);
|
2005-12-30 15:56:42 +00:00
|
|
|
|
2005-12-30 11:25:15 +00:00
|
|
|
}
|
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
|
|
|
|
2005-08-15 19:46:09 +00:00
|
|
|
static void ui_draw_roundbox(uiBut *but)
|
|
|
|
|
{
|
2005-09-28 11:05:20 +00:00
|
|
|
glEnable(GL_BLEND);
|
|
|
|
|
|
2008-07-23 12:27:08 +00:00
|
|
|
BIF_ThemeColorShadeAlpha(but->themecol, but->a2, but->a2);
|
2005-08-15 19:46:09 +00:00
|
|
|
|
|
|
|
|
uiSetRoundBox(but->a1);
|
|
|
|
|
gl_round_box(GL_POLYGON, but->x1, but->y1, but->x2, but->y2, but->min);
|
|
|
|
|
|
2005-09-28 11:05:20 +00:00
|
|
|
glDisable(GL_BLEND);
|
2005-08-15 19:46:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
/* nothing! */
|
|
|
|
|
static void ui_draw_nothing(int type, int colorid, float asp, float x1, float y1, float x2, float y2, int flag)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* ************** EXTERN, called from interface.c ************* */
|
2003-11-14 00:44:48 +00:00
|
|
|
/* ************** MAIN CALLBACK FUNCTION ************* */
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
|
|
|
|
|
void ui_set_embossfunc(uiBut *but, int drawtype)
|
|
|
|
|
{
|
2004-10-03 13:49:54 +00:00
|
|
|
// this aded for evaluating textcolor for example
|
|
|
|
|
but->dt= drawtype;
|
|
|
|
|
|
2003-10-21 11:46:12 +00:00
|
|
|
// not really part of standard minimal themes, just make sure it is set
|
|
|
|
|
but->sliderfunc= ui_draw_slider;
|
|
|
|
|
|
|
|
|
|
// standard builtin first:
|
2005-08-15 19:46:09 +00:00
|
|
|
if(but->type==LABEL || but->type==ROUNDBOX) but->embossfunc= ui_draw_nothing;
|
2004-10-03 13:49:54 +00:00
|
|
|
else if(but->type==PULLDOWN) but->embossfunc= ui_draw_pulldown_round;
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
else if(drawtype==UI_EMBOSSM) but->embossfunc= ui_draw_minimal;
|
|
|
|
|
else if(drawtype==UI_EMBOSSN) but->embossfunc= ui_draw_nothing;
|
2004-10-03 13:49:54 +00:00
|
|
|
else if(drawtype==UI_EMBOSSP) but->embossfunc= ui_draw_pulldown_item;
|
2005-08-04 22:36:21 +00:00
|
|
|
else if(drawtype==UI_EMBOSSR) but->embossfunc= ui_draw_round;
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
else {
|
|
|
|
|
int theme= BIF_GetThemeValue(TH_BUT_DRAWTYPE);
|
|
|
|
|
|
2006-10-28 13:21:02 +00:00
|
|
|
switch(theme) {
|
|
|
|
|
|
|
|
|
|
case TH_ROUNDED:
|
2003-11-14 00:44:48 +00:00
|
|
|
but->embossfunc= ui_draw_round;
|
2006-10-28 13:21:02 +00:00
|
|
|
break;
|
|
|
|
|
case TH_OLDSKOOL:
|
2003-11-14 00:44:48 +00:00
|
|
|
but->embossfunc= ui_draw_oldskool;
|
2006-10-28 13:21:02 +00:00
|
|
|
break;
|
|
|
|
|
case TH_MINIMAL:
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
but->embossfunc= ui_draw_minimal;
|
2006-10-28 13:21:02 +00:00
|
|
|
break;
|
|
|
|
|
case TH_SHADED:
|
|
|
|
|
default:
|
|
|
|
|
but->embossfunc= ui_draw_default;
|
|
|
|
|
but->sliderfunc= ui_default_slider;
|
|
|
|
|
break;
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
}
|
|
|
|
|
}
|
2003-11-14 15:49:26 +00:00
|
|
|
|
|
|
|
|
// note: if you want aligning, adapt the call uiBlockEndAlign in interface.c
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ui_draw_but(uiBut *but)
|
|
|
|
|
{
|
|
|
|
|
double value;
|
|
|
|
|
float x1, x2, y1, y2, fac;
|
|
|
|
|
|
2004-10-03 20:02:22 +00:00
|
|
|
if(but==NULL) return;
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
|
2004-10-04 12:37:16 +00:00
|
|
|
/* signal for frontbuf flush buttons and menus, not when normal drawing */
|
2004-10-03 20:02:22 +00:00
|
|
|
if(but->block->in_use) ui_block_set_flush(but->block, but);
|
2004-10-03 13:49:54 +00:00
|
|
|
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
switch (but->type) {
|
|
|
|
|
|
|
|
|
|
case NUMSLI:
|
|
|
|
|
case HSVSLI:
|
|
|
|
|
|
|
|
|
|
but->embossfunc(but->type, but->themecol, but->aspect, but->x1, but->y1, but->x2, but->y2, but->flag);
|
|
|
|
|
ui_draw_text_icon(but);
|
|
|
|
|
|
|
|
|
|
x1= (but->x1+but->x2)/2;
|
|
|
|
|
x2= but->x2 - 5.0*but->aspect;
|
|
|
|
|
y1= but->y1 + 2.0*but->aspect;
|
|
|
|
|
y2= but->y2 - 2.0*but->aspect;
|
|
|
|
|
|
|
|
|
|
value= ui_get_but_val(but);
|
|
|
|
|
fac= (value-but->min)*(x2-x1)/(but->max - but->min);
|
|
|
|
|
|
|
|
|
|
but->sliderfunc(but->themecol, fac, but->aspect, x1, y1, x2, y2, but->flag);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case SEPR:
|
|
|
|
|
// only background
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case COL:
|
|
|
|
|
ui_draw_but_COL(but); // black box with color
|
|
|
|
|
break;
|
|
|
|
|
|
2004-07-05 08:48:17 +00:00
|
|
|
case HSVCUBE:
|
|
|
|
|
ui_draw_but_HSVCUBE(but); // box for colorpicker, three types
|
|
|
|
|
break;
|
|
|
|
|
|
2005-09-14 14:02:21 +00:00
|
|
|
#ifdef INTERNATIONAL
|
|
|
|
|
case CHARTAB:
|
|
|
|
|
value= ui_get_but_val(but);
|
|
|
|
|
ui_draw_but_CHARTAB(but);
|
|
|
|
|
break;
|
|
|
|
|
#endif
|
|
|
|
|
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
case LINK:
|
|
|
|
|
case INLINK:
|
2006-12-07 14:17:38 +00:00
|
|
|
ui_draw_icon(but, but->icon, 0);
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
break;
|
2005-08-15 19:46:09 +00:00
|
|
|
|
|
|
|
|
case ROUNDBOX:
|
|
|
|
|
ui_draw_roundbox(but);
|
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case BUT_COLORBAND:
|
|
|
|
|
ui_draw_but_COLORBAND(but);
|
|
|
|
|
break;
|
2005-12-30 11:25:15 +00:00
|
|
|
case BUT_NORMAL:
|
|
|
|
|
ui_draw_but_NORMAL(but);
|
|
|
|
|
break;
|
Orange:
- New UI element: the "Curve Button".
For mapping ranges (like 0 - 1) to another range, the curve button can be
used for proportional falloff, bone influences, painting density, etc.
Most evident use is of course to map RGB color with curves.
To be able to use it, you have to allocate a CurveMapping struct and pass
this on to the button. The CurveMapping API is in the new C file
blenkernel/intern/colortools.c
It's as simple as calling:
curvemap= curvemapping_add(3, 0, 0, 1, 1)
Which will create 3 curves, and sets a default 0-1 range. The current code
only supports up to 4 curves maximum per mapping struct.
The CurveMap button in Blender than handles allmost all editing.
Evaluating a single channel:
float newvalue= curvemapping_evaluateF(curvemap, 0, oldval);
Where the second argument is the channel index, here 0-1-2 are possible.
Or mapping a vector:
curvemapping_evaluate3F(curvemap, newvec, oldvec);
Optimized versions for byte or short mapping is possible too, not done yet.
In butspace.c I've added a template wrapper for buttons around the curve, to
reveil settings or show tools; check this screenie:
http://www.blender.org/bf/curves.jpg
- Buttons R, G, B: select channel
- icons + and -: zoom in, out
- icon 'wrench': menu with tools, like clear curve, set handle type
- icon 'clipping': menu with clip values, and to dis/enable clipping
- icon 'x': delete selection
In the curve button itself, only LMB clicks are handled (like all UI elements
in Blender).
- click on point: select
- shift+click on point: swap select
- click on point + drag: select point (if not selected) and move it
- click outside point + drag: translate view
- CTRL+click: add new point
- hold SHIFT while dragging to snap to grid
(Yes I know... either one of these can be Blender compliant, not both!)
- if you drag a point exactly on top of another, it merges them
Other fixes:
- Icons now draw using "Safe RasterPos", so they align with pixel boundary.
the old code made ints from the raster pos coordinate, which doesn't work
well for zoom in/out situations
- bug in Node editing: buttons could not get freed, causing in memory error
prints at end of a Blender session. That one was a very simple, but nasty
error causing me all evening last night to find!
(Hint; check diff of editnode.c, where uiDoButtons is called)
Last note: this adds 3 new files in our tree, I did scons, but not MSVC!
2006-01-08 11:41:06 +00:00
|
|
|
case BUT_CURVE:
|
|
|
|
|
ui_draw_but_CURVE(but);
|
|
|
|
|
break;
|
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
|
|
|
|
Another mega commit... loadsof restructure, and a pretty good one! :)
- changed the BIF_DrawString() function. it used to work different for
AA fonts as for default fonts. Now it's identical. Setting color for fonts
can just be done with OpenGL, for both font types.
Removed: BIF_DrawStringRGB()
- added theme color options for Buttons
- recoded DefButton, so it automatically chooses the right color.
- had to remove a 1000 uiBlockSetCol() calls for that reason...
- uiBlockSetCol() still works, to override automatic color
- removed entirely the silly old color system (BIFColorID). All color
calls can now be done with a BIF_ThemeColor() call, including fonts and
buttons and opengl stuff
- all buttons in button header have headercolor by default
- recoded drawing icons, it was a really bad & old loop doing manually
colorshading and blending... which was per pixel a load of code!
Now it uses a single OpenGL call to blend or colorize. Quite faster!
- (as test, for review) icons don't colorize anymore with button color,
but have a different alpha to blend in (when not active)
- recoded the entire interface_draw.c file...:
- drawing buttons is separated in three parts:
1. main drawing function for text and icons
2. free definable callback for button itself
3. free definable callback for slider
- removed a load of redundant code for this!
- coded a minimal theme, and adjusted Matt's buttons to match new
callback system
- adding new drawing themes is piece of cake now
- for coders, default 'themes' to be aware of:
UI_EMBOSS : the themable drawing style
UI_EMBOSSP: the pulldown menu system (apart from color not themable)
UI_EMBOSSN: draw nothing, only text and/or icon
UI_EMBOSSM: minimal theme, still in use for Logic and Constraintsa
this can be set with uiBlockSetEmboss(block) or in the uiNewBlock() call.
TODO: make UI API call for button alignment
(plus removed another series of warnings from code...)
Plus: fixed bug in Matts commit: he used a 'short' button for an 'int'
2003-10-20 15:40:20 +00:00
|
|
|
default:
|
|
|
|
|
but->embossfunc(but->type, but->themecol, but->aspect, but->x1, but->y1, but->x2, but->y2, but->flag);
|
|
|
|
|
ui_draw_text_icon(but);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-09-02 17:25:03 +00:00
|
|
|
void ui_dropshadow(rctf *rct, float radius, float aspect, int select)
|
|
|
|
|
{
|
|
|
|
|
float rad;
|
|
|
|
|
float a;
|
|
|
|
|
char alpha= 2;
|
|
|
|
|
|
|
|
|
|
glEnable(GL_BLEND);
|
|
|
|
|
|
|
|
|
|
if(radius > (rct->ymax-rct->ymin-10.0f)/2.0f)
|
|
|
|
|
rad= (rct->ymax-rct->ymin-10.0f)/2.0f;
|
|
|
|
|
else
|
|
|
|
|
rad= radius;
|
|
|
|
|
|
|
|
|
|
if(select) a= 12.0f*aspect; else a= 12.0f*aspect;
|
|
|
|
|
for(; a>0.0f; a-=aspect) {
|
|
|
|
|
/* alpha ranges from 2 to 20 or so */
|
|
|
|
|
glColor4ub(0, 0, 0, alpha);
|
|
|
|
|
alpha+= 2;
|
|
|
|
|
|
|
|
|
|
gl_round_box(GL_POLYGON, rct->xmin - a, rct->ymin - a, rct->xmax + a, rct->ymax-10.0f + a, rad+a);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* outline emphasis */
|
|
|
|
|
glEnable( GL_LINE_SMOOTH );
|
|
|
|
|
glColor4ub(0, 0, 0, 100);
|
|
|
|
|
gl_round_box(GL_LINE_LOOP, rct->xmin-0.5f, rct->ymin-0.5f, rct->xmax+0.5f, rct->ymax+0.5f, radius);
|
|
|
|
|
glDisable( GL_LINE_SMOOTH );
|
|
|
|
|
|
|
|
|
|
glDisable(GL_BLEND);
|
|
|
|
|
}
|