Fix #106323: Snap to Face Nearest not working
Face Nearest only works with individual projection, so always set the `SCE_SNAP_PROJECT` flag in this case. Also gray out the `Project Individual Elements` option in the UI if `Face Nearest` is enabled. And change the description to indicate that `Project Individual Elements` is always enabled with the `Face Nearest` option. (I feel a better design for this option needs to be considered).
This commit is contained in:
parent
f898c22349
commit
6778460e53
|
@ -7053,13 +7053,16 @@ class VIEW3D_PT_snapping(Panel):
|
|||
|
||||
col.prop(tool_settings, "use_snap_backface_culling")
|
||||
|
||||
if 'FACE' in snap_elements:
|
||||
col.prop(tool_settings, "use_snap_project")
|
||||
is_face_nearest_enabled = 'FACE_NEAREST' in snap_elements
|
||||
if is_face_nearest_enabled or 'FACE' in snap_elements:
|
||||
sub = col.column()
|
||||
sub.active = not is_face_nearest_enabled
|
||||
sub.prop(tool_settings, "use_snap_project")
|
||||
|
||||
if 'FACE_NEAREST' in snap_elements:
|
||||
col.prop(tool_settings, "use_snap_to_same_target")
|
||||
if object_mode == 'EDIT':
|
||||
col.prop(tool_settings, "snap_face_nearest_steps")
|
||||
if is_face_nearest_enabled:
|
||||
col.prop(tool_settings, "use_snap_to_same_target")
|
||||
if object_mode == 'EDIT':
|
||||
col.prop(tool_settings, "snap_face_nearest_steps")
|
||||
|
||||
if 'VOLUME' in snap_elements:
|
||||
col.prop(tool_settings, "use_snap_peel_object")
|
||||
|
|
|
@ -740,12 +740,18 @@ static void initSnappingMode(TransInfo *t)
|
|||
t->tsnap.mode = SCE_SNAP_MODE_INCREMENT;
|
||||
}
|
||||
|
||||
if ((t->spacetype != SPACE_VIEW3D) || !(t->tsnap.mode & SCE_SNAP_MODE_FACE_RAYCAST) ||
|
||||
(t->tsnap.mode & SCE_SNAP_MODE_FACE_NEAREST) || (t->flag & T_NO_PROJECT)) {
|
||||
if ((t->spacetype != SPACE_VIEW3D) ||
|
||||
!(t->tsnap.mode & (SCE_SNAP_MODE_FACE_RAYCAST | SCE_SNAP_MODE_FACE_NEAREST)) ||
|
||||
(t->flag & T_NO_PROJECT)) {
|
||||
/* Force project off when not supported. */
|
||||
t->tsnap.flag &= ~SCE_SNAP_PROJECT;
|
||||
}
|
||||
|
||||
if (t->tsnap.mode & SCE_SNAP_MODE_FACE_NEAREST) {
|
||||
/* This mode only works with individual projection. */
|
||||
t->tsnap.flag |= SCE_SNAP_PROJECT;
|
||||
}
|
||||
|
||||
setSnappingCallback(t);
|
||||
|
||||
if (t->spacetype == SPACE_VIEW3D) {
|
||||
|
|
|
@ -2307,7 +2307,7 @@ typedef enum eSnapMode {
|
|||
/* Due to dependency conflicts with Cycles, header cannot directly include `BLI_utildefines.h`. */
|
||||
/* TODO: move this macro to a more general place. */
|
||||
#ifdef ENUM_OPERATORS
|
||||
ENUM_OPERATORS(eSnapMode, SCE_SNAP_MODE_GRID)
|
||||
ENUM_OPERATORS(eSnapMode, SCE_SNAP_MODE_FACE_NEAREST)
|
||||
#endif
|
||||
|
||||
#define SCE_SNAP_MODE_GEOM \
|
||||
|
|
|
@ -3414,7 +3414,8 @@ static void rna_def_tool_settings(BlenderRNA *brna)
|
|||
RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP_PROJECT);
|
||||
RNA_def_property_ui_text(prop,
|
||||
"Project Individual Elements",
|
||||
"Project individual elements on the surface of other objects");
|
||||
"Project individual elements on the surface of other objects (Always "
|
||||
"enabled with Face Nearest)");
|
||||
RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
|
||||
|
||||
prop = RNA_def_property(srna, "use_snap_backface_culling", PROP_BOOLEAN, PROP_NONE);
|
||||
|
|
Loading…
Reference in New Issue