diff options
author | Sergey Sharybin <sergey@blender.org> | 2021-01-19 16:28:44 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey@blender.org> | 2021-01-26 18:23:09 +0300 |
commit | 66f8835f9c03e7736297b5995a68e1455ed14e2a (patch) | |
tree | d44f2a93d14c55944a5ae55282a1527d7db90664 /source/blender/editors/include/ED_clip.h | |
parent | 3d3b6d94e6e646828bd03c5656673a5d00a806aa (diff) |
Fix T84850: "Lock to Selection" causes unwanted jumps
Adding new tracks, mask points, mask primitives, changing selection was
causing an unwanted jumps in the view.
This change makes it so those operations are preserving view offset.
Differential Revision: https://developer.blender.org/D10146
Diffstat (limited to 'source/blender/editors/include/ED_clip.h')
-rw-r--r-- | source/blender/editors/include/ED_clip.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/source/blender/editors/include/ED_clip.h b/source/blender/editors/include/ED_clip.h index 0a66c439f79..56494f87bfe 100644 --- a/source/blender/editors/include/ED_clip.h +++ b/source/blender/editors/include/ED_clip.h @@ -99,6 +99,30 @@ void ED_space_clip_set_clip(struct bContext *C, struct Mask *ED_space_clip_get_mask(struct SpaceClip *sc); void ED_space_clip_set_mask(struct bContext *C, struct SpaceClip *sc, struct Mask *mask); +/* Locked state is used to preserve current clip editor viewport upon changes. Example usage: + * + * ... + * + * ClipViewLockState lock_state; + * ED_clip_view_lock_state_store(C, &lock_state); + * + * <change selection> + * + * ED_clip_view_lock_state_restore_no_jump(C, &lock_state); + * + * These function are to be used from space clip editor context only. Otherwise debug builds will + * assert, release builds will crash. */ + +typedef struct ClipViewLockState { + float offset_x, offset_y; + float lock_offset_x, lock_offset_y; + float zoom; +} ClipViewLockState; + +void ED_clip_view_lock_state_store(const struct bContext *C, ClipViewLockState *state); +void ED_clip_view_lock_state_restore_no_jump(const struct bContext *C, + const ClipViewLockState *state); + /* ** clip_ops.c ** */ void ED_operatormacros_clip(void); |