Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/windowmanager/intern')
-rw-r--r--source/blender/windowmanager/intern/wm.c3
-rw-r--r--source/blender/windowmanager/intern/wm_dragdrop.c19
-rw-r--r--source/blender/windowmanager/intern/wm_draw.c6
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c87
-rw-r--r--source/blender/windowmanager/intern/wm_files.c8
-rw-r--r--source/blender/windowmanager/intern/wm_gesture.c2
-rw-r--r--source/blender/windowmanager/intern/wm_init_exit.c3
-rw-r--r--source/blender/windowmanager/intern/wm_keymap.c137
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c262
-rw-r--r--source/blender/windowmanager/intern/wm_subwindow.c2
-rw-r--r--source/blender/windowmanager/intern/wm_window.c9
11 files changed, 406 insertions, 132 deletions
diff --git a/source/blender/windowmanager/intern/wm.c b/source/blender/windowmanager/intern/wm.c
index 28bddb47778..d05cc572c45 100644
--- a/source/blender/windowmanager/intern/wm.c
+++ b/source/blender/windowmanager/intern/wm.c
@@ -462,7 +462,8 @@ void wm_close_and_free(bContext *C, wmWindowManager *wm)
BLI_freelistN(&wm->queue);
BLI_freelistN(&wm->paintcursors);
- BLI_freelistN(&wm->drags);
+
+ WM_drag_free_list(&wm->drags);
wm_reports_free(wm);
diff --git a/source/blender/windowmanager/intern/wm_dragdrop.c b/source/blender/windowmanager/intern/wm_dragdrop.c
index 2aa177602cb..e5bba9285b4 100644
--- a/source/blender/windowmanager/intern/wm_dragdrop.c
+++ b/source/blender/windowmanager/intern/wm_dragdrop.c
@@ -143,7 +143,7 @@ void wm_dropbox_free(void)
/* *********************************** */
/* note that the pointer should be valid allocated and not on stack */
-wmDrag *WM_event_start_drag(struct bContext *C, int icon, int type, void *poin, double value)
+wmDrag *WM_event_start_drag(struct bContext *C, int icon, int type, void *poin, double value, unsigned int flags)
{
wmWindowManager *wm = CTX_wm_manager(C);
wmDrag *drag = MEM_callocN(sizeof(struct wmDrag), "new drag");
@@ -152,6 +152,7 @@ wmDrag *WM_event_start_drag(struct bContext *C, int icon, int type, void *poin,
/* if multiple drags are added, they're drawn as list */
BLI_addtail(&wm->drags, drag);
+ drag->flags = flags;
drag->icon = icon;
drag->type = type;
if (type == WM_DRAG_PATH)
@@ -171,6 +172,22 @@ void WM_event_drag_image(wmDrag *drag, ImBuf *imb, float scale, int sx, int sy)
drag->sy = sy;
}
+void WM_drag_free(wmDrag *drag)
+{
+ if ((drag->flags & WM_DRAG_FREE_DATA) && drag->poin) {
+ MEM_freeN(drag->poin);
+ }
+
+ MEM_freeN(drag);
+}
+
+void WM_drag_free_list(struct ListBase *lb)
+{
+ wmDrag *drag;
+ while ((drag = BLI_pophead(lb))) {
+ WM_drag_free(drag);
+ }
+}
static const char *dropbox_active(bContext *C, ListBase *handlers, wmDrag *drag, wmEvent *event)
{
diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c
index 4116bee4a5f..7440570f4a0 100644
--- a/source/blender/windowmanager/intern/wm_draw.c
+++ b/source/blender/windowmanager/intern/wm_draw.c
@@ -592,7 +592,7 @@ static void wm_method_draw_triple(bContext *C, wmWindow *win)
bScreen *screen = win->screen;
ScrArea *sa;
ARegion *ar;
- int copytex = 0, paintcursor = 1;
+ int copytex = 0;
if (win->drawdata) {
glClearColor(0, 0, 0, 0);
@@ -639,7 +639,7 @@ static void wm_method_draw_triple(bContext *C, wmWindow *win)
wm_triple_copy_textures(win, triple);
}
- if (paintcursor && wm->paintcursors.first) {
+ if (wm->paintcursors.first) {
for (sa = screen->areabase.first; sa; sa = sa->next) {
for (ar = sa->regionbase.first; ar; ar = ar->next) {
if (ar->swinid && ar->swinid == screen->subwinactive) {
@@ -685,8 +685,6 @@ static void wm_method_draw_triple(bContext *C, wmWindow *win)
CTX_wm_menu_set(C, ar);
ED_region_do_draw(C, ar);
CTX_wm_menu_set(C, NULL);
- /* when a menu is being drawn, don't do the paint cursors */
- paintcursor = 0;
}
}
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 4b2ec0ef587..ab4b21d5e33 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -111,10 +111,13 @@ void wm_event_free(wmEvent *event)
if (event->customdata) {
if (event->customdatafree) {
/* note: pointer to listbase struct elsewhere */
- if (event->custom == EVT_DATA_LISTBASE)
- BLI_freelistN(event->customdata);
- else
+ if (event->custom == EVT_DATA_DRAGDROP) {
+ ListBase *lb = event->customdata;
+ WM_drag_free_list(lb);
+ }
+ else {
MEM_freeN(event->customdata);
+ }
}
}
@@ -289,7 +292,7 @@ void wm_event_do_notifiers(bContext *C)
do_anim = true;
}
}
- if (ELEM5(note->category, NC_SCENE, NC_OBJECT, NC_GEOM, NC_SCENE, NC_WM)) {
+ if (ELEM(note->category, NC_SCENE, NC_OBJECT, NC_GEOM, NC_SCENE, NC_WM)) {
ED_info_stats_clear(win->screen->scene);
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_INFO, NULL);
}
@@ -393,13 +396,17 @@ static int wm_handler_ui_call(bContext *C, wmEventHandler *handler, wmEvent *eve
ARegion *region = CTX_wm_region(C);
ARegion *menu = CTX_wm_menu(C);
static bool do_wheel_ui = true;
- const bool is_wheel = ELEM3(event->type, WHEELUPMOUSE, WHEELDOWNMOUSE, MOUSEPAN);
+ const bool is_wheel = ELEM(event->type, WHEELUPMOUSE, WHEELDOWNMOUSE, MOUSEPAN);
int retval;
/* UI code doesn't handle return values - it just always returns break.
* to make the DBL_CLICK conversion work, we just don't send this to UI, except mouse clicks */
- if (event->type != LEFTMOUSE && event->val == KM_DBL_CLICK)
+ if (((handler->flag & WM_HANDLER_ACCEPT_DBL_CLICK) == 0) &&
+ (event->type != LEFTMOUSE) &&
+ (event->val == KM_DBL_CLICK))
+ {
return WM_HANDLER_CONTINUE;
+ }
/* UI is quite aggressive with swallowing events, like scrollwheel */
/* I realize this is not extremely nice code... when UI gets keymaps it can be maybe smarter */
@@ -1261,11 +1268,17 @@ static int wm_operator_call_internal(bContext *C, wmOperatorType *ot, PointerRNA
/* invokes operator in context */
+int WM_operator_name_call_ptr(bContext *C, wmOperatorType *ot, short context, PointerRNA *properties)
+{
+ BLI_assert(ot == WM_operatortype_find(ot->idname, true));
+ return wm_operator_call_internal(C, ot, properties, NULL, context, false);
+}
int WM_operator_name_call(bContext *C, const char *opstring, short context, PointerRNA *properties)
{
wmOperatorType *ot = WM_operatortype_find(opstring, 0);
- if (ot)
- return wm_operator_call_internal(C, ot, properties, NULL, context, false);
+ if (ot) {
+ return WM_operator_name_call_ptr(C, ot, context, properties);
+ }
return 0;
}
@@ -1928,17 +1941,17 @@ static int wm_handlers_do_intern(bContext *C, wmEvent *event, ListBase *handlers
wmDropBox *drop = handler->dropboxes->first;
for (; drop; drop = drop->next) {
/* other drop custom types allowed */
- if (event->custom == EVT_DATA_LISTBASE) {
+ if (event->custom == EVT_DATA_DRAGDROP) {
ListBase *lb = (ListBase *)event->customdata;
wmDrag *drag;
for (drag = lb->first; drag; drag = drag->next) {
if (drop->poll(C, drag, event)) {
-
drop->copy(drag, drop);
/* free the drags before calling operator */
- BLI_freelistN(event->customdata);
+ WM_drag_free_list(lb);
+
event->customdata = NULL;
event->custom = 0;
@@ -2004,7 +2017,7 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers)
if (CTX_wm_window(C) == NULL)
return action;
- if (!ELEM3(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE, EVENT_NONE) && !ISTIMER(event->type)) {
+ if (!ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE, EVENT_NONE) && !ISTIMER(event->type)) {
/* test for CLICK events */
if (wm_action_not_handled(action)) {
@@ -2140,10 +2153,12 @@ static void wm_event_drag_test(wmWindowManager *wm, wmWindow *win, wmEvent *even
return;
}
- if (event->type == MOUSEMOVE || ISKEYMODIFIER(event->type))
+ if (event->type == MOUSEMOVE || ISKEYMODIFIER(event->type)) {
win->screen->do_draw_drag = true;
+ }
else if (event->type == ESCKEY) {
- BLI_freelistN(&wm->drags);
+ WM_drag_free_list(&wm->drags);
+
win->screen->do_draw_drag = true;
}
else if (event->type == LEFTMOUSE && event->val == KM_RELEASE) {
@@ -2155,7 +2170,7 @@ static void wm_event_drag_test(wmWindowManager *wm, wmWindow *win, wmEvent *even
MEM_freeN(event->customdata);
}
- event->custom = EVT_DATA_LISTBASE;
+ event->custom = EVT_DATA_DRAGDROP;
event->customdata = &wm->drags;
event->customdatafree = 1;
@@ -2552,7 +2567,7 @@ void WM_event_remove_keymap_handler(ListBase *handlers, wmKeyMap *keymap)
wmEventHandler *WM_event_add_ui_handler(
const bContext *C, ListBase *handlers,
wmUIHandlerFunc ui_handle, wmUIHandlerRemoveFunc ui_remove,
- void *userdata)
+ void *userdata, const bool accept_dbl_click)
{
wmEventHandler *handler = MEM_callocN(sizeof(wmEventHandler), "event ui handler");
handler->ui_handle = ui_handle;
@@ -2569,6 +2584,9 @@ wmEventHandler *WM_event_add_ui_handler(
handler->ui_menu = NULL;
}
+ if (accept_dbl_click) {
+ handler->flag |= WM_HANDLER_ACCEPT_DBL_CLICK;
+ }
BLI_addhead(handlers, handler);
@@ -2688,7 +2706,7 @@ bool WM_modal_tweak_exit(const wmEvent *event, int tweak_event)
else {
/* if the initial event wasn't a tweak event then
* ignore USER_RELEASECONFIRM setting: see [#26756] */
- if (ELEM3(tweak_event, EVT_TWEAK_L, EVT_TWEAK_M, EVT_TWEAK_R) == 0) {
+ if (ELEM(tweak_event, EVT_TWEAK_L, EVT_TWEAK_M, EVT_TWEAK_R) == 0) {
return 1;
}
}
@@ -3398,4 +3416,39 @@ void WM_event_ndof_to_quat(const struct wmNDOFMotionData *ndof, float q[4])
axis_angle_to_quat(q, axis, angle);
}
+/* if this is a tablet event, return tablet pressure and set *pen_flip
+ * to 1 if the eraser tool is being used, 0 otherwise */
+float WM_event_tablet_data(const wmEvent *event, int *pen_flip, float tilt[2])
+{
+ int erasor = 0;
+ float pressure = 1;
+
+ if (tilt)
+ zero_v2(tilt);
+
+ if (event->tablet_data) {
+ wmTabletData *wmtab = event->tablet_data;
+
+ erasor = (wmtab->Active == EVT_TABLET_ERASER);
+ if (wmtab->Active != EVT_TABLET_NONE) {
+ pressure = wmtab->Pressure;
+ if (tilt) {
+ tilt[0] = wmtab->Xtilt;
+ tilt[1] = wmtab->Ytilt;
+ }
+ }
+ }
+
+ if (pen_flip)
+ (*pen_flip) = erasor;
+
+ return pressure;
+}
+
+bool WM_event_is_tablet(const struct wmEvent *event)
+{
+ return (event->tablet_data) ? true : false;
+}
+
+
/** \} */
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index 0bc6442348c..832fef404e3 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -278,11 +278,13 @@ static void wm_window_match_do(bContext *C, ListBase *oldwmlist)
/* in case UserDef was read, we re-initialize all, and do versioning */
static void wm_init_userdef(bContext *C, const bool from_memory)
{
+ Main *bmain = CTX_data_main(C);
+
/* versioning is here */
UI_init_userdef();
MEM_CacheLimiter_set_maximum(((size_t)U.memcachelimit) * 1024 * 1024);
- sound_init(CTX_data_main(C));
+ sound_init(bmain);
/* needed so loading a file from the command line respects user-pref [#26156] */
BKE_BIT_TEST_SET(G.fileflags, U.flag & USER_FILENOUI, G_FILE_NO_UI);
@@ -295,7 +297,7 @@ static void wm_init_userdef(bContext *C, const bool from_memory)
/* avoid re-saving for every small change to our prefs, allow overrides */
if (from_memory) {
- UI_init_userdef_factory();
+ BLO_update_defaults_userpref_blend();
}
/* update tempdir from user preferences */
@@ -457,6 +459,7 @@ bool WM_file_read(bContext *C, const char *filepath, ReportList *reports)
#endif
/* important to do before NULL'ing the context */
+ BLI_callback_exec(CTX_data_main(C), NULL, BLI_CB_EVT_VERSION_UPDATE);
BLI_callback_exec(CTX_data_main(C), NULL, BLI_CB_EVT_LOAD_POST);
if (!G.background) {
@@ -648,6 +651,7 @@ int wm_homefile_read(bContext *C, ReportList *reports, bool from_memory, const c
#endif
/* important to do before NULL'ing the context */
+ BLI_callback_exec(CTX_data_main(C), NULL, BLI_CB_EVT_VERSION_UPDATE);
BLI_callback_exec(CTX_data_main(C), NULL, BLI_CB_EVT_LOAD_POST);
WM_event_add_notifier(C, NC_WM | ND_FILEREAD, NULL);
diff --git a/source/blender/windowmanager/intern/wm_gesture.c b/source/blender/windowmanager/intern/wm_gesture.c
index c9ef473a442..3e287a3907b 100644
--- a/source/blender/windowmanager/intern/wm_gesture.c
+++ b/source/blender/windowmanager/intern/wm_gesture.c
@@ -74,7 +74,7 @@ wmGesture *WM_gesture_new(bContext *C, const wmEvent *event, int type)
wm_subwindow_origin_get(window, gesture->swinid, &sx, &sy);
- if (ELEM5(type, WM_GESTURE_RECT, WM_GESTURE_CROSS_RECT, WM_GESTURE_TWEAK,
+ if (ELEM(type, WM_GESTURE_RECT, WM_GESTURE_CROSS_RECT, WM_GESTURE_TWEAK,
WM_GESTURE_CIRCLE, WM_GESTURE_STRAIGHTLINE))
{
rcti *rect = MEM_callocN(sizeof(rcti), "gesture rect new");
diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c
index b2c822f501c..6720bf89c77 100644
--- a/source/blender/windowmanager/intern/wm_init_exit.c
+++ b/source/blender/windowmanager/intern/wm_init_exit.c
@@ -188,6 +188,8 @@ void WM_init(bContext *C, int argc, const char **argv)
(void)argv; /* unused */
#endif
+ ED_spacemacros_init();
+
if (!G.background && !wm_start_with_console)
GHOST_toggleConsole(3);
@@ -236,6 +238,7 @@ void WM_init(bContext *C, int argc, const char **argv)
*
* unlikely any handlers are set but its possible,
* note that recovering the last session does its own callbacks. */
+ BLI_callback_exec(CTX_data_main(C), NULL, BLI_CB_EVT_VERSION_UPDATE);
BLI_callback_exec(CTX_data_main(C), NULL, BLI_CB_EVT_LOAD_POST);
}
}
diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c
index 0163517545f..7b567142979 100644
--- a/source/blender/windowmanager/intern/wm_keymap.c
+++ b/source/blender/windowmanager/intern/wm_keymap.c
@@ -464,6 +464,13 @@ wmKeyMapItem *WM_keymap_add_menu(wmKeyMap *keymap, const char *idname, int type,
return kmi;
}
+wmKeyMapItem *WM_keymap_add_menu_pie(wmKeyMap *keymap, const char *idname, int type, int val, int modifier, int keymodifier)
+{
+ wmKeyMapItem *kmi = WM_keymap_add_item(keymap, "WM_OT_call_menu_pie", type, val, modifier, keymodifier);
+ RNA_string_set(kmi->ptr, "name", idname);
+ return kmi;
+}
+
bool WM_keymap_remove_item(wmKeyMap *keymap, wmKeyMapItem *kmi)
{
if (BLI_findindex(&keymap->items, kmi) != -1) {
@@ -1108,9 +1115,9 @@ int WM_keymap_item_compare(wmKeyMapItem *k1, wmKeyMapItem *k2)
if (k1->val != KM_ANY && k2->val != KM_ANY) {
/* take click, press, release conflict into account */
- if (k1->val == KM_CLICK && ELEM3(k2->val, KM_PRESS, KM_RELEASE, KM_CLICK) == 0)
+ if (k1->val == KM_CLICK && ELEM(k2->val, KM_PRESS, KM_RELEASE, KM_CLICK) == 0)
return 0;
- if (k2->val == KM_CLICK && ELEM3(k1->val, KM_PRESS, KM_RELEASE, KM_CLICK) == 0)
+ if (k2->val == KM_CLICK && ELEM(k1->val, KM_PRESS, KM_RELEASE, KM_CLICK) == 0)
return 0;
if (k1->val != k2->val)
return 0;
@@ -1414,46 +1421,73 @@ wmKeyMapItem *WM_keymap_item_find_id(wmKeyMap *keymap, int id)
/* Needs to be kept up to date with Keymap and Operator naming */
wmKeyMap *WM_keymap_guess_opname(const bContext *C, const char *opname)
{
+ /* Op types purposely skipped for now:
+ * BRUSH_OT
+ * BOID_OT
+ * BUTTONS_OT
+ * CONSTRAINT_OT
+ * DPAINT_OT
+ * ED_OT
+ * FLUID_OT
+ * TEXTURE_OT
+ * UI_OT
+ * VIEW2D_OT
+ * WORLD_OT
+ */
+
wmKeyMap *km = NULL;
SpaceLink *sl = CTX_wm_space_data(C);
/* Window */
- if (strstr(opname, "WM_OT")) {
+ if (STRPREFIX(opname, "WM_OT")) {
km = WM_keymap_find_all(C, "Window", 0, 0);
}
- /* Screen */
- else if (strstr(opname, "SCREEN_OT")) {
+ /* Screen & Render */
+ else if (STRPREFIX(opname, "SCREEN_OT") ||
+ STRPREFIX(opname, "RENDER_OT") ||
+ STRPREFIX(opname, "SOUND_OT") ||
+ STRPREFIX(opname, "SCENE_OT"))
+ {
km = WM_keymap_find_all(C, "Screen", 0, 0);
}
/* Grease Pencil */
- else if (strstr(opname, "GPENCIL_OT")) {
+ else if (STRPREFIX(opname, "GPENCIL_OT")) {
km = WM_keymap_find_all(C, "Grease Pencil", 0, 0);
}
/* Markers */
- else if (strstr(opname, "MARKER_OT")) {
+ else if (STRPREFIX(opname, "MARKER_OT")) {
km = WM_keymap_find_all(C, "Markers", 0, 0);
}
/* Import/Export*/
- else if (strstr(opname, "IMPORT_") || strstr(opname, "EXPORT_")) {
+ else if (STRPREFIX(opname, "IMPORT_") ||
+ STRPREFIX(opname, "EXPORT_"))
+ {
km = WM_keymap_find_all(C, "Window", 0, 0);
}
/* 3D View */
- else if (strstr(opname, "VIEW3D_OT")) {
+ else if (STRPREFIX(opname, "VIEW3D_OT")) {
km = WM_keymap_find_all(C, "3D View", sl->spacetype, 0);
}
- else if (strstr(opname, "OBJECT_OT")) {
+ else if (STRPREFIX(opname, "OBJECT_OT")) {
/* exception, this needs to work outside object mode too */
- if (strstr(opname, "OBJECT_OT_mode_set"))
+ if (STRPREFIX(opname, "OBJECT_OT_mode_set"))
km = WM_keymap_find_all(C, "Object Non-modal", 0, 0);
else
km = WM_keymap_find_all(C, "Object Mode", 0, 0);
}
-
+ /* Object mode related */
+ else if (STRPREFIX(opname, "GROUP_OT") ||
+ STRPREFIX(opname, "MATERIAL_OT") ||
+ STRPREFIX(opname, "PTCACHE_OT") ||
+ STRPREFIX(opname, "RIGIDBODY_OT"))
+ {
+ km = WM_keymap_find_all(C, "Object Mode", 0, 0);
+ }
/* Editing Modes */
- else if (strstr(opname, "MESH_OT")) {
+ else if (STRPREFIX(opname, "MESH_OT")) {
km = WM_keymap_find_all(C, "Mesh", 0, 0);
/* some mesh operators are active in object mode too, like add-prim */
@@ -1461,7 +1495,9 @@ wmKeyMap *WM_keymap_guess_opname(const bContext *C, const char *opname)
km = WM_keymap_find_all(C, "Object Mode", 0, 0);
}
}
- else if (strstr(opname, "CURVE_OT")) {
+ else if (STRPREFIX(opname, "CURVE_OT") ||
+ STRPREFIX(opname, "SURFACE_OT"))
+ {
km = WM_keymap_find_all(C, "Curve", 0, 0);
/* some curve operators are active in object mode too, like add-prim */
@@ -1469,13 +1505,17 @@ wmKeyMap *WM_keymap_guess_opname(const bContext *C, const char *opname)
km = WM_keymap_find_all(C, "Object Mode", 0, 0);
}
}
- else if (strstr(opname, "ARMATURE_OT")) {
+ else if (STRPREFIX(opname, "ARMATURE_OT") ||
+ STRPREFIX(opname, "SKETCH_OT"))
+ {
km = WM_keymap_find_all(C, "Armature", 0, 0);
}
- else if (strstr(opname, "POSE_OT")) {
+ else if (STRPREFIX(opname, "POSE_OT") ||
+ STRPREFIX(opname, "POSELIB_OT"))
+ {
km = WM_keymap_find_all(C, "Pose", 0, 0);
}
- else if (strstr(opname, "SCULPT_OT")) {
+ else if (STRPREFIX(opname, "SCULPT_OT")) {
switch (CTX_data_mode_enum(C)) {
case OB_MODE_SCULPT:
km = WM_keymap_find_all(C, "Sculpt", 0, 0);
@@ -1485,7 +1525,7 @@ wmKeyMap *WM_keymap_guess_opname(const bContext *C, const char *opname)
break;
}
}
- else if (strstr(opname, "MBALL_OT")) {
+ else if (STRPREFIX(opname, "MBALL_OT")) {
km = WM_keymap_find_all(C, "Metaball", 0, 0);
/* some mball operators are active in object mode too, like add-prim */
@@ -1493,16 +1533,16 @@ wmKeyMap *WM_keymap_guess_opname(const bContext *C, const char *opname)
km = WM_keymap_find_all(C, "Object Mode", 0, 0);
}
}
- else if (strstr(opname, "LATTICE_OT")) {
+ else if (STRPREFIX(opname, "LATTICE_OT")) {
km = WM_keymap_find_all(C, "Lattice", 0, 0);
}
- else if (strstr(opname, "PARTICLE_OT")) {
+ else if (STRPREFIX(opname, "PARTICLE_OT")) {
km = WM_keymap_find_all(C, "Particle", 0, 0);
}
- else if (strstr(opname, "FONT_OT")) {
+ else if (STRPREFIX(opname, "FONT_OT")) {
km = WM_keymap_find_all(C, "Font", 0, 0);
}
- else if (strstr(opname, "PAINT_OT")) {
+ else if (STRPREFIX(opname, "PAINT_OT")) {
/* check for relevant mode */
switch (CTX_data_mode_enum(C)) {
@@ -1518,69 +1558,86 @@ wmKeyMap *WM_keymap_guess_opname(const bContext *C, const char *opname)
}
}
/* Paint Face Mask */
- else if (strstr(opname, "PAINT_OT_face_select")) {
+ else if (STRPREFIX(opname, "PAINT_OT_face_select")) {
km = WM_keymap_find_all(C, "Face Mask", sl->spacetype, 0);
}
/* Timeline */
- else if (strstr(opname, "TIME_OT")) {
+ else if (STRPREFIX(opname, "TIME_OT")) {
km = WM_keymap_find_all(C, "Timeline", sl->spacetype, 0);
}
/* Image Editor */
- else if (strstr(opname, "IMAGE_OT")) {
+ else if (STRPREFIX(opname, "IMAGE_OT")) {
km = WM_keymap_find_all(C, "Image", sl->spacetype, 0);
}
+ /* Clip Editor */
+ else if (STRPREFIX(opname, "CLIP_OT")) {
+ km = WM_keymap_find_all(C, "Clip", sl->spacetype, 0);
+ }
+ else if (STRPREFIX(opname, "MASK_OT")) {
+ km = WM_keymap_find_all(C, "Mask Editing", 0, 0);
+ }
/* UV Editor */
- else if (strstr(opname, "UV_OT")) {
+ else if (STRPREFIX(opname, "UV_OT")) {
km = WM_keymap_find_all(C, "UV Editor", sl->spacetype, 0);
}
/* Node Editor */
- else if (strstr(opname, "NODE_OT")) {
+ else if (STRPREFIX(opname, "NODE_OT")) {
km = WM_keymap_find_all(C, "Node Editor", sl->spacetype, 0);
}
/* Animation Editor Channels */
- else if (strstr(opname, "ANIM_OT_channels")) {
+ else if (STRPREFIX(opname, "ANIM_OT_channels")) {
km = WM_keymap_find_all(C, "Animation Channels", sl->spacetype, 0);
}
/* Animation Generic - after channels */
- else if (strstr(opname, "ANIM_OT")) {
+ else if (STRPREFIX(opname, "ANIM_OT")) {
km = WM_keymap_find_all(C, "Animation", 0, 0);
}
/* Graph Editor */
- else if (strstr(opname, "GRAPH_OT")) {
+ else if (STRPREFIX(opname, "GRAPH_OT")) {
km = WM_keymap_find_all(C, "Graph Editor", sl->spacetype, 0);
}
/* Dopesheet Editor */
- else if (strstr(opname, "ACTION_OT")) {
+ else if (STRPREFIX(opname, "ACTION_OT")) {
km = WM_keymap_find_all(C, "Dopesheet", sl->spacetype, 0);
}
/* NLA Editor */
- else if (strstr(opname, "NLA_OT")) {
+ else if (STRPREFIX(opname, "NLA_OT")) {
km = WM_keymap_find_all(C, "NLA Editor", sl->spacetype, 0);
}
/* Script */
- else if (strstr(opname, "SCRIPT_OT")) {
+ else if (STRPREFIX(opname, "SCRIPT_OT")) {
km = WM_keymap_find_all(C, "Script", sl->spacetype, 0);
}
/* Text */
- else if (strstr(opname, "TEXT_OT")) {
+ else if (STRPREFIX(opname, "TEXT_OT")) {
km = WM_keymap_find_all(C, "Text", sl->spacetype, 0);
}
/* Sequencer */
- else if (strstr(opname, "SEQUENCER_OT")) {
+ else if (STRPREFIX(opname, "SEQUENCER_OT")) {
km = WM_keymap_find_all(C, "Sequencer", sl->spacetype, 0);
}
/* Console */
- else if (strstr(opname, "CONSOLE_OT")) {
+ else if (STRPREFIX(opname, "CONSOLE_OT")) {
km = WM_keymap_find_all(C, "Console", sl->spacetype, 0);
}
/* Console */
- else if (strstr(opname, "INFO_OT")) {
+ else if (STRPREFIX(opname, "INFO_OT")) {
km = WM_keymap_find_all(C, "Info", sl->spacetype, 0);
}
-
+ /* File browser */
+ else if (STRPREFIX(opname, "FILE_OT")) {
+ km = WM_keymap_find_all(C, "File Browser", sl->spacetype, 0);
+ }
+ /* Logic Editor */
+ else if (STRPREFIX(opname, "LOGIC_OT")) {
+ km = WM_keymap_find_all(C, "Logic Editor", sl->spacetype, 0);
+ }
+ /* Outliner */
+ else if (STRPREFIX(opname, "OUTLINER_OT")) {
+ km = WM_keymap_find_all(C, "Outliner", sl->spacetype, 0);
+ }
/* Transform */
- else if (strstr(opname, "TRANSFORM_OT")) {
-
+ else if (STRPREFIX(opname, "TRANSFORM_OT")) {
/* check for relevant editor */
switch (sl->spacetype) {
case SPACE_VIEW3D:
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index ba454bb1818..bc79879f1f4 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -56,6 +56,7 @@
#include "PIL_time.h"
#include "BLI_blenlib.h"
+#include "BLI_dial.h"
#include "BLI_dynstr.h" /*for WM_operator_pystring */
#include "BLI_math.h"
#include "BLI_utildefines.h"
@@ -501,7 +502,7 @@ void WM_operator_py_idname(char *to, const char *from)
int ofs = (sep - from);
/* note, we use ascii tolower instead of system tolower, because the
- * latter depends on the locale, and can lead to idname mistmatch */
+ * latter depends on the locale, and can lead to idname mismatch */
memcpy(to, from, sizeof(char) * ofs);
BLI_ascii_strtolower(to, ofs);
@@ -1312,9 +1313,14 @@ void WM_operator_properties_gesture_border(wmOperatorType *ot, bool extend)
void WM_operator_properties_mouse_select(wmOperatorType *ot)
{
- RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend selection instead of deselecting everything first");
- RNA_def_boolean(ot->srna, "deselect", 0, "Deselect", "Remove from selection");
- RNA_def_boolean(ot->srna, "toggle", 0, "Toggle Selection", "Toggle the selection");
+ PropertyRNA *prop;
+
+ prop = RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend selection instead of deselecting everything first");
+ RNA_def_property_flag(prop, PROP_SKIP_SAVE);
+ prop = RNA_def_boolean(ot->srna, "deselect", 0, "Deselect", "Remove from selection");
+ RNA_def_property_flag(prop, PROP_SKIP_SAVE);
+ prop = RNA_def_boolean(ot->srna, "toggle", 0, "Toggle Selection", "Toggle the selection");
+ RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
void WM_operator_properties_gesture_straightline(wmOperatorType *ot, int cursor)
@@ -2049,6 +2055,41 @@ static void WM_OT_call_menu(wmOperatorType *ot)
RNA_def_string(ot->srna, "name", NULL, BKE_ST_MAXNAME, "Name", "Name of the menu");
}
+static int wm_call_pie_menu_invoke(bContext *C, wmOperator *op, const wmEvent *event)
+{
+ char idname[BKE_ST_MAXNAME];
+ RNA_string_get(op->ptr, "name", idname);
+
+ uiPieMenuInvoke(C, idname, event);
+
+ return OPERATOR_CANCELLED;
+}
+
+static int wm_call_pie_menu_exec(bContext *C, wmOperator *op)
+{
+ char idname[BKE_ST_MAXNAME];
+ RNA_string_get(op->ptr, "name", idname);
+
+ uiPieMenuInvoke(C, idname, CTX_wm_window(C)->eventstate);
+
+ return OPERATOR_CANCELLED;
+}
+
+static void WM_OT_call_menu_pie(wmOperatorType *ot)
+{
+ ot->name = "Call Pie Menu";
+ ot->idname = "WM_OT_call_menu_pie";
+ ot->description = "Call (draw) a pre-defined pie menu";
+
+ ot->invoke = wm_call_pie_menu_invoke;
+ ot->exec = wm_call_pie_menu_exec;
+ ot->poll = WM_operator_winactive;
+
+ ot->flag = OPTYPE_INTERNAL;
+
+ RNA_def_string(ot->srna, "name", NULL, BKE_ST_MAXNAME, "Name", "Name of the pie menu");
+}
+
/* ************ window / screen operator definitions ************** */
/* this poll functions is needed in place of WM_operator_winactive
@@ -2336,8 +2377,8 @@ static void WM_OT_open_mainfile(wmOperatorType *ot)
WM_operator_properties_filesel(ot, FOLDERFILE | BLENDERFILE, FILE_BLENDER, FILE_OPENFILE,
WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
- RNA_def_boolean(ot->srna, "load_ui", 1, "Load UI", "Load user interface setup in the .blend file");
- RNA_def_boolean(ot->srna, "use_scripts", 1, "Trusted Source",
+ RNA_def_boolean(ot->srna, "load_ui", true, "Load UI", "Load user interface setup in the .blend file");
+ RNA_def_boolean(ot->srna, "use_scripts", true, "Trusted Source",
"Allow .blend file to execute scripts automatically, default available from system preferences");
}
@@ -2348,7 +2389,14 @@ static int wm_revert_mainfile_exec(bContext *C, wmOperator *op)
{
bool success;
- success = wm_file_read_opwrap(C, G.main->name, op->reports, true);
+ wm_open_init_use_scripts(op, false);
+
+ if (RNA_boolean_get(op->ptr, "use_scripts"))
+ G.f |= G_SCRIPT_AUTOEXEC;
+ else
+ G.f &= ~G_SCRIPT_AUTOEXEC;
+
+ success = wm_file_read_opwrap(C, G.main->name, op->reports, !(G.f & G_SCRIPT_AUTOEXEC));
if (success) {
return OPERATOR_FINISHED;
@@ -2370,6 +2418,9 @@ static void WM_OT_revert_mainfile(wmOperatorType *ot)
ot->description = "Reload the saved file";
ot->invoke = WM_operator_confirm;
+ RNA_def_boolean(ot->srna, "use_scripts", true, "Trusted Source",
+ "Allow .blend file to execute scripts automatically, default available from system preferences");
+
ot->exec = wm_revert_mainfile_exec;
ot->poll = wm_revert_mainfile_poll;
}
@@ -2419,7 +2470,7 @@ static short wm_link_append_flag(wmOperator *op)
if (RNA_boolean_get(op->ptr, "autoselect")) flag |= FILE_AUTOSELECT;
if (RNA_boolean_get(op->ptr, "active_layer")) flag |= FILE_ACTIVELAY;
- if (RNA_boolean_get(op->ptr, "relative_path")) flag |= FILE_RELPATH;
+ if (RNA_struct_find_property(op->ptr, "relative_path") && RNA_boolean_get(op->ptr, "relative_path")) flag |= FILE_RELPATH;
if (RNA_boolean_get(op->ptr, "link")) flag |= FILE_LINK;
if (RNA_boolean_get(op->ptr, "instance_groups")) flag |= FILE_GROUP_INSTANCE;
@@ -2550,13 +2601,31 @@ static int wm_link_append_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static void WM_OT_link_append(wmOperatorType *ot)
+static void wm_link_append_properties_common(wmOperatorType *ot, bool is_link)
{
PropertyRNA *prop;
- ot->name = "Link/Append from Library";
- ot->idname = "WM_OT_link_append";
- ot->description = "Link or Append from a Library .blend file";
+ /* better not save _any_ settings for this operator */
+ /* properties */
+ prop = RNA_def_boolean(ot->srna, "link", is_link,
+ "Link", "Link the objects or datablocks rather than appending");
+ RNA_def_property_flag(prop, PROP_SKIP_SAVE | PROP_HIDDEN);
+ prop = RNA_def_boolean(ot->srna, "autoselect", true,
+ "Select", "Select new objects");
+ RNA_def_property_flag(prop, PROP_SKIP_SAVE);
+ prop = RNA_def_boolean(ot->srna, "active_layer", true,
+ "Active Layer", "Put new objects on the active layer");
+ RNA_def_property_flag(prop, PROP_SKIP_SAVE);
+ prop = RNA_def_boolean(ot->srna, "instance_groups", is_link,
+ "Instance Groups", "Create Dupli-Group instances for each group");
+ RNA_def_property_flag(prop, PROP_SKIP_SAVE);
+}
+
+static void WM_OT_link(wmOperatorType *ot)
+{
+ ot->name = "Link from Library";
+ ot->idname = "WM_OT_link";
+ ot->description = "Link from a Library .blend file";
ot->invoke = wm_link_append_invoke;
ot->exec = wm_link_append_exec;
@@ -2569,16 +2638,27 @@ static void WM_OT_link_append(wmOperatorType *ot)
WM_FILESEL_FILEPATH | WM_FILESEL_DIRECTORY | WM_FILESEL_FILENAME | WM_FILESEL_RELPATH | WM_FILESEL_FILES,
FILE_DEFAULTDISPLAY);
- /* better not save _any_ settings for this operator */
- /* properties */
- prop = RNA_def_boolean(ot->srna, "link", 1, "Link", "Link the objects or datablocks rather than appending");
- RNA_def_property_flag(prop, PROP_SKIP_SAVE | PROP_HIDDEN);
- prop = RNA_def_boolean(ot->srna, "autoselect", 1, "Select", "Select the linked objects");
- RNA_def_property_flag(prop, PROP_SKIP_SAVE);
- prop = RNA_def_boolean(ot->srna, "active_layer", 1, "Active Layer", "Put the linked objects on the active layer");
- RNA_def_property_flag(prop, PROP_SKIP_SAVE);
- prop = RNA_def_boolean(ot->srna, "instance_groups", 1, "Instance Groups", "Create instances for each group as a DupliGroup");
- RNA_def_property_flag(prop, PROP_SKIP_SAVE);
+ wm_link_append_properties_common(ot, true);
+}
+
+static void WM_OT_append(wmOperatorType *ot)
+{
+ ot->name = "Append from Library";
+ ot->idname = "WM_OT_append";
+ ot->description = "Append from a Library .blend file";
+
+ ot->invoke = wm_link_append_invoke;
+ ot->exec = wm_link_append_exec;
+ ot->poll = wm_link_append_poll;
+
+ ot->flag |= OPTYPE_UNDO;
+
+ WM_operator_properties_filesel(
+ ot, FOLDERFILE | BLENDERFILE, FILE_LOADLIB, FILE_OPENFILE,
+ WM_FILESEL_FILEPATH | WM_FILESEL_DIRECTORY | WM_FILESEL_FILENAME | WM_FILESEL_FILES,
+ FILE_DEFAULTDISPLAY);
+
+ wm_link_append_properties_common(ot, false);
}
/* *************** recover last session **************** */
@@ -3291,7 +3371,7 @@ void wm_tweakevent_test(bContext *C, wmEvent *event, int action)
if (win->tweak == NULL) {
if (CTX_wm_region(C)) {
if (event->val == KM_PRESS) {
- if (ELEM3(event->type, LEFTMOUSE, MIDDLEMOUSE, RIGHTMOUSE)) {
+ if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE, RIGHTMOUSE)) {
win->tweak = WM_gesture_new(C, event, WM_GESTURE_TWEAK);
}
}
@@ -3642,6 +3722,9 @@ typedef struct {
StructRNA *image_id_srna;
float initial_value, current_value, min_value, max_value;
int initial_mouse[2];
+ int slow_mouse[2];
+ bool slow_mode;
+ Dial *dial;
unsigned int gltex;
ListBase orig_paintcursors;
bool use_secondary_tex;
@@ -4032,7 +4115,7 @@ static int radial_control_invoke(bContext *C, wmOperator *op, const wmEvent *eve
/* get subtype of property */
rc->subtype = RNA_property_subtype(rc->prop);
- if (!ELEM5(rc->subtype, PROP_NONE, PROP_DISTANCE, PROP_FACTOR, PROP_ANGLE, PROP_PIXEL)) {
+ if (!ELEM(rc->subtype, PROP_NONE, PROP_DISTANCE, PROP_FACTOR, PROP_ANGLE, PROP_PIXEL)) {
BKE_report(op->reports, RPT_ERROR, "Property must be a none, distance, a factor, or an angle");
MEM_freeN(rc);
return OPERATOR_CANCELLED;
@@ -4075,6 +4158,11 @@ static void radial_control_cancel(bContext *C, wmOperator *op)
RadialControl *rc = op->customdata;
wmWindowManager *wm = CTX_wm_manager(C);
+ if (rc->dial) {
+ MEM_freeN(rc->dial);
+ rc->dial = NULL;
+ }
+
WM_paint_cursor_end(wm, rc->cursor);
/* restore original paint cursors */
@@ -4094,24 +4182,61 @@ static int radial_control_modal(bContext *C, wmOperator *op, const wmEvent *even
{
RadialControl *rc = op->customdata;
float new_value, dist, zoom[2];
- float delta[2], snap, ret = OPERATOR_RUNNING_MODAL;
-
+ float delta[2], ret = OPERATOR_RUNNING_MODAL;
+ bool snap;
+ float angle_precision = 0.0f;
/* TODO: fix hardcoded events */
- snap = event->ctrl;
+ snap = event->ctrl != 0;
switch (event->type) {
case MOUSEMOVE:
- delta[0] = rc->initial_mouse[0] - event->x;
- delta[1] = rc->initial_mouse[1] - event->y;
-
- if (rc->zoom_prop) {
- RNA_property_float_get_array(&rc->zoom_ptr, rc->zoom_prop, zoom);
- delta[0] /= zoom[0];
- delta[1] /= zoom[1];
+ if (rc->slow_mode) {
+ if (rc->subtype == PROP_ANGLE) {
+ float position[2] = {event->x, event->y};
+
+ /* calculate the initial angle here first */
+ delta[0] = rc->initial_mouse[0] - rc->slow_mouse[0];
+ delta[1] = rc->initial_mouse[1] - rc->slow_mouse[1];
+
+ /* precision angle gets calculated from dial and gets added later */
+ angle_precision = -0.1f * BLI_dial_angle(rc->dial, position);
+ }
+ else {
+ delta[0] = rc->initial_mouse[0] - rc->slow_mouse[0];
+ delta[1] = rc->initial_mouse[1] - rc->slow_mouse[1];
+
+ if (rc->zoom_prop) {
+ RNA_property_float_get_array(&rc->zoom_ptr, rc->zoom_prop, zoom);
+ delta[0] /= zoom[0];
+ delta[1] /= zoom[1];
+ }
+
+ dist = len_v2(delta);
+
+ delta[0] = event->x - rc->slow_mouse[0];
+ delta[1] = event->y - rc->slow_mouse[1];
+
+ if (rc->zoom_prop) {
+ delta[0] /= zoom[0];
+ delta[1] /= zoom[1];
+ }
+
+ dist = dist + 0.1f * (delta[0] + delta[1]);
+ }
}
+ else {
+ delta[0] = rc->initial_mouse[0] - event->x;
+ delta[1] = rc->initial_mouse[1] - event->y;
- dist = len_v2(delta);
+ if (rc->zoom_prop) {
+ RNA_property_float_get_array(&rc->zoom_ptr, rc->zoom_prop, zoom);
+ delta[0] /= zoom[0];
+ delta[1] /= zoom[1];
+ }
+
+ dist = len_v2(delta);
+ }
/* calculate new value and apply snapping */
switch (rc->subtype) {
@@ -4126,7 +4251,10 @@ static int radial_control_modal(bContext *C, wmOperator *op, const wmEvent *even
if (snap) new_value = ((int)ceil(new_value * 10.f) * 10.0f) / 100.f;
break;
case PROP_ANGLE:
- new_value = atan2(delta[1], delta[0]) + M_PI;
+ new_value = atan2(delta[1], delta[0]) + M_PI + angle_precision;
+ new_value = fmod(new_value, 2.0f * (float)M_PI);
+ if (new_value < 0.0f)
+ new_value += 2.0f * (float)M_PI;
if (snap) new_value = DEG2RADF(((int)RAD2DEGF(new_value) + 5) / 10 * 10);
break;
default:
@@ -4153,6 +4281,29 @@ static int radial_control_modal(bContext *C, wmOperator *op, const wmEvent *even
RNA_property_update(C, &rc->ptr, rc->prop);
ret = OPERATOR_FINISHED;
break;
+
+ case LEFTSHIFTKEY:
+ case RIGHTSHIFTKEY:
+ if (event->val == KM_PRESS) {
+ rc->slow_mouse[0] = event->x;
+ rc->slow_mouse[1] = event->y;
+ rc->slow_mode = true;
+ if (rc->subtype == PROP_ANGLE) {
+ float initial_position[2] = {UNPACK2(rc->initial_mouse)};
+ float current_position[2] = {UNPACK2(rc->slow_mouse)};
+ rc->dial = BLI_dial_initialize(initial_position, 0.0f);
+ /* immediately set the position to get a an initial direction */
+ BLI_dial_angle(rc->dial, current_position);
+ }
+ }
+ if (event->val == KM_RELEASE) {
+ rc->slow_mode = false;
+ if (rc->dial) {
+ MEM_freeN(rc->dial);
+ rc->dial = NULL;
+ }
+ }
+ break;
}
ED_region_tag_redraw(CTX_wm_region(C));
@@ -4165,8 +4316,6 @@ static int radial_control_modal(bContext *C, wmOperator *op, const wmEvent *even
static void WM_OT_radial_control(wmOperatorType *ot)
{
- PropertyRNA *prop;
-
ot->name = "Radial Control";
ot->idname = "WM_OT_radial_control";
ot->description = "Set some size property (like e.g. brush size) with mouse wheel";
@@ -4178,32 +4327,23 @@ static void WM_OT_radial_control(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING;
/* all paths relative to the context */
- prop = RNA_def_string(ot->srna, "data_path_primary", NULL, 0, "Primary Data Path", "Primary path of property to be set by the radial control");
- RNA_def_property_flag(prop, PROP_HIDDEN);
+ RNA_def_string(ot->srna, "data_path_primary", NULL, 0, "Primary Data Path", "Primary path of property to be set by the radial control");
- prop = RNA_def_string(ot->srna, "data_path_secondary", NULL, 0, "Secondary Data Path", "Secondary path of property to be set by the radial control");
- RNA_def_property_flag(prop, PROP_HIDDEN);
+ RNA_def_string(ot->srna, "data_path_secondary", NULL, 0, "Secondary Data Path", "Secondary path of property to be set by the radial control");
- prop = RNA_def_string(ot->srna, "use_secondary", NULL, 0, "Use Secondary", "Path of property to select between the primary and secondary data paths");
- RNA_def_property_flag(prop, PROP_HIDDEN);
+ RNA_def_string(ot->srna, "use_secondary", NULL, 0, "Use Secondary", "Path of property to select between the primary and secondary data paths");
- prop = RNA_def_string(ot->srna, "rotation_path", NULL, 0, "Rotation Path", "Path of property used to rotate the texture display");
- RNA_def_property_flag(prop, PROP_HIDDEN);
+ RNA_def_string(ot->srna, "rotation_path", NULL, 0, "Rotation Path", "Path of property used to rotate the texture display");
- prop = RNA_def_string(ot->srna, "color_path", NULL, 0, "Color Path", "Path of property used to set the color of the control");
- RNA_def_property_flag(prop, PROP_HIDDEN);
+ RNA_def_string(ot->srna, "color_path", NULL, 0, "Color Path", "Path of property used to set the color of the control");
- prop = RNA_def_string(ot->srna, "fill_color_path", NULL, 0, "Fill Color Path", "Path of property used to set the fill color of the control");
- RNA_def_property_flag(prop, PROP_HIDDEN);
+ RNA_def_string(ot->srna, "fill_color_path", NULL, 0, "Fill Color Path", "Path of property used to set the fill color of the control");
- prop = RNA_def_string(ot->srna, "zoom_path", NULL, 0, "Zoom Path", "Path of property used to set the zoom level for the control");
- RNA_def_property_flag(prop, PROP_HIDDEN);
+ RNA_def_string(ot->srna, "zoom_path", NULL, 0, "Zoom Path", "Path of property used to set the zoom level for the control");
- prop = RNA_def_string(ot->srna, "image_id", NULL, 0, "Image ID", "Path of ID that is used to generate an image for the control");
- RNA_def_property_flag(prop, PROP_HIDDEN);
+ RNA_def_string(ot->srna, "image_id", NULL, 0, "Image ID", "Path of ID that is used to generate an image for the control");
- prop = RNA_def_boolean(ot->srna, "secondary_tex", 0, "Secondary Texture", "Tweak brush secondary/mask texture");
- RNA_def_property_flag(prop, PROP_HIDDEN);
+ RNA_def_boolean(ot->srna, "secondary_tex", 0, "Secondary Texture", "Tweak brush secondary/mask texture");
}
/* ************************** timer for testing ***************** */
@@ -4425,7 +4565,8 @@ void wm_operatortype_init(void)
WM_operatortype_append(WM_OT_quit_blender);
WM_operatortype_append(WM_OT_open_mainfile);
WM_operatortype_append(WM_OT_revert_mainfile);
- WM_operatortype_append(WM_OT_link_append);
+ WM_operatortype_append(WM_OT_link);
+ WM_operatortype_append(WM_OT_append);
WM_operatortype_append(WM_OT_recover_last_session);
WM_operatortype_append(WM_OT_recover_auto_save);
WM_operatortype_append(WM_OT_save_as_mainfile);
@@ -4438,6 +4579,7 @@ void wm_operatortype_init(void)
WM_operatortype_append(WM_OT_splash);
WM_operatortype_append(WM_OT_search_menu);
WM_operatortype_append(WM_OT_call_menu);
+ WM_operatortype_append(WM_OT_call_menu_pie);
WM_operatortype_append(WM_OT_radial_control);
#if defined(WIN32)
WM_operatortype_append(WM_OT_console_toggle);
@@ -4651,10 +4793,8 @@ void wm_window_keymap(wmKeyConfig *keyconf)
WM_keymap_add_menu(keymap, "INFO_MT_file_open_recent", OKEY, KM_PRESS, KM_SHIFT | KM_CTRL, 0);
WM_keymap_add_item(keymap, "WM_OT_open_mainfile", OKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "WM_OT_open_mainfile", F1KEY, KM_PRESS, 0, 0);
- WM_keymap_add_item(keymap, "WM_OT_link_append", OKEY, KM_PRESS, KM_CTRL | KM_ALT, 0);
- kmi = WM_keymap_add_item(keymap, "WM_OT_link_append", F1KEY, KM_PRESS, KM_SHIFT, 0);
- RNA_boolean_set(kmi->ptr, "link", false);
- RNA_boolean_set(kmi->ptr, "instance_groups", false);
+ WM_keymap_add_item(keymap, "WM_OT_link", OKEY, KM_PRESS, KM_CTRL | KM_ALT, 0);
+ WM_keymap_add_item(keymap, "WM_OT_append", F1KEY, KM_PRESS, KM_SHIFT, 0);
WM_keymap_add_item(keymap, "WM_OT_save_mainfile", SKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "WM_OT_save_mainfile", WKEY, KM_PRESS, KM_CTRL, 0);
diff --git a/source/blender/windowmanager/intern/wm_subwindow.c b/source/blender/windowmanager/intern/wm_subwindow.c
index 1792ea40a1a..db4459b1799 100644
--- a/source/blender/windowmanager/intern/wm_subwindow.c
+++ b/source/blender/windowmanager/intern/wm_subwindow.c
@@ -308,7 +308,7 @@ void wmSubWindowScissorSet(wmWindow *win, int swinid, const rcti *srct, bool src
int scissor_height = BLI_rcti_size_y(srct);
/* typically a single pixel doesn't matter,
- * but one pixel offset is noticable with viewport border render */
+ * but one pixel offset is noticeable with viewport border render */
if (srct_pad) {
scissor_width += 1;
scissor_height += 1;
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
index 99f4ec6bd16..d83f876c2e1 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -973,14 +973,15 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_ptr
const char *path = GHOST_GetEventData(evt);
if (path) {
+ wmOperatorType *ot = WM_operatortype_find("WM_OT_open_mainfile", false);
/* operator needs a valid window in context, ensures
* it is correctly set */
oldWindow = CTX_wm_window(C);
CTX_wm_window_set(C, win);
- WM_operator_properties_create(&props_ptr, "WM_OT_open_mainfile");
+ WM_operator_properties_create_ptr(&props_ptr, ot);
RNA_string_set(&props_ptr, "filepath", path);
- WM_operator_name_call(C, "WM_OT_open_mainfile", WM_OP_EXEC_DEFAULT, &props_ptr);
+ WM_operator_name_call_ptr(C, ot, WM_OP_EXEC_DEFAULT, &props_ptr);
WM_operator_properties_free(&props_ptr);
CTX_wm_window_set(C, oldWindow);
@@ -1014,7 +1015,7 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_ptr
/* make blender drop event with custom data pointing to wm drags */
event.type = EVT_DROP;
event.val = KM_RELEASE;
- event.custom = EVT_DATA_LISTBASE;
+ event.custom = EVT_DATA_DRAGDROP;
event.customdata = &wm->drags;
event.customdatafree = 1;
@@ -1033,7 +1034,7 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_ptr
/* try to get icon type from extension */
icon = ED_file_extension_icon((char *)stra->strings[a]);
- WM_event_start_drag(C, icon, WM_DRAG_PATH, stra->strings[a], 0.0);
+ WM_event_start_drag(C, icon, WM_DRAG_PATH, stra->strings[a], 0.0, WM_DRAG_NOP);
/* void poin should point to string, it makes a copy */
break; /* only one drop element supported now */
}