Browse Source

doc: Do not expose Variant::NIL as a type in the class reference

Fix signals Variant arguments incorrectly listed as Nil.

Fixes #12520.
Rémi Verschelde 5 years ago
parent
commit
09ced94dd4

+ 1 - 1
doc/classes/@GlobalScope.xml

@@ -1454,7 +1454,7 @@
 			Default method flags.
 			Default method flags.
 		</constant>
 		</constant>
 		<constant name="TYPE_NIL" value="0" enum="Variant.Type">
 		<constant name="TYPE_NIL" value="0" enum="Variant.Type">
-			Variable is of type [Nil] (only applied for [code]null[/code]).
+			Variable is [code]null[/code].
 		</constant>
 		</constant>
 		<constant name="TYPE_BOOL" value="1" enum="Variant.Type">
 		<constant name="TYPE_BOOL" value="1" enum="Variant.Type">
 			Variable is of type [bool].
 			Variable is of type [bool].

+ 2 - 2
doc/classes/EditorProperty.xml

@@ -113,7 +113,7 @@
 		<signal name="property_changed">
 		<signal name="property_changed">
 			<argument index="0" name="property" type="String">
 			<argument index="0" name="property" type="String">
 			</argument>
 			</argument>
-			<argument index="1" name="value" type="Nil">
+			<argument index="1" name="value" type="Variant">
 			</argument>
 			</argument>
 			<description>
 			<description>
 				Do not emit this manually, use the [method emit_changed] method instead.
 				Do not emit this manually, use the [method emit_changed] method instead.
@@ -138,7 +138,7 @@
 		<signal name="property_keyed_with_value">
 		<signal name="property_keyed_with_value">
 			<argument index="0" name="property" type="String">
 			<argument index="0" name="property" type="String">
 			</argument>
 			</argument>
-			<argument index="1" name="value" type="Nil">
+			<argument index="1" name="value" type="Variant">
 			</argument>
 			</argument>
 			<description>
 			<description>
 				Emit it if you want to key a property with a single value.
 				Emit it if you want to key a property with a single value.

+ 2 - 0
doc/classes/Input.xml

@@ -277,6 +277,8 @@
 			<argument index="3" name="guid" type="String">
 			<argument index="3" name="guid" type="String">
 			</argument>
 			</argument>
 			<description>
 			<description>
+				Notifies the [Input] singleton that a connection has changed, to update the state for the [code]device[/code] index.
+				This is used internally and should not have to be called from user scripts. See [signal joy_connection_changed] for the signal emitted when this is triggered internally.
 			</description>
 			</description>
 		</method>
 		</method>
 		<method name="parse_input_event">
 		<method name="parse_input_event">

+ 0 - 169
doc/classes/Nil.xml

@@ -1,169 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Nil" category="Built-In Types" version="3.2">
-	<brief_description>
-	</brief_description>
-	<description>
-	</description>
-	<tutorials>
-	</tutorials>
-	<methods>
-		<method name="Nil">
-			<argument index="0" name="from" type="PoolColorArray">
-			</argument>
-			<description>
-			</description>
-		</method>
-		<method name="Nil">
-			<argument index="0" name="from" type="PoolVector3Array">
-			</argument>
-			<description>
-			</description>
-		</method>
-		<method name="Nil">
-			<argument index="0" name="from" type="PoolVector2Array">
-			</argument>
-			<description>
-			</description>
-		</method>
-		<method name="Nil">
-			<argument index="0" name="from" type="PoolStringArray">
-			</argument>
-			<description>
-			</description>
-		</method>
-		<method name="Nil">
-			<argument index="0" name="from" type="PoolRealArray">
-			</argument>
-			<description>
-			</description>
-		</method>
-		<method name="Nil">
-			<argument index="0" name="from" type="PoolIntArray">
-			</argument>
-			<description>
-			</description>
-		</method>
-		<method name="Nil">
-			<argument index="0" name="from" type="PoolByteArray">
-			</argument>
-			<description>
-			</description>
-		</method>
-		<method name="Nil">
-			<argument index="0" name="from" type="Array">
-			</argument>
-			<description>
-			</description>
-		</method>
-		<method name="Nil">
-			<argument index="0" name="from" type="Dictionary">
-			</argument>
-			<description>
-			</description>
-		</method>
-		<method name="Nil">
-			<argument index="0" name="from" type="Object">
-			</argument>
-			<description>
-			</description>
-		</method>
-		<method name="Nil">
-			<argument index="0" name="from" type="RID">
-			</argument>
-			<description>
-			</description>
-		</method>
-		<method name="Nil">
-			<argument index="0" name="from" type="NodePath">
-			</argument>
-			<description>
-			</description>
-		</method>
-		<method name="Nil">
-			<argument index="0" name="from" type="Color">
-			</argument>
-			<description>
-			</description>
-		</method>
-		<method name="Nil">
-			<argument index="0" name="from" type="Transform">
-			</argument>
-			<description>
-			</description>
-		</method>
-		<method name="Nil">
-			<argument index="0" name="from" type="Basis">
-			</argument>
-			<description>
-			</description>
-		</method>
-		<method name="Nil">
-			<argument index="0" name="from" type="AABB">
-			</argument>
-			<description>
-			</description>
-		</method>
-		<method name="Nil">
-			<argument index="0" name="from" type="Quat">
-			</argument>
-			<description>
-			</description>
-		</method>
-		<method name="Nil">
-			<argument index="0" name="from" type="Plane">
-			</argument>
-			<description>
-			</description>
-		</method>
-		<method name="Nil">
-			<argument index="0" name="from" type="Transform2D">
-			</argument>
-			<description>
-			</description>
-		</method>
-		<method name="Nil">
-			<argument index="0" name="from" type="Vector3">
-			</argument>
-			<description>
-			</description>
-		</method>
-		<method name="Nil">
-			<argument index="0" name="from" type="Rect2">
-			</argument>
-			<description>
-			</description>
-		</method>
-		<method name="Nil">
-			<argument index="0" name="from" type="Vector2">
-			</argument>
-			<description>
-			</description>
-		</method>
-		<method name="Nil">
-			<argument index="0" name="from" type="String">
-			</argument>
-			<description>
-			</description>
-		</method>
-		<method name="Nil">
-			<argument index="0" name="from" type="float">
-			</argument>
-			<description>
-			</description>
-		</method>
-		<method name="Nil">
-			<argument index="0" name="from" type="int">
-			</argument>
-			<description>
-			</description>
-		</method>
-		<method name="Nil">
-			<argument index="0" name="from" type="bool">
-			</argument>
-			<description>
-			</description>
-		</method>
-	</methods>
-	<constants>
-	</constants>
-</class>

