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:
authorSebastian Parborg <darkdefende@gmail.com>2019-12-04 18:00:03 +0300
committerSebastian Parborg <darkdefende@gmail.com>2019-12-04 18:02:58 +0300
commit7868db9343d577784aa754418f2b888793a01d25 (patch)
tree56b4cb1d1ef6f813cc1881d50d2e26e89a8912ca /source/blender/editors/interface/view2d.c
parent824c2659382b2c76c3e6ec53ca598647af104446 (diff)
Make curve decimation only take into account the selected curve points
Previously the decimation would take the whole curve into account when decimating and not just the selected part. This also contains various smaller bug fixes for the fcurve decimation. Reviewed By: Sybren Differential Revision: http://developer.blender.org/D6286
Diffstat (limited to 'source/blender/editors/interface/view2d.c')
-rw-r--r--source/blender/editors/interface/view2d.c34
1 files changed, 28 insertions, 6 deletions
diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c
index b1a060089ee..a3f84e7bdd0 100644
--- a/source/blender/editors/interface/view2d.c
+++ b/source/blender/editors/interface/view2d.c
@@ -174,12 +174,9 @@ static void view2d_masks(View2D *v2d, bool check_scrollers, const rcti *mask_scr
* - if they overlap, they must not occupy the corners (which are reserved for other widgets)
*/
if (scroll) {
- const int scroll_width = (v2d->scroll & V2D_SCROLL_VERTICAL_HANDLES) ?
- V2D_SCROLL_HANDLE_WIDTH :
- V2D_SCROLL_WIDTH;
- const int scroll_height = (v2d->scroll & V2D_SCROLL_HORIZONTAL_HANDLES) ?
- V2D_SCROLL_HANDLE_HEIGHT :
- V2D_SCROLL_HEIGHT;
+ float scroll_width, scroll_height;
+
+ UI_view2d_scroller_size_get(v2d, &scroll_width, &scroll_height);
/* vertical scroller */
if (scroll & V2D_SCROLL_LEFT) {
@@ -1939,6 +1936,31 @@ View2D *UI_view2d_fromcontext_rwin(const bContext *C)
return &(region->v2d);
}
+/* Get scrollbar sizes of the current 2D view. The size will be zero if the view has its scrollbars
+ * disabled. */
+void UI_view2d_scroller_size_get(const View2D *v2d, float *r_x, float *r_y)
+{
+ int scroll = view2d_scroll_mapped(v2d->scroll);
+
+ if (r_x) {
+ if (scroll & V2D_SCROLL_VERTICAL) {
+ *r_x = (scroll & V2D_SCROLL_VERTICAL_HANDLES) ? V2D_SCROLL_HANDLE_WIDTH : V2D_SCROLL_WIDTH;
+ }
+ else {
+ *r_x = 0;
+ }
+ }
+ if (r_y) {
+ if (scroll & V2D_SCROLL_HORIZONTAL) {
+ *r_y = (scroll & V2D_SCROLL_HORIZONTAL_HANDLES) ? V2D_SCROLL_HANDLE_HEIGHT :
+ V2D_SCROLL_HEIGHT;
+ }
+ else {
+ *r_y = 0;
+ }
+ }
+}
+
/**
* Calculate the scale per-axis of the drawing-area
*