summaryrefslogtreecommitdiff
path: root/scene/debugger/scene_debugger.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/debugger/scene_debugger.cpp')
-rw-r--r--scene/debugger/scene_debugger.cpp137
1 files changed, 70 insertions, 67 deletions
diff --git a/scene/debugger/scene_debugger.cpp b/scene/debugger/scene_debugger.cpp
index 17b573b776..a54e728c1b 100644
--- a/scene/debugger/scene_debugger.cpp
+++ b/scene/debugger/scene_debugger.cpp
@@ -68,7 +68,7 @@ bool SceneDebugger::RPCProfilerFrame::deserialize(const Array &p_arr) {
}
class SceneDebugger::RPCProfiler : public EngineProfiler {
- Map<ObjectID, RPCNodeInfo> rpc_node_data;
+ HashMap<ObjectID, RPCNodeInfo> rpc_node_data;
uint64_t last_profile_time = 0;
void init_node(const ObjectID p_node) {
@@ -345,22 +345,22 @@ void SceneDebugger::remove_from_cache(const String &p_filename, Node *p_node) {
return;
}
- Map<String, Set<Node *>> &edit_cache = debugger->live_scene_edit_cache;
- Map<String, Set<Node *>>::Element *E = edit_cache.find(p_filename);
+ HashMap<String, HashSet<Node *>> &edit_cache = debugger->live_scene_edit_cache;
+ HashMap<String, HashSet<Node *>>::Iterator E = edit_cache.find(p_filename);
if (E) {
- E->get().erase(p_node);
- if (E->get().size() == 0) {
- edit_cache.erase(E);
+ E->value.erase(p_node);
+ if (E->value.size() == 0) {
+ edit_cache.remove(E);
}
}
- Map<Node *, Map<ObjectID, Node *>> &remove_list = debugger->live_edit_remove_list;
- Map<Node *, Map<ObjectID, Node *>>::Element *F = remove_list.find(p_node);
+ HashMap<Node *, HashMap<ObjectID, Node *>> &remove_list = debugger->live_edit_remove_list;
+ HashMap<Node *, HashMap<ObjectID, Node *>>::Iterator F = remove_list.find(p_node);
if (F) {
- for (const KeyValue<ObjectID, Node *> &G : F->get()) {
+ for (const KeyValue<ObjectID, Node *> &G : F->value) {
memdelete(G.value);
}
- remove_list.erase(F);
+ remove_list.remove(F);
}
}
@@ -408,47 +408,47 @@ SceneDebuggerObject::SceneDebuggerObject(ObjectID p_id) {
}
void SceneDebuggerObject::_parse_script_properties(Script *p_script, ScriptInstance *p_instance) {
- typedef Map<const Script *, Set<StringName>> ScriptMemberMap;
- typedef Map<const Script *, Map<StringName, Variant>> ScriptConstantsMap;
+ typedef HashMap<const Script *, HashSet<StringName>> ScriptMemberMap;
+ typedef HashMap<const Script *, HashMap<StringName, Variant>> ScriptConstantsMap;
ScriptMemberMap members;
if (p_instance) {
- members[p_script] = Set<StringName>();
+ members[p_script] = HashSet<StringName>();
p_script->get_members(&(members[p_script]));
}
ScriptConstantsMap constants;
- constants[p_script] = Map<StringName, Variant>();
+ constants[p_script] = HashMap<StringName, Variant>();
p_script->get_constants(&(constants[p_script]));
Ref<Script> base = p_script->get_base_script();
while (base.is_valid()) {
if (p_instance) {
- members[base.ptr()] = Set<StringName>();
+ members[base.ptr()] = HashSet<StringName>();
base->get_members(&(members[base.ptr()]));
}
- constants[base.ptr()] = Map<StringName, Variant>();
+ constants[base.ptr()] = HashMap<StringName, Variant>();
base->get_constants(&(constants[base.ptr()]));
base = base->get_base_script();
}
// Members
- for (ScriptMemberMap::Element *sm = members.front(); sm; sm = sm->next()) {
- for (Set<StringName>::Element *E = sm->get().front(); E; E = E->next()) {
+ for (KeyValue<const Script *, HashSet<StringName>> sm : members) {
+ for (const StringName &E : sm.value) {
Variant m;
- if (p_instance->get(E->get(), m)) {
- String script_path = sm->key() == p_script ? "" : sm->key()->get_path().get_file() + "/";
- PropertyInfo pi(m.get_type(), "Members/" + script_path + E->get());
+ if (p_instance->get(E, m)) {
+ String script_path = sm.key == p_script ? "" : sm.key->get_path().get_file() + "/";
+ PropertyInfo pi(m.get_type(), "Members/" + script_path + E);
properties.push_back(SceneDebuggerProperty(pi, m));
}
}
}
// Constants
- for (ScriptConstantsMap::Element *sc = constants.front(); sc; sc = sc->next()) {
- for (const KeyValue<StringName, Variant> &E : sc->get()) {
- String script_path = sc->key() == p_script ? "" : sc->key()->get_path().get_file() + "/";
+ for (KeyValue<const Script *, HashMap<StringName, Variant>> &sc : constants) {
+ for (const KeyValue<StringName, Variant> &E : sc.value) {
+ String script_path = sc.key == p_script ? "" : sc.key->get_path().get_file() + "/";
if (E.value.get_type() == Variant::OBJECT) {
Variant id = ((Object *)E.value)->get_instance_id();
PropertyInfo pi(id.get_type(), "Constants/" + E.key, PROPERTY_HINT_OBJECT_ID, "Object");
@@ -624,13 +624,13 @@ void LiveEditor::_node_set_func(int p_id, const StringName &p_prop, const Varian
base = scene_tree->root->get_node(live_edit_root);
}
- Map<String, Set<Node *>>::Element *E = live_scene_edit_cache.find(live_edit_scene);
+ HashMap<String, HashSet<Node *>>::Iterator E = live_scene_edit_cache.find(live_edit_scene);
if (!E) {
return; //scene not editable
}
- for (Set<Node *>::Element *F = E->get().front(); F; F = F->next()) {
- Node *n = F->get();
+ for (Node *F : E->value) {
+ Node *n = F;
if (base && !base->is_ancestor_of(n)) {
continue;
@@ -668,13 +668,13 @@ void LiveEditor::_node_call_func(int p_id, const StringName &p_method, const Var
base = scene_tree->root->get_node(live_edit_root);
}
- Map<String, Set<Node *>>::Element *E = live_scene_edit_cache.find(live_edit_scene);
+ HashMap<String, HashSet<Node *>>::Iterator E = live_scene_edit_cache.find(live_edit_scene);
if (!E) {
return; //scene not editable
}
- for (Set<Node *>::Element *F = E->get().front(); F; F = F->next()) {
- Node *n = F->get();
+ for (Node *F : E->value) {
+ Node *n = F;
if (base && !base->is_ancestor_of(n)) {
continue;
@@ -753,13 +753,13 @@ void LiveEditor::_create_node_func(const NodePath &p_parent, const String &p_typ
base = scene_tree->root->get_node(live_edit_root);
}
- Map<String, Set<Node *>>::Element *E = live_scene_edit_cache.find(live_edit_scene);
+ HashMap<String, HashSet<Node *>>::Iterator E = live_scene_edit_cache.find(live_edit_scene);
if (!E) {
return; //scene not editable
}
- for (Set<Node *>::Element *F = E->get().front(); F; F = F->next()) {
- Node *n = F->get();
+ for (Node *F : E->value) {
+ Node *n = F;
if (base && !base->is_ancestor_of(n)) {
continue;
@@ -797,13 +797,13 @@ void LiveEditor::_instance_node_func(const NodePath &p_parent, const String &p_p
base = scene_tree->root->get_node(live_edit_root);
}
- Map<String, Set<Node *>>::Element *E = live_scene_edit_cache.find(live_edit_scene);
+ HashMap<String, HashSet<Node *>>::Iterator E = live_scene_edit_cache.find(live_edit_scene);
if (!E) {
return; //scene not editable
}
- for (Set<Node *>::Element *F = E->get().front(); F; F = F->next()) {
- Node *n = F->get();
+ for (Node *F : E->value) {
+ Node *n = F;
if (base && !base->is_ancestor_of(n)) {
continue;
@@ -835,15 +835,15 @@ void LiveEditor::_remove_node_func(const NodePath &p_at) {
base = scene_tree->root->get_node(live_edit_root);
}
- Map<String, Set<Node *>>::Element *E = live_scene_edit_cache.find(live_edit_scene);
+ HashMap<String, HashSet<Node *>>::Iterator E = live_scene_edit_cache.find(live_edit_scene);
if (!E) {
return; //scene not editable
}
- for (Set<Node *>::Element *F = E->get().front(); F;) {
- Set<Node *>::Element *N = F->next();
+ Vector<Node *> to_delete;
- Node *n = F->get();
+ for (HashSet<Node *>::Iterator F = E->value.begin(); F; ++F) {
+ Node *n = *F;
if (base && !base->is_ancestor_of(n)) {
continue;
@@ -854,9 +854,11 @@ void LiveEditor::_remove_node_func(const NodePath &p_at) {
}
Node *n2 = n->get_node(p_at);
- memdelete(n2);
+ to_delete.push_back(n2);
+ }
- F = N;
+ for (int i = 0; i < to_delete.size(); i++) {
+ memdelete(to_delete[i]);
}
}
@@ -871,15 +873,14 @@ void LiveEditor::_remove_and_keep_node_func(const NodePath &p_at, ObjectID p_kee
base = scene_tree->root->get_node(live_edit_root);
}
- Map<String, Set<Node *>>::Element *E = live_scene_edit_cache.find(live_edit_scene);
+ HashMap<String, HashSet<Node *>>::Iterator E = live_scene_edit_cache.find(live_edit_scene);
if (!E) {
return; //scene not editable
}
- for (Set<Node *>::Element *F = E->get().front(); F;) {
- Set<Node *>::Element *N = F->next();
-
- Node *n = F->get();
+ Vector<Node *> to_remove;
+ for (HashSet<Node *>::Iterator F = E->value.begin(); F; ++F) {
+ Node *n = *F;
if (base && !base->is_ancestor_of(n)) {
continue;
@@ -889,13 +890,14 @@ void LiveEditor::_remove_and_keep_node_func(const NodePath &p_at, ObjectID p_kee
continue;
}
- Node *n2 = n->get_node(p_at);
+ to_remove.push_back(n);
+ }
+ for (int i = 0; i < to_remove.size(); i++) {
+ Node *n = to_remove[i];
+ Node *n2 = n->get_node(p_at);
n2->get_parent()->remove_child(n2);
-
live_edit_remove_list[n][p_keep_id] = n2;
-
- F = N;
}
}
@@ -910,15 +912,16 @@ void LiveEditor::_restore_node_func(ObjectID p_id, const NodePath &p_at, int p_a
base = scene_tree->root->get_node(live_edit_root);
}
- Map<String, Set<Node *>>::Element *E = live_scene_edit_cache.find(live_edit_scene);
+ HashMap<String, HashSet<Node *>>::Iterator E = live_scene_edit_cache.find(live_edit_scene);
if (!E) {
return; //scene not editable
}
- for (Set<Node *>::Element *F = E->get().front(); F;) {
- Set<Node *>::Element *N = F->next();
+ for (HashSet<Node *>::Iterator F = E->value.begin(); F;) {
+ HashSet<Node *>::Iterator N = F;
+ ++N;
- Node *n = F->get();
+ Node *n = *F;
if (base && !base->is_ancestor_of(n)) {
continue;
@@ -929,23 +932,23 @@ void LiveEditor::_restore_node_func(ObjectID p_id, const NodePath &p_at, int p_a
}
Node *n2 = n->get_node(p_at);
- Map<Node *, Map<ObjectID, Node *>>::Element *EN = live_edit_remove_list.find(n);
+ HashMap<Node *, HashMap<ObjectID, Node *>>::Iterator EN = live_edit_remove_list.find(n);
if (!EN) {
continue;
}
- Map<ObjectID, Node *>::Element *FN = EN->get().find(p_id);
+ HashMap<ObjectID, Node *>::Iterator FN = EN->value.find(p_id);
if (!FN) {
continue;
}
- n2->add_child(FN->get());
+ n2->add_child(FN->value);
- EN->get().erase(FN);
+ EN->value.remove(FN);
- if (EN->get().size() == 0) {
- live_edit_remove_list.erase(EN);
+ if (EN->value.size() == 0) {
+ live_edit_remove_list.remove(EN);
}
F = N;
@@ -963,13 +966,13 @@ void LiveEditor::_duplicate_node_func(const NodePath &p_at, const String &p_new_
base = scene_tree->root->get_node(live_edit_root);
}
- Map<String, Set<Node *>>::Element *E = live_scene_edit_cache.find(live_edit_scene);
+ HashMap<String, HashSet<Node *>>::Iterator E = live_scene_edit_cache.find(live_edit_scene);
if (!E) {
return; //scene not editable
}
- for (Set<Node *>::Element *F = E->get().front(); F; F = F->next()) {
- Node *n = F->get();
+ for (Node *F : E->value) {
+ Node *n = F;
if (base && !base->is_ancestor_of(n)) {
continue;
@@ -1002,13 +1005,13 @@ void LiveEditor::_reparent_node_func(const NodePath &p_at, const NodePath &p_new
base = scene_tree->root->get_node(live_edit_root);
}
- Map<String, Set<Node *>>::Element *E = live_scene_edit_cache.find(live_edit_scene);
+ HashMap<String, HashSet<Node *>>::Iterator E = live_scene_edit_cache.find(live_edit_scene);
if (!E) {
return; //scene not editable
}
- for (Set<Node *>::Element *F = E->get().front(); F; F = F->next()) {
- Node *n = F->get();
+ for (Node *F : E->value) {
+ Node *n = F;
if (base && !base->is_ancestor_of(n)) {
continue;