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.c2
-rw-r--r--source/blender/windowmanager/intern/wm_cursors.c3
-rw-r--r--source/blender/windowmanager/intern/wm_dragdrop.c11
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c32
-rw-r--r--source/blender/windowmanager/intern/wm_operator_props.c18
-rw-r--r--source/blender/windowmanager/intern/wm_operator_type.c5
6 files changed, 51 insertions, 20 deletions
diff --git a/source/blender/windowmanager/intern/wm.c b/source/blender/windowmanager/intern/wm.c
index a10284e9740..549b59e9e1d 100644
--- a/source/blender/windowmanager/intern/wm.c
+++ b/source/blender/windowmanager/intern/wm.c
@@ -279,6 +279,8 @@ IDTypeInfo IDType_ID_WM = {
.blend_read_expand = NULL,
.blend_read_undo_preserve = NULL,
+
+ .lib_override_apply_post = NULL,
};
#define MAX_OP_REGISTERED 32
diff --git a/source/blender/windowmanager/intern/wm_cursors.c b/source/blender/windowmanager/intern/wm_cursors.c
index d50516dfab2..e32552063af 100644
--- a/source/blender/windowmanager/intern/wm_cursors.c
+++ b/source/blender/windowmanager/intern/wm_cursors.c
@@ -246,8 +246,7 @@ void WM_cursor_wait(bool val)
void WM_cursor_grab_enable(wmWindow *win, int wrap, bool hide, int bounds[4])
{
/* Only grab cursor when not running debug.
- * It helps not to get a stuck WM when hitting a breakpoint
- * */
+ * It helps not to get a stuck WM when hitting a break-point. */
GHOST_TGrabCursorMode mode = GHOST_kGrabNormal;
GHOST_TAxisFlag mode_axis = GHOST_kAxisX | GHOST_kGrabAxisY;
diff --git a/source/blender/windowmanager/intern/wm_dragdrop.c b/source/blender/windowmanager/intern/wm_dragdrop.c
index 08f60fef0d2..6fdcbab889c 100644
--- a/source/blender/windowmanager/intern/wm_dragdrop.c
+++ b/source/blender/windowmanager/intern/wm_dragdrop.c
@@ -225,7 +225,8 @@ static const char *dropbox_active(bContext *C,
if (handler->dropboxes) {
LISTBASE_FOREACH (wmDropBox *, drop, handler->dropboxes) {
const char *tooltip = NULL;
- if (drop->poll(C, drag, event, &tooltip)) {
+ if (drop->poll(C, drag, event, &tooltip) &&
+ WM_operator_poll_context(C, drop->ot, drop->opcontext)) {
/* XXX Doing translation here might not be ideal, but later we have no more
* access to ot (and hence op context)... */
return (tooltip) ? tooltip : WM_operatortype_name(drop->ot, drop->ptr);
@@ -353,6 +354,14 @@ ID *WM_drag_get_local_ID_from_event(const wmEvent *event, short idcode)
return WM_drag_get_local_ID(lb->first, idcode);
}
+/**
+ * Check if the drag data is either a local ID or an external ID asset of type \a idcode.
+ */
+bool WM_drag_is_ID_type(const wmDrag *drag, int idcode)
+{
+ return WM_drag_get_local_ID(drag, idcode) || WM_drag_get_asset_data(drag, idcode);
+}
+
wmDragAsset *WM_drag_get_asset_data(const wmDrag *drag, int idcode)
{
if (drag->type != WM_DRAG_ASSET) {
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 859336d0338..17f4713ff96 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -543,13 +543,33 @@ void wm_event_do_notifiers(bContext *C)
ED_screen_do_listen(C, note);
LISTBASE_FOREACH (ARegion *, region, &screen->regionbase) {
- ED_region_do_listen(win, NULL, region, note, scene);
+ wmRegionListenerParams region_params = {
+ .window = win,
+ .area = NULL,
+ .region = region,
+ .scene = scene,
+ .notifier = note,
+ };
+ ED_region_do_listen(&region_params);
}
ED_screen_areas_iter (win, screen, area) {
- ED_area_do_listen(win, area, note, scene);
+ wmSpaceTypeListenerParams area_params = {
+ .window = win,
+ .area = area,
+ .notifier = note,
+ .scene = scene,
+ };
+ ED_area_do_listen(&area_params);
LISTBASE_FOREACH (ARegion *, region, &area->regionbase) {
- ED_region_do_listen(win, area, region, note, scene);
+ wmRegionListenerParams region_params = {
+ .window = win,
+ .area = area,
+ .region = region,
+ .scene = scene,
+ .notifier = note,
+ };
+ ED_region_do_listen(&region_params);
}
}
}
@@ -2788,8 +2808,10 @@ static int wm_handlers_do_intern(bContext *C, wmEvent *event, ListBase *handlers
LISTBASE_FOREACH (wmDrag *, drag, lb) {
const char *tooltip = NULL;
if (drop->poll(C, drag, event, &tooltip)) {
- /* Optionally copy drag information to operator properties. */
- if (drop->copy) {
+ /* Optionally copy drag information to operator properties. Don't call it if the
+ * operator fails anyway, it might do more than just set properties (e.g.
+ * typically import an asset). */
+ if (drop->copy && WM_operator_poll_context(C, drop->ot, drop->opcontext)) {
drop->copy(drag, drop);
}
diff --git a/source/blender/windowmanager/intern/wm_operator_props.c b/source/blender/windowmanager/intern/wm_operator_props.c
index 8dfe26fbf79..aeab1ee6fca 100644
--- a/source/blender/windowmanager/intern/wm_operator_props.c
+++ b/source/blender/windowmanager/intern/wm_operator_props.c
@@ -284,15 +284,15 @@ void WM_operator_properties_select_action_simple(wmOperatorType *ot,
*/
void WM_operator_properties_select_random(wmOperatorType *ot)
{
- RNA_def_float_percentage(ot->srna,
- "percent",
- 50.0f,
- 0.0f,
- 100.0f,
- "Percent",
- "Percentage of objects to select randomly",
- 0.0f,
- 100.0f);
+ RNA_def_float_factor(ot->srna,
+ "ratio",
+ 0.5f,
+ 0.0f,
+ 1.0f,
+ "Ratio",
+ "Portion of items to select randomly",
+ 0.f,
+ 1.0f);
RNA_def_int(ot->srna,
"seed",
0,
diff --git a/source/blender/windowmanager/intern/wm_operator_type.c b/source/blender/windowmanager/intern/wm_operator_type.c
index 4c4fd2b1a8e..0e57a92b685 100644
--- a/source/blender/windowmanager/intern/wm_operator_type.c
+++ b/source/blender/windowmanager/intern/wm_operator_type.c
@@ -424,9 +424,8 @@ static int wm_macro_modal(bContext *C, wmOperator *op, const wmEvent *event)
wm_event_free_handler(&handler->head);
}
- /* if operator is blocking, grab cursor
- * This may end up grabbing twice, but we don't care.
- * */
+ /* If operator is blocking, grab cursor.
+ * This may end up grabbing twice, but we don't care. */
if (op->opm->type->flag & OPTYPE_BLOCKING) {
int bounds[4] = {-1, -1, -1, -1};
int wrap = WM_CURSOR_WRAP_NONE;