+ 3 - 3
doc/classes/RichTextLabel.xml

@@ -325,21 +325,21 @@
 	</members>
 	</members>
 	<signals>
 	<signals>
 		<signal name="meta_clicked">
 		<signal name="meta_clicked">
-			<argument index="0" name="meta" type="Nil">
+			<argument index="0" name="meta" type="Variant">
 			</argument>
 			</argument>
 			<description>
 			<description>
 				Triggered when the user clicks on content between meta tags. If the meta is defined in text, e.g. [code][url={"data"="hi"}]hi[/url][/code], then the parameter for this signal will be a [String] type. If a particular type or an object is desired, the [method push_meta] method must be used to manually insert the data into the tag stack.
 				Triggered when the user clicks on content between meta tags. If the meta is defined in text, e.g. [code][url={"data"="hi"}]hi[/url][/code], then the parameter for this signal will be a [String] type. If a particular type or an object is desired, the [method push_meta] method must be used to manually insert the data into the tag stack.
 			</description>
 			</description>
 		</signal>
 		</signal>
 		<signal name="meta_hover_ended">
 		<signal name="meta_hover_ended">
-			<argument index="0" name="meta" type="Nil">
+			<argument index="0" name="meta" type="Variant">
 			</argument>
 			</argument>
 			<description>
 			<description>
 				Triggers when the mouse exits a meta tag.
 				Triggers when the mouse exits a meta tag.
 			</description>
 			</description>
 		</signal>
 		</signal>
 		<signal name="meta_hover_started">
 		<signal name="meta_hover_started">
-			<argument index="0" name="meta" type="Nil">
+			<argument index="0" name="meta" type="Variant">
 			</argument>
 			</argument>
 			<description>
 			<description>
 				Triggers when the mouse enters a meta tag.
 				Triggers when the mouse enters a meta tag.

+ 2 - 2
doc/classes/SceneTree.xml

@@ -329,9 +329,9 @@
 			</description>
 			</description>
 		</signal>
 		</signal>
 		<signal name="global_menu_action">
 		<signal name="global_menu_action">
-			<argument index="0" name="id" type="Nil">
+			<argument index="0" name="id" type="Variant">
 			</argument>
 			</argument>
-			<argument index="1" name="meta" type="Nil">
+			<argument index="1" name="meta" type="Variant">
 			</argument>
 			</argument>
 			<description>
 			<description>
 				Emitted whenever global menu item is clicked.
 				Emitted whenever global menu item is clicked.

+ 10 - 20
editor/doc/doc_data.cpp

