mirror of
				https://github.com/godotengine/godot.git
				synced 2025-11-03 23:21:15 +00:00 
			
		
		
		
	Clean up some Editor, OpenXR, VideoStream code
- EditorNode has excessive and pointless checks for Input singleton. - EditorNode initialization order is a bit awkward. - OpenXR binds a method that doesn't need that (for call deferred). - VideoStream has a formatting error.
This commit is contained in:
		
							parent
							
								
									f333e4acf5
								
							
						
					
					
						commit
						cd31407cb3
					
				
					 3 changed files with 30 additions and 34 deletions
				
			
		| 
						 | 
					@ -6728,18 +6728,18 @@ int EditorNode::execute_and_show_output(const String &p_title, const String &p_p
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
EditorNode::EditorNode() {
 | 
					EditorNode::EditorNode() {
 | 
				
			||||||
	EditorPropertyNameProcessor *epnp = memnew(EditorPropertyNameProcessor);
 | 
						DEV_ASSERT(!singleton);
 | 
				
			||||||
	add_child(epnp);
 | 
						singleton = this;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	PortableCompressedTexture2D::set_keep_all_compressed_buffers(true);
 | 
					 | 
				
			||||||
	Input::get_singleton()->set_use_accumulated_input(true);
 | 
					 | 
				
			||||||
	Resource::_get_local_scene_func = _resource_get_edited_scene;
 | 
						Resource::_get_local_scene_func = _resource_get_edited_scene;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							PortableCompressedTexture2D::set_keep_all_compressed_buffers(true);
 | 
				
			||||||
		RenderingServer::get_singleton()->set_debug_generate_wireframes(true);
 | 
							RenderingServer::get_singleton()->set_debug_generate_wireframes(true);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		AudioServer::get_singleton()->set_enable_tagging_used_audio_streams(true);
 | 
							AudioServer::get_singleton()->set_enable_tagging_used_audio_streams(true);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// No navigation server by default if in editor.
 | 
							// No navigation by default if in editor.
 | 
				
			||||||
		if (NavigationServer3D::get_singleton()->get_debug_enabled()) {
 | 
							if (NavigationServer3D::get_singleton()->get_debug_enabled()) {
 | 
				
			||||||
			NavigationServer3D::get_singleton()->set_active(true);
 | 
								NavigationServer3D::get_singleton()->set_active(true);
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
| 
						 | 
					@ -6750,27 +6750,25 @@ EditorNode::EditorNode() {
 | 
				
			||||||
		PhysicsServer3D::get_singleton()->set_active(false);
 | 
							PhysicsServer3D::get_singleton()->set_active(false);
 | 
				
			||||||
		PhysicsServer2D::get_singleton()->set_active(false);
 | 
							PhysicsServer2D::get_singleton()->set_active(false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// No scripting by default if in editor.
 | 
							// No scripting by default if in editor (except for tool).
 | 
				
			||||||
		ScriptServer::set_scripting_enabled(false);
 | 
							ScriptServer::set_scripting_enabled(false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							Input::get_singleton()->set_use_accumulated_input(true);
 | 
				
			||||||
 | 
							if (!DisplayServer::get_singleton()->is_touchscreen_available()) {
 | 
				
			||||||
 | 
								// Only if no touchscreen ui hint, disable emulation just in case.
 | 
				
			||||||
 | 
								Input::get_singleton()->set_emulate_touch_from_mouse(false);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							DisplayServer::get_singleton()->cursor_set_custom_image(Ref<Resource>());
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	EditorHelp::generate_doc();
 | 
						EditorHelp::generate_doc();
 | 
				
			||||||
	SceneState::set_disable_placeholders(true);
 | 
						SceneState::set_disable_placeholders(true);
 | 
				
			||||||
	ResourceLoader::clear_translation_remaps(); // Using no remaps if in editor.
 | 
						ResourceLoader::clear_translation_remaps(); // Using no remaps if in editor.
 | 
				
			||||||
	ResourceLoader::clear_path_remaps();
 | 
						ResourceLoader::clear_path_remaps();
 | 
				
			||||||
	ResourceLoader::set_create_missing_resources_if_class_unavailable(true);
 | 
						ResourceLoader::set_create_missing_resources_if_class_unavailable(true);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	Input *id = Input::get_singleton();
 | 
						EditorPropertyNameProcessor *epnp = memnew(EditorPropertyNameProcessor);
 | 
				
			||||||
 | 
						add_child(epnp);
 | 
				
			||||||
	if (id) {
 | 
					 | 
				
			||||||
		if (!DisplayServer::get_singleton()->is_touchscreen_available() && Input::get_singleton()) {
 | 
					 | 
				
			||||||
			// Only if no touchscreen ui hint, disable emulation just in case.
 | 
					 | 
				
			||||||
			id->set_emulate_touch_from_mouse(false);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		DisplayServer::get_singleton()->cursor_set_custom_image(Ref<Resource>());
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	DEV_ASSERT(!singleton);
 | 
					 | 
				
			||||||
	singleton = this;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	EditorUndoRedoManager::get_singleton()->connect("version_changed", callable_mp(this, &EditorNode::_update_undo_redo_allowed));
 | 
						EditorUndoRedoManager::get_singleton()->connect("version_changed", callable_mp(this, &EditorNode::_update_undo_redo_allowed));
 | 
				
			||||||
	EditorUndoRedoManager::get_singleton()->connect("history_changed", callable_mp(this, &EditorNode::_update_undo_redo_allowed));
 | 
						EditorUndoRedoManager::get_singleton()->connect("history_changed", callable_mp(this, &EditorNode::_update_undo_redo_allowed));
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -45,7 +45,6 @@
 | 
				
			||||||
void OpenXRInteractionProfileEditorBase::_bind_methods() {
 | 
					void OpenXRInteractionProfileEditorBase::_bind_methods() {
 | 
				
			||||||
	ClassDB::bind_method(D_METHOD("_add_binding", "action", "path"), &OpenXRInteractionProfileEditorBase::_add_binding);
 | 
						ClassDB::bind_method(D_METHOD("_add_binding", "action", "path"), &OpenXRInteractionProfileEditorBase::_add_binding);
 | 
				
			||||||
	ClassDB::bind_method(D_METHOD("_remove_binding", "action", "path"), &OpenXRInteractionProfileEditorBase::_remove_binding);
 | 
						ClassDB::bind_method(D_METHOD("_remove_binding", "action", "path"), &OpenXRInteractionProfileEditorBase::_remove_binding);
 | 
				
			||||||
	ClassDB::bind_method(D_METHOD("_update_interaction_profile"), &OpenXRInteractionProfileEditorBase::_update_interaction_profile);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void OpenXRInteractionProfileEditorBase::_notification(int p_what) {
 | 
					void OpenXRInteractionProfileEditorBase::_notification(int p_what) {
 | 
				
			||||||
| 
						 | 
					@ -63,7 +62,7 @@ void OpenXRInteractionProfileEditorBase::_notification(int p_what) {
 | 
				
			||||||
void OpenXRInteractionProfileEditorBase::_do_update_interaction_profile() {
 | 
					void OpenXRInteractionProfileEditorBase::_do_update_interaction_profile() {
 | 
				
			||||||
	if (!is_dirty) {
 | 
						if (!is_dirty) {
 | 
				
			||||||
		is_dirty = true;
 | 
							is_dirty = true;
 | 
				
			||||||
		call_deferred("_update_interaction_profile");
 | 
							callable_mp(this, &OpenXRInteractionProfileEditorBase::_update_interaction_profile).call_deferred();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -94,8 +94,7 @@ class VideoStream : public Resource {
 | 
				
			||||||
	OBJ_SAVE_TYPE(VideoStream);
 | 
						OBJ_SAVE_TYPE(VideoStream);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
protected:
 | 
					protected:
 | 
				
			||||||
	static void
 | 
						static void _bind_methods();
 | 
				
			||||||
	_bind_methods();
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	GDVIRTUAL0R(Ref<VideoStreamPlayback>, _instantiate_playback);
 | 
						GDVIRTUAL0R(Ref<VideoStreamPlayback>, _instantiate_playback);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue