1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-09 12:50:35 +00:00

Ensure gizmos are added to newly created Node3D-derivatives and silence error for attempting to create gizmos twice

This commit is contained in:
SaracenOne
2022-04-13 04:10:44 +01:00
parent 895f2a21f4
commit f8cc2e054d
2 changed files with 4 additions and 10 deletions

View File

@@ -7120,8 +7120,10 @@ void Node3DEditor::_request_gizmo(Object *p_obj) {
} }
} }
} }
if (!sp->get_gizmos().is_empty()) {
sp->update_gizmos(); sp->update_gizmos();
} }
}
} }
void Node3DEditor::_set_subgizmo_selection(Object *p_obj, Ref<Node3DGizmo> p_gizmo, int p_id, Transform3D p_transform) { void Node3DEditor::_set_subgizmo_selection(Object *p_obj, Ref<Node3DGizmo> p_gizmo, int p_id, Transform3D p_transform) {

View File

@@ -181,15 +181,6 @@ void Node3D::_notification(int p_what) {
#ifdef TOOLS_ENABLED #ifdef TOOLS_ENABLED
if (Engine::get_singleton()->is_editor_hint() && get_tree()->is_node_being_edited(this)) { if (Engine::get_singleton()->is_editor_hint() && get_tree()->is_node_being_edited(this)) {
get_tree()->call_group_flags(0, SceneStringNames::get_singleton()->_spatial_editor_group, SceneStringNames::get_singleton()->_request_gizmo, this); get_tree()->call_group_flags(0, SceneStringNames::get_singleton()->_spatial_editor_group, SceneStringNames::get_singleton()->_request_gizmo, this);
if (!data.gizmos_disabled) {
for (int i = 0; i < data.gizmos.size(); i++) {
data.gizmos.write[i]->create();
if (is_visible_in_tree()) {
data.gizmos.write[i]->redraw();
}
data.gizmos.write[i]->transform();
}
}
} }
#endif #endif
} break; } break;
@@ -427,6 +418,7 @@ void Node3D::update_gizmos() {
} }
if (data.gizmos.is_empty()) { if (data.gizmos.is_empty()) {
get_tree()->call_group_flags(0, SceneStringNames::get_singleton()->_spatial_editor_group, SceneStringNames::get_singleton()->_request_gizmo, this);
return; return;
} }
if (data.gizmos_dirty) { if (data.gizmos_dirty) {