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:
authorGermano Cavalcante <germano.costa@ig.com.br>2021-10-26 01:39:56 +0300
committerGermano Cavalcante <germano.costa@ig.com.br>2021-10-26 01:40:08 +0300
commit40f59b5dad15eab01ddd326fbffd59846f398c34 (patch)
treef51029a08752c89fd28769bcc8430ef1c1f8331c /source/blender/editors/space_view3d/view3d_cursor_snap.c
parent4468c343787471df8a7a71ceb066301d2eaa6dc6 (diff)
View3D Snap Cursor: sanitize and increase the maximum amount of states
3 is a small amount as each viewport creates a gizmo that creates its own state Now if the state is not created, the gizmos use the last state.
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_cursor_snap.c')
-rw-r--r--source/blender/editors/space_view3d/view3d_cursor_snap.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/source/blender/editors/space_view3d/view3d_cursor_snap.c b/source/blender/editors/space_view3d/view3d_cursor_snap.c
index 5eb9ec3625c..9c45a89c3ff 100644
--- a/source/blender/editors/space_view3d/view3d_cursor_snap.c
+++ b/source/blender/editors/space_view3d/view3d_cursor_snap.c
@@ -54,7 +54,7 @@
#include "WM_api.h"
-#define STATE_LEN 3
+#define STATE_LEN 8
typedef struct SnapStateIntern {
V3DSnapCursorState snap_state;
@@ -925,7 +925,6 @@ V3DSnapCursorState *ED_view3d_cursor_snap_active(void)
}
}
- BLI_assert(false);
data_intern->state_active_len--;
return NULL;
}
@@ -938,6 +937,10 @@ void ED_view3d_cursor_snap_deactive(V3DSnapCursorState *state)
return;
}
+ if (!state) {
+ return;
+ }
+
SnapStateIntern *state_intern = (SnapStateIntern *)state;
if (!state_intern->is_active) {
return;
@@ -956,6 +959,9 @@ void ED_view3d_cursor_snap_deactive(V3DSnapCursorState *state)
void ED_view3d_cursor_snap_prevpoint_set(V3DSnapCursorState *state, const float prev_point[3])
{
SnapCursorDataIntern *data_intern = &g_data_intern;
+ if (!state) {
+ state = ED_view3d_cursor_snap_state_get();
+ }
if (prev_point) {
copy_v3_v3(data_intern->prevpoint_stack, prev_point);
state->prevpoint = data_intern->prevpoint_stack;