forked from bartvdbraak/blender
presets now work from non-redo popups,
ended up having to add a new pointer into the uiBlock (which I'd rather have avoided), but setting the uiLayoutSetContextPointer(..) was complicated to properly use for submenus and popus.
This commit is contained in:
parent
08cc1c6bb9
commit
5caf6e9070
@ -507,6 +507,7 @@ if(UNIX AND NOT APPLE)
|
|||||||
if(NOT BOOST_CUSTOM)
|
if(NOT BOOST_CUSTOM)
|
||||||
set(Boost_USE_MULTITHREADED ON)
|
set(Boost_USE_MULTITHREADED ON)
|
||||||
find_package(Boost 1.34 COMPONENTS filesystem regex system thread)
|
find_package(Boost 1.34 COMPONENTS filesystem regex system thread)
|
||||||
|
mark_as_advanced(Boost_DIR) # why doesnt boost do this?
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(BOOST_INCLUDE_DIR ${Boost_INCLUDE_DIRS})
|
set(BOOST_INCLUDE_DIR ${Boost_INCLUDE_DIRS})
|
||||||
|
@ -802,6 +802,7 @@ void UI_buttons_operatortypes(void);
|
|||||||
uiBut *uiContextActiveButton(const struct bContext *C);
|
uiBut *uiContextActiveButton(const struct bContext *C);
|
||||||
void uiContextActiveProperty(const struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA **prop, int *index);
|
void uiContextActiveProperty(const struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA **prop, int *index);
|
||||||
void uiContextActivePropertyHandle(struct bContext *C);
|
void uiContextActivePropertyHandle(struct bContext *C);
|
||||||
|
struct wmOperator *uiContextActiveOperator(const struct bContext *C);
|
||||||
void uiContextAnimUpdate(const struct bContext *C);
|
void uiContextAnimUpdate(const struct bContext *C);
|
||||||
void uiFileBrowseContextProperty(const struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA **prop);
|
void uiFileBrowseContextProperty(const struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA **prop);
|
||||||
void uiIDContextProperty(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA **prop);
|
void uiIDContextProperty(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA **prop);
|
||||||
|
@ -5471,6 +5471,38 @@ void uiContextActivePropertyHandle(bContext *C)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wmOperator *uiContextActiveOperator(const struct bContext *C)
|
||||||
|
{
|
||||||
|
ARegion *ar_ctx= CTX_wm_region(C);
|
||||||
|
uiBlock *block;
|
||||||
|
|
||||||
|
/* scan active regions ui */
|
||||||
|
for(block=ar_ctx->uiblocks.first; block; block=block->next) {
|
||||||
|
if (block->ui_operator) {
|
||||||
|
return block->ui_operator;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* scan popups */
|
||||||
|
{
|
||||||
|
bScreen *sc= CTX_wm_screen(C);
|
||||||
|
ARegion *ar;
|
||||||
|
|
||||||
|
for (ar= sc->regionbase.first; ar; ar= ar->next) {
|
||||||
|
if (ar == ar_ctx) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
for(block=ar->uiblocks.first; block; block=block->next) {
|
||||||
|
if (block->ui_operator) {
|
||||||
|
return block->ui_operator;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* helper function for insert keyframe, reset to default, etc operators */
|
/* helper function for insert keyframe, reset to default, etc operators */
|
||||||
void uiContextAnimUpdate(const bContext *C)
|
void uiContextAnimUpdate(const bContext *C)
|
||||||
{
|
{
|
||||||
|
@ -315,6 +315,9 @@ struct uiBlock {
|
|||||||
|
|
||||||
uiPopupBlockHandle *handle; // handle
|
uiPopupBlockHandle *handle; // handle
|
||||||
|
|
||||||
|
struct wmOperator *ui_operator;// use so presets can find the operator,
|
||||||
|
// across menus and from nested popups which fail for operator context.
|
||||||
|
|
||||||
void *evil_C; // XXX hack for dynamic operator enums
|
void *evil_C; // XXX hack for dynamic operator enums
|
||||||
|
|
||||||
struct UnitSettings *unit; // unit system, used a lot for numeric buttons so include here rather then fetching through the scene every time.
|
struct UnitSettings *unit; // unit system, used a lot for numeric buttons so include here rather then fetching through the scene every time.
|
||||||
|
@ -2767,6 +2767,8 @@ void uiLayoutOperatorButs(const bContext *C, uiLayout *layout, wmOperator *op,in
|
|||||||
PointerRNA op_ptr;
|
PointerRNA op_ptr;
|
||||||
uiLayout *row;
|
uiLayout *row;
|
||||||
|
|
||||||
|
uiLayoutGetBlock(layout)->ui_operator= op;
|
||||||
|
|
||||||
row= uiLayoutRow(layout, TRUE);
|
row= uiLayoutRow(layout, TRUE);
|
||||||
uiItemM(row, (bContext *)C, "WM_MT_operator_presets", NULL, ICON_NONE);
|
uiItemM(row, (bContext *)C, "WM_MT_operator_presets", NULL, ICON_NONE);
|
||||||
|
|
||||||
|
@ -53,6 +53,7 @@
|
|||||||
#include "ED_armature.h"
|
#include "ED_armature.h"
|
||||||
|
|
||||||
#include "WM_api.h"
|
#include "WM_api.h"
|
||||||
|
#include "UI_interface.h"
|
||||||
|
|
||||||
#include "screen_intern.h"
|
#include "screen_intern.h"
|
||||||
|
|
||||||
@ -399,6 +400,9 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
|
|||||||
if(sfile) {
|
if(sfile) {
|
||||||
op= sfile->op;
|
op= sfile->op;
|
||||||
}
|
}
|
||||||
|
else if ((op= uiContextActiveOperator(C))) {
|
||||||
|
/* do nothign */
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
/* note, this checks poll, could be a problem, but this also
|
/* note, this checks poll, could be a problem, but this also
|
||||||
* happens for the toolbar */
|
* happens for the toolbar */
|
||||||
|
Loading…
Reference in New Issue
Block a user