diff --git a/tools/editor/io_plugins/editor_texture_import_plugin.cpp b/tools/editor/io_plugins/editor_texture_import_plugin.cpp index c0887ab40ac..8d5a4f1dcf6 100644 --- a/tools/editor/io_plugins/editor_texture_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_texture_import_plugin.cpp @@ -1180,8 +1180,15 @@ Error EditorTextureImportPlugin::import2(const String& p_path, const Refget_source_count()); @@ -1210,16 +1217,21 @@ Error EditorTextureImportPlugin::import2(const String& p_path, const Ref::Element *E=source_map[i].front();E;E=E->next()) { - Ref at = memnew( AtlasTexture ); + String apath = p_path.get_base_dir().plus_file(from->get_source_path(E->get()).get_file().basename()+".atex"); + Ref at; + if (ResourceCache::has(apath)) { + at = Ref( ResourceCache::get(apath)->cast_to() ); + } else { + + at = Ref( memnew( AtlasTexture ) ); + } at->set_region(region); at->set_margin(margin); - String apath = p_path.get_base_dir().plus_file(from->get_source_path(E->get()).get_file().basename()+".atex"); at->set_path(apath); atlases[E->get()]=at; print_line("Atlas Tex: "+apath); - } } if (ResourceCache::has(p_path)) { diff --git a/tools/editor/script_editor_debugger.cpp b/tools/editor/script_editor_debugger.cpp index 2e1fa2814e2..084e7a6a1f2 100644 --- a/tools/editor/script_editor_debugger.cpp +++ b/tools/editor/script_editor_debugger.cpp @@ -1322,6 +1322,38 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor){ } + VBoxContainer *vmem_vb = memnew( VBoxContainer ); + HBoxContainer *vmem_hb = memnew( HBoxContainer ); + Label *vmlb = memnew(Label("List of Video Memory Usage by Resource: ") ); + vmlb->set_h_size_flags(SIZE_EXPAND_FILL); + vmem_hb->add_child( vmlb ); + vmem_refresh = memnew( Button ); + vmem_hb->add_child(vmem_refresh); + vmem_vb->add_child(vmem_hb); + + MarginContainer *vmmc = memnew( MarginContainer ); + vmmc = memnew( MarginContainer ); + vmem_tree = memnew( Tree ); + vmem_tree->set_v_size_flags(SIZE_EXPAND_FILL); + vmem_tree->set_h_size_flags(SIZE_EXPAND_FILL); + vmmc->add_child(vmem_tree); + vmmc->set_v_size_flags(SIZE_EXPAND_FILL); + vmem_vb->add_child(vmmc); + + vmem_vb->set_name("Video Mem"); + vmem_tree->set_columns(3); + vmem_tree->set_column_titles_visible(true); + vmem_tree->set_column_title(0,"Resource Path"); + vmem_tree->set_column_expand(0,true); + vmem_tree->set_column_expand(1,false); + vmem_tree->set_column_title(1,"Type"); + vmem_tree->set_column_min_width(1,150); + vmem_tree->set_column_expand(2,false); + vmem_tree->set_column_title(2,"Usage"); + vmem_tree->set_column_min_width(2,150); + + tabs->add_child(vmem_vb); + info = memnew( HSplitContainer ); info->set_name("Info"); tabs->add_child(info); diff --git a/tools/editor/script_editor_debugger.h b/tools/editor/script_editor_debugger.h index 3c66dde340c..04459e39f80 100644 --- a/tools/editor/script_editor_debugger.h +++ b/tools/editor/script_editor_debugger.h @@ -96,6 +96,9 @@ class ScriptEditorDebugger : public Control { Tree *perf_monitors; Control *perf_draw; + Tree *vmem_tree; + Button *vmem_refresh; + Tree *stack_dump; PropertyEditor *inspector;