Use C++ iterators for Lists in many situations

This commit is contained in:
Aaron Franke
2021-07-15 23:45:57 -04:00
parent b918c4c3ce
commit 4e6efd1b07
218 changed files with 2755 additions and 3004 deletions

View File

@ -52,12 +52,12 @@ bool MultiNodeEdit::_set_impl(const StringName &p_name, const Variant &p_value,
UndoRedo *ur = EditorNode::get_undo_redo();
ur->create_action(TTR("MultiNode Set") + " " + String(name), UndoRedo::MERGE_ENDS);
for (const List<NodePath>::Element *E = nodes.front(); E; E = E->next()) {
if (!es->has_node(E->get())) {
for (const NodePath &E : nodes) {
if (!es->has_node(E)) {
continue;
}
Node *n = es->get_node(E->get());
Node *n = es->get_node(E);
if (!n) {
continue;
}
@ -98,12 +98,12 @@ bool MultiNodeEdit::_get(const StringName &p_name, Variant &r_ret) const {
name = "script";
}
for (const List<NodePath>::Element *E = nodes.front(); E; E = E->next()) {
if (!es->has_node(E->get())) {
for (const NodePath &E : nodes) {
if (!es->has_node(E)) {
continue;
}
const Node *n = es->get_node(E->get());
const Node *n = es->get_node(E);
if (!n) {
continue;
}
@ -130,12 +130,12 @@ void MultiNodeEdit::_get_property_list(List<PropertyInfo> *p_list) const {
List<PLData *> data_list;
for (const List<NodePath>::Element *E = nodes.front(); E; E = E->next()) {
if (!es->has_node(E->get())) {
for (const NodePath &E : nodes) {
if (!es->has_node(E)) {
continue;
}
Node *n = es->get_node(E->get());
Node *n = es->get_node(E);
if (!n) {
continue;
}
@ -143,30 +143,30 @@ void MultiNodeEdit::_get_property_list(List<PropertyInfo> *p_list) const {
List<PropertyInfo> plist;
n->get_property_list(&plist, true);
for (List<PropertyInfo>::Element *F = plist.front(); F; F = F->next()) {
if (F->get().name == "script") {
for (PropertyInfo &F : plist) {
if (F.name == "script") {
continue; //added later manually, since this is intercepted before being set (check Variant Object::get() )
}
if (!usage.has(F->get().name)) {
if (!usage.has(F.name)) {
PLData pld;
pld.uses = 0;
pld.info = F->get();
usage[F->get().name] = pld;
data_list.push_back(usage.getptr(F->get().name));
pld.info = F;
usage[F.name] = pld;
data_list.push_back(usage.getptr(F.name));
}
// Make sure only properties with the same exact PropertyInfo data will appear
if (usage[F->get().name].info == F->get()) {
usage[F->get().name].uses++;
if (usage[F.name].info == F) {
usage[F.name].uses++;
}
}
nc++;
}
for (List<PLData *>::Element *E = data_list.front(); E; E = E->next()) {
if (nc == E->get()->uses) {
p_list->push_back(E->get()->info);
for (PLData *E : data_list) {
if (nc == E->uses) {
p_list->push_back(E->info);
}
}