浏览代码

Merge pull request #14505 from akien-mga/bind_vmethod_return

Fix wrong return value in some virtual method bindings
Rémi Verschelde 7 年之前
父节点
当前提交
6a0a61d000

+ 2 - 2
core/math/a_star.cpp

@@ -473,8 +473,8 @@ void AStar::_bind_methods() {
 	ClassDB::bind_method(D_METHOD("get_point_path", "from_id", "to_id"), &AStar::get_point_path);
 	ClassDB::bind_method(D_METHOD("get_id_path", "from_id", "to_id"), &AStar::get_id_path);
 
-	BIND_VMETHOD(MethodInfo("_estimate_cost", PropertyInfo(Variant::INT, "from_id"), PropertyInfo(Variant::INT, "to_id")));
-	BIND_VMETHOD(MethodInfo("_compute_cost", PropertyInfo(Variant::INT, "from_id"), PropertyInfo(Variant::INT, "to_id")));
+	BIND_VMETHOD(MethodInfo(Variant::REAL, "_estimate_cost", PropertyInfo(Variant::INT, "from_id"), PropertyInfo(Variant::INT, "to_id")));
+	BIND_VMETHOD(MethodInfo(Variant::REAL, "_compute_cost", PropertyInfo(Variant::INT, "from_id"), PropertyInfo(Variant::INT, "to_id")));
 }
 
 AStar::AStar() {

+ 2 - 2
doc/classes/AStar.xml

@@ -13,7 +13,7 @@
 	</demos>
 	<methods>
 		<method name="_compute_cost" qualifiers="virtual">
-			<return type="void">
+			<return type="float">
 			</return>
 			<argument index="0" name="from_id" type="int">
 			</argument>
@@ -24,7 +24,7 @@
 			</description>
 		</method>
 		<method name="_estimate_cost" qualifiers="virtual">
-			<return type="void">
+			<return type="float">
 			</return>
 			<argument index="0" name="from_id" type="int">
 			</argument>

+ 1 - 1
doc/classes/CubeMap.xml

@@ -66,7 +66,7 @@
 		<member name="lossy_storage_quality" type="float" setter="set_lossy_storage_quality" getter="get_lossy_storage_quality">
 			The lossy storage quality of the [code]CubeMap[/code] if the storage mode is set to STORAGE_COMPRESS_LOSSY.
 		</member>
-		<member name="storage_mode" type="CubeMap.Storage" setter="set_storage" getter="get_storage" enum="CubeMap.Storage">
+		<member name="storage_mode" type="int" setter="set_storage" getter="get_storage" enum="CubeMap.Storage">
 			The [code]CubeMap[/code]'s storage mode. See [code]STORAGE_*[/code] constants.
 		</member>
 	</members>

+ 1 - 1
doc/classes/EditorResourceConversionPlugin.xml

@@ -18,7 +18,7 @@
 			</description>
 		</method>
 		<method name="_converts_to" qualifiers="virtual">
-			<return type="bool">
+			<return type="String">
 			</return>
 			<description>
 			</description>

+ 32 - 0
doc/classes/PopupMenu.xml

@@ -233,6 +233,12 @@
 			<description>
 			</description>
 		</method>
+		<method name="is_hide_on_state_item_selection" qualifiers="const">
+			<return type="bool">
+			</return>
+			<description>
+			</description>
+		</method>
 		<method name="is_item_checkable" qualifiers="const">
 			<return type="bool">
 			</return>
@@ -278,6 +284,14 @@
 				Removes the item at index "idx" from the menu. Note that the indexes of items after the removed item are going to be shifted by one.
 			</description>
 		</method>
+		<method name="set_hide_on_state_item_selection">
+			<return type="void">
+			</return>
+			<argument index="0" name="enable" type="bool">
+			</argument>
+			<description>
+			</description>
+		</method>
 		<method name="set_item_accelerator">
 			<return type="void">
 			</return>
@@ -377,6 +391,16 @@
 			<description>
 			</description>
 		</method>
+		<method name="set_item_statable">
+			<return type="void">
+			</return>
+			<argument index="0" name="idx" type="int">
+			</argument>
+			<argument index="1" name="state" type="int">
+			</argument>
+			<description>
+			</description>
+		</method>
 		<method name="set_item_submenu">
 			<return type="void">
 			</return>
@@ -417,6 +441,14 @@
 			<description>
 			</description>
 		</method>
+		<method name="toggle_item_statable">
+			<return type="void">
+			</return>
+			<argument index="0" name="idx" type="int">
+			</argument>
+			<description>
+			</description>
+		</method>
 	</methods>
 	<members>
 		<member name="hide_on_checkable_item_selection" type="bool" setter="set_hide_on_checkable_item_selection" getter="is_hide_on_checkable_item_selection">

+ 2 - 2
doc/classes/TileSet.xml

@@ -13,7 +13,7 @@
 	</demos>
 	<methods>
 		<method name="_forward_subtile_selection" qualifiers="virtual">
-			<return type="void">
+			<return type="Vector2">
 			</return>
 			<argument index="0" name="autotile_id" type="int">
 			</argument>
@@ -27,7 +27,7 @@
 			</description>
 		</method>
 		<method name="_is_tile_bound" qualifiers="virtual">
-			<return type="void">
+			<return type="bool">
 			</return>
 			<argument index="0" name="drawn_id" type="int">
 			</argument>

+ 1 - 1
editor/property_editor.cpp

@@ -70,7 +70,7 @@ void EditorResourceConversionPlugin::_bind_methods() {
 	mi.name = "_handles";
 	mi.return_val = PropertyInfo(Variant::BOOL, "");
 
-	BIND_VMETHOD(MethodInfo(Variant::BOOL, "_converts_to"));
+	BIND_VMETHOD(MethodInfo(Variant::STRING, "_converts_to"));
 }
 
 String EditorResourceConversionPlugin::converts_to() const {

+ 2 - 2
scene/resources/tile_set.cpp

@@ -932,8 +932,8 @@ void TileSet::_bind_methods() {
 	ClassDB::bind_method(D_METHOD("find_tile_by_name", "name"), &TileSet::find_tile_by_name);
 	ClassDB::bind_method(D_METHOD("get_tiles_ids"), &TileSet::_get_tiles_ids);
 
-	BIND_VMETHOD(MethodInfo("_is_tile_bound", PropertyInfo(Variant::INT, "drawn_id"), PropertyInfo(Variant::INT, "neighbor_id")));
-	BIND_VMETHOD(MethodInfo("_forward_subtile_selection", PropertyInfo(Variant::INT, "autotile_id"), PropertyInfo(Variant::INT, "bitmask"), PropertyInfo(Variant::OBJECT, "tilemap", PROPERTY_HINT_NONE, "TileMap"), PropertyInfo(Variant::VECTOR2, "tile_location")));
+	BIND_VMETHOD(MethodInfo(Variant::BOOL, "_is_tile_bound", PropertyInfo(Variant::INT, "drawn_id"), PropertyInfo(Variant::INT, "neighbor_id")));
+	BIND_VMETHOD(MethodInfo(Variant::VECTOR2, "_forward_subtile_selection", PropertyInfo(Variant::INT, "autotile_id"), PropertyInfo(Variant::INT, "bitmask"), PropertyInfo(Variant::OBJECT, "tilemap", PROPERTY_HINT_NONE, "TileMap"), PropertyInfo(Variant::VECTOR2, "tile_location")));
 
 	BIND_ENUM_CONSTANT(BITMASK_2X2);
 	BIND_ENUM_CONSTANT(BITMASK_3X3);