diff options
Diffstat (limited to 'core/script_language.cpp')
| -rw-r--r-- | core/script_language.cpp | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/core/script_language.cpp b/core/script_language.cpp index 35c50b1022..0eac39e7d1 100644 --- a/core/script_language.cpp +++ b/core/script_language.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -92,6 +92,22 @@ void ScriptServer::init_languages() { } } +void ScriptInstance::get_property_state(List<Pair<StringName, Variant> > &state) { + + List<PropertyInfo> pinfo; + get_property_list(&pinfo); + for (List<PropertyInfo>::Element *E=pinfo.front();E;E=E->next()) { + + if (E->get().usage&PROPERTY_USAGE_STORAGE) { + Pair<StringName,Variant> p; + p.first=E->get().name; + if (get(p.first,p.second)) + state.push_back(p); + } + } +} + + Variant ScriptInstance::call(const StringName& p_method,VARIANT_ARG_DECLARE) { VARIANT_ARGPTRS; @@ -267,6 +283,20 @@ void PlaceHolderScriptInstance::get_property_list(List<PropertyInfo> *p_properti } } +Variant::Type PlaceHolderScriptInstance::get_property_type(const StringName& p_name,bool *r_is_valid) const { + + if (values.has(p_name)) { + if (r_is_valid) + *r_is_valid=true; + return values[p_name].get_type(); + } + if (r_is_valid) + *r_is_valid=false; + + return Variant::NIL; +} + + void PlaceHolderScriptInstance::update(const List<PropertyInfo> &p_properties,const Map<StringName,Variant>& p_values) { |