You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-09 12:50:35 +00:00
Remove the "Open Editor" button, it will open automatically.
This commit is contained in:
@@ -1460,7 +1460,7 @@ void EditorNode::edit_item(Object *p_object) {
|
|||||||
_set_editing_top_editors(p_object);
|
_set_editing_top_editors(p_object);
|
||||||
_display_top_editors(true);
|
_display_top_editors(true);
|
||||||
} else {
|
} else {
|
||||||
_hide_top_editors();
|
hide_top_editors();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1498,7 +1498,7 @@ void EditorNode::_save_default_environment() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditorNode::_hide_top_editors() {
|
void EditorNode::hide_top_editors() {
|
||||||
|
|
||||||
_display_top_editors(false);
|
_display_top_editors(false);
|
||||||
|
|
||||||
@@ -1675,7 +1675,7 @@ void EditorNode::_edit_current() {
|
|||||||
|
|
||||||
} else if (!editor_plugins_over->get_plugins_list().empty()) {
|
} else if (!editor_plugins_over->get_plugins_list().empty()) {
|
||||||
|
|
||||||
_hide_top_editors();
|
hide_top_editors();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -452,7 +452,6 @@ private:
|
|||||||
|
|
||||||
void _instance_request(const Vector<String> &p_files);
|
void _instance_request(const Vector<String> &p_files);
|
||||||
|
|
||||||
void _hide_top_editors();
|
|
||||||
void _display_top_editors(bool p_display);
|
void _display_top_editors(bool p_display);
|
||||||
void _set_top_editors(Vector<EditorPlugin *> p_editor_plugins_over);
|
void _set_top_editors(Vector<EditorPlugin *> p_editor_plugins_over);
|
||||||
void _set_editing_top_editors(Object *p_current_object);
|
void _set_editing_top_editors(Object *p_current_object);
|
||||||
@@ -677,6 +676,7 @@ public:
|
|||||||
void edit_item(Object *p_object);
|
void edit_item(Object *p_object);
|
||||||
void edit_item_resource(RES p_resource);
|
void edit_item_resource(RES p_resource);
|
||||||
bool item_has_editor(Object *p_object);
|
bool item_has_editor(Object *p_object);
|
||||||
|
void hide_top_editors();
|
||||||
|
|
||||||
void open_request(const String &p_path);
|
void open_request(const String &p_path);
|
||||||
|
|
||||||
|
|||||||
@@ -2443,6 +2443,38 @@ void EditorPropertyResource::_open_editor_pressed() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EditorPropertyResource::_fold_other_editors(Object *p_self) {
|
||||||
|
|
||||||
|
if (this == p_self) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
RES res = get_edited_object()->get(get_edited_property());
|
||||||
|
|
||||||
|
if (!res.is_valid())
|
||||||
|
return;
|
||||||
|
bool use_editor = false;
|
||||||
|
for (int i = 0; i < EditorNode::get_singleton()->get_editor_data().get_editor_plugin_count(); i++) {
|
||||||
|
EditorPlugin *ep = EditorNode::get_singleton()->get_editor_data().get_editor_plugin(i);
|
||||||
|
if (ep->handles(res.ptr())) {
|
||||||
|
use_editor = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!use_editor)
|
||||||
|
return;
|
||||||
|
bool unfolded = get_edited_object()->editor_is_section_unfolded(get_edited_property());
|
||||||
|
|
||||||
|
if (unfolded) {
|
||||||
|
//refold
|
||||||
|
assign->set_pressed(false);
|
||||||
|
get_edited_object()->editor_set_section_unfold(get_edited_property(), false);
|
||||||
|
update_property();
|
||||||
|
}
|
||||||
|
|
||||||
|
opened_editor = false;
|
||||||
|
}
|
||||||
|
|
||||||
void EditorPropertyResource::update_property() {
|
void EditorPropertyResource::update_property() {
|
||||||
|
|
||||||
RES res = get_edited_object()->get(get_edited_property());
|
RES res = get_edited_object()->get(get_edited_property());
|
||||||
@@ -2487,12 +2519,20 @@ void EditorPropertyResource::update_property() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (use_editor) {
|
if (use_editor) {
|
||||||
|
//open editor directly and hide other open of these
|
||||||
|
_open_editor_pressed();
|
||||||
|
if (is_inside_tree()) {
|
||||||
|
get_tree()->call_deferred("call_group", "_editor_resource_properties", "_fold_other_editors", this);
|
||||||
|
}
|
||||||
|
opened_editor = true;
|
||||||
|
/*
|
||||||
Button *open_in_editor = memnew(Button);
|
Button *open_in_editor = memnew(Button);
|
||||||
open_in_editor->set_text(TTR("Open Editor"));
|
open_in_editor->set_text(TTR("Open Editor"));
|
||||||
open_in_editor->set_icon(get_icon("Edit", "EditorIcons"));
|
open_in_editor->set_icon(get_icon("Edit", "EditorIcons"));
|
||||||
sub_inspector_vbox->add_child(open_in_editor);
|
sub_inspector_vbox->add_child(open_in_editor);
|
||||||
open_in_editor->connect("pressed", this, "_open_editor_pressed");
|
open_in_editor->connect("pressed", this, "_open_editor_pressed");
|
||||||
open_in_editor->set_h_size_flags(SIZE_SHRINK_CENTER);
|
open_in_editor->set_h_size_flags(SIZE_SHRINK_CENTER);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2506,6 +2546,10 @@ void EditorPropertyResource::update_property() {
|
|||||||
memdelete(sub_inspector_vbox);
|
memdelete(sub_inspector_vbox);
|
||||||
sub_inspector = NULL;
|
sub_inspector = NULL;
|
||||||
sub_inspector_vbox = NULL;
|
sub_inspector_vbox = NULL;
|
||||||
|
if (opened_editor) {
|
||||||
|
EditorNode::get_singleton()->hide_top_editors();
|
||||||
|
opened_editor = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -2726,10 +2770,12 @@ void EditorPropertyResource::_bind_methods() {
|
|||||||
ClassDB::bind_method(D_METHOD("_button_draw"), &EditorPropertyResource::_button_draw);
|
ClassDB::bind_method(D_METHOD("_button_draw"), &EditorPropertyResource::_button_draw);
|
||||||
ClassDB::bind_method(D_METHOD("_open_editor_pressed"), &EditorPropertyResource::_open_editor_pressed);
|
ClassDB::bind_method(D_METHOD("_open_editor_pressed"), &EditorPropertyResource::_open_editor_pressed);
|
||||||
ClassDB::bind_method(D_METHOD("_button_input"), &EditorPropertyResource::_button_input);
|
ClassDB::bind_method(D_METHOD("_button_input"), &EditorPropertyResource::_button_input);
|
||||||
|
ClassDB::bind_method(D_METHOD("_fold_other_editors"), &EditorPropertyResource::_fold_other_editors);
|
||||||
}
|
}
|
||||||
|
|
||||||
EditorPropertyResource::EditorPropertyResource() {
|
EditorPropertyResource::EditorPropertyResource() {
|
||||||
|
|
||||||
|
opened_editor = true;
|
||||||
sub_inspector = NULL;
|
sub_inspector = NULL;
|
||||||
sub_inspector_vbox = NULL;
|
sub_inspector_vbox = NULL;
|
||||||
use_sub_inspector = bool(EDITOR_GET("interface/inspector/open_resources_in_current_inspector"));
|
use_sub_inspector = bool(EDITOR_GET("interface/inspector/open_resources_in_current_inspector"));
|
||||||
@@ -2766,6 +2812,8 @@ EditorPropertyResource::EditorPropertyResource() {
|
|||||||
file = NULL;
|
file = NULL;
|
||||||
scene_tree = NULL;
|
scene_tree = NULL;
|
||||||
dropping = false;
|
dropping = false;
|
||||||
|
|
||||||
|
add_to_group("_editor_resource_properties");
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////// DEFAULT PLUGIN //////////////////////
|
////////////// DEFAULT PLUGIN //////////////////////
|
||||||
|
|||||||
@@ -581,6 +581,9 @@ class EditorPropertyResource : public EditorProperty {
|
|||||||
|
|
||||||
void _button_input(const Ref<InputEvent> &p_event);
|
void _button_input(const Ref<InputEvent> &p_event);
|
||||||
void _open_editor_pressed();
|
void _open_editor_pressed();
|
||||||
|
void _fold_other_editors(Object *p_self);
|
||||||
|
|
||||||
|
bool opened_editor;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
|
|||||||
@@ -36,24 +36,6 @@
|
|||||||
#include "scene/main/node.h"
|
#include "scene/main/node.h"
|
||||||
#include "scene/resources/texture.h"
|
#include "scene/resources/texture.h"
|
||||||
|
|
||||||
/* make previews for:
|
|
||||||
*packdscene
|
|
||||||
*wav
|
|
||||||
*image
|
|
||||||
*mesh
|
|
||||||
-font
|
|
||||||
*script
|
|
||||||
*material
|
|
||||||
-shader
|
|
||||||
-shader graph?
|
|
||||||
-navigation mesh
|
|
||||||
-collision?
|
|
||||||
-occluder polygon
|
|
||||||
-navigation polygon
|
|
||||||
-tileset
|
|
||||||
-curve and curve2D
|
|
||||||
*/
|
|
||||||
|
|
||||||
class EditorResourcePreviewGenerator : public Reference {
|
class EditorResourcePreviewGenerator : public Reference {
|
||||||
|
|
||||||
GDCLASS(EditorResourcePreviewGenerator, Reference);
|
GDCLASS(EditorResourcePreviewGenerator, Reference);
|
||||||
|
|||||||
Reference in New Issue
Block a user