Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
godotengine
GitHub Repository: godotengine/godot
Path: blob/master/editor/debugger/editor_debugger_inspector.h
9896 views
1
/**************************************************************************/
2
/* editor_debugger_inspector.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
#include "core/variant/typed_dictionary.h"
34
#include "editor/inspector/editor_inspector.h"
35
36
class SceneDebuggerObject;
37
38
class EditorDebuggerRemoteObjects : public Object {
39
GDCLASS(EditorDebuggerRemoteObjects, Object);
40
41
private:
42
bool _set_impl(const StringName &p_name, const Variant &p_value, const String &p_field);
43
44
protected:
45
bool _set(const StringName &p_name, const Variant &p_value);
46
bool _get(const StringName &p_name, Variant &r_ret) const;
47
void _get_property_list(List<PropertyInfo> *p_list) const;
48
static void _bind_methods();
49
50
public:
51
TypedArray<uint64_t> remote_object_ids;
52
String type_name;
53
List<PropertyInfo> prop_list;
54
HashMap<StringName, TypedDictionary<uint64_t, Variant>> prop_values;
55
56
bool _hide_script_from_inspector() { return true; }
57
bool _hide_metadata_from_inspector() { return true; }
58
59
void set_property_field(const StringName &p_property, const Variant &p_value, const String &p_field);
60
String get_title();
61
Variant get_variant(const StringName &p_name);
62
63
void clear() {
64
prop_list.clear();
65
prop_values.clear();
66
}
67
68
void update() { notify_property_list_changed(); }
69
};
70
71
class EditorDebuggerInspector : public EditorInspector {
72
GDCLASS(EditorDebuggerInspector, EditorInspector);
73
74
private:
75
LocalVector<EditorDebuggerRemoteObjects *> remote_objects_list;
76
HashSet<Ref<Resource>> remote_dependencies;
77
EditorDebuggerRemoteObjects *variables = nullptr;
78
79
void _object_selected(ObjectID p_object);
80
void _objects_edited(const String &p_prop, const TypedDictionary<uint64_t, Variant> &p_values, const String &p_field);
81
82
protected:
83
void _notification(int p_what);
84
static void _bind_methods();
85
86
public:
87
EditorDebuggerInspector();
88
~EditorDebuggerInspector();
89
90
// Remote Object cache
91
EditorDebuggerRemoteObjects *set_objects(const Array &p_array);
92
void clear_remote_inspector();
93
void clear_cache();
94
void invalidate_selection_from_cache(const TypedArray<uint64_t> &p_ids);
95
96
// Stack Dump variables
97
String get_stack_variable(const String &p_var);
98
void add_stack_variable(const Array &p_arr, int p_offset = -1);
99
void clear_stack_variables();
100
};
101
102