diff --git a/editor/editor_properties_array_dict.cpp b/editor/editor_properties_array_dict.cpp index 3216728be1..8b67b67571 100644 --- a/editor/editor_properties_array_dict.cpp +++ b/editor/editor_properties_array_dict.cpp @@ -30,16 +30,18 @@ #include "editor_properties_array_dict.h" +#include "core/input/input.h" #include "core/io/marshalls.h" +#include "editor/editor_node.h" #include "editor/editor_scale.h" #include "editor_properties.h" bool EditorPropertyArrayObject::_set(const StringName &p_name, const Variant &p_value) { - String pn = p_name; + String name = p_name; - if (pn.begins_with("indices")) { - int idx = pn.get_slicec('/', 1).to_int(); - array.set(idx, p_value); + if (name.begins_with("indices")) { + int index = name.get_slicec('/', 1).to_int(); + array.set(index, p_value); return true; } @@ -47,12 +49,12 @@ bool EditorPropertyArrayObject::_set(const StringName &p_name, const Variant &p_ } bool EditorPropertyArrayObject::_get(const StringName &p_name, Variant &r_ret) const { - String pn = p_name; + String name = p_name; - if (pn.begins_with("indices")) { - int idx = pn.get_slicec('/', 1).to_int(); + if (name.begins_with("indices")) { + int index = name.get_slicec('/', 1).to_int(); bool valid; - r_ret = array.get(idx, &valid); + r_ret = array.get(index, &valid); if (r_ret.get_type() == Variant::OBJECT && Object::cast_to(r_ret)) { r_ret = Object::cast_to(r_ret)->get_object_id(); } @@ -77,21 +79,21 @@ EditorPropertyArrayObject::EditorPropertyArrayObject() { /////////////////// bool EditorPropertyDictionaryObject::_set(const StringName &p_name, const Variant &p_value) { - String pn = p_name; + String name = p_name; - if (pn == "new_item_key") { + if (name == "new_item_key") { new_item_key = p_value; return true; } - if (pn == "new_item_value") { + if (name == "new_item_value") { new_item_value = p_value; return true; } - if (pn.begins_with("indices")) { - int idx = pn.get_slicec('/', 1).to_int(); - Variant key = dict.get_key_at_index(idx); + if (name.begins_with("indices")) { + int index = name.get_slicec('/', 1).to_int(); + Variant key = dict.get_key_at_index(index); dict[key] = p_value; return true; } @@ -100,21 +102,21 @@ bool EditorPropertyDictionaryObject::_set(const StringName &p_name, const Varian } bool EditorPropertyDictionaryObject::_get(const StringName &p_name, Variant &r_ret) const { - String pn = p_name; + String name = p_name; - if (pn == "new_item_key") { + if (name == "new_item_key") { r_ret = new_item_key; return true; } - if (pn == "new_item_value") { + if (name == "new_item_value") { r_ret = new_item_value; return true; } - if (pn.begins_with("indices")) { - int idx = pn.get_slicec('/', 1).to_int(); - Variant key = dict.get_key_at_index(idx); + if (name.begins_with("indices")) { + int index = name.get_slicec('/', 1).to_int(); + Variant key = dict.get_key_at_index(index); r_ret = dict[key]; if (r_ret.get_type() == Variant::OBJECT && Object::cast_to(r_ret)) { r_ret = Object::cast_to(r_ret)->get_object_id(); @@ -157,13 +159,13 @@ EditorPropertyDictionaryObject::EditorPropertyDictionaryObject() { void EditorPropertyArray::_property_changed(const String &p_property, Variant p_value, const String &p_name, bool p_changing) { if (p_property.begins_with("indices")) { - int idx = p_property.get_slice("/", 1).to_int(); + int index = p_property.get_slice("/", 1).to_int(); Variant array = object->get_array(); - array.set(idx, p_value); + array.set(index, p_value); emit_changed(get_edited_property(), array, "", true); if (array.get_type() == Variant::ARRAY) { - array = array.call("duplicate"); //dupe, so undo/redo works better + array = array.call("duplicate"); // Duplicate, so undo/redo works better. } object->set_array(array); } @@ -171,7 +173,7 @@ void EditorPropertyArray::_property_changed(const String &p_property, Variant p_ void EditorPropertyArray::_change_type(Object *p_button, int p_index) { Button *button = Object::cast_to