Fix #115153: Snap Base in Camera View crashes Blender

Snap to geometry is not supported when moving camera in camera view.

This is because the camera would make jumps that would be difficult to
predict and control.

The same happens if Snap Base were supported.

Therefore, disable Edit Snap Base when transforming camera into camera
view.
This commit is contained in:
Germano Cavalcante
2023-11-20 11:09:16 -03:00
parent 6ccb30246d
commit 07b5e1bd80
2 changed files with 10 additions and 0 deletions

View File

@@ -707,6 +707,10 @@ static bool transform_modal_item_poll(const wmOperator *op, int value)
/* More modes can be added over time if this feature proves useful for them. */
return false;
}
if (t->options & CTX_CAMERA) {
/* Not supported. */
return false;
}
break;
}
case TFM_MODAL_PASSTHROUGH_NAVIGATE:

View File

@@ -165,6 +165,12 @@ void transform_mode_snap_source_init(TransInfo *t, wmOperator * /*op*/)
return;
}
if (t->tsnap.snap_target_fn) {
/* A `snap_target_fn` is required for the operation to work.
* `snap_target_fn` can be `nullptr` when transforming camera in camera view. */
return;
}
if (ELEM(t->mode, TFM_INIT, TFM_DUMMY)) {
/* Fallback */
transform_mode_init(t, nullptr, TFM_TRANSLATION);