summaryrefslogtreecommitdiff
path: root/editor/editor_inspector.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/editor_inspector.cpp')
-rw-r--r--editor/editor_inspector.cpp229
1 files changed, 135 insertions, 94 deletions
diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp
index ed5a411d8b..a0f8b59117 100644
--- a/editor/editor_inspector.cpp
+++ b/editor/editor_inspector.cpp
@@ -41,7 +41,7 @@
Size2 EditorProperty::get_minimum_size() const {
Size2 ms;
- Ref<Font> font = get_font("font", "Tree");
+ Ref<Font> font = get_theme_font("font", "Tree");
ms.height = font->get_height();
for (int i = 0; i < get_child_count(); i++) {
@@ -62,17 +62,17 @@ Size2 EditorProperty::get_minimum_size() const {
}
if (keying) {
- Ref<Texture2D> key = get_icon("Key", "EditorIcons");
- ms.width += key->get_width() + get_constant("hseparator", "Tree");
+ Ref<Texture2D> key = get_theme_icon("Key", "EditorIcons");
+ ms.width += key->get_width() + get_theme_constant("hseparator", "Tree");
}
if (checkable) {
- Ref<Texture2D> check = get_icon("checked", "CheckBox");
- ms.width += check->get_width() + get_constant("hseparation", "CheckBox") + get_constant("hseparator", "Tree");
+ Ref<Texture2D> check = get_theme_icon("checked", "CheckBox");
+ ms.width += check->get_width() + get_theme_constant("hseparation", "CheckBox") + get_theme_constant("hseparator", "Tree");
}
- if (bottom_editor != NULL && bottom_editor->is_visible()) {
- ms.height += get_constant("vseparation", "Tree");
+ if (bottom_editor != nullptr && bottom_editor->is_visible()) {
+ ms.height += get_theme_constant("vseparation", "Tree");
Size2 bems = bottom_editor->get_combined_minimum_size();
//bems.width += get_constant("item_margin", "Tree");
ms.height += bems.height;
@@ -103,7 +103,7 @@ void EditorProperty::_notification(int p_what) {
{
int child_room = size.width * (1.0 - split_ratio);
- Ref<Font> font = get_font("font", "Tree");
+ Ref<Font> font = get_theme_font("font", "Tree");
int height = font->get_height();
bool no_children = true;
@@ -136,19 +136,19 @@ void EditorProperty::_notification(int p_what) {
int m = 0; //get_constant("item_margin", "Tree");
- bottom_rect = Rect2(m, rect.size.height + get_constant("vseparation", "Tree"), size.width - m, bottom_editor->get_combined_minimum_size().height);
+ bottom_rect = Rect2(m, rect.size.height + get_theme_constant("vseparation", "Tree"), size.width - m, bottom_editor->get_combined_minimum_size().height);
}
if (keying) {
Ref<Texture2D> key;
if (use_keying_next()) {
- key = get_icon("KeyNext", "EditorIcons");
+ key = get_theme_icon("KeyNext", "EditorIcons");
} else {
- key = get_icon("Key", "EditorIcons");
+ key = get_theme_icon("Key", "EditorIcons");
}
- rect.size.x -= key->get_width() + get_constant("hseparator", "Tree");
+ rect.size.x -= key->get_width() + get_theme_constant("hseparator", "Tree");
if (no_children) {
text_size -= key->get_width() + 4 * EDSCALE;
@@ -180,8 +180,8 @@ void EditorProperty::_notification(int p_what) {
}
if (p_what == NOTIFICATION_DRAW) {
- Ref<Font> font = get_font("font", "Tree");
- Color dark_color = get_color("dark_color_2", "Editor");
+ Ref<Font> font = get_theme_font("font", "Tree");
+ Color dark_color = get_theme_color("dark_color_2", "Editor");
Size2 size = get_size();
if (bottom_editor) {
@@ -191,7 +191,7 @@ void EditorProperty::_notification(int p_what) {
}
if (selected) {
- Ref<StyleBox> sb = get_stylebox("selected", "Tree");
+ Ref<StyleBox> sb = get_theme_stylebox("selected", "Tree");
draw_style_box(sb, Rect2(Vector2(), size));
}
@@ -204,9 +204,9 @@ void EditorProperty::_notification(int p_what) {
Color color;
if (draw_red) {
- color = get_color("error_color", "Editor");
+ color = get_theme_color("error_color", "Editor");
} else {
- color = get_color("property_color", "Editor");
+ color = get_theme_color("property_color", "Editor");
}
if (label.find(".") != -1) {
color.a = 0.5; //this should be un-hacked honestly, as it's used for editor overrides
@@ -218,9 +218,9 @@ void EditorProperty::_notification(int p_what) {
if (checkable) {
Ref<Texture2D> checkbox;
if (checked)
- checkbox = get_icon("GuiChecked", "EditorIcons");
+ checkbox = get_theme_icon("GuiChecked", "EditorIcons");
else
- checkbox = get_icon("GuiUnchecked", "EditorIcons");
+ checkbox = get_theme_icon("GuiUnchecked", "EditorIcons");
Color color2(1, 1, 1);
if (check_hover) {
@@ -230,16 +230,16 @@ void EditorProperty::_notification(int p_what) {
}
check_rect = Rect2(ofs, ((size.height - checkbox->get_height()) / 2), checkbox->get_width(), checkbox->get_height());
draw_texture(checkbox, check_rect.position, color2);
- ofs += get_constant("hseparator", "Tree") + checkbox->get_width() + get_constant("hseparation", "CheckBox");
+ ofs += get_theme_constant("hseparator", "Tree") + checkbox->get_width() + get_theme_constant("hseparation", "CheckBox");
text_limit -= ofs;
} else {
check_rect = Rect2();
}
if (can_revert) {
- Ref<Texture2D> reload_icon = get_icon("ReloadSmall", "EditorIcons");
- text_limit -= reload_icon->get_width() + get_constant("hseparator", "Tree") * 2;
- revert_rect = Rect2(text_limit + get_constant("hseparator", "Tree"), (size.height - reload_icon->get_height()) / 2, reload_icon->get_width(), reload_icon->get_height());
+ Ref<Texture2D> reload_icon = get_theme_icon("ReloadSmall", "EditorIcons");
+ text_limit -= reload_icon->get_width() + get_theme_constant("hseparator", "Tree") * 2;
+ revert_rect = Rect2(text_limit + get_theme_constant("hseparator", "Tree"), (size.height - reload_icon->get_height()) / 2, reload_icon->get_width(), reload_icon->get_height());
Color color2(1, 1, 1);
if (revert_hover) {
@@ -260,12 +260,12 @@ void EditorProperty::_notification(int p_what) {
Ref<Texture2D> key;
if (use_keying_next()) {
- key = get_icon("KeyNext", "EditorIcons");
+ key = get_theme_icon("KeyNext", "EditorIcons");
} else {
- key = get_icon("Key", "EditorIcons");
+ key = get_theme_icon("Key", "EditorIcons");
}
- ofs = size.width - key->get_width() - get_constant("hseparator", "Tree");
+ ofs = size.width - key->get_width() - get_theme_constant("hseparator", "Tree");
Color color2(1, 1, 1);
if (keying_hover) {
@@ -646,7 +646,7 @@ void EditorProperty::_gui_input(const Ref<InputEvent> &p_event) {
emit_signal("property_keyed", property, use_keying_next());
if (use_keying_next()) {
- if (property == "frame_coords" && (object->is_class("Sprite") || object->is_class("Sprite3D"))) {
+ if (property == "frame_coords" && (object->is_class("Sprite2D") || object->is_class("Sprite3D"))) {
Vector2 new_coords = object->get(property);
new_coords.x++;
if (new_coords.x >= object->get("hframes").operator int64_t()) {
@@ -776,13 +776,14 @@ Control *EditorProperty::make_custom_tooltip(const String &p_text) const {
tooltip_text = p_text;
EditorHelpBit *help_bit = memnew(EditorHelpBit);
- help_bit->add_style_override("panel", get_stylebox("panel", "TooltipPanel"));
+ //help_bit->add_theme_style_override("panel", get_theme_stylebox("panel", "TooltipPanel"));
help_bit->get_rich_text()->set_fixed_size_to_width(360 * EDSCALE);
+ String text;
PackedStringArray slices = p_text.split("::", false);
if (!slices.empty()) {
String property_name = slices[0].strip_edges();
- String text = TTR("Property:") + " [u][b]" + property_name + "[/b][/u]";
+ text = TTR("Property:") + " [u][b]" + property_name + "[/b][/u]";
if (slices.size() > 1) {
String property_doc = slices[1].strip_edges();
@@ -790,7 +791,7 @@ Control *EditorProperty::make_custom_tooltip(const String &p_text) const {
text += "\n" + property_doc;
}
}
- help_bit->call_deferred("set_text", text); //hack so it uses proper theme once inside scene
+ help_bit->set_text(text);
}
return help_bit;
@@ -855,7 +856,7 @@ void EditorProperty::_bind_methods() {
EditorProperty::EditorProperty() {
draw_top_bg = true;
- object = NULL;
+ object = nullptr;
split_ratio = 0.5;
selectable = true;
text_size = 0;
@@ -872,8 +873,8 @@ EditorProperty::EditorProperty() {
property_usage = 0;
selected = false;
selected_focusable = -1;
- label_reference = NULL;
- bottom_editor = NULL;
+ label_reference = nullptr;
+ bottom_editor = nullptr;
}
////////////////////////////////////////////////
////////////////////////////////////////////////
@@ -887,7 +888,7 @@ void EditorInspectorPlugin::add_custom_control(Control *control) {
void EditorInspectorPlugin::add_property_editor(const String &p_for_property, Control *p_prop) {
- ERR_FAIL_COND(Object::cast_to<EditorProperty>(p_prop) == NULL);
+ ERR_FAIL_COND(Object::cast_to<EditorProperty>(p_prop) == nullptr);
AddedEditor ae;
ae.properties.push_back(p_for_property);
@@ -987,9 +988,9 @@ void EditorInspectorCategory::_notification(int p_what) {
if (p_what == NOTIFICATION_DRAW) {
draw_rect(Rect2(Vector2(), get_size()), bg_color);
- Ref<Font> font = get_font("font", "Tree");
+ Ref<Font> font = get_theme_font("font", "Tree");
- int hs = get_constant("hseparation", "Tree");
+ int hs = get_theme_constant("hseparation", "Tree");
int w = font->get_string_size(label).width;
if (icon.is_valid()) {
@@ -1003,7 +1004,7 @@ void EditorInspectorCategory::_notification(int p_what) {
ofs += hs + icon->get_width();
}
- Color color = get_color("font_color", "Tree");
+ Color color = get_theme_color("font_color", "Tree");
draw_string(font, Point2(ofs, font->get_ascent() + (get_size().height - font->get_height()) / 2).floor(), label, color, get_size().width);
}
}
@@ -1012,7 +1013,7 @@ Control *EditorInspectorCategory::make_custom_tooltip(const String &p_text) cons
tooltip_text = p_text;
EditorHelpBit *help_bit = memnew(EditorHelpBit);
- help_bit->add_style_override("panel", get_stylebox("panel", "TooltipPanel"));
+ help_bit->add_theme_style_override("panel", get_theme_stylebox("panel", "TooltipPanel"));
help_bit->get_rich_text()->set_fixed_size_to_width(360 * EDSCALE);
PackedStringArray slices = p_text.split("::", false);
@@ -1026,7 +1027,7 @@ Control *EditorInspectorCategory::make_custom_tooltip(const String &p_text) cons
text += "\n" + property_doc;
}
}
- help_bit->call_deferred("set_text", text); //hack so it uses proper theme once inside scene
+ help_bit->set_text(text); //hack so it uses proper theme once inside scene
}
return help_bit;
@@ -1034,7 +1035,7 @@ Control *EditorInspectorCategory::make_custom_tooltip(const String &p_text) cons
Size2 EditorInspectorCategory::get_minimum_size() const {
- Ref<Font> font = get_font("font", "Tree");
+ Ref<Font> font = get_theme_font("font", "Tree");
Size2 ms;
ms.width = 1;
@@ -1042,7 +1043,7 @@ Size2 EditorInspectorCategory::get_minimum_size() const {
if (icon.is_valid()) {
ms.height = MAX(icon->get_height(), ms.height);
}
- ms.height += get_constant("vseparation", "Tree");
+ ms.height += get_theme_constant("vseparation", "Tree");
return ms;
}
@@ -1074,14 +1075,14 @@ void EditorInspectorSection::_notification(int p_what) {
if (p_what == NOTIFICATION_SORT_CHILDREN) {
- Ref<Font> font = get_font("font", "Tree");
+ Ref<Font> font = get_theme_font("font", "Tree");
Ref<Texture2D> arrow;
if (foldable) {
if (object->editor_is_section_unfolded(section)) {
- arrow = get_icon("arrow", "Tree");
+ arrow = get_theme_icon("arrow", "Tree");
} else {
- arrow = get_icon("arrow_collapsed", "Tree");
+ arrow = get_theme_icon("arrow_collapsed", "Tree");
}
}
@@ -1092,8 +1093,8 @@ void EditorInspectorSection::_notification(int p_what) {
offset.y = MAX(offset.y, arrow->get_height());
}
- offset.y += get_constant("vseparation", "Tree");
- offset.x += get_constant("inspector_margin", "Editor");
+ offset.y += get_theme_constant("vseparation", "Tree");
+ offset.x += get_theme_constant("inspector_margin", "Editor");
Rect2 rect(offset, size - offset);
@@ -1120,24 +1121,24 @@ void EditorInspectorSection::_notification(int p_what) {
if (foldable) {
if (object->editor_is_section_unfolded(section)) {
- arrow = get_icon("arrow", "Tree");
+ arrow = get_theme_icon("arrow", "Tree");
} else {
- arrow = get_icon("arrow_collapsed", "Tree");
+ arrow = get_theme_icon("arrow_collapsed", "Tree");
}
}
- Ref<Font> font = get_font("font", "Tree");
+ Ref<Font> font = get_theme_font("font", "Tree");
int h = font->get_height();
if (arrow.is_valid()) {
h = MAX(h, arrow->get_height());
}
- h += get_constant("vseparation", "Tree");
+ h += get_theme_constant("vseparation", "Tree");
draw_rect(Rect2(Vector2(), Vector2(get_size().width, h)), bg_color);
const int arrow_margin = 3;
- Color color = get_color("font_color", "Tree");
+ Color color = get_theme_color("font_color", "Tree");
draw_string(font, Point2(Math::round((16 + arrow_margin) * EDSCALE), font->get_ascent() + (h - font->get_height()) / 2).floor(), label, color, get_size().width);
if (arrow.is_valid()) {
@@ -1163,9 +1164,9 @@ Size2 EditorInspectorSection::get_minimum_size() const {
ms.height = MAX(ms.height, minsize.height);
}
- Ref<Font> font = get_font("font", "Tree");
- ms.height += font->get_height() + get_constant("vseparation", "Tree");
- ms.width += get_constant("inspector_margin", "Editor");
+ Ref<Font> font = get_theme_font("font", "Tree");
+ ms.height += font->get_height() + get_theme_constant("vseparation", "Tree");
+ ms.width += get_theme_constant("inspector_margin", "Editor");
return ms;
}
@@ -1201,7 +1202,7 @@ void EditorInspectorSection::_gui_input(const Ref<InputEvent> &p_event) {
Ref<InputEventMouseButton> mb = p_event;
if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
- Ref<Font> font = get_font("font", "Tree");
+ Ref<Font> font = get_theme_font("font", "Tree");
if (mb->get_position().y > font->get_height()) { //clicked outside
return;
}
@@ -1256,7 +1257,7 @@ void EditorInspectorSection::_bind_methods() {
}
EditorInspectorSection::EditorInspectorSection() {
- object = NULL;
+ object = nullptr;
foldable = false;
vbox = memnew(VBoxContainer);
vbox_added = false;
@@ -1296,7 +1297,7 @@ EditorProperty *EditorInspector::instantiate_property_editor(Object *p_object, V
}
}
}
- return NULL;
+ return nullptr;
}
void EditorInspector::add_inspector_plugin(const Ref<EditorInspectorPlugin> &p_plugin) {
@@ -1454,7 +1455,7 @@ void EditorInspector::update_tree() {
if (!object)
return;
- List<Ref<EditorInspectorPlugin> > valid_plugins;
+ List<Ref<EditorInspectorPlugin>> valid_plugins;
for (int i = inspector_plugin_count - 1; i >= 0; i--) { //start by last, so lastly added can override newly added
if (!inspector_plugins[i]->can_handle(object))
@@ -1472,12 +1473,14 @@ void EditorInspector::update_tree() {
}
}
- // TreeItem *current_category = NULL;
+ // TreeItem *current_category = nullptr;
String filter = search_box ? search_box->get_text() : "";
String group;
String group_base;
- VBoxContainer *category_vbox = NULL;
+ String subgroup;
+ String subgroup_base;
+ VBoxContainer *category_vbox = nullptr;
List<PropertyInfo>
plist;
@@ -1488,9 +1491,9 @@ void EditorInspector::update_tree() {
item_path[""] = main_vbox;
- Color sscolor = get_color("prop_subsection", "Editor");
+ Color sscolor = get_theme_color("prop_subsection", "Editor");
- for (List<Ref<EditorInspectorPlugin> >::Element *E = valid_plugins.front(); E; E = E->next()) {
+ for (List<Ref<EditorInspectorPlugin>>::Element *E = valid_plugins.front(); E; E = E->next()) {
Ref<EditorInspectorPlugin> ped = E->get();
ped->parse_begin(object);
_parse_added_editors(main_vbox, ped);
@@ -1502,10 +1505,19 @@ void EditorInspector::update_tree() {
//make sure the property can be edited
- if (p.usage & PROPERTY_USAGE_GROUP) {
+ if (p.usage & PROPERTY_USAGE_SUBGROUP) {
+
+ subgroup = p.name;
+ subgroup_base = p.hint_string;
+
+ continue;
+
+ } else if (p.usage & PROPERTY_USAGE_GROUP) {
group = p.name;
group_base = p.hint_string;
+ subgroup = "";
+ subgroup_base = "";
continue;
@@ -1513,6 +1525,8 @@ void EditorInspector::update_tree() {
group = "";
group_base = "";
+ subgroup = "";
+ subgroup_base = "";
if (!show_categories)
continue;
@@ -1534,13 +1548,13 @@ void EditorInspector::update_tree() {
EditorInspectorCategory *category = memnew(EditorInspectorCategory);
main_vbox->add_child(category);
- category_vbox = NULL; //reset
+ category_vbox = nullptr; //reset
String type = p.name;
category->icon = EditorNode::get_singleton()->get_class_icon(type, "Object");
category->label = type;
- category->bg_color = get_color("prop_category", "Editor");
+ category->bg_color = get_theme_color("prop_category", "Editor");
if (use_doc_hints) {
StringName type2 = p.name;
if (!class_descr_cache.has(type2)) {
@@ -1551,13 +1565,13 @@ void EditorInspector::update_tree() {
if (E) {
descr = E->get().brief_description;
}
- class_descr_cache[type2] = descr;
+ class_descr_cache[type2] = DTR(descr);
}
category->set_tooltip(p.name + "::" + (class_descr_cache[type2] == "" ? "" : class_descr_cache[type2]));
}
- for (List<Ref<EditorInspectorPlugin> >::Element *E = valid_plugins.front(); E; E = E->next()) {
+ for (List<Ref<EditorInspectorPlugin>>::Element *E = valid_plugins.front(); E; E = E->next()) {
Ref<EditorInspectorPlugin> ped = E->get();
ped->parse_category(object, p.name);
_parse_added_editors(main_vbox, ped);
@@ -1568,7 +1582,7 @@ void EditorInspector::update_tree() {
} else if (!(p.usage & PROPERTY_USAGE_EDITOR) || _is_property_disabled_by_feature_profile(p.name))
continue;
- if (p.usage & PROPERTY_USAGE_HIGH_END_GFX && VS::get_singleton()->is_low_end())
+ if (p.usage & PROPERTY_USAGE_HIGH_END_GFX && RS::get_singleton()->is_low_end())
continue; //do not show this property in low end gfx
if (p.name == "script" && (hide_script || bool(object->call("_hide_script_from_inspector")))) {
@@ -1576,18 +1590,33 @@ void EditorInspector::update_tree() {
}
String basename = p.name;
+
+ if (subgroup != "") {
+ if (subgroup_base != "") {
+ if (basename.begins_with(subgroup_base)) {
+ basename = basename.replace_first(subgroup_base, "");
+ } else if (subgroup_base.begins_with(basename)) {
+ //keep it, this is used pretty often
+ } else {
+ subgroup = ""; //no longer using subgroup base, clear
+ }
+ }
+ }
if (group != "") {
- if (group_base != "") {
+ if (group_base != "" && subgroup == "") {
if (basename.begins_with(group_base)) {
basename = basename.replace_first(group_base, "");
} else if (group_base.begins_with(basename)) {
//keep it, this is used pretty often
} else {
group = ""; //no longer using group base, clear
+ subgroup = "";
}
}
}
-
+ if (subgroup != "") {
+ basename = subgroup + "/" + basename;
+ }
if (group != "") {
basename = group + "/" + basename;
}
@@ -1620,7 +1649,7 @@ void EditorInspector::update_tree() {
continue;
}
- if (category_vbox == NULL) {
+ if (category_vbox == nullptr) {
category_vbox = memnew(VBoxContainer);
main_vbox->add_child(category_vbox);
}
@@ -1658,7 +1687,7 @@ void EditorInspector::update_tree() {
if (current_vbox == main_vbox) {
//do not add directly to the main vbox, given it has no spacing
- if (category_vbox == NULL) {
+ if (category_vbox == nullptr) {
category_vbox = memnew(VBoxContainer);
}
current_vbox = category_vbox;
@@ -1688,7 +1717,7 @@ void EditorInspector::update_tree() {
String descr;
bool found = false;
- Map<StringName, Map<StringName, String> >::Element *E = descr_cache.find(classname);
+ Map<StringName, Map<StringName, String>>::Element *E = descr_cache.find(classname);
if (E) {
Map<StringName, String>::Element *F = E->get().find(propname);
if (F) {
@@ -1703,10 +1732,22 @@ void EditorInspector::update_tree() {
while (F && descr == String()) {
for (int i = 0; i < F->get().properties.size(); i++) {
if (F->get().properties[i].name == propname.operator String()) {
- descr = F->get().properties[i].description.strip_edges();
+ descr = DTR(F->get().properties[i].description.strip_edges());
break;
}
}
+
+ Vector<String> slices = propname.operator String().split("/");
+ if (slices.size() == 2 && slices[0].begins_with("custom_")) {
+ // Likely a theme property.
+ for (int i = 0; i < F->get().theme_properties.size(); i++) {
+ if (F->get().theme_properties[i].name == slices[1]) {
+ descr = DTR(F->get().theme_properties[i].description.strip_edges());
+ break;
+ }
+ }
+ }
+
if (!F->get().inherits.empty()) {
F = dd->class_list.find(F->get().inherits);
} else {
@@ -1719,7 +1760,7 @@ void EditorInspector::update_tree() {
doc_hint = descr;
}
- for (List<Ref<EditorInspectorPlugin> >::Element *E = valid_plugins.front(); E; E = E->next()) {
+ for (List<Ref<EditorInspectorPlugin>>::Element *E = valid_plugins.front(); E; E = E->next()) {
Ref<EditorInspectorPlugin> ped = E->get();
bool exclusive = ped->parse_property(object, p.type, p.name, p.hint, p.hint_string, p.usage);
@@ -1802,7 +1843,7 @@ void EditorInspector::update_tree() {
}
}
- for (List<Ref<EditorInspectorPlugin> >::Element *E = valid_plugins.front(); E; E = E->next()) {
+ for (List<Ref<EditorInspectorPlugin>>::Element *E = valid_plugins.front(); E; E = E->next()) {
Ref<EditorInspectorPlugin> ped = E->get();
ped->parse_end();
_parse_added_editors(main_vbox, ped);
@@ -1933,7 +1974,7 @@ void EditorInspector::collapse_all_folding() {
E->get()->fold();
}
- for (Map<StringName, List<EditorProperty *> >::Element *F = editor_property_map.front(); F; F = F->next()) {
+ for (Map<StringName, List<EditorProperty *>>::Element *F = editor_property_map.front(); F; F = F->next()) {
for (List<EditorProperty *>::Element *E = F->get().front(); E; E = E->next()) {
E->get()->collapse_all_folding();
}
@@ -1944,7 +1985,7 @@ void EditorInspector::expand_all_folding() {
for (List<EditorInspectorSection *>::Element *E = sections.front(); E; E = E->next()) {
E->get()->unfold();
}
- for (Map<StringName, List<EditorProperty *> >::Element *F = editor_property_map.front(); F; F = F->next()) {
+ for (Map<StringName, List<EditorProperty *>>::Element *F = editor_property_map.front(); F; F = F->next()) {
for (List<EditorProperty *>::Element *E = F->get().front(); E; E = E->next()) {
E->get()->expand_all_folding();
}
@@ -1966,9 +2007,9 @@ void EditorInspector::set_sub_inspector(bool p_enable) {
return;
if (sub_inspector) {
- add_style_override("bg", get_stylebox("sub_inspector_bg", "Editor"));
+ add_theme_style_override("bg", get_theme_stylebox("sub_inspector_bg", "Editor"));
} else {
- add_style_override("bg", get_stylebox("bg", "Tree"));
+ add_theme_style_override("bg", get_theme_stylebox("bg", "Tree"));
}
}
@@ -2130,7 +2171,7 @@ void EditorInspector::_property_checked(const String &p_path, bool p_checked) {
for (List<PropertyInfo>::Element *E = pinfo.front(); E; E = E->next()) {
if (E->get().name == p_path) {
Callable::CallError ce;
- to_create = Variant::construct(E->get().type, NULL, 0, ce);
+ to_create = Variant::construct(E->get().type, nullptr, 0, ce);
break;
}
}
@@ -2154,7 +2195,7 @@ void EditorInspector::_property_selected(const String &p_path, int p_focusable)
property_selected = p_path;
property_focusable = p_focusable;
//deselect the others
- for (Map<StringName, List<EditorProperty *> >::Element *F = editor_property_map.front(); F; F = F->next()) {
+ for (Map<StringName, List<EditorProperty *>>::Element *F = editor_property_map.front(); F; F = F->next()) {
if (F->key() == property_selected)
continue;
for (List<EditorProperty *>::Element *E = F->get().front(); E; E = E->next()) {
@@ -2178,7 +2219,7 @@ void EditorInspector::_resource_selected(const String &p_path, RES p_resource) {
void EditorInspector::_node_removed(Node *p_node) {
if (p_node == object) {
- edit(NULL);
+ edit(nullptr);
}
}
@@ -2191,21 +2232,21 @@ void EditorInspector::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE) {
if (sub_inspector) {
- add_style_override("bg", get_stylebox("sub_inspector_bg", "Editor"));
+ add_theme_style_override("bg", get_theme_stylebox("sub_inspector_bg", "Editor"));
} else {
- add_style_override("bg", get_stylebox("bg", "Tree"));
+ add_theme_style_override("bg", get_theme_stylebox("bg", "Tree"));
get_tree()->connect("node_removed", callable_mp(this, &EditorInspector::_node_removed));
}
}
if (p_what == NOTIFICATION_PREDELETE) {
- edit(NULL); //just in case
+ edit(nullptr); //just in case
}
if (p_what == NOTIFICATION_EXIT_TREE) {
if (!sub_inspector) {
get_tree()->disconnect("node_removed", callable_mp(this, &EditorInspector::_node_removed));
}
- edit(NULL);
+ edit(nullptr);
}
if (p_what == NOTIFICATION_PROCESS) {
@@ -2217,7 +2258,7 @@ void EditorInspector::_notification(int p_what) {
if (refresh_countdown > 0) {
refresh_countdown -= get_process_delta_time();
if (refresh_countdown <= 0) {
- for (Map<StringName, List<EditorProperty *> >::Element *F = editor_property_map.front(); F; F = F->next()) {
+ for (Map<StringName, List<EditorProperty *>>::Element *F = editor_property_map.front(); F; F = F->next()) {
for (List<EditorProperty *>::Element *E = F->get().front(); E; E = E->next()) {
E->get()->update_property();
E->get()->update_reload_status();
@@ -2254,9 +2295,9 @@ void EditorInspector::_notification(int p_what) {
if (p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) {
if (sub_inspector) {
- add_style_override("bg", get_stylebox("sub_inspector_bg", "Editor"));
+ add_theme_style_override("bg", get_theme_stylebox("sub_inspector_bg", "Editor"));
} else if (is_inside_tree()) {
- add_style_override("bg", get_stylebox("bg", "Tree"));
+ add_theme_style_override("bg", get_theme_stylebox("bg", "Tree"));
}
update_tree();
@@ -2315,11 +2356,11 @@ void EditorInspector::_bind_methods() {
}
EditorInspector::EditorInspector() {
- object = NULL;
- undo_redo = NULL;
+ object = nullptr;
+ undo_redo = nullptr;
main_vbox = memnew(VBoxContainer);
main_vbox->set_h_size_flags(SIZE_EXPAND_FILL);
- main_vbox->add_constant_override("separation", 0);
+ main_vbox->add_theme_constant_override("separation", 0);
add_child(main_vbox);
set_enable_h_scroll(false);
set_enable_v_scroll(true);
@@ -2336,7 +2377,7 @@ EditorInspector::EditorInspector() {
update_tree_pending = false;
refresh_countdown = 0;
read_only = false;
- search_box = NULL;
+ search_box = nullptr;
keying = false;
_prop_edited = "property_edited";
set_process(true);