25#include "RNA_prototypes.hh"
83 if ((bone_dropper->
ptr.
data ==
nullptr) || (bone_dropper->
prop ==
nullptr)) {
109 BoneDropper *bone_dropper = MEM_new<BoneDropper>(__func__);
111 bone_dropper->
ptr = button_ptr;
112 bone_dropper->
prop = button_prop;
116 MEM_delete(bone_dropper);
184 Base *base =
nullptr;
189 if (!bone || !base) {
208 if (!ebone || !base) {
246 if (bone_id != search_id) {
257 if (bone_id != search_id) {
273 if (bone_id != search_id) {
314 const int mval[2] = {event_xy[0] - region->winrct.xmin, event_xy[1] - region->winrct.ymin};
324 switch (area.spacetype) {
339 if (sample_data.
name) {
366 if (!sample_data.
name) {
372 if (search_type == &RNA_Bone && sample_data.
bone_rna.
type == &RNA_PoseBone &&
410 op->
reports,
RPT_WARNING,
"Picked bone does not belong to the already chosen armature");
416 "Selection is not a bone. Armature needs to be in Pose Mode or Edit Mode "
417 "to pick in the 3D Viewport");
441 switch (event->
val) {
446 const bool is_undo = bdr->
is_undo;
529 return type == &RNA_Bone || type == &RNA_EditBone;
535 ot->
name =
"Eyedropper Bone";
536 ot->
idname =
"UI_OT_eyedropper_bone";
537 ot->
description =
"Sample a bone from the 3D View or the Outliner to store in a property";
ReportList * CTX_wm_reports(const bContext *C)
ScrArea * CTX_wm_area(const bContext *C)
wmWindow * CTX_wm_window(const bContext *C)
void CTX_wm_window_set(bContext *C, wmWindow *win)
Main * CTX_data_main(const bContext *C)
void CTX_wm_area_set(bContext *C, ScrArea *area)
void CTX_wm_region_set(bContext *C, ARegion *region)
ARegion * CTX_wm_region(const bContext *C)
enum eContextObjectMode CTX_data_mode_enum(const bContext *C)
General operations, lookup, etc. for blender objects.
void BKE_object_update_select_id(Main *bmain)
void BKE_report(ReportList *reports, eReportType type, const char *message)
ARegion * BKE_area_find_region_xy(const ScrArea *area, int regiontype, const int xy[2]) ATTR_NONNULL(3)
SpaceType * BKE_spacetype_from_id(int spaceid)
ARegionType * BKE_regiontype_from_id(const SpaceType *st, int regionid)
ARegion * BKE_area_find_region_type(const ScrArea *area, int region_type)
#define BLI_assert_unreachable()
MINLINE void copy_v2_v2_int(int r[2], const int a[2])
#define SNPRINTF(dst, format,...)
bool ED_outliner_give_rna_under_cursor(bContext *C, const int mval[2], PointerRNA *r_ptr)
void ED_area_tag_redraw(ScrArea *area)
void ED_region_tag_redraw(ARegion *region)
void * ED_region_draw_cb_activate(ARegionType *art, void(*draw)(const bContext *, ARegion *, void *), void *customdata, int type)
bool ED_region_draw_cb_exit(ARegionType *art, void *handle)
#define REGION_DRAW_POST_PIXEL
short RNA_type_to_ID_code(const StructRNA *type)
uiBut * UI_context_active_but_prop_get(const bContext *C, PointerRNA *r_ptr, PropertyRNA **r_prop, int *r_index)
void UI_context_active_but_clear(bContext *C, wmWindow *win, ARegion *region)
bool UI_but_flag_is_set(uiBut *but, int flag)
EditBone * ED_armature_pick_ebone(bContext *C, const int xy[2], bool findunsel, Base **r_base)
bPoseChannel * ED_armature_pick_pchan(bContext *C, const int xy[2], bool findunsel, Base **r_base)
void eyedropper_win_area_find(const bContext *C, const int event_xy[2], int r_event_xy[2], wmWindow **r_win, ScrArea **r_area)
@ EYE_MODAL_SAMPLE_CONFIRM
void eyedropper_draw_cursor_text_region(const int xy[2], const char *name)
static int bonedropper_invoke(bContext *C, wmOperator *op, const wmEvent *)
static void bonedropper_cancel(bContext *C, wmOperator *op)
static int bonedropper_exec(bContext *C, wmOperator *op)
static BoneSampleData sample_data_from_outliner(bContext *C, const int mval[2], const BoneDropper &bdr)
static void bonedropper_set_draw_callback_region(ScrArea &area, BoneDropper &bdr)
static void datadropper_draw_cb(const bContext *, ARegion *, void *arg)
static int bonedropper_modal(bContext *C, wmOperator *op, const wmEvent *event)
static BoneSampleData bonedropper_sample_pt(bContext *C, wmWindow &win, ScrArea &area, BoneDropper &bdr, const int event_xy[2])
static SampleResult bonedropper_sample(bContext *C, BoneDropper &bdr, const int event_xy[2])
static bool bonedropper_poll(bContext *C)
static int bonedropper_init(bContext *C, wmOperator *op)
void UI_OT_eyedropper_bone(wmOperatorType *ot)
static bool is_bone_dropper_valid(BoneDropper *bone_dropper)
static void generate_sample_warning(SampleResult result, wmOperator *op)
static BoneSampleData sample_data_from_3d_view(bContext *C, const int mval[2], const BoneDropper &bdr)
static void bonedropper_exit(bContext *C, wmOperator *op)
StructRNA * RNA_property_pointer_type(PointerRNA *ptr, PropertyRNA *prop)
void RNA_property_pointer_set(PointerRNA *ptr, PropertyRNA *prop, PointerRNA ptr_value, ReportList *reports)
PropertyType RNA_property_type(PropertyRNA *prop)
void RNA_property_update(bContext *C, PointerRNA *ptr, PropertyRNA *prop)
bool RNA_property_editable(const PointerRNA *ptr, PropertyRNA *prop)
PointerRNA RNA_pointer_create(ID *id, StructRNA *type, void *data)
PointerRNA RNA_id_pointer_create(ID *id)
void RNA_property_string_set(PointerRNA *ptr, PropertyRNA *prop, const char *value)
ARegionType * area_region_type
PropertyRNA * search_prop
SampleResult sample_result
PropertyRNA * rnasearchprop
bool(* poll)(bContext *C) ATTR_WARN_UNUSED_RESULT
int(* modal)(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
int(* invoke)(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
int(* exec)(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
void(* cancel)(bContext *C, wmOperator *op)
struct ReportList * reports
void WM_cursor_modal_set(wmWindow *win, int val)
void WM_cursor_modal_restore(wmWindow *win)
wmEventHandler_Op * WM_event_add_modal_handler(bContext *C, wmOperator *op)
void WM_event_add_mousemove(wmWindow *win)