summaryrefslogtreecommitdiff
path: root/tools/editor
diff options
context:
space:
mode:
Diffstat (limited to 'tools/editor')
-rw-r--r--tools/editor/animation_editor.cpp24
-rw-r--r--tools/editor/animation_editor.h2
-rw-r--r--tools/editor/asset_library_editor_plugin.cpp2
-rw-r--r--tools/editor/editor_data.cpp4
-rw-r--r--tools/editor/editor_file_dialog.cpp10
-rw-r--r--tools/editor/editor_file_system.cpp45
-rw-r--r--tools/editor/editor_node.cpp168
-rw-r--r--tools/editor/editor_node.h10
-rw-r--r--tools/editor/icons/icon_loop_interpolation.pngbin374 -> 0 bytes
-rw-r--r--tools/editor/io_plugins/editor_scene_import_plugin.cpp13
-rw-r--r--tools/editor/plugins/canvas_item_editor_plugin.cpp38
-rw-r--r--tools/editor/plugins/sprite_frames_editor_plugin.cpp63
-rw-r--r--tools/editor/plugins/texture_region_editor_plugin.cpp4
-rw-r--r--tools/editor/scene_tree_dock.cpp6
-rw-r--r--tools/editor/scene_tree_editor.cpp16
-rw-r--r--tools/editor/scenes_dock.cpp3
16 files changed, 314 insertions, 94 deletions
diff --git a/tools/editor/animation_editor.cpp b/tools/editor/animation_editor.cpp
index dd3c3fee32..7582162b72 100644
--- a/tools/editor/animation_editor.cpp
+++ b/tools/editor/animation_editor.cpp
@@ -2922,7 +2922,6 @@ void AnimationKeyEditor::_notification(int p_what) {
edit_button->connect("pressed",this,"_toggle_edit_curves");
loop->set_icon(get_icon("Loop","EditorIcons"));
- loop_interpolation->set_icon(get_icon("LoopInterpolation","EditorIcons"));
curve_edit->connect("transition_changed",this,"_curve_transition_changed");
//edit_button->add_color_override("font_color",get_color("font_color","Tree"));
@@ -3013,7 +3012,6 @@ void AnimationKeyEditor::_update_menu() {
length->set_val(animation->get_length());
loop->set_pressed(animation->has_loop());
- loop_interpolation->set_pressed(animation->has_loop_interpolation());
step->set_val(animation->get_step());
}
@@ -3469,21 +3467,6 @@ void AnimationKeyEditor::_animation_loop_changed() {
}
-void AnimationKeyEditor::_animation_loop_interpolation_changed() {
-
- if (updating)
- return;
-
- if (!animation.is_null()) {
-
- undo_redo->create_action(TTR("Change Anim Loop Interpolation"));
- undo_redo->add_do_method(animation.ptr(),"set_loop_interpolation",loop_interpolation->is_pressed());
- undo_redo->add_undo_method(animation.ptr(),"set_loop_interpolation",!loop_interpolation->is_pressed());
- undo_redo->commit_action();
- }
-
-}
-
void AnimationKeyEditor::_create_value_item(int p_type) {
@@ -3769,7 +3752,6 @@ void AnimationKeyEditor::_bind_methods() {
ObjectTypeDB::bind_method(_MD("_animation_loop_changed"),&AnimationKeyEditor::_animation_loop_changed);
- ObjectTypeDB::bind_method(_MD("_animation_loop_interpolation_changed"),&AnimationKeyEditor::_animation_loop_interpolation_changed);
ObjectTypeDB::bind_method(_MD("_animation_len_changed"),&AnimationKeyEditor::_animation_len_changed);
ObjectTypeDB::bind_method(_MD("_create_value_item"),&AnimationKeyEditor::_create_value_item);
ObjectTypeDB::bind_method(_MD("_pane_drag"),&AnimationKeyEditor::_pane_drag);
@@ -3880,12 +3862,6 @@ AnimationKeyEditor::AnimationKeyEditor() {
hb->add_child(loop);
loop->set_tooltip(TTR("Enable/Disable looping in animation."));
- loop_interpolation = memnew( ToolButton );
- loop_interpolation->set_toggle_mode(true);
- loop_interpolation->connect("pressed",this,"_animation_loop_interpolation_changed");
- hb->add_child(loop_interpolation);
- loop_interpolation->set_tooltip(TTR("Enable/Disable interpolation when looping animation."));
-
hb->add_child( memnew( VSeparator ) );
menu_add_track = memnew( MenuButton );
diff --git a/tools/editor/animation_editor.h b/tools/editor/animation_editor.h
index c8de1d87c1..413c73b4b9 100644
--- a/tools/editor/animation_editor.h
+++ b/tools/editor/animation_editor.h
@@ -173,7 +173,6 @@ class AnimationKeyEditor : public VBoxContainer {
//MenuButton *menu;
SpinBox *length;
Button *loop;
- Button *loop_interpolation;
bool keying;
ToolButton *edit_button;
ToolButton *move_up_button;
@@ -239,7 +238,6 @@ class AnimationKeyEditor : public VBoxContainer {
void _animation_len_changed(float p_len);
void _animation_loop_changed();
- void _animation_loop_interpolation_changed();
void _step_changed(float p_len);
struct InsertData {
diff --git a/tools/editor/asset_library_editor_plugin.cpp b/tools/editor/asset_library_editor_plugin.cpp
index a2448921d7..ee535310bc 100644
--- a/tools/editor/asset_library_editor_plugin.cpp
+++ b/tools/editor/asset_library_editor_plugin.cpp
@@ -1366,7 +1366,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) {
repository = memnew( OptionButton );
repository->add_item("Godot");
- repository->set_item_metadata(0, "http://godotengine.org/asset-library/api");
+ repository->set_item_metadata(0, "https://godotengine.org/asset-library/api");
repository->add_item("Localhost"); // TODO: Maybe remove?
repository->set_item_metadata(1, "http://127.0.0.1/asset-library/api");
repository->connect("item_selected",this,"_repository_changed");
diff --git a/tools/editor/editor_data.cpp b/tools/editor/editor_data.cpp
index 4c4fecdd83..0f10041034 100644
--- a/tools/editor/editor_data.cpp
+++ b/tools/editor/editor_data.cpp
@@ -565,6 +565,8 @@ bool EditorData::check_and_update_scene(int p_idx) {
bool must_reload = _find_updated_instances(edited_scene[p_idx].root,edited_scene[p_idx].root,checked_scenes);
+ print_line("MUST RELOAD? "+itos(must_reload));
+
if (must_reload) {
Ref<PackedScene> pscene;
pscene.instance();
@@ -762,6 +764,8 @@ Ref<ResourceImportMetadata> EditorData::get_edited_scene_import_metadata() const
return edited_scene[current_edited_scene].medatata;
}
+
+
void EditorData::clear_edited_scenes() {
for(int i=0;i<edited_scene.size();i++) {
diff --git a/tools/editor/editor_file_dialog.cpp b/tools/editor/editor_file_dialog.cpp
index e68a53659b..b8abd1d32c 100644
--- a/tools/editor/editor_file_dialog.cpp
+++ b/tools/editor/editor_file_dialog.cpp
@@ -144,11 +144,11 @@ void EditorFileDialog::_unhandled_input(const InputEvent& p_event) {
dir->grab_focus();
handled=true;
}
- if (ED_IS_SHORTCUT("file_dialog/mode_favorite_up", p_event)) {
+ if (ED_IS_SHORTCUT("file_dialog/move_favorite_up", p_event)) {
_favorite_move_up();
handled=true;
}
- if (ED_IS_SHORTCUT("file_dialog/mode_favorite_down", p_event)) {
+ if (ED_IS_SHORTCUT("file_dialog/move_favorite_down", p_event)) {
_favorite_move_down();
handled=true;
}
@@ -1290,14 +1290,14 @@ EditorFileDialog::EditorFileDialog() {
ED_SHORTCUT("file_dialog/go_back", TTR("Go Back"), KEY_MASK_ALT|KEY_LEFT);
ED_SHORTCUT("file_dialog/go_forward", TTR("Go Forward"), KEY_MASK_ALT|KEY_RIGHT);
ED_SHORTCUT("file_dialog/go_up", TTR("Go Up"), KEY_MASK_ALT|KEY_UP);
- ED_SHORTCUT("file_dialog/refresh", TTR("Refresh"), KEY_MASK_CMD|KEY_F5); // ctrl + f5 else it launches the game as well..
+ ED_SHORTCUT("file_dialog/refresh", TTR("Refresh"), KEY_F5);
ED_SHORTCUT("file_dialog/toggle_hidden_files", TTR("Toggle Hidden Files"), KEY_MASK_CMD|KEY_H);
ED_SHORTCUT("file_dialog/toggle_favorite", TTR("Toggle Favorite"), KEY_MASK_ALT|KEY_F);
ED_SHORTCUT("file_dialog/toggle_mode", TTR("Toggle Mode"), KEY_MASK_ALT|KEY_V);
ED_SHORTCUT("file_dialog/create_folder", TTR("Create Folder"), KEY_MASK_CMD|KEY_N);
ED_SHORTCUT("file_dialog/focus_path", TTR("Focus Path"), KEY_MASK_CMD|KEY_D);
- ED_SHORTCUT("file_dialog/mode_favorite_up", TTR("Mode Favorite Up"), KEY_MASK_CMD|KEY_UP);
- ED_SHORTCUT("file_dialog/mode_favorite_down", TTR("Mode Favorite Down"), KEY_MASK_CMD|KEY_DOWN);
+ ED_SHORTCUT("file_dialog/move_favorite_up", TTR("Move Favorite Up"), KEY_MASK_CMD|KEY_UP);
+ ED_SHORTCUT("file_dialog/move_favorite_down", TTR("Move Favorite Down"), KEY_MASK_CMD|KEY_DOWN);
HBoxContainer *pathhb = memnew( HBoxContainer );
diff --git a/tools/editor/editor_file_system.cpp b/tools/editor/editor_file_system.cpp
index c5c92b5228..1f414f80a0 100644
--- a/tools/editor/editor_file_system.cpp
+++ b/tools/editor/editor_file_system.cpp
@@ -621,31 +621,40 @@ void EditorFileSystem::_scan_new_dir(EditorFileSystemDirectory *p_dir,DirAccess
int total = dirs.size()+files.size();
int idx=0;
+
for (List<String>::Element *E=dirs.front();E;E=E->next(),idx++) {
if (da->change_dir(E->get())==OK) {
- EditorFileSystemDirectory *efd = memnew( EditorFileSystemDirectory );
+ String d = da->get_current_dir();
- efd->parent=p_dir;
- efd->name=E->get();
+ if (d==cd || !d.begins_with(cd)) {
+ da->change_dir(cd); //avoid recursion
+ } else {
- _scan_new_dir(efd,da,p_progress.get_sub(idx,total));
- int idx=0;
- for(int i=0;i<p_dir->subdirs.size();i++) {
+ EditorFileSystemDirectory *efd = memnew( EditorFileSystemDirectory );
- if (efd->name<p_dir->subdirs[i]->name)
- break;
- idx++;
- }
- if (idx==p_dir->subdirs.size()) {
- p_dir->subdirs.push_back(efd);
- } else {
- p_dir->subdirs.insert(idx,efd);
- }
+ efd->parent=p_dir;
+ efd->name=E->get();
+
+ _scan_new_dir(efd,da,p_progress.get_sub(idx,total));
+
+ int idx=0;
+ for(int i=0;i<p_dir->subdirs.size();i++) {
+
+ if (efd->name<p_dir->subdirs[i]->name)
+ break;
+ idx++;
+ }
+ if (idx==p_dir->subdirs.size()) {
+ p_dir->subdirs.push_back(efd);
+ } else {
+ p_dir->subdirs.insert(idx,efd);
+ }
- da->change_dir("..");
+ da->change_dir("..");
+ }
} else {
ERR_PRINTS(TTR("Cannot go into subdir:")+" "+E->get());
}
@@ -821,12 +830,10 @@ void EditorFileSystem::_scan_fs_changes(EditorFileSystemDirectory *p_dir,const S
}
}
+
da->list_dir_end();
memdelete(da);
-
-
-
}
for(int i=0;i<p_dir->files.size();i++) {
diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp
index f9bedc7660..2bba97251d 100644
--- a/tools/editor/editor_node.cpp
+++ b/tools/editor/editor_node.cpp
@@ -168,6 +168,10 @@ void EditorNode::_update_title() {
void EditorNode::_unhandled_input(const InputEvent& p_event) {
+ if (Node::get_viewport()->get_modal_stack_top())
+ return; //ignore because of modal window
+
+
if (p_event.type==InputEvent::KEY && p_event.key.pressed && !p_event.key.echo && !gui_base->get_viewport()->gui_has_modal_stack()) {
@@ -1161,7 +1165,11 @@ void EditorNode::_dialog_action(String p_file) {
load_scene(p_file);
} break;
+ case SETTINGS_PICK_MAIN_SCENE: {
+ Globals::get_singleton()->set("application/main_scene",p_file);
+ //would be nice to show the project manager opened with the hilighted field..
+ } break;
case FILE_SAVE_OPTIMIZED: {
@@ -1850,12 +1858,31 @@ void EditorNode::_run(bool p_current,const String& p_custom) {
current_option=-1;
//accept->get_cancel()->hide();
- accept->get_ok()->set_text(TTR("I see.."));
- accept->set_text(TTR("No main scene has ever been defined.\nSelect one from \"Project Settings\" under the 'application' category."));
- accept->popup_centered_minsize();
+ pick_main_scene->set_text(TTR("No main scene has ever been defined, select one?\nYou can change it later in later in \"Project Settings\" under the 'application' category."));
+ pick_main_scene->popup_centered_minsize();
return;
}
+ if (!FileAccess::exists(run_filename)) {
+
+ current_option=-1;
+ //accept->get_cancel()->hide();
+ pick_main_scene->set_text(vformat(TTR("Selected scene '%s' does not exist, select a valid one?\nYou can change it later in \"Project Settings\" under the 'application' category."), run_filename));
+ pick_main_scene->popup_centered_minsize();
+ return;
+
+ }
+
+ if (ResourceLoader::get_resource_type(run_filename)!="PackedScene") {
+
+ current_option=-1;
+ //accept->get_cancel()->hide();
+ pick_main_scene->set_text(vformat(TTR("Selected scene '%s' is not a scene file, select a valid one?\nYou can change it later in \"Project Settings\" under the 'application' category."), run_filename));
+ pick_main_scene->popup_centered_minsize();
+ return;
+
+ }
+
}
@@ -2769,6 +2796,30 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) {
file_templates->popup_centered_ratio();
} break;
+ case SETTINGS_PICK_MAIN_SCENE: {
+
+
+ //print_tree();
+ file->set_mode(EditorFileDialog::MODE_OPEN_FILE);
+ //not for now?
+ List<String> extensions;
+ ResourceLoader::get_recognized_extensions_for_type("PackedScene",&extensions);
+ file->clear_filters();
+ for(int i=0;i<extensions.size();i++) {
+
+ file->add_filter("*."+extensions[i]+" ; "+extensions[i].to_upper());
+ }
+
+
+ //file->set_current_path(current_path);
+ Node *scene = editor_data.get_edited_scene_root();
+ if (scene) {
+ file->set_current_path(scene->get_filename());
+ };
+ file->set_title(TTR("Pick a Main Scene"));
+ file->popup_centered_ratio();
+
+ } break;
case SETTINGS_ABOUT: {
about->popup_centered(Size2(500,130)*EDSCALE);
@@ -2782,10 +2833,12 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) {
List<Ref<Resource> > cached;
ResourceCache::get_cached_resources(&cached);
-
+ //this should probably be done in a thread..
for(List<Ref<Resource> >::Element *E=cached.front();E;E=E->next()) {
- if (!E->get()->can_reload_from_file())
+ if (!E->get()->editor_can_reload_from_file())
+ continue;
+ if (!E->get()->get_path().is_resource_file() && !E->get()->get_path().is_abs_path())
continue;
if (!FileAccess::exists(E->get()->get_path()))
continue;
@@ -3376,7 +3429,10 @@ Dictionary EditorNode::_get_main_scene_state() {
return state;
}
-void EditorNode::_set_main_scene_state(Dictionary p_state) {
+void EditorNode::_set_main_scene_state(Dictionary p_state,Node* p_for_scene) {
+
+ if (get_edited_scene()!=p_for_scene && p_for_scene!=NULL)
+ return; //not for this scene
//print_line("set current 7 ");
changing_scene=false;
@@ -3520,7 +3576,7 @@ void EditorNode::set_current_scene(int p_idx) {
}*/
//_set_main_scene_state(state);
- call_deferred("_set_main_scene_state",state); //do after everything else is done setting up
+ call_deferred("_set_main_scene_state",state,get_edited_scene()); //do after everything else is done setting up
//print_line("set current 6 ");
@@ -3540,7 +3596,7 @@ void EditorNode::fix_dependencies(const String& p_for_file) {
dependency_fixer->edit(p_for_file);
}
-Error EditorNode::load_scene(const String& p_scene, bool p_ignore_broken_deps,bool p_set_inherited) {
+Error EditorNode::load_scene(const String& p_scene, bool p_ignore_broken_deps,bool p_set_inherited,bool p_clear_errors) {
if (!is_inside_tree()) {
defer_load_scene = p_scene;
@@ -3559,7 +3615,9 @@ Error EditorNode::load_scene(const String& p_scene, bool p_ignore_broken_deps,bo
}
- load_errors->clear();
+ if (p_clear_errors)
+ load_errors->clear();
+
String lpath = Globals::get_singleton()->localize_path(p_scene);
if (!lpath.begins_with("res://")) {
@@ -3996,15 +4054,17 @@ bool EditorNode::_find_editing_changed_scene(Node *p_from) {
void EditorNode::add_io_error(const String& p_error) {
- CharString err_ut = p_error.utf8();
- ERR_PRINT(err_ut.get_data());
+ //CharString err_ut = p_error.utf8();
+ //ERR_PRINT(!err_ut.get_data());
_load_error_notify(singleton,p_error);
}
void EditorNode::_load_error_notify(void* p_ud,const String& p_text) {
+
EditorNode*en=(EditorNode*)p_ud;
- en->load_errors->set_text(en->load_errors->get_text()+p_text+"\n");
+ en->load_errors->add_image(en->gui_base->get_icon("Error","EditorIcons"));
+ en->load_errors->add_text(p_text+"\n");
en->load_error_dialog->popup_centered_ratio(0.5);
}
@@ -5058,6 +5118,78 @@ void EditorNode::_file_access_close_error_notify(const String& p_str) {
add_io_error("Unable to write to file '"+p_str+"', file in use, locked or lacking permissions.");
}
+
+void EditorNode::reload_scene(const String& p_path) {
+
+
+ //first of all, reload textures as they might have changed on disk
+
+ List<Ref<Resource> > cached;
+ ResourceCache::get_cached_resources(&cached);
+ List<Ref<Resource> > to_clear; //clear internal resources from previous scene from being used
+ for(List<Ref<Resource> >::Element *E=cached.front();E;E=E->next()) {
+
+ if (E->get()->get_path().begins_with(p_path+"::")) //subresources of existing scene
+ to_clear.push_back(E->get());
+
+ if (!E->get()->cast_to<Texture>())
+ continue;
+ if (!E->get()->get_path().is_resource_file() && !E->get()->get_path().is_abs_path())
+ continue;
+ if (!FileAccess::exists(E->get()->get_path()))
+ continue;
+ uint64_t mt = FileAccess::get_modified_time(E->get()->get_path());
+ if (mt!=E->get()->get_last_modified_time()) {
+ E->get()->reload_from_file();
+ }
+ }
+
+ //so reload reloads everything, clear subresources of previous scene
+ while(to_clear.front()) {
+ to_clear.front()->get()->set_path("");
+ to_clear.pop_front();
+ }
+
+ int scene_idx=-1;
+ for(int i=0;i<editor_data.get_edited_scene_count();i++) {
+
+ if (editor_data.get_scene_path(i)==p_path) {
+ scene_idx=i;
+ break;
+ }
+ }
+
+ int current_tab = editor_data.get_edited_scene();
+
+
+ if (scene_idx==-1) {
+ if (get_edited_scene()) {
+ //scene is not open, so at it might be instanced, just refresh, set tab to itself and it will reload
+ set_current_scene(current_tab);
+ editor_data.get_undo_redo().clear_history();
+ }
+ return;
+ }
+
+
+ if (current_tab==scene_idx) {
+ editor_data.apply_changes_in_editors();
+ _set_scene_metadata(p_path);
+
+ }
+ //remove scene
+ _remove_scene(scene_idx);
+ //reload scene
+ load_scene(p_path);
+ //adjust index so tab is back a the previous position
+ editor_data.move_edited_scene_to_index(scene_idx);
+ get_undo_redo()->clear_history();
+ //recover the tab
+ scene_tabs->set_current_tab(current_tab);
+ _scene_tab_changed(current_tab);
+}
+
+
void EditorNode::_bind_methods() {
@@ -6421,13 +6553,14 @@ EditorNode::EditorNode() {
set_process_unhandled_input(true);
_playing_edited=false;
- load_errors = memnew( TextEdit );
- load_errors->set_readonly(true);
+// Panel *errors = memnew( Panel );
+ load_errors = memnew( RichTextLabel );
+// load_errors->set_readonly(true);
load_error_dialog = memnew( AcceptDialog );
load_error_dialog->add_child(load_errors);
load_error_dialog->set_title(TTR("Load Errors"));
load_error_dialog->set_child_rect(load_errors);
- add_child(load_error_dialog);
+ gui_base->add_child(load_error_dialog);
//EditorImport::add_importer( Ref<EditorImporterCollada>( memnew(EditorImporterCollada )));
@@ -6452,7 +6585,10 @@ EditorNode::EditorNode() {
Node::set_human_readable_collision_renaming(true);
-
+ pick_main_scene = memnew( ConfirmationDialog );
+ gui_base->add_child(pick_main_scene);
+ pick_main_scene->get_ok()->set_text("Select");
+ pick_main_scene->connect("confirmed",this,"_menu_option",varray(SETTINGS_PICK_MAIN_SCENE));
// Ref<ImageTexture> it = gui_base->get_icon("logo","Icons");
// OS::get_singleton()->set_icon( it->get_data() );
diff --git a/tools/editor/editor_node.h b/tools/editor/editor_node.h
index bea973a357..9b0edda75e 100644
--- a/tools/editor/editor_node.h
+++ b/tools/editor/editor_node.h
@@ -185,6 +185,7 @@ private:
SETTINGS_LAYOUT_DELETE,
SETTINGS_LAYOUT_DEFAULT,
SETTINGS_LOAD_EXPORT_TEMPLATES,
+ SETTINGS_PICK_MAIN_SCENE,
SETTINGS_HELP,
SETTINGS_ABOUT,
SOURCES_REIMPORT,
@@ -261,7 +262,7 @@ private:
TextureProgress *audio_vu;
//MenuButton *fileserver_menu;
- TextEdit *load_errors;
+ RichTextLabel *load_errors;
AcceptDialog *load_error_dialog;
//Control *scene_root_base;
@@ -287,6 +288,7 @@ private:
ConfirmationDialog *confirmation;
ConfirmationDialog *import_confirmation;
ConfirmationDialog *open_recent_confirmation;
+ ConfirmationDialog *pick_main_scene;
AcceptDialog *accept;
AcceptDialog *about;
AcceptDialog *warning;
@@ -553,7 +555,7 @@ private:
void _scene_tab_script_edited(int p_tab);
Dictionary _get_main_scene_state();
- void _set_main_scene_state(Dictionary p_state);
+ void _set_main_scene_state(Dictionary p_state,Node* p_for_scene);
int _get_current_main_editor();
@@ -652,7 +654,7 @@ public:
void fix_dependencies(const String& p_for_file);
void clear_scene() { _cleanup_scene(); }
- Error load_scene(const String& p_scene, bool p_ignore_broken_deps=false, bool p_set_inherited=false);
+ Error load_scene(const String& p_scene, bool p_ignore_broken_deps=false, bool p_set_inherited=false, bool p_clear_errors=true);
Error load_resource(const String& p_scene);
bool is_scene_open(const String& p_path);
@@ -714,6 +716,8 @@ public:
void update_keying();
+ void reload_scene(const String& p_path);
+
bool is_exiting() const { return exiting; }
ToolButton *get_pause_button() { return pause_button; }
diff --git a/tools/editor/icons/icon_loop_interpolation.png b/tools/editor/icons/icon_loop_interpolation.png
deleted file mode 100644
index 488b33316e..0000000000
--- a/tools/editor/icons/icon_loop_interpolation.png
+++ /dev/null
Binary files differ
diff --git a/tools/editor/io_plugins/editor_scene_import_plugin.cpp b/tools/editor/io_plugins/editor_scene_import_plugin.cpp
index c7d92a9658..b27539b933 100644
--- a/tools/editor/io_plugins/editor_scene_import_plugin.cpp
+++ b/tools/editor/io_plugins/editor_scene_import_plugin.cpp
@@ -822,7 +822,7 @@ void EditorSceneImportDialog::_import(bool p_and_open) {
return;
}
if (wip_open)
- EditorNode::get_singleton()->load_scene(save_file);
+ EditorNode::get_singleton()->load_scene(save_file,false,false,false);
}
@@ -867,7 +867,7 @@ void EditorSceneImportDialog::_import_confirm() {
}
if (wip_open)
- EditorNode::get_singleton()->load_scene(wip_save_file);
+ EditorNode::get_singleton()->load_scene(wip_save_file,false,false,false);
wip_open=false;
wip_save_file="";
@@ -2680,8 +2680,9 @@ Error EditorSceneImportPlugin::import2(Node *scene, const String& p_dest_path, c
post_import_script = Ref<EditorScenePostImport>( memnew( EditorScenePostImport ) );
post_import_script->set_script(scr.get_ref_ptr());
if (!post_import_script->get_script_instance()) {
- EditorNode::add_io_error(TTR("Invalid/broken script for post-import:")+" "+post_import_script_path);
+ EditorNode::add_io_error(TTR("Invalid/broken script for post-import (check console):")+" "+post_import_script_path);
post_import_script.unref();
+ return ERR_CANT_CREATE;
}
}
}
@@ -2789,15 +2790,16 @@ Error EditorSceneImportPlugin::import2(Node *scene, const String& p_dest_path, c
Ref<PackedScene> packer = memnew( PackedScene );
packer->pack(scene);
- packer->set_path(p_dest_path);
+ //packer->set_path(p_dest_path); do not take over, let the changed files reload themselves
packer->set_import_metadata(from);
print_line("SAVING TO: "+p_dest_path);
- err = ResourceSaver::save(p_dest_path,packer,ResourceSaver::FLAG_REPLACE_SUBRESOURCE_PATHS);
+ err = ResourceSaver::save(p_dest_path,packer); //do not take over, let the changed files reload themselves
//EditorFileSystem::get_singleton()->update_resource(packer);
memdelete(scene);
+
/*
scene->set_filename(p_dest_path);
if (r_scene) {
@@ -2817,6 +2819,7 @@ Error EditorSceneImportPlugin::import2(Node *scene, const String& p_dest_path, c
*/
+ EditorNode::get_singleton()->reload_scene(p_dest_path);
return err;
diff --git a/tools/editor/plugins/canvas_item_editor_plugin.cpp b/tools/editor/plugins/canvas_item_editor_plugin.cpp
index 0cbc867b47..81601a81a7 100644
--- a/tools/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/tools/editor/plugins/canvas_item_editor_plugin.cpp
@@ -1382,6 +1382,8 @@ void CanvasItemEditor::_viewport_input_event(const InputEvent& p_event) {
se->undo_state=canvas_item->edit_get_state();
if (canvas_item->cast_to<Node2D>())
se->undo_pivot=canvas_item->cast_to<Node2D>()->edit_get_pivot();
+ if (canvas_item->cast_to<Control>())
+ se->undo_pivot=Vector2();
return;
}
@@ -1566,14 +1568,34 @@ void CanvasItemEditor::_viewport_input_event(const InputEvent& p_event) {
if (drag==DRAG_ROTATE) {
Vector2 center = canvas_item->get_global_transform_with_canvas().get_origin();
- if (Node2D *node = canvas_item->cast_to<Node2D>()) {
- Matrix32 rot;
- rot.elements[1] = (dfrom - center).normalized();
- rot.elements[0] = rot.elements[1].tangent();
- node->set_rot(snap_angle(rot.xform_inv(dto-center).angle() + node->get_rot(), node->get_rot()));
- display_rotate_to = dto;
- display_rotate_from = center;
- viewport->update();
+ {
+ Node2D *node = canvas_item->cast_to<Node2D>();
+
+
+ if (node) {
+ Matrix32 rot;
+ rot.elements[1] = (dfrom - center).normalized();
+ rot.elements[0] = rot.elements[1].tangent();
+ node->set_rot(snap_angle(rot.xform_inv(dto-center).angle() + node->get_rot(), node->get_rot()));
+ display_rotate_to = dto;
+ display_rotate_from = center;
+ viewport->update();
+ }
+ }
+
+ {
+ Control *node = canvas_item->cast_to<Control>();
+
+
+ if (node) {
+ Matrix32 rot;
+ rot.elements[1] = (dfrom - center).normalized();
+ rot.elements[0] = rot.elements[1].tangent();
+ node->set_rotation(snap_angle(rot.xform_inv(dto-center).angle() + node->get_rotation(), node->get_rotation()));
+ display_rotate_to = dto;
+ display_rotate_from = center;
+ viewport->update();
+ }
}
continue;
diff --git a/tools/editor/plugins/sprite_frames_editor_plugin.cpp b/tools/editor/plugins/sprite_frames_editor_plugin.cpp
index 4f59287994..e29a0c8d52 100644
--- a/tools/editor/plugins/sprite_frames_editor_plugin.cpp
+++ b/tools/editor/plugins/sprite_frames_editor_plugin.cpp
@@ -31,7 +31,7 @@
#include "io/resource_loader.h"
#include "globals.h"
#include "tools/editor/editor_settings.h"
-
+#include "scene/3d/sprite_3d.h"
@@ -355,6 +355,35 @@ void SpriteFramesEditor::_animation_select() {
}
+
+static void _find_anim_sprites(Node* p_node,List<Node*> *r_nodes,Ref<SpriteFrames> p_sfames) {
+
+ Node *edited = EditorNode::get_singleton()->get_edited_scene();
+ if (!edited)
+ return;
+ if (p_node!=edited && p_node->get_owner()!=edited)
+ return;
+
+ {
+ AnimatedSprite *as = p_node->cast_to<AnimatedSprite>();
+ if (as && as->get_sprite_frames()==p_sfames) {
+ r_nodes->push_back(p_node);
+ }
+ }
+
+ {
+ AnimatedSprite3D *as = p_node->cast_to<AnimatedSprite3D>();
+ if (as && as->get_sprite_frames()==p_sfames) {
+ r_nodes->push_back(p_node);
+ }
+ }
+
+ for(int i=0;i<p_node->get_child_count();i++) {
+ _find_anim_sprites(p_node->get_child(i),r_nodes,p_sfames);
+ }
+
+}
+
void SpriteFramesEditor::_animation_name_edited(){
if (updating)
@@ -381,9 +410,24 @@ void SpriteFramesEditor::_animation_name_edited(){
name=new_name+" "+itos(counter);
}
+ List<Node*> nodes;
+ _find_anim_sprites(EditorNode::get_singleton()->get_edited_scene(),&nodes,Ref<SpriteFrames>(frames));
+
undo_redo->create_action(TTR("Rename Animation"));
undo_redo->add_do_method(frames,"rename_animation",edited_anim,name);
undo_redo->add_undo_method(frames,"rename_animation",name,edited_anim);
+
+ for(List<Node*>::Element *E=nodes.front();E;E=E->next()) {
+
+ String current = E->get()->call("get_animation");
+ if (current!=edited_anim)
+ continue;
+
+ undo_redo->add_do_method(E->get(),"set_animation",name);
+ undo_redo->add_undo_method(E->get(),"set_animation",edited_anim);
+
+ }
+
undo_redo->add_do_method(this,"_update_library");
undo_redo->add_undo_method(this,"_update_library");
@@ -406,12 +450,28 @@ void SpriteFramesEditor::_animation_add(){
name=new_name+" "+itos(counter);
}
+ List<Node*> nodes;
+ _find_anim_sprites(EditorNode::get_singleton()->get_edited_scene(),&nodes,Ref<SpriteFrames>(frames));
+
+
undo_redo->create_action(TTR("Add Animation"));
undo_redo->add_do_method(frames,"add_animation",name);
undo_redo->add_undo_method(frames,"remove_animation",name);
undo_redo->add_do_method(this,"_update_library");
undo_redo->add_undo_method(this,"_update_library");
+
+ for(List<Node*>::Element *E=nodes.front();E;E=E->next()) {
+
+ String current = E->get()->call("get_animation");
+ if (frames->has_animation(current))
+ continue;
+
+ undo_redo->add_do_method(E->get(),"set_animation",name);
+ undo_redo->add_undo_method(E->get(),"set_animation",current);
+
+ }
+
edited_anim=new_name;
undo_redo->commit_action();
@@ -426,6 +486,7 @@ void SpriteFramesEditor::_animation_remove(){
if (!frames->has_animation(edited_anim))
return;
+
undo_redo->create_action(TTR("Remove Animation"));
undo_redo->add_do_method(frames,"remove_animation",edited_anim);
undo_redo->add_undo_method(frames,"add_animation",edited_anim);
diff --git a/tools/editor/plugins/texture_region_editor_plugin.cpp b/tools/editor/plugins/texture_region_editor_plugin.cpp
index 8515008982..63d8e2e1cf 100644
--- a/tools/editor/plugins/texture_region_editor_plugin.cpp
+++ b/tools/editor/plugins/texture_region_editor_plugin.cpp
@@ -302,7 +302,6 @@ void TextureRegionEditor::_region_input(const InputEvent& p_input)
}
}
} else if (edited_margin < 0) {
- print_line("EDIT RECTANGLE!!!");
drag_from=mtx.affine_inverse().xform(Vector2(mb.x,mb.y));
if (snap_mode == SNAP_PIXEL)
drag_from = drag_from.snapped(Vector2(1,1));
@@ -332,7 +331,6 @@ void TextureRegionEditor::_region_input(const InputEvent& p_input)
}
} else if (drag) {
- print_line("DRAGING!!!");
if (edited_margin >= 0) {
undo_redo->create_action("Set Margin");
static Margin m[4] = {MARGIN_TOP,MARGIN_BOTTOM,MARGIN_LEFT,MARGIN_RIGHT};
@@ -776,6 +774,8 @@ TextureRegionEditor::TextureRegionEditor(EditorNode* p_editor)
snap_step=Vector2(10,10);
snap_separation = Vector2(0,0);
+ edited_margin = -1;
+ drag_index = -1;
drag=false;
VBoxContainer *main_vb = memnew( VBoxContainer );
diff --git a/tools/editor/scene_tree_dock.cpp b/tools/editor/scene_tree_dock.cpp
index 30ffdf6664..ab5c6e5044 100644
--- a/tools/editor/scene_tree_dock.cpp
+++ b/tools/editor/scene_tree_dock.cpp
@@ -39,16 +39,20 @@
#include "multi_node_edit.h"
#include "tools/editor/plugins/animation_player_editor_plugin.h"
#include "animation_editor.h"
-
+#include "scene/main/viewport.h"
void SceneTreeDock::_unhandled_key_input(InputEvent p_event) {
+ if (get_viewport()->get_modal_stack_top())
+ return; //ignore because of modal window
+
uint32_t sc = p_event.key.get_scancode_with_modifiers();
if (!p_event.key.pressed || p_event.key.echo)
return;
+
if (ED_IS_SHORTCUT("scene_tree/add_child_node", p_event)) {
_tool_selected(TOOL_NEW);
}
diff --git a/tools/editor/scene_tree_editor.cpp b/tools/editor/scene_tree_editor.cpp
index a155f0c0cf..f174bc2f1b 100644
--- a/tools/editor/scene_tree_editor.cpp
+++ b/tools/editor/scene_tree_editor.cpp
@@ -302,8 +302,15 @@ bool SceneTreeEditor::_add_nodes(Node *p_node,TreeItem *p_parent) {
item->set_selectable(0,true);
if (can_rename) {
-
- bool collapsed = p_node->has_meta("_editor_collapsed") ? (bool)p_node->get_meta("_editor_collapsed") : false;
+#ifdef ENABLE_DEPRECATED
+ if (p_node->has_meta("_editor_collapsed")) {
+ //remove previous way of storing folding, which did not get along with scene inheritance and instancing
+ if ((bool)p_node->get_meta("_editor_collapsed"))
+ p_node->set_display_folded(true);
+ p_node->set_meta("_editor_collapsed",Variant());
+ }
+#endif
+ bool collapsed = p_node->is_displayed_folded();
if (collapsed)
item->set_collapsed(true);
}
@@ -896,10 +903,7 @@ void SceneTreeEditor::_cell_collapsed(Object *p_obj) {
Node *n=get_node(np);
ERR_FAIL_COND(!n);
- if (collapsed)
- n->set_meta("_editor_collapsed",true);
- else
- n->set_meta("_editor_collapsed",Variant());
+ n->set_display_folded(collapsed);
}
diff --git a/tools/editor/scenes_dock.cpp b/tools/editor/scenes_dock.cpp
index 68bf504fe2..cbd7df9d18 100644
--- a/tools/editor/scenes_dock.cpp
+++ b/tools/editor/scenes_dock.cpp
@@ -1668,7 +1668,7 @@ ScenesDock::ScenesDock(EditorNode *p_editor) {
button_favorite->set_focus_mode(FOCUS_NONE);
- Control *spacer = memnew( Control);
+// Control *spacer = memnew( Control);
@@ -1702,6 +1702,7 @@ ScenesDock::ScenesDock(EditorNode *p_editor) {
tree->set_hide_root(true);
split_box->add_child(tree);
+ tree->set_custom_minimum_size(Size2(0,200)*EDSCALE);
tree->set_drag_forwarding(this);