summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/property_selector.cpp33
-rw-r--r--editor/property_selector.h3
2 files changed, 31 insertions, 5 deletions
diff --git a/editor/property_selector.cpp b/editor/property_selector.cpp
index 6bbb35ceab..86de7c56e1 100644
--- a/editor/property_selector.cpp
+++ b/editor/property_selector.cpp
@@ -75,6 +75,8 @@ void PropertySelector::_update_search() {
if (properties)
set_title(TTR("Select Property"));
+ else if (virtuals_only)
+ set_title(TTR("Select Virtual Method"));
else
set_title(TTR("Select Method"));
@@ -209,7 +211,7 @@ void PropertySelector::_update_search() {
StringName base = base_type;
while (base) {
methods.push_back(MethodInfo("*" + String(base)));
- ClassDB::get_method_list(base, &methods, true);
+ ClassDB::get_method_list(base, &methods, true, true);
base = ClassDB::get_parent_class(base);
}
}
@@ -230,11 +232,13 @@ void PropertySelector::_update_search() {
Ref<Texture> icon;
script_methods = false;
+ print_line("name: " + E->get().name);
+ String rep = E->get().name.replace("*", "");
if (E->get().name == "*Script Methods") {
icon = get_icon("Script", "EditorIcons");
script_methods = true;
- } else if (has_icon(E->get().name, "EditorIcons")) {
- icon = get_icon(E->get().name, "EditorIcons");
+ } else if (has_icon(rep, "EditorIcons")) {
+ icon = get_icon(rep, "EditorIcons");
} else {
icon = get_icon("Object", "EditorIcons");
}
@@ -247,6 +251,12 @@ void PropertySelector::_update_search() {
if (!script_methods && name.begins_with("_") && !(E->get().flags & METHOD_FLAG_VIRTUAL))
continue;
+ if (virtuals_only && !(E->get().flags & METHOD_FLAG_VIRTUAL))
+ continue;
+
+ if (!virtuals_only && (E->get().flags & METHOD_FLAG_VIRTUAL))
+ continue;
+
if (search_box->get_text() != String() && name.find(search_box->get_text()) == -1)
continue;
@@ -283,6 +293,12 @@ void PropertySelector::_update_search() {
desc += " )";
+ if (E->get().flags & METHOD_FLAG_CONST)
+ desc += " const";
+
+ if (E->get().flags & METHOD_FLAG_VIRTUAL)
+ desc += " virtual";
+
item->set_text(0, desc);
item->set_metadata(0, name);
item->set_selectable(0, true);
@@ -397,7 +413,7 @@ void PropertySelector::_notification(int p_what) {
}
}
-void PropertySelector::select_method_from_base_type(const String &p_base, const String &p_current) {
+void PropertySelector::select_method_from_base_type(const String &p_base, const String &p_current, bool p_virtuals_only) {
base_type = p_base;
selected = p_current;
@@ -405,6 +421,7 @@ void PropertySelector::select_method_from_base_type(const String &p_base, const
script = 0;
properties = false;
instance = NULL;
+ virtuals_only = p_virtuals_only;
popup_centered_ratio(0.6);
search_box->set_text("");
@@ -421,6 +438,7 @@ void PropertySelector::select_method_from_script(const Ref<Script> &p_script, co
script = p_script->get_instance_id();
properties = false;
instance = NULL;
+ virtuals_only = false;
popup_centered_ratio(0.6);
search_box->set_text("");
@@ -436,6 +454,7 @@ void PropertySelector::select_method_from_basic_type(Variant::Type p_type, const
script = 0;
properties = false;
instance = NULL;
+ virtuals_only = false;
popup_centered_ratio(0.6);
search_box->set_text("");
@@ -456,6 +475,7 @@ void PropertySelector::select_method_from_instance(Object *p_instance, const Str
}
properties = false;
instance = NULL;
+ virtuals_only = false;
popup_centered_ratio(0.6);
search_box->set_text("");
@@ -471,6 +491,7 @@ void PropertySelector::select_property_from_base_type(const String &p_base, cons
script = 0;
properties = true;
instance = NULL;
+ virtuals_only = false;
popup_centered_ratio(0.6);
search_box->set_text("");
@@ -488,6 +509,7 @@ void PropertySelector::select_property_from_script(const Ref<Script> &p_script,
script = p_script->get_instance_id();
properties = true;
instance = NULL;
+ virtuals_only = false;
popup_centered_ratio(0.6);
search_box->set_text("");
@@ -503,6 +525,7 @@ void PropertySelector::select_property_from_basic_type(Variant::Type p_type, con
script = 0;
properties = true;
instance = NULL;
+ virtuals_only = false;
popup_centered_ratio(0.6);
search_box->set_text("");
@@ -518,6 +541,7 @@ void PropertySelector::select_property_from_instance(Object *p_instance, const S
script = 0;
properties = true;
instance = p_instance;
+ virtuals_only = false;
popup_centered_ratio(0.6);
search_box->set_text("");
@@ -554,6 +578,7 @@ PropertySelector::PropertySelector() {
search_options->connect("cell_selected", this, "_item_selected");
search_options->set_hide_root(true);
search_options->set_hide_folding(true);
+ virtuals_only = false;
help_bit = memnew(EditorHelpBit);
vbc->add_margin_child(TTR("Description:"), help_bit);
diff --git a/editor/property_selector.h b/editor/property_selector.h
index 3fa60771d7..eb745d776f 100644
--- a/editor/property_selector.h
+++ b/editor/property_selector.h
@@ -55,6 +55,7 @@ class PropertySelector : public ConfirmationDialog {
String base_type;
ObjectID script;
Object *instance;
+ bool virtuals_only;
void _item_selected();
@@ -63,7 +64,7 @@ protected:
static void _bind_methods();
public:
- void select_method_from_base_type(const String &p_base, const String &p_current = "");
+ void select_method_from_base_type(const String &p_base, const String &p_current = "", bool p_virtuals_only = false);
void select_method_from_script(const Ref<Script> &p_script, const String &p_current = "");
void select_method_from_basic_type(Variant::Type p_type, const String &p_current = "");
void select_method_from_instance(Object *p_instance, const String &p_current = "");