Show instantiating message with position when using to drag to instantiate in 3D

This commit is contained in:
Robert Yevdokimov 2024-02-24 13:44:41 -05:00
parent 2e7fc81315
commit 967d03ac5c
1 changed files with 5 additions and 0 deletions

View File

@ -2972,6 +2972,10 @@ void Node3DEditorViewport::_notification(int p_what) {
}
if (preview_node->is_inside_tree()) {
preview_node_pos = spatial_editor->snap_point(_get_instance_position(preview_node_viewport_pos));
double snap = EDITOR_GET("interface/inspector/default_float_step");
int snap_step_decimals = Math::range_step_decimals(snap);
set_message(TTR("Instantiating:") + " (" + String::num(preview_node_pos.x, snap_step_decimals) + ", " +
String::num(preview_node_pos.y, snap_step_decimals) + ", " + String::num(preview_node_pos.z, snap_step_decimals) + ")");
Transform3D preview_gl_transform = Transform3D(Basis(), preview_node_pos);
preview_node->set_global_transform(preview_gl_transform);
if (!preview_node->is_visible()) {
@ -4213,6 +4217,7 @@ void Node3DEditorViewport::_create_preview_node(const Vector<String> &files) con
}
void Node3DEditorViewport::_remove_preview_node() {
set_message("");
if (preview_node->get_parent()) {
for (int i = preview_node->get_child_count() - 1; i >= 0; i--) {
Node *node = preview_node->get_child(i);