Minor fixes to Node3DEditorPlugin
* Change EditorNode3D::update_all_gizmos() to start at the edited scene root instead of the whole editor root. * Call update_all_gizmos() only once at start instead of evrey time a gizmo plugin is added. * Add missing null check.
This commit is contained in:
parent
f32c042f3e
commit
49361034f9
@ -690,6 +690,7 @@ void Node3DEditorViewport::_select_region() {
|
|||||||
Node3D *single_selected = spatial_editor->get_single_selected_node();
|
Node3D *single_selected = spatial_editor->get_single_selected_node();
|
||||||
Node3DEditorSelectedItem *se = editor_selection->get_node_editor_data<Node3DEditorSelectedItem>(single_selected);
|
Node3DEditorSelectedItem *se = editor_selection->get_node_editor_data<Node3DEditorSelectedItem>(single_selected);
|
||||||
|
|
||||||
|
if (se) {
|
||||||
Ref<EditorNode3DGizmo> old_gizmo;
|
Ref<EditorNode3DGizmo> old_gizmo;
|
||||||
if (!clicked_wants_append) {
|
if (!clicked_wants_append) {
|
||||||
se->subgizmos.clear();
|
se->subgizmos.clear();
|
||||||
@ -739,6 +740,7 @@ void Node3DEditorViewport::_select_region() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!clicked_wants_append) {
|
if (!clicked_wants_append) {
|
||||||
_clear_selected();
|
_clear_selected();
|
||||||
@ -4776,13 +4778,13 @@ void _update_all_gizmos(Node *p_node) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Node3DEditor::update_all_gizmos(Node *p_node) {
|
void Node3DEditor::update_all_gizmos(Node *p_node) {
|
||||||
if (!p_node) {
|
if (!p_node && get_tree()) {
|
||||||
if (SceneTree::get_singleton()) {
|
p_node = get_tree()->get_edited_scene_root();
|
||||||
p_node = SceneTree::get_singleton()->get_root();
|
|
||||||
} else {
|
|
||||||
// No scene tree, so nothing to update.
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!p_node) {
|
||||||
|
// No edited scene, so nothing to update.
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
_update_all_gizmos(p_node);
|
_update_all_gizmos(p_node);
|
||||||
}
|
}
|
||||||
@ -6591,6 +6593,7 @@ void Node3DEditor::_notification(int p_what) {
|
|||||||
_register_all_gizmos();
|
_register_all_gizmos();
|
||||||
_update_gizmos_menu();
|
_update_gizmos_menu();
|
||||||
_init_indicators();
|
_init_indicators();
|
||||||
|
update_all_gizmos();
|
||||||
} break;
|
} break;
|
||||||
case NOTIFICATION_EXIT_TREE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
_finish_indicators();
|
_finish_indicators();
|
||||||
@ -7724,7 +7727,6 @@ void Node3DEditor::add_gizmo_plugin(Ref<EditorNode3DGizmoPlugin> p_plugin) {
|
|||||||
gizmo_plugins_by_name.sort_custom<_GizmoPluginNameComparator>();
|
gizmo_plugins_by_name.sort_custom<_GizmoPluginNameComparator>();
|
||||||
|
|
||||||
_update_gizmos_menu();
|
_update_gizmos_menu();
|
||||||
Node3DEditor::get_singleton()->update_all_gizmos();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node3DEditor::remove_gizmo_plugin(Ref<EditorNode3DGizmoPlugin> p_plugin) {
|
void Node3DEditor::remove_gizmo_plugin(Ref<EditorNode3DGizmoPlugin> p_plugin) {
|
||||||
|
Loading…
Reference in New Issue
Block a user