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

Method deserialize

scene/debugger/scene_debugger.cpp:867–911  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

865}
866
867void SceneDebuggerObject::deserialize(const Array &p_arr) {
868#define CHECK_TYPE(p_what, p_type) ERR_FAIL_COND(p_what.get_type() != Variant::p_type);
869 ERR_FAIL_COND(p_arr.size() < 3);
870 CHECK_TYPE(p_arr[0], INT);
871 CHECK_TYPE(p_arr[1], STRING);
872 CHECK_TYPE(p_arr[2], ARRAY);
873
874 id = uint64_t(p_arr[0]);
875 class_name = p_arr[1];
876 Array props = p_arr[2];
877
878 for (int i = 0; i < props.size(); i++) {
879 CHECK_TYPE(props[i], ARRAY);
880 Array prop = props[i];
881
882 ERR_FAIL_COND(prop.size() != 6);
883 CHECK_TYPE(prop[0], STRING);
884 CHECK_TYPE(prop[1], INT);
885 CHECK_TYPE(prop[2], INT);
886 CHECK_TYPE(prop[3], STRING);
887 CHECK_TYPE(prop[4], INT);
888
889 PropertyInfo pinfo;
890 pinfo.name = prop[0];
891 pinfo.type = Variant::Type(int(prop[1]));
892 pinfo.hint = PropertyHint(int(prop[2]));
893 pinfo.hint_string = prop[3];
894 pinfo.usage = PropertyUsageFlags(int(prop[4]));
895 Variant var = prop[5];
896
897 if (pinfo.type == Variant::OBJECT) {
898 if (var.is_zero()) {
899 var = Ref<Resource>();
900 } else if (var.get_type() == Variant::OBJECT) {
901 if (((Object *)var)->is_class("EncodedObjectAsID")) {
902 var = Object::cast_to<EncodedObjectAsID>(var)->get_object_id();
903 pinfo.type = var.get_type();
904 pinfo.hint = PROPERTY_HINT_OBJECT_ID;
905 pinfo.hint_string = "Object";
906 }
907 }
908 }
909 properties.push_back(SceneDebuggerProperty(pinfo, var));
910 }
911}
912
913/// SceneDebuggerTree
914SceneDebuggerTree::SceneDebuggerTree(Node *p_root) {

Callers 11

_msg_scene_scene_treeMethod · 0.45
_msg_stack_dumpMethod · 0.45
_msg_errorMethod · 0.45
set_objectsMethod · 0.45
add_stack_variableMethod · 0.45
on_debug_dataMethod · 0.45

Calls 10

RemoteNodeClass · 0.85
sizeMethod · 0.65
TypeEnum · 0.50
PropertyHintEnum · 0.50
PropertyUsageFlagsEnum · 0.50
is_zeroMethod · 0.45
get_typeMethod · 0.45
is_classMethod · 0.45
get_object_idMethod · 0.45
push_backMethod · 0.45

Tested by 2

set_objectsMethod · 0.36
add_stack_variableMethod · 0.36