diff options
Diffstat (limited to 'tools')
22 files changed, 280 insertions, 23 deletions
diff --git a/tools/doc/doc_data.cpp b/tools/doc/doc_data.cpp index e3689cf13d..470dd078ae 100644 --- a/tools/doc/doc_data.cpp +++ b/tools/doc/doc_data.cpp @@ -455,6 +455,12 @@ void DocData::generate(bool p_basic_types) { } + { + //so it can be documented that it does not exist + class_list["Variant"]=ClassDoc(); + class_list["Variant"].name="Variant"; + } + if (!p_basic_types) return; 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_dir_dialog.cpp b/tools/editor/editor_dir_dialog.cpp index a6e231cf18..f6ce7bf3f8 100644 --- a/tools/editor/editor_dir_dialog.cpp +++ b/tools/editor/editor_dir_dialog.cpp @@ -99,8 +99,14 @@ void EditorDirDialog::_notification(int p_what) { if (p_what==NOTIFICATION_ENTER_TREE) { reload(); - tree->connect("item_collapsed",this,"_item_collapsed",varray(),CONNECT_DEFERRED); - EditorFileSystem::get_singleton()->connect("filesystem_changed",this,"reload"); + + if (!tree->is_connected("item_collapsed",this,"_item_collapsed")) { + tree->connect("item_collapsed",this,"_item_collapsed",varray(),CONNECT_DEFERRED); + } + + if (!EditorFileSystem::get_singleton()->is_connected("filesystem_changed",this,"reload")) { + EditorFileSystem::get_singleton()->connect("filesystem_changed",this,"reload"); + } } @@ -185,10 +191,14 @@ void EditorDirDialog::ok_pressed() { void EditorDirDialog::_make_dir() { TreeItem *ti=tree->get_selected(); - if (!ti) + if (!ti) { + mkdirerr->set_text("Please select a base directory first"); + mkdirerr->popup_centered_minsize(); return; + } makedialog->popup_centered_minsize(Size2(250,80)); + makedirname->grab_focus(); } void EditorDirDialog::_make_dir_confirm() { @@ -198,9 +208,11 @@ void EditorDirDialog::_make_dir_confirm() { return; String dir = ti->get_metadata(0); + DirAccess *d = DirAccess::open(dir); ERR_FAIL_COND(!d); Error err = d->make_dir(makedirname->get_text()); + if (err!=OK) { mkdirerr->popup_centered_minsize(Size2(250,80)); } else { diff --git a/tools/editor/editor_file_system.cpp b/tools/editor/editor_file_system.cpp index 1f414f80a0..cb7cefea26 100644 --- a/tools/editor/editor_file_system.cpp +++ b/tools/editor/editor_file_system.cpp @@ -34,6 +34,7 @@ #include "editor_node.h" #include "io/resource_saver.h" #include "editor_settings.h" +#include "editor_resource_preview.h" EditorFileSystem *EditorFileSystem::singleton=NULL; @@ -848,6 +849,7 @@ void EditorFileSystem::_scan_fs_changes(EditorFileSystemDirectory *p_dir,const S continue; } + if (_check_meta_sources(p_dir->files[i]->meta)) { ItemAction ia; ia.action=ItemAction::ACTION_FILE_SOURCES_CHANGED; @@ -858,6 +860,8 @@ void EditorFileSystem::_scan_fs_changes(EditorFileSystemDirectory *p_dir,const S } else { p_dir->files[i]->meta.sources_changed=false; } + + EditorResourcePreview::get_singleton()->check_for_invalidation(p_dir->get_file_path(i)); } for(int i=0;i<p_dir->subdirs.size();i++) { @@ -1328,6 +1332,7 @@ void EditorFileSystem::update_file(const String& p_file) { fs->files[cpos]->modified_time=FileAccess::get_modified_time(p_file); fs->files[cpos]->meta=_get_meta(p_file); + EditorResourcePreview::get_singleton()->call_deferred("check_for_invalidation",p_file); call_deferred("emit_signal","filesystem_changed"); //update later } @@ -1341,6 +1346,8 @@ void EditorFileSystem::_bind_methods() { } + + EditorFileSystem::EditorFileSystem() { diff --git a/tools/editor/editor_file_system.h b/tools/editor/editor_file_system.h index b96e947569..fb768fb358 100644 --- a/tools/editor/editor_file_system.h +++ b/tools/editor/editor_file_system.h @@ -236,6 +236,7 @@ public: EditorFileSystemDirectory *get_path(const String& p_path); String get_file_type(const String& p_file) const; EditorFileSystemDirectory* find_file(const String& p_file,int* r_index) const; + EditorFileSystem(); ~EditorFileSystem(); }; diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index 2bba97251d..ae632ab381 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -2846,6 +2846,7 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { if (mt!=E->get()->get_last_modified_time()) { E->get()->reload_from_file(); } + } diff --git a/tools/editor/editor_resource_preview.cpp b/tools/editor/editor_resource_preview.cpp index 8975c0ec35..750a172d1e 100644 --- a/tools/editor/editor_resource_preview.cpp +++ b/tools/editor/editor_resource_preview.cpp @@ -66,16 +66,20 @@ void EditorResourcePreview::_preview_ready(const String& p_str,const Ref<Texture String path = p_str; uint32_t hash=0; + uint64_t modified_time=0; if (p_str.begins_with("ID:")) { hash=p_str.get_slicec(':',2).to_int(); path="ID:"+p_str.get_slicec(':',1); + } else { + modified_time = FileAccess::get_modified_time(path); } Item item; item.order=order++; item.preview=p_texture; item.last_hash=hash; + item.modified_time=modified_time; cache[path]=item; @@ -263,6 +267,8 @@ void EditorResourcePreview::queue_edited_resource_preview(const Ref<Resource>& p preview_mutex->lock(); String path_id = "ID:"+itos(p_res->get_instance_ID()); + + if (cache.has(path_id) && cache[path_id].last_hash==p_res->hash_edited_version()) { cache[path_id].order=order++; @@ -272,6 +278,8 @@ void EditorResourcePreview::queue_edited_resource_preview(const Ref<Resource>& p } + cache.erase(path_id); //erase if exists, since it will be regen + //print_line("send to thread "+p_path); QueueItem item; item.function=p_receiver_func; @@ -322,6 +330,32 @@ EditorResourcePreview* EditorResourcePreview::get_singleton() { void EditorResourcePreview::_bind_methods() { ObjectTypeDB::bind_method("_preview_ready",&EditorResourcePreview::_preview_ready); + ObjectTypeDB::bind_method(_MD("check_for_invalidation","path"),&EditorResourcePreview::check_for_invalidation); + + + ADD_SIGNAL(MethodInfo("preview_invalidated",PropertyInfo(Variant::STRING,"path"))); +} + +bool EditorResourcePreview::check_for_invalidation(const String& p_path) { + + preview_mutex->lock(); + + bool call_invalidated=false; + if (cache.has(p_path)) { + + uint64_t modified_time = FileAccess::get_modified_time(p_path); + if (modified_time!=cache[p_path].modified_time) { + cache.erase(p_path); + call_invalidated=true; + } + } + + preview_mutex->unlock(); + + if (call_invalidated) {//do outside mutex + call_deferred("emit_signal","preview_invalidated",p_path); + } + } EditorResourcePreview::EditorResourcePreview() { diff --git a/tools/editor/editor_resource_preview.h b/tools/editor/editor_resource_preview.h index 63dc5c3dd3..fed8f129ed 100644 --- a/tools/editor/editor_resource_preview.h +++ b/tools/editor/editor_resource_preview.h @@ -93,6 +93,7 @@ class EditorResourcePreview : public Node { Ref<Texture> preview; int order; uint32_t last_hash; + uint64_t modified_time; }; int order; @@ -106,6 +107,8 @@ class EditorResourcePreview : public Node { void _thread(); Vector<Ref<EditorResourcePreviewGenerator> > preview_generators; + + protected: static void _bind_methods(); @@ -118,6 +121,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); + bool check_for_invalidation(const String& p_path); EditorResourcePreview(); ~EditorResourcePreview(); diff --git a/tools/editor/io_plugins/editor_scene_import_plugin.cpp b/tools/editor/io_plugins/editor_scene_import_plugin.cpp index b27539b933..8899d65aea 100644 --- a/tools/editor/io_plugins/editor_scene_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_scene_import_plugin.cpp @@ -2459,7 +2459,7 @@ void EditorSceneImportPlugin::_optimize_animations(Node *scene, float p_max_lin_ void EditorSceneImportPlugin::_find_resources_to_merge(Node *scene, Node *node, bool p_merge_material, Map<String, Ref<Material> > &materials, bool p_merge_anims, Map<String,Ref<Animation> >& merged_anims,Set<Ref<Mesh> > &tested_meshes) { - if (node->get_owner()!=scene) + if (node!=scene && node->get_owner()!=scene) return; String path = scene->get_path_to(node); @@ -2507,11 +2507,43 @@ void EditorSceneImportPlugin::_find_resources_to_merge(Node *scene, Node *node, for(int i=0;i<mesh->get_surface_count();i++) { Ref<Material> material = mesh->surface_get_material(i); - materials[mesh->get_name()+":surf:"+mesh->surface_get_name(i)]=material; + + if (material.is_valid()) { + + String sname = mesh->surface_get_name(i); + if (sname=="") + sname="surf_"+itos(i); + + sname=mesh->get_name()+":surf:"+sname; + materials[sname]=material; + } } tested_meshes.insert(mesh); } + + if (mesh.is_valid()) { + + for(int i=0;i<mesh->get_surface_count();i++) { + Ref<Material> material = mi->get_surface_material(i); + if (material.is_valid()) { + String sname = mesh->surface_get_name(i); + if (sname=="") + sname="surf_"+itos(i); + + sname=path+":inst_surf:"+sname; + materials[sname]=material; + } + } + + } + + Ref<Material> override = mi->get_material_override(); + + if (override.is_valid()) { + + materials[path+":override"]=override; + } } @@ -2525,11 +2557,13 @@ void EditorSceneImportPlugin::_find_resources_to_merge(Node *scene, Node *node, void EditorSceneImportPlugin::_merge_found_resources(Node *scene, Node *node, bool p_merge_material, const Map<String, Ref<Material> > &materials, bool p_merge_anims, const Map<String,Ref<Animation> >& merged_anims, Set<Ref<Mesh> > &tested_meshes) { - if (node->get_owner()!=scene) + if (node!=scene && node->get_owner()!=scene) return; String path = scene->get_path_to(node); + print_line("at path: "+path); + if (node->cast_to<AnimationPlayer>()) { AnimationPlayer *ap = node->cast_to<AnimationPlayer>(); @@ -2570,15 +2604,48 @@ void EditorSceneImportPlugin::_merge_found_resources(Node *scene, Node *node, bo if (mesh.is_valid() && mesh->get_name()!=String() && !tested_meshes.has(mesh)) { for(int i=0;i<mesh->get_surface_count();i++) { - String sname = mesh->get_name()+":surf:"+mesh->surface_get_name(i); + + String sname = mesh->surface_get_name(i); + if (sname=="") + sname="surf_"+itos(i); + + sname=mesh->get_name()+":surf:"+sname; + if (materials.has(sname)) { + mesh->surface_set_material(i,materials[sname]); } } tested_meshes.insert(mesh); } + + if (mesh.is_valid()) { + + for(int i=0;i<mesh->get_surface_count();i++) { + + String sname = mesh->surface_get_name(i); + if (sname=="") + sname="surf_"+itos(i); + + sname=path+":inst_surf:"+sname; + + + if (materials.has(sname)) { + + mi->set_surface_material(i,materials[sname]); + } + } + + } + + + String opath = path+":override"; + if (materials.has(opath)) { + mi->set_material_override(materials[opath]); + } + } @@ -2643,6 +2710,7 @@ Error EditorSceneImportPlugin::import2(Node *scene, const String& p_dest_path, c if (scene_flags&(SCENE_FLAG_MERGE_KEEP_MATERIALS|SCENE_FLAG_MERGE_KEEP_EXTRA_ANIM_TRACKS) && FileAccess::exists(p_dest_path)) { //must merge! + print_line("MUST MERGE"); Ref<PackedScene> pscene = ResourceLoader::load(p_dest_path,"PackedScene",true); if (pscene.is_valid()) { @@ -2653,8 +2721,9 @@ Error EditorSceneImportPlugin::import2(Node *scene, const String& p_dest_path, c Set<Ref<Mesh> > tested_meshes; _find_resources_to_merge(instance,instance,scene_flags&SCENE_FLAG_MERGE_KEEP_MATERIALS,merged_materials,scene_flags&SCENE_FLAG_MERGE_KEEP_EXTRA_ANIM_TRACKS,merged_anims,tested_meshes); + tested_meshes.clear(); - _merge_found_resources(instance,instance,scene_flags&SCENE_FLAG_MERGE_KEEP_MATERIALS,merged_materials,scene_flags&SCENE_FLAG_MERGE_KEEP_EXTRA_ANIM_TRACKS,merged_anims,tested_meshes); + _merge_found_resources(scene,scene,scene_flags&SCENE_FLAG_MERGE_KEEP_MATERIALS,merged_materials,scene_flags&SCENE_FLAG_MERGE_KEEP_EXTRA_ANIM_TRACKS,merged_anims,tested_meshes); memdelete(instance); } diff --git a/tools/editor/plugins/animation_player_editor_plugin.cpp b/tools/editor/plugins/animation_player_editor_plugin.cpp index 10c7bf79a3..203564e612 100644 --- a/tools/editor/plugins/animation_player_editor_plugin.cpp +++ b/tools/editor/plugins/animation_player_editor_plugin.cpp @@ -1404,6 +1404,7 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor) { hb->add_child(animation); animation->set_h_size_flags(SIZE_EXPAND_FILL); animation->set_tooltip(TTR("Display list of animations in player.")); + animation->set_clip_text(true); autoplay = memnew( ToolButton ); hb->add_child(autoplay); diff --git a/tools/editor/plugins/sample_editor_plugin.cpp b/tools/editor/plugins/sample_editor_plugin.cpp index b094184a29..69602ac995 100644 --- a/tools/editor/plugins/sample_editor_plugin.cpp +++ b/tools/editor/plugins/sample_editor_plugin.cpp @@ -324,12 +324,13 @@ void SampleEditor::generate_preview_texture(const Ref<Sample>& p_sample,Ref<Imag void SampleEditor::_update_sample() { player->stop_all(); - if (sample->get_format()==Sample::FORMAT_IMA_ADPCM) - return; //bye or unsupported generate_preview_texture(sample,peakdisplay); info_label->set_text(TTR("Length:")+" "+String::num(sample->get_length()/(float)sample->get_mix_rate(),2)+"s"); + if (library->has_sample("default")) + library->remove_sample("default"); + library->add_sample("default",sample); } diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp index 10e4fc8475..ee83b6b032 100644 --- a/tools/editor/plugins/script_editor_plugin.cpp +++ b/tools/editor/plugins/script_editor_plugin.cpp @@ -585,7 +585,6 @@ void ScriptTextEditor::_code_complete_script(const String& p_code, List<String>* Error err = script->get_language()->complete_code(p_code,script->get_path().get_base_dir(),base,r_options,hint); if (hint!="") { get_text_edit()->set_code_hint(hint); - print_line("hint: "+hint.replace(String::chr(0xFFFF),"|")); } } @@ -2316,6 +2315,22 @@ void ScriptEditor::_script_split_dragged(float) { EditorNode::get_singleton()->save_layout(); } +void ScriptEditor::_unhandled_input(const InputEvent& p_event) { + if (p_event.key.pressed || !is_visible()) return; + if (ED_IS_SHORTCUT("script_editor/next_script", p_event)) { + int next_tab = script_list->get_current() + 1; + next_tab %= script_list->get_item_count(); + _go_to_tab(script_list->get_item_metadata(next_tab)); + _update_script_names(); + } + if (ED_IS_SHORTCUT("script_editor/prev_script", p_event)) { + int next_tab = script_list->get_current() - 1; + next_tab = next_tab >= 0 ? next_tab : script_list->get_item_count() - 1; + _go_to_tab(script_list->get_item_metadata(next_tab)); + _update_script_names(); + } +} + void ScriptEditor::set_window_layout(Ref<ConfigFile> p_layout) { if (!bool(EDITOR_DEF("text_editor/restore_scripts_on_load",true))) { @@ -2598,6 +2613,7 @@ void ScriptEditor::_bind_methods() { ObjectTypeDB::bind_method("_history_forward",&ScriptEditor::_history_forward); ObjectTypeDB::bind_method("_history_back",&ScriptEditor::_history_back); ObjectTypeDB::bind_method("_live_auto_reload_running_scripts",&ScriptEditor::_live_auto_reload_running_scripts); + ObjectTypeDB::bind_method("_unhandled_input",&ScriptEditor::_unhandled_input); } @@ -2631,6 +2647,10 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { tab_container->set_h_size_flags(SIZE_EXPAND_FILL); + ED_SHORTCUT("script_editor/next_script", TTR("Next script"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_GREATER); + ED_SHORTCUT("script_editor/prev_script", TTR("Previous script"), KEY_MASK_CMD | KEY_LESS); + set_process_unhandled_input(true); + file_menu = memnew( MenuButton ); menu_hb->add_child(file_menu); file_menu->set_text(TTR("File")); diff --git a/tools/editor/plugins/script_editor_plugin.h b/tools/editor/plugins/script_editor_plugin.h index 0636190a41..85412087b4 100644 --- a/tools/editor/plugins/script_editor_plugin.h +++ b/tools/editor/plugins/script_editor_plugin.h @@ -279,6 +279,8 @@ class ScriptEditor : public VBoxContainer { void _script_split_dragged(float); + void _unhandled_input(const InputEvent& p_event); + void _history_forward(); void _history_back(); diff --git a/tools/editor/plugins/shader_graph_editor_plugin.cpp b/tools/editor/plugins/shader_graph_editor_plugin.cpp index d567c8e9b3..dea2fe4833 100644 --- a/tools/editor/plugins/shader_graph_editor_plugin.cpp +++ b/tools/editor/plugins/shader_graph_editor_plugin.cpp @@ -176,7 +176,9 @@ void GraphColorRampEdit::_input_event(const InputEvent& p_event) { void GraphColorRampEdit::_notification(int p_what){ if (p_what==NOTIFICATION_ENTER_TREE) { - picker->connect("color_changed",this,"_color_changed"); + if (!picker->is_connected("color_changed",this,"_color_changed")) { + picker->connect("color_changed",this,"_color_changed"); + } } if (p_what==NOTIFICATION_DRAW) { 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/tile_map_editor_plugin.cpp b/tools/editor/plugins/tile_map_editor_plugin.cpp index d5f85d3333..9d27ac8aa3 100644 --- a/tools/editor/plugins/tile_map_editor_plugin.cpp +++ b/tools/editor/plugins/tile_map_editor_plugin.cpp @@ -223,7 +223,7 @@ void TileMapEditor::_update_palette() { String name; if (tileset->tile_get_name(E->get())!="") { - name = tileset->tile_get_name(E->get()); + name = itos(E->get())+" - "+tileset->tile_get_name(E->get()); } else { name = "#"+itos(E->get()); } diff --git a/tools/editor/project_manager.cpp b/tools/editor/project_manager.cpp index d8814fd50e..dafec397c5 100644 --- a/tools/editor/project_manager.cpp +++ b/tools/editor/project_manager.cpp @@ -871,9 +871,6 @@ ProjectManager::ProjectManager() { HBoxContainer *top_hb = memnew( HBoxContainer); vb->add_child(top_hb); - TextureFrame *logo = memnew( TextureFrame ); - logo->set_texture(theme->get_icon("LogoSmall","EditorIcons")); - //top_hb->add_child( logo ); CenterContainer *ccl = memnew( CenterContainer ); Label *l = memnew( Label ); l->set_text(_MKSTR(VERSION_NAME)+String(" - ")+TTR("Project Manager")); diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp index 246785932d..e0dc76e733 100644 --- a/tools/editor/property_editor.cpp +++ b/tools/editor/property_editor.cpp @@ -612,6 +612,7 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty color_picker->set_edit_alpha(hint!=PROPERTY_HINT_COLOR_NO_ALPHA); color_picker->set_color(v); set_size( Size2(300*EDSCALE, color_picker->get_combined_minimum_size().height+10*EDSCALE)); + color_picker->set_focus_on_line_edit(); /* int ofs=80; int m=10; diff --git a/tools/editor/scene_tree_dock.cpp b/tools/editor/scene_tree_dock.cpp index ab5c6e5044..d2bc0e112e 100644 --- a/tools/editor/scene_tree_dock.cpp +++ b/tools/editor/scene_tree_dock.cpp @@ -1069,6 +1069,8 @@ void SceneTreeDock::_do_reparent(Node* p_new_parent,int p_position_in_parent,Vec List<Pair<NodePath,NodePath> > path_renames; + int inc=0; + for(int ni=0;ni<p_nodes.size();ni++) { //no undo for now, sorry @@ -1085,12 +1087,16 @@ void SceneTreeDock::_do_reparent(Node* p_new_parent,int p_position_in_parent,Vec } + if (new_parent==node->get_parent() && node->get_index() < p_position_in_parent+ni) { + //if child will generate a gap when moved, adjust + inc--; + } editor_data->get_undo_redo().add_do_method(node->get_parent(),"remove_child",node); editor_data->get_undo_redo().add_do_method(new_parent,"add_child",node); if (p_position_in_parent>=0) - editor_data->get_undo_redo().add_do_method(new_parent,"move_child",node,p_position_in_parent+ni); + editor_data->get_undo_redo().add_do_method(new_parent,"move_child",node,p_position_in_parent+inc); ScriptEditorDebugger *sed = ScriptEditor::get_singleton()->get_debugger(); String new_name = new_parent->validate_child_name(node->get_name()); @@ -1122,6 +1128,8 @@ void SceneTreeDock::_do_reparent(Node* p_new_parent,int p_position_in_parent,Vec editor_data->get_undo_redo().add_undo_method(new_parent,"remove_child",node); + inc++; + } //add and move in a second step.. (so old order is preserved) @@ -1583,7 +1591,7 @@ static Node* _find_last_visible(Node*p_node) { } -void SceneTreeDock::_normalize_drop(Node*& to_node, int &to_pos,int p_type) { +void SceneTreeDock::_normalize_drop(Node*& to_node, int &to_pos, int p_type) { to_pos=-1; @@ -1624,6 +1632,7 @@ void SceneTreeDock::_normalize_drop(Node*& to_node, int &to_pos,int p_type) { //just insert over this node because nothing is above at the same level to_pos=to_node->get_index(); to_node=to_node->get_parent(); + } } else if (p_type==1) { @@ -1650,12 +1659,13 @@ void SceneTreeDock::_normalize_drop(Node*& to_node, int &to_pos,int p_type) { break; } } - if (lower_sibling) { to_pos=lower_sibling->get_index(); } to_node=to_node->get_parent(); + + } #if 0 //quite complicated, look for next visible in tree diff --git a/tools/editor/scene_tree_dock.h b/tools/editor/scene_tree_dock.h index 60bec9b4f4..51041a235b 100644 --- a/tools/editor/scene_tree_dock.h +++ b/tools/editor/scene_tree_dock.h @@ -139,7 +139,7 @@ class SceneTreeDock : public VBoxContainer { void _fill_path_renames(Vector<StringName> base_path,Vector<StringName> new_base_path,Node * p_node, List<Pair<NodePath,NodePath> > *p_renames); - void _normalize_drop(Node*& to_node, int &to_pos,int p_type); + void _normalize_drop(Node*& to_node, int &to_pos, int p_type); void _nodes_dragged(Array p_nodes,NodePath p_to,int p_type); void _files_dropped(Vector<String> p_files,NodePath p_to,int p_type); diff --git a/tools/editor/scenes_dock.cpp b/tools/editor/scenes_dock.cpp index cbd7df9d18..fa7c898f91 100644 --- a/tools/editor/scenes_dock.cpp +++ b/tools/editor/scenes_dock.cpp @@ -164,12 +164,14 @@ void ScenesDock::_notification(int p_what) { if (split_mode) { file_list_vb->hide(); + tree->set_custom_minimum_size(Size2(0,0)); tree->set_v_size_flags(SIZE_EXPAND_FILL); button_back->show(); } else { tree->show(); file_list_vb->show(); + tree->set_custom_minimum_size(Size2(0,200)*EDSCALE); tree->set_v_size_flags(SIZE_FILL); button_back->hide(); if (!EditorFileSystem::get_singleton()->is_scanning()) { @@ -187,6 +189,7 @@ void ScenesDock::_notification(int p_what) { initialized=true; EditorFileSystem::get_singleton()->connect("filesystem_changed",this,"_fs_changed"); + EditorResourcePreview::get_singleton()->connect("preview_invalidated",this,"_preview_invalidated"); button_reload->set_icon( get_icon("Reload","EditorIcons")); button_favorite->set_icon( get_icon("Favorites","EditorIcons")); @@ -661,6 +664,27 @@ void ScenesDock::_go_to_dir(const String& p_dir){ } + +void ScenesDock::_preview_invalidated(const String& p_path) { + + if (p_path.get_base_dir()==path && search_box->get_text()==String() && file_list_vb->is_visible()) { + + + for(int i=0;i<files->get_item_count();i++) { + + if (files->get_item_metadata(i)==p_path) { + //re-request preview + Array udata; + udata.resize(2); + udata[0]=i; + udata[1]=files->get_item_text(i); + EditorResourcePreview::get_singleton()->queue_resource_preview(p_path,this,"_thumbnail_done",udata); + break; + } + } + } +} + void ScenesDock::_fs_changed() { button_hist_prev->set_disabled(history_pos==0); @@ -1618,6 +1642,9 @@ void ScenesDock::_bind_methods() { ObjectTypeDB::bind_method(_MD("drop_data_fw"), &ScenesDock::drop_data_fw); ObjectTypeDB::bind_method(_MD("_files_list_rmb_select"),&ScenesDock::_files_list_rmb_select); + ObjectTypeDB::bind_method(_MD("_preview_invalidated"),&ScenesDock::_preview_invalidated); + + ADD_SIGNAL(MethodInfo("instance")); ADD_SIGNAL(MethodInfo("open")); @@ -1702,7 +1729,6 @@ 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); diff --git a/tools/editor/scenes_dock.h b/tools/editor/scenes_dock.h index ed24711abb..0973fce250 100644 --- a/tools/editor/scenes_dock.h +++ b/tools/editor/scenes_dock.h @@ -168,6 +168,8 @@ class ScenesDock : public VBoxContainer { bool can_drop_data_fw(const Point2& p_point,const Variant& p_data,Control* p_from) const; void drop_data_fw(const Point2& p_point,const Variant& p_data,Control* p_from); + void _preview_invalidated(const String& p_path); + protected: void _notification(int p_what); static void _bind_methods(); |