Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_view3d/view3d_placement.c
| Show All 39 Lines | |||||
| #include "ED_view3d.h" | #include "ED_view3d.h" | ||||
| #include "UI_resources.h" | #include "UI_resources.h" | ||||
| #include "GPU_immediate.h" | #include "GPU_immediate.h" | ||||
| #include "view3d_intern.h" | #include "view3d_intern.h" | ||||
| #define SNAP_MODE_GEOM \ | |||||
| (SCE_SNAP_MODE_VERTEX | SCE_SNAP_MODE_EDGE | SCE_SNAP_MODE_FACE | \ | |||||
| SCE_SNAP_MODE_EDGE_PERPENDICULAR | SCE_SNAP_MODE_EDGE_MIDPOINT) | |||||
| static const char *view3d_gzgt_placement_id = "VIEW3D_GGT_placement"; | static const char *view3d_gzgt_placement_id = "VIEW3D_GGT_placement"; | ||||
| /** | /** | ||||
| * Dot products below this will be considered view aligned. | * Dot products below this will be considered view aligned. | ||||
| * In this case we can't usefully project the mouse cursor onto the plane, | * In this case we can't usefully project the mouse cursor onto the plane, | ||||
| * so use a fall-back plane instead. | * so use a fall-back plane instead. | ||||
| */ | */ | ||||
| static const float eps_view_align = 1e-2f; | static const float eps_view_align = 1e-2f; | ||||
| ▲ Show 20 Lines • Show All 1,243 Lines • ▼ Show 20 Lines | static int idp_rna_snap_target_get_fn(struct PointerRNA *UNUSED(ptr), | ||||
| struct PropertyRNA *UNUSED(prop)) | struct PropertyRNA *UNUSED(prop)) | ||||
| { | { | ||||
| V3DSnapCursorState *snap_state = ED_view3d_cursor_snap_state_get(); | V3DSnapCursorState *snap_state = ED_view3d_cursor_snap_state_get(); | ||||
| if (!snap_state->snap_elem_force) { | if (!snap_state->snap_elem_force) { | ||||
| return PLACE_SNAP_TO_DEFAULT; | return PLACE_SNAP_TO_DEFAULT; | ||||
| } | } | ||||
| /* Make sure you keep a consistent #snap_mode. */ | /* Make sure you keep a consistent #snap_mode. */ | ||||
| snap_state->snap_elem_force = SNAP_MODE_GEOM; | snap_state->snap_elem_force = SCE_SNAP_MODE_GEOM; | ||||
| return PLACE_SNAP_TO_GEOMETRY; | return PLACE_SNAP_TO_GEOMETRY; | ||||
| } | } | ||||
| static void idp_rna_snap_target_set_fn(struct PointerRNA *UNUSED(ptr), | static void idp_rna_snap_target_set_fn(struct PointerRNA *UNUSED(ptr), | ||||
| struct PropertyRNA *UNUSED(prop), | struct PropertyRNA *UNUSED(prop), | ||||
| int value) | int value) | ||||
| { | { | ||||
| short snap_mode = 0; /* #toolsettings->snap_mode. */ | short snap_mode = 0; /* #toolsettings->snap_mode. */ | ||||
| const enum ePlace_SnapTo snap_to = value; | const enum ePlace_SnapTo snap_to = value; | ||||
| if (snap_to == PLACE_SNAP_TO_GEOMETRY) { | if (snap_to == PLACE_SNAP_TO_GEOMETRY) { | ||||
| snap_mode = SNAP_MODE_GEOM; | snap_mode = SCE_SNAP_MODE_GEOM; | ||||
| } | } | ||||
| V3DSnapCursorState *snap_state = ED_view3d_cursor_snap_state_get(); | V3DSnapCursorState *snap_state = ED_view3d_cursor_snap_state_get(); | ||||
| snap_state->snap_elem_force = snap_mode; | snap_state->snap_elem_force = snap_mode; | ||||
| ED_view3d_cursor_snap_state_default_set(snap_state); | ED_view3d_cursor_snap_state_default_set(snap_state); | ||||
| } | } | ||||
| static bool idp_rna_use_plane_axis_auto_get_fn(struct PointerRNA *UNUSED(ptr), | static bool idp_rna_use_plane_axis_auto_get_fn(struct PointerRNA *UNUSED(ptr), | ||||
| ▲ Show 20 Lines • Show All 214 Lines • Show Last 20 Lines | |||||