Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/interface/interface_eyedropper.c
| Show First 20 Lines • Show All 124 Lines • ▼ Show 20 Lines | void eyedropper_draw_cursor_text_window(const struct wmWindow *window, const char *name) | ||||
| eyedropper_draw_cursor_text_ex(x, y, name); | eyedropper_draw_cursor_text_ex(x, y, name); | ||||
| } | } | ||||
| void eyedropper_draw_cursor_text_region(const struct bContext *C, | void eyedropper_draw_cursor_text_region(const struct bContext *C, | ||||
| const ARegion *region, | const ARegion *region, | ||||
| const char *name) | const char *name) | ||||
| { | { | ||||
| wmWindow *win = CTX_wm_window(C); | wmWindow *win = CTX_wm_window(C); | ||||
| const int x = win->eventstate->x - region->winrct.xmin; | const int x = win->eventstate->x; | ||||
| const int y = win->eventstate->y - region->winrct.ymin; | const int y = win->eventstate->y; | ||||
| if ((name[0] == '\0') || (BLI_rcti_isect_pt(®ion->winrct, x, y) == false)) { | if ((name[0] == '\0') || (BLI_rcti_isect_pt(®ion->winrct, x, y) == false)) { | ||||
| return; | return; | ||||
| } | } | ||||
| eyedropper_draw_cursor_text_ex(x, y, name); | const int mval[2] = { | ||||
| x - region->winrct.xmin, | |||||
| y - region->winrct.ymin, | |||||
| }; | |||||
| eyedropper_draw_cursor_text_ex(mval[0], mval[1], name); | |||||
| } | } | ||||
Severin: Why not this?:
```
const int mval[2] = {
x - region->winrct.xmin,
y - region->winrct.ymin… | |||||
| /** | /** | ||||
| * Utility to retrieve a button representing a RNA property that is currently under the cursor. | * Utility to retrieve a button representing a RNA property that is currently under the cursor. | ||||
| * | * | ||||
| * This is to be used by any eyedroppers which fetch properties (e.g. UI_OT_eyedropper_driver). | * This is to be used by any eyedroppers which fetch properties (e.g. UI_OT_eyedropper_driver). | ||||
| * Especially during modal operations (e.g. as with the eyedroppers), context cannot be relied | * Especially during modal operations (e.g. as with the eyedroppers), context cannot be relied | ||||
| * upon to provide this information, as it is not updated until the operator finishes. | * upon to provide this information, as it is not updated until the operator finishes. | ||||
| * | * | ||||
| Show All 17 Lines | |||||
Why not this?:
const int mval[2] = { x - region->winrct.xmin, y - region->winrct.ymin, }; eyedropper_draw_cursor_text_ex(mval[0], mval[1], name);We usually prefer keeping declarations close to usage.