Merge pull request #5467 from RandomShaper/enhance-tidy-extensions
Enhance/tidy file extensions management
This commit is contained in:
commit
24d86e33a6
6 changed files with 17 additions and 37 deletions
|
@ -1105,14 +1105,9 @@ void ResourceFormatLoaderBinary::get_recognized_extensions_for_type(const String
|
|||
|
||||
for(List<String>::Element *E=extensions.front();E;E=E->next()) {
|
||||
String ext = E->get().to_lower();
|
||||
if (ext=="res")
|
||||
continue;
|
||||
// p_extensions->push_back("x"+ext);
|
||||
p_extensions->push_back(ext);
|
||||
}
|
||||
|
||||
p_extensions->push_back("res");
|
||||
|
||||
}
|
||||
void ResourceFormatLoaderBinary::get_recognized_extensions(List<String> *p_extensions) const{
|
||||
|
||||
|
@ -1122,12 +1117,9 @@ void ResourceFormatLoaderBinary::get_recognized_extensions(List<String> *p_exten
|
|||
|
||||
for(List<String>::Element *E=extensions.front();E;E=E->next()) {
|
||||
String ext = E->get().to_lower();
|
||||
if (ext=="res")
|
||||
continue;
|
||||
p_extensions->push_back(ext);
|
||||
}
|
||||
|
||||
p_extensions->push_back("res");
|
||||
}
|
||||
|
||||
bool ResourceFormatLoaderBinary::handles_type(const String& p_type) const{
|
||||
|
@ -2270,16 +2262,8 @@ bool ResourceFormatSaverBinary::recognize(const RES& p_resource) const {
|
|||
|
||||
void ResourceFormatSaverBinary::get_recognized_extensions(const RES& p_resource,List<String> *p_extensions) const {
|
||||
|
||||
|
||||
//here comes the sun, lalalala
|
||||
String base = p_resource->get_base_extension().to_lower();
|
||||
if (base!="res") {
|
||||
|
||||
p_extensions->push_back(base);
|
||||
}
|
||||
|
||||
p_extensions->push_back("res");
|
||||
|
||||
p_extensions->push_back(base);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#include "scene_format_text.h"
|
||||
#include "resource_format_text.h"
|
||||
|
||||
#include "globals.h"
|
||||
#include "version.h"
|
|
@ -42,6 +42,7 @@
|
|||
#include "translation.h"
|
||||
#include "compressed_translation.h"
|
||||
#include "io/translation_loader_po.h"
|
||||
#include "io/resource_format_text.h"
|
||||
#include "io/resource_format_xml.h"
|
||||
#include "io/resource_format_binary.h"
|
||||
#include "io/stream_peer_ssl.h"
|
||||
|
@ -53,6 +54,9 @@
|
|||
#include "input_map.h"
|
||||
#include "undo_redo.h"
|
||||
|
||||
|
||||
static ResourceFormatSaverText *resource_saver_text=NULL;
|
||||
static ResourceFormatLoaderText *resource_loader_text=NULL;
|
||||
#ifdef XML_ENABLED
|
||||
static ResourceFormatSaverXML *resource_saver_xml=NULL;
|
||||
static ResourceFormatLoaderXML *resource_loader_xml=NULL;
|
||||
|
@ -96,6 +100,11 @@ void register_core_types() {
|
|||
resource_format_po = memnew( TranslationLoaderPO );
|
||||
ResourceLoader::add_resource_format_loader( resource_format_po );
|
||||
|
||||
// Register text formats before to give them precedence on saving
|
||||
resource_saver_text = memnew( ResourceFormatSaverText );
|
||||
ResourceSaver::add_resource_format_saver(resource_saver_text);
|
||||
resource_loader_text = memnew( ResourceFormatLoaderText );
|
||||
ResourceLoader::add_resource_format_loader(resource_loader_text);
|
||||
|
||||
resource_saver_binary = memnew( ResourceFormatSaverBinary );
|
||||
ResourceSaver::add_resource_format_saver(resource_saver_binary);
|
||||
|
@ -202,6 +211,11 @@ void unregister_core_types() {
|
|||
if (resource_loader_binary)
|
||||
memdelete(resource_loader_binary);
|
||||
|
||||
if (resource_saver_text)
|
||||
memdelete(resource_saver_text);
|
||||
if (resource_loader_text)
|
||||
memdelete(resource_loader_text);
|
||||
|
||||
|
||||
memdelete( resource_format_po );
|
||||
|
||||
|
|
|
@ -222,8 +222,6 @@
|
|||
#include "scene/3d/collision_polygon.h"
|
||||
#endif
|
||||
|
||||
#include "scene/resources/scene_format_text.h"
|
||||
|
||||
static ResourceFormatLoaderImage *resource_loader_image=NULL;
|
||||
static ResourceFormatLoaderWAV *resource_loader_wav=NULL;
|
||||
|
||||
|
@ -235,9 +233,6 @@ static ResourceFormatLoaderWAV *resource_loader_wav=NULL;
|
|||
static ResourceFormatLoaderTheme *resource_loader_theme=NULL;
|
||||
static ResourceFormatLoaderShader *resource_loader_shader=NULL;
|
||||
|
||||
static ResourceFormatSaverText *resource_saver_text=NULL;
|
||||
static ResourceFormatLoaderText *resource_loader_text=NULL;
|
||||
|
||||
static ResourceFormatLoaderDynamicFont *resource_loader_dynamic_font=NULL;
|
||||
|
||||
//static SceneStringNames *string_names;
|
||||
|
@ -635,13 +630,6 @@ void register_scene_types() {
|
|||
|
||||
OS::get_singleton()->yield(); //may take time to init
|
||||
|
||||
|
||||
resource_saver_text = memnew( ResourceFormatSaverText );
|
||||
ResourceSaver::add_resource_format_saver(resource_saver_text);
|
||||
|
||||
resource_loader_text = memnew( ResourceFormatLoaderText );
|
||||
ResourceLoader::add_resource_format_loader(resource_loader_text);
|
||||
|
||||
}
|
||||
|
||||
void unregister_scene_types() {
|
||||
|
@ -661,11 +649,5 @@ void unregister_scene_types() {
|
|||
memdelete( resource_loader_theme );
|
||||
memdelete( resource_loader_shader );
|
||||
|
||||
if (resource_saver_text) {
|
||||
memdelete(resource_saver_text);
|
||||
}
|
||||
if (resource_loader_text) {
|
||||
memdelete(resource_loader_text);
|
||||
}
|
||||
SceneStringNames::free();
|
||||
}
|
||||
|
|
|
@ -2154,7 +2154,7 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) {
|
|||
String existing;
|
||||
if (extensions.size()) {
|
||||
String root_name(get_edited_scene()->get_name());
|
||||
existing=root_name+".tscn";//+extensions.front()->get().to_lower();
|
||||
existing=root_name+"."+extensions.front()->get().to_lower();
|
||||
}
|
||||
file->set_current_path(existing);
|
||||
|
||||
|
|
Loading…
Reference in a new issue