Merge pull request #21974 from akien-mga/drop-property-editor

Replace last occurrences of PropertyEditor and drop its code
This commit is contained in:
Rémi Verschelde 2018-09-11 17:05:55 +02:00 committed by GitHub
commit 10db0421db
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 24 additions and 2913 deletions

View file

@ -341,8 +341,7 @@ ConnectDialog::ConnectDialog() {
vbc_right->add_margin_child(TTR("Add Extra Call Argument:"), add_bind_hb);
bind_editor = memnew(PropertyEditor);
bind_editor->hide_top_label();
bind_editor = memnew(EditorInspector);
vbc_right->add_margin_child(TTR("Extra Call Arguments:"), bind_editor, true);

View file

@ -35,7 +35,7 @@
#ifndef CONNECTIONS_DIALOG_H
#define CONNECTIONS_DIALOG_H
#include "editor/property_editor.h"
#include "editor/editor_inspector.h"
#include "editor/scene_tree_editor.h"
#include "scene/gui/button.h"
#include "scene/gui/check_button.h"
@ -62,7 +62,7 @@ class ConnectDialog : public ConfirmationDialog {
SceneTreeEditor *tree;
ConfirmationDialog *error;
PropertyEditor *bind_editor;
EditorInspector *bind_editor;
OptionButton *type_list;
CheckButton *deferred;
CheckButton *oneshot;

View file

@ -38,7 +38,6 @@
// TODO:
// arrays and dictionary
// replace property editor in sectionedpropertyeditor
Size2 EditorProperty::get_minimum_size() const {
@ -1138,7 +1137,6 @@ void EditorInspectorSection::_gui_input(const Ref<InputEvent> &p_event) {
return;
#ifdef TOOLS_ENABLED
Ref<InputEventMouseButton> mb = p_event;
if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
@ -1167,7 +1165,6 @@ void EditorInspectorSection::unfold() {
_test_unfold();
#ifdef TOOLS_ENABLED
object->editor_set_section_unfold(section, true);
vbox->show();
update();
@ -1180,8 +1177,8 @@ void EditorInspectorSection::fold() {
if (!vbox_added)
return; //kinda pointless
#ifdef TOOLS_ENABLED
#ifdef TOOLS_ENABLED
object->editor_set_section_unfold(section, false);
vbox->hide();
update();
@ -1202,7 +1199,6 @@ EditorInspectorSection::EditorInspectorSection() {
foldable = false;
vbox = memnew(VBoxContainer);
vbox_added = false;
//add_child(vbox);
}
EditorInspectorSection::~EditorInspectorSection() {
@ -1607,12 +1603,6 @@ void EditorInspector::update_tree() {
doc_hint = descr;
}
#if 0
if (p.name == selected_property) {
item->select(1);
}
#endif
for (List<Ref<EditorInspectorPlugin> >::Element *E = valid_plugins.front(); E; E = E->next()) {
Ref<EditorInspectorPlugin> ped = E->get();
bool exclusive = ped->parse_property(object, p.type, p.name, p.hint, p.hint_string, p.usage);
@ -1812,12 +1802,6 @@ void EditorInspector::_filter_changed(const String &p_text) {
update_tree();
}
void EditorInspector::set_subsection_selectable(bool p_selectable) {
}
void EditorInspector::set_property_selectable(bool p_selectable) {
}
void EditorInspector::set_use_folding(bool p_enable) {
use_folding = p_enable;
update_tree();

View file

@ -349,9 +349,6 @@ public:
void set_use_filter(bool p_use);
void register_text_enter(Node *p_line_edit);
void set_subsection_selectable(bool p_selectable);
void set_property_selectable(bool p_selectable);
void set_use_folding(bool p_enable);
bool is_using_folding();

View file

@ -5646,10 +5646,6 @@ EditorNode::EditorNode() {
add_editor_plugin(memnew(SkeletonIKEditorPlugin(this)));
add_editor_plugin(memnew(PhysicalBonePlugin(this)));
// FIXME: Disabled as (according to reduz) users were complaining that it gets in the way
// Waiting for PropertyEditor rewrite (planned for 3.1) to be refactored.
//add_editor_plugin(memnew(MaterialEditorPlugin(this)));
for (int i = 0; i < EditorPlugins::get_plugin_count(); i++)
add_editor_plugin(EditorPlugins::create(i, this));

View file

@ -278,19 +278,21 @@ void ItemListEditor::_add_pressed() {
void ItemListEditor::_delete_pressed() {
TreeItem *ti = tree->get_selected();
if (!ti)
return;
if (ti->get_parent() != tree->get_root())
return;
int idx = ti->get_text(0).to_int();
if (selected_idx == -1)
return;
String current_selected = (String)property_editor->get_selected_path();
if (current_selected == "")
return;
// FIXME: Currently relying on selecting a *property* to derive what item to delete
// e.g. you select "1/enabled" to delete item 1.
// This should be fixed so that you can delete by selecting the item section header,
// or a delete button on that header.
int idx = current_selected.get_slice("/", 0).to_int();
item_plugins[selected_idx]->erase(idx);
}
@ -382,13 +384,9 @@ ItemListEditor::ItemListEditor() {
hbc->add_child(del_button);
del_button->connect("pressed", this, "_delete_button");
property_editor = memnew(PropertyEditor);
property_editor->hide_top_label();
property_editor->set_subsection_selectable(true);
property_editor = memnew(EditorInspector);
vbc->add_child(property_editor);
property_editor->set_v_size_flags(SIZE_EXPAND_FILL);
tree = property_editor->get_property_tree();
}
ItemListEditor::~ItemListEditor() {

View file

@ -32,9 +32,9 @@
#define ITEM_LIST_EDITOR_PLUGIN_H
#include "canvas_item_editor_plugin.h"
#include "editor/editor_inspector.h"
#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "scene/gui/menu_button.h"
#include "scene/gui/option_button.h"
#include "scene/gui/popup_menu.h"
@ -210,7 +210,7 @@ class ItemListEditor : public HBoxContainer {
ToolButton *toolbar_button;
AcceptDialog *dialog;
PropertyEditor *property_editor;
EditorInspector *property_editor;
Tree *tree;
Button *add_button;
Button *del_button;

View file

@ -1750,12 +1750,9 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
globals_editor = memnew(SectionedInspector);
props_base->add_child(globals_editor);
globals_editor->get_inspector()->set_undo_redo(EditorNode::get_singleton()->get_undo_redo());
globals_editor->get_inspector()->set_property_selectable(true);
//globals_editor->hide_top_label();
globals_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL);
globals_editor->register_search_box(search_box);
globals_editor->get_inspector()->connect("property_selected", this, "_item_selected");
//globals_editor->get_inspector()->connect("property_toggled", this, "_item_checked", varray(), CONNECT_DEFERRED);
globals_editor->get_inspector()->connect("property_edited", this, "_settings_prop_edited");
globals_editor->get_inspector()->connect("restart_requested", this, "_editor_restart_request");

File diff suppressed because it is too large Load diff

View file

@ -175,180 +175,6 @@ public:
CustomPropertyEditor();
};
class PropertyEditor : public Control {
GDCLASS(PropertyEditor, Control);
Tree *tree;
Label *top_label;
LineEdit *search_box;
PropertyValueEvaluator *evaluator;
Object *obj;
StringName _prop_edited;
bool capitalize_paths;
bool changing;
bool update_tree_pending;
bool autoclear;
bool keying;
bool read_only;
bool show_categories;
bool show_type_icons;
float refresh_countdown;
bool use_doc_hints;
bool use_filter;
bool subsection_selectable;
bool hide_script;
bool use_folding;
bool property_selectable;
bool updating_folding;
List<String> foldable_property_cache;
HashMap<String, String> pending;
String selected_property;
Map<StringName, Map<StringName, String> > descr_cache;
Map<StringName, String> class_descr_cache;
CustomPropertyEditor *custom_editor;
void _resource_edit_request();
void _custom_editor_edited();
void _custom_editor_edited_field(const String &p_field_name);
void _custom_editor_request(bool p_arrow);
void _item_selected();
void _item_rmb_edited();
void _item_edited();
TreeItem *get_parent_node(String p_path, HashMap<String, TreeItem *> &item_paths, TreeItem *root, TreeItem *category);
void set_item_text(TreeItem *p_item, int p_type, const String &p_name, int p_hint = PROPERTY_HINT_NONE, const String &p_hint_text = "");
TreeItem *find_item(TreeItem *p_item, const String &p_name);
virtual void _changed_callback(Object *p_changed, const char *p_prop);
virtual void _changed_callbacks(Object *p_changed, const String &p_prop);
void _check_reload_status(const String &p_name, TreeItem *item);
void _edit_button(Object *p_item, int p_column, int p_button);
void _node_removed(Node *p_node);
friend class ProjectExportDialog;
void _edit_set(const String &p_name, const Variant &p_value, bool p_refresh_all = false, const String &p_changed_field = "");
void _draw_flags(Object *p_object, const Rect2 &p_rect);
bool _might_be_in_instance();
bool _get_instanced_node_original_property(const StringName &p_prop, Variant &value);
bool _is_property_different(const Variant &p_current, const Variant &p_orig, int p_usage = 0);
bool _is_instanced_node_with_original_property_different(const String &p_name, TreeItem *item);
void _refresh_item(TreeItem *p_item);
void _set_range_def(Object *p_item, String prop, float p_frame);
void _filter_changed(const String &p_text);
void _mark_drop_fields(TreeItem *p_at);
void _clear_drop_fields(TreeItem *p_at);
bool _is_drop_valid(const Dictionary &p_drag_data, const Dictionary &p_item_data) const;
Variant get_drag_data_fw(const Point2 &p_point, Control *p_from);
bool can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const;
void drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from);
void _resource_preview_done(const String &p_path, const Ref<Texture> &p_preview, Variant p_ud);
void _draw_transparency(Object *t, const Rect2 &p_rect);
void _item_folded(Object *item_obj);
UndoRedo *undo_redo;
protected:
void _notification(int p_what);
static void _bind_methods();
public:
void set_undo_redo(UndoRedo *p_undo_redo) { undo_redo = p_undo_redo; }
String get_selected_path() const;
Tree *get_property_tree();
Label *get_top_label();
void hide_top_label();
void update_tree();
void update_property(const String &p_prop);
void refresh();
void edit(Object *p_object);
void set_keying(bool p_active);
void set_read_only(bool p_read_only) {
read_only = p_read_only;
custom_editor->set_read_only(p_read_only);
}
bool is_capitalize_paths_enabled() const;
void set_enable_capitalize_paths(bool p_capitalize);
void set_autoclear(bool p_enable);
void set_show_categories(bool p_show);
void set_use_doc_hints(bool p_enable) { use_doc_hints = p_enable; }
void set_hide_script(bool p_hide) { hide_script = p_hide; }
void set_use_filter(bool p_use);
void register_text_enter(Node *p_line_edit);
void set_subsection_selectable(bool p_selectable);
void set_property_selectable(bool p_selectable);
void set_use_folding(bool p_enable);
void collapse_all_folding();
void expand_all_folding();
PropertyEditor();
~PropertyEditor();
};
class SectionedPropertyEditorFilter;
class SectionedPropertyEditor : public HSplitContainer {
GDCLASS(SectionedPropertyEditor, HSplitContainer);
ObjectID obj;
Tree *sections;
SectionedPropertyEditorFilter *filter;
Map<String, TreeItem *> section_map;
PropertyEditor *editor;
LineEdit *search_box;
static void _bind_methods();
void _section_selected();
void _search_changed(const String &p_what);
public:
void register_search_box(LineEdit *p_box);
PropertyEditor *get_property_editor();
void edit(Object *p_object);
String get_full_item_path(const String &p_item);
void set_current_section(const String &p_section);
String get_current_section() const;
void update_category_list();
SectionedPropertyEditor();
~SectionedPropertyEditor();
};
class PropertyValueEvaluator : public ValueEvaluator {
GDCLASS(PropertyValueEvaluator, ValueEvaluator);

View file

@ -396,7 +396,6 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
dobreak->set_disabled(false);
docontinue->set_disabled(true);
emit_signal("breaked", false, false, Variant());
//tabs->set_current_tab(0);
profiler->set_enabled(true);
profiler->disable_seeking();
inspector->edit(NULL);
@ -1946,10 +1945,8 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) {
stack_dump->connect("cell_selected", this, "_stack_dump_frame_selected");
sc->add_child(stack_dump);
inspector = memnew(PropertyEditor);
inspector = memnew(EditorInspector);
inspector->set_h_size_flags(SIZE_EXPAND_FILL);
inspector->hide_top_label();
inspector->get_property_tree()->set_column_title(0, TTR("Variable"));
inspector->set_enable_capitalize_paths(false);
inspector->set_read_only(true);
inspector->connect("object_id_selected", this, "_scene_tree_property_select_object");
@ -2180,7 +2177,6 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) {
ScriptEditorDebugger::~ScriptEditorDebugger() {
//inspector->edit(NULL);
memdelete(variables);
ppeer->set_stream_peer(Ref<StreamPeer>());

View file

@ -33,12 +33,12 @@
#include "core/io/packet_peer.h"
#include "core/io/tcp_server.h"
#include "property_editor.h"
#include "editor/editor_inspector.h"
#include "editor/property_editor.h"
#include "scene/gui/box_container.h"
#include "scene/gui/button.h"
class Tree;
class PropertyEditor;
class EditorNode;
class ScriptEditorDebuggerVariables;
class LineEdit;
@ -130,7 +130,7 @@ class ScriptEditorDebugger : public Control {
LineEdit *vmem_total;
Tree *stack_dump;
PropertyEditor *inspector;
EditorInspector *inspector;
Ref<TCP_Server> server;
Ref<StreamPeerTCP> connection;