diff options
Diffstat (limited to 'source/blender/editors')
33 files changed, 161 insertions, 89 deletions
diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index 38820e05869..711ec0a9d22 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -2544,7 +2544,7 @@ static bool animchannels_find_poll(bContext *C) } /* find_invoke() - Get initial channels */ -static int animchannels_find_invoke(bContext *C, wmOperator *op, const wmEvent *evt) +static int animchannels_find_invoke(bContext *C, wmOperator *op, const wmEvent *event) { bAnimContext ac; @@ -2557,7 +2557,7 @@ static int animchannels_find_invoke(bContext *C, wmOperator *op, const wmEvent * RNA_string_set(op->ptr, "query", ac.ads->searchstr); /* defer to popup */ - return WM_operator_props_popup(C, op, evt); + return WM_operator_props_popup(C, op, event); } /* find_exec() - Called to set the value */ diff --git a/source/blender/editors/animation/fmodifier_ui.c b/source/blender/editors/animation/fmodifier_ui.c index b344e67f62d..1809daa3fcb 100644 --- a/source/blender/editors/animation/fmodifier_ui.c +++ b/source/blender/editors/animation/fmodifier_ui.c @@ -305,6 +305,7 @@ static void fmodifier_frame_range_draw(const bContext *C, Panel *panel) PointerRNA *ptr = fmodifier_get_pointers(C, panel, NULL); uiLayoutSetPropSep(layout, true); + uiLayoutSetPropDecorate(layout, false); FModifier *fcm = (FModifier *)ptr->data; uiLayoutSetActive(layout, fcm->flag & FMODIFIER_FLAG_RANGERESTRICT); @@ -478,6 +479,7 @@ static void fn_generator_panel_draw(const bContext *C, Panel *panel) uiItemR(layout, ptr, "function_type", 0, "", ICON_NONE); uiLayoutSetPropSep(layout, true); + uiLayoutSetPropDecorate(layout, false); col = uiLayoutColumn(layout, false); uiItemR(col, ptr, "use_additive", 0, NULL, ICON_NONE); @@ -698,6 +700,7 @@ static void envelope_panel_draw(const bContext *C, Panel *panel) FMod_Envelope *env = (FMod_Envelope *)fcm->data; uiLayoutSetPropSep(layout, true); + uiLayoutSetPropDecorate(layout, false); /* General settings. */ col = uiLayoutColumn(layout, true); @@ -792,6 +795,7 @@ static void limits_panel_draw(const bContext *C, Panel *panel) PointerRNA *ptr = fmodifier_get_pointers(C, panel, NULL); uiLayoutSetPropSep(layout, true); + uiLayoutSetPropDecorate(layout, false); /* Minimums. */ col = uiLayoutColumn(layout, false); @@ -853,6 +857,7 @@ static void stepped_panel_draw(const bContext *C, Panel *panel) PointerRNA *ptr = fmodifier_get_pointers(C, panel, NULL); uiLayoutSetPropSep(layout, true); + uiLayoutSetPropDecorate(layout, false); /* Stepping Settings. */ col = uiLayoutColumn(layout, false); diff --git a/source/blender/editors/armature/pose_edit.c b/source/blender/editors/armature/pose_edit.c index 78bce8679bb..e65871c0896 100644 --- a/source/blender/editors/armature/pose_edit.c +++ b/source/blender/editors/armature/pose_edit.c @@ -476,9 +476,9 @@ static int pose_clear_paths_exec(bContext *C, wmOperator *op) } /* operator callback/wrapper */ -static int pose_clear_paths_invoke(bContext *C, wmOperator *op, const wmEvent *evt) +static int pose_clear_paths_invoke(bContext *C, wmOperator *op, const wmEvent *event) { - if ((evt->shift) && !RNA_struct_property_is_set(op->ptr, "only_selected")) { + if ((event->shift) && !RNA_struct_property_is_set(op->ptr, "only_selected")) { RNA_boolean_set(op->ptr, "only_selected", true); } return pose_clear_paths_exec(C, op); diff --git a/source/blender/editors/armature/pose_lib.c b/source/blender/editors/armature/pose_lib.c index 45f623f3a9d..dd90f9f2cc3 100644 --- a/source/blender/editors/armature/pose_lib.c +++ b/source/blender/editors/armature/pose_lib.c @@ -1321,10 +1321,10 @@ static void poselib_preview_get_next(tPoseLib_PreviewData *pld, int step) } /* specially handle events for searching */ -static void poselib_preview_handle_search(tPoseLib_PreviewData *pld, ushort event, char ascii) +static void poselib_preview_handle_search(tPoseLib_PreviewData *pld, ushort event_type, char ascii) { /* try doing some form of string manipulation first */ - switch (event) { + switch (event_type) { case EVT_BACKSPACEKEY: if (pld->searchstr[0] && pld->search_cursor) { short len = strlen(pld->searchstr); diff --git a/source/blender/editors/gpencil/annotate_paint.c b/source/blender/editors/gpencil/annotate_paint.c index c8bd38d58fe..e9817f82090 100644 --- a/source/blender/editors/gpencil/annotate_paint.c +++ b/source/blender/editors/gpencil/annotate_paint.c @@ -2093,7 +2093,7 @@ static void annotation_draw_apply_event( p->mval[1] = (float)event->mval[1] - y; /* Key to toggle stabilization. */ - if (event->shift > 0 && p->paintmode == GP_PAINTMODE_DRAW) { + if (event->shift && p->paintmode == GP_PAINTMODE_DRAW) { /* Using permanent stabilization, shift will deactivate the flag. */ if (p->flags & GP_PAINTFLAG_USE_STABILIZER) { if (p->flags & GP_PAINTFLAG_USE_STABILIZER_TEMP) { @@ -2108,7 +2108,7 @@ static void annotation_draw_apply_event( } } /* verify key status for straight lines */ - else if ((event->ctrl > 0) || (event->alt > 0)) { + else if (event->ctrl || event->alt) { if (p->straight[0] == 0) { int dx = abs((int)(p->mval[0] - p->mvalo[0])); int dy = abs((int)(p->mval[1] - p->mvalo[1])); @@ -2348,7 +2348,7 @@ static int annotation_draw_invoke(bContext *C, wmOperator *op, const wmEvent *ev p->flags |= GP_PAINTFLAG_USE_STABILIZER | GP_PAINTFLAG_USE_STABILIZER_TEMP; annotation_draw_toggle_stabilizer_cursor(p, true); } - else if (event->shift > 0) { + else if (event->shift) { p->flags |= GP_PAINTFLAG_USE_STABILIZER_TEMP; annotation_draw_toggle_stabilizer_cursor(p, true); } diff --git a/source/blender/editors/gpencil/gpencil_data.c b/source/blender/editors/gpencil/gpencil_data.c index 039bc50fcc9..fd2758c8a08 100644 --- a/source/blender/editors/gpencil/gpencil_data.c +++ b/source/blender/editors/gpencil/gpencil_data.c @@ -1420,7 +1420,7 @@ void GPENCIL_OT_layer_merge(wmOperatorType *ot) /* ********************** Change Layer ***************************** */ -static int gpencil_layer_change_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(evt)) +static int gpencil_layer_change_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) { uiPopupMenu *pup; uiLayout *layout; diff --git a/source/blender/editors/gpencil/gpencil_edit_curve.c b/source/blender/editors/gpencil/gpencil_edit_curve.c index 0f9a8c93df9..e766a410889 100644 --- a/source/blender/editors/gpencil/gpencil_edit_curve.c +++ b/source/blender/editors/gpencil/gpencil_edit_curve.c @@ -131,7 +131,7 @@ void GPENCIL_OT_stroke_enter_editcurve_mode(wmOperatorType *ot) "Error Threshold", "Threshold on the maximum deviation from the actual stroke", FLT_MIN, - 10.f); + 10.0f); RNA_def_property_ui_range(prop, FLT_MIN, 10.0f, 0.1f, 5); } diff --git a/source/blender/editors/gpencil/gpencil_fill.c b/source/blender/editors/gpencil/gpencil_fill.c index 406daf9f92e..85130e89ad1 100644 --- a/source/blender/editors/gpencil/gpencil_fill.c +++ b/source/blender/editors/gpencil/gpencil_fill.c @@ -55,6 +55,7 @@ #include "BKE_screen.h" #include "ED_gpencil.h" +#include "ED_keyframing.h" #include "ED_screen.h" #include "ED_space_api.h" #include "ED_view3d.h" @@ -542,12 +543,18 @@ static void gpencil_draw_datablock(tGPDfill *tgpf, const float ink[4]) if (gpl == tgpf->gpl) { if ((gpl->actframe == NULL) || (gpl->actframe->framenum != tgpf->active_cfra)) { short add_frame_mode; - if (ts->gpencil_flags & GP_TOOL_FLAG_RETAIN_LAST) { - add_frame_mode = GP_GETFRAME_ADD_COPY; + if (IS_AUTOKEY_ON(tgpf->scene)) { + if (ts->gpencil_flags & GP_TOOL_FLAG_RETAIN_LAST) { + add_frame_mode = GP_GETFRAME_ADD_COPY; + } + else { + add_frame_mode = GP_GETFRAME_ADD_NEW; + } } else { - add_frame_mode = GP_GETFRAME_ADD_NEW; + add_frame_mode = GP_GETFRAME_USE_PREV; } + BKE_gpencil_layer_frame_get(gpl, tgpf->active_cfra, add_frame_mode); } } @@ -1456,7 +1463,10 @@ static void gpencil_stroke_from_buffer(tGPDfill *tgpf) tgpf->done = true; /* Get frame or create a new one. */ - tgpf->gpf = BKE_gpencil_layer_frame_get(tgpf->gpl, tgpf->active_cfra, GP_GETFRAME_ADD_NEW); + tgpf->gpf = BKE_gpencil_layer_frame_get(tgpf->gpl, + tgpf->active_cfra, + IS_AUTOKEY_ON(tgpf->scene) ? GP_GETFRAME_ADD_NEW : + GP_GETFRAME_USE_PREV); /* Set frame as selected. */ tgpf->gpf->flag |= GP_FRAME_SELECT; @@ -2064,6 +2074,12 @@ static int gpencil_fill_modal(bContext *C, wmOperator *op, const wmEvent *event) estate = OPERATOR_CANCELLED; break; case LEFTMOUSE: + if (!IS_AUTOKEY_ON(tgpf->scene) && (!is_multiedit) && (tgpf->gpl->actframe == NULL)) { + BKE_report(op->reports, RPT_INFO, "No available frame for creating stroke"); + estate = OPERATOR_CANCELLED; + break; + } + /* first time the event is not enabled to show help lines. */ if ((tgpf->oldkey != -1) || (!help_lines)) { ARegion *region = BKE_area_find_region_xy( @@ -2088,17 +2104,24 @@ static int gpencil_fill_modal(bContext *C, wmOperator *op, const wmEvent *event) gpencil_stroke_convertcoords_tpoint( tgpf->scene, tgpf->region, tgpf->ob, &point2D, NULL, &pt->x); + /* Hash of selected frames.*/ + GHash *frame_list = BLI_ghash_int_new_ex(__func__, 64); + /* If not multiframe and there is no frame in CFRA for the active layer, create - * a new frame before to make the hash function can find something. */ + * a new frame. */ if (!is_multiedit) { tgpf->gpf = BKE_gpencil_layer_frame_get( - tgpf->gpl, tgpf->active_cfra, GP_GETFRAME_ADD_NEW); + tgpf->gpl, + tgpf->active_cfra, + IS_AUTOKEY_ON(tgpf->scene) ? GP_GETFRAME_ADD_NEW : GP_GETFRAME_USE_PREV); tgpf->gpf->flag |= GP_FRAME_SELECT; - } - /* Hash of selected frames.*/ - GHash *frame_list = BLI_ghash_int_new_ex(__func__, 64); - BKE_gpencil_frame_selected_hash(tgpf->gpd, frame_list); + BLI_ghash_insert( + frame_list, POINTER_FROM_INT(tgpf->active_cfra), tgpf->gpl->actframe); + } + else { + BKE_gpencil_frame_selected_hash(tgpf->gpd, frame_list); + } /* Loop all frames. */ wmWindow *win = CTX_wm_window(C); diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index 974f51ff90b..1217a3a7e8f 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -67,6 +67,7 @@ #include "ED_clip.h" #include "ED_gpencil.h" +#include "ED_keyframing.h" #include "ED_object.h" #include "ED_screen.h" #include "ED_view3d.h" @@ -2155,6 +2156,10 @@ static void gpencil_paint_initstroke(tGPsdata *p, continue; } + if (!IS_AUTOKEY_ON(scene) && (gpl->actframe == NULL)) { + continue; + } + /* Add a new frame if needed (and based off the active frame, * as we need some existing strokes to erase) * @@ -2164,7 +2169,8 @@ static void gpencil_paint_initstroke(tGPsdata *p, */ if (gpl->actframe && gpl->actframe->strokes.first) { if (ts->gpencil_flags & GP_TOOL_FLAG_RETAIN_LAST) { - gpl->actframe = BKE_gpencil_layer_frame_get(gpl, CFRA, GP_GETFRAME_ADD_COPY); + short frame_mode = IS_AUTOKEY_ON(scene) ? GP_GETFRAME_ADD_COPY : GP_GETFRAME_USE_PREV; + gpl->actframe = BKE_gpencil_layer_frame_get(gpl, CFRA, frame_mode); } has_layer_to_erase = true; break; @@ -2187,11 +2193,16 @@ static void gpencil_paint_initstroke(tGPsdata *p, /* Drawing Modes - Add a new frame if needed on the active layer */ short add_frame_mode; - if (ts->gpencil_flags & GP_TOOL_FLAG_RETAIN_LAST) { - add_frame_mode = GP_GETFRAME_ADD_COPY; + if (IS_AUTOKEY_ON(scene)) { + if (ts->gpencil_flags & GP_TOOL_FLAG_RETAIN_LAST) { + add_frame_mode = GP_GETFRAME_ADD_COPY; + } + else { + add_frame_mode = GP_GETFRAME_ADD_NEW; + } } else { - add_frame_mode = GP_GETFRAME_ADD_NEW; + add_frame_mode = GP_GETFRAME_USE_PREV; } bool need_tag = p->gpl->actframe == NULL; @@ -2206,6 +2217,10 @@ static void gpencil_paint_initstroke(tGPsdata *p, if (G.debug & G_DEBUG) { printf("Error: No frame created (gpencil_paint_init)\n"); } + if (!IS_AUTOKEY_ON(scene)) { + BKE_report(p->reports, RPT_INFO, "No available frame for creating stroke"); + } + return; } p->gpf->flag |= GP_FRAME_PAINT; @@ -2469,6 +2484,8 @@ static int gpencil_draw_init(bContext *C, wmOperator *op, const wmEvent *event) return 0; } + p->reports = op->reports; + /* init painting data */ gpencil_paint_initstroke(p, paintmode, CTX_data_ensure_evaluated_depsgraph(C)); if (p->status == GP_STATUS_ERROR) { @@ -2483,8 +2500,6 @@ static int gpencil_draw_init(bContext *C, wmOperator *op, const wmEvent *event) p->keymodifier = -1; } - p->reports = op->reports; - /* everything is now setup ok */ return 1; } @@ -2835,7 +2850,7 @@ static void gpencil_draw_apply_event(bContext *C, /* verify direction for straight lines and guides */ if ((is_speed_guide) || - ((event->alt > 0) && (RNA_boolean_get(op->ptr, "disable_straight") == false))) { + (event->alt && (RNA_boolean_get(op->ptr, "disable_straight") == false))) { if (p->straight == 0) { int dx = (int)fabsf(p->mval[0] - p->mvali[0]); int dy = (int)fabsf(p->mval[1] - p->mvali[1]); @@ -2876,13 +2891,13 @@ static void gpencil_draw_apply_event(bContext *C, /* special eraser modes */ if (p->paintmode == GP_PAINTMODE_ERASER) { - if (event->shift > 0) { + if (event->shift) { p->flags |= GP_PAINTFLAG_HARD_ERASER; } else { p->flags &= ~GP_PAINTFLAG_HARD_ERASER; } - if (event->alt > 0) { + if (event->alt) { p->flags |= GP_PAINTFLAG_STROKE_ERASER; } else { diff --git a/source/blender/editors/gpencil/gpencil_primitive.c b/source/blender/editors/gpencil/gpencil_primitive.c index 12d399f32ca..b29ef2e7ee2 100644 --- a/source/blender/editors/gpencil/gpencil_primitive.c +++ b/source/blender/editors/gpencil/gpencil_primitive.c @@ -71,6 +71,7 @@ #include "RNA_enum_types.h" #include "ED_gpencil.h" +#include "ED_keyframing.h" #include "ED_object.h" #include "ED_screen.h" #include "ED_space_api.h" @@ -1253,9 +1254,18 @@ static void gpencil_primitive_init(bContext *C, wmOperator *op) static int gpencil_primitive_invoke(bContext *C, wmOperator *op, const wmEvent *event) { wmWindow *win = CTX_wm_window(C); + Scene *scene = CTX_data_scene(C); bGPdata *gpd = CTX_data_gpencil_data(C); tGPDprimitive *tgpi = NULL; + if (!IS_AUTOKEY_ON(scene)) { + bGPDlayer *gpl = BKE_gpencil_layer_active_get(gpd); + if ((gpl == NULL) || (gpl->actframe == NULL)) { + BKE_report(op->reports, RPT_INFO, "No available frame for creating stroke"); + return OPERATOR_CANCELLED; + } + } + /* initialize operator runtime data */ gpencil_primitive_init(C, op); tgpi = op->customdata; @@ -1310,11 +1320,16 @@ static void gpencil_primitive_interaction_end(bContext *C, /* insert keyframes as required... */ short add_frame_mode; - if (ts->gpencil_flags & GP_TOOL_FLAG_RETAIN_LAST) { - add_frame_mode = GP_GETFRAME_ADD_COPY; + if (IS_AUTOKEY_ON(tgpi->scene)) { + if (ts->gpencil_flags & GP_TOOL_FLAG_RETAIN_LAST) { + add_frame_mode = GP_GETFRAME_ADD_COPY; + } + else { + add_frame_mode = GP_GETFRAME_ADD_NEW; + } } else { - add_frame_mode = GP_GETFRAME_ADD_NEW; + add_frame_mode = GP_GETFRAME_USE_PREV; } bool need_tag = tgpi->gpl->actframe == NULL; diff --git a/source/blender/editors/gpencil/gpencil_sculpt_paint.c b/source/blender/editors/gpencil/gpencil_sculpt_paint.c index 0d3ab9011d6..9666aca5254 100644 --- a/source/blender/editors/gpencil/gpencil_sculpt_paint.c +++ b/source/blender/editors/gpencil/gpencil_sculpt_paint.c @@ -73,6 +73,7 @@ #include "UI_view2d.h" #include "ED_gpencil.h" +#include "ED_keyframing.h" #include "ED_screen.h" #include "ED_view3d.h" @@ -1019,7 +1020,11 @@ static void gpencil_brush_clone_add(bContext *C, tGP_BrushEditData *gso) if (gpl == NULL) { gpl = CTX_data_active_gpencil_layer(C); } - bGPDframe *gpf = BKE_gpencil_layer_frame_get(gpl, CFRA, GP_GETFRAME_ADD_NEW); + bGPDframe *gpf = BKE_gpencil_layer_frame_get( + gpl, CFRA, IS_AUTOKEY_ON(scene) ? GP_GETFRAME_ADD_NEW : GP_GETFRAME_USE_PREV); + if (gpf == NULL) { + continue; + } /* Make a new stroke */ new_stroke = BKE_gpencil_stroke_duplicate(gps, true, true); @@ -1334,6 +1339,10 @@ static void gpencil_sculpt_brush_init_stroke(bContext *C, tGP_BrushEditData *gso /* go through each layer, and ensure that we've got a valid frame to use */ LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) { + if (!IS_AUTOKEY_ON(scene) && (gpl->actframe == NULL)) { + continue; + } + /* only editable and visible layers are considered */ if (BKE_gpencil_layer_is_editable(gpl) && (gpl->actframe != NULL)) { bGPDframe *gpf = gpl->actframe; @@ -1343,7 +1352,7 @@ static void gpencil_sculpt_brush_init_stroke(bContext *C, tGP_BrushEditData *gso * - This is useful when animating as it saves that "uh-oh" moment when you realize you've * spent too much time editing the wrong frame. */ - if (gpf->framenum != cfra) { + if ((IS_AUTOKEY_ON(scene)) && (gpf->framenum != cfra)) { BKE_gpencil_frame_addcopy(gpl, cfra); /* Need tag to recalculate evaluated data to avoid crashes. */ DEG_id_tag_update(&gso->gpd->id, ID_RECALC_GEOMETRY | ID_RECALC_COPY_ON_WRITE); diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h index 2415c85e299..4b440aa7367 100644 --- a/source/blender/editors/include/ED_anim_api.h +++ b/source/blender/editors/include/ED_anim_api.h @@ -55,7 +55,6 @@ struct FModifier; struct bAction; struct uiBlock; -struct uiLayout; struct PointerRNA; struct PropertyRNA; diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h index 61e1f0fdf7d..b3205acb8ee 100644 --- a/source/blender/editors/include/ED_screen.h +++ b/source/blender/editors/include/ED_screen.h @@ -52,7 +52,6 @@ struct rcti; struct uiBlock; struct uiLayout; struct wmKeyConfig; -struct wmMsgBus; struct wmMsgSubscribeKey; struct wmMsgSubscribeValue; struct wmNotifier; diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index d10cdc207c2..40cfcaea883 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -120,7 +120,7 @@ void UI_draw_roundbox_4fv_ex(const rctf *rect, }; GPUBatch *batch = ui_batch_roundbox_widget_get(); GPU_batch_program_set_builtin(batch, GPU_SHADER_2D_WIDGET_BASE); - GPU_batch_uniform_4fv_array(batch, "parameters", 11, (float(*)[4]) & widget_params); + GPU_batch_uniform_4fv_array(batch, "parameters", 11, (const float(*)[4]) & widget_params); GPU_blend(GPU_BLEND_ALPHA); GPU_batch_draw(batch); GPU_blend(GPU_BLEND_NONE); @@ -2376,7 +2376,7 @@ void ui_draw_dropshadow( GPUBatch *batch = ui_batch_roundbox_shadow_get(); GPU_batch_program_set_builtin(batch, GPU_SHADER_2D_WIDGET_SHADOW); - GPU_batch_uniform_4fv_array(batch, "parameters", 4, (float(*)[4]) & widget_params); + GPU_batch_uniform_4fv_array(batch, "parameters", 4, (const float(*)[4]) & widget_params); GPU_batch_uniform_1f(batch, "alpha", 1.0f - visibility); GPU_batch_draw(batch); diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 75ee3300e63..042f10ddded 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -168,12 +168,14 @@ static bool ui_mouse_motion_keynav_test(struct uiKeyNavLock *keynav, const wmEve #define PIE_MENU_INTERVAL 0.01 #define BUTTON_AUTO_OPEN_THRESH 0.2 #define BUTTON_MOUSE_TOWARDS_THRESH 1.0 -/* pixels to move the cursor to get out of keyboard navigation */ +/** Pixels to move the cursor to get out of keyboard navigation. */ #define BUTTON_KEYNAV_PX_LIMIT 8 -#define MENU_TOWARDS_MARGIN 20 /* margin in pixels */ -#define MENU_TOWARDS_WIGGLE_ROOM 64 /* tolerance in pixels */ -/* drag-lock distance threshold in pixels */ +/** Margin around the menu, use to check if we're moving towards this rectangle (in pixels). */ +#define MENU_TOWARDS_MARGIN 20 +/** Tolerance for closing menus (in pixels). */ +#define MENU_TOWARDS_WIGGLE_ROOM 64 +/** Drag-lock distance threshold (in pixels). */ #define BUTTON_DRAGLOCK_THRESH 3 typedef enum uiButtonActivateType { @@ -10444,7 +10446,7 @@ static int ui_pie_handler(bContext *C, const wmEvent *event, uiPopupBlockHandle } } - if (event->type == block->pie_data.event && !is_click_style) { + if (event->type == block->pie_data.event_type && !is_click_style) { if (event->val != KM_RELEASE) { ui_handle_menu_button(C, event, menu); @@ -10618,7 +10620,7 @@ static int ui_handle_menus_recursive(bContext *C, /* root pie menus accept the key that spawned * them as double click to improve responsiveness */ const bool do_recursion = (!(block->flag & UI_BLOCK_RADIAL) || - event->type != block->pie_data.event); + event->type != block->pie_data.event_type); if (do_recursion) { if (is_parent_inside == false) { @@ -10911,7 +10913,7 @@ static int ui_popup_handler(bContext *C, const wmEvent *event, void *userdata) /* set last pie event to allow chained pie spawning */ if (block->flag & UI_BLOCK_RADIAL) { - win->last_pie_event = block->pie_data.event; + win->pie_event_type_last = block->pie_data.event_type; reset_pie = true; } @@ -10954,7 +10956,7 @@ static int ui_popup_handler(bContext *C, const wmEvent *event, void *userdata) wmWindow *win = CTX_wm_window(C); if (win) { - win->last_pie_event = EVENT_NONE; + win->pie_event_type_last = EVENT_NONE; } } diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index c39e2b3ff8a..1d4a44e0c76 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -424,8 +424,8 @@ struct PieMenuData { float last_pos[2]; double duration_gesture; int flags; - /** initial event used to fire the pie menu, store here so we can query for release */ - int event; + /** Initial event used to fire the pie menu, store here so we can query for release */ + short event_type; float alphafac; }; diff --git a/source/blender/editors/interface/interface_region_menu_pie.c b/source/blender/editors/interface/interface_region_menu_pie.c index 81c627816b9..05aa139e055 100644 --- a/source/blender/editors/interface/interface_region_menu_pie.c +++ b/source/blender/editors/interface/interface_region_menu_pie.c @@ -122,26 +122,26 @@ uiPieMenu *UI_pie_menu_begin(struct bContext *C, const char *title, int icon, co * it is always assumed to be click style */ if (event->type == LEFTMOUSE || ELEM(event->val, KM_RELEASE, KM_CLICK)) { pie->block_radial->pie_data.flags |= UI_PIE_CLICK_STYLE; - pie->block_radial->pie_data.event = EVENT_NONE; - win->lock_pie_event = EVENT_NONE; + pie->block_radial->pie_data.event_type = EVENT_NONE; + win->pie_event_type_lock = EVENT_NONE; } else { - if (win->last_pie_event != EVENT_NONE) { + if (win->pie_event_type_last != EVENT_NONE) { /* original pie key has been released, so don't propagate the event */ - if (win->lock_pie_event == EVENT_NONE) { + if (win->pie_event_type_lock == EVENT_NONE) { event_type = EVENT_NONE; pie->block_radial->pie_data.flags |= UI_PIE_CLICK_STYLE; } else { - event_type = win->last_pie_event; + event_type = win->pie_event_type_last; } } else { event_type = event->type; } - pie->block_radial->pie_data.event = event_type; - win->lock_pie_event = event_type; + pie->block_radial->pie_data.event_type = event_type; + win->pie_event_type_lock = event_type; } pie->layout = UI_block_layout( diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 0fa5999976b..06b87dd857f 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -1180,7 +1180,7 @@ void UI_widgetbase_draw_cache_flush(void) /* draw single */ GPU_batch_program_set_builtin(batch, GPU_SHADER_2D_WIDGET_BASE); GPU_batch_uniform_4fv_array( - batch, "parameters", MAX_WIDGET_PARAMETERS, (float(*)[4])g_widget_base_batch.params); + batch, "parameters", MAX_WIDGET_PARAMETERS, (const float(*)[4])g_widget_base_batch.params); GPU_batch_uniform_3fv(batch, "checkerColorAndSize", checker_params); GPU_batch_draw(batch); } diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index 1f894ec0f1d..b5ec3f388a0 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -966,7 +966,7 @@ static void knifetool_draw_angle_snapping(const KnifeTool_OpData *kcd) float planes[4][4]; planes_from_projmat( - (float(*)[4])kcd->projmat, planes[2], planes[0], planes[3], planes[1], NULL, NULL); + (const float(*)[4])kcd->projmat, planes[2], planes[0], planes[3], planes[1], NULL, NULL); /* ray-cast all planes */ { diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 43e0ab97f5d..7502b77ae02 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -4172,15 +4172,7 @@ static Base *mesh_separate_tagged( })); BM_mesh_elem_toolflags_ensure(bm_new); /* needed for 'duplicate' bmo */ - CustomData_copy(&bm_old->vdata, &bm_new->vdata, CD_MASK_BMESH.vmask, CD_CALLOC, 0); - CustomData_copy(&bm_old->edata, &bm_new->edata, CD_MASK_BMESH.emask, CD_CALLOC, 0); - CustomData_copy(&bm_old->ldata, &bm_new->ldata, CD_MASK_BMESH.lmask, CD_CALLOC, 0); - CustomData_copy(&bm_old->pdata, &bm_new->pdata, CD_MASK_BMESH.pmask, CD_CALLOC, 0); - - CustomData_bmesh_init_pool(&bm_new->vdata, bm_mesh_allocsize_default.totvert, BM_VERT); - CustomData_bmesh_init_pool(&bm_new->edata, bm_mesh_allocsize_default.totedge, BM_EDGE); - CustomData_bmesh_init_pool(&bm_new->ldata, bm_mesh_allocsize_default.totloop, BM_LOOP); - CustomData_bmesh_init_pool(&bm_new->pdata, bm_mesh_allocsize_default.totface, BM_FACE); + BM_mesh_copy_init_customdata(bm_new, bm_old, &bm_mesh_allocsize_default); /* Take into account user preferences for duplicating actions. */ const eDupli_ID_Flags dupflag = USER_DUP_MESH | (U.dupflag & USER_DUP_ACT); diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index da14d4ef52a..c774bc9f9cc 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -1330,9 +1330,9 @@ static int object_clear_paths_exec(bContext *C, wmOperator *op) } /* operator callback/wrapper */ -static int object_clear_paths_invoke(bContext *C, wmOperator *op, const wmEvent *evt) +static int object_clear_paths_invoke(bContext *C, wmOperator *op, const wmEvent *event) { - if ((evt->shift) && !RNA_struct_property_is_set(op->ptr, "only_selected")) { + if ((event->shift) && !RNA_struct_property_is_set(op->ptr, "only_selected")) { RNA_boolean_set(op->ptr, "only_selected", true); } return object_clear_paths_exec(C, op); diff --git a/source/blender/editors/space_action/action_data.c b/source/blender/editors/space_action/action_data.c index 3a584a7f0cb..efa714e315d 100644 --- a/source/blender/editors/space_action/action_data.c +++ b/source/blender/editors/space_action/action_data.c @@ -663,11 +663,11 @@ static int action_unlink_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int action_unlink_invoke(bContext *C, wmOperator *op, const wmEvent *evt) +static int action_unlink_invoke(bContext *C, wmOperator *op, const wmEvent *event) { /* NOTE: this is hardcoded to match the behavior for the unlink button * (in interface_templates.c). */ - RNA_boolean_set(op->ptr, "force_delete", evt->shift != 0); + RNA_boolean_set(op->ptr, "force_delete", event->shift != 0); return action_unlink_exec(C, op); } diff --git a/source/blender/editors/space_nla/nla_channels.c b/source/blender/editors/space_nla/nla_channels.c index fb297672f0f..f2cea23af76 100644 --- a/source/blender/editors/space_nla/nla_channels.c +++ b/source/blender/editors/space_nla/nla_channels.c @@ -594,11 +594,11 @@ static int nla_action_unlink_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int nla_action_unlink_invoke(bContext *C, wmOperator *op, const wmEvent *evt) +static int nla_action_unlink_invoke(bContext *C, wmOperator *op, const wmEvent *event) { /* NOTE: this is hardcoded to match the behavior for the unlink button * (in interface_templates.c) */ - RNA_boolean_set(op->ptr, "force_delete", evt->shift != 0); + RNA_boolean_set(op->ptr, "force_delete", event->shift != 0); return nla_action_unlink_exec(C, op); } diff --git a/source/blender/editors/space_node/node_draw.cc b/source/blender/editors/space_node/node_draw.cc index 162f3878f7e..5a0cacf070b 100644 --- a/source/blender/editors/space_node/node_draw.cc +++ b/source/blender/editors/space_node/node_draw.cc @@ -1236,16 +1236,15 @@ static char *node_errors_tooltip_fn(bContext *UNUSED(C), void *argN, const char for (const NodeWarning &warning : warnings.drop_back(1)) { complete_string += warning.message; + /* Adding the period is not ideal for multi-line messages, but it is consistent + * with other tooltip implementations in Blender, so it is added here. */ + complete_string += '.'; complete_string += '\n'; } + /* Let the tooltip system automatically add the last period. */ complete_string += warnings.last().message; - /* Remove the last period-- the tooltip system adds this automatically. */ - if (complete_string.back() == '.') { - complete_string.pop_back(); - } - return BLI_strdupn(complete_string.c_str(), complete_string.size()); } diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index 4826b6c72ba..5205e50b0bf 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -2231,10 +2231,13 @@ static int node_clipboard_paste_exec(bContext *C, wmOperator *op) link->tosock->new_sock); } - ntreeUpdateTree(CTX_data_main(C), snode->edittree); + Main *bmain = CTX_data_main(C); + ntreeUpdateTree(bmain, snode->edittree); snode_notify(C, snode); snode_dag_update(C, snode); + /* Pasting nodes can create arbitrary new relations, because nodes can reference IDs. */ + DEG_relations_tag_update(bmain); return OPERATOR_FINISHED; } diff --git a/source/blender/editors/space_node/node_geometry_attribute_search.cc b/source/blender/editors/space_node/node_geometry_attribute_search.cc index 41f04dad221..982c57eb3ec 100644 --- a/source/blender/editors/space_node/node_geometry_attribute_search.cc +++ b/source/blender/editors/space_node/node_geometry_attribute_search.cc @@ -69,6 +69,12 @@ static void attribute_search_update_fn( UI_search_item_add(items, str, (void *)str, ICON_ADD, 0, 0); } + if (str[0] == '\0' && !is_first) { + /* Allow clearing the text field when the string is empty, but not on the first pass, + * or opening an attribute field for the first time would show this search item. */ + UI_search_item_add(items, str, (void *)str, ICON_X, 0, 0); + } + /* Skip the filter when the menu is first opened, so all of the items are visible. */ if (is_first) { for (const std::string &attribute_name : attribute_name_hints) { diff --git a/source/blender/editors/space_node/node_intern.h b/source/blender/editors/space_node/node_intern.h index 4ec8f56480e..19700b258ae 100644 --- a/source/blender/editors/space_node/node_intern.h +++ b/source/blender/editors/space_node/node_intern.h @@ -38,11 +38,9 @@ struct bContext; struct bNode; struct bNodeLink; struct bNodeSocket; -struct uiBut; struct wmGizmoGroupType; struct wmKeyConfig; struct wmWindow; -struct uiBlock; #ifdef __cplusplus extern "C" { diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c index d1260f02c67..09aa268d856 100644 --- a/source/blender/editors/space_outliner/outliner_edit.c +++ b/source/blender/editors/space_outliner/outliner_edit.c @@ -2267,7 +2267,7 @@ static bool ed_operator_outliner_id_orphans_active(bContext *C) /** \} */ -static int outliner_orphans_purge_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(evt)) +static int outliner_orphans_purge_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) { Main *bmain = CTX_data_main(C); int num_tagged[INDEX_ID_MAX] = {0}; diff --git a/source/blender/editors/space_outliner/tree/tree_display_libraries.cc b/source/blender/editors/space_outliner/tree/tree_display_libraries.cc index cb5f42f08e1..a81ce11498a 100644 --- a/source/blender/editors/space_outliner/tree/tree_display_libraries.cc +++ b/source/blender/editors/space_outliner/tree/tree_display_libraries.cc @@ -111,7 +111,7 @@ TreeElement *TreeDisplayLibraries::add_library_contents(Main &mainvar, { const short filter_id_type = id_filter_get(); - ListBase *lbarray[MAX_LIBARRAY]; + ListBase *lbarray[INDEX_ID_MAX]; int tot; if (filter_id_type) { lbarray[0] = which_libbase(&mainvar, space_outliner_.filter_id_type); diff --git a/source/blender/editors/space_outliner/tree/tree_display_orphaned.cc b/source/blender/editors/space_outliner/tree/tree_display_orphaned.cc index 0b17ea98831..559cb289f3f 100644 --- a/source/blender/editors/space_outliner/tree/tree_display_orphaned.cc +++ b/source/blender/editors/space_outliner/tree/tree_display_orphaned.cc @@ -42,7 +42,7 @@ TreeDisplayIDOrphans::TreeDisplayIDOrphans(SpaceOutliner &space_outliner) ListBase TreeDisplayIDOrphans::buildTree(const TreeSourceData &source_data) { ListBase tree = {nullptr}; - ListBase *lbarray[MAX_LIBARRAY]; + ListBase *lbarray[INDEX_ID_MAX]; short filter_id_type = (space_outliner_.filter & SO_FILTER_ID_TYPE) ? space_outliner_.filter_id_type : 0; diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c index 43cbcb0aba4..2037981e655 100644 --- a/source/blender/editors/transform/transform_constraints.c +++ b/source/blender/editors/transform/transform_constraints.c @@ -550,7 +550,7 @@ static void applyObjectConstraintSize(TransInfo *t, } static void constraints_rotation_impl(TransInfo *t, - float axismtx[3][3], + const float axismtx[3][3], float r_vec[3], float *r_angle) { @@ -621,7 +621,7 @@ static void applyObjectConstraintRot( { if (t->con.mode & CON_APPLY) { float tmp_axismtx[3][3]; - float(*axismtx)[3]; + const float(*axismtx)[3]; /* on setup call, use first object */ if (td == NULL) { diff --git a/source/blender/editors/transform/transform_convert_gpencil.c b/source/blender/editors/transform/transform_convert_gpencil.c index 244cd552495..45df0e66691 100644 --- a/source/blender/editors/transform/transform_convert_gpencil.c +++ b/source/blender/editors/transform/transform_convert_gpencil.c @@ -37,6 +37,7 @@ #include "BKE_gpencil_geom.h" #include "ED_gpencil.h" +#include "ED_keyframing.h" #include "transform.h" #include "transform_convert.h" @@ -114,6 +115,7 @@ static void createTransGPencil_curves(bContext *C, #define SEL_F3 (1 << 2) View3D *v3d = t->view; + Scene *scene = CTX_data_scene(C); const bool handle_only_selected_visible = (v3d->overlay.handle_display == CURVE_HANDLE_SELECTED); const bool handle_all_visible = (v3d->overlay.handle_display == CURVE_HANDLE_ALL); @@ -230,7 +232,9 @@ static void createTransGPencil_curves(bContext *C, } if ((gpf->framenum != cfra) && (!is_multiedit)) { - gpf = BKE_gpencil_frame_addcopy(gpl, cfra); + if (IS_AUTOKEY_ON(scene)) { + gpf = BKE_gpencil_frame_addcopy(gpl, cfra); + } /* in some weird situations (framelock enabled) return NULL */ if (gpf == NULL) { continue; @@ -405,6 +409,7 @@ static void createTransGPencil_strokes(bContext *C, const bool is_prop_edit_connected, const bool is_scale_thickness) { + Scene *scene = CTX_data_scene(C); TransData *td = NULL; float mtx[3][3], smtx[3][3]; @@ -517,7 +522,9 @@ static void createTransGPencil_strokes(bContext *C, * spent too much time editing the wrong frame... */ if ((gpf->framenum != cfra) && (!is_multiedit)) { - gpf = BKE_gpencil_frame_addcopy(gpl, cfra); + if (IS_AUTOKEY_ON(scene)) { + gpf = BKE_gpencil_frame_addcopy(gpl, cfra); + } /* in some weird situations (framelock enabled) return NULL */ if (gpf == NULL) { continue; diff --git a/source/blender/editors/util/ed_draw.c b/source/blender/editors/util/ed_draw.c index 94adba36664..d7b22b4f601 100644 --- a/source/blender/editors/util/ed_draw.c +++ b/source/blender/editors/util/ed_draw.c @@ -116,7 +116,7 @@ BLI_INLINE bool metadata_is_valid(ImBuf *ibuf, char *r_str, short index, int off BLI_INLINE bool metadata_is_custom_drawable(const char *field) { - /* Metadata field stored by Blender for multilayer EXR images. Is rather + /* Metadata field stored by Blender for multi-layer EXR images. Is rather * useless to be viewed all the time. Can still be seen in the Metadata * panel. */ if (STREQ(field, "BlenderMultiChannel")) { |