Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
godotengine
GitHub Repository: godotengine/godot
Path: blob/master/scene/debugger/scene_debugger_object.h
20934 views
1
/**************************************************************************/
2
/* scene_debugger_object.h */
3
/**************************************************************************/
4
/* This file is part of: */
5
/* GODOT ENGINE */
6
/* https://godotengine.org */
7
/**************************************************************************/
8
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
9
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
10
/* */
11
/* Permission is hereby granted, free of charge, to any person obtaining */
12
/* a copy of this software and associated documentation files (the */
13
/* "Software"), to deal in the Software without restriction, including */
14
/* without limitation the rights to use, copy, modify, merge, publish, */
15
/* distribute, sublicense, and/or sell copies of the Software, and to */
16
/* permit persons to whom the Software is furnished to do so, subject to */
17
/* the following conditions: */
18
/* */
19
/* The above copyright notice and this permission notice shall be */
20
/* included in all copies or substantial portions of the Software. */
21
/* */
22
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
23
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
24
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
25
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
26
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
27
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
28
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
29
/**************************************************************************/
30
31
#pragma once
32
33
#ifdef DEBUG_ENABLED
34
35
#include "scene/main/node.h"
36
37
class SceneDebuggerObject {
38
private:
39
void _parse_script_properties(Script *p_script, ScriptInstance *p_instance);
40
41
public:
42
typedef Pair<PropertyInfo, Variant> SceneDebuggerProperty;
43
ObjectID id;
44
String class_name;
45
List<SceneDebuggerProperty> properties;
46
47
SceneDebuggerObject(ObjectID p_id);
48
SceneDebuggerObject(Object *p_obj);
49
SceneDebuggerObject() {}
50
51
void serialize(Array &r_arr, int p_max_size = 1 << 20);
52
void deserialize(const Array &p_arr);
53
void deserialize(uint64_t p_id, const String &p_class_name, const Array &p_props);
54
};
55
56
class SceneDebuggerTree {
57
public:
58
struct RemoteNode {
59
int child_count = 0;
60
String name;
61
String type_name;
62
ObjectID id;
63
String scene_file_path;
64
uint8_t view_flags = 0;
65
66
enum ViewFlags {
67
VIEW_HAS_VISIBLE_METHOD = 1 << 1,
68
VIEW_VISIBLE = 1 << 2,
69
VIEW_VISIBLE_IN_TREE = 1 << 3,
70
};
71
72
RemoteNode(int p_child, const String &p_name, const String &p_type, ObjectID p_id, const String p_scene_file_path, int p_view_flags) {
73
child_count = p_child;
74
name = p_name;
75
type_name = p_type;
76
id = p_id;
77
78
scene_file_path = p_scene_file_path;
79
view_flags = p_view_flags;
80
}
81
82
RemoteNode() {}
83
};
84
85
List<RemoteNode> nodes;
86
87
void serialize(Array &r_arr);
88
void deserialize(const Array &p_arr);
89
SceneDebuggerTree(Node *p_root);
90
SceneDebuggerTree() {}
91
};
92
#endif // DEBUG_ENABLED
93
94