| 7518 | } |
| 7519 | |
| 7520 | EditorNode::EditorNode() { |
| 7521 | DEV_ASSERT(!singleton); |
| 7522 | singleton = this; |
| 7523 | |
| 7524 | // Detecting headless mode, that means the editor is running in command line. |
| 7525 | if (!DisplayServer::get_singleton()->window_can_draw()) { |
| 7526 | cmdline_mode = true; |
| 7527 | } |
| 7528 | |
| 7529 | Resource::_get_local_scene_func = _resource_get_edited_scene; |
| 7530 | |
| 7531 | { |
| 7532 | PortableCompressedTexture2D::set_keep_all_compressed_buffers(true); |
| 7533 | RenderingServer::get_singleton()->set_debug_generate_wireframes(true); |
| 7534 | |
| 7535 | AudioServer::get_singleton()->set_enable_tagging_used_audio_streams(true); |
| 7536 | |
| 7537 | // No navigation by default if in editor. |
| 7538 | if (NavigationServer3D::get_singleton()->get_debug_enabled()) { |
| 7539 | NavigationServer3D::get_singleton()->set_active(true); |
| 7540 | } else { |
| 7541 | NavigationServer3D::get_singleton()->set_active(false); |
| 7542 | } |
| 7543 | |
| 7544 | // No physics by default if in editor. |
| 7545 | #ifndef PHYSICS_3D_DISABLED |
| 7546 | PhysicsServer3D::get_singleton()->set_active(false); |
| 7547 | #endif // PHYSICS_3D_DISABLED |
| 7548 | #ifndef PHYSICS_2D_DISABLED |
| 7549 | PhysicsServer2D::get_singleton()->set_active(false); |
| 7550 | #endif // PHYSICS_2D_DISABLED |
| 7551 | |
| 7552 | // No scripting by default if in editor (except for tool). |
| 7553 | ScriptServer::set_scripting_enabled(false); |
| 7554 | |
| 7555 | if (!DisplayServer::get_singleton()->is_touchscreen_available()) { |
| 7556 | // Only if no touchscreen ui hint, disable emulation just in case. |
| 7557 | Input::get_singleton()->set_emulate_touch_from_mouse(false); |
| 7558 | } |
| 7559 | if (DisplayServer::get_singleton()->has_feature(DisplayServer::FEATURE_CUSTOM_CURSOR_SHAPE)) { |
| 7560 | DisplayServer::get_singleton()->cursor_set_custom_image(Ref<Resource>()); |
| 7561 | } |
| 7562 | } |
| 7563 | |
| 7564 | SceneState::set_disable_placeholders(true); |
| 7565 | ResourceLoader::clear_translation_remaps(); // Using no remaps if in editor. |
| 7566 | ResourceLoader::set_create_missing_resources_if_class_unavailable(true); |
| 7567 | |
| 7568 | EditorPropertyNameProcessor *epnp = memnew(EditorPropertyNameProcessor); |
| 7569 | add_child(epnp); |
| 7570 | |
| 7571 | EditorUndoRedoManager::get_singleton()->connect("version_changed", callable_mp(this, &EditorNode::_update_undo_redo_allowed)); |
| 7572 | EditorUndoRedoManager::get_singleton()->connect("version_changed", callable_mp(this, &EditorNode::_update_unsaved_cache)); |
| 7573 | EditorUndoRedoManager::get_singleton()->connect("history_changed", callable_mp(this, &EditorNode::_update_undo_redo_allowed)); |
| 7574 | EditorUndoRedoManager::get_singleton()->connect("history_changed", callable_mp(this, &EditorNode::_update_unsaved_cache)); |
| 7575 | ProjectSettings::get_singleton()->connect("settings_changed", callable_mp(this, &EditorNode::_update_from_settings)); |
| 7576 | GDExtensionManager::get_singleton()->connect("extensions_reloaded", callable_mp(this, &EditorNode::_gdextensions_reloaded)); |
| 7577 |
nothing calls this directly
no test coverage detected