| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
#pragma once |
| 32 |
|
| 33 |
#include "editor/debugger/editor_debugger_inspector.h" |
| 34 |
|
| 35 |
class GameStateSnapshot; |
| 36 |
|
| 37 |
class SnapshotDataObject : public Object { |
| 38 |
GDCLASS(SnapshotDataObject, Object); |
| 39 |
|
| 40 |
HashSet<ObjectID> _unique_references(const HashMap<String, ObjectID> &p_refs); |
| 41 |
String _get_script_name(Ref<Script> p_script); |
| 42 |
|
| 43 |
public: |
| 44 |
GameStateSnapshot *snapshot = nullptr; |
| 45 |
Dictionary extra_debug_data; |
| 46 |
HashMap<String, ObjectID> outbound_references; |
| 47 |
HashMap<String, ObjectID> inbound_references; |
| 48 |
|
| 49 |
HashSet<ObjectID> get_unique_outbound_refernces(); |
| 50 |
HashSet<ObjectID> get_unique_inbound_references(); |
| 51 |
|
| 52 |
uint64_t remote_object_id = 0; |
| 53 |
String type_name; |
| 54 |
LocalVector<PropertyInfo> prop_list; |
| 55 |
HashMap<StringName, Variant> prop_values; |
| 56 |
bool _get(const StringName &p_name, Variant &r_ret) const; |
| 57 |
void _get_property_list(List<PropertyInfo> *p_list) const; |
| 58 |
|
| 59 |
struct ResourceCache { |
| 60 |
HashMap<String, Ref<Resource>> cache; |
| 61 |
int misses = 0; |
| 62 |
int hits = 0; |
| 63 |
}; |
| 64 |
|
| 65 |
SnapshotDataObject(SceneDebuggerObject &p_obj, GameStateSnapshot *p_snapshot, ResourceCache &resource_cache); |
| 66 |
|
| 67 |
String get_name(); |
| 68 |
String get_node_path(); |
| 69 |
bool is_refcounted(); |
| 70 |
bool is_node(); |
| 71 |
bool is_class(const String &p_base_class); |
| 72 |
|
| 73 |
protected: |
| 74 |
|
| 75 |
bool _is_read_only() { return true; } |
| 76 |
static void _bind_methods(); |
| 77 |
}; |
| 78 |
|
| 79 |
class GameStateSnapshot : public RefCounted { |
| 80 |
GDCLASS(GameStateSnapshot, RefCounted); |
| 81 |
|
| 82 |
void _get_outbound_references(Variant &p_var, HashMap<String, ObjectID> &r_ret_val, const String &p_current_path = ""); |
| 83 |
void _get_rc_cycles(SnapshotDataObject *p_obj, SnapshotDataObject *p_source_obj, HashSet<SnapshotDataObject *> p_traversed_objs, LocalVector<String> &r_ret_val, const String &p_current_path = ""); |
| 84 |
|
| 85 |
public: |
| 86 |
String name; |
| 87 |
HashMap<ObjectID, SnapshotDataObject *> objects; |
| 88 |
Dictionary snapshot_context; |
| 89 |
|
| 90 |
static Ref<GameStateSnapshot> create_ref(const String &p_snapshot_name, const Vector<uint8_t> &p_snapshot_buffer); |
| 91 |
~GameStateSnapshot(); |
| 92 |
|
| 93 |
void recompute_references(); |
| 94 |
}; |