diff options
Diffstat (limited to 'scene')
-rw-r--r-- | scene/register_scene_types.cpp | 1 | ||||
-rw-r--r-- | scene/resources/packed_scene.cpp | 33 | ||||
-rw-r--r-- | scene/resources/packed_scene.h | 9 |
3 files changed, 43 insertions, 0 deletions
diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp index 6c4fe1be79..3c1b5268fc 100644 --- a/scene/register_scene_types.cpp +++ b/scene/register_scene_types.cpp @@ -608,6 +608,7 @@ void register_scene_types() { OS::get_singleton()->yield(); //may take time to init + ObjectTypeDB::register_virtual_type<SceneState>(); ObjectTypeDB::register_type<PackedScene>(); ObjectTypeDB::register_type<SceneTree>(); diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp index 03127620f7..57d2a8d890 100644 --- a/scene/resources/packed_scene.cpp +++ b/scene/resources/packed_scene.cpp @@ -1532,7 +1532,39 @@ void SceneState::add_editable_instance(const NodePath& p_path){ editable_instances.push_back(p_path); } +DVector<String> SceneState::_get_node_groups(int p_idx) const { + Vector<StringName> groups = get_node_groups(p_idx); + DVector<String> ret; + + for(int i=0;i<groups.size();i++) + ret.push_back(groups[i]); + + return ret; +} + +void SceneState::_bind_methods() { + + //unbuild API + + ObjectTypeDB::bind_method(_MD("get_node_count"),&SceneState::get_node_count); + ObjectTypeDB::bind_method(_MD("get_node_type","idx"),&SceneState::get_node_type); + ObjectTypeDB::bind_method(_MD("get_node_name","idx"),&SceneState::get_node_name); + ObjectTypeDB::bind_method(_MD("get_node_path","idx","for_parent"),&SceneState::get_node_path,DEFVAL(false)); + ObjectTypeDB::bind_method(_MD("get_node_owner_path","idx"),&SceneState::get_node_owner_path); + ObjectTypeDB::bind_method(_MD("get_node_instance:PackedScene","idx"),&SceneState::get_node_instance); + ObjectTypeDB::bind_method(_MD("get_node_groups","idx"),&SceneState::_get_node_groups); + ObjectTypeDB::bind_method(_MD("get_node_property_count","idx"),&SceneState::get_node_property_count); + ObjectTypeDB::bind_method(_MD("get_node_property_name","idx","prop_idx"),&SceneState::get_node_property_name); + ObjectTypeDB::bind_method(_MD("get_node_property_value","idx","prop_idx"),&SceneState::get_node_property_value); + ObjectTypeDB::bind_method(_MD("get_connection_count"),&SceneState::get_connection_count); + ObjectTypeDB::bind_method(_MD("get_connection_source","idx"),&SceneState::get_connection_source); + ObjectTypeDB::bind_method(_MD("get_connection_signal","idx"),&SceneState::get_connection_signal); + ObjectTypeDB::bind_method(_MD("get_connection_target","idx"),&SceneState::get_connection_target); + ObjectTypeDB::bind_method(_MD("get_connection_method","idx"),&SceneState::get_connection_method); + ObjectTypeDB::bind_method(_MD("get_connection_flags","idx"),&SceneState::get_connection_flags); + ObjectTypeDB::bind_method(_MD("get_connection_binds","idx"),&SceneState::get_connection_binds); +} SceneState::SceneState() { @@ -1635,6 +1667,7 @@ void PackedScene::_bind_methods() { ObjectTypeDB::bind_method(_MD("can_instance"),&PackedScene::can_instance); ObjectTypeDB::bind_method(_MD("_set_bundled_scene"),&PackedScene::_set_bundled_scene); ObjectTypeDB::bind_method(_MD("_get_bundled_scene"),&PackedScene::_get_bundled_scene); + ObjectTypeDB::bind_method(_MD("get_state:SceneState"),&PackedScene::get_state); ADD_PROPERTY( PropertyInfo(Variant::DICTIONARY,"_bundled"),_SCS("_set_bundled_scene"),_SCS("_get_bundled_scene")); diff --git a/scene/resources/packed_scene.h b/scene/resources/packed_scene.h index 00a812f16a..7fda4392d8 100644 --- a/scene/resources/packed_scene.h +++ b/scene/resources/packed_scene.h @@ -36,6 +36,8 @@ class SceneState : public Reference { OBJ_TYPE( SceneState, Reference ); + + Vector<StringName> names; Vector<Variant> variants; Vector<NodePath> node_paths; @@ -103,6 +105,13 @@ class SceneState : public Reference { _FORCE_INLINE_ Ref<SceneState> _get_base_scene_state() const; static bool disable_placeholders; + + DVector<String> _get_node_groups(int p_idx) const; + +protected: + + static void _bind_methods(); + public: enum { |