瀏覽代碼

Merge pull request #104115 from mihe/scene-state-binds

Bind `SceneState` methods `get_path` and `get_base_scene_state`
Thaddeus Crews 5 月之前
父節點
當前提交
c5e36a973c
共有 2 個文件被更改,包括 14 次插入0 次删除
  1. 12 0
      doc/classes/SceneState.xml
  2. 2 0
      scene/resources/packed_scene.cpp

+ 12 - 0
doc/classes/SceneState.xml

@@ -10,6 +10,12 @@
 	<tutorials>
 	</tutorials>
 	<methods>
+		<method name="get_base_scene_state" qualifiers="const">
+			<return type="SceneState" />
+			<description>
+				Returns the [SceneState] of the scene that this scene inherits from, or [code]null[/code] if it doesn't inherit from any scene.
+			</description>
+		</method>
 		<method name="get_connection_binds" qualifiers="const">
 			<return type="Array" />
 			<param index="0" name="idx" type="int" />
@@ -155,6 +161,12 @@
 				Returns the type of the node at [param idx].
 			</description>
 		</method>
+		<method name="get_path" qualifiers="const">
+			<return type="String" />
+			<description>
+				Returns the resource path to the represented [PackedScene].
+			</description>
+		</method>
 		<method name="is_node_instance_placeholder" qualifiers="const">
 			<return type="bool" />
 			<param index="0" name="idx" type="int" />

+ 2 - 0
scene/resources/packed_scene.cpp

@@ -2092,6 +2092,8 @@ Vector<String> SceneState::_get_node_groups(int p_idx) const {
 void SceneState::_bind_methods() {
 	//unbuild API
 
+	ClassDB::bind_method(D_METHOD("get_path"), &SceneState::get_path);
+	ClassDB::bind_method(D_METHOD("get_base_scene_state"), &SceneState::get_base_scene_state);
 	ClassDB::bind_method(D_METHOD("get_node_count"), &SceneState::get_node_count);
 	ClassDB::bind_method(D_METHOD("get_node_type", "idx"), &SceneState::get_node_type);
 	ClassDB::bind_method(D_METHOD("get_node_name", "idx"), &SceneState::get_node_name);