summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/editor/code_editor.cpp34
-rw-r--r--tools/editor/code_editor.h5
-rw-r--r--tools/editor/editor_data.cpp16
-rw-r--r--tools/editor/editor_data.h2
-rw-r--r--tools/editor/editor_file_system.cpp18
-rw-r--r--tools/editor/editor_import_export.cpp2
-rw-r--r--tools/editor/editor_node.cpp60
-rw-r--r--tools/editor/editor_node.h3
-rw-r--r--tools/editor/editor_plugin.cpp39
-rw-r--r--tools/editor/editor_plugin.h14
-rw-r--r--tools/editor/editor_resource_preview.cpp42
-rw-r--r--tools/editor/editor_resource_preview.h8
-rw-r--r--tools/editor/editor_themes.cpp13
-rw-r--r--tools/editor/editor_themes.h4
-rw-r--r--tools/editor/icons/2x/icon_remote_transform.pngbin0 -> 1435 bytes
-rw-r--r--tools/editor/icons/icon_color_frame.pngbin0 -> 360 bytes
-rw-r--r--tools/editor/icons/icon_remote_transform.pngbin0 -> 680 bytes
-rw-r--r--tools/editor/icons/source/icon_remote_transform.svg124
-rw-r--r--tools/editor/io_plugins/editor_bitmask_import_plugin.cpp2
-rw-r--r--tools/editor/io_plugins/editor_sample_import_plugin.cpp2
-rw-r--r--tools/editor/io_plugins/editor_scene_import_plugin.cpp7
-rw-r--r--tools/editor/plugins/baked_light_baker.cpp4
-rw-r--r--tools/editor/plugins/canvas_item_editor_plugin.cpp14
-rw-r--r--tools/editor/plugins/collision_polygon_2d_editor_plugin.h2
-rw-r--r--tools/editor/plugins/collision_shape_2d_editor_plugin.h2
-rw-r--r--tools/editor/plugins/light_occluder_2d_editor_plugin.h2
-rw-r--r--tools/editor/plugins/navigation_polygon_editor_plugin.h2
-rw-r--r--tools/editor/plugins/path_2d_editor_plugin.h2
-rw-r--r--tools/editor/plugins/polygon_2d_editor_plugin.h2
-rw-r--r--tools/editor/plugins/script_editor_plugin.cpp43
-rw-r--r--tools/editor/plugins/script_editor_plugin.h4
-rw-r--r--tools/editor/plugins/script_text_editor.cpp150
-rw-r--r--tools/editor/plugins/script_text_editor.h5
-rw-r--r--tools/editor/plugins/shader_graph_editor_plugin.cpp9
-rw-r--r--tools/editor/plugins/spatial_editor_plugin.cpp3
-rw-r--r--tools/editor/plugins/tile_map_editor_plugin.h2
-rw-r--r--tools/editor/project_manager.cpp4
-rw-r--r--tools/editor/spatial_editor_gizmos.cpp2
38 files changed, 563 insertions, 84 deletions
diff --git a/tools/editor/code_editor.cpp b/tools/editor/code_editor.cpp
index 2779275ea8..9240e3527c 100644
--- a/tools/editor/code_editor.cpp
+++ b/tools/editor/code_editor.cpp
@@ -356,7 +356,7 @@ void FindReplaceBar::_show_search() {
show();
search_text->grab_focus();
- if (text_edit->is_selection_active()) {
+ if (text_edit->is_selection_active() && !selection_only->is_pressed()) {
search_text->set_text(text_edit->get_selection_text());
}
@@ -376,12 +376,16 @@ void FindReplaceBar::popup_search() {
void FindReplaceBar::popup_replace() {
+
if (!replace_hbc->is_visible() || !replace_options_hbc->is_visible()) {
replace_text->clear();
replace_hbc->show();
replace_options_hbc->show();
+
}
+ selection_only->set_pressed( (text_edit->is_selection_active() && text_edit->get_selection_from_line() < text_edit->get_selection_to_line()) );
+
_show_search();
}
@@ -409,6 +413,14 @@ void FindReplaceBar::_search_text_entered(const String& p_text) {
search_next();
}
+void FindReplaceBar::_replace_text_entered(const String& p_text) {
+
+ if (selection_only->is_pressed() && text_edit->is_selection_active()) {
+ _replace_all();
+ _hide_bar();
+ }
+}
+
String FindReplaceBar::get_search_text() const {
return search_text->get_text();
@@ -452,6 +464,7 @@ void FindReplaceBar::_bind_methods() {
ObjectTypeDB::bind_method("_editor_text_changed",&FindReplaceBar::_editor_text_changed);
ObjectTypeDB::bind_method("_search_text_changed",&FindReplaceBar::_search_text_changed);
ObjectTypeDB::bind_method("_search_text_entered",&FindReplaceBar::_search_text_entered);
+ ObjectTypeDB::bind_method("_replace_text_entered",&FindReplaceBar::_replace_text_entered);
ObjectTypeDB::bind_method("_search_current",&FindReplaceBar::search_current);
ObjectTypeDB::bind_method("_search_next",&FindReplaceBar::search_next);
ObjectTypeDB::bind_method("_search_prev",&FindReplaceBar::search_prev);
@@ -497,18 +510,19 @@ FindReplaceBar::FindReplaceBar() {
replace_text = memnew(LineEdit);
replace_hbc->add_child(replace_text);
replace_text->set_custom_minimum_size(Size2(200, 0));
- replace_text->connect("text_entered",this,"_search_text_entered");
+ replace_text->connect("text_entered",this,"_replace_text_entered");
+
- replace = memnew(ToolButton);
+ replace = memnew(Button);
replace_hbc->add_child(replace);
replace->set_text(TTR("Replace"));
- replace->set_focus_mode(FOCUS_NONE);
+ //replace->set_focus_mode(FOCUS_NONE);
replace->connect("pressed",this,"_replace_pressed");
- replace_all = memnew(ToolButton);
+ replace_all = memnew(Button);
replace_hbc->add_child(replace_all);
replace_all->set_text(TTR("Replace All"));
- replace_all->set_focus_mode(FOCUS_NONE);
+ //replace_all->set_focus_mode(FOCUS_NONE);
replace_all->connect("pressed",this,"_replace_all_pressed");
Control *spacer_split = memnew( Control );
@@ -581,8 +595,10 @@ void FindReplaceDialog::popup_search() {
void FindReplaceDialog::popup_replace() {
+
set_title(TTR("Replace"));
bool do_selection=(text_edit->is_selection_active() && text_edit->get_selection_from_line() < text_edit->get_selection_to_line());
+
set_replace_selection_only(do_selection);
if (!do_selection && text_edit->is_selection_active()) {
@@ -1112,8 +1128,10 @@ void CodeTextEditor::_update_font() {
font_overridden = true;
}
}
- if(!font_overridden)
+ if(!font_overridden) {
+
text_editor->add_font_override("font",get_font("source","EditorFonts"));
+ }
}
void CodeTextEditor::_on_settings_change() {
@@ -1152,7 +1170,7 @@ void CodeTextEditor::_notification(int p_what) {
_load_theme_settings();
emit_signal("load_theme_settings");
}
- if (p_what==NOTIFICATION_ENTER_TREE) {
+ if (p_what==NOTIFICATION_THEME_CHANGED) {
_update_font();
}
}
diff --git a/tools/editor/code_editor.h b/tools/editor/code_editor.h
index 2affa31482..6f59dda1ee 100644
--- a/tools/editor/code_editor.h
+++ b/tools/editor/code_editor.h
@@ -73,8 +73,8 @@ class FindReplaceBar : public HBoxContainer {
TextureButton *hide_button;
LineEdit *replace_text;
- ToolButton *replace;
- ToolButton *replace_all;
+ Button *replace;
+ Button *replace_all;
CheckBox *selection_only;
VBoxContainer *text_vbc;
@@ -98,6 +98,7 @@ class FindReplaceBar : public HBoxContainer {
void _search_options_changed(bool p_pressed);
void _search_text_changed(const String& p_text);
void _search_text_entered(const String& p_text);
+ void _replace_text_entered(const String& p_text);
protected:
void _notification(int p_what);
diff --git a/tools/editor/editor_data.cpp b/tools/editor/editor_data.cpp
index 35ec1ebfcc..8fc18b5b39 100644
--- a/tools/editor/editor_data.cpp
+++ b/tools/editor/editor_data.cpp
@@ -877,8 +877,7 @@ bool EditorSelection::is_selected(Node * p_node) const {
return selection.has(p_node);
}
-
-Array EditorSelection::_get_selected_nodes() {
+Array EditorSelection::_get_transformable_selected_nodes() {
Array ret;
@@ -890,6 +889,18 @@ Array EditorSelection::_get_selected_nodes() {
return ret;
}
+Array EditorSelection::_get_selected_nodes() {
+
+ Array ret;
+
+ for (Map<Node*,Object*>::Element *E=selection.front();E;E=E->next()) {
+
+ ret.push_back(E->key());
+ }
+
+ return ret;
+}
+
void EditorSelection::_bind_methods() {
ObjectTypeDB::bind_method(_MD("_node_removed"),&EditorSelection::_node_removed);
@@ -897,6 +908,7 @@ void EditorSelection::_bind_methods() {
ObjectTypeDB::bind_method(_MD("add_node","node:Node"),&EditorSelection::add_node);
ObjectTypeDB::bind_method(_MD("remove_node","node:Node"),&EditorSelection::remove_node);
ObjectTypeDB::bind_method(_MD("get_selected_nodes"),&EditorSelection::_get_selected_nodes);
+ ObjectTypeDB::bind_method(_MD("get_transformable_selected_nodes"),&EditorSelection::_get_transformable_selected_nodes);
ADD_SIGNAL( MethodInfo("selection_changed") );
}
diff --git a/tools/editor/editor_data.h b/tools/editor/editor_data.h
index a0b716f560..59f9d4e4f3 100644
--- a/tools/editor/editor_data.h
+++ b/tools/editor/editor_data.h
@@ -233,6 +233,8 @@ public:
void _update_nl();
Array _get_selected_nodes();
+ Array _get_transformable_selected_nodes();
+
protected:
static void _bind_methods();
diff --git a/tools/editor/editor_file_system.cpp b/tools/editor/editor_file_system.cpp
index 582b9e2490..be1af16576 100644
--- a/tools/editor/editor_file_system.cpp
+++ b/tools/editor/editor_file_system.cpp
@@ -208,10 +208,14 @@ void EditorFileSystemDirectory::_bind_methods() {
ObjectTypeDB::bind_method(_MD("get_file_count"),&EditorFileSystemDirectory::get_file_count);
ObjectTypeDB::bind_method(_MD("get_file","idx"),&EditorFileSystemDirectory::get_file);
ObjectTypeDB::bind_method(_MD("get_file_path","idx"),&EditorFileSystemDirectory::get_file_path);
- ObjectTypeDB::bind_method(_MD("get_file_types","idx"),&EditorFileSystemDirectory::get_file_type);
+ ObjectTypeDB::bind_method(_MD("get_file_type","idx"),&EditorFileSystemDirectory::get_file_type);
ObjectTypeDB::bind_method(_MD("is_missing_sources","idx"),&EditorFileSystemDirectory::is_missing_sources);
ObjectTypeDB::bind_method(_MD("get_name"),&EditorFileSystemDirectory::get_name);
- ObjectTypeDB::bind_method(_MD("get_parent"),&EditorFileSystemDirectory::get_parent);
+ ObjectTypeDB::bind_method(_MD("get_path"),&EditorFileSystemDirectory::get_path);
+ ObjectTypeDB::bind_method(_MD("get_parent:EditorFileSystemDirectory"),&EditorFileSystemDirectory::get_parent);
+ ObjectTypeDB::bind_method(_MD("find_file_index","name"),&EditorFileSystemDirectory::find_file_index);
+ ObjectTypeDB::bind_method(_MD("find_dir_index","name"),&EditorFileSystemDirectory::find_dir_index);
+
}
@@ -1341,6 +1345,16 @@ void EditorFileSystem::update_file(const String& p_file) {
void EditorFileSystem::_bind_methods() {
+
+ ObjectTypeDB::bind_method(_MD("get_filesystem:EditorFileSystemDirectory"),&EditorFileSystem::get_filesystem);
+ ObjectTypeDB::bind_method(_MD("is_scanning"),&EditorFileSystem::is_scanning);
+ ObjectTypeDB::bind_method(_MD("get_scanning_progress"),&EditorFileSystem::get_scanning_progress);
+ ObjectTypeDB::bind_method(_MD("scan"),&EditorFileSystem::scan);
+ ObjectTypeDB::bind_method(_MD("scan_sources"),&EditorFileSystem::scan_sources);
+ ObjectTypeDB::bind_method(_MD("update_file","path"),&EditorFileSystem::update_file);
+ ObjectTypeDB::bind_method(_MD("get_path:EditorFileSystemDirectory","path"),&EditorFileSystem::get_path);
+ ObjectTypeDB::bind_method(_MD("get_file_type","path"),&EditorFileSystem::get_file_type);
+
ADD_SIGNAL( MethodInfo("filesystem_changed") );
ADD_SIGNAL( MethodInfo("sources_changed",PropertyInfo(Variant::BOOL,"exist")) );
diff --git a/tools/editor/editor_import_export.cpp b/tools/editor/editor_import_export.cpp
index 357d139c04..d90a175811 100644
--- a/tools/editor/editor_import_export.cpp
+++ b/tools/editor/editor_import_export.cpp
@@ -1441,7 +1441,7 @@ bool EditorExportPlatformPC::can_export(String *r_error) const {
String err;
bool valid=true;
- if (use64 && (!exists_export_template(debug_binary64)) || !exists_export_template(release_binary64)) {
+ if (use64 && (!exists_export_template(debug_binary64) || !exists_export_template(release_binary64))) {
valid=false;
err="No 64 bits export templates found.\nDownload and install export templates.\n";
}
diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp
index 11c51991e1..e88a155d95 100644
--- a/tools/editor/editor_node.cpp
+++ b/tools/editor/editor_node.cpp
@@ -785,7 +785,7 @@ bool EditorNode::_find_and_save_resource(RES res,Map<RES,bool>& processed,int32_
if (changed || subchanged) {
//save
print_line("Also saving modified external resource: "+res->get_path());
- Error err = ResourceSaver::save(res->get_path(),res,flags);
+ ResourceSaver::save(res->get_path(),res,flags);
}
processed[res]=false; //because it's a file
@@ -4139,6 +4139,11 @@ void EditorNode::register_editor_types() {
//ObjectTypeDB::register_type<EditorImportExport>();
ObjectTypeDB::register_type<EditorSettings>();
ObjectTypeDB::register_type<EditorSpatialGizmo>();
+ ObjectTypeDB::register_type<EditorResourcePreview>();
+ ObjectTypeDB::register_type<EditorResourcePreviewGenerator>();
+ ObjectTypeDB::register_type<EditorFileSystem>();
+ ObjectTypeDB::register_type<EditorFileSystemDirectory>();
+
//ObjectTypeDB::register_type<EditorImporter>();
@@ -5414,9 +5419,9 @@ EditorNode::EditorNode() {
theme_base->add_child(gui_base);
gui_base->set_area_as_parent_rect();
- theme_base->set_theme( create_default_theme() );
- theme = create_editor_theme();
- gui_base->set_theme(theme);
+ Ref<Theme> theme = create_editor_theme();
+ theme_base->set_theme( theme );
+ gui_base->set_theme(create_custom_theme());
resource_preview = memnew( EditorResourcePreview );
add_child(resource_preview);
@@ -6679,45 +6684,54 @@ EditorNode::~EditorNode() {
void EditorPluginList::make_visible(bool p_visible) {
- if (!plugins_list.empty()) {
- for (int i = 0; i < plugins_list.size(); i++) {
- plugins_list[i]->make_visible(p_visible);
- }
+
+ for (int i = 0; i < plugins_list.size(); i++) {
+ plugins_list[i]->make_visible(p_visible);
}
+
}
void EditorPluginList::edit(Object* p_object) {
- if (!plugins_list.empty()) {
- for (int i = 0; i < plugins_list.size(); i++) {
- plugins_list[i]->edit(p_object);
- }
+
+ for (int i = 0; i < plugins_list.size(); i++) {
+ plugins_list[i]->edit(p_object);
}
+
}
-bool EditorPluginList::forward_input_event(const InputEvent& p_event) {
+bool EditorPluginList::forward_input_event(const Matrix32& p_canvas_xform,const InputEvent& p_event) {
+
bool discard = false;
- if (!plugins_list.empty()) {
- for (int i = 0; i < plugins_list.size(); i++) {
- if (plugins_list[i]->forward_input_event(p_event)) {
- discard = true;
- }
+
+ for (int i = 0; i < plugins_list.size(); i++) {
+ if (plugins_list[i]->forward_canvas_input_event(p_canvas_xform,p_event)) {
+ discard = true;
}
}
+
return discard;
}
bool EditorPluginList::forward_spatial_input_event(Camera* p_camera, const InputEvent& p_event) {
bool discard = false;
- if (!plugins_list.empty()) {
- for (int i = 0; i < plugins_list.size(); i++) {
- if (plugins_list[i]->forward_spatial_input_event(p_camera, p_event)) {
- discard = true;
- }
+
+ for (int i = 0; i < plugins_list.size(); i++) {
+ if (plugins_list[i]->forward_spatial_input_event(p_camera, p_event)) {
+ discard = true;
}
}
+
return discard;
}
+void EditorPluginList::forward_draw_over_canvas(const Matrix32& p_canvas_xform,Control* p_canvas) {
+
+ for (int i = 0; i < plugins_list.size(); i++) {
+ plugins_list[i]->forward_draw_over_canvas(p_canvas_xform,p_canvas);
+ }
+
+}
+
bool EditorPluginList::empty() {
return plugins_list.empty();
}
diff --git a/tools/editor/editor_node.h b/tools/editor/editor_node.h
index e6119cf577..147a0fd6ed 100644
--- a/tools/editor/editor_node.h
+++ b/tools/editor/editor_node.h
@@ -780,8 +780,9 @@ public:
void make_visible(bool p_visible);
void edit(Object *p_object);
- bool forward_input_event(const InputEvent& p_event);
+ bool forward_input_event(const Matrix32& p_canvas_xform,const InputEvent& p_event);
bool forward_spatial_input_event(Camera* p_camera, const InputEvent& p_event);
+ void forward_draw_over_canvas(const Matrix32& p_canvas_xform,Control* p_canvas);
void clear();
bool empty();
diff --git a/tools/editor/editor_plugin.cpp b/tools/editor/editor_plugin.cpp
index 5e671549ef..55f0e52c88 100644
--- a/tools/editor/editor_plugin.cpp
+++ b/tools/editor/editor_plugin.cpp
@@ -32,6 +32,7 @@
#include "plugins/spatial_editor_plugin.h"
#include "tools/editor/editor_node.h"
#include "tools/editor/editor_settings.h"
+#include "editor_resource_preview.h"
void EditorPlugin::add_custom_type(const String& p_type, const String& p_base,const Ref<Script>& p_script, const Ref<Texture>& p_icon) {
@@ -130,13 +131,25 @@ Ref<SpatialEditorGizmo> EditorPlugin::create_spatial_gizmo(Spatial* p_spatial) {
return Ref<SpatialEditorGizmo>();
}
-bool EditorPlugin::forward_input_event(const InputEvent& p_event) {
+bool EditorPlugin::forward_canvas_input_event(const Matrix32& p_canvas_xform,const InputEvent& p_event) {
- if (get_script_instance() && get_script_instance()->has_method("forward_input_event")) {
- return get_script_instance()->call("forward_input_event",p_event);
+ if (get_script_instance() && get_script_instance()->has_method("forward_canvas_input_event")) {
+ return get_script_instance()->call("forward_canvas_input_event",p_canvas_xform,p_event);
}
return false;
}
+
+void EditorPlugin::forward_draw_over_canvas(const Matrix32& p_canvas_xform,Control *p_canvas) {
+
+ if (get_script_instance() && get_script_instance()->has_method("forward_draw_over_canvas")) {
+ get_script_instance()->call("forward_draw_over_canvas",p_canvas_xform,p_canvas);
+ }
+}
+
+void EditorPlugin::update_canvas() {
+ CanvasItemEditor::get_singleton()->get_viewport_control()->update();
+}
+
bool EditorPlugin::forward_spatial_input_event(Camera* p_camera,const InputEvent& p_event) {
if (get_script_instance() && get_script_instance()->has_method("forward_spatial_input_event")) {
@@ -272,6 +285,10 @@ EditorSettings *EditorPlugin::get_editor_settings() {
return EditorSettings::get_singleton();
}
+EditorResourcePreview *EditorPlugin::get_resource_previewer() {
+ return EditorResourcePreview::get_singleton();
+}
+
void EditorPlugin::add_import_plugin(const Ref<EditorImportPlugin>& p_editor_import) {
EditorNode::get_singleton()->add_editor_import_plugin(p_editor_import);
@@ -298,6 +315,14 @@ Control *EditorPlugin::get_base_control() {
return EditorNode::get_singleton()->get_gui_base();
}
+void EditorPlugin::inspect_object(Object *p_obj,const String& p_for_property) {
+
+ EditorNode::get_singleton()->push_item(p_obj,p_for_property);
+}
+
+EditorFileSystem *EditorPlugin::get_resource_file_system() {
+ return EditorFileSystem::get_singleton();
+}
void EditorPlugin::_bind_methods() {
@@ -315,6 +340,11 @@ void EditorPlugin::_bind_methods() {
ObjectTypeDB::bind_method(_MD("add_export_plugin","plugin:EditorExportPlugin"),&EditorPlugin::add_export_plugin);
ObjectTypeDB::bind_method(_MD("remove_export_plugin","plugin:EditorExportPlugin"),&EditorPlugin::remove_export_plugin);
+ ObjectTypeDB::bind_method(_MD("get_resource_previewer:EditorResourcePreview"),&EditorPlugin::get_resource_previewer);
+ ObjectTypeDB::bind_method(_MD("get_resource_filesystem:EditorFileSystem"),&EditorPlugin::get_resource_file_system);
+
+ ObjectTypeDB::bind_method(_MD("inspect_object","object","for_property"),&EditorPlugin::inspect_object,DEFVAL(String()));
+ ObjectTypeDB::bind_method(_MD("update_canvas"),&EditorPlugin::update_canvas);
ObjectTypeDB::bind_method(_MD("get_base_control:Control"),&EditorPlugin::get_base_control);
ObjectTypeDB::bind_method(_MD("get_undo_redo:UndoRedo"),&EditorPlugin::_get_undo_redo);
@@ -322,7 +352,8 @@ void EditorPlugin::_bind_methods() {
ObjectTypeDB::bind_method(_MD("get_editor_settings:EditorSettings"),&EditorPlugin::get_editor_settings);
ObjectTypeDB::bind_method(_MD("queue_save_layout"),&EditorPlugin::queue_save_layout);
- ObjectTypeDB::add_virtual_method(get_type_static(),MethodInfo(Variant::BOOL,"forward_input_event",PropertyInfo(Variant::INPUT_EVENT,"event")));
+ ObjectTypeDB::add_virtual_method(get_type_static(),MethodInfo(Variant::BOOL,"forward_canvas_input_event",PropertyInfo(Variant::MATRIX32,"canvas_xform"),PropertyInfo(Variant::INPUT_EVENT,"event")));
+ ObjectTypeDB::add_virtual_method(get_type_static(),MethodInfo("forward_draw_over_canvas",PropertyInfo(Variant::MATRIX32,"canvas_xform"),PropertyInfo(Variant::OBJECT,"canvas:Control")));
ObjectTypeDB::add_virtual_method(get_type_static(),MethodInfo(Variant::BOOL,"forward_spatial_input_event",PropertyInfo(Variant::OBJECT,"camera",PROPERTY_HINT_RESOURCE_TYPE,"Camera"),PropertyInfo(Variant::INPUT_EVENT,"event")));
MethodInfo gizmo = MethodInfo(Variant::OBJECT,"create_spatial_gizmo",PropertyInfo(Variant::OBJECT,"for_spatial:Spatial"));
gizmo.return_val.hint=PROPERTY_HINT_RESOURCE_TYPE;
diff --git a/tools/editor/editor_plugin.h b/tools/editor/editor_plugin.h
index 9a9c32357d..5b944cc27a 100644
--- a/tools/editor/editor_plugin.h
+++ b/tools/editor/editor_plugin.h
@@ -34,6 +34,7 @@
#include "scene/resources/texture.h"
#include "undo_redo.h"
#include "io/config_file.h"
+
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
@@ -47,6 +48,8 @@ class EditorSettings;
class SpatialEditorGizmo;
class EditorImportPlugin;
class EditorExportPlugin;
+class EditorResourcePreview;
+class EditorFileSystem;
class EditorPlugin : public Node {
@@ -99,7 +102,8 @@ public:
void remove_control_from_bottom_panel(Control *p_control);
virtual Ref<SpatialEditorGizmo> create_spatial_gizmo(Spatial* p_spatial);
- virtual bool forward_input_event(const InputEvent& p_event);
+ virtual bool forward_canvas_input_event(const Matrix32& p_canvas_xform, const InputEvent& p_event);
+ virtual void forward_draw_over_canvas(const Matrix32& p_canvas_xform,Control *p_canvas);
virtual bool forward_spatial_input_event(Camera* p_camera,const InputEvent& p_event);
virtual String get_name() const;
virtual bool has_main_screen() const;
@@ -116,7 +120,11 @@ public:
virtual bool get_remove_list(List<Node*> *p_list);
virtual void set_window_layout(Ref<ConfigFile> p_layout);
virtual void get_window_layout(Ref<ConfigFile> p_layout);
- virtual void edited_scene_changed(){}; // if changes are pending in editor, apply them
+ virtual void edited_scene_changed(){} // if changes are pending in editor, apply them
+
+ void update_canvas();
+
+ virtual void inspect_object(Object *p_obj,const String& p_for_property=String());
void queue_save_layout() const;
@@ -131,6 +139,8 @@ public:
EditorSelection* get_selection();
//EditorImportExport *get_import_export();
EditorSettings *get_editor_settings();
+ EditorResourcePreview *get_resource_previewer();
+ EditorFileSystem *get_resource_file_system();
virtual void restore_global_state();
virtual void save_global_state();
diff --git a/tools/editor/editor_resource_preview.cpp b/tools/editor/editor_resource_preview.cpp
index a02fe2a531..6afc3e2a34 100644
--- a/tools/editor/editor_resource_preview.cpp
+++ b/tools/editor/editor_resource_preview.cpp
@@ -35,14 +35,46 @@
#include "editor_scale.h"
#include "message_queue.h"
+bool EditorResourcePreviewGenerator::handles(const String& p_type) const {
+
+ if (get_script_instance() && get_script_instance()->has_method("handles")) {
+ return get_script_instance()->call("handles",p_type);
+ }
+ ERR_EXPLAIN("EditorResourcePreviewGenerator::handles needs to be overriden");
+ ERR_FAIL_V(false);
+}
+Ref<Texture> EditorResourcePreviewGenerator::generate(const RES& p_from){
+
+ if (get_script_instance() && get_script_instance()->has_method("generate")) {
+ return get_script_instance()->call("generate",p_from);
+ }
+ ERR_EXPLAIN("EditorResourcePreviewGenerator::generate needs to be overriden");
+ ERR_FAIL_V(Ref<Texture>());
+
+}
+
+
Ref<Texture> EditorResourcePreviewGenerator::generate_from_path(const String& p_path) {
+ if (get_script_instance() && get_script_instance()->has_method("generate_from_path")) {
+ return get_script_instance()->call("generate_from_path",p_path);
+ }
+
RES res = ResourceLoader::load(p_path);
if (!res.is_valid())
return res;
return generate(res);
}
+
+void EditorResourcePreviewGenerator::_bind_methods() {
+
+ ObjectTypeDB::add_virtual_method(get_type_static(),MethodInfo(Variant::BOOL,"handles",PropertyInfo(Variant::STRING,"type")));
+ ObjectTypeDB::add_virtual_method(get_type_static(),MethodInfo(Variant::OBJECT,"generate:Texture",PropertyInfo(Variant::OBJECT,"from",PROPERTY_HINT_RESOURCE_TYPE,"Resource")));
+ ObjectTypeDB::add_virtual_method(get_type_static(),MethodInfo(Variant::OBJECT,"generate_from_path:Texture",PropertyInfo(Variant::STRING,"path",PROPERTY_HINT_FILE)));
+
+}
+
EditorResourcePreviewGenerator::EditorResourcePreviewGenerator() {
@@ -330,6 +362,11 @@ void EditorResourcePreview::add_preview_generator(const Ref<EditorResourcePrevie
preview_generators.push_back(p_generator);
}
+void EditorResourcePreview::remove_preview_generator(const Ref<EditorResourcePreviewGenerator>& p_generator) {
+
+ preview_generators.erase(p_generator);
+}
+
EditorResourcePreview* EditorResourcePreview::get_singleton() {
return singleton;
@@ -338,6 +375,11 @@ EditorResourcePreview* EditorResourcePreview::get_singleton() {
void EditorResourcePreview::_bind_methods() {
ObjectTypeDB::bind_method("_preview_ready",&EditorResourcePreview::_preview_ready);
+
+ ObjectTypeDB::bind_method(_MD("queue_resource_preview","path","receiver","receiver_func","userdata:Variant"),&EditorResourcePreview::queue_resource_preview);
+ ObjectTypeDB::bind_method(_MD("queue_edited_resource_preview","resource:Resource","receiver","receiver_func","userdata:Variant"),&EditorResourcePreview::queue_edited_resource_preview);
+ ObjectTypeDB::bind_method(_MD("add_preview_generator","generator:EditorResourcePreviewGenerator"),&EditorResourcePreview::add_preview_generator);
+ ObjectTypeDB::bind_method(_MD("remove_preview_generator","generator:EditorResourcePreviewGenerator"),&EditorResourcePreview::remove_preview_generator);
ObjectTypeDB::bind_method(_MD("check_for_invalidation","path"),&EditorResourcePreview::check_for_invalidation);
diff --git a/tools/editor/editor_resource_preview.h b/tools/editor/editor_resource_preview.h
index 51a00965eb..2756360130 100644
--- a/tools/editor/editor_resource_preview.h
+++ b/tools/editor/editor_resource_preview.h
@@ -57,10 +57,13 @@ class EditorResourcePreviewGenerator : public Reference {
OBJ_TYPE(EditorResourcePreviewGenerator,Reference );
+protected:
+
+ static void _bind_methods();
public:
- virtual bool handles(const String& p_type) const=0;
- virtual Ref<Texture> generate(const RES& p_from)=0;
+ virtual bool handles(const String& p_type) const;
+ virtual Ref<Texture> generate(const RES& p_from);
virtual Ref<Texture> generate_from_path(const String& p_path);
EditorResourcePreviewGenerator();
@@ -121,6 +124,7 @@ public:
void queue_edited_resource_preview(const Ref<Resource>& p_path, Object* p_receiver, const StringName& p_receiver_func, const Variant& p_userdata);
void add_preview_generator(const Ref<EditorResourcePreviewGenerator>& p_generator);
+ void remove_preview_generator(const Ref<EditorResourcePreviewGenerator>& p_generator);
void check_for_invalidation(const String& p_path);
EditorResourcePreview();
diff --git a/tools/editor/editor_themes.cpp b/tools/editor/editor_themes.cpp
index 7130044490..80ba4c46e0 100644
--- a/tools/editor/editor_themes.cpp
+++ b/tools/editor/editor_themes.cpp
@@ -33,7 +33,7 @@
#include "editor_settings.h"
#include "core/io/resource_loader.h"
-Ref<Theme> create_default_theme()
+Ref<Theme> create_editor_theme()
{
Ref<Theme> theme = Ref<Theme>( memnew( Theme ) );
@@ -57,23 +57,22 @@ Ref<Theme> create_default_theme()
return theme;
}
-Ref<Theme> create_editor_theme()
+Ref<Theme> create_custom_theme()
{
- Ref<Theme> theme = NULL;
+ Ref<Theme> theme;
String custom_theme = EditorSettings::get_singleton()->get("global/custom_theme");
if (custom_theme!="") {
theme = ResourceLoader::load(custom_theme);
}
- if (theme.is_null() || !theme.is_valid()) {
- theme = create_default_theme();
- }
-
String global_font = EditorSettings::get_singleton()->get("global/custom_font");
if (global_font!="") {
Ref<Font> fnt = ResourceLoader::load(global_font);
if (fnt.is_valid()) {
+ if (!theme.is_valid()) {
+ theme.instance();
+ }
theme->set_default_theme_font(fnt);
}
}
diff --git a/tools/editor/editor_themes.h b/tools/editor/editor_themes.h
index dbff8b3079..db49801600 100644
--- a/tools/editor/editor_themes.h
+++ b/tools/editor/editor_themes.h
@@ -31,8 +31,8 @@
#include "scene/resources/theme.h"
-Ref<Theme> create_default_theme();
-
Ref<Theme> create_editor_theme();
+Ref<Theme> create_custom_theme();
+
#endif
diff --git a/tools/editor/icons/2x/icon_remote_transform.png b/tools/editor/icons/2x/icon_remote_transform.png
new file mode 100644
index 0000000000..9ee66bc70c
--- /dev/null
+++ b/tools/editor/icons/2x/icon_remote_transform.png
Binary files differ
diff --git a/tools/editor/icons/icon_color_frame.png b/tools/editor/icons/icon_color_frame.png
new file mode 100644
index 0000000000..a82eefc10a
--- /dev/null
+++ b/tools/editor/icons/icon_color_frame.png
Binary files differ
diff --git a/tools/editor/icons/icon_remote_transform.png b/tools/editor/icons/icon_remote_transform.png
new file mode 100644
index 0000000000..deff925b53
--- /dev/null
+++ b/tools/editor/icons/icon_remote_transform.png
Binary files differ
diff --git a/tools/editor/icons/source/icon_remote_transform.svg b/tools/editor/icons/source/icon_remote_transform.svg
new file mode 100644
index 0000000000..fbbfacf629
--- /dev/null
+++ b/tools/editor/icons/source/icon_remote_transform.svg
@@ -0,0 +1,124 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="16"
+ viewBox="0 0 16 16"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.91 r13725"
+ inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_node_2d.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90"
+ sodipodi:docname="icon_remote_transform.svg">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="16"
+ inkscape:cx="7.0691739"
+ inkscape:cy="9.3738931"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ units="px"
+ inkscape:snap-bbox="true"
+ inkscape:bbox-paths="true"
+ inkscape:bbox-nodes="true"
+ inkscape:snap-bbox-edge-midpoints="true"
+ inkscape:snap-bbox-midpoints="true"
+ inkscape:snap-object-midpoints="true"
+ inkscape:snap-center="true"
+ inkscape:window-width="1680"
+ inkscape:window-height="1050"
+ inkscape:window-x="1366"
+ inkscape:window-y="0"
+ inkscape:window-maximized="1"
+ inkscape:object-paths="true"
+ inkscape:snap-intersection-paths="true"
+ inkscape:object-nodes="true"
+ inkscape:snap-smooth-nodes="true">
+ <inkscape:grid
+ type="xygrid"
+ id="grid3336"
+ empspacing="4" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-1036.3622)">
+ <path
+ style="opacity:1;fill:#fc9c9c;fill-opacity:0.99607843;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="path4155"
+ sodipodi:type="arc"
+ sodipodi:cx="744.13245"
+ sodipodi:cy="734.23291"
+ sodipodi:rx="4"
+ sodipodi:ry="4"
+ sodipodi:start="0"
+ sodipodi:end="3.1415927"
+ d="m 748.13245,734.23291 a 4,4 0 0 1 -2,3.4641 4,4 0 0 1 -4,0 4,4 0 0 1 -2,-3.4641 l 4,0 z"
+ inkscape:transform-center-y="0.58575321"
+ transform="matrix(0.70710678,0.70710678,-0.70710678,0.70710678,0,0)"
+ inkscape:transform-center-x="0.58575732" />
+ <circle
+ style="opacity:1;fill:#fc9c9c;fill-opacity:0.99607843;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="path4159"
+ cx="7"
+ cy="1045.3622"
+ r="1" />
+ <path
+ style="opacity:1;fill:#fc9c9c;fill-opacity:0.99607843;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ d="m 13.242641,1039.1196 a 6.0000172,6.0000172 0 0 0 -8.4852817,0 l 0.7071068,0.7071 a 5.0000172,5.0000172 0 0 1 7.0710679,0 5.0000172,5.0000172 0 0 1 0,7.071 l 0.707107,0.7071 a 6.0000172,6.0000172 0 0 0 0,-8.4852 z"
+ id="circle4163"
+ inkscape:connector-curvature="0"
+ inkscape:transform-center-y="-0.87867618"
+ inkscape:transform-center-x="-0.8786559" />
+ <path
+ style="opacity:1;fill:#fc9c9c;fill-opacity:0.99607843;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ d="m 11.828427,1040.5338 a 4.0000172,4.0000172 0 0 0 -5.6568541,0 l 0.7071068,0.7071 a 3.0000174,3.0000174 0 0 1 4.2426403,0 3.0000174,3.0000174 0 0 1 0,4.2426 l 0.707107,0.7071 a 4.0000172,4.0000172 0 0 0 0,-5.6568 z"
+ id="circle4168"
+ inkscape:connector-curvature="0"
+ inkscape:transform-center-y="-0.58578284"
+ inkscape:transform-center-x="-0.58576926" />
+ <path
+ style="opacity:1;fill:#fc9c9c;fill-opacity:0.99607843;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ d="m 10.414214,1041.948 a 2,2 0 0 0 -2.8284276,0 l 0.7071068,0.7071 a 1.0000174,1.0000174 0 0 1 1.4142136,0 1.0000174,1.0000174 0 0 1 0,1.4142 l 0.7071072,0.7071 a 2,2 0 0 0 0,-2.8284 z"
+ id="circle4172"
+ inkscape:connector-curvature="0"
+ inkscape:transform-center-y="-0.29289334"
+ inkscape:transform-center-x="-0.29288664" />
+ <path
+ style="fill:#fc9c9c;fill-opacity:0.99607843;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 1,1051.3622 4,-5 1,0 0,5 z"
+ id="path4181"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="ccccc" />
+ </g>
+</svg>
diff --git a/tools/editor/io_plugins/editor_bitmask_import_plugin.cpp b/tools/editor/io_plugins/editor_bitmask_import_plugin.cpp
index dca7d011ff..757d2ed5d4 100644
--- a/tools/editor/io_plugins/editor_bitmask_import_plugin.cpp
+++ b/tools/editor/io_plugins/editor_bitmask_import_plugin.cpp
@@ -147,7 +147,7 @@ public:
dst = dst.plus_file(bitmasks[i].get_file().basename() + ".pbm");
- Error err = plugin->import(dst, imd);
+ plugin->import(dst, imd);
}
hide();
diff --git a/tools/editor/io_plugins/editor_sample_import_plugin.cpp b/tools/editor/io_plugins/editor_sample_import_plugin.cpp
index ac0795f522..7dc74e58dd 100644
--- a/tools/editor/io_plugins/editor_sample_import_plugin.cpp
+++ b/tools/editor/io_plugins/editor_sample_import_plugin.cpp
@@ -298,7 +298,7 @@ public:
dst = dst.plus_file(samples[i].get_file().basename()+".smp");
- Error err = plugin->import(dst,imd);
+ plugin->import(dst,imd);
}
hide();
diff --git a/tools/editor/io_plugins/editor_scene_import_plugin.cpp b/tools/editor/io_plugins/editor_scene_import_plugin.cpp
index fa62283e37..190b56faba 100644
--- a/tools/editor/io_plugins/editor_scene_import_plugin.cpp
+++ b/tools/editor/io_plugins/editor_scene_import_plugin.cpp
@@ -1447,6 +1447,7 @@ void EditorSceneImportPlugin::_find_resources(const Variant& p_var, Map<Ref<Imag
}
} break;
+ default: {}
}
@@ -2325,7 +2326,7 @@ void EditorSceneImportPlugin::_filter_tracks(Node *scene, const String& p_text)
if (!scene->has_node(String("AnimationPlayer")))
return;
- Node* n = scene->get_node(String("AnimationPlayer"));
+ Node* n = scene->get_node(String("AnimationPlayer"));
ERR_FAIL_COND(!n);
AnimationPlayer *anim = n->cast_to<AnimationPlayer>();
ERR_FAIL_COND(!anim);
@@ -2443,7 +2444,7 @@ void EditorSceneImportPlugin::_optimize_animations(Node *scene, float p_max_lin_
if (!scene->has_node(String("AnimationPlayer")))
return;
- Node* n = scene->get_node(String("AnimationPlayer"));
+ Node* n = scene->get_node(String("AnimationPlayer"));
ERR_FAIL_COND(!n);
AnimationPlayer *anim = n->cast_to<AnimationPlayer>();
ERR_FAIL_COND(!anim);
@@ -2842,7 +2843,7 @@ Error EditorSceneImportPlugin::import2(Node *scene, const String& p_dest_path, c
}
}
- Error err = EditorTextureImportPlugin::get_singleton()->import(target_path,imd);
+ EditorTextureImportPlugin::get_singleton()->import(target_path,imd);
}
}
diff --git a/tools/editor/plugins/baked_light_baker.cpp b/tools/editor/plugins/baked_light_baker.cpp
index a2e94e8855..f43bec1cd3 100644
--- a/tools/editor/plugins/baked_light_baker.cpp
+++ b/tools/editor/plugins/baked_light_baker.cpp
@@ -1177,8 +1177,6 @@ float BakedLightBaker::_throw_ray(ThreadStack& thread_stack,bool p_bake_direct,c
diffuse_at_point.g=res_light.g*diffuse_at_point.g;
diffuse_at_point.b=res_light.b*diffuse_at_point.b;
- float ret=1e6;
-
if (p_bounces>0) {
@@ -1220,7 +1218,7 @@ float BakedLightBaker::_throw_ray(ThreadStack& thread_stack,bool p_bake_direct,c
#endif
- ret=_throw_ray(thread_stack,p_bake_direct,r_point,r_point+rn*p_rest,p_rest,diffuse_at_point,p_att_curve,p_att_pos,p_att_curve_len,p_bounces-1);
+ _throw_ray(thread_stack,p_bake_direct,r_point,r_point+rn*p_rest,p_rest,diffuse_at_point,p_att_curve,p_att_pos,p_att_curve_len,p_bounces-1);
}
if (use_specular && (specular_at_point.r>CMP_EPSILON || specular_at_point.g>CMP_EPSILON || specular_at_point.b>CMP_EPSILON)) {
diff --git a/tools/editor/plugins/canvas_item_editor_plugin.cpp b/tools/editor/plugins/canvas_item_editor_plugin.cpp
index 3468f42a6c..b0e002ba44 100644
--- a/tools/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/tools/editor/plugins/canvas_item_editor_plugin.cpp
@@ -1058,7 +1058,7 @@ void CanvasItemEditor::_viewport_input_event(const InputEvent& p_event) {
EditorPluginList *over_plugin_list = en->get_editor_plugins_over();
if (!over_plugin_list->empty()) {
- bool discard = over_plugin_list->forward_input_event(p_event);
+ bool discard = over_plugin_list->forward_input_event(transform,p_event);
if (discard) {
accept_event();
return;
@@ -2090,6 +2090,18 @@ void CanvasItemEditor::_viewport_draw() {
}
+ {
+
+ EditorNode *en = editor;
+ EditorPluginList *over_plugin_list = en->get_editor_plugins_over();
+
+ if (!over_plugin_list->empty()) {
+
+ over_plugin_list->forward_draw_over_canvas(transform,viewport);
+
+ }
+ }
+
if (skeleton_show_bones) {
int bone_width = EditorSettings::get_singleton()->get("2d_editor/bone_width");
Color bone_color1 = EditorSettings::get_singleton()->get("2d_editor/bone_color1");
diff --git a/tools/editor/plugins/collision_polygon_2d_editor_plugin.h b/tools/editor/plugins/collision_polygon_2d_editor_plugin.h
index 982ba35fe8..431d3651c1 100644
--- a/tools/editor/plugins/collision_polygon_2d_editor_plugin.h
+++ b/tools/editor/plugins/collision_polygon_2d_editor_plugin.h
@@ -95,7 +95,7 @@ class CollisionPolygon2DEditorPlugin : public EditorPlugin {
public:
- virtual bool forward_input_event(const InputEvent& p_event) { return collision_polygon_editor->forward_input_event(p_event); }
+ virtual bool forward_canvas_input_event(const Matrix32& p_canvas_xform,const InputEvent& p_event) { return collision_polygon_editor->forward_input_event(p_event); }
virtual String get_name() const { return "CollisionPolygon2D"; }
bool has_main_screen() const { return false; }
diff --git a/tools/editor/plugins/collision_shape_2d_editor_plugin.h b/tools/editor/plugins/collision_shape_2d_editor_plugin.h
index 1ee81eda43..a8930dc0f2 100644
--- a/tools/editor/plugins/collision_shape_2d_editor_plugin.h
+++ b/tools/editor/plugins/collision_shape_2d_editor_plugin.h
@@ -86,7 +86,7 @@ class CollisionShape2DEditorPlugin : public EditorPlugin {
EditorNode* editor;
public:
- virtual bool forward_input_event(const InputEvent& p_event) { return collision_shape_2d_editor->forward_input_event(p_event); }
+ virtual bool forward_canvas_input_event(const Matrix32& p_canvas_xform,const InputEvent& p_event) { return collision_shape_2d_editor->forward_input_event(p_event); }
virtual String get_name() const { return "CollisionShape2D"; }
bool has_main_screen() const { return false; }
diff --git a/tools/editor/plugins/light_occluder_2d_editor_plugin.h b/tools/editor/plugins/light_occluder_2d_editor_plugin.h
index b570fff506..0176eb87dd 100644
--- a/tools/editor/plugins/light_occluder_2d_editor_plugin.h
+++ b/tools/editor/plugins/light_occluder_2d_editor_plugin.h
@@ -99,7 +99,7 @@ class LightOccluder2DEditorPlugin : public EditorPlugin {
public:
- virtual bool forward_input_event(const InputEvent& p_event) { return collision_polygon_editor->forward_input_event(p_event); }
+ virtual bool forward_canvas_input_event(const Matrix32& p_canvas_xform,const InputEvent& p_event) { return collision_polygon_editor->forward_input_event(p_event); }
virtual String get_name() const { return "LightOccluder2D"; }
bool has_main_screen() const { return false; }
diff --git a/tools/editor/plugins/navigation_polygon_editor_plugin.h b/tools/editor/plugins/navigation_polygon_editor_plugin.h
index 503b4c2662..defdebbec2 100644
--- a/tools/editor/plugins/navigation_polygon_editor_plugin.h
+++ b/tools/editor/plugins/navigation_polygon_editor_plugin.h
@@ -101,7 +101,7 @@ class NavigationPolygonEditorPlugin : public EditorPlugin {
public:
- virtual bool forward_input_event(const InputEvent& p_event) { return collision_polygon_editor->forward_input_event(p_event); }
+ virtual bool forward_canvas_input_event(const Matrix32& p_canvas_xform,const InputEvent& p_event) { return collision_polygon_editor->forward_input_event(p_event); }
virtual String get_name() const { return "NavigationPolygonInstance"; }
bool has_main_screen() const { return false; }
diff --git a/tools/editor/plugins/path_2d_editor_plugin.h b/tools/editor/plugins/path_2d_editor_plugin.h
index 973c17464e..acbc481e09 100644
--- a/tools/editor/plugins/path_2d_editor_plugin.h
+++ b/tools/editor/plugins/path_2d_editor_plugin.h
@@ -108,7 +108,7 @@ class Path2DEditorPlugin : public EditorPlugin {
public:
- virtual bool forward_input_event(const InputEvent& p_event) { return path2d_editor->forward_input_event(p_event); }
+ virtual bool forward_canvas_input_event(const Matrix32& p_canvas_xform,const InputEvent& p_event) { return path2d_editor->forward_input_event(p_event); }
virtual String get_name() const { return "Path2D"; }
bool has_main_screen() const { return false; }
diff --git a/tools/editor/plugins/polygon_2d_editor_plugin.h b/tools/editor/plugins/polygon_2d_editor_plugin.h
index d8b951ec44..33bae94340 100644
--- a/tools/editor/plugins/polygon_2d_editor_plugin.h
+++ b/tools/editor/plugins/polygon_2d_editor_plugin.h
@@ -151,7 +151,7 @@ class Polygon2DEditorPlugin : public EditorPlugin {
public:
- virtual bool forward_input_event(const InputEvent& p_event) { return collision_polygon_editor->forward_input_event(p_event); }
+ virtual bool forward_canvas_input_event(const Matrix32& p_canvas_xform,const InputEvent& p_event) { return collision_polygon_editor->forward_input_event(p_event); }
virtual String get_name() const { return "Polygon2D"; }
bool has_main_screen() const { return false; }
diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp
index 1f931fb492..77b4106473 100644
--- a/tools/editor/plugins/script_editor_plugin.cpp
+++ b/tools/editor/plugins/script_editor_plugin.cpp
@@ -480,6 +480,33 @@ void ScriptEditor::_close_docs_tab() {
}
+void ScriptEditor::_close_all_tabs() {
+
+ int child_count = tab_container->get_child_count();
+ for (int i = child_count-1; i>=0; i--) {
+
+ tab_container->set_current_tab(i);
+ ScriptEditorBase *se = tab_container->get_child(i)->cast_to<ScriptEditorBase>();
+
+ if (se) {
+
+ // Maybe there are unsaved changes
+ if (se->is_unsaved()) {
+ _ask_close_current_unsaved_tab(se);
+ continue;
+ }
+
+ }
+
+ _close_current_tab();
+ }
+
+}
+
+void ScriptEditor::_ask_close_current_unsaved_tab(ScriptEditorBase *current) {
+ erase_tab_confirm->set_text("Close and save changes?\n\""+current->get_name()+"\"");
+ erase_tab_confirm->popup_centered_minsize();
+}
void ScriptEditor::_resave_scripts(const String& p_str) {
@@ -831,8 +858,7 @@ void ScriptEditor::_menu_option(int p_option) {
case FILE_CLOSE: {
if (current->is_unsaved()) {
- erase_tab_confirm->set_text("Close and save changes?\n\""+current->get_name()+"\"");
- erase_tab_confirm->popup_centered_minsize();
+ _ask_close_current_unsaved_tab(current);
} else {
_close_current_tab();
}
@@ -840,6 +866,9 @@ void ScriptEditor::_menu_option(int p_option) {
case CLOSE_DOCS: {
_close_docs_tab();
} break;
+ case CLOSE_ALL: {
+ _close_all_tabs();
+ } break;
case DEBUG_NEXT: {
if (debugger)
@@ -913,6 +942,9 @@ void ScriptEditor::_menu_option(int p_option) {
case CLOSE_DOCS: {
_close_docs_tab();
} break;
+ case CLOSE_ALL: {
+ _close_all_tabs();
+ } break;
}
@@ -1481,6 +1513,7 @@ void ScriptEditor::edit(const Ref<Script>& p_script, bool p_grab_focus) {
}
ERR_FAIL_COND(!se);
tab_container->add_child(se);
+
se->set_edited_script(p_script);
se->set_tooltip_request_func("_get_debug_tooltip",this);
if (se->get_edit_menu()) {
@@ -1977,6 +2010,7 @@ void ScriptEditor::_bind_methods() {
ObjectTypeDB::bind_method("_menu_option",&ScriptEditor::_menu_option);
ObjectTypeDB::bind_method("_close_current_tab",&ScriptEditor::_close_current_tab);
ObjectTypeDB::bind_method("_close_docs_tab", &ScriptEditor::_close_docs_tab);
+ ObjectTypeDB::bind_method("_close_all_tabs", &ScriptEditor::_close_all_tabs);
ObjectTypeDB::bind_method("_editor_play",&ScriptEditor::_editor_play);
ObjectTypeDB::bind_method("_editor_pause",&ScriptEditor::_editor_pause);
ObjectTypeDB::bind_method("_editor_stop",&ScriptEditor::_editor_stop);
@@ -2057,8 +2091,8 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/reload_script_soft", TTR("Soft Reload Script"), KEY_MASK_CMD|KEY_MASK_SHIFT|KEY_R), FILE_TOOL_RELOAD_SOFT);
file_menu->get_popup()->add_separator();
- file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/history_previous", TTR("History Prev"), KEY_MASK_CTRL|KEY_MASK_ALT|KEY_LEFT), WINDOW_PREV);
- file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/history_next", TTR("History Next"), KEY_MASK_CTRL|KEY_MASK_ALT|KEY_RIGHT), WINDOW_NEXT);
+ file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/history_previous", TTR("History Prev"), KEY_MASK_ALT|KEY_LEFT), WINDOW_PREV);
+ file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/history_next", TTR("History Next"), KEY_MASK_ALT|KEY_RIGHT), WINDOW_NEXT);
file_menu->get_popup()->add_separator();
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/import_theme", TTR("Import Theme")), FILE_IMPORT_THEME);
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/reload_theme", TTR("Reload Theme")), FILE_RELOAD_THEME);
@@ -2067,6 +2101,7 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
file_menu->get_popup()->add_separator();
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/close_docs", TTR("Close Docs")), CLOSE_DOCS);
file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/close_file", TTR("Close"), KEY_MASK_CMD | KEY_W), FILE_CLOSE);
+ file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/close_all", TTR("Close All")), CLOSE_ALL);
file_menu->get_popup()->connect("item_pressed", this,"_menu_option");
diff --git a/tools/editor/plugins/script_editor_plugin.h b/tools/editor/plugins/script_editor_plugin.h
index 1a23ffed72..907240a352 100644
--- a/tools/editor/plugins/script_editor_plugin.h
+++ b/tools/editor/plugins/script_editor_plugin.h
@@ -133,6 +133,7 @@ class ScriptEditor : public VBoxContainer {
FILE_SAVE_THEME_AS,
FILE_CLOSE,
CLOSE_DOCS,
+ CLOSE_ALL,
FILE_TOOL_RELOAD,
FILE_TOOL_RELOAD_SOFT,
DEBUG_NEXT,
@@ -221,6 +222,9 @@ class ScriptEditor : public VBoxContainer {
void _close_current_tab();
void _close_docs_tab();
+ void _close_all_tabs();
+
+ void _ask_close_current_unsaved_tab(ScriptEditorBase *current);
bool grab_focus_block;
diff --git a/tools/editor/plugins/script_text_editor.cpp b/tools/editor/plugins/script_text_editor.cpp
index 57cf8cbea3..68b1042565 100644
--- a/tools/editor/plugins/script_text_editor.cpp
+++ b/tools/editor/plugins/script_text_editor.cpp
@@ -30,6 +30,7 @@
#include "tools/editor/editor_settings.h"
#include "os/keyboard.h"
#include "tools/editor/script_editor_debugger.h"
+#include "tools/editor/editor_node.h"
Vector<String> ScriptTextEditor::get_functions() {
@@ -920,6 +921,10 @@ void ScriptTextEditor::_bind_methods() {
ObjectTypeDB::bind_method("_edit_option",&ScriptTextEditor::_edit_option);
ObjectTypeDB::bind_method("_goto_line",&ScriptTextEditor::_goto_line);
+ ObjectTypeDB::bind_method("get_drag_data_fw",&ScriptTextEditor::get_drag_data_fw);
+ ObjectTypeDB::bind_method("can_drop_data_fw",&ScriptTextEditor::can_drop_data_fw);
+ ObjectTypeDB::bind_method("drop_data_fw",&ScriptTextEditor::drop_data_fw);
+
ADD_SIGNAL(MethodInfo("name_changed"));
ADD_SIGNAL(MethodInfo("request_help_search",PropertyInfo(Variant::STRING,"topic")));
}
@@ -957,6 +962,144 @@ void ScriptTextEditor::set_debugger_active(bool p_active) {
}
+
+Variant ScriptTextEditor::get_drag_data_fw(const Point2& p_point,Control* p_from) {
+
+ return Variant();
+}
+
+bool ScriptTextEditor::can_drop_data_fw(const Point2& p_point,const Variant& p_data,Control* p_from) const{
+
+ Dictionary d = p_data;
+ if (d.has("type") &&
+ (
+
+ String(d["type"])=="resource" ||
+ String(d["type"])=="files" ||
+ String(d["type"])=="nodes"
+ ) ) {
+
+
+ return true;
+ }
+
+
+ return false;
+
+}
+
+#ifdef TOOLS_ENABLED
+
+static Node* _find_script_node(Node* p_edited_scene,Node* p_current_node,const Ref<Script> &script) {
+
+ if (p_edited_scene!=p_current_node && p_current_node->get_owner()!=p_edited_scene)
+ return NULL;
+
+ Ref<Script> scr = p_current_node->get_script();
+
+ if (scr.is_valid() && scr==script)
+ return p_current_node;
+
+ for(int i=0;i<p_current_node->get_child_count();i++) {
+ Node *n = _find_script_node(p_edited_scene,p_current_node->get_child(i),script);
+ if (n)
+ return n;
+ }
+
+ return NULL;
+}
+
+#else
+
+static Node* _find_script_node(Node* p_edited_scene,Node* p_current_node,const Ref<Script> &script) {
+
+ return NULL;
+}
+#endif
+
+
+
+
+void ScriptTextEditor::drop_data_fw(const Point2& p_point,const Variant& p_data,Control* p_from){
+
+ Dictionary d = p_data;
+
+ if (d.has("type") && String(d["type"])=="resource") {
+
+ Ref<Resource> res = d["resource"];
+ if (!res.is_valid()) {
+ return;
+ }
+
+ if (res->get_path().is_resource_file()) {
+ EditorNode::get_singleton()->show_warning("Only resources from filesystem can be dropped.");
+ return;
+ }
+
+ code_editor->get_text_edit()->insert_text_at_cursor(res->get_path());
+
+ }
+
+ if (d.has("type") && String(d["type"])=="files") {
+
+
+ Array files = d["files"];
+
+ String text_to_drop;
+ for(int i=0;i<files.size();i++) {
+
+ if (i>0)
+ text_to_drop+=",";
+ text_to_drop+="\""+String(files[i]).c_escape()+"\"";
+
+ }
+
+ code_editor->get_text_edit()->insert_text_at_cursor(text_to_drop);
+
+ }
+
+ if (d.has("type") && String(d["type"])=="nodes") {
+
+ Node* sn = _find_script_node(get_tree()->get_edited_scene_root(),get_tree()->get_edited_scene_root(),script);
+
+
+ if (!sn) {
+ EditorNode::get_singleton()->show_warning("Can't drop nodes because script '"+get_name()+"' is not used in this scene.");
+ return;
+ }
+
+
+ Array nodes = d["nodes"];
+ String text_to_drop;
+ for(int i=0;i<nodes.size();i++) {
+
+ if (i>0)
+ text_to_drop+=",";
+
+ NodePath np = nodes[i];
+ Node *node = get_node(np);
+ if (!node) {
+ continue;
+ }
+
+
+
+ String path = sn->get_path_to(node);
+ text_to_drop+="\""+path.c_escape()+"\"";
+
+
+ }
+
+ code_editor->get_text_edit()->insert_text_at_cursor(text_to_drop);
+
+
+ }
+
+
+
+}
+
+
ScriptTextEditor::ScriptTextEditor() {
code_editor = memnew( CodeTextEditor );
@@ -1039,6 +1182,9 @@ ScriptTextEditor::ScriptTextEditor() {
goto_line_dialog = memnew(GotoLineDialog);
add_child(goto_line_dialog);
+
+
+ code_editor->get_text_edit()->set_drag_forwarding(this);
}
static ScriptEditorBase * create_editor(const Ref<Script>& p_script) {
@@ -1060,8 +1206,8 @@ void ScriptTextEditor::register_editor() {
ED_SHORTCUT("script_text_editor/select_all", TTR("Select All"), KEY_MASK_CMD|KEY_A);
ED_SHORTCUT("script_text_editor/move_up", TTR("Move Up"), KEY_MASK_ALT|KEY_UP);
ED_SHORTCUT("script_text_editor/move_down", TTR("Move Down"), KEY_MASK_ALT|KEY_DOWN);
- ED_SHORTCUT("script_text_editor/indent_left", TTR("Indent Left"), KEY_MASK_ALT|KEY_LEFT);
- ED_SHORTCUT("script_text_editor/indent_right", TTR("Indent Right"), KEY_MASK_ALT|KEY_RIGHT);
+ ED_SHORTCUT("script_text_editor/indent_left", TTR("Indent Left"), 0);
+ ED_SHORTCUT("script_text_editor/indent_right", TTR("Indent Right"), 0);
ED_SHORTCUT("script_text_editor/toggle_comment", TTR("Toggle Comment"), KEY_MASK_CMD|KEY_K);
ED_SHORTCUT("script_text_editor/clone_down", TTR("Clone Down"), KEY_MASK_CMD|KEY_B);
#ifdef OSX_ENABLED
diff --git a/tools/editor/plugins/script_text_editor.h b/tools/editor/plugins/script_text_editor.h
index 247fd97e81..c311a21131 100644
--- a/tools/editor/plugins/script_text_editor.h
+++ b/tools/editor/plugins/script_text_editor.h
@@ -98,6 +98,11 @@ protected:
void _edit_option(int p_op);
void _goto_line(int p_line) { goto_line(p_line); }
+
+ 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);
+
public:
virtual void apply_code();
diff --git a/tools/editor/plugins/shader_graph_editor_plugin.cpp b/tools/editor/plugins/shader_graph_editor_plugin.cpp
index 815da48e96..aa66a2e0d9 100644
--- a/tools/editor/plugins/shader_graph_editor_plugin.cpp
+++ b/tools/editor/plugins/shader_graph_editor_plugin.cpp
@@ -901,6 +901,7 @@ void ShaderGraphView::_variant_edited() {
case Variant::COLOR:
v2=Color();
break;
+ default: {}
}
UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo();
ur->create_action(TTR("Change Default Value"));
@@ -1321,6 +1322,7 @@ void ShaderGraphView::_default_changed(int p_id, Node *p_button, int p_param, in
h=PROPERTY_HINT_COLOR_NO_ALPHA;
v=Color();
break;
+ default: {}
}
ped_popup->edit(NULL,"",vt,v,h,p_hint);
@@ -1347,6 +1349,8 @@ ToolButton *ShaderGraphView::make_label(String text, Variant::Type v_type) {
break;
case Variant::COLOR:
l->set_icon(ped_popup->get_icon("Color", "EditorIcons"));
+ break;
+ default: {}
}
return l;
}
@@ -1372,7 +1376,7 @@ ToolButton *ShaderGraphView::make_editor(String text,GraphNode* gn,int p_id,int
case Variant::TRANSFORM:
edit->set_icon(ped_popup->get_icon("Matrix", "EditorIcons"));
break;
- case Variant::COLOR:
+ case Variant::COLOR: {
Image icon_color = Image(15,15,false,Image::FORMAT_RGB);
Color c = graph->default_get_value(type,p_id,param);
for (int x=1;x<14;x++)
@@ -1382,7 +1386,8 @@ ToolButton *ShaderGraphView::make_editor(String text,GraphNode* gn,int p_id,int
t.instance();
t->create_from_image(icon_color);
edit->set_icon(t);
- break;
+ } break;
+ default: {}
}
return edit;
}
diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp
index 41956747e1..9701b8030d 100644
--- a/tools/editor/plugins/spatial_editor_plugin.cpp
+++ b/tools/editor/plugins/spatial_editor_plugin.cpp
@@ -3469,6 +3469,8 @@ void SpatialEditor::_unhandled_key_input(InputEvent p_event) {
if (!is_visible() || get_viewport()->gui_has_modal_stack())
return;
+#if 0
+//i don't remember this being used, why was it here?
{
EditorNode *en = editor;
@@ -3480,6 +3482,7 @@ void SpatialEditor::_unhandled_key_input(InputEvent p_event) {
}
}
+#endif
switch(p_event.type) {
diff --git a/tools/editor/plugins/tile_map_editor_plugin.h b/tools/editor/plugins/tile_map_editor_plugin.h
index 4b47dccd15..2f24002770 100644
--- a/tools/editor/plugins/tile_map_editor_plugin.h
+++ b/tools/editor/plugins/tile_map_editor_plugin.h
@@ -181,7 +181,7 @@ class TileMapEditorPlugin : public EditorPlugin {
public:
- virtual bool forward_input_event(const InputEvent& p_event) { return tile_map_editor->forward_input_event(p_event); }
+ virtual bool forward_canvas_input_event(const Matrix32& p_canvas_xform,const InputEvent& p_event) { return tile_map_editor->forward_input_event(p_event); }
virtual String get_name() const { return "TileMap"; }
bool has_main_screen() const { return false; }
diff --git a/tools/editor/project_manager.cpp b/tools/editor/project_manager.cpp
index 0c734436cd..b884e0d111 100644
--- a/tools/editor/project_manager.cpp
+++ b/tools/editor/project_manager.cpp
@@ -1196,7 +1196,7 @@ ProjectManager::ProjectManager() {
FileDialog::set_default_show_hidden_files(EditorSettings::get_singleton()->get("file_dialog/show_hidden_files"));
set_area_as_parent_rect();
- set_theme(create_default_theme());
+ set_theme(create_editor_theme());
gui_base = memnew( Control );
add_child(gui_base);
@@ -1389,7 +1389,7 @@ ProjectManager::ProjectManager() {
SceneTree::get_singleton()->connect("files_dropped", this, "_files_dropped");
- gui_base->set_theme(create_editor_theme());
+ gui_base->set_theme(create_custom_theme());
}
diff --git a/tools/editor/spatial_editor_gizmos.cpp b/tools/editor/spatial_editor_gizmos.cpp
index 480d33fd0a..84803eb6db 100644
--- a/tools/editor/spatial_editor_gizmos.cpp
+++ b/tools/editor/spatial_editor_gizmos.cpp
@@ -422,8 +422,6 @@ bool EditorSpatialGizmo::intersect_ray(const Camera *p_camera,const Point2& p_po
if (billboard_handle) {
t.set_look_at(t.origin,t.origin+p_camera->get_transform().basis.get_axis(2),p_camera->get_transform().basis.get_axis(1));
}
- Transform ti=t.affine_inverse();
-
float min_d=1e20;
int idx=-1;