2011-02-23 10:52:22 +00:00
|
|
|
/*
|
2012-04-30 14:24:11 +00:00
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
2008-01-07 18:03:41 +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
|
2011-11-29 10:54:47 +00:00
|
|
|
* of the License, or (at your option) any later version.
|
2008-01-07 18:03:41 +00:00
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2008-01-07 18:03:41 +00:00
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* The Original Code is: all of this file.
|
|
|
|
*
|
|
|
|
* Contributor(s): none yet.
|
|
|
|
*
|
|
|
|
* ***** END GPL/BL DUAL LICENSE BLOCK *****
|
|
|
|
*/
|
|
|
|
|
2011-07-30 09:24:10 +00:00
|
|
|
/** \file blender/editors/interface/resources.c
|
|
|
|
* \ingroup edinterface
|
|
|
|
*/
|
|
|
|
|
2008-01-07 18:03:41 +00:00
|
|
|
#include <math.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
|
|
|
|
#include "DNA_screen_types.h"
|
|
|
|
#include "DNA_space_types.h"
|
2014-07-21 12:02:05 +02:00
|
|
|
#include "DNA_userdef_types.h"
|
2008-01-07 18:03:41 +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
|
|
|
#include "BLI_blenlib.h"
|
2011-01-07 18:36:47 +00:00
|
|
|
#include "BLI_utildefines.h"
|
2012-03-20 09:45:17 +00:00
|
|
|
#include "BLI_math.h"
|
2008-01-07 18:03:41 +00:00
|
|
|
|
2018-09-13 07:56:58 +10:00
|
|
|
#include "BKE_addon.h"
|
2014-11-23 14:37:13 +01:00
|
|
|
#include "BKE_appdir.h"
|
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
|
|
|
#include "BKE_main.h"
|
2018-06-25 13:03:56 +02:00
|
|
|
#include "BKE_mesh_runtime.h"
|
2008-01-07 18:03:41 +00:00
|
|
|
|
2018-09-12 18:22:00 +10:00
|
|
|
#include "BLO_readfile.h" /* for UserDef version patching. */
|
Port of part of the Interface code to 2.50.
This is based on the current trunk version, so these files should not need
merges. There's two things (clipboard and intptr_t) that are missing in 2.50
and commented out with XXX 2.48, these can be enabled again once trunk is
merged into this branch.
Further this is not all interface code, there are many parts commented out:
* interface.c: nearly all button types, missing: links, chartab, keyevent.
* interface_draw.c: almost all code, with some small exceptions.
* interface_ops.c: this replaces ui_do_but and uiDoBlocks with two operators,
making it non-blocking.
* interface_regions: this is a part of interface.c, split off, contains code to
create regions for tooltips, menus, pupmenu (that one is crashing currently),
color chooser, basically regions with buttons which is fairly independent of
core interface code.
* interface_panel.c and interface_icons.c: not ported over, so no panels and
icons yet. Panels should probably become (free floating) regions?
* text.c: (formerly language.c) for drawing text and translation. this works
but is using bad globals still and could be cleaned up.
Header Files:
* ED_datafiles.h now has declarations for datatoc_ files, so those extern
declarations can be #included instead of repeated.
* The user interface code is in UI_interface.h and other UI_* files.
Core:
* The API for creating blocks, buttons, etc is nearly the same still. Blocks
are now created per region instead of per area.
* The code was made non-blocking, which means that any changes and redraws
should be possible while editing a button. That means though that we need
some sort of persistence even though the blender model is to recreate buttons
for each redraw. So when a new block is created, some matching happens to
find out which buttons correspond to buttons in the previously created block,
and for activated buttons some data is then copied over to the new button.
* Added UI_init/UI_init_userdef/UI_exit functions that should initialize code
in this module, instead of multiple function calls in the windowmanager.
* Removed most static/globals from interface.c.
* Removed UIafterfunc_ I don't think it's needed anymore, and not sure how it
would integrate here?
* Currently only full window redraws are used, this should become per region
and maybe per button later.
Operators:
* Events are currently handled through two operators: button activate and menu
handle. Operators may not be the best way to implement this, since there are
currently some issues with events being missed, but they can become a special
handler type instead, this should not be a big change.
* The button activate operator runs as long as a button is active, and will
handle all interaction with that button until the button is not activated
anymore. This means clicking, text editing, number dragging, opening menu
blocks, etc.
* Since this operator has to be non-blocking, the ui_do_but code needed to made
non-blocking. That means variables that were previously on the stack, now
need to be stored away in a struct such that they can be accessed again when
the operator receives more events.
* Additionally the place in the ui_do_but code indicated the state, now that
needs to be set explicit in order to handle the right events in the right
state. So an activated button can be in one of these states: init, highlight,
wait_flash, wait_release, wait_key_event, num_editing, text_editing,
text_selecting, block_open, exit.
* For each button type an ui_apply_but_* function has also been separated out
from ui_do_but. This makes it possible to continuously apply the button as
text is being typed for example, and there is an option in the code to enable
this. Since the code non-blocking and can deal with the button being deleted
even, it should be safe to do this.
* When editing text, dragging numbers, etc, the actual data (but->poin) is not
being edited, since that would mean data is being edited without correct
updates happening, while some other part of blender may be accessing that
data in the meantime. So data values, strings, vectors are written to a
temporary location and only flush in the apply function.
Regions:
* Menus, color chooser, tooltips etc all create screen level regions. Such menu
blocks give a handle to the button that creates it, which will contain the
results of the menu block once a MESSAGE event is received from that menu
block.
* For this type of menu block the coordinates used to be in window space. They
are still created that way and ui_positionblock still works with window
coordinates, but after that the block and buttons are brought back to region
coordinates since these are now contained in a region.
* The flush/overdraw frontbuffer drawing code was removed, the windowmanager
should have enough information with these screen level regions to have full
control over what gets drawn when and to then do correct compositing.
Testing:
* The header in the time space currently has some buttons to test the UI code.
2008-11-11 18:31:32 +00:00
|
|
|
|
2017-02-01 19:00:30 -05:00
|
|
|
#include "BLF_api.h"
|
|
|
|
|
2018-06-01 15:04:51 +02:00
|
|
|
#include "ED_screen.h"
|
|
|
|
|
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
|
|
|
#include "UI_interface.h"
|
2008-12-03 17:36:30 +00:00
|
|
|
#include "UI_interface_icons.h"
|
2008-01-07 18:03:41 +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
|
|
|
#include "interface_intern.h"
|
2018-06-27 19:07:23 -06:00
|
|
|
#include "GPU_framebuffer.h"
|
2008-01-07 18:03:41 +00:00
|
|
|
|
|
|
|
/* global for themes */
|
|
|
|
typedef void (*VectorDrawFunc)(int x, int y, int w, int h, float alpha);
|
|
|
|
|
2015-01-04 23:20:56 +11:00
|
|
|
/* be sure to keep 'bThemeState' in sync */
|
|
|
|
static struct bThemeState g_theme_state = {
|
|
|
|
NULL,
|
|
|
|
SPACE_VIEW3D,
|
|
|
|
RGN_TYPE_WINDOW,
|
|
|
|
};
|
|
|
|
|
|
|
|
#define theme_active g_theme_state.theme
|
|
|
|
#define theme_spacetype g_theme_state.spacetype
|
|
|
|
#define theme_regionid g_theme_state.regionid
|
2008-01-07 18:03:41 +00:00
|
|
|
|
Port of part of the Interface code to 2.50.
This is based on the current trunk version, so these files should not need
merges. There's two things (clipboard and intptr_t) that are missing in 2.50
and commented out with XXX 2.48, these can be enabled again once trunk is
merged into this branch.
Further this is not all interface code, there are many parts commented out:
* interface.c: nearly all button types, missing: links, chartab, keyevent.
* interface_draw.c: almost all code, with some small exceptions.
* interface_ops.c: this replaces ui_do_but and uiDoBlocks with two operators,
making it non-blocking.
* interface_regions: this is a part of interface.c, split off, contains code to
create regions for tooltips, menus, pupmenu (that one is crashing currently),
color chooser, basically regions with buttons which is fairly independent of
core interface code.
* interface_panel.c and interface_icons.c: not ported over, so no panels and
icons yet. Panels should probably become (free floating) regions?
* text.c: (formerly language.c) for drawing text and translation. this works
but is using bad globals still and could be cleaned up.
Header Files:
* ED_datafiles.h now has declarations for datatoc_ files, so those extern
declarations can be #included instead of repeated.
* The user interface code is in UI_interface.h and other UI_* files.
Core:
* The API for creating blocks, buttons, etc is nearly the same still. Blocks
are now created per region instead of per area.
* The code was made non-blocking, which means that any changes and redraws
should be possible while editing a button. That means though that we need
some sort of persistence even though the blender model is to recreate buttons
for each redraw. So when a new block is created, some matching happens to
find out which buttons correspond to buttons in the previously created block,
and for activated buttons some data is then copied over to the new button.
* Added UI_init/UI_init_userdef/UI_exit functions that should initialize code
in this module, instead of multiple function calls in the windowmanager.
* Removed most static/globals from interface.c.
* Removed UIafterfunc_ I don't think it's needed anymore, and not sure how it
would integrate here?
* Currently only full window redraws are used, this should become per region
and maybe per button later.
Operators:
* Events are currently handled through two operators: button activate and menu
handle. Operators may not be the best way to implement this, since there are
currently some issues with events being missed, but they can become a special
handler type instead, this should not be a big change.
* The button activate operator runs as long as a button is active, and will
handle all interaction with that button until the button is not activated
anymore. This means clicking, text editing, number dragging, opening menu
blocks, etc.
* Since this operator has to be non-blocking, the ui_do_but code needed to made
non-blocking. That means variables that were previously on the stack, now
need to be stored away in a struct such that they can be accessed again when
the operator receives more events.
* Additionally the place in the ui_do_but code indicated the state, now that
needs to be set explicit in order to handle the right events in the right
state. So an activated button can be in one of these states: init, highlight,
wait_flash, wait_release, wait_key_event, num_editing, text_editing,
text_selecting, block_open, exit.
* For each button type an ui_apply_but_* function has also been separated out
from ui_do_but. This makes it possible to continuously apply the button as
text is being typed for example, and there is an option in the code to enable
this. Since the code non-blocking and can deal with the button being deleted
even, it should be safe to do this.
* When editing text, dragging numbers, etc, the actual data (but->poin) is not
being edited, since that would mean data is being edited without correct
updates happening, while some other part of blender may be accessing that
data in the meantime. So data values, strings, vectors are written to a
temporary location and only flush in the apply function.
Regions:
* Menus, color chooser, tooltips etc all create screen level regions. Such menu
blocks give a handle to the button that creates it, which will contain the
results of the menu block once a MESSAGE event is received from that menu
block.
* For this type of menu block the coordinates used to be in window space. They
are still created that way and ui_positionblock still works with window
coordinates, but after that the block and buttons are brought back to region
coordinates since these are now contained in a region.
* The flush/overdraw frontbuffer drawing code was removed, the windowmanager
should have enough information with these screen level regions to have full
control over what gets drawn when and to then do correct compositing.
Testing:
* The header in the time space currently has some buttons to test the UI code.
2008-11-11 18:31:32 +00:00
|
|
|
void ui_resources_init(void)
|
2008-01-07 18:03:41 +00:00
|
|
|
{
|
2018-07-24 12:43:21 +02:00
|
|
|
UI_icons_init();
|
2008-01-07 18:03:41 +00:00
|
|
|
}
|
|
|
|
|
Port of part of the Interface code to 2.50.
This is based on the current trunk version, so these files should not need
merges. There's two things (clipboard and intptr_t) that are missing in 2.50
and commented out with XXX 2.48, these can be enabled again once trunk is
merged into this branch.
Further this is not all interface code, there are many parts commented out:
* interface.c: nearly all button types, missing: links, chartab, keyevent.
* interface_draw.c: almost all code, with some small exceptions.
* interface_ops.c: this replaces ui_do_but and uiDoBlocks with two operators,
making it non-blocking.
* interface_regions: this is a part of interface.c, split off, contains code to
create regions for tooltips, menus, pupmenu (that one is crashing currently),
color chooser, basically regions with buttons which is fairly independent of
core interface code.
* interface_panel.c and interface_icons.c: not ported over, so no panels and
icons yet. Panels should probably become (free floating) regions?
* text.c: (formerly language.c) for drawing text and translation. this works
but is using bad globals still and could be cleaned up.
Header Files:
* ED_datafiles.h now has declarations for datatoc_ files, so those extern
declarations can be #included instead of repeated.
* The user interface code is in UI_interface.h and other UI_* files.
Core:
* The API for creating blocks, buttons, etc is nearly the same still. Blocks
are now created per region instead of per area.
* The code was made non-blocking, which means that any changes and redraws
should be possible while editing a button. That means though that we need
some sort of persistence even though the blender model is to recreate buttons
for each redraw. So when a new block is created, some matching happens to
find out which buttons correspond to buttons in the previously created block,
and for activated buttons some data is then copied over to the new button.
* Added UI_init/UI_init_userdef/UI_exit functions that should initialize code
in this module, instead of multiple function calls in the windowmanager.
* Removed most static/globals from interface.c.
* Removed UIafterfunc_ I don't think it's needed anymore, and not sure how it
would integrate here?
* Currently only full window redraws are used, this should become per region
and maybe per button later.
Operators:
* Events are currently handled through two operators: button activate and menu
handle. Operators may not be the best way to implement this, since there are
currently some issues with events being missed, but they can become a special
handler type instead, this should not be a big change.
* The button activate operator runs as long as a button is active, and will
handle all interaction with that button until the button is not activated
anymore. This means clicking, text editing, number dragging, opening menu
blocks, etc.
* Since this operator has to be non-blocking, the ui_do_but code needed to made
non-blocking. That means variables that were previously on the stack, now
need to be stored away in a struct such that they can be accessed again when
the operator receives more events.
* Additionally the place in the ui_do_but code indicated the state, now that
needs to be set explicit in order to handle the right events in the right
state. So an activated button can be in one of these states: init, highlight,
wait_flash, wait_release, wait_key_event, num_editing, text_editing,
text_selecting, block_open, exit.
* For each button type an ui_apply_but_* function has also been separated out
from ui_do_but. This makes it possible to continuously apply the button as
text is being typed for example, and there is an option in the code to enable
this. Since the code non-blocking and can deal with the button being deleted
even, it should be safe to do this.
* When editing text, dragging numbers, etc, the actual data (but->poin) is not
being edited, since that would mean data is being edited without correct
updates happening, while some other part of blender may be accessing that
data in the meantime. So data values, strings, vectors are written to a
temporary location and only flush in the apply function.
Regions:
* Menus, color chooser, tooltips etc all create screen level regions. Such menu
blocks give a handle to the button that creates it, which will contain the
results of the menu block once a MESSAGE event is received from that menu
block.
* For this type of menu block the coordinates used to be in window space. They
are still created that way and ui_positionblock still works with window
coordinates, but after that the block and buttons are brought back to region
coordinates since these are now contained in a region.
* The flush/overdraw frontbuffer drawing code was removed, the windowmanager
should have enough information with these screen level regions to have full
control over what gets drawn when and to then do correct compositing.
Testing:
* The header in the time space currently has some buttons to test the UI code.
2008-11-11 18:31:32 +00:00
|
|
|
void ui_resources_free(void)
|
2008-01-07 18:03:41 +00:00
|
|
|
{
|
2008-11-25 19:23:54 +00:00
|
|
|
UI_icons_free();
|
2008-01-07 18:03:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* ******************************************************** */
|
|
|
|
/* THEMES */
|
|
|
|
/* ******************************************************** */
|
|
|
|
|
2019-01-04 11:05:53 +11:00
|
|
|
const uchar *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid)
|
2008-01-07 18:03:41 +00:00
|
|
|
{
|
2012-03-30 01:51:25 +00:00
|
|
|
ThemeSpace *ts = NULL;
|
|
|
|
static char error[4] = {240, 0, 240, 255};
|
|
|
|
static char alert[4] = {240, 60, 60, 255};
|
|
|
|
static char headerdesel[4] = {0, 0, 0, 255};
|
2018-06-01 15:04:51 +02:00
|
|
|
static char back[4] = {0, 0, 0, 255};
|
2012-12-15 16:22:18 +00:00
|
|
|
static char setting = 0;
|
2012-03-30 01:51:25 +00:00
|
|
|
const char *cp = error;
|
2018-05-23 10:47:12 +02:00
|
|
|
|
2016-04-24 22:42:41 +10:00
|
|
|
/* ensure we're not getting a color after running BKE_blender_userdef_free */
|
2014-02-18 12:33:19 +11:00
|
|
|
BLI_assert(BLI_findindex(&U.themes, theme_active) != -1);
|
2014-06-04 14:22:29 +10:00
|
|
|
BLI_assert(colorid != TH_UNDEFINED);
|
2014-02-18 12:33:19 +11:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (btheme) {
|
2018-05-23 10:47:12 +02:00
|
|
|
|
2012-07-07 22:51:57 +00:00
|
|
|
/* first check for ui buttons theme */
|
2012-03-24 06:38:07 +00:00
|
|
|
if (colorid < TH_THEMEUI) {
|
2018-05-23 10:47:12 +02:00
|
|
|
|
2012-03-30 01:51:25 +00:00
|
|
|
switch (colorid) {
|
2008-01-07 18:03:41 +00:00
|
|
|
|
2012-03-30 01:51:25 +00:00
|
|
|
case TH_REDALERT:
|
|
|
|
cp = alert; break;
|
2008-01-07 18:03:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2018-05-23 10:47:12 +02:00
|
|
|
|
2012-03-30 01:51:25 +00:00
|
|
|
switch (spacetype) {
|
|
|
|
case SPACE_BUTS:
|
|
|
|
ts = &btheme->tbuts;
|
|
|
|
break;
|
|
|
|
case SPACE_VIEW3D:
|
|
|
|
ts = &btheme->tv3d;
|
|
|
|
break;
|
|
|
|
case SPACE_IPO:
|
|
|
|
ts = &btheme->tipo;
|
|
|
|
break;
|
|
|
|
case SPACE_FILE:
|
|
|
|
ts = &btheme->tfile;
|
|
|
|
break;
|
|
|
|
case SPACE_NLA:
|
|
|
|
ts = &btheme->tnla;
|
|
|
|
break;
|
|
|
|
case SPACE_ACTION:
|
|
|
|
ts = &btheme->tact;
|
|
|
|
break;
|
|
|
|
case SPACE_SEQ:
|
|
|
|
ts = &btheme->tseq;
|
|
|
|
break;
|
|
|
|
case SPACE_IMAGE:
|
|
|
|
ts = &btheme->tima;
|
|
|
|
break;
|
|
|
|
case SPACE_TEXT:
|
|
|
|
ts = &btheme->text;
|
|
|
|
break;
|
|
|
|
case SPACE_OUTLINER:
|
|
|
|
ts = &btheme->toops;
|
|
|
|
break;
|
|
|
|
case SPACE_INFO:
|
|
|
|
ts = &btheme->tinfo;
|
|
|
|
break;
|
|
|
|
case SPACE_USERPREF:
|
|
|
|
ts = &btheme->tuserpref;
|
|
|
|
break;
|
|
|
|
case SPACE_CONSOLE:
|
|
|
|
ts = &btheme->tconsole;
|
|
|
|
break;
|
|
|
|
case SPACE_NODE:
|
|
|
|
ts = &btheme->tnode;
|
|
|
|
break;
|
|
|
|
case SPACE_CLIP:
|
|
|
|
ts = &btheme->tclip;
|
|
|
|
break;
|
UI: New Global Top-Bar (WIP)
== Main Features/Changes for Users
* Add horizontal bar at top of all non-temp windows, consisting out of two horizontal sub-bars.
* Upper sub-bar contains global menus (File, Render, etc.), tabs for workspaces and scene selector.
* Lower sub-bar contains object mode selector, screen-layout and render-layer selector. Later operator and/or tool settings will be placed here.
* Individual sections of the topbar are individually scrollable.
* Workspace tabs can be double- or ctrl-clicked for renaming and contain 'x' icon for deleting.
* Top-bar should scale nicely with DPI.
* The lower half of the top-bar can be hided by dragging the lower top-bar edge up. Better hiding options are planned (e.g. hide in fullscreen modes).
* Info editors at the top of the window and using the full window width with be replaced by the top-bar.
* In fullscreen modes, no more info editor is added on top, the top-bar replaces it.
== Technical Features/Changes
* Adds initial support for global areas
A global area is part of the window, not part of the regular screen-layout.
I've added a macro iterator to iterate over both, global and screen-layout level areas. When iterating over areas, from now on developers should always consider if they have to include global areas.
* Adds a TOPBAR editor type
The editor type is hidden in the UI editor type menu.
* Adds a variation of the ID template to display IDs as tab buttons (template_ID_tabs in BPY)
* Does various changes to RNA button creation code to improve their appearance in the horizontal top-bar.
* Adds support for dynamically sized regions. That is, regions that scale automatically to the layout bounds.
The code for this is currently a big hack (it's based on drawing the UI multiple times). This should definitely be improved.
* Adds a template for displaying operator properties optimized for the top-bar. This will probably change a lot still and is in fact disabled in code.
Since the final top-bar design depends a lot on other 2.8 designs (mainly tool-system and workspaces), we decided to not show the operator or tool settings in the top-bar for now. That means most of the lower sub-bar is empty for the time being.
NOTE: Top-bar or global area data is not written to files or SDNA. They are simply added to the window when opening Blender or reading a file. This allows us doing changes to the top-bar without having to care for compatibility.
== ToDo's
It's a bit hard to predict all the ToDo's here are the known main ones:
* Add options for the new active-tool system and for operator redo to the topbar.
* Automatically hide the top-bar in fullscreen modes.
* General visual polish.
* Top-bar drag & drop support (WIP in temp-tab_drag_drop).
* Improve dynamic regions (should also fix some layout glitches).
* Make internal terminology consistent.
* Enable topbar file writing once design is more advanced.
* Address TODO's and XXX's in code :)
Thanks @brecht for the review! And @sergey for the complaining ;)
Differential Revision: D2758
2018-04-20 17:14:03 +02:00
|
|
|
case SPACE_TOPBAR:
|
|
|
|
ts = &btheme->ttopbar;
|
|
|
|
break;
|
2018-05-24 10:19:27 +02:00
|
|
|
case SPACE_STATUSBAR:
|
|
|
|
ts = &btheme->tstatusbar;
|
|
|
|
break;
|
2012-03-30 01:51:25 +00:00
|
|
|
default:
|
|
|
|
ts = &btheme->tv3d;
|
|
|
|
break;
|
2008-01-07 18:03:41 +00:00
|
|
|
}
|
2012-03-30 01:51:25 +00:00
|
|
|
|
|
|
|
switch (colorid) {
|
|
|
|
case TH_BACK:
|
2018-05-07 14:57:05 +02:00
|
|
|
if (ELEM(theme_regionid, RGN_TYPE_WINDOW, RGN_TYPE_PREVIEW))
|
2012-03-30 01:51:25 +00:00
|
|
|
cp = ts->back;
|
|
|
|
else if (theme_regionid == RGN_TYPE_CHANNELS)
|
|
|
|
cp = ts->list;
|
|
|
|
else if (theme_regionid == RGN_TYPE_HEADER)
|
|
|
|
cp = ts->header;
|
UI: Vertical Properties Editor Tabs
Moves the Properties editor context switching to a vertical tabs region.
Design Task: T54951
Differential Revison: D3840
The tabs are regular widgets, unlike the 'old' toolshelf tabs. This means they
give mouse hover feedback, have tooltips, support the right-click menu, etc.
Also, when vertical screen space gets tight, the tabs can be scrolled, they
don't shrink like the toolshelf ones.
The tab region is slightly larger than the header. The tabs are scaled up
accordingly. This makes them nicely readable.
The header is quite empty now. As shown in T54951, we wanted to have a search
button there. This should be added next.
Implementation Notes:
* Added a new region type, RGN_TYPE_NAVIGATION.
* Having the tabs in a separate region allows scrolling of the tab-bar, unlike
the toolshelf tabs. We might want to remove the scrollbars though.
* Added a new region flag RGN_FLAG_PREFSIZE_OR_HIDDEN, to ensure the tab region
is either hidden or has a fixed size.
* Added some additional flags to support fine-tuning the layout in panel and
layout code.
* Bumps subversion.
2018-10-29 21:34:14 +01:00
|
|
|
else if (theme_regionid == RGN_TYPE_NAV_BAR)
|
|
|
|
cp = ts->navigation_bar;
|
2018-06-01 15:42:00 +02:00
|
|
|
else
|
2012-03-30 01:51:25 +00:00
|
|
|
cp = ts->button;
|
2018-06-01 15:04:51 +02:00
|
|
|
|
2018-06-01 15:42:00 +02:00
|
|
|
copy_v4_v4_char(back, cp);
|
|
|
|
if (!ED_region_is_overlap(spacetype, theme_regionid)) {
|
|
|
|
back[3] = 255;
|
2018-06-01 15:37:53 +02:00
|
|
|
}
|
2018-06-01 15:42:00 +02:00
|
|
|
cp = back;
|
2012-03-30 01:51:25 +00:00
|
|
|
break;
|
2013-01-07 15:42:42 +00:00
|
|
|
case TH_LOW_GRAD:
|
2013-01-06 16:45:10 +00:00
|
|
|
cp = ts->gradients.gradient;
|
|
|
|
break;
|
2013-01-07 15:42:42 +00:00
|
|
|
case TH_HIGH_GRAD:
|
|
|
|
cp = ts->gradients.high_gradient;
|
|
|
|
break;
|
2013-01-06 16:45:10 +00:00
|
|
|
case TH_SHOW_BACK_GRAD:
|
|
|
|
cp = &setting;
|
|
|
|
setting = ts->gradients.show_grad;
|
|
|
|
break;
|
2012-03-30 01:51:25 +00:00
|
|
|
case TH_TEXT:
|
|
|
|
if (theme_regionid == RGN_TYPE_WINDOW)
|
|
|
|
cp = ts->text;
|
|
|
|
else if (theme_regionid == RGN_TYPE_CHANNELS)
|
|
|
|
cp = ts->list_text;
|
|
|
|
else if (theme_regionid == RGN_TYPE_HEADER)
|
|
|
|
cp = ts->header_text;
|
|
|
|
else
|
|
|
|
cp = ts->button_text;
|
|
|
|
break;
|
|
|
|
case TH_TEXT_HI:
|
|
|
|
if (theme_regionid == RGN_TYPE_WINDOW)
|
|
|
|
cp = ts->text_hi;
|
|
|
|
else if (theme_regionid == RGN_TYPE_CHANNELS)
|
|
|
|
cp = ts->list_text_hi;
|
|
|
|
else if (theme_regionid == RGN_TYPE_HEADER)
|
|
|
|
cp = ts->header_text_hi;
|
|
|
|
else
|
|
|
|
cp = ts->button_text_hi;
|
|
|
|
break;
|
|
|
|
case TH_TITLE:
|
|
|
|
if (theme_regionid == RGN_TYPE_WINDOW)
|
|
|
|
cp = ts->title;
|
|
|
|
else if (theme_regionid == RGN_TYPE_CHANNELS)
|
|
|
|
cp = ts->list_title;
|
|
|
|
else if (theme_regionid == RGN_TYPE_HEADER)
|
|
|
|
cp = ts->header_title;
|
|
|
|
else
|
|
|
|
cp = ts->button_title;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TH_HEADER:
|
|
|
|
cp = ts->header; break;
|
|
|
|
case TH_HEADERDESEL:
|
|
|
|
/* we calculate a dynamic builtin header deselect color, also for pulldowns... */
|
|
|
|
cp = ts->header;
|
|
|
|
headerdesel[0] = cp[0] > 10 ? cp[0] - 10 : 0;
|
|
|
|
headerdesel[1] = cp[1] > 10 ? cp[1] - 10 : 0;
|
|
|
|
headerdesel[2] = cp[2] > 10 ? cp[2] - 10 : 0;
|
2018-04-21 18:37:03 +02:00
|
|
|
headerdesel[3] = cp[3];
|
2012-03-30 01:51:25 +00:00
|
|
|
cp = headerdesel;
|
|
|
|
break;
|
|
|
|
case TH_HEADER_TEXT:
|
|
|
|
cp = ts->header_text; break;
|
|
|
|
case TH_HEADER_TEXT_HI:
|
|
|
|
cp = ts->header_text_hi; break;
|
|
|
|
|
2012-12-15 16:22:18 +00:00
|
|
|
case TH_PANEL_HEADER:
|
|
|
|
cp = ts->panelcolors.header; break;
|
|
|
|
case TH_PANEL_BACK:
|
|
|
|
cp = ts->panelcolors.back; break;
|
2018-06-03 13:32:36 +02:00
|
|
|
case TH_PANEL_SUB_BACK:
|
|
|
|
cp = ts->panelcolors.sub_back; break;
|
2018-05-23 10:47:12 +02:00
|
|
|
|
2012-03-30 01:51:25 +00:00
|
|
|
case TH_BUTBACK:
|
|
|
|
cp = ts->button; break;
|
|
|
|
case TH_BUTBACK_TEXT:
|
|
|
|
cp = ts->button_text; break;
|
|
|
|
case TH_BUTBACK_TEXT_HI:
|
|
|
|
cp = ts->button_text_hi; break;
|
|
|
|
|
2014-01-23 11:44:35 +11:00
|
|
|
case TH_TAB_ACTIVE:
|
|
|
|
cp = ts->tab_active; break;
|
|
|
|
case TH_TAB_INACTIVE:
|
|
|
|
cp = ts->tab_inactive; break;
|
|
|
|
case TH_TAB_BACK:
|
|
|
|
cp = ts->tab_back; break;
|
|
|
|
case TH_TAB_OUTLINE:
|
|
|
|
cp = ts->tab_outline; break;
|
|
|
|
|
2012-03-30 01:51:25 +00:00
|
|
|
case TH_SHADE1:
|
|
|
|
cp = ts->shade1; break;
|
|
|
|
case TH_SHADE2:
|
|
|
|
cp = ts->shade2; break;
|
|
|
|
case TH_HILITE:
|
|
|
|
cp = ts->hilite; break;
|
2018-05-23 10:47:12 +02:00
|
|
|
|
2012-03-30 01:51:25 +00:00
|
|
|
case TH_GRID:
|
|
|
|
cp = ts->grid; break;
|
2014-03-18 05:34:43 +11:00
|
|
|
case TH_VIEW_OVERLAY:
|
|
|
|
cp = ts->view_overlay; break;
|
2012-03-30 01:51:25 +00:00
|
|
|
case TH_WIRE:
|
|
|
|
cp = ts->wire; break;
|
2014-10-14 10:16:46 +02:00
|
|
|
case TH_WIRE_INNER:
|
|
|
|
cp = ts->syntaxr; break;
|
2013-06-08 21:58:00 +00:00
|
|
|
case TH_WIRE_EDIT:
|
|
|
|
cp = ts->wire_edit; break;
|
2012-03-30 01:51:25 +00:00
|
|
|
case TH_LAMP:
|
|
|
|
cp = ts->lamp; break;
|
|
|
|
case TH_SPEAKER:
|
|
|
|
cp = ts->speaker; break;
|
|
|
|
case TH_CAMERA:
|
|
|
|
cp = ts->camera; break;
|
|
|
|
case TH_EMPTY:
|
|
|
|
cp = ts->empty; break;
|
|
|
|
case TH_SELECT:
|
|
|
|
cp = ts->select; break;
|
|
|
|
case TH_ACTIVE:
|
|
|
|
cp = ts->active; break;
|
|
|
|
case TH_GROUP:
|
|
|
|
cp = ts->group; break;
|
|
|
|
case TH_GROUP_ACTIVE:
|
|
|
|
cp = ts->group_active; break;
|
|
|
|
case TH_TRANSFORM:
|
|
|
|
cp = ts->transform; break;
|
|
|
|
case TH_VERTEX:
|
|
|
|
cp = ts->vertex; break;
|
|
|
|
case TH_VERTEX_SELECT:
|
|
|
|
cp = ts->vertex_select; break;
|
2016-09-21 23:04:26 +02:00
|
|
|
case TH_VERTEX_BEVEL:
|
|
|
|
cp = ts->vertex_bevel; break;
|
2013-03-05 20:30:38 +00:00
|
|
|
case TH_VERTEX_UNREFERENCED:
|
|
|
|
cp = ts->vertex_unreferenced; break;
|
2012-03-30 01:51:25 +00:00
|
|
|
case TH_VERTEX_SIZE:
|
|
|
|
cp = &ts->vertex_size; break;
|
|
|
|
case TH_OUTLINE_WIDTH:
|
|
|
|
cp = &ts->outline_width; break;
|
|
|
|
case TH_EDGE:
|
|
|
|
cp = ts->edge; break;
|
|
|
|
case TH_EDGE_SELECT:
|
|
|
|
cp = ts->edge_select; break;
|
|
|
|
case TH_EDGE_SEAM:
|
|
|
|
cp = ts->edge_seam; break;
|
|
|
|
case TH_EDGE_SHARP:
|
|
|
|
cp = ts->edge_sharp; break;
|
|
|
|
case TH_EDGE_CREASE:
|
|
|
|
cp = ts->edge_crease; break;
|
2016-09-21 23:04:26 +02:00
|
|
|
case TH_EDGE_BEVEL:
|
|
|
|
cp = ts->edge_bevel; break;
|
2012-03-30 01:51:25 +00:00
|
|
|
case TH_EDITMESH_ACTIVE:
|
|
|
|
cp = ts->editmesh_active; break;
|
|
|
|
case TH_EDGE_FACESEL:
|
|
|
|
cp = ts->edge_facesel; break;
|
|
|
|
case TH_FACE:
|
|
|
|
cp = ts->face; break;
|
|
|
|
case TH_FACE_SELECT:
|
|
|
|
cp = ts->face_select; break;
|
|
|
|
case TH_FACE_DOT:
|
|
|
|
cp = ts->face_dot; break;
|
|
|
|
case TH_FACEDOT_SIZE:
|
|
|
|
cp = &ts->facedot_size; break;
|
|
|
|
case TH_DRAWEXTRA_EDGELEN:
|
|
|
|
cp = ts->extra_edge_len; break;
|
2013-03-29 04:01:52 +00:00
|
|
|
case TH_DRAWEXTRA_EDGEANG:
|
|
|
|
cp = ts->extra_edge_angle; break;
|
2012-03-30 01:51:25 +00:00
|
|
|
case TH_DRAWEXTRA_FACEAREA:
|
|
|
|
cp = ts->extra_face_area; break;
|
|
|
|
case TH_DRAWEXTRA_FACEANG:
|
|
|
|
cp = ts->extra_face_angle; break;
|
|
|
|
case TH_NORMAL:
|
|
|
|
cp = ts->normal; break;
|
|
|
|
case TH_VNORMAL:
|
|
|
|
cp = ts->vertex_normal; break;
|
2014-08-25 12:45:49 +02:00
|
|
|
case TH_LNORMAL:
|
|
|
|
cp = ts->loop_normal; break;
|
2012-03-30 01:51:25 +00:00
|
|
|
case TH_BONE_SOLID:
|
|
|
|
cp = ts->bone_solid; break;
|
|
|
|
case TH_BONE_POSE:
|
|
|
|
cp = ts->bone_pose; break;
|
2012-07-26 10:53:59 +00:00
|
|
|
case TH_BONE_POSE_ACTIVE:
|
|
|
|
cp = ts->bone_pose_active; break;
|
2012-03-30 01:51:25 +00:00
|
|
|
case TH_STRIP:
|
|
|
|
cp = ts->strip; break;
|
|
|
|
case TH_STRIP_SELECT:
|
|
|
|
cp = ts->strip_select; break;
|
2014-01-07 22:45:40 +13:00
|
|
|
case TH_KEYTYPE_KEYFRAME:
|
|
|
|
cp = ts->keytype_keyframe; break;
|
|
|
|
case TH_KEYTYPE_KEYFRAME_SELECT:
|
|
|
|
cp = ts->keytype_keyframe_select; break;
|
|
|
|
case TH_KEYTYPE_EXTREME:
|
|
|
|
cp = ts->keytype_extreme; break;
|
|
|
|
case TH_KEYTYPE_EXTREME_SELECT:
|
|
|
|
cp = ts->keytype_extreme_select; break;
|
|
|
|
case TH_KEYTYPE_BREAKDOWN:
|
|
|
|
cp = ts->keytype_breakdown; break;
|
|
|
|
case TH_KEYTYPE_BREAKDOWN_SELECT:
|
|
|
|
cp = ts->keytype_breakdown_select; break;
|
|
|
|
case TH_KEYTYPE_JITTER:
|
|
|
|
cp = ts->keytype_jitter; break;
|
|
|
|
case TH_KEYTYPE_JITTER_SELECT:
|
|
|
|
cp = ts->keytype_jitter_select; break;
|
2018-10-18 23:48:06 +03:00
|
|
|
case TH_KEYTYPE_MOVEHOLD:
|
|
|
|
cp = ts->keytype_movehold; break;
|
|
|
|
case TH_KEYTYPE_MOVEHOLD_SELECT:
|
|
|
|
cp = ts->keytype_movehold_select; break;
|
2014-01-07 22:45:40 +13:00
|
|
|
case TH_KEYBORDER:
|
|
|
|
cp = ts->keyborder; break;
|
|
|
|
case TH_KEYBORDER_SELECT:
|
|
|
|
cp = ts->keyborder_select; break;
|
2012-03-30 01:51:25 +00:00
|
|
|
case TH_CFRAME:
|
|
|
|
cp = ts->cframe; break;
|
2015-01-04 00:48:29 +13:00
|
|
|
case TH_TIME_KEYFRAME:
|
|
|
|
cp = ts->time_keyframe; break;
|
|
|
|
case TH_TIME_GP_KEYFRAME:
|
|
|
|
cp = ts->time_gp_keyframe; break;
|
2012-03-30 01:51:25 +00:00
|
|
|
case TH_NURB_ULINE:
|
|
|
|
cp = ts->nurb_uline; break;
|
|
|
|
case TH_NURB_VLINE:
|
|
|
|
cp = ts->nurb_vline; break;
|
|
|
|
case TH_NURB_SEL_ULINE:
|
|
|
|
cp = ts->nurb_sel_uline; break;
|
|
|
|
case TH_NURB_SEL_VLINE:
|
|
|
|
cp = ts->nurb_sel_vline; break;
|
|
|
|
case TH_ACTIVE_SPLINE:
|
|
|
|
cp = ts->act_spline; break;
|
2014-01-27 15:18:40 +11:00
|
|
|
case TH_ACTIVE_VERT:
|
2012-03-30 01:51:25 +00:00
|
|
|
cp = ts->lastsel_point; break;
|
|
|
|
case TH_HANDLE_FREE:
|
|
|
|
cp = ts->handle_free; break;
|
|
|
|
case TH_HANDLE_AUTO:
|
|
|
|
cp = ts->handle_auto; break;
|
|
|
|
case TH_HANDLE_AUTOCLAMP:
|
|
|
|
cp = ts->handle_auto_clamped; break;
|
|
|
|
case TH_HANDLE_VECT:
|
|
|
|
cp = ts->handle_vect; break;
|
|
|
|
case TH_HANDLE_ALIGN:
|
|
|
|
cp = ts->handle_align; break;
|
|
|
|
case TH_HANDLE_SEL_FREE:
|
|
|
|
cp = ts->handle_sel_free; break;
|
|
|
|
case TH_HANDLE_SEL_AUTO:
|
|
|
|
cp = ts->handle_sel_auto; break;
|
|
|
|
case TH_HANDLE_SEL_AUTOCLAMP:
|
|
|
|
cp = ts->handle_sel_auto_clamped; break;
|
|
|
|
case TH_HANDLE_SEL_VECT:
|
|
|
|
cp = ts->handle_sel_vect; break;
|
|
|
|
case TH_HANDLE_SEL_ALIGN:
|
|
|
|
cp = ts->handle_sel_align; break;
|
2012-03-31 22:09:43 +00:00
|
|
|
case TH_FREESTYLE_EDGE_MARK:
|
|
|
|
cp = ts->freestyle_edge_mark; break;
|
|
|
|
case TH_FREESTYLE_FACE_MARK:
|
|
|
|
cp = ts->freestyle_face_mark; break;
|
2012-03-30 01:51:25 +00:00
|
|
|
|
|
|
|
case TH_SYNTAX_B:
|
|
|
|
cp = ts->syntaxb; break;
|
|
|
|
case TH_SYNTAX_V:
|
|
|
|
cp = ts->syntaxv; break;
|
|
|
|
case TH_SYNTAX_C:
|
|
|
|
cp = ts->syntaxc; break;
|
|
|
|
case TH_SYNTAX_L:
|
|
|
|
cp = ts->syntaxl; break;
|
2012-12-29 18:25:03 +00:00
|
|
|
case TH_SYNTAX_D:
|
|
|
|
cp = ts->syntaxd; break;
|
|
|
|
case TH_SYNTAX_R:
|
|
|
|
cp = ts->syntaxr; break;
|
2012-03-30 01:51:25 +00:00
|
|
|
case TH_SYNTAX_N:
|
|
|
|
cp = ts->syntaxn; break;
|
2012-12-30 01:26:31 +00:00
|
|
|
case TH_SYNTAX_S:
|
|
|
|
cp = ts->syntaxs; break;
|
2012-03-30 01:51:25 +00:00
|
|
|
|
|
|
|
case TH_NODE:
|
|
|
|
cp = ts->syntaxl; break;
|
2013-12-01 21:30:04 +01:00
|
|
|
case TH_NODE_INPUT:
|
2012-03-30 01:51:25 +00:00
|
|
|
cp = ts->syntaxn; break;
|
2013-12-01 21:30:04 +01:00
|
|
|
case TH_NODE_OUTPUT:
|
|
|
|
cp = ts->nodeclass_output; break;
|
|
|
|
case TH_NODE_COLOR:
|
2012-03-30 01:51:25 +00:00
|
|
|
cp = ts->syntaxb; break;
|
2013-12-01 21:30:04 +01:00
|
|
|
case TH_NODE_FILTER:
|
|
|
|
cp = ts->nodeclass_filter; break;
|
|
|
|
case TH_NODE_VECTOR:
|
|
|
|
cp = ts->nodeclass_vector; break;
|
|
|
|
case TH_NODE_TEXTURE:
|
|
|
|
cp = ts->nodeclass_texture; break;
|
|
|
|
case TH_NODE_PATTERN:
|
|
|
|
cp = ts->nodeclass_pattern; break;
|
|
|
|
case TH_NODE_SCRIPT:
|
|
|
|
cp = ts->nodeclass_script; break;
|
|
|
|
case TH_NODE_LAYOUT:
|
|
|
|
cp = ts->nodeclass_layout; break;
|
|
|
|
case TH_NODE_SHADER:
|
|
|
|
cp = ts->nodeclass_shader; break;
|
2012-03-30 01:51:25 +00:00
|
|
|
case TH_NODE_CONVERTOR:
|
|
|
|
cp = ts->syntaxv; break;
|
|
|
|
case TH_NODE_GROUP:
|
|
|
|
cp = ts->syntaxc; break;
|
2013-03-18 16:34:57 +00:00
|
|
|
case TH_NODE_INTERFACE:
|
2013-03-18 18:25:05 +00:00
|
|
|
cp = ts->console_output; break;
|
2012-06-01 14:42:21 +00:00
|
|
|
case TH_NODE_FRAME:
|
|
|
|
cp = ts->movie; break;
|
2013-01-19 04:20:53 +00:00
|
|
|
case TH_NODE_MATTE:
|
|
|
|
cp = ts->syntaxs; break;
|
|
|
|
case TH_NODE_DISTORT:
|
|
|
|
cp = ts->syntaxd; break;
|
2012-03-30 01:51:25 +00:00
|
|
|
case TH_NODE_CURVING:
|
|
|
|
cp = &ts->noodle_curving; break;
|
|
|
|
|
|
|
|
case TH_SEQ_MOVIE:
|
|
|
|
cp = ts->movie; break;
|
|
|
|
case TH_SEQ_MOVIECLIP:
|
|
|
|
cp = ts->movieclip; break;
|
2012-06-07 18:24:36 +00:00
|
|
|
case TH_SEQ_MASK:
|
|
|
|
cp = ts->mask; break;
|
2012-03-30 01:51:25 +00:00
|
|
|
case TH_SEQ_IMAGE:
|
|
|
|
cp = ts->image; break;
|
|
|
|
case TH_SEQ_SCENE:
|
|
|
|
cp = ts->scene; break;
|
|
|
|
case TH_SEQ_AUDIO:
|
|
|
|
cp = ts->audio; break;
|
|
|
|
case TH_SEQ_EFFECT:
|
|
|
|
cp = ts->effect; break;
|
|
|
|
case TH_SEQ_TRANSITION:
|
|
|
|
cp = ts->transition; break;
|
|
|
|
case TH_SEQ_META:
|
|
|
|
cp = ts->meta; break;
|
2015-12-01 23:56:48 +01:00
|
|
|
case TH_SEQ_TEXT:
|
|
|
|
cp = ts->text_strip; break;
|
2012-03-30 01:51:25 +00:00
|
|
|
case TH_SEQ_PREVIEW:
|
|
|
|
cp = ts->preview_back; break;
|
|
|
|
|
|
|
|
case TH_CONSOLE_OUTPUT:
|
|
|
|
cp = ts->console_output; break;
|
|
|
|
case TH_CONSOLE_INPUT:
|
|
|
|
cp = ts->console_input; break;
|
|
|
|
case TH_CONSOLE_INFO:
|
|
|
|
cp = ts->console_info; break;
|
|
|
|
case TH_CONSOLE_ERROR:
|
|
|
|
cp = ts->console_error; break;
|
|
|
|
case TH_CONSOLE_CURSOR:
|
|
|
|
cp = ts->console_cursor; break;
|
2013-02-18 02:36:36 +00:00
|
|
|
case TH_CONSOLE_SELECT:
|
|
|
|
cp = ts->console_select; break;
|
2012-03-30 01:51:25 +00:00
|
|
|
|
|
|
|
case TH_HANDLE_VERTEX:
|
|
|
|
cp = ts->handle_vertex;
|
|
|
|
break;
|
|
|
|
case TH_HANDLE_VERTEX_SELECT:
|
|
|
|
cp = ts->handle_vertex_select;
|
|
|
|
break;
|
|
|
|
case TH_HANDLE_VERTEX_SIZE:
|
|
|
|
cp = &ts->handle_vertex_size;
|
|
|
|
break;
|
2018-05-23 10:47:12 +02:00
|
|
|
|
2015-01-03 18:07:05 +13:00
|
|
|
case TH_GP_VERTEX:
|
|
|
|
cp = ts->gp_vertex;
|
|
|
|
break;
|
|
|
|
case TH_GP_VERTEX_SELECT:
|
|
|
|
cp = ts->gp_vertex_select;
|
|
|
|
break;
|
|
|
|
case TH_GP_VERTEX_SIZE:
|
|
|
|
cp = &ts->gp_vertex_size;
|
|
|
|
break;
|
2018-05-23 10:47:12 +02:00
|
|
|
|
2012-03-30 01:51:25 +00:00
|
|
|
case TH_DOPESHEET_CHANNELOB:
|
|
|
|
cp = ts->ds_channel;
|
|
|
|
break;
|
|
|
|
case TH_DOPESHEET_CHANNELSUBOB:
|
|
|
|
cp = ts->ds_subchannel;
|
|
|
|
break;
|
Dope Sheet: new option to display keyframe interpolation mode and extremes.
With the new automatic handle algorithm, it is possible to do a lot
of the animation via keyframes without touching the curves. It is
however necessary to change the keyframe interpolation and handle
types in certain cases. Currently the dopesheet/action editor
allows changing the types, but does not show them in any way.
To fix, add a new menu option to display this information. For handle
type, it is represented using the shape of the key icons: diamond for
Free, clipped diamond for Aligned, square for Vector, circle for Auto
Clamp, and cirle with dot for Automatic.
Non-bezier interpolation is a property of intervals between keys,
so it is marked by drawing lines, similar to holds. In this initial
version, only the fact of non-bezier interpolation is displayed,
without distinguishing types. For summaries, the line is drawn at
half alpha if not all curves in the group are non-bezier.
In addition, it is sometimes helpful to know the general direction
of change of the curve, and which keys are extremes. This commit
also adds an option to highlight extremes, based on comparing the
keyed values with adjacent keys. Half-intensity display is used
for overshot bezier extremes, or non-uniform summaries.
Reviewers: brecht, aligorith, billreynish
Differential Revision: https://developer.blender.org/D3788
2018-10-19 18:55:19 +03:00
|
|
|
case TH_DOPESHEET_IPOLINE:
|
|
|
|
cp = ts->ds_ipoline;
|
|
|
|
break;
|
2012-03-30 01:51:25 +00:00
|
|
|
|
|
|
|
case TH_PREVIEW_BACK:
|
|
|
|
cp = ts->preview_back;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TH_STITCH_PREVIEW_FACE:
|
|
|
|
cp = ts->preview_stitch_face;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TH_STITCH_PREVIEW_EDGE:
|
|
|
|
cp = ts->preview_stitch_edge;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TH_STITCH_PREVIEW_VERT:
|
|
|
|
cp = ts->preview_stitch_vert;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TH_STITCH_PREVIEW_STITCHABLE:
|
|
|
|
cp = ts->preview_stitch_stitchable;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TH_STITCH_PREVIEW_UNSTITCHABLE:
|
|
|
|
cp = ts->preview_stitch_unstitchable;
|
|
|
|
break;
|
|
|
|
case TH_STITCH_PREVIEW_ACTIVE:
|
|
|
|
cp = ts->preview_stitch_active;
|
|
|
|
break;
|
2013-09-05 15:09:10 +00:00
|
|
|
|
2014-07-21 12:02:05 +02:00
|
|
|
case TH_PAINT_CURVE_HANDLE:
|
|
|
|
cp = ts->paint_curve_handle;
|
|
|
|
break;
|
|
|
|
case TH_PAINT_CURVE_PIVOT:
|
|
|
|
cp = ts->paint_curve_pivot;
|
|
|
|
break;
|
|
|
|
|
2015-04-21 17:15:40 +02:00
|
|
|
case TH_METADATA_BG:
|
2015-04-22 04:43:13 +10:00
|
|
|
cp = ts->metadatabg;
|
2015-04-21 17:15:40 +02:00
|
|
|
break;
|
|
|
|
case TH_METADATA_TEXT:
|
2015-04-22 04:43:13 +10:00
|
|
|
cp = ts->metadatatext;
|
2015-04-21 17:15:40 +02:00
|
|
|
break;
|
|
|
|
|
2013-09-05 15:09:10 +00:00
|
|
|
case TH_UV_OTHERS:
|
|
|
|
cp = ts->uv_others;
|
|
|
|
break;
|
|
|
|
case TH_UV_SHADOW:
|
|
|
|
cp = ts->uv_shadow;
|
|
|
|
break;
|
|
|
|
|
2012-03-30 01:51:25 +00:00
|
|
|
case TH_MARKER_OUTLINE:
|
|
|
|
cp = ts->marker_outline; break;
|
|
|
|
case TH_MARKER:
|
|
|
|
cp = ts->marker; break;
|
|
|
|
case TH_ACT_MARKER:
|
|
|
|
cp = ts->act_marker; break;
|
|
|
|
case TH_SEL_MARKER:
|
|
|
|
cp = ts->sel_marker; break;
|
|
|
|
case TH_BUNDLE_SOLID:
|
|
|
|
cp = ts->bundle_solid; break;
|
|
|
|
case TH_DIS_MARKER:
|
|
|
|
cp = ts->dis_marker; break;
|
|
|
|
case TH_PATH_BEFORE:
|
|
|
|
cp = ts->path_before; break;
|
|
|
|
case TH_PATH_AFTER:
|
|
|
|
cp = ts->path_after; break;
|
|
|
|
case TH_CAMERA_PATH:
|
|
|
|
cp = ts->camera_path; break;
|
|
|
|
case TH_LOCK_MARKER:
|
|
|
|
cp = ts->lock_marker; break;
|
|
|
|
|
|
|
|
case TH_MATCH:
|
|
|
|
cp = ts->match;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TH_SELECT_HIGHLIGHT:
|
|
|
|
cp = ts->selected_highlight;
|
|
|
|
break;
|
2012-05-22 15:29:15 +00:00
|
|
|
|
|
|
|
case TH_SKIN_ROOT:
|
|
|
|
cp = ts->skin_root;
|
|
|
|
break;
|
2018-05-23 10:47:12 +02:00
|
|
|
|
2012-06-04 01:17:37 +00:00
|
|
|
case TH_ANIM_ACTIVE:
|
|
|
|
cp = ts->anim_active;
|
|
|
|
break;
|
|
|
|
case TH_ANIM_INACTIVE:
|
|
|
|
cp = ts->anim_non_active;
|
|
|
|
break;
|
2018-10-04 15:45:58 +02:00
|
|
|
case TH_ANIM_PREVIEW_RANGE:
|
|
|
|
cp = ts->anim_preview_range;
|
|
|
|
break;
|
2018-05-23 10:47:12 +02:00
|
|
|
|
2012-06-04 01:17:37 +00:00
|
|
|
case TH_NLA_TWEAK:
|
|
|
|
cp = ts->nla_tweaking;
|
|
|
|
break;
|
|
|
|
case TH_NLA_TWEAK_DUPLI:
|
|
|
|
cp = ts->nla_tweakdupli;
|
|
|
|
break;
|
2018-05-23 10:47:12 +02:00
|
|
|
|
2012-06-04 01:17:37 +00:00
|
|
|
case TH_NLA_TRANSITION:
|
|
|
|
cp = ts->nla_transition;
|
|
|
|
break;
|
|
|
|
case TH_NLA_TRANSITION_SEL:
|
|
|
|
cp = ts->nla_transition_sel;
|
|
|
|
break;
|
|
|
|
case TH_NLA_META:
|
|
|
|
cp = ts->nla_meta;
|
|
|
|
break;
|
|
|
|
case TH_NLA_META_SEL:
|
|
|
|
cp = ts->nla_meta_sel;
|
|
|
|
break;
|
|
|
|
case TH_NLA_SOUND:
|
|
|
|
cp = ts->nla_sound;
|
|
|
|
break;
|
|
|
|
case TH_NLA_SOUND_SEL:
|
|
|
|
cp = ts->nla_sound_sel;
|
|
|
|
break;
|
2018-05-23 10:47:12 +02:00
|
|
|
|
2014-12-08 00:38:36 +01:00
|
|
|
case TH_WIDGET_EMBOSS:
|
|
|
|
cp = btheme->tui.widget_emboss; break;
|
2014-10-27 18:11:55 +01:00
|
|
|
|
2018-04-22 22:55:05 +02:00
|
|
|
case TH_EDITOR_OUTLINE:
|
|
|
|
cp = btheme->tui.editor_outline;
|
|
|
|
break;
|
Axis Colours are now Themeable
This commit allows you to set the RGB <-> XYZ axis colours used for things like
the mini axis indicator, grid axis indicators, manipulators, transform
constraint indicators, F-Curves (when using XYZ to RGB colouring option), and
perhaps something else I've missed. Previously, these places all used hardcoded
defines (220 * i/j/k), but the readability of these colours was often quite
poor, especially when used with certain themes.
The settings for these colours can be found under the "User Interface" section
of the themes (i.e. same set of colours is used across editors). I could have
made these per editor, but since it's unlikely that these will need to be too
different across editors in practice (+ being easier to version patch), they are
stored under the UI section.
2012-11-09 06:36:11 +00:00
|
|
|
case TH_AXIS_X:
|
|
|
|
cp = btheme->tui.xaxis; break;
|
|
|
|
case TH_AXIS_Y:
|
|
|
|
cp = btheme->tui.yaxis; break;
|
|
|
|
case TH_AXIS_Z:
|
|
|
|
cp = btheme->tui.zaxis; break;
|
2013-12-18 05:02:42 +11:00
|
|
|
|
2018-07-14 23:49:00 +02:00
|
|
|
case TH_GIZMO_HI:
|
|
|
|
cp = btheme->tui.gizmo_hi; break;
|
|
|
|
case TH_GIZMO_PRIMARY:
|
|
|
|
cp = btheme->tui.gizmo_primary; break;
|
|
|
|
case TH_GIZMO_SECONDARY:
|
|
|
|
cp = btheme->tui.gizmo_secondary; break;
|
|
|
|
case TH_GIZMO_A:
|
|
|
|
cp = btheme->tui.gizmo_a; break;
|
|
|
|
case TH_GIZMO_B:
|
|
|
|
cp = btheme->tui.gizmo_b; break;
|
2017-08-08 17:06:24 +10:00
|
|
|
|
2018-10-02 19:04:38 +02:00
|
|
|
case TH_ICON_COLLECTION:
|
|
|
|
cp = btheme->tui.icon_collection; break;
|
|
|
|
case TH_ICON_OBJECT:
|
|
|
|
cp = btheme->tui.icon_object; break;
|
|
|
|
case TH_ICON_OBJECT_DATA:
|
|
|
|
cp = btheme->tui.icon_object_data; break;
|
|
|
|
case TH_ICON_MODIFIER:
|
|
|
|
cp = btheme->tui.icon_modifier; break;
|
|
|
|
case TH_ICON_SHADING:
|
|
|
|
cp = btheme->tui.icon_shading; break;
|
|
|
|
|
2013-12-18 05:02:42 +11:00
|
|
|
case TH_INFO_SELECTED:
|
|
|
|
cp = ts->info_selected;
|
|
|
|
break;
|
|
|
|
case TH_INFO_SELECTED_TEXT:
|
|
|
|
cp = ts->info_selected_text;
|
|
|
|
break;
|
|
|
|
case TH_INFO_ERROR:
|
|
|
|
cp = ts->info_error;
|
|
|
|
break;
|
|
|
|
case TH_INFO_ERROR_TEXT:
|
|
|
|
cp = ts->info_error_text;
|
|
|
|
break;
|
|
|
|
case TH_INFO_WARNING:
|
|
|
|
cp = ts->info_warning;
|
|
|
|
break;
|
|
|
|
case TH_INFO_WARNING_TEXT:
|
|
|
|
cp = ts->info_warning_text;
|
|
|
|
break;
|
|
|
|
case TH_INFO_INFO:
|
|
|
|
cp = ts->info_info;
|
|
|
|
break;
|
|
|
|
case TH_INFO_INFO_TEXT:
|
|
|
|
cp = ts->info_info_text;
|
|
|
|
break;
|
|
|
|
case TH_INFO_DEBUG:
|
|
|
|
cp = ts->info_debug;
|
|
|
|
break;
|
|
|
|
case TH_INFO_DEBUG_TEXT:
|
|
|
|
cp = ts->info_debug_text;
|
|
|
|
break;
|
2015-01-28 13:03:42 +01:00
|
|
|
case TH_V3D_CLIPPING_BORDER:
|
|
|
|
cp = ts->clipping_border_3d;
|
|
|
|
break;
|
2008-01-07 18:03:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-05-23 10:47:12 +02:00
|
|
|
|
2019-01-04 11:05:53 +11:00
|
|
|
return (const uchar *)cp;
|
2008-01-07 18:03:41 +00:00
|
|
|
}
|
|
|
|
|
2015-05-31 14:20:03 +10:00
|
|
|
/**
|
|
|
|
* initialize default theme
|
|
|
|
* \note: when you add new colors, created & saved themes need initialized
|
2012-02-11 12:16:34 +00:00
|
|
|
* use function below, init_userdef_do_versions()
|
|
|
|
*/
|
2010-03-30 04:27:13 +00:00
|
|
|
void ui_theme_init_default(void)
|
2008-01-07 18:03:41 +00:00
|
|
|
{
|
2018-05-23 10:47:12 +02:00
|
|
|
|
2008-01-07 18:03:41 +00:00
|
|
|
/* we search for the theme with name Default */
|
2018-06-27 12:28:26 +02:00
|
|
|
bTheme *btheme = BLI_findstring(&U.themes, "Default", offsetof(bTheme, name));
|
2012-03-30 01:51:25 +00:00
|
|
|
if (btheme == NULL) {
|
2018-06-27 12:28:26 +02:00
|
|
|
btheme = MEM_callocN(sizeof(bTheme), __func__);
|
2008-01-07 18:03:41 +00:00
|
|
|
BLI_addtail(&U.themes, btheme);
|
|
|
|
}
|
2018-05-23 10:47:12 +02:00
|
|
|
|
2012-10-20 20:20:02 +00:00
|
|
|
UI_SetTheme(0, 0); /* make sure the global used in this file is set */
|
2008-01-07 18:03:41 +00:00
|
|
|
|
2018-07-03 05:57:27 +02:00
|
|
|
const int active_theme_area = btheme->active_theme_area;
|
2018-06-27 12:28:26 +02:00
|
|
|
memcpy(btheme, &U_theme_default, sizeof(*btheme));
|
2018-07-03 05:57:27 +02:00
|
|
|
btheme->active_theme_area = active_theme_area;
|
2008-01-07 18:03:41 +00:00
|
|
|
}
|
|
|
|
|
2013-06-07 00:27:21 +00:00
|
|
|
void ui_style_init_default(void)
|
|
|
|
{
|
|
|
|
BLI_freelistN(&U.uistyles);
|
|
|
|
/* gets automatically re-allocated */
|
|
|
|
uiStyleInit();
|
|
|
|
}
|
|
|
|
|
2008-01-07 18:03:41 +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
|
|
|
void UI_SetTheme(int spacetype, int regionid)
|
2008-01-07 18:03:41 +00:00
|
|
|
{
|
2013-06-26 12:24:36 +00:00
|
|
|
if (spacetype) {
|
2012-07-07 22:51:57 +00:00
|
|
|
/* later on, a local theme can be found too */
|
2012-03-30 01:51:25 +00:00
|
|
|
theme_active = U.themes.first;
|
|
|
|
theme_spacetype = spacetype;
|
|
|
|
theme_regionid = regionid;
|
2008-01-07 18:03:41 +00:00
|
|
|
}
|
2013-06-26 12:24:36 +00:00
|
|
|
else if (regionid) {
|
|
|
|
/* popups */
|
|
|
|
theme_active = U.themes.first;
|
|
|
|
theme_spacetype = SPACE_BUTS;
|
|
|
|
theme_regionid = regionid;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* for safety, when theme was deleted */
|
|
|
|
theme_active = U.themes.first;
|
|
|
|
theme_spacetype = SPACE_VIEW3D;
|
|
|
|
theme_regionid = RGN_TYPE_WINDOW;
|
|
|
|
}
|
2008-01-07 18:03:41 +00:00
|
|
|
}
|
|
|
|
|
2012-09-14 06:17:14 +00:00
|
|
|
bTheme *UI_GetTheme(void)
|
2011-11-19 20:57:53 +00:00
|
|
|
{
|
|
|
|
return U.themes.first;
|
|
|
|
}
|
|
|
|
|
2015-01-04 23:20:56 +11:00
|
|
|
/**
|
|
|
|
* for the rare case we need to temp swap in a different theme (offscreen render)
|
|
|
|
*/
|
|
|
|
void UI_Theme_Store(struct bThemeState *theme_state)
|
|
|
|
{
|
|
|
|
*theme_state = g_theme_state;
|
|
|
|
}
|
|
|
|
void UI_Theme_Restore(struct bThemeState *theme_state)
|
|
|
|
{
|
|
|
|
g_theme_state = *theme_state;
|
|
|
|
}
|
|
|
|
|
2019-01-04 11:05:53 +11:00
|
|
|
void UI_GetThemeColorShadeAlpha4ubv(int colorid, int coloffset, int alphaoffset, uchar col[4])
|
2017-01-15 19:26:35 -05:00
|
|
|
{
|
|
|
|
int r, g, b, a;
|
2019-01-04 11:05:53 +11:00
|
|
|
const uchar *cp;
|
2018-05-23 10:47:12 +02:00
|
|
|
|
2017-01-15 19:26:35 -05:00
|
|
|
cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
|
|
|
|
r = coloffset + (int) cp[0];
|
|
|
|
CLAMP(r, 0, 255);
|
|
|
|
g = coloffset + (int) cp[1];
|
|
|
|
CLAMP(g, 0, 255);
|
|
|
|
b = coloffset + (int) cp[2];
|
|
|
|
CLAMP(b, 0, 255);
|
|
|
|
a = alphaoffset + (int) cp[3];
|
|
|
|
CLAMP(a, 0, 255);
|
|
|
|
|
|
|
|
col[0] = r;
|
|
|
|
col[1] = g;
|
|
|
|
col[2] = b;
|
|
|
|
col[3] = a;
|
|
|
|
}
|
|
|
|
|
2019-01-04 11:05:53 +11:00
|
|
|
void UI_GetThemeColorBlend3ubv(int colorid1, int colorid2, float fac, uchar col[3])
|
2008-01-07 18:03:41 +00:00
|
|
|
{
|
2019-01-04 11:05:53 +11:00
|
|
|
const uchar *cp1, *cp2;
|
2014-06-04 14:22:29 +10:00
|
|
|
|
2012-03-30 01:51:25 +00:00
|
|
|
cp1 = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid1);
|
|
|
|
cp2 = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid2);
|
2008-01-07 18:03:41 +00:00
|
|
|
|
2011-03-27 14:52:16 +00:00
|
|
|
CLAMP(fac, 0.0f, 1.0f);
|
2014-06-04 14:22:29 +10:00
|
|
|
col[0] = floorf((1.0f - fac) * cp1[0] + fac * cp2[0]);
|
|
|
|
col[1] = floorf((1.0f - fac) * cp1[1] + fac * cp2[1]);
|
|
|
|
col[2] = floorf((1.0f - fac) * cp1[2] + fac * cp2[2]);
|
|
|
|
}
|
|
|
|
|
2017-04-26 11:59:13 +02:00
|
|
|
void UI_GetThemeColorBlend3f(int colorid1, int colorid2, float fac, float r_col[3])
|
|
|
|
{
|
2019-01-04 11:05:53 +11:00
|
|
|
const uchar *cp1, *cp2;
|
2017-04-26 11:59:13 +02:00
|
|
|
|
|
|
|
cp1 = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid1);
|
|
|
|
cp2 = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid2);
|
|
|
|
|
|
|
|
CLAMP(fac, 0.0f, 1.0f);
|
|
|
|
r_col[0] = ((1.0f - fac) * cp1[0] + fac * cp2[0]) / 255.0f;
|
|
|
|
r_col[1] = ((1.0f - fac) * cp1[1] + fac * cp2[1]) / 255.0f;
|
|
|
|
r_col[2] = ((1.0f - fac) * cp1[2] + fac * cp2[2]) / 255.0f;
|
|
|
|
}
|
|
|
|
|
2017-02-01 19:00:30 -05:00
|
|
|
void UI_FontThemeColor(int fontid, int colorid)
|
|
|
|
{
|
2019-01-04 11:05:53 +11:00
|
|
|
uchar color[4];
|
2017-02-01 19:00:30 -05:00
|
|
|
UI_GetThemeColor4ubv(colorid, color);
|
|
|
|
BLF_color4ubv(fontid, color);
|
|
|
|
}
|
2009-01-04 07:50:41 +00:00
|
|
|
|
2012-10-20 20:20:02 +00:00
|
|
|
/* get individual values, not scaled */
|
Port of part of the Interface code to 2.50.
This is based on the current trunk version, so these files should not need
merges. There's two things (clipboard and intptr_t) that are missing in 2.50
and commented out with XXX 2.48, these can be enabled again once trunk is
merged into this branch.
Further this is not all interface code, there are many parts commented out:
* interface.c: nearly all button types, missing: links, chartab, keyevent.
* interface_draw.c: almost all code, with some small exceptions.
* interface_ops.c: this replaces ui_do_but and uiDoBlocks with two operators,
making it non-blocking.
* interface_regions: this is a part of interface.c, split off, contains code to
create regions for tooltips, menus, pupmenu (that one is crashing currently),
color chooser, basically regions with buttons which is fairly independent of
core interface code.
* interface_panel.c and interface_icons.c: not ported over, so no panels and
icons yet. Panels should probably become (free floating) regions?
* text.c: (formerly language.c) for drawing text and translation. this works
but is using bad globals still and could be cleaned up.
Header Files:
* ED_datafiles.h now has declarations for datatoc_ files, so those extern
declarations can be #included instead of repeated.
* The user interface code is in UI_interface.h and other UI_* files.
Core:
* The API for creating blocks, buttons, etc is nearly the same still. Blocks
are now created per region instead of per area.
* The code was made non-blocking, which means that any changes and redraws
should be possible while editing a button. That means though that we need
some sort of persistence even though the blender model is to recreate buttons
for each redraw. So when a new block is created, some matching happens to
find out which buttons correspond to buttons in the previously created block,
and for activated buttons some data is then copied over to the new button.
* Added UI_init/UI_init_userdef/UI_exit functions that should initialize code
in this module, instead of multiple function calls in the windowmanager.
* Removed most static/globals from interface.c.
* Removed UIafterfunc_ I don't think it's needed anymore, and not sure how it
would integrate here?
* Currently only full window redraws are used, this should become per region
and maybe per button later.
Operators:
* Events are currently handled through two operators: button activate and menu
handle. Operators may not be the best way to implement this, since there are
currently some issues with events being missed, but they can become a special
handler type instead, this should not be a big change.
* The button activate operator runs as long as a button is active, and will
handle all interaction with that button until the button is not activated
anymore. This means clicking, text editing, number dragging, opening menu
blocks, etc.
* Since this operator has to be non-blocking, the ui_do_but code needed to made
non-blocking. That means variables that were previously on the stack, now
need to be stored away in a struct such that they can be accessed again when
the operator receives more events.
* Additionally the place in the ui_do_but code indicated the state, now that
needs to be set explicit in order to handle the right events in the right
state. So an activated button can be in one of these states: init, highlight,
wait_flash, wait_release, wait_key_event, num_editing, text_editing,
text_selecting, block_open, exit.
* For each button type an ui_apply_but_* function has also been separated out
from ui_do_but. This makes it possible to continuously apply the button as
text is being typed for example, and there is an option in the code to enable
this. Since the code non-blocking and can deal with the button being deleted
even, it should be safe to do this.
* When editing text, dragging numbers, etc, the actual data (but->poin) is not
being edited, since that would mean data is being edited without correct
updates happening, while some other part of blender may be accessing that
data in the meantime. So data values, strings, vectors are written to a
temporary location and only flush in the apply function.
Regions:
* Menus, color chooser, tooltips etc all create screen level regions. Such menu
blocks give a handle to the button that creates it, which will contain the
results of the menu block once a MESSAGE event is received from that menu
block.
* For this type of menu block the coordinates used to be in window space. They
are still created that way and ui_positionblock still works with window
coordinates, but after that the block and buttons are brought back to region
coordinates since these are now contained in a region.
* The flush/overdraw frontbuffer drawing code was removed, the windowmanager
should have enough information with these screen level regions to have full
control over what gets drawn when and to then do correct compositing.
Testing:
* The header in the time space currently has some buttons to test the UI code.
2008-11-11 18:31:32 +00:00
|
|
|
float UI_GetThemeValuef(int colorid)
|
2008-01-07 18:03:41 +00:00
|
|
|
{
|
2019-01-04 11:05:53 +11:00
|
|
|
const uchar *cp;
|
2018-05-23 10:47:12 +02:00
|
|
|
|
2012-03-30 01:51:25 +00:00
|
|
|
cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
|
2008-01-07 18:03:41 +00:00
|
|
|
return ((float)cp[0]);
|
|
|
|
}
|
|
|
|
|
2012-10-20 20:20:02 +00:00
|
|
|
/* get individual values, not scaled */
|
Port of part of the Interface code to 2.50.
This is based on the current trunk version, so these files should not need
merges. There's two things (clipboard and intptr_t) that are missing in 2.50
and commented out with XXX 2.48, these can be enabled again once trunk is
merged into this branch.
Further this is not all interface code, there are many parts commented out:
* interface.c: nearly all button types, missing: links, chartab, keyevent.
* interface_draw.c: almost all code, with some small exceptions.
* interface_ops.c: this replaces ui_do_but and uiDoBlocks with two operators,
making it non-blocking.
* interface_regions: this is a part of interface.c, split off, contains code to
create regions for tooltips, menus, pupmenu (that one is crashing currently),
color chooser, basically regions with buttons which is fairly independent of
core interface code.
* interface_panel.c and interface_icons.c: not ported over, so no panels and
icons yet. Panels should probably become (free floating) regions?
* text.c: (formerly language.c) for drawing text and translation. this works
but is using bad globals still and could be cleaned up.
Header Files:
* ED_datafiles.h now has declarations for datatoc_ files, so those extern
declarations can be #included instead of repeated.
* The user interface code is in UI_interface.h and other UI_* files.
Core:
* The API for creating blocks, buttons, etc is nearly the same still. Blocks
are now created per region instead of per area.
* The code was made non-blocking, which means that any changes and redraws
should be possible while editing a button. That means though that we need
some sort of persistence even though the blender model is to recreate buttons
for each redraw. So when a new block is created, some matching happens to
find out which buttons correspond to buttons in the previously created block,
and for activated buttons some data is then copied over to the new button.
* Added UI_init/UI_init_userdef/UI_exit functions that should initialize code
in this module, instead of multiple function calls in the windowmanager.
* Removed most static/globals from interface.c.
* Removed UIafterfunc_ I don't think it's needed anymore, and not sure how it
would integrate here?
* Currently only full window redraws are used, this should become per region
and maybe per button later.
Operators:
* Events are currently handled through two operators: button activate and menu
handle. Operators may not be the best way to implement this, since there are
currently some issues with events being missed, but they can become a special
handler type instead, this should not be a big change.
* The button activate operator runs as long as a button is active, and will
handle all interaction with that button until the button is not activated
anymore. This means clicking, text editing, number dragging, opening menu
blocks, etc.
* Since this operator has to be non-blocking, the ui_do_but code needed to made
non-blocking. That means variables that were previously on the stack, now
need to be stored away in a struct such that they can be accessed again when
the operator receives more events.
* Additionally the place in the ui_do_but code indicated the state, now that
needs to be set explicit in order to handle the right events in the right
state. So an activated button can be in one of these states: init, highlight,
wait_flash, wait_release, wait_key_event, num_editing, text_editing,
text_selecting, block_open, exit.
* For each button type an ui_apply_but_* function has also been separated out
from ui_do_but. This makes it possible to continuously apply the button as
text is being typed for example, and there is an option in the code to enable
this. Since the code non-blocking and can deal with the button being deleted
even, it should be safe to do this.
* When editing text, dragging numbers, etc, the actual data (but->poin) is not
being edited, since that would mean data is being edited without correct
updates happening, while some other part of blender may be accessing that
data in the meantime. So data values, strings, vectors are written to a
temporary location and only flush in the apply function.
Regions:
* Menus, color chooser, tooltips etc all create screen level regions. Such menu
blocks give a handle to the button that creates it, which will contain the
results of the menu block once a MESSAGE event is received from that menu
block.
* For this type of menu block the coordinates used to be in window space. They
are still created that way and ui_positionblock still works with window
coordinates, but after that the block and buttons are brought back to region
coordinates since these are now contained in a region.
* The flush/overdraw frontbuffer drawing code was removed, the windowmanager
should have enough information with these screen level regions to have full
control over what gets drawn when and to then do correct compositing.
Testing:
* The header in the time space currently has some buttons to test the UI code.
2008-11-11 18:31:32 +00:00
|
|
|
int UI_GetThemeValue(int colorid)
|
2008-01-07 18:03:41 +00:00
|
|
|
{
|
2019-01-04 11:05:53 +11:00
|
|
|
const uchar *cp;
|
2018-05-23 10:47:12 +02:00
|
|
|
|
2012-03-30 01:51:25 +00:00
|
|
|
cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
|
2008-01-07 18:03:41 +00:00
|
|
|
return ((int) cp[0]);
|
|
|
|
}
|
|
|
|
|
2015-11-13 00:03:12 +11:00
|
|
|
/* versions of the function above, which take a space-type */
|
|
|
|
float UI_GetThemeValueTypef(int colorid, int spacetype)
|
|
|
|
{
|
2019-01-04 11:05:53 +11:00
|
|
|
const uchar *cp;
|
2015-11-13 00:03:12 +11:00
|
|
|
|
|
|
|
cp = UI_ThemeGetColorPtr(theme_active, spacetype, colorid);
|
|
|
|
return ((float)cp[0]);
|
|
|
|
}
|
|
|
|
|
|
|
|
int UI_GetThemeValueType(int colorid, int spacetype)
|
|
|
|
{
|
2019-01-04 11:05:53 +11:00
|
|
|
const uchar *cp;
|
2015-11-13 00:03:12 +11:00
|
|
|
|
|
|
|
cp = UI_ThemeGetColorPtr(theme_active, spacetype, colorid);
|
|
|
|
return ((int)cp[0]);
|
|
|
|
}
|
|
|
|
|
2008-01-07 18:03:41 +00:00
|
|
|
|
2012-10-20 20:20:02 +00:00
|
|
|
/* get the color, range 0.0-1.0 */
|
2012-05-22 08:24:52 +00:00
|
|
|
void UI_GetThemeColor3fv(int colorid, float col[3])
|
2008-01-07 18:03:41 +00:00
|
|
|
{
|
2019-01-04 11:05:53 +11:00
|
|
|
const uchar *cp;
|
2018-05-23 10:47:12 +02:00
|
|
|
|
2012-03-30 01:51:25 +00:00
|
|
|
cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
|
|
|
|
col[0] = ((float)cp[0]) / 255.0f;
|
|
|
|
col[1] = ((float)cp[1]) / 255.0f;
|
|
|
|
col[2] = ((float)cp[2]) / 255.0f;
|
2008-01-07 18:03:41 +00:00
|
|
|
}
|
|
|
|
|
2012-06-04 01:17:37 +00:00
|
|
|
void UI_GetThemeColor4fv(int colorid, float col[4])
|
|
|
|
{
|
2019-01-04 11:05:53 +11:00
|
|
|
const uchar *cp;
|
2018-05-23 10:47:12 +02:00
|
|
|
|
2012-06-04 01:17:37 +00:00
|
|
|
cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
|
|
|
|
col[0] = ((float)cp[0]) / 255.0f;
|
|
|
|
col[1] = ((float)cp[1]) / 255.0f;
|
|
|
|
col[2] = ((float)cp[2]) / 255.0f;
|
|
|
|
col[3] = ((float)cp[3]) / 255.0f;
|
|
|
|
}
|
|
|
|
|
2012-10-20 20:20:02 +00:00
|
|
|
/* get the color, range 0.0-1.0, complete with shading offset */
|
2012-05-22 08:24:52 +00:00
|
|
|
void UI_GetThemeColorShade3fv(int colorid, int offset, float col[3])
|
2010-01-08 11:14:30 +00:00
|
|
|
{
|
|
|
|
int r, g, b;
|
2019-01-04 11:05:53 +11:00
|
|
|
const uchar *cp;
|
2018-05-23 10:47:12 +02:00
|
|
|
|
2012-03-30 01:51:25 +00:00
|
|
|
cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
|
2018-05-23 10:47:12 +02:00
|
|
|
|
2012-03-30 01:51:25 +00:00
|
|
|
r = offset + (int) cp[0];
|
2010-01-08 11:14:30 +00:00
|
|
|
CLAMP(r, 0, 255);
|
2012-03-30 01:51:25 +00:00
|
|
|
g = offset + (int) cp[1];
|
2010-01-08 11:14:30 +00:00
|
|
|
CLAMP(g, 0, 255);
|
2012-03-30 01:51:25 +00:00
|
|
|
b = offset + (int) cp[2];
|
2010-01-08 11:14:30 +00:00
|
|
|
CLAMP(b, 0, 255);
|
2018-05-23 10:47:12 +02:00
|
|
|
|
2012-03-30 01:51:25 +00:00
|
|
|
col[0] = ((float)r) / 255.0f;
|
|
|
|
col[1] = ((float)g) / 255.0f;
|
|
|
|
col[2] = ((float)b) / 255.0f;
|
2010-01-08 11:14:30 +00:00
|
|
|
}
|
|
|
|
|
2019-01-04 11:05:53 +11:00
|
|
|
void UI_GetThemeColorShade3ubv(int colorid, int offset, uchar col[3])
|
2012-05-22 08:24:52 +00:00
|
|
|
{
|
|
|
|
int r, g, b;
|
2019-01-04 11:05:53 +11:00
|
|
|
const uchar *cp;
|
2012-05-22 08:24:52 +00:00
|
|
|
|
|
|
|
cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
|
|
|
|
|
|
|
|
r = offset + (int) cp[0];
|
|
|
|
CLAMP(r, 0, 255);
|
|
|
|
g = offset + (int) cp[1];
|
|
|
|
CLAMP(g, 0, 255);
|
|
|
|
b = offset + (int) cp[2];
|
|
|
|
CLAMP(b, 0, 255);
|
|
|
|
|
|
|
|
col[0] = r;
|
|
|
|
col[1] = g;
|
|
|
|
col[2] = b;
|
|
|
|
}
|
|
|
|
|
2019-01-04 11:05:53 +11:00
|
|
|
void UI_GetThemeColorBlendShade3ubv(int colorid1, int colorid2, float fac, int offset, uchar col[3])
|
2017-02-01 20:40:49 -02:00
|
|
|
{
|
2019-01-04 11:05:53 +11:00
|
|
|
const uchar *cp1, *cp2;
|
2017-02-01 20:40:49 -02:00
|
|
|
|
|
|
|
cp1 = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid1);
|
|
|
|
cp2 = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid2);
|
|
|
|
|
|
|
|
CLAMP(fac, 0.0f, 1.0f);
|
|
|
|
|
2017-03-15 13:48:47 +01:00
|
|
|
float blend[3];
|
|
|
|
blend[0] = offset + floorf((1.0f - fac) * cp1[0] + fac * cp2[0]);
|
|
|
|
blend[1] = offset + floorf((1.0f - fac) * cp1[1] + fac * cp2[1]);
|
|
|
|
blend[2] = offset + floorf((1.0f - fac) * cp1[2] + fac * cp2[2]);
|
|
|
|
|
2018-05-07 18:02:48 +02:00
|
|
|
unit_float_to_uchar_clamp_v3(col, blend);
|
2017-02-01 20:40:49 -02:00
|
|
|
}
|
|
|
|
|
2019-01-04 11:05:53 +11:00
|
|
|
void UI_GetThemeColorShade4ubv(int colorid, int offset, uchar col[4])
|
2017-02-08 18:33:40 -05:00
|
|
|
{
|
|
|
|
int r, g, b;
|
2019-01-04 11:05:53 +11:00
|
|
|
const uchar *cp;
|
2017-02-08 18:33:40 -05:00
|
|
|
|
|
|
|
cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
|
|
|
|
r = offset + (int) cp[0];
|
|
|
|
CLAMP(r, 0, 255);
|
|
|
|
g = offset + (int) cp[1];
|
|
|
|
CLAMP(g, 0, 255);
|
|
|
|
b = offset + (int) cp[2];
|
|
|
|
CLAMP(b, 0, 255);
|
|
|
|
|
|
|
|
col[0] = r;
|
|
|
|
col[1] = g;
|
|
|
|
col[2] = b;
|
|
|
|
col[3] = cp[3];
|
|
|
|
}
|
|
|
|
|
2016-10-07 14:56:08 -04:00
|
|
|
void UI_GetThemeColorShadeAlpha4fv(int colorid, int coloffset, int alphaoffset, float col[4])
|
|
|
|
{
|
|
|
|
int r, g, b, a;
|
2019-01-04 11:05:53 +11:00
|
|
|
const uchar *cp;
|
2016-10-07 14:56:08 -04:00
|
|
|
|
|
|
|
cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
|
|
|
|
|
|
|
|
r = coloffset + (int) cp[0];
|
|
|
|
CLAMP(r, 0, 255);
|
|
|
|
g = coloffset + (int) cp[1];
|
|
|
|
CLAMP(g, 0, 255);
|
|
|
|
b = coloffset + (int) cp[2];
|
|
|
|
CLAMP(b, 0, 255);
|
|
|
|
a = alphaoffset + (int) cp[3];
|
|
|
|
CLAMP(b, 0, 255);
|
|
|
|
|
|
|
|
col[0] = ((float)r) / 255.0f;
|
|
|
|
col[1] = ((float)g) / 255.0f;
|
|
|
|
col[2] = ((float)b) / 255.0f;
|
|
|
|
col[3] = ((float)a) / 255.0f;
|
|
|
|
}
|
|
|
|
|
2017-04-27 19:31:19 +10:00
|
|
|
void UI_GetThemeColorBlendShade3fv(int colorid1, int colorid2, float fac, int offset, float col[3])
|
|
|
|
{
|
|
|
|
int r, g, b;
|
2019-01-04 11:05:53 +11:00
|
|
|
const uchar *cp1, *cp2;
|
2017-04-27 19:31:19 +10:00
|
|
|
|
|
|
|
cp1 = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid1);
|
|
|
|
cp2 = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid2);
|
|
|
|
|
|
|
|
CLAMP(fac, 0.0f, 1.0f);
|
|
|
|
|
|
|
|
r = offset + floorf((1.0f - fac) * cp1[0] + fac * cp2[0]);
|
|
|
|
CLAMP(r, 0, 255);
|
|
|
|
g = offset + floorf((1.0f - fac) * cp1[1] + fac * cp2[1]);
|
|
|
|
CLAMP(g, 0, 255);
|
|
|
|
b = offset + floorf((1.0f - fac) * cp1[2] + fac * cp2[2]);
|
|
|
|
CLAMP(b, 0, 255);
|
|
|
|
|
|
|
|
col[0] = ((float)r) / 255.0f;
|
|
|
|
col[1] = ((float)g) / 255.0f;
|
|
|
|
col[2] = ((float)b) / 255.0f;
|
|
|
|
}
|
|
|
|
|
2016-10-13 20:06:44 +00:00
|
|
|
void UI_GetThemeColorBlendShade4fv(int colorid1, int colorid2, float fac, int offset, float col[4])
|
|
|
|
{
|
|
|
|
int r, g, b, a;
|
2019-01-04 11:05:53 +11:00
|
|
|
const uchar *cp1, *cp2;
|
2016-10-13 20:06:44 +00:00
|
|
|
|
|
|
|
cp1 = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid1);
|
|
|
|
cp2 = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid2);
|
|
|
|
|
|
|
|
CLAMP(fac, 0.0f, 1.0f);
|
|
|
|
|
|
|
|
r = offset + floorf((1.0f - fac) * cp1[0] + fac * cp2[0]);
|
|
|
|
CLAMP(r, 0, 255);
|
|
|
|
g = offset + floorf((1.0f - fac) * cp1[1] + fac * cp2[1]);
|
|
|
|
CLAMP(g, 0, 255);
|
|
|
|
b = offset + floorf((1.0f - fac) * cp1[2] + fac * cp2[2]);
|
|
|
|
CLAMP(b, 0, 255);
|
|
|
|
a = offset + floorf((1.0f - fac) * cp1[3] + fac * cp2[3]);
|
|
|
|
CLAMP(a, 0, 255);
|
|
|
|
|
|
|
|
col[0] = ((float)r) / 255.0f;
|
|
|
|
col[1] = ((float)g) / 255.0f;
|
|
|
|
col[2] = ((float)b) / 255.0f;
|
|
|
|
col[3] = ((float)a) / 255.0f;
|
|
|
|
}
|
|
|
|
|
2012-10-20 20:20:02 +00:00
|
|
|
/* get the color, in char pointer */
|
2019-01-04 11:05:53 +11:00
|
|
|
void UI_GetThemeColor3ubv(int colorid, uchar col[3])
|
2008-01-07 18:03:41 +00:00
|
|
|
{
|
2019-01-04 11:05:53 +11:00
|
|
|
const uchar *cp;
|
2018-05-23 10:47:12 +02:00
|
|
|
|
2012-03-30 01:51:25 +00:00
|
|
|
cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
|
|
|
|
col[0] = cp[0];
|
|
|
|
col[1] = cp[1];
|
|
|
|
col[2] = cp[2];
|
2008-01-07 18:03:41 +00:00
|
|
|
}
|
|
|
|
|
2016-07-07 23:37:15 +12:00
|
|
|
/* get the color, range 0.0-1.0, complete with shading offset */
|
|
|
|
void UI_GetThemeColorShade4fv(int colorid, int offset, float col[4])
|
|
|
|
{
|
|
|
|
int r, g, b, a;
|
2019-01-04 11:05:53 +11:00
|
|
|
const uchar *cp;
|
2018-05-23 10:47:12 +02:00
|
|
|
|
2016-07-07 23:37:15 +12:00
|
|
|
cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
|
2018-05-23 10:47:12 +02:00
|
|
|
|
2016-07-07 23:37:15 +12:00
|
|
|
r = offset + (int) cp[0];
|
|
|
|
CLAMP(r, 0, 255);
|
|
|
|
g = offset + (int) cp[1];
|
|
|
|
CLAMP(g, 0, 255);
|
|
|
|
b = offset + (int) cp[2];
|
|
|
|
CLAMP(b, 0, 255);
|
2018-05-23 10:47:12 +02:00
|
|
|
|
2016-07-07 23:37:15 +12:00
|
|
|
a = (int) cp[3]; /* no shading offset... */
|
|
|
|
CLAMP(a, 0, 255);
|
2018-05-23 10:47:12 +02:00
|
|
|
|
2016-07-07 23:37:15 +12:00
|
|
|
col[0] = ((float)r) / 255.0f;
|
|
|
|
col[1] = ((float)g) / 255.0f;
|
|
|
|
col[2] = ((float)b) / 255.0f;
|
|
|
|
col[3] = ((float)a) / 255.0f;
|
|
|
|
}
|
|
|
|
|
2012-10-20 20:20:02 +00:00
|
|
|
/* get the color, in char pointer */
|
2019-01-04 11:05:53 +11:00
|
|
|
void UI_GetThemeColor4ubv(int colorid, uchar col[4])
|
2008-01-07 18:03:41 +00:00
|
|
|
{
|
2019-01-04 11:05:53 +11:00
|
|
|
const uchar *cp;
|
2018-05-23 10:47:12 +02:00
|
|
|
|
2012-03-30 01:51:25 +00:00
|
|
|
cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
|
|
|
|
col[0] = cp[0];
|
|
|
|
col[1] = cp[1];
|
|
|
|
col[2] = cp[2];
|
|
|
|
col[3] = cp[3];
|
2008-01-07 18:03:41 +00:00
|
|
|
}
|
|
|
|
|
2018-12-27 12:54:31 +11:00
|
|
|
void UI_GetThemeColorType3ubv(int colorid, int spacetype, uchar col[3])
|
2018-12-23 23:32:56 -02:00
|
|
|
{
|
2019-01-04 11:05:53 +11:00
|
|
|
const uchar *cp;
|
2018-12-23 23:32:56 -02:00
|
|
|
|
|
|
|
cp = UI_ThemeGetColorPtr(theme_active, spacetype, colorid);
|
|
|
|
col[0] = cp[0];
|
|
|
|
col[1] = cp[1];
|
|
|
|
col[2] = cp[2];
|
|
|
|
}
|
|
|
|
|
2018-12-27 12:54:31 +11:00
|
|
|
void UI_GetThemeColorType4ubv(int colorid, int spacetype, uchar col[4])
|
2008-01-07 18:03:41 +00:00
|
|
|
{
|
2019-01-04 11:05:53 +11:00
|
|
|
const uchar *cp;
|
2018-05-23 10:47:12 +02:00
|
|
|
|
2012-03-30 01:51:25 +00:00
|
|
|
cp = UI_ThemeGetColorPtr(theme_active, spacetype, colorid);
|
|
|
|
col[0] = cp[0];
|
|
|
|
col[1] = cp[1];
|
|
|
|
col[2] = cp[2];
|
|
|
|
col[3] = cp[3];
|
2008-01-07 18:03:41 +00:00
|
|
|
}
|
|
|
|
|
2018-10-02 19:04:38 +02:00
|
|
|
bool UI_GetIconThemeColor4fv(int colorid, float col[4])
|
|
|
|
{
|
|
|
|
if (colorid == 0) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Only colored icons in outliner and popups, overall UI is intended
|
|
|
|
* to stay monochrome and out of the way except a few places where it
|
|
|
|
* is important to communicate different data types. */
|
|
|
|
if (!((theme_spacetype == SPACE_OUTLINER) ||
|
|
|
|
(theme_regionid == RGN_TYPE_TEMPORARY)))
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2019-01-04 11:05:53 +11:00
|
|
|
const uchar *cp;
|
2018-10-02 19:04:38 +02:00
|
|
|
cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
|
|
|
|
col[0] = ((float)cp[0]) / 255.0f;
|
|
|
|
col[1] = ((float)cp[1]) / 255.0f;
|
|
|
|
col[2] = ((float)cp[2]) / 255.0f;
|
|
|
|
col[3] = ((float)cp[3]) / 255.0f;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2019-01-04 11:05:53 +11:00
|
|
|
void UI_GetColorPtrShade3ubv(const uchar cp[3], uchar col[3], int offset)
|
2011-09-11 04:31:09 +00:00
|
|
|
{
|
|
|
|
int r, g, b;
|
|
|
|
|
2012-03-30 01:51:25 +00:00
|
|
|
r = offset + (int)cp[0];
|
|
|
|
g = offset + (int)cp[1];
|
|
|
|
b = offset + (int)cp[2];
|
2011-09-11 04:31:09 +00:00
|
|
|
|
|
|
|
CLAMP(r, 0, 255);
|
|
|
|
CLAMP(g, 0, 255);
|
|
|
|
CLAMP(b, 0, 255);
|
|
|
|
|
|
|
|
col[0] = r;
|
|
|
|
col[1] = g;
|
|
|
|
col[2] = b;
|
|
|
|
}
|
|
|
|
|
2012-10-20 20:20:02 +00:00
|
|
|
/* get a 3 byte color, blended and shaded between two other char color pointers */
|
2015-05-05 03:13:47 +10:00
|
|
|
void UI_GetColorPtrBlendShade3ubv(
|
2019-01-04 11:05:53 +11:00
|
|
|
const uchar cp1[3], const uchar cp2[3], uchar col[3],
|
2015-05-05 03:13:47 +10:00
|
|
|
float fac, int offset)
|
2008-01-07 18:03:41 +00:00
|
|
|
{
|
|
|
|
int r, g, b;
|
2011-03-27 14:52:16 +00:00
|
|
|
|
|
|
|
CLAMP(fac, 0.0f, 1.0f);
|
2012-03-30 01:51:25 +00:00
|
|
|
r = offset + floor((1.0f - fac) * cp1[0] + fac * cp2[0]);
|
|
|
|
g = offset + floor((1.0f - fac) * cp1[1] + fac * cp2[1]);
|
|
|
|
b = offset + floor((1.0f - fac) * cp1[2] + fac * cp2[2]);
|
2011-03-27 14:52:16 +00:00
|
|
|
|
|
|
|
CLAMP(r, 0, 255);
|
|
|
|
CLAMP(g, 0, 255);
|
|
|
|
CLAMP(b, 0, 255);
|
|
|
|
|
2008-01-07 18:03:41 +00:00
|
|
|
col[0] = r;
|
|
|
|
col[1] = g;
|
|
|
|
col[2] = b;
|
|
|
|
}
|
Port of part of the Interface code to 2.50.
This is based on the current trunk version, so these files should not need
merges. There's two things (clipboard and intptr_t) that are missing in 2.50
and commented out with XXX 2.48, these can be enabled again once trunk is
merged into this branch.
Further this is not all interface code, there are many parts commented out:
* interface.c: nearly all button types, missing: links, chartab, keyevent.
* interface_draw.c: almost all code, with some small exceptions.
* interface_ops.c: this replaces ui_do_but and uiDoBlocks with two operators,
making it non-blocking.
* interface_regions: this is a part of interface.c, split off, contains code to
create regions for tooltips, menus, pupmenu (that one is crashing currently),
color chooser, basically regions with buttons which is fairly independent of
core interface code.
* interface_panel.c and interface_icons.c: not ported over, so no panels and
icons yet. Panels should probably become (free floating) regions?
* text.c: (formerly language.c) for drawing text and translation. this works
but is using bad globals still and could be cleaned up.
Header Files:
* ED_datafiles.h now has declarations for datatoc_ files, so those extern
declarations can be #included instead of repeated.
* The user interface code is in UI_interface.h and other UI_* files.
Core:
* The API for creating blocks, buttons, etc is nearly the same still. Blocks
are now created per region instead of per area.
* The code was made non-blocking, which means that any changes and redraws
should be possible while editing a button. That means though that we need
some sort of persistence even though the blender model is to recreate buttons
for each redraw. So when a new block is created, some matching happens to
find out which buttons correspond to buttons in the previously created block,
and for activated buttons some data is then copied over to the new button.
* Added UI_init/UI_init_userdef/UI_exit functions that should initialize code
in this module, instead of multiple function calls in the windowmanager.
* Removed most static/globals from interface.c.
* Removed UIafterfunc_ I don't think it's needed anymore, and not sure how it
would integrate here?
* Currently only full window redraws are used, this should become per region
and maybe per button later.
Operators:
* Events are currently handled through two operators: button activate and menu
handle. Operators may not be the best way to implement this, since there are
currently some issues with events being missed, but they can become a special
handler type instead, this should not be a big change.
* The button activate operator runs as long as a button is active, and will
handle all interaction with that button until the button is not activated
anymore. This means clicking, text editing, number dragging, opening menu
blocks, etc.
* Since this operator has to be non-blocking, the ui_do_but code needed to made
non-blocking. That means variables that were previously on the stack, now
need to be stored away in a struct such that they can be accessed again when
the operator receives more events.
* Additionally the place in the ui_do_but code indicated the state, now that
needs to be set explicit in order to handle the right events in the right
state. So an activated button can be in one of these states: init, highlight,
wait_flash, wait_release, wait_key_event, num_editing, text_editing,
text_selecting, block_open, exit.
* For each button type an ui_apply_but_* function has also been separated out
from ui_do_but. This makes it possible to continuously apply the button as
text is being typed for example, and there is an option in the code to enable
this. Since the code non-blocking and can deal with the button being deleted
even, it should be safe to do this.
* When editing text, dragging numbers, etc, the actual data (but->poin) is not
being edited, since that would mean data is being edited without correct
updates happening, while some other part of blender may be accessing that
data in the meantime. So data values, strings, vectors are written to a
temporary location and only flush in the apply function.
Regions:
* Menus, color chooser, tooltips etc all create screen level regions. Such menu
blocks give a handle to the button that creates it, which will contain the
results of the menu block once a MESSAGE event is received from that menu
block.
* For this type of menu block the coordinates used to be in window space. They
are still created that way and ui_positionblock still works with window
coordinates, but after that the block and buttons are brought back to region
coordinates since these are now contained in a region.
* The flush/overdraw frontbuffer drawing code was removed, the windowmanager
should have enough information with these screen level regions to have full
control over what gets drawn when and to then do correct compositing.
Testing:
* The header in the time space currently has some buttons to test the UI code.
2008-11-11 18:31:32 +00:00
|
|
|
|
2010-04-06 07:02:16 +00:00
|
|
|
void UI_ThemeClearColor(int colorid)
|
|
|
|
{
|
|
|
|
float col[3];
|
2018-05-23 10:47:12 +02:00
|
|
|
|
2010-04-06 07:02:16 +00:00
|
|
|
UI_GetThemeColor3fv(colorid, col);
|
2018-06-27 19:07:23 -06:00
|
|
|
GPU_clear_color(col[0], col[1], col[2], 0.0f);
|
2010-04-06 07:02:16 +00:00
|
|
|
}
|
|
|
|
|
2015-03-10 16:34:40 +01:00
|
|
|
void UI_ThemeClearColorAlpha(int colorid, float alpha)
|
|
|
|
{
|
|
|
|
float col[3];
|
|
|
|
UI_GetThemeColor3fv(colorid, col);
|
2018-06-27 19:07:23 -06:00
|
|
|
GPU_clear_color(col[0], col[1], col[2], alpha);
|
2015-03-10 16:34:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-12-20 16:50:39 +00:00
|
|
|
int UI_ThemeMenuShadowWidth(void)
|
|
|
|
{
|
|
|
|
bTheme *btheme = UI_GetTheme();
|
|
|
|
return (int)(btheme->tui.menu_shadow_width * UI_DPI_FAC);
|
|
|
|
}
|
|
|
|
|
2019-01-04 11:05:53 +11:00
|
|
|
void UI_make_axis_color(const uchar src_col[3], uchar dst_col[3], const char axis)
|
2009-04-30 11:47:35 +00:00
|
|
|
{
|
2019-01-04 11:05:53 +11:00
|
|
|
uchar col[3];
|
2018-05-23 10:47:12 +02:00
|
|
|
|
2012-04-28 06:31:57 +00:00
|
|
|
switch (axis) {
|
2010-12-20 03:59:22 +00:00
|
|
|
case 'X':
|
Axis Colours are now Themeable
This commit allows you to set the RGB <-> XYZ axis colours used for things like
the mini axis indicator, grid axis indicators, manipulators, transform
constraint indicators, F-Curves (when using XYZ to RGB colouring option), and
perhaps something else I've missed. Previously, these places all used hardcoded
defines (220 * i/j/k), but the readability of these colours was often quite
poor, especially when used with certain themes.
The settings for these colours can be found under the "User Interface" section
of the themes (i.e. same set of colours is used across editors). I could have
made these per editor, but since it's unlikely that these will need to be too
different across editors in practice (+ being easier to version patch), they are
stored under the UI section.
2012-11-09 06:36:11 +00:00
|
|
|
UI_GetThemeColor3ubv(TH_AXIS_X, col);
|
|
|
|
UI_GetColorPtrBlendShade3ubv(src_col, col, dst_col, 0.5f, -10);
|
2009-04-30 11:47:35 +00:00
|
|
|
break;
|
2010-12-20 03:59:22 +00:00
|
|
|
case 'Y':
|
Axis Colours are now Themeable
This commit allows you to set the RGB <-> XYZ axis colours used for things like
the mini axis indicator, grid axis indicators, manipulators, transform
constraint indicators, F-Curves (when using XYZ to RGB colouring option), and
perhaps something else I've missed. Previously, these places all used hardcoded
defines (220 * i/j/k), but the readability of these colours was often quite
poor, especially when used with certain themes.
The settings for these colours can be found under the "User Interface" section
of the themes (i.e. same set of colours is used across editors). I could have
made these per editor, but since it's unlikely that these will need to be too
different across editors in practice (+ being easier to version patch), they are
stored under the UI section.
2012-11-09 06:36:11 +00:00
|
|
|
UI_GetThemeColor3ubv(TH_AXIS_Y, col);
|
|
|
|
UI_GetColorPtrBlendShade3ubv(src_col, col, dst_col, 0.5f, -10);
|
2009-04-30 11:47:35 +00:00
|
|
|
break;
|
2010-12-20 03:59:22 +00:00
|
|
|
case 'Z':
|
Axis Colours are now Themeable
This commit allows you to set the RGB <-> XYZ axis colours used for things like
the mini axis indicator, grid axis indicators, manipulators, transform
constraint indicators, F-Curves (when using XYZ to RGB colouring option), and
perhaps something else I've missed. Previously, these places all used hardcoded
defines (220 * i/j/k), but the readability of these colours was often quite
poor, especially when used with certain themes.
The settings for these colours can be found under the "User Interface" section
of the themes (i.e. same set of colours is used across editors). I could have
made these per editor, but since it's unlikely that these will need to be too
different across editors in practice (+ being easier to version patch), they are
stored under the UI section.
2012-11-09 06:36:11 +00:00
|
|
|
UI_GetThemeColor3ubv(TH_AXIS_Z, col);
|
|
|
|
UI_GetColorPtrBlendShade3ubv(src_col, col, dst_col, 0.5f, -10);
|
2010-12-20 03:59:22 +00:00
|
|
|
break;
|
|
|
|
default:
|
2013-07-21 08:16:37 +00:00
|
|
|
BLI_assert(0);
|
|
|
|
break;
|
2009-04-30 11:47:35 +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
|
|
|
|
|
|
|
/* patching UserDef struct and Themes */
|
2018-06-08 12:16:37 +02:00
|
|
|
void init_userdef_do_versions(Main *bmain)
|
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
|
|
|
{
|
2018-09-12 18:22:00 +10:00
|
|
|
BLO_version_defaults_userpref_blend(bmain, &U);
|
2015-07-01 12:47:44 +10:00
|
|
|
|
2015-01-26 16:03:11 +01:00
|
|
|
if (STREQ(U.tempdir, "/")) {
|
2014-11-23 15:54:29 +01:00
|
|
|
BKE_tempdir_system_init(U.tempdir);
|
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
|
|
|
}
|
2018-05-23 10:47:12 +02:00
|
|
|
|
2018-09-13 07:56:58 +10:00
|
|
|
/* Not versioning, just avoid errors. */
|
|
|
|
#ifndef WITH_CYCLES
|
|
|
|
BKE_addon_remove_safe(&U.addons, "cycles");
|
|
|
|
#endif
|
|
|
|
|
2010-07-14 14:11:03 +00:00
|
|
|
}
|