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.cpp87
1 files changed, 44 insertions, 43 deletions
diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp
index 96b6a32914..d10cc7f91e 100644
--- a/editor/editor_inspector.cpp
+++ b/editor/editor_inspector.cpp
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */
+/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -31,6 +31,7 @@
#include "editor_inspector.h"
#include "array_property_edit.h"
#include "dictionary_property_edit.h"
+#include "editor_feature_profile.h"
#include "editor_node.h"
#include "editor_scale.h"
#include "multi_node_edit.h"
@@ -60,12 +61,12 @@ Size2 EditorProperty::get_minimum_size() const {
}
if (keying) {
- Ref<Texture> key = get_icon("Key", "EditorIcons");
+ Ref<Texture2D> key = get_icon("Key", "EditorIcons");
ms.width += key->get_width() + get_constant("hseparator", "Tree");
}
if (checkable) {
- Ref<Texture> check = get_icon("checked", "CheckBox");
+ Ref<Texture2D> check = get_icon("checked", "CheckBox");
ms.width += check->get_width() + get_constant("hseparation", "CheckBox") + get_constant("hseparator", "Tree");
}
@@ -138,7 +139,7 @@ void EditorProperty::_notification(int p_what) {
}
if (keying) {
- Ref<Texture> key;
+ Ref<Texture2D> key;
if (use_keying_next()) {
key = get_icon("KeyNext", "EditorIcons");
@@ -214,7 +215,7 @@ void EditorProperty::_notification(int p_what) {
int text_limit = text_size;
if (checkable) {
- Ref<Texture> checkbox;
+ Ref<Texture2D> checkbox;
if (checked)
checkbox = get_icon("GuiChecked", "EditorIcons");
else
@@ -235,7 +236,7 @@ void EditorProperty::_notification(int p_what) {
}
if (can_revert) {
- Ref<Texture> reload_icon = get_icon("ReloadSmall", "EditorIcons");
+ 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());
@@ -255,7 +256,7 @@ void EditorProperty::_notification(int p_what) {
draw_string(font, Point2(ofs, v_ofs + font->get_ascent()), label, color, text_limit);
if (keying) {
- Ref<Texture> key;
+ Ref<Texture2D> key;
if (use_keying_next()) {
key = get_icon("KeyNext", "EditorIcons");
@@ -429,7 +430,7 @@ bool EditorPropertyRevert::is_node_property_different(Node *p_node, const Varian
return false; //pointless to check if we are not comparing against anything.
}
- if (p_current.get_type() == Variant::REAL && p_orig.get_type() == Variant::REAL) {
+ if (p_current.get_type() == Variant::FLOAT && p_orig.get_type() == Variant::FLOAT) {
float a = p_current;
float b = p_orig;
@@ -569,7 +570,7 @@ void EditorProperty::_focusable_focused(int p_index) {
void EditorProperty::add_focusable(Control *p_control) {
- p_control->connect("focus_entered", this, "_focusable_focused", varray(focusables.size()));
+ p_control->connect_compat("focus_entered", this, "_focusable_focused", varray(focusables.size()));
focusables.push_back(p_control);
}
@@ -827,13 +828,13 @@ void EditorProperty::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "checked"), "set_checked", "is_checked");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "draw_red"), "set_draw_red", "is_draw_red");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "keying"), "set_keying", "is_keying");
- ADD_SIGNAL(MethodInfo("property_changed", PropertyInfo(Variant::STRING, "property"), PropertyInfo(Variant::NIL, "value", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NIL_IS_VARIANT)));
- ADD_SIGNAL(MethodInfo("multiple_properties_changed", PropertyInfo(Variant::POOL_STRING_ARRAY, "properties"), PropertyInfo(Variant::ARRAY, "value")));
- ADD_SIGNAL(MethodInfo("property_keyed", PropertyInfo(Variant::STRING, "property")));
- ADD_SIGNAL(MethodInfo("property_keyed_with_value", PropertyInfo(Variant::STRING, "property"), PropertyInfo(Variant::NIL, "value", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NIL_IS_VARIANT)));
- ADD_SIGNAL(MethodInfo("property_checked", PropertyInfo(Variant::STRING, "property"), PropertyInfo(Variant::STRING, "bool")));
+ ADD_SIGNAL(MethodInfo("property_changed", PropertyInfo(Variant::STRING_NAME, "property"), PropertyInfo(Variant::NIL, "value", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NIL_IS_VARIANT)));
+ ADD_SIGNAL(MethodInfo("multiple_properties_changed", PropertyInfo(Variant::PACKED_STRING_ARRAY, "properties"), PropertyInfo(Variant::ARRAY, "value")));
+ ADD_SIGNAL(MethodInfo("property_keyed", PropertyInfo(Variant::STRING_NAME, "property")));
+ ADD_SIGNAL(MethodInfo("property_keyed_with_value", PropertyInfo(Variant::STRING_NAME, "property"), PropertyInfo(Variant::NIL, "value", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NIL_IS_VARIANT)));
+ ADD_SIGNAL(MethodInfo("property_checked", PropertyInfo(Variant::STRING_NAME, "property"), PropertyInfo(Variant::STRING, "bool")));
ADD_SIGNAL(MethodInfo("resource_selected", PropertyInfo(Variant::STRING, "path"), PropertyInfo(Variant::OBJECT, "resource", PROPERTY_HINT_RESOURCE_TYPE, "Resource")));
- ADD_SIGNAL(MethodInfo("object_id_selected", PropertyInfo(Variant::STRING, "property"), PropertyInfo(Variant::INT, "id")));
+ ADD_SIGNAL(MethodInfo("object_id_selected", PropertyInfo(Variant::STRING_NAME, "property"), PropertyInfo(Variant::INT, "id")));
ADD_SIGNAL(MethodInfo("selected", PropertyInfo(Variant::STRING, "path"), PropertyInfo(Variant::INT, "focusable_idx")));
MethodInfo vm;
@@ -924,7 +925,7 @@ bool EditorInspectorPlugin::parse_property(Object *p_object, Variant::Type p_typ
&arg[0], &arg[1], &arg[2], &arg[3], &arg[4], &arg[5]
};
- Variant::CallError err;
+ Callable::CallError err;
return get_script_instance()->call("parse_property", (const Variant **)&argptr, 6, err);
}
return false;
@@ -1054,7 +1055,7 @@ void EditorInspectorSection::_notification(int p_what) {
if (p_what == NOTIFICATION_SORT_CHILDREN) {
Ref<Font> font = get_font("font", "Tree");
- Ref<Texture> arrow;
+ Ref<Texture2D> arrow;
if (foldable) {
if (object->editor_is_section_unfolded(section)) {
@@ -1095,7 +1096,7 @@ void EditorInspectorSection::_notification(int p_what) {
if (p_what == NOTIFICATION_DRAW) {
- Ref<Texture> arrow;
+ Ref<Texture2D> arrow;
if (foldable) {
if (object->editor_is_section_unfolded(section)) {
@@ -1338,14 +1339,14 @@ void EditorInspector::_parse_added_editors(VBoxContainer *current_vbox, Ref<Edit
if (ep) {
ep->object = object;
- ep->connect("property_changed", this, "_property_changed");
- ep->connect("property_keyed", this, "_property_keyed");
- ep->connect("property_keyed_with_value", this, "_property_keyed_with_value");
- ep->connect("property_checked", this, "_property_checked");
- ep->connect("selected", this, "_property_selected");
- ep->connect("multiple_properties_changed", this, "_multiple_properties_changed");
- ep->connect("resource_selected", this, "_resource_selected", varray(), CONNECT_DEFERRED);
- ep->connect("object_id_selected", this, "_object_id_selected", varray(), CONNECT_DEFERRED);
+ ep->connect_compat("property_changed", this, "_property_changed");
+ ep->connect_compat("property_keyed", this, "_property_keyed");
+ ep->connect_compat("property_keyed_with_value", this, "_property_keyed_with_value");
+ ep->connect_compat("property_checked", this, "_property_checked");
+ ep->connect_compat("selected", this, "_property_selected");
+ ep->connect_compat("multiple_properties_changed", this, "_multiple_properties_changed");
+ ep->connect_compat("resource_selected", this, "_resource_selected", varray(), CONNECT_DEFERRED);
+ ep->connect_compat("object_id_selected", this, "_object_id_selected", varray(), CONNECT_DEFERRED);
if (F->get().properties.size()) {
@@ -1595,7 +1596,7 @@ void EditorInspector::update_tree() {
if (capitalize_paths)
cat = cat.capitalize();
- if (!filter.is_subsequence_ofi(cat) && !filter.is_subsequence_ofi(name))
+ if (!filter.is_subsequence_ofi(cat) && !filter.is_subsequence_ofi(name) && property_prefix.to_lower().find(filter.to_lower()) == -1)
continue;
}
@@ -1750,17 +1751,17 @@ void EditorInspector::update_tree() {
if (ep) {
- ep->connect("property_changed", this, "_property_changed");
+ ep->connect_compat("property_changed", this, "_property_changed");
if (p.usage & PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED) {
- ep->connect("property_changed", this, "_property_changed_update_all", varray(), CONNECT_DEFERRED);
+ ep->connect_compat("property_changed", this, "_property_changed_update_all", varray(), CONNECT_DEFERRED);
}
- ep->connect("property_keyed", this, "_property_keyed");
- ep->connect("property_keyed_with_value", this, "_property_keyed_with_value");
- ep->connect("property_checked", this, "_property_checked");
- ep->connect("selected", this, "_property_selected");
- ep->connect("multiple_properties_changed", this, "_multiple_properties_changed");
- ep->connect("resource_selected", this, "_resource_selected", varray(), CONNECT_DEFERRED);
- ep->connect("object_id_selected", this, "_object_id_selected", varray(), CONNECT_DEFERRED);
+ ep->connect_compat("property_keyed", this, "_property_keyed");
+ ep->connect_compat("property_keyed_with_value", this, "_property_keyed_with_value");
+ ep->connect_compat("property_checked", this, "_property_checked");
+ ep->connect_compat("selected", this, "_property_selected");
+ ep->connect_compat("multiple_properties_changed", this, "_multiple_properties_changed");
+ ep->connect_compat("resource_selected", this, "_resource_selected", varray(), CONNECT_DEFERRED);
+ ep->connect_compat("object_id_selected", this, "_object_id_selected", varray(), CONNECT_DEFERRED);
if (doc_hint != String()) {
ep->set_tooltip(property_prefix + p.name + "::" + doc_hint);
} else {
@@ -1888,7 +1889,7 @@ void EditorInspector::set_use_filter(bool p_use) {
void EditorInspector::register_text_enter(Node *p_line_edit) {
search_box = Object::cast_to<LineEdit>(p_line_edit);
if (search_box)
- search_box->connect("text_changed", this, "_filter_changed");
+ search_box->connect_compat("text_changed", this, "_filter_changed");
}
void EditorInspector::_filter_changed(const String &p_text) {
@@ -2108,7 +2109,7 @@ void EditorInspector::_property_checked(const String &p_path, bool p_checked) {
object->get_property_list(&pinfo);
for (List<PropertyInfo>::Element *E = pinfo.front(); E; E = E->next()) {
if (E->get().name == p_path) {
- Variant::CallError ce;
+ Callable::CallError ce;
to_create = Variant::construct(E->get().type, NULL, 0, ce);
break;
}
@@ -2164,7 +2165,7 @@ void EditorInspector::_node_removed(Node *p_node) {
void EditorInspector::_notification(int p_what) {
if (p_what == NOTIFICATION_READY) {
- EditorFeatureProfileManager::get_singleton()->connect("current_feature_profile_changed", this, "_feature_profile_changed");
+ EditorFeatureProfileManager::get_singleton()->connect_compat("current_feature_profile_changed", this, "_feature_profile_changed");
}
if (p_what == NOTIFICATION_ENTER_TREE) {
@@ -2173,7 +2174,7 @@ void EditorInspector::_notification(int p_what) {
add_style_override("bg", get_stylebox("sub_inspector_bg", "Editor"));
} else {
add_style_override("bg", get_stylebox("bg", "Tree"));
- get_tree()->connect("node_removed", this, "_node_removed");
+ get_tree()->connect_compat("node_removed", this, "_node_removed");
}
}
if (p_what == NOTIFICATION_PREDELETE) {
@@ -2182,7 +2183,7 @@ void EditorInspector::_notification(int p_what) {
if (p_what == NOTIFICATION_EXIT_TREE) {
if (!sub_inspector) {
- get_tree()->disconnect("node_removed", this, "_node_removed");
+ get_tree()->disconnect_compat("node_removed", this, "_node_removed");
}
edit(NULL);
}
@@ -2336,6 +2337,6 @@ EditorInspector::EditorInspector() {
property_focusable = -1;
sub_inspector = false;
- get_v_scrollbar()->connect("value_changed", this, "_vscroll_changed");
+ get_v_scrollbar()->connect_compat("value_changed", this, "_vscroll_changed");
update_scroll_request = -1;
}