Cleanup: Move interface eyedroppers directory to C++
This commit is contained in:
parent
136ea84d9a
commit
e47c75aa6e
|
@ -27,13 +27,13 @@ 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.cc
|
||||
interface_anim.cc
|
||||
|
@ -81,7 +81,7 @@ set(SRC
|
|||
views/interface_view.cc
|
||||
views/tree_view.cc
|
||||
|
||||
eyedroppers/eyedropper_intern.h
|
||||
eyedroppers/eyedropper_intern.hh
|
||||
interface_intern.h
|
||||
interface_regions_intern.hh
|
||||
)
|
||||
|
|
|
@ -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)
|
|
@ -35,14 +35,14 @@
|
|||
|
||||
#include "interface_intern.h"
|
||||
|
||||
#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 "eyedropper_intern.hh"
|
||||
#include "interface_intern.h"
|
||||
|
||||
/**
|
||||
* \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 "eyedropper_intern.hh"
|
||||
#include "interface_intern.h"
|
||||
|
||||
/**
|
||||
* \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 "eyedropper_intern.hh"
|
||||
#include "interface_intern.h"
|
||||
|
||||
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 "eyedropper_intern.hh"
|
||||
#include "interface_intern.h"
|
||||
|
||||
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]);
|
||||
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include "interface_intern.h"
|
||||
|
||||
#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);
|
Loading…
Reference in New Issue