diff options
author | Ariel Manzur <ariel@godotengine.org> | 2016-11-08 17:40:46 -0300 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2016-11-18 21:55:21 +0100 |
commit | b3616089fad2d113626c22f14034ae52b3eecb68 (patch) | |
tree | c405ce2792c3f5b7192fbe92c6c016204a3232bf /scene/main/instance_placeholder.cpp | |
parent | 959683c3d8f7aaa7469d5758c7698e0da108b406 (diff) | |
download | redot-engine-b3616089fad2d113626c22f14034ae52b3eecb68.tar.gz |
adding get_stored_values method
changed order name
(cherry picked from commit dbca4ee3fe283f59a8c9d50aae73b97f48be7b01)
Diffstat (limited to 'scene/main/instance_placeholder.cpp')
-rw-r--r-- | scene/main/instance_placeholder.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/scene/main/instance_placeholder.cpp b/scene/main/instance_placeholder.cpp index fb047ea5e4..15045a73d5 100644 --- a/scene/main/instance_placeholder.cpp +++ b/scene/main/instance_placeholder.cpp @@ -101,11 +101,28 @@ void InstancePlaceholder::replace_by_instance(const Ref<PackedScene> &p_custom_s base->remove_child(this); base->add_child(scene); base->move_child(scene,pos); - } +Dictionary InstancePlaceholder::get_stored_values(bool p_with_order) { + + Dictionary ret; + StringArray order; + + for(List<PropSet>::Element *E=stored_values.front();E;E=E->next()) { + ret[E->get().name] = E->get().value; + if (p_with_order) + order.push_back(E->get().name); + }; + + if (p_with_order) + ret[".order"] = order; + + return ret; +}; + void InstancePlaceholder::_bind_methods() { + ObjectTypeDB::bind_method(_MD("get_stored_values","with_order"),&InstancePlaceholder::get_stored_values,DEFVAL(false)); ObjectTypeDB::bind_method(_MD("replace_by_instance","custom_scene:PackedScene"),&InstancePlaceholder::replace_by_instance,DEFVAL(Variant())); ObjectTypeDB::bind_method(_MD("get_instance_path"),&InstancePlaceholder::get_instance_path); } |