summaryrefslogtreecommitdiff
path: root/editor/inspector_dock.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/inspector_dock.cpp')
-rw-r--r--editor/inspector_dock.cpp67
1 files changed, 28 insertions, 39 deletions
diff --git a/editor/inspector_dock.cpp b/editor/inspector_dock.cpp
index b65482cc6b..2729d9ecb5 100644
--- a/editor/inspector_dock.cpp
+++ b/editor/inspector_dock.cpp
@@ -76,7 +76,6 @@ void InspectorDock::_menu_option(int p_option) {
editor_data->apply_changes_in_editors();
if (current)
editor_data->paste_object_params(current);
- editor_data->get_undo_redo().clear_history();
} break;
case OBJECT_UNIQUE_RESOURCES: {
@@ -166,8 +165,8 @@ void InspectorDock::_resource_file_selected(String p_file) {
}
void InspectorDock::_save_resource(bool save_as) const {
- uint32_t current = EditorNode::get_singleton()->get_editor_history()->get_current();
- Object *current_obj = current > 0 ? ObjectDB::get_instance(current) : NULL;
+ ObjectID current = EditorNode::get_singleton()->get_editor_history()->get_current();
+ Object *current_obj = current.is_valid() ? ObjectDB::get_instance(current) : NULL;
ERR_FAIL_COND(!Object::cast_to<Resource>(current_obj));
@@ -180,8 +179,8 @@ void InspectorDock::_save_resource(bool save_as) const {
}
void InspectorDock::_unref_resource() const {
- uint32_t current = EditorNode::get_singleton()->get_editor_history()->get_current();
- Object *current_obj = current > 0 ? ObjectDB::get_instance(current) : NULL;
+ ObjectID current = EditorNode::get_singleton()->get_editor_history()->get_current();
+ Object *current_obj = current.is_valid() ? ObjectDB::get_instance(current) : NULL;
ERR_FAIL_COND(!Object::cast_to<Resource>(current_obj));
@@ -191,8 +190,8 @@ void InspectorDock::_unref_resource() const {
}
void InspectorDock::_copy_resource() const {
- uint32_t current = EditorNode::get_singleton()->get_editor_history()->get_current();
- Object *current_obj = current > 0 ? ObjectDB::get_instance(current) : NULL;
+ ObjectID current = EditorNode::get_singleton()->get_editor_history()->get_current();
+ Object *current_obj = current.is_valid() ? ObjectDB::get_instance(current) : NULL;
ERR_FAIL_COND(!Object::cast_to<Resource>(current_obj));
@@ -215,7 +214,7 @@ void InspectorDock::_prepare_history() {
history_menu->get_popup()->clear();
- Ref<Texture> base_icon = get_icon("Object", "EditorIcons");
+ Ref<Texture2D> base_icon = get_icon("Object", "EditorIcons");
Set<ObjectID> already;
for (int i = editor_history->get_history_len() - 1; i >= history_to; i--) {
@@ -230,7 +229,7 @@ void InspectorDock::_prepare_history() {
already.insert(id);
- Ref<Texture> icon = EditorNode::get_singleton()->get_object_icon(obj, "");
+ Ref<Texture2D> icon = EditorNode::get_singleton()->get_object_icon(obj, "");
if (icon.is_null()) {
icon = base_icon;
}
@@ -247,7 +246,7 @@ void InspectorDock::_prepare_history() {
}
} else if (Object::cast_to<Node>(obj)) {
text = Object::cast_to<Node>(obj)->get_name();
- } else if (obj->is_class("ScriptEditorDebuggerInspectedObject")) {
+ } else if (obj->is_class("EditorDebuggerRemoteObject")) {
text = obj->call("get_title");
} else {
text = obj->get_class();
@@ -260,7 +259,7 @@ void InspectorDock::_prepare_history() {
}
}
-void InspectorDock::_select_history(int p_idx) const {
+void InspectorDock::_select_history(int p_idx) {
//push it to the top, it is not correct, but it's more useful
ObjectID id = EditorNode::get_singleton()->get_editor_history()->get_history_obj(p_idx);
Object *obj = ObjectDB::get_instance(id);
@@ -269,7 +268,7 @@ void InspectorDock::_select_history(int p_idx) const {
editor->push_item(obj);
}
-void InspectorDock::_resource_created() const {
+void InspectorDock::_resource_created() {
Object *c = new_resource_dialog->instance_selected();
ERR_FAIL_COND(!c);
@@ -280,7 +279,7 @@ void InspectorDock::_resource_created() const {
editor->push_item(c);
}
-void InspectorDock::_resource_selected(const RES &p_res, const String &p_property) const {
+void InspectorDock::_resource_selected(const RES &p_res, const String &p_property) {
if (p_res.is_null())
return;
@@ -337,33 +336,22 @@ void InspectorDock::_notification(int p_what) {
history_menu->set_icon(get_icon("History", "EditorIcons"));
object_menu->set_icon(get_icon("Tools", "EditorIcons"));
warning->set_icon(get_icon("NodeWarning", "EditorIcons"));
+ warning->add_color_override("font_color", get_color("warning_color", "Editor"));
} break;
}
}
void InspectorDock::_bind_methods() {
- ClassDB::bind_method("_menu_option", &InspectorDock::_menu_option);
ClassDB::bind_method("update_keying", &InspectorDock::update_keying);
- ClassDB::bind_method("_property_keyed", &InspectorDock::_property_keyed);
- ClassDB::bind_method("_transform_keyed", &InspectorDock::_transform_keyed);
+ ClassDB::bind_method("_transform_keyed", &InspectorDock::_transform_keyed); // Still used by some connect_compat.
- ClassDB::bind_method("_new_resource", &InspectorDock::_new_resource);
- ClassDB::bind_method("_resource_file_selected", &InspectorDock::_resource_file_selected);
- ClassDB::bind_method("_open_resource_selector", &InspectorDock::_open_resource_selector);
ClassDB::bind_method("_unref_resource", &InspectorDock::_unref_resource);
ClassDB::bind_method("_paste_resource", &InspectorDock::_paste_resource);
ClassDB::bind_method("_copy_resource", &InspectorDock::_copy_resource);
- ClassDB::bind_method("_select_history", &InspectorDock::_select_history);
- ClassDB::bind_method("_prepare_history", &InspectorDock::_prepare_history);
- ClassDB::bind_method("_resource_created", &InspectorDock::_resource_created);
- ClassDB::bind_method("_resource_selected", &InspectorDock::_resource_selected, DEFVAL(""));
ClassDB::bind_method("_menu_collapseall", &InspectorDock::_menu_collapseall);
ClassDB::bind_method("_menu_expandall", &InspectorDock::_menu_expandall);
- ClassDB::bind_method("_warning_pressed", &InspectorDock::_warning_pressed);
- ClassDB::bind_method("_edit_forward", &InspectorDock::_edit_forward);
- ClassDB::bind_method("_edit_back", &InspectorDock::_edit_back);
ADD_SIGNAL(MethodInfo("request_help"));
}
@@ -510,14 +498,14 @@ InspectorDock::InspectorDock(EditorNode *p_editor, EditorData &p_editor_data) {
resource_new_button->set_tooltip(TTR("Create a new resource in memory and edit it."));
resource_new_button->set_icon(get_icon("New", "EditorIcons"));
general_options_hb->add_child(resource_new_button);
- resource_new_button->connect("pressed", this, "_new_resource");
+ resource_new_button->connect("pressed", callable_mp(this, &InspectorDock::_new_resource));
resource_new_button->set_focus_mode(Control::FOCUS_NONE);
resource_load_button = memnew(ToolButton);
resource_load_button->set_tooltip(TTR("Load an existing resource from disk and edit it."));
resource_load_button->set_icon(get_icon("Load", "EditorIcons"));
general_options_hb->add_child(resource_load_button);
- resource_load_button->connect("pressed", this, "_open_resource_selector");
+ resource_load_button->connect("pressed", callable_mp(this, &InspectorDock::_open_resource_selector));
resource_load_button->set_focus_mode(Control::FOCUS_NONE);
resource_save_button = memnew(MenuButton);
@@ -526,7 +514,7 @@ InspectorDock::InspectorDock(EditorNode *p_editor, EditorData &p_editor_data) {
general_options_hb->add_child(resource_save_button);
resource_save_button->get_popup()->add_item(TTR("Save"), RESOURCE_SAVE);
resource_save_button->get_popup()->add_item(TTR("Save As..."), RESOURCE_SAVE_AS);
- resource_save_button->get_popup()->connect("id_pressed", this, "_menu_option");
+ resource_save_button->get_popup()->connect("id_pressed", callable_mp(this, &InspectorDock::_menu_option));
resource_save_button->set_focus_mode(Control::FOCUS_NONE);
resource_save_button->set_disabled(true);
@@ -538,7 +526,7 @@ InspectorDock::InspectorDock(EditorNode *p_editor, EditorData &p_editor_data) {
backward_button->set_flat(true);
backward_button->set_tooltip(TTR("Go to the previous edited object in history."));
backward_button->set_disabled(true);
- backward_button->connect("pressed", this, "_edit_back");
+ backward_button->connect("pressed", callable_mp(this, &InspectorDock::_edit_back));
forward_button = memnew(ToolButton);
general_options_hb->add_child(forward_button);
@@ -546,14 +534,14 @@ InspectorDock::InspectorDock(EditorNode *p_editor, EditorData &p_editor_data) {
forward_button->set_flat(true);
forward_button->set_tooltip(TTR("Go to the next edited object in history."));
forward_button->set_disabled(true);
- forward_button->connect("pressed", this, "_edit_forward");
+ forward_button->connect("pressed", callable_mp(this, &InspectorDock::_edit_forward));
history_menu = memnew(MenuButton);
history_menu->set_tooltip(TTR("History of recently edited objects."));
history_menu->set_icon(get_icon("History", "EditorIcons"));
general_options_hb->add_child(history_menu);
- history_menu->connect("about_to_show", this, "_prepare_history");
- history_menu->get_popup()->connect("id_pressed", this, "_select_history");
+ history_menu->connect("about_to_show", callable_mp(this, &InspectorDock::_prepare_history));
+ history_menu->get_popup()->connect("id_pressed", callable_mp(this, &InspectorDock::_select_history));
HBoxContainer *node_info_hb = memnew(HBoxContainer);
add_child(node_info_hb);
@@ -566,12 +554,12 @@ InspectorDock::InspectorDock(EditorNode *p_editor, EditorData &p_editor_data) {
object_menu->set_icon(get_icon("Tools", "EditorIcons"));
node_info_hb->add_child(object_menu);
object_menu->set_tooltip(TTR("Object properties."));
- object_menu->get_popup()->connect("id_pressed", this, "_menu_option");
+ object_menu->get_popup()->connect("id_pressed", callable_mp(this, &InspectorDock::_menu_option));
new_resource_dialog = memnew(CreateDialog);
editor->get_gui_base()->add_child(new_resource_dialog);
new_resource_dialog->set_base_type("Resource");
- new_resource_dialog->connect("create", this, "_resource_created");
+ new_resource_dialog->connect("create", callable_mp(this, &InspectorDock::_resource_created));
search = memnew(LineEdit);
search->set_h_size_flags(Control::SIZE_EXPAND_FILL);
@@ -584,9 +572,10 @@ InspectorDock::InspectorDock(EditorNode *p_editor, EditorData &p_editor_data) {
add_child(warning);
warning->set_text(TTR("Changes may be lost!"));
warning->set_icon(get_icon("NodeWarning", "EditorIcons"));
+ warning->add_color_override("font_color", get_color("warning_color", "Editor"));
warning->set_clip_text(true);
warning->hide();
- warning->connect("pressed", this, "_warning_pressed");
+ warning->connect("pressed", callable_mp(this, &InspectorDock::_warning_pressed));
warning_dialog = memnew(AcceptDialog);
editor->get_gui_base()->add_child(warning_dialog);
@@ -594,7 +583,7 @@ InspectorDock::InspectorDock(EditorNode *p_editor, EditorData &p_editor_data) {
load_resource_dialog = memnew(EditorFileDialog);
add_child(load_resource_dialog);
load_resource_dialog->set_current_dir("res://");
- load_resource_dialog->connect("file_selected", this, "_resource_file_selected");
+ load_resource_dialog->connect("file_selected", callable_mp(this, &InspectorDock::_resource_file_selected));
inspector = memnew(EditorInspector);
add_child(inspector);
@@ -610,8 +599,8 @@ InspectorDock::InspectorDock(EditorNode *p_editor, EditorData &p_editor_data) {
inspector->set_use_filter(true); // TODO: check me
- inspector->connect("resource_selected", this, "_resource_selected");
- inspector->connect("property_keyed", this, "_property_keyed");
+ inspector->connect("resource_selected", callable_mp(this, &InspectorDock::_resource_selected));
+ inspector->connect("property_keyed", callable_mp(this, &InspectorDock::_property_keyed));
}
InspectorDock::~InspectorDock() {