mirror of
https://github.com/godotengine/godot-visual-script.git
synced 2026-01-04 18:10:07 +03:00
Merge pull request #65 from kitsdream/next
Restore and fix the issues what make the search box too slow.
This commit is contained in:
@@ -42,39 +42,25 @@
|
|||||||
#include "editor/editor_node.h"
|
#include "editor/editor_node.h"
|
||||||
#include "editor/editor_scale.h"
|
#include "editor/editor_scale.h"
|
||||||
#include "editor/editor_settings.h"
|
#include "editor/editor_settings.h"
|
||||||
#include "editor/visual_script_property_selector.h"
|
|
||||||
#include "scene/main/node.h"
|
#include "scene/main/node.h"
|
||||||
#include "scene/main/window.h"
|
#include "scene/main/window.h"
|
||||||
|
|
||||||
void VisualScriptPropertySelector::_update_icons() {
|
void VisualScriptPropertySelector::_update_icons() {
|
||||||
search_box->set_right_icon(
|
search_box->set_right_icon(results_tree->get_theme_icon(SNAME("Search"), SNAME("EditorIcons")));
|
||||||
results_tree->get_theme_icon(SNAME("Search"), SNAME("EditorIcons")));
|
|
||||||
search_box->set_clear_button_enabled(true);
|
search_box->set_clear_button_enabled(true);
|
||||||
search_box->add_theme_icon_override(
|
search_box->add_theme_icon_override("right_icon", results_tree->get_theme_icon(SNAME("Search"), SNAME("EditorIcons")));
|
||||||
"right_icon",
|
|
||||||
results_tree->get_theme_icon(SNAME("Search"), SNAME("EditorIcons")));
|
|
||||||
|
|
||||||
search_visual_script_nodes->set_icon(results_tree->get_theme_icon(
|
search_visual_script_nodes->set_icon(results_tree->get_theme_icon(SNAME("VisualScript"), SNAME("EditorIcons")));
|
||||||
SNAME("VisualScript"), SNAME("EditorIcons")));
|
search_classes->set_icon(results_tree->get_theme_icon(SNAME("Object"), SNAME("EditorIcons")));
|
||||||
search_classes->set_icon(
|
search_methods->set_icon(results_tree->get_theme_icon(SNAME("MemberMethod"), SNAME("EditorIcons")));
|
||||||
results_tree->get_theme_icon(SNAME("Object"), SNAME("EditorIcons")));
|
search_operators->set_icon(results_tree->get_theme_icon(SNAME("Add"), SNAME("EditorIcons")));
|
||||||
search_methods->set_icon(results_tree->get_theme_icon(SNAME("MemberMethod"),
|
search_signals->set_icon(results_tree->get_theme_icon(SNAME("MemberSignal"), SNAME("EditorIcons")));
|
||||||
SNAME("EditorIcons")));
|
search_constants->set_icon(results_tree->get_theme_icon(SNAME("MemberConstant"), SNAME("EditorIcons")));
|
||||||
search_operators->set_icon(
|
search_properties->set_icon(results_tree->get_theme_icon(SNAME("MemberProperty"), SNAME("EditorIcons")));
|
||||||
results_tree->get_theme_icon(SNAME("Add"), SNAME("EditorIcons")));
|
search_theme_items->set_icon(results_tree->get_theme_icon(SNAME("MemberTheme"), SNAME("EditorIcons")));
|
||||||
search_signals->set_icon(results_tree->get_theme_icon(SNAME("MemberSignal"),
|
|
||||||
SNAME("EditorIcons")));
|
|
||||||
search_constants->set_icon(results_tree->get_theme_icon(
|
|
||||||
SNAME("MemberConstant"), SNAME("EditorIcons")));
|
|
||||||
search_properties->set_icon(results_tree->get_theme_icon(
|
|
||||||
SNAME("MemberProperty"), SNAME("EditorIcons")));
|
|
||||||
search_theme_items->set_icon(
|
|
||||||
results_tree->get_theme_icon(SNAME("MemberTheme"), SNAME("EditorIcons")));
|
|
||||||
|
|
||||||
case_sensitive_button->set_icon(
|
case_sensitive_button->set_icon(results_tree->get_theme_icon(SNAME("MatchCase"), SNAME("EditorIcons")));
|
||||||
results_tree->get_theme_icon(SNAME("MatchCase"), SNAME("EditorIcons")));
|
hierarchy_button->set_icon(results_tree->get_theme_icon(SNAME("ClassList"), SNAME("EditorIcons")));
|
||||||
hierarchy_button->set_icon(
|
|
||||||
results_tree->get_theme_icon(SNAME("ClassList"), SNAME("EditorIcons")));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VisualScriptPropertySelector::_sbox_input(const Ref<InputEvent> &p_ie) {
|
void VisualScriptPropertySelector::_sbox_input(const Ref<InputEvent> &p_ie) {
|
||||||
@@ -114,89 +100,6 @@ void VisualScriptPropertySelector::_update_results() {
|
|||||||
_update_icons();
|
_update_icons();
|
||||||
search_runner = Ref<SearchRunner>(memnew(SearchRunner(this, results_tree)));
|
search_runner = Ref<SearchRunner>(memnew(SearchRunner(this, results_tree)));
|
||||||
set_process(true);
|
set_process(true);
|
||||||
|
|
||||||
TreeItem *root = results_tree->create_item();
|
|
||||||
|
|
||||||
if (search_classes->is_pressed()) {
|
|
||||||
List<StringName> class_list;
|
|
||||||
ClassDB::get_class_list(&class_list);
|
|
||||||
|
|
||||||
for (const StringName &class_name : class_list) {
|
|
||||||
if (search_box->get_text().findn(String(class_name)) == -1) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
TreeItem *item = results_tree->create_item(root);
|
|
||||||
item->set_text(0, String(class_name));
|
|
||||||
item->set_icon(
|
|
||||||
0, EditorNode::get_singleton()->get_class_icon(class_name, "Object"));
|
|
||||||
item->set_metadata(0, "class:" + String(class_name));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (search_methods->is_pressed()) {
|
|
||||||
List<StringName> class_list;
|
|
||||||
ClassDB::get_class_list(&class_list);
|
|
||||||
|
|
||||||
for (const StringName &class_name : class_list) {
|
|
||||||
List<MethodInfo> method_list;
|
|
||||||
ClassDB::get_method_list(class_name, &method_list, true);
|
|
||||||
|
|
||||||
for (const MethodInfo &method_info : method_list) {
|
|
||||||
if (method_info.name.findn(search_box->get_text()) == -1 &&
|
|
||||||
(method_info.flags & METHOD_FLAG_VIRTUAL) != 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
TreeItem *item = results_tree->create_item(root);
|
|
||||||
item->set_text(0, String(class_name) + "::" + method_info.name);
|
|
||||||
item->set_icon(0, EditorNode::get_singleton()->get_class_icon(class_name, "Object"));
|
|
||||||
item->set_metadata(0, "method:" + String(class_name) + "::" + method_info.name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (search_properties->is_pressed()) {
|
|
||||||
List<StringName> class_list;
|
|
||||||
ClassDB::get_class_list(&class_list);
|
|
||||||
|
|
||||||
for (const StringName &class_name : class_list) {
|
|
||||||
List<PropertyInfo> property_list;
|
|
||||||
ClassDB::get_property_list(class_name, &property_list, true);
|
|
||||||
|
|
||||||
for (const PropertyInfo &property_info : property_list) {
|
|
||||||
if (property_info.name.findn(search_box->get_text()) == -1) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
TreeItem *item = results_tree->create_item(root);
|
|
||||||
item->set_text(0, String(class_name) + "::" + property_info.name);
|
|
||||||
item->set_icon(0, EditorNode::get_singleton()->get_class_icon(class_name, "Object"));
|
|
||||||
item->set_metadata(0, "property:" + String(class_name) + "::" + property_info.name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (search_signals->is_pressed()) {
|
|
||||||
List<StringName> class_list;
|
|
||||||
ClassDB::get_class_list(&class_list);
|
|
||||||
|
|
||||||
for (const StringName &class_name : class_list) {
|
|
||||||
List<MethodInfo> signal_list;
|
|
||||||
ClassDB::get_signal_list(class_name, &signal_list, true);
|
|
||||||
|
|
||||||
for (const MethodInfo &signal_info : signal_list) {
|
|
||||||
if (signal_info.name.findn(search_box->get_text()) == -1) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
TreeItem *item = results_tree->create_item(root);
|
|
||||||
item->set_text(0, String(class_name) + "::" + signal_info.name);
|
|
||||||
item->set_icon(0, EditorNode::get_singleton()->get_class_icon(class_name, "Object"));
|
|
||||||
item->set_metadata(0, "signal:" + String(class_name) + "::" + signal_info.name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VisualScriptPropertySelector::_confirmed() {
|
void VisualScriptPropertySelector::_confirmed() {
|
||||||
@@ -204,14 +107,12 @@ void VisualScriptPropertySelector::_confirmed() {
|
|||||||
if (!ti) {
|
if (!ti) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
emit_signal(SNAME("selected"), ti->get_metadata(0), ti->get_metadata(1),
|
emit_signal(SNAME("selected"), ti->get_metadata(0), ti->get_metadata(1), connecting);
|
||||||
connecting);
|
|
||||||
set_visible(false);
|
set_visible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VisualScriptPropertySelector::_item_selected() {
|
void VisualScriptPropertySelector::_item_selected() {
|
||||||
help_bit->set_text(results_tree->get_selected()->get_meta(
|
help_bit->set_text(results_tree->get_selected()->get_meta("description", "No description available"));
|
||||||
"description", "No description available"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VisualScriptPropertySelector::_hide_requested() {
|
void VisualScriptPropertySelector::_hide_requested() {
|
||||||
@@ -225,8 +126,7 @@ void VisualScriptPropertySelector::_notification(int p_what) {
|
|||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_ENTER_TREE: {
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
connect("confirmed",
|
connect("confirmed", callable_mp(this, &VisualScriptPropertySelector::_confirmed));
|
||||||
callable_mp(this, &VisualScriptPropertySelector::_confirmed));
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_PROCESS: {
|
case NOTIFICATION_PROCESS: {
|
||||||
@@ -247,21 +147,21 @@ void VisualScriptPropertySelector::_notification(int p_what) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void VisualScriptPropertySelector::select_method_from_base_type(
|
void VisualScriptPropertySelector::select_method_from_base_type(const String &p_base, const bool p_virtuals_only, const bool p_connecting, bool clear_text) {
|
||||||
const String &p_base, const bool p_virtuals_only, const bool p_connecting,
|
|
||||||
bool clear_text) {
|
|
||||||
set_title(TTR("Select method from base type"));
|
set_title(TTR("Select method from base type"));
|
||||||
base_type = p_base;
|
base_type = p_base;
|
||||||
base_script = "";
|
base_script = "";
|
||||||
type = Variant::NIL;
|
type = Variant::NIL;
|
||||||
connecting = p_connecting;
|
connecting = p_connecting;
|
||||||
|
|
||||||
if (clear_text && !p_virtuals_only) {
|
if (clear_text) {
|
||||||
search_box->set_text(" "); // show all methods
|
if (p_virtuals_only) {
|
||||||
search_box->set_caret_column(1);
|
search_box->set_text("._"); // show all _methods
|
||||||
} else {
|
search_box->set_caret_column(2);
|
||||||
search_box->set_text("._"); // show all _methods
|
} else {
|
||||||
search_box->set_caret_column(2);
|
search_box->set_text("."); // show all methods.
|
||||||
|
search_box->set_caret_column(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
search_visual_script_nodes->set_pressed(false);
|
search_visual_script_nodes->set_pressed(false);
|
||||||
@@ -281,17 +181,20 @@ void VisualScriptPropertySelector::select_method_from_base_type(
|
|||||||
_update_results();
|
_update_results();
|
||||||
}
|
}
|
||||||
|
|
||||||
void VisualScriptPropertySelector::select_from_visual_script(
|
void VisualScriptPropertySelector::select_from_visual_script(const Ref<Script> &p_script, bool clear_text) {
|
||||||
const Ref<Script> &p_script) {
|
|
||||||
set_title(TTR("Select from visual script"));
|
set_title(TTR("Select from visual script"));
|
||||||
base_type = p_script->get_instance_base_type();
|
base_type = p_script->get_instance_base_type();
|
||||||
base_script = p_script->get_path()
|
if (p_script == nullptr) {
|
||||||
.trim_prefix("res://")
|
base_script = "";
|
||||||
.quote(); // filepath to EditorHelp::get_doc_data().name
|
} else {
|
||||||
|
base_script = p_script->get_path().trim_prefix("res://").quote();
|
||||||
|
}
|
||||||
type = Variant::NIL;
|
type = Variant::NIL;
|
||||||
connecting = true;
|
connecting = false;
|
||||||
|
|
||||||
search_box->set_text(" ");
|
if (clear_text) {
|
||||||
|
search_box->set_text("");
|
||||||
|
}
|
||||||
search_box->select_all();
|
search_box->select_all();
|
||||||
|
|
||||||
search_visual_script_nodes->set_pressed(true);
|
search_visual_script_nodes->set_pressed(true);
|
||||||
@@ -299,7 +202,7 @@ void VisualScriptPropertySelector::select_from_visual_script(
|
|||||||
search_methods->set_pressed(true);
|
search_methods->set_pressed(true);
|
||||||
search_operators->set_pressed(false);
|
search_operators->set_pressed(false);
|
||||||
search_signals->set_pressed(true);
|
search_signals->set_pressed(true);
|
||||||
search_constants->set_pressed(false);
|
search_constants->set_pressed(true);
|
||||||
search_properties->set_pressed(true);
|
search_properties->set_pressed(true);
|
||||||
search_theme_items->set_pressed(false);
|
search_theme_items->set_pressed(false);
|
||||||
|
|
||||||
@@ -311,23 +214,18 @@ void VisualScriptPropertySelector::select_from_visual_script(
|
|||||||
_update_results();
|
_update_results();
|
||||||
}
|
}
|
||||||
|
|
||||||
void VisualScriptPropertySelector::select_from_base_type(
|
void VisualScriptPropertySelector::select_from_base_type(const String &p_base, const String &p_base_script, bool p_virtuals_only, const bool p_connecting, bool clear_text) {
|
||||||
const String &p_base, const String &p_base_script, bool p_virtuals_only,
|
|
||||||
const bool p_connecting, bool clear_text) {
|
|
||||||
set_title(TTR("Select from base type"));
|
set_title(TTR("Select from base type"));
|
||||||
base_type = p_base;
|
base_type = p_base;
|
||||||
base_script = p_base_script.trim_prefix("res://")
|
base_script = p_base_script.trim_prefix("res://").quote();
|
||||||
.quote(); // filepath to EditorHelp::get_doc_data().name
|
|
||||||
type = Variant::NIL;
|
type = Variant::NIL;
|
||||||
connecting = p_connecting;
|
connecting = p_connecting;
|
||||||
|
|
||||||
if (clear_text) {
|
if (clear_text) {
|
||||||
if (p_virtuals_only) {
|
if (p_virtuals_only) {
|
||||||
search_box->set_text("._"); // show all _methods
|
search_box->set_text("_");
|
||||||
search_box->set_caret_column(2);
|
|
||||||
} else {
|
} else {
|
||||||
search_box->set_text("."); // show all methods
|
search_box->set_text("");
|
||||||
search_box->set_caret_column(1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
search_box->select_all();
|
search_box->select_all();
|
||||||
@@ -346,25 +244,21 @@ void VisualScriptPropertySelector::select_from_base_type(
|
|||||||
results_tree->clear();
|
results_tree->clear();
|
||||||
show_window(.5f);
|
show_window(.5f);
|
||||||
search_box->grab_focus();
|
search_box->grab_focus();
|
||||||
|
_update_results();
|
||||||
}
|
}
|
||||||
|
|
||||||
void VisualScriptPropertySelector::select_from_script(
|
void VisualScriptPropertySelector::select_from_script(const Ref<Script> &p_script, const bool p_connecting, bool clear_text) {
|
||||||
const Ref<Script> &p_script, const bool p_connecting, bool clear_text) {
|
|
||||||
set_title(TTR("Select from script"));
|
set_title(TTR("Select from script"));
|
||||||
ERR_FAIL_COND(p_script.is_null());
|
ERR_FAIL_COND(p_script.is_null());
|
||||||
|
|
||||||
base_type = p_script->get_instance_base_type();
|
base_type = p_script->get_instance_base_type();
|
||||||
base_script = p_script->get_path()
|
base_script = p_script->get_path().trim_prefix("res://").quote();
|
||||||
.trim_prefix("res://")
|
|
||||||
.quote(); // filepath to EditorHelp::get_doc_data().name
|
|
||||||
type = Variant::NIL;
|
type = Variant::NIL;
|
||||||
script = p_script->get_instance_id();
|
script = p_script->get_instance_id();
|
||||||
connecting = p_connecting;
|
connecting = p_connecting;
|
||||||
|
|
||||||
if (clear_text) {
|
if (clear_text) {
|
||||||
search_box->set_text(" ");
|
search_box->set_text("");
|
||||||
} else {
|
|
||||||
search_box->set_text(base_type);
|
|
||||||
}
|
}
|
||||||
search_box->select_all();
|
search_box->select_all();
|
||||||
|
|
||||||
@@ -382,10 +276,10 @@ void VisualScriptPropertySelector::select_from_script(
|
|||||||
results_tree->clear();
|
results_tree->clear();
|
||||||
show_window(.5f);
|
show_window(.5f);
|
||||||
search_box->grab_focus();
|
search_box->grab_focus();
|
||||||
|
_update_results();
|
||||||
}
|
}
|
||||||
|
|
||||||
void VisualScriptPropertySelector::select_from_basic_type(
|
void VisualScriptPropertySelector::select_from_basic_type(Variant::Type p_type, const bool p_connecting, bool clear_text) {
|
||||||
Variant::Type p_type, const bool p_connecting, bool clear_text) {
|
|
||||||
set_title(TTR("Select from basic type"));
|
set_title(TTR("Select from basic type"));
|
||||||
ERR_FAIL_COND(p_type == Variant::NIL);
|
ERR_FAIL_COND(p_type == Variant::NIL);
|
||||||
base_type = Variant::get_type_name(p_type);
|
base_type = Variant::get_type_name(p_type);
|
||||||
@@ -394,9 +288,7 @@ void VisualScriptPropertySelector::select_from_basic_type(
|
|||||||
connecting = p_connecting;
|
connecting = p_connecting;
|
||||||
|
|
||||||
if (clear_text) {
|
if (clear_text) {
|
||||||
search_box->set_text(" ");
|
search_box->set_text("");
|
||||||
} else {
|
|
||||||
search_box->set_text(base_type);
|
|
||||||
}
|
}
|
||||||
search_box->select_all();
|
search_box->select_all();
|
||||||
|
|
||||||
@@ -414,11 +306,10 @@ void VisualScriptPropertySelector::select_from_basic_type(
|
|||||||
results_tree->clear();
|
results_tree->clear();
|
||||||
show_window(.5f);
|
show_window(.5f);
|
||||||
search_box->grab_focus();
|
search_box->grab_focus();
|
||||||
|
_update_results();
|
||||||
}
|
}
|
||||||
|
|
||||||
void VisualScriptPropertySelector::select_from_instance(Object *p_instance,
|
void VisualScriptPropertySelector::select_from_instance(Object *p_instance, const bool p_connecting, bool clear_text) {
|
||||||
const bool p_connecting,
|
|
||||||
bool clear_text) {
|
|
||||||
set_title(TTR("Select from instance"));
|
set_title(TTR("Select from instance"));
|
||||||
base_type = p_instance->get_class();
|
base_type = p_instance->get_class();
|
||||||
|
|
||||||
@@ -426,18 +317,14 @@ void VisualScriptPropertySelector::select_from_instance(Object *p_instance,
|
|||||||
if (p_script == nullptr) {
|
if (p_script == nullptr) {
|
||||||
base_script = "";
|
base_script = "";
|
||||||
} else {
|
} else {
|
||||||
base_script = p_script->get_path()
|
base_script = p_script->get_path().trim_prefix("res://").quote();
|
||||||
.trim_prefix("res://")
|
|
||||||
.quote(); // filepath to EditorHelp::get_doc_data().name
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type = Variant::NIL;
|
type = Variant::NIL;
|
||||||
connecting = p_connecting;
|
connecting = p_connecting;
|
||||||
|
|
||||||
if (clear_text) {
|
if (clear_text) {
|
||||||
search_box->set_text(".");
|
search_box->set_text("");
|
||||||
} else {
|
|
||||||
search_box->set_text(base_type);
|
|
||||||
}
|
}
|
||||||
search_box->select_all();
|
search_box->select_all();
|
||||||
|
|
||||||
@@ -455,16 +342,17 @@ void VisualScriptPropertySelector::select_from_instance(Object *p_instance,
|
|||||||
results_tree->clear();
|
results_tree->clear();
|
||||||
show_window(.5f);
|
show_window(.5f);
|
||||||
search_box->grab_focus();
|
search_box->grab_focus();
|
||||||
|
_update_results();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void VisualScriptPropertySelector::show_window(float p_screen_ratio) {
|
void VisualScriptPropertySelector::show_window(float p_screen_ratio) {
|
||||||
popup_centered_ratio(p_screen_ratio);
|
popup_centered_ratio(p_screen_ratio);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VisualScriptPropertySelector::_bind_methods() {
|
void VisualScriptPropertySelector::_bind_methods() {
|
||||||
ADD_SIGNAL(MethodInfo("selected", PropertyInfo(Variant::STRING, "name"),
|
ADD_SIGNAL(MethodInfo("selected", PropertyInfo(Variant::STRING, "name"), PropertyInfo(Variant::STRING, "category"), PropertyInfo(Variant::BOOL, "connecting")));
|
||||||
PropertyInfo(Variant::STRING, "category"),
|
|
||||||
PropertyInfo(Variant::BOOL, "connecting")));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VisualScriptPropertySelector::VisualScriptPropertySelector() {
|
VisualScriptPropertySelector::VisualScriptPropertySelector() {
|
||||||
@@ -478,9 +366,7 @@ VisualScriptPropertySelector::VisualScriptPropertySelector() {
|
|||||||
case_sensitive_button = memnew(Button);
|
case_sensitive_button = memnew(Button);
|
||||||
case_sensitive_button->set_flat(true);
|
case_sensitive_button->set_flat(true);
|
||||||
case_sensitive_button->set_tooltip_text(TTR("Case Sensitive"));
|
case_sensitive_button->set_tooltip_text(TTR("Case Sensitive"));
|
||||||
case_sensitive_button->connect(
|
case_sensitive_button->connect("pressed", callable_mp(this, &VisualScriptPropertySelector::_update_results));
|
||||||
"pressed",
|
|
||||||
callable_mp(this, &VisualScriptPropertySelector::_update_results));
|
|
||||||
case_sensitive_button->set_toggle_mode(true);
|
case_sensitive_button->set_toggle_mode(true);
|
||||||
case_sensitive_button->set_focus_mode(Control::FOCUS_NONE);
|
case_sensitive_button->set_focus_mode(Control::FOCUS_NONE);
|
||||||
hbox->add_child(case_sensitive_button);
|
hbox->add_child(case_sensitive_button);
|
||||||
@@ -488,9 +374,7 @@ VisualScriptPropertySelector::VisualScriptPropertySelector() {
|
|||||||
hierarchy_button = memnew(Button);
|
hierarchy_button = memnew(Button);
|
||||||
hierarchy_button->set_flat(true);
|
hierarchy_button->set_flat(true);
|
||||||
hierarchy_button->set_tooltip_text(TTR("Show Hierarchy"));
|
hierarchy_button->set_tooltip_text(TTR("Show Hierarchy"));
|
||||||
hierarchy_button->connect(
|
hierarchy_button->connect("pressed", callable_mp(this, &VisualScriptPropertySelector::_update_results));
|
||||||
"pressed",
|
|
||||||
callable_mp(this, &VisualScriptPropertySelector::_update_results));
|
|
||||||
hierarchy_button->set_toggle_mode(true);
|
hierarchy_button->set_toggle_mode(true);
|
||||||
hierarchy_button->set_pressed(true);
|
hierarchy_button->set_pressed(true);
|
||||||
hierarchy_button->set_focus_mode(Control::FOCUS_NONE);
|
hierarchy_button->set_focus_mode(Control::FOCUS_NONE);
|
||||||
@@ -500,11 +384,8 @@ VisualScriptPropertySelector::VisualScriptPropertySelector() {
|
|||||||
|
|
||||||
search_visual_script_nodes = memnew(Button);
|
search_visual_script_nodes = memnew(Button);
|
||||||
search_visual_script_nodes->set_flat(true);
|
search_visual_script_nodes->set_flat(true);
|
||||||
search_visual_script_nodes->set_tooltip_text(
|
search_visual_script_nodes->set_tooltip_text(TTR("Search Visual Script Nodes"));
|
||||||
TTR("Search Visual Script Nodes"));
|
search_visual_script_nodes->connect("pressed", callable_mp(this, &VisualScriptPropertySelector::_update_results));
|
||||||
search_visual_script_nodes->connect(
|
|
||||||
"pressed",
|
|
||||||
callable_mp(this, &VisualScriptPropertySelector::_update_results));
|
|
||||||
search_visual_script_nodes->set_toggle_mode(true);
|
search_visual_script_nodes->set_toggle_mode(true);
|
||||||
search_visual_script_nodes->set_pressed(true);
|
search_visual_script_nodes->set_pressed(true);
|
||||||
search_visual_script_nodes->set_focus_mode(Control::FOCUS_NONE);
|
search_visual_script_nodes->set_focus_mode(Control::FOCUS_NONE);
|
||||||
@@ -513,10 +394,7 @@ VisualScriptPropertySelector::VisualScriptPropertySelector() {
|
|||||||
search_classes = memnew(Button);
|
search_classes = memnew(Button);
|
||||||
search_classes->set_flat(true);
|
search_classes->set_flat(true);
|
||||||
search_classes->set_tooltip_text(TTR("Search Classes"));
|
search_classes->set_tooltip_text(TTR("Search Classes"));
|
||||||
search_classes->connect(
|
search_classes->connect("pressed", callable_mp(this, &VisualScriptPropertySelector::_update_results_search_all));
|
||||||
"pressed",
|
|
||||||
callable_mp(this,
|
|
||||||
&VisualScriptPropertySelector::_update_results_search_all));
|
|
||||||
search_classes->set_toggle_mode(true);
|
search_classes->set_toggle_mode(true);
|
||||||
search_classes->set_pressed(true);
|
search_classes->set_pressed(true);
|
||||||
search_classes->set_focus_mode(Control::FOCUS_NONE);
|
search_classes->set_focus_mode(Control::FOCUS_NONE);
|
||||||
@@ -525,9 +403,7 @@ VisualScriptPropertySelector::VisualScriptPropertySelector() {
|
|||||||
search_operators = memnew(Button);
|
search_operators = memnew(Button);
|
||||||
search_operators->set_flat(true);
|
search_operators->set_flat(true);
|
||||||
search_operators->set_tooltip_text(TTR("Search Operators"));
|
search_operators->set_tooltip_text(TTR("Search Operators"));
|
||||||
search_operators->connect(
|
search_operators->connect("pressed", callable_mp(this, &VisualScriptPropertySelector::_update_results));
|
||||||
"pressed",
|
|
||||||
callable_mp(this, &VisualScriptPropertySelector::_update_results));
|
|
||||||
search_operators->set_toggle_mode(true);
|
search_operators->set_toggle_mode(true);
|
||||||
search_operators->set_pressed(true);
|
search_operators->set_pressed(true);
|
||||||
search_operators->set_focus_mode(Control::FOCUS_NONE);
|
search_operators->set_focus_mode(Control::FOCUS_NONE);
|
||||||
@@ -538,9 +414,7 @@ VisualScriptPropertySelector::VisualScriptPropertySelector() {
|
|||||||
search_methods = memnew(Button);
|
search_methods = memnew(Button);
|
||||||
search_methods->set_flat(true);
|
search_methods->set_flat(true);
|
||||||
search_methods->set_tooltip_text(TTR("Search Methods"));
|
search_methods->set_tooltip_text(TTR("Search Methods"));
|
||||||
search_methods->connect(
|
search_methods->connect("pressed", callable_mp(this, &VisualScriptPropertySelector::_update_results));
|
||||||
"pressed",
|
|
||||||
callable_mp(this, &VisualScriptPropertySelector::_update_results));
|
|
||||||
search_methods->set_toggle_mode(true);
|
search_methods->set_toggle_mode(true);
|
||||||
search_methods->set_pressed(true);
|
search_methods->set_pressed(true);
|
||||||
search_methods->set_focus_mode(Control::FOCUS_NONE);
|
search_methods->set_focus_mode(Control::FOCUS_NONE);
|
||||||
@@ -549,9 +423,7 @@ VisualScriptPropertySelector::VisualScriptPropertySelector() {
|
|||||||
search_signals = memnew(Button);
|
search_signals = memnew(Button);
|
||||||
search_signals->set_flat(true);
|
search_signals->set_flat(true);
|
||||||
search_signals->set_tooltip_text(TTR("Search Signals"));
|
search_signals->set_tooltip_text(TTR("Search Signals"));
|
||||||
search_signals->connect(
|
search_signals->connect("pressed", callable_mp(this, &VisualScriptPropertySelector::_update_results));
|
||||||
"pressed",
|
|
||||||
callable_mp(this, &VisualScriptPropertySelector::_update_results));
|
|
||||||
search_signals->set_toggle_mode(true);
|
search_signals->set_toggle_mode(true);
|
||||||
search_signals->set_pressed(true);
|
search_signals->set_pressed(true);
|
||||||
search_signals->set_focus_mode(Control::FOCUS_NONE);
|
search_signals->set_focus_mode(Control::FOCUS_NONE);
|
||||||
@@ -560,9 +432,7 @@ VisualScriptPropertySelector::VisualScriptPropertySelector() {
|
|||||||
search_constants = memnew(Button);
|
search_constants = memnew(Button);
|
||||||
search_constants->set_flat(true);
|
search_constants->set_flat(true);
|
||||||
search_constants->set_tooltip_text(TTR("Search Constants"));
|
search_constants->set_tooltip_text(TTR("Search Constants"));
|
||||||
search_constants->connect(
|
search_constants->connect("pressed", callable_mp(this, &VisualScriptPropertySelector::_update_results));
|
||||||
"pressed",
|
|
||||||
callable_mp(this, &VisualScriptPropertySelector::_update_results));
|
|
||||||
search_constants->set_toggle_mode(true);
|
search_constants->set_toggle_mode(true);
|
||||||
search_constants->set_pressed(true);
|
search_constants->set_pressed(true);
|
||||||
search_constants->set_focus_mode(Control::FOCUS_NONE);
|
search_constants->set_focus_mode(Control::FOCUS_NONE);
|
||||||
@@ -571,9 +441,7 @@ VisualScriptPropertySelector::VisualScriptPropertySelector() {
|
|||||||
search_properties = memnew(Button);
|
search_properties = memnew(Button);
|
||||||
search_properties->set_flat(true);
|
search_properties->set_flat(true);
|
||||||
search_properties->set_tooltip_text(TTR("Search Properties"));
|
search_properties->set_tooltip_text(TTR("Search Properties"));
|
||||||
search_properties->connect(
|
search_properties->connect("pressed", callable_mp(this, &VisualScriptPropertySelector::_update_results));
|
||||||
"pressed",
|
|
||||||
callable_mp(this, &VisualScriptPropertySelector::_update_results));
|
|
||||||
search_properties->set_toggle_mode(true);
|
search_properties->set_toggle_mode(true);
|
||||||
search_properties->set_pressed(true);
|
search_properties->set_pressed(true);
|
||||||
search_properties->set_focus_mode(Control::FOCUS_NONE);
|
search_properties->set_focus_mode(Control::FOCUS_NONE);
|
||||||
@@ -582,9 +450,7 @@ VisualScriptPropertySelector::VisualScriptPropertySelector() {
|
|||||||
search_theme_items = memnew(Button);
|
search_theme_items = memnew(Button);
|
||||||
search_theme_items->set_flat(true);
|
search_theme_items->set_flat(true);
|
||||||
search_theme_items->set_tooltip_text(TTR("Search Theme Items"));
|
search_theme_items->set_tooltip_text(TTR("Search Theme Items"));
|
||||||
search_theme_items->connect(
|
search_theme_items->connect("pressed", callable_mp(this, &VisualScriptPropertySelector::_update_results));
|
||||||
"pressed",
|
|
||||||
callable_mp(this, &VisualScriptPropertySelector::_update_results));
|
|
||||||
search_theme_items->set_toggle_mode(true);
|
search_theme_items->set_toggle_mode(true);
|
||||||
search_theme_items->set_pressed(true);
|
search_theme_items->set_pressed(true);
|
||||||
search_theme_items->set_focus_mode(Control::FOCUS_NONE);
|
search_theme_items->set_focus_mode(Control::FOCUS_NONE);
|
||||||
@@ -600,24 +466,15 @@ VisualScriptPropertySelector::VisualScriptPropertySelector() {
|
|||||||
scope_combo->add_item(TTR("Search Inheriters"), SCOPE_INHERITERS);
|
scope_combo->add_item(TTR("Search Inheriters"), SCOPE_INHERITERS);
|
||||||
scope_combo->add_item(TTR("Search Unrelated"), SCOPE_UNRELATED);
|
scope_combo->add_item(TTR("Search Unrelated"), SCOPE_UNRELATED);
|
||||||
scope_combo->add_item(TTR("Search All"), SCOPE_ALL);
|
scope_combo->add_item(TTR("Search All"), SCOPE_ALL);
|
||||||
scope_combo->connect(
|
scope_combo->connect("item_selected", callable_mp(this, &VisualScriptPropertySelector::_update_results_i));
|
||||||
"item_selected",
|
|
||||||
callable_mp(this, &VisualScriptPropertySelector::_update_results_i));
|
|
||||||
hbox->add_child(scope_combo);
|
hbox->add_child(scope_combo);
|
||||||
|
|
||||||
search_box = memnew(LineEdit);
|
search_box = memnew(LineEdit);
|
||||||
search_box->set_tooltip_text(
|
search_box->set_tooltip_text(TTR("Enter \" \" to show all filtered options\nEnter \".\" to show all filtered methods, operators and constructors\nUse CTRL_KEY to drop property setters"));
|
||||||
TTR("Enter \" \" to show all filtered options\nEnter \".\" to show all "
|
|
||||||
"filtered methods, operators and constructors\nUse CTRL_KEY to drop "
|
|
||||||
"property setters"));
|
|
||||||
search_box->set_custom_minimum_size(Size2(200, 0) * EDSCALE);
|
search_box->set_custom_minimum_size(Size2(200, 0) * EDSCALE);
|
||||||
search_box->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
search_box->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||||
search_box->connect(
|
search_box->connect("text_changed", callable_mp(this, &VisualScriptPropertySelector::_update_results_s));
|
||||||
"text_changed",
|
search_box->connect("gui_input", callable_mp(this, &VisualScriptPropertySelector::_sbox_input));
|
||||||
callable_mp(this, &VisualScriptPropertySelector::_update_results_s));
|
|
||||||
search_box->connect(
|
|
||||||
"gui_input",
|
|
||||||
callable_mp(this, &VisualScriptPropertySelector::_sbox_input));
|
|
||||||
register_text_enter(search_box);
|
register_text_enter(search_box);
|
||||||
vbox->add_child(search_box);
|
vbox->add_child(search_box);
|
||||||
|
|
||||||
@@ -634,12 +491,8 @@ VisualScriptPropertySelector::VisualScriptPropertySelector() {
|
|||||||
results_tree->set_column_clip_content(1, true);
|
results_tree->set_column_clip_content(1, true);
|
||||||
results_tree->set_custom_minimum_size(Size2(0, 100) * EDSCALE);
|
results_tree->set_custom_minimum_size(Size2(0, 100) * EDSCALE);
|
||||||
results_tree->set_select_mode(Tree::SELECT_ROW);
|
results_tree->set_select_mode(Tree::SELECT_ROW);
|
||||||
results_tree->connect(
|
results_tree->connect("item_activated", callable_mp(this, &VisualScriptPropertySelector::_confirmed));
|
||||||
"item_activated",
|
results_tree->connect("item_selected", callable_mp(this, &VisualScriptPropertySelector::_item_selected));
|
||||||
callable_mp(this, &VisualScriptPropertySelector::_confirmed));
|
|
||||||
results_tree->connect(
|
|
||||||
"item_selected",
|
|
||||||
callable_mp(this, &VisualScriptPropertySelector::_item_selected));
|
|
||||||
vbox->add_child(results_tree);
|
vbox->add_child(results_tree);
|
||||||
|
|
||||||
ScrollContainer *scroller = memnew(ScrollContainer);
|
ScrollContainer *scroller = memnew(ScrollContainer);
|
||||||
@@ -653,18 +506,14 @@ VisualScriptPropertySelector::VisualScriptPropertySelector() {
|
|||||||
help_bit->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
help_bit->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||||
scroller->add_child(help_bit);
|
scroller->add_child(help_bit);
|
||||||
|
|
||||||
help_bit->connect(
|
help_bit->connect("request_hide", callable_mp(this, &VisualScriptPropertySelector::_hide_requested));
|
||||||
"request_hide",
|
|
||||||
callable_mp(this, &VisualScriptPropertySelector::_hide_requested));
|
|
||||||
set_ok_button_text(TTR("Open"));
|
set_ok_button_text(TTR("Open"));
|
||||||
get_ok_button()->set_disabled(true);
|
get_ok_button()->set_disabled(true);
|
||||||
set_hide_on_ok(false);
|
set_hide_on_ok(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VisualScriptPropertySelector::SearchRunner::
|
bool VisualScriptPropertySelector::SearchRunner::_is_class_disabled_by_feature_profile(const StringName &p_class) {
|
||||||
_is_class_disabled_by_feature_profile(const StringName &p_class) {
|
Ref<EditorFeatureProfile> profile = EditorFeatureProfileManager::get_singleton()->get_current_profile();
|
||||||
Ref<EditorFeatureProfile> profile =
|
|
||||||
EditorFeatureProfileManager::get_singleton()->get_current_profile();
|
|
||||||
if (profile.is_null()) {
|
if (profile.is_null()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -684,8 +533,7 @@ bool VisualScriptPropertySelector::SearchRunner::
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VisualScriptPropertySelector::SearchRunner::_is_class_disabled_by_scope(
|
bool VisualScriptPropertySelector::SearchRunner::_is_class_disabled_by_scope(const StringName &p_class) {
|
||||||
const StringName &p_class) {
|
|
||||||
bool is_base_script = false;
|
bool is_base_script = false;
|
||||||
if (p_class == selector_ui->base_script) {
|
if (p_class == selector_ui->base_script) {
|
||||||
is_base_script = true;
|
is_base_script = true;
|
||||||
@@ -706,10 +554,6 @@ bool VisualScriptPropertySelector::SearchRunner::_is_class_disabled_by_scope(
|
|||||||
is_inheriter = true;
|
is_inheriter = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_global = false;
|
|
||||||
if (ScriptServer::is_global_class(p_class) && ScriptServer::get_global_class_base(p_class) != StringName()) {
|
|
||||||
is_global = true;
|
|
||||||
}
|
|
||||||
if (scope_flags & SCOPE_BASE) {
|
if (scope_flags & SCOPE_BASE) {
|
||||||
if (is_base_script || is_base || is_parent) {
|
if (is_base_script || is_base || is_parent) {
|
||||||
return false;
|
return false;
|
||||||
@@ -720,16 +564,12 @@ bool VisualScriptPropertySelector::SearchRunner::_is_class_disabled_by_scope(
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scope_flags & SCOPE_UNRELATED) {
|
if (scope_flags & SCOPE_UNRELATED) {
|
||||||
if (!is_base_script && !is_base && !is_inheriter) {
|
if (!is_base_script && !is_base && !is_inheriter) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (scope_flags & SCOPE_GLOBAL) {
|
|
||||||
if (is_global) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -769,8 +609,7 @@ bool VisualScriptPropertySelector::SearchRunner::_slice() {
|
|||||||
case PHASE_MAX:
|
case PHASE_MAX:
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
WARN_PRINT("Invalid or unhandled phase in EditorHelpSearch::Runner, "
|
WARN_PRINT("Invalid or unhandled phase in EditorHelpSearch::Runner, aborting search.");
|
||||||
"aborting search.");
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -781,14 +620,16 @@ bool VisualScriptPropertySelector::SearchRunner::_slice() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool VisualScriptPropertySelector::SearchRunner::_phase_init() {
|
bool VisualScriptPropertySelector::SearchRunner::_phase_init() {
|
||||||
search_flags = 0;
|
search_flags = 0; // selector_ui->filter_combo->get_selected_id();
|
||||||
if (selector_ui->search_visual_script_nodes->is_pressed()) {
|
if (selector_ui->search_visual_script_nodes->is_pressed()) {
|
||||||
search_flags |= SEARCH_VISUAL_SCRIPT_NODES;
|
search_flags |= SEARCH_VISUAL_SCRIPT_NODES;
|
||||||
}
|
}
|
||||||
if (selector_ui->search_classes->is_pressed()) {
|
if (selector_ui->search_classes->is_pressed()) {
|
||||||
search_flags |= SEARCH_CLASSES;
|
search_flags |= SEARCH_CLASSES;
|
||||||
}
|
}
|
||||||
|
// if (selector_ui->search_constructors->is_pressed()) {
|
||||||
search_flags |= SEARCH_CONSTRUCTORS;
|
search_flags |= SEARCH_CONSTRUCTORS;
|
||||||
|
// }
|
||||||
if (selector_ui->search_methods->is_pressed()) {
|
if (selector_ui->search_methods->is_pressed()) {
|
||||||
search_flags |= SEARCH_METHODS;
|
search_flags |= SEARCH_METHODS;
|
||||||
}
|
}
|
||||||
@@ -824,25 +665,23 @@ bool VisualScriptPropertySelector::SearchRunner::_phase_match_classes_init() {
|
|||||||
matched_item = nullptr;
|
matched_item = nullptr;
|
||||||
match_highest_score = 0;
|
match_highest_score = 0;
|
||||||
|
|
||||||
if ((selector_ui->base_script.unquote() != "") &&
|
if (
|
||||||
|
(selector_ui->base_script.unquote() != "") &&
|
||||||
(selector_ui->base_script.unquote() != ".") &&
|
(selector_ui->base_script.unquote() != ".") &&
|
||||||
!combined_docs.has(selector_ui->base_script)) {
|
!combined_docs.has(selector_ui->base_script)) {
|
||||||
String file_path =
|
String file_path = "res://" + selector_ui->base_script.unquote(); // EditorHelp::get_doc_data().name to filepath
|
||||||
"res://" +
|
Ref<Script> script;
|
||||||
selector_ui->base_script
|
script = ResourceLoader::load(file_path);
|
||||||
.unquote(); // EditorHelp::get_doc_data().name to filepath
|
if (!script.is_null()) {
|
||||||
Ref<Script> phase_match_script = ResourceLoader::load(file_path);
|
|
||||||
if (!phase_match_script.is_null()) {
|
|
||||||
DocData::ClassDoc class_doc = DocData::ClassDoc();
|
DocData::ClassDoc class_doc = DocData::ClassDoc();
|
||||||
|
|
||||||
class_doc.name = selector_ui->base_script;
|
class_doc.name = selector_ui->base_script;
|
||||||
|
|
||||||
class_doc.inherits = phase_match_script->get_instance_base_type();
|
class_doc.inherits = script->get_instance_base_type();
|
||||||
class_doc.brief_description =
|
class_doc.brief_description = ".vs files not supported by EditorHelp::get_doc_data()";
|
||||||
".vs files not supported by EditorHelp::get_doc_data()";
|
|
||||||
class_doc.description = "";
|
class_doc.description = "";
|
||||||
|
|
||||||
Object *obj = ObjectDB::get_instance(phase_match_script->get_instance_id());
|
Object *obj = ObjectDB::get_instance(script->get_instance_id());
|
||||||
if (Object::cast_to<Script>(obj)) {
|
if (Object::cast_to<Script>(obj)) {
|
||||||
List<MethodInfo> methods;
|
List<MethodInfo> methods;
|
||||||
Object::cast_to<Script>(obj)->get_script_method_list(&methods);
|
Object::cast_to<Script>(obj)->get_script_method_list(&methods);
|
||||||
@@ -858,8 +697,7 @@ bool VisualScriptPropertySelector::SearchRunner::_phase_match_classes_init() {
|
|||||||
|
|
||||||
List<PropertyInfo> properties;
|
List<PropertyInfo> properties;
|
||||||
Object::cast_to<Script>(obj)->get_script_property_list(&properties);
|
Object::cast_to<Script>(obj)->get_script_property_list(&properties);
|
||||||
for (List<PropertyInfo>::Element *P = properties.front(); P;
|
for (List<PropertyInfo>::Element *P = properties.front(); P; P = P->next()) {
|
||||||
P = P->next()) {
|
|
||||||
DocData::PropertyDoc pd = DocData::PropertyDoc();
|
DocData::PropertyDoc pd = DocData::PropertyDoc();
|
||||||
pd.name = P->get().name;
|
pd.name = P->get().name;
|
||||||
pd.type = Variant::get_type_name(P->get().type);
|
pd.type = Variant::get_type_name(P->get().type);
|
||||||
@@ -931,8 +769,8 @@ bool VisualScriptPropertySelector::SearchRunner::_phase_node_classes_build() {
|
|||||||
|
|
||||||
bool VisualScriptPropertySelector::SearchRunner::_phase_match_classes() {
|
bool VisualScriptPropertySelector::SearchRunner::_phase_match_classes() {
|
||||||
DocData::ClassDoc &class_doc = iterator_doc->value;
|
DocData::ClassDoc &class_doc = iterator_doc->value;
|
||||||
if ((!_is_class_disabled_by_feature_profile(class_doc.name) &&
|
if (
|
||||||
!_is_class_disabled_by_scope(class_doc.name)) ||
|
(!_is_class_disabled_by_feature_profile(class_doc.name) && !_is_class_disabled_by_scope(class_doc.name)) ||
|
||||||
_match_visual_script(class_doc)) {
|
_match_visual_script(class_doc)) {
|
||||||
if (class_doc.inherits == "VisualScriptCustomNode") {
|
if (class_doc.inherits == "VisualScriptCustomNode") {
|
||||||
class_doc.script_path = "res://" + class_doc.name.unquote();
|
class_doc.script_path = "res://" + class_doc.name.unquote();
|
||||||
@@ -945,8 +783,7 @@ bool VisualScriptPropertySelector::SearchRunner::_phase_match_classes() {
|
|||||||
class_doc.inherits = vsn->get_category();
|
class_doc.inherits = vsn->get_category();
|
||||||
} else if (combined_docs.has("VisualScriptNode/" + vsn->get_category())) {
|
} else if (combined_docs.has("VisualScriptNode/" + vsn->get_category())) {
|
||||||
class_doc.inherits = "VisualScriptNode/" + vsn->get_category();
|
class_doc.inherits = "VisualScriptNode/" + vsn->get_category();
|
||||||
} else if (combined_docs.has("VisualScriptCustomNode/" +
|
} else if (combined_docs.has("VisualScriptCustomNode/" + vsn->get_category())) {
|
||||||
vsn->get_category())) {
|
|
||||||
class_doc.inherits = "VisualScriptCustomNode/" + vsn->get_category();
|
class_doc.inherits = "VisualScriptCustomNode/" + vsn->get_category();
|
||||||
} else {
|
} else {
|
||||||
class_doc.inherits = "";
|
class_doc.inherits = "";
|
||||||
@@ -980,74 +817,53 @@ bool VisualScriptPropertySelector::SearchRunner::_phase_match_classes() {
|
|||||||
if (term.length() >= 0) {
|
if (term.length() >= 0) {
|
||||||
if (search_flags & SEARCH_CONSTRUCTORS) {
|
if (search_flags & SEARCH_CONSTRUCTORS) {
|
||||||
for (int i = 0; i < class_doc.constructors.size(); i++) {
|
for (int i = 0; i < class_doc.constructors.size(); i++) {
|
||||||
String method_name = (search_flags & SEARCH_CASE_SENSITIVE)
|
String method_name = (search_flags & SEARCH_CASE_SENSITIVE) ? class_doc.constructors[i].name : class_doc.constructors[i].name.to_lower();
|
||||||
? class_doc.constructors[i].name
|
if (method_name.find(term) > -1 ||
|
||||||
: class_doc.constructors[i].name.to_lower();
|
term == " " ||
|
||||||
if (method_name.find(term) > -1 || term == " " ||
|
(term.begins_with(".") && method_name.begins_with(term.substr(1))) ||
|
||||||
(term.begins_with(".") &&
|
(term.ends_with("(") && method_name.ends_with(term.left(term.length() - 1).strip_edges())) ||
|
||||||
method_name.begins_with(term.substr(1))) ||
|
(term.begins_with(".") && term.ends_with("(") && method_name == term.substr(1, term.length() - 2).strip_edges())) {
|
||||||
(term.ends_with("(") &&
|
match.constructors.push_back(const_cast<DocData::MethodDoc *>(&class_doc.constructors[i]));
|
||||||
method_name.ends_with(
|
|
||||||
term.left(term.length() - 1).strip_edges())) ||
|
|
||||||
(term.begins_with(".") && term.ends_with("(") &&
|
|
||||||
method_name ==
|
|
||||||
term.substr(1, term.length() - 2).strip_edges())) {
|
|
||||||
match.constructors.push_back(
|
|
||||||
const_cast<DocData::MethodDoc *>(&class_doc.constructors[i]));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (search_flags & SEARCH_METHODS) {
|
if (search_flags & SEARCH_METHODS) {
|
||||||
for (int i = 0; i < class_doc.methods.size(); i++) {
|
for (int i = 0; i < class_doc.methods.size(); i++) {
|
||||||
String method_name = (search_flags & SEARCH_CASE_SENSITIVE)
|
String method_name = (search_flags & SEARCH_CASE_SENSITIVE) ? class_doc.methods[i].name : class_doc.methods[i].name.to_lower();
|
||||||
? class_doc.methods[i].name
|
if (method_name.find(term) > -1 ||
|
||||||
: class_doc.methods[i].name.to_lower();
|
term == " " ||
|
||||||
if (method_name.find(term) > -1 || term == " " ||
|
(term.begins_with(".") && method_name.begins_with(term.substr(1))) ||
|
||||||
(term.begins_with(".") &&
|
(term.ends_with("(") && method_name.ends_with(term.left(term.length() - 1).strip_edges())) ||
|
||||||
method_name.begins_with(term.substr(1))) ||
|
(term.begins_with(".") && term.ends_with("(") && method_name == term.substr(1, term.length() - 2).strip_edges())) {
|
||||||
(term.ends_with("(") &&
|
match.methods.push_back(const_cast<DocData::MethodDoc *>(&class_doc.methods[i]));
|
||||||
method_name.ends_with(
|
|
||||||
term.left(term.length() - 1).strip_edges())) ||
|
|
||||||
(term.begins_with(".") && term.ends_with("(") &&
|
|
||||||
method_name ==
|
|
||||||
term.substr(1, term.length() - 2).strip_edges())) {
|
|
||||||
match.methods.push_back(
|
|
||||||
const_cast<DocData::MethodDoc *>(&class_doc.methods[i]));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (search_flags & SEARCH_OPERATORS) {
|
if (search_flags & SEARCH_OPERATORS) {
|
||||||
for (int i = 0; i < class_doc.operators.size(); i++) {
|
for (int i = 0; i < class_doc.operators.size(); i++) {
|
||||||
String method_name = (search_flags & SEARCH_CASE_SENSITIVE)
|
String method_name = (search_flags & SEARCH_CASE_SENSITIVE) ? class_doc.operators[i].name : class_doc.operators[i].name.to_lower();
|
||||||
? class_doc.operators[i].name
|
if (method_name.find(term) > -1 ||
|
||||||
: class_doc.operators[i].name.to_lower();
|
term == " " ||
|
||||||
if (method_name.find(term) > -1 || term == " " ||
|
(term.begins_with(".") && method_name.begins_with(term.substr(1))) ||
|
||||||
(term.begins_with(".") &&
|
(term.ends_with("(") && method_name.ends_with(term.left(term.length() - 1).strip_edges())) ||
|
||||||
method_name.begins_with(term.substr(1))) ||
|
(term.begins_with(".") && term.ends_with("(") && method_name == term.substr(1, term.length() - 2).strip_edges())) {
|
||||||
(term.ends_with("(") &&
|
match.operators.push_back(const_cast<DocData::MethodDoc *>(&class_doc.operators[i]));
|
||||||
method_name.ends_with(
|
|
||||||
term.left(term.length() - 1).strip_edges())) ||
|
|
||||||
(term.begins_with(".") && term.ends_with("(") &&
|
|
||||||
method_name ==
|
|
||||||
term.substr(1, term.length() - 2).strip_edges())) {
|
|
||||||
match.operators.push_back(
|
|
||||||
const_cast<DocData::MethodDoc *>(&class_doc.operators[i]));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (search_flags & SEARCH_SIGNALS) {
|
if (search_flags & SEARCH_SIGNALS) {
|
||||||
for (int i = 0; i < class_doc.signals.size(); i++) {
|
for (int i = 0; i < class_doc.signals.size(); i++) {
|
||||||
if (_match_string(term, class_doc.signals[i].name) || term == " ") {
|
if (_match_string(term, class_doc.signals[i].name) ||
|
||||||
match.signals.push_back(
|
term == " ") {
|
||||||
const_cast<DocData::MethodDoc *>(&class_doc.signals[i]));
|
match.signals.push_back(const_cast<DocData::MethodDoc *>(&class_doc.signals[i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (search_flags & SEARCH_CONSTANTS) {
|
if (search_flags & SEARCH_CONSTANTS) {
|
||||||
for (int i = 0; i < class_doc.constants.size(); i++) {
|
for (int i = 0; i < class_doc.constants.size(); i++) {
|
||||||
if (_match_string(term, class_doc.constants[i].name) || term == " ") {
|
if (_match_string(term, class_doc.constants[i].name) ||
|
||||||
match.constants.push_back(
|
term == " ") {
|
||||||
const_cast<DocData::ConstantDoc *>(&class_doc.constants[i]));
|
match.constants.push_back(const_cast<DocData::ConstantDoc *>(&class_doc.constants[i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1057,8 +873,7 @@ bool VisualScriptPropertySelector::SearchRunner::_phase_match_classes() {
|
|||||||
term == " " ||
|
term == " " ||
|
||||||
_match_string(term, class_doc.properties[i].getter) ||
|
_match_string(term, class_doc.properties[i].getter) ||
|
||||||
_match_string(term, class_doc.properties[i].setter)) {
|
_match_string(term, class_doc.properties[i].setter)) {
|
||||||
match.properties.push_back(
|
match.properties.push_back(const_cast<DocData::PropertyDoc *>(&class_doc.properties[i]));
|
||||||
const_cast<DocData::PropertyDoc *>(&class_doc.properties[i]));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1066,9 +881,7 @@ bool VisualScriptPropertySelector::SearchRunner::_phase_match_classes() {
|
|||||||
for (int i = 0; i < class_doc.theme_properties.size(); i++) {
|
for (int i = 0; i < class_doc.theme_properties.size(); i++) {
|
||||||
if (_match_string(term, class_doc.theme_properties[i].name) ||
|
if (_match_string(term, class_doc.theme_properties[i].name) ||
|
||||||
term == " ") {
|
term == " ") {
|
||||||
match.theme_properties.push_back(
|
match.theme_properties.push_back(const_cast<DocData::ThemeItemDoc *>(&class_doc.theme_properties[i]));
|
||||||
const_cast<DocData::ThemeItemDoc *>(
|
|
||||||
&class_doc.theme_properties[i]));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1123,9 +936,7 @@ bool VisualScriptPropertySelector::SearchRunner::_phase_member_items() {
|
|||||||
|
|
||||||
ClassMatch &match = iterator_match->value;
|
ClassMatch &match = iterator_match->value;
|
||||||
|
|
||||||
TreeItem *parent = (search_flags & SEARCH_SHOW_HIERARCHY)
|
TreeItem *parent = (search_flags & SEARCH_SHOW_HIERARCHY) ? class_items[match.doc->name] : root_item;
|
||||||
? class_items[match.doc->name]
|
|
||||||
: root_item;
|
|
||||||
bool constructor_created = false;
|
bool constructor_created = false;
|
||||||
for (int i = 0; i < match.methods.size(); i++) {
|
for (int i = 0; i < match.methods.size(); i++) {
|
||||||
String text = match.methods[i]->name;
|
String text = match.methods[i]->name;
|
||||||
@@ -1165,8 +976,7 @@ bool VisualScriptPropertySelector::SearchRunner::_phase_select_match() {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VisualScriptPropertySelector::SearchRunner::_match_string(
|
bool VisualScriptPropertySelector::SearchRunner::_match_string(const String &p_term, const String &p_string) const {
|
||||||
const String &p_term, const String &p_string) const {
|
|
||||||
if (search_flags & SEARCH_CASE_SENSITIVE) {
|
if (search_flags & SEARCH_CASE_SENSITIVE) {
|
||||||
return p_string.find(p_term) > -1;
|
return p_string.find(p_term) > -1;
|
||||||
} else {
|
} else {
|
||||||
@@ -1189,16 +999,13 @@ bool VisualScriptPropertySelector::SearchRunner::_match_is_hidden(
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VisualScriptPropertySelector::SearchRunner::_match_item(
|
void VisualScriptPropertySelector::SearchRunner::_match_item(TreeItem *p_item, const String &p_text) {
|
||||||
TreeItem *p_item, const String &p_text) {
|
|
||||||
float inverse_length = 1.f / float(p_text.length());
|
float inverse_length = 1.f / float(p_text.length());
|
||||||
|
|
||||||
// Favor types where search term is a substring close to the start of the
|
// Favor types where search term is a substring close to the start of the type.
|
||||||
// type.
|
|
||||||
float w = 0.5f;
|
float w = 0.5f;
|
||||||
int pos = p_text.findn(term);
|
int pos = p_text.findn(term);
|
||||||
float score = (pos > -1) ? 1.0f - w * MIN(1, 3 * pos * inverse_length)
|
float score = (pos > -1) ? 1.0f - w * MIN(1, 3 * pos * inverse_length) : MAX(0.f, .9f - w);
|
||||||
: MAX(0.f, .9f - w);
|
|
||||||
|
|
||||||
// Favor shorter items: they resemble the search term more.
|
// Favor shorter items: they resemble the search term more.
|
||||||
w = 0.1f;
|
w = 0.1f;
|
||||||
@@ -1219,14 +1026,12 @@ void VisualScriptPropertySelector::SearchRunner::_add_class_doc(
|
|||||||
combined_docs.insert(class_doc.name, class_doc);
|
combined_docs.insert(class_doc.name, class_doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
DocData::MethodDoc VisualScriptPropertySelector::SearchRunner::_get_method_doc(
|
DocData::MethodDoc VisualScriptPropertySelector::SearchRunner::_get_method_doc(MethodInfo method_info) {
|
||||||
MethodInfo method_info) {
|
|
||||||
DocData::MethodDoc method_doc = DocData::MethodDoc();
|
DocData::MethodDoc method_doc = DocData::MethodDoc();
|
||||||
method_doc.name = method_info.name;
|
method_doc.name = method_info.name;
|
||||||
method_doc.return_type = Variant::get_type_name(method_info.return_val.type);
|
method_doc.return_type = Variant::get_type_name(method_info.return_val.type);
|
||||||
method_doc.description = "No description available";
|
method_doc.description = "No description available";
|
||||||
for (List<PropertyInfo>::Element *P = method_info.arguments.front(); P;
|
for (List<PropertyInfo>::Element *P = method_info.arguments.front(); P; P = P->next()) {
|
||||||
P = P->next()) {
|
|
||||||
DocData::ArgumentDoc argument_doc = DocData::ArgumentDoc();
|
DocData::ArgumentDoc argument_doc = DocData::ArgumentDoc();
|
||||||
argument_doc.name = P->get().name;
|
argument_doc.name = P->get().name;
|
||||||
argument_doc.type = Variant::get_type_name(P->get().type);
|
argument_doc.type = Variant::get_type_name(P->get().type);
|
||||||
@@ -1235,8 +1040,7 @@ DocData::MethodDoc VisualScriptPropertySelector::SearchRunner::_get_method_doc(
|
|||||||
return method_doc;
|
return method_doc;
|
||||||
}
|
}
|
||||||
|
|
||||||
TreeItem *VisualScriptPropertySelector::SearchRunner::_create_class_hierarchy(
|
TreeItem *VisualScriptPropertySelector::SearchRunner::_create_class_hierarchy(const ClassMatch &p_match) {
|
||||||
const ClassMatch &p_match) {
|
|
||||||
if (class_items.has(p_match.doc->name)) {
|
if (class_items.has(p_match.doc->name)) {
|
||||||
return class_items[p_match.doc->name];
|
return class_items[p_match.doc->name];
|
||||||
}
|
}
|
||||||
@@ -1296,11 +1100,8 @@ TreeItem *VisualScriptPropertySelector::SearchRunner::_create_class_item(
|
|||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
TreeItem *VisualScriptPropertySelector::SearchRunner::_create_method_item(
|
TreeItem *VisualScriptPropertySelector::SearchRunner::_create_method_item(TreeItem *p_parent, const DocData::ClassDoc *p_class_doc, const String &p_text, const DocData::MethodDoc *p_doc) {
|
||||||
TreeItem *p_parent, const DocData::ClassDoc *p_class_doc,
|
String tooltip = p_doc->return_type + " " + p_class_doc->name + "." + p_doc->name + "(";
|
||||||
const String &p_text, const DocData::MethodDoc *p_doc) {
|
|
||||||
String tooltip =
|
|
||||||
p_doc->return_type + " " + p_class_doc->name + "." + p_doc->name + "(";
|
|
||||||
for (int i = 0; i < p_doc->arguments.size(); i++) {
|
for (int i = 0; i < p_doc->arguments.size(); i++) {
|
||||||
const DocData::ArgumentDoc &arg = p_doc->arguments[i];
|
const DocData::ArgumentDoc &arg = p_doc->arguments[i];
|
||||||
tooltip += arg.type + " " + arg.name;
|
tooltip += arg.type + " " + arg.name;
|
||||||
@@ -1312,16 +1113,11 @@ TreeItem *VisualScriptPropertySelector::SearchRunner::_create_method_item(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
tooltip += ")";
|
tooltip += ")";
|
||||||
return _create_member_item(p_parent, p_class_doc->name, "MemberMethod",
|
return _create_member_item(p_parent, p_class_doc->name, "MemberMethod", p_doc->name, p_text, TTRC("Method"), "method", tooltip, p_doc->description);
|
||||||
p_doc->name, p_text, TTRC("Method"), "method",
|
|
||||||
tooltip, p_doc->description);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TreeItem *VisualScriptPropertySelector::SearchRunner::_create_signal_item(
|
TreeItem *VisualScriptPropertySelector::SearchRunner::_create_signal_item(TreeItem *p_parent, const DocData::ClassDoc *p_class_doc, const DocData::MethodDoc *p_doc) {
|
||||||
TreeItem *p_parent, const DocData::ClassDoc *p_class_doc,
|
String tooltip = p_doc->return_type + " " + p_class_doc->name + "." + p_doc->name + "(";
|
||||||
const DocData::MethodDoc *p_doc) {
|
|
||||||
String tooltip =
|
|
||||||
p_doc->return_type + " " + p_class_doc->name + "." + p_doc->name + "(";
|
|
||||||
for (int i = 0; i < p_doc->arguments.size(); i++) {
|
for (int i = 0; i < p_doc->arguments.size(); i++) {
|
||||||
const DocData::ArgumentDoc &arg = p_doc->arguments[i];
|
const DocData::ArgumentDoc &arg = p_doc->arguments[i];
|
||||||
tooltip += arg.type + " " + arg.name;
|
tooltip += arg.type + " " + arg.name;
|
||||||
@@ -1333,47 +1129,27 @@ TreeItem *VisualScriptPropertySelector::SearchRunner::_create_signal_item(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
tooltip += ")";
|
tooltip += ")";
|
||||||
return _create_member_item(p_parent, p_class_doc->name, "MemberSignal",
|
return _create_member_item(p_parent, p_class_doc->name, "MemberSignal", p_doc->name, p_doc->name, TTRC("Signal"), "signal", tooltip, p_doc->description);
|
||||||
p_doc->name, p_doc->name, TTRC("Signal"), "signal",
|
|
||||||
tooltip, p_doc->description);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TreeItem *VisualScriptPropertySelector::SearchRunner::_create_constant_item(
|
TreeItem *VisualScriptPropertySelector::SearchRunner::_create_constant_item(TreeItem *p_parent, const DocData::ClassDoc *p_class_doc, const DocData::ConstantDoc *p_doc) {
|
||||||
TreeItem *p_parent, const DocData::ClassDoc *p_class_doc,
|
|
||||||
const DocData::ConstantDoc *p_doc) {
|
|
||||||
String tooltip = p_class_doc->name + "." + p_doc->name;
|
String tooltip = p_class_doc->name + "." + p_doc->name;
|
||||||
return _create_member_item(p_parent, p_class_doc->name, "MemberConstant",
|
return _create_member_item(p_parent, p_class_doc->name, "MemberConstant", p_doc->name, p_doc->name, TTRC("Constant"), "constant", tooltip, p_doc->description);
|
||||||
p_doc->name, p_doc->name, TTRC("Constant"),
|
|
||||||
"constant", tooltip, p_doc->description);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TreeItem *VisualScriptPropertySelector::SearchRunner::_create_property_item(
|
TreeItem *VisualScriptPropertySelector::SearchRunner::_create_property_item(TreeItem *p_parent, const DocData::ClassDoc *p_class_doc, const DocData::PropertyDoc *p_doc) {
|
||||||
TreeItem *p_parent, const DocData::ClassDoc *p_class_doc,
|
|
||||||
const DocData::PropertyDoc *p_doc) {
|
|
||||||
String tooltip = p_doc->type + " " + p_class_doc->name + "." + p_doc->name;
|
String tooltip = p_doc->type + " " + p_class_doc->name + "." + p_doc->name;
|
||||||
tooltip +=
|
tooltip += "\n " + p_class_doc->name + "." + p_doc->setter + "(value) setter";
|
||||||
"\n " + p_class_doc->name + "." + p_doc->setter + "(value) setter";
|
|
||||||
tooltip += "\n " + p_class_doc->name + "." + p_doc->getter + "() getter";
|
tooltip += "\n " + p_class_doc->name + "." + p_doc->getter + "() getter";
|
||||||
return _create_member_item(p_parent, p_class_doc->name, "MemberProperty",
|
return _create_member_item(p_parent, p_class_doc->name, "MemberProperty", p_doc->name, p_doc->name, TTRC("Property"), "property", tooltip, p_doc->description);
|
||||||
p_doc->name, p_doc->name, TTRC("Property"),
|
|
||||||
"property", tooltip, p_doc->description);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TreeItem *
|
TreeItem *VisualScriptPropertySelector::SearchRunner::_create_theme_property_item(TreeItem *p_parent, const DocData::ClassDoc *p_class_doc, const DocData::ThemeItemDoc *p_doc) {
|
||||||
VisualScriptPropertySelector::SearchRunner::_create_theme_property_item(
|
|
||||||
TreeItem *p_parent, const DocData::ClassDoc *p_class_doc,
|
|
||||||
const DocData::ThemeItemDoc *p_doc) {
|
|
||||||
String tooltip = p_doc->type + " " + p_class_doc->name + "." + p_doc->name;
|
String tooltip = p_doc->type + " " + p_class_doc->name + "." + p_doc->name;
|
||||||
return _create_member_item(p_parent, p_class_doc->name, "MemberTheme",
|
return _create_member_item(p_parent, p_class_doc->name, "MemberTheme", p_doc->name, p_doc->name, TTRC("Theme Property"), "theme_item", tooltip, p_doc->description);
|
||||||
p_doc->name, p_doc->name, TTRC("Theme Property"),
|
|
||||||
"theme_item", tooltip, p_doc->description);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TreeItem *VisualScriptPropertySelector::SearchRunner::_create_member_item(
|
TreeItem *VisualScriptPropertySelector::SearchRunner::_create_member_item(TreeItem *p_parent, const String &p_class_name, const String &p_icon, const String &p_name, const String &p_text, const String &p_type, const String &p_metatype, const String &p_tooltip, const String &p_description) {
|
||||||
TreeItem *p_parent, const String &p_class_name, const String &p_icon,
|
|
||||||
const String &p_name, const String &p_text, const String &p_type,
|
|
||||||
const String &p_metatype, const String &p_tooltip,
|
|
||||||
const String &p_description) {
|
|
||||||
Ref<Texture2D> icon;
|
Ref<Texture2D> icon;
|
||||||
String text;
|
String text;
|
||||||
if (search_flags & SEARCH_SHOW_HIERARCHY) {
|
if (search_flags & SEARCH_SHOW_HIERARCHY) {
|
||||||
@@ -1410,6 +1186,11 @@ bool VisualScriptPropertySelector::SearchRunner::work(uint64_t slot) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
VisualScriptPropertySelector::SearchRunner::SearchRunner(
|
VisualScriptPropertySelector::SearchRunner::SearchRunner(VisualScriptPropertySelector *p_selector_ui, Tree *p_results_tree) :
|
||||||
VisualScriptPropertySelector *p_selector_ui, Tree *p_results_tree) :
|
selector_ui(p_selector_ui),
|
||||||
selector_ui(p_selector_ui), ui_service(p_selector_ui->vbox), results_tree(p_results_tree), term(p_selector_ui->search_box->get_text()), empty_icon(ui_service->get_theme_icon(SNAME("ArrowRight"), SNAME("EditorIcons"))), disabled_color(ui_service->get_theme_color(SNAME("disabled_font_color"), SNAME("Editor"))) {}
|
ui_service(p_selector_ui->vbox),
|
||||||
|
results_tree(p_results_tree),
|
||||||
|
term(p_selector_ui->search_box->get_text()),
|
||||||
|
empty_icon(ui_service->get_theme_icon(SNAME("ArrowRight"), SNAME("EditorIcons"))),
|
||||||
|
disabled_color(ui_service->get_theme_color(SNAME("disabled_font_color"), SNAME("Editor"))) {
|
||||||
|
}
|
||||||
|
|||||||
@@ -129,30 +129,29 @@ protected:
|
|||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void select_from_visual_script(
|
void select_method_from_base_type(const String &p_base,
|
||||||
const Ref<Script> &p_script);
|
const bool p_virtuals_only = false,
|
||||||
|
const bool p_connecting = true,
|
||||||
|
bool clear_text = true);
|
||||||
|
void select_from_base_type(const String &p_base,
|
||||||
|
const String &p_base_script = "",
|
||||||
|
bool p_virtuals_only = false,
|
||||||
|
const bool p_connecting = true,
|
||||||
|
bool clear_text = true);
|
||||||
|
void select_from_script(const Ref<Script> &p_script,
|
||||||
|
const bool p_connecting = true,
|
||||||
|
bool clear_text = true);
|
||||||
|
void select_from_basic_type(Variant::Type p_type,
|
||||||
|
const bool p_connecting = true,
|
||||||
|
bool clear_text = true);
|
||||||
|
void select_from_instance(Object *p_instance, const bool p_connecting = true,
|
||||||
|
bool clear_text = true);
|
||||||
|
void select_from_visual_script(const Ref<Script> &p_script,
|
||||||
|
bool clear_text = true);
|
||||||
|
|
||||||
void select_method_from_base_type(const String &p_base,
|
void show_window(float p_screen_ratio);
|
||||||
const bool p_virtuals_only = false,
|
|
||||||
const bool p_connecting = true,
|
|
||||||
bool clear_text = true);
|
|
||||||
void select_from_base_type(const String &p_base,
|
|
||||||
const String &p_base_script = "",
|
|
||||||
bool p_virtuals_only = false,
|
|
||||||
const bool p_connecting = true,
|
|
||||||
bool clear_text = true);
|
|
||||||
void select_from_script(const Ref<Script> &p_script,
|
|
||||||
const bool p_connecting = true,
|
|
||||||
bool clear_text = true);
|
|
||||||
void select_from_basic_type(Variant::Type p_type,
|
|
||||||
const bool p_connecting = true,
|
|
||||||
bool clear_text = true);
|
|
||||||
void select_from_instance(Object *p_instance, const bool p_connecting = true,
|
|
||||||
bool clear_text = true);
|
|
||||||
|
|
||||||
void show_window(float p_screen_ratio);
|
VisualScriptPropertySelector();
|
||||||
|
|
||||||
VisualScriptPropertySelector();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class VisualScriptPropertySelector::SearchRunner : public RefCounted {
|
class VisualScriptPropertySelector::SearchRunner : public RefCounted {
|
||||||
|
|||||||
@@ -446,6 +446,10 @@ class VisualScriptInstance : public ScriptInstance {
|
|||||||
friend class VisualScriptFunctionState; // For yield.
|
friend class VisualScriptFunctionState; // For yield.
|
||||||
friend class VisualScriptLanguage; // For debugger.
|
friend class VisualScriptLanguage; // For debugger.
|
||||||
public:
|
public:
|
||||||
|
virtual void validate_property(PropertyInfo &p_property) const {
|
||||||
|
}
|
||||||
|
virtual void notification(int p_notification, bool p_reversed = false) {
|
||||||
|
}
|
||||||
virtual bool set(const StringName &p_name, const Variant &p_value);
|
virtual bool set(const StringName &p_name, const Variant &p_value);
|
||||||
virtual bool get(const StringName &p_name, Variant &r_ret) const;
|
virtual bool get(const StringName &p_name, Variant &r_ret) const;
|
||||||
virtual void get_property_list(List<PropertyInfo> *p_properties) const;
|
virtual void get_property_list(List<PropertyInfo> *p_properties) const;
|
||||||
@@ -466,7 +470,6 @@ public:
|
|||||||
int p_argcount, Callable::CallError &r_error);
|
int p_argcount, Callable::CallError &r_error);
|
||||||
virtual void notification(int p_notification);
|
virtual void notification(int p_notification);
|
||||||
String to_string(bool *r_valid);
|
String to_string(bool *r_valid);
|
||||||
|
|
||||||
bool set_variable(const StringName &p_variable, const Variant &p_value) {
|
bool set_variable(const StringName &p_variable, const Variant &p_value) {
|
||||||
HashMap<StringName, Variant>::Iterator E = variables.find(p_variable);
|
HashMap<StringName, Variant>::Iterator E = variables.find(p_variable);
|
||||||
if (!E) {
|
if (!E) {
|
||||||
|
|||||||
Reference in New Issue
Block a user