@@ -233,7 +233,7 @@ void DocData::generate(bool p_basic_types) {
 	List<StringName> classes;
 	List<StringName> classes;
 	ClassDB::get_class_list(&classes);
 	ClassDB::get_class_list(&classes);
 	classes.sort_custom<StringName::AlphCompare>();
 	classes.sort_custom<StringName::AlphCompare>();
-	// Move ProjectSettings, so that other classes can register properties there
+	// Move ProjectSettings, so that other classes can register properties there.
 	classes.move_to_back(classes.find("ProjectSettings"));
 	classes.move_to_back(classes.find("ProjectSettings"));
 
 
 	bool skip_setter_getter_methods = true;
 	bool skip_setter_getter_methods = true;
@@ -403,13 +403,10 @@ void DocData::generate(bool p_basic_types) {
 				} else {
 				} else {
 
 
 					const PropertyInfo &arginfo = E->get().arguments[i];
 					const PropertyInfo &arginfo = E->get().arguments[i];
-
 					ArgumentDoc argument;
 					ArgumentDoc argument;
-
 					argument_doc_from_arginfo(argument, arginfo);
 					argument_doc_from_arginfo(argument, arginfo);
 
 
 					int darg_idx = i - (E->get().arguments.size() - E->get().default_arguments.size());
 					int darg_idx = i - (E->get().arguments.size() - E->get().default_arguments.size());
-
 					if (darg_idx >= 0) {
 					if (darg_idx >= 0) {
 						Variant default_arg = E->get().default_arguments[darg_idx];
 						Variant default_arg = E->get().default_arguments[darg_idx];
 						argument.default_value = default_arg.get_construct_string();
 						argument.default_value = default_arg.get_construct_string();
@@ -433,14 +430,10 @@ void DocData::generate(bool p_basic_types) {
 				signal.name = EV->get().name;
 				signal.name = EV->get().name;
 				for (int i = 0; i < EV->get().arguments.size(); i++) {
 				for (int i = 0; i < EV->get().arguments.size(); i++) {
 
 
-					PropertyInfo arginfo = EV->get().arguments[i];
+					const PropertyInfo &arginfo = EV->get().arguments[i];
 					ArgumentDoc argument;
 					ArgumentDoc argument;
-					argument.name = arginfo.name;
-					if (arginfo.type == Variant::OBJECT && arginfo.class_name != StringName()) {
-						argument.type = arginfo.class_name.operator String();
-					} else {
-						argument.type = Variant::get_type_name(arginfo.type);
-					}
+					argument_doc_from_arginfo(argument, arginfo);
+
 					signal.arguments.push_back(argument);
 					signal.arguments.push_back(argument);
 				}
 				}
 
 
@@ -518,7 +511,7 @@ void DocData::generate(bool p_basic_types) {
 	}
 	}
 
 
 	{
 	{
-		//so it can be documented that it does not exist
+		// So we can document the concept of Variant even if it's not a usable class per se.
 		class_list["Variant"] = ClassDoc();
 		class_list["Variant"] = ClassDoc();
 		class_list["Variant"].name = "Variant";
 		class_list["Variant"].name = "Variant";
 	}
 	}
@@ -526,10 +519,12 @@ void DocData::generate(bool p_basic_types) {
 	if (!p_basic_types)
 	if (!p_basic_types)
 		return;
 		return;
 
 
+	// Add Variant types.
 	for (int i = 0; i < Variant::VARIANT_MAX; i++) {
 	for (int i = 0; i < Variant::VARIANT_MAX; i++) {
-
+		if (i == Variant::NIL)
+			continue; // Not exposed outside of 'null', should not be in class list.
 		if (i == Variant::OBJECT)
 		if (i == Variant::OBJECT)
-			continue; //use the core type instead
+			continue; // Use the core type instead.
 
 
 		String cname = Variant::get_type_name(Variant::Type(i));
 		String cname = Variant::get_type_name(Variant::Type(i));
 
 
@@ -556,15 +551,10 @@ void DocData::generate(bool p_basic_types) {
 			for (int j = 0; j < mi.arguments.size(); j++) {
 			for (int j = 0; j < mi.arguments.size(); j++) {
 
 
 				PropertyInfo arginfo = mi.arguments[j];
 				PropertyInfo arginfo = mi.arguments[j];
-
 				ArgumentDoc ad;
 				ArgumentDoc ad;
+				argument_doc_from_arginfo(ad, mi.arguments[j]);
 				ad.name = arginfo.name;
 				ad.name = arginfo.name;
 
 
-				if (arginfo.type == Variant::NIL)
-					ad.type = "Variant";
-				else
-					ad.type = Variant::get_type_name(arginfo.type);
-
 				int defarg = mi.default_arguments.size() - mi.arguments.size() + j;
 				int defarg = mi.default_arguments.size() - mi.arguments.size() + j;
 				if (defarg >= 0)
 				if (defarg >= 0)
 					ad.default_value = mi.default_arguments[defarg];
 					ad.default_value = mi.default_arguments[defarg];

+ 1 - 1
modules/gdscript/doc_classes/GDScriptFunctionState.xml

@@ -33,7 +33,7 @@
 	</methods>
 	</methods>
 	<signals>
 	<signals>
 		<signal name="completed">
 		<signal name="completed">
-			<argument index="0" name="result" type="Nil">
+			<argument index="0" name="result" type="Variant">
 			</argument>
 			</argument>
 			<description>
 			<description>
 			</description>
 			</description>