diff options
Diffstat (limited to 'editor/editor_properties.cpp')
-rw-r--r-- | editor/editor_properties.cpp | 237 |
1 files changed, 139 insertions, 98 deletions
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index c134786b89..e154b13eac 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -64,7 +64,11 @@ void EditorPropertyText::_text_changed(const String &p_string) { if (updating) return; - emit_changed(get_edited_property(), p_string, "", true); + if (string_name) { + emit_changed(get_edited_property(), StringName(p_string), "", true); + } else { + emit_changed(get_edited_property(), p_string, "", true); + } } void EditorPropertyText::update_property() { @@ -75,6 +79,9 @@ void EditorPropertyText::update_property() { updating = false; } +void EditorPropertyText::set_string_name(bool p_enabled) { + string_name = p_enabled; +} void EditorPropertyText::set_placeholder(const String &p_string) { text->set_placeholder(p_string); } @@ -89,9 +96,10 @@ EditorPropertyText::EditorPropertyText() { text = memnew(LineEdit); add_child(text); add_focusable(text); - text->connect("text_changed", this, "_text_changed"); - text->connect("text_entered", this, "_text_entered"); + text->connect_compat("text_changed", this, "_text_changed"); + text->connect_compat("text_entered", this, "_text_entered"); + string_name = false; updating = false; } @@ -110,7 +118,7 @@ void EditorPropertyMultilineText::_open_big_text() { if (!big_text_dialog) { big_text = memnew(TextEdit); - big_text->connect("text_changed", this, "_big_text_changed"); + big_text->connect_compat("text_changed", this, "_big_text_changed"); big_text->set_wrap_enabled(true); big_text_dialog = memnew(AcceptDialog); big_text_dialog->add_child(big_text); @@ -135,7 +143,7 @@ void EditorPropertyMultilineText::_notification(int p_what) { switch (p_what) { case NOTIFICATION_THEME_CHANGED: case NOTIFICATION_ENTER_TREE: { - Ref<Texture> df = get_icon("DistractionFree", "EditorIcons"); + Ref<Texture2D> df = get_icon("DistractionFree", "EditorIcons"); open_big_text->set_icon(df); Ref<Font> font = get_font("font", "Label"); text->set_custom_minimum_size(Vector2(0, font->get_height() * 6)); @@ -156,13 +164,13 @@ EditorPropertyMultilineText::EditorPropertyMultilineText() { add_child(hb); set_bottom_editor(hb); text = memnew(TextEdit); - text->connect("text_changed", this, "_text_changed"); + text->connect_compat("text_changed", this, "_text_changed"); text->set_wrap_enabled(true); add_focusable(text); hb->add_child(text); text->set_h_size_flags(SIZE_EXPAND_FILL); open_big_text = memnew(ToolButton); - open_big_text->connect("pressed", this, "_open_big_text"); + open_big_text->connect_compat("pressed", this, "_open_big_text"); hb->add_child(open_big_text); big_text_dialog = NULL; big_text = NULL; @@ -172,7 +180,12 @@ EditorPropertyMultilineText::EditorPropertyMultilineText() { void EditorPropertyTextEnum::_option_selected(int p_which) { - emit_changed(get_edited_property(), options->get_item_text(p_which)); + if (string_name) { + + emit_changed(get_edited_property(), StringName(options->get_item_text(p_which))); + } else { + emit_changed(get_edited_property(), options->get_item_text(p_which)); + } } void EditorPropertyTextEnum::update_property() { @@ -187,10 +200,11 @@ void EditorPropertyTextEnum::update_property() { } } -void EditorPropertyTextEnum::setup(const Vector<String> &p_options) { +void EditorPropertyTextEnum::setup(const Vector<String> &p_options, bool p_string_name) { for (int i = 0; i < p_options.size(); i++) { options->add_item(p_options[i], i); } + string_name = p_string_name; } void EditorPropertyTextEnum::_bind_methods() { @@ -202,10 +216,11 @@ EditorPropertyTextEnum::EditorPropertyTextEnum() { options = memnew(OptionButton); options->set_clip_text(true); options->set_flat(true); + string_name = false; add_child(options); add_focusable(options); - options->connect("item_selected", this, "_option_selected"); + options->connect_compat("item_selected", this, "_option_selected"); } ///////////////////// PATH ///////////////////////// @@ -218,8 +233,8 @@ void EditorPropertyPath::_path_pressed() { if (!dialog) { dialog = memnew(EditorFileDialog); - dialog->connect("file_selected", this, "_path_selected"); - dialog->connect("dir_selected", this, "_path_selected"); + dialog->connect_compat("file_selected", this, "_path_selected"); + dialog->connect_compat("dir_selected", this, "_path_selected"); add_child(dialog); } @@ -293,8 +308,8 @@ EditorPropertyPath::EditorPropertyPath() { add_child(path_hb); path = memnew(LineEdit); path_hb->add_child(path); - path->connect("text_entered", this, "_path_selected"); - path->connect("focus_exited", this, "_path_focus_exited"); + path->connect_compat("text_entered", this, "_path_selected"); + path->connect_compat("focus_exited", this, "_path_focus_exited"); path->set_h_size_flags(SIZE_EXPAND_FILL); path_edit = memnew(Button); @@ -302,7 +317,7 @@ EditorPropertyPath::EditorPropertyPath() { path_hb->add_child(path_edit); add_focusable(path); dialog = NULL; - path_edit->connect("pressed", this, "_path_pressed"); + path_edit->connect_compat("pressed", this, "_path_pressed"); folder = false; global = false; save_mode = false; @@ -346,10 +361,10 @@ EditorPropertyClassName::EditorPropertyClassName() { add_child(property); add_focusable(property); property->set_text(selected_type); - property->connect("pressed", this, "_property_selected"); + property->connect_compat("pressed", this, "_property_selected"); dialog = memnew(CreateDialog); dialog->set_base_type(base_type); - dialog->connect("create", this, "_dialog_created"); + dialog->connect_compat("create", this, "_dialog_created"); add_child(dialog); } @@ -365,7 +380,7 @@ void EditorPropertyMember::_property_select() { if (!selector) { selector = memnew(PropertySelector); - selector->connect("selected", this, "_property_selected"); + selector->connect_compat("selected", this, "_property_selected"); add_child(selector); } @@ -388,13 +403,13 @@ void EditorPropertyMember::_property_select() { } else if (hint == MEMBER_METHOD_OF_INSTANCE) { - Object *instance = ObjectDB::get_instance(hint_text.to_int64()); + Object *instance = ObjectDB::get_instance(ObjectID(hint_text.to_int64())); if (instance) selector->select_method_from_instance(instance, current); } else if (hint == MEMBER_METHOD_OF_SCRIPT) { - Object *obj = ObjectDB::get_instance(hint_text.to_int64()); + Object *obj = ObjectDB::get_instance(ObjectID(hint_text.to_int64())); if (Object::cast_to<Script>(obj)) { selector->select_method_from_script(Object::cast_to<Script>(obj), current); } @@ -420,13 +435,13 @@ void EditorPropertyMember::_property_select() { } else if (hint == MEMBER_PROPERTY_OF_INSTANCE) { - Object *instance = ObjectDB::get_instance(hint_text.to_int64()); + Object *instance = ObjectDB::get_instance(ObjectID(hint_text.to_int64())); if (instance) selector->select_property_from_instance(instance, current); } else if (hint == MEMBER_PROPERTY_OF_SCRIPT) { - Object *obj = ObjectDB::get_instance(hint_text.to_int64()); + Object *obj = ObjectDB::get_instance(ObjectID(hint_text.to_int64())); if (Object::cast_to<Script>(obj)) { selector->select_property_from_script(Object::cast_to<Script>(obj), current); } @@ -455,7 +470,7 @@ EditorPropertyMember::EditorPropertyMember() { property->set_clip_text(true); add_child(property); add_focusable(property); - property->connect("pressed", this, "_property_select"); + property->connect_compat("pressed", this, "_property_select"); } ///////////////////// CHECK ///////////////////////// @@ -480,7 +495,7 @@ EditorPropertyCheck::EditorPropertyCheck() { checkbox->set_text(TTR("On")); add_child(checkbox); add_focusable(checkbox); - checkbox->connect("pressed", this, "_checkbox_pressed"); + checkbox->connect_compat("pressed", this, "_checkbox_pressed"); } ///////////////////// ENUM ///////////////////////// @@ -531,7 +546,7 @@ EditorPropertyEnum::EditorPropertyEnum() { options->set_flat(true); add_child(options); add_focusable(options); - options->connect("item_selected", this, "_option_selected"); + options->connect_compat("item_selected", this, "_option_selected"); } ///////////////////// FLAGS ///////////////////////// @@ -576,7 +591,7 @@ void EditorPropertyFlags::setup(const Vector<String> &p_options) { CheckBox *cb = memnew(CheckBox); cb->set_text(option); cb->set_clip_text(true); - cb->connect("pressed", this, "_flag_toggled"); + cb->connect_compat("pressed", this, "_flag_toggled"); add_focusable(cb); vbox->add_child(cb); flags.push_back(cb); @@ -787,20 +802,20 @@ EditorPropertyLayers::EditorPropertyLayers() { HBoxContainer *hb = memnew(HBoxContainer); add_child(hb); grid = memnew(EditorPropertyLayersGrid); - grid->connect("flag_changed", this, "_grid_changed"); + grid->connect_compat("flag_changed", this, "_grid_changed"); grid->set_h_size_flags(SIZE_EXPAND_FILL); hb->add_child(grid); button = memnew(Button); button->set_toggle_mode(true); button->set_text(".."); - button->connect("pressed", this, "_button_pressed"); + button->connect_compat("pressed", this, "_button_pressed"); hb->add_child(button); set_bottom_editor(hb); layers = memnew(PopupMenu); add_child(layers); layers->set_hide_on_checkable_item_selection(false); - layers->connect("id_pressed", this, "_menu_pressed"); - layers->connect("popup_hide", button, "set_pressed", varray(false)); + layers->connect_compat("id_pressed", this, "_menu_pressed"); + layers->connect_compat("popup_hide", button, "set_pressed", varray(false)); } ///////////////////// INT ///////////////////////// @@ -841,7 +856,7 @@ EditorPropertyInteger::EditorPropertyInteger() { spin->set_flat(true); add_child(spin); add_focusable(spin); - spin->connect("value_changed", this, "_value_changed"); + spin->connect_compat("value_changed", this, "_value_changed"); setting = false; } @@ -858,14 +873,14 @@ void EditorPropertyObjectID::update_property() { type = "Object"; ObjectID id = get_edited_object()->get(get_edited_property()); - if (id != 0) { + if (id.is_valid()) { edit->set_text(type + " ID: " + itos(id)); edit->set_disabled(false); edit->set_icon(EditorNode::get_singleton()->get_class_icon(type)); } else { edit->set_text(TTR("[Empty]")); edit->set_disabled(true); - edit->set_icon(Ref<Texture>()); + edit->set_icon(Ref<Texture2D>()); } } @@ -881,7 +896,7 @@ EditorPropertyObjectID::EditorPropertyObjectID() { edit = memnew(Button); add_child(edit); add_focusable(edit); - edit->connect("pressed", this, "_edit_pressed"); + edit->connect_compat("pressed", this, "_edit_pressed"); } ///////////////////// FLOAT ///////////////////////// @@ -921,7 +936,7 @@ EditorPropertyFloat::EditorPropertyFloat() { spin->set_flat(true); add_child(spin); add_focusable(spin); - spin->connect("value_changed", this, "_value_changed"); + spin->connect_compat("value_changed", this, "_value_changed"); setting = false; } @@ -1019,7 +1034,7 @@ void EditorPropertyEasing::_draw_easing() { prev = h; } - easing_draw->draw_multiline(lines, line_color, 1.0, true); + easing_draw->draw_multiline(lines, line_color, 1.0); f->draw(ci, Point2(10, 10 + f->get_ascent()), String::num(exp, 2), font_color); } @@ -1100,14 +1115,14 @@ void EditorPropertyEasing::_bind_methods() { EditorPropertyEasing::EditorPropertyEasing() { easing_draw = memnew(Control); - easing_draw->connect("draw", this, "_draw_easing"); - easing_draw->connect("gui_input", this, "_drag_easing"); + easing_draw->connect_compat("draw", this, "_draw_easing"); + easing_draw->connect_compat("gui_input", this, "_drag_easing"); easing_draw->set_default_cursor_shape(Control::CURSOR_MOVE); add_child(easing_draw); preset = memnew(PopupMenu); add_child(preset); - preset->connect("id_pressed", this, "_set_preset"); + preset->connect_compat("id_pressed", this, "_set_preset"); spin = memnew(EditorSpinSlider); spin->set_flat(true); @@ -1117,8 +1132,8 @@ EditorPropertyEasing::EditorPropertyEasing() { spin->set_hide_slider(true); spin->set_allow_lesser(true); spin->set_allow_greater(true); - spin->connect("value_changed", this, "_spin_value_changed"); - spin->get_line_edit()->connect("focus_exited", this, "_spin_focus_exited"); + spin->connect_compat("value_changed", this, "_spin_value_changed"); + spin->get_line_edit()->connect_compat("focus_exited", this, "_spin_focus_exited"); spin->hide(); add_child(spin); @@ -1196,7 +1211,7 @@ EditorPropertyVector2::EditorPropertyVector2() { spin[i]->set_label(desc[i]); bc->add_child(spin[i]); add_focusable(spin[i]); - spin[i]->connect("value_changed", this, "_value_changed", varray(desc[i])); + spin[i]->connect_compat("value_changed", this, "_value_changed", varray(desc[i])); if (horizontal) { spin[i]->set_h_size_flags(SIZE_EXPAND_FILL); } @@ -1280,7 +1295,7 @@ EditorPropertyRect2::EditorPropertyRect2() { spin[i]->set_flat(true); bc->add_child(spin[i]); add_focusable(spin[i]); - spin[i]->connect("value_changed", this, "_value_changed", varray(desc[i])); + spin[i]->connect_compat("value_changed", this, "_value_changed", varray(desc[i])); if (horizontal) { spin[i]->set_h_size_flags(SIZE_EXPAND_FILL); } @@ -1361,7 +1376,7 @@ EditorPropertyVector3::EditorPropertyVector3() { spin[i]->set_label(desc[i]); bc->add_child(spin[i]); add_focusable(spin[i]); - spin[i]->connect("value_changed", this, "_value_changed", varray(desc[i])); + spin[i]->connect_compat("value_changed", this, "_value_changed", varray(desc[i])); if (horizontal) { spin[i]->set_h_size_flags(SIZE_EXPAND_FILL); } @@ -1444,7 +1459,7 @@ EditorPropertyPlane::EditorPropertyPlane() { spin[i]->set_label(desc[i]); bc->add_child(spin[i]); add_focusable(spin[i]); - spin[i]->connect("value_changed", this, "_value_changed", varray(desc[i])); + spin[i]->connect_compat("value_changed", this, "_value_changed", varray(desc[i])); if (horizontal) { spin[i]->set_h_size_flags(SIZE_EXPAND_FILL); } @@ -1527,7 +1542,7 @@ EditorPropertyQuat::EditorPropertyQuat() { spin[i]->set_label(desc[i]); bc->add_child(spin[i]); add_focusable(spin[i]); - spin[i]->connect("value_changed", this, "_value_changed", varray(desc[i])); + spin[i]->connect_compat("value_changed", this, "_value_changed", varray(desc[i])); if (horizontal) { spin[i]->set_h_size_flags(SIZE_EXPAND_FILL); } @@ -1609,7 +1624,7 @@ EditorPropertyAABB::EditorPropertyAABB() { g->add_child(spin[i]); spin[i]->set_h_size_flags(SIZE_EXPAND_FILL); add_focusable(spin[i]); - spin[i]->connect("value_changed", this, "_value_changed", varray(desc[i])); + spin[i]->connect_compat("value_changed", this, "_value_changed", varray(desc[i])); } set_bottom_editor(g); setting = false; @@ -1684,7 +1699,7 @@ EditorPropertyTransform2D::EditorPropertyTransform2D() { g->add_child(spin[i]); spin[i]->set_h_size_flags(SIZE_EXPAND_FILL); add_focusable(spin[i]); - spin[i]->connect("value_changed", this, "_value_changed", varray(desc[i])); + spin[i]->connect_compat("value_changed", this, "_value_changed", varray(desc[i])); } set_bottom_editor(g); setting = false; @@ -1765,7 +1780,7 @@ EditorPropertyBasis::EditorPropertyBasis() { g->add_child(spin[i]); spin[i]->set_h_size_flags(SIZE_EXPAND_FILL); add_focusable(spin[i]); - spin[i]->connect("value_changed", this, "_value_changed", varray(desc[i])); + spin[i]->connect_compat("value_changed", this, "_value_changed", varray(desc[i])); } set_bottom_editor(g); setting = false; @@ -1852,7 +1867,7 @@ EditorPropertyTransform::EditorPropertyTransform() { g->add_child(spin[i]); spin[i]->set_h_size_flags(SIZE_EXPAND_FILL); add_focusable(spin[i]); - spin[i]->connect("value_changed", this, "_value_changed", varray(desc[i])); + spin[i]->connect_compat("value_changed", this, "_value_changed", varray(desc[i])); } set_bottom_editor(g); setting = false; @@ -1917,9 +1932,9 @@ EditorPropertyColor::EditorPropertyColor() { picker = memnew(ColorPickerButton); add_child(picker); picker->set_flat(true); - picker->connect("color_changed", this, "_color_changed"); - picker->connect("popup_closed", this, "_popup_closed"); - picker->connect("picker_created", this, "_picker_created"); + picker->connect_compat("color_changed", this, "_color_changed"); + picker->connect_compat("popup_closed", this, "_popup_closed"); + picker->connect_compat("picker_created", this, "_picker_created"); } ////////////// NODE PATH ////////////////////// @@ -1966,7 +1981,7 @@ void EditorPropertyNodePath::_node_assign() { scene_tree->get_scene_tree()->set_show_enabled_subscene(true); scene_tree->get_scene_tree()->set_valid_types(valid_types); add_child(scene_tree); - scene_tree->connect("selected", this, "_node_selected"); + scene_tree->connect_compat("selected", this, "_node_selected"); } scene_tree->popup_centered_ratio(); } @@ -1983,7 +1998,7 @@ void EditorPropertyNodePath::update_property() { assign->set_tooltip(p); if (p == NodePath()) { - assign->set_icon(Ref<Texture>()); + assign->set_icon(Ref<Texture2D>()); assign->set_text(TTR("Assign...")); assign->set_flat(false); return; @@ -2000,7 +2015,7 @@ void EditorPropertyNodePath::update_property() { } if (!base_node || !base_node->has_node(p)) { - assign->set_icon(Ref<Texture>()); + assign->set_icon(Ref<Texture2D>()); assign->set_text(p); return; } @@ -2009,7 +2024,7 @@ void EditorPropertyNodePath::update_property() { ERR_FAIL_COND(!target_node); if (String(target_node->get_name()).find("@") != -1) { - assign->set_icon(Ref<Texture>()); + assign->set_icon(Ref<Texture2D>()); assign->set_text(p); return; } @@ -2028,7 +2043,7 @@ void EditorPropertyNodePath::setup(const NodePath &p_base_hint, Vector<StringNam void EditorPropertyNodePath::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) { - Ref<Texture> t = get_icon("Clear", "EditorIcons"); + Ref<Texture2D> t = get_icon("Clear", "EditorIcons"); clear->set_icon(t); } } @@ -2048,12 +2063,12 @@ EditorPropertyNodePath::EditorPropertyNodePath() { assign->set_flat(true); assign->set_h_size_flags(SIZE_EXPAND_FILL); assign->set_clip_text(true); - assign->connect("pressed", this, "_node_assign"); + assign->connect_compat("pressed", this, "_node_assign"); hbc->add_child(assign); clear = memnew(Button); clear->set_flat(true); - clear->connect("pressed", this, "_node_clear"); + clear->connect_compat("pressed", this, "_node_clear"); hbc->add_child(clear); use_path_from_scene_root = false; @@ -2120,7 +2135,7 @@ void EditorPropertyResource::_menu_option(int p_which) { if (!file) { file = memnew(EditorFileDialog); - file->connect("file_selected", this, "_file_selected"); + file->connect_compat("file_selected", this, "_file_selected"); add_child(file); } file->set_mode(EditorFileDialog::MODE_OPEN_FILE); @@ -2289,7 +2304,7 @@ void EditorPropertyResource::_menu_option(int p_which) { scene_tree->get_scene_tree()->set_valid_types(valid_types); scene_tree->get_scene_tree()->set_show_enabled_subscene(true); add_child(scene_tree); - scene_tree->connect("selected", this, "_viewport_selected"); + scene_tree->connect_compat("selected", this, "_viewport_selected"); scene_tree->set_title(TTR("Pick a Viewport")); } scene_tree->popup_centered_ratio(); @@ -2331,7 +2346,7 @@ void EditorPropertyResource::_menu_option(int p_which) { } } -void EditorPropertyResource::_resource_preview(const String &p_path, const Ref<Texture> &p_preview, const Ref<Texture> &p_small_preview, ObjectID p_obj) { +void EditorPropertyResource::_resource_preview(const String &p_path, const Ref<Texture2D> &p_preview, const Ref<Texture2D> &p_small_preview, ObjectID p_obj) { RES p = get_edited_object()->get(get_edited_property()); if (p.is_valid() && p->get_instance_id() == p_obj) { @@ -2412,7 +2427,7 @@ void EditorPropertyResource::_update_menu_items() { const String &t = F->get(); bool is_custom_resource = false; - Ref<Texture> icon; + Ref<Texture2D> icon; if (!custom_resources.empty()) { for (int j = 0; j < custom_resources.size(); j++) { if (custom_resources[j].name == t) { @@ -2493,7 +2508,7 @@ void EditorPropertyResource::_update_menu_items() { } for (int i = 0; i < conversions.size(); i++) { String what = conversions[i]->converts_to(); - Ref<Texture> icon; + Ref<Texture2D> icon; if (has_icon(what, "EditorIcons")) { icon = get_icon(what, "EditorIcons"); @@ -2607,9 +2622,9 @@ void EditorPropertyResource::update_property() { sub_inspector->set_sub_inspector(true); sub_inspector->set_enable_capitalize_paths(true); - sub_inspector->connect("property_keyed", this, "_sub_inspector_property_keyed"); - sub_inspector->connect("resource_selected", this, "_sub_inspector_resource_selected"); - sub_inspector->connect("object_id_selected", this, "_sub_inspector_object_id_selected"); + sub_inspector->connect_compat("property_keyed", this, "_sub_inspector_property_keyed"); + sub_inspector->connect_compat("resource_selected", this, "_sub_inspector_resource_selected"); + sub_inspector->connect_compat("object_id_selected", this, "_sub_inspector_object_id_selected"); sub_inspector->set_keying(is_keying()); sub_inspector->set_read_only(is_read_only()); sub_inspector->set_use_folding(is_using_folding()); @@ -2659,9 +2674,9 @@ void EditorPropertyResource::update_property() { } } - preview->set_texture(Ref<Texture>()); + preview->set_texture(Ref<Texture2D>()); if (res == RES()) { - assign->set_icon(Ref<Texture>()); + assign->set_icon(Ref<Texture2D>()); assign->set_text(TTR("[empty]")); } else { @@ -2712,7 +2727,7 @@ void EditorPropertyResource::setup(const String &p_base_type) { void EditorPropertyResource::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) { - Ref<Texture> t = get_icon("select_arrow", "Tree"); + Ref<Texture2D> t = get_icon("select_arrow", "Tree"); edit->set_icon(t); } @@ -2892,9 +2907,9 @@ EditorPropertyResource::EditorPropertyResource() { assign->set_flat(true); assign->set_h_size_flags(SIZE_EXPAND_FILL); assign->set_clip_text(true); - assign->connect("pressed", this, "_resource_selected"); + assign->connect_compat("pressed", this, "_resource_selected"); assign->set_drag_forwarding(this); - assign->connect("draw", this, "_button_draw"); + assign->connect_compat("draw", this, "_button_draw"); hbc->add_child(assign); add_focusable(assign); @@ -2905,18 +2920,18 @@ EditorPropertyResource::EditorPropertyResource() { preview->set_margin(MARGIN_BOTTOM, -1); preview->set_margin(MARGIN_RIGHT, -1); assign->add_child(preview); - assign->connect("gui_input", this, "_button_input"); + assign->connect_compat("gui_input", this, "_button_input"); menu = memnew(PopupMenu); add_child(menu); edit = memnew(Button); edit->set_flat(true); edit->set_toggle_mode(true); - menu->connect("id_pressed", this, "_menu_option"); - menu->connect("popup_hide", edit, "set_pressed", varray(false)); - edit->connect("pressed", this, "_update_menu"); + menu->connect_compat("id_pressed", this, "_menu_option"); + menu->connect_compat("popup_hide", edit, "set_pressed", varray(false)); + edit->connect_compat("pressed", this, "_update_menu"); hbc->add_child(edit); - edit->connect("gui_input", this, "_button_input"); + edit->connect_compat("gui_input", this, "_button_input"); add_focusable(edit); file = NULL; @@ -3024,7 +3039,7 @@ bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, Variant::Typ add_property_editor(p_path, editor); } } break; - case Variant::REAL: { + case Variant::FLOAT: { if (p_hint == PROPERTY_HINT_EXP_EASING) { EditorPropertyEasing *editor = memnew(EditorPropertyEasing); @@ -3158,7 +3173,7 @@ bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, Variant::Typ editor->setup(min, max, step, hide_slider); add_property_editor(p_path, editor); - } break; // 5 + } break; case Variant::RECT2: { EditorPropertyRect2 *editor = memnew(EditorPropertyRect2); double min = -65535, max = 65535, step = default_float_step; @@ -3245,7 +3260,7 @@ bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, Variant::Typ editor->setup(min, max, step, hide_slider); add_property_editor(p_path, editor); - } break; // 10 + } break; case Variant::AABB: { EditorPropertyAABB *editor = memnew(EditorPropertyAABB); double min = -65535, max = 65535, step = default_float_step; @@ -3305,6 +3320,22 @@ bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, Variant::Typ editor->setup(p_hint != PROPERTY_HINT_COLOR_NO_ALPHA); add_property_editor(p_path, editor); } break; + case Variant::STRING_NAME: { + + if (p_hint == PROPERTY_HINT_ENUM) { + EditorPropertyTextEnum *editor = memnew(EditorPropertyTextEnum); + Vector<String> options = p_hint_text.split(","); + editor->setup(options, true); + add_property_editor(p_path, editor); + } else { + EditorPropertyText *editor = memnew(EditorPropertyText); + if (p_hint == PROPERTY_HINT_PLACEHOLDER_TEXT) { + editor->set_placeholder(p_hint_text); + } + editor->set_string_name(true); + add_property_editor(p_path, editor); + } + } break; case Variant::NODE_PATH: { EditorPropertyNodePath *editor = memnew(EditorPropertyNodePath); @@ -3318,7 +3349,7 @@ bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, Variant::Typ } add_property_editor(p_path, editor); - } break; // 15 + } break; case Variant::_RID: { EditorPropertyRID *editor = memnew(EditorPropertyRID); add_property_editor(p_path, editor); @@ -3353,39 +3384,49 @@ bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, Variant::Typ editor->setup(Variant::ARRAY, p_hint_text); add_property_editor(p_path, editor); } break; - case Variant::POOL_BYTE_ARRAY: { + case Variant::PACKED_BYTE_ARRAY: { EditorPropertyArray *editor = memnew(EditorPropertyArray); - editor->setup(Variant::POOL_BYTE_ARRAY); + editor->setup(Variant::PACKED_BYTE_ARRAY); add_property_editor(p_path, editor); - } break; // 20 - case Variant::POOL_INT_ARRAY: { + } break; + case Variant::PACKED_INT32_ARRAY: { EditorPropertyArray *editor = memnew(EditorPropertyArray); - editor->setup(Variant::POOL_INT_ARRAY); + editor->setup(Variant::PACKED_INT32_ARRAY); add_property_editor(p_path, editor); } break; - case Variant::POOL_REAL_ARRAY: { + case Variant::PACKED_INT64_ARRAY: { EditorPropertyArray *editor = memnew(EditorPropertyArray); - editor->setup(Variant::POOL_REAL_ARRAY); + editor->setup(Variant::PACKED_INT64_ARRAY); add_property_editor(p_path, editor); } break; - case Variant::POOL_STRING_ARRAY: { + case Variant::PACKED_FLOAT32_ARRAY: { EditorPropertyArray *editor = memnew(EditorPropertyArray); - editor->setup(Variant::POOL_STRING_ARRAY); + editor->setup(Variant::PACKED_FLOAT32_ARRAY); add_property_editor(p_path, editor); } break; - case Variant::POOL_VECTOR2_ARRAY: { + case Variant::PACKED_FLOAT64_ARRAY: { EditorPropertyArray *editor = memnew(EditorPropertyArray); - editor->setup(Variant::POOL_VECTOR2_ARRAY); + editor->setup(Variant::PACKED_FLOAT64_ARRAY); add_property_editor(p_path, editor); } break; - case Variant::POOL_VECTOR3_ARRAY: { + case Variant::PACKED_STRING_ARRAY: { EditorPropertyArray *editor = memnew(EditorPropertyArray); - editor->setup(Variant::POOL_VECTOR3_ARRAY); + editor->setup(Variant::PACKED_STRING_ARRAY); add_property_editor(p_path, editor); - } break; // 25 - case Variant::POOL_COLOR_ARRAY: { + } break; + case Variant::PACKED_VECTOR2_ARRAY: { + EditorPropertyArray *editor = memnew(EditorPropertyArray); + editor->setup(Variant::PACKED_VECTOR2_ARRAY); + add_property_editor(p_path, editor); + } break; + case Variant::PACKED_VECTOR3_ARRAY: { + EditorPropertyArray *editor = memnew(EditorPropertyArray); + editor->setup(Variant::PACKED_VECTOR3_ARRAY); + add_property_editor(p_path, editor); + } break; + case Variant::PACKED_COLOR_ARRAY: { EditorPropertyArray *editor = memnew(EditorPropertyArray); - editor->setup(Variant::POOL_COLOR_ARRAY); + editor->setup(Variant::PACKED_COLOR_ARRAY); add_property_editor(p_path, editor); } break; default: { |