summaryrefslogtreecommitdiff
path: root/editor/multi_node_edit.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/multi_node_edit.cpp')
-rw-r--r--editor/multi_node_edit.cpp41
1 files changed, 24 insertions, 17 deletions
diff --git a/editor/multi_node_edit.cpp b/editor/multi_node_edit.cpp
index 7bc67b54c1..1077aca7b3 100644
--- a/editor/multi_node_edit.cpp
+++ b/editor/multi_node_edit.cpp
@@ -39,8 +39,9 @@ bool MultiNodeEdit::_set(const StringName &p_name, const Variant &p_value) {
bool MultiNodeEdit::_set_impl(const StringName &p_name, const Variant &p_value, const String &p_field) {
Node *es = EditorNode::get_singleton()->get_edited_scene();
- if (!es)
+ if (!es) {
return false;
+ }
String name = p_name;
@@ -52,13 +53,14 @@ bool MultiNodeEdit::_set_impl(const StringName &p_name, const Variant &p_value,
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()))
+ if (!es->has_node(E->get())) {
continue;
+ }
Node *n = es->get_node(E->get());
- if (!n)
+ if (!n) {
continue;
+ }
if (p_value.get_type() == Variant::NODE_PATH) {
Node *tonode = n->get_node(p_value);
@@ -87,8 +89,9 @@ bool MultiNodeEdit::_set_impl(const StringName &p_name, const Variant &p_value,
bool MultiNodeEdit::_get(const StringName &p_name, Variant &r_ret) const {
Node *es = EditorNode::get_singleton()->get_edited_scene();
- if (!es)
+ if (!es) {
return false;
+ }
String name = p_name;
if (name == "scripts") { // script set is intercepted at object level (check Variant Object::get() ) ,so use a different name
@@ -96,18 +99,20 @@ bool MultiNodeEdit::_get(const StringName &p_name, Variant &r_ret) const {
}
for (const List<NodePath>::Element *E = nodes.front(); E; E = E->next()) {
-
- if (!es->has_node(E->get()))
+ if (!es->has_node(E->get())) {
continue;
+ }
const Node *n = es->get_node(E->get());
- if (!n)
+ if (!n) {
continue;
+ }
bool found;
r_ret = n->get(name, &found);
- if (found)
+ if (found) {
return true;
+ }
}
return false;
@@ -117,29 +122,31 @@ void MultiNodeEdit::_get_property_list(List<PropertyInfo> *p_list) const {
HashMap<String, PLData> usage;
Node *es = EditorNode::get_singleton()->get_edited_scene();
- if (!es)
+ if (!es) {
return;
+ }
int nc = 0;
List<PLData *> data_list;
for (const List<NodePath>::Element *E = nodes.front(); E; E = E->next()) {
-
- if (!es->has_node(E->get()))
+ if (!es->has_node(E->get())) {
continue;
+ }
Node *n = es->get_node(E->get());
- if (!n)
+ if (!n) {
continue;
+ }
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")
+ if (F->get().name == "script") {
continue; //added later manually, since this is intercepted before being set (check Variant Object::get() )
+ }
if (!usage.has(F->get().name)) {
PLData pld;
pld.uses = 0;
@@ -149,15 +156,15 @@ void MultiNodeEdit::_get_property_list(List<PropertyInfo> *p_list) const {
}
// Make sure only properties with the same exact PropertyInfo data will appear
- if (usage[F->get().name].info == F->get())
+ if (usage[F->get().name].info == F->get()) {
usage[F->get().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);
}