Manipulator: Expose Context.manipulator_group
Needed for operators run by the manipulator keymap so they can access their selected manipulators.
This commit is contained in:
parent
c7bc2f5e87
commit
d53028b450
|
@ -153,6 +153,7 @@ struct SpaceLink *CTX_wm_space_data(const bContext *C);
|
|||
struct ARegion *CTX_wm_region(const bContext *C);
|
||||
void *CTX_wm_region_data(const bContext *C);
|
||||
struct ARegion *CTX_wm_menu(const bContext *C);
|
||||
struct wmManipulatorGroup *CTX_wm_manipulator_group(const bContext *C);
|
||||
struct ReportList *CTX_wm_reports(const bContext *C);
|
||||
|
||||
struct View3D *CTX_wm_view3d(const bContext *C);
|
||||
|
@ -180,6 +181,7 @@ void CTX_wm_screen_set(bContext *C, struct bScreen *screen); /* to be removed */
|
|||
void CTX_wm_area_set(bContext *C, struct ScrArea *sa);
|
||||
void CTX_wm_region_set(bContext *C, struct ARegion *region);
|
||||
void CTX_wm_menu_set(bContext *C, struct ARegion *menu);
|
||||
void CTX_wm_manipulator_group_set(bContext *C, struct wmManipulatorGroup *mgroup);
|
||||
const char *CTX_wm_operator_poll_msg_get(struct bContext *C);
|
||||
void CTX_wm_operator_poll_msg_set(struct bContext *C, const char *msg);
|
||||
|
||||
|
|
|
@ -77,6 +77,7 @@ struct bContext {
|
|||
struct ScrArea *area;
|
||||
struct ARegion *region;
|
||||
struct ARegion *menu;
|
||||
struct wmManipulatorGroup *manipulator_group;
|
||||
struct bContextStore *store;
|
||||
const char *operator_poll_msg; /* reason for poll failing */
|
||||
} wm;
|
||||
|
@ -671,6 +672,11 @@ struct ARegion *CTX_wm_menu(const bContext *C)
|
|||
return C->wm.menu;
|
||||
}
|
||||
|
||||
struct wmManipulatorGroup *CTX_wm_manipulator_group(const bContext *C)
|
||||
{
|
||||
return C->wm.manipulator_group;
|
||||
}
|
||||
|
||||
struct ReportList *CTX_wm_reports(const bContext *C)
|
||||
{
|
||||
if (C->wm.manager)
|
||||
|
@ -870,6 +876,11 @@ void CTX_wm_menu_set(bContext *C, ARegion *menu)
|
|||
C->wm.menu = menu;
|
||||
}
|
||||
|
||||
void CTX_wm_manipulator_group_set(bContext *C, struct wmManipulatorGroup *mgroup)
|
||||
{
|
||||
C->wm.manipulator_group = mgroup;
|
||||
}
|
||||
|
||||
void CTX_wm_operator_poll_msg_set(bContext *C, const char *msg)
|
||||
{
|
||||
C->wm.operator_poll_msg = msg;
|
||||
|
|
|
@ -101,6 +101,14 @@ static PointerRNA rna_Context_region_data_get(PointerRNA *ptr)
|
|||
return PointerRNA_NULL;
|
||||
}
|
||||
|
||||
static PointerRNA rna_Context_manipulator_group_get(PointerRNA *ptr)
|
||||
{
|
||||
bContext *C = (bContext *)ptr->data;
|
||||
PointerRNA newptr;
|
||||
RNA_pointer_create(NULL, &RNA_ManipulatorGroup, CTX_wm_manipulator_group(C), &newptr);
|
||||
return newptr;
|
||||
}
|
||||
|
||||
static PointerRNA rna_Context_main_get(PointerRNA *ptr)
|
||||
{
|
||||
bContext *C = (bContext *)ptr->data;
|
||||
|
@ -229,6 +237,11 @@ void RNA_def_context(BlenderRNA *brna)
|
|||
RNA_def_property_struct_type(prop, "RegionView3D");
|
||||
RNA_def_property_pointer_funcs(prop, "rna_Context_region_data_get", NULL, NULL, NULL);
|
||||
|
||||
prop = RNA_def_property(srna, "manipulator_group", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_struct_type(prop, "ManipulatorGroup");
|
||||
RNA_def_property_pointer_funcs(prop, "rna_Context_manipulator_group_get", NULL, NULL, NULL);
|
||||
|
||||
/* Data */
|
||||
prop = RNA_def_property(srna, "blend_data", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
||||
|
|
|
@ -2230,11 +2230,15 @@ static int wm_handlers_do_intern(bContext *C, wmEvent *event, ListBase *handlers
|
|||
/* weak, but allows interactive callback to not use rawkey */
|
||||
event->keymap_idname = kmi->idname;
|
||||
|
||||
CTX_wm_manipulator_group_set(C, mgroup);
|
||||
|
||||
/* handler->op is called later, we want keymap op to be triggered here */
|
||||
handler->op = NULL;
|
||||
action |= wm_handler_operator_call(C, handlers, handler, event, kmi->ptr);
|
||||
handler->op = op;
|
||||
|
||||
CTX_wm_manipulator_group_set(C, NULL);
|
||||
|
||||
if (action & WM_HANDLER_BREAK) {
|
||||
if (action & WM_HANDLER_HANDLED) {
|
||||
if (G.debug & (G_DEBUG_EVENTS | G_DEBUG_HANDLERS))
|
||||
|
|
Loading…
Reference in New Issue