Compare commits
19 Commits
refactor-m
...
temp-ui-cp
Author | SHA1 | Date | |
---|---|---|---|
f77be09171 | |||
1a3681b83c | |||
3c2073d844 | |||
a1ea6d6496 | |||
1836acbeac | |||
ae3f443220 | |||
b9d1b07a45 | |||
dd1be8db19 | |||
6450f380ac | |||
1051c17af3 | |||
87628abaa1 | |||
462177fd62 | |||
5d221a2a8a | |||
fb4b7aaa8f | |||
6183f63250 | |||
08228956d9 | |||
956be86c09 | |||
e2f9602be2 | |||
24ae9c52d8 |
@@ -5,6 +5,8 @@
|
||||
* \ingroup bke
|
||||
*/
|
||||
|
||||
#include "BKE_undo_system.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -13,8 +15,6 @@ struct Main;
|
||||
struct MemFileUndoData;
|
||||
struct bContext;
|
||||
|
||||
enum eUndoStepDir;
|
||||
|
||||
#define BKE_UNDO_STR_MAX 64
|
||||
|
||||
struct MemFileUndoData *BKE_memfile_undo_encode(struct Main *bmain,
|
||||
|
@@ -27,15 +27,15 @@ set(INC
|
||||
)
|
||||
|
||||
set(SRC
|
||||
eyedroppers/eyedropper_color.c
|
||||
eyedroppers/eyedropper_colorband.c
|
||||
eyedroppers/eyedropper_datablock.c
|
||||
eyedroppers/eyedropper_depth.c
|
||||
eyedroppers/eyedropper_driver.c
|
||||
eyedroppers/eyedropper_gpencil_color.c
|
||||
eyedroppers/interface_eyedropper.c
|
||||
eyedroppers/eyedropper_color.cc
|
||||
eyedroppers/eyedropper_colorband.cc
|
||||
eyedroppers/eyedropper_datablock.cc
|
||||
eyedroppers/eyedropper_depth.cc
|
||||
eyedroppers/eyedropper_driver.cc
|
||||
eyedroppers/eyedropper_gpencil_color.cc
|
||||
eyedroppers/interface_eyedropper.cc
|
||||
interface.cc
|
||||
interface_align.c
|
||||
interface_align.cc
|
||||
interface_anim.cc
|
||||
interface_button_group.cc
|
||||
interface_context_menu.cc
|
||||
@@ -43,10 +43,10 @@ set(SRC
|
||||
interface_drag.cc
|
||||
interface_draw.cc
|
||||
interface_dropboxes.cc
|
||||
interface_handlers.c
|
||||
interface_icons.c
|
||||
interface_handlers.cc
|
||||
interface_icons.cc
|
||||
interface_icons_event.cc
|
||||
interface_layout.c
|
||||
interface_layout.cc
|
||||
interface_ops.cc
|
||||
interface_panel.cc
|
||||
interface_query.cc
|
||||
@@ -65,11 +65,11 @@ set(SRC
|
||||
interface_template_list.cc
|
||||
interface_template_search_menu.cc
|
||||
interface_template_search_operator.cc
|
||||
interface_templates.c
|
||||
interface_templates.cc
|
||||
interface_undo.cc
|
||||
interface_utils.cc
|
||||
interface_widgets.c
|
||||
resources.c
|
||||
interface_widgets.cc
|
||||
resources.cc
|
||||
view2d.cc
|
||||
view2d_draw.cc
|
||||
view2d_edge_pan.cc
|
||||
@@ -81,8 +81,8 @@ set(SRC
|
||||
views/interface_view.cc
|
||||
views/tree_view.cc
|
||||
|
||||
eyedroppers/eyedropper_intern.h
|
||||
interface_intern.h
|
||||
eyedroppers/eyedropper_intern.hh
|
||||
interface_intern.hh
|
||||
interface_regions_intern.hh
|
||||
)
|
||||
|
||||
|
@@ -41,7 +41,7 @@
|
||||
|
||||
#include "RNA_define.h"
|
||||
|
||||
#include "interface_intern.h"
|
||||
#include "interface_intern.hh"
|
||||
|
||||
#include "ED_clip.h"
|
||||
#include "ED_image.h"
|
||||
@@ -50,10 +50,10 @@
|
||||
|
||||
#include "RE_pipeline.h"
|
||||
|
||||
#include "eyedropper_intern.h"
|
||||
#include "eyedropper_intern.hh"
|
||||
|
||||
typedef struct Eyedropper {
|
||||
struct ColorManagedDisplay *display;
|
||||
struct Eyedropper {
|
||||
ColorManagedDisplay *display;
|
||||
|
||||
PointerRNA ptr;
|
||||
PropertyRNA *prop;
|
||||
@@ -71,23 +71,24 @@ typedef struct Eyedropper {
|
||||
char sample_text[MAX_NAME];
|
||||
|
||||
bNode *crypto_node;
|
||||
struct CryptomatteSession *cryptomatte_session;
|
||||
} Eyedropper;
|
||||
CryptomatteSession *cryptomatte_session;
|
||||
};
|
||||
|
||||
static void eyedropper_draw_cb(const wmWindow *window, void *arg)
|
||||
{
|
||||
Eyedropper *eye = arg;
|
||||
Eyedropper *eye = static_cast<Eyedropper *>(arg);
|
||||
eyedropper_draw_cursor_text_window(window, eye->sample_text);
|
||||
}
|
||||
|
||||
static bool eyedropper_init(bContext *C, wmOperator *op)
|
||||
{
|
||||
Eyedropper *eye = MEM_callocN(sizeof(Eyedropper), __func__);
|
||||
Eyedropper *eye = MEM_cnew<Eyedropper>(__func__);
|
||||
|
||||
uiBut *but = UI_context_active_but_prop_get(C, &eye->ptr, &eye->prop, &eye->index);
|
||||
const enum PropertySubType prop_subtype = eye->prop ? RNA_property_subtype(eye->prop) : 0;
|
||||
const enum PropertySubType prop_subtype = eye->prop ? RNA_property_subtype(eye->prop) :
|
||||
PropertySubType(0);
|
||||
|
||||
if ((eye->ptr.data == NULL) || (eye->prop == NULL) ||
|
||||
if ((eye->ptr.data == nullptr) || (eye->prop == nullptr) ||
|
||||
(RNA_property_editable(&eye->ptr, eye->prop) == false) ||
|
||||
(RNA_property_array_length(&eye->ptr, eye->prop) < 3) ||
|
||||
(RNA_property_type(eye->prop) != PROP_FLOAT) ||
|
||||
@@ -127,18 +128,18 @@ static bool eyedropper_init(bContext *C, wmOperator *op)
|
||||
|
||||
static void eyedropper_exit(bContext *C, wmOperator *op)
|
||||
{
|
||||
Eyedropper *eye = op->customdata;
|
||||
Eyedropper *eye = static_cast<Eyedropper *>(op->customdata);
|
||||
wmWindow *window = CTX_wm_window(C);
|
||||
WM_cursor_modal_restore(window);
|
||||
|
||||
if (eye->draw_handle_sample_text) {
|
||||
WM_draw_cb_exit(window, eye->draw_handle_sample_text);
|
||||
eye->draw_handle_sample_text = NULL;
|
||||
eye->draw_handle_sample_text = nullptr;
|
||||
}
|
||||
|
||||
if (eye->cryptomatte_session) {
|
||||
BKE_cryptomatte_free(eye->cryptomatte_session);
|
||||
eye->cryptomatte_session = NULL;
|
||||
eye->cryptomatte_session = nullptr;
|
||||
}
|
||||
|
||||
MEM_SAFE_FREE(op->customdata);
|
||||
@@ -219,11 +220,11 @@ static bool eyedropper_cryptomatte_sample_image_fl(const bNode *node,
|
||||
{
|
||||
bool success = false;
|
||||
Image *image = (Image *)node->id;
|
||||
BLI_assert((image == NULL) || (GS(image->id.name) == ID_IM));
|
||||
BLI_assert((image == nullptr) || (GS(image->id.name) == ID_IM));
|
||||
ImageUser *iuser = &crypto->iuser;
|
||||
|
||||
if (image && image->type == IMA_TYPE_MULTILAYER) {
|
||||
ImBuf *ibuf = BKE_image_acquire_ibuf(image, iuser, NULL);
|
||||
ImBuf *ibuf = BKE_image_acquire_ibuf(image, iuser, nullptr);
|
||||
if (image->rr) {
|
||||
LISTBASE_FOREACH (RenderLayer *, render_layer, &image->rr->layers) {
|
||||
success = eyedropper_cryptomatte_sample_renderlayer_fl(render_layer, prefix, fpos, r_col);
|
||||
@@ -232,7 +233,7 @@ static bool eyedropper_cryptomatte_sample_image_fl(const bNode *node,
|
||||
}
|
||||
}
|
||||
}
|
||||
BKE_image_release_ibuf(image, ibuf, NULL);
|
||||
BKE_image_release_ibuf(image, ibuf, nullptr);
|
||||
}
|
||||
return success;
|
||||
}
|
||||
@@ -243,7 +244,7 @@ static bool eyedropper_cryptomatte_sample_fl(bContext *C,
|
||||
float r_col[3])
|
||||
{
|
||||
bNode *node = eye->crypto_node;
|
||||
NodeCryptomatte *crypto = node ? ((NodeCryptomatte *)node->storage) : NULL;
|
||||
NodeCryptomatte *crypto = node ? ((NodeCryptomatte *)node->storage) : nullptr;
|
||||
|
||||
if (!crypto) {
|
||||
return false;
|
||||
@@ -264,18 +265,18 @@ static bool eyedropper_cryptomatte_sample_fl(bContext *C,
|
||||
float fpos[2] = {-1.0f, -1.0};
|
||||
switch (area->spacetype) {
|
||||
case SPACE_IMAGE: {
|
||||
SpaceImage *sima = area->spacedata.first;
|
||||
SpaceImage *sima = static_cast<SpaceImage *>(area->spacedata.first);
|
||||
ED_space_image_get_position(sima, region, mval, fpos);
|
||||
break;
|
||||
}
|
||||
case SPACE_NODE: {
|
||||
Main *bmain = CTX_data_main(C);
|
||||
SpaceNode *snode = area->spacedata.first;
|
||||
SpaceNode *snode = static_cast<SpaceNode *>(area->spacedata.first);
|
||||
ED_space_node_get_position(bmain, snode, region, mval, fpos);
|
||||
break;
|
||||
}
|
||||
case SPACE_CLIP: {
|
||||
SpaceClip *sc = area->spacedata.first;
|
||||
SpaceClip *sc = static_cast<SpaceClip *>(area->spacedata.first);
|
||||
ED_space_clip_get_position(sc, region, mval, fpos);
|
||||
break;
|
||||
}
|
||||
@@ -315,7 +316,7 @@ void eyedropper_color_sample_fl(bContext *C, const int m_xy[2], float r_col[3])
|
||||
Main *bmain = CTX_data_main(C);
|
||||
wmWindowManager *wm = CTX_wm_manager(C);
|
||||
const char *display_device = CTX_data_scene(C)->display_settings.display_device;
|
||||
struct ColorManagedDisplay *display = IMB_colormanagement_display_get_named(display_device);
|
||||
ColorManagedDisplay *display = IMB_colormanagement_display_get_named(display_device);
|
||||
|
||||
int mval[2];
|
||||
wmWindow *win;
|
||||
@@ -326,10 +327,10 @@ void eyedropper_color_sample_fl(bContext *C, const int m_xy[2], float r_col[3])
|
||||
if (area->spacetype == SPACE_IMAGE) {
|
||||
ARegion *region = BKE_area_find_region_xy(area, RGN_TYPE_WINDOW, mval);
|
||||
if (region) {
|
||||
SpaceImage *sima = area->spacedata.first;
|
||||
SpaceImage *sima = static_cast<SpaceImage *>(area->spacedata.first);
|
||||
const int region_mval[2] = {mval[0] - region->winrct.xmin, mval[1] - region->winrct.ymin};
|
||||
|
||||
if (ED_space_image_color_sample(sima, region, region_mval, r_col, NULL)) {
|
||||
if (ED_space_image_color_sample(sima, region, region_mval, r_col, nullptr)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -337,7 +338,7 @@ void eyedropper_color_sample_fl(bContext *C, const int m_xy[2], float r_col[3])
|
||||
else if (area->spacetype == SPACE_NODE) {
|
||||
ARegion *region = BKE_area_find_region_xy(area, RGN_TYPE_WINDOW, mval);
|
||||
if (region) {
|
||||
SpaceNode *snode = area->spacedata.first;
|
||||
SpaceNode *snode = static_cast<SpaceNode *>(area->spacedata.first);
|
||||
const int region_mval[2] = {mval[0] - region->winrct.xmin, mval[1] - region->winrct.ymin};
|
||||
|
||||
if (ED_space_node_color_sample(bmain, snode, region, region_mval, r_col)) {
|
||||
@@ -348,7 +349,7 @@ void eyedropper_color_sample_fl(bContext *C, const int m_xy[2], float r_col[3])
|
||||
else if (area->spacetype == SPACE_CLIP) {
|
||||
ARegion *region = BKE_area_find_region_xy(area, RGN_TYPE_WINDOW, mval);
|
||||
if (region) {
|
||||
SpaceClip *sc = area->spacedata.first;
|
||||
SpaceClip *sc = static_cast<SpaceClip *>(area->spacedata.first);
|
||||
const int region_mval[2] = {mval[0] - region->winrct.xmin, mval[1] - region->winrct.ymin};
|
||||
|
||||
if (ED_space_clip_color_sample(sc, region, region_mval, r_col)) {
|
||||
@@ -440,7 +441,7 @@ static void eyedropper_color_sample_text_update(bContext *C, Eyedropper *eye, co
|
||||
|
||||
static void eyedropper_cancel(bContext *C, wmOperator *op)
|
||||
{
|
||||
Eyedropper *eye = op->customdata;
|
||||
Eyedropper *eye = static_cast<Eyedropper *>(op->customdata);
|
||||
if (eye->is_set) {
|
||||
eyedropper_color_set(C, eye, eye->init_col);
|
||||
}
|
||||
@@ -495,7 +496,7 @@ static int eyedropper_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
}
|
||||
|
||||
/* Modal Operator init */
|
||||
static int eyedropper_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
|
||||
static int eyedropper_invoke(bContext *C, wmOperator *op, const wmEvent * /*event*/)
|
||||
{
|
||||
/* init */
|
||||
if (eyedropper_init(C, op)) {
|
||||
@@ -532,7 +533,7 @@ static bool eyedropper_poll(bContext *C)
|
||||
{
|
||||
/* Actual test for active button happens later, since we don't
|
||||
* know which one is active until mouse over. */
|
||||
return (CTX_wm_window(C) != NULL);
|
||||
return (CTX_wm_window(C) != nullptr);
|
||||
}
|
||||
|
||||
void UI_OT_eyedropper_color(wmOperatorType *ot)
|
@@ -33,16 +33,16 @@
|
||||
#include "WM_api.h"
|
||||
#include "WM_types.h"
|
||||
|
||||
#include "interface_intern.h"
|
||||
#include "interface_intern.hh"
|
||||
|
||||
#include "eyedropper_intern.h"
|
||||
#include "eyedropper_intern.hh"
|
||||
|
||||
typedef struct Colorband_RNAUpdateCb {
|
||||
struct Colorband_RNAUpdateCb {
|
||||
PointerRNA ptr;
|
||||
PropertyRNA *prop;
|
||||
} Colorband_RNAUpdateCb;
|
||||
};
|
||||
|
||||
typedef struct EyedropperColorband {
|
||||
struct EyedropperColorband {
|
||||
int event_xy_last[2];
|
||||
/* Alpha is currently fixed at 1.0, may support in future. */
|
||||
float (*color_buffer)[4];
|
||||
@@ -55,7 +55,7 @@ typedef struct EyedropperColorband {
|
||||
PropertyRNA *prop;
|
||||
bool is_undo;
|
||||
bool is_set;
|
||||
} EyedropperColorband;
|
||||
};
|
||||
|
||||
/* For user-data only. */
|
||||
struct EyedropperColorband_Context {
|
||||
@@ -65,15 +65,15 @@ struct EyedropperColorband_Context {
|
||||
|
||||
static bool eyedropper_colorband_init(bContext *C, wmOperator *op)
|
||||
{
|
||||
ColorBand *band = NULL;
|
||||
ColorBand *band = nullptr;
|
||||
|
||||
uiBut *but = UI_context_active_but_get(C);
|
||||
|
||||
PointerRNA rna_update_ptr = PointerRNA_NULL;
|
||||
PropertyRNA *rna_update_prop = NULL;
|
||||
PropertyRNA *rna_update_prop = nullptr;
|
||||
bool is_undo = true;
|
||||
|
||||
if (but == NULL) {
|
||||
if (but == nullptr) {
|
||||
/* pass */
|
||||
}
|
||||
else {
|
||||
@@ -95,8 +95,8 @@ static bool eyedropper_colorband_init(bContext *C, wmOperator *op)
|
||||
|
||||
if (!band) {
|
||||
const PointerRNA ptr = CTX_data_pointer_get_type(C, "color_ramp", &RNA_ColorRamp);
|
||||
if (ptr.data != NULL) {
|
||||
band = ptr.data;
|
||||
if (ptr.data != nullptr) {
|
||||
band = static_cast<ColorBand *>(ptr.data);
|
||||
|
||||
/* Set this to a sub-member of the property to trigger an update. */
|
||||
rna_update_ptr = ptr;
|
||||
@@ -109,9 +109,10 @@ static bool eyedropper_colorband_init(bContext *C, wmOperator *op)
|
||||
return false;
|
||||
}
|
||||
|
||||
EyedropperColorband *eye = MEM_callocN(sizeof(EyedropperColorband), __func__);
|
||||
EyedropperColorband *eye = MEM_cnew<EyedropperColorband>(__func__);
|
||||
eye->color_buffer_alloc = 16;
|
||||
eye->color_buffer = MEM_mallocN(sizeof(*eye->color_buffer) * eye->color_buffer_alloc, __func__);
|
||||
eye->color_buffer = static_cast<float(*)[4]>(
|
||||
MEM_mallocN(sizeof(*eye->color_buffer) * eye->color_buffer_alloc, __func__));
|
||||
eye->color_buffer_len = 0;
|
||||
eye->color_band = band;
|
||||
eye->init_color_band = *eye->color_band;
|
||||
@@ -134,8 +135,8 @@ static void eyedropper_colorband_sample_point(bContext *C,
|
||||
eyedropper_color_sample_fl(C, m_xy, col);
|
||||
if (eye->color_buffer_len + 1 == eye->color_buffer_alloc) {
|
||||
eye->color_buffer_alloc *= 2;
|
||||
eye->color_buffer = MEM_reallocN(eye->color_buffer,
|
||||
sizeof(*eye->color_buffer) * eye->color_buffer_alloc);
|
||||
eye->color_buffer = static_cast<float(*)[4]>(
|
||||
MEM_reallocN(eye->color_buffer, sizeof(*eye->color_buffer) * eye->color_buffer_alloc));
|
||||
}
|
||||
copy_v4_v4(eye->color_buffer[eye->color_buffer_len], col);
|
||||
eye->color_buffer_len += 1;
|
||||
@@ -146,7 +147,7 @@ static void eyedropper_colorband_sample_point(bContext *C,
|
||||
|
||||
static bool eyedropper_colorband_sample_callback(int mx, int my, void *userdata)
|
||||
{
|
||||
struct EyedropperColorband_Context *data = userdata;
|
||||
EyedropperColorband_Context *data = static_cast<EyedropperColorband_Context *>(userdata);
|
||||
bContext *C = data->context;
|
||||
EyedropperColorband *eye = data->eye;
|
||||
const int cursor[2] = {mx, my};
|
||||
@@ -160,7 +161,7 @@ static void eyedropper_colorband_sample_segment(bContext *C,
|
||||
{
|
||||
/* Since the mouse tends to move rather rapidly we use #BLI_bitmap_draw_2d_line_v2v2i
|
||||
* to interpolate between the reported coordinates */
|
||||
struct EyedropperColorband_Context userdata = {C, eye};
|
||||
EyedropperColorband_Context userdata = {C, eye};
|
||||
BLI_bitmap_draw_2d_line_v2v2i(
|
||||
eye->event_xy_last, m_xy, eyedropper_colorband_sample_callback, &userdata);
|
||||
}
|
||||
@@ -170,16 +171,16 @@ static void eyedropper_colorband_exit(bContext *C, wmOperator *op)
|
||||
WM_cursor_modal_restore(CTX_wm_window(C));
|
||||
|
||||
if (op->customdata) {
|
||||
EyedropperColorband *eye = op->customdata;
|
||||
EyedropperColorband *eye = static_cast<EyedropperColorband *>(op->customdata);
|
||||
MEM_freeN(eye->color_buffer);
|
||||
MEM_freeN(eye);
|
||||
op->customdata = NULL;
|
||||
op->customdata = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
static void eyedropper_colorband_apply(bContext *C, wmOperator *op)
|
||||
{
|
||||
EyedropperColorband *eye = op->customdata;
|
||||
EyedropperColorband *eye = static_cast<EyedropperColorband *>(op->customdata);
|
||||
/* Always filter, avoids noise in resulting color-band. */
|
||||
const bool filter_samples = true;
|
||||
BKE_colorband_init_from_table_rgba(
|
||||
@@ -192,7 +193,7 @@ static void eyedropper_colorband_apply(bContext *C, wmOperator *op)
|
||||
|
||||
static void eyedropper_colorband_cancel(bContext *C, wmOperator *op)
|
||||
{
|
||||
EyedropperColorband *eye = op->customdata;
|
||||
EyedropperColorband *eye = static_cast<EyedropperColorband *>(op->customdata);
|
||||
if (eye->is_set) {
|
||||
*eye->color_band = eye->init_color_band;
|
||||
if (eye->prop) {
|
||||
@@ -205,7 +206,7 @@ static void eyedropper_colorband_cancel(bContext *C, wmOperator *op)
|
||||
/* main modal status check */
|
||||
static int eyedropper_colorband_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
EyedropperColorband *eye = op->customdata;
|
||||
EyedropperColorband *eye = static_cast<EyedropperColorband *>(op->customdata);
|
||||
/* handle modal keymap */
|
||||
if (event->type == EVT_MODAL_MAP) {
|
||||
switch (event->val) {
|
||||
@@ -242,7 +243,7 @@ static int eyedropper_colorband_modal(bContext *C, wmOperator *op, const wmEvent
|
||||
|
||||
static int eyedropper_colorband_point_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
EyedropperColorband *eye = op->customdata;
|
||||
EyedropperColorband *eye = static_cast<EyedropperColorband *>(op->customdata);
|
||||
/* handle modal keymap */
|
||||
if (event->type == EVT_MODAL_MAP) {
|
||||
switch (event->val) {
|
||||
@@ -280,7 +281,7 @@ static int eyedropper_colorband_point_modal(bContext *C, wmOperator *op, const w
|
||||
}
|
||||
|
||||
/* Modal Operator init */
|
||||
static int eyedropper_colorband_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
|
||||
static int eyedropper_colorband_invoke(bContext *C, wmOperator *op, const wmEvent * /*event*/)
|
||||
{
|
||||
/* init */
|
||||
if (eyedropper_colorband_init(C, op)) {
|
||||
@@ -320,7 +321,7 @@ static bool eyedropper_colorband_poll(bContext *C)
|
||||
return true;
|
||||
}
|
||||
const PointerRNA ptr = CTX_data_pointer_get_type(C, "color_ramp", &RNA_ColorRamp);
|
||||
if (ptr.data != NULL) {
|
||||
if (ptr.data != nullptr) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
@@ -38,13 +38,13 @@
|
||||
#include "ED_space_api.h"
|
||||
#include "ED_view3d.h"
|
||||
|
||||
#include "eyedropper_intern.h"
|
||||
#include "interface_intern.h"
|
||||
#include "eyedropper_intern.hh"
|
||||
#include "interface_intern.hh"
|
||||
|
||||
/**
|
||||
* \note #DataDropper is only internal name to avoid confusion with other kinds of eye-droppers.
|
||||
*/
|
||||
typedef struct DataDropper {
|
||||
struct DataDropper {
|
||||
PointerRNA ptr;
|
||||
PropertyRNA *prop;
|
||||
short idcode;
|
||||
@@ -58,13 +58,11 @@ typedef struct DataDropper {
|
||||
void *draw_handle_pixel;
|
||||
int name_pos[2];
|
||||
char name[200];
|
||||
} DataDropper;
|
||||
};
|
||||
|
||||
static void datadropper_draw_cb(const struct bContext *UNUSED(C),
|
||||
ARegion *UNUSED(region),
|
||||
void *arg)
|
||||
static void datadropper_draw_cb(const bContext * /*C*/, ARegion * /*region*/, void *arg)
|
||||
{
|
||||
DataDropper *ddr = arg;
|
||||
DataDropper *ddr = static_cast<DataDropper *>(arg);
|
||||
eyedropper_draw_cursor_text_region(ddr->name_pos, ddr->name);
|
||||
}
|
||||
|
||||
@@ -79,11 +77,11 @@ static int datadropper_init(bContext *C, wmOperator *op)
|
||||
st = BKE_spacetype_from_id(SPACE_VIEW3D);
|
||||
art = BKE_regiontype_from_id(st, RGN_TYPE_WINDOW);
|
||||
|
||||
DataDropper *ddr = MEM_callocN(sizeof(DataDropper), __func__);
|
||||
DataDropper *ddr = MEM_cnew<DataDropper>(__func__);
|
||||
|
||||
uiBut *but = UI_context_active_but_prop_get(C, &ddr->ptr, &ddr->prop, &index_dummy);
|
||||
|
||||
if ((ddr->ptr.data == NULL) || (ddr->prop == NULL) ||
|
||||
if ((ddr->ptr.data == nullptr) || (ddr->prop == nullptr) ||
|
||||
(RNA_property_editable(&ddr->ptr, ddr->prop) == false) ||
|
||||
(RNA_property_type(ddr->prop) != PROP_POINTER)) {
|
||||
MEM_freeN(ddr);
|
||||
@@ -126,7 +124,7 @@ static void datadropper_exit(bContext *C, wmOperator *op)
|
||||
|
||||
MEM_freeN(op->customdata);
|
||||
|
||||
op->customdata = NULL;
|
||||
op->customdata = nullptr;
|
||||
}
|
||||
|
||||
WM_event_add_mousemove(win);
|
||||
@@ -168,7 +166,7 @@ static void datadropper_id_sample_pt(
|
||||
|
||||
if (base) {
|
||||
Object *ob = base->object;
|
||||
ID *id = NULL;
|
||||
ID *id = nullptr;
|
||||
if (ddr->idcode == ID_OB) {
|
||||
id = (ID *)ob;
|
||||
}
|
||||
@@ -208,7 +206,7 @@ static bool datadropper_id_set(bContext *C, DataDropper *ddr, ID *id)
|
||||
|
||||
RNA_id_pointer_create(id, &ptr_value);
|
||||
|
||||
RNA_property_pointer_set(&ddr->ptr, ddr->prop, ptr_value, NULL);
|
||||
RNA_property_pointer_set(&ddr->ptr, ddr->prop, ptr_value, nullptr);
|
||||
|
||||
RNA_property_update(C, &ddr->ptr, ddr->prop);
|
||||
|
||||
@@ -220,7 +218,7 @@ static bool datadropper_id_set(bContext *C, DataDropper *ddr, ID *id)
|
||||
/* single point sample & set */
|
||||
static bool datadropper_id_sample(bContext *C, DataDropper *ddr, const int m_xy[2])
|
||||
{
|
||||
ID *id = NULL;
|
||||
ID *id = nullptr;
|
||||
|
||||
int mval[2];
|
||||
wmWindow *win;
|
||||
@@ -233,7 +231,7 @@ static bool datadropper_id_sample(bContext *C, DataDropper *ddr, const int m_xy[
|
||||
|
||||
static void datadropper_cancel(bContext *C, wmOperator *op)
|
||||
{
|
||||
DataDropper *ddr = op->customdata;
|
||||
DataDropper *ddr = static_cast<DataDropper *>(op->customdata);
|
||||
datadropper_id_set(C, ddr, ddr->init_id);
|
||||
datadropper_exit(C, op);
|
||||
}
|
||||
@@ -287,7 +285,7 @@ static int datadropper_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
}
|
||||
}
|
||||
else if (event->type == MOUSEMOVE) {
|
||||
ID *id = NULL;
|
||||
ID *id = nullptr;
|
||||
|
||||
int mval[2];
|
||||
wmWindow *win;
|
||||
@@ -304,7 +302,7 @@ static int datadropper_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
}
|
||||
|
||||
/* Modal Operator init */
|
||||
static int datadropper_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
|
||||
static int datadropper_invoke(bContext *C, wmOperator *op, const wmEvent * /*event*/)
|
||||
{
|
||||
/* init */
|
||||
if (datadropper_init(C, op)) {
|
||||
@@ -342,7 +340,7 @@ static bool datadropper_poll(bContext *C)
|
||||
uiBut *but;
|
||||
|
||||
/* data dropper only supports object data */
|
||||
if ((CTX_wm_window(C) != NULL) &&
|
||||
if ((CTX_wm_window(C) != nullptr) &&
|
||||
(but = UI_context_active_but_prop_get(C, &ptr, &prop, &index_dummy)) &&
|
||||
(but->type == UI_BTYPE_SEARCH_MENU) && (but->flag & UI_BUT_VALUE_CLEAR)) {
|
||||
if (prop && RNA_property_type(prop) == PROP_POINTER) {
|
@@ -38,13 +38,13 @@
|
||||
#include "ED_space_api.h"
|
||||
#include "ED_view3d.h"
|
||||
|
||||
#include "eyedropper_intern.h"
|
||||
#include "interface_intern.h"
|
||||
#include "eyedropper_intern.hh"
|
||||
#include "interface_intern.hh"
|
||||
|
||||
/**
|
||||
* \note #DepthDropper is only internal name to avoid confusion with other kinds of eye-droppers.
|
||||
*/
|
||||
typedef struct DepthDropper {
|
||||
struct DepthDropper {
|
||||
PointerRNA ptr;
|
||||
PropertyRNA *prop;
|
||||
bool is_undo;
|
||||
@@ -60,13 +60,11 @@ typedef struct DepthDropper {
|
||||
void *draw_handle_pixel;
|
||||
int name_pos[2];
|
||||
char name[200];
|
||||
} DepthDropper;
|
||||
};
|
||||
|
||||
static void depthdropper_draw_cb(const struct bContext *UNUSED(C),
|
||||
ARegion *UNUSED(region),
|
||||
void *arg)
|
||||
static void depthdropper_draw_cb(const struct bContext * /*C*/, ARegion * /*region*/, void *arg)
|
||||
{
|
||||
DepthDropper *ddr = arg;
|
||||
DepthDropper *ddr = static_cast<DepthDropper *>(arg);
|
||||
eyedropper_draw_cursor_text_region(ddr->name_pos, ddr->name);
|
||||
}
|
||||
|
||||
@@ -80,17 +78,17 @@ static int depthdropper_init(bContext *C, wmOperator *op)
|
||||
st = BKE_spacetype_from_id(SPACE_VIEW3D);
|
||||
art = BKE_regiontype_from_id(st, RGN_TYPE_WINDOW);
|
||||
|
||||
DepthDropper *ddr = MEM_callocN(sizeof(DepthDropper), __func__);
|
||||
DepthDropper *ddr = MEM_cnew<DepthDropper>(__func__);
|
||||
|
||||
uiBut *but = UI_context_active_but_prop_get(C, &ddr->ptr, &ddr->prop, &index_dummy);
|
||||
|
||||
/* fallback to the active camera's dof */
|
||||
if (ddr->prop == NULL) {
|
||||
if (ddr->prop == nullptr) {
|
||||
RegionView3D *rv3d = CTX_wm_region_view3d(C);
|
||||
if (rv3d && rv3d->persp == RV3D_CAMOB) {
|
||||
View3D *v3d = CTX_wm_view3d(C);
|
||||
if (v3d->camera && v3d->camera->data &&
|
||||
BKE_id_is_editable(CTX_data_main(C), v3d->camera->data)) {
|
||||
BKE_id_is_editable(CTX_data_main(C), static_cast<const ID *>(v3d->camera->data))) {
|
||||
Camera *camera = (Camera *)v3d->camera->data;
|
||||
RNA_pointer_create(&camera->id, &RNA_CameraDOFSettings, &camera->dof, &ddr->ptr);
|
||||
ddr->prop = RNA_struct_find_property(&ddr->ptr, "focus_distance");
|
||||
@@ -102,7 +100,7 @@ static int depthdropper_init(bContext *C, wmOperator *op)
|
||||
ddr->is_undo = UI_but_flag_is_set(but, UI_BUT_UNDO);
|
||||
}
|
||||
|
||||
if ((ddr->ptr.data == NULL) || (ddr->prop == NULL) ||
|
||||
if ((ddr->ptr.data == nullptr) || (ddr->prop == nullptr) ||
|
||||
(RNA_property_editable(&ddr->ptr, ddr->prop) == false) ||
|
||||
(RNA_property_type(ddr->prop) != PROP_FLOAT)) {
|
||||
MEM_freeN(ddr);
|
||||
@@ -131,7 +129,7 @@ static void depthdropper_exit(bContext *C, wmOperator *op)
|
||||
|
||||
MEM_freeN(op->customdata);
|
||||
|
||||
op->customdata = NULL;
|
||||
op->customdata = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,8 +157,8 @@ static void depthdropper_depth_sample_pt(bContext *C,
|
||||
ARegion *region = BKE_area_find_region_xy(area, RGN_TYPE_WINDOW, m_xy);
|
||||
if (region) {
|
||||
struct Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C);
|
||||
View3D *v3d = area->spacedata.first;
|
||||
RegionView3D *rv3d = region->regiondata;
|
||||
View3D *v3d = static_cast<View3D *>(area->spacedata.first);
|
||||
RegionView3D *rv3d = static_cast<RegionView3D *>(region->regiondata);
|
||||
/* weak, we could pass in some reference point */
|
||||
const float *view_co = v3d->camera ? v3d->camera->object_to_world[3] : rv3d->viewinv[3];
|
||||
const int mval[2] = {m_xy[0] - region->winrct.xmin, m_xy[1] - region->winrct.ymin};
|
||||
@@ -176,7 +174,7 @@ static void depthdropper_depth_sample_pt(bContext *C,
|
||||
|
||||
view3d_operator_needs_opengl(C);
|
||||
|
||||
if (ED_view3d_autodist(depsgraph, region, v3d, mval, co, true, NULL)) {
|
||||
if (ED_view3d_autodist(depsgraph, region, v3d, mval, co, true, nullptr)) {
|
||||
const float mval_center_fl[2] = {(float)region->winx / 2, (float)region->winy / 2};
|
||||
float co_align[3];
|
||||
|
||||
@@ -244,7 +242,7 @@ static void depthdropper_depth_sample_accum(bContext *C, DepthDropper *ddr, cons
|
||||
|
||||
static void depthdropper_cancel(bContext *C, wmOperator *op)
|
||||
{
|
||||
DepthDropper *ddr = op->customdata;
|
||||
DepthDropper *ddr = static_cast<DepthDropper *>(op->customdata);
|
||||
if (ddr->is_set) {
|
||||
depthdropper_depth_set(C, ddr, ddr->init_depth);
|
||||
}
|
||||
@@ -254,7 +252,7 @@ static void depthdropper_cancel(bContext *C, wmOperator *op)
|
||||
/* main modal status check */
|
||||
static int depthdropper_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
DepthDropper *ddr = (DepthDropper *)op->customdata;
|
||||
DepthDropper *ddr = static_cast<DepthDropper *>(op->customdata);
|
||||
|
||||
/* handle modal keymap */
|
||||
if (event->type == EVT_MODAL_MAP) {
|
||||
@@ -299,7 +297,7 @@ static int depthdropper_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
}
|
||||
|
||||
/* Modal Operator init */
|
||||
static int depthdropper_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
|
||||
static int depthdropper_invoke(bContext *C, wmOperator *op, const wmEvent * /*event*/)
|
||||
{
|
||||
/* init */
|
||||
if (depthdropper_init(C, op)) {
|
||||
@@ -337,9 +335,9 @@ static bool depthdropper_poll(bContext *C)
|
||||
uiBut *but;
|
||||
|
||||
/* check if there's an active button taking depth value */
|
||||
if ((CTX_wm_window(C) != NULL) &&
|
||||
if ((CTX_wm_window(C) != nullptr) &&
|
||||
(but = UI_context_active_but_prop_get(C, &ptr, &prop, &index_dummy)) &&
|
||||
(but->type == UI_BTYPE_NUM) && (prop != NULL)) {
|
||||
(but->type == UI_BTYPE_NUM) && (prop != nullptr)) {
|
||||
if ((RNA_property_type(prop) == PROP_FLOAT) &&
|
||||
(RNA_property_subtype(prop) & PROP_UNIT_LENGTH) &&
|
||||
(RNA_property_array_check(prop) == false)) {
|
||||
@@ -351,7 +349,7 @@ static bool depthdropper_poll(bContext *C)
|
||||
if (rv3d && rv3d->persp == RV3D_CAMOB) {
|
||||
View3D *v3d = CTX_wm_view3d(C);
|
||||
if (v3d->camera && v3d->camera->data &&
|
||||
BKE_id_is_editable(CTX_data_main(C), v3d->camera->data)) {
|
||||
BKE_id_is_editable(CTX_data_main(C), static_cast<const ID *>(v3d->camera->data))) {
|
||||
return true;
|
||||
}
|
||||
}
|
@@ -33,10 +33,10 @@
|
||||
|
||||
#include "ED_keyframing.h"
|
||||
|
||||
#include "eyedropper_intern.h"
|
||||
#include "interface_intern.h"
|
||||
#include "eyedropper_intern.hh"
|
||||
#include "interface_intern.hh"
|
||||
|
||||
typedef struct DriverDropper {
|
||||
struct DriverDropper {
|
||||
/* Destination property (i.e. where we'll add a driver) */
|
||||
PointerRNA ptr;
|
||||
PropertyRNA *prop;
|
||||
@@ -44,15 +44,15 @@ typedef struct DriverDropper {
|
||||
bool is_undo;
|
||||
|
||||
/* TODO: new target? */
|
||||
} DriverDropper;
|
||||
};
|
||||
|
||||
static bool driverdropper_init(bContext *C, wmOperator *op)
|
||||
{
|
||||
DriverDropper *ddr = MEM_callocN(sizeof(DriverDropper), __func__);
|
||||
DriverDropper *ddr = MEM_cnew<DriverDropper>(__func__);
|
||||
|
||||
uiBut *but = UI_context_active_but_prop_get(C, &ddr->ptr, &ddr->prop, &ddr->index);
|
||||
|
||||
if ((ddr->ptr.data == NULL) || (ddr->prop == NULL) ||
|
||||
if ((ddr->ptr.data == nullptr) || (ddr->prop == nullptr) ||
|
||||
(RNA_property_editable(&ddr->ptr, ddr->prop) == false) ||
|
||||
(RNA_property_animateable(&ddr->ptr, ddr->prop) == false) || (but->flag & UI_BUT_DRIVEN)) {
|
||||
MEM_freeN(ddr);
|
||||
@@ -74,14 +74,14 @@ static void driverdropper_exit(bContext *C, wmOperator *op)
|
||||
|
||||
static void driverdropper_sample(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
DriverDropper *ddr = (DriverDropper *)op->customdata;
|
||||
DriverDropper *ddr = static_cast<DriverDropper *>(op->customdata);
|
||||
uiBut *but = eyedropper_get_property_button_under_mouse(C, event);
|
||||
|
||||
const short mapping_type = RNA_enum_get(op->ptr, "mapping_type");
|
||||
const short flag = 0;
|
||||
|
||||
/* we can only add a driver if we know what RNA property it corresponds to */
|
||||
if (but == NULL) {
|
||||
if (but == nullptr) {
|
||||
return;
|
||||
}
|
||||
/* Get paths for the source. */
|
||||
@@ -112,7 +112,7 @@ static void driverdropper_sample(bContext *C, wmOperator *op, const wmEvent *eve
|
||||
UI_context_update_anim_flag(C);
|
||||
DEG_relations_tag_update(CTX_data_main(C));
|
||||
DEG_id_tag_update(ddr->ptr.owner_id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_FCURVES_ORDER, NULL); /* XXX */
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_FCURVES_ORDER, nullptr); /* XXX */
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ static void driverdropper_cancel(bContext *C, wmOperator *op)
|
||||
/* main modal status check */
|
||||
static int driverdropper_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
DriverDropper *ddr = op->customdata;
|
||||
DriverDropper *ddr = static_cast<DriverDropper *>(op->customdata);
|
||||
|
||||
/* handle modal keymap */
|
||||
if (event->type == EVT_MODAL_MAP) {
|
||||
@@ -156,7 +156,7 @@ static int driverdropper_modal(bContext *C, wmOperator *op, const wmEvent *event
|
||||
}
|
||||
|
||||
/* Modal Operator init */
|
||||
static int driverdropper_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
|
||||
static int driverdropper_invoke(bContext *C, wmOperator *op, const wmEvent * /*event*/)
|
||||
{
|
||||
/* init */
|
||||
if (driverdropper_init(C, op)) {
|
@@ -46,16 +46,16 @@
|
||||
#include "DEG_depsgraph.h"
|
||||
#include "DEG_depsgraph_build.h"
|
||||
|
||||
#include "eyedropper_intern.h"
|
||||
#include "interface_intern.h"
|
||||
#include "eyedropper_intern.hh"
|
||||
#include "interface_intern.hh"
|
||||
|
||||
typedef struct EyedropperGPencil {
|
||||
struct EyedropperGPencil {
|
||||
struct ColorManagedDisplay *display;
|
||||
/** color under cursor RGB */
|
||||
float color[3];
|
||||
/** Mode */
|
||||
int mode;
|
||||
} EyedropperGPencil;
|
||||
};
|
||||
|
||||
/* Helper: Draw status message while the user is running the operator */
|
||||
static void eyedropper_gpencil_status_indicators(bContext *C)
|
||||
@@ -70,7 +70,7 @@ static void eyedropper_gpencil_status_indicators(bContext *C)
|
||||
/* Initialize. */
|
||||
static bool eyedropper_gpencil_init(bContext *C, wmOperator *op)
|
||||
{
|
||||
EyedropperGPencil *eye = MEM_callocN(sizeof(EyedropperGPencil), __func__);
|
||||
EyedropperGPencil *eye = MEM_cnew<EyedropperGPencil>(__func__);
|
||||
|
||||
op->customdata = eye;
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
@@ -87,7 +87,7 @@ static bool eyedropper_gpencil_init(bContext *C, wmOperator *op)
|
||||
static void eyedropper_gpencil_exit(bContext *C, wmOperator *op)
|
||||
{
|
||||
/* Clear status message area. */
|
||||
ED_workspace_status_text(C, NULL);
|
||||
ED_workspace_status_text(C, nullptr);
|
||||
|
||||
MEM_SAFE_FREE(op->customdata);
|
||||
}
|
||||
@@ -100,7 +100,7 @@ static void eyedropper_add_material(bContext *C,
|
||||
{
|
||||
Main *bmain = CTX_data_main(C);
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
Material *ma = NULL;
|
||||
Material *ma = nullptr;
|
||||
|
||||
bool found = false;
|
||||
|
||||
@@ -108,12 +108,12 @@ static void eyedropper_add_material(bContext *C,
|
||||
short *totcol = BKE_object_material_len_p(ob);
|
||||
for (short i = 0; i < *totcol; i++) {
|
||||
ma = BKE_object_material_get(ob, i + 1);
|
||||
if (ma == NULL) {
|
||||
if (ma == nullptr) {
|
||||
continue;
|
||||
}
|
||||
|
||||
MaterialGPencilStyle *gp_style = ma->gp_style;
|
||||
if (gp_style != NULL) {
|
||||
if (gp_style != nullptr) {
|
||||
/* Check stroke color. */
|
||||
bool found_stroke = compare_v3v3(gp_style->stroke_rgba, col_conv, 0.01f) &&
|
||||
(gp_style->flag & GP_MATERIAL_STROKE_SHOW);
|
||||
@@ -134,8 +134,8 @@ static void eyedropper_add_material(bContext *C,
|
||||
/* Found existing material. */
|
||||
if (found) {
|
||||
ob->actcol = i + 1;
|
||||
WM_main_add_notifier(NC_MATERIAL | ND_SHADING_LINKS, NULL);
|
||||
WM_main_add_notifier(NC_SPACE | ND_SPACE_VIEW3D, NULL);
|
||||
WM_main_add_notifier(NC_MATERIAL | ND_SHADING_LINKS, nullptr);
|
||||
WM_main_add_notifier(NC_SPACE | ND_SPACE_VIEW3D, nullptr);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -147,13 +147,13 @@ static void eyedropper_add_material(bContext *C,
|
||||
int idx;
|
||||
Material *ma_new = BKE_gpencil_object_material_new(bmain, ob, "Material", &idx);
|
||||
WM_main_add_notifier(NC_OBJECT | ND_OB_SHADING, &ob->id);
|
||||
WM_main_add_notifier(NC_MATERIAL | ND_SHADING_LINKS, NULL);
|
||||
WM_main_add_notifier(NC_MATERIAL | ND_SHADING_LINKS, nullptr);
|
||||
DEG_relations_tag_update(bmain);
|
||||
|
||||
BLI_assert(ma_new != NULL);
|
||||
BLI_assert(ma_new != nullptr);
|
||||
|
||||
MaterialGPencilStyle *gp_style_new = ma_new->gp_style;
|
||||
BLI_assert(gp_style_new != NULL);
|
||||
BLI_assert(gp_style_new != nullptr);
|
||||
|
||||
/* Only create Stroke (default option). */
|
||||
if (only_stroke) {
|
||||
@@ -193,13 +193,13 @@ static void eyedropper_add_palette_color(bContext *C, const float col_conv[4])
|
||||
Paint *vertexpaint = &gp_vertexpaint->paint;
|
||||
|
||||
/* Check for Palette in Draw and Vertex Paint Mode. */
|
||||
if (paint->palette == NULL) {
|
||||
if (paint->palette == nullptr) {
|
||||
Palette *palette = BKE_palette_add(bmain, "Grease Pencil");
|
||||
id_us_min(&palette->id);
|
||||
|
||||
BKE_paint_palette_set(paint, palette);
|
||||
|
||||
if (vertexpaint->palette == NULL) {
|
||||
if (vertexpaint->palette == nullptr) {
|
||||
BKE_paint_palette_set(vertexpaint, palette);
|
||||
}
|
||||
}
|
||||
@@ -280,7 +280,7 @@ static int eyedropper_gpencil_modal(bContext *C, wmOperator *op, const wmEvent *
|
||||
|
||||
/* Create material. */
|
||||
eyedropper_gpencil_color_set(C, event, eye);
|
||||
WM_main_add_notifier(NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
|
||||
WM_main_add_notifier(NC_GPENCIL | ND_DATA | NA_EDITED, nullptr);
|
||||
|
||||
eyedropper_gpencil_exit(C, op);
|
||||
return OPERATOR_FINISHED;
|
||||
@@ -305,7 +305,7 @@ static int eyedropper_gpencil_modal(bContext *C, wmOperator *op, const wmEvent *
|
||||
}
|
||||
|
||||
/* Modal Operator init */
|
||||
static int eyedropper_gpencil_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
|
||||
static int eyedropper_gpencil_invoke(bContext *C, wmOperator *op, const wmEvent * /*event*/)
|
||||
{
|
||||
/* Init. */
|
||||
if (eyedropper_gpencil_init(C, op)) {
|
||||
@@ -337,12 +337,12 @@ static bool eyedropper_gpencil_poll(bContext *C)
|
||||
{
|
||||
/* Only valid if the current active object is grease pencil. */
|
||||
Object *obact = CTX_data_active_object(C);
|
||||
if ((obact == NULL) || (obact->type != OB_GPENCIL)) {
|
||||
if ((obact == nullptr) || (obact->type != OB_GPENCIL)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Test we have a window below. */
|
||||
return (CTX_wm_window(C) != NULL);
|
||||
return (CTX_wm_window(C) != nullptr);
|
||||
}
|
||||
|
||||
void UI_OT_eyedropper_gpencil_color(wmOperatorType *ot)
|
||||
@@ -350,7 +350,7 @@ void UI_OT_eyedropper_gpencil_color(wmOperatorType *ot)
|
||||
static const EnumPropertyItem items_mode[] = {
|
||||
{0, "MATERIAL", 0, "Material", ""},
|
||||
{1, "PALETTE", 0, "Palette", ""},
|
||||
{0, NULL, 0, NULL, NULL},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
/* identifiers */
|
@@ -35,7 +35,7 @@ void datadropper_win_area_find(const struct bContext *C,
|
||||
*
|
||||
* Special check for image or nodes where we MAY have HDR pixels which don't display.
|
||||
*
|
||||
* \note Exposed by 'eyedropper_intern.h' for use with color band picking.
|
||||
* \note Exposed by 'eyedropper_intern.hh' for use with color band picking.
|
||||
*/
|
||||
void eyedropper_color_sample_fl(bContext *C, const int m_xy[2], float r_col[3]);
|
||||
|
@@ -19,9 +19,9 @@
|
||||
#include "WM_api.h"
|
||||
#include "WM_types.h"
|
||||
|
||||
#include "interface_intern.h"
|
||||
#include "interface_intern.hh"
|
||||
|
||||
#include "eyedropper_intern.h" /* own include */
|
||||
#include "eyedropper_intern.hh" /* own include */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/* Keymap
|
||||
@@ -36,14 +36,14 @@ wmKeyMap *eyedropper_modal_keymap(wmKeyConfig *keyconf)
|
||||
{EYE_MODAL_SAMPLE_CONFIRM, "SAMPLE_CONFIRM", 0, "Confirm Sampling", ""},
|
||||
{EYE_MODAL_SAMPLE_BEGIN, "SAMPLE_BEGIN", 0, "Start Sampling", ""},
|
||||
{EYE_MODAL_SAMPLE_RESET, "SAMPLE_RESET", 0, "Reset Sampling", ""},
|
||||
{0, NULL, 0, NULL, NULL},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
wmKeyMap *keymap = WM_modalkeymap_find(keyconf, "Eyedropper Modal Map");
|
||||
|
||||
/* This function is called for each space-type, only needs to add map once. */
|
||||
if (keymap && keymap->modal_items) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
keymap = WM_modalkeymap_ensure(keyconf, "Eyedropper Modal Map", modal_items);
|
||||
@@ -66,7 +66,7 @@ wmKeyMap *eyedropper_colorband_modal_keymap(wmKeyConfig *keyconf)
|
||||
{EYE_MODAL_POINT_SAMPLE, "SAMPLE_SAMPLE", 0, "Sample a Point", ""},
|
||||
{EYE_MODAL_POINT_CONFIRM, "SAMPLE_CONFIRM", 0, "Confirm Sampling", ""},
|
||||
{EYE_MODAL_POINT_RESET, "SAMPLE_RESET", 0, "Reset Sampling", ""},
|
||||
{0, NULL, 0, NULL, NULL},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
wmKeyMap *keymap = WM_modalkeymap_find(keyconf, "Eyedropper ColorRamp PointSampling Map");
|
||||
@@ -107,7 +107,7 @@ static void eyedropper_draw_cursor_text_ex(const int xy[2], const char *name)
|
||||
UI_fontstyle_draw_simple_backdrop(fstyle, xy[0], xy[1] + U.widget_unit, name, col_fg, col_bg);
|
||||
}
|
||||
|
||||
void eyedropper_draw_cursor_text_window(const struct wmWindow *window, const char *name)
|
||||
void eyedropper_draw_cursor_text_window(const wmWindow *window, const char *name)
|
||||
{
|
||||
if (name[0] == '\0') {
|
||||
return;
|
||||
@@ -133,8 +133,8 @@ uiBut *eyedropper_get_property_button_under_mouse(bContext *C, const wmEvent *ev
|
||||
|
||||
uiBut *but = ui_but_find_mouse_over(region, event);
|
||||
|
||||
if (ELEM(NULL, but, but->rnapoin.data, but->rnaprop)) {
|
||||
return NULL;
|
||||
if (ELEM(nullptr, but, but->rnapoin.data, but->rnaprop)) {
|
||||
return nullptr;
|
||||
}
|
||||
return but;
|
||||
}
|
||||
@@ -146,7 +146,7 @@ void datadropper_win_area_find(
|
||||
|
||||
*r_win = CTX_wm_window(C);
|
||||
*r_area = BKE_screen_find_area_xy(screen, SPACE_TYPE_ANY, mval);
|
||||
if (*r_area == NULL) {
|
||||
if (*r_area == nullptr) {
|
||||
*r_win = WM_window_find_under_cursor(*r_win, mval, r_mval);
|
||||
if (*r_win) {
|
||||
screen = WM_window_get_active_screen(*r_win);
|
@@ -73,7 +73,7 @@
|
||||
|
||||
#include "DEG_depsgraph_query.h"
|
||||
|
||||
#include "interface_intern.h"
|
||||
#include "interface_intern.hh"
|
||||
|
||||
using blender::Vector;
|
||||
|
||||
|
@@ -14,7 +14,7 @@
|
||||
|
||||
#include "UI_interface.h"
|
||||
|
||||
#include "interface_intern.h"
|
||||
#include "interface_intern.hh"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
* This will probably not work in all possible cases,
|
||||
* but not sure we want to support such exotic cases anyway.
|
||||
*/
|
||||
typedef struct ButAlign {
|
||||
struct ButAlign {
|
||||
uiBut *but;
|
||||
|
||||
/* Neighbor buttons */
|
||||
@@ -56,7 +56,7 @@ typedef struct ButAlign {
|
||||
/* Flags, used to mark whether we should 'stitch'
|
||||
* the corners of this button with its neighbors' ones. */
|
||||
char flags[4];
|
||||
} ButAlign;
|
||||
};
|
||||
|
||||
/* Side-related enums and flags. */
|
||||
enum {
|
||||
@@ -168,7 +168,7 @@ static void block_align_proximity_compute(ButAlign *butal, ButAlign *butal_other
|
||||
/* We found an as close or closer neighbor.
|
||||
* If both buttons are alignable, we set them as each other neighbors.
|
||||
* Else, we have an unalignable one, we need to reset the others matching
|
||||
* neighbor to NULL if its 'proximity distance'
|
||||
* neighbor to nullptr if its 'proximity distance'
|
||||
* is really lower with current one.
|
||||
*
|
||||
* NOTE: We cannot only execute that piece of code in case we found a
|
||||
@@ -181,10 +181,10 @@ static void block_align_proximity_compute(ButAlign *butal, ButAlign *butal_other
|
||||
butal_other->neighbors[side_opp] = butal;
|
||||
}
|
||||
else if (butal_can_align && (delta < butal->dists[side])) {
|
||||
butal->neighbors[side] = NULL;
|
||||
butal->neighbors[side] = nullptr;
|
||||
}
|
||||
else if (butal_other_can_align && (delta < butal_other->dists[side_opp])) {
|
||||
butal_other->neighbors[side_opp] = NULL;
|
||||
butal_other->neighbors[side_opp] = nullptr;
|
||||
}
|
||||
butal->dists[side] = butal_other->dists[side_opp] = delta;
|
||||
}
|
||||
@@ -196,10 +196,10 @@ static void block_align_proximity_compute(ButAlign *butal, ButAlign *butal_other
|
||||
const int stitch = STITCH(side);
|
||||
const int stitch_opp = STITCH(side_opp);
|
||||
|
||||
if (butal->neighbors[side] == NULL) {
|
||||
if (butal->neighbors[side] == nullptr) {
|
||||
butal->neighbors[side] = butal_other;
|
||||
}
|
||||
if (butal_other->neighbors[side_opp] == NULL) {
|
||||
if (butal_other->neighbors[side_opp] == nullptr) {
|
||||
butal_other->neighbors[side_opp] = butal;
|
||||
}
|
||||
|
||||
@@ -304,8 +304,8 @@ static void block_align_stitch_neighbors(ButAlign *butal,
|
||||
*/
|
||||
static int ui_block_align_butal_cmp(const void *a, const void *b)
|
||||
{
|
||||
const ButAlign *butal = a;
|
||||
const ButAlign *butal_other = b;
|
||||
const ButAlign *butal = static_cast<const ButAlign *>(a);
|
||||
const ButAlign *butal_other = static_cast<const ButAlign *>(b);
|
||||
|
||||
/* Sort by align group. */
|
||||
if (butal->but->alignnr != butal_other->but->alignnr) {
|
||||
@@ -402,7 +402,8 @@ void ui_block_align_calc(uiBlock *block, const ARegion *region)
|
||||
butal_array = butal_array_buf;
|
||||
}
|
||||
else {
|
||||
butal_array = MEM_mallocN(sizeof(*butal_array) * num_buttons, __func__);
|
||||
butal_array = static_cast<ButAlign *>(
|
||||
MEM_mallocN(sizeof(*butal_array) * num_buttons, __func__));
|
||||
}
|
||||
memset(butal_array, 0, sizeof(*butal_array) * (size_t)num_buttons);
|
||||
|
||||
@@ -549,7 +550,7 @@ static bool buts_are_horiz(uiBut *but1, uiBut *but2)
|
||||
|
||||
static void ui_block_align_calc_but(uiBut *first, short nr)
|
||||
{
|
||||
uiBut *prev, *but = NULL, *next;
|
||||
uiBut *prev, *but = nullptr, *next;
|
||||
int flag = 0, cols = 0, rows = 0;
|
||||
|
||||
/* auto align */
|
||||
@@ -569,10 +570,10 @@ static void ui_block_align_calc_but(uiBut *first, short nr)
|
||||
|
||||
/* NOTE: manipulation of 'flag' in the loop below is confusing.
|
||||
* In some cases it's assigned, other times OR is used. */
|
||||
for (but = first, prev = NULL; but && but->alignnr == nr; prev = but, but = but->next) {
|
||||
for (but = first, prev = nullptr; but && but->alignnr == nr; prev = but, but = but->next) {
|
||||
next = but->next;
|
||||
if (next && next->alignnr != nr) {
|
||||
next = NULL;
|
||||
next = nullptr;
|
||||
}
|
||||
|
||||
/* clear old flag */
|
||||
@@ -593,7 +594,7 @@ static void ui_block_align_calc_but(uiBut *first, short nr)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (next == NULL) { /* last case */
|
||||
else if (next == nullptr) { /* last case */
|
||||
if (prev) {
|
||||
if (buts_are_horiz(prev, but)) {
|
||||
if (rows == 0) {
|
||||
@@ -622,7 +623,7 @@ static void ui_block_align_calc_but(uiBut *first, short nr)
|
||||
}
|
||||
bt = bt->next;
|
||||
}
|
||||
if (bt == NULL || bt->alignnr != nr) {
|
||||
if (bt == nullptr || bt->alignnr != nr) {
|
||||
flag = UI_BUT_ALIGN_TOP | UI_BUT_ALIGN_RIGHT;
|
||||
}
|
||||
}
|
||||
@@ -704,7 +705,7 @@ static void ui_block_align_calc_but(uiBut *first, short nr)
|
||||
}
|
||||
}
|
||||
|
||||
void ui_block_align_calc(uiBlock *block, const struct ARegion *UNUSED(region))
|
||||
void ui_block_align_calc(uiBlock *block, const struct ARegion *(region))
|
||||
{
|
||||
short nr;
|
||||
|
@@ -40,7 +40,7 @@
|
||||
#include "WM_api.h"
|
||||
#include "WM_types.h"
|
||||
|
||||
#include "interface_intern.h"
|
||||
#include "interface_intern.hh"
|
||||
|
||||
static FCurve *ui_but_get_fcurve(
|
||||
uiBut *but, AnimData **adt, bAction **action, bool *r_driven, bool *r_special)
|
||||
|
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "interface_intern.h"
|
||||
#include "interface_intern.hh"
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Button Groups
|
||||
|
@@ -30,7 +30,7 @@
|
||||
|
||||
#include "UI_interface.h"
|
||||
|
||||
#include "interface_intern.h"
|
||||
#include "interface_intern.hh"
|
||||
|
||||
#include "RNA_access.h"
|
||||
#include "RNA_prototypes.h"
|
||||
|
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "WM_api.h"
|
||||
|
||||
#include "interface_intern.h"
|
||||
#include "interface_intern.hh"
|
||||
|
||||
void UI_but_drag_set_id(uiBut *but, ID *id)
|
||||
{
|
||||
|
@@ -48,7 +48,7 @@
|
||||
#include "UI_interface.h"
|
||||
|
||||
/* own include */
|
||||
#include "interface_intern.h"
|
||||
#include "interface_intern.hh"
|
||||
|
||||
static int roundboxtype = UI_CNR_ALL;
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -5,9 +5,9 @@
|
||||
* \ingroup edinterface
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <cmath>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
#include "WM_api.h"
|
||||
#include "WM_types.h"
|
||||
|
||||
#include "interface_intern.h"
|
||||
#include "interface_intern.hh"
|
||||
|
||||
#ifndef WITH_HEADLESS
|
||||
# define ICON_GRID_COLS 26
|
||||
@@ -74,15 +74,15 @@
|
||||
# define ICON_GRID_H 32
|
||||
#endif /* WITH_HEADLESS */
|
||||
|
||||
typedef struct IconImage {
|
||||
struct IconImage {
|
||||
int w;
|
||||
int h;
|
||||
uint *rect;
|
||||
const uchar *datatoc_rect;
|
||||
int datatoc_size;
|
||||
} IconImage;
|
||||
};
|
||||
|
||||
typedef void (*VectorDrawFunc)(int x, int y, int w, int h, float alpha);
|
||||
using VectorDrawFunc = void (*)(int x, int y, int w, int h, float alpha);
|
||||
|
||||
#define ICON_TYPE_PREVIEW 0
|
||||
#define ICON_TYPE_COLOR_TEXTURE 1
|
||||
@@ -95,7 +95,7 @@ typedef void (*VectorDrawFunc)(int x, int y, int w, int h, float alpha);
|
||||
#define ICON_TYPE_GPLAYER 8
|
||||
#define ICON_TYPE_BLANK 9
|
||||
|
||||
typedef struct DrawInfo {
|
||||
struct DrawInfo {
|
||||
int type;
|
||||
|
||||
union {
|
||||
@@ -123,26 +123,26 @@ typedef struct DrawInfo {
|
||||
struct DrawInfo *next;
|
||||
} input;
|
||||
} data;
|
||||
} DrawInfo;
|
||||
};
|
||||
|
||||
typedef struct IconTexture {
|
||||
struct GPUTexture *tex[2];
|
||||
struct IconTexture {
|
||||
GPUTexture *tex[2];
|
||||
int num_textures;
|
||||
int w;
|
||||
int h;
|
||||
float invw;
|
||||
float invh;
|
||||
} IconTexture;
|
||||
};
|
||||
|
||||
typedef struct IconType {
|
||||
struct IconType {
|
||||
int type;
|
||||
int theme_color;
|
||||
} IconType;
|
||||
};
|
||||
|
||||
/* ******************* STATIC LOCAL VARS ******************* */
|
||||
/* Static here to cache results of icon directory scan, so it's not
|
||||
* scanning the file-system each time the menu is drawn. */
|
||||
static struct ListBase iconfilelist = {NULL, NULL};
|
||||
static ListBase iconfilelist = {NULL, NULL};
|
||||
static IconTexture icongltex = {{NULL, NULL}, 0, 0, 0, 0.0f, 0.0f};
|
||||
|
||||
#ifndef WITH_HEADLESS
|
||||
@@ -168,12 +168,12 @@ static const IconType icontypes[] = {
|
||||
static DrawInfo *def_internal_icon(
|
||||
ImBuf *bbuf, int icon_id, int xofs, int yofs, int size, int type, int theme_color)
|
||||
{
|
||||
Icon *new_icon = MEM_callocN(sizeof(Icon), "texicon");
|
||||
Icon *new_icon = MEM_cnew<Icon>(__func__);
|
||||
|
||||
new_icon->obj = NULL; /* icon is not for library object */
|
||||
new_icon->id_type = 0;
|
||||
|
||||
DrawInfo *di = MEM_callocN(sizeof(DrawInfo), "drawinfo");
|
||||
DrawInfo *di = MEM_cnew<DrawInfo>(__func__);
|
||||
di->type = type;
|
||||
|
||||
if (ELEM(type, ICON_TYPE_COLOR_TEXTURE, ICON_TYPE_MONO_TEXTURE)) {
|
||||
@@ -184,7 +184,7 @@ static DrawInfo *def_internal_icon(
|
||||
di->data.texture.h = size;
|
||||
}
|
||||
else if (type == ICON_TYPE_BUFFER) {
|
||||
IconImage *iimg = MEM_callocN(sizeof(IconImage), "icon_img");
|
||||
IconImage *iimg = MEM_cnew<IconImage>(__func__);
|
||||
iimg->w = size;
|
||||
iimg->h = size;
|
||||
|
||||
@@ -192,7 +192,7 @@ static DrawInfo *def_internal_icon(
|
||||
if (bbuf) {
|
||||
int y, imgsize;
|
||||
|
||||
iimg->rect = MEM_mallocN(size * size * sizeof(uint), "icon_rect");
|
||||
iimg->rect = static_cast<uint *>(MEM_mallocN(size * size * sizeof(uint), __func__));
|
||||
|
||||
/* Here we store the rect in the icon - same as before */
|
||||
if (size == bbuf->x && size == bbuf->y && xofs == 0 && yofs == 0) {
|
||||
@@ -220,12 +220,12 @@ static DrawInfo *def_internal_icon(
|
||||
|
||||
static void def_internal_vicon(int icon_id, VectorDrawFunc drawFunc)
|
||||
{
|
||||
Icon *new_icon = MEM_callocN(sizeof(Icon), "texicon");
|
||||
Icon *new_icon = MEM_cnew<Icon>("texicon");
|
||||
|
||||
new_icon->obj = NULL; /* icon is not for library object */
|
||||
new_icon->id_type = 0;
|
||||
|
||||
DrawInfo *di = MEM_callocN(sizeof(DrawInfo), "drawinfo");
|
||||
DrawInfo *di = MEM_cnew<DrawInfo>("drawinfo");
|
||||
di->type = ICON_TYPE_VECTOR;
|
||||
di->data.vector.func = drawFunc;
|
||||
|
||||
@@ -244,7 +244,7 @@ static void vicon_keytype_draw_wrapper(
|
||||
{
|
||||
/* Initialize dummy theme state for Action Editor - where these colors are defined
|
||||
* (since we're doing this off-screen, free from any particular space_id). */
|
||||
struct bThemeState theme_state;
|
||||
bThemeState theme_state;
|
||||
|
||||
UI_Theme_Store(&theme_state);
|
||||
UI_SetTheme(SPACE_ACTION, RGN_TYPE_WINDOW);
|
||||
@@ -822,7 +822,7 @@ static ImBuf *create_mono_icon_with_border(ImBuf *buf,
|
||||
const int offset_write = (sy + by) * buf->x + (sx + bx);
|
||||
const float blurred_alpha = blurred_alpha_buffer[blurred_alpha_offset];
|
||||
const float border_srgb[4] = {
|
||||
0, 0, 0, MIN2(1.0, blurred_alpha * border_sharpness) * border_intensity};
|
||||
0, 0, 0, MIN2(1.0f, blurred_alpha * border_sharpness) * border_intensity};
|
||||
|
||||
const uint color_read = buf->rect[offset_write];
|
||||
const uchar *orig_color = (uchar *)&color_read;
|
||||
@@ -1036,7 +1036,7 @@ static void init_internal_icons(void)
|
||||
vicon_strip_color_draw_library_data_override_noneditable);
|
||||
}
|
||||
|
||||
static void init_iconfile_list(struct ListBase *list)
|
||||
static void init_iconfile_list(ListBase *list)
|
||||
{
|
||||
BLI_listbase_clear(list);
|
||||
const char *icondir = BKE_appdir_folder_id(BLENDER_DATAFILES, "icons");
|
||||
@@ -1045,7 +1045,7 @@ static void init_iconfile_list(struct ListBase *list)
|
||||
return;
|
||||
}
|
||||
|
||||
struct direntry *dir;
|
||||
direntry *dir;
|
||||
const int totfile = BLI_filelist_dir_contents(icondir, &dir);
|
||||
|
||||
int index = 1;
|
||||
@@ -1083,7 +1083,7 @@ static void init_iconfile_list(struct ListBase *list)
|
||||
# endif /* removed */
|
||||
|
||||
/* found a potential icon file, so make an entry for it in the cache list */
|
||||
IconFile *ifile = MEM_callocN(sizeof(IconFile), "IconFile");
|
||||
IconFile *ifile = MEM_cnew<IconFile>(__func__);
|
||||
|
||||
BLI_strncpy(ifile->filename, filename, sizeof(ifile->filename));
|
||||
ifile->index = index;
|
||||
@@ -1099,12 +1099,9 @@ static void init_iconfile_list(struct ListBase *list)
|
||||
dir = NULL;
|
||||
}
|
||||
|
||||
static void free_iconfile_list(struct ListBase *list)
|
||||
static void free_iconfile_list(ListBase *list)
|
||||
{
|
||||
IconFile *ifile = NULL, *next_ifile = NULL;
|
||||
|
||||
for (ifile = list->first; ifile; ifile = next_ifile) {
|
||||
next_ifile = ifile->next;
|
||||
LISTBASE_FOREACH_MUTABLE (IconFile *, ifile, &iconfilelist) {
|
||||
BLI_freelinkN(list, ifile);
|
||||
}
|
||||
}
|
||||
@@ -1119,10 +1116,7 @@ void UI_icons_reload_internal_textures(void)
|
||||
|
||||
int UI_iconfile_get_index(const char *filename)
|
||||
{
|
||||
IconFile *ifile;
|
||||
ListBase *list = &(iconfilelist);
|
||||
|
||||
for (ifile = list->first; ifile; ifile = ifile->next) {
|
||||
LISTBASE_FOREACH (const IconFile *, ifile, &iconfilelist) {
|
||||
if (BLI_path_cmp(filename, ifile->filename) == 0) {
|
||||
return ifile->index;
|
||||
}
|
||||
@@ -1149,7 +1143,7 @@ void UI_icons_free(void)
|
||||
|
||||
void UI_icons_free_drawinfo(void *drawinfo)
|
||||
{
|
||||
DrawInfo *di = drawinfo;
|
||||
DrawInfo *di = static_cast<DrawInfo *>(drawinfo);
|
||||
|
||||
if (di == NULL) {
|
||||
return;
|
||||
@@ -1179,7 +1173,7 @@ static DrawInfo *icon_create_drawinfo(Icon *icon)
|
||||
{
|
||||
const int icon_data_type = icon->obj_type;
|
||||
|
||||
DrawInfo *di = MEM_callocN(sizeof(DrawInfo), "di_icon");
|
||||
DrawInfo *di = MEM_cnew<DrawInfo>("di_icon");
|
||||
|
||||
if (ELEM(icon_data_type, ICON_DATA_ID, ICON_DATA_PREVIEW)) {
|
||||
di->type = ICON_TYPE_PREVIEW;
|
||||
@@ -1206,7 +1200,7 @@ static DrawInfo *icon_create_drawinfo(Icon *icon)
|
||||
static DrawInfo *icon_ensure_drawinfo(Icon *icon)
|
||||
{
|
||||
if (icon->drawinfo) {
|
||||
return icon->drawinfo;
|
||||
return static_cast<DrawInfo *>(icon->drawinfo);
|
||||
}
|
||||
DrawInfo *di = icon_create_drawinfo(icon);
|
||||
icon->drawinfo = di;
|
||||
@@ -1287,7 +1281,7 @@ int UI_icon_preview_to_render_size(enum eIconSizes size)
|
||||
|
||||
/* Create rect for the icon
|
||||
*/
|
||||
static void icon_create_rect(struct PreviewImage *prv_img, enum eIconSizes size)
|
||||
static void icon_create_rect(PreviewImage *prv_img, enum eIconSizes size)
|
||||
{
|
||||
const uint render_size = UI_icon_preview_to_render_size(size);
|
||||
|
||||
@@ -1301,7 +1295,8 @@ static void icon_create_rect(struct PreviewImage *prv_img, enum eIconSizes size)
|
||||
prv_img->h[size] = render_size;
|
||||
prv_img->flag[size] |= PRV_CHANGED;
|
||||
prv_img->changed_timestamp[size] = 0;
|
||||
prv_img->rect[size] = MEM_callocN(render_size * render_size * sizeof(uint), "prv_rect");
|
||||
prv_img->rect[size] = static_cast<uint *>(
|
||||
MEM_callocN(render_size * render_size * sizeof(uint), "prv_rect"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1316,7 +1311,7 @@ static void ui_studiolight_icon_job_exec(void *customdata,
|
||||
Icon **tmp = (Icon **)customdata;
|
||||
Icon *icon = *tmp;
|
||||
DrawInfo *di = icon_ensure_drawinfo(icon);
|
||||
StudioLight *sl = icon->obj;
|
||||
StudioLight *sl = static_cast<StudioLight *>(icon->obj);
|
||||
BKE_studiolight_preview(di->data.buffer.image->rect, sl, icon->id_type);
|
||||
}
|
||||
|
||||
@@ -1329,7 +1324,7 @@ static void ui_studiolight_kill_icon_preview_job(wmWindowManager *wm, int icon_i
|
||||
|
||||
static void ui_studiolight_free_function(StudioLight *sl, void *data)
|
||||
{
|
||||
wmWindowManager *wm = data;
|
||||
wmWindowManager *wm = static_cast<wmWindowManager *>(data);
|
||||
|
||||
/* Happens if job was canceled or already finished. */
|
||||
if (wm == NULL) {
|
||||
@@ -1355,7 +1350,7 @@ static void ui_studiolight_icon_job_end(void *customdata)
|
||||
{
|
||||
Icon **tmp = (Icon **)customdata;
|
||||
Icon *icon = *tmp;
|
||||
StudioLight *sl = icon->obj;
|
||||
StudioLight *sl = static_cast<StudioLight *>(icon->obj);
|
||||
BKE_studiolight_set_free_function(sl, &ui_studiolight_free_function, NULL);
|
||||
}
|
||||
|
||||
@@ -1375,8 +1370,9 @@ void ui_icon_ensure_deferred(const bContext *C, const int icon_id, const bool bi
|
||||
|
||||
switch (di->type) {
|
||||
case ICON_TYPE_PREVIEW: {
|
||||
ID *id = (icon->id_type != 0) ? icon->obj : NULL;
|
||||
PreviewImage *prv = id ? BKE_previewimg_id_ensure(id) : icon->obj;
|
||||
ID *id = (icon->id_type != 0) ? static_cast<ID *>(icon->obj) : NULL;
|
||||
PreviewImage *prv = id ? BKE_previewimg_id_ensure(id) :
|
||||
static_cast<PreviewImage *>(icon->obj);
|
||||
/* Using jobs for screen previews crashes due to off-screen rendering.
|
||||
* XXX: would be nicer if #PreviewImage could store if it supports jobs. */
|
||||
const bool use_jobs = !id || (GS(id->name) != ID_SCR);
|
||||
@@ -1394,20 +1390,24 @@ void ui_icon_ensure_deferred(const bContext *C, const int icon_id, const bool bi
|
||||
if (icon->obj_type == ICON_DATA_STUDIOLIGHT) {
|
||||
if (di->data.buffer.image == NULL) {
|
||||
wmWindowManager *wm = CTX_wm_manager(C);
|
||||
StudioLight *sl = icon->obj;
|
||||
StudioLight *sl = static_cast<StudioLight *>(icon->obj);
|
||||
BKE_studiolight_set_free_function(sl, &ui_studiolight_free_function, wm);
|
||||
IconImage *img = MEM_mallocN(sizeof(IconImage), __func__);
|
||||
IconImage *img = MEM_cnew<IconImage>(__func__);
|
||||
|
||||
img->w = STUDIOLIGHT_ICON_SIZE;
|
||||
img->h = STUDIOLIGHT_ICON_SIZE;
|
||||
const size_t size = STUDIOLIGHT_ICON_SIZE * STUDIOLIGHT_ICON_SIZE * sizeof(uint);
|
||||
img->rect = MEM_mallocN(size, __func__);
|
||||
img->rect = static_cast<uint *>(MEM_mallocN(size, __func__));
|
||||
memset(img->rect, 0, size);
|
||||
di->data.buffer.image = img;
|
||||
|
||||
wmJob *wm_job = WM_jobs_get(
|
||||
wm, CTX_wm_window(C), icon, "StudioLight Icon", 0, WM_JOB_TYPE_STUDIOLIGHT);
|
||||
Icon **tmp = MEM_callocN(sizeof(Icon *), __func__);
|
||||
wmJob *wm_job = WM_jobs_get(wm,
|
||||
CTX_wm_window(C),
|
||||
icon,
|
||||
"StudioLight Icon",
|
||||
eWM_JobFlag(0),
|
||||
WM_JOB_TYPE_STUDIOLIGHT);
|
||||
Icon **tmp = MEM_cnew<Icon *>(__func__);
|
||||
*tmp = icon;
|
||||
WM_jobs_customdata_set(wm_job, tmp, MEM_freeN);
|
||||
WM_jobs_timer(wm_job, 0.01, 0, NC_WINDOW);
|
||||
@@ -1478,7 +1478,7 @@ PreviewImage *UI_icon_to_preview(int icon_id)
|
||||
|
||||
if (di->type == ICON_TYPE_PREVIEW) {
|
||||
PreviewImage *prv = (icon->id_type != 0) ? BKE_previewimg_id_ensure((ID *)icon->obj) :
|
||||
icon->obj;
|
||||
static_cast<PreviewImage *>(icon->obj);
|
||||
|
||||
if (prv) {
|
||||
return BKE_previewimg_copy(prv);
|
||||
@@ -1581,16 +1581,16 @@ static void icon_draw_rect(float x,
|
||||
* efficient than simple glUniform calls. */
|
||||
#define ICON_DRAW_CACHE_SIZE 16
|
||||
|
||||
typedef struct IconDrawCall {
|
||||
struct IconDrawCall {
|
||||
rctf pos;
|
||||
rctf tex;
|
||||
float color[4];
|
||||
} IconDrawCall;
|
||||
};
|
||||
|
||||
typedef struct IconTextureDrawCall {
|
||||
struct IconTextureDrawCall {
|
||||
IconDrawCall drawcall_cache[ICON_DRAW_CACHE_SIZE];
|
||||
int calls; /* Number of calls batched together */
|
||||
} IconTextureDrawCall;
|
||||
};
|
||||
|
||||
static struct {
|
||||
IconTextureDrawCall normal;
|
||||
@@ -1616,7 +1616,7 @@ static void icon_draw_cache_texture_flush_ex(GPUTexture *texture,
|
||||
|
||||
const int data_binding = GPU_shader_get_uniform_block_binding(shader, "multi_rect_data");
|
||||
GPUUniformBuf *ubo = GPU_uniformbuf_create_ex(
|
||||
sizeof(struct MultiRectCallData), texture_draw_calls->drawcall_cache, __func__);
|
||||
sizeof(MultiRectCallData), texture_draw_calls->drawcall_cache, __func__);
|
||||
GPU_uniformbuf_bind(ubo, data_binding);
|
||||
|
||||
const int img_binding = GPU_shader_get_texture_binding(shader, "image");
|
||||
@@ -1752,21 +1752,20 @@ static void icon_draw_texture(float x,
|
||||
fstyle_small.points *= zoom_factor;
|
||||
fstyle_small.points *= 0.8f;
|
||||
|
||||
rcti text_rect = {
|
||||
.xmax = x + UI_UNIT_X * zoom_factor,
|
||||
.xmin = x,
|
||||
.ymax = y,
|
||||
.ymin = y,
|
||||
};
|
||||
rcti text_rect{};
|
||||
text_rect.xmax = x + UI_UNIT_X * zoom_factor;
|
||||
text_rect.xmin = x;
|
||||
text_rect.ymax = y;
|
||||
text_rect.ymin = y;
|
||||
|
||||
uiFontStyleDraw_Params params{};
|
||||
params.align = UI_STYLE_TEXT_RIGHT;
|
||||
UI_fontstyle_draw(&fstyle_small,
|
||||
&text_rect,
|
||||
text_overlay->text,
|
||||
sizeof(text_overlay->text),
|
||||
text_color,
|
||||
&(struct uiFontStyleDraw_Params){
|
||||
.align = UI_STYLE_TEXT_RIGHT,
|
||||
});
|
||||
¶ms);
|
||||
text_width = (float)UI_fontstyle_string_width(&fstyle_small, text_overlay->text) / UI_UNIT_X /
|
||||
zoom_factor;
|
||||
}
|
||||
@@ -1798,14 +1797,19 @@ static void icon_draw_texture(float x,
|
||||
const int rect_geom_loc = GPU_shader_get_uniform(shader, "rect_geom");
|
||||
|
||||
if (rgb) {
|
||||
GPU_shader_uniform_vector(shader, color_loc, 4, 1, (float[4]){UNPACK3(rgb), alpha});
|
||||
const float color[4] = {rgb[0], rgb[1], rgb[2], alpha};
|
||||
GPU_shader_uniform_vector(shader, color_loc, 4, 1, color);
|
||||
}
|
||||
else {
|
||||
GPU_shader_uniform_vector(shader, color_loc, 4, 1, (float[4]){alpha, alpha, alpha, alpha});
|
||||
const float color[4] = {alpha, alpha, alpha, alpha};
|
||||
GPU_shader_uniform_vector(shader, color_loc, 4, 1, color);
|
||||
}
|
||||
|
||||
GPU_shader_uniform_vector(shader, rect_tex_loc, 4, 1, (float[4]){x1, y1, x2, y2});
|
||||
GPU_shader_uniform_vector(shader, rect_geom_loc, 4, 1, (float[4]){x, y, x + w, y + h});
|
||||
const float tex_color[4] = {x1, y1, x2, y2};
|
||||
const float geom_color[4] = {x, y, x + w, y + h};
|
||||
|
||||
GPU_shader_uniform_vector(shader, rect_tex_loc, 4, 1, tex_color);
|
||||
GPU_shader_uniform_vector(shader, rect_geom_loc, 4, 1, geom_color);
|
||||
GPU_shader_uniform_1f(shader, "text_width", text_width);
|
||||
|
||||
GPU_texture_bind_ex(texture, GPU_SAMPLER_ICON, img_binding, false);
|
||||
@@ -1867,7 +1871,7 @@ static void icon_draw_size(float x,
|
||||
UI_widgetbase_draw_cache_flush();
|
||||
|
||||
if (di->type == ICON_TYPE_IMBUF) {
|
||||
ImBuf *ibuf = icon->obj;
|
||||
ImBuf *ibuf = static_cast<ImBuf *>(icon->obj);
|
||||
|
||||
GPU_blend(GPU_BLEND_ALPHA_PREMULT);
|
||||
icon_draw_rect(x, y, w, h, aspect, ibuf->x, ibuf->y, ibuf->rect, alpha, desaturate);
|
||||
@@ -1902,9 +1906,9 @@ static void icon_draw_size(float x,
|
||||
IMB_freeImBuf(ibuf);
|
||||
}
|
||||
if (invert != geom_inverted) {
|
||||
BKE_icon_geom_invert_lightness(icon->obj);
|
||||
BKE_icon_geom_invert_lightness(static_cast<Icon_Geom *>(icon->obj));
|
||||
}
|
||||
ibuf = BKE_icon_geom_rasterize(icon->obj, w, h);
|
||||
ibuf = BKE_icon_geom_rasterize(static_cast<Icon_Geom *>(icon->obj), w, h);
|
||||
di->data.geom.image_cache = ibuf;
|
||||
di->data.geom.inverted = invert;
|
||||
}
|
||||
@@ -1984,7 +1988,7 @@ static void icon_draw_size(float x,
|
||||
}
|
||||
else if (di->type == ICON_TYPE_PREVIEW) {
|
||||
PreviewImage *pi = (icon->id_type != 0) ? BKE_previewimg_id_ensure((ID *)icon->obj) :
|
||||
icon->obj;
|
||||
static_cast<PreviewImage *>(icon->obj);
|
||||
|
||||
if (pi) {
|
||||
/* no create icon on this level in code */
|
||||
@@ -2016,7 +2020,7 @@ static void ui_id_preview_image_render_size(
|
||||
/* changed only ever set by dynamic icons */
|
||||
if ((pi->flag[size] & PRV_CHANGED) || !pi->rect[size]) {
|
||||
/* create the rect if necessary */
|
||||
icon_set_image(C, scene, id, pi, size, use_job);
|
||||
icon_set_image(C, scene, id, pi, eIconSizes(size), use_job);
|
||||
|
||||
pi->flag[size] &= ~PRV_CHANGED;
|
||||
}
|
||||
@@ -2045,8 +2049,8 @@ void UI_icon_render_id(
|
||||
/* For objects, first try if a preview can created via the object data. */
|
||||
if (GS(id->name) == ID_OB) {
|
||||
Object *ob = (Object *)id;
|
||||
if (ED_preview_id_is_supported(ob->data)) {
|
||||
id_to_render = ob->data;
|
||||
if (ED_preview_id_is_supported(static_cast<const ID *>(ob->data))) {
|
||||
id_to_render = static_cast<ID *>(ob->data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2065,7 +2069,7 @@ static void ui_id_icon_render(const bContext *C, ID *id, bool use_jobs)
|
||||
return;
|
||||
}
|
||||
|
||||
for (enum eIconSizes i = 0; i < NUM_ICON_SIZES; i++) {
|
||||
for (int i = 0; i < NUM_ICON_SIZES; i++) {
|
||||
ui_id_preview_image_render_size(C, NULL, id, pi, i, use_jobs);
|
||||
}
|
||||
}
|
||||
@@ -2112,7 +2116,7 @@ static int ui_id_brush_get_icon(const bContext *C, ID *id)
|
||||
}
|
||||
else if (space_type == SPACE_IMAGE) {
|
||||
if (area->spacetype == space_type) {
|
||||
const SpaceImage *sima = area->spacedata.first;
|
||||
const SpaceImage *sima = static_cast<const SpaceImage *>(area->spacedata.first);
|
||||
if (sima->mode == SI_MODE_PAINT) {
|
||||
paint_mode = PAINT_MODE_TEXTURE_2D;
|
||||
}
|
||||
@@ -2310,16 +2314,16 @@ int UI_icon_from_rnaptr(const bContext *C, PointerRNA *ptr, int rnaicon, const b
|
||||
id = ptr->owner_id;
|
||||
}
|
||||
else if (RNA_struct_is_a(ptr->type, &RNA_MaterialSlot)) {
|
||||
id = RNA_pointer_get(ptr, "material").data;
|
||||
id = static_cast<ID *>(RNA_pointer_get(ptr, "material").data);
|
||||
}
|
||||
else if (RNA_struct_is_a(ptr->type, &RNA_TextureSlot)) {
|
||||
id = RNA_pointer_get(ptr, "texture").data;
|
||||
id = static_cast<ID *>(RNA_pointer_get(ptr, "texture").data);
|
||||
}
|
||||
else if (RNA_struct_is_a(ptr->type, &RNA_FileBrowserFSMenuEntry)) {
|
||||
return RNA_int_get(ptr, "icon");
|
||||
}
|
||||
else if (RNA_struct_is_a(ptr->type, &RNA_DynamicPaintSurface)) {
|
||||
DynamicPaintSurface *surface = ptr->data;
|
||||
DynamicPaintSurface *surface = static_cast<DynamicPaintSurface *>(ptr->data);
|
||||
|
||||
if (surface->format == MOD_DPAINT_SURFACE_F_PTEX) {
|
||||
return ICON_SHADING_TEXTURE;
|
||||
@@ -2332,7 +2336,7 @@ int UI_icon_from_rnaptr(const bContext *C, PointerRNA *ptr, int rnaicon, const b
|
||||
}
|
||||
}
|
||||
else if (RNA_struct_is_a(ptr->type, &RNA_StudioLight)) {
|
||||
StudioLight *sl = ptr->data;
|
||||
StudioLight *sl = static_cast<StudioLight *>(ptr->data);
|
||||
switch (sl->flag & STUDIOLIGHT_FLAG_ORIENTATIONS) {
|
||||
case STUDIOLIGHT_TYPE_STUDIO:
|
||||
return sl->icon_id_irradiance;
|
||||
@@ -2550,7 +2554,7 @@ ImBuf *UI_icon_alert_imbuf_get(eAlertIcon icon)
|
||||
return NULL;
|
||||
#else
|
||||
const int ALERT_IMG_SIZE = 256;
|
||||
icon = MIN2(icon, ALERT_ICON_MAX - 1);
|
||||
icon = eAlertIcon(MIN2(icon, ALERT_ICON_MAX - 1));
|
||||
const int left = icon * ALERT_IMG_SIZE;
|
||||
const rcti crop = {left, left + ALERT_IMG_SIZE - 1, 0, ALERT_IMG_SIZE - 1};
|
||||
ImBuf *ibuf = IMB_ibImageFromMemory((const uchar *)datatoc_alert_icons_png,
|
@@ -18,7 +18,7 @@
|
||||
|
||||
#include "UI_interface.h"
|
||||
|
||||
#include "interface_intern.h"
|
||||
#include "interface_intern.hh"
|
||||
|
||||
static void icon_draw_rect_input_text(
|
||||
const rctf *rect, const float color[4], const char *str, float font_size, float v_offset)
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -48,7 +48,7 @@
|
||||
|
||||
#include "UI_interface.h"
|
||||
|
||||
#include "interface_intern.h"
|
||||
#include "interface_intern.hh"
|
||||
|
||||
#include "WM_api.h"
|
||||
#include "WM_types.h"
|
||||
|
@@ -48,7 +48,7 @@
|
||||
#include "GPU_matrix.h"
|
||||
#include "GPU_state.h"
|
||||
|
||||
#include "interface_intern.h"
|
||||
#include "interface_intern.hh"
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Defines & Structs
|
||||
|
@@ -19,7 +19,7 @@
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "interface_intern.h"
|
||||
#include "interface_intern.hh"
|
||||
|
||||
#include "WM_api.h"
|
||||
#include "WM_types.h"
|
||||
|
@@ -34,7 +34,7 @@
|
||||
|
||||
#include "IMB_colormanagement.h"
|
||||
|
||||
#include "interface_intern.h"
|
||||
#include "interface_intern.hh"
|
||||
|
||||
enum ePickerType {
|
||||
PICKER_TYPE_RGB = 0,
|
||||
|
@@ -36,7 +36,7 @@
|
||||
#include "ED_undo.h"
|
||||
|
||||
#include "GPU_framebuffer.h"
|
||||
#include "interface_intern.h"
|
||||
#include "interface_intern.hh"
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Utilities
|
||||
|
@@ -36,7 +36,7 @@
|
||||
|
||||
#include "ED_screen.h"
|
||||
|
||||
#include "interface_intern.h"
|
||||
#include "interface_intern.hh"
|
||||
#include "interface_regions_intern.hh"
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
@@ -39,7 +39,7 @@
|
||||
|
||||
#include "ED_screen.h"
|
||||
|
||||
#include "interface_intern.h"
|
||||
#include "interface_intern.hh"
|
||||
#include "interface_regions_intern.hh"
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
@@ -45,7 +45,7 @@
|
||||
|
||||
#include "UI_interface.h"
|
||||
|
||||
#include "interface_intern.h"
|
||||
#include "interface_intern.hh"
|
||||
#include "interface_regions_intern.hh"
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
@@ -30,7 +30,7 @@
|
||||
|
||||
#include "ED_screen.h"
|
||||
|
||||
#include "interface_intern.h"
|
||||
#include "interface_intern.hh"
|
||||
#include "interface_regions_intern.hh"
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
@@ -41,7 +41,7 @@
|
||||
#include "ED_screen.h"
|
||||
|
||||
#include "GPU_state.h"
|
||||
#include "interface_intern.h"
|
||||
#include "interface_intern.hh"
|
||||
#include "interface_regions_intern.hh"
|
||||
|
||||
#define MENU_BORDER int(0.3f * U.widget_unit)
|
||||
|
@@ -52,7 +52,7 @@
|
||||
|
||||
#include "ED_screen.h"
|
||||
|
||||
#include "interface_intern.h"
|
||||
#include "interface_intern.hh"
|
||||
#include "interface_regions_intern.hh"
|
||||
|
||||
#define UI_TIP_PAD_FAC 1.3f
|
||||
|
@@ -30,7 +30,7 @@
|
||||
|
||||
#include "ED_datafiles.h"
|
||||
|
||||
#include "interface_intern.h"
|
||||
#include "interface_intern.hh"
|
||||
|
||||
#ifdef WIN32
|
||||
# include "BLI_math_base.h" /* M_PI */
|
||||
|
@@ -28,7 +28,7 @@
|
||||
#include "WM_api.h"
|
||||
#include "WM_types.h"
|
||||
|
||||
#include "interface_intern.h"
|
||||
#include "interface_intern.hh"
|
||||
|
||||
struct AssetViewListData {
|
||||
AssetLibraryReference asset_library_ref;
|
||||
|
@@ -30,7 +30,7 @@
|
||||
|
||||
#include "WM_api.h"
|
||||
|
||||
#include "interface_intern.h"
|
||||
#include "interface_intern.hh"
|
||||
|
||||
/**
|
||||
* The validated data that was passed to #uiTemplateList (typically through Python).
|
||||
|
@@ -47,7 +47,7 @@
|
||||
#include "WM_types.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "interface_intern.h"
|
||||
#include "interface_intern.hh"
|
||||
|
||||
/* For key-map item access. */
|
||||
#include "wm_event_system.h"
|
||||
|
@@ -28,7 +28,7 @@
|
||||
#include "WM_types.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "interface_intern.h"
|
||||
#include "interface_intern.hh"
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Operator Search Template Implementation
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -15,7 +15,7 @@
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "interface_intern.h"
|
||||
#include "interface_intern.hh"
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Text Field Undo Stack
|
||||
|
@@ -40,7 +40,7 @@
|
||||
#include "WM_api.h"
|
||||
#include "WM_types.h"
|
||||
|
||||
#include "interface_intern.h"
|
||||
#include "interface_intern.hh"
|
||||
|
||||
/*************************** RNA Utilities ******************************/
|
||||
|
||||
|
@@ -5,9 +5,9 @@
|
||||
* \ingroup edinterface
|
||||
*/
|
||||
|
||||
#include <limits.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <climits>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
#include "DNA_brush_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
@@ -32,7 +32,7 @@
|
||||
#include "UI_interface_icons.h"
|
||||
#include "UI_view2d.h"
|
||||
|
||||
#include "interface_intern.h"
|
||||
#include "interface_intern.hh"
|
||||
|
||||
#include "GPU_batch.h"
|
||||
#include "GPU_batch_presets.h"
|
||||
@@ -55,7 +55,7 @@
|
||||
|
||||
/* visual types for drawing */
|
||||
/* for time being separated from functional types */
|
||||
typedef enum {
|
||||
enum uiWidgetTypeEnum {
|
||||
/* default */
|
||||
UI_WTYPE_REGULAR,
|
||||
|
||||
@@ -105,12 +105,12 @@ typedef enum {
|
||||
UI_WTYPE_PROGRESSBAR,
|
||||
UI_WTYPE_NODESOCKET,
|
||||
UI_WTYPE_VIEW_ITEM,
|
||||
} uiWidgetTypeEnum;
|
||||
};
|
||||
|
||||
/**
|
||||
* The button's state information adapted for drawing. Use #STATE_INFO_NULL for empty state.
|
||||
*/
|
||||
typedef struct {
|
||||
struct uiWidgetStateInfo {
|
||||
/** Copy of #uiBut.flag (possibly with overrides for drawing). */
|
||||
int but_flag;
|
||||
/** Copy of #uiBut.drawflag (possibly with overrides for drawing). */
|
||||
@@ -120,7 +120,7 @@ typedef struct {
|
||||
bool has_hold_action : 1;
|
||||
/** The button is in text input mode. */
|
||||
bool is_text_input : 1;
|
||||
} uiWidgetStateInfo;
|
||||
};
|
||||
|
||||
static const uiWidgetStateInfo STATE_INFO_NULL = {0};
|
||||
|
||||
@@ -212,22 +212,21 @@ static void color_mul_hsl_v3(uchar ch[3], float h_factor, float s_factor, float
|
||||
/* fill this struct with polygon info to draw AA'ed */
|
||||
/* it has outline, back, and two optional tria meshes */
|
||||
|
||||
typedef struct uiWidgetTrias {
|
||||
struct uiWidgetTrias {
|
||||
uint tot;
|
||||
int type;
|
||||
float size, center[2];
|
||||
|
||||
float vec[16][2];
|
||||
const uint (*index)[3];
|
||||
|
||||
} uiWidgetTrias;
|
||||
};
|
||||
|
||||
/* max as used by round_box__edges */
|
||||
/* Make sure to change widget_base_vert.glsl accordingly. */
|
||||
#define WIDGET_CURVE_RESOLU 9
|
||||
#define WIDGET_SIZE_MAX (WIDGET_CURVE_RESOLU * 4)
|
||||
|
||||
typedef struct uiWidgetBase {
|
||||
struct uiWidgetBase {
|
||||
/* TODO: remove these completely. */
|
||||
int totvert, halfwayvert;
|
||||
float outer_v[WIDGET_SIZE_MAX][2];
|
||||
@@ -241,13 +240,13 @@ typedef struct uiWidgetBase {
|
||||
|
||||
/* Widget shader parameters, must match the shader layout. */
|
||||
uiWidgetBaseParameters uniform_params;
|
||||
} uiWidgetBase;
|
||||
};
|
||||
|
||||
/**
|
||||
* For time being only for visual appearance,
|
||||
* later, a handling callback can be added too.
|
||||
*/
|
||||
typedef struct uiWidgetType {
|
||||
struct uiWidgetType {
|
||||
|
||||
/* pointer to theme color definition */
|
||||
const uiWidgetColors *wcol_theme;
|
||||
@@ -272,8 +271,7 @@ typedef struct uiWidgetType {
|
||||
void (*draw_block)(
|
||||
uiWidgetColors *, rcti *, int block_flag, int roundboxalign, const float zoom);
|
||||
void (*text)(const uiFontStyle *, const uiWidgetColors *, uiBut *, rcti *);
|
||||
|
||||
} uiWidgetType;
|
||||
};
|
||||
|
||||
/** \} */
|
||||
|
||||
@@ -424,7 +422,7 @@ static GPUVertFormat *vflag_format(void)
|
||||
|
||||
static void set_roundbox_vertex_data(GPUVertBufRaw *vflag_step, uint32_t d)
|
||||
{
|
||||
uint32_t *data = GPU_vertbuf_raw_step(vflag_step);
|
||||
uint32_t *data = static_cast<uint32_t *>(GPU_vertbuf_raw_step(vflag_step));
|
||||
*data = d;
|
||||
}
|
||||
|
||||
@@ -436,7 +434,7 @@ static uint32_t set_roundbox_vertex(GPUVertBufRaw *vflag_step,
|
||||
bool emboss,
|
||||
int color)
|
||||
{
|
||||
uint32_t *data = GPU_vertbuf_raw_step(vflag_step);
|
||||
uint32_t *data = static_cast<uint32_t *>(GPU_vertbuf_raw_step(vflag_step));
|
||||
*data = corner_id;
|
||||
*data |= corner_v << 2;
|
||||
*data |= jit_v << 6;
|
||||
@@ -448,7 +446,7 @@ static uint32_t set_roundbox_vertex(GPUVertBufRaw *vflag_step,
|
||||
|
||||
GPUBatch *ui_batch_roundbox_widget_get(void)
|
||||
{
|
||||
if (g_ui_batch_cache.roundbox_widget == NULL) {
|
||||
if (g_ui_batch_cache.roundbox_widget == nullptr) {
|
||||
GPUVertBuf *vbo = GPU_vertbuf_create_with_format(vflag_format());
|
||||
|
||||
GPU_vertbuf_data_alloc(vbo, 12);
|
||||
@@ -474,7 +472,7 @@ GPUBatch *ui_batch_roundbox_widget_get(void)
|
||||
|
||||
GPUBatch *ui_batch_roundbox_shadow_get(void)
|
||||
{
|
||||
if (g_ui_batch_cache.roundbox_shadow == NULL) {
|
||||
if (g_ui_batch_cache.roundbox_shadow == nullptr) {
|
||||
uint32_t last_data;
|
||||
GPUVertBufRaw vflag_step;
|
||||
GPUVertBuf *vbo = GPU_vertbuf_create_with_format(vflag_format());
|
||||
@@ -502,7 +500,7 @@ GPUBatch *ui_batch_roundbox_shadow_get(void)
|
||||
}
|
||||
}
|
||||
g_ui_batch_cache.roundbox_shadow = GPU_batch_create_ex(
|
||||
GPU_PRIM_TRI_STRIP, vbo, NULL, GPU_BATCH_OWNS_VBO);
|
||||
GPU_PRIM_TRI_STRIP, vbo, nullptr, GPU_BATCH_OWNS_VBO);
|
||||
gpu_batch_presets_register(g_ui_batch_cache.roundbox_shadow);
|
||||
}
|
||||
return g_ui_batch_cache.roundbox_shadow;
|
||||
@@ -971,7 +969,7 @@ static void shape_preset_init_scroll_circle(uiWidgetTrias *tria,
|
||||
|
||||
static void widget_draw_vertex_buffer(uint pos,
|
||||
uint col,
|
||||
int mode,
|
||||
GPUPrimType mode,
|
||||
const float quads_pos[WIDGET_SIZE_MAX][2],
|
||||
const uchar quads_col[WIDGET_SIZE_MAX][4],
|
||||
uint totvert)
|
||||
@@ -1073,7 +1071,7 @@ static void widgetbase_outline(uiWidgetBase *wtb, uint pos)
|
||||
widget_verts_to_triangle_strip(wtb, wtb->totvert, triangle_strip);
|
||||
|
||||
widget_draw_vertex_buffer(
|
||||
pos, 0, GPU_PRIM_TRI_STRIP, triangle_strip, NULL, wtb->totvert * 2 + 2);
|
||||
pos, 0, GPU_PRIM_TRI_STRIP, triangle_strip, nullptr, wtb->totvert * 2 + 2);
|
||||
}
|
||||
|
||||
static void widgetbase_set_uniform_alpha_discard(uiWidgetBase *wtb,
|
||||
@@ -1502,7 +1500,8 @@ static void ui_text_clip_right_ex(const uiFontStyle *fstyle,
|
||||
BLI_assert(str[0]);
|
||||
|
||||
/* How many BYTES (not characters) of this utf-8 string can fit, along with appended ellipsis. */
|
||||
int l_end = BLF_width_to_strlen(fstyle->uifont_id, str, max_len, okwidth - sep_strwidth, NULL);
|
||||
int l_end = BLF_width_to_strlen(
|
||||
fstyle->uifont_id, str, max_len, okwidth - sep_strwidth, nullptr);
|
||||
|
||||
if (l_end > 0) {
|
||||
/* At least one character, so clip and add the ellipsis. */
|
||||
@@ -1513,7 +1512,7 @@ static void ui_text_clip_right_ex(const uiFontStyle *fstyle,
|
||||
}
|
||||
else {
|
||||
/* Otherwise fit as much as we can without adding an ellipsis. */
|
||||
l_end = BLF_width_to_strlen(fstyle->uifont_id, str, max_len, okwidth, NULL);
|
||||
l_end = BLF_width_to_strlen(fstyle->uifont_id, str, max_len, okwidth, nullptr);
|
||||
str[l_end] = '\0';
|
||||
if (r_final_len) {
|
||||
*r_final_len = (size_t)l_end;
|
||||
@@ -1541,7 +1540,7 @@ float UI_text_clip_middle_ex(const uiFontStyle *fstyle,
|
||||
const int sep_len = sizeof(sep) - 1;
|
||||
const float sep_strwidth = BLF_width(fstyle->uifont_id, sep, sep_len + 1);
|
||||
|
||||
char *rpart = NULL, rpart_buf[UI_MAX_DRAW_STR];
|
||||
char *rpart = nullptr, rpart_buf[UI_MAX_DRAW_STR];
|
||||
float rpart_width = 0.0f;
|
||||
size_t rpart_len = 0;
|
||||
size_t final_lpart_len;
|
||||
@@ -1559,7 +1558,7 @@ float UI_text_clip_middle_ex(const uiFontStyle *fstyle,
|
||||
/* Not enough place for actual label, just display protected right part.
|
||||
* Here just for safety, should never happen in real life! */
|
||||
memmove(str, rpart, rpart_len + 1);
|
||||
rpart = NULL;
|
||||
rpart = nullptr;
|
||||
okwidth += rpart_width;
|
||||
strwidth = rpart_width;
|
||||
}
|
||||
@@ -1575,7 +1574,7 @@ float UI_text_clip_middle_ex(const uiFontStyle *fstyle,
|
||||
}
|
||||
|
||||
const size_t l_end = BLF_width_to_strlen(
|
||||
fstyle->uifont_id, str, max_len, parts_strwidth, NULL);
|
||||
fstyle->uifont_id, str, max_len, parts_strwidth, nullptr);
|
||||
if (l_end < 10 || min_ff(parts_strwidth, strwidth - okwidth) < minwidth) {
|
||||
/* If we really have no place, or we would clip a very small piece of string in the middle,
|
||||
* only show start of string.
|
||||
@@ -1586,7 +1585,7 @@ float UI_text_clip_middle_ex(const uiFontStyle *fstyle,
|
||||
else {
|
||||
size_t r_offset, r_len;
|
||||
|
||||
r_offset = BLF_width_to_rstrlen(fstyle->uifont_id, str, max_len, parts_strwidth, NULL);
|
||||
r_offset = BLF_width_to_rstrlen(fstyle->uifont_id, str, max_len, parts_strwidth, nullptr);
|
||||
r_len = strlen(str + r_offset) + 1; /* +1 for the trailing '\0'. */
|
||||
|
||||
if (l_end + sep_len + r_len + rpart_len > max_len) {
|
||||
@@ -1869,7 +1868,7 @@ static void widget_draw_text(const uiFontStyle *fstyle,
|
||||
{
|
||||
int drawstr_left_len = UI_MAX_DRAW_STR;
|
||||
const char *drawstr = but->drawstr;
|
||||
const char *drawstr_right = NULL;
|
||||
const char *drawstr_right = nullptr;
|
||||
bool use_right_only = false;
|
||||
|
||||
#ifdef WITH_INPUT_IME
|
||||
@@ -1901,7 +1900,7 @@ static void widget_draw_text(const uiFontStyle *fstyle,
|
||||
else {
|
||||
if (but->editstr) {
|
||||
/* max length isn't used in this case,
|
||||
* we rely on string being NULL terminated. */
|
||||
* we rely on string being nullptr terminated. */
|
||||
drawstr_left_len = INT_MAX;
|
||||
|
||||
#ifdef WITH_INPUT_IME
|
||||
@@ -2058,7 +2057,7 @@ static void widget_draw_text(const uiFontStyle *fstyle,
|
||||
bool use_drawstr_right_as_hint = false;
|
||||
|
||||
/* cut string in 2 parts - only for menu entries */
|
||||
if (but->flag & UI_BUT_HAS_SEP_CHAR && (but->editstr == NULL)) {
|
||||
if (but->flag & UI_BUT_HAS_SEP_CHAR && (but->editstr == nullptr)) {
|
||||
drawstr_right = strrchr(drawstr, UI_SEP_CHAR);
|
||||
if (drawstr_right) {
|
||||
use_drawstr_right_as_hint = true;
|
||||
@@ -2071,7 +2070,7 @@ static void widget_draw_text(const uiFontStyle *fstyle,
|
||||
if (!drawstr_right && (but->drawflag & UI_BUT_TEXT_LEFT) &&
|
||||
ELEM(but->type, UI_BTYPE_NUM, UI_BTYPE_NUM_SLIDER) &&
|
||||
/* if we're editing or multi-drag (fake editing), then use left alignment */
|
||||
(but->editstr == NULL) && (drawstr == but->drawstr)) {
|
||||
(but->editstr == nullptr) && (drawstr == but->drawstr)) {
|
||||
drawstr_right = strrchr(drawstr + but->ofs, ':');
|
||||
if (drawstr_right) {
|
||||
drawstr_right++;
|
||||
@@ -2097,17 +2096,17 @@ static void widget_draw_text(const uiFontStyle *fstyle,
|
||||
(drawstr_left_len - but->ofs);
|
||||
|
||||
if (drawlen > 0) {
|
||||
uiFontStyleDraw_Params params{};
|
||||
params.align = align;
|
||||
UI_fontstyle_draw_ex(fstyle,
|
||||
rect,
|
||||
drawstr + but->ofs,
|
||||
drawlen,
|
||||
wcol->text,
|
||||
&(struct uiFontStyleDraw_Params){
|
||||
.align = align,
|
||||
},
|
||||
¶ms,
|
||||
&font_xofs,
|
||||
&font_yofs,
|
||||
NULL);
|
||||
nullptr);
|
||||
|
||||
if (but->menu_key != '\0') {
|
||||
const char *drawstr_ofs = drawstr + but->ofs;
|
||||
@@ -2116,10 +2115,10 @@ static void widget_draw_text(const uiFontStyle *fstyle,
|
||||
{
|
||||
/* Find upper case, fallback to lower case. */
|
||||
const char *drawstr_end = drawstr_ofs + drawlen;
|
||||
const char keys[] = {but->menu_key - 32, but->menu_key};
|
||||
const char keys[] = {char(but->menu_key - 32), but->menu_key};
|
||||
for (int i = 0; i < ARRAY_SIZE(keys); i++) {
|
||||
const char *drawstr_menu = strchr(drawstr_ofs, keys[i]);
|
||||
if (drawstr_menu != NULL && drawstr_menu < drawstr_end) {
|
||||
if (drawstr_menu != nullptr && drawstr_menu < drawstr_end) {
|
||||
ul_index = (int)(drawstr_menu - drawstr_ofs);
|
||||
break;
|
||||
}
|
||||
@@ -2153,14 +2152,9 @@ static void widget_draw_text(const uiFontStyle *fstyle,
|
||||
}
|
||||
|
||||
rect->xmax -= UI_TEXT_CLIP_MARGIN;
|
||||
UI_fontstyle_draw(fstyle,
|
||||
rect,
|
||||
drawstr_right,
|
||||
UI_MAX_DRAW_STR,
|
||||
col,
|
||||
&(struct uiFontStyleDraw_Params){
|
||||
.align = UI_STYLE_TEXT_RIGHT,
|
||||
});
|
||||
uiFontStyleDraw_Params params{};
|
||||
params.align = UI_STYLE_TEXT_RIGHT;
|
||||
UI_fontstyle_draw(fstyle, rect, drawstr_right, UI_MAX_DRAW_STR, col, ¶ms);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2219,7 +2213,7 @@ static void widget_draw_node_link_socket(const uiWidgetColors *wcol,
|
||||
UI_widgetbase_draw_cache_flush();
|
||||
GPU_blend(GPU_BLEND_NONE);
|
||||
|
||||
ED_node_socket_draw(but->custom_data, rect, col, scale);
|
||||
ED_node_socket_draw(static_cast<bNodeSocket *>(but->custom_data), rect, col, scale);
|
||||
}
|
||||
else {
|
||||
widget_draw_icon(but, ICON_LAYER_USED, alpha, rect, wcol->text);
|
||||
@@ -2263,7 +2257,7 @@ static void widget_draw_text_icon(const uiFontStyle *fstyle,
|
||||
|
||||
/* Big previews with optional text label below */
|
||||
if (but->flag & UI_BUT_ICON_PREVIEW && ui_block_is_menu(but->block)) {
|
||||
const BIFIconID icon = ui_but_icon(but);
|
||||
const BIFIconID icon = BIFIconID(ui_but_icon(but));
|
||||
int icon_size = BLI_rcti_size_y(rect);
|
||||
int text_size = 0;
|
||||
|
||||
@@ -2300,7 +2294,7 @@ static void widget_draw_text_icon(const uiFontStyle *fstyle,
|
||||
}
|
||||
#endif
|
||||
|
||||
const BIFIconID icon = ui_but_icon(but);
|
||||
const BIFIconID icon = BIFIconID(ui_but_icon(but));
|
||||
const int icon_size_init = is_tool ? ICON_DEFAULT_HEIGHT_TOOLBAR : ICON_DEFAULT_HEIGHT;
|
||||
const float icon_size = icon_size_init / (but->block->aspect * U.inv_dpi_fac);
|
||||
const float icon_padding = 2 * UI_DPI_FAC;
|
||||
@@ -2350,7 +2344,7 @@ static void widget_draw_text_icon(const uiFontStyle *fstyle,
|
||||
rect->xmin += text_padding;
|
||||
}
|
||||
else if (but->flag & UI_BUT_DRAG_MULTI) {
|
||||
const bool text_is_edited = ui_but_drag_multi_edit_get(but) != NULL;
|
||||
const bool text_is_edited = ui_but_drag_multi_edit_get(but) != nullptr;
|
||||
if (text_is_edited || (but->drawflag & UI_BUT_TEXT_LEFT)) {
|
||||
rect->xmin += text_padding;
|
||||
}
|
||||
@@ -2456,7 +2450,7 @@ static const uchar *widget_color_blend_from_flags(const uiWidgetStateColors *wco
|
||||
{
|
||||
/* Explicitly require #UI_EMBOSS_NONE_OR_STATUS for color blending with no emboss. */
|
||||
if (emboss == UI_EMBOSS_NONE) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (state->but_drawflag & UI_BUT_ANIMATED_CHANGED) {
|
||||
@@ -2474,7 +2468,7 @@ static const uchar *widget_color_blend_from_flags(const uiWidgetStateColors *wco
|
||||
if (state->but_flag & UI_BUT_OVERRIDDEN) {
|
||||
return wcol_state->inner_overridden_sel;
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/* copy colors from theme, and set changes in it based on state */
|
||||
@@ -2498,7 +2492,7 @@ static void widget_state(uiWidgetType *wt, const uiWidgetStateInfo *state, eUIEm
|
||||
|
||||
if (state->but_flag & UI_SELECT) {
|
||||
copy_v4_v4_uchar(wt->wcol.inner, wt->wcol.inner_sel);
|
||||
if (color_blend != NULL) {
|
||||
if (color_blend != nullptr) {
|
||||
color_blend_v3_v3(wt->wcol.inner, color_blend, wcol_state->blend);
|
||||
}
|
||||
|
||||
@@ -2513,7 +2507,7 @@ static void widget_state(uiWidgetType *wt, const uiWidgetStateInfo *state, eUIEm
|
||||
copy_v4_v4_uchar(wt->wcol.inner, wt->wcol.inner_sel);
|
||||
copy_v4_v4_uchar(wt->wcol.text, wt->wcol.text_sel);
|
||||
}
|
||||
if (color_blend != NULL) {
|
||||
if (color_blend != nullptr) {
|
||||
color_blend_v3_v3(wt->wcol.inner, color_blend, wcol_state->blend);
|
||||
}
|
||||
|
||||
@@ -2587,7 +2581,7 @@ static void widget_state_numslider(uiWidgetType *wt,
|
||||
widget_state(wt, state, emboss);
|
||||
|
||||
const uchar *color_blend = widget_color_blend_from_flags(wcol_state, state, emboss);
|
||||
if (color_blend != NULL) {
|
||||
if (color_blend != nullptr) {
|
||||
/* Set the slider 'item' so that it reflects state settings too.
|
||||
* De-saturate so the color of the slider doesn't conflict with the blend color,
|
||||
* which can make the color hard to see when the slider is set to full (see T66102). */
|
||||
@@ -2622,16 +2616,16 @@ static void widget_state_option_menu(uiWidgetType *wt,
|
||||
}
|
||||
|
||||
static void widget_state_nothing(uiWidgetType *wt,
|
||||
const uiWidgetStateInfo *UNUSED(state),
|
||||
eUIEmbossType UNUSED(emboss))
|
||||
const uiWidgetStateInfo * /*state*/,
|
||||
eUIEmbossType /*emboss*/)
|
||||
{
|
||||
wt->wcol = *(wt->wcol_theme);
|
||||
}
|
||||
|
||||
/* special case, button that calls pulldown */
|
||||
static void widget_state_pulldown(uiWidgetType *wt,
|
||||
const uiWidgetStateInfo *UNUSED(state),
|
||||
eUIEmbossType UNUSED(emboss))
|
||||
const uiWidgetStateInfo * /*state*/,
|
||||
eUIEmbossType /*emboss*/)
|
||||
{
|
||||
wt->wcol = *(wt->wcol_theme);
|
||||
}
|
||||
@@ -2639,7 +2633,7 @@ static void widget_state_pulldown(uiWidgetType *wt,
|
||||
/* special case, pie menu items */
|
||||
static void widget_state_pie_menu_item(uiWidgetType *wt,
|
||||
const uiWidgetStateInfo *state,
|
||||
eUIEmbossType UNUSED(emboss))
|
||||
eUIEmbossType /*emboss*/)
|
||||
{
|
||||
wt->wcol = *(wt->wcol_theme);
|
||||
|
||||
@@ -2673,7 +2667,7 @@ static void widget_state_pie_menu_item(uiWidgetType *wt,
|
||||
/* special case, menu items */
|
||||
static void widget_state_menu_item(uiWidgetType *wt,
|
||||
const uiWidgetStateInfo *state,
|
||||
eUIEmbossType UNUSED(emboss))
|
||||
eUIEmbossType /*emboss*/)
|
||||
{
|
||||
wt->wcol = *(wt->wcol_theme);
|
||||
|
||||
@@ -2754,7 +2748,7 @@ static void widget_softshadow(const rcti *rect, int roundboxalign, const float r
|
||||
|
||||
widget_verts_to_triangle_strip(&wtb, totvert, triangle_strip);
|
||||
|
||||
widget_draw_vertex_buffer(pos, 0, GPU_PRIM_TRI_STRIP, triangle_strip, NULL, totvert * 2);
|
||||
widget_draw_vertex_buffer(pos, 0, GPU_PRIM_TRI_STRIP, triangle_strip, nullptr, totvert * 2);
|
||||
}
|
||||
|
||||
immUnbindProgram();
|
||||
@@ -2861,7 +2855,7 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, const uiWidgetColors *wcol, const
|
||||
const float centy = BLI_rcti_cent_y_fl(rect);
|
||||
const float radius = (float)min_ii(BLI_rcti_size_x(rect), BLI_rcti_size_y(rect)) / 2.0f;
|
||||
|
||||
ColorPicker *cpicker = but->custom_data;
|
||||
ColorPicker *cpicker = static_cast<ColorPicker *>(but->custom_data);
|
||||
float rgb[3], hsv[3], rgb_center[3];
|
||||
const bool is_color_gamma = ui_but_is_color_gamma(but);
|
||||
|
||||
@@ -3171,7 +3165,7 @@ static void ui_draw_but_HSVCUBE(uiBut *but, const rcti *rect)
|
||||
const uiButHSVCube *hsv_but = (uiButHSVCube *)but;
|
||||
float rgb[3];
|
||||
float x = 0.0f, y = 0.0f;
|
||||
ColorPicker *cpicker = but->custom_data;
|
||||
ColorPicker *cpicker = static_cast<ColorPicker *>(but->custom_data);
|
||||
float *hsv = cpicker->hsv_perceptual;
|
||||
float hsv_n[3];
|
||||
|
||||
@@ -3235,14 +3229,19 @@ static void ui_draw_but_HSV_v(uiBut *but, const rcti *rect)
|
||||
round_box_edges(&wtb, UI_CNR_ALL, rect, rad);
|
||||
|
||||
/* setup temp colors */
|
||||
widgetbase_draw(&wtb,
|
||||
&((uiWidgetColors){
|
||||
.outline = {0, 0, 0, 255},
|
||||
.inner = {128, 128, 128, 255},
|
||||
.shadetop = 127,
|
||||
.shadedown = -128,
|
||||
.shaded = 1,
|
||||
}));
|
||||
uiWidgetColors colors{};
|
||||
colors.outline[0] = 0;
|
||||
colors.outline[1] = 0;
|
||||
colors.outline[2] = 0;
|
||||
colors.outline[3] = 255;
|
||||
colors.inner[0] = 128;
|
||||
colors.inner[1] = 128;
|
||||
colors.inner[2] = 128;
|
||||
colors.inner[3] = 255;
|
||||
colors.shadetop = 127;
|
||||
colors.shadedown = -128;
|
||||
colors.shaded = 1;
|
||||
widgetbase_draw(&wtb, &colors);
|
||||
|
||||
/* We are drawing on top of widget bases. Flush cache. */
|
||||
GPU_blend(GPU_BLEND_ALPHA);
|
||||
@@ -3411,7 +3410,7 @@ static void widget_numbut(uiWidgetColors *wcol,
|
||||
|
||||
static void widget_menubut(uiWidgetColors *wcol,
|
||||
rcti *rect,
|
||||
const uiWidgetStateInfo *UNUSED(state),
|
||||
const uiWidgetStateInfo * /*state*/,
|
||||
int roundboxalign,
|
||||
const float zoom)
|
||||
{
|
||||
@@ -3435,11 +3434,11 @@ static void widget_menubut(uiWidgetColors *wcol,
|
||||
/**
|
||||
* Draw menu buttons still with triangles when field is not embossed
|
||||
*/
|
||||
static void widget_menubut_embossn(const uiBut *UNUSED(but),
|
||||
static void widget_menubut_embossn(const uiBut * /*but*/,
|
||||
uiWidgetColors *wcol,
|
||||
rcti *rect,
|
||||
const uiWidgetStateInfo *UNUSED(state),
|
||||
int UNUSED(roundboxalign))
|
||||
const uiWidgetStateInfo * /*state*/,
|
||||
int /*roundboxalign*/)
|
||||
{
|
||||
uiWidgetBase wtb;
|
||||
widget_init(&wtb);
|
||||
@@ -3457,7 +3456,7 @@ static void widget_menubut_embossn(const uiBut *UNUSED(but),
|
||||
/**
|
||||
* Draw number buttons still with triangles when field is not embossed
|
||||
*/
|
||||
static void widget_numbut_embossn(const uiBut *UNUSED(but),
|
||||
static void widget_numbut_embossn(const uiBut * /*but*/,
|
||||
uiWidgetColors *wcol,
|
||||
rcti *rect,
|
||||
const uiWidgetStateInfo *state,
|
||||
@@ -3548,8 +3547,8 @@ static void widget_scroll(uiBut *but,
|
||||
uiWidgetColors *wcol,
|
||||
rcti *rect,
|
||||
const uiWidgetStateInfo *state,
|
||||
int UNUSED(roundboxalign),
|
||||
const float UNUSED(zoom))
|
||||
int /*roundboxalign*/,
|
||||
const float /*zoom*/)
|
||||
{
|
||||
/* calculate slider part */
|
||||
const float value = (float)ui_but_value_get(but);
|
||||
@@ -3603,7 +3602,7 @@ static void widget_scroll(uiBut *but,
|
||||
static void widget_progressbar(uiBut *but,
|
||||
uiWidgetColors *wcol,
|
||||
rcti *rect,
|
||||
const uiWidgetStateInfo *UNUSED(state),
|
||||
const uiWidgetStateInfo * /*state*/,
|
||||
int roundboxalign,
|
||||
const float zoom)
|
||||
{
|
||||
@@ -3638,7 +3637,7 @@ static void widget_progressbar(uiBut *but,
|
||||
static void widget_view_item(uiWidgetColors *wcol,
|
||||
rcti *rect,
|
||||
const uiWidgetStateInfo *state,
|
||||
int UNUSED(roundboxalign),
|
||||
int /*roundboxalign*/,
|
||||
const float zoom)
|
||||
{
|
||||
uiWidgetBase wtb;
|
||||
@@ -3657,9 +3656,9 @@ static void widget_view_item(uiWidgetColors *wcol,
|
||||
static void widget_nodesocket(uiBut *but,
|
||||
uiWidgetColors *wcol,
|
||||
rcti *rect,
|
||||
const uiWidgetStateInfo *UNUSED(state),
|
||||
int UNUSED(roundboxalign),
|
||||
const float UNUSED(zoom))
|
||||
const uiWidgetStateInfo * /*state*/,
|
||||
int /*roundboxalign*/,
|
||||
const float /*zoom*/)
|
||||
{
|
||||
const int radi = 0.25f * BLI_rcti_size_y(rect);
|
||||
|
||||
@@ -3902,8 +3901,8 @@ static void widget_swatch(uiBut *but,
|
||||
static void widget_unitvec(uiBut *but,
|
||||
uiWidgetColors *wcol,
|
||||
rcti *rect,
|
||||
const uiWidgetStateInfo *UNUSED(state),
|
||||
int UNUSED(roundboxalign),
|
||||
const uiWidgetStateInfo * /*state*/,
|
||||
int /*roundboxalign*/,
|
||||
const float zoom)
|
||||
{
|
||||
const float rad = widget_radius_from_zoom(zoom, wcol);
|
||||
@@ -3961,9 +3960,9 @@ static void widget_textbut(uiWidgetColors *wcol,
|
||||
static void widget_preview_tile(uiBut *but,
|
||||
uiWidgetColors *wcol,
|
||||
rcti *rect,
|
||||
const uiWidgetStateInfo *UNUSED(state),
|
||||
int UNUSED(roundboxalign),
|
||||
const float UNUSED(zoom))
|
||||
const uiWidgetStateInfo * /*state*/,
|
||||
int /*roundboxalign*/,
|
||||
const float /*zoom*/)
|
||||
{
|
||||
const uiStyle *style = UI_style_get();
|
||||
ui_draw_preview_item_stateless(
|
||||
@@ -3972,7 +3971,7 @@ static void widget_preview_tile(uiBut *but,
|
||||
|
||||
static void widget_menuiconbut(uiWidgetColors *wcol,
|
||||
rcti *rect,
|
||||
const uiWidgetStateInfo *UNUSED(state),
|
||||
const uiWidgetStateInfo * /*state*/,
|
||||
int roundboxalign,
|
||||
const float zoom)
|
||||
{
|
||||
@@ -4020,8 +4019,8 @@ static void widget_pulldownbut(uiWidgetColors *wcol,
|
||||
|
||||
static void widget_menu_itembut(uiWidgetColors *wcol,
|
||||
rcti *rect,
|
||||
const uiWidgetStateInfo *UNUSED(state),
|
||||
int UNUSED(roundboxalign),
|
||||
const uiWidgetStateInfo * /*state*/,
|
||||
int /*roundboxalign*/,
|
||||
const float zoom)
|
||||
{
|
||||
uiWidgetBase wtb;
|
||||
@@ -4044,8 +4043,8 @@ static void widget_menu_itembut(uiWidgetColors *wcol,
|
||||
|
||||
static void widget_menu_itembut_unpadded(uiWidgetColors *wcol,
|
||||
rcti *rect,
|
||||
const uiWidgetStateInfo *UNUSED(state),
|
||||
int UNUSED(roundboxalign),
|
||||
const uiWidgetStateInfo * /*state*/,
|
||||
int /*roundboxalign*/,
|
||||
const float zoom)
|
||||
{
|
||||
/* This function is used for menu items placed close to each other horizontally, e.g. the matcap
|
||||
@@ -4066,8 +4065,8 @@ static void widget_menu_itembut_unpadded(uiWidgetColors *wcol,
|
||||
static void widget_menu_radial_itembut(uiBut *but,
|
||||
uiWidgetColors *wcol,
|
||||
rcti *rect,
|
||||
const uiWidgetStateInfo *UNUSED(state),
|
||||
int UNUSED(roundboxalign),
|
||||
const uiWidgetStateInfo * /*state*/,
|
||||
int /*roundboxalign*/,
|
||||
const float zoom)
|
||||
{
|
||||
const float fac = but->block->pie_data.alphafac;
|
||||
@@ -4092,8 +4091,8 @@ static void widget_menu_radial_itembut(uiBut *but,
|
||||
|
||||
static void widget_list_itembut(uiWidgetColors *wcol,
|
||||
rcti *rect,
|
||||
const uiWidgetStateInfo *UNUSED(state),
|
||||
int UNUSED(roundboxalign),
|
||||
const uiWidgetStateInfo * /*state*/,
|
||||
int /*roundboxalign*/,
|
||||
const float zoom)
|
||||
{
|
||||
uiWidgetBase wtb;
|
||||
@@ -4110,8 +4109,8 @@ static void widget_list_itembut(uiWidgetColors *wcol,
|
||||
static void widget_optionbut(uiWidgetColors *wcol,
|
||||
rcti *rect,
|
||||
const uiWidgetStateInfo *state,
|
||||
int UNUSED(roundboxalign),
|
||||
const float UNUSED(zoom))
|
||||
int /*roundboxalign*/,
|
||||
const float /*zoom*/)
|
||||
{
|
||||
/* For a right aligned layout (signified by #UI_BUT_TEXT_RIGHT), draw the text on the left of the
|
||||
* checkbox. */
|
||||
@@ -4187,7 +4186,7 @@ static void widget_state_label(uiWidgetType *wt,
|
||||
|
||||
static void widget_radiobut(uiWidgetColors *wcol,
|
||||
rcti *rect,
|
||||
const uiWidgetStateInfo *UNUSED(state),
|
||||
const uiWidgetStateInfo * /*state*/,
|
||||
int roundboxalign,
|
||||
const float zoom)
|
||||
{
|
||||
@@ -4203,7 +4202,7 @@ static void widget_radiobut(uiWidgetColors *wcol,
|
||||
static void widget_box(uiBut *but,
|
||||
uiWidgetColors *wcol,
|
||||
rcti *rect,
|
||||
const uiWidgetStateInfo *UNUSED(state),
|
||||
const uiWidgetStateInfo * /*state*/,
|
||||
int roundboxalign,
|
||||
const float zoom)
|
||||
{
|
||||
@@ -4214,7 +4213,7 @@ static void widget_box(uiBut *but,
|
||||
copy_v3_v3_uchar(old_col, wcol->inner);
|
||||
|
||||
/* abuse but->hsv - if it's non-zero, use this color as the box's background */
|
||||
if (but != NULL && but->col[3]) {
|
||||
if (but != nullptr && but->col[3]) {
|
||||
wcol->inner[0] = but->col[0];
|
||||
wcol->inner[1] = but->col[1];
|
||||
wcol->inner[2] = but->col[2];
|
||||
@@ -4231,7 +4230,7 @@ static void widget_box(uiBut *but,
|
||||
|
||||
static void widget_but(uiWidgetColors *wcol,
|
||||
rcti *rect,
|
||||
const uiWidgetStateInfo *UNUSED(state),
|
||||
const uiWidgetStateInfo * /*state*/,
|
||||
int roundboxalign,
|
||||
const float zoom)
|
||||
{
|
||||
@@ -4245,7 +4244,7 @@ static void widget_but(uiWidgetColors *wcol,
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void widget_roundbut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign)
|
||||
static void widget_roundbut(uiWidgetColors *wcol, rcti *rect, int /*state*/ int roundboxalign)
|
||||
{
|
||||
uiWidgetBase wtb;
|
||||
const float rad = wcol->roundness * U.widget_unit;
|
||||
@@ -4382,7 +4381,7 @@ static uiWidgetType *widget_type(uiWidgetTypeEnum type)
|
||||
wt.wcol_state = &btheme->tui.wcol_state;
|
||||
wt.state = widget_state;
|
||||
wt.draw = widget_but;
|
||||
wt.custom = NULL;
|
||||
wt.custom = nullptr;
|
||||
wt.text = widget_draw_text_icon;
|
||||
|
||||
switch (type) {
|
||||
@@ -4390,7 +4389,7 @@ static uiWidgetType *widget_type(uiWidgetTypeEnum type)
|
||||
break;
|
||||
|
||||
case UI_WTYPE_LABEL:
|
||||
wt.draw = NULL;
|
||||
wt.draw = nullptr;
|
||||
wt.state = widget_state_label;
|
||||
break;
|
||||
|
||||
@@ -4507,9 +4506,9 @@ static uiWidgetType *widget_type(uiWidgetTypeEnum type)
|
||||
break;
|
||||
|
||||
case UI_WTYPE_PREVIEW_TILE:
|
||||
wt.draw = NULL;
|
||||
wt.draw = nullptr;
|
||||
/* Drawn via the `custom` callback. */
|
||||
wt.text = NULL;
|
||||
wt.text = nullptr;
|
||||
wt.custom = widget_preview_tile;
|
||||
break;
|
||||
|
||||
@@ -4637,12 +4636,12 @@ static int widget_roundbox_set(uiBut *but, rcti *rect)
|
||||
/** \name Public API
|
||||
* \{ */
|
||||
|
||||
void ui_draw_but(const bContext *C, struct ARegion *region, uiStyle *style, uiBut *but, rcti *rect)
|
||||
void ui_draw_but(const bContext *C, ARegion *region, uiStyle *style, uiBut *but, rcti *rect)
|
||||
{
|
||||
bTheme *btheme = UI_GetTheme();
|
||||
const ThemeUI *tui = &btheme->tui;
|
||||
const uiFontStyle *fstyle = &style->widget;
|
||||
uiWidgetType *wt = NULL;
|
||||
uiWidgetType *wt = nullptr;
|
||||
|
||||
/* handle menus separately */
|
||||
if (but->emboss == UI_EMBOSS_PULLDOWN) {
|
||||
@@ -4908,7 +4907,7 @@ void ui_draw_but(const bContext *C, struct ARegion *region, uiStyle *style, uiBu
|
||||
}
|
||||
}
|
||||
|
||||
if (wt == NULL) {
|
||||
if (wt == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -4996,7 +4995,7 @@ static void ui_draw_clip_tri(uiBlock *block, rcti *rect, uiWidgetType *wt)
|
||||
}
|
||||
}
|
||||
|
||||
void ui_draw_menu_back(uiStyle *UNUSED(style), uiBlock *block, rcti *rect)
|
||||
void ui_draw_menu_back(uiStyle * /*style*/, uiBlock *block, rcti *rect)
|
||||
{
|
||||
uiWidgetType *wt = widget_type(UI_WTYPE_MENU_BACK);
|
||||
|
||||
@@ -5086,15 +5085,12 @@ static void ui_draw_popover_back_impl(const uiWidgetColors *wcol,
|
||||
GPU_blend(GPU_BLEND_NONE);
|
||||
}
|
||||
|
||||
void ui_draw_popover_back(struct ARegion *region,
|
||||
uiStyle *UNUSED(style),
|
||||
uiBlock *block,
|
||||
rcti *rect)
|
||||
void ui_draw_popover_back(ARegion *region, uiStyle * /*style*/, uiBlock *block, rcti *rect)
|
||||
{
|
||||
uiWidgetType *wt = widget_type(UI_WTYPE_MENU_BACK);
|
||||
|
||||
if (block) {
|
||||
float mval_origin[2] = {UNPACK2(block->bounds_offset)};
|
||||
float mval_origin[2] = {float(block->bounds_offset[0]), float(block->bounds_offset[1])};
|
||||
ui_window_to_block_fl(region, block, &mval_origin[0], &mval_origin[1]);
|
||||
ui_draw_popover_back_impl(
|
||||
wt->wcol_theme, rect, block->direction, U.widget_unit / block->aspect, mval_origin);
|
||||
@@ -5203,7 +5199,7 @@ void ui_draw_pie_center(uiBlock *block)
|
||||
pie_radius_external,
|
||||
subd,
|
||||
btheme->tui.wcol_pie_menu.inner,
|
||||
NULL,
|
||||
nullptr,
|
||||
false);
|
||||
}
|
||||
|
||||
@@ -5231,7 +5227,7 @@ void ui_draw_pie_center(uiBlock *block)
|
||||
pie_radius_external,
|
||||
subd,
|
||||
btheme->tui.wcol_pie_menu.inner_sel,
|
||||
NULL,
|
||||
nullptr,
|
||||
false);
|
||||
}
|
||||
}
|
||||
@@ -5259,7 +5255,7 @@ void ui_draw_pie_center(uiBlock *block)
|
||||
pie_confirm_external,
|
||||
subd,
|
||||
col,
|
||||
NULL,
|
||||
nullptr,
|
||||
false);
|
||||
}
|
||||
|
||||
@@ -5312,10 +5308,10 @@ void ui_draw_widget_menu_back_color(const rcti *rect, bool use_shadow, const flo
|
||||
|
||||
void ui_draw_widget_menu_back(const rcti *rect, bool use_shadow)
|
||||
{
|
||||
ui_draw_widget_back_color(UI_WTYPE_MENU_BACK, use_shadow, rect, NULL);
|
||||
ui_draw_widget_back_color(UI_WTYPE_MENU_BACK, use_shadow, rect, nullptr);
|
||||
}
|
||||
|
||||
void ui_draw_tooltip_background(const uiStyle *UNUSED(style), uiBlock *UNUSED(block), rcti *rect)
|
||||
void ui_draw_tooltip_background(const uiStyle * /*style*/, uiBlock * /*block*/, rcti *rect)
|
||||
{
|
||||
uiWidgetType *wt = widget_type(UI_WTYPE_TOOLTIP);
|
||||
wt->state(wt, &STATE_INFO_NULL, UI_EMBOSS_UNDEFINED);
|
||||
@@ -5336,7 +5332,7 @@ void ui_draw_menu_item(const uiFontStyle *fstyle,
|
||||
const int row_height = BLI_rcti_size_y(rect);
|
||||
int max_hint_width = INT_MAX;
|
||||
int padding = 0.25f * row_height;
|
||||
char *cpoin = NULL;
|
||||
char *cpoin = nullptr;
|
||||
|
||||
uiWidgetStateInfo state = {0};
|
||||
state.but_flag = but_flag;
|
||||
@@ -5354,7 +5350,7 @@ void ui_draw_menu_item(const uiFontStyle *fstyle,
|
||||
|
||||
/* cut string in 2 parts? */
|
||||
if (separator_type != UI_MENU_ITEM_SEPARATOR_NONE) {
|
||||
cpoin = strrchr(name, UI_SEP_CHAR);
|
||||
cpoin = const_cast<char *>(strrchr(name, UI_SEP_CHAR));
|
||||
if (cpoin) {
|
||||
*cpoin = 0;
|
||||
|
||||
@@ -5400,19 +5396,12 @@ void ui_draw_menu_item(const uiFontStyle *fstyle,
|
||||
}
|
||||
|
||||
int xofs = 0, yofs = 0;
|
||||
struct ResultBLF info;
|
||||
UI_fontstyle_draw_ex(fstyle,
|
||||
rect,
|
||||
drawstr,
|
||||
sizeof(drawstr),
|
||||
wt->wcol.text,
|
||||
&(struct uiFontStyleDraw_Params){
|
||||
.align = UI_STYLE_TEXT_LEFT,
|
||||
},
|
||||
&xofs,
|
||||
&yofs,
|
||||
&info);
|
||||
if (r_xmax != NULL) {
|
||||
ResultBLF info;
|
||||
uiFontStyleDraw_Params params{};
|
||||
params.align = UI_STYLE_TEXT_LEFT;
|
||||
UI_fontstyle_draw_ex(
|
||||
fstyle, rect, drawstr, sizeof(drawstr), wt->wcol.text, ¶ms, &xofs, &yofs, &info);
|
||||
if (r_xmax != nullptr) {
|
||||
*r_xmax = xofs + info.width;
|
||||
}
|
||||
}
|
||||
@@ -5457,14 +5446,9 @@ void ui_draw_menu_item(const uiFontStyle *fstyle,
|
||||
}
|
||||
|
||||
rect->xmax = _rect.xmax - 5;
|
||||
UI_fontstyle_draw(fstyle,
|
||||
rect,
|
||||
hint_drawstr,
|
||||
sizeof(hint_drawstr),
|
||||
wt->wcol.text,
|
||||
&(struct uiFontStyleDraw_Params){
|
||||
.align = UI_STYLE_TEXT_RIGHT,
|
||||
});
|
||||
uiFontStyleDraw_Params params{};
|
||||
params.align = UI_STYLE_TEXT_RIGHT;
|
||||
UI_fontstyle_draw(fstyle, rect, hint_drawstr, sizeof(hint_drawstr), wt->wcol.text, ¶ms);
|
||||
*cpoin = UI_SEP_CHAR;
|
||||
}
|
||||
}
|
||||
@@ -5487,7 +5471,7 @@ void ui_draw_preview_item_stateless(const uiFontStyle *fstyle,
|
||||
rect->ymin += text_size;
|
||||
}
|
||||
GPU_blend(GPU_BLEND_ALPHA);
|
||||
widget_draw_preview(iconid, 1.0f, rect);
|
||||
widget_draw_preview(BIFIconID(iconid), 1.0f, rect);
|
||||
GPU_blend(GPU_BLEND_NONE);
|
||||
|
||||
if (!has_text) {
|
||||
@@ -5513,14 +5497,9 @@ void ui_draw_preview_item_stateless(const uiFontStyle *fstyle,
|
||||
BLI_strncpy(drawstr, name, sizeof(drawstr));
|
||||
UI_text_clip_middle_ex(fstyle, drawstr, okwidth, minwidth, max_len, '\0');
|
||||
|
||||
UI_fontstyle_draw(fstyle,
|
||||
&trect,
|
||||
drawstr,
|
||||
sizeof(drawstr),
|
||||
text_col,
|
||||
&(struct uiFontStyleDraw_Params){
|
||||
.align = text_align,
|
||||
});
|
||||
uiFontStyleDraw_Params params{};
|
||||
params.align = text_align;
|
||||
UI_fontstyle_draw(fstyle, &trect, drawstr, sizeof(drawstr), text_col, ¶ms);
|
||||
}
|
||||
}
|
||||
|
@@ -5,9 +5,9 @@
|
||||
* \ingroup edinterface
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <cmath>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
@@ -34,24 +34,21 @@
|
||||
#include "UI_interface_icons.h"
|
||||
|
||||
#include "GPU_framebuffer.h"
|
||||
#include "interface_intern.h"
|
||||
|
||||
/* global for themes */
|
||||
typedef void (*VectorDrawFunc)(int x, int y, int w, int h, float alpha);
|
||||
#include "interface_intern.hh"
|
||||
|
||||
/* be sure to keep 'bThemeState' in sync */
|
||||
static struct bThemeState g_theme_state = {
|
||||
NULL,
|
||||
static bThemeState g_theme_state = {
|
||||
nullptr,
|
||||
SPACE_VIEW3D,
|
||||
RGN_TYPE_WINDOW,
|
||||
};
|
||||
|
||||
void ui_resources_init(void)
|
||||
void ui_resources_init()
|
||||
{
|
||||
UI_icons_init();
|
||||
}
|
||||
|
||||
void ui_resources_free(void)
|
||||
void ui_resources_free()
|
||||
{
|
||||
UI_icons_free();
|
||||
}
|
||||
@@ -62,7 +59,7 @@ void ui_resources_free(void)
|
||||
|
||||
const uchar *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid)
|
||||
{
|
||||
ThemeSpace *ts = NULL;
|
||||
ThemeSpace *ts = nullptr;
|
||||
static uchar error[4] = {240, 0, 240, 255};
|
||||
static uchar alert[4] = {240, 60, 60, 255};
|
||||
static uchar header_active[4] = {0, 0, 0, 255};
|
||||
@@ -230,7 +227,7 @@ const uchar *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid)
|
||||
cp = ts->header;
|
||||
break;
|
||||
|
||||
case TH_HEADER_ACTIVE:
|
||||
case TH_HEADER_ACTIVE: {
|
||||
cp = ts->header;
|
||||
const int factor = 5;
|
||||
/* Lighten the header color when editor is active. */
|
||||
@@ -240,7 +237,7 @@ const uchar *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid)
|
||||
header_active[3] = cp[3];
|
||||
cp = header_active;
|
||||
break;
|
||||
|
||||
}
|
||||
case TH_HEADER_TEXT:
|
||||
cp = ts->header_text;
|
||||
break;
|
||||
@@ -1021,12 +1018,13 @@ const uchar *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid)
|
||||
return (const uchar *)cp;
|
||||
}
|
||||
|
||||
void UI_theme_init_default(void)
|
||||
void UI_theme_init_default()
|
||||
{
|
||||
/* we search for the theme with name Default */
|
||||
bTheme *btheme = BLI_findstring(&U.themes, "Default", offsetof(bTheme, name));
|
||||
if (btheme == NULL) {
|
||||
btheme = MEM_callocN(sizeof(bTheme), __func__);
|
||||
bTheme *btheme = static_cast<bTheme *>(
|
||||
BLI_findstring(&U.themes, "Default", offsetof(bTheme, name)));
|
||||
if (btheme == nullptr) {
|
||||
btheme = MEM_cnew<bTheme>(__func__);
|
||||
BLI_addtail(&U.themes, btheme);
|
||||
}
|
||||
|
||||
@@ -1037,7 +1035,7 @@ void UI_theme_init_default(void)
|
||||
btheme->active_theme_area = active_theme_area;
|
||||
}
|
||||
|
||||
void UI_style_init_default(void)
|
||||
void UI_style_init_default()
|
||||
{
|
||||
BLI_freelistN(&U.uistyles);
|
||||
/* gets automatically re-allocated */
|
||||
@@ -1048,34 +1046,34 @@ void UI_SetTheme(int spacetype, int regionid)
|
||||
{
|
||||
if (spacetype) {
|
||||
/* later on, a local theme can be found too */
|
||||
g_theme_state.theme = U.themes.first;
|
||||
g_theme_state.theme = static_cast<bTheme *>(U.themes.first);
|
||||
g_theme_state.spacetype = spacetype;
|
||||
g_theme_state.regionid = regionid;
|
||||
}
|
||||
else if (regionid) {
|
||||
/* popups */
|
||||
g_theme_state.theme = U.themes.first;
|
||||
g_theme_state.theme = static_cast<bTheme *>(U.themes.first);
|
||||
g_theme_state.spacetype = SPACE_PROPERTIES;
|
||||
g_theme_state.regionid = regionid;
|
||||
}
|
||||
else {
|
||||
/* for safety, when theme was deleted */
|
||||
g_theme_state.theme = U.themes.first;
|
||||
g_theme_state.theme = static_cast<bTheme *>(U.themes.first);
|
||||
g_theme_state.spacetype = SPACE_VIEW3D;
|
||||
g_theme_state.regionid = RGN_TYPE_WINDOW;
|
||||
}
|
||||
}
|
||||
|
||||
bTheme *UI_GetTheme(void)
|
||||
bTheme *UI_GetTheme()
|
||||
{
|
||||
return U.themes.first;
|
||||
return static_cast<bTheme *>(U.themes.first);
|
||||
}
|
||||
|
||||
void UI_Theme_Store(struct bThemeState *theme_state)
|
||||
void UI_Theme_Store(bThemeState *theme_state)
|
||||
{
|
||||
*theme_state = g_theme_state;
|
||||
}
|
||||
void UI_Theme_Restore(struct bThemeState *theme_state)
|
||||
void UI_Theme_Restore(bThemeState *theme_state)
|
||||
{
|
||||
g_theme_state = *theme_state;
|
||||
}
|
||||
@@ -1084,13 +1082,13 @@ void UI_GetThemeColorShadeAlpha4ubv(int colorid, int coloffset, int alphaoffset,
|
||||
{
|
||||
int r, g, b, a;
|
||||
const uchar *cp = UI_ThemeGetColorPtr(g_theme_state.theme, g_theme_state.spacetype, colorid);
|
||||
r = coloffset + (int)cp[0];
|
||||
r = coloffset + int(cp[0]);
|
||||
CLAMP(r, 0, 255);
|
||||
g = coloffset + (int)cp[1];
|
||||
g = coloffset + int(cp[1]);
|
||||
CLAMP(g, 0, 255);
|
||||
b = coloffset + (int)cp[2];
|
||||
b = coloffset + int(cp[2]);
|
||||
CLAMP(b, 0, 255);
|
||||
a = alphaoffset + (int)cp[3];
|
||||
a = alphaoffset + int(cp[3]);
|
||||
CLAMP(a, 0, 255);
|
||||
|
||||
col[0] = r;
|
||||
@@ -1143,51 +1141,51 @@ void UI_FontThemeColor(int fontid, int colorid)
|
||||
float UI_GetThemeValuef(int colorid)
|
||||
{
|
||||
const uchar *cp = UI_ThemeGetColorPtr(g_theme_state.theme, g_theme_state.spacetype, colorid);
|
||||
return ((float)cp[0]);
|
||||
return (float(cp[0]));
|
||||
}
|
||||
|
||||
int UI_GetThemeValue(int colorid)
|
||||
{
|
||||
const uchar *cp = UI_ThemeGetColorPtr(g_theme_state.theme, g_theme_state.spacetype, colorid);
|
||||
return ((int)cp[0]);
|
||||
return (int(cp[0]));
|
||||
}
|
||||
|
||||
float UI_GetThemeValueTypef(int colorid, int spacetype)
|
||||
{
|
||||
const uchar *cp = UI_ThemeGetColorPtr(g_theme_state.theme, spacetype, colorid);
|
||||
return ((float)cp[0]);
|
||||
return (float(cp[0]));
|
||||
}
|
||||
|
||||
int UI_GetThemeValueType(int colorid, int spacetype)
|
||||
{
|
||||
const uchar *cp = UI_ThemeGetColorPtr(g_theme_state.theme, spacetype, colorid);
|
||||
return ((int)cp[0]);
|
||||
return (int(cp[0]));
|
||||
}
|
||||
|
||||
void UI_GetThemeColor3fv(int colorid, float col[3])
|
||||
{
|
||||
const uchar *cp = UI_ThemeGetColorPtr(g_theme_state.theme, g_theme_state.spacetype, colorid);
|
||||
col[0] = ((float)cp[0]) / 255.0f;
|
||||
col[1] = ((float)cp[1]) / 255.0f;
|
||||
col[2] = ((float)cp[2]) / 255.0f;
|
||||
col[0] = (float(cp[0])) / 255.0f;
|
||||
col[1] = (float(cp[1])) / 255.0f;
|
||||
col[2] = (float(cp[2])) / 255.0f;
|
||||
}
|
||||
|
||||
void UI_GetThemeColor4fv(int colorid, float col[4])
|
||||
{
|
||||
const uchar *cp = UI_ThemeGetColorPtr(g_theme_state.theme, g_theme_state.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;
|
||||
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;
|
||||
}
|
||||
|
||||
void UI_GetThemeColorType4fv(int colorid, int spacetype, float col[4])
|
||||
{
|
||||
const uchar *cp = UI_ThemeGetColorPtr(g_theme_state.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;
|
||||
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;
|
||||
}
|
||||
|
||||
void UI_GetThemeColorShade3fv(int colorid, int offset, float col[3])
|
||||
@@ -1195,16 +1193,16 @@ void UI_GetThemeColorShade3fv(int colorid, int offset, float col[3])
|
||||
const uchar *cp = UI_ThemeGetColorPtr(g_theme_state.theme, g_theme_state.spacetype, colorid);
|
||||
int r, g, b;
|
||||
|
||||
r = offset + (int)cp[0];
|
||||
r = offset + int(cp[0]);
|
||||
CLAMP(r, 0, 255);
|
||||
g = offset + (int)cp[1];
|
||||
g = offset + int(cp[1]);
|
||||
CLAMP(g, 0, 255);
|
||||
b = offset + (int)cp[2];
|
||||
b = offset + int(cp[2]);
|
||||
CLAMP(b, 0, 255);
|
||||
|
||||
col[0] = ((float)r) / 255.0f;
|
||||
col[1] = ((float)g) / 255.0f;
|
||||
col[2] = ((float)b) / 255.0f;
|
||||
col[0] = float(r) / 255.0f;
|
||||
col[1] = float(g) / 255.0f;
|
||||
col[2] = float(b) / 255.0f;
|
||||
}
|
||||
|
||||
void UI_GetThemeColorShade3ubv(int colorid, int offset, uchar col[3])
|
||||
@@ -1212,11 +1210,11 @@ void UI_GetThemeColorShade3ubv(int colorid, int offset, uchar col[3])
|
||||
const uchar *cp = UI_ThemeGetColorPtr(g_theme_state.theme, g_theme_state.spacetype, colorid);
|
||||
int r, g, b;
|
||||
|
||||
r = offset + (int)cp[0];
|
||||
r = offset + int(cp[0]);
|
||||
CLAMP(r, 0, 255);
|
||||
g = offset + (int)cp[1];
|
||||
g = offset + int(cp[1]);
|
||||
CLAMP(g, 0, 255);
|
||||
b = offset + (int)cp[2];
|
||||
b = offset + int(cp[2]);
|
||||
CLAMP(b, 0, 255);
|
||||
|
||||
col[0] = r;
|
||||
@@ -1245,11 +1243,11 @@ void UI_GetThemeColorShade4ubv(int colorid, int offset, uchar col[4])
|
||||
const uchar *cp = UI_ThemeGetColorPtr(g_theme_state.theme, g_theme_state.spacetype, colorid);
|
||||
int r, g, b;
|
||||
|
||||
r = offset + (int)cp[0];
|
||||
r = offset + int(cp[0]);
|
||||
CLAMP(r, 0, 255);
|
||||
g = offset + (int)cp[1];
|
||||
g = offset + int(cp[1]);
|
||||
CLAMP(g, 0, 255);
|
||||
b = offset + (int)cp[2];
|
||||
b = offset + int(cp[2]);
|
||||
CLAMP(b, 0, 255);
|
||||
|
||||
col[0] = r;
|
||||
@@ -1263,19 +1261,19 @@ void UI_GetThemeColorShadeAlpha4fv(int colorid, int coloffset, int alphaoffset,
|
||||
const uchar *cp = UI_ThemeGetColorPtr(g_theme_state.theme, g_theme_state.spacetype, colorid);
|
||||
int r, g, b, a;
|
||||
|
||||
r = coloffset + (int)cp[0];
|
||||
r = coloffset + int(cp[0]);
|
||||
CLAMP(r, 0, 255);
|
||||
g = coloffset + (int)cp[1];
|
||||
g = coloffset + int(cp[1]);
|
||||
CLAMP(g, 0, 255);
|
||||
b = coloffset + (int)cp[2];
|
||||
b = coloffset + int(cp[2]);
|
||||
CLAMP(b, 0, 255);
|
||||
a = alphaoffset + (int)cp[3];
|
||||
a = alphaoffset + int(cp[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;
|
||||
col[0] = float(r) / 255.0f;
|
||||
col[1] = float(g) / 255.0f;
|
||||
col[2] = float(b) / 255.0f;
|
||||
col[3] = float(a) / 255.0f;
|
||||
}
|
||||
|
||||
void UI_GetThemeColorBlendShade3fv(int colorid1, int colorid2, float fac, int offset, float col[3])
|
||||
@@ -1293,9 +1291,9 @@ void UI_GetThemeColorBlendShade3fv(int colorid1, int colorid2, float fac, int of
|
||||
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;
|
||||
col[0] = float(r) / 255.0f;
|
||||
col[1] = float(g) / 255.0f;
|
||||
col[2] = float(b) / 255.0f;
|
||||
}
|
||||
|
||||
void UI_GetThemeColorBlendShade4fv(int colorid1, int colorid2, float fac, int offset, float col[4])
|
||||
@@ -1316,10 +1314,10 @@ void UI_GetThemeColorBlendShade4fv(int colorid1, int colorid2, float fac, int of
|
||||
a = floorf((1.0f - fac) * cp1[3] + fac * cp2[3]); /* No shading offset. */
|
||||
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;
|
||||
col[0] = float(r) / 255.0f;
|
||||
col[1] = float(g) / 255.0f;
|
||||
col[2] = float(b) / 255.0f;
|
||||
col[3] = float(a) / 255.0f;
|
||||
}
|
||||
|
||||
void UI_GetThemeColor3ubv(int colorid, uchar col[3])
|
||||
@@ -1335,20 +1333,20 @@ void UI_GetThemeColorShade4fv(int colorid, int offset, float col[4])
|
||||
const uchar *cp = UI_ThemeGetColorPtr(g_theme_state.theme, g_theme_state.spacetype, colorid);
|
||||
int r, g, b, a;
|
||||
|
||||
r = offset + (int)cp[0];
|
||||
r = offset + int(cp[0]);
|
||||
CLAMP(r, 0, 255);
|
||||
g = offset + (int)cp[1];
|
||||
g = offset + int(cp[1]);
|
||||
CLAMP(g, 0, 255);
|
||||
b = offset + (int)cp[2];
|
||||
b = offset + int(cp[2]);
|
||||
CLAMP(b, 0, 255);
|
||||
|
||||
a = (int)cp[3]; /* no shading offset... */
|
||||
a = int(cp[3]); /* no shading offset... */
|
||||
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;
|
||||
col[0] = float(r) / 255.0f;
|
||||
col[1] = float(g) / 255.0f;
|
||||
col[2] = float(b) / 255.0f;
|
||||
col[3] = float(a) / 255.0f;
|
||||
}
|
||||
|
||||
void UI_GetThemeColor4ubv(int colorid, uchar col[4])
|
||||
@@ -1363,9 +1361,9 @@ void UI_GetThemeColor4ubv(int colorid, uchar col[4])
|
||||
void UI_GetThemeColorType3fv(int colorid, int spacetype, float col[3])
|
||||
{
|
||||
const uchar *cp = UI_ThemeGetColorPtr(g_theme_state.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[0] = (float(cp[0])) / 255.0f;
|
||||
col[1] = (float(cp[1])) / 255.0f;
|
||||
col[2] = (float(cp[2])) / 255.0f;
|
||||
}
|
||||
|
||||
void UI_GetThemeColorType3ubv(int colorid, int spacetype, uchar col[3])
|
||||
@@ -1418,9 +1416,9 @@ void UI_GetColorPtrShade3ubv(const uchar cp[3], uchar col[3], int offset)
|
||||
{
|
||||
int r, g, b;
|
||||
|
||||
r = offset + (int)cp[0];
|
||||
g = offset + (int)cp[1];
|
||||
b = offset + (int)cp[2];
|
||||
r = offset + int(cp[0]);
|
||||
g = offset + int(cp[1]);
|
||||
b = offset + int(cp[2]);
|
||||
|
||||
CLAMP(r, 0, 255);
|
||||
CLAMP(g, 0, 255);
|
||||
@@ -1458,10 +1456,10 @@ void UI_ThemeClearColor(int colorid)
|
||||
GPU_clear_color(col[0], col[1], col[2], 1.0f);
|
||||
}
|
||||
|
||||
int UI_ThemeMenuShadowWidth(void)
|
||||
int UI_ThemeMenuShadowWidth()
|
||||
{
|
||||
bTheme *btheme = UI_GetTheme();
|
||||
return (int)(btheme->tui.menu_shadow_width * UI_DPI_FAC);
|
||||
return int(btheme->tui.menu_shadow_width * UI_DPI_FAC);
|
||||
}
|
||||
|
||||
void UI_make_axis_color(const uchar src_col[3], uchar dst_col[3], const char axis)
|
@@ -43,7 +43,7 @@
|
||||
#include "UI_interface.h"
|
||||
#include "UI_view2d.h"
|
||||
|
||||
#include "interface_intern.h"
|
||||
#include "interface_intern.hh"
|
||||
|
||||
static void ui_view2d_curRect_validate_resize(View2D *v2d, bool resize);
|
||||
|
||||
|
@@ -33,7 +33,7 @@
|
||||
#include "UI_interface.h"
|
||||
#include "UI_view2d.h"
|
||||
|
||||
#include "interface_intern.h"
|
||||
#include "interface_intern.hh"
|
||||
|
||||
/* Compute display grid resolution
|
||||
********************************************************/
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* \ingroup edinterface
|
||||
*/
|
||||
|
||||
#include "interface_intern.h"
|
||||
#include "interface_intern.hh"
|
||||
|
||||
#include "UI_abstract_view.hh"
|
||||
|
||||
|
@@ -12,7 +12,7 @@
|
||||
#include "WM_api.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "interface_intern.h"
|
||||
#include "interface_intern.hh"
|
||||
|
||||
#include "UI_abstract_view.hh"
|
||||
|
||||
|
@@ -12,7 +12,7 @@
|
||||
#include "WM_types.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "interface_intern.h"
|
||||
#include "interface_intern.hh"
|
||||
|
||||
#include "UI_grid_view.hh"
|
||||
|
||||
|
@@ -27,7 +27,7 @@
|
||||
|
||||
#include "ED_screen.h"
|
||||
|
||||
#include "interface_intern.h"
|
||||
#include "interface_intern.hh"
|
||||
|
||||
#include "UI_interface.hh"
|
||||
|
||||
|
@@ -11,7 +11,7 @@
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "interface_intern.h"
|
||||
#include "interface_intern.hh"
|
||||
|
||||
#include "UI_interface.h"
|
||||
|
||||
|
@@ -51,7 +51,7 @@
|
||||
#include "WM_api.h"
|
||||
#include "WM_types.h"
|
||||
|
||||
#include "../interface/interface_intern.h"
|
||||
#include "../interface/interface_intern.hh"
|
||||
|
||||
#include "buttons_intern.h" /* own include */
|
||||
|
||||
|
@@ -77,6 +77,8 @@
|
||||
#include "FN_field.hh"
|
||||
#include "FN_field_cpp_type.hh"
|
||||
|
||||
#include "../interface/interface_intern.hh" /* TODO: Remove */
|
||||
|
||||
#include "node_intern.hh" /* own include */
|
||||
|
||||
namespace geo_log = blender::nodes::geo_eval_log;
|
||||
@@ -84,12 +86,6 @@ namespace geo_log = blender::nodes::geo_eval_log;
|
||||
using blender::GPointer;
|
||||
using blender::Vector;
|
||||
|
||||
extern "C" {
|
||||
/* XXX interface.h */
|
||||
extern void ui_draw_dropshadow(
|
||||
const rctf *rct, float radius, float aspect, float alpha, int select);
|
||||
}
|
||||
|
||||
/**
|
||||
* This is passed to many functions which draw the node editor.
|
||||
*/
|
||||
|
@@ -32,7 +32,7 @@
|
||||
#include "NOD_socket.h"
|
||||
#include "NOD_socket_declarations.hh"
|
||||
|
||||
#include "../interface/interface_intern.h" /* XXX bad level */
|
||||
#include "../interface/interface_intern.hh" /* XXX bad level */
|
||||
#include "UI_interface.h"
|
||||
|
||||
#include "ED_node.h" /* own include */
|
||||
|
Reference in New Issue
Block a user