2011-02-23 10:52:22 +00:00
|
|
|
/*
|
2011-10-23 17:52:20 +00:00
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
2009-03-25 16:58:42 +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
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* 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,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2009-03-25 16:58:42 +00:00
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2009 Blender Foundation.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s): Blender Foundation
|
|
|
|
*
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
|
|
*/
|
|
|
|
|
2011-02-27 20:29:51 +00:00
|
|
|
/** \file blender/editors/interface/interface_widgets.c
|
|
|
|
* \ingroup edinterface
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2009-03-25 16:58:42 +00:00
|
|
|
#include <limits.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2010-10-17 08:59:23 +00:00
|
|
|
#include <assert.h>
|
2009-03-25 16:58:42 +00:00
|
|
|
|
|
|
|
|
|
|
|
#include "DNA_screen_types.h"
|
2009-04-09 18:11:18 +00:00
|
|
|
#include "DNA_userdef_types.h"
|
2009-03-25 16:58:42 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
#include "BLI_math.h"
|
2009-03-25 16:58:42 +00:00
|
|
|
#include "BLI_listbase.h"
|
|
|
|
#include "BLI_rect.h"
|
2010-12-14 02:38:29 +00:00
|
|
|
#include "BLI_string.h"
|
2012-03-22 09:20:22 +00:00
|
|
|
#include "BLI_string_utf8.h"
|
2011-01-07 18:36:47 +00:00
|
|
|
#include "BLI_utildefines.h"
|
2009-03-25 16:58:42 +00:00
|
|
|
|
|
|
|
#include "BKE_context.h"
|
2009-06-17 11:01:05 +00:00
|
|
|
#include "BKE_curve.h"
|
2009-03-25 16:58:42 +00:00
|
|
|
#include "BKE_utildefines.h"
|
|
|
|
|
Changes to Color Management
After testing and feedback, I've decided to slightly modify the way color
management works internally. While the previous method worked well for
rendering, was a smaller transition and had some advantages over this
new method, it was a bit more ambiguous, and was making things difficult
for other areas such as compositing.
This implementation now considers all color data (with only a couple of
exceptions such as brush colors) to be stored in linear RGB color space,
rather than sRGB as previously. This brings it in line with Nuke, which also
operates this way, quite successfully. Color swatches, pickers, color ramp
display are now gamma corrected to display gamma so you can see what
you're doing, but the numbers themselves are considered linear. This
makes understanding blending modes more clear (a 0.5 value on overlay
will not change the result now) as well as making color swatches act more
predictably in the compositor, however bringing over color values from
applications like photoshop or gimp, that operate in a gamma space,
will give identical results.
This commit will convert over existing files saved by earlier 2.5 versions to
work generally the same, though there may be some slight differences with
things like textures. Now that we're set on changing other areas of shading,
this won't be too disruptive overall.
I've made a diagram explaining the pipeline here:
http://mke3.net/blender/devel/2.5/25_linear_workflow_pipeline.png
and some docs here:
http://www.blender.org/development/release-logs/blender-250/color-management/
2009-12-02 07:56:34 +00:00
|
|
|
#include "RNA_access.h"
|
|
|
|
|
2009-03-25 16:58:42 +00:00
|
|
|
#include "BIF_gl.h"
|
2009-04-03 16:26:03 +00:00
|
|
|
#include "BIF_glutil.h"
|
2009-03-25 16:58:42 +00:00
|
|
|
|
2009-04-10 14:06:24 +00:00
|
|
|
#include "BLF_api.h"
|
|
|
|
|
2009-03-25 16:58:42 +00:00
|
|
|
#include "UI_interface.h"
|
|
|
|
#include "UI_interface_icons.h"
|
|
|
|
|
|
|
|
|
|
|
|
#include "interface_intern.h"
|
|
|
|
|
|
|
|
/* ************** widget base functions ************** */
|
|
|
|
/*
|
2012-03-03 16:31:46 +00:00
|
|
|
* - in: roundbox codes for corner types and radius
|
|
|
|
* - return: array of [size][2][x,y] points, the edges of the roundbox, + UV coords
|
|
|
|
*
|
|
|
|
* - draw black box with alpha 0 on exact button boundbox
|
|
|
|
* - for ever AA step:
|
|
|
|
* - draw the inner part for a round filled box, with color blend codes or texture coords
|
|
|
|
* - draw outline in outline color
|
|
|
|
* - draw outer part, bottom half, extruded 1 pixel to bottom, for emboss shadow
|
|
|
|
* - draw extra decorations
|
|
|
|
* - draw background color box with alpha 1 on exact button boundbox
|
2009-03-25 16:58:42 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* fill this struct with polygon info to draw AA'ed */
|
|
|
|
/* it has outline, back, and two optional tria meshes */
|
|
|
|
|
|
|
|
typedef struct uiWidgetTrias {
|
2011-09-10 01:39:21 +00:00
|
|
|
unsigned int tot;
|
2009-03-25 16:58:42 +00:00
|
|
|
|
|
|
|
float vec[32][2];
|
2011-09-10 01:39:21 +00:00
|
|
|
unsigned int (*index)[3];
|
2009-03-25 16:58:42 +00:00
|
|
|
|
|
|
|
} uiWidgetTrias;
|
|
|
|
|
2011-09-09 13:10:18 +00:00
|
|
|
/* max as used by round_box__edges */
|
|
|
|
#define WIDGET_CURVE_RESOLU 9
|
|
|
|
#define WIDGET_SIZE_MAX (WIDGET_CURVE_RESOLU*4)
|
|
|
|
|
2009-03-25 16:58:42 +00:00
|
|
|
typedef struct uiWidgetBase {
|
|
|
|
|
|
|
|
int totvert, halfwayvert;
|
2011-09-09 13:10:18 +00:00
|
|
|
float outer_v[WIDGET_SIZE_MAX][2];
|
|
|
|
float inner_v[WIDGET_SIZE_MAX][2];
|
|
|
|
float inner_uv[WIDGET_SIZE_MAX][2];
|
2009-03-25 16:58:42 +00:00
|
|
|
|
2009-04-03 16:26:03 +00:00
|
|
|
short inner, outline, emboss; /* set on/off */
|
2009-06-24 14:16:56 +00:00
|
|
|
short shadedir;
|
2009-04-02 18:16:15 +00:00
|
|
|
|
2009-03-25 16:58:42 +00:00
|
|
|
uiWidgetTrias tria1;
|
|
|
|
uiWidgetTrias tria2;
|
|
|
|
|
|
|
|
} uiWidgetBase;
|
|
|
|
|
2009-04-02 15:01:11 +00:00
|
|
|
/* uiWidgetType: for time being only for visual appearance,
|
2012-03-03 16:31:46 +00:00
|
|
|
* later, a handling callback can be added too
|
|
|
|
*/
|
2009-04-02 15:01:11 +00:00
|
|
|
typedef struct uiWidgetType {
|
|
|
|
|
|
|
|
/* pointer to theme color definition */
|
|
|
|
uiWidgetColors *wcol_theme;
|
2009-07-12 02:06:15 +00:00
|
|
|
uiWidgetStateColors *wcol_state;
|
2009-04-02 15:01:11 +00:00
|
|
|
|
|
|
|
/* converted colors for state */
|
|
|
|
uiWidgetColors wcol;
|
|
|
|
|
|
|
|
void (*state)(struct uiWidgetType *, int state);
|
|
|
|
void (*draw)(uiWidgetColors *, rcti *, int state, int roundboxalign);
|
2009-04-02 18:16:15 +00:00
|
|
|
void (*custom)(uiBut *, uiWidgetColors *, rcti *, int state, int roundboxalign);
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
void (*text)(uiFontStyle *, uiWidgetColors *, uiBut *, rcti *);
|
2009-04-02 15:01:11 +00:00
|
|
|
|
|
|
|
} uiWidgetType;
|
|
|
|
|
|
|
|
|
|
|
|
/* *********************** draw data ************************** */
|
|
|
|
|
2011-09-09 13:10:18 +00:00
|
|
|
static float cornervec[WIDGET_CURVE_RESOLU][2]= {{0.0, 0.0}, {0.195, 0.02}, {0.383, 0.067}, {0.55, 0.169},
|
2009-03-25 16:58:42 +00:00
|
|
|
{0.707, 0.293}, {0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805}, {1.0, 1.0}};
|
|
|
|
|
2012-01-13 09:26:06 +00:00
|
|
|
#define WIDGET_AA_JITTER 8
|
|
|
|
static float jit[WIDGET_AA_JITTER][2]= {
|
|
|
|
{ 0.468813 , -0.481430}, {-0.155755 , -0.352820},
|
|
|
|
{ 0.219306 , -0.238501}, {-0.393286 , -0.110949},
|
|
|
|
{-0.024699 , 0.013908}, { 0.343805 , 0.147431},
|
|
|
|
{-0.272855 , 0.269918}, { 0.095909 , 0.388710}};
|
2009-03-25 16:58:42 +00:00
|
|
|
|
2009-09-14 12:28:59 +00:00
|
|
|
static float num_tria_vert[3][2]= {
|
|
|
|
{-0.352077, 0.532607}, {-0.352077, -0.549313}, {0.330000, -0.008353}};
|
|
|
|
|
2011-09-10 01:39:21 +00:00
|
|
|
static unsigned int num_tria_face[1][3]= {
|
2009-09-14 12:28:59 +00:00
|
|
|
{0, 1, 2}};
|
|
|
|
|
|
|
|
static float scroll_circle_vert[16][2]= {
|
2009-03-25 16:58:42 +00:00
|
|
|
{0.382684, 0.923879}, {0.000001, 1.000000}, {-0.382683, 0.923880}, {-0.707107, 0.707107},
|
|
|
|
{-0.923879, 0.382684}, {-1.000000, 0.000000}, {-0.923880, -0.382684}, {-0.707107, -0.707107},
|
|
|
|
{-0.382683, -0.923880}, {0.000000, -1.000000}, {0.382684, -0.923880}, {0.707107, -0.707107},
|
2009-09-14 12:28:59 +00:00
|
|
|
{0.923880, -0.382684}, {1.000000, -0.000000}, {0.923880, 0.382683}, {0.707107, 0.707107}};
|
2009-03-25 16:58:42 +00:00
|
|
|
|
2011-09-10 01:39:21 +00:00
|
|
|
static unsigned int scroll_circle_face[14][3]= {
|
2009-09-14 12:28:59 +00:00
|
|
|
{0, 1, 2}, {2, 0, 3}, {3, 0, 15}, {3, 15, 4}, {4, 15, 14}, {4, 14, 5}, {5, 14, 13}, {5, 13, 6},
|
|
|
|
{6, 13, 12}, {6, 12, 7}, {7, 12, 11}, {7, 11, 8}, {8, 11, 10}, {8, 10, 9}};
|
2009-03-25 16:58:42 +00:00
|
|
|
|
|
|
|
static float menu_tria_vert[6][2]= {
|
|
|
|
{-0.41, 0.16}, {0.41, 0.16}, {0, 0.82},
|
|
|
|
{0, -0.82}, {-0.41, -0.16}, {0.41, -0.16}};
|
|
|
|
|
2011-09-10 01:39:21 +00:00
|
|
|
static unsigned int menu_tria_face[2][3]= {{2, 0, 1}, {3, 5, 4}};
|
2009-03-25 16:58:42 +00:00
|
|
|
|
|
|
|
static float check_tria_vert[6][2]= {
|
|
|
|
{-0.578579, 0.253369}, {-0.392773, 0.412794}, {-0.004241, -0.328551},
|
|
|
|
{-0.003001, 0.034320}, {1.055313, 0.864744}, {0.866408, 1.026895}};
|
|
|
|
|
2011-09-10 01:39:21 +00:00
|
|
|
static unsigned int check_tria_face[4][3]= {
|
2009-03-25 16:58:42 +00:00
|
|
|
{3, 2, 4}, {3, 4, 5}, {1, 0, 3}, {0, 2, 3}};
|
|
|
|
|
2011-06-06 09:12:03 +00:00
|
|
|
GLubyte checker_stipple_sml[32*32/8] =
|
|
|
|
{
|
2012-01-12 06:11:08 +00:00
|
|
|
255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,
|
|
|
|
255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,
|
|
|
|
0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,
|
|
|
|
0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,
|
|
|
|
255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,
|
|
|
|
255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,
|
|
|
|
0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,
|
|
|
|
0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,
|
2011-06-06 09:12:03 +00:00
|
|
|
};
|
|
|
|
|
2009-04-02 15:01:11 +00:00
|
|
|
/* ************************************************* */
|
|
|
|
|
|
|
|
void ui_draw_anti_tria(float x1, float y1, float x2, float y2, float x3, float y3)
|
|
|
|
{
|
2011-09-09 14:44:36 +00:00
|
|
|
float tri_arr[3][2]= {{x1, y1}, {x2, y2}, {x3, y3}};
|
2009-04-02 15:01:11 +00:00
|
|
|
float color[4];
|
|
|
|
int j;
|
|
|
|
|
|
|
|
glEnable(GL_BLEND);
|
|
|
|
glGetFloatv(GL_CURRENT_COLOR, color);
|
2011-08-19 16:21:29 +00:00
|
|
|
color[3] *= 0.125f;
|
2009-04-02 15:01:11 +00:00
|
|
|
glColor4fv(color);
|
2011-09-09 14:44:36 +00:00
|
|
|
|
|
|
|
glEnableClientState(GL_VERTEX_ARRAY);
|
|
|
|
glVertexPointer(2, GL_FLOAT, 0, tri_arr);
|
|
|
|
|
2009-04-02 15:01:11 +00:00
|
|
|
/* for each AA step */
|
2012-01-13 09:26:06 +00:00
|
|
|
for (j = 0; j < WIDGET_AA_JITTER; j++) {
|
2011-03-27 14:52:16 +00:00
|
|
|
glTranslatef(1.0f * jit[j][0], 1.0f * jit[j][1], 0.0f);
|
2011-09-09 14:44:36 +00:00
|
|
|
glDrawArrays(GL_TRIANGLES, 0, 3);
|
2011-03-27 14:52:16 +00:00
|
|
|
glTranslatef(-1.0f * jit[j][0], -1.0f * jit[j][1], 0.0f);
|
2009-04-02 15:01:11 +00:00
|
|
|
}
|
2009-03-25 16:58:42 +00:00
|
|
|
|
2011-09-09 14:44:36 +00:00
|
|
|
glDisableClientState(GL_VERTEX_ARRAY);
|
2009-04-02 15:01:11 +00:00
|
|
|
glDisable(GL_BLEND);
|
2011-12-16 22:00:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ui_draw_anti_roundbox(int mode, float minx, float miny, float maxx, float maxy, float rad)
|
|
|
|
{
|
|
|
|
float color[4];
|
|
|
|
int j;
|
|
|
|
|
|
|
|
glEnable(GL_BLEND);
|
|
|
|
glGetFloatv(GL_CURRENT_COLOR, color);
|
|
|
|
color[3] *= 0.125f;
|
|
|
|
glColor4fv(color);
|
2009-04-02 15:01:11 +00:00
|
|
|
|
2012-01-13 09:26:06 +00:00
|
|
|
for (j = 0; j < WIDGET_AA_JITTER; j++) {
|
2011-12-16 22:00:53 +00:00
|
|
|
glTranslatef(1.0f * jit[j][0], 1.0f * jit[j][1], 0.0f);
|
|
|
|
uiDrawBox(mode, minx, miny, maxx, maxy, rad);
|
|
|
|
glTranslatef(-1.0f * jit[j][0], -1.0f * jit[j][1], 0.0f);
|
|
|
|
}
|
|
|
|
|
|
|
|
glDisable(GL_BLEND);
|
2009-04-02 15:01:11 +00:00
|
|
|
}
|
2009-03-25 16:58:42 +00:00
|
|
|
|
2009-04-02 18:16:15 +00:00
|
|
|
static void widget_init(uiWidgetBase *wtb)
|
2009-03-25 16:58:42 +00:00
|
|
|
{
|
2009-04-02 18:16:15 +00:00
|
|
|
wtb->totvert= wtb->halfwayvert= 0;
|
|
|
|
wtb->tria1.tot= 0;
|
|
|
|
wtb->tria2.tot= 0;
|
|
|
|
|
|
|
|
wtb->inner= 1;
|
|
|
|
wtb->outline= 1;
|
2009-04-03 16:26:03 +00:00
|
|
|
wtb->emboss= 1;
|
2009-06-24 14:16:56 +00:00
|
|
|
wtb->shadedir= 1;
|
2009-04-03 16:26:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* helper call, makes shadow rect, with 'sun' above menu, so only shadow to left/right/bottom */
|
|
|
|
/* return tot */
|
2009-04-15 14:43:54 +00:00
|
|
|
static int round_box_shadow_edges(float (*vert)[2], rcti *rect, float rad, int roundboxalign, float step)
|
2009-04-03 16:26:03 +00:00
|
|
|
{
|
2011-09-09 13:10:18 +00:00
|
|
|
float vec[WIDGET_CURVE_RESOLU][2];
|
2009-04-03 16:26:03 +00:00
|
|
|
float minx, miny, maxx, maxy;
|
|
|
|
int a, tot= 0;
|
|
|
|
|
2009-04-15 14:43:54 +00:00
|
|
|
rad+= step;
|
|
|
|
|
|
|
|
if(2.0f*rad > rect->ymax-rect->ymin)
|
|
|
|
rad= 0.5f*(rect->ymax-rect->ymin);
|
|
|
|
|
|
|
|
minx= rect->xmin-step;
|
|
|
|
miny= rect->ymin-step;
|
|
|
|
maxx= rect->xmax+step;
|
|
|
|
maxy= rect->ymax+step;
|
2009-04-03 16:26:03 +00:00
|
|
|
|
|
|
|
/* mult */
|
2011-09-09 13:10:18 +00:00
|
|
|
for(a=0; a < WIDGET_CURVE_RESOLU; a++) {
|
2009-04-03 16:26:03 +00:00
|
|
|
vec[a][0]= rad*cornervec[a][0];
|
|
|
|
vec[a][1]= rad*cornervec[a][1];
|
|
|
|
}
|
|
|
|
|
|
|
|
/* start with left-top, anti clockwise */
|
2011-09-11 06:41:09 +00:00
|
|
|
if(roundboxalign & UI_CNR_TOP_LEFT) {
|
2011-09-09 13:10:18 +00:00
|
|
|
for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
|
2009-04-03 16:26:03 +00:00
|
|
|
vert[tot][0]= minx+rad-vec[a][0];
|
|
|
|
vert[tot][1]= maxy-vec[a][1];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2011-09-09 13:10:18 +00:00
|
|
|
for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
|
2009-04-03 16:26:03 +00:00
|
|
|
vert[tot][0]= minx;
|
|
|
|
vert[tot][1]= maxy;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-09-11 06:41:09 +00:00
|
|
|
if(roundboxalign & UI_CNR_BOTTOM_LEFT) {
|
2011-09-09 13:10:18 +00:00
|
|
|
for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
|
2009-04-03 16:26:03 +00:00
|
|
|
vert[tot][0]= minx+vec[a][1];
|
|
|
|
vert[tot][1]= miny+rad-vec[a][0];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2011-09-09 13:10:18 +00:00
|
|
|
for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
|
2009-04-03 16:26:03 +00:00
|
|
|
vert[tot][0]= minx;
|
|
|
|
vert[tot][1]= miny;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-09-11 06:41:09 +00:00
|
|
|
if(roundboxalign & UI_CNR_BOTTOM_RIGHT) {
|
2011-09-09 13:10:18 +00:00
|
|
|
for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
|
2009-04-03 16:26:03 +00:00
|
|
|
vert[tot][0]= maxx-rad+vec[a][0];
|
|
|
|
vert[tot][1]= miny+vec[a][1];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2011-09-09 13:10:18 +00:00
|
|
|
for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
|
2009-04-03 16:26:03 +00:00
|
|
|
vert[tot][0]= maxx;
|
|
|
|
vert[tot][1]= miny;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-09-11 06:41:09 +00:00
|
|
|
if(roundboxalign & UI_CNR_TOP_RIGHT) {
|
2011-09-09 13:10:18 +00:00
|
|
|
for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
|
2009-04-03 16:26:03 +00:00
|
|
|
vert[tot][0]= maxx-vec[a][1];
|
|
|
|
vert[tot][1]= maxy-rad+vec[a][0];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2011-09-09 13:10:18 +00:00
|
|
|
for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
|
2009-04-03 16:26:03 +00:00
|
|
|
vert[tot][0]= maxx;
|
|
|
|
vert[tot][1]= maxy;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return tot;
|
2009-03-25 16:58:42 +00:00
|
|
|
}
|
|
|
|
|
2009-06-08 12:39:39 +00:00
|
|
|
/* this call has 1 extra arg to allow mask outline */
|
|
|
|
static void round_box__edges(uiWidgetBase *wt, int roundboxalign, rcti *rect, float rad, float radi)
|
2009-03-25 16:58:42 +00:00
|
|
|
{
|
2011-09-09 13:10:18 +00:00
|
|
|
float vec[WIDGET_CURVE_RESOLU][2], veci[WIDGET_CURVE_RESOLU][2];
|
2009-03-25 16:58:42 +00:00
|
|
|
float minx= rect->xmin, miny= rect->ymin, maxx= rect->xmax, maxy= rect->ymax;
|
|
|
|
float minxi= minx + 1.0f; /* boundbox inner */
|
|
|
|
float maxxi= maxx - 1.0f;
|
|
|
|
float minyi= miny + 1.0f;
|
|
|
|
float maxyi= maxy - 1.0f;
|
2010-06-04 11:31:39 +00:00
|
|
|
float facxi= (maxxi!=minxi) ? 1.0f/(maxxi-minxi) : 0.0f; /* for uv, can divide by zero */
|
|
|
|
float facyi= (maxyi!=minyi) ? 1.0f/(maxyi-minyi) : 0.0f;
|
2009-07-02 11:23:19 +00:00
|
|
|
int a, tot= 0, minsize;
|
2011-09-11 06:41:09 +00:00
|
|
|
const int hnum= ((roundboxalign & (UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT))==(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT) ||
|
|
|
|
(roundboxalign & (UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT))==(UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT)) ? 1 : 2;
|
|
|
|
const int vnum= ((roundboxalign & (UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT))==(UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT) ||
|
|
|
|
(roundboxalign & (UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT))==(UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT)) ? 1 : 2;
|
2010-06-04 11:31:39 +00:00
|
|
|
|
2010-10-05 15:44:58 +00:00
|
|
|
minsize= MIN2((rect->xmax-rect->xmin)*hnum, (rect->ymax-rect->ymin)*vnum);
|
2009-07-02 11:23:19 +00:00
|
|
|
|
|
|
|
if(2.0f*rad > minsize)
|
|
|
|
rad= 0.5f*minsize;
|
2009-04-15 14:43:54 +00:00
|
|
|
|
2009-07-02 11:23:19 +00:00
|
|
|
if(2.0f*(radi+1.0f) > minsize)
|
|
|
|
radi= 0.5f*minsize - 1.0f;
|
2009-04-15 14:43:54 +00:00
|
|
|
|
2009-03-25 16:58:42 +00:00
|
|
|
/* mult */
|
2011-09-09 13:10:18 +00:00
|
|
|
for(a=0; a < WIDGET_CURVE_RESOLU; a++) {
|
2009-03-25 16:58:42 +00:00
|
|
|
veci[a][0]= radi*cornervec[a][0];
|
|
|
|
veci[a][1]= radi*cornervec[a][1];
|
|
|
|
vec[a][0]= rad*cornervec[a][0];
|
|
|
|
vec[a][1]= rad*cornervec[a][1];
|
|
|
|
}
|
|
|
|
|
|
|
|
/* corner left-bottom */
|
2011-09-11 06:41:09 +00:00
|
|
|
if(roundboxalign & UI_CNR_BOTTOM_LEFT) {
|
2009-03-25 16:58:42 +00:00
|
|
|
|
2011-09-09 13:10:18 +00:00
|
|
|
for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
|
2009-03-25 16:58:42 +00:00
|
|
|
wt->inner_v[tot][0]= minxi+veci[a][1];
|
|
|
|
wt->inner_v[tot][1]= minyi+radi-veci[a][0];
|
|
|
|
|
|
|
|
wt->outer_v[tot][0]= minx+vec[a][1];
|
|
|
|
wt->outer_v[tot][1]= miny+rad-vec[a][0];
|
|
|
|
|
|
|
|
wt->inner_uv[tot][0]= facxi*(wt->inner_v[tot][0] - minxi);
|
|
|
|
wt->inner_uv[tot][1]= facyi*(wt->inner_v[tot][1] - minyi);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
wt->inner_v[tot][0]= minxi;
|
|
|
|
wt->inner_v[tot][1]= minyi;
|
|
|
|
|
|
|
|
wt->outer_v[tot][0]= minx;
|
|
|
|
wt->outer_v[tot][1]= miny;
|
|
|
|
|
|
|
|
wt->inner_uv[tot][0]= 0.0f;
|
|
|
|
wt->inner_uv[tot][1]= 0.0f;
|
|
|
|
|
|
|
|
tot++;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* corner right-bottom */
|
2011-09-11 06:41:09 +00:00
|
|
|
if(roundboxalign & UI_CNR_BOTTOM_RIGHT) {
|
2009-03-25 16:58:42 +00:00
|
|
|
|
2011-09-09 13:10:18 +00:00
|
|
|
for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
|
2009-03-25 16:58:42 +00:00
|
|
|
wt->inner_v[tot][0]= maxxi-radi+veci[a][0];
|
|
|
|
wt->inner_v[tot][1]= minyi+veci[a][1];
|
|
|
|
|
|
|
|
wt->outer_v[tot][0]= maxx-rad+vec[a][0];
|
|
|
|
wt->outer_v[tot][1]= miny+vec[a][1];
|
|
|
|
|
|
|
|
wt->inner_uv[tot][0]= facxi*(wt->inner_v[tot][0] - minxi);
|
|
|
|
wt->inner_uv[tot][1]= facyi*(wt->inner_v[tot][1] - minyi);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
wt->inner_v[tot][0]= maxxi;
|
|
|
|
wt->inner_v[tot][1]= minyi;
|
|
|
|
|
|
|
|
wt->outer_v[tot][0]= maxx;
|
|
|
|
wt->outer_v[tot][1]= miny;
|
|
|
|
|
|
|
|
wt->inner_uv[tot][0]= 1.0f;
|
|
|
|
wt->inner_uv[tot][1]= 0.0f;
|
|
|
|
|
|
|
|
tot++;
|
|
|
|
}
|
|
|
|
|
|
|
|
wt->halfwayvert= tot;
|
|
|
|
|
|
|
|
/* corner right-top */
|
2011-09-11 06:41:09 +00:00
|
|
|
if(roundboxalign & UI_CNR_TOP_RIGHT) {
|
2009-03-25 16:58:42 +00:00
|
|
|
|
2011-09-09 13:10:18 +00:00
|
|
|
for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
|
2009-03-25 16:58:42 +00:00
|
|
|
wt->inner_v[tot][0]= maxxi-veci[a][1];
|
|
|
|
wt->inner_v[tot][1]= maxyi-radi+veci[a][0];
|
|
|
|
|
|
|
|
wt->outer_v[tot][0]= maxx-vec[a][1];
|
|
|
|
wt->outer_v[tot][1]= maxy-rad+vec[a][0];
|
|
|
|
|
|
|
|
wt->inner_uv[tot][0]= facxi*(wt->inner_v[tot][0] - minxi);
|
|
|
|
wt->inner_uv[tot][1]= facyi*(wt->inner_v[tot][1] - minyi);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
wt->inner_v[tot][0]= maxxi;
|
|
|
|
wt->inner_v[tot][1]= maxyi;
|
|
|
|
|
|
|
|
wt->outer_v[tot][0]= maxx;
|
|
|
|
wt->outer_v[tot][1]= maxy;
|
|
|
|
|
|
|
|
wt->inner_uv[tot][0]= 1.0f;
|
|
|
|
wt->inner_uv[tot][1]= 1.0f;
|
|
|
|
|
|
|
|
tot++;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* corner left-top */
|
2011-09-11 06:41:09 +00:00
|
|
|
if(roundboxalign & UI_CNR_TOP_LEFT) {
|
2009-03-25 16:58:42 +00:00
|
|
|
|
2011-09-09 13:10:18 +00:00
|
|
|
for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
|
2009-03-25 16:58:42 +00:00
|
|
|
wt->inner_v[tot][0]= minxi+radi-veci[a][0];
|
|
|
|
wt->inner_v[tot][1]= maxyi-veci[a][1];
|
|
|
|
|
|
|
|
wt->outer_v[tot][0]= minx+rad-vec[a][0];
|
|
|
|
wt->outer_v[tot][1]= maxy-vec[a][1];
|
|
|
|
|
|
|
|
wt->inner_uv[tot][0]= facxi*(wt->inner_v[tot][0] - minxi);
|
|
|
|
wt->inner_uv[tot][1]= facyi*(wt->inner_v[tot][1] - minyi);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
|
|
|
|
wt->inner_v[tot][0]= minxi;
|
|
|
|
wt->inner_v[tot][1]= maxyi;
|
|
|
|
|
|
|
|
wt->outer_v[tot][0]= minx;
|
|
|
|
wt->outer_v[tot][1]= maxy;
|
|
|
|
|
|
|
|
wt->inner_uv[tot][0]= 0.0f;
|
|
|
|
wt->inner_uv[tot][1]= 1.0f;
|
|
|
|
|
|
|
|
tot++;
|
|
|
|
}
|
2011-09-09 13:10:18 +00:00
|
|
|
|
|
|
|
BLI_assert(tot <= WIDGET_SIZE_MAX);
|
|
|
|
|
2009-03-25 16:58:42 +00:00
|
|
|
wt->totvert= tot;
|
|
|
|
}
|
|
|
|
|
2009-06-08 12:39:39 +00:00
|
|
|
static void round_box_edges(uiWidgetBase *wt, int roundboxalign, rcti *rect, float rad)
|
|
|
|
{
|
|
|
|
round_box__edges(wt, roundboxalign, rect, rad, rad-1.0f);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-03-25 16:58:42 +00:00
|
|
|
/* based on button rect, return scaled array of triangles */
|
|
|
|
static void widget_num_tria(uiWidgetTrias *tria, rcti *rect, float triasize, char where)
|
|
|
|
{
|
2009-07-03 13:21:09 +00:00
|
|
|
float centx, centy, sizex, sizey, minsize;
|
|
|
|
int a, i1=0, i2=1;
|
|
|
|
|
|
|
|
minsize= MIN2(rect->xmax-rect->xmin, rect->ymax-rect->ymin);
|
2009-03-25 16:58:42 +00:00
|
|
|
|
|
|
|
/* center position and size */
|
2009-07-03 13:21:09 +00:00
|
|
|
centx= (float)rect->xmin + 0.5f*minsize;
|
|
|
|
centy= (float)rect->ymin + 0.5f*minsize;
|
|
|
|
sizex= sizey= -0.5f*triasize*minsize;
|
2009-03-25 16:58:42 +00:00
|
|
|
|
|
|
|
if(where=='r') {
|
2009-07-03 13:21:09 +00:00
|
|
|
centx= (float)rect->xmax - 0.5f*minsize;
|
|
|
|
sizex= -sizex;
|
|
|
|
}
|
|
|
|
else if(where=='t') {
|
|
|
|
centy= (float)rect->ymax - 0.5f*minsize;
|
|
|
|
sizey= -sizey;
|
|
|
|
i2=0; i1= 1;
|
|
|
|
}
|
|
|
|
else if(where=='b') {
|
|
|
|
sizex= -sizex;
|
|
|
|
i2=0; i1= 1;
|
2009-03-25 16:58:42 +00:00
|
|
|
}
|
|
|
|
|
2009-09-14 12:28:59 +00:00
|
|
|
for(a=0; a<3; a++) {
|
2009-07-03 13:21:09 +00:00
|
|
|
tria->vec[a][0]= sizex*num_tria_vert[a][i1] + centx;
|
|
|
|
tria->vec[a][1]= sizey*num_tria_vert[a][i2] + centy;
|
2009-03-25 16:58:42 +00:00
|
|
|
}
|
|
|
|
|
2009-09-14 12:28:59 +00:00
|
|
|
tria->tot= 1;
|
2009-03-25 16:58:42 +00:00
|
|
|
tria->index= num_tria_face;
|
|
|
|
}
|
|
|
|
|
2009-09-14 12:28:59 +00:00
|
|
|
static void widget_scroll_circle(uiWidgetTrias *tria, rcti *rect, float triasize, char where)
|
|
|
|
{
|
|
|
|
float centx, centy, sizex, sizey, minsize;
|
|
|
|
int a, i1=0, i2=1;
|
|
|
|
|
|
|
|
minsize= MIN2(rect->xmax-rect->xmin, rect->ymax-rect->ymin);
|
|
|
|
|
|
|
|
/* center position and size */
|
|
|
|
centx= (float)rect->xmin + 0.5f*minsize;
|
|
|
|
centy= (float)rect->ymin + 0.5f*minsize;
|
|
|
|
sizex= sizey= -0.5f*triasize*minsize;
|
|
|
|
|
|
|
|
if(where=='r') {
|
|
|
|
centx= (float)rect->xmax - 0.5f*minsize;
|
|
|
|
sizex= -sizex;
|
|
|
|
}
|
|
|
|
else if(where=='t') {
|
|
|
|
centy= (float)rect->ymax - 0.5f*minsize;
|
|
|
|
sizey= -sizey;
|
|
|
|
i2=0; i1= 1;
|
|
|
|
}
|
|
|
|
else if(where=='b') {
|
|
|
|
sizex= -sizex;
|
|
|
|
i2=0; i1= 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
for(a=0; a<16; a++) {
|
|
|
|
tria->vec[a][0]= sizex*scroll_circle_vert[a][i1] + centx;
|
|
|
|
tria->vec[a][1]= sizey*scroll_circle_vert[a][i2] + centy;
|
|
|
|
}
|
|
|
|
|
|
|
|
tria->tot= 14;
|
|
|
|
tria->index= scroll_circle_face;
|
|
|
|
}
|
|
|
|
|
2009-03-25 16:58:42 +00:00
|
|
|
static void widget_trias_draw(uiWidgetTrias *tria)
|
|
|
|
{
|
2011-09-09 14:44:36 +00:00
|
|
|
glEnableClientState(GL_VERTEX_ARRAY);
|
|
|
|
glVertexPointer(2, GL_FLOAT, 0, tria->vec);
|
2011-09-10 01:39:21 +00:00
|
|
|
glDrawElements(GL_TRIANGLES, tria->tot*3, GL_UNSIGNED_INT, tria->index);
|
2011-09-09 14:44:36 +00:00
|
|
|
glDisableClientState(GL_VERTEX_ARRAY);
|
2009-03-25 16:58:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void widget_menu_trias(uiWidgetTrias *tria, rcti *rect)
|
|
|
|
{
|
2009-04-03 16:26:03 +00:00
|
|
|
float centx, centy, size, asp;
|
2009-03-25 16:58:42 +00:00
|
|
|
int a;
|
|
|
|
|
|
|
|
/* center position and size */
|
|
|
|
centx= rect->xmax - 0.5f*(rect->ymax-rect->ymin);
|
|
|
|
centy= rect->ymin + 0.5f*(rect->ymax-rect->ymin);
|
|
|
|
size= 0.4f*(rect->ymax-rect->ymin);
|
|
|
|
|
2009-04-03 16:26:03 +00:00
|
|
|
/* XXX exception */
|
|
|
|
asp= ((float)rect->xmax-rect->xmin)/((float)rect->ymax-rect->ymin);
|
|
|
|
if(asp > 1.2f && asp < 2.6f)
|
|
|
|
centx= rect->xmax - 0.3f*(rect->ymax-rect->ymin);
|
|
|
|
|
2009-03-25 16:58:42 +00:00
|
|
|
for(a=0; a<6; a++) {
|
|
|
|
tria->vec[a][0]= size*menu_tria_vert[a][0] + centx;
|
|
|
|
tria->vec[a][1]= size*menu_tria_vert[a][1] + centy;
|
|
|
|
}
|
|
|
|
|
|
|
|
tria->tot= 2;
|
|
|
|
tria->index= menu_tria_face;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void widget_check_trias(uiWidgetTrias *tria, rcti *rect)
|
|
|
|
{
|
|
|
|
float centx, centy, size;
|
|
|
|
int a;
|
|
|
|
|
|
|
|
/* center position and size */
|
|
|
|
centx= rect->xmin + 0.5f*(rect->ymax-rect->ymin);
|
|
|
|
centy= rect->ymin + 0.5f*(rect->ymax-rect->ymin);
|
|
|
|
size= 0.5f*(rect->ymax-rect->ymin);
|
|
|
|
|
|
|
|
for(a=0; a<6; a++) {
|
|
|
|
tria->vec[a][0]= size*check_tria_vert[a][0] + centx;
|
|
|
|
tria->vec[a][1]= size*check_tria_vert[a][1] + centy;
|
|
|
|
}
|
|
|
|
|
|
|
|
tria->tot= 4;
|
|
|
|
tria->index= check_tria_face;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* prepares shade colors */
|
2011-09-26 17:30:56 +00:00
|
|
|
static void shadecolors4(char coltop[4], char *coldown, const char *color, short shadetop, short shadedown)
|
2009-03-25 16:58:42 +00:00
|
|
|
{
|
|
|
|
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
coltop[0]= CLAMPIS(color[0]+shadetop, 0, 255);
|
|
|
|
coltop[1]= CLAMPIS(color[1]+shadetop, 0, 255);
|
|
|
|
coltop[2]= CLAMPIS(color[2]+shadetop, 0, 255);
|
2009-04-03 16:26:03 +00:00
|
|
|
coltop[3]= color[3];
|
2009-03-25 16:58:42 +00:00
|
|
|
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
coldown[0]= CLAMPIS(color[0]+shadedown, 0, 255);
|
|
|
|
coldown[1]= CLAMPIS(color[1]+shadedown, 0, 255);
|
|
|
|
coldown[2]= CLAMPIS(color[2]+shadedown, 0, 255);
|
2009-07-02 18:12:46 +00:00
|
|
|
coldown[3]= color[3];
|
2009-03-25 16:58:42 +00:00
|
|
|
}
|
|
|
|
|
2011-09-09 14:44:36 +00:00
|
|
|
static void round_box_shade_col4_r(unsigned char col_r[4], const char col1[4], const char col2[4], const float fac)
|
|
|
|
{
|
|
|
|
const int faci= FTOCHAR(fac);
|
|
|
|
const int facm= 255-faci;
|
|
|
|
|
|
|
|
col_r[0]= (faci*col1[0] + facm*col2[0])>>8;
|
|
|
|
col_r[1]= (faci*col1[1] + facm*col2[1])>>8;
|
|
|
|
col_r[2]= (faci*col1[2] + facm*col2[2])>>8;
|
|
|
|
col_r[3]= (faci*col1[3] + facm*col2[3])>>8;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void widget_verts_to_quad_strip(uiWidgetBase *wtb, const int totvert, float quad_strip[WIDGET_SIZE_MAX*2+2][2])
|
2009-06-08 12:39:39 +00:00
|
|
|
{
|
|
|
|
int a;
|
2011-09-09 14:44:36 +00:00
|
|
|
for(a=0; a<totvert; a++) {
|
|
|
|
copy_v2_v2(quad_strip[a*2], wtb->outer_v[a]);
|
|
|
|
copy_v2_v2(quad_strip[a*2+1], wtb->inner_v[a]);
|
2009-06-08 12:39:39 +00:00
|
|
|
}
|
2011-09-09 14:44:36 +00:00
|
|
|
copy_v2_v2(quad_strip[a*2], wtb->outer_v[0]);
|
|
|
|
copy_v2_v2(quad_strip[a*2+1], wtb->inner_v[0]);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void widget_verts_to_quad_strip_open(uiWidgetBase *wtb, const int totvert, float quad_strip[WIDGET_SIZE_MAX*2][2])
|
|
|
|
{
|
|
|
|
int a;
|
|
|
|
for(a=0; a<totvert; a++) {
|
|
|
|
quad_strip[a*2][0]= wtb->outer_v[a][0];
|
|
|
|
quad_strip[a*2][1]= wtb->outer_v[a][1];
|
|
|
|
quad_strip[a*2+1][0]= wtb->outer_v[a][0];
|
|
|
|
quad_strip[a*2+1][1]= wtb->outer_v[a][1] - 1.0f;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void widgetbase_outline(uiWidgetBase *wtb)
|
|
|
|
{
|
|
|
|
float quad_strip[WIDGET_SIZE_MAX*2+2][2]; /* + 2 because the last pair is wrapped */
|
|
|
|
widget_verts_to_quad_strip(wtb, wtb->totvert, quad_strip);
|
|
|
|
|
|
|
|
glEnableClientState(GL_VERTEX_ARRAY);
|
|
|
|
glVertexPointer(2, GL_FLOAT, 0, quad_strip);
|
|
|
|
glDrawArrays(GL_QUAD_STRIP, 0, wtb->totvert*2 + 2);
|
|
|
|
glDisableClientState(GL_VERTEX_ARRAY);
|
2009-06-08 12:39:39 +00:00
|
|
|
}
|
|
|
|
|
2009-04-02 18:16:15 +00:00
|
|
|
static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol)
|
2009-03-25 16:58:42 +00:00
|
|
|
{
|
|
|
|
int j, a;
|
|
|
|
|
|
|
|
glEnable(GL_BLEND);
|
|
|
|
|
|
|
|
/* backdrop non AA */
|
2009-04-02 18:16:15 +00:00
|
|
|
if(wtb->inner) {
|
|
|
|
if(wcol->shaded==0) {
|
2010-06-26 17:12:55 +00:00
|
|
|
if (wcol->alpha_check) {
|
2011-09-09 14:44:36 +00:00
|
|
|
float inner_v_half[WIDGET_SIZE_MAX][2];
|
2010-06-26 17:12:55 +00:00
|
|
|
float x_mid= 0.0f; /* used for dumb clamping of values */
|
|
|
|
|
|
|
|
/* dark checkers */
|
2011-06-06 09:12:03 +00:00
|
|
|
glColor4ub(UI_TRANSP_DARK, UI_TRANSP_DARK, UI_TRANSP_DARK, 255);
|
2011-09-09 14:44:36 +00:00
|
|
|
glEnableClientState(GL_VERTEX_ARRAY);
|
|
|
|
glVertexPointer(2, GL_FLOAT, 0, wtb->inner_v);
|
|
|
|
glDrawArrays(GL_POLYGON, 0, wtb->totvert);
|
|
|
|
glDisableClientState(GL_VERTEX_ARRAY);
|
2009-06-08 10:00:14 +00:00
|
|
|
|
2010-06-26 17:12:55 +00:00
|
|
|
/* light checkers */
|
|
|
|
glEnable(GL_POLYGON_STIPPLE);
|
2011-06-06 09:12:03 +00:00
|
|
|
glColor4ub(UI_TRANSP_LIGHT, UI_TRANSP_LIGHT, UI_TRANSP_LIGHT, 255);
|
2010-06-26 17:12:55 +00:00
|
|
|
glPolygonStipple(checker_stipple_sml);
|
2011-09-09 14:44:36 +00:00
|
|
|
|
|
|
|
glEnableClientState(GL_VERTEX_ARRAY);
|
|
|
|
glVertexPointer(2, GL_FLOAT, 0, wtb->inner_v);
|
|
|
|
glDrawArrays(GL_POLYGON, 0, wtb->totvert);
|
|
|
|
glDisableClientState(GL_VERTEX_ARRAY);
|
|
|
|
|
2010-06-26 17:12:55 +00:00
|
|
|
glDisable(GL_POLYGON_STIPPLE);
|
|
|
|
|
|
|
|
/* alpha fill */
|
|
|
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
|
|
|
|
|
|
|
glColor4ubv((unsigned char*)wcol->inner);
|
2011-09-09 14:44:36 +00:00
|
|
|
glEnableClientState(GL_VERTEX_ARRAY);
|
|
|
|
|
2010-06-26 17:12:55 +00:00
|
|
|
for(a=0; a<wtb->totvert; a++) {
|
|
|
|
x_mid += wtb->inner_v[a][0];
|
|
|
|
}
|
|
|
|
x_mid /= wtb->totvert;
|
2011-09-09 14:44:36 +00:00
|
|
|
|
|
|
|
glVertexPointer(2, GL_FLOAT, 0, wtb->inner_v);
|
|
|
|
glDrawArrays(GL_POLYGON, 0, wtb->totvert);
|
|
|
|
glDisableClientState(GL_VERTEX_ARRAY);
|
2010-06-26 17:12:55 +00:00
|
|
|
|
|
|
|
/* 1/2 solid color */
|
|
|
|
glColor4ub(wcol->inner[0], wcol->inner[1], wcol->inner[2], 255);
|
2011-09-09 14:44:36 +00:00
|
|
|
|
|
|
|
for(a=0; a<wtb->totvert; a++) {
|
|
|
|
inner_v_half[a][0]= MIN2(wtb->inner_v[a][0], x_mid);
|
|
|
|
inner_v_half[a][1]= wtb->inner_v[a][1];
|
|
|
|
}
|
|
|
|
|
|
|
|
glEnableClientState(GL_VERTEX_ARRAY);
|
|
|
|
glVertexPointer(2, GL_FLOAT, 0, inner_v_half);
|
|
|
|
glDrawArrays(GL_POLYGON, 0, wtb->totvert);
|
|
|
|
glDisableClientState(GL_VERTEX_ARRAY);
|
2010-06-26 17:12:55 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* simple fill */
|
|
|
|
glColor4ubv((unsigned char*)wcol->inner);
|
2011-09-09 14:44:36 +00:00
|
|
|
|
|
|
|
glEnableClientState(GL_VERTEX_ARRAY);
|
|
|
|
glVertexPointer(2, GL_FLOAT, 0, wtb->inner_v);
|
|
|
|
glDrawArrays(GL_POLYGON, 0, wtb->totvert);
|
|
|
|
glDisableClientState(GL_VERTEX_ARRAY);
|
2010-06-26 17:12:55 +00:00
|
|
|
}
|
2009-04-02 18:16:15 +00:00
|
|
|
}
|
|
|
|
else {
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
char col1[4], col2[4];
|
2011-09-09 14:44:36 +00:00
|
|
|
unsigned char col_array[WIDGET_SIZE_MAX * 4];
|
|
|
|
unsigned char *col_pt= col_array;
|
2009-04-02 18:16:15 +00:00
|
|
|
|
2009-04-03 16:26:03 +00:00
|
|
|
shadecolors4(col1, col2, wcol->inner, wcol->shadetop, wcol->shadedown);
|
2009-04-02 18:16:15 +00:00
|
|
|
|
|
|
|
glShadeModel(GL_SMOOTH);
|
2011-09-09 14:44:36 +00:00
|
|
|
for(a=0; a<wtb->totvert; a++, col_pt += 4) {
|
|
|
|
round_box_shade_col4_r(col_pt, col1, col2, wtb->inner_uv[a][wtb->shadedir]);
|
2009-04-02 18:16:15 +00:00
|
|
|
}
|
2011-09-09 14:44:36 +00:00
|
|
|
|
|
|
|
glEnableClientState(GL_VERTEX_ARRAY);
|
|
|
|
glEnableClientState(GL_COLOR_ARRAY);
|
|
|
|
glVertexPointer(2, GL_FLOAT, 0, wtb->inner_v);
|
|
|
|
glColorPointer(4, GL_UNSIGNED_BYTE, 0, col_array);
|
|
|
|
glDrawArrays(GL_POLYGON, 0, wtb->totvert);
|
|
|
|
glDisableClientState(GL_VERTEX_ARRAY);
|
|
|
|
glDisableClientState(GL_COLOR_ARRAY);
|
|
|
|
|
2009-04-02 18:16:15 +00:00
|
|
|
glShadeModel(GL_FLAT);
|
2009-03-25 16:58:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* for each AA step */
|
2009-04-02 18:16:15 +00:00
|
|
|
if(wtb->outline) {
|
2011-09-09 14:44:36 +00:00
|
|
|
float quad_strip[WIDGET_SIZE_MAX*2+2][2]; /* + 2 because the last pair is wrapped */
|
|
|
|
float quad_strip_emboss[WIDGET_SIZE_MAX*2][2]; /* only for emboss */
|
|
|
|
|
2012-01-14 07:46:21 +00:00
|
|
|
const unsigned char tcol[4] = {wcol->outline[0],
|
|
|
|
wcol->outline[1],
|
|
|
|
wcol->outline[2],
|
|
|
|
UCHAR_MAX / WIDGET_AA_JITTER};
|
2012-01-13 09:26:06 +00:00
|
|
|
|
2011-09-09 14:44:36 +00:00
|
|
|
widget_verts_to_quad_strip(wtb, wtb->totvert, quad_strip);
|
|
|
|
|
|
|
|
if(wtb->emboss) {
|
|
|
|
widget_verts_to_quad_strip_open(wtb, wtb->halfwayvert, quad_strip_emboss);
|
|
|
|
}
|
|
|
|
|
|
|
|
glEnableClientState(GL_VERTEX_ARRAY);
|
|
|
|
|
2012-01-13 09:26:06 +00:00
|
|
|
for (j = 0; j < WIDGET_AA_JITTER; j++) {
|
2011-03-27 14:52:16 +00:00
|
|
|
glTranslatef(1.0f * jit[j][0], 1.0f * jit[j][1], 0.0f);
|
2009-04-02 18:16:15 +00:00
|
|
|
|
|
|
|
/* outline */
|
2012-01-13 09:26:06 +00:00
|
|
|
glColor4ubv(tcol);
|
2011-09-09 14:44:36 +00:00
|
|
|
|
|
|
|
glVertexPointer(2, GL_FLOAT, 0, quad_strip);
|
|
|
|
glDrawArrays(GL_QUAD_STRIP, 0, wtb->totvert*2 + 2);
|
2009-03-25 16:58:42 +00:00
|
|
|
|
2009-04-02 18:16:15 +00:00
|
|
|
/* emboss bottom shadow */
|
2009-04-03 16:26:03 +00:00
|
|
|
if(wtb->emboss) {
|
|
|
|
glColor4f(1.0f, 1.0f, 1.0f, 0.02f);
|
2011-09-09 14:44:36 +00:00
|
|
|
|
|
|
|
glVertexPointer(2, GL_FLOAT, 0, quad_strip_emboss);
|
|
|
|
glDrawArrays(GL_QUAD_STRIP, 0, wtb->halfwayvert*2);
|
2009-04-02 18:16:15 +00:00
|
|
|
}
|
|
|
|
|
2011-03-27 14:52:16 +00:00
|
|
|
glTranslatef(-1.0f * jit[j][0], -1.0f * jit[j][1], 0.0f);
|
2009-03-25 16:58:42 +00:00
|
|
|
}
|
2011-09-09 14:44:36 +00:00
|
|
|
|
|
|
|
glDisableClientState(GL_VERTEX_ARRAY);
|
2009-03-25 16:58:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* decoration */
|
2009-04-02 18:16:15 +00:00
|
|
|
if(wtb->tria1.tot || wtb->tria2.tot) {
|
2012-01-14 07:46:21 +00:00
|
|
|
const unsigned char tcol[4] = {wcol->item[0],
|
|
|
|
wcol->item[1],
|
|
|
|
wcol->item[2],
|
|
|
|
(unsigned char)((float)wcol->item[3] / WIDGET_AA_JITTER)};
|
2009-03-25 16:58:42 +00:00
|
|
|
/* for each AA step */
|
2012-01-13 09:26:06 +00:00
|
|
|
for (j = 0; j < WIDGET_AA_JITTER; j++) {
|
2011-03-27 14:52:16 +00:00
|
|
|
glTranslatef(1.0f * jit[j][0], 1.0f * jit[j][1], 0.0f);
|
2009-03-25 16:58:42 +00:00
|
|
|
|
2009-04-02 18:16:15 +00:00
|
|
|
if(wtb->tria1.tot) {
|
2012-01-13 09:26:06 +00:00
|
|
|
glColor4ubv(tcol);
|
2009-04-02 18:16:15 +00:00
|
|
|
widget_trias_draw(&wtb->tria1);
|
2009-03-25 16:58:42 +00:00
|
|
|
}
|
2009-04-02 18:16:15 +00:00
|
|
|
if(wtb->tria2.tot) {
|
2012-01-13 09:26:06 +00:00
|
|
|
glColor4ubv(tcol);
|
2009-04-02 18:16:15 +00:00
|
|
|
widget_trias_draw(&wtb->tria2);
|
2009-03-25 16:58:42 +00:00
|
|
|
}
|
|
|
|
|
2011-03-27 14:52:16 +00:00
|
|
|
glTranslatef(-1.0f * jit[j][0], -1.0f * jit[j][1], 0.0f);
|
2009-03-25 16:58:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
glDisable(GL_BLEND);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/* *********************** text/icon ************************************** */
|
|
|
|
|
2010-01-03 08:37:18 +00:00
|
|
|
#define PREVIEW_PAD 4
|
|
|
|
|
2011-01-20 16:29:43 +00:00
|
|
|
static void widget_draw_preview(BIFIconID icon, float UNUSED(alpha), rcti *rect)
|
2010-01-03 08:37:18 +00:00
|
|
|
{
|
2011-01-07 04:10:37 +00:00
|
|
|
int w, h, size;
|
2010-07-26 04:00:09 +00:00
|
|
|
|
2011-02-27 18:03:19 +00:00
|
|
|
if(icon==ICON_NONE)
|
2010-07-26 18:37:47 +00:00
|
|
|
return;
|
|
|
|
|
2010-01-03 08:37:18 +00:00
|
|
|
w = rect->xmax - rect->xmin;
|
|
|
|
h = rect->ymax - rect->ymin;
|
|
|
|
size = MIN2(w, h);
|
|
|
|
size -= PREVIEW_PAD*2; /* padding */
|
2011-01-07 04:10:37 +00:00
|
|
|
|
|
|
|
if(size > 0) {
|
|
|
|
int x = rect->xmin + w/2 - size/2;
|
|
|
|
int y = rect->ymin + h/2 - size/2;
|
|
|
|
|
2011-01-20 16:29:43 +00:00
|
|
|
UI_icon_draw_preview_aspect_size(x, y, icon, 1.0f, size);
|
2011-01-07 04:10:37 +00:00
|
|
|
}
|
2010-01-03 08:37:18 +00:00
|
|
|
}
|
|
|
|
|
2009-04-07 17:08:26 +00:00
|
|
|
|
2011-11-14 14:42:47 +00:00
|
|
|
static int ui_but_draw_menu_icon(uiBut *but)
|
|
|
|
{
|
|
|
|
return (but->flag & UI_ICON_SUBMENU) && (but->dt == UI_EMBOSSP);
|
|
|
|
}
|
|
|
|
|
2009-04-07 17:08:26 +00:00
|
|
|
/* icons have been standardized... and this call draws in untransformed coordinates */
|
|
|
|
|
Sorry, three commits in one, became difficult to untangle..
Editors Modules
* render/ module added in editors, moved the preview render code there and
also shading related operators.
* physics/ module made more consistent with other modules. renaming files,
making a single physics_ops.c for operators and keymaps. Also move all
particle related operators here now.
* space_buttons/ now should have only operators relevant to the buttons
specificially.
Updates & Notifiers
* Material/Texture/World/Lamp can now be passed to DAG_id_flush_update,
which will go back to a callback in editors. Eventually these should
be in the depsgraph itself, but for now this gives a unified call for
doing updates.
* GLSL materials are now refreshed on changes. There's still various
cases missing,
* Preview icons now hook into this system, solving various update cases
that were missed before.
* Also fixes issue in my last commit, where some preview would not render,
problem is avoided in the new system.
Icon Rendering
* On systems with support for non-power of two textures, an OpenGL texture
is now used instead of glDrawPixels. This avoids problems with icons get
clipped on region borders. On my Linux desktop, this gives an 1.1x speedup,
and on my Mac laptop a 2.3x speedup overall in redrawing the full window,
with the default setup. The glDrawPixels implementation on Mac seems to
have a lot of overhread.
* Preview icons are now drawn using proper premul alpha, and never faded so
you can see them clearly.
* Also tried to fix issue with texture node preview rendering, globals can't
be used with threads reliably.
2009-09-29 19:12:12 +00:00
|
|
|
static void widget_draw_icon(uiBut *but, BIFIconID icon, float alpha, rcti *rect)
|
2009-04-07 17:08:26 +00:00
|
|
|
{
|
2009-06-04 15:19:48 +00:00
|
|
|
int xs=0, ys=0;
|
|
|
|
float aspect, height;
|
2009-04-07 17:08:26 +00:00
|
|
|
|
2010-01-03 08:37:18 +00:00
|
|
|
if (but->flag & UI_ICON_PREVIEW) {
|
2011-01-20 16:29:43 +00:00
|
|
|
widget_draw_preview(icon, alpha, rect);
|
2010-01-03 08:37:18 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-04-07 17:08:26 +00:00
|
|
|
/* this icon doesn't need draw... */
|
2009-04-30 17:27:30 +00:00
|
|
|
if(icon==ICON_BLANK1 && (but->flag & UI_ICON_SUBMENU)==0) return;
|
2009-04-07 17:08:26 +00:00
|
|
|
|
|
|
|
/* we need aspect from block, for menus... these buttons are scaled in uiPositionBlock() */
|
|
|
|
aspect= but->block->aspect;
|
|
|
|
if(aspect != but->aspect) {
|
|
|
|
/* prevent scaling up icon in pupmenu */
|
|
|
|
if (aspect < 1.0f) {
|
2011-08-05 10:45:32 +00:00
|
|
|
height= UI_DPI_ICON_SIZE;
|
2009-04-07 17:08:26 +00:00
|
|
|
aspect = 1.0f;
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
2011-08-05 10:45:32 +00:00
|
|
|
height= UI_DPI_ICON_SIZE/aspect;
|
2009-04-07 17:08:26 +00:00
|
|
|
}
|
|
|
|
else
|
2011-08-05 10:45:32 +00:00
|
|
|
height= UI_DPI_ICON_SIZE;
|
2009-04-07 17:08:26 +00:00
|
|
|
|
2009-04-30 17:27:30 +00:00
|
|
|
/* calculate blend color */
|
2009-07-21 01:26:17 +00:00
|
|
|
if ELEM4(but->type, TOG, ROW, TOGN, LISTROW) {
|
2009-04-30 17:27:30 +00:00
|
|
|
if(but->flag & UI_SELECT);
|
|
|
|
else if(but->flag & UI_ACTIVE);
|
Sorry, three commits in one, became difficult to untangle..
Editors Modules
* render/ module added in editors, moved the preview render code there and
also shading related operators.
* physics/ module made more consistent with other modules. renaming files,
making a single physics_ops.c for operators and keymaps. Also move all
particle related operators here now.
* space_buttons/ now should have only operators relevant to the buttons
specificially.
Updates & Notifiers
* Material/Texture/World/Lamp can now be passed to DAG_id_flush_update,
which will go back to a callback in editors. Eventually these should
be in the depsgraph itself, but for now this gives a unified call for
doing updates.
* GLSL materials are now refreshed on changes. There's still various
cases missing,
* Preview icons now hook into this system, solving various update cases
that were missed before.
* Also fixes issue in my last commit, where some preview would not render,
problem is avoided in the new system.
Icon Rendering
* On systems with support for non-power of two textures, an OpenGL texture
is now used instead of glDrawPixels. This avoids problems with icons get
clipped on region borders. On my Linux desktop, this gives an 1.1x speedup,
and on my Mac laptop a 2.3x speedup overall in redrawing the full window,
with the default setup. The glDrawPixels implementation on Mac seems to
have a lot of overhread.
* Preview icons are now drawn using proper premul alpha, and never faded so
you can see them clearly.
* Also tried to fix issue with texture node preview rendering, globals can't
be used with threads reliably.
2009-09-29 19:12:12 +00:00
|
|
|
else alpha= 0.5f;
|
2009-04-30 17:27:30 +00:00
|
|
|
}
|
|
|
|
|
Drag and drop 2.5 integration! Finally, slashdot regulars can use
Blender too now! :)
** Drag works as follows:
- drag-able items are defined by the standard interface ui toolkit
- each button can get this feature, via uiButSetDragXXX(but, ...).
There are calls to define drag-able images, ID blocks, RNA paths,
file paths, and so on. By default you drag an icon, exceptionally
an ImBuf
- Drag items are registered centrally in the WM, it allows more drag
items simultaneous too, but not implemented
** Drop works as follows:
- On mouse release, and if drag items exist in the WM, it converts
the mouse event to an EVT_DROP type. This event then gets the full
drag info as customdata
- drop regions are defined with WM_dropbox_add(), similar to keymaps
you can make a "drop map" this way, which become 'drop map handlers'
in the queues.
- next to that the UI kit handles some common button types (like
accepting ID or names) to be catching a drop event too.
- Every "drop box" has two callbacks:
- poll() = check if the event drag data is relevant for this box
- copy() = fill in custom properties in the dropbox to initialize
an operator
- The dropbox handler then calls its standard Operator with its
dropbox properties.
** Currently implemented
Drag items:
- ID icons in browse buttons
- ID icons in context menu of properties region
- ID icons in outliner and rna viewer
- FileBrowser icons
- FileBrowser preview images
Drag-able icons are subtly visualized by making them brighter a bit
on mouse-over. In case the icon is a button or UI element too (most
cases), the drag-able feature will make the item react to
mouse-release instead of mouse-press.
Drop options:
- UI buttons: ID and text buttons (paste name)
- View3d: Object ID drop copies object
- View3d: Material ID drop assigns to object under cursor
- View3d: Image ID drop assigns to object UV texture under cursor
- Sequencer: Path drop will add either Image or Movie strip
- Image window: Path drop will open image
** Drag and drop Notes:
- Dropping into another Blender window (from same application) works
too. I've added code that passes on mousemoves and clicks to other
windows, without activating them though. This does make using multi-window
Blender a bit friendler.
- Dropping a file path to an image, is not the same as dropping an
Image ID... keep this in mind. Sequencer for example wants paths to
be dropped, textures in 3d window wants an Image ID.
- Although drop boxes could be defined via Python, I suggest they're
part of the UI and editor design (= how we want an editor to work), and
not default offered configurable like keymaps.
- At the moment only one item can be dragged at a time. This is for
several reasons.... For one, Blender doesn't have a well defined
uniform way to define "what is selected" (files, outliner items, etc).
Secondly there's potential conflicts on what todo when you drop mixed
drag sets on spots. All undefined stuff... nice for later.
- Example to bypass the above: a collection of images that form a strip,
should be represented in filewindow as a single sequence anyway.
This then will fit well and gets handled neatly by design.
- Another option to check is to allow multiple options per drop... it
could show the operator as a sort of menu, allowing arrow or scrollwheel
to choose. For time being I'd prefer to try to design a singular drop
though, just offer only one drop action per data type on given spots.
- What does work already, but a tad slow, is to use a function that
detects an object (type) under cursor, so a drag item's option can be
further refined (like drop object on object = parent). (disabled)
** More notes
- Added saving for Region layouts (like split points for toolbar)
- Label buttons now handle mouse over
- File list: added full path entry for drop feature.
- Filesel bugfix: wm_operator_exec() got called there and fully handled,
while WM event code tried same. Added new OPERATOR_HANDLED flag for this.
Maybe python needs it too?
- Cocoa: added window move event, so multi-win setups work OK (didnt save).
- Interface_handlers.c: removed win->active
- Severe area copy bug: area handlers were not set to NULL
- Filesel bugfix: next/prev folder list was not copied on area copies
** Leftover todos
- Cocoa windows seem to hang on cases still... needs check
- Cocoa 'draw overlap' swap doesn't work
- Cocoa window loses focus permanently on using Spotlight
(for these reasons, makefile building has Carbon as default atm)
- ListView templates in UI cannot become dragged yet, needs review...
it consists of two overlapping UI elements, preventing handling icon clicks.
- There's already Ghost library code to handle dropping from OS
into Blender window. I've noticed this code is unfinished for Macs, but
seems to be complete for Windows. Needs test... currently, an external
drop event will print in console when succesfully delivered to Blender's WM.
2010-01-26 18:18:21 +00:00
|
|
|
/* extra feature allows more alpha blending */
|
|
|
|
if(but->type==LABEL && but->a1==1.0f) alpha *= but->a2;
|
|
|
|
|
2009-04-30 17:27:30 +00:00
|
|
|
glEnable(GL_BLEND);
|
|
|
|
|
|
|
|
if(icon && icon!=ICON_BLANK1) {
|
|
|
|
if(but->flag & UI_ICON_LEFT) {
|
|
|
|
if (but->type==BUT_TOGDUAL) {
|
|
|
|
if (but->drawstr[0]) {
|
2009-06-04 15:19:48 +00:00
|
|
|
xs= rect->xmin-1;
|
2009-04-30 17:27:30 +00:00
|
|
|
} else {
|
2009-06-04 15:19:48 +00:00
|
|
|
xs= (rect->xmin+rect->xmax- height)/2;
|
2009-04-30 17:27:30 +00:00
|
|
|
}
|
2009-04-07 17:08:26 +00:00
|
|
|
}
|
2009-04-30 17:27:30 +00:00
|
|
|
else if (but->block->flag & UI_BLOCK_LOOP) {
|
2009-06-05 16:11:18 +00:00
|
|
|
if(but->type==SEARCH_MENU)
|
|
|
|
xs= rect->xmin+4;
|
|
|
|
else
|
|
|
|
xs= rect->xmin+1;
|
2009-04-30 17:27:30 +00:00
|
|
|
}
|
|
|
|
else if ((but->type==ICONROW) || (but->type==ICONTEXTROW)) {
|
2009-06-04 15:19:48 +00:00
|
|
|
xs= rect->xmin+3;
|
2009-04-30 17:27:30 +00:00
|
|
|
}
|
|
|
|
else {
|
2009-06-04 15:19:48 +00:00
|
|
|
xs= rect->xmin+4;
|
2009-04-30 17:27:30 +00:00
|
|
|
}
|
2009-06-04 15:19:48 +00:00
|
|
|
ys= (rect->ymin+rect->ymax- height)/2;
|
2009-04-07 17:08:26 +00:00
|
|
|
}
|
|
|
|
else {
|
2009-06-04 15:19:48 +00:00
|
|
|
xs= (rect->xmin+rect->xmax- height)/2;
|
|
|
|
ys= (rect->ymin+rect->ymax- height)/2;
|
2009-04-07 17:08:26 +00:00
|
|
|
}
|
Drag and drop 2.5 integration! Finally, slashdot regulars can use
Blender too now! :)
** Drag works as follows:
- drag-able items are defined by the standard interface ui toolkit
- each button can get this feature, via uiButSetDragXXX(but, ...).
There are calls to define drag-able images, ID blocks, RNA paths,
file paths, and so on. By default you drag an icon, exceptionally
an ImBuf
- Drag items are registered centrally in the WM, it allows more drag
items simultaneous too, but not implemented
** Drop works as follows:
- On mouse release, and if drag items exist in the WM, it converts
the mouse event to an EVT_DROP type. This event then gets the full
drag info as customdata
- drop regions are defined with WM_dropbox_add(), similar to keymaps
you can make a "drop map" this way, which become 'drop map handlers'
in the queues.
- next to that the UI kit handles some common button types (like
accepting ID or names) to be catching a drop event too.
- Every "drop box" has two callbacks:
- poll() = check if the event drag data is relevant for this box
- copy() = fill in custom properties in the dropbox to initialize
an operator
- The dropbox handler then calls its standard Operator with its
dropbox properties.
** Currently implemented
Drag items:
- ID icons in browse buttons
- ID icons in context menu of properties region
- ID icons in outliner and rna viewer
- FileBrowser icons
- FileBrowser preview images
Drag-able icons are subtly visualized by making them brighter a bit
on mouse-over. In case the icon is a button or UI element too (most
cases), the drag-able feature will make the item react to
mouse-release instead of mouse-press.
Drop options:
- UI buttons: ID and text buttons (paste name)
- View3d: Object ID drop copies object
- View3d: Material ID drop assigns to object under cursor
- View3d: Image ID drop assigns to object UV texture under cursor
- Sequencer: Path drop will add either Image or Movie strip
- Image window: Path drop will open image
** Drag and drop Notes:
- Dropping into another Blender window (from same application) works
too. I've added code that passes on mousemoves and clicks to other
windows, without activating them though. This does make using multi-window
Blender a bit friendler.
- Dropping a file path to an image, is not the same as dropping an
Image ID... keep this in mind. Sequencer for example wants paths to
be dropped, textures in 3d window wants an Image ID.
- Although drop boxes could be defined via Python, I suggest they're
part of the UI and editor design (= how we want an editor to work), and
not default offered configurable like keymaps.
- At the moment only one item can be dragged at a time. This is for
several reasons.... For one, Blender doesn't have a well defined
uniform way to define "what is selected" (files, outliner items, etc).
Secondly there's potential conflicts on what todo when you drop mixed
drag sets on spots. All undefined stuff... nice for later.
- Example to bypass the above: a collection of images that form a strip,
should be represented in filewindow as a single sequence anyway.
This then will fit well and gets handled neatly by design.
- Another option to check is to allow multiple options per drop... it
could show the operator as a sort of menu, allowing arrow or scrollwheel
to choose. For time being I'd prefer to try to design a singular drop
though, just offer only one drop action per data type on given spots.
- What does work already, but a tad slow, is to use a function that
detects an object (type) under cursor, so a drag item's option can be
further refined (like drop object on object = parent). (disabled)
** More notes
- Added saving for Region layouts (like split points for toolbar)
- Label buttons now handle mouse over
- File list: added full path entry for drop feature.
- Filesel bugfix: wm_operator_exec() got called there and fully handled,
while WM event code tried same. Added new OPERATOR_HANDLED flag for this.
Maybe python needs it too?
- Cocoa: added window move event, so multi-win setups work OK (didnt save).
- Interface_handlers.c: removed win->active
- Severe area copy bug: area handlers were not set to NULL
- Filesel bugfix: next/prev folder list was not copied on area copies
** Leftover todos
- Cocoa windows seem to hang on cases still... needs check
- Cocoa 'draw overlap' swap doesn't work
- Cocoa window loses focus permanently on using Spotlight
(for these reasons, makefile building has Carbon as default atm)
- ListView templates in UI cannot become dragged yet, needs review...
it consists of two overlapping UI elements, preventing handling icon clicks.
- There's already Ghost library code to handle dropping from OS
into Blender window. I've noticed this code is unfinished for Macs, but
seems to be complete for Windows. Needs test... currently, an external
drop event will print in console when succesfully delivered to Blender's WM.
2010-01-26 18:18:21 +00:00
|
|
|
|
|
|
|
/* to indicate draggable */
|
|
|
|
if(but->dragpoin && (but->flag & UI_ACTIVE)) {
|
|
|
|
float rgb[3]= {1.25f, 1.25f, 1.25f};
|
|
|
|
UI_icon_draw_aspect_color(xs, ys, icon, aspect, rgb);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
UI_icon_draw_aspect(xs, ys, icon, aspect, alpha);
|
2009-04-07 17:08:26 +00:00
|
|
|
}
|
2011-11-14 14:42:47 +00:00
|
|
|
|
|
|
|
if (ui_but_draw_menu_icon(but)) {
|
2009-06-04 15:19:48 +00:00
|
|
|
xs= rect->xmax-17;
|
|
|
|
ys= (rect->ymin+rect->ymax- height)/2;
|
2009-04-30 17:27:30 +00:00
|
|
|
|
Sorry, three commits in one, became difficult to untangle..
Editors Modules
* render/ module added in editors, moved the preview render code there and
also shading related operators.
* physics/ module made more consistent with other modules. renaming files,
making a single physics_ops.c for operators and keymaps. Also move all
particle related operators here now.
* space_buttons/ now should have only operators relevant to the buttons
specificially.
Updates & Notifiers
* Material/Texture/World/Lamp can now be passed to DAG_id_flush_update,
which will go back to a callback in editors. Eventually these should
be in the depsgraph itself, but for now this gives a unified call for
doing updates.
* GLSL materials are now refreshed on changes. There's still various
cases missing,
* Preview icons now hook into this system, solving various update cases
that were missed before.
* Also fixes issue in my last commit, where some preview would not render,
problem is avoided in the new system.
Icon Rendering
* On systems with support for non-power of two textures, an OpenGL texture
is now used instead of glDrawPixels. This avoids problems with icons get
clipped on region borders. On my Linux desktop, this gives an 1.1x speedup,
and on my Mac laptop a 2.3x speedup overall in redrawing the full window,
with the default setup. The glDrawPixels implementation on Mac seems to
have a lot of overhread.
* Preview icons are now drawn using proper premul alpha, and never faded so
you can see them clearly.
* Also tried to fix issue with texture node preview rendering, globals can't
be used with threads reliably.
2009-09-29 19:12:12 +00:00
|
|
|
UI_icon_draw_aspect(xs, ys, ICON_RIGHTARROW_THIN, aspect, alpha);
|
2009-04-07 17:08:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
glDisable(GL_BLEND);
|
|
|
|
}
|
|
|
|
|
2012-03-22 09:20:22 +00:00
|
|
|
static void ui_text_clip_give_prev_off(uiBut *but)
|
|
|
|
{
|
|
|
|
char *prev_utf8 = BLI_str_find_prev_char_utf8(but->drawstr, but->drawstr + but->ofs);
|
|
|
|
int bytes = but->drawstr + but->ofs - prev_utf8;
|
|
|
|
|
|
|
|
but->ofs -= bytes;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void ui_text_clip_give_next_off(uiBut *but)
|
|
|
|
{
|
|
|
|
char *next_utf8 = BLI_str_find_next_char_utf8(but->drawstr + but->ofs, NULL);
|
|
|
|
int bytes = next_utf8 - (but->drawstr + but->ofs);
|
|
|
|
|
|
|
|
but->ofs += bytes;
|
|
|
|
}
|
|
|
|
|
2009-04-10 14:06:24 +00:00
|
|
|
/* sets but->ofs to make sure text is correctly visible */
|
|
|
|
static void ui_text_leftclip(uiFontStyle *fstyle, uiBut *but, rcti *rect)
|
|
|
|
{
|
2009-09-21 21:26:04 +00:00
|
|
|
int border= (but->flag & UI_BUT_ALIGN_RIGHT)? 8: 10;
|
|
|
|
int okwidth= rect->xmax-rect->xmin - border;
|
2009-04-10 14:06:24 +00:00
|
|
|
|
2011-08-05 10:45:32 +00:00
|
|
|
if (but->flag & UI_HAS_ICON) okwidth -= UI_DPI_ICON_SIZE;
|
2010-01-14 09:56:41 +00:00
|
|
|
|
2009-04-10 14:06:24 +00:00
|
|
|
/* need to set this first */
|
|
|
|
uiStyleFontSet(fstyle);
|
2010-04-02 11:15:37 +00:00
|
|
|
|
|
|
|
if (fstyle->kerning==1) /* for BLF_width */
|
BugFix:
[#20854] PROPERTIES STAMP: Rendering stamp flickers in output renders
Blenfont was not thread safe, that is why one thread can change
the font properties (size, dpi, color, etc) at the same time
that the stamp draw on the image, and then the problem.
To make blenfont thread safe I have to change two important things:
1) Every BLF_* function take one argument, the font id.
2) We have two new function to make font "thread safe":
BLF_load_unique
BLF_load_mem_unique
This two function are for case like stamp, that need and own font
that don't share the glyph cache, so can draw without problem
in a different thread.
Why the BLF_*_unique function ?
Because blenfont keep only one copy of a font and keep a list of
"glyph cache". Every glyph cache have size and dpi, so if two
different thread access the same font at the same time, they can
change value and finish with something like the stamp problem.
Why don't remove the glyph cache ?
Because if we do that, we finish with a font object for every size
and dpi, and the stamp is really a special case that happen in
the rendering process, so I really thing is better keep the
glyph cache and make this two new function to handle this
special case.
(When I say "font object" I mean have the same freetype font multiple
times just to have differents size and dpi)
As Matt point we still can have one case that two thread access
the BLF_*_unique function at the same time, but I am looking to
fix this with some class of thread lock.
For now I test and work fine, so if some one found problem, please
let me know.
Campbell I have to change the python api (python/generic/blf_api.c)
to the new syntax, so maybe you can take a look at this.
2010-04-22 10:56:45 +00:00
|
|
|
BLF_enable(fstyle->uifont_id, BLF_KERNING_DEFAULT);
|
2009-04-07 17:08:26 +00:00
|
|
|
|
2011-01-20 18:34:48 +00:00
|
|
|
/* if text editing we define ofs dynamically */
|
|
|
|
if(but->editstr && but->pos >= 0) {
|
|
|
|
if(but->ofs > but->pos)
|
|
|
|
but->ofs= but->pos;
|
2012-01-26 12:48:36 +00:00
|
|
|
|
|
|
|
if(BLF_width(fstyle->uifont_id, but->drawstr) <= okwidth)
|
|
|
|
but->ofs = 0;
|
2011-01-20 18:34:48 +00:00
|
|
|
}
|
|
|
|
else but->ofs= 0;
|
2009-04-10 14:06:24 +00:00
|
|
|
|
2011-01-20 18:34:48 +00:00
|
|
|
but->strwidth= BLF_width(fstyle->uifont_id, but->drawstr + but->ofs);
|
|
|
|
|
|
|
|
while(but->strwidth > okwidth) {
|
2009-04-10 14:06:24 +00:00
|
|
|
|
2011-01-20 18:34:48 +00:00
|
|
|
/* textbut exception, clip right when... */
|
|
|
|
if(but->editstr && but->pos >= 0) {
|
|
|
|
float width;
|
2011-05-12 16:49:53 +00:00
|
|
|
char buf[UI_MAX_DRAW_STR];
|
2009-04-10 14:06:24 +00:00
|
|
|
|
2011-01-20 18:34:48 +00:00
|
|
|
/* copy draw string */
|
2012-03-22 09:20:22 +00:00
|
|
|
BLI_strncpy_utf8(buf, but->drawstr, sizeof(buf));
|
2011-01-20 18:34:48 +00:00
|
|
|
/* string position of cursor */
|
|
|
|
buf[but->pos]= 0;
|
|
|
|
width= BLF_width(fstyle->uifont_id, buf+but->ofs);
|
|
|
|
|
|
|
|
/* if cursor is at 20 pixels of right side button we clip left */
|
|
|
|
if(width > okwidth-20)
|
2012-03-22 09:20:22 +00:00
|
|
|
ui_text_clip_give_next_off(but);
|
2011-01-20 18:34:48 +00:00
|
|
|
else {
|
2012-03-22 09:20:22 +00:00
|
|
|
int len, bytes;
|
2011-01-20 18:34:48 +00:00
|
|
|
/* shift string to the left */
|
|
|
|
if(width < 20 && but->ofs > 0)
|
2012-03-22 09:20:22 +00:00
|
|
|
ui_text_clip_give_prev_off(but);
|
|
|
|
len= strlen(but->drawstr);
|
|
|
|
bytes= BLI_str_utf8_size(BLI_str_find_prev_char_utf8(but->drawstr, but->drawstr + len));
|
|
|
|
but->drawstr[ len-bytes ]= 0;
|
2009-04-10 14:06:24 +00:00
|
|
|
}
|
|
|
|
}
|
2011-01-20 18:34:48 +00:00
|
|
|
else
|
2012-03-22 09:20:22 +00:00
|
|
|
ui_text_clip_give_next_off(but);
|
2011-01-20 18:34:48 +00:00
|
|
|
|
|
|
|
but->strwidth= BLF_width(fstyle->uifont_id, but->drawstr+but->ofs);
|
2009-04-10 14:06:24 +00:00
|
|
|
|
|
|
|
if(but->strwidth < 10) break;
|
|
|
|
}
|
2010-04-02 11:15:37 +00:00
|
|
|
|
|
|
|
if (fstyle->kerning==1)
|
BugFix:
[#20854] PROPERTIES STAMP: Rendering stamp flickers in output renders
Blenfont was not thread safe, that is why one thread can change
the font properties (size, dpi, color, etc) at the same time
that the stamp draw on the image, and then the problem.
To make blenfont thread safe I have to change two important things:
1) Every BLF_* function take one argument, the font id.
2) We have two new function to make font "thread safe":
BLF_load_unique
BLF_load_mem_unique
This two function are for case like stamp, that need and own font
that don't share the glyph cache, so can draw without problem
in a different thread.
Why the BLF_*_unique function ?
Because blenfont keep only one copy of a font and keep a list of
"glyph cache". Every glyph cache have size and dpi, so if two
different thread access the same font at the same time, they can
change value and finish with something like the stamp problem.
Why don't remove the glyph cache ?
Because if we do that, we finish with a font object for every size
and dpi, and the stamp is really a special case that happen in
the rendering process, so I really thing is better keep the
glyph cache and make this two new function to handle this
special case.
(When I say "font object" I mean have the same freetype font multiple
times just to have differents size and dpi)
As Matt point we still can have one case that two thread access
the BLF_*_unique function at the same time, but I am looking to
fix this with some class of thread lock.
For now I test and work fine, so if some one found problem, please
let me know.
Campbell I have to change the python api (python/generic/blf_api.c)
to the new syntax, so maybe you can take a look at this.
2010-04-22 10:56:45 +00:00
|
|
|
BLF_disable(fstyle->uifont_id, BLF_KERNING_DEFAULT);
|
2009-04-10 14:06:24 +00:00
|
|
|
}
|
2009-04-07 17:08:26 +00:00
|
|
|
|
2009-11-11 10:27:25 +00:00
|
|
|
static void ui_text_label_rightclip(uiFontStyle *fstyle, uiBut *but, rcti *rect)
|
|
|
|
{
|
|
|
|
int border= (but->flag & UI_BUT_ALIGN_RIGHT)? 8: 10;
|
|
|
|
int okwidth= rect->xmax-rect->xmin - border;
|
|
|
|
char *cpoin=NULL;
|
2009-11-12 00:48:44 +00:00
|
|
|
char *cpend = but->drawstr + strlen(but->drawstr);
|
2009-11-11 10:27:25 +00:00
|
|
|
|
|
|
|
/* need to set this first */
|
|
|
|
uiStyleFontSet(fstyle);
|
|
|
|
|
2010-04-02 11:15:37 +00:00
|
|
|
if (fstyle->kerning==1) /* for BLF_width */
|
BugFix:
[#20854] PROPERTIES STAMP: Rendering stamp flickers in output renders
Blenfont was not thread safe, that is why one thread can change
the font properties (size, dpi, color, etc) at the same time
that the stamp draw on the image, and then the problem.
To make blenfont thread safe I have to change two important things:
1) Every BLF_* function take one argument, the font id.
2) We have two new function to make font "thread safe":
BLF_load_unique
BLF_load_mem_unique
This two function are for case like stamp, that need and own font
that don't share the glyph cache, so can draw without problem
in a different thread.
Why the BLF_*_unique function ?
Because blenfont keep only one copy of a font and keep a list of
"glyph cache". Every glyph cache have size and dpi, so if two
different thread access the same font at the same time, they can
change value and finish with something like the stamp problem.
Why don't remove the glyph cache ?
Because if we do that, we finish with a font object for every size
and dpi, and the stamp is really a special case that happen in
the rendering process, so I really thing is better keep the
glyph cache and make this two new function to handle this
special case.
(When I say "font object" I mean have the same freetype font multiple
times just to have differents size and dpi)
As Matt point we still can have one case that two thread access
the BLF_*_unique function at the same time, but I am looking to
fix this with some class of thread lock.
For now I test and work fine, so if some one found problem, please
let me know.
Campbell I have to change the python api (python/generic/blf_api.c)
to the new syntax, so maybe you can take a look at this.
2010-04-22 10:56:45 +00:00
|
|
|
BLF_enable(fstyle->uifont_id, BLF_KERNING_DEFAULT);
|
2010-04-02 11:15:37 +00:00
|
|
|
|
BugFix:
[#20854] PROPERTIES STAMP: Rendering stamp flickers in output renders
Blenfont was not thread safe, that is why one thread can change
the font properties (size, dpi, color, etc) at the same time
that the stamp draw on the image, and then the problem.
To make blenfont thread safe I have to change two important things:
1) Every BLF_* function take one argument, the font id.
2) We have two new function to make font "thread safe":
BLF_load_unique
BLF_load_mem_unique
This two function are for case like stamp, that need and own font
that don't share the glyph cache, so can draw without problem
in a different thread.
Why the BLF_*_unique function ?
Because blenfont keep only one copy of a font and keep a list of
"glyph cache". Every glyph cache have size and dpi, so if two
different thread access the same font at the same time, they can
change value and finish with something like the stamp problem.
Why don't remove the glyph cache ?
Because if we do that, we finish with a font object for every size
and dpi, and the stamp is really a special case that happen in
the rendering process, so I really thing is better keep the
glyph cache and make this two new function to handle this
special case.
(When I say "font object" I mean have the same freetype font multiple
times just to have differents size and dpi)
As Matt point we still can have one case that two thread access
the BLF_*_unique function at the same time, but I am looking to
fix this with some class of thread lock.
For now I test and work fine, so if some one found problem, please
let me know.
Campbell I have to change the python api (python/generic/blf_api.c)
to the new syntax, so maybe you can take a look at this.
2010-04-22 10:56:45 +00:00
|
|
|
but->strwidth= BLF_width(fstyle->uifont_id, but->drawstr);
|
2009-11-11 10:27:25 +00:00
|
|
|
but->ofs= 0;
|
|
|
|
|
|
|
|
/* find the space after ':' separator */
|
2009-11-12 00:48:44 +00:00
|
|
|
cpoin= strrchr(but->drawstr, ':');
|
2009-11-11 10:27:25 +00:00
|
|
|
|
2009-11-12 00:48:44 +00:00
|
|
|
if (cpoin && (cpoin < cpend-2)) {
|
|
|
|
char *cp2 = cpoin;
|
|
|
|
|
|
|
|
/* chop off the leading text, starting from the right */
|
|
|
|
while (but->strwidth > okwidth && cp2 > but->drawstr) {
|
2012-03-22 09:20:22 +00:00
|
|
|
int bytes = BLI_str_utf8_size(cp2);
|
|
|
|
if (bytes < 0)
|
|
|
|
bytes = 1;
|
|
|
|
|
2009-11-12 00:48:44 +00:00
|
|
|
/* shift the text after and including cp2 back by 1 char, +1 to include null terminator */
|
2012-03-22 09:20:22 +00:00
|
|
|
memmove(cp2-bytes, cp2, strlen(cp2)+1);
|
|
|
|
cp2-=bytes;
|
2009-11-12 00:48:44 +00:00
|
|
|
|
BugFix:
[#20854] PROPERTIES STAMP: Rendering stamp flickers in output renders
Blenfont was not thread safe, that is why one thread can change
the font properties (size, dpi, color, etc) at the same time
that the stamp draw on the image, and then the problem.
To make blenfont thread safe I have to change two important things:
1) Every BLF_* function take one argument, the font id.
2) We have two new function to make font "thread safe":
BLF_load_unique
BLF_load_mem_unique
This two function are for case like stamp, that need and own font
that don't share the glyph cache, so can draw without problem
in a different thread.
Why the BLF_*_unique function ?
Because blenfont keep only one copy of a font and keep a list of
"glyph cache". Every glyph cache have size and dpi, so if two
different thread access the same font at the same time, they can
change value and finish with something like the stamp problem.
Why don't remove the glyph cache ?
Because if we do that, we finish with a font object for every size
and dpi, and the stamp is really a special case that happen in
the rendering process, so I really thing is better keep the
glyph cache and make this two new function to handle this
special case.
(When I say "font object" I mean have the same freetype font multiple
times just to have differents size and dpi)
As Matt point we still can have one case that two thread access
the BLF_*_unique function at the same time, but I am looking to
fix this with some class of thread lock.
For now I test and work fine, so if some one found problem, please
let me know.
Campbell I have to change the python api (python/generic/blf_api.c)
to the new syntax, so maybe you can take a look at this.
2010-04-22 10:56:45 +00:00
|
|
|
but->strwidth= BLF_width(fstyle->uifont_id, but->drawstr+but->ofs);
|
2009-11-12 00:48:44 +00:00
|
|
|
if(but->strwidth < 10) break;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* after the leading text is gone, chop off the : and following space, with ofs */
|
|
|
|
while ((but->strwidth > okwidth) && (but->ofs < 2))
|
2009-11-11 10:27:25 +00:00
|
|
|
{
|
2012-03-22 09:20:22 +00:00
|
|
|
ui_text_clip_give_next_off(but);
|
BugFix:
[#20854] PROPERTIES STAMP: Rendering stamp flickers in output renders
Blenfont was not thread safe, that is why one thread can change
the font properties (size, dpi, color, etc) at the same time
that the stamp draw on the image, and then the problem.
To make blenfont thread safe I have to change two important things:
1) Every BLF_* function take one argument, the font id.
2) We have two new function to make font "thread safe":
BLF_load_unique
BLF_load_mem_unique
This two function are for case like stamp, that need and own font
that don't share the glyph cache, so can draw without problem
in a different thread.
Why the BLF_*_unique function ?
Because blenfont keep only one copy of a font and keep a list of
"glyph cache". Every glyph cache have size and dpi, so if two
different thread access the same font at the same time, they can
change value and finish with something like the stamp problem.
Why don't remove the glyph cache ?
Because if we do that, we finish with a font object for every size
and dpi, and the stamp is really a special case that happen in
the rendering process, so I really thing is better keep the
glyph cache and make this two new function to handle this
special case.
(When I say "font object" I mean have the same freetype font multiple
times just to have differents size and dpi)
As Matt point we still can have one case that two thread access
the BLF_*_unique function at the same time, but I am looking to
fix this with some class of thread lock.
For now I test and work fine, so if some one found problem, please
let me know.
Campbell I have to change the python api (python/generic/blf_api.c)
to the new syntax, so maybe you can take a look at this.
2010-04-22 10:56:45 +00:00
|
|
|
but->strwidth= BLF_width(fstyle->uifont_id, but->drawstr+but->ofs);
|
2009-11-12 00:48:44 +00:00
|
|
|
if(but->strwidth < 10) break;
|
2009-11-11 10:27:25 +00:00
|
|
|
}
|
2009-11-12 00:48:44 +00:00
|
|
|
|
2009-11-11 10:27:25 +00:00
|
|
|
}
|
2009-11-12 00:48:44 +00:00
|
|
|
|
2009-11-11 10:27:25 +00:00
|
|
|
/* once the label's gone, chop off the least significant digits */
|
|
|
|
while(but->strwidth > okwidth ) {
|
2012-03-22 09:20:22 +00:00
|
|
|
int len= strlen(but->drawstr);
|
|
|
|
int bytes= BLI_str_utf8_size(BLI_str_find_prev_char_utf8(but->drawstr, but->drawstr + len));
|
|
|
|
if (bytes < 0)
|
|
|
|
bytes = 1;
|
|
|
|
|
|
|
|
but->drawstr[ len-bytes ]= 0;
|
2009-11-11 10:27:25 +00:00
|
|
|
|
BugFix:
[#20854] PROPERTIES STAMP: Rendering stamp flickers in output renders
Blenfont was not thread safe, that is why one thread can change
the font properties (size, dpi, color, etc) at the same time
that the stamp draw on the image, and then the problem.
To make blenfont thread safe I have to change two important things:
1) Every BLF_* function take one argument, the font id.
2) We have two new function to make font "thread safe":
BLF_load_unique
BLF_load_mem_unique
This two function are for case like stamp, that need and own font
that don't share the glyph cache, so can draw without problem
in a different thread.
Why the BLF_*_unique function ?
Because blenfont keep only one copy of a font and keep a list of
"glyph cache". Every glyph cache have size and dpi, so if two
different thread access the same font at the same time, they can
change value and finish with something like the stamp problem.
Why don't remove the glyph cache ?
Because if we do that, we finish with a font object for every size
and dpi, and the stamp is really a special case that happen in
the rendering process, so I really thing is better keep the
glyph cache and make this two new function to handle this
special case.
(When I say "font object" I mean have the same freetype font multiple
times just to have differents size and dpi)
As Matt point we still can have one case that two thread access
the BLF_*_unique function at the same time, but I am looking to
fix this with some class of thread lock.
For now I test and work fine, so if some one found problem, please
let me know.
Campbell I have to change the python api (python/generic/blf_api.c)
to the new syntax, so maybe you can take a look at this.
2010-04-22 10:56:45 +00:00
|
|
|
but->strwidth= BLF_width(fstyle->uifont_id, but->drawstr+but->ofs);
|
2009-11-11 10:27:25 +00:00
|
|
|
if(but->strwidth < 10) break;
|
|
|
|
}
|
2009-11-12 00:48:44 +00:00
|
|
|
|
2010-04-02 11:15:37 +00:00
|
|
|
if (fstyle->kerning==1)
|
BugFix:
[#20854] PROPERTIES STAMP: Rendering stamp flickers in output renders
Blenfont was not thread safe, that is why one thread can change
the font properties (size, dpi, color, etc) at the same time
that the stamp draw on the image, and then the problem.
To make blenfont thread safe I have to change two important things:
1) Every BLF_* function take one argument, the font id.
2) We have two new function to make font "thread safe":
BLF_load_unique
BLF_load_mem_unique
This two function are for case like stamp, that need and own font
that don't share the glyph cache, so can draw without problem
in a different thread.
Why the BLF_*_unique function ?
Because blenfont keep only one copy of a font and keep a list of
"glyph cache". Every glyph cache have size and dpi, so if two
different thread access the same font at the same time, they can
change value and finish with something like the stamp problem.
Why don't remove the glyph cache ?
Because if we do that, we finish with a font object for every size
and dpi, and the stamp is really a special case that happen in
the rendering process, so I really thing is better keep the
glyph cache and make this two new function to handle this
special case.
(When I say "font object" I mean have the same freetype font multiple
times just to have differents size and dpi)
As Matt point we still can have one case that two thread access
the BLF_*_unique function at the same time, but I am looking to
fix this with some class of thread lock.
For now I test and work fine, so if some one found problem, please
let me know.
Campbell I have to change the python api (python/generic/blf_api.c)
to the new syntax, so maybe you can take a look at this.
2010-04-22 10:56:45 +00:00
|
|
|
BLF_disable(fstyle->uifont_id, BLF_KERNING_DEFAULT);
|
2009-11-11 10:27:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-05-21 17:09:06 +00:00
|
|
|
static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *but, rcti *rect)
|
2009-03-25 16:58:42 +00:00
|
|
|
{
|
2009-04-09 18:11:18 +00:00
|
|
|
// int transopts;
|
2009-05-03 02:27:36 +00:00
|
|
|
char *cpoin = NULL;
|
2009-03-25 16:58:42 +00:00
|
|
|
|
2010-12-14 02:38:29 +00:00
|
|
|
/* for underline drawing */
|
|
|
|
float font_xofs, font_yofs;
|
|
|
|
|
2009-05-21 17:09:06 +00:00
|
|
|
uiStyleFontSet(fstyle);
|
|
|
|
|
|
|
|
if(but->editstr || (but->flag & UI_TEXT_LEFT))
|
|
|
|
fstyle->align= UI_STYLE_TEXT_LEFT;
|
|
|
|
else
|
|
|
|
fstyle->align= UI_STYLE_TEXT_CENTER;
|
2010-04-02 11:15:37 +00:00
|
|
|
|
|
|
|
if (fstyle->kerning==1) /* for BLF_width */
|
BugFix:
[#20854] PROPERTIES STAMP: Rendering stamp flickers in output renders
Blenfont was not thread safe, that is why one thread can change
the font properties (size, dpi, color, etc) at the same time
that the stamp draw on the image, and then the problem.
To make blenfont thread safe I have to change two important things:
1) Every BLF_* function take one argument, the font id.
2) We have two new function to make font "thread safe":
BLF_load_unique
BLF_load_mem_unique
This two function are for case like stamp, that need and own font
that don't share the glyph cache, so can draw without problem
in a different thread.
Why the BLF_*_unique function ?
Because blenfont keep only one copy of a font and keep a list of
"glyph cache". Every glyph cache have size and dpi, so if two
different thread access the same font at the same time, they can
change value and finish with something like the stamp problem.
Why don't remove the glyph cache ?
Because if we do that, we finish with a font object for every size
and dpi, and the stamp is really a special case that happen in
the rendering process, so I really thing is better keep the
glyph cache and make this two new function to handle this
special case.
(When I say "font object" I mean have the same freetype font multiple
times just to have differents size and dpi)
As Matt point we still can have one case that two thread access
the BLF_*_unique function at the same time, but I am looking to
fix this with some class of thread lock.
For now I test and work fine, so if some one found problem, please
let me know.
Campbell I have to change the python api (python/generic/blf_api.c)
to the new syntax, so maybe you can take a look at this.
2010-04-22 10:56:45 +00:00
|
|
|
BLF_enable(fstyle->uifont_id, BLF_KERNING_DEFAULT);
|
2010-04-02 11:15:37 +00:00
|
|
|
|
2009-05-21 17:09:06 +00:00
|
|
|
/* text button selection and cursor */
|
|
|
|
if(but->editstr && but->pos != -1) {
|
2009-07-28 18:20:16 +00:00
|
|
|
short t=0, pos=0, ch;
|
2009-05-21 17:09:06 +00:00
|
|
|
short selsta_tmp, selend_tmp, selsta_draw, selwidth_draw;
|
2010-01-12 05:54:15 +00:00
|
|
|
|
2009-05-21 17:09:06 +00:00
|
|
|
if ((but->selend - but->selsta) > 0) {
|
|
|
|
/* text button selection */
|
2009-07-28 17:59:59 +00:00
|
|
|
selsta_tmp = but->selsta;
|
|
|
|
selend_tmp = but->selend;
|
2009-05-21 17:09:06 +00:00
|
|
|
|
|
|
|
if(but->drawstr[0]!=0) {
|
2010-01-12 05:54:15 +00:00
|
|
|
|
|
|
|
if (but->selsta >= but->ofs) {
|
|
|
|
ch= but->drawstr[selsta_tmp];
|
|
|
|
but->drawstr[selsta_tmp]= 0;
|
|
|
|
|
BugFix:
[#20854] PROPERTIES STAMP: Rendering stamp flickers in output renders
Blenfont was not thread safe, that is why one thread can change
the font properties (size, dpi, color, etc) at the same time
that the stamp draw on the image, and then the problem.
To make blenfont thread safe I have to change two important things:
1) Every BLF_* function take one argument, the font id.
2) We have two new function to make font "thread safe":
BLF_load_unique
BLF_load_mem_unique
This two function are for case like stamp, that need and own font
that don't share the glyph cache, so can draw without problem
in a different thread.
Why the BLF_*_unique function ?
Because blenfont keep only one copy of a font and keep a list of
"glyph cache". Every glyph cache have size and dpi, so if two
different thread access the same font at the same time, they can
change value and finish with something like the stamp problem.
Why don't remove the glyph cache ?
Because if we do that, we finish with a font object for every size
and dpi, and the stamp is really a special case that happen in
the rendering process, so I really thing is better keep the
glyph cache and make this two new function to handle this
special case.
(When I say "font object" I mean have the same freetype font multiple
times just to have differents size and dpi)
As Matt point we still can have one case that two thread access
the BLF_*_unique function at the same time, but I am looking to
fix this with some class of thread lock.
For now I test and work fine, so if some one found problem, please
let me know.
Campbell I have to change the python api (python/generic/blf_api.c)
to the new syntax, so maybe you can take a look at this.
2010-04-22 10:56:45 +00:00
|
|
|
selsta_draw = BLF_width(fstyle->uifont_id, but->drawstr+but->ofs);
|
2010-01-12 05:54:15 +00:00
|
|
|
|
|
|
|
but->drawstr[selsta_tmp]= ch;
|
|
|
|
} else
|
|
|
|
selsta_draw = 0;
|
2009-05-21 17:09:06 +00:00
|
|
|
|
|
|
|
ch= but->drawstr[selend_tmp];
|
|
|
|
but->drawstr[selend_tmp]= 0;
|
|
|
|
|
BugFix:
[#20854] PROPERTIES STAMP: Rendering stamp flickers in output renders
Blenfont was not thread safe, that is why one thread can change
the font properties (size, dpi, color, etc) at the same time
that the stamp draw on the image, and then the problem.
To make blenfont thread safe I have to change two important things:
1) Every BLF_* function take one argument, the font id.
2) We have two new function to make font "thread safe":
BLF_load_unique
BLF_load_mem_unique
This two function are for case like stamp, that need and own font
that don't share the glyph cache, so can draw without problem
in a different thread.
Why the BLF_*_unique function ?
Because blenfont keep only one copy of a font and keep a list of
"glyph cache". Every glyph cache have size and dpi, so if two
different thread access the same font at the same time, they can
change value and finish with something like the stamp problem.
Why don't remove the glyph cache ?
Because if we do that, we finish with a font object for every size
and dpi, and the stamp is really a special case that happen in
the rendering process, so I really thing is better keep the
glyph cache and make this two new function to handle this
special case.
(When I say "font object" I mean have the same freetype font multiple
times just to have differents size and dpi)
As Matt point we still can have one case that two thread access
the BLF_*_unique function at the same time, but I am looking to
fix this with some class of thread lock.
For now I test and work fine, so if some one found problem, please
let me know.
Campbell I have to change the python api (python/generic/blf_api.c)
to the new syntax, so maybe you can take a look at this.
2010-04-22 10:56:45 +00:00
|
|
|
selwidth_draw = BLF_width(fstyle->uifont_id, but->drawstr+but->ofs);
|
2009-05-21 17:09:06 +00:00
|
|
|
|
|
|
|
but->drawstr[selend_tmp]= ch;
|
2009-07-28 17:59:59 +00:00
|
|
|
|
2009-07-21 01:26:17 +00:00
|
|
|
glColor3ubv((unsigned char*)wcol->item);
|
2009-09-21 21:26:04 +00:00
|
|
|
glRects(rect->xmin+selsta_draw, rect->ymin+2, rect->xmin+selwidth_draw, rect->ymax-2);
|
2009-05-21 17:09:06 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* text cursor */
|
2009-07-28 17:59:59 +00:00
|
|
|
pos= but->pos;
|
2009-05-21 17:09:06 +00:00
|
|
|
if(pos >= but->ofs) {
|
|
|
|
if(but->drawstr[0]!=0) {
|
|
|
|
ch= but->drawstr[pos];
|
|
|
|
but->drawstr[pos]= 0;
|
|
|
|
|
BugFix:
[#20854] PROPERTIES STAMP: Rendering stamp flickers in output renders
Blenfont was not thread safe, that is why one thread can change
the font properties (size, dpi, color, etc) at the same time
that the stamp draw on the image, and then the problem.
To make blenfont thread safe I have to change two important things:
1) Every BLF_* function take one argument, the font id.
2) We have two new function to make font "thread safe":
BLF_load_unique
BLF_load_mem_unique
This two function are for case like stamp, that need and own font
that don't share the glyph cache, so can draw without problem
in a different thread.
Why the BLF_*_unique function ?
Because blenfont keep only one copy of a font and keep a list of
"glyph cache". Every glyph cache have size and dpi, so if two
different thread access the same font at the same time, they can
change value and finish with something like the stamp problem.
Why don't remove the glyph cache ?
Because if we do that, we finish with a font object for every size
and dpi, and the stamp is really a special case that happen in
the rendering process, so I really thing is better keep the
glyph cache and make this two new function to handle this
special case.
(When I say "font object" I mean have the same freetype font multiple
times just to have differents size and dpi)
As Matt point we still can have one case that two thread access
the BLF_*_unique function at the same time, but I am looking to
fix this with some class of thread lock.
For now I test and work fine, so if some one found problem, please
let me know.
Campbell I have to change the python api (python/generic/blf_api.c)
to the new syntax, so maybe you can take a look at this.
2010-04-22 10:56:45 +00:00
|
|
|
t= BLF_width(fstyle->uifont_id, but->drawstr+but->ofs) / but->aspect;
|
2009-05-21 17:09:06 +00:00
|
|
|
|
|
|
|
but->drawstr[pos]= ch;
|
|
|
|
}
|
2009-07-28 17:59:59 +00:00
|
|
|
|
2010-04-02 11:15:37 +00:00
|
|
|
glColor3f(0.20, 0.6, 0.9);
|
2009-05-21 17:09:06 +00:00
|
|
|
glRects(rect->xmin+t, rect->ymin+2, rect->xmin+t+2, rect->ymax-2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2010-04-02 11:15:37 +00:00
|
|
|
|
|
|
|
if (fstyle->kerning == 1)
|
BugFix:
[#20854] PROPERTIES STAMP: Rendering stamp flickers in output renders
Blenfont was not thread safe, that is why one thread can change
the font properties (size, dpi, color, etc) at the same time
that the stamp draw on the image, and then the problem.
To make blenfont thread safe I have to change two important things:
1) Every BLF_* function take one argument, the font id.
2) We have two new function to make font "thread safe":
BLF_load_unique
BLF_load_mem_unique
This two function are for case like stamp, that need and own font
that don't share the glyph cache, so can draw without problem
in a different thread.
Why the BLF_*_unique function ?
Because blenfont keep only one copy of a font and keep a list of
"glyph cache". Every glyph cache have size and dpi, so if two
different thread access the same font at the same time, they can
change value and finish with something like the stamp problem.
Why don't remove the glyph cache ?
Because if we do that, we finish with a font object for every size
and dpi, and the stamp is really a special case that happen in
the rendering process, so I really thing is better keep the
glyph cache and make this two new function to handle this
special case.
(When I say "font object" I mean have the same freetype font multiple
times just to have differents size and dpi)
As Matt point we still can have one case that two thread access
the BLF_*_unique function at the same time, but I am looking to
fix this with some class of thread lock.
For now I test and work fine, so if some one found problem, please
let me know.
Campbell I have to change the python api (python/generic/blf_api.c)
to the new syntax, so maybe you can take a look at this.
2010-04-22 10:56:45 +00:00
|
|
|
BLF_disable(fstyle->uifont_id, BLF_KERNING_DEFAULT);
|
2010-04-02 11:15:37 +00:00
|
|
|
|
2009-05-21 17:09:06 +00:00
|
|
|
// ui_rasterpos_safe(x, y, but->aspect);
|
2009-04-09 18:11:18 +00:00
|
|
|
// if(but->type==IDPOIN) transopts= 0; // no translation, of course!
|
|
|
|
// else transopts= ui_translate_buttons();
|
2009-03-25 16:58:42 +00:00
|
|
|
|
2009-05-03 02:27:36 +00:00
|
|
|
/* cut string in 2 parts - only for menu entries */
|
2009-08-19 12:35:40 +00:00
|
|
|
if((but->block->flag & UI_BLOCK_LOOP)) {
|
|
|
|
if(ELEM5(but->type, SLI, NUM, TEX, NUMSLI, NUMABS)==0) {
|
|
|
|
cpoin= strchr(but->drawstr, '|');
|
|
|
|
if(cpoin) *cpoin= 0;
|
|
|
|
}
|
2009-05-03 02:27:36 +00:00
|
|
|
}
|
2009-03-25 16:58:42 +00:00
|
|
|
|
2009-07-21 01:26:17 +00:00
|
|
|
glColor3ubv((unsigned char*)wcol->text);
|
2010-12-14 02:38:29 +00:00
|
|
|
|
|
|
|
uiStyleFontDrawExt(fstyle, rect, but->drawstr+but->ofs, &font_xofs, &font_yofs);
|
|
|
|
|
|
|
|
if(but->menu_key != '\0') {
|
|
|
|
char fixedbuf[128];
|
|
|
|
char *str;
|
|
|
|
|
|
|
|
BLI_strncpy(fixedbuf, but->drawstr + but->ofs, sizeof(fixedbuf));
|
|
|
|
|
|
|
|
str= strchr(fixedbuf, but->menu_key-32); /* upper case */
|
|
|
|
if(str==NULL)
|
|
|
|
str= strchr(fixedbuf, but->menu_key);
|
|
|
|
|
|
|
|
if(str) {
|
|
|
|
int ul_index= -1;
|
|
|
|
float ul_advance;
|
|
|
|
|
|
|
|
ul_index= (int)(str - fixedbuf);
|
|
|
|
|
|
|
|
if (fstyle->kerning == 1) {
|
|
|
|
BLF_enable(fstyle->uifont_id, BLF_KERNING_DEFAULT);
|
|
|
|
}
|
|
|
|
|
|
|
|
fixedbuf[ul_index]= '\0';
|
|
|
|
ul_advance= BLF_width(fstyle->uifont_id, fixedbuf);
|
|
|
|
|
|
|
|
BLF_position(fstyle->uifont_id, rect->xmin+font_xofs + ul_advance, rect->ymin+font_yofs, 0.0f);
|
|
|
|
BLF_draw(fstyle->uifont_id, "_", 2);
|
|
|
|
|
|
|
|
if (fstyle->kerning == 1) {
|
|
|
|
BLF_disable(fstyle->uifont_id, BLF_KERNING_DEFAULT);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-04-09 18:11:18 +00:00
|
|
|
|
2009-04-10 14:06:24 +00:00
|
|
|
/* part text right aligned */
|
2009-03-25 16:58:42 +00:00
|
|
|
if(cpoin) {
|
2009-04-10 14:06:24 +00:00
|
|
|
fstyle->align= UI_STYLE_TEXT_RIGHT;
|
2011-11-14 14:42:47 +00:00
|
|
|
rect->xmax -= ui_but_draw_menu_icon(but) ? UI_DPI_ICON_SIZE : 5;
|
2009-04-10 14:06:24 +00:00
|
|
|
uiStyleFontDraw(fstyle, rect, cpoin+1);
|
2009-03-25 16:58:42 +00:00
|
|
|
*cpoin= '|';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* draws text and icons for buttons */
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *but, rcti *rect)
|
2009-03-25 16:58:42 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
if(but==NULL) return;
|
2009-11-11 10:27:25 +00:00
|
|
|
|
|
|
|
/* clip but->drawstr to fit in available space */
|
2011-01-23 19:20:10 +00:00
|
|
|
if (but->editstr && but->pos >= 0) {
|
|
|
|
ui_text_leftclip(fstyle, but, rect);
|
|
|
|
}
|
|
|
|
else if (ELEM4(but->type, NUM, NUMABS, NUMSLI, SLI)) {
|
2009-11-11 10:27:25 +00:00
|
|
|
ui_text_label_rightclip(fstyle, but, rect);
|
|
|
|
}
|
2010-01-21 01:30:32 +00:00
|
|
|
else if (ELEM(but->type, TEX, SEARCH_MENU)) {
|
|
|
|
ui_text_leftclip(fstyle, but, rect);
|
|
|
|
}
|
|
|
|
else if ((but->block->flag & UI_BLOCK_LOOP) && (but->type == BUT)) {
|
2009-04-10 14:06:24 +00:00
|
|
|
ui_text_leftclip(fstyle, but, rect);
|
|
|
|
}
|
|
|
|
else but->ofs= 0;
|
|
|
|
|
2009-03-25 16:58:42 +00:00
|
|
|
/* check for button text label */
|
|
|
|
if (but->type == ICONTEXTROW) {
|
Sorry, three commits in one, became difficult to untangle..
Editors Modules
* render/ module added in editors, moved the preview render code there and
also shading related operators.
* physics/ module made more consistent with other modules. renaming files,
making a single physics_ops.c for operators and keymaps. Also move all
particle related operators here now.
* space_buttons/ now should have only operators relevant to the buttons
specificially.
Updates & Notifiers
* Material/Texture/World/Lamp can now be passed to DAG_id_flush_update,
which will go back to a callback in editors. Eventually these should
be in the depsgraph itself, but for now this gives a unified call for
doing updates.
* GLSL materials are now refreshed on changes. There's still various
cases missing,
* Preview icons now hook into this system, solving various update cases
that were missed before.
* Also fixes issue in my last commit, where some preview would not render,
problem is avoided in the new system.
Icon Rendering
* On systems with support for non-power of two textures, an OpenGL texture
is now used instead of glDrawPixels. This avoids problems with icons get
clipped on region borders. On my Linux desktop, this gives an 1.1x speedup,
and on my Mac laptop a 2.3x speedup overall in redrawing the full window,
with the default setup. The glDrawPixels implementation on Mac seems to
have a lot of overhread.
* Preview icons are now drawn using proper premul alpha, and never faded so
you can see them clearly.
* Also tried to fix issue with texture node preview rendering, globals can't
be used with threads reliably.
2009-09-29 19:12:12 +00:00
|
|
|
widget_draw_icon(but, (BIFIconID) (but->icon+but->iconadd), 1.0f, rect);
|
2009-03-25 16:58:42 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
Sorry, three commits in one, became difficult to untangle..
Editors Modules
* render/ module added in editors, moved the preview render code there and
also shading related operators.
* physics/ module made more consistent with other modules. renaming files,
making a single physics_ops.c for operators and keymaps. Also move all
particle related operators here now.
* space_buttons/ now should have only operators relevant to the buttons
specificially.
Updates & Notifiers
* Material/Texture/World/Lamp can now be passed to DAG_id_flush_update,
which will go back to a callback in editors. Eventually these should
be in the depsgraph itself, but for now this gives a unified call for
doing updates.
* GLSL materials are now refreshed on changes. There's still various
cases missing,
* Preview icons now hook into this system, solving various update cases
that were missed before.
* Also fixes issue in my last commit, where some preview would not render,
problem is avoided in the new system.
Icon Rendering
* On systems with support for non-power of two textures, an OpenGL texture
is now used instead of glDrawPixels. This avoids problems with icons get
clipped on region borders. On my Linux desktop, this gives an 1.1x speedup,
and on my Mac laptop a 2.3x speedup overall in redrawing the full window,
with the default setup. The glDrawPixels implementation on Mac seems to
have a lot of overhread.
* Preview icons are now drawn using proper premul alpha, and never faded so
you can see them clearly.
* Also tried to fix issue with texture node preview rendering, globals can't
be used with threads reliably.
2009-09-29 19:12:12 +00:00
|
|
|
widget_draw_icon(but, ICON_DOT, dualset?1.0f:0.25f, rect);
|
2009-03-25 16:58:42 +00:00
|
|
|
}
|
2011-11-07 22:28:49 +00:00
|
|
|
else if(but->type==MENU && (but->flag & UI_BUT_NODE_LINK)) {
|
|
|
|
int tmp = rect->xmin;
|
|
|
|
rect->xmin = rect->xmax - (rect->ymax - rect->ymin) - 1;
|
|
|
|
widget_draw_icon(but, ICON_LAYER_USED, 1.0f, rect);
|
|
|
|
rect->xmin = tmp;
|
|
|
|
}
|
2009-03-25 16:58:42 +00:00
|
|
|
|
2009-06-02 18:10:06 +00:00
|
|
|
/* If there's an icon too (made with uiDefIconTextBut) then draw the icon
|
2012-03-03 16:31:46 +00:00
|
|
|
* and offset the text label to accommodate it */
|
2009-06-02 18:10:06 +00:00
|
|
|
|
|
|
|
if (but->flag & UI_HAS_ICON) {
|
Sorry, three commits in one, became difficult to untangle..
Editors Modules
* render/ module added in editors, moved the preview render code there and
also shading related operators.
* physics/ module made more consistent with other modules. renaming files,
making a single physics_ops.c for operators and keymaps. Also move all
particle related operators here now.
* space_buttons/ now should have only operators relevant to the buttons
specificially.
Updates & Notifiers
* Material/Texture/World/Lamp can now be passed to DAG_id_flush_update,
which will go back to a callback in editors. Eventually these should
be in the depsgraph itself, but for now this gives a unified call for
doing updates.
* GLSL materials are now refreshed on changes. There's still various
cases missing,
* Preview icons now hook into this system, solving various update cases
that were missed before.
* Also fixes issue in my last commit, where some preview would not render,
problem is avoided in the new system.
Icon Rendering
* On systems with support for non-power of two textures, an OpenGL texture
is now used instead of glDrawPixels. This avoids problems with icons get
clipped on region borders. On my Linux desktop, this gives an 1.1x speedup,
and on my Mac laptop a 2.3x speedup overall in redrawing the full window,
with the default setup. The glDrawPixels implementation on Mac seems to
have a lot of overhread.
* Preview icons are now drawn using proper premul alpha, and never faded so
you can see them clearly.
* Also tried to fix issue with texture node preview rendering, globals can't
be used with threads reliably.
2009-09-29 19:12:12 +00:00
|
|
|
widget_draw_icon(but, but->icon+but->iconadd, 1.0f, rect);
|
2009-03-25 16:58:42 +00:00
|
|
|
|
2011-08-05 10:45:32 +00:00
|
|
|
rect->xmin += (int)((float)UI_icon_get_width(but->icon+but->iconadd) * UI_DPI_ICON_FAC);
|
2009-03-25 16:58:42 +00:00
|
|
|
|
2009-06-02 18:10:06 +00:00
|
|
|
if(but->editstr || (but->flag & UI_TEXT_LEFT))
|
2009-08-10 20:57:12 +00:00
|
|
|
rect->xmin += 5;
|
2009-03-25 16:58:42 +00:00
|
|
|
}
|
2009-07-28 17:59:59 +00:00
|
|
|
else if((but->flag & UI_TEXT_LEFT))
|
2009-07-30 10:33:27 +00:00
|
|
|
rect->xmin += 5;
|
2009-06-02 18:10:06 +00:00
|
|
|
|
|
|
|
/* always draw text for textbutton cursor */
|
|
|
|
widget_draw_text(fstyle, wcol, but, rect);
|
|
|
|
|
2009-03-25 16:58:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* *********************** widget types ************************************* */
|
|
|
|
|
2009-04-02 15:01:11 +00:00
|
|
|
|
2012-03-03 16:31:46 +00:00
|
|
|
/* uiWidgetStateColors
|
|
|
|
* char inner_anim[4];
|
|
|
|
* char inner_anim_sel[4];
|
|
|
|
* char inner_key[4];
|
|
|
|
* char inner_key_sel[4];
|
|
|
|
* char inner_driven[4];
|
|
|
|
* char inner_driven_sel[4];
|
|
|
|
* float blend;
|
|
|
|
*/
|
2009-04-13 15:55:27 +00:00
|
|
|
|
2010-12-03 12:30:59 +00:00
|
|
|
static struct uiWidgetStateColors wcol_state_colors= {
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
{115, 190, 76, 255},
|
|
|
|
{90, 166, 51, 255},
|
|
|
|
{240, 235, 100, 255},
|
2009-07-12 02:06:15 +00:00
|
|
|
{215, 211, 75, 255},
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
{180, 0, 255, 255},
|
2009-07-12 02:06:15 +00:00
|
|
|
{153, 0, 230, 255},
|
|
|
|
0.5f, 0.0f
|
2009-04-13 15:55:27 +00:00
|
|
|
};
|
|
|
|
|
2012-03-03 16:31:46 +00:00
|
|
|
/* uiWidgetColors
|
|
|
|
* float outline[3];
|
|
|
|
* float inner[4];
|
|
|
|
* float inner_sel[4];
|
|
|
|
* float item[3];
|
|
|
|
* float text[3];
|
|
|
|
* float text_sel[3];
|
|
|
|
*
|
|
|
|
* short shaded;
|
|
|
|
* float shadetop, shadedown;
|
|
|
|
*/
|
2009-03-25 16:58:42 +00:00
|
|
|
|
|
|
|
static struct uiWidgetColors wcol_num= {
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
{25, 25, 25, 255},
|
|
|
|
{180, 180, 180, 255},
|
|
|
|
{153, 153, 153, 255},
|
|
|
|
{90, 90, 90, 255},
|
2009-03-25 16:58:42 +00:00
|
|
|
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
{0, 0, 0, 255},
|
|
|
|
{255, 255, 255, 255},
|
2009-03-25 16:58:42 +00:00
|
|
|
|
|
|
|
1,
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
-20, 0
|
2009-03-25 16:58:42 +00:00
|
|
|
};
|
|
|
|
|
2009-04-02 18:16:15 +00:00
|
|
|
static struct uiWidgetColors wcol_numslider= {
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
{25, 25, 25, 255},
|
|
|
|
{180, 180, 180, 255},
|
|
|
|
{153, 153, 153, 255},
|
|
|
|
{128, 128, 128, 255},
|
2009-04-02 18:16:15 +00:00
|
|
|
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
{0, 0, 0, 255},
|
|
|
|
{255, 255, 255, 255},
|
2009-04-02 18:16:15 +00:00
|
|
|
|
|
|
|
1,
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
-20, 0
|
2009-04-02 18:16:15 +00:00
|
|
|
};
|
|
|
|
|
2009-03-25 16:58:42 +00:00
|
|
|
static struct uiWidgetColors wcol_text= {
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
{25, 25, 25, 255},
|
|
|
|
{153, 153, 153, 255},
|
|
|
|
{153, 153, 153, 255},
|
|
|
|
{90, 90, 90, 255},
|
2009-03-25 16:58:42 +00:00
|
|
|
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
{0, 0, 0, 255},
|
|
|
|
{255, 255, 255, 255},
|
2009-03-25 16:58:42 +00:00
|
|
|
|
|
|
|
1,
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
0, 25
|
2009-03-25 16:58:42 +00:00
|
|
|
};
|
|
|
|
|
2009-04-02 15:01:11 +00:00
|
|
|
static struct uiWidgetColors wcol_option= {
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
{0, 0, 0, 255},
|
2009-04-29 04:43:17 +00:00
|
|
|
{70, 70, 70, 255},
|
|
|
|
{70, 70, 70, 255},
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
{255, 255, 255, 255},
|
2009-04-02 15:01:11 +00:00
|
|
|
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
{0, 0, 0, 255},
|
|
|
|
{255, 255, 255, 255},
|
2009-04-02 15:01:11 +00:00
|
|
|
|
|
|
|
1,
|
2009-05-18 18:20:29 +00:00
|
|
|
15, -15
|
2009-04-02 15:01:11 +00:00
|
|
|
};
|
|
|
|
|
2009-04-03 16:26:03 +00:00
|
|
|
/* button that shows popup */
|
2009-03-25 16:58:42 +00:00
|
|
|
static struct uiWidgetColors wcol_menu= {
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
{0, 0, 0, 255},
|
2009-04-29 04:43:17 +00:00
|
|
|
{70, 70, 70, 255},
|
|
|
|
{70, 70, 70, 255},
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
{255, 255, 255, 255},
|
2009-03-25 16:58:42 +00:00
|
|
|
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
{255, 255, 255, 255},
|
|
|
|
{204, 204, 204, 255},
|
2009-03-25 16:58:42 +00:00
|
|
|
|
|
|
|
1,
|
2009-05-18 18:20:29 +00:00
|
|
|
15, -15
|
2009-03-25 16:58:42 +00:00
|
|
|
};
|
|
|
|
|
2009-04-03 16:26:03 +00:00
|
|
|
/* button that starts pulldown */
|
|
|
|
static struct uiWidgetColors wcol_pulldown= {
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
{0, 0, 0, 255},
|
|
|
|
{63, 63, 63, 255},
|
2009-04-29 04:43:17 +00:00
|
|
|
{86, 128, 194, 255},
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
{255, 255, 255, 255},
|
2009-04-03 16:26:03 +00:00
|
|
|
|
2009-04-29 04:43:17 +00:00
|
|
|
{0, 0, 0, 255},
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
{0, 0, 0, 255},
|
2009-04-03 16:26:03 +00:00
|
|
|
|
|
|
|
0,
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
25, -20
|
2009-04-03 16:26:03 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* button inside menu */
|
|
|
|
static struct uiWidgetColors wcol_menu_item= {
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
{0, 0, 0, 255},
|
2009-04-29 04:43:17 +00:00
|
|
|
{0, 0, 0, 0},
|
|
|
|
{86, 128, 194, 255},
|
2012-03-15 21:11:14 +00:00
|
|
|
{172, 172, 172, 128},
|
2009-04-03 16:26:03 +00:00
|
|
|
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
{255, 255, 255, 255},
|
|
|
|
{0, 0, 0, 255},
|
2009-04-03 16:26:03 +00:00
|
|
|
|
2011-05-03 15:30:16 +00:00
|
|
|
1,
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
38, 0
|
2009-04-03 16:26:03 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* backdrop menu + title text color */
|
|
|
|
static struct uiWidgetColors wcol_menu_back= {
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
{0, 0, 0, 255},
|
2009-04-29 04:43:17 +00:00
|
|
|
{25, 25, 25, 230},
|
2009-06-10 11:43:21 +00:00
|
|
|
{45, 45, 45, 230},
|
2009-06-27 16:35:42 +00:00
|
|
|
{100, 100, 100, 255},
|
2009-04-03 16:26:03 +00:00
|
|
|
|
2009-07-24 13:25:39 +00:00
|
|
|
{160, 160, 160, 255},
|
2009-06-10 11:43:21 +00:00
|
|
|
{255, 255, 255, 255},
|
2009-04-03 16:26:03 +00:00
|
|
|
|
|
|
|
0,
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
25, -20
|
2009-04-03 16:26:03 +00:00
|
|
|
};
|
|
|
|
|
2012-03-19 22:29:16 +00:00
|
|
|
/* tooltip colour */
|
|
|
|
static struct uiWidgetColors wcol_tooltip= {
|
|
|
|
{0, 0, 0, 255},
|
|
|
|
{25, 25, 25, 230},
|
|
|
|
{45, 45, 45, 230},
|
|
|
|
{100, 100, 100, 255},
|
|
|
|
|
|
|
|
{160, 160, 160, 255},
|
|
|
|
{255, 255, 255, 255},
|
|
|
|
|
|
|
|
0,
|
|
|
|
25, -20
|
|
|
|
};
|
2009-04-02 15:01:11 +00:00
|
|
|
|
|
|
|
static struct uiWidgetColors wcol_radio= {
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
{0, 0, 0, 255},
|
2009-04-29 04:43:17 +00:00
|
|
|
{70, 70, 70, 255},
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
{86, 128, 194, 255},
|
|
|
|
{255, 255, 255, 255},
|
2009-03-25 16:58:42 +00:00
|
|
|
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
{255, 255, 255, 255},
|
|
|
|
{0, 0, 0, 255},
|
2009-03-25 16:58:42 +00:00
|
|
|
|
|
|
|
1,
|
2009-05-16 17:30:13 +00:00
|
|
|
15, -15
|
2009-03-25 16:58:42 +00:00
|
|
|
};
|
|
|
|
|
2009-11-19 09:57:04 +00:00
|
|
|
static struct uiWidgetColors wcol_regular= {
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
{25, 25, 25, 255},
|
2009-11-18 18:01:54 +00:00
|
|
|
{153, 153, 153, 255},
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
{100, 100, 100, 255},
|
|
|
|
{25, 25, 25, 255},
|
2009-03-25 16:58:42 +00:00
|
|
|
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
{0, 0, 0, 255},
|
|
|
|
{255, 255, 255, 255},
|
2009-03-25 16:58:42 +00:00
|
|
|
|
|
|
|
0,
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
0, 0
|
2009-03-25 16:58:42 +00:00
|
|
|
};
|
|
|
|
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
static struct uiWidgetColors wcol_tool= {
|
|
|
|
{25, 25, 25, 255},
|
|
|
|
{153, 153, 153, 255},
|
|
|
|
{100, 100, 100, 255},
|
|
|
|
{25, 25, 25, 255},
|
2009-03-25 16:58:42 +00:00
|
|
|
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
{0, 0, 0, 255},
|
|
|
|
{255, 255, 255, 255},
|
2009-03-25 16:58:42 +00:00
|
|
|
|
|
|
|
1,
|
2009-08-23 21:56:32 +00:00
|
|
|
15, -15
|
2009-03-25 16:58:42 +00:00
|
|
|
};
|
|
|
|
|
2009-06-01 11:31:06 +00:00
|
|
|
static struct uiWidgetColors wcol_box= {
|
|
|
|
{25, 25, 25, 255},
|
|
|
|
{128, 128, 128, 255},
|
|
|
|
{100, 100, 100, 255},
|
|
|
|
{25, 25, 25, 255},
|
|
|
|
|
|
|
|
{0, 0, 0, 255},
|
|
|
|
{255, 255, 255, 255},
|
|
|
|
|
|
|
|
0,
|
|
|
|
0, 0
|
|
|
|
};
|
|
|
|
|
2009-06-24 14:16:56 +00:00
|
|
|
static struct uiWidgetColors wcol_toggle= {
|
|
|
|
{25, 25, 25, 255},
|
|
|
|
{153, 153, 153, 255},
|
|
|
|
{100, 100, 100, 255},
|
|
|
|
{25, 25, 25, 255},
|
|
|
|
|
|
|
|
{0, 0, 0, 255},
|
|
|
|
{255, 255, 255, 255},
|
|
|
|
|
|
|
|
0,
|
|
|
|
0, 0
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct uiWidgetColors wcol_scroll= {
|
2009-07-02 18:12:46 +00:00
|
|
|
{50, 50, 50, 180},
|
|
|
|
{80, 80, 80, 180},
|
|
|
|
{100, 100, 100, 180},
|
2009-07-23 20:50:24 +00:00
|
|
|
{128, 128, 128, 255},
|
2009-06-24 14:16:56 +00:00
|
|
|
|
|
|
|
{0, 0, 0, 255},
|
|
|
|
{255, 255, 255, 255},
|
|
|
|
|
|
|
|
1,
|
2009-07-23 20:50:24 +00:00
|
|
|
5, -5
|
2009-06-24 14:16:56 +00:00
|
|
|
};
|
|
|
|
|
2010-05-27 08:22:16 +00:00
|
|
|
static struct uiWidgetColors wcol_progress= {
|
|
|
|
{0, 0, 0, 255},
|
|
|
|
{190, 190, 190, 255},
|
|
|
|
{100, 100, 100, 180},
|
|
|
|
{68, 68, 68, 255},
|
|
|
|
|
|
|
|
{0, 0, 0, 255},
|
|
|
|
{255, 255, 255, 255},
|
|
|
|
|
|
|
|
0,
|
|
|
|
0, 0
|
|
|
|
};
|
|
|
|
|
2009-07-21 01:26:17 +00:00
|
|
|
static struct uiWidgetColors wcol_list_item= {
|
|
|
|
{0, 0, 0, 255},
|
|
|
|
{0, 0, 0, 0},
|
|
|
|
{86, 128, 194, 255},
|
|
|
|
{0, 0, 0, 255},
|
|
|
|
|
|
|
|
{0, 0, 0, 255},
|
|
|
|
{0, 0, 0, 255},
|
|
|
|
|
|
|
|
0,
|
|
|
|
0, 0
|
|
|
|
};
|
|
|
|
|
2009-06-12 14:22:27 +00:00
|
|
|
/* free wcol struct to play with */
|
|
|
|
static struct uiWidgetColors wcol_tmp= {
|
|
|
|
{0, 0, 0, 255},
|
|
|
|
{128, 128, 128, 255},
|
|
|
|
{100, 100, 100, 255},
|
|
|
|
{25, 25, 25, 255},
|
|
|
|
|
|
|
|
{0, 0, 0, 255},
|
|
|
|
{255, 255, 255, 255},
|
|
|
|
|
|
|
|
0,
|
|
|
|
0, 0
|
|
|
|
};
|
|
|
|
|
2009-06-01 11:31:06 +00:00
|
|
|
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
/* called for theme init (new theme) and versions */
|
|
|
|
void ui_widget_color_init(ThemeUI *tui)
|
|
|
|
{
|
2009-11-19 09:57:04 +00:00
|
|
|
tui->wcol_regular= wcol_regular;
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
tui->wcol_tool= wcol_tool;
|
|
|
|
tui->wcol_text= wcol_text;
|
2009-06-24 14:16:56 +00:00
|
|
|
tui->wcol_radio= wcol_radio;
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
tui->wcol_option= wcol_option;
|
2009-06-24 14:16:56 +00:00
|
|
|
tui->wcol_toggle= wcol_toggle;
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
tui->wcol_num= wcol_num;
|
|
|
|
tui->wcol_numslider= wcol_numslider;
|
|
|
|
tui->wcol_menu= wcol_menu;
|
|
|
|
tui->wcol_pulldown= wcol_pulldown;
|
|
|
|
tui->wcol_menu_back= wcol_menu_back;
|
2012-03-19 22:29:16 +00:00
|
|
|
tui->wcol_tooltip = wcol_tooltip;
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
tui->wcol_menu_item= wcol_menu_item;
|
2009-06-01 11:31:06 +00:00
|
|
|
tui->wcol_box= wcol_box;
|
2009-06-24 14:16:56 +00:00
|
|
|
tui->wcol_scroll= wcol_scroll;
|
2009-07-21 01:26:17 +00:00
|
|
|
tui->wcol_list_item= wcol_list_item;
|
2010-05-27 08:22:16 +00:00
|
|
|
tui->wcol_progress= wcol_progress;
|
2009-07-12 02:06:15 +00:00
|
|
|
|
2010-12-03 12:30:59 +00:00
|
|
|
tui->wcol_state= wcol_state_colors;
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
}
|
|
|
|
|
2009-04-02 15:01:11 +00:00
|
|
|
/* ************ button callbacks, state ***************** */
|
2009-03-25 16:58:42 +00:00
|
|
|
|
2011-09-26 17:30:56 +00:00
|
|
|
static void widget_state_blend(char cp[3], const char cpstate[3], const float fac)
|
2009-07-12 02:06:15 +00:00
|
|
|
{
|
|
|
|
if(fac != 0.0f) {
|
|
|
|
cp[0]= (int)((1.0f-fac)*cp[0] + fac*cpstate[0]);
|
|
|
|
cp[1]= (int)((1.0f-fac)*cp[1] + fac*cpstate[1]);
|
|
|
|
cp[2]= (int)((1.0f-fac)*cp[2] + fac*cpstate[2]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-04-02 15:01:11 +00:00
|
|
|
/* copy colors from theme, and set changes in it based on state */
|
|
|
|
static void widget_state(uiWidgetType *wt, int state)
|
2009-03-25 16:58:42 +00:00
|
|
|
{
|
2009-07-12 02:06:15 +00:00
|
|
|
uiWidgetStateColors *wcol_state= wt->wcol_state;
|
|
|
|
|
2009-04-02 15:01:11 +00:00
|
|
|
wt->wcol= *(wt->wcol_theme);
|
2009-03-25 16:58:42 +00:00
|
|
|
|
2009-04-02 15:01:11 +00:00
|
|
|
if(state & UI_SELECT) {
|
2011-11-07 01:38:32 +00:00
|
|
|
copy_v4_v4_char(wt->wcol.inner, wt->wcol.inner_sel);
|
2009-07-12 02:06:15 +00:00
|
|
|
|
2009-04-03 23:30:32 +00:00
|
|
|
if(state & UI_BUT_ANIMATED_KEY)
|
2009-07-12 02:06:15 +00:00
|
|
|
widget_state_blend(wt->wcol.inner, wcol_state->inner_key_sel, wcol_state->blend);
|
2009-04-03 23:30:32 +00:00
|
|
|
else if(state & UI_BUT_ANIMATED)
|
2009-07-12 02:06:15 +00:00
|
|
|
widget_state_blend(wt->wcol.inner, wcol_state->inner_anim_sel, wcol_state->blend);
|
2009-04-10 13:16:50 +00:00
|
|
|
else if(state & UI_BUT_DRIVEN)
|
2009-07-12 02:06:15 +00:00
|
|
|
widget_state_blend(wt->wcol.inner, wcol_state->inner_driven_sel, wcol_state->blend);
|
2009-04-03 23:30:32 +00:00
|
|
|
|
2011-11-07 01:38:32 +00:00
|
|
|
copy_v3_v3_char(wt->wcol.text, wt->wcol.text_sel);
|
2010-09-11 00:08:07 +00:00
|
|
|
|
|
|
|
if(state & UI_SELECT)
|
|
|
|
SWAP(short, wt->wcol.shadetop, wt->wcol.shadedown);
|
2009-04-02 15:01:11 +00:00
|
|
|
}
|
2009-04-03 23:30:32 +00:00
|
|
|
else {
|
|
|
|
if(state & UI_BUT_ANIMATED_KEY)
|
2009-07-12 02:06:15 +00:00
|
|
|
widget_state_blend(wt->wcol.inner, wcol_state->inner_key, wcol_state->blend);
|
2009-04-03 23:30:32 +00:00
|
|
|
else if(state & UI_BUT_ANIMATED)
|
2009-07-12 02:06:15 +00:00
|
|
|
widget_state_blend(wt->wcol.inner, wcol_state->inner_anim, wcol_state->blend);
|
2009-04-10 13:16:50 +00:00
|
|
|
else if(state & UI_BUT_DRIVEN)
|
2009-07-12 02:06:15 +00:00
|
|
|
widget_state_blend(wt->wcol.inner, wcol_state->inner_driven, wcol_state->blend);
|
2009-04-03 23:30:32 +00:00
|
|
|
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
if(state & UI_ACTIVE) { /* mouse over? */
|
|
|
|
wt->wcol.inner[0]= wt->wcol.inner[0]>=240? 255 : wt->wcol.inner[0]+15;
|
|
|
|
wt->wcol.inner[1]= wt->wcol.inner[1]>=240? 255 : wt->wcol.inner[1]+15;
|
|
|
|
wt->wcol.inner[2]= wt->wcol.inner[2]>=240? 255 : wt->wcol.inner[2]+15;
|
|
|
|
}
|
2009-04-03 23:30:32 +00:00
|
|
|
}
|
2010-09-17 05:58:06 +00:00
|
|
|
|
|
|
|
if(state & UI_BUT_REDALERT) {
|
|
|
|
char red[4]= {255, 0, 0};
|
|
|
|
widget_state_blend(wt->wcol.inner, red, 0.4f);
|
|
|
|
}
|
2011-11-07 22:28:49 +00:00
|
|
|
if(state & UI_BUT_NODE_ACTIVE) {
|
|
|
|
char blue[4]= {86, 128, 194};
|
|
|
|
widget_state_blend(wt->wcol.inner, blue, 0.3f);
|
|
|
|
}
|
2009-04-02 15:01:11 +00:00
|
|
|
}
|
|
|
|
|
2009-10-15 11:52:23 +00:00
|
|
|
/* sliders use special hack which sets 'item' as inner when drawing filling */
|
|
|
|
static void widget_state_numslider(uiWidgetType *wt, int state)
|
|
|
|
{
|
|
|
|
uiWidgetStateColors *wcol_state= wt->wcol_state;
|
|
|
|
float blend= wcol_state->blend - 0.2f; // XXX special tweak to make sure that bar will still be visible
|
|
|
|
|
|
|
|
/* call this for option button */
|
|
|
|
widget_state(wt, state);
|
|
|
|
|
|
|
|
/* now, set the inner-part so that it reflects state settings too */
|
|
|
|
// TODO: maybe we should have separate settings for the blending colors used for this case?
|
|
|
|
if(state & UI_SELECT) {
|
2010-09-07 11:14:20 +00:00
|
|
|
|
2009-10-15 11:52:23 +00:00
|
|
|
if(state & UI_BUT_ANIMATED_KEY)
|
|
|
|
widget_state_blend(wt->wcol.item, wcol_state->inner_key_sel, blend);
|
|
|
|
else if(state & UI_BUT_ANIMATED)
|
|
|
|
widget_state_blend(wt->wcol.item, wcol_state->inner_anim_sel, blend);
|
|
|
|
else if(state & UI_BUT_DRIVEN)
|
|
|
|
widget_state_blend(wt->wcol.item, wcol_state->inner_driven_sel, blend);
|
2010-09-11 00:08:07 +00:00
|
|
|
|
|
|
|
if(state & UI_SELECT)
|
|
|
|
SWAP(short, wt->wcol.shadetop, wt->wcol.shadedown);
|
2009-10-15 11:52:23 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
if(state & UI_BUT_ANIMATED_KEY)
|
|
|
|
widget_state_blend(wt->wcol.item, wcol_state->inner_key, blend);
|
|
|
|
else if(state & UI_BUT_ANIMATED)
|
|
|
|
widget_state_blend(wt->wcol.item, wcol_state->inner_anim, blend);
|
|
|
|
else if(state & UI_BUT_DRIVEN)
|
|
|
|
widget_state_blend(wt->wcol.item, wcol_state->inner_driven, blend);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
/* labels use theme colors for text */
|
|
|
|
static void widget_state_label(uiWidgetType *wt, int state)
|
|
|
|
{
|
|
|
|
/* call this for option button */
|
|
|
|
widget_state(wt, state);
|
|
|
|
|
|
|
|
if(state & UI_SELECT)
|
2010-12-20 03:59:22 +00:00
|
|
|
UI_GetThemeColor4ubv(TH_TEXT_HI, (unsigned char *)wt->wcol.text);
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
else
|
2010-12-20 03:59:22 +00:00
|
|
|
UI_GetThemeColor4ubv(TH_TEXT, (unsigned char *)wt->wcol.text);
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2011-04-04 15:01:22 +00:00
|
|
|
/* labels use theme colors for text */
|
|
|
|
static void widget_state_option_menu(uiWidgetType *wt, int state)
|
|
|
|
{
|
|
|
|
|
|
|
|
/* call this for option button */
|
|
|
|
widget_state(wt, state);
|
|
|
|
|
|
|
|
/* if not selected we get theme from menu back */
|
|
|
|
if(state & UI_SELECT)
|
|
|
|
UI_GetThemeColor4ubv(TH_TEXT_HI, (unsigned char *)wt->wcol.text);
|
|
|
|
else {
|
2011-11-19 20:57:53 +00:00
|
|
|
bTheme *btheme= UI_GetTheme(); /* XXX */
|
2011-04-04 15:01:22 +00:00
|
|
|
|
2011-11-07 01:38:32 +00:00
|
|
|
copy_v3_v3_char(wt->wcol.text, btheme->tui.wcol_menu_back.text);
|
2011-04-04 15:01:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-10-16 02:40:31 +00:00
|
|
|
static void widget_state_nothing(uiWidgetType *wt, int UNUSED(state))
|
2009-07-02 18:12:46 +00:00
|
|
|
{
|
|
|
|
wt->wcol= *(wt->wcol_theme);
|
|
|
|
}
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
|
2009-04-03 16:26:03 +00:00
|
|
|
/* special case, button that calls pulldown */
|
|
|
|
static void widget_state_pulldown(uiWidgetType *wt, int state)
|
|
|
|
{
|
|
|
|
wt->wcol= *(wt->wcol_theme);
|
|
|
|
|
2011-11-07 01:38:32 +00:00
|
|
|
copy_v4_v4_char(wt->wcol.inner, wt->wcol.inner_sel);
|
|
|
|
copy_v3_v3_char(wt->wcol.outline, wt->wcol.inner);
|
2009-04-03 16:26:03 +00:00
|
|
|
|
|
|
|
if(state & UI_ACTIVE)
|
2011-11-07 01:38:32 +00:00
|
|
|
copy_v3_v3_char(wt->wcol.text, wt->wcol.text_sel);
|
2009-04-03 16:26:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* special case, menu items */
|
|
|
|
static void widget_state_menu_item(uiWidgetType *wt, int state)
|
|
|
|
{
|
|
|
|
wt->wcol= *(wt->wcol_theme);
|
|
|
|
|
2009-05-28 23:37:55 +00:00
|
|
|
if(state & (UI_BUT_DISABLED|UI_BUT_INACTIVE)) {
|
2009-04-12 13:40:29 +00:00
|
|
|
wt->wcol.text[0]= 0.5f*(wt->wcol.text[0]+wt->wcol.text_sel[0]);
|
|
|
|
wt->wcol.text[1]= 0.5f*(wt->wcol.text[1]+wt->wcol.text_sel[1]);
|
|
|
|
wt->wcol.text[2]= 0.5f*(wt->wcol.text[2]+wt->wcol.text_sel[2]);
|
|
|
|
}
|
|
|
|
else if(state & UI_ACTIVE) {
|
2011-11-07 01:38:32 +00:00
|
|
|
copy_v4_v4_char(wt->wcol.inner, wt->wcol.inner_sel);
|
|
|
|
copy_v3_v3_char(wt->wcol.text, wt->wcol.text_sel);
|
2009-04-03 16:26:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* ************ menu backdrop ************************* */
|
|
|
|
|
|
|
|
/* outside of rect, rad to left/bottom/right */
|
|
|
|
static void widget_softshadow(rcti *rect, int roundboxalign, float radin, float radout)
|
|
|
|
{
|
|
|
|
uiWidgetBase wtb;
|
|
|
|
rcti rect1= *rect;
|
|
|
|
float alpha, alphastep;
|
2011-09-09 14:44:36 +00:00
|
|
|
int step, totvert;
|
|
|
|
float quad_strip[WIDGET_SIZE_MAX*2][2];
|
2009-04-03 16:26:03 +00:00
|
|
|
|
2009-04-15 14:43:54 +00:00
|
|
|
/* prevent tooltips to not show round shadow */
|
|
|
|
if( 2.0f*radout > 0.2f*(rect1.ymax-rect1.ymin) )
|
|
|
|
rect1.ymax -= 0.2f*(rect1.ymax-rect1.ymin);
|
|
|
|
else
|
|
|
|
rect1.ymax -= 2.0f*radout;
|
2009-04-03 16:26:03 +00:00
|
|
|
|
|
|
|
/* inner part */
|
2011-09-11 06:41:09 +00:00
|
|
|
totvert= round_box_shadow_edges(wtb.inner_v, &rect1, radin, roundboxalign & (UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT), 0.0f);
|
2011-09-09 14:44:36 +00:00
|
|
|
|
2009-04-03 16:26:03 +00:00
|
|
|
/* inverse linear shadow alpha */
|
|
|
|
alpha= 0.15;
|
|
|
|
alphastep= 0.67;
|
|
|
|
|
2011-09-09 14:44:36 +00:00
|
|
|
glEnableClientState(GL_VERTEX_ARRAY);
|
|
|
|
|
2009-04-03 16:26:03 +00:00
|
|
|
for(step= 1; step<=radout; step++, alpha*=alphastep) {
|
2011-09-11 06:41:09 +00:00
|
|
|
round_box_shadow_edges(wtb.outer_v, &rect1, radin, UI_CNR_ALL, (float)step);
|
2009-04-03 16:26:03 +00:00
|
|
|
|
|
|
|
glColor4f(0.0f, 0.0f, 0.0f, alpha);
|
2011-09-09 14:44:36 +00:00
|
|
|
|
|
|
|
widget_verts_to_quad_strip_open(&wtb, totvert, quad_strip);
|
|
|
|
|
|
|
|
glVertexPointer(2, GL_FLOAT, 0, quad_strip);
|
|
|
|
glDrawArrays(GL_QUAD_STRIP, 0, totvert*2);
|
2009-04-03 16:26:03 +00:00
|
|
|
}
|
2011-09-09 14:44:36 +00:00
|
|
|
|
|
|
|
glDisableClientState(GL_VERTEX_ARRAY);
|
2009-04-03 16:26:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void widget_menu_back(uiWidgetColors *wcol, rcti *rect, int flag, int direction)
|
|
|
|
{
|
|
|
|
uiWidgetBase wtb;
|
2011-09-11 06:41:09 +00:00
|
|
|
int roundboxalign= UI_CNR_ALL;
|
2009-04-03 16:26:03 +00:00
|
|
|
|
|
|
|
widget_init(&wtb);
|
|
|
|
|
|
|
|
/* menu is 2nd level or deeper */
|
|
|
|
if (flag & UI_BLOCK_POPUP) {
|
2009-06-04 18:38:10 +00:00
|
|
|
//rect->ymin -= 4.0;
|
|
|
|
//rect->ymax += 4.0;
|
2009-04-03 16:26:03 +00:00
|
|
|
}
|
|
|
|
else if (direction == UI_DOWN) {
|
2011-09-11 06:41:09 +00:00
|
|
|
roundboxalign= (UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT);
|
2009-04-03 16:26:03 +00:00
|
|
|
rect->ymin -= 4.0;
|
|
|
|
}
|
|
|
|
else if (direction == UI_TOP) {
|
2011-09-11 06:41:09 +00:00
|
|
|
roundboxalign= UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT;
|
2009-04-03 16:26:03 +00:00
|
|
|
rect->ymax += 4.0;
|
|
|
|
}
|
|
|
|
|
|
|
|
glEnable(GL_BLEND);
|
|
|
|
widget_softshadow(rect, roundboxalign, 5.0f, 8.0f);
|
|
|
|
|
|
|
|
round_box_edges(&wtb, roundboxalign, rect, 5.0f);
|
|
|
|
wtb.emboss= 0;
|
|
|
|
widgetbase_draw(&wtb, wcol);
|
|
|
|
|
|
|
|
glDisable(GL_BLEND);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-06-12 14:22:27 +00:00
|
|
|
static void ui_hsv_cursor(float x, float y)
|
|
|
|
{
|
|
|
|
|
|
|
|
glPushMatrix();
|
|
|
|
glTranslatef(x, y, 0.0f);
|
|
|
|
|
|
|
|
glColor3f(1.0f, 1.0f, 1.0f);
|
|
|
|
glutil_draw_filled_arc(0.0f, M_PI*2.0, 3.0f, 8);
|
|
|
|
|
|
|
|
glEnable(GL_BLEND);
|
|
|
|
glEnable(GL_LINE_SMOOTH );
|
|
|
|
glColor3f(0.0f, 0.0f, 0.0f);
|
|
|
|
glutil_draw_lined_arc(0.0f, M_PI*2.0, 3.0f, 12);
|
|
|
|
glDisable(GL_BLEND);
|
|
|
|
glDisable(GL_LINE_SMOOTH );
|
|
|
|
|
|
|
|
glPopMatrix();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void ui_hsvcircle_vals_from_pos(float *valrad, float *valdist, rcti *rect, float mx, float my)
|
2009-06-10 11:43:21 +00:00
|
|
|
{
|
|
|
|
/* duplication of code... well, simple is better now */
|
|
|
|
float centx= (float)(rect->xmin + rect->xmax)/2;
|
|
|
|
float centy= (float)(rect->ymin + rect->ymax)/2;
|
|
|
|
float radius, dist;
|
|
|
|
|
|
|
|
if( rect->xmax-rect->xmin > rect->ymax-rect->ymin )
|
|
|
|
radius= (float)(rect->ymax - rect->ymin)/2;
|
|
|
|
else
|
|
|
|
radius= (float)(rect->xmax - rect->xmin)/2;
|
|
|
|
|
|
|
|
mx-= centx;
|
|
|
|
my-= centy;
|
|
|
|
dist= sqrt( mx*mx + my*my);
|
|
|
|
if(dist < radius)
|
|
|
|
*valdist= dist/radius;
|
|
|
|
else
|
|
|
|
*valdist= 1.0f;
|
|
|
|
|
2011-03-27 14:52:16 +00:00
|
|
|
*valrad= atan2f(mx, my)/(2.0f*(float)M_PI) + 0.5f;
|
2009-06-10 11:43:21 +00:00
|
|
|
}
|
|
|
|
|
2011-02-13 14:16:36 +00:00
|
|
|
static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, rcti *rect)
|
2009-06-10 11:43:21 +00:00
|
|
|
{
|
|
|
|
/* gouraud triangle fan */
|
|
|
|
float radstep, ang= 0.0f;
|
2011-12-21 13:49:22 +00:00
|
|
|
float centx, centy, radius, cursor_radius;
|
2010-10-13 13:53:49 +00:00
|
|
|
float rgb[3], hsvo[3], hsv[3], col[3], colcent[3];
|
2009-06-10 11:43:21 +00:00
|
|
|
int a, tot= 32;
|
2010-08-25 07:49:12 +00:00
|
|
|
int color_profile = but->block->color_profile;
|
|
|
|
|
|
|
|
if (but->rnaprop && RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA)
|
|
|
|
color_profile = BLI_PR_NONE;
|
2009-06-10 11:43:21 +00:00
|
|
|
|
2011-03-27 14:52:16 +00:00
|
|
|
radstep= 2.0f*(float)M_PI/(float)tot;
|
2009-06-10 11:43:21 +00:00
|
|
|
centx= (float)(rect->xmin + rect->xmax)/2;
|
|
|
|
centy= (float)(rect->ymin + rect->ymax)/2;
|
|
|
|
|
|
|
|
if( rect->xmax-rect->xmin > rect->ymax-rect->ymin )
|
|
|
|
radius= (float)(rect->ymax - rect->ymin)/2;
|
|
|
|
else
|
|
|
|
radius= (float)(rect->xmax - rect->xmin)/2;
|
|
|
|
|
|
|
|
/* color */
|
2010-01-07 09:55:11 +00:00
|
|
|
ui_get_but_vectorf(but, rgb);
|
2010-10-13 13:53:49 +00:00
|
|
|
copy_v3_v3(hsv, ui_block_hsv_get(but->block));
|
|
|
|
rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
|
2010-01-07 09:55:11 +00:00
|
|
|
copy_v3_v3(hsvo, hsv);
|
|
|
|
|
2010-07-05 07:08:10 +00:00
|
|
|
/* exception: if 'lock' is set
|
2010-01-27 00:22:29 +00:00
|
|
|
* lock the value of the color wheel to 1.
|
2011-10-23 15:43:12 +00:00
|
|
|
* Useful for color correction tools where you're only interested in hue. */
|
2010-08-25 07:49:12 +00:00
|
|
|
if (but->flag & UI_BUT_COLOR_LOCK)
|
|
|
|
hsv[2] = 1.f;
|
|
|
|
else if (color_profile)
|
|
|
|
hsv[2] = linearrgb_to_srgb(hsv[2]);
|
2010-01-27 00:22:29 +00:00
|
|
|
|
2010-01-07 09:55:11 +00:00
|
|
|
hsv_to_rgb(0.f, 0.f, hsv[2], colcent, colcent+1, colcent+2);
|
2009-06-10 11:43:21 +00:00
|
|
|
|
|
|
|
glShadeModel(GL_SMOOTH);
|
|
|
|
|
|
|
|
glBegin(GL_TRIANGLE_FAN);
|
|
|
|
glColor3fv(colcent);
|
|
|
|
glVertex2f( centx, centy);
|
|
|
|
|
|
|
|
for(a=0; a<=tot; a++, ang+=radstep) {
|
|
|
|
float si= sin(ang);
|
|
|
|
float co= cos(ang);
|
|
|
|
|
2009-06-12 14:22:27 +00:00
|
|
|
ui_hsvcircle_vals_from_pos(hsv, hsv+1, rect, centx + co*radius, centy + si*radius);
|
2010-07-04 20:59:10 +00:00
|
|
|
CLAMP(hsv[2], 0.0f, 1.0f); /* for display only */
|
2010-07-05 15:52:25 +00:00
|
|
|
|
2009-06-10 11:43:21 +00:00
|
|
|
hsv_to_rgb(hsv[0], hsv[1], hsv[2], col, col+1, col+2);
|
|
|
|
glColor3fv(col);
|
|
|
|
glVertex2f( centx + co*radius, centy + si*radius);
|
|
|
|
}
|
|
|
|
glEnd();
|
|
|
|
|
|
|
|
glShadeModel(GL_FLAT);
|
2009-06-12 14:22:27 +00:00
|
|
|
|
|
|
|
/* fully rounded outline */
|
|
|
|
glPushMatrix();
|
|
|
|
glTranslatef(centx, centy, 0.0f);
|
|
|
|
glEnable(GL_BLEND);
|
|
|
|
glEnable(GL_LINE_SMOOTH );
|
2010-01-07 09:55:11 +00:00
|
|
|
glColor3ubv((unsigned char*)wcol->outline);
|
2010-07-04 20:59:10 +00:00
|
|
|
glutil_draw_lined_arc(0.0f, M_PI*2.0, radius, tot + 1);
|
2009-06-12 14:22:27 +00:00
|
|
|
glDisable(GL_BLEND);
|
|
|
|
glDisable(GL_LINE_SMOOTH );
|
|
|
|
glPopMatrix();
|
|
|
|
|
|
|
|
/* cursor */
|
2011-03-27 14:52:16 +00:00
|
|
|
ang= 2.0f*(float)M_PI*hsvo[0] + 0.5f*(float)M_PI;
|
2010-07-05 15:52:25 +00:00
|
|
|
|
|
|
|
if(but->flag & UI_BUT_COLOR_CUBIC)
|
2011-12-21 13:49:22 +00:00
|
|
|
cursor_radius = (1.0f - powf(1.0f - hsvo[1], 3.0f));
|
2010-07-05 15:52:25 +00:00
|
|
|
else
|
2011-12-21 13:49:22 +00:00
|
|
|
cursor_radius = hsvo[1];
|
2010-07-05 15:52:25 +00:00
|
|
|
|
2011-12-21 13:49:22 +00:00
|
|
|
radius= CLAMPIS(cursor_radius, 0.0f, 1.0f) * radius;
|
2011-03-27 14:52:16 +00:00
|
|
|
ui_hsv_cursor(centx + cosf(-ang)*radius, centy + sinf(-ang)*radius);
|
2009-06-10 11:43:21 +00:00
|
|
|
}
|
|
|
|
|
2009-06-12 14:22:27 +00:00
|
|
|
/* ************ custom buttons, old stuff ************** */
|
|
|
|
|
2009-04-03 16:26:03 +00:00
|
|
|
/* draws in resolution of 20x4 colors */
|
2012-01-14 07:46:21 +00:00
|
|
|
void ui_draw_gradient(rcti *rect, const float hsv[3], int type, float alpha)
|
2009-04-03 16:26:03 +00:00
|
|
|
{
|
|
|
|
int a;
|
2010-10-28 12:01:02 +00:00
|
|
|
float h= hsv[0], s= hsv[1], v= hsv[2];
|
2010-01-21 00:00:45 +00:00
|
|
|
float dx, dy, sx1, sx2, sy;
|
2009-04-03 16:26:03 +00:00
|
|
|
float col0[4][3]; // left half, rect bottom to top
|
|
|
|
float col1[4][3]; // right half, rect bottom to top
|
2010-10-13 14:10:42 +00:00
|
|
|
|
2009-04-03 16:26:03 +00:00
|
|
|
/* draw series of gouraud rects */
|
|
|
|
glShadeModel(GL_SMOOTH);
|
|
|
|
|
2010-01-21 00:00:45 +00:00
|
|
|
switch(type) {
|
|
|
|
case UI_GRAD_SV:
|
|
|
|
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]);
|
|
|
|
break;
|
|
|
|
case UI_GRAD_HV:
|
|
|
|
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]);
|
|
|
|
break;
|
|
|
|
case UI_GRAD_HS:
|
|
|
|
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]);
|
|
|
|
break;
|
|
|
|
case UI_GRAD_H:
|
|
|
|
hsv_to_rgb(0.0, 1.0, 1.0, &col1[0][0], &col1[0][1], &col1[0][2]);
|
2011-11-06 16:34:44 +00:00
|
|
|
copy_v3_v3(col1[1], col1[0]);
|
|
|
|
copy_v3_v3(col1[2], col1[0]);
|
|
|
|
copy_v3_v3(col1[3], col1[0]);
|
2010-01-21 00:00:45 +00:00
|
|
|
break;
|
|
|
|
case UI_GRAD_S:
|
|
|
|
hsv_to_rgb(1.0, 0.0, 1.0, &col1[1][0], &col1[1][1], &col1[1][2]);
|
2011-11-06 16:34:44 +00:00
|
|
|
copy_v3_v3(col1[0], col1[1]);
|
|
|
|
copy_v3_v3(col1[2], col1[1]);
|
|
|
|
copy_v3_v3(col1[3], col1[1]);
|
2010-01-21 00:00:45 +00:00
|
|
|
break;
|
|
|
|
case UI_GRAD_V:
|
|
|
|
hsv_to_rgb(1.0, 1.0, 0.0, &col1[2][0], &col1[2][1], &col1[2][2]);
|
2011-11-06 16:34:44 +00:00
|
|
|
copy_v3_v3(col1[0], col1[2]);
|
|
|
|
copy_v3_v3(col1[1], col1[2]);
|
|
|
|
copy_v3_v3(col1[3], col1[2]);
|
2010-01-21 00:00:45 +00:00
|
|
|
break;
|
2010-10-17 08:59:23 +00:00
|
|
|
default:
|
|
|
|
assert(!"invalid 'type' argument");
|
|
|
|
hsv_to_rgb(1.0, 1.0, 1.0, &col1[2][0], &col1[2][1], &col1[2][2]);
|
2011-11-06 16:34:44 +00:00
|
|
|
copy_v3_v3(col1[0], col1[2]);
|
|
|
|
copy_v3_v3(col1[1], col1[2]);
|
|
|
|
copy_v3_v3(col1[3], col1[2]);
|
2010-01-09 06:44:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* old below */
|
2009-04-03 16:26:03 +00:00
|
|
|
|
2011-03-27 14:52:16 +00:00
|
|
|
for(dx=0.0f; dx<1.0f; dx+= 0.05f) {
|
2009-04-03 16:26:03 +00:00
|
|
|
// previous color
|
2011-11-06 16:34:44 +00:00
|
|
|
copy_v3_v3(col0[0], col1[0]);
|
|
|
|
copy_v3_v3(col0[1], col1[1]);
|
|
|
|
copy_v3_v3(col0[2], col1[2]);
|
|
|
|
copy_v3_v3(col0[3], col1[3]);
|
2009-04-03 16:26:03 +00:00
|
|
|
|
|
|
|
// new color
|
2010-01-21 00:00:45 +00:00
|
|
|
switch(type) {
|
|
|
|
case UI_GRAD_SV:
|
|
|
|
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]);
|
|
|
|
break;
|
|
|
|
case UI_GRAD_HV:
|
|
|
|
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]);
|
|
|
|
break;
|
|
|
|
case UI_GRAD_HS:
|
|
|
|
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]);
|
|
|
|
break;
|
|
|
|
case UI_GRAD_H:
|
|
|
|
hsv_to_rgb(dx, 1.0, 1.0, &col1[0][0], &col1[0][1], &col1[0][2]);
|
2011-11-06 16:34:44 +00:00
|
|
|
copy_v3_v3(col1[1], col1[0]);
|
|
|
|
copy_v3_v3(col1[2], col1[0]);
|
|
|
|
copy_v3_v3(col1[3], col1[0]);
|
2010-01-21 00:00:45 +00:00
|
|
|
break;
|
|
|
|
case UI_GRAD_S:
|
|
|
|
hsv_to_rgb(h, dx, 1.0, &col1[1][0], &col1[1][1], &col1[1][2]);
|
2011-11-06 16:34:44 +00:00
|
|
|
copy_v3_v3(col1[0], col1[1]);
|
|
|
|
copy_v3_v3(col1[2], col1[1]);
|
|
|
|
copy_v3_v3(col1[3], col1[1]);
|
2010-01-21 00:00:45 +00:00
|
|
|
break;
|
|
|
|
case UI_GRAD_V:
|
|
|
|
hsv_to_rgb(h, 1.0, dx, &col1[2][0], &col1[2][1], &col1[2][2]);
|
2011-11-06 16:34:44 +00:00
|
|
|
copy_v3_v3(col1[0], col1[2]);
|
|
|
|
copy_v3_v3(col1[1], col1[2]);
|
|
|
|
copy_v3_v3(col1[3], col1[2]);
|
2010-01-21 00:00:45 +00:00
|
|
|
break;
|
2010-01-09 06:44:54 +00:00
|
|
|
}
|
2009-04-03 16:26:03 +00:00
|
|
|
|
|
|
|
// rect
|
2009-04-12 13:40:29 +00:00
|
|
|
sx1= rect->xmin + dx*(rect->xmax-rect->xmin);
|
2011-03-27 14:52:16 +00:00
|
|
|
sx2= rect->xmin + (dx+0.05f)*(rect->xmax-rect->xmin);
|
2009-04-12 13:40:29 +00:00
|
|
|
sy= rect->ymin;
|
|
|
|
dy= (rect->ymax-rect->ymin)/3.0;
|
2009-04-03 16:26:03 +00:00
|
|
|
|
|
|
|
glBegin(GL_QUADS);
|
|
|
|
for(a=0; a<3; a++, sy+=dy) {
|
2010-01-21 00:00:45 +00:00
|
|
|
glColor4f(col0[a][0], col0[a][1], col0[a][2], alpha);
|
2009-04-03 16:26:03 +00:00
|
|
|
glVertex2f(sx1, sy);
|
|
|
|
|
2010-01-21 00:00:45 +00:00
|
|
|
glColor4f(col1[a][0], col1[a][1], col1[a][2], alpha);
|
2009-04-03 16:26:03 +00:00
|
|
|
glVertex2f(sx2, sy);
|
2010-01-21 00:00:45 +00:00
|
|
|
|
|
|
|
glColor4f(col1[a+1][0], col1[a+1][1], col1[a+1][2], alpha);
|
2009-04-03 16:26:03 +00:00
|
|
|
glVertex2f(sx2, sy+dy);
|
|
|
|
|
2010-01-21 00:00:45 +00:00
|
|
|
glColor4f(col0[a+1][0], col0[a+1][1], col0[a+1][2], alpha);
|
2009-04-03 16:26:03 +00:00
|
|
|
glVertex2f(sx1, sy+dy);
|
|
|
|
}
|
|
|
|
glEnd();
|
|
|
|
}
|
|
|
|
|
|
|
|
glShadeModel(GL_FLAT);
|
|
|
|
|
2010-01-21 00:00:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void ui_draw_but_HSVCUBE(uiBut *but, rcti *rect)
|
|
|
|
{
|
|
|
|
float rgb[3], h,s,v;
|
|
|
|
float x=0.0f, y=0.0f;
|
2010-10-13 13:53:49 +00:00
|
|
|
float *hsv= ui_block_hsv_get(but->block);
|
2010-10-13 14:10:42 +00:00
|
|
|
float hsvn[3];
|
2010-10-13 13:53:49 +00:00
|
|
|
|
|
|
|
h= hsv[0];
|
|
|
|
s= hsv[1];
|
|
|
|
v= hsv[2];
|
2010-01-21 00:00:45 +00:00
|
|
|
|
|
|
|
ui_get_but_vectorf(but, rgb);
|
2010-10-13 13:53:49 +00:00
|
|
|
rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], &h, &s, &v);
|
2010-10-13 14:10:42 +00:00
|
|
|
|
|
|
|
hsvn[0]= h;
|
|
|
|
hsvn[1]= s;
|
|
|
|
hsvn[2]= v;
|
2010-01-21 00:00:45 +00:00
|
|
|
|
2010-10-13 14:10:42 +00:00
|
|
|
ui_draw_gradient(rect, hsvn, but->a1, 1.f);
|
2010-01-21 00:00:45 +00:00
|
|
|
|
|
|
|
switch((int)but->a1) {
|
|
|
|
case UI_GRAD_SV:
|
|
|
|
x= v; y= s; break;
|
|
|
|
case UI_GRAD_HV:
|
|
|
|
x= h; y= v; break;
|
|
|
|
case UI_GRAD_HS:
|
|
|
|
x= h; y= s; break;
|
|
|
|
case UI_GRAD_H:
|
|
|
|
x= h; y= 0.5; break;
|
|
|
|
case UI_GRAD_S:
|
|
|
|
x= s; y= 0.5; break;
|
|
|
|
case UI_GRAD_V:
|
|
|
|
x= v; y= 0.5; break;
|
|
|
|
}
|
|
|
|
|
2009-04-03 16:26:03 +00:00
|
|
|
/* cursor */
|
2009-04-12 13:40:29 +00:00
|
|
|
x= rect->xmin + x*(rect->xmax-rect->xmin);
|
|
|
|
y= rect->ymin + y*(rect->ymax-rect->ymin);
|
2011-03-27 14:52:16 +00:00
|
|
|
CLAMP(x, rect->xmin+3.0f, rect->xmax-3.0f);
|
|
|
|
CLAMP(y, rect->ymin+3.0f, rect->ymax-3.0f);
|
2009-04-03 16:26:03 +00:00
|
|
|
|
2009-06-12 14:22:27 +00:00
|
|
|
ui_hsv_cursor(x, y);
|
2009-04-03 16:26:03 +00:00
|
|
|
|
|
|
|
/* outline */
|
|
|
|
glColor3ub(0, 0, 0);
|
2009-04-12 13:40:29 +00:00
|
|
|
fdrawbox((rect->xmin), (rect->ymin), (rect->xmax), (rect->ymax));
|
2009-04-03 16:26:03 +00:00
|
|
|
}
|
|
|
|
|
2009-06-12 14:22:27 +00:00
|
|
|
/* vertical 'value' slider, using new widget code */
|
|
|
|
static void ui_draw_but_HSV_v(uiBut *but, rcti *rect)
|
|
|
|
{
|
|
|
|
uiWidgetBase wtb;
|
|
|
|
float rad= 0.5f*(rect->xmax - rect->xmin);
|
|
|
|
float x, y;
|
2010-01-27 00:22:29 +00:00
|
|
|
float rgb[3], hsv[3], v, range;
|
Changes to Color Management
After testing and feedback, I've decided to slightly modify the way color
management works internally. While the previous method worked well for
rendering, was a smaller transition and had some advantages over this
new method, it was a bit more ambiguous, and was making things difficult
for other areas such as compositing.
This implementation now considers all color data (with only a couple of
exceptions such as brush colors) to be stored in linear RGB color space,
rather than sRGB as previously. This brings it in line with Nuke, which also
operates this way, quite successfully. Color swatches, pickers, color ramp
display are now gamma corrected to display gamma so you can see what
you're doing, but the numbers themselves are considered linear. This
makes understanding blending modes more clear (a 0.5 value on overlay
will not change the result now) as well as making color swatches act more
predictably in the compositor, however bringing over color values from
applications like photoshop or gimp, that operate in a gamma space,
will give identical results.
This commit will convert over existing files saved by earlier 2.5 versions to
work generally the same, though there may be some slight differences with
things like textures. Now that we're set on changing other areas of shading,
this won't be too disruptive overall.
I've made a diagram explaining the pipeline here:
http://mke3.net/blender/devel/2.5/25_linear_workflow_pipeline.png
and some docs here:
http://www.blender.org/development/release-logs/blender-250/color-management/
2009-12-02 07:56:34 +00:00
|
|
|
int color_profile = but->block->color_profile;
|
|
|
|
|
2010-08-25 07:49:12 +00:00
|
|
|
if (but->rnaprop && RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA)
|
|
|
|
color_profile = BLI_PR_NONE;
|
Changes to Color Management
After testing and feedback, I've decided to slightly modify the way color
management works internally. While the previous method worked well for
rendering, was a smaller transition and had some advantages over this
new method, it was a bit more ambiguous, and was making things difficult
for other areas such as compositing.
This implementation now considers all color data (with only a couple of
exceptions such as brush colors) to be stored in linear RGB color space,
rather than sRGB as previously. This brings it in line with Nuke, which also
operates this way, quite successfully. Color swatches, pickers, color ramp
display are now gamma corrected to display gamma so you can see what
you're doing, but the numbers themselves are considered linear. This
makes understanding blending modes more clear (a 0.5 value on overlay
will not change the result now) as well as making color swatches act more
predictably in the compositor, however bringing over color values from
applications like photoshop or gimp, that operate in a gamma space,
will give identical results.
This commit will convert over existing files saved by earlier 2.5 versions to
work generally the same, though there may be some slight differences with
things like textures. Now that we're set on changing other areas of shading,
this won't be too disruptive overall.
I've made a diagram explaining the pipeline here:
http://mke3.net/blender/devel/2.5/25_linear_workflow_pipeline.png
and some docs here:
http://www.blender.org/development/release-logs/blender-250/color-management/
2009-12-02 07:56:34 +00:00
|
|
|
|
2010-01-07 09:55:11 +00:00
|
|
|
ui_get_but_vectorf(but, rgb);
|
|
|
|
rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
|
|
|
|
v = hsv[2];
|
|
|
|
|
Changes to Color Management
After testing and feedback, I've decided to slightly modify the way color
management works internally. While the previous method worked well for
rendering, was a smaller transition and had some advantages over this
new method, it was a bit more ambiguous, and was making things difficult
for other areas such as compositing.
This implementation now considers all color data (with only a couple of
exceptions such as brush colors) to be stored in linear RGB color space,
rather than sRGB as previously. This brings it in line with Nuke, which also
operates this way, quite successfully. Color swatches, pickers, color ramp
display are now gamma corrected to display gamma so you can see what
you're doing, but the numbers themselves are considered linear. This
makes understanding blending modes more clear (a 0.5 value on overlay
will not change the result now) as well as making color swatches act more
predictably in the compositor, however bringing over color values from
applications like photoshop or gimp, that operate in a gamma space,
will give identical results.
This commit will convert over existing files saved by earlier 2.5 versions to
work generally the same, though there may be some slight differences with
things like textures. Now that we're set on changing other areas of shading,
this won't be too disruptive overall.
I've made a diagram explaining the pipeline here:
http://mke3.net/blender/devel/2.5/25_linear_workflow_pipeline.png
and some docs here:
http://www.blender.org/development/release-logs/blender-250/color-management/
2009-12-02 07:56:34 +00:00
|
|
|
if (color_profile)
|
|
|
|
v = linearrgb_to_srgb(v);
|
2010-01-27 00:22:29 +00:00
|
|
|
|
|
|
|
/* map v from property range to [0,1] */
|
|
|
|
range = but->softmax - but->softmin;
|
|
|
|
v = (v - but->softmin)/range;
|
2009-06-12 14:22:27 +00:00
|
|
|
|
|
|
|
widget_init(&wtb);
|
|
|
|
|
|
|
|
/* fully rounded */
|
2011-09-11 06:41:09 +00:00
|
|
|
round_box_edges(&wtb, UI_CNR_ALL, rect, rad);
|
2009-06-12 14:22:27 +00:00
|
|
|
|
|
|
|
/* setup temp colors */
|
|
|
|
wcol_tmp.outline[0]= wcol_tmp.outline[1]= wcol_tmp.outline[2]= 0;
|
|
|
|
wcol_tmp.inner[0]= wcol_tmp.inner[1]= wcol_tmp.inner[2]= 128;
|
|
|
|
wcol_tmp.shadetop= 127;
|
|
|
|
wcol_tmp.shadedown= -128;
|
|
|
|
wcol_tmp.shaded= 1;
|
|
|
|
|
|
|
|
widgetbase_draw(&wtb, &wcol_tmp);
|
|
|
|
|
|
|
|
/* cursor */
|
Changes to Color Management
After testing and feedback, I've decided to slightly modify the way color
management works internally. While the previous method worked well for
rendering, was a smaller transition and had some advantages over this
new method, it was a bit more ambiguous, and was making things difficult
for other areas such as compositing.
This implementation now considers all color data (with only a couple of
exceptions such as brush colors) to be stored in linear RGB color space,
rather than sRGB as previously. This brings it in line with Nuke, which also
operates this way, quite successfully. Color swatches, pickers, color ramp
display are now gamma corrected to display gamma so you can see what
you're doing, but the numbers themselves are considered linear. This
makes understanding blending modes more clear (a 0.5 value on overlay
will not change the result now) as well as making color swatches act more
predictably in the compositor, however bringing over color values from
applications like photoshop or gimp, that operate in a gamma space,
will give identical results.
This commit will convert over existing files saved by earlier 2.5 versions to
work generally the same, though there may be some slight differences with
things like textures. Now that we're set on changing other areas of shading,
this won't be too disruptive overall.
I've made a diagram explaining the pipeline here:
http://mke3.net/blender/devel/2.5/25_linear_workflow_pipeline.png
and some docs here:
http://www.blender.org/development/release-logs/blender-250/color-management/
2009-12-02 07:56:34 +00:00
|
|
|
x= rect->xmin + 0.5f * (rect->xmax-rect->xmin);
|
|
|
|
y= rect->ymin + v * (rect->ymax-rect->ymin);
|
2011-03-27 14:52:16 +00:00
|
|
|
CLAMP(y, rect->ymin+3.0f, rect->ymax-3.0f);
|
2009-06-12 14:22:27 +00:00
|
|
|
|
|
|
|
ui_hsv_cursor(x, y);
|
|
|
|
|
|
|
|
}
|
2009-04-02 15:01:11 +00:00
|
|
|
|
2010-01-19 01:32:06 +00:00
|
|
|
|
2010-01-11 01:26:16 +00:00
|
|
|
/* ************ separator, for menus etc ***************** */
|
2010-10-16 02:40:31 +00:00
|
|
|
static void ui_draw_separator(rcti *rect, uiWidgetColors *wcol)
|
2010-01-11 01:26:16 +00:00
|
|
|
{
|
|
|
|
int y = rect->ymin + (rect->ymax - rect->ymin)/2 - 1;
|
2010-01-14 21:30:51 +00:00
|
|
|
unsigned char col[4];
|
2010-01-11 01:26:16 +00:00
|
|
|
|
|
|
|
col[0] = wcol->text[0];
|
|
|
|
col[1] = wcol->text[1];
|
|
|
|
col[2] = wcol->text[2];
|
|
|
|
col[3] = 7;
|
|
|
|
|
|
|
|
glEnable(GL_BLEND);
|
|
|
|
glColor4ubv(col);
|
|
|
|
sdrawline(rect->xmin, y, rect->xmax, y);
|
|
|
|
glDisable(GL_BLEND);
|
|
|
|
}
|
|
|
|
|
2009-04-02 15:01:11 +00:00
|
|
|
/* ************ button callbacks, draw ***************** */
|
|
|
|
|
|
|
|
static void widget_numbut(uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign)
|
|
|
|
{
|
|
|
|
uiWidgetBase wtb;
|
2009-06-08 12:39:39 +00:00
|
|
|
float rad= 0.5f*(rect->ymax - rect->ymin);
|
2011-03-27 14:52:16 +00:00
|
|
|
float textofs = rad*0.75f;
|
2009-11-11 10:27:25 +00:00
|
|
|
|
2010-09-11 00:08:07 +00:00
|
|
|
if(state & UI_SELECT)
|
|
|
|
SWAP(short, wcol->shadetop, wcol->shadedown);
|
|
|
|
|
2009-04-02 15:01:11 +00:00
|
|
|
widget_init(&wtb);
|
2009-03-25 16:58:42 +00:00
|
|
|
|
|
|
|
/* fully rounded */
|
2009-06-08 12:39:39 +00:00
|
|
|
round_box_edges(&wtb, roundboxalign, rect, rad);
|
2009-03-25 16:58:42 +00:00
|
|
|
|
|
|
|
/* decoration */
|
2009-04-02 15:01:11 +00:00
|
|
|
if(!(state & UI_TEXTINPUT)) {
|
2009-07-03 13:21:09 +00:00
|
|
|
widget_num_tria(&wtb.tria1, rect, 0.6f, 'l');
|
2009-04-02 15:01:11 +00:00
|
|
|
widget_num_tria(&wtb.tria2, rect, 0.6f, 'r');
|
2009-11-12 00:48:44 +00:00
|
|
|
}
|
|
|
|
|
2009-04-02 18:16:15 +00:00
|
|
|
widgetbase_draw(&wtb, wcol);
|
2009-04-09 18:11:18 +00:00
|
|
|
|
|
|
|
/* text space */
|
2009-11-12 00:48:44 +00:00
|
|
|
rect->xmin += textofs;
|
|
|
|
rect->xmax -= textofs;
|
2009-04-02 18:16:15 +00:00
|
|
|
}
|
|
|
|
|
2010-01-19 11:24:42 +00:00
|
|
|
//static int ui_link_bezier_points(rcti *rect, float coord_array[][2], int resol)
|
|
|
|
int ui_link_bezier_points(rcti *rect, float coord_array[][2], int resol)
|
2009-06-17 11:01:05 +00:00
|
|
|
{
|
|
|
|
float dist, vec[4][2];
|
|
|
|
|
|
|
|
vec[0][0]= rect->xmin;
|
|
|
|
vec[0][1]= rect->ymin;
|
|
|
|
vec[3][0]= rect->xmax;
|
|
|
|
vec[3][1]= rect->ymax;
|
|
|
|
|
|
|
|
dist= 0.5f*ABS(vec[0][0] - vec[3][0]);
|
|
|
|
|
|
|
|
vec[1][0]= vec[0][0]+dist;
|
|
|
|
vec[1][1]= vec[0][1];
|
|
|
|
|
|
|
|
vec[2][0]= vec[3][0]-dist;
|
|
|
|
vec[2][1]= vec[3][1];
|
|
|
|
|
2009-09-11 14:56:54 +00:00
|
|
|
forward_diff_bezier(vec[0][0], vec[1][0], vec[2][0], vec[3][0], coord_array[0], resol, sizeof(float)*2);
|
|
|
|
forward_diff_bezier(vec[0][1], vec[1][1], vec[2][1], vec[3][1], coord_array[0]+1, resol, sizeof(float)*2);
|
2009-06-17 11:01:05 +00:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define LINK_RESOL 24
|
|
|
|
void ui_draw_link_bezier(rcti *rect)
|
|
|
|
{
|
|
|
|
float coord_array[LINK_RESOL+1][2];
|
|
|
|
|
|
|
|
if(ui_link_bezier_points(rect, coord_array, LINK_RESOL)) {
|
|
|
|
/* we can reuse the dist variable here to increment the GL curve eval amount*/
|
2011-03-28 02:34:55 +00:00
|
|
|
// const float dist= 1.0f/(float)LINK_RESOL; // UNUSED
|
|
|
|
|
2009-06-17 11:01:05 +00:00
|
|
|
glEnable(GL_BLEND);
|
|
|
|
glEnable(GL_LINE_SMOOTH);
|
2011-09-09 14:44:36 +00:00
|
|
|
|
|
|
|
glEnableClientState(GL_VERTEX_ARRAY);
|
|
|
|
glVertexPointer(2, GL_FLOAT, 0, coord_array);
|
|
|
|
glDrawArrays(GL_LINE_STRIP, 0, LINK_RESOL);
|
|
|
|
glDisableClientState(GL_VERTEX_ARRAY);
|
|
|
|
|
2009-06-17 11:01:05 +00:00
|
|
|
glDisable(GL_BLEND);
|
|
|
|
glDisable(GL_LINE_SMOOTH);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-07-02 18:12:46 +00:00
|
|
|
/* function in use for buttons and for view2d sliders */
|
2009-07-03 10:54:39 +00:00
|
|
|
void uiWidgetScrollDraw(uiWidgetColors *wcol, rcti *rect, rcti *slider, int state)
|
2009-06-24 14:16:56 +00:00
|
|
|
{
|
|
|
|
uiWidgetBase wtb;
|
2009-07-02 18:12:46 +00:00
|
|
|
float rad;
|
2009-06-24 14:16:56 +00:00
|
|
|
int horizontal;
|
2010-05-27 08:22:16 +00:00
|
|
|
short outline=0;
|
2009-06-24 14:16:56 +00:00
|
|
|
|
2009-07-02 18:12:46 +00:00
|
|
|
widget_init(&wtb);
|
|
|
|
|
2009-06-24 14:16:56 +00:00
|
|
|
/* determine horizontal/vertical */
|
|
|
|
horizontal= (rect->xmax - rect->xmin > rect->ymax - rect->ymin);
|
2009-07-02 18:12:46 +00:00
|
|
|
|
2009-06-24 14:16:56 +00:00
|
|
|
if(horizontal)
|
|
|
|
rad= 0.5f*(rect->ymax - rect->ymin);
|
|
|
|
else
|
|
|
|
rad= 0.5f*(rect->xmax - rect->xmin);
|
2009-07-02 18:12:46 +00:00
|
|
|
|
2009-06-24 14:16:56 +00:00
|
|
|
wtb.shadedir= (horizontal)? 1: 0;
|
2009-07-02 18:12:46 +00:00
|
|
|
|
2009-06-24 14:16:56 +00:00
|
|
|
/* draw back part, colors swapped and shading inverted */
|
|
|
|
if(horizontal)
|
|
|
|
SWAP(short, wcol->shadetop, wcol->shadedown);
|
|
|
|
|
2011-09-11 06:41:09 +00:00
|
|
|
round_box_edges(&wtb, UI_CNR_ALL, rect, rad);
|
2009-06-24 14:16:56 +00:00
|
|
|
widgetbase_draw(&wtb, wcol);
|
|
|
|
|
2009-07-02 18:12:46 +00:00
|
|
|
/* slider */
|
|
|
|
if(slider->xmax-slider->xmin<2 || slider->ymax-slider->ymin<2);
|
|
|
|
else {
|
|
|
|
|
|
|
|
SWAP(short, wcol->shadetop, wcol->shadedown);
|
|
|
|
|
2011-11-07 01:38:32 +00:00
|
|
|
copy_v4_v4_char(wcol->inner, wcol->item);
|
2009-07-02 18:12:46 +00:00
|
|
|
|
|
|
|
if(wcol->shadetop>wcol->shadedown)
|
|
|
|
wcol->shadetop+= 20; /* XXX violates themes... */
|
|
|
|
else wcol->shadedown+= 20;
|
|
|
|
|
2009-07-23 20:50:24 +00:00
|
|
|
if(state & UI_SCROLL_PRESSED) {
|
|
|
|
wcol->inner[0]= wcol->inner[0]>=250? 255 : wcol->inner[0]+5;
|
|
|
|
wcol->inner[1]= wcol->inner[1]>=250? 255 : wcol->inner[1]+5;
|
|
|
|
wcol->inner[2]= wcol->inner[2]>=250? 255 : wcol->inner[2]+5;
|
|
|
|
}
|
2009-07-02 18:12:46 +00:00
|
|
|
|
|
|
|
/* draw */
|
|
|
|
wtb.emboss= 0; /* only emboss once */
|
|
|
|
|
2010-05-27 08:22:16 +00:00
|
|
|
/* exception for progress bar */
|
|
|
|
if (state & UI_SCROLL_NO_OUTLINE)
|
|
|
|
SWAP(short, outline, wtb.outline);
|
|
|
|
|
2011-09-11 06:41:09 +00:00
|
|
|
round_box_edges(&wtb, UI_CNR_ALL, slider, rad);
|
2009-07-02 18:12:46 +00:00
|
|
|
|
2009-07-03 13:21:09 +00:00
|
|
|
if(state & UI_SCROLL_ARROWS) {
|
|
|
|
if(wcol->item[0] > 48) wcol->item[0]-= 48;
|
|
|
|
if(wcol->item[1] > 48) wcol->item[1]-= 48;
|
|
|
|
if(wcol->item[2] > 48) wcol->item[2]-= 48;
|
|
|
|
wcol->item[3]= 255;
|
|
|
|
|
|
|
|
if(horizontal) {
|
2009-09-14 12:28:59 +00:00
|
|
|
widget_scroll_circle(&wtb.tria1, slider, 0.6f, 'l');
|
|
|
|
widget_scroll_circle(&wtb.tria2, slider, 0.6f, 'r');
|
2009-07-03 13:21:09 +00:00
|
|
|
}
|
|
|
|
else {
|
2009-09-14 12:28:59 +00:00
|
|
|
widget_scroll_circle(&wtb.tria1, slider, 0.6f, 'b');
|
|
|
|
widget_scroll_circle(&wtb.tria2, slider, 0.6f, 't');
|
2009-07-03 13:21:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
widgetbase_draw(&wtb, wcol);
|
2010-05-27 08:22:16 +00:00
|
|
|
|
|
|
|
if (state & UI_SCROLL_NO_OUTLINE)
|
|
|
|
SWAP(short, outline, wtb.outline);
|
2009-07-02 18:12:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-10-16 02:40:31 +00:00
|
|
|
static void widget_scroll(uiBut *but, uiWidgetColors *wcol, rcti *rect, int state, int UNUSED(roundboxalign))
|
2009-07-02 18:12:46 +00:00
|
|
|
{
|
|
|
|
rcti rect1;
|
|
|
|
double value;
|
2009-07-21 01:26:17 +00:00
|
|
|
float fac, size, min;
|
2009-07-02 18:12:46 +00:00
|
|
|
int horizontal;
|
|
|
|
|
|
|
|
/* calculate slider part */
|
2009-06-24 14:16:56 +00:00
|
|
|
value= ui_get_but_val(but);
|
|
|
|
|
|
|
|
size= (but->softmax + but->a1 - but->softmin);
|
|
|
|
size= MAX2(size, 2);
|
|
|
|
|
|
|
|
/* position */
|
|
|
|
rect1= *rect;
|
|
|
|
|
2009-07-02 18:12:46 +00:00
|
|
|
/* determine horizontal/vertical */
|
|
|
|
horizontal= (rect->xmax - rect->xmin > rect->ymax - rect->ymin);
|
|
|
|
|
2009-06-24 14:16:56 +00:00
|
|
|
if(horizontal) {
|
2009-07-01 22:25:49 +00:00
|
|
|
fac= (rect->xmax - rect->xmin)/(size);
|
2012-03-24 02:51:46 +00:00
|
|
|
rect1.xmin = rect1.xmin + ceilf(fac*((float)value - but->softmin));
|
|
|
|
rect1.xmax = rect1.xmin + ceilf(fac*(but->a1 - but->softmin));
|
2009-07-21 01:26:17 +00:00
|
|
|
|
|
|
|
/* ensure minimium size */
|
|
|
|
min= rect->ymax - rect->ymin;
|
|
|
|
|
|
|
|
if(rect1.xmax - rect1.xmin < min) {
|
2012-03-24 02:51:46 +00:00
|
|
|
rect1.xmax = rect1.xmin + min;
|
2009-07-21 01:26:17 +00:00
|
|
|
|
|
|
|
if(rect1.xmax > rect->xmax) {
|
2012-03-24 02:51:46 +00:00
|
|
|
rect1.xmax = rect->xmax;
|
|
|
|
rect1.xmin = MAX2(rect1.xmax - min, rect->xmin);
|
2009-07-21 01:26:17 +00:00
|
|
|
}
|
|
|
|
}
|
2009-06-24 14:16:56 +00:00
|
|
|
}
|
|
|
|
else {
|
2009-07-01 22:25:49 +00:00
|
|
|
fac= (rect->ymax - rect->ymin)/(size);
|
2012-03-24 02:51:46 +00:00
|
|
|
rect1.ymax = rect1.ymax - ceilf(fac*((float)value - but->softmin));
|
|
|
|
rect1.ymin = rect1.ymax - ceilf(fac*(but->a1 - but->softmin));
|
2009-07-21 01:26:17 +00:00
|
|
|
|
|
|
|
/* ensure minimium size */
|
|
|
|
min= rect->xmax - rect->xmin;
|
|
|
|
|
|
|
|
if(rect1.ymax - rect1.ymin < min) {
|
2012-03-24 02:51:46 +00:00
|
|
|
rect1.ymax = rect1.ymin + min;
|
2009-07-21 01:26:17 +00:00
|
|
|
|
|
|
|
if(rect1.ymax > rect->ymax) {
|
2012-03-24 02:51:46 +00:00
|
|
|
rect1.ymax = rect->ymax;
|
|
|
|
rect1.ymin = MAX2(rect1.ymax - min, rect->ymin);
|
2009-07-21 01:26:17 +00:00
|
|
|
}
|
|
|
|
}
|
2009-06-24 14:16:56 +00:00
|
|
|
}
|
|
|
|
|
2009-07-03 13:21:09 +00:00
|
|
|
if(state & UI_SELECT)
|
|
|
|
state= UI_SCROLL_PRESSED;
|
|
|
|
else
|
|
|
|
state= 0;
|
2009-07-03 10:54:39 +00:00
|
|
|
uiWidgetScrollDraw(wcol, rect, &rect1, state);
|
2009-06-24 14:16:56 +00:00
|
|
|
}
|
2009-06-17 11:01:05 +00:00
|
|
|
|
2010-10-16 02:40:31 +00:00
|
|
|
static void widget_progressbar(uiBut *but, uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int UNUSED(roundboxalign))
|
2009-06-17 11:01:05 +00:00
|
|
|
{
|
2010-05-27 08:22:16 +00:00
|
|
|
rcti rect_prog = *rect, rect_bar = *rect;
|
|
|
|
float value = but->a1;
|
|
|
|
float w, min;
|
|
|
|
|
|
|
|
/* make the progress bar a proportion of the original height */
|
|
|
|
/* hardcoded 4px high for now */
|
|
|
|
rect_prog.ymax = rect_prog.ymin + 4;
|
|
|
|
rect_bar.ymax = rect_bar.ymin + 4;
|
|
|
|
|
|
|
|
w = value * (rect_prog.xmax - rect_prog.xmin);
|
|
|
|
|
|
|
|
/* ensure minimium size */
|
|
|
|
min= rect_prog.ymax - rect_prog.ymin;
|
|
|
|
w = MAX2(w, min);
|
|
|
|
|
|
|
|
rect_bar.xmax = rect_bar.xmin + w;
|
|
|
|
|
|
|
|
uiWidgetScrollDraw(wcol, &rect_prog, &rect_bar, UI_SCROLL_NO_OUTLINE);
|
|
|
|
|
|
|
|
/* raise text a bit */
|
|
|
|
rect->ymin += 6;
|
|
|
|
rect->xmin -= 6;
|
|
|
|
}
|
2009-06-17 11:01:05 +00:00
|
|
|
|
2010-10-16 02:40:31 +00:00
|
|
|
static void widget_link(uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *rect, int UNUSED(state), int UNUSED(roundboxalign))
|
2010-05-27 08:22:16 +00:00
|
|
|
{
|
|
|
|
|
2009-06-17 11:01:05 +00:00
|
|
|
if(but->flag & UI_SELECT) {
|
|
|
|
rcti rectlink;
|
|
|
|
|
|
|
|
UI_ThemeColor(TH_TEXT_HI);
|
|
|
|
|
2012-03-24 02:51:46 +00:00
|
|
|
rectlink.xmin = (rect->xmin+rect->xmax)/2;
|
|
|
|
rectlink.ymin = (rect->ymin+rect->ymax)/2;
|
|
|
|
rectlink.xmax = but->linkto[0];
|
|
|
|
rectlink.ymax = but->linkto[1];
|
2009-06-17 11:01:05 +00:00
|
|
|
|
|
|
|
ui_draw_link_bezier(&rectlink);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-04-02 18:16:15 +00:00
|
|
|
static void widget_numslider(uiBut *but, uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign)
|
|
|
|
{
|
|
|
|
uiWidgetBase wtb, wtb1;
|
|
|
|
rcti rect1;
|
|
|
|
double value;
|
2010-10-05 15:44:58 +00:00
|
|
|
float offs, toffs, fac;
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
char outline[3];
|
2011-04-25 11:52:42 +00:00
|
|
|
|
2009-04-02 18:16:15 +00:00
|
|
|
widget_init(&wtb);
|
|
|
|
widget_init(&wtb1);
|
|
|
|
|
|
|
|
/* backdrop first */
|
|
|
|
|
|
|
|
/* fully rounded */
|
|
|
|
offs= 0.5f*(rect->ymax - rect->ymin);
|
2010-10-05 15:44:58 +00:00
|
|
|
toffs = offs*0.75f;
|
2009-04-02 18:16:15 +00:00
|
|
|
round_box_edges(&wtb, roundboxalign, rect, offs);
|
2009-03-25 16:58:42 +00:00
|
|
|
|
2009-04-02 18:16:15 +00:00
|
|
|
wtb.outline= 0;
|
|
|
|
widgetbase_draw(&wtb, wcol);
|
|
|
|
|
2011-06-11 12:10:01 +00:00
|
|
|
/* draw left/right parts only when not in text editing */
|
|
|
|
if(!(state & UI_TEXTINPUT)) {
|
|
|
|
|
|
|
|
/* slider part */
|
2011-11-07 01:38:32 +00:00
|
|
|
copy_v3_v3_char(outline, wcol->outline);
|
|
|
|
copy_v3_v3_char(wcol->outline, wcol->item);
|
|
|
|
copy_v3_v3_char(wcol->inner, wcol->item);
|
2010-09-07 11:14:20 +00:00
|
|
|
|
2011-06-11 12:10:01 +00:00
|
|
|
if(!(state & UI_SELECT))
|
|
|
|
SWAP(short, wcol->shadetop, wcol->shadedown);
|
|
|
|
|
|
|
|
rect1= *rect;
|
|
|
|
|
|
|
|
value= ui_get_but_val(but);
|
|
|
|
fac= ((float)value-but->softmin)*(rect1.xmax - rect1.xmin - offs)/(but->softmax - but->softmin);
|
|
|
|
|
|
|
|
/* left part of slider, always rounded */
|
2012-03-24 02:51:46 +00:00
|
|
|
rect1.xmax = rect1.xmin + ceil(offs+1.0f);
|
2011-09-11 06:41:09 +00:00
|
|
|
round_box_edges(&wtb1, roundboxalign & ~(UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT), &rect1, offs);
|
2011-06-11 12:10:01 +00:00
|
|
|
wtb1.outline= 0;
|
|
|
|
widgetbase_draw(&wtb1, wcol);
|
|
|
|
|
|
|
|
/* right part of slider, interpolate roundness */
|
2012-03-24 02:51:46 +00:00
|
|
|
rect1.xmax = rect1.xmin + fac + offs;
|
2011-06-11 12:10:01 +00:00
|
|
|
rect1.xmin+= floor(offs-1.0f);
|
|
|
|
if(rect1.xmax + offs > rect->xmax)
|
|
|
|
offs*= (rect1.xmax + offs - rect->xmax)/offs;
|
|
|
|
else
|
|
|
|
offs= 0.0f;
|
2011-09-11 06:41:09 +00:00
|
|
|
round_box_edges(&wtb1, roundboxalign & ~(UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT), &rect1, offs);
|
2011-06-11 12:10:01 +00:00
|
|
|
|
|
|
|
widgetbase_draw(&wtb1, wcol);
|
2011-11-07 01:38:32 +00:00
|
|
|
copy_v3_v3_char(wcol->outline, outline);
|
2011-06-11 12:10:01 +00:00
|
|
|
|
|
|
|
if(!(state & UI_SELECT))
|
|
|
|
SWAP(short, wcol->shadetop, wcol->shadedown);
|
|
|
|
}
|
2009-04-02 18:16:15 +00:00
|
|
|
|
|
|
|
/* outline */
|
|
|
|
wtb.outline= 1;
|
|
|
|
wtb.inner= 0;
|
|
|
|
widgetbase_draw(&wtb, wcol);
|
|
|
|
|
2009-05-21 17:09:06 +00:00
|
|
|
/* text space */
|
2010-10-05 15:44:58 +00:00
|
|
|
rect->xmin += toffs;
|
|
|
|
rect->xmax -= toffs;
|
2009-03-25 16:58:42 +00:00
|
|
|
}
|
|
|
|
|
2010-09-30 12:10:18 +00:00
|
|
|
/* I think 3 is sufficient border to indicate keyed status */
|
|
|
|
#define SWATCH_KEYED_BORDER 3
|
|
|
|
|
2009-04-03 16:26:03 +00:00
|
|
|
static void widget_swatch(uiBut *but, uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign)
|
|
|
|
{
|
|
|
|
uiWidgetBase wtb;
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
float col[4];
|
Changes to Color Management
After testing and feedback, I've decided to slightly modify the way color
management works internally. While the previous method worked well for
rendering, was a smaller transition and had some advantages over this
new method, it was a bit more ambiguous, and was making things difficult
for other areas such as compositing.
This implementation now considers all color data (with only a couple of
exceptions such as brush colors) to be stored in linear RGB color space,
rather than sRGB as previously. This brings it in line with Nuke, which also
operates this way, quite successfully. Color swatches, pickers, color ramp
display are now gamma corrected to display gamma so you can see what
you're doing, but the numbers themselves are considered linear. This
makes understanding blending modes more clear (a 0.5 value on overlay
will not change the result now) as well as making color swatches act more
predictably in the compositor, however bringing over color values from
applications like photoshop or gimp, that operate in a gamma space,
will give identical results.
This commit will convert over existing files saved by earlier 2.5 versions to
work generally the same, though there may be some slight differences with
things like textures. Now that we're set on changing other areas of shading,
this won't be too disruptive overall.
I've made a diagram explaining the pipeline here:
http://mke3.net/blender/devel/2.5/25_linear_workflow_pipeline.png
and some docs here:
http://www.blender.org/development/release-logs/blender-250/color-management/
2009-12-02 07:56:34 +00:00
|
|
|
int color_profile = but->block->color_profile;
|
|
|
|
|
2010-06-26 17:12:55 +00:00
|
|
|
col[3]= 1.0f;
|
|
|
|
|
Changes to Color Management
After testing and feedback, I've decided to slightly modify the way color
management works internally. While the previous method worked well for
rendering, was a smaller transition and had some advantages over this
new method, it was a bit more ambiguous, and was making things difficult
for other areas such as compositing.
This implementation now considers all color data (with only a couple of
exceptions such as brush colors) to be stored in linear RGB color space,
rather than sRGB as previously. This brings it in line with Nuke, which also
operates this way, quite successfully. Color swatches, pickers, color ramp
display are now gamma corrected to display gamma so you can see what
you're doing, but the numbers themselves are considered linear. This
makes understanding blending modes more clear (a 0.5 value on overlay
will not change the result now) as well as making color swatches act more
predictably in the compositor, however bringing over color values from
applications like photoshop or gimp, that operate in a gamma space,
will give identical results.
This commit will convert over existing files saved by earlier 2.5 versions to
work generally the same, though there may be some slight differences with
things like textures. Now that we're set on changing other areas of shading,
this won't be too disruptive overall.
I've made a diagram explaining the pipeline here:
http://mke3.net/blender/devel/2.5/25_linear_workflow_pipeline.png
and some docs here:
http://www.blender.org/development/release-logs/blender-250/color-management/
2009-12-02 07:56:34 +00:00
|
|
|
if (but->rnaprop) {
|
|
|
|
if (RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA)
|
|
|
|
color_profile = BLI_PR_NONE;
|
2010-06-26 17:12:55 +00:00
|
|
|
|
|
|
|
if(RNA_property_array_length(&but->rnapoin, but->rnaprop)==4) {
|
|
|
|
col[3]= RNA_property_float_get_index(&but->rnapoin, but->rnaprop, 3);
|
|
|
|
}
|
Changes to Color Management
After testing and feedback, I've decided to slightly modify the way color
management works internally. While the previous method worked well for
rendering, was a smaller transition and had some advantages over this
new method, it was a bit more ambiguous, and was making things difficult
for other areas such as compositing.
This implementation now considers all color data (with only a couple of
exceptions such as brush colors) to be stored in linear RGB color space,
rather than sRGB as previously. This brings it in line with Nuke, which also
operates this way, quite successfully. Color swatches, pickers, color ramp
display are now gamma corrected to display gamma so you can see what
you're doing, but the numbers themselves are considered linear. This
makes understanding blending modes more clear (a 0.5 value on overlay
will not change the result now) as well as making color swatches act more
predictably in the compositor, however bringing over color values from
applications like photoshop or gimp, that operate in a gamma space,
will give identical results.
This commit will convert over existing files saved by earlier 2.5 versions to
work generally the same, though there may be some slight differences with
things like textures. Now that we're set on changing other areas of shading,
this won't be too disruptive overall.
I've made a diagram explaining the pipeline here:
http://mke3.net/blender/devel/2.5/25_linear_workflow_pipeline.png
and some docs here:
http://www.blender.org/development/release-logs/blender-250/color-management/
2009-12-02 07:56:34 +00:00
|
|
|
}
|
2009-04-03 16:26:03 +00:00
|
|
|
|
|
|
|
widget_init(&wtb);
|
|
|
|
|
|
|
|
/* half rounded */
|
2009-08-23 21:56:32 +00:00
|
|
|
round_box_edges(&wtb, roundboxalign, rect, 5.0f);
|
2009-04-03 16:26:03 +00:00
|
|
|
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
ui_get_but_vectorf(but, col);
|
Changes to Color Management
After testing and feedback, I've decided to slightly modify the way color
management works internally. While the previous method worked well for
rendering, was a smaller transition and had some advantages over this
new method, it was a bit more ambiguous, and was making things difficult
for other areas such as compositing.
This implementation now considers all color data (with only a couple of
exceptions such as brush colors) to be stored in linear RGB color space,
rather than sRGB as previously. This brings it in line with Nuke, which also
operates this way, quite successfully. Color swatches, pickers, color ramp
display are now gamma corrected to display gamma so you can see what
you're doing, but the numbers themselves are considered linear. This
makes understanding blending modes more clear (a 0.5 value on overlay
will not change the result now) as well as making color swatches act more
predictably in the compositor, however bringing over color values from
applications like photoshop or gimp, that operate in a gamma space,
will give identical results.
This commit will convert over existing files saved by earlier 2.5 versions to
work generally the same, though there may be some slight differences with
things like textures. Now that we're set on changing other areas of shading,
this won't be too disruptive overall.
I've made a diagram explaining the pipeline here:
http://mke3.net/blender/devel/2.5/25_linear_workflow_pipeline.png
and some docs here:
http://www.blender.org/development/release-logs/blender-250/color-management/
2009-12-02 07:56:34 +00:00
|
|
|
|
2010-09-30 12:10:18 +00:00
|
|
|
if(state & (UI_BUT_ANIMATED|UI_BUT_ANIMATED_KEY|UI_BUT_DRIVEN|UI_BUT_REDALERT)) {
|
2010-12-03 12:30:59 +00:00
|
|
|
// draw based on state - color for keyed etc
|
2010-09-30 12:10:18 +00:00
|
|
|
widgetbase_draw(&wtb, wcol);
|
|
|
|
|
2010-12-03 12:30:59 +00:00
|
|
|
// inset to draw swatch color
|
2010-09-30 12:10:18 +00:00
|
|
|
rect->xmin+= SWATCH_KEYED_BORDER;
|
|
|
|
rect->xmax-= SWATCH_KEYED_BORDER;
|
|
|
|
rect->ymin+= SWATCH_KEYED_BORDER;
|
|
|
|
rect->ymax-= SWATCH_KEYED_BORDER;
|
|
|
|
|
|
|
|
round_box_edges(&wtb, roundboxalign, rect, 5.0f);
|
|
|
|
}
|
|
|
|
|
Changes to Color Management
After testing and feedback, I've decided to slightly modify the way color
management works internally. While the previous method worked well for
rendering, was a smaller transition and had some advantages over this
new method, it was a bit more ambiguous, and was making things difficult
for other areas such as compositing.
This implementation now considers all color data (with only a couple of
exceptions such as brush colors) to be stored in linear RGB color space,
rather than sRGB as previously. This brings it in line with Nuke, which also
operates this way, quite successfully. Color swatches, pickers, color ramp
display are now gamma corrected to display gamma so you can see what
you're doing, but the numbers themselves are considered linear. This
makes understanding blending modes more clear (a 0.5 value on overlay
will not change the result now) as well as making color swatches act more
predictably in the compositor, however bringing over color values from
applications like photoshop or gimp, that operate in a gamma space,
will give identical results.
This commit will convert over existing files saved by earlier 2.5 versions to
work generally the same, though there may be some slight differences with
things like textures. Now that we're set on changing other areas of shading,
this won't be too disruptive overall.
I've made a diagram explaining the pipeline here:
http://mke3.net/blender/devel/2.5/25_linear_workflow_pipeline.png
and some docs here:
http://www.blender.org/development/release-logs/blender-250/color-management/
2009-12-02 07:56:34 +00:00
|
|
|
if (color_profile)
|
|
|
|
linearrgb_to_srgb_v3_v3(col, col);
|
|
|
|
|
2012-01-19 10:04:51 +00:00
|
|
|
rgba_float_to_uchar((unsigned char *)wcol->inner, col);
|
2012-01-14 11:21:00 +00:00
|
|
|
|
2010-01-21 05:14:05 +00:00
|
|
|
wcol->shaded = 0;
|
2010-06-26 17:12:55 +00:00
|
|
|
wcol->alpha_check = (wcol->inner[3] < 255);
|
|
|
|
|
2009-04-03 16:26:03 +00:00
|
|
|
widgetbase_draw(&wtb, wcol);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2010-12-10 00:00:01 +00:00
|
|
|
static void widget_icon_has_anim(uiBut *UNUSED(but), uiWidgetColors *wcol, rcti *rect, int state, int UNUSED(roundboxalign))
|
2010-12-09 18:08:58 +00:00
|
|
|
{
|
|
|
|
if(state & (UI_BUT_ANIMATED|UI_BUT_ANIMATED_KEY|UI_BUT_DRIVEN|UI_BUT_REDALERT)) {
|
|
|
|
uiWidgetBase wtb;
|
|
|
|
|
|
|
|
widget_init(&wtb);
|
|
|
|
wtb.outline= 0;
|
|
|
|
|
|
|
|
/* rounded */
|
2011-09-11 06:41:09 +00:00
|
|
|
round_box_edges(&wtb, UI_CNR_ALL, rect, 10.0f);
|
2010-12-09 18:08:58 +00:00
|
|
|
widgetbase_draw(&wtb, wcol);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-04-02 15:01:11 +00:00
|
|
|
|
|
|
|
static void widget_textbut(uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign)
|
2009-03-25 16:58:42 +00:00
|
|
|
{
|
2009-04-02 15:01:11 +00:00
|
|
|
uiWidgetBase wtb;
|
2009-03-25 16:58:42 +00:00
|
|
|
|
2010-09-11 00:08:07 +00:00
|
|
|
if(state & UI_SELECT)
|
|
|
|
SWAP(short, wcol->shadetop, wcol->shadedown);
|
|
|
|
|
2009-04-02 15:01:11 +00:00
|
|
|
widget_init(&wtb);
|
2009-03-25 16:58:42 +00:00
|
|
|
|
|
|
|
/* half rounded */
|
2009-08-23 21:56:32 +00:00
|
|
|
round_box_edges(&wtb, roundboxalign, rect, 4.0f);
|
2009-03-25 16:58:42 +00:00
|
|
|
|
2009-04-02 18:16:15 +00:00
|
|
|
widgetbase_draw(&wtb, wcol);
|
2009-03-25 16:58:42 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-10-16 02:40:31 +00:00
|
|
|
static void widget_menubut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign)
|
2009-03-25 16:58:42 +00:00
|
|
|
{
|
2009-04-02 15:01:11 +00:00
|
|
|
uiWidgetBase wtb;
|
2009-03-25 16:58:42 +00:00
|
|
|
|
2009-04-02 15:01:11 +00:00
|
|
|
widget_init(&wtb);
|
2009-03-25 16:58:42 +00:00
|
|
|
|
|
|
|
/* half rounded */
|
2009-04-02 15:01:11 +00:00
|
|
|
round_box_edges(&wtb, roundboxalign, rect, 4.0f);
|
2009-03-25 16:58:42 +00:00
|
|
|
|
|
|
|
/* decoration */
|
2009-04-02 15:01:11 +00:00
|
|
|
widget_menu_trias(&wtb.tria1, rect);
|
2009-03-25 16:58:42 +00:00
|
|
|
|
2009-04-02 18:16:15 +00:00
|
|
|
widgetbase_draw(&wtb, wcol);
|
2009-04-09 18:11:18 +00:00
|
|
|
|
|
|
|
/* text space */
|
|
|
|
rect->xmax -= (rect->ymax-rect->ymin);
|
2009-09-28 15:59:09 +00:00
|
|
|
}
|
|
|
|
|
2010-10-16 02:40:31 +00:00
|
|
|
static void widget_menuiconbut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign)
|
2009-09-28 15:59:09 +00:00
|
|
|
{
|
|
|
|
uiWidgetBase wtb;
|
|
|
|
|
|
|
|
widget_init(&wtb);
|
|
|
|
|
|
|
|
/* half rounded */
|
|
|
|
round_box_edges(&wtb, roundboxalign, rect, 4.0f);
|
2009-04-09 18:11:18 +00:00
|
|
|
|
2009-09-28 15:59:09 +00:00
|
|
|
/* decoration */
|
|
|
|
widgetbase_draw(&wtb, wcol);
|
2009-03-25 16:58:42 +00:00
|
|
|
}
|
|
|
|
|
2011-11-07 22:28:49 +00:00
|
|
|
static void widget_menunodebut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign)
|
|
|
|
{
|
|
|
|
/* silly node link button hacks */
|
|
|
|
uiWidgetBase wtb;
|
|
|
|
uiWidgetColors wcol_backup= *wcol;
|
|
|
|
|
|
|
|
widget_init(&wtb);
|
|
|
|
|
|
|
|
/* half rounded */
|
|
|
|
round_box_edges(&wtb, roundboxalign, rect, 4.0f);
|
|
|
|
|
|
|
|
wcol->inner[0] += 15;
|
|
|
|
wcol->inner[1] += 15;
|
|
|
|
wcol->inner[2] += 15;
|
|
|
|
wcol->outline[0] += 15;
|
|
|
|
wcol->outline[1] += 15;
|
|
|
|
wcol->outline[2] += 15;
|
|
|
|
|
|
|
|
/* decoration */
|
|
|
|
widgetbase_draw(&wtb, wcol);
|
|
|
|
*wcol= wcol_backup;
|
|
|
|
}
|
|
|
|
|
2010-10-16 02:40:31 +00:00
|
|
|
static void widget_pulldownbut(uiWidgetColors *wcol, rcti *rect, int state, int UNUSED(roundboxalign))
|
2009-04-03 16:26:03 +00:00
|
|
|
{
|
|
|
|
if(state & UI_ACTIVE) {
|
|
|
|
uiWidgetBase wtb;
|
2009-08-26 00:38:43 +00:00
|
|
|
float rad= 0.5f*(rect->ymax - rect->ymin); // 4.0f
|
2009-04-03 16:26:03 +00:00
|
|
|
|
|
|
|
widget_init(&wtb);
|
|
|
|
|
2009-08-23 21:56:32 +00:00
|
|
|
/* half rounded */
|
2011-09-11 06:41:09 +00:00
|
|
|
round_box_edges(&wtb, UI_CNR_ALL, rect, rad);
|
2009-04-03 16:26:03 +00:00
|
|
|
|
|
|
|
widgetbase_draw(&wtb, wcol);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-10-16 02:40:31 +00:00
|
|
|
static void widget_menu_itembut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int UNUSED(roundboxalign))
|
2009-04-03 16:26:03 +00:00
|
|
|
{
|
|
|
|
uiWidgetBase wtb;
|
|
|
|
|
|
|
|
widget_init(&wtb);
|
|
|
|
|
|
|
|
/* not rounded, no outline */
|
|
|
|
wtb.outline= 0;
|
|
|
|
round_box_edges(&wtb, 0, rect, 0.0f);
|
|
|
|
|
|
|
|
widgetbase_draw(&wtb, wcol);
|
|
|
|
}
|
|
|
|
|
2010-10-16 02:40:31 +00:00
|
|
|
static void widget_list_itembut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int UNUSED(roundboxalign))
|
2009-07-21 01:26:17 +00:00
|
|
|
{
|
|
|
|
uiWidgetBase wtb;
|
|
|
|
|
|
|
|
widget_init(&wtb);
|
|
|
|
|
|
|
|
/* rounded, but no outline */
|
|
|
|
wtb.outline= 0;
|
2011-09-11 06:41:09 +00:00
|
|
|
round_box_edges(&wtb, UI_CNR_ALL, rect, 4.0f);
|
2009-07-21 01:26:17 +00:00
|
|
|
|
|
|
|
widgetbase_draw(&wtb, wcol);
|
|
|
|
}
|
2009-04-03 16:26:03 +00:00
|
|
|
|
2010-10-16 02:40:31 +00:00
|
|
|
static void widget_optionbut(uiWidgetColors *wcol, rcti *rect, int state, int UNUSED(roundboxalign))
|
2009-03-25 16:58:42 +00:00
|
|
|
{
|
2009-04-02 15:01:11 +00:00
|
|
|
uiWidgetBase wtb;
|
2009-03-25 16:58:42 +00:00
|
|
|
rcti recttemp= *rect;
|
|
|
|
int delta;
|
|
|
|
|
2009-04-02 15:01:11 +00:00
|
|
|
widget_init(&wtb);
|
2009-03-25 16:58:42 +00:00
|
|
|
|
|
|
|
/* square */
|
2012-03-24 02:51:46 +00:00
|
|
|
recttemp.xmax = recttemp.xmin + (recttemp.ymax-recttemp.ymin);
|
2009-03-25 16:58:42 +00:00
|
|
|
|
|
|
|
/* smaller */
|
|
|
|
delta= 1 + (recttemp.ymax-recttemp.ymin)/8;
|
|
|
|
recttemp.xmin+= delta;
|
|
|
|
recttemp.ymin+= delta;
|
|
|
|
recttemp.xmax-= delta;
|
|
|
|
recttemp.ymax-= delta;
|
|
|
|
|
|
|
|
/* half rounded */
|
2011-09-11 06:41:09 +00:00
|
|
|
round_box_edges(&wtb, UI_CNR_ALL, &recttemp, 4.0f);
|
2009-03-25 16:58:42 +00:00
|
|
|
|
|
|
|
/* decoration */
|
|
|
|
if(state & UI_SELECT) {
|
2009-04-02 15:01:11 +00:00
|
|
|
widget_check_trias(&wtb.tria1, &recttemp);
|
2009-03-25 16:58:42 +00:00
|
|
|
}
|
|
|
|
|
2009-04-02 18:16:15 +00:00
|
|
|
widgetbase_draw(&wtb, wcol);
|
2009-04-09 18:11:18 +00:00
|
|
|
|
|
|
|
/* text space */
|
2009-04-23 01:53:11 +00:00
|
|
|
rect->xmin += (rect->ymax-rect->ymin)*0.7 + delta;
|
2009-03-25 16:58:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-10-16 02:40:31 +00:00
|
|
|
static void widget_radiobut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign)
|
2009-03-25 16:58:42 +00:00
|
|
|
{
|
2009-04-02 15:01:11 +00:00
|
|
|
uiWidgetBase wtb;
|
2009-03-25 16:58:42 +00:00
|
|
|
|
2009-04-02 15:01:11 +00:00
|
|
|
widget_init(&wtb);
|
2009-03-25 16:58:42 +00:00
|
|
|
|
|
|
|
/* half rounded */
|
2009-04-02 15:01:11 +00:00
|
|
|
round_box_edges(&wtb, roundboxalign, rect, 4.0f);
|
2009-03-25 16:58:42 +00:00
|
|
|
|
2009-04-02 18:16:15 +00:00
|
|
|
widgetbase_draw(&wtb, wcol);
|
2009-03-25 16:58:42 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2010-10-16 02:40:31 +00:00
|
|
|
static void widget_box(uiBut *but, uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign)
|
2010-04-06 07:02:16 +00:00
|
|
|
{
|
|
|
|
uiWidgetBase wtb;
|
2010-06-03 07:27:55 +00:00
|
|
|
char old_col[3];
|
2010-04-06 07:02:16 +00:00
|
|
|
|
|
|
|
widget_init(&wtb);
|
|
|
|
|
2011-11-07 01:38:32 +00:00
|
|
|
copy_v3_v3_char(old_col, wcol->inner);
|
2010-06-03 07:27:55 +00:00
|
|
|
|
2010-12-03 12:30:59 +00:00
|
|
|
/* abuse but->hsv - if it's non-zero, use this color as the box's background */
|
2010-10-13 13:53:49 +00:00
|
|
|
if (but->col[3]) {
|
|
|
|
wcol->inner[0] = but->col[0];
|
|
|
|
wcol->inner[1] = but->col[1];
|
|
|
|
wcol->inner[2] = but->col[2];
|
2010-06-03 07:27:55 +00:00
|
|
|
}
|
|
|
|
|
2010-04-06 07:02:16 +00:00
|
|
|
/* half rounded */
|
|
|
|
round_box_edges(&wtb, roundboxalign, rect, 4.0f);
|
|
|
|
|
|
|
|
widgetbase_draw(&wtb, wcol);
|
|
|
|
|
|
|
|
/* store the box bg as gl clearcolor, to retrieve later when drawing semi-transparent rects
|
|
|
|
* over the top to indicate disabled buttons */
|
2011-06-14 05:19:16 +00:00
|
|
|
/* XXX, this doesnt work right since the color applies to buttons outside the box too. */
|
2010-04-06 07:02:16 +00:00
|
|
|
glClearColor(wcol->inner[0]/255.0, wcol->inner[1]/255.0, wcol->inner[2]/255.0, 1.0);
|
2010-06-03 07:27:55 +00:00
|
|
|
|
2011-11-07 01:38:32 +00:00
|
|
|
copy_v3_v3_char(wcol->inner, old_col);
|
2010-04-06 07:02:16 +00:00
|
|
|
}
|
|
|
|
|
2010-10-16 02:40:31 +00:00
|
|
|
static void widget_but(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign)
|
2009-03-25 16:58:42 +00:00
|
|
|
{
|
2009-04-02 15:01:11 +00:00
|
|
|
uiWidgetBase wtb;
|
2009-03-25 16:58:42 +00:00
|
|
|
|
2009-04-02 15:01:11 +00:00
|
|
|
widget_init(&wtb);
|
2009-03-25 16:58:42 +00:00
|
|
|
|
|
|
|
/* half rounded */
|
2009-04-02 15:01:11 +00:00
|
|
|
round_box_edges(&wtb, roundboxalign, rect, 4.0f);
|
2009-03-25 16:58:42 +00:00
|
|
|
|
2009-04-02 18:16:15 +00:00
|
|
|
widgetbase_draw(&wtb, wcol);
|
2009-03-25 16:58:42 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2010-10-16 02:40:31 +00:00
|
|
|
static void widget_roundbut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign)
|
2009-03-25 16:58:42 +00:00
|
|
|
{
|
2009-04-02 15:01:11 +00:00
|
|
|
uiWidgetBase wtb;
|
2009-08-26 00:38:43 +00:00
|
|
|
float rad= 5.0f; //0.5f*(rect->ymax - rect->ymin);
|
2009-03-25 16:58:42 +00:00
|
|
|
|
2009-04-02 15:01:11 +00:00
|
|
|
widget_init(&wtb);
|
2009-03-25 16:58:42 +00:00
|
|
|
|
2009-08-23 21:56:32 +00:00
|
|
|
/* half rounded */
|
2009-08-26 00:38:43 +00:00
|
|
|
round_box_edges(&wtb, roundboxalign, rect, rad);
|
2009-03-25 16:58:42 +00:00
|
|
|
|
2009-04-02 18:16:15 +00:00
|
|
|
widgetbase_draw(&wtb, wcol);
|
2009-03-25 16:58:42 +00:00
|
|
|
}
|
|
|
|
|
2009-06-08 10:00:14 +00:00
|
|
|
static void widget_draw_extra_mask(const bContext *C, uiBut *but, uiWidgetType *wt, rcti *rect)
|
|
|
|
{
|
|
|
|
uiWidgetBase wtb;
|
2010-12-20 03:59:22 +00:00
|
|
|
unsigned char col[4];
|
2009-06-08 10:00:14 +00:00
|
|
|
|
|
|
|
/* state copy! */
|
|
|
|
wt->wcol= *(wt->wcol_theme);
|
|
|
|
|
|
|
|
widget_init(&wtb);
|
|
|
|
|
|
|
|
if(but->block->drawextra) {
|
2009-06-08 16:24:37 +00:00
|
|
|
/* note: drawextra can change rect +1 or -1, to match round errors of existing previews */
|
2009-08-18 19:58:27 +00:00
|
|
|
but->block->drawextra(C, but->poin, but->block->drawextra_arg1, but->block->drawextra_arg2, rect);
|
2009-06-08 10:00:14 +00:00
|
|
|
|
2009-06-08 12:39:39 +00:00
|
|
|
/* make mask to draw over image */
|
|
|
|
UI_GetThemeColor3ubv(TH_BACK, col);
|
2010-12-20 03:59:22 +00:00
|
|
|
glColor3ubv(col);
|
2009-06-08 12:39:39 +00:00
|
|
|
|
2011-09-11 06:41:09 +00:00
|
|
|
round_box__edges(&wtb, UI_CNR_ALL, rect, 0.0f, 4.0);
|
2009-06-08 12:39:39 +00:00
|
|
|
widgetbase_outline(&wtb);
|
2009-06-08 10:00:14 +00:00
|
|
|
}
|
2009-06-08 11:27:40 +00:00
|
|
|
|
2009-06-08 10:00:14 +00:00
|
|
|
/* outline */
|
2011-09-11 06:41:09 +00:00
|
|
|
round_box_edges(&wtb, UI_CNR_ALL, rect, 5.0f);
|
2009-06-08 10:00:14 +00:00
|
|
|
wtb.outline= 1;
|
|
|
|
wtb.inner= 0;
|
2009-06-08 12:39:39 +00:00
|
|
|
widgetbase_draw(&wtb, &wt->wcol);
|
2009-06-08 10:00:14 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-04-02 15:01:11 +00:00
|
|
|
static void widget_disabled(rcti *rect)
|
2009-03-25 16:58:42 +00:00
|
|
|
{
|
2009-04-15 17:53:12 +00:00
|
|
|
float col[4];
|
2009-03-25 16:58:42 +00:00
|
|
|
|
2009-04-02 15:01:11 +00:00
|
|
|
glEnable(GL_BLEND);
|
2009-03-25 16:58:42 +00:00
|
|
|
|
2009-04-15 17:53:12 +00:00
|
|
|
/* can't use theme TH_BACK or TH_PANEL... undefined */
|
|
|
|
glGetFloatv(GL_COLOR_CLEAR_VALUE, col);
|
2009-04-02 15:01:11 +00:00
|
|
|
glColor4f(col[0], col[1], col[2], 0.5f);
|
2010-04-06 07:02:16 +00:00
|
|
|
|
2009-06-19 23:11:41 +00:00
|
|
|
/* need -1 and +1 to make it work right for aligned buttons,
|
|
|
|
* but problem may be somewhere else? */
|
2010-04-06 07:02:16 +00:00
|
|
|
glRectf(rect->xmin-1, rect->ymin-1, rect->xmax, rect->ymax+1);
|
|
|
|
|
2009-04-02 15:01:11 +00:00
|
|
|
glDisable(GL_BLEND);
|
|
|
|
}
|
|
|
|
|
|
|
|
static uiWidgetType *widget_type(uiWidgetTypeEnum type)
|
|
|
|
{
|
2011-11-19 20:57:53 +00:00
|
|
|
bTheme *btheme= UI_GetTheme();
|
2009-04-02 15:01:11 +00:00
|
|
|
static uiWidgetType wt;
|
2009-03-25 16:58:42 +00:00
|
|
|
|
2009-04-02 15:01:11 +00:00
|
|
|
/* defaults */
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
wt.wcol_theme= &btheme->tui.wcol_regular;
|
2009-07-12 02:06:15 +00:00
|
|
|
wt.wcol_state= &btheme->tui.wcol_state;
|
2009-04-02 15:01:11 +00:00
|
|
|
wt.state= widget_state;
|
|
|
|
wt.draw= widget_but;
|
2009-04-02 18:16:15 +00:00
|
|
|
wt.custom= NULL;
|
2009-04-02 15:01:11 +00:00
|
|
|
wt.text= widget_draw_text_icon;
|
2009-03-25 16:58:42 +00:00
|
|
|
|
2009-04-02 15:01:11 +00:00
|
|
|
switch(type) {
|
2009-06-24 14:16:56 +00:00
|
|
|
case UI_WTYPE_REGULAR:
|
|
|
|
break;
|
|
|
|
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
case UI_WTYPE_LABEL:
|
|
|
|
wt.draw= NULL;
|
|
|
|
wt.state= widget_state_label;
|
|
|
|
break;
|
|
|
|
|
2009-04-02 15:01:11 +00:00
|
|
|
case UI_WTYPE_TOGGLE:
|
2009-06-24 14:16:56 +00:00
|
|
|
wt.wcol_theme= &btheme->tui.wcol_toggle;
|
2009-04-02 15:01:11 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case UI_WTYPE_OPTION:
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
wt.wcol_theme= &btheme->tui.wcol_option;
|
2009-04-02 15:01:11 +00:00
|
|
|
wt.draw= widget_optionbut;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case UI_WTYPE_RADIO:
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
wt.wcol_theme= &btheme->tui.wcol_radio;
|
2009-04-02 15:01:11 +00:00
|
|
|
wt.draw= widget_radiobut;
|
|
|
|
break;
|
2009-06-24 14:16:56 +00:00
|
|
|
|
2009-04-02 15:01:11 +00:00
|
|
|
case UI_WTYPE_NUMBER:
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
wt.wcol_theme= &btheme->tui.wcol_num;
|
2009-04-02 15:01:11 +00:00
|
|
|
wt.draw= widget_numbut;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case UI_WTYPE_SLIDER:
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
wt.wcol_theme= &btheme->tui.wcol_numslider;
|
2009-04-02 18:16:15 +00:00
|
|
|
wt.custom= widget_numslider;
|
2009-10-15 11:52:23 +00:00
|
|
|
wt.state= widget_state_numslider;
|
2009-04-02 15:01:11 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case UI_WTYPE_EXEC:
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
wt.wcol_theme= &btheme->tui.wcol_tool;
|
2009-04-02 15:01:11 +00:00
|
|
|
wt.draw= widget_roundbut;
|
|
|
|
break;
|
2012-03-19 22:29:16 +00:00
|
|
|
|
|
|
|
case UI_WTYPE_TOOLTIP:
|
|
|
|
wt.wcol_theme = &btheme->tui.wcol_tooltip;
|
|
|
|
wt.draw = widget_menu_back;
|
|
|
|
break;
|
2009-04-02 15:01:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* strings */
|
|
|
|
case UI_WTYPE_NAME:
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
wt.wcol_theme= &btheme->tui.wcol_text;
|
2009-04-02 15:01:11 +00:00
|
|
|
wt.draw= widget_textbut;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case UI_WTYPE_NAME_LINK:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case UI_WTYPE_POINTER_LINK:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case UI_WTYPE_FILENAME:
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
2009-04-03 16:26:03 +00:00
|
|
|
/* start menus */
|
2009-04-02 15:01:11 +00:00
|
|
|
case UI_WTYPE_MENU_RADIO:
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
wt.wcol_theme= &btheme->tui.wcol_menu;
|
2009-04-02 15:01:11 +00:00
|
|
|
wt.draw= widget_menubut;
|
|
|
|
break;
|
2009-09-28 15:59:09 +00:00
|
|
|
|
|
|
|
case UI_WTYPE_MENU_ICON_RADIO:
|
|
|
|
wt.wcol_theme= &btheme->tui.wcol_menu;
|
|
|
|
wt.draw= widget_menuiconbut;
|
|
|
|
break;
|
2009-04-02 15:01:11 +00:00
|
|
|
|
|
|
|
case UI_WTYPE_MENU_POINTER_LINK:
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
wt.wcol_theme= &btheme->tui.wcol_menu;
|
2009-04-02 15:01:11 +00:00
|
|
|
wt.draw= widget_menubut;
|
|
|
|
break;
|
2011-11-07 22:28:49 +00:00
|
|
|
|
|
|
|
case UI_WTYPE_MENU_NODE_LINK:
|
|
|
|
wt.wcol_theme= &btheme->tui.wcol_menu;
|
|
|
|
wt.draw= widget_menunodebut;
|
|
|
|
break;
|
2009-04-02 15:01:11 +00:00
|
|
|
|
|
|
|
case UI_WTYPE_PULLDOWN:
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
wt.wcol_theme= &btheme->tui.wcol_pulldown;
|
2009-04-03 16:26:03 +00:00
|
|
|
wt.draw= widget_pulldownbut;
|
|
|
|
wt.state= widget_state_pulldown;
|
2009-04-02 15:01:11 +00:00
|
|
|
break;
|
|
|
|
|
2009-04-03 16:26:03 +00:00
|
|
|
/* in menus */
|
2009-04-02 15:01:11 +00:00
|
|
|
case UI_WTYPE_MENU_ITEM:
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
wt.wcol_theme= &btheme->tui.wcol_menu_item;
|
2009-04-03 16:26:03 +00:00
|
|
|
wt.draw= widget_menu_itembut;
|
|
|
|
wt.state= widget_state_menu_item;
|
2009-04-02 15:01:11 +00:00
|
|
|
break;
|
|
|
|
|
2009-04-03 16:26:03 +00:00
|
|
|
case UI_WTYPE_MENU_BACK:
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
wt.wcol_theme= &btheme->tui.wcol_menu_back;
|
2009-04-03 16:26:03 +00:00
|
|
|
wt.draw= widget_menu_back;
|
|
|
|
break;
|
2009-04-02 15:01:11 +00:00
|
|
|
|
|
|
|
/* specials */
|
|
|
|
case UI_WTYPE_ICON:
|
2010-12-09 18:08:58 +00:00
|
|
|
wt.custom= widget_icon_has_anim;
|
2009-04-02 15:01:11 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case UI_WTYPE_SWATCH:
|
2009-04-03 16:26:03 +00:00
|
|
|
wt.custom= widget_swatch;
|
2009-04-02 15:01:11 +00:00
|
|
|
break;
|
|
|
|
|
2009-06-01 11:31:06 +00:00
|
|
|
case UI_WTYPE_BOX:
|
2010-04-06 07:02:16 +00:00
|
|
|
wt.custom= widget_box;
|
2009-06-01 11:31:06 +00:00
|
|
|
wt.wcol_theme= &btheme->tui.wcol_box;
|
|
|
|
break;
|
|
|
|
|
2009-04-02 15:01:11 +00:00
|
|
|
case UI_WTYPE_RGB_PICKER:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case UI_WTYPE_NORMAL:
|
|
|
|
break;
|
2009-06-24 14:16:56 +00:00
|
|
|
|
|
|
|
case UI_WTYPE_SCROLL:
|
|
|
|
wt.wcol_theme= &btheme->tui.wcol_scroll;
|
2009-07-02 18:12:46 +00:00
|
|
|
wt.state= widget_state_nothing;
|
2009-06-24 14:16:56 +00:00
|
|
|
wt.custom= widget_scroll;
|
|
|
|
break;
|
2009-07-21 01:26:17 +00:00
|
|
|
|
|
|
|
case UI_WTYPE_LISTITEM:
|
|
|
|
wt.wcol_theme= &btheme->tui.wcol_list_item;
|
|
|
|
wt.draw= widget_list_itembut;
|
|
|
|
break;
|
2010-05-27 08:22:16 +00:00
|
|
|
|
|
|
|
case UI_WTYPE_PROGRESSBAR:
|
|
|
|
wt.wcol_theme= &btheme->tui.wcol_progress;
|
|
|
|
wt.custom= widget_progressbar;
|
|
|
|
break;
|
2009-04-02 15:01:11 +00:00
|
|
|
}
|
2009-03-25 16:58:42 +00:00
|
|
|
|
2009-04-02 15:01:11 +00:00
|
|
|
return &wt;
|
2009-03-25 16:58:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-09-09 13:37:17 +00:00
|
|
|
static int widget_roundbox_set(uiBut *but, rcti *rect)
|
2009-03-25 16:58:42 +00:00
|
|
|
{
|
|
|
|
/* alignment */
|
|
|
|
if(but->flag & UI_BUT_ALIGN) {
|
|
|
|
|
|
|
|
if(but->flag & UI_BUT_ALIGN_TOP)
|
|
|
|
rect->ymax+= 1;
|
|
|
|
if(but->flag & UI_BUT_ALIGN_LEFT)
|
|
|
|
rect->xmin-= 1;
|
|
|
|
|
|
|
|
switch(but->flag & UI_BUT_ALIGN) {
|
|
|
|
case UI_BUT_ALIGN_TOP:
|
2011-09-11 06:41:09 +00:00
|
|
|
return UI_CNR_BOTTOM_LEFT | UI_CNR_BOTTOM_RIGHT;
|
2009-03-25 16:58:42 +00:00
|
|
|
case UI_BUT_ALIGN_DOWN:
|
2011-09-11 06:41:09 +00:00
|
|
|
return UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT;
|
2009-03-25 16:58:42 +00:00
|
|
|
case UI_BUT_ALIGN_LEFT:
|
2011-09-11 06:41:09 +00:00
|
|
|
return UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT;
|
2009-03-25 16:58:42 +00:00
|
|
|
case UI_BUT_ALIGN_RIGHT:
|
2011-09-11 06:41:09 +00:00
|
|
|
return UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT;
|
2011-09-09 13:10:18 +00:00
|
|
|
case UI_BUT_ALIGN_DOWN | UI_BUT_ALIGN_RIGHT:
|
2011-09-11 06:41:09 +00:00
|
|
|
return UI_CNR_TOP_LEFT;
|
2011-09-09 13:10:18 +00:00
|
|
|
case UI_BUT_ALIGN_DOWN | UI_BUT_ALIGN_LEFT:
|
2011-09-11 06:41:09 +00:00
|
|
|
return UI_CNR_TOP_RIGHT;
|
2011-09-09 13:10:18 +00:00
|
|
|
case UI_BUT_ALIGN_TOP | UI_BUT_ALIGN_RIGHT:
|
2011-09-11 06:41:09 +00:00
|
|
|
return UI_CNR_BOTTOM_LEFT;
|
2011-09-09 13:10:18 +00:00
|
|
|
case UI_BUT_ALIGN_TOP | UI_BUT_ALIGN_LEFT:
|
2011-09-11 06:41:09 +00:00
|
|
|
return UI_CNR_BOTTOM_RIGHT;
|
2009-03-25 16:58:42 +00:00
|
|
|
default:
|
2011-09-09 13:10:18 +00:00
|
|
|
return 0;
|
2009-03-25 16:58:42 +00:00
|
|
|
}
|
2011-09-09 13:10:18 +00:00
|
|
|
}
|
|
|
|
|
2011-09-11 06:41:09 +00:00
|
|
|
return UI_CNR_ALL;
|
2009-03-25 16:58:42 +00:00
|
|
|
}
|
|
|
|
|
2009-04-03 16:26:03 +00:00
|
|
|
/* conversion from old to new buttons, so still messy */
|
2009-06-08 10:00:14 +00:00
|
|
|
void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rcti *rect)
|
2009-03-25 16:58:42 +00:00
|
|
|
{
|
2011-11-19 20:57:53 +00:00
|
|
|
bTheme *btheme= UI_GetTheme();
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
ThemeUI *tui= &btheme->tui;
|
|
|
|
uiFontStyle *fstyle= &style->widget;
|
2009-04-02 15:01:11 +00:00
|
|
|
uiWidgetType *wt= NULL;
|
2011-06-14 01:04:11 +00:00
|
|
|
|
2009-11-02 17:25:15 +00:00
|
|
|
/* handle menus separately */
|
2009-04-03 16:26:03 +00:00
|
|
|
if(but->dt==UI_EMBOSSP) {
|
|
|
|
switch (but->type) {
|
|
|
|
case LABEL:
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
widget_draw_text_icon(&style->widgetlabel, &tui->wcol_menu_back, but, rect);
|
2009-04-03 16:26:03 +00:00
|
|
|
break;
|
|
|
|
case SEPR:
|
2010-10-16 02:40:31 +00:00
|
|
|
ui_draw_separator(rect, &tui->wcol_menu_item);
|
2009-04-03 16:26:03 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
wt= widget_type(UI_WTYPE_MENU_ITEM);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if(but->dt==UI_EMBOSSN) {
|
|
|
|
/* "nothing" */
|
|
|
|
wt= widget_type(UI_WTYPE_ICON);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
|
|
|
|
switch (but->type) {
|
|
|
|
case LABEL:
|
|
|
|
if(but->block->flag & UI_BLOCK_LOOP)
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
widget_draw_text_icon(&style->widgetlabel, &tui->wcol_menu_back, but, rect);
|
|
|
|
else {
|
|
|
|
wt= widget_type(UI_WTYPE_LABEL);
|
|
|
|
fstyle= &style->widgetlabel;
|
|
|
|
}
|
2009-04-03 16:26:03 +00:00
|
|
|
break;
|
2009-06-12 14:22:27 +00:00
|
|
|
|
2009-04-03 16:26:03 +00:00
|
|
|
case SEPR:
|
|
|
|
break;
|
2009-06-12 14:22:27 +00:00
|
|
|
|
2009-04-03 16:26:03 +00:00
|
|
|
case BUT:
|
2009-11-19 09:57:04 +00:00
|
|
|
wt= widget_type(UI_WTYPE_EXEC);
|
2009-04-03 16:26:03 +00:00
|
|
|
break;
|
2009-06-24 14:16:56 +00:00
|
|
|
|
2009-04-03 16:26:03 +00:00
|
|
|
case NUM:
|
|
|
|
wt= widget_type(UI_WTYPE_NUMBER);
|
|
|
|
break;
|
2009-06-12 14:22:27 +00:00
|
|
|
|
2009-04-03 16:26:03 +00:00
|
|
|
case NUMSLI:
|
|
|
|
case HSVSLI:
|
|
|
|
wt= widget_type(UI_WTYPE_SLIDER);
|
|
|
|
break;
|
2009-06-12 14:22:27 +00:00
|
|
|
|
2009-04-03 16:26:03 +00:00
|
|
|
case ROW:
|
|
|
|
wt= widget_type(UI_WTYPE_RADIO);
|
|
|
|
break;
|
2009-07-21 01:26:17 +00:00
|
|
|
|
|
|
|
case LISTROW:
|
|
|
|
wt= widget_type(UI_WTYPE_LISTITEM);
|
|
|
|
break;
|
2009-06-12 14:22:27 +00:00
|
|
|
|
2009-04-03 16:26:03 +00:00
|
|
|
case TEX:
|
2009-06-10 11:43:21 +00:00
|
|
|
wt= widget_type(UI_WTYPE_NAME);
|
|
|
|
break;
|
2009-06-12 14:22:27 +00:00
|
|
|
|
2009-06-02 18:10:06 +00:00
|
|
|
case SEARCH_MENU:
|
2009-04-03 16:26:03 +00:00
|
|
|
wt= widget_type(UI_WTYPE_NAME);
|
2009-06-10 11:43:21 +00:00
|
|
|
if(but->block->flag & UI_BLOCK_LOOP)
|
|
|
|
wt->wcol_theme= &btheme->tui.wcol_menu_back;
|
2009-04-03 16:26:03 +00:00
|
|
|
break;
|
2009-06-12 14:22:27 +00:00
|
|
|
|
2009-04-12 13:40:29 +00:00
|
|
|
case TOGBUT:
|
2009-04-03 16:26:03 +00:00
|
|
|
case TOG:
|
|
|
|
case TOGN:
|
|
|
|
case TOG3:
|
2009-05-27 00:03:49 +00:00
|
|
|
wt= widget_type(UI_WTYPE_TOGGLE);
|
|
|
|
break;
|
2009-06-12 14:22:27 +00:00
|
|
|
|
2009-05-27 00:03:49 +00:00
|
|
|
case OPTION:
|
|
|
|
case OPTIONN:
|
2009-04-09 18:11:18 +00:00
|
|
|
if (!(but->flag & UI_HAS_ICON)) {
|
2009-04-03 16:26:03 +00:00
|
|
|
wt= widget_type(UI_WTYPE_OPTION);
|
2009-04-09 18:11:18 +00:00
|
|
|
but->flag |= UI_TEXT_LEFT;
|
|
|
|
}
|
2009-04-03 16:26:03 +00:00
|
|
|
else
|
|
|
|
wt= widget_type(UI_WTYPE_TOGGLE);
|
2011-04-04 15:01:22 +00:00
|
|
|
|
|
|
|
/* option buttons have strings outside, on menus use different colors */
|
|
|
|
if(but->block->flag & UI_BLOCK_LOOP)
|
|
|
|
wt->state= widget_state_option_menu;
|
|
|
|
|
2009-04-03 16:26:03 +00:00
|
|
|
break;
|
2009-06-12 14:22:27 +00:00
|
|
|
|
2009-04-03 16:26:03 +00:00
|
|
|
case MENU:
|
|
|
|
case BLOCK:
|
|
|
|
case ICONTEXTROW:
|
2011-11-07 22:28:49 +00:00
|
|
|
if(but->flag & UI_BUT_NODE_LINK)
|
|
|
|
wt= widget_type(UI_WTYPE_MENU_NODE_LINK);
|
|
|
|
else if(!but->str[0] && but->icon)
|
2009-09-28 15:59:09 +00:00
|
|
|
wt= widget_type(UI_WTYPE_MENU_ICON_RADIO);
|
|
|
|
else
|
|
|
|
wt= widget_type(UI_WTYPE_MENU_RADIO);
|
2009-04-03 16:26:03 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PULLDOWN:
|
|
|
|
wt= widget_type(UI_WTYPE_PULLDOWN);
|
|
|
|
break;
|
2009-03-25 16:58:42 +00:00
|
|
|
|
2009-04-03 16:26:03 +00:00
|
|
|
case BUTM:
|
|
|
|
wt= widget_type(UI_WTYPE_MENU_ITEM);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case COL:
|
|
|
|
wt= widget_type(UI_WTYPE_SWATCH);
|
|
|
|
break;
|
2009-06-01 11:31:06 +00:00
|
|
|
|
|
|
|
case ROUNDBOX:
|
2009-07-21 01:26:17 +00:00
|
|
|
case LISTBOX:
|
2009-06-01 11:31:06 +00:00
|
|
|
wt= widget_type(UI_WTYPE_BOX);
|
|
|
|
break;
|
2009-06-17 11:01:05 +00:00
|
|
|
|
|
|
|
case LINK:
|
|
|
|
case INLINK:
|
|
|
|
wt= widget_type(UI_WTYPE_ICON);
|
|
|
|
wt->custom= widget_link;
|
|
|
|
|
|
|
|
break;
|
2009-06-08 10:00:14 +00:00
|
|
|
|
|
|
|
case BUT_EXTRA:
|
|
|
|
widget_draw_extra_mask(C, but, widget_type(UI_WTYPE_BOX), rect);
|
|
|
|
break;
|
2009-06-01 11:31:06 +00:00
|
|
|
|
2009-04-03 16:26:03 +00:00
|
|
|
case HSVCUBE:
|
2010-10-28 11:49:56 +00:00
|
|
|
if(but->a1 == UI_GRAD_V_ALT) // vertical V slider, uses new widget draw now
|
2009-06-12 14:22:27 +00:00
|
|
|
ui_draw_but_HSV_v(but, rect);
|
|
|
|
else // other HSV pickers...
|
|
|
|
ui_draw_but_HSVCUBE(but, rect);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case HSVCIRCLE:
|
2010-01-07 09:55:11 +00:00
|
|
|
ui_draw_but_HSVCIRCLE(but, &tui->wcol_regular, rect);
|
2009-04-06 15:44:30 +00:00
|
|
|
break;
|
2009-06-12 14:22:27 +00:00
|
|
|
|
2009-04-06 15:44:30 +00:00
|
|
|
case BUT_COLORBAND:
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
ui_draw_but_COLORBAND(but, &tui->wcol_regular, rect);
|
2009-04-06 15:44:30 +00:00
|
|
|
break;
|
2009-06-12 14:22:27 +00:00
|
|
|
|
2009-04-06 15:44:30 +00:00
|
|
|
case BUT_NORMAL:
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
ui_draw_but_NORMAL(but, &tui->wcol_regular, rect);
|
2009-04-06 15:44:30 +00:00
|
|
|
break;
|
2009-06-12 14:22:27 +00:00
|
|
|
|
2009-11-23 13:58:55 +00:00
|
|
|
case BUT_IMAGE:
|
|
|
|
ui_draw_but_IMAGE(ar, but, &tui->wcol_regular, rect);
|
|
|
|
break;
|
2010-01-19 01:32:06 +00:00
|
|
|
|
|
|
|
case HISTOGRAM:
|
2010-01-28 07:26:21 +00:00
|
|
|
ui_draw_but_HISTOGRAM(ar, but, &tui->wcol_regular, rect);
|
2010-01-19 01:32:06 +00:00
|
|
|
break;
|
2009-11-23 13:58:55 +00:00
|
|
|
|
2010-04-06 02:05:54 +00:00
|
|
|
case WAVEFORM:
|
|
|
|
ui_draw_but_WAVEFORM(ar, but, &tui->wcol_regular, rect);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case VECTORSCOPE:
|
|
|
|
ui_draw_but_VECTORSCOPE(ar, but, &tui->wcol_regular, rect);
|
|
|
|
break;
|
|
|
|
|
2009-04-06 15:44:30 +00:00
|
|
|
case BUT_CURVE:
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
ui_draw_but_CURVE(ar, but, &tui->wcol_regular, rect);
|
2009-04-03 16:26:03 +00:00
|
|
|
break;
|
2010-05-27 08:22:16 +00:00
|
|
|
|
|
|
|
case PROGRESSBAR:
|
|
|
|
wt= widget_type(UI_WTYPE_PROGRESSBAR);
|
|
|
|
fstyle= &style->widgetlabel;
|
|
|
|
break;
|
2009-06-24 14:16:56 +00:00
|
|
|
|
|
|
|
case SCROLL:
|
|
|
|
wt= widget_type(UI_WTYPE_SCROLL);
|
|
|
|
break;
|
|
|
|
|
2011-11-07 12:55:18 +00:00
|
|
|
case TRACKPREVIEW:
|
|
|
|
ui_draw_but_TRACKPREVIEW(ar, but, &tui->wcol_regular, rect);
|
|
|
|
break;
|
|
|
|
|
2009-04-03 16:26:03 +00:00
|
|
|
default:
|
2009-06-24 14:16:56 +00:00
|
|
|
wt= widget_type(UI_WTYPE_REGULAR);
|
2009-04-03 16:26:03 +00:00
|
|
|
}
|
2009-03-25 16:58:42 +00:00
|
|
|
}
|
|
|
|
|
2009-04-02 15:01:11 +00:00
|
|
|
if(wt) {
|
2009-04-12 13:40:29 +00:00
|
|
|
rcti disablerect= *rect; /* rect gets clipped smaller for text */
|
2009-04-02 15:01:11 +00:00
|
|
|
int roundboxalign, state;
|
|
|
|
|
2011-09-09 13:37:17 +00:00
|
|
|
roundboxalign= widget_roundbox_set(but, rect);
|
2009-06-24 14:16:56 +00:00
|
|
|
|
2009-04-02 15:01:11 +00:00
|
|
|
state= but->flag;
|
|
|
|
if(but->editstr) state |= UI_TEXTINPUT;
|
|
|
|
|
|
|
|
wt->state(wt, state);
|
2009-04-02 18:16:15 +00:00
|
|
|
if(wt->custom)
|
2009-04-09 18:11:18 +00:00
|
|
|
wt->custom(but, &wt->wcol, rect, state, roundboxalign);
|
2009-04-03 16:26:03 +00:00
|
|
|
else if(wt->draw)
|
2009-04-09 18:11:18 +00:00
|
|
|
wt->draw(&wt->wcol, rect, state, roundboxalign);
|
2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
shows the last operator, if appropriate.
Nkey properties moved to the other side.
A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;
- Buttons now all have a complete set of colors, based on button classifications
(See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types.
Currently colors are defined for Window, Header, List/Channels and
for Button/Tool views.
The screen manager handles this btw, so a TH_BACK will always pick the
right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
Only Panel font, widget font and widget-label work now. The 'group label'
will be for templates mostly.
Style settings will be expanded with spacing defaults, label conventions,
etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
Same goes for Panel title color.
Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
|
|
|
wt->text(fstyle, &wt->wcol, but, rect);
|
2009-04-02 15:01:11 +00:00
|
|
|
|
2009-05-28 23:37:55 +00:00
|
|
|
if(state & (UI_BUT_DISABLED|UI_BUT_INACTIVE))
|
2009-04-12 13:40:29 +00:00
|
|
|
if(but->dt!=UI_EMBOSSP)
|
|
|
|
widget_disabled(&disablerect);
|
2009-04-02 15:01:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-10-16 02:40:31 +00:00
|
|
|
void ui_draw_menu_back(uiStyle *UNUSED(style), uiBlock *block, rcti *rect)
|
2009-04-03 16:26:03 +00:00
|
|
|
{
|
|
|
|
uiWidgetType *wt= widget_type(UI_WTYPE_MENU_BACK);
|
|
|
|
|
|
|
|
wt->state(wt, 0);
|
2009-04-15 14:43:54 +00:00
|
|
|
if(block)
|
|
|
|
wt->draw(&wt->wcol, rect, block->flag, block->direction);
|
|
|
|
else
|
|
|
|
wt->draw(&wt->wcol, rect, 0, 0);
|
2009-04-03 16:26:03 +00:00
|
|
|
|
Code holiday commit:
- fix: user pref, window title was reset to 'Blender' on tab usage
- Undo history menu back:
- name "Undo History"
- hotkey alt+ctrl+z (alt+apple+z for mac)
- works like 2.4x, only for global undo, editmode and particle edit.
- Menu scroll
- for small windows or screens, popup menus now allow to display
all items, using internal scrolling
- works with a timer, scrolling 10 items per second when mouse
is over the top or bottom arrow
- if menu is too big to display, it now draws to top or bottom,
based on largest available space.
- also works for hotkey driven pop up menus.
- User pref "DPI" follows widget/layout size
- widgets & headers now become bigger and smaller, to match
'dpi' font sizes. Works well to match UI to monitor size.
- note that icons can get fuzzy, we need better mipmaps for it
2011-06-04 17:03:46 +00:00
|
|
|
if(block) {
|
|
|
|
if(block->flag & UI_BLOCK_CLIPTOP) {
|
|
|
|
/* XXX no scaling for UI here yet */
|
|
|
|
glColor3ubv((unsigned char*)wt->wcol.text);
|
|
|
|
UI_DrawTriIcon((rect->xmax+rect->xmin)/2, rect->ymax-8, 't');
|
|
|
|
}
|
|
|
|
if(block->flag & UI_BLOCK_CLIPBOTTOM) {
|
|
|
|
/* XXX no scaling for UI here yet */
|
|
|
|
glColor3ubv((unsigned char*)wt->wcol.text);
|
|
|
|
UI_DrawTriIcon((rect->xmax+rect->xmin)/2, rect->ymin+10, 'v');
|
|
|
|
}
|
|
|
|
}
|
2009-04-03 16:26:03 +00:00
|
|
|
}
|
2009-04-02 15:01:11 +00:00
|
|
|
|
2012-03-22 20:24:11 +00:00
|
|
|
uiWidgetColors* ui_tooltip_get_theme(void){
|
|
|
|
uiWidgetType *wt = widget_type(UI_WTYPE_TOOLTIP);
|
|
|
|
return wt->wcol_theme;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ui_draw_tooltip_background(uiStyle *UNUSED(style), uiBlock *UNUSED(block), rcti *rect)
|
2012-03-19 22:29:16 +00:00
|
|
|
{
|
|
|
|
uiWidgetType *wt = widget_type(UI_WTYPE_TOOLTIP);
|
|
|
|
wt->state(wt, 0);
|
|
|
|
/* wt->draw ends up using same function to draw the tooltip as menu_back */
|
|
|
|
wt->draw(&wt->wcol, rect, 0, 0);
|
|
|
|
}
|
|
|
|
|
2010-10-16 02:40:31 +00:00
|
|
|
void ui_draw_search_back(uiStyle *UNUSED(style), uiBlock *block, rcti *rect)
|
2009-06-03 18:31:37 +00:00
|
|
|
{
|
|
|
|
uiWidgetType *wt= widget_type(UI_WTYPE_BOX);
|
|
|
|
|
|
|
|
glEnable(GL_BLEND);
|
2011-09-11 06:41:09 +00:00
|
|
|
widget_softshadow(rect, UI_CNR_ALL, 5.0f, 8.0f);
|
2009-06-03 18:31:37 +00:00
|
|
|
glDisable(GL_BLEND);
|
|
|
|
|
|
|
|
wt->state(wt, 0);
|
|
|
|
if(block)
|
2011-09-11 06:41:09 +00:00
|
|
|
wt->draw(&wt->wcol, rect, block->flag, UI_CNR_ALL);
|
2009-06-03 18:31:37 +00:00
|
|
|
else
|
2011-09-11 06:41:09 +00:00
|
|
|
wt->draw(&wt->wcol, rect, 0, UI_CNR_ALL);
|
2009-06-03 18:31:37 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-06-02 18:10:06 +00:00
|
|
|
/* helper call to draw a menu item without button */
|
|
|
|
/* state: UI_ACTIVE or 0 */
|
2011-02-07 22:48:23 +00:00
|
|
|
void ui_draw_menu_item(uiFontStyle *fstyle, rcti *rect, const char *name, int iconid, int state)
|
2009-06-02 18:10:06 +00:00
|
|
|
{
|
|
|
|
uiWidgetType *wt= widget_type(UI_WTYPE_MENU_ITEM);
|
|
|
|
rcti _rect= *rect;
|
|
|
|
char *cpoin;
|
|
|
|
|
|
|
|
wt->state(wt, state);
|
|
|
|
wt->draw(&wt->wcol, rect, 0, 0);
|
|
|
|
|
|
|
|
uiStyleFontSet(fstyle);
|
|
|
|
fstyle->align= UI_STYLE_TEXT_LEFT;
|
|
|
|
|
|
|
|
/* text location offset */
|
|
|
|
rect->xmin+=5;
|
2011-08-05 10:45:32 +00:00
|
|
|
if(iconid) rect->xmin+= UI_DPI_ICON_SIZE;
|
2009-06-02 18:10:06 +00:00
|
|
|
|
|
|
|
/* cut string in 2 parts? */
|
|
|
|
cpoin= strchr(name, '|');
|
2009-06-03 18:31:37 +00:00
|
|
|
if(cpoin) {
|
|
|
|
*cpoin= 0;
|
BugFix:
[#20854] PROPERTIES STAMP: Rendering stamp flickers in output renders
Blenfont was not thread safe, that is why one thread can change
the font properties (size, dpi, color, etc) at the same time
that the stamp draw on the image, and then the problem.
To make blenfont thread safe I have to change two important things:
1) Every BLF_* function take one argument, the font id.
2) We have two new function to make font "thread safe":
BLF_load_unique
BLF_load_mem_unique
This two function are for case like stamp, that need and own font
that don't share the glyph cache, so can draw without problem
in a different thread.
Why the BLF_*_unique function ?
Because blenfont keep only one copy of a font and keep a list of
"glyph cache". Every glyph cache have size and dpi, so if two
different thread access the same font at the same time, they can
change value and finish with something like the stamp problem.
Why don't remove the glyph cache ?
Because if we do that, we finish with a font object for every size
and dpi, and the stamp is really a special case that happen in
the rendering process, so I really thing is better keep the
glyph cache and make this two new function to handle this
special case.
(When I say "font object" I mean have the same freetype font multiple
times just to have differents size and dpi)
As Matt point we still can have one case that two thread access
the BLF_*_unique function at the same time, but I am looking to
fix this with some class of thread lock.
For now I test and work fine, so if some one found problem, please
let me know.
Campbell I have to change the python api (python/generic/blf_api.c)
to the new syntax, so maybe you can take a look at this.
2010-04-22 10:56:45 +00:00
|
|
|
rect->xmax -= BLF_width(fstyle->uifont_id, cpoin+1) + 10;
|
2009-06-03 18:31:37 +00:00
|
|
|
}
|
2009-06-02 18:10:06 +00:00
|
|
|
|
2009-07-21 01:26:17 +00:00
|
|
|
glColor3ubv((unsigned char*)wt->wcol.text);
|
2009-06-02 18:10:06 +00:00
|
|
|
uiStyleFontDraw(fstyle, rect, name);
|
|
|
|
|
|
|
|
/* part text right aligned */
|
|
|
|
if(cpoin) {
|
|
|
|
fstyle->align= UI_STYLE_TEXT_RIGHT;
|
2012-03-24 02:51:46 +00:00
|
|
|
rect->xmax = _rect.xmax - 5;
|
2009-06-02 18:10:06 +00:00
|
|
|
uiStyleFontDraw(fstyle, rect, cpoin+1);
|
|
|
|
*cpoin= '|';
|
|
|
|
}
|
|
|
|
|
|
|
|
/* restore rect, was messed with */
|
|
|
|
*rect= _rect;
|
|
|
|
|
2009-06-24 16:44:54 +00:00
|
|
|
if(iconid) {
|
|
|
|
int xs= rect->xmin+4;
|
2011-08-05 10:45:32 +00:00
|
|
|
int ys= 1 + (rect->ymin+rect->ymax- UI_DPI_ICON_SIZE)/2;
|
2009-06-24 16:44:54 +00:00
|
|
|
glEnable(GL_BLEND);
|
Sorry, three commits in one, became difficult to untangle..
Editors Modules
* render/ module added in editors, moved the preview render code there and
also shading related operators.
* physics/ module made more consistent with other modules. renaming files,
making a single physics_ops.c for operators and keymaps. Also move all
particle related operators here now.
* space_buttons/ now should have only operators relevant to the buttons
specificially.
Updates & Notifiers
* Material/Texture/World/Lamp can now be passed to DAG_id_flush_update,
which will go back to a callback in editors. Eventually these should
be in the depsgraph itself, but for now this gives a unified call for
doing updates.
* GLSL materials are now refreshed on changes. There's still various
cases missing,
* Preview icons now hook into this system, solving various update cases
that were missed before.
* Also fixes issue in my last commit, where some preview would not render,
problem is avoided in the new system.
Icon Rendering
* On systems with support for non-power of two textures, an OpenGL texture
is now used instead of glDrawPixels. This avoids problems with icons get
clipped on region borders. On my Linux desktop, this gives an 1.1x speedup,
and on my Mac laptop a 2.3x speedup overall in redrawing the full window,
with the default setup. The glDrawPixels implementation on Mac seems to
have a lot of overhread.
* Preview icons are now drawn using proper premul alpha, and never faded so
you can see them clearly.
* Also tried to fix issue with texture node preview rendering, globals can't
be used with threads reliably.
2009-09-29 19:12:12 +00:00
|
|
|
UI_icon_draw_aspect(xs, ys, iconid, 1.2f, 0.5f); /* XXX scale weak get from fstyle? */
|
2009-06-24 16:44:54 +00:00
|
|
|
glDisable(GL_BLEND);
|
|
|
|
}
|
2009-06-02 18:10:06 +00:00
|
|
|
}
|
2009-03-25 16:58:42 +00:00
|
|
|
|
2011-02-07 22:48:23 +00:00
|
|
|
void ui_draw_preview_item(uiFontStyle *fstyle, rcti *rect, const char *name, int iconid, int state)
|
2010-01-03 08:37:18 +00:00
|
|
|
{
|
2012-02-28 20:46:55 +00:00
|
|
|
rcti trect = *rect, bg_rect;
|
2012-01-11 05:45:39 +00:00
|
|
|
float font_dims[2] = {0.0f, 0.0f};
|
2010-01-03 08:37:18 +00:00
|
|
|
uiWidgetType *wt= widget_type(UI_WTYPE_MENU_ITEM);
|
2012-02-28 20:46:55 +00:00
|
|
|
unsigned char bg_col[3];
|
2010-01-03 08:37:18 +00:00
|
|
|
|
|
|
|
wt->state(wt, state);
|
|
|
|
wt->draw(&wt->wcol, rect, 0, 0);
|
|
|
|
|
2011-01-20 16:29:43 +00:00
|
|
|
widget_draw_preview(iconid, 1.0f, rect);
|
2010-01-03 08:37:18 +00:00
|
|
|
|
2012-01-11 05:45:39 +00:00
|
|
|
BLF_width_and_height(fstyle->uifont_id, name, &font_dims[0], &font_dims[1]);
|
|
|
|
|
2012-02-28 01:55:27 +00:00
|
|
|
/* text rect */
|
2010-01-03 08:37:18 +00:00
|
|
|
trect.xmin += 0;
|
2012-01-11 05:45:39 +00:00
|
|
|
trect.xmax = trect.xmin + font_dims[0] + 10;
|
2010-01-03 08:37:18 +00:00
|
|
|
trect.ymin += 10;
|
2012-01-11 05:45:39 +00:00
|
|
|
trect.ymax = trect.ymin + font_dims[1];
|
2012-02-28 01:55:27 +00:00
|
|
|
if(trect.xmax > rect->xmax - PREVIEW_PAD)
|
|
|
|
trect.xmax = rect->xmax - PREVIEW_PAD;
|
|
|
|
|
2012-02-28 20:46:55 +00:00
|
|
|
bg_rect = trect;
|
|
|
|
bg_rect.xmin = rect->xmin + PREVIEW_PAD;
|
|
|
|
bg_rect.ymin = rect->ymin + PREVIEW_PAD;
|
2012-03-15 21:11:14 +00:00
|
|
|
bg_rect.xmax = rect->xmax - PREVIEW_PAD;
|
2012-02-28 20:46:55 +00:00
|
|
|
bg_rect.ymax += PREVIEW_PAD / 2;
|
|
|
|
|
|
|
|
if(bg_rect.xmax > rect->xmax - PREVIEW_PAD)
|
|
|
|
bg_rect.xmax = rect->xmax - PREVIEW_PAD;
|
|
|
|
|
|
|
|
UI_GetThemeColor3ubv(TH_BUTBACK, bg_col);
|
2012-03-15 21:11:14 +00:00
|
|
|
glColor4ubv((unsigned char*)wt->wcol.item);
|
|
|
|
glEnable(GL_BLEND);
|
2012-02-28 20:46:55 +00:00
|
|
|
glRecti(bg_rect.xmin, bg_rect.ymin, bg_rect.xmax, bg_rect.ymax);
|
2012-03-15 21:11:14 +00:00
|
|
|
glDisable(GL_BLEND);
|
2012-02-28 20:46:55 +00:00
|
|
|
|
|
|
|
if (state == UI_ACTIVE)
|
|
|
|
glColor3ubv((unsigned char*)wt->wcol.text);
|
|
|
|
else
|
|
|
|
glColor3ubv((unsigned char*)wt->wcol.text_sel);
|
|
|
|
|
2010-01-03 08:37:18 +00:00
|
|
|
uiStyleFontDraw(fstyle, &trect, name);
|
|
|
|
}
|