feat: modules moved and engine moved to submodule
This commit is contained in:
parent
dfb5e645cd
commit
c33d2130cc
5136 changed files with 225275 additions and 64485 deletions
|
|
@ -81,7 +81,7 @@ public:
|
|||
String name = p_name;
|
||||
|
||||
if (name.begins_with("bind/argument_")) {
|
||||
int which = name.get_slice("_", 1).to_int() - 1;
|
||||
int which = name.get_slicec('_', 1).to_int() - 1;
|
||||
ERR_FAIL_INDEX_V(which, params.size(), false);
|
||||
params.write[which] = p_value;
|
||||
} else {
|
||||
|
|
@ -95,7 +95,7 @@ public:
|
|||
String name = p_name;
|
||||
|
||||
if (name.begins_with("bind/argument_")) {
|
||||
int which = name.get_slice("_", 1).to_int() - 1;
|
||||
int which = name.get_slicec('_', 1).to_int() - 1;
|
||||
ERR_FAIL_INDEX_V(which, params.size(), false);
|
||||
r_ret = params[which];
|
||||
} else {
|
||||
|
|
@ -224,7 +224,7 @@ void ConnectDialog::_remove_bind() {
|
|||
if (st.is_empty()) {
|
||||
return;
|
||||
}
|
||||
int idx = st.get_slice("/", 1).to_int() - 1;
|
||||
int idx = st.get_slicec('/', 1).to_int() - 1;
|
||||
|
||||
ERR_FAIL_INDEX(idx, cdbinds->params.size());
|
||||
cdbinds->params.remove_at(idx);
|
||||
|
|
@ -255,10 +255,12 @@ StringName ConnectDialog::generate_method_callback_name(Node *p_source, const St
|
|||
subst["NodeName"] = node_name.to_pascal_case();
|
||||
subst["nodeName"] = node_name.to_camel_case();
|
||||
subst["node_name"] = node_name.to_snake_case();
|
||||
subst["node-name"] = node_name.to_kebab_case();
|
||||
|
||||
subst["SignalName"] = p_signal_name.to_pascal_case();
|
||||
subst["signalName"] = p_signal_name.to_camel_case();
|
||||
subst["signal_name"] = p_signal_name.to_snake_case();
|
||||
subst["signal-name"] = p_signal_name.to_kebab_case();
|
||||
|
||||
String dst_method;
|
||||
if (p_source == p_target) {
|
||||
|
|
@ -282,10 +284,11 @@ List<MethodInfo> ConnectDialog::_filter_method_list(const List<MethodInfo> &p_me
|
|||
bool check_signal = compatible_methods_only->is_pressed();
|
||||
List<MethodInfo> ret;
|
||||
|
||||
List<Pair<Variant::Type, StringName>> effective_args;
|
||||
LocalVector<Pair<Variant::Type, StringName>> effective_args;
|
||||
int unbind = get_unbinds();
|
||||
for (int i = 0; i < p_signal.arguments.size() - unbind; i++) {
|
||||
PropertyInfo pi = p_signal.arguments.get(i);
|
||||
effective_args.reserve(p_signal.arguments.size() - unbind);
|
||||
for (int64_t i = 0; i < p_signal.arguments.size() - unbind; i++) {
|
||||
PropertyInfo pi = p_signal.arguments[i];
|
||||
effective_args.push_back(Pair(pi.type, pi.class_name));
|
||||
}
|
||||
if (unbind == 0) {
|
||||
|
|
@ -312,17 +315,16 @@ List<MethodInfo> ConnectDialog::_filter_method_list(const List<MethodInfo> &p_me
|
|||
}
|
||||
|
||||
bool type_mismatch = false;
|
||||
const List<Pair<Variant::Type, StringName>>::Element *E = effective_args.front();
|
||||
for (const List<PropertyInfo>::Element *F = mi.arguments.front(); F; F = F->next(), E = E->next()) {
|
||||
Variant::Type stype = E->get().first;
|
||||
Variant::Type mtype = F->get().type;
|
||||
for (int64_t i = 0; i < mi.arguments.size(); ++i) {
|
||||
Variant::Type stype = effective_args[i].first;
|
||||
Variant::Type mtype = mi.arguments[i].type;
|
||||
|
||||
if (stype != Variant::NIL && mtype != Variant::NIL && stype != mtype) {
|
||||
type_mismatch = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (stype == Variant::OBJECT && mtype == Variant::OBJECT && !ClassDB::is_parent_class(E->get().second, F->get().class_name)) {
|
||||
if (stype == Variant::OBJECT && mtype == Variant::OBJECT && !ClassDB::is_parent_class(effective_args[i].second, mi.arguments[i].class_name)) {
|
||||
type_mismatch = true;
|
||||
break;
|
||||
}
|
||||
|
|
@ -453,7 +455,13 @@ void ConnectDialog::_update_ok_enabled() {
|
|||
}
|
||||
|
||||
void ConnectDialog::_update_warning_label() {
|
||||
Ref<Script> scr = source->get_node(dst_path)->get_script();
|
||||
Node *dst = source->get_node(dst_path);
|
||||
if (dst == nullptr) {
|
||||
warning_label->set_visible(false);
|
||||
return;
|
||||
}
|
||||
|
||||
Ref<Script> scr = dst->get_script();
|
||||
if (scr.is_null()) {
|
||||
warning_label->set_visible(false);
|
||||
return;
|
||||
|
|
@ -546,13 +554,12 @@ String ConnectDialog::get_signature(const MethodInfo &p_method, PackedStringArra
|
|||
signature.append(p_method.name);
|
||||
signature.append("(");
|
||||
|
||||
int i = 0;
|
||||
for (List<PropertyInfo>::ConstIterator itr = p_method.arguments.begin(); itr != p_method.arguments.end(); ++itr, ++i) {
|
||||
if (itr != p_method.arguments.begin()) {
|
||||
for (int64_t i = 0; i < p_method.arguments.size(); ++i) {
|
||||
if (i > 0) {
|
||||
signature.append(", ");
|
||||
}
|
||||
|
||||
const PropertyInfo &pi = *itr;
|
||||
const PropertyInfo &pi = p_method.arguments[i];
|
||||
String type_name;
|
||||
switch (pi.type) {
|
||||
case Variant::NIL:
|
||||
|
|
@ -575,8 +582,8 @@ String ConnectDialog::get_signature(const MethodInfo &p_method, PackedStringArra
|
|||
case Variant::DICTIONARY:
|
||||
type_name = "Dictionary";
|
||||
if (pi.hint == PROPERTY_HINT_DICTIONARY_TYPE && !pi.hint_string.is_empty()) {
|
||||
String key_hint = pi.hint_string.get_slice(";", 0);
|
||||
String value_hint = pi.hint_string.get_slice(";", 1);
|
||||
String key_hint = pi.hint_string.get_slicec(';', 0);
|
||||
String value_hint = pi.hint_string.get_slicec(';', 1);
|
||||
if (key_hint.is_empty() || key_hint.begins_with("res://")) {
|
||||
key_hint = "Variant";
|
||||
}
|
||||
|
|
@ -731,6 +738,7 @@ ConnectDialog::ConnectDialog() {
|
|||
vbc_left->set_custom_minimum_size(Vector2(400 * EDSCALE, 0));
|
||||
|
||||
from_signal = memnew(LineEdit);
|
||||
from_signal->set_accessibility_name(TTRC("From Signal"));
|
||||
vbc_left->add_margin_child(TTR("From Signal:"), from_signal);
|
||||
from_signal->set_editable(false);
|
||||
|
||||
|
|
@ -749,6 +757,7 @@ ConnectDialog::ConnectDialog() {
|
|||
hbc_filter->add_child(filter_nodes);
|
||||
filter_nodes->set_h_size_flags(Control::SIZE_FILL | Control::SIZE_EXPAND);
|
||||
filter_nodes->set_placeholder(TTR("Filter Nodes"));
|
||||
filter_nodes->set_accessibility_name(TTRC("Filter Nodes"));
|
||||
filter_nodes->set_clear_button_enabled(true);
|
||||
filter_nodes->connect(SceneStringName(text_changed), callable_mp(tree, &SceneTreeEditor::set_filter));
|
||||
|
||||
|
|
@ -781,11 +790,13 @@ ConnectDialog::ConnectDialog() {
|
|||
method_search = memnew(LineEdit);
|
||||
method_vbc->add_child(method_search);
|
||||
method_search->set_placeholder(TTR("Filter Methods"));
|
||||
method_search->set_accessibility_name(TTRC("Filter Methods"));
|
||||
method_search->set_clear_button_enabled(true);
|
||||
method_search->connect(SceneStringName(text_changed), callable_mp(this, &ConnectDialog::_update_method_tree).unbind(1));
|
||||
|
||||
method_tree = memnew(Tree);
|
||||
method_vbc->add_child(method_tree);
|
||||
method_tree->set_accessibility_name(TTRC("Methods"));
|
||||
method_tree->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
|
||||
method_tree->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
method_tree->set_hide_root(true);
|
||||
|
|
@ -819,6 +830,7 @@ ConnectDialog::ConnectDialog() {
|
|||
HBoxContainer *add_bind_hb = memnew(HBoxContainer);
|
||||
|
||||
type_list = memnew(OptionButton);
|
||||
type_list->set_accessibility_name(TTRC("Type"));
|
||||
type_list->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
add_bind_hb->add_child(type_list);
|
||||
for (int i = 0; i < Variant::VARIANT_MAX; i++) {
|
||||
|
|
@ -846,12 +858,14 @@ ConnectDialog::ConnectDialog() {
|
|||
vbc_right->add_margin_child(TTR("Add Extra Call Argument:"), add_bind_hb);
|
||||
|
||||
bind_editor = memnew(EditorInspector);
|
||||
bind_editor->set_accessibility_name(TTRC("Extra Call Arguments"));
|
||||
bind_controls.push_back(bind_editor);
|
||||
|
||||
vbc_right->add_margin_child(TTR("Extra Call Arguments:"), bind_editor, true);
|
||||
|
||||
unbind_count = memnew(SpinBox);
|
||||
unbind_count->set_tooltip_text(TTR("Allows to drop arguments sent by signal emitter."));
|
||||
unbind_count->set_accessibility_name(TTRC("Unbind Signal Arguments"));
|
||||
unbind_count->connect(SceneStringName(value_changed), callable_mp(this, &ConnectDialog::_unbind_count_changed));
|
||||
|
||||
vbc_right->add_margin_child(TTR("Unbind Signal Arguments:"), unbind_count);
|
||||
|
|
@ -860,14 +874,14 @@ ConnectDialog::ConnectDialog() {
|
|||
vbc_left->add_margin_child(TTR("Receiver Method:"), hbc_method);
|
||||
|
||||
dst_method = memnew(LineEdit);
|
||||
dst_method->set_accessibility_name(TTRC("Receiver Method"));
|
||||
dst_method->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
dst_method->connect(SceneStringName(text_changed), callable_mp(method_tree, &Tree::deselect_all).unbind(1));
|
||||
hbc_method->add_child(dst_method);
|
||||
register_text_enter(dst_method);
|
||||
|
||||
open_method_tree = memnew(Button);
|
||||
open_method_tree = memnew(Button(TTRC("Pick")));
|
||||
hbc_method->add_child(open_method_tree);
|
||||
open_method_tree->set_text("Pick");
|
||||
open_method_tree->connect(SceneStringName(pressed), callable_mp(this, &ConnectDialog::_open_method_popup));
|
||||
|
||||
advanced = memnew(CheckButton(TTR("Advanced")));
|
||||
|
|
@ -1287,11 +1301,14 @@ void ConnectionsDock::_slot_menu_about_to_popup() {
|
|||
}
|
||||
|
||||
void ConnectionsDock::_tree_gui_input(const Ref<InputEvent> &p_event) {
|
||||
TreeItem *item = nullptr;
|
||||
Point2 item_pos;
|
||||
|
||||
const Ref<InputEventKey> &key = p_event;
|
||||
|
||||
if (key.is_valid() && key->is_pressed() && !key->is_echo()) {
|
||||
if (ED_IS_SHORTCUT("connections_editor/disconnect", p_event)) {
|
||||
TreeItem *item = tree->get_selected();
|
||||
item = tree->get_selected();
|
||||
if (item && _get_item_type(*item) == TREE_ITEM_TYPE_CONNECTION) {
|
||||
Connection connection = item->get_metadata(0);
|
||||
_disconnect(connection);
|
||||
|
|
@ -1309,22 +1326,32 @@ void ConnectionsDock::_tree_gui_input(const Ref<InputEvent> &p_event) {
|
|||
return;
|
||||
}
|
||||
}
|
||||
if (key.is_valid() && key->is_pressed() && key->is_action("ui_menu", true)) {
|
||||
item = tree->get_selected();
|
||||
if (!item) {
|
||||
return;
|
||||
}
|
||||
item_pos = tree->get_item_rect(item).position;
|
||||
}
|
||||
|
||||
// Handle RMB press.
|
||||
const Ref<InputEventMouseButton> &mb_event = p_event;
|
||||
|
||||
if (mb_event.is_valid() && mb_event->is_pressed() && mb_event->get_button_index() == MouseButton::RIGHT) {
|
||||
TreeItem *item = tree->get_item_at_position(mb_event->get_position());
|
||||
item = tree->get_item_at_position(mb_event->get_position());
|
||||
if (!item) {
|
||||
return;
|
||||
}
|
||||
item_pos = mb_event->get_position();
|
||||
}
|
||||
|
||||
if (item) {
|
||||
if (item->is_selectable(0)) {
|
||||
// Update selection now, before `about_to_popup` signal. Needed for SIGNAL and CONNECTION context menus.
|
||||
tree->set_selected(item);
|
||||
}
|
||||
|
||||
Vector2 screen_position = tree->get_screen_position() + mb_event->get_position();
|
||||
Vector2 screen_position = tree->get_screen_position() + item_pos;
|
||||
|
||||
switch (_get_item_type(*item)) {
|
||||
case TREE_ITEM_TYPE_ROOT:
|
||||
|
|
@ -1459,8 +1486,8 @@ void ConnectionsDock::update_tree() {
|
|||
List<MethodInfo> base_signals;
|
||||
base->get_script_signal_list(&base_signals);
|
||||
HashSet<String> base_signal_names;
|
||||
for (List<MethodInfo>::Element *F = base_signals.front(); F; F = F->next()) {
|
||||
base_signal_names.insert(F->get().name);
|
||||
for (const MethodInfo &signal : base_signals) {
|
||||
base_signal_names.insert(signal.name);
|
||||
}
|
||||
for (List<MethodInfo>::Element *F = class_signals.front(); F; F = F->next()) {
|
||||
if (base_signal_names.has(F->get().name)) {
|
||||
|
|
@ -1597,11 +1624,13 @@ ConnectionsDock::ConnectionsDock() {
|
|||
search_box = memnew(LineEdit);
|
||||
search_box->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
search_box->set_placeholder(TTR("Filter Signals"));
|
||||
search_box->set_accessibility_name(TTRC("Filter Signals"));
|
||||
search_box->set_clear_button_enabled(true);
|
||||
search_box->connect(SceneStringName(text_changed), callable_mp(this, &ConnectionsDock::_filter_changed));
|
||||
vbc->add_child(search_box);
|
||||
|
||||
tree = memnew(ConnectionsDockTree);
|
||||
tree->set_accessibility_name(TTRC("Connections"));
|
||||
tree->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
|
||||
tree->set_columns(1);
|
||||
tree->set_select_mode(Tree::SELECT_ROW);
|
||||
|
|
@ -1612,6 +1641,7 @@ ConnectionsDock::ConnectionsDock() {
|
|||
tree->set_allow_rmb_select(true);
|
||||
|
||||
connect_button = memnew(Button);
|
||||
connect_button->set_accessibility_name(TTRC("Connect"));
|
||||
HBoxContainer *hb = memnew(HBoxContainer);
|
||||
vbc->add_child(hb);
|
||||
hb->add_spacer();
|
||||
|
|
@ -1658,6 +1688,3 @@ ConnectionsDock::ConnectionsDock() {
|
|||
|
||||
add_theme_constant_override("separation", 3 * EDSCALE);
|
||||
}
|
||||
|
||||
ConnectionsDock::~ConnectionsDock() {
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue