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/gizmo_library
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/gizmo_library')
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/snap3d_gizmo.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/source/blender/editors/gizmo_library/gizmo_types/snap3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/snap3d_gizmo.c
index 33532bd0549..93ee6ec2d81 100644
--- a/source/blender/editors/gizmo_library/gizmo_types/snap3d_gizmo.c
+++ b/source/blender/editors/gizmo_library/gizmo_types/snap3d_gizmo.c
@@ -225,8 +225,10 @@ static void snap_gizmo_setup(wmGizmo *gz)
gz->flag |= WM_GIZMO_NO_TOOLTIP;
SnapGizmo3D *snap_gizmo = (SnapGizmo3D *)gz;
snap_gizmo->snap_state = ED_view3d_cursor_snap_active();
- snap_gizmo->snap_state->draw_point = true;
- snap_gizmo->snap_state->draw_plane = false;
+ if (snap_gizmo->snap_state) {
+ snap_gizmo->snap_state->draw_point = true;
+ snap_gizmo->snap_state->draw_plane = false;
+ }
rgba_float_to_uchar(snap_gizmo->snap_state->color_point, gz->color);
}
@@ -284,7 +286,9 @@ static int snap_gizmo_invoke(bContext *UNUSED(C),
static void snap_gizmo_free(wmGizmo *gz)
{
SnapGizmo3D *snap_gizmo = (SnapGizmo3D *)gz;
- ED_view3d_cursor_snap_deactive(snap_gizmo->snap_state);
+ if (snap_gizmo->snap_state) {
+ ED_view3d_cursor_snap_deactive(snap_gizmo->snap_state);
+ }
}
static void GIZMO_GT_snap_3d(wmGizmoType *gzt)