mirror of
https://github.com/godotengine/godot.git
synced 2026-01-06 10:11:57 +03:00
adding get_stored_values method
changed order name
This commit is contained in:
@@ -101,11 +101,28 @@ void InstancePlaceholder::replace_by_instance(const Ref<PackedScene> &p_custom_s
|
|||||||
base->remove_child(this);
|
base->remove_child(this);
|
||||||
base->add_child(scene);
|
base->add_child(scene);
|
||||||
base->move_child(scene,pos);
|
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() {
|
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("replace_by_instance","custom_scene:PackedScene"),&InstancePlaceholder::replace_by_instance,DEFVAL(Variant()));
|
||||||
ObjectTypeDB::bind_method(_MD("get_instance_path"),&InstancePlaceholder::get_instance_path);
|
ObjectTypeDB::bind_method(_MD("get_instance_path"),&InstancePlaceholder::get_instance_path);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,6 +57,8 @@ public:
|
|||||||
void set_instance_path(const String& p_name);
|
void set_instance_path(const String& p_name);
|
||||||
String get_instance_path() const;
|
String get_instance_path() const;
|
||||||
|
|
||||||
|
Dictionary get_stored_values(bool p_with_order = false);
|
||||||
|
|
||||||
void replace_by_instance(const Ref<PackedScene>& p_custom_scene=Ref<PackedScene>());
|
void replace_by_instance(const Ref<PackedScene>& p_custom_scene=Ref<PackedScene>());
|
||||||
|
|
||||||
InstancePlaceholder();
|
InstancePlaceholder();
|
||||||
|
|||||||
Reference in New Issue
Block a user