SceneDebuggerObject
| 730 | |
| 731 | /// SceneDebuggerObject |
| 732 | SceneDebuggerObject::SceneDebuggerObject(ObjectID p_id) { |
| 733 | id = ObjectID(); |
| 734 | Object *obj = ObjectDB::get_instance(p_id); |
| 735 | if (!obj) { |
| 736 | return; |
| 737 | } |
| 738 | |
| 739 | id = p_id; |
| 740 | class_name = obj->get_class(); |
| 741 | |
| 742 | if (ScriptInstance *si = obj->get_script_instance()) { |
| 743 | // Read script instance constants and variables |
| 744 | if (!si->get_script().is_null()) { |
| 745 | Script *s = si->get_script().ptr(); |
| 746 | _parse_script_properties(s, si); |
| 747 | } |
| 748 | } |
| 749 | |
| 750 | if (Node *node = Object::cast_to<Node>(obj)) { |
| 751 | // For debugging multiplayer. |
| 752 | { |
| 753 | PropertyInfo pi(Variant::INT, String("Node/multiplayer_authority"), PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_READ_ONLY); |
| 754 | properties.push_back(SceneDebuggerProperty(pi, node->get_multiplayer_authority())); |
| 755 | } |
| 756 | |
| 757 | // Add specialized NodePath info (if inside tree). |
| 758 | if (node->is_inside_tree()) { |
| 759 | PropertyInfo pi(Variant::NODE_PATH, String("Node/path")); |
| 760 | properties.push_back(SceneDebuggerProperty(pi, node->get_path())); |
| 761 | } else { // Can't ask for path if a node is not in tree. |
| 762 | PropertyInfo pi(Variant::STRING, String("Node/path")); |
| 763 | properties.push_back(SceneDebuggerProperty(pi, "[Orphan]")); |
| 764 | } |
| 765 | } else if (Script *s = Object::cast_to<Script>(obj)) { |
| 766 | // Add script constants (no instance). |
| 767 | _parse_script_properties(s, nullptr); |
| 768 | } |
| 769 | |
| 770 | // Add base object properties. |
| 771 | List<PropertyInfo> pinfo; |
| 772 | obj->get_property_list(&pinfo, true); |
| 773 | for (const PropertyInfo &E : pinfo) { |
| 774 | if (E.usage & (PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_CATEGORY)) { |
| 775 | properties.push_back(SceneDebuggerProperty(E, obj->get(E.name))); |
| 776 | } |
| 777 | } |
| 778 | } |
| 779 | |
| 780 | void SceneDebuggerObject::_parse_script_properties(Script *p_script, ScriptInstance *p_instance) { |
| 781 | typedef HashMap<const Script *, HashSet<StringName>> ScriptMemberMap; |
nothing calls this directly
no test coverage detected