diff options
Diffstat (limited to 'editor/property_editor.cpp')
-rw-r--r-- | editor/property_editor.cpp | 108 |
1 files changed, 53 insertions, 55 deletions
diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp index 2dcbc4c14c..72b2eb2885 100644 --- a/editor/property_editor.cpp +++ b/editor/property_editor.cpp @@ -176,9 +176,9 @@ void CustomPropertyEditor::_menu_option(int p_which) { case OBJ_MENU_EDIT: { - RefPtr RefPtr = v; + REF r = v; - if (!RefPtr.is_null()) { + if (!r.is_null()) { emit_signal("resource_edit_request"); hide(); @@ -193,8 +193,7 @@ void CustomPropertyEditor::_menu_option(int p_which) { case OBJ_MENU_MAKE_UNIQUE: { - RefPtr RefPtr = v; - Ref<Resource> res_orig = RefPtr; + Ref<Resource> res_orig = v; if (res_orig.is_null()) return; @@ -229,7 +228,7 @@ void CustomPropertyEditor::_menu_option(int p_which) { res->set(p.first, p.second); } - v = res.get_ref_ptr(); + v = res; emit_signal("variant_changed"); hide(); } break; @@ -311,7 +310,7 @@ void CustomPropertyEditor::_menu_option(int p_which) { res->call("set_instance_base_type", owner->get_class()); } - v = Ref<Resource>(res).get_ref_ptr(); + v = res; emit_signal("variant_changed"); } break; @@ -590,7 +589,7 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant:: if (!create_dialog) { create_dialog = memnew(CreateDialog); - create_dialog->connect("create", this, "_create_dialog_callback"); + create_dialog->connect_compat("create", this, "_create_dialog_callback"); add_child(create_dialog); } @@ -606,12 +605,12 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant:: return false; } else if (hint == PROPERTY_HINT_METHOD_OF_VARIANT_TYPE) { -#define MAKE_PROPSELECT \ - if (!property_select) { \ - property_select = memnew(PropertySelector); \ - property_select->connect("selected", this, "_create_selected_property"); \ - add_child(property_select); \ - } \ +#define MAKE_PROPSELECT \ + if (!property_select) { \ + property_select = memnew(PropertySelector); \ + property_select->connect_compat("selected", this, "_create_selected_property"); \ + add_child(property_select); \ + } \ hide(); MAKE_PROPSELECT; @@ -639,7 +638,7 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant:: MAKE_PROPSELECT - Object *instance = ObjectDB::get_instance(hint_text.to_int64()); + Object *instance = ObjectDB::get_instance(ObjectID(hint_text.to_int64())); if (instance) property_select->select_method_from_instance(instance, v); updating = false; @@ -648,7 +647,7 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant:: } else if (hint == PROPERTY_HINT_METHOD_OF_SCRIPT) { MAKE_PROPSELECT - 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)) { property_select->select_method_from_script(Object::cast_to<Script>(obj), v); } @@ -688,7 +687,7 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant:: MAKE_PROPSELECT - Object *instance = ObjectDB::get_instance(hint_text.to_int64()); + Object *instance = ObjectDB::get_instance(ObjectID(hint_text.to_int64())); if (instance) property_select->select_property_from_instance(instance, v); @@ -698,7 +697,7 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant:: } else if (hint == PROPERTY_HINT_PROPERTY_OF_SCRIPT) { MAKE_PROPSELECT - 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)) { property_select->select_property_from_script(Object::cast_to<Script>(obj), v); } @@ -866,7 +865,7 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant:: color_picker->set_deferred_mode(true); add_child(color_picker); color_picker->hide(); - color_picker->connect("color_changed", this, "_color_changed"); + color_picker->connect_compat("color_changed", this, "_color_changed"); // get default color picker mode from editor settings int default_color_mode = EDITOR_GET("interface/inspector/default_color_picker_mode"); @@ -935,7 +934,7 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant:: const String &t = j->get(); bool is_custom_resource = false; - Ref<Texture> icon; + Ref<Texture2D> icon; if (!custom_resources.empty()) { for (int k = 0; k < custom_resources.size(); k++) { if (custom_resources[k].name == t) { @@ -1023,7 +1022,7 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant:: } 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"); @@ -1046,22 +1045,22 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant:: case Variant::DICTIONARY: { } break; - case Variant::POOL_BYTE_ARRAY: { + case Variant::PACKED_BYTE_ARRAY: { } break; - case Variant::POOL_INT_ARRAY: { + case Variant::PACKED_INT_ARRAY: { } break; - case Variant::POOL_REAL_ARRAY: { + case Variant::PACKED_REAL_ARRAY: { } break; - case Variant::POOL_STRING_ARRAY: { + case Variant::PACKED_STRING_ARRAY: { } break; - case Variant::POOL_VECTOR3_ARRAY: { + case Variant::PACKED_VECTOR3_ARRAY: { } break; - case Variant::POOL_COLOR_ARRAY: { + case Variant::PACKED_COLOR_ARRAY: { } break; default: { @@ -1103,7 +1102,7 @@ void CustomPropertyEditor::_file_selected(String p_file) { error->popup_centered_minsize(); break; } - v = res.get_ref_ptr(); + v = res; emit_signal("variant_changed"); hide(); } break; @@ -1168,7 +1167,7 @@ void CustomPropertyEditor::_type_create_selected(int p_idx) { Resource *res = Object::cast_to<Resource>(obj); ERR_FAIL_COND(!res); - v = Ref<Resource>(res).get_ref_ptr(); + v = res; emit_signal("variant_changed"); hide(); } @@ -1373,7 +1372,7 @@ void CustomPropertyEditor::_action_pressed(int p_which) { Resource *res = Object::cast_to<Resource>(obj); ERR_BREAK(!res); - v = Ref<Resource>(res).get_ref_ptr(); + v = res; emit_signal("variant_changed"); hide(); } @@ -1395,9 +1394,9 @@ void CustomPropertyEditor::_action_pressed(int p_which) { } else if (p_which == 2) { - RefPtr RefPtr = v; + RES r = v; - if (!RefPtr.is_null()) { + if (!r.is_null()) { emit_signal("resource_edit_request"); hide(); @@ -1410,8 +1409,7 @@ void CustomPropertyEditor::_action_pressed(int p_which) { hide(); } else if (p_which == 4) { - RefPtr RefPtr = v; - Ref<Resource> res_orig = RefPtr; + Ref<Resource> res_orig = v; if (res_orig.is_null()) return; @@ -1442,7 +1440,7 @@ void CustomPropertyEditor::_action_pressed(int p_which) { res->set(p.first, p.second); } - v = res.get_ref_ptr(); + v = res; emit_signal("variant_changed"); hide(); } @@ -1699,22 +1697,22 @@ void CustomPropertyEditor::_modified(String p_string) { case Variant::DICTIONARY: { } break; - case Variant::POOL_BYTE_ARRAY: { + case Variant::PACKED_BYTE_ARRAY: { } break; - case Variant::POOL_INT_ARRAY: { + case Variant::PACKED_INT_ARRAY: { } break; - case Variant::POOL_REAL_ARRAY: { + case Variant::PACKED_REAL_ARRAY: { } break; - case Variant::POOL_STRING_ARRAY: { + case Variant::PACKED_STRING_ARRAY: { } break; - case Variant::POOL_VECTOR3_ARRAY: { + case Variant::PACKED_VECTOR3_ARRAY: { } break; - case Variant::POOL_COLOR_ARRAY: { + case Variant::PACKED_COLOR_ARRAY: { } break; default: { @@ -1904,9 +1902,9 @@ CustomPropertyEditor::CustomPropertyEditor() { add_child(value_label[i]); value_editor[i]->hide(); value_label[i]->hide(); - value_editor[i]->connect("text_entered", this, "_modified"); - value_editor[i]->connect("focus_entered", this, "_focus_enter"); - value_editor[i]->connect("focus_exited", this, "_focus_exit"); + value_editor[i]->connect_compat("text_entered", this, "_modified"); + value_editor[i]->connect_compat("focus_entered", this, "_focus_enter"); + value_editor[i]->connect_compat("focus_exited", this, "_focus_exit"); } focused_value_editor = -1; @@ -1936,7 +1934,7 @@ CustomPropertyEditor::CustomPropertyEditor() { checks20[i]->set_focus_mode(FOCUS_NONE); checks20gc->add_child(checks20[i]); checks20[i]->hide(); - checks20[i]->connect("pressed", this, "_action_pressed", make_binds(i)); + checks20[i]->connect_compat("pressed", this, "_action_pressed", make_binds(i)); checks20[i]->set_tooltip(vformat(TTR("Bit %d, val %d."), i, 1 << i)); } @@ -1946,7 +1944,7 @@ CustomPropertyEditor::CustomPropertyEditor() { text_edit->set_margin(MARGIN_BOTTOM, -30); text_edit->hide(); - text_edit->connect("text_changed", this, "_text_edit_changed"); + text_edit->connect_compat("text_changed", this, "_text_edit_changed"); for (int i = 0; i < MAX_ACTION_BUTTONS; i++) { @@ -1955,7 +1953,7 @@ CustomPropertyEditor::CustomPropertyEditor() { add_child(action_buttons[i]); Vector<Variant> binds; binds.push_back(i); - action_buttons[i]->connect("pressed", this, "_action_pressed", binds); + action_buttons[i]->connect_compat("pressed", this, "_action_pressed", binds); action_buttons[i]->set_flat(true); } @@ -1966,8 +1964,8 @@ CustomPropertyEditor::CustomPropertyEditor() { add_child(file); file->hide(); - file->connect("file_selected", this, "_file_selected"); - file->connect("dir_selected", this, "_file_selected"); + file->connect_compat("file_selected", this, "_file_selected"); + file->connect_compat("dir_selected", this, "_file_selected"); error = memnew(ConfirmationDialog); error->set_title(TTR("Error!")); @@ -1975,7 +1973,7 @@ CustomPropertyEditor::CustomPropertyEditor() { scene_tree = memnew(SceneTreeDialog); add_child(scene_tree); - scene_tree->connect("selected", this, "_node_path_selected"); + scene_tree->connect_compat("selected", this, "_node_path_selected"); scene_tree->get_scene_tree()->set_show_enabled_subscene(true); texture_preview = memnew(TextureRect); @@ -1985,31 +1983,31 @@ CustomPropertyEditor::CustomPropertyEditor() { easing_draw = memnew(Control); add_child(easing_draw); easing_draw->hide(); - 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); type_button = memnew(MenuButton); add_child(type_button); type_button->hide(); - type_button->get_popup()->connect("id_pressed", this, "_type_create_selected"); + type_button->get_popup()->connect_compat("id_pressed", this, "_type_create_selected"); menu = memnew(PopupMenu); menu->set_pass_on_modal_close_click(false); add_child(menu); - menu->connect("id_pressed", this, "_menu_option"); + menu->connect_compat("id_pressed", this, "_menu_option"); evaluator = NULL; spinbox = memnew(SpinBox); add_child(spinbox); spinbox->set_anchors_and_margins_preset(Control::PRESET_WIDE, Control::PRESET_MODE_MINSIZE, 5); - spinbox->connect("value_changed", this, "_range_modified"); + spinbox->connect_compat("value_changed", this, "_range_modified"); slider = memnew(HSlider); add_child(slider); slider->set_anchors_and_margins_preset(Control::PRESET_WIDE, Control::PRESET_MODE_MINSIZE, 5); - slider->connect("value_changed", this, "_range_modified"); + slider->connect_compat("value_changed", this, "_range_modified"); create_dialog = NULL; property_select = NULL; |