summaryrefslogtreecommitdiff
path: root/editor/array_property_edit.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2020-05-14 13:23:58 +0200
committerRémi Verschelde <rverschelde@gmail.com>2020-05-14 16:54:55 +0200
commit0be6d925dc3c6413bce7a3ccb49631b8e4a6e67a (patch)
treea27e497da7104dd0a64f98a04fa3067668735e91 /editor/array_property_edit.cpp
parent710b34b70227becdc652b4ae027fe0ac47409642 (diff)
Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks
Which means that reduz' beloved style which we all became used to will now be changed automatically to remove the first empty line. This makes us lean closer to 1TBS (the one true brace style) instead of hybridating it with some Allman-inspired spacing. There's still the case of braces around single-statement blocks that needs to be addressed (but clang-format can't help with that, but clang-tidy may if we agree about it). Part of #33027.
Diffstat (limited to 'editor/array_property_edit.cpp')
-rw-r--r--editor/array_property_edit.cpp18
1 files changed, 0 insertions, 18 deletions
diff --git a/editor/array_property_edit.cpp b/editor/array_property_edit.cpp
index 9f6785ec06..a239d2e909 100644
--- a/editor/array_property_edit.cpp
+++ b/editor/array_property_edit.cpp
@@ -36,7 +36,6 @@
#define ITEMS_PER_PAGE 100
Variant ArrayPropertyEdit::get_array() const {
-
Object *o = ObjectDB::get_instance(obj);
if (!o)
return Array();
@@ -52,12 +51,10 @@ void ArrayPropertyEdit::_notif_change() {
_change_notify();
}
void ArrayPropertyEdit::_notif_changev(const String &p_v) {
-
_change_notify(p_v.utf8().get_data());
}
void ArrayPropertyEdit::_set_size(int p_size) {
-
Variant arr = get_array();
arr.call("resize", p_size);
Object *o = ObjectDB::get_instance(obj);
@@ -68,7 +65,6 @@ void ArrayPropertyEdit::_set_size(int p_size) {
}
void ArrayPropertyEdit::_set_value(int p_idx, const Variant &p_value) {
-
Variant arr = get_array();
arr.set(p_idx, p_value);
Object *o = ObjectDB::get_instance(obj);
@@ -79,13 +75,10 @@ void ArrayPropertyEdit::_set_value(int p_idx, const Variant &p_value) {
}
bool ArrayPropertyEdit::_set(const StringName &p_name, const Variant &p_value) {
-
String pn = p_name;
if (pn.begins_with("array/")) {
-
if (pn == "array/size") {
-
Variant arr = get_array();
int size = arr.call("size");
@@ -102,7 +95,6 @@ bool ArrayPropertyEdit::_set(const StringName &p_name, const Variant &p_value) {
ur->add_undo_method(this, "_set_value", i, arr.get(i));
}
} else if (newsize > size) {
-
Variant init;
Callable::CallError ce;
Variant::Type new_type = subtype;
@@ -128,7 +120,6 @@ bool ArrayPropertyEdit::_set(const StringName &p_name, const Variant &p_value) {
}
} else if (pn.begins_with("indices")) {
-
if (pn.find("_") != -1) {
//type
int idx = pn.get_slicec('/', 1).get_slicec('_', 0).to_int();
@@ -173,13 +164,11 @@ bool ArrayPropertyEdit::_set(const StringName &p_name, const Variant &p_value) {
}
bool ArrayPropertyEdit::_get(const StringName &p_name, Variant &r_ret) const {
-
Variant arr = get_array();
//int size = arr.call("size");
String pn = p_name;
if (pn.begins_with("array/")) {
-
if (pn == "array/size") {
r_ret = arr.call("size");
return true;
@@ -189,7 +178,6 @@ bool ArrayPropertyEdit::_get(const StringName &p_name, Variant &r_ret) const {
return true;
}
} else if (pn.begins_with("indices")) {
-
if (pn.find("_") != -1) {
//type
int idx = pn.get_slicec('/', 1).get_slicec('_', 0).to_int();
@@ -216,7 +204,6 @@ bool ArrayPropertyEdit::_get(const StringName &p_name, Variant &r_ret) const {
}
void ArrayPropertyEdit::_get_property_list(List<PropertyInfo> *p_list) const {
-
Variant arr = get_array();
int size = arr.call("size");
@@ -230,7 +217,6 @@ void ArrayPropertyEdit::_get_property_list(List<PropertyInfo> *p_list) const {
int items = MIN(size - offset, ITEMS_PER_PAGE);
for (int i = 0; i < items; i++) {
-
Variant v = arr.get(i + offset);
bool is_typed = arr.get_type() != Variant::ARRAY || subtype != Variant::NIL;
@@ -260,7 +246,6 @@ void ArrayPropertyEdit::_get_property_list(List<PropertyInfo> *p_list) const {
}
void ArrayPropertyEdit::edit(Object *p_obj, const StringName &p_prop, const String &p_hint_string, Variant::Type p_deftype) {
-
page = 0;
property = p_prop;
obj = p_obj->get_instance_id();
@@ -284,7 +269,6 @@ void ArrayPropertyEdit::edit(Object *p_obj, const StringName &p_prop, const Stri
}
Node *ArrayPropertyEdit::get_node() {
-
return Object::cast_to<Node>(ObjectDB::get_instance(obj));
}
@@ -293,7 +277,6 @@ bool ArrayPropertyEdit::_dont_undo_redo() {
}
void ArrayPropertyEdit::_bind_methods() {
-
ClassDB::bind_method(D_METHOD("_set_size"), &ArrayPropertyEdit::_set_size);
ClassDB::bind_method(D_METHOD("_set_value"), &ArrayPropertyEdit::_set_value);
ClassDB::bind_method(D_METHOD("_notif_change"), &ArrayPropertyEdit::_notif_change);
@@ -304,7 +287,6 @@ void ArrayPropertyEdit::_bind_methods() {
ArrayPropertyEdit::ArrayPropertyEdit() {
page = 0;
for (int i = 0; i < Variant::VARIANT_MAX; i++) {
-
if (i > 0)
vtypes += ",";
vtypes += Variant::get_type_name(Variant::Type(i));