Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document editor export presets in the class reference #49525

Closed

Conversation

Calinou
Copy link
Member

@Calinou Calinou commented Jun 12, 2021

The documentation appears as tooltips when hovering options in export presets.

This PR can be remade for the 3.x branch once we reach an agreement on its design.

This closes godotengine/godot-proposals#1955. See also #48548 and #49524 (can be merged independently).

Preview

Disregard the black text – it's not a bug related to this PR.

Tooltip

TODO

  • Only one export platform is present in the documentation right now. Generate the XML for all other export platforms.
  • Write documentation for all export platforms.

The documentation appears as tooltips when hovering options in
export presets.
@Calinou Calinou force-pushed the document-editor-export-presets branch from 6c5a2ad to e67ad37 Compare June 12, 2021 03:26
@Calinou Calinou changed the title Document editor export presets Document editor export presets in the class reference Jun 12, 2021
@Calinou
Copy link
Member Author

Calinou commented May 12, 2022

I've tried to rebase this following export changes in master (most notably EditorExportPlatformPC now being abstract). Unfortunately, I couldn't get it to work, as no EditorExportPlatformWindows.xml is generated (and EditorExportPlatformPC.xml no longer has properties):

diff --git a/doc/classes/EditorExportPlatformPC.xml b/doc/classes/EditorExportPlatformPC.xml
new file mode 100644
index 0000000000..eae12b1dc1
--- /dev/null
+++ b/doc/classes/EditorExportPlatformPC.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="EditorExportPlatformPC" inherits="EditorExportPlatform" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
+	<brief_description>
+		Exporter for desktop platforms (Windows, macOS, Linux).
+	</brief_description>
+	<description>
+		This exporter supports the following OS/architecture combinations:
+		[codeblock]
+		- Windows x86, Windows x86_64
+		- macOS x86_64, macOS ARMv8 (Apple Silicon)
+		    - Can be packed into an universal .app bundle.
+		    - x86 support is not available as Apple no longer supports 32-bit x86.
+		- Linux x86, x86_64
+		[/codeblock]
+		Support for other OS/architecture combinations (such as Linux + ARM) is possible by using custom export templates.
+	</description>
+	<tutorials>
+		<link title="Exporting for PC">https://docs.godotengine.org/en/latest/tutorials/export/exporting_for_pc.html</link>
+	</tutorials>
+</class>
diff --git a/editor/doc_tools.cpp b/editor/doc_tools.cpp
index 16cbc0f34d..d858d72061 100644
--- a/editor/doc_tools.cpp
+++ b/editor/doc_tools.cpp
@@ -39,6 +39,7 @@
 #include "core/object/script_language.h"
 #include "core/string/translation.h"
 #include "core/version.h"
+#include "platform/windows/export/export_plugin.h"
 #include "scene/resources/theme.h"
 
 // Used for a hack preserving Mono properties on non-Mono builds.
@@ -353,6 +354,11 @@ void DocTools::generate(bool p_basic_types) {
 			// Special case for project settings, so settings can be documented.
 			ProjectSettings::get_singleton()->get_property_list(&properties);
 			own_properties = properties;
+		} else if (name == "EditorExportPlatformWindows") {
+			EditorExportPlatformWindows *editor_export_platform = memnew(EditorExportPlatformWindows);
+			Ref<EditorExportPreset> export_preset = editor_export_platform->create_preset();
+			export_preset->get_property_list(&properties);
+			own_properties = properties;
 		} else {
 			ClassDB::get_property_list(name, &properties);
 			ClassDB::get_property_list(name, &own_properties, true);
@@ -388,6 +394,13 @@ void DocTools::generate(bool p_basic_types) {
 			bool default_value_valid = false;
 			Variant default_value;
 
+			if (name == "EditorExportPlatformWindows") {
+				if (E.name == "script") {
+					// Prevent spurious property from being added to the generated XML.
+					continue;
+				}
+			}
+
 			if (name == "ProjectSettings") {
 				// Special case for project settings, so that settings are not taken from the current project's settings
 				if (E.name == "script" || !ProjectSettings::get_singleton()->is_builtin_setting(E.name)) {
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 3b71c85422..7954beaf9c 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -204,6 +204,8 @@
 #include "editor/register_exporters.h"
 #include "editor/scene_tree_dock.h"
 
+#include "platform/windows/export/export_plugin.h"
+
 #include <stdio.h>
 #include <stdlib.h>
 
@@ -3923,6 +3925,16 @@ void EditorNode::register_editor_types() {
 	GDREGISTER_CLASS(EditorSyntaxHighlighter);
 	GDREGISTER_ABSTRACT_CLASS(EditorInterface);
 	GDREGISTER_CLASS(EditorExportPlugin);
+
+	// Required to document export preset properties in the class reference.
+	// GDREGISTER_CLASS(EditorExportPlatformAndroid);
+	// GDREGISTER_CLASS(EditorExportPlatformIOS);
+	// GDREGISTER_CLASS(EditorExportPlatformJavaScript);
+	// GDREGISTER_CLASS(EditorExportPlatformOSX);
+	GDREGISTER_ABSTRACT_CLASS(EditorExportPlatformPC);
+	GDREGISTER_CLASS(EditorExportPlatformWindows);
+	// GDREGISTER_CLASS(EditorExportPlatformUWP);
+
 	GDREGISTER_CLASS(EditorResourceConversionPlugin);
 	GDREGISTER_CLASS(EditorSceneFormatImporter);
 	GDREGISTER_CLASS(EditorScenePostImportPlugin);
diff --git a/editor/project_export.cpp b/editor/project_export.cpp
index 1344afbd3a..8c6c58db6a 100644
--- a/editor/project_export.cpp
+++ b/editor/project_export.cpp
@@ -238,6 +238,9 @@ void ProjectExportDialog::_edit_preset(int p_index) {
 	export_path->update_property();
 	runnable->set_disabled(false);
 	runnable->set_pressed(current->is_runnable());
+	// Set the importer class to fetch the correct class in the XML class reference.
+	// This allows tooltips to display when hovering properties.
+	parameters->set_object_class(current->get_platform()->get_class_name());
 	parameters->edit(current.ptr());
 
 	export_filter->select(current->get_export_filter());
@@ -1071,6 +1074,9 @@ ProjectExportDialog::ProjectExportDialog() {
 	parameters->set_name(TTR("Options"));
 	parameters->set_v_size_flags(Control::SIZE_EXPAND_FILL);
 	parameters->set_property_name_style(EditorPropertyNameProcessor::get_settings_style());
+	// Make it possible to display tooltips stored in the XML class reference.
+	// The object name is set when the importer changes in `_update_options()`.
+	parameters->set_use_doc_hints(true);
 	parameters->connect("property_edited", callable_mp(this, &ProjectExportDialog::_update_parameters));
 	EditorExport::get_singleton()->connect("export_presets_updated", callable_mp(this, &ProjectExportDialog::_force_update_current_preset_parameters));
 

@YuriSizov YuriSizov modified the milestones: 4.0, 4.x Aug 17, 2022
@YuriSizov
Copy link
Contributor

This would be good to have the sooner the better, but it seems like it still needs some effort to work again. So kicking it to 4.x hoping to change it to 4.0 if someone wants to continue this work. Would be very helpful!

@Calinou
Copy link
Member Author

Calinou commented Apr 18, 2023

Superseded by #74644.

@Calinou Calinou closed this Apr 18, 2023
@YuriSizov YuriSizov removed this from the 4.x milestone Dec 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add descriptions/tooltips to export preset settings
2 participants