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/editors/screen/screen_ops.c')
-rw-r--r--source/blender/editors/screen/screen_ops.c79
1 files changed, 42 insertions, 37 deletions
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index 8d7d742e44b..cff3ecfbbd3 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -381,7 +381,7 @@ bool ED_operator_console_active(bContext *C)
static bool ed_object_hidden(const Object *ob)
{
/* if hidden but in edit mode, we still display, can happen with animation */
- return ((ob->restrictflag & OB_RESTRICT_VIEWPORT) && !(ob->mode & OB_MODE_EDIT));
+ return ((ob->visibility_flag & OB_HIDE_VIEWPORT) && !(ob->mode & OB_MODE_EDIT));
}
bool ED_operator_object_active(bContext *C)
@@ -403,7 +403,7 @@ bool ED_operator_object_active_editable_ex(bContext *C, const Object *ob)
}
if (ed_object_hidden(ob)) {
- CTX_wm_operator_poll_msg_set(C, "Cannot edit hidden obect");
+ CTX_wm_operator_poll_msg_set(C, "Cannot edit hidden object");
return false;
}
@@ -1023,10 +1023,7 @@ AZone *ED_area_azones_update(ScrArea *area, const int xy[2])
static void actionzone_exit(wmOperator *op)
{
- if (op->customdata) {
- MEM_freeN(op->customdata);
- }
- op->customdata = NULL;
+ MEM_SAFE_FREE(op->customdata);
G.moving &= ~G_TRANSFORM_WM;
}
@@ -1308,10 +1305,7 @@ static bool area_swap_init(wmOperator *op, const wmEvent *event)
static void area_swap_exit(bContext *C, wmOperator *op)
{
WM_cursor_modal_restore(CTX_wm_window(C));
- if (op->customdata) {
- MEM_freeN(op->customdata);
- }
- op->customdata = NULL;
+ MEM_SAFE_FREE(op->customdata);
}
static void area_swap_cancel(bContext *C, wmOperator *op)
@@ -1892,10 +1886,7 @@ static void area_move_apply(bContext *C, wmOperator *op)
static void area_move_exit(bContext *C, wmOperator *op)
{
- if (op->customdata) {
- MEM_freeN(op->customdata);
- }
- op->customdata = NULL;
+ MEM_SAFE_FREE(op->customdata);
/* this makes sure aligned edges will result in aligned grabbing */
BKE_screen_remove_double_scrverts(CTX_wm_screen(C));
@@ -2906,7 +2897,7 @@ static void areas_do_frame_follow(bContext *C, bool middle)
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
LISTBASE_FOREACH (ARegion *, region, &area->regionbase) {
/* do follow here if editor type supports it */
- if ((screen_ctx->redraws_flag & TIME_FOLLOW)) {
+ if (screen_ctx->redraws_flag & TIME_FOLLOW) {
if ((region->regiontype == RGN_TYPE_WINDOW &&
ELEM(area->spacetype, SPACE_SEQ, SPACE_GRAPH, SPACE_ACTION, SPACE_NLA)) ||
(area->spacetype == SPACE_CLIP && region->regiontype == RGN_TYPE_PREVIEW)) {
@@ -3057,8 +3048,7 @@ static int keyframe_jump_exec(bContext *C, wmOperator *op)
float cfra = (float)(CFRA);
/* init binarytree-list for getting keyframes */
- DLRBT_Tree keys;
- BLI_dlrbTree_init(&keys);
+ struct AnimKeylist *keylist = ED_keylist_create();
/* seed up dummy dopesheet context with flags to perform necessary filtering */
if ((scene->flag & SCE_KEYS_NO_SELONLY) == 0) {
@@ -3067,14 +3057,14 @@ static int keyframe_jump_exec(bContext *C, wmOperator *op)
}
/* populate tree with keyframe nodes */
- scene_to_keylist(&ads, scene, &keys, 0);
+ scene_to_keylist(&ads, scene, keylist, 0);
if (ob) {
- ob_to_keylist(&ads, ob, &keys, 0);
+ ob_to_keylist(&ads, ob, keylist, 0);
if (ob->type == OB_GPENCIL) {
const bool active = !(scene->flag & SCE_KEYS_NO_SELONLY);
- gpencil_to_keylist(&ads, ob->data, &keys, active);
+ gpencil_to_keylist(&ads, ob->data, keylist, active);
}
}
@@ -3082,17 +3072,17 @@ static int keyframe_jump_exec(bContext *C, wmOperator *op)
Mask *mask = CTX_data_edit_mask(C);
if (mask) {
MaskLayer *masklay = BKE_mask_layer_active(mask);
- mask_to_keylist(&ads, masklay, &keys);
+ mask_to_keylist(&ads, masklay, keylist);
}
}
/* find matching keyframe in the right direction */
- ActKeyColumn *ak;
+ const ActKeyColumn *ak;
if (next) {
- ak = (ActKeyColumn *)BLI_dlrbTree_search_next(&keys, compare_ak_cfraPtr, &cfra);
+ ak = ED_keylist_find_next(keylist, cfra);
}
else {
- ak = (ActKeyColumn *)BLI_dlrbTree_search_prev(&keys, compare_ak_cfraPtr, &cfra);
+ ak = ED_keylist_find_prev(keylist, cfra);
}
while ((ak != NULL) && (done == false)) {
@@ -3113,7 +3103,7 @@ static int keyframe_jump_exec(bContext *C, wmOperator *op)
}
/* free temp stuff */
- BLI_dlrbTree_free(&keys);
+ ED_keylist_free(keylist);
/* any success? */
if (done == false) {
@@ -4488,10 +4478,8 @@ static bool match_region_with_redraws(const ScrArea *area,
return false;
}
-static void screen_animation_region_tag_redraw(ScrArea *area,
- ARegion *region,
- const Scene *scene,
- eScreen_Redraws_Flag redraws)
+static void screen_animation_region_tag_redraw(
+ bContext *C, ScrArea *area, ARegion *region, const Scene *scene, eScreen_Redraws_Flag redraws)
{
/* Do follow time here if editor type supports it */
if ((redraws & TIME_FOLLOW) &&
@@ -4515,10 +4503,29 @@ static void screen_animation_region_tag_redraw(ScrArea *area,
* We do need to redraw when this area is in full screen as no other areas
* will be tagged for redrawing. */
if (region->regiontype == RGN_TYPE_WINDOW && !area->full) {
- if (ELEM(area->spacetype, SPACE_GRAPH, SPACE_NLA, SPACE_ACTION)) {
+ if (ELEM(area->spacetype, SPACE_NLA, SPACE_ACTION)) {
return;
}
+ /* Drivers Editor needs a full redraw on playback for graph_draw_driver_debug().
+ * This will make it slower than regular graph editor during playback, but drawing this in
+ * graph_main_region_draw_overlay() is not feasible because it requires animation filtering
+ * which has significant overhead which needs to be avoided in the overlay which is redrawn on
+ * every UI interaction. */
+ if (area->spacetype == SPACE_GRAPH) {
+ const SpaceGraph *sipo = area->spacedata.first;
+ if (sipo->mode != SIPO_MODE_DRIVERS) {
+ return;
+ }
+ bAnimContext ac;
+ if (ANIM_animdata_get_context(C, &ac) == false) {
+ return;
+ }
+ if (ac.datatype != ANIMCONT_DRIVERS) {
+ return;
+ }
+ }
+
if (area->spacetype == SPACE_SEQ) {
const SpaceSeq *sseq = area->spacedata.first;
if (!ED_space_sequencer_has_playback_animation(sseq, scene)) {
@@ -4712,7 +4719,7 @@ static int screen_animation_step_invoke(bContext *C, wmOperator *UNUSED(op), con
}
if (redraw) {
- screen_animation_region_tag_redraw(area, region, scene, sad->redraws);
+ screen_animation_region_tag_redraw(C, area, region, scene, sad->redraws);
}
}
}
@@ -5695,10 +5702,7 @@ static void keymap_modal_set(wmKeyConfig *keyconf)
WM_modalkeymap_assign(keymap, "SCREEN_OT_area_move");
}
-static bool blend_file_drop_poll(bContext *UNUSED(C),
- wmDrag *drag,
- const wmEvent *UNUSED(event),
- const char **UNUSED(r_tooltip))
+static bool blend_file_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event))
{
if (drag->type == WM_DRAG_PATH) {
if (drag->icon == ICON_FILE_BLEND) {
@@ -5728,8 +5732,9 @@ void ED_keymap_screen(wmKeyConfig *keyconf)
/* dropbox for entire window */
ListBase *lb = WM_dropboxmap_find("Window", 0, 0);
- WM_dropbox_add(lb, "WM_OT_drop_blend_file", blend_file_drop_poll, blend_file_drop_copy, NULL);
- WM_dropbox_add(lb, "UI_OT_drop_color", UI_drop_color_poll, UI_drop_color_copy, NULL);
+ WM_dropbox_add(
+ lb, "WM_OT_drop_blend_file", blend_file_drop_poll, blend_file_drop_copy, NULL, NULL);
+ WM_dropbox_add(lb, "UI_OT_drop_color", UI_drop_color_poll, UI_drop_color_copy, NULL, NULL);
keymap_modal_set(keyconf);
}