feat: updated engine version to 4.4-rc1
This commit is contained in:
parent
ee00efde1f
commit
21ba8e33af
5459 changed files with 1128836 additions and 198305 deletions
|
|
@ -30,49 +30,38 @@
|
|||
|
||||
#include "property_selector.h"
|
||||
|
||||
#include "core/os/keyboard.h"
|
||||
#include "editor/doc_tools.h"
|
||||
#include "editor/editor_help.h"
|
||||
#include "editor/editor_node.h"
|
||||
#include "editor/themes/editor_scale.h"
|
||||
#include "scene/gui/line_edit.h"
|
||||
#include "scene/gui/rich_text_label.h"
|
||||
#include "scene/gui/tree.h"
|
||||
|
||||
void PropertySelector::_text_changed(const String &p_newtext) {
|
||||
_update_search();
|
||||
}
|
||||
|
||||
void PropertySelector::_sbox_input(const Ref<InputEvent> &p_ie) {
|
||||
Ref<InputEventKey> k = p_ie;
|
||||
void PropertySelector::_sbox_input(const Ref<InputEvent> &p_event) {
|
||||
// Redirect navigational key events to the tree.
|
||||
Ref<InputEventKey> key = p_event;
|
||||
if (key.is_valid()) {
|
||||
if (key->is_action("ui_up", true) || key->is_action("ui_down", true) || key->is_action("ui_page_up") || key->is_action("ui_page_down")) {
|
||||
search_options->gui_input(key);
|
||||
search_box->accept_event();
|
||||
|
||||
if (k.is_valid()) {
|
||||
switch (k->get_keycode()) {
|
||||
case Key::UP:
|
||||
case Key::DOWN:
|
||||
case Key::PAGEUP:
|
||||
case Key::PAGEDOWN: {
|
||||
search_options->gui_input(k);
|
||||
search_box->accept_event();
|
||||
TreeItem *root = search_options->get_root();
|
||||
if (!root->get_first_child()) {
|
||||
return;
|
||||
}
|
||||
|
||||
TreeItem *root = search_options->get_root();
|
||||
if (!root->get_first_child()) {
|
||||
break;
|
||||
}
|
||||
TreeItem *current = search_options->get_selected();
|
||||
|
||||
TreeItem *current = search_options->get_selected();
|
||||
TreeItem *item = search_options->get_next_selected(root);
|
||||
while (item) {
|
||||
item->deselect(0);
|
||||
item = search_options->get_next_selected(item);
|
||||
}
|
||||
|
||||
TreeItem *item = search_options->get_next_selected(root);
|
||||
while (item) {
|
||||
item->deselect(0);
|
||||
item = search_options->get_next_selected(item);
|
||||
}
|
||||
|
||||
current->select(0);
|
||||
|
||||
} break;
|
||||
default:
|
||||
break;
|
||||
current->select(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -123,50 +112,6 @@ void PropertySelector::_update_search() {
|
|||
TreeItem *category = nullptr;
|
||||
|
||||
bool found = false;
|
||||
|
||||
Ref<Texture2D> type_icons[] = {
|
||||
search_options->get_editor_theme_icon(SNAME("Variant")),
|
||||
search_options->get_editor_theme_icon(SNAME("bool")),
|
||||
search_options->get_editor_theme_icon(SNAME("int")),
|
||||
search_options->get_editor_theme_icon(SNAME("float")),
|
||||
search_options->get_editor_theme_icon(SNAME("String")),
|
||||
search_options->get_editor_theme_icon(SNAME("Vector2")),
|
||||
search_options->get_editor_theme_icon(SNAME("Vector2i")),
|
||||
search_options->get_editor_theme_icon(SNAME("Rect2")),
|
||||
search_options->get_editor_theme_icon(SNAME("Rect2i")),
|
||||
search_options->get_editor_theme_icon(SNAME("Vector3")),
|
||||
search_options->get_editor_theme_icon(SNAME("Vector3i")),
|
||||
search_options->get_editor_theme_icon(SNAME("Transform2D")),
|
||||
search_options->get_editor_theme_icon(SNAME("Vector4")),
|
||||
search_options->get_editor_theme_icon(SNAME("Vector4i")),
|
||||
search_options->get_editor_theme_icon(SNAME("Plane")),
|
||||
search_options->get_editor_theme_icon(SNAME("Quaternion")),
|
||||
search_options->get_editor_theme_icon(SNAME("AABB")),
|
||||
search_options->get_editor_theme_icon(SNAME("Basis")),
|
||||
search_options->get_editor_theme_icon(SNAME("Transform3D")),
|
||||
search_options->get_editor_theme_icon(SNAME("Projection")),
|
||||
search_options->get_editor_theme_icon(SNAME("Color")),
|
||||
search_options->get_editor_theme_icon(SNAME("StringName")),
|
||||
search_options->get_editor_theme_icon(SNAME("NodePath")),
|
||||
search_options->get_editor_theme_icon(SNAME("RID")),
|
||||
search_options->get_editor_theme_icon(SNAME("MiniObject")),
|
||||
search_options->get_editor_theme_icon(SNAME("Callable")),
|
||||
search_options->get_editor_theme_icon(SNAME("Signal")),
|
||||
search_options->get_editor_theme_icon(SNAME("Dictionary")),
|
||||
search_options->get_editor_theme_icon(SNAME("Array")),
|
||||
search_options->get_editor_theme_icon(SNAME("PackedByteArray")),
|
||||
search_options->get_editor_theme_icon(SNAME("PackedInt32Array")),
|
||||
search_options->get_editor_theme_icon(SNAME("PackedInt64Array")),
|
||||
search_options->get_editor_theme_icon(SNAME("PackedFloat32Array")),
|
||||
search_options->get_editor_theme_icon(SNAME("PackedFloat64Array")),
|
||||
search_options->get_editor_theme_icon(SNAME("PackedStringArray")),
|
||||
search_options->get_editor_theme_icon(SNAME("PackedVector2Array")),
|
||||
search_options->get_editor_theme_icon(SNAME("PackedVector3Array")),
|
||||
search_options->get_editor_theme_icon(SNAME("PackedColorArray")),
|
||||
search_options->get_editor_theme_icon(SNAME("PackedVector4Array")),
|
||||
};
|
||||
static_assert((sizeof(type_icons) / sizeof(type_icons[0])) == Variant::VARIANT_MAX, "Number of type icons doesn't match the number of Variant types.");
|
||||
|
||||
for (const PropertyInfo &E : props) {
|
||||
if (E.usage == PROPERTY_USAGE_CATEGORY) {
|
||||
if (category && category->get_first_child() == nullptr) {
|
||||
|
|
@ -194,26 +139,38 @@ void PropertySelector::_update_search() {
|
|||
continue;
|
||||
}
|
||||
|
||||
if (type_filter.size() && !type_filter.has(E.type)) {
|
||||
if (!type_filter.is_empty() && !type_filter.has(E.type)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
TreeItem *item = search_options->create_item(category ? category : root);
|
||||
item->set_text(0, E.name);
|
||||
item->set_metadata(0, E.name);
|
||||
item->set_icon(0, type_icons[E.type]);
|
||||
item->set_icon(0, search_options->get_editor_theme_icon(Variant::get_type_name(E.type)));
|
||||
|
||||
if (!found && !search_box->get_text().is_empty() && E.name.containsn(search_text)) {
|
||||
item->select(0);
|
||||
found = true;
|
||||
} else if (!found && search_box->get_text().is_empty() && E.name == selected) {
|
||||
item->select(0);
|
||||
found = true;
|
||||
}
|
||||
|
||||
item->set_selectable(0, true);
|
||||
|
||||
_create_subproperties(item, E.type);
|
||||
item->set_collapsed(true);
|
||||
}
|
||||
|
||||
if (category && category->get_first_child() == nullptr) {
|
||||
memdelete(category); //old category was unused
|
||||
}
|
||||
|
||||
if (found) {
|
||||
// As we call this while adding items, defer until list is completely populated.
|
||||
callable_mp(search_options, &Tree::scroll_to_item).call_deferred(search_options->get_selected(), true);
|
||||
}
|
||||
|
||||
} else {
|
||||
List<MethodInfo> methods;
|
||||
|
||||
|
|
@ -301,7 +258,7 @@ void PropertySelector::_update_search() {
|
|||
TreeItem *item = search_options->create_item(category ? category : root);
|
||||
|
||||
String desc;
|
||||
if (mi.name.contains(":")) {
|
||||
if (mi.name.contains_char(':')) {
|
||||
desc = mi.name.get_slice(":", 1) + " ";
|
||||
mi.name = mi.name.get_slice(":", 0);
|
||||
} else if (mi.return_val.type != Variant::NIL) {
|
||||
|
|
@ -321,7 +278,7 @@ void PropertySelector::_update_search() {
|
|||
|
||||
if (arg_itr->type == Variant::NIL) {
|
||||
desc += ": Variant";
|
||||
} else if (arg_itr->name.contains(":")) {
|
||||
} else if (arg_itr->name.contains_char(':')) {
|
||||
desc += vformat(": %s", arg_itr->name.get_slice(":", 1));
|
||||
arg_itr->name = arg_itr->name.get_slice(":", 0);
|
||||
} else {
|
||||
|
|
@ -346,15 +303,23 @@ void PropertySelector::_update_search() {
|
|||
if (!found && !search_box->get_text().is_empty() && name.containsn(search_text)) {
|
||||
item->select(0);
|
||||
found = true;
|
||||
} else if (!found && search_box->get_text().is_empty() && name == selected) {
|
||||
item->select(0);
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (category && category->get_first_child() == nullptr) {
|
||||
memdelete(category); //old category was unused
|
||||
}
|
||||
|
||||
if (found) {
|
||||
// As we call this while adding items, defer until list is completely populated.
|
||||
callable_mp(search_options, &Tree::scroll_to_item).call_deferred(search_options->get_selected(), true);
|
||||
}
|
||||
}
|
||||
|
||||
get_ok_button()->set_disabled(root->get_first_child() == nullptr);
|
||||
get_ok_button()->set_disabled(search_options->get_selected() == nullptr);
|
||||
}
|
||||
|
||||
void PropertySelector::_confirmed() {
|
||||
|
|
@ -370,6 +335,8 @@ void PropertySelector::_item_selected() {
|
|||
help_bit->set_custom_text(String(), String(), String());
|
||||
|
||||
TreeItem *item = search_options->get_selected();
|
||||
get_ok_button()->set_disabled(item == nullptr);
|
||||
|
||||
if (!item) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -407,6 +374,133 @@ void PropertySelector::_hide_requested() {
|
|||
_cancel_pressed(); // From AcceptDialog.
|
||||
}
|
||||
|
||||
void PropertySelector::_create_subproperties(TreeItem *p_parent_item, Variant::Type p_type) {
|
||||
switch (p_type) {
|
||||
case Variant::VECTOR2: {
|
||||
_create_subproperty(p_parent_item, "x", Variant::FLOAT);
|
||||
_create_subproperty(p_parent_item, "y", Variant::FLOAT);
|
||||
} break;
|
||||
|
||||
case Variant::VECTOR2I: {
|
||||
_create_subproperty(p_parent_item, "x", Variant::INT);
|
||||
_create_subproperty(p_parent_item, "y", Variant::INT);
|
||||
} break;
|
||||
|
||||
case Variant::RECT2: {
|
||||
_create_subproperty(p_parent_item, "position", Variant::VECTOR2);
|
||||
_create_subproperty(p_parent_item, "size", Variant::VECTOR2);
|
||||
_create_subproperty(p_parent_item, "end", Variant::VECTOR2);
|
||||
} break;
|
||||
|
||||
case Variant::RECT2I: {
|
||||
_create_subproperty(p_parent_item, "position", Variant::VECTOR2I);
|
||||
_create_subproperty(p_parent_item, "size", Variant::VECTOR2I);
|
||||
_create_subproperty(p_parent_item, "end", Variant::VECTOR2I);
|
||||
} break;
|
||||
|
||||
case Variant::VECTOR3: {
|
||||
_create_subproperty(p_parent_item, "x", Variant::FLOAT);
|
||||
_create_subproperty(p_parent_item, "y", Variant::FLOAT);
|
||||
_create_subproperty(p_parent_item, "z", Variant::FLOAT);
|
||||
} break;
|
||||
|
||||
case Variant::VECTOR3I: {
|
||||
_create_subproperty(p_parent_item, "x", Variant::INT);
|
||||
_create_subproperty(p_parent_item, "y", Variant::INT);
|
||||
_create_subproperty(p_parent_item, "z", Variant::INT);
|
||||
} break;
|
||||
|
||||
case Variant::TRANSFORM2D: {
|
||||
_create_subproperty(p_parent_item, "origin", Variant::VECTOR2);
|
||||
_create_subproperty(p_parent_item, "x", Variant::VECTOR2);
|
||||
_create_subproperty(p_parent_item, "y", Variant::VECTOR2);
|
||||
} break;
|
||||
|
||||
case Variant::VECTOR4: {
|
||||
_create_subproperty(p_parent_item, "x", Variant::FLOAT);
|
||||
_create_subproperty(p_parent_item, "y", Variant::FLOAT);
|
||||
_create_subproperty(p_parent_item, "z", Variant::FLOAT);
|
||||
_create_subproperty(p_parent_item, "w", Variant::FLOAT);
|
||||
} break;
|
||||
|
||||
case Variant::VECTOR4I: {
|
||||
_create_subproperty(p_parent_item, "x", Variant::INT);
|
||||
_create_subproperty(p_parent_item, "y", Variant::INT);
|
||||
_create_subproperty(p_parent_item, "z", Variant::INT);
|
||||
_create_subproperty(p_parent_item, "w", Variant::INT);
|
||||
} break;
|
||||
|
||||
case Variant::PLANE: {
|
||||
_create_subproperty(p_parent_item, "x", Variant::FLOAT);
|
||||
_create_subproperty(p_parent_item, "y", Variant::FLOAT);
|
||||
_create_subproperty(p_parent_item, "z", Variant::FLOAT);
|
||||
_create_subproperty(p_parent_item, "normal", Variant::VECTOR3);
|
||||
_create_subproperty(p_parent_item, "d", Variant::FLOAT);
|
||||
} break;
|
||||
|
||||
case Variant::QUATERNION: {
|
||||
_create_subproperty(p_parent_item, "x", Variant::FLOAT);
|
||||
_create_subproperty(p_parent_item, "y", Variant::FLOAT);
|
||||
_create_subproperty(p_parent_item, "z", Variant::FLOAT);
|
||||
_create_subproperty(p_parent_item, "w", Variant::FLOAT);
|
||||
} break;
|
||||
|
||||
case Variant::AABB: {
|
||||
_create_subproperty(p_parent_item, "position", Variant::VECTOR3);
|
||||
_create_subproperty(p_parent_item, "size", Variant::VECTOR3);
|
||||
_create_subproperty(p_parent_item, "end", Variant::VECTOR3);
|
||||
} break;
|
||||
|
||||
case Variant::BASIS: {
|
||||
_create_subproperty(p_parent_item, "x", Variant::VECTOR3);
|
||||
_create_subproperty(p_parent_item, "y", Variant::VECTOR3);
|
||||
_create_subproperty(p_parent_item, "z", Variant::VECTOR3);
|
||||
} break;
|
||||
|
||||
case Variant::TRANSFORM3D: {
|
||||
_create_subproperty(p_parent_item, "basis", Variant::BASIS);
|
||||
_create_subproperty(p_parent_item, "origin", Variant::VECTOR3);
|
||||
} break;
|
||||
|
||||
case Variant::PROJECTION: {
|
||||
_create_subproperty(p_parent_item, "x", Variant::VECTOR4);
|
||||
_create_subproperty(p_parent_item, "y", Variant::VECTOR4);
|
||||
_create_subproperty(p_parent_item, "z", Variant::VECTOR4);
|
||||
_create_subproperty(p_parent_item, "w", Variant::VECTOR4);
|
||||
} break;
|
||||
|
||||
case Variant::COLOR: {
|
||||
_create_subproperty(p_parent_item, "r", Variant::FLOAT);
|
||||
_create_subproperty(p_parent_item, "g", Variant::FLOAT);
|
||||
_create_subproperty(p_parent_item, "b", Variant::FLOAT);
|
||||
_create_subproperty(p_parent_item, "a", Variant::FLOAT);
|
||||
_create_subproperty(p_parent_item, "r8", Variant::INT);
|
||||
_create_subproperty(p_parent_item, "g8", Variant::INT);
|
||||
_create_subproperty(p_parent_item, "b8", Variant::INT);
|
||||
_create_subproperty(p_parent_item, "a8", Variant::INT);
|
||||
_create_subproperty(p_parent_item, "h", Variant::FLOAT);
|
||||
_create_subproperty(p_parent_item, "s", Variant::FLOAT);
|
||||
_create_subproperty(p_parent_item, "v", Variant::FLOAT);
|
||||
} break;
|
||||
|
||||
default: {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PropertySelector::_create_subproperty(TreeItem *p_parent_item, const String &p_name, Variant::Type p_type) {
|
||||
if (!type_filter.is_empty() && !type_filter.has(p_type)) {
|
||||
return;
|
||||
}
|
||||
|
||||
TreeItem *item = search_options->create_item(p_parent_item);
|
||||
item->set_text(0, p_name);
|
||||
item->set_metadata(0, String(p_parent_item->get_metadata(0)) + ":" + p_name);
|
||||
item->set_icon(0, search_options->get_editor_theme_icon(Variant::get_type_name(p_type)));
|
||||
|
||||
_create_subproperties(item, p_type);
|
||||
}
|
||||
|
||||
void PropertySelector::_notification(int p_what) {
|
||||
switch (p_what) {
|
||||
case NOTIFICATION_ENTER_TREE: {
|
||||
|
|
@ -576,7 +670,6 @@ PropertySelector::PropertySelector() {
|
|||
search_options->connect("item_activated", callable_mp(this, &PropertySelector::_confirmed));
|
||||
search_options->connect("cell_selected", callable_mp(this, &PropertySelector::_item_selected));
|
||||
search_options->set_hide_root(true);
|
||||
search_options->set_hide_folding(true);
|
||||
|
||||
help_bit = memnew(EditorHelpBit);
|
||||
help_bit->set_content_height_limits(80 * EDSCALE, 80 * EDSCALE);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue