Fix #107830: missing snap indication in measure tool
Error happened because the activated snap state was different from the one being drawn. So create a utility that activates the correct state.
This commit is contained in:
committed by
Germano Cavalcante
parent
64f9a30cbd
commit
16228f2d71
@@ -270,7 +270,10 @@ static void snap_gizmo_draw(const bContext *UNUSED(C), wmGizmo *gz)
|
||||
if (snap_gizmo->snap_state == NULL) {
|
||||
snap_cursor_init(snap_gizmo);
|
||||
}
|
||||
/* All drawing is handled at the paint cursor. */
|
||||
|
||||
/* All drawing is handled at the paint cursor.
|
||||
* Therefore, make sure that the #V3DSnapCursorState is the one of the gizmo being drawn. */
|
||||
ED_view3d_cursor_snap_state_set(snap_gizmo->snap_state);
|
||||
}
|
||||
|
||||
static int snap_gizmo_test_select(bContext *C, wmGizmo *gz, const int mval[2])
|
||||
|
||||
@@ -337,6 +337,7 @@ typedef struct V3DSnapCursorState {
|
||||
|
||||
void ED_view3d_cursor_snap_state_default_set(V3DSnapCursorState *state);
|
||||
V3DSnapCursorState *ED_view3d_cursor_snap_state_get(void);
|
||||
void ED_view3d_cursor_snap_state_set(V3DSnapCursorState *state);
|
||||
V3DSnapCursorState *ED_view3d_cursor_snap_active(void);
|
||||
void ED_view3d_cursor_snap_deactive(V3DSnapCursorState *state);
|
||||
void ED_view3d_cursor_snap_prevpoint_set(V3DSnapCursorState *state, const float prev_point[3]);
|
||||
|
||||
@@ -911,6 +911,26 @@ V3DSnapCursorState *ED_view3d_cursor_snap_state_get(void)
|
||||
return &((SnapStateIntern *)data_intern->state_intern.last)->snap_state;
|
||||
}
|
||||
|
||||
void ED_view3d_cursor_snap_state_set(V3DSnapCursorState *state)
|
||||
{
|
||||
if (state == &g_data_intern.state_default) {
|
||||
BLI_assert_unreachable();
|
||||
return;
|
||||
}
|
||||
|
||||
SnapStateIntern *state_intern = STATE_INTERN_GET(state);
|
||||
if (state_intern == (SnapStateIntern *)g_data_intern.state_intern.last) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!BLI_remlink_safe(&g_data_intern.state_intern, state_intern)) {
|
||||
BLI_assert_unreachable();
|
||||
return;
|
||||
}
|
||||
|
||||
BLI_addtail(&g_data_intern.state_intern, state_intern);
|
||||
}
|
||||
|
||||
static void v3d_cursor_snap_activate(void)
|
||||
{
|
||||
SnapCursorDataIntern *data_intern = &g_data_intern;
|
||||
|
||||
Reference in New Issue
Block a user