MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / update

Method update

core/object/script_language.cpp:796–842  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

794}
795
796void PlaceHolderScriptInstance::update(const List<PropertyInfo> &p_properties, const HashMap<StringName, Variant> &p_values) {
797 HashSet<StringName> new_values;
798 for (const PropertyInfo &E : p_properties) {
799 if (E.usage & (PROPERTY_USAGE_GROUP | PROPERTY_USAGE_SUBGROUP | PROPERTY_USAGE_CATEGORY)) {
800 continue;
801 }
802
803 StringName n = E.name;
804 new_values.insert(n);
805
806 if (!values.has(n) || (E.type != Variant::NIL && values[n].get_type() != E.type)) {
807 if (p_values.has(n)) {
808 values[n] = p_values[n];
809 }
810 }
811 }
812
813 properties = p_properties;
814 List<StringName> to_remove;
815
816 for (KeyValue<StringName, Variant> &E : values) {
817 if (!new_values.has(E.key)) {
818 to_remove.push_back(E.key);
819 }
820
821 Variant defval;
822 if (script->get_property_default_value(E.key, defval)) {
823 //remove because it's the same as the default value
824 if (defval == E.value) {
825 to_remove.push_back(E.key);
826 }
827 }
828 }
829
830 while (to_remove.size()) {
831 values.erase(to_remove.front()->get());
832 to_remove.pop_front();
833 }
834
835 if (owner && owner->get_script_instance() == this) {
836 owner->notify_property_list_changed();
837 }
838 //change notify
839
840 constants.clear();
841 script->get_constants(&constants);
842}
843
844void PlaceHolderScriptInstance::property_set_fallback(const StringName &p_name, const Variant &p_value, bool *r_valid) {
845 if (script->is_placeholder_fallback_enabled()) {

Callers

nothing calls this directly

Calls 14

get_script_instanceMethod · 0.80
sizeMethod · 0.65
insertMethod · 0.45
hasMethod · 0.45
get_typeMethod · 0.45
push_backMethod · 0.45
eraseMethod · 0.45
getMethod · 0.45
frontMethod · 0.45
pop_frontMethod · 0.45

Tested by

no test coverage detected