summaryrefslogtreecommitdiff
path: root/editor/property_selector.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/property_selector.cpp')
-rw-r--r--editor/property_selector.cpp121
1 files changed, 61 insertions, 60 deletions
diff --git a/editor/property_selector.cpp b/editor/property_selector.cpp
index 00652c02c8..a1deae92a4 100644
--- a/editor/property_selector.cpp
+++ b/editor/property_selector.cpp
@@ -119,77 +119,80 @@ void PropertySelector::_update_search() {
bool found = false;
Ref<Texture2D> type_icons[Variant::VARIANT_MAX] = {
- search_options->get_theme_icon("Variant", "EditorIcons"),
- search_options->get_theme_icon("bool", "EditorIcons"),
- search_options->get_theme_icon("int", "EditorIcons"),
- search_options->get_theme_icon("float", "EditorIcons"),
- search_options->get_theme_icon("String", "EditorIcons"),
- search_options->get_theme_icon("Vector2", "EditorIcons"),
- search_options->get_theme_icon("Vector2i", "EditorIcons"),
- search_options->get_theme_icon("Rect2", "EditorIcons"),
- search_options->get_theme_icon("Rect2i", "EditorIcons"),
- search_options->get_theme_icon("Vector3", "EditorIcons"),
- search_options->get_theme_icon("Vector3i", "EditorIcons"),
- search_options->get_theme_icon("Transform2D", "EditorIcons"),
- search_options->get_theme_icon("Plane", "EditorIcons"),
- search_options->get_theme_icon("Quaternion", "EditorIcons"),
- search_options->get_theme_icon("AABB", "EditorIcons"),
- search_options->get_theme_icon("Basis", "EditorIcons"),
- search_options->get_theme_icon("Transform3D", "EditorIcons"),
- search_options->get_theme_icon("Color", "EditorIcons"),
- search_options->get_theme_icon("NodePath", "EditorIcons"),
- search_options->get_theme_icon("RID", "EditorIcons"),
- search_options->get_theme_icon("MiniObject", "EditorIcons"),
- search_options->get_theme_icon("Callable", "EditorIcons"),
- search_options->get_theme_icon("Signal", "EditorIcons"),
- search_options->get_theme_icon("Dictionary", "EditorIcons"),
- search_options->get_theme_icon("Array", "EditorIcons"),
- search_options->get_theme_icon("PackedByteArray", "EditorIcons"),
- search_options->get_theme_icon("PackedInt32Array", "EditorIcons"),
- search_options->get_theme_icon("PackedFloat32Array", "EditorIcons"),
- search_options->get_theme_icon("PackedStringArray", "EditorIcons"),
- search_options->get_theme_icon("PackedVector2Array", "EditorIcons"),
- search_options->get_theme_icon("PackedVector3Array", "EditorIcons"),
- search_options->get_theme_icon("PackedColorArray", "EditorIcons")
+ search_options->get_theme_icon(SNAME("Variant"), SNAME("EditorIcons")),
+ search_options->get_theme_icon(SNAME("bool"), SNAME("EditorIcons")),
+ search_options->get_theme_icon(SNAME("int"), SNAME("EditorIcons")),
+ search_options->get_theme_icon(SNAME("float"), SNAME("EditorIcons")),
+ search_options->get_theme_icon(SNAME("String"), SNAME("EditorIcons")),
+ search_options->get_theme_icon(SNAME("Vector2"), SNAME("EditorIcons")),
+ search_options->get_theme_icon(SNAME("Vector2i"), SNAME("EditorIcons")),
+ search_options->get_theme_icon(SNAME("Rect2"), SNAME("EditorIcons")),
+ search_options->get_theme_icon(SNAME("Rect2i"), SNAME("EditorIcons")),
+ search_options->get_theme_icon(SNAME("Vector3"), SNAME("EditorIcons")),
+ search_options->get_theme_icon(SNAME("Vector3i"), SNAME("EditorIcons")),
+ search_options->get_theme_icon(SNAME("Transform2D"), SNAME("EditorIcons")),
+ search_options->get_theme_icon(SNAME("Plane"), SNAME("EditorIcons")),
+ search_options->get_theme_icon(SNAME("Quaternion"), SNAME("EditorIcons")),
+ search_options->get_theme_icon(SNAME("AABB"), SNAME("EditorIcons")),
+ search_options->get_theme_icon(SNAME("Basis"), SNAME("EditorIcons")),
+ search_options->get_theme_icon(SNAME("Transform3D"), SNAME("EditorIcons")),
+ search_options->get_theme_icon(SNAME("Color"), SNAME("EditorIcons")),
+ search_options->get_theme_icon(SNAME("StringName"), SNAME("EditorIcons")),
+ search_options->get_theme_icon(SNAME("NodePath"), SNAME("EditorIcons")),
+ search_options->get_theme_icon(SNAME("RID"), SNAME("EditorIcons")),
+ search_options->get_theme_icon(SNAME("MiniObject"), SNAME("EditorIcons")),
+ search_options->get_theme_icon(SNAME("Callable"), SNAME("EditorIcons")),
+ search_options->get_theme_icon(SNAME("Signal"), SNAME("EditorIcons")),
+ search_options->get_theme_icon(SNAME("Dictionary"), SNAME("EditorIcons")),
+ search_options->get_theme_icon(SNAME("Array"), SNAME("EditorIcons")),
+ search_options->get_theme_icon(SNAME("PackedByteArray"), SNAME("EditorIcons")),
+ search_options->get_theme_icon(SNAME("PackedInt32Array"), SNAME("EditorIcons")),
+ search_options->get_theme_icon(SNAME("PackedInt64Array"), SNAME("EditorIcons")),
+ search_options->get_theme_icon(SNAME("PackedFloat32Array"), SNAME("EditorIcons")),
+ search_options->get_theme_icon(SNAME("PackedFloat64Array"), SNAME("EditorIcons")),
+ search_options->get_theme_icon(SNAME("PackedStringArray"), SNAME("EditorIcons")),
+ search_options->get_theme_icon(SNAME("PackedVector2Array"), SNAME("EditorIcons")),
+ search_options->get_theme_icon(SNAME("PackedVector3Array"), SNAME("EditorIcons")),
+ search_options->get_theme_icon(SNAME("PackedColorArray"), SNAME("EditorIcons"))
};
- for (List<PropertyInfo>::Element *E = props.front(); E; E = E->next()) {
- if (E->get().usage == PROPERTY_USAGE_CATEGORY) {
+ for (const PropertyInfo &E : props) {
+ if (E.usage == PROPERTY_USAGE_CATEGORY) {
if (category && category->get_first_child() == nullptr) {
memdelete(category); //old category was unused
}
category = search_options->create_item(root);
- category->set_text(0, E->get().name);
+ category->set_text(0, E.name);
category->set_selectable(0, false);
Ref<Texture2D> icon;
- if (E->get().name == "Script Variables") {
- icon = search_options->get_theme_icon("Script", "EditorIcons");
+ if (E.name == "Script Variables") {
+ icon = search_options->get_theme_icon(SNAME("Script"), SNAME("EditorIcons"));
} else {
- icon = EditorNode::get_singleton()->get_class_icon(E->get().name);
+ icon = EditorNode::get_singleton()->get_class_icon(E.name);
}
category->set_icon(0, icon);
continue;
}
- if (!(E->get().usage & PROPERTY_USAGE_EDITOR) && !(E->get().usage & PROPERTY_USAGE_SCRIPT_VARIABLE)) {
+ if (!(E.usage & PROPERTY_USAGE_EDITOR) && !(E.usage & PROPERTY_USAGE_SCRIPT_VARIABLE)) {
continue;
}
- if (search_box->get_text() != String() && E->get().name.findn(search_text) == -1) {
+ if (search_box->get_text() != String() && E.name.findn(search_text) == -1) {
continue;
}
- if (type_filter.size() && type_filter.find(E->get().type) == -1) {
+ if (type_filter.size() && type_filter.find(E.type) == -1) {
continue;
}
TreeItem *item = search_options->create_item(category ? category : root);
- item->set_text(0, E->get().name);
- item->set_metadata(0, E->get().name);
- item->set_icon(0, type_icons[E->get().type]);
+ item->set_text(0, E.name);
+ item->set_metadata(0, E.name);
+ item->set_icon(0, type_icons[E.type]);
- if (!found && search_box->get_text() != String() && E->get().name.findn(search_text) != -1) {
+ if (!found && search_box->get_text() != String() && E.name.findn(search_text) != -1) {
item->select(0);
found = true;
}
@@ -228,20 +231,20 @@ void PropertySelector::_update_search() {
bool found = false;
bool script_methods = false;
- for (List<MethodInfo>::Element *E = methods.front(); E; E = E->next()) {
- if (E->get().name.begins_with("*")) {
+ for (MethodInfo &mi : methods) {
+ if (mi.name.begins_with("*")) {
if (category && category->get_first_child() == nullptr) {
memdelete(category); //old category was unused
}
category = search_options->create_item(root);
- category->set_text(0, E->get().name.replace_first("*", ""));
+ category->set_text(0, mi.name.replace_first("*", ""));
category->set_selectable(0, false);
Ref<Texture2D> icon;
script_methods = false;
- String rep = E->get().name.replace("*", "");
- if (E->get().name == "*Script Methods") {
- icon = search_options->get_theme_icon("Script", "EditorIcons");
+ String rep = mi.name.replace("*", "");
+ if (mi.name == "*Script Methods") {
+ icon = search_options->get_theme_icon(SNAME("Script"), SNAME("EditorIcons"));
script_methods = true;
} else {
icon = EditorNode::get_singleton()->get_class_icon(rep);
@@ -251,16 +254,16 @@ void PropertySelector::_update_search() {
continue;
}
- String name = E->get().name.get_slice(":", 0);
- if (!script_methods && name.begins_with("_") && !(E->get().flags & METHOD_FLAG_VIRTUAL)) {
+ String name = mi.name.get_slice(":", 0);
+ if (!script_methods && name.begins_with("_") && !(mi.flags & METHOD_FLAG_VIRTUAL)) {
continue;
}
- if (virtuals_only && !(E->get().flags & METHOD_FLAG_VIRTUAL)) {
+ if (virtuals_only && !(mi.flags & METHOD_FLAG_VIRTUAL)) {
continue;
}
- if (!virtuals_only && (E->get().flags & METHOD_FLAG_VIRTUAL)) {
+ if (!virtuals_only && (mi.flags & METHOD_FLAG_VIRTUAL)) {
continue;
}
@@ -270,8 +273,6 @@ void PropertySelector::_update_search() {
TreeItem *item = search_options->create_item(category ? category : root);
- MethodInfo mi = E->get();
-
String desc;
if (mi.name.find(":") != -1) {
desc = mi.name.get_slice(":", 1) + " ";
@@ -303,11 +304,11 @@ void PropertySelector::_update_search() {
desc += ")";
- if (E->get().flags & METHOD_FLAG_CONST) {
+ if (mi.flags & METHOD_FLAG_CONST) {
desc += " const";
}
- if (E->get().flags & METHOD_FLAG_VIRTUAL) {
+ if (mi.flags & METHOD_FLAG_VIRTUAL) {
desc += " virtual";
}
@@ -334,7 +335,7 @@ void PropertySelector::_confirmed() {
if (!ti) {
return;
}
- emit_signal("selected", ti->get_metadata(0));
+ emit_signal(SNAME("selected"), ti->get_metadata(0));
hide();
}