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:
authorLukas Tönne <lukas.toenne@gmail.com>2021-08-24 19:45:40 +0300
committerLukas Tönne <lukas.toenne@gmail.com>2021-08-24 20:00:05 +0300
commit19da434e9cc020a88d71d7e8a2e210fd79cab321 (patch)
treeb5e8c3e615564271b86cb7d976345691370cd5f8 /source/blender/editors/include
parent38bdde852f1c38a2eaba2b8efc15b49f226baffd (diff)
Nodes: Improvements to edge panning in the node editor.
- New operator property to toggle edge panning in the keymap: This is disabled by default to avoid edge-panning in cases where it gets distracting, such as adding a new node. Only the explicit translate operator(s) (GKEY or drag) have this enabled now. - Restore the initial view rect on edge pan cancel: The initial view rect is now stored in the edge pan operator data. When an operator with edge panning is cancelled it can now call the `UI_view2d_edge_pan_cancel` function to restore the original View2D rect. - Less delay in node editor scrolling: Delay is useful when scrolling through long lists, such as in the outliner, but makes node scrolling feel sluggish and unresponsive. The lower scroll speed here makes a faster response the better option. - Zoom influence feature: Somewhat slower scrolling in UI-space when zoomed out. With the 0.5 zoom influence factor nodes behave as if zoom factor is halved, otherwise it gets too fast when zoomed out. Previously scrolling would always be constant-speed in UI space, now it's half-way between UI space and node (view) space.
Diffstat (limited to 'source/blender/editors/include')
-rw-r--r--source/blender/editors/include/ED_node.h5
-rw-r--r--source/blender/editors/include/ED_transform.h1
-rw-r--r--source/blender/editors/include/UI_view2d.h17
3 files changed, 19 insertions, 4 deletions
diff --git a/source/blender/editors/include/ED_node.h b/source/blender/editors/include/ED_node.h
index 6e4002fcc0a..1d51a3e77cf 100644
--- a/source/blender/editors/include/ED_node.h
+++ b/source/blender/editors/include/ED_node.h
@@ -53,8 +53,9 @@ typedef enum {
#define NODE_EDGE_PAN_INSIDE_PAD 2
#define NODE_EDGE_PAN_OUTSIDE_PAD 0 /* Disable clamping for node panning, use whole screen. */
#define NODE_EDGE_PAN_SPEED_RAMP 1
-#define NODE_EDGE_PAN_MAX_SPEED 40 /* In UI units per second, slower than default. */
-#define NODE_EDGE_PAN_DELAY 1.0f
+#define NODE_EDGE_PAN_MAX_SPEED 26 /* In UI units per second, slower than default. */
+#define NODE_EDGE_PAN_DELAY 0.5f
+#define NODE_EDGE_PAN_ZOOM_INFLUENCE 0.5f
/* space_node.c */
diff --git a/source/blender/editors/include/ED_transform.h b/source/blender/editors/include/ED_transform.h
index cb6fb0dba60..69ac48d842f 100644
--- a/source/blender/editors/include/ED_transform.h
+++ b/source/blender/editors/include/ED_transform.h
@@ -137,6 +137,7 @@ int BIF_countTransformOrientation(const struct bContext *C);
#define P_GPENCIL_EDIT (1 << 13)
#define P_CURSOR_EDIT (1 << 14)
#define P_CLNOR_INVALIDATE (1 << 15)
+#define P_VIEW2D_EDGE_PAN (1 << 16)
/* For properties performed when confirming the transformation. */
#define P_POST_TRANSFORM (1 << 19)
diff --git a/source/blender/editors/include/UI_view2d.h b/source/blender/editors/include/UI_view2d.h
index 4ee7df89487..e3c02b4c249 100644
--- a/source/blender/editors/include/UI_view2d.h
+++ b/source/blender/editors/include/UI_view2d.h
@@ -26,6 +26,7 @@
#pragma once
#include "BLI_compiler_attrs.h"
+#include "BLI_rect.h"
#ifdef __cplusplus
extern "C" {
@@ -321,6 +322,14 @@ typedef struct View2DEdgePanData {
float max_speed;
/** Delay in seconds before maximum speed is reached. */
float delay;
+ /** Influence factor for view zoom:
+ * 0 = Constant speed in UI units
+ * 1 = Constant speed in view space, UI speed slows down when zooming out
+ */
+ float zoom_influence;
+
+ /** Initial view rect. */
+ rctf initial_rect;
/** Amount to move view relative to zoom. */
float facx, facy;
@@ -338,7 +347,8 @@ void UI_view2d_edge_pan_init(struct bContext *C,
float outside_pad,
float speed_ramp,
float max_speed,
- float delay);
+ float delay,
+ float zoom_influence);
void UI_view2d_edge_pan_reset(struct View2DEdgePanData *vpd);
@@ -350,6 +360,8 @@ void UI_view2d_edge_pan_apply_event(struct bContext *C,
struct View2DEdgePanData *vpd,
const struct wmEvent *event);
+void UI_view2d_edge_pan_cancel(struct bContext *C, struct View2DEdgePanData *vpd);
+
void UI_view2d_edge_pan_operator_properties(struct wmOperatorType *ot);
void UI_view2d_edge_pan_operator_properties_ex(struct wmOperatorType *ot,
@@ -357,7 +369,8 @@ void UI_view2d_edge_pan_operator_properties_ex(struct wmOperatorType *ot,
float outside_pad,
float speed_ramp,
float max_speed,
- float delay);
+ float delay,
+ float zoom_influence);
/* Initialize panning data with operator settings. */
void UI_view2d_edge_pan_operator_init(struct bContext *C,