Removed import/export system, will start new one from scratch.

This commit is contained in:
Juan Linietsky 2017-01-25 21:55:59 -03:00
parent ae258e2679
commit 96de0141cc
56 changed files with 350 additions and 805 deletions

View file

@ -106,17 +106,12 @@ bool _ResourceLoader::has(const String &p_path) {
return ResourceCache::has(local_path); return ResourceCache::has(local_path);
}; };
Ref<ResourceImportMetadata> _ResourceLoader::load_import_metadata(const String& p_path) {
return ResourceLoader::load_import_metadata(p_path);
}
void _ResourceLoader::_bind_methods() { void _ResourceLoader::_bind_methods() {
ClassDB::bind_method(_MD("load_interactive:ResourceInteractiveLoader","path","type_hint"),&_ResourceLoader::load_interactive,DEFVAL("")); ClassDB::bind_method(_MD("load_interactive:ResourceInteractiveLoader","path","type_hint"),&_ResourceLoader::load_interactive,DEFVAL(""));
ClassDB::bind_method(_MD("load:Resource","path","type_hint", "p_no_cache"),&_ResourceLoader::load,DEFVAL(""), DEFVAL(false)); ClassDB::bind_method(_MD("load:Resource","path","type_hint", "p_no_cache"),&_ResourceLoader::load,DEFVAL(""), DEFVAL(false));
ClassDB::bind_method(_MD("load_import_metadata:ResourceImportMetadata","path"),&_ResourceLoader::load_import_metadata);
ClassDB::bind_method(_MD("get_recognized_extensions_for_type","type"),&_ResourceLoader::get_recognized_extensions_for_type); ClassDB::bind_method(_MD("get_recognized_extensions_for_type","type"),&_ResourceLoader::get_recognized_extensions_for_type);
ClassDB::bind_method(_MD("set_abort_on_missing_resources","abort"),&_ResourceLoader::set_abort_on_missing_resources); ClassDB::bind_method(_MD("set_abort_on_missing_resources","abort"),&_ResourceLoader::set_abort_on_missing_resources);
ClassDB::bind_method(_MD("get_dependencies","path"),&_ResourceLoader::get_dependencies); ClassDB::bind_method(_MD("get_dependencies","path"),&_ResourceLoader::get_dependencies);

View file

@ -54,7 +54,6 @@ public:
void set_abort_on_missing_resources(bool p_abort); void set_abort_on_missing_resources(bool p_abort);
PoolStringArray get_dependencies(const String& p_path); PoolStringArray get_dependencies(const String& p_path);
bool has(const String& p_path); bool has(const String& p_path);
Ref<ResourceImportMetadata> load_import_metadata(const String& p_path);
_ResourceLoader(); _ResourceLoader();
}; };

View file

@ -759,30 +759,7 @@ Error ResourceInteractiveLoaderBinary::poll(){
resource_cache.push_back(res); resource_cache.push_back(res);
if (main) { if (main) {
if (importmd_ofs) {
f->seek(importmd_ofs);
Ref<ResourceImportMetadata> imd = memnew( ResourceImportMetadata );
imd->set_editor(get_unicode_string());
int sc = f->get_32();
for(int i=0;i<sc;i++) {
String src = get_unicode_string();
String md5 = get_unicode_string();
imd->add_source(src,md5);
}
int pc = f->get_32();
for(int i=0;i<pc;i++) {
String name = get_unicode_string();
Variant val;
parse_variant(val);
imd->set_option(name,val);
}
res->set_import_metadata(imd);
}
f->close(); f->close();
resource=res; resource=res;
error=ERR_FILE_EOF; error=ERR_FILE_EOF;
@ -849,9 +826,6 @@ void ResourceInteractiveLoaderBinary::get_dependencies(FileAccess *p_f,List<Stri
for(int i=0;i<external_resources.size();i++) { for(int i=0;i<external_resources.size();i++) {
String dep=external_resources[i].path; String dep=external_resources[i].path;
if (dep.ends_with("*")) {
dep=ResourceLoader::guess_full_filename(dep,external_resources[i].type);
}
if (p_add_types && external_resources[i].type!=String()) { if (p_add_types && external_resources[i].type!=String()) {
dep+="::"+external_resources[i].type; dep+="::"+external_resources[i].type;
@ -1104,53 +1078,6 @@ bool ResourceFormatLoaderBinary::handles_type(const String& p_type) const{
return true; //handles all return true; //handles all
} }
Error ResourceFormatLoaderBinary::load_import_metadata(const String &p_path, Ref<ResourceImportMetadata>& r_var) const {
FileAccess *f = FileAccess::open(p_path,FileAccess::READ);
if (!f) {
return ERR_FILE_CANT_OPEN;
}
Ref<ResourceInteractiveLoaderBinary> ria = memnew( ResourceInteractiveLoaderBinary );
ria->local_path=GlobalConfig::get_singleton()->localize_path(p_path);
ria->res_path=ria->local_path;
//ria->set_local_path( Globals::get_singleton()->localize_path(p_path) );
ria->recognize(f);
if(ria->error!=OK)
return ERR_FILE_UNRECOGNIZED;
f=ria->f;
uint64_t imp_ofs = f->get_64();
if (imp_ofs==0)
return ERR_UNAVAILABLE;
f->seek(imp_ofs);
Ref<ResourceImportMetadata> imd = memnew( ResourceImportMetadata );
imd->set_editor(ria->get_unicode_string());
int sc = f->get_32();
for(int i=0;i<sc;i++) {
String src = ria->get_unicode_string();
String md5 = ria->get_unicode_string();
imd->add_source(src,md5);
}
int pc = f->get_32();
for(int i=0;i<pc;i++) {
String name = ria->get_unicode_string();
Variant val;
ria->parse_variant(val);
imd->set_option(name,val);
}
r_var=imd;
return OK;
}
void ResourceFormatLoaderBinary::get_dependencies(const String& p_path,List<String> *p_dependencies,bool p_add_types) { void ResourceFormatLoaderBinary::get_dependencies(const String& p_path,List<String> *p_dependencies,bool p_add_types) {
@ -2179,30 +2106,6 @@ Error ResourceFormatSaverBinaryInstance::save(const String &p_path,const RES& p_
} }
f->seek_end(); f->seek_end();
print_line("SAVING: "+p_path);
if (p_resource->get_import_metadata().is_valid()) {
uint64_t md_pos = f->get_pos();
Ref<ResourceImportMetadata> imd=p_resource->get_import_metadata();
save_unicode_string(imd->get_editor());
f->store_32(imd->get_source_count());
for(int i=0;i<imd->get_source_count();i++) {
save_unicode_string(imd->get_source_path(i));
save_unicode_string(imd->get_source_md5(i));
print_line("SAVE PATH: "+imd->get_source_path(i));
print_line("SAVE MD5: "+imd->get_source_md5(i));
}
List<String> options;
imd->get_options(&options);
f->store_32(options.size());
for(List<String>::Element *E=options.front();E;E=E->next()) {
save_unicode_string(E->get());
write_variant(imd->get_option(E->get()));
}
f->seek(md_at);
f->store_64(md_pos);
f->seek_end();
}
f->store_buffer((const uint8_t*)"RSRC",4); //magic at end f->store_buffer((const uint8_t*)"RSRC",4); //magic at end

View file

@ -109,7 +109,6 @@ public:
virtual bool handles_type(const String& p_type) const; virtual bool handles_type(const String& p_type) const;
virtual String get_resource_type(const String &p_path) const; virtual String get_resource_type(const String &p_path) const;
virtual void get_dependencies(const String& p_path, List<String> *p_dependencies, bool p_add_types=false); virtual void get_dependencies(const String& p_path, List<String> *p_dependencies, bool p_add_types=false);
virtual Error load_import_metadata(const String &p_path, Ref<ResourceImportMetadata>& r_var) const;
virtual Error rename_dependencies(const String &p_path,const Map<String,String>& p_map); virtual Error rename_dependencies(const String &p_path,const Map<String,String>& p_map);

154
core/io/resource_import.cpp Normal file
View file

@ -0,0 +1,154 @@
#include "resource_import.h"
#include "variant_parser.h"
Error ResourceFormatImporter::_get_path_and_type(const String& p_path, PathAndType &r_path_and_type) const {
Error err;
FileAccess *f= FileAccess::open(p_path+".import",FileAccess::READ,&err);
if (!f)
return err;
VariantParser::StreamFile stream;
stream.f=f;
String assign;
Variant value;
VariantParser::Tag next_tag;
int lines=0;
String error_text;
while(true) {
assign=Variant();
next_tag.fields.clear();
next_tag.name=String();
err = VariantParser::parse_tag_assign_eof(&stream,lines,error_text,next_tag,assign,value,NULL,true);
if (err==ERR_FILE_EOF) {
memdelete(f);
return OK;
}
else if (err!=OK) {
ERR_PRINTS("ResourceFormatImporter::load - "+p_path+":"+itos(lines)+" error: "+error_text);
memdelete(f);
return err;
}
if (assign!=String()) {
if (assign=="path") {
r_path_and_type.path=value;
} else if (assign=="type") {
r_path_and_type.type=value;
}
} else if (next_tag.name!="remap") {
break;
}
}
memdelete(f);
if (r_path_and_type.path==String() || r_path_and_type.type==String()) {
return ERR_FILE_CORRUPT;
}
return OK;
}
RES ResourceFormatImporter::load(const String &p_path,const String& p_original_path,Error *r_error) {
PathAndType pat;
Error err = _get_path_and_type(p_path,pat);
if (err!=OK) {
if (r_error)
*r_error=err;
return RES();
}
return ResourceLoader::load(pat.path,pat.type,false,r_error);
}
void ResourceFormatImporter::get_recognized_extensions(List<String> *p_extensions) const{
Set<String> found;
for (Set< Ref<ResourceImporter> >::Element *E=importers.front();E;E=E->next()) {
List<String> local_exts;
E->get()->get_recognized_extensions(&local_exts);
for (List<String>::Element *F=local_exts.front();F;F=F->next()) {
if (!found.has(F->get())) {
p_extensions->push_back(F->get());
found.insert(F->get());
}
}
}
}
void ResourceFormatImporter::get_recognized_extensions_for_type(const String& p_type,List<String> *p_extensions) const{
Set<String> found;
for (Set< Ref<ResourceImporter> >::Element *E=importers.front();E;E=E->next()) {
if (!ClassDB::is_parent_class(p_type,E->get()->get_resource_type()))
continue;
List<String> local_exts;
E->get()->get_recognized_extensions(&local_exts);
for (List<String>::Element *F=local_exts.front();F;F=F->next()) {
if (!found.has(F->get())) {
p_extensions->push_back(F->get());
found.insert(F->get());
}
}
}
}
bool ResourceFormatImporter::recognize_path(const String& p_path,const String& p_for_type) const{
return (p_path.get_extension().to_lower()=="import");
}
bool ResourceFormatImporter::handles_type(const String& p_type) const {
for (Set< Ref<ResourceImporter> >::Element *E=importers.front();E;E=E->next()) {
if (ClassDB::is_parent_class(p_type,E->get()->get_resource_type()))
return true;
}
return true;
}
String ResourceFormatImporter::get_resource_type(const String &p_path) const {
PathAndType pat;
Error err = _get_path_and_type(p_path,pat);
if (err!=OK) {
return "";
}
return pat.type;
}
void ResourceFormatImporter::get_dependencies(const String& p_path,List<String> *p_dependencies,bool p_add_types){
PathAndType pat;
Error err = _get_path_and_type(p_path,pat);
if (err!=OK) {
return;
}
return ResourceLoader::get_dependencies(pat.path,p_dependencies,p_add_types);
}

50
core/io/resource_import.h Normal file
View file

@ -0,0 +1,50 @@
#ifndef RESOURCE_IMPORT_H
#define RESOURCE_IMPORT_H
#include "io/resource_loader.h"
class ResourceImporter;
class ResourceFormatImporter : public ResourceFormatLoader {
struct PathAndType {
String path;
String type;
};
Error _get_path_and_type(const String& p_path,PathAndType & r_path_and_type) const;
Set< Ref<ResourceImporter> > importers;
public:
virtual RES load(const String &p_path,const String& p_original_path="",Error *r_error=NULL);
virtual void get_recognized_extensions(List<String> *p_extensions) const;
virtual void get_recognized_extensions_for_type(const String& p_type,List<String> *p_extensions) const;
bool recognize_path(const String& p_path,const String& p_for_type=String()) const;
virtual bool handles_type(const String& p_type) const=0;
virtual String get_resource_type(const String &p_path) const=0;
virtual void get_dependencies(const String& p_path,List<String> *p_dependencies,bool p_add_types=false);
};
class ResourceImporter {
public:
virtual String get_name() const=0;
virtual String get_visible_name() const=0;
virtual void get_recognized_extensions(List<String> *p_extensions) const=0;
virtual String get_resource_type() const=0;
struct ImportOption {
PropertyInfo option;
Variant default_value;
};
virtual void get_import_options(List<ImportOption> *r_options)=0;
virtual RES import(const String& p_path,const Map<StringName,Variant>& p_options)=0;
};
#endif // RESOURCE_IMPORT_H

View file

@ -47,21 +47,29 @@ Error ResourceInteractiveLoader::wait() {
return err; return err;
} }
bool ResourceFormatLoader::recognize_path(const String& p_path,const String& p_for_type) const {
bool ResourceFormatLoader::recognize(const String& p_extension) const {
String extension = p_path.get_extension();
List<String> extensions; List<String> extensions;
get_recognized_extensions(&extensions); if (p_for_type==String()) {
get_recognized_extensions(&extensions);
} else {
get_recognized_extensions_for_type(p_for_type,&extensions);
}
for (List<String>::Element *E=extensions.front();E;E=E->next()) { for (List<String>::Element *E=extensions.front();E;E=E->next()) {
if (E->get().nocasecmp_to(p_extension.get_extension())==0) if (E->get().nocasecmp_to(extension)==0)
return true; return true;
} }
return false; return false;
} }
void ResourceFormatLoader::get_recognized_extensions_for_type(const String& p_type,List<String> *p_extensions) const { void ResourceFormatLoader::get_recognized_extensions_for_type(const String& p_type,List<String> *p_extensions) const {
if (p_type=="" || handles_type(p_type)) if (p_type=="" || handles_type(p_type))
@ -166,7 +174,7 @@ RES ResourceLoader::load(const String &p_path, const String& p_type_hint, bool p
else else
local_path = GlobalConfig::get_singleton()->localize_path(p_path); local_path = GlobalConfig::get_singleton()->localize_path(p_path);
local_path=find_complete_path(local_path,p_type_hint);
ERR_FAIL_COND_V(local_path=="",RES()); ERR_FAIL_COND_V(local_path=="",RES());
if (!p_no_cache && ResourceCache::has(local_path)) { if (!p_no_cache && ResourceCache::has(local_path)) {
@ -177,22 +185,16 @@ RES ResourceLoader::load(const String &p_path, const String& p_type_hint, bool p
return RES( ResourceCache::get(local_path ) ); return RES( ResourceCache::get(local_path ) );
} }
String remapped_path = PathRemap::get_singleton()->get_remap(local_path);
if (OS::get_singleton()->is_stdout_verbose()) if (OS::get_singleton()->is_stdout_verbose())
print_line("load resource: "+remapped_path); print_line("load resource: "+local_path);
String extension=remapped_path.get_extension();
bool found=false; bool found=false;
for (int i=0;i<loader_count;i++) { for (int i=0;i<loader_count;i++) {
if (!loader[i]->recognize(extension)) if (!loader[i]->recognize_path(local_path,p_type_hint))
continue;
if (p_type_hint!="" && !loader[i]->handles_type(p_type_hint))
continue; continue;
found=true; found=true;
RES res = loader[i]->load(remapped_path,local_path,r_error); RES res = loader[i]->load(local_path,local_path,r_error);
if (res.is_null()) if (res.is_null())
continue; continue;
if (!p_no_cache) if (!p_no_cache)
@ -201,7 +203,7 @@ RES ResourceLoader::load(const String &p_path, const String& p_type_hint, bool p
res->set_edited(false); res->set_edited(false);
if (timestamp_on_load) { if (timestamp_on_load) {
uint64_t mt = FileAccess::get_modified_time(remapped_path); uint64_t mt = FileAccess::get_modified_time(local_path);
//printf("mt %s: %lli\n",remapped_path.utf8().get_data(),mt); //printf("mt %s: %lli\n",remapped_path.utf8().get_data(),mt);
res->set_last_modified_time(mt); res->set_last_modified_time(mt);
} }
@ -220,82 +222,6 @@ RES ResourceLoader::load(const String &p_path, const String& p_type_hint, bool p
} }
Ref<ResourceImportMetadata> ResourceLoader::load_import_metadata(const String &p_path) {
String local_path;
if (p_path.is_rel_path())
local_path="res://"+p_path;
else
local_path = GlobalConfig::get_singleton()->localize_path(p_path);
String extension=p_path.get_extension();
Ref<ResourceImportMetadata> ret;
for (int i=0;i<loader_count;i++) {
if (!loader[i]->recognize(extension))
continue;
Error err = loader[i]->load_import_metadata(local_path,ret);
if (err==OK)
break;
}
return ret;
}
String ResourceLoader::find_complete_path(const String& p_path,const String& p_type) {
//this is an old vestige when the engine saved files without extension.
//remains here for compatibility with old projects and only because it
//can be sometimes nice to open files using .* from a script and have it guess
//the right extension.
String local_path = p_path;
if (local_path.ends_with("*")) {
//find the extension for resource that ends with *
local_path = local_path.substr(0,local_path.length()-1);
List<String> extensions;
get_recognized_extensions_for_type(p_type,&extensions);
List<String> candidates;
for(List<String>::Element *E=extensions.front();E;E=E->next()) {
String path = local_path+E->get();
if (PathRemap::get_singleton()->has_remap(path) || FileAccess::exists(path)) {
candidates.push_back(path);
}
}
if (candidates.size()==0) {
return "";
} else if (candidates.size()==1 || p_type=="") {
return candidates.front()->get();
} else {
for(List<String>::Element *E=candidates.front();E;E=E->next()) {
String rt = get_resource_type(E->get());
if (ClassDB::is_parent_class(rt,p_type)) {
return E->get();
}
}
return "";
}
}
return local_path;
}
Ref<ResourceInteractiveLoader> ResourceLoader::load_interactive(const String &p_path,const String& p_type_hint,bool p_no_cache,Error *r_error) { Ref<ResourceInteractiveLoader> ResourceLoader::load_interactive(const String &p_path,const String& p_type_hint,bool p_no_cache,Error *r_error) {
@ -309,7 +235,7 @@ Ref<ResourceInteractiveLoader> ResourceLoader::load_interactive(const String &p_
else else
local_path = GlobalConfig::get_singleton()->localize_path(p_path); local_path = GlobalConfig::get_singleton()->localize_path(p_path);
local_path=find_complete_path(local_path,p_type_hint);
ERR_FAIL_COND_V(local_path=="",Ref<ResourceInteractiveLoader>()); ERR_FAIL_COND_V(local_path=="",Ref<ResourceInteractiveLoader>());
@ -329,19 +255,14 @@ Ref<ResourceInteractiveLoader> ResourceLoader::load_interactive(const String &p_
if (OS::get_singleton()->is_stdout_verbose()) if (OS::get_singleton()->is_stdout_verbose())
print_line("load resource: "); print_line("load resource: ");
String remapped_path = PathRemap::get_singleton()->get_remap(local_path);
String extension=remapped_path.get_extension();
bool found=false; bool found=false;
for (int i=0;i<loader_count;i++) { for (int i=0;i<loader_count;i++) {
if (!loader[i]->recognize(extension)) if (!loader[i]->recognize_path(local_path,p_type_hint))
continue;
if (p_type_hint!="" && !loader[i]->handles_type(p_type_hint))
continue; continue;
found=true; found=true;
Ref<ResourceInteractiveLoader> ril = loader[i]->load_interactive(remapped_path,r_error); Ref<ResourceInteractiveLoader> ril = loader[i]->load_interactive(local_path,r_error);
if (ril.is_null()) if (ril.is_null())
continue; continue;
if (!p_no_cache) if (!p_no_cache)
@ -383,20 +304,16 @@ void ResourceLoader::get_dependencies(const String& p_path, List<String> *p_depe
else else
local_path = GlobalConfig::get_singleton()->localize_path(p_path); local_path = GlobalConfig::get_singleton()->localize_path(p_path);
String remapped_path = PathRemap::get_singleton()->get_remap(local_path);
String extension=remapped_path.get_extension();
for (int i=0;i<loader_count;i++) { for (int i=0;i<loader_count;i++) {
if (!loader[i]->recognize(extension)) if (!loader[i]->recognize_path(local_path))
continue; continue;
/* /*
if (p_type_hint!="" && !loader[i]->handles_type(p_type_hint)) if (p_type_hint!="" && !loader[i]->handles_type(p_type_hint))
continue; continue;
*/ */
loader[i]->get_dependencies(remapped_path,p_dependencies,p_add_types); loader[i]->get_dependencies(local_path,p_dependencies,p_add_types);
} }
} }
@ -410,20 +327,17 @@ Error ResourceLoader::rename_dependencies(const String &p_path,const Map<String,
else else
local_path = GlobalConfig::get_singleton()->localize_path(p_path); local_path = GlobalConfig::get_singleton()->localize_path(p_path);
String remapped_path = PathRemap::get_singleton()->get_remap(local_path);
String extension=remapped_path.get_extension();
for (int i=0;i<loader_count;i++) { for (int i=0;i<loader_count;i++) {
if (!loader[i]->recognize(extension)) if (!loader[i]->recognize_path(local_path))
continue; continue;
/* /*
if (p_type_hint!="" && !loader[i]->handles_type(p_type_hint)) if (p_type_hint!="" && !loader[i]->handles_type(p_type_hint))
continue; continue;
*/ */
return loader[i]->rename_dependencies(p_path,p_map); return loader[i]->rename_dependencies(local_path,p_map);
} }
@ -432,17 +346,6 @@ Error ResourceLoader::rename_dependencies(const String &p_path,const Map<String,
} }
String ResourceLoader::guess_full_filename(const String &p_path,const String& p_type) {
String local_path;
if (p_path.is_rel_path())
local_path="res://"+p_path;
else
local_path = GlobalConfig::get_singleton()->localize_path(p_path);
return find_complete_path(local_path,p_type);
}
String ResourceLoader::get_resource_type(const String &p_path) { String ResourceLoader::get_resource_type(const String &p_path) {
@ -452,8 +355,6 @@ String ResourceLoader::get_resource_type(const String &p_path) {
else else
local_path = GlobalConfig::get_singleton()->localize_path(p_path); local_path = GlobalConfig::get_singleton()->localize_path(p_path);
String remapped_path = PathRemap::get_singleton()->get_remap(local_path);
String extension=remapped_path.get_extension();
for (int i=0;i<loader_count;i++) { for (int i=0;i<loader_count;i++) {

View file

@ -61,11 +61,10 @@ public:
virtual RES load(const String &p_path,const String& p_original_path="",Error *r_error=NULL); virtual RES load(const String &p_path,const String& p_original_path="",Error *r_error=NULL);
virtual void get_recognized_extensions(List<String> *p_extensions) const=0; virtual void get_recognized_extensions(List<String> *p_extensions) const=0;
virtual void get_recognized_extensions_for_type(const String& p_type,List<String> *p_extensions) const; virtual void get_recognized_extensions_for_type(const String& p_type,List<String> *p_extensions) const;
bool recognize(const String& p_extension) const; bool recognize_path(const String& p_path,const String& p_for_type=String()) const;
virtual bool handles_type(const String& p_type) const=0; virtual bool handles_type(const String& p_type) const=0;
virtual String get_resource_type(const String &p_path) const=0; virtual String get_resource_type(const String &p_path) const=0;
virtual void get_dependencies(const String& p_path,List<String> *p_dependencies,bool p_add_types=false); virtual void get_dependencies(const String& p_path,List<String> *p_dependencies,bool p_add_types=false);
virtual Error load_import_metadata(const String &p_path, Ref<ResourceImportMetadata>& r_var) const { return ERR_UNAVAILABLE; }
virtual Error rename_dependencies(const String &p_path,const Map<String,String>& p_map) { return OK; } virtual Error rename_dependencies(const String &p_path,const Map<String,String>& p_map) { return OK; }
virtual ~ResourceFormatLoader() {} virtual ~ResourceFormatLoader() {}
@ -92,14 +91,12 @@ class ResourceLoader {
static DependencyErrorNotify dep_err_notify; static DependencyErrorNotify dep_err_notify;
static bool abort_on_missing_resource; static bool abort_on_missing_resource;
static String find_complete_path(const String& p_path,const String& p_type);
public: public:
static Ref<ResourceInteractiveLoader> load_interactive(const String &p_path,const String& p_type_hint="",bool p_no_cache=false,Error *r_error=NULL); static Ref<ResourceInteractiveLoader> load_interactive(const String &p_path,const String& p_type_hint="",bool p_no_cache=false,Error *r_error=NULL);
static RES load(const String &p_path,const String& p_type_hint="",bool p_no_cache=false,Error *r_error=NULL); static RES load(const String &p_path,const String& p_type_hint="",bool p_no_cache=false,Error *r_error=NULL);
static Ref<ResourceImportMetadata> load_import_metadata(const String &p_path);
static void get_recognized_extensions_for_type(const String& p_type,List<String> *p_extensions); static void get_recognized_extensions_for_type(const String& p_type,List<String> *p_extensions);
static void add_resource_format_loader(ResourceFormatLoader *p_format_loader,bool p_at_front=false); static void add_resource_format_loader(ResourceFormatLoader *p_format_loader,bool p_at_front=false);
@ -107,8 +104,6 @@ public:
static void get_dependencies(const String& p_path,List<String> *p_dependencies,bool p_add_types=false); static void get_dependencies(const String& p_path,List<String> *p_dependencies,bool p_add_types=false);
static Error rename_dependencies(const String &p_path,const Map<String,String>& p_map); static Error rename_dependencies(const String &p_path,const Map<String,String>& p_map);
static String guess_full_filename(const String &p_path,const String& p_type);
static void set_timestamp_on_load(bool p_timestamp) { timestamp_on_load=p_timestamp; } static void set_timestamp_on_load(bool p_timestamp) { timestamp_on_load=p_timestamp; }
static void notify_load_error(const String& p_err) { if (err_notify) err_notify(err_notify_ud,p_err); } static void notify_load_error(const String& p_err) { if (err_notify) err_notify(err_notify_ud,p_err); }
@ -122,4 +117,6 @@ public:
static bool get_abort_on_missing_resources() { return abort_on_missing_resource; } static bool get_abort_on_missing_resources() { return abort_on_missing_resource; }
}; };
#endif #endif

View file

@ -28,185 +28,3 @@
/*************************************************************************/ /*************************************************************************/
#include "path_remap.h" #include "path_remap.h"
#include "globals.h"
#include "os/os.h"
#include "translation.h"
PathRemap* PathRemap::singleton=NULL;
PathRemap* PathRemap::get_singleton() {
return singleton;
}
void PathRemap::add_remap(const String& p_from, const String& p_to,const String& p_locale) {
if (!remap.has(p_from)) {
remap[p_from]=RemapData();
}
if (p_locale==String())
remap[p_from].always=p_to;
else
remap[p_from].locale[p_locale]=p_to;
}
String PathRemap::get_remap(const String& p_from) const {
const RemapData *ptr=remap.getptr(p_from);
if (!ptr) {
if (OS::get_singleton()->is_stdout_verbose())
print_line("remap failed: "+p_from);
return p_from;
} else {
const RemapData *ptr2=NULL;
String locale = TranslationServer::get_singleton()->get_locale();
if (ptr->locale.has(locale)) {
if (OS::get_singleton()->is_stdout_verbose())
print_line("remap found: "+p_from+" -> "+ptr->locale[locale]);
ptr2=remap.getptr(ptr->locale[locale]);
if (ptr2 && ptr2->always!=String()) //may have atlas or export remap too
return ptr2->always;
else
return ptr->locale[locale];
}
int p = locale.find("_");
if (p!=-1) {
locale=locale.substr(0,p);
if (ptr->locale.has(locale)) {
if (OS::get_singleton()->is_stdout_verbose())
print_line("remap found: "+p_from+" -> "+ptr->locale[locale]);
ptr2=remap.getptr(ptr->locale[locale]);
if (ptr2 && ptr2->always!=String()) //may have atlas or export remap too
return ptr2->always;
else
return ptr->locale[locale];
}
}
if (ptr->always!=String()) {
if (OS::get_singleton()->is_stdout_verbose()) {
print_line("remap found: "+p_from+" -> "+ptr->always);
}
return ptr->always;
}
if (OS::get_singleton()->is_stdout_verbose())
print_line("remap failed: "+p_from);
return p_from;
}
}
bool PathRemap::has_remap(const String& p_from) const{
return remap.has(p_from);
}
void PathRemap::erase_remap(const String& p_from){
ERR_FAIL_COND(!remap.has(p_from));
remap.erase(p_from);
}
void PathRemap::clear_remaps() {
remap.clear();
}
void PathRemap::load_remaps() {
// default remaps first
PoolVector<String> remaps;
if (GlobalConfig::get_singleton()->has("remap/all")) {
remaps = GlobalConfig::get_singleton()->get("remap/all");
}
{
int rlen = remaps.size();
ERR_FAIL_COND( rlen%2 );
PoolVector<String>::Read r = remaps.read();
for(int i=0;i<rlen/2;i++) {
String from = r[i*2+0];
String to = r[i*2+1];
add_remap(from,to);
}
}
// platform remaps second, so override
if (GlobalConfig::get_singleton()->has("remap/"+OS::get_singleton()->get_name())) {
remaps = GlobalConfig::get_singleton()->get("remap/"+OS::get_singleton()->get_name());
} else {
remaps.resize(0);
}
//remaps = Globals::get_singleton()->get("remap/PSP");
{
int rlen = remaps.size();
ERR_FAIL_COND( rlen%2 );
PoolVector<String>::Read r = remaps.read();
for(int i=0;i<rlen/2;i++) {
String from = r[i*2+0];
String to = r[i*2+1];
//print_line("add remap: "+from+" -> "+to);
add_remap(from,to);
}
}
//locale based remaps
if (GlobalConfig::get_singleton()->has("locale/translation_remaps")) {
Dictionary remaps = GlobalConfig::get_singleton()->get("locale/translation_remaps");
List<Variant> rk;
remaps.get_key_list(&rk);
for(List<Variant>::Element *E=rk.front();E;E=E->next()) {
String source = E->get();
PoolStringArray sa = remaps[E->get()];
int sas = sa.size();
PoolStringArray::Read r = sa.read();
for(int i=0;i<sas;i++) {
String s = r[i];
int qp = s.find_last(":");
if (qp!=-1) {
String path = s.substr(0,qp);
String locale = s.substr(qp+1,s.length());
add_remap(source,path,locale);
}
}
}
}
}
void PathRemap::_bind_methods() {
ClassDB::bind_method(_MD("add_remap","from","to","locale"),&PathRemap::add_remap,DEFVAL(String()));
ClassDB::bind_method(_MD("has_remap","path"),&PathRemap::has_remap);
ClassDB::bind_method(_MD("get_remap","path"),&PathRemap::get_remap);
ClassDB::bind_method(_MD("erase_remap","path"),&PathRemap::erase_remap);
ClassDB::bind_method(_MD("clear_remaps"),&PathRemap::clear_remaps);
}
PathRemap::PathRemap() {
singleton=this;
}

View file

@ -29,39 +29,4 @@
#ifndef PATH_REMAP_H #ifndef PATH_REMAP_H
#define PATH_REMAP_H #define PATH_REMAP_H
#include "hash_map.h"
#include "ustring.h"
#include "object.h"
class PathRemap : public Object {
GDCLASS(PathRemap,Object);
static PathRemap* singleton;
struct RemapData {
String always;
Map<String,String> locale;
};
HashMap<String,RemapData> remap;
protected:
static void _bind_methods();
public:
void add_remap(const String& p_from, const String& p_to,const String& p_locale=String());
bool has_remap(const String& p_from) const;
//_FORCE_INLINE_ String get_remap(const String& p_from) const { const String *ptr=remap.getptr(p_from); if (!ptr) return p_from; else return *ptr; }
String get_remap(const String& p_from) const;
void erase_remap(const String& p_from);
void clear_remaps();
void load_remaps();
static PathRemap* get_singleton();
PathRemap();
};
#endif // PATH_REMAP_H #endif // PATH_REMAP_H

View file

@ -110,7 +110,6 @@ void register_core_types() {
ClassDB::register_class<Reference>(); ClassDB::register_class<Reference>();
ClassDB::register_class<WeakRef>(); ClassDB::register_class<WeakRef>();
ClassDB::register_class<ResourceImportMetadata>();
ClassDB::register_class<Resource>(); ClassDB::register_class<Resource>();
ClassDB::register_class<FuncRef>(); ClassDB::register_class<FuncRef>();
ClassDB::register_virtual_class<StreamPeer>(); ClassDB::register_virtual_class<StreamPeer>();
@ -179,7 +178,6 @@ void register_core_singletons() {
GlobalConfig::get_singleton()->add_singleton( GlobalConfig::Singleton("Geometry",_Geometry::get_singleton()) ); GlobalConfig::get_singleton()->add_singleton( GlobalConfig::Singleton("Geometry",_Geometry::get_singleton()) );
GlobalConfig::get_singleton()->add_singleton( GlobalConfig::Singleton("ResourceLoader",_ResourceLoader::get_singleton()) ); GlobalConfig::get_singleton()->add_singleton( GlobalConfig::Singleton("ResourceLoader",_ResourceLoader::get_singleton()) );
GlobalConfig::get_singleton()->add_singleton( GlobalConfig::Singleton("ResourceSaver",_ResourceSaver::get_singleton()) ); GlobalConfig::get_singleton()->add_singleton( GlobalConfig::Singleton("ResourceSaver",_ResourceSaver::get_singleton()) );
GlobalConfig::get_singleton()->add_singleton( GlobalConfig::Singleton("PathRemap",PathRemap::get_singleton() ) );
GlobalConfig::get_singleton()->add_singleton( GlobalConfig::Singleton("OS",_OS::get_singleton() ) ); GlobalConfig::get_singleton()->add_singleton( GlobalConfig::Singleton("OS",_OS::get_singleton() ) );
GlobalConfig::get_singleton()->add_singleton( GlobalConfig::Singleton("Engine",_Engine::get_singleton() ) ); GlobalConfig::get_singleton()->add_singleton( GlobalConfig::Singleton("Engine",_Engine::get_singleton() ) );
GlobalConfig::get_singleton()->add_singleton( GlobalConfig::Singleton("ClassDB",_classdb ) ); GlobalConfig::get_singleton()->add_singleton( GlobalConfig::Singleton("ClassDB",_classdb ) );

View file

@ -35,119 +35,6 @@
#include <stdio.h> #include <stdio.h>
void ResourceImportMetadata::set_editor(const String& p_editor) {
editor=p_editor;
}
String ResourceImportMetadata::get_editor() const{
return editor;
}
void ResourceImportMetadata::add_source(const String& p_path,const String& p_md5) {
Source s;
s.md5=p_md5;
s.path=p_path;
sources.push_back(s);
}
String ResourceImportMetadata::get_source_path(int p_idx) const{
ERR_FAIL_INDEX_V(p_idx,sources.size(),String());
return sources[p_idx].path;
}
String ResourceImportMetadata::get_source_md5(int p_idx) const{
ERR_FAIL_INDEX_V(p_idx,sources.size(),String());
return sources[p_idx].md5;
}
void ResourceImportMetadata::set_source_md5(int p_idx,const String& p_md5) {
ERR_FAIL_INDEX(p_idx,sources.size());
sources[p_idx].md5=p_md5;
}
void ResourceImportMetadata::remove_source(int p_idx){
ERR_FAIL_INDEX(p_idx,sources.size());
sources.remove(p_idx);
}
int ResourceImportMetadata::get_source_count() const {
return sources.size();
}
void ResourceImportMetadata::set_option(const String& p_key, const Variant& p_value) {
if (p_value.get_type()==Variant::NIL) {
options.erase(p_key);
return;
}
ERR_FAIL_COND(p_value.get_type() == Variant::OBJECT);
ERR_FAIL_COND(p_value.get_type() == Variant::_RID);
options[p_key]=p_value;
}
bool ResourceImportMetadata::has_option(const String& p_key) const {
return options.has(p_key);
}
Variant ResourceImportMetadata::get_option(const String& p_key) const {
ERR_FAIL_COND_V(!options.has(p_key),Variant());
return options[p_key];
}
void ResourceImportMetadata::get_options(List<String> *r_options) const {
for(Map<String,Variant>::Element *E=options.front();E;E=E->next()) {
r_options->push_back(E->key());
}
}
PoolStringArray ResourceImportMetadata::_get_options() const {
PoolStringArray option_names;
option_names.resize(options.size());
int i=0;
for(Map<String,Variant>::Element *E=options.front();E;E=E->next()) {
option_names.set(i++,E->key());
}
return option_names;
}
void ResourceImportMetadata::_bind_methods() {
ClassDB::bind_method(_MD("set_editor","name"),&ResourceImportMetadata::set_editor);
ClassDB::bind_method(_MD("get_editor"),&ResourceImportMetadata::get_editor);
ClassDB::bind_method(_MD("add_source","path","md5"),&ResourceImportMetadata::add_source, "");
ClassDB::bind_method(_MD("get_source_path","idx"),&ResourceImportMetadata::get_source_path);
ClassDB::bind_method(_MD("get_source_md5","idx"),&ResourceImportMetadata::get_source_md5);
ClassDB::bind_method(_MD("set_source_md5","idx", "md5"),&ResourceImportMetadata::set_source_md5);
ClassDB::bind_method(_MD("remove_source","idx"),&ResourceImportMetadata::remove_source);
ClassDB::bind_method(_MD("get_source_count"),&ResourceImportMetadata::get_source_count);
ClassDB::bind_method(_MD("set_option","key","value"),&ResourceImportMetadata::set_option);
ClassDB::bind_method(_MD("get_option","key"),&ResourceImportMetadata::get_option);
ClassDB::bind_method(_MD("get_options"),&ResourceImportMetadata::_get_options);
}
ResourceImportMetadata::ResourceImportMetadata() {
}
void Resource::emit_changed() { void Resource::emit_changed() {
@ -381,21 +268,6 @@ void Resource::notify_change_to_owners() {
} }
} }
void Resource::set_import_metadata(const Ref<ResourceImportMetadata>& p_metadata) {
#ifdef TOOLS_ENABLED
import_metadata=p_metadata;
#endif
}
Ref<ResourceImportMetadata> Resource::get_import_metadata() const {
#ifdef TOOLS_ENABLED
return import_metadata;
#else
return Ref<ResourceImportMetadata>();
#endif
}
#ifdef TOOLS_ENABLED #ifdef TOOLS_ENABLED
@ -461,8 +333,6 @@ void Resource::_bind_methods() {
ClassDB::bind_method(_MD("set_name","name"),&Resource::set_name); ClassDB::bind_method(_MD("set_name","name"),&Resource::set_name);
ClassDB::bind_method(_MD("get_name"),&Resource::get_name); ClassDB::bind_method(_MD("get_name"),&Resource::get_name);
ClassDB::bind_method(_MD("get_rid"),&Resource::get_rid); ClassDB::bind_method(_MD("get_rid"),&Resource::get_rid);
ClassDB::bind_method(_MD("set_import_metadata","metadata"),&Resource::set_import_metadata);
ClassDB::bind_method(_MD("get_import_metadata"),&Resource::get_import_metadata);
ClassDB::bind_method(_MD("set_local_to_scene","enable"),&Resource::set_local_to_scene); ClassDB::bind_method(_MD("set_local_to_scene","enable"),&Resource::set_local_to_scene);
ClassDB::bind_method(_MD("is_local_to_scene"),&Resource::is_local_to_scene); ClassDB::bind_method(_MD("is_local_to_scene"),&Resource::is_local_to_scene);
ClassDB::bind_method(_MD("get_local_scene:Node"),&Resource::get_local_scene); ClassDB::bind_method(_MD("get_local_scene:Node"),&Resource::get_local_scene);

View file

@ -46,47 +46,6 @@ virtual String get_base_extension() const { return m_ext; }\
private: private:
class ResourceImportMetadata : public Reference {
GDCLASS( ResourceImportMetadata, Reference );
struct Source {
String path;
String md5;
};
Vector<Source> sources;
String editor;
Map<String,Variant> options;
PoolStringArray _get_options() const;
protected:
static void _bind_methods();
public:
void set_editor(const String& p_editor);
String get_editor() const;
void add_source(const String& p_path,const String& p_md5="");
String get_source_path(int p_idx) const;
String get_source_md5(int p_idx) const;
void set_source_md5(int p_idx,const String& p_md5);
void remove_source(int p_idx);
int get_source_count() const;
void set_option(const String& p_key, const Variant& p_value);
Variant get_option(const String& p_key) const;
bool has_option(const String& p_key) const;
void get_options(List<String> *r_options) const;
ResourceImportMetadata();
};
class Resource : public Reference { class Resource : public Reference {
@ -106,7 +65,6 @@ friend class ResourceCache;
virtual bool _use_builtin_script() const { return true; } virtual bool _use_builtin_script() const { return true; }
#ifdef TOOLS_ENABLED #ifdef TOOLS_ENABLED
Ref<ResourceImportMetadata> import_metadata;
uint64_t last_modified_time; uint64_t last_modified_time;
#endif #endif
@ -147,10 +105,6 @@ public:
Ref<Resource> duplicate(bool p_subresources=false); Ref<Resource> duplicate(bool p_subresources=false);
Ref<Resource> duplicate_for_local_scene(Node *p_scene,Map<Ref<Resource>,Ref<Resource> >& remap_cache); Ref<Resource> duplicate_for_local_scene(Node *p_scene,Map<Ref<Resource>,Ref<Resource> >& remap_cache);
void set_import_metadata(const Ref<ResourceImportMetadata>& p_metadata);
Ref<ResourceImportMetadata> get_import_metadata() const;
void set_local_to_scene(bool p_enable); void set_local_to_scene(bool p_enable);
bool is_local_to_scene() const; bool is_local_to_scene() const;
virtual void setup_local_to_scene(); virtual void setup_local_to_scene();

View file

@ -38,7 +38,7 @@
#include "script_debugger_local.h" #include "script_debugger_local.h"
#include "script_debugger_remote.h" #include "script_debugger_remote.h"
#include "message_queue.h" #include "message_queue.h"
#include "path_remap.h"
#include "input_map.h" #include "input_map.h"
#include "io/resource_loader.h" #include "io/resource_loader.h"
#include "scene/main/scene_main_loop.h" #include "scene/main/scene_main_loop.h"
@ -85,7 +85,7 @@ AudioServer *audio_server=NULL;
static MessageQueue *message_queue=NULL; static MessageQueue *message_queue=NULL;
static Performance *performance = NULL; static Performance *performance = NULL;
static PathRemap *path_remap;
static PackedData *packed_data=NULL; static PackedData *packed_data=NULL;
#ifdef MINIZIP_ENABLED #ifdef MINIZIP_ENABLED
static ZipArchive *zip_packed_data=NULL; static ZipArchive *zip_packed_data=NULL;
@ -215,7 +215,6 @@ Error Main::setup(const char *execpath,int argc, char *argv[],bool p_second_phas
register_core_settings(); //here globals is present register_core_settings(); //here globals is present
path_remap = memnew( PathRemap );
translation_server = memnew( TranslationServer ); translation_server = memnew( TranslationServer );
performance = memnew( Performance ); performance = memnew( Performance );
globals->add_singleton(GlobalConfig::Singleton("Performance",performance)); globals->add_singleton(GlobalConfig::Singleton("Performance",performance));
@ -874,8 +873,6 @@ Error Main::setup(const char *execpath,int argc, char *argv[],bool p_second_phas
memdelete(packed_data); memdelete(packed_data);
if (file_access_network_client) if (file_access_network_client)
memdelete(file_access_network_client); memdelete(file_access_network_client);
if(path_remap)
memdelete(path_remap);
// Note 1: *zip_packed_data live into *packed_data // Note 1: *zip_packed_data live into *packed_data
// Note 2: PackedData::~PackedData destroy this. // Note 2: PackedData::~PackedData destroy this.
@ -935,8 +932,6 @@ Error Main::setup2() {
} }
MAIN_PRINT("Main: Load Remaps"); MAIN_PRINT("Main: Load Remaps");
path_remap->load_remaps();
Color clear = GLOBAL_DEF("rendering/viewport/default_clear_color",Color(0.3,0.3,0.3)); Color clear = GLOBAL_DEF("rendering/viewport/default_clear_color",Color(0.3,0.3,0.3));
VisualServer::get_singleton()->set_default_clear_color(clear); VisualServer::get_singleton()->set_default_clear_color(clear);
@ -1791,8 +1786,6 @@ void Main::cleanup() {
memdelete(input_map); memdelete(input_map);
if (translation_server) if (translation_server)
memdelete( translation_server ); memdelete( translation_server );
if (path_remap)
memdelete(path_remap);
if (globals) if (globals)
memdelete(globals); memdelete(globals);
if (engine) if (engine)

View file

@ -38,7 +38,7 @@
GDScriptLanguage *script_language_gd=NULL; GDScriptLanguage *script_language_gd=NULL;
ResourceFormatLoaderGDScript *resource_loader_gd=NULL; ResourceFormatLoaderGDScript *resource_loader_gd=NULL;
ResourceFormatSaverGDScript *resource_saver_gd=NULL; ResourceFormatSaverGDScript *resource_saver_gd=NULL;
#if 0
#ifdef TOOLS_ENABLED #ifdef TOOLS_ENABLED
#include "tools/editor/editor_import_export.h" #include "tools/editor/editor_import_export.h"
@ -135,7 +135,7 @@ static void register_editor_plugin() {
#endif #endif
#endif
void register_gdscript_types() { void register_gdscript_types() {
ClassDB::register_class<GDScript>(); ClassDB::register_class<GDScript>();
@ -148,11 +148,12 @@ void register_gdscript_types() {
ResourceLoader::add_resource_format_loader(resource_loader_gd); ResourceLoader::add_resource_format_loader(resource_loader_gd);
resource_saver_gd=memnew( ResourceFormatSaverGDScript ); resource_saver_gd=memnew( ResourceFormatSaverGDScript );
ResourceSaver::add_resource_format_saver(resource_saver_gd); ResourceSaver::add_resource_format_saver(resource_saver_gd);
#if 0
#ifdef TOOLS_ENABLED #ifdef TOOLS_ENABLED
EditorNode::add_init_callback(register_editor_plugin); EditorNode::add_init_callback(register_editor_plugin);
#endif #endif
#endif
} }
void unregister_gdscript_types() { void unregister_gdscript_types() {

View file

@ -38,7 +38,7 @@
#include "os/os.h" #include "os/os.h"
#include "platform/android/logo.h" #include "platform/android/logo.h"
#include <string.h> #include <string.h>
#if 0
static const char* android_perms[]={ static const char* android_perms[]={
"ACCESS_CHECKIN_PROPERTIES", "ACCESS_CHECKIN_PROPERTIES",
@ -1915,3 +1915,4 @@ void register_android_exporter() {
EditorImportExport::get_singleton()->add_export_platform(exporter); EditorImportExport::get_singleton()->add_export_platform(exporter);
} }
#endif

View file

@ -40,7 +40,7 @@
#include "io/xml_parser.h" #include "io/xml_parser.h"
#define MAX_DEVICES 5 #define MAX_DEVICES 5
#if 0
class EditorExportPlatformBB10 : public EditorExportPlatform { class EditorExportPlatformBB10 : public EditorExportPlatform {
GDCLASS( EditorExportPlatformBB10,EditorExportPlatform ); GDCLASS( EditorExportPlatformBB10,EditorExportPlatform );
@ -827,3 +827,4 @@ void register_bb10_exporter() {
} }
#endif

View file

@ -38,6 +38,9 @@
#include "os/os.h" #include "os/os.h"
#include "platform/javascript/logo.h" #include "platform/javascript/logo.h"
#include "string.h" #include "string.h"
#if 0
class EditorExportPlatformJavaScript : public EditorExportPlatform { class EditorExportPlatformJavaScript : public EditorExportPlatform {
GDCLASS( EditorExportPlatformJavaScript,EditorExportPlatform ); GDCLASS( EditorExportPlatformJavaScript,EditorExportPlatform );
@ -424,3 +427,4 @@ void register_javascript_exporter() {
} }
#endif

View file

@ -39,7 +39,7 @@
#include "os/os.h" #include "os/os.h"
#include "platform/osx/logo.h" #include "platform/osx/logo.h"
#include "string.h" #include "string.h"
#if 0
class EditorExportPlatformOSX : public EditorExportPlatform { class EditorExportPlatformOSX : public EditorExportPlatform {
@ -546,3 +546,4 @@ void register_osx_exporter() {
} }
#endif

View file

@ -65,7 +65,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*************************************************************************/ *************************************************************************/
#if 0
#include "version.h" #include "version.h"
#include "export.h" #include "export.h"
#include "object.h" #include "object.h"
@ -2390,3 +2390,4 @@ void register_uwp_exporter() {
Ref<EditorExportPlatformUWP> exporter = Ref<EditorExportPlatformUWP>(memnew(EditorExportPlatformUWP)); Ref<EditorExportPlatformUWP> exporter = Ref<EditorExportPlatformUWP>(memnew(EditorExportPlatformUWP));
EditorImportExport::get_singleton()->add_export_platform(exporter); EditorImportExport::get_singleton()->add_export_platform(exporter);
} }
#endif

View file

@ -29,7 +29,7 @@
#include "export.h" #include "export.h"
#include "platform/windows/logo.h" #include "platform/windows/logo.h"
#include "tools/editor/editor_import_export.h" #include "tools/editor/editor_import_export.h"
#if 0
void register_windows_exporter() { void register_windows_exporter() {
Image img(_windows_logo); Image img(_windows_logo);
@ -50,3 +50,4 @@ void register_windows_exporter() {
} }
#endif

View file

@ -30,7 +30,7 @@
#include "platform/x11/logo.h" #include "platform/x11/logo.h"
#include "tools/editor/editor_import_export.h" #include "tools/editor/editor_import_export.h"
#include "scene/resources/texture.h" #include "scene/resources/texture.h"
#if 0
void register_x11_exporter() { void register_x11_exporter() {
Image img(_x11_logo); Image img(_x11_logo);
@ -50,3 +50,4 @@ void register_x11_exporter() {
} }
} }
#endif

View file

@ -55,7 +55,7 @@ if (env["tools"] == "yes"):
reg_exporters = 'void register_exporters() {\n' reg_exporters = 'void register_exporters() {\n'
for e in env.platform_exporters: for e in env.platform_exporters:
env.tool_sources.append("#platform/" + e + "/export/export.cpp") env.tool_sources.append("#platform/" + e + "/export/export.cpp")
reg_exporters += '\tregister_' + e + '_exporter();\n' reg_exporters += '\t//register_' + e + '_exporter();\n'
reg_exporters_inc += '#include "platform/' + e + '/export/export.h"\n' reg_exporters_inc += '#include "platform/' + e + '/export/export.h"\n'
reg_exporters += '}\n' reg_exporters += '}\n'
f = open("register_exporters.cpp", "wb") f = open("register_exporters.cpp", "wb")

View file

@ -769,26 +769,6 @@ Dictionary EditorData::restore_edited_scene_state(EditorSelection *p_selection,
} }
void EditorData::set_edited_scene_import_metadata(Ref<ResourceImportMetadata> p_mdata) {
ERR_FAIL_INDEX(current_edited_scene,edited_scene.size());
edited_scene[current_edited_scene].medatata=p_mdata;
}
Ref<ResourceImportMetadata> EditorData::get_edited_scene_import_metadata(int idx) const{
ERR_FAIL_INDEX_V(current_edited_scene,edited_scene.size(),Ref<ResourceImportMetadata>());
if(idx<0) {
return edited_scene[current_edited_scene].medatata;
} else {
ERR_FAIL_INDEX_V(idx,edited_scene.size(),Ref<ResourceImportMetadata>());
return edited_scene[idx].medatata;
}
}
void EditorData::clear_edited_scenes() { void EditorData::clear_edited_scenes() {
for(int i=0;i<edited_scene.size();i++) { for(int i=0;i<edited_scene.size();i++) {

View file

@ -129,7 +129,6 @@ private:
struct EditedScene { struct EditedScene {
Node* root; Node* root;
Dictionary editor_states; Dictionary editor_states;
Ref<ResourceImportMetadata> medatata;
List<Node*> selection; List<Node*> selection;
Vector<EditorHistory::History> history_stored; Vector<EditorHistory::History> history_stored;
int history_current; int history_current;
@ -184,8 +183,6 @@ public:
void remove_scene(int p_idx); void remove_scene(int p_idx);
void set_edited_scene(int p_idx); void set_edited_scene(int p_idx);
void set_edited_scene_root(Node* p_root); void set_edited_scene_root(Node* p_root);
void set_edited_scene_import_metadata(Ref<ResourceImportMetadata> p_mdata);
Ref<ResourceImportMetadata> get_edited_scene_import_metadata(int p_idx = -1) const;
int get_edited_scene() const; int get_edited_scene() const;
Node* get_edited_scene_root(int p_idx = -1); Node* get_edited_scene_root(int p_idx = -1);
int get_edited_scene_count() const; int get_edited_scene_count() const;

View file

@ -247,6 +247,8 @@ EditorFileSystemDirectory::~EditorFileSystemDirectory() {
EditorFileSystemDirectory::ImportMeta EditorFileSystem::_get_meta(const String& p_path) { EditorFileSystemDirectory::ImportMeta EditorFileSystem::_get_meta(const String& p_path) {
return EditorFileSystemDirectory::ImportMeta();
#if 0
Ref<ResourceImportMetadata> imd = ResourceLoader::load_import_metadata(p_path); Ref<ResourceImportMetadata> imd = ResourceLoader::load_import_metadata(p_path);
EditorFileSystemDirectory::ImportMeta m; EditorFileSystemDirectory::ImportMeta m;
if (imd.is_null()) { if (imd.is_null()) {
@ -274,6 +276,7 @@ EditorFileSystemDirectory::ImportMeta EditorFileSystem::_get_meta(const String&
} }
return m; return m;
#endif
} }
@ -535,7 +538,7 @@ bool EditorFileSystem::_check_meta_sources(EditorFileSystemDirectory::ImportMeta
for(int j=0;j<p_meta.sources.size();j++) { for(int j=0;j<p_meta.sources.size();j++) {
#if 0
String src = EditorImportPlugin::expand_source_path(p_meta.sources[j].path); String src = EditorImportPlugin::expand_source_path(p_meta.sources[j].path);
if (!FileAccess::exists(src)) { if (!FileAccess::exists(src)) {
@ -559,6 +562,7 @@ bool EditorFileSystem::_check_meta_sources(EditorFileSystemDirectory::ImportMeta
} }
p_meta.sources[j].modified_time=mt; p_meta.sources[j].modified_time=mt;
} }
#endif
} }
} }

View file

@ -28,6 +28,7 @@
/*************************************************************************/ /*************************************************************************/
#include "editor_import_export.h" #include "editor_import_export.h"
#if 0
#include "version.h" #include "version.h"
#include "script_language.h" #include "script_language.h"
#include "globals.h" #include "globals.h"
@ -2302,3 +2303,4 @@ EditorImportExport::~EditorImportExport() {
} }
#endif

View file

@ -29,6 +29,8 @@
#ifndef EDITOR_IMPORT_EXPORT_H #ifndef EDITOR_IMPORT_EXPORT_H
#define EDITOR_IMPORT_EXPORT_H #define EDITOR_IMPORT_EXPORT_H
#if 0
#include "resource.h" #include "resource.h"
#include "scene/main/node.h" #include "scene/main/node.h"
#include "scene/resources/texture.h" #include "scene/resources/texture.h"
@ -419,4 +421,5 @@ VARIANT_ENUM_CAST(EditorImportExport::ImageAction);
VARIANT_ENUM_CAST(EditorImportExport::ScriptAction); VARIANT_ENUM_CAST(EditorImportExport::ScriptAction);
VARIANT_ENUM_CAST(EditorImportExport::SampleAction); VARIANT_ENUM_CAST(EditorImportExport::SampleAction);
#endif
#endif // EDITOR_IMPORT_EXPORT_H #endif // EDITOR_IMPORT_EXPORT_H

View file

@ -431,7 +431,7 @@ void EditorNode::_fs_changed() {
if (export_defer.platform!="") { if (export_defer.platform!="") {
project_export_settings->export_platform(export_defer.platform,export_defer.path,export_defer.debug,export_defer.password,true); //project_export_settings->export_platform(export_defer.platform,export_defer.path,export_defer.debug,export_defer.password,true);
export_defer.platform=""; export_defer.platform="";
} }
@ -448,7 +448,7 @@ void EditorNode::_sources_changed(bool p_exist) {
EditorProgress ep("reimport",TTR("Re-Importing"),changed_sources.size()); EditorProgress ep("reimport",TTR("Re-Importing"),changed_sources.size());
int step_idx=0; int step_idx=0;
#if 0
for(List<String>::Element *E=changed_sources.front();E;E=E->next()) { for(List<String>::Element *E=changed_sources.front();E;E=E->next()) {
ep.step(TTR("Importing:")+" "+E->get(),step_idx++); ep.step(TTR("Importing:")+" "+E->get(),step_idx++);
@ -467,7 +467,7 @@ void EditorNode::_sources_changed(bool p_exist) {
} }
} }
#endif
EditorFileSystem::get_singleton()->scan_sources(); EditorFileSystem::get_singleton()->scan_sources();
waiting_for_sources_changed=false; waiting_for_sources_changed=false;
@ -502,9 +502,11 @@ void EditorNode::_rebuild_import_menu()
p->clear(); p->clear();
//p->add_item(TTR("Node From Scene"), FILE_IMPORT_SUBSCENE); //p->add_item(TTR("Node From Scene"), FILE_IMPORT_SUBSCENE);
//p->add_separator(); //p->add_separator();
#if 0
for (int i = 0; i < editor_import_export->get_import_plugin_count(); i++) { for (int i = 0; i < editor_import_export->get_import_plugin_count(); i++) {
p->add_item(editor_import_export->get_import_plugin(i)->get_visible_name(), IMPORT_PLUGIN_BASE + i); p->add_item(editor_import_export->get_import_plugin(i)->get_visible_name(), IMPORT_PLUGIN_BASE + i);
} }
#endif
} }
void EditorNode::_node_renamed() { void EditorNode::_node_renamed() {
@ -1008,7 +1010,6 @@ void EditorNode::_save_scene(String p_file, int idx) {
return; return;
} }
sdata->set_import_metadata(editor_data.get_edited_scene_import_metadata(idx));
int flg=0; int flg=0;
if (EditorSettings::get_singleton()->get("filesystem/on_save/compress_binary_resources")) if (EditorSettings::get_singleton()->get("filesystem/on_save/compress_binary_resources"))
flg|=ResourceSaver::FLAG_COMPRESS; flg|=ResourceSaver::FLAG_COMPRESS;
@ -2282,7 +2283,7 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) {
case FILE_EXPORT_PROJECT: { case FILE_EXPORT_PROJECT: {
project_export_settings->popup_export(); //project_export_settings->popup_export();
/* /*
String target = export_db->get_current_platform(); String target = export_db->get_current_platform();
Ref<EditorExporter> exporter = export_db->get_exporter(target); Ref<EditorExporter> exporter = export_db->get_exporter(target);
@ -2861,7 +2862,7 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) {
} break; } break;
case SOURCES_REIMPORT: { case SOURCES_REIMPORT: {
reimport_dialog->popup_reimport(); //reimport_dialog->popup_reimport();
} break; } break;
case DEPENDENCY_LOAD_CHANGED_IMAGES: { case DEPENDENCY_LOAD_CHANGED_IMAGES: {
@ -2951,10 +2952,6 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) {
current->call(name); current->call(name);
} else if (p_option>=IMPORT_PLUGIN_BASE) { } else if (p_option>=IMPORT_PLUGIN_BASE) {
Ref<EditorImportPlugin> p = editor_import_export->get_import_plugin(p_option-IMPORT_PLUGIN_BASE);
if (p.is_valid()) {
p->import_dialog();
}
} }
} }
@ -3055,20 +3052,6 @@ void EditorNode::remove_editor_plugin(EditorPlugin *p_editor) {
} }
void EditorNode::add_editor_import_plugin(const Ref<EditorImportPlugin>& p_editor_import) {
ERR_FAIL_COND( p_editor_import.is_null() );
editor_import_export->add_import_plugin(p_editor_import);
_rebuild_import_menu();
}
void EditorNode::remove_editor_import_plugin(const Ref<EditorImportPlugin>& p_editor_import) {
ERR_FAIL_COND( p_editor_import.is_null() );
editor_import_export->remove_import_plugin(p_editor_import);
_rebuild_import_menu();
}
void EditorNode::_update_addon_config() { void EditorNode::_update_addon_config() {
@ -3812,7 +3795,6 @@ Error EditorNode::load_scene(const String& p_scene, bool p_ignore_broken_deps,bo
property_editor->edit(new_scene); property_editor->edit(new_scene);
editor_data.set_edited_scene_root(new_scene); editor_data.set_edited_scene_root(new_scene);
*/ */
editor_data.set_edited_scene_import_metadata( sdata->get_import_metadata() );
//editor_data.get_undo_redo().clear_history(); //editor_data.get_undo_redo().clear_history();
saved_version=editor_data.get_undo_redo().get_version(); saved_version=editor_data.get_undo_redo().get_version();
@ -4155,9 +4137,9 @@ bool EditorNode::is_scene_in_use(const String& p_path) {
void EditorNode::register_editor_types() { void EditorNode::register_editor_types() {
ClassDB::register_class<EditorPlugin>(); ClassDB::register_class<EditorPlugin>();
ClassDB::register_class<EditorImportPlugin>(); // ClassDB::register_class<EditorImportPlugin>();
ClassDB::register_class<EditorExportPlugin>(); // ClassDB::register_class<EditorExportPlugin>();
ClassDB::register_class<EditorScenePostImport>(); // ClassDB::register_class<EditorScenePostImport>();
ClassDB::register_class<EditorScript>(); ClassDB::register_class<EditorScript>();
ClassDB::register_class<EditorSelection>(); ClassDB::register_class<EditorSelection>();
ClassDB::register_class<EditorFileDialog>(); ClassDB::register_class<EditorFileDialog>();
@ -5187,9 +5169,9 @@ Variant EditorNode::drag_files_and_dirs(const Vector<String>& p_files, Control *
void EditorNode::_dropped_files(const Vector<String>& p_files,int p_screen) { void EditorNode::_dropped_files(const Vector<String>& p_files,int p_screen) {
String cur_path = filesystem_dock->get_current_path(); String cur_path = filesystem_dock->get_current_path();
for(int i=0;i<EditorImportExport::get_singleton()->get_import_plugin_count();i++) { // for(int i=0;i<EditorImportExport::get_singleton()->get_import_plugin_count();i++) {
EditorImportExport::get_singleton()->get_import_plugin(i)->import_from_drop(p_files,cur_path); // EditorImportExport::get_singleton()->get_import_plugin(i)->import_from_drop(p_files,cur_path);
} // }
} }
void EditorNode::_file_access_close_error_notify(const String& p_str) { void EditorNode::_file_access_close_error_notify(const String& p_str) {
@ -5369,8 +5351,8 @@ void EditorNode::_bind_methods() {
ClassDB::bind_method(_MD("add_editor_import_plugin", "plugin"), &EditorNode::add_editor_import_plugin); // ClassDB::bind_method(_MD("add_editor_import_plugin", "plugin"), &EditorNode::add_editor_import_plugin);
ClassDB::bind_method(_MD("remove_editor_import_plugin", "plugin"), &EditorNode::remove_editor_import_plugin); //ClassDB::bind_method(_MD("remove_editor_import_plugin", "plugin"), &EditorNode::remove_editor_import_plugin);
ClassDB::bind_method(_MD("get_gui_base"), &EditorNode::get_gui_base); ClassDB::bind_method(_MD("get_gui_base"), &EditorNode::get_gui_base);
ClassDB::bind_method(_MD("_bottom_panel_switch"), &EditorNode::_bottom_panel_switch); ClassDB::bind_method(_MD("_bottom_panel_switch"), &EditorNode::_bottom_panel_switch);
@ -5423,7 +5405,6 @@ EditorNode::EditorNode() {
FileAccess::set_backup_save(true); FileAccess::set_backup_save(true);
PathRemap::get_singleton()->clear_remaps(); //editor uses no remaps
TranslationServer::get_singleton()->set_enabled(false); TranslationServer::get_singleton()->set_enabled(false);
// load settings // load settings
if (!EditorSettings::get_singleton()) if (!EditorSettings::get_singleton())
@ -5476,13 +5457,8 @@ EditorNode::EditorNode() {
EditorFileDialog::unregister_func=_editor_file_dialog_unregister; EditorFileDialog::unregister_func=_editor_file_dialog_unregister;
editor_import_export = memnew( EditorImportExport );
add_child(editor_import_export);
register_exporters(); register_exporters();
editor_import_export->load_config();
GLOBAL_DEF("editor/main_run_args","$scene"); GLOBAL_DEF("editor/main_run_args","$scene");
ClassDB::set_class_enabled("CollisionShape",true); ClassDB::set_class_enabled("CollisionShape",true);
@ -6396,11 +6372,11 @@ EditorNode::EditorNode() {
//gui_base->add_child(optimized_save); //gui_base->add_child(optimized_save);
//optimized_save->connect("confirmed",this,"_save_optimized"); //optimized_save->connect("confirmed",this,"_save_optimized");
project_export = memnew( ProjectExport(&editor_data) ); //project_export = memnew( ProjectExport(&editor_data) );
gui_base->add_child(project_export); //gui_base->add_child(project_export);
project_export_settings = memnew( ProjectExportDialog(this) ); //project_export_settings = memnew( ProjectExportDialog(this) );
gui_base->add_child(project_export_settings); //gui_base->add_child(project_export_settings);
//optimized_presets = memnew( OptimizedPresetsDialog(&editor_data) ); //optimized_presets = memnew( OptimizedPresetsDialog(&editor_data) );
//gui_base->add_child(optimized_presets); //gui_base->add_child(optimized_presets);
@ -6514,8 +6490,8 @@ EditorNode::EditorNode() {
gui_base->add_child(file_script); gui_base->add_child(file_script);
file_script->connect("file_selected",this,"_dialog_action"); file_script->connect("file_selected",this,"_dialog_action");
reimport_dialog = memnew( EditorReImportDialog ); //reimport_dialog = memnew( EditorReImportDialog );
gui_base->add_child(reimport_dialog); //gui_base->add_child(reimport_dialog);
@ -6541,26 +6517,6 @@ EditorNode::EditorNode() {
file_server = memnew( EditorFileServer ); file_server = memnew( EditorFileServer );
editor_import_export->add_import_plugin( Ref<EditorTextureImportPlugin>( memnew(EditorTextureImportPlugin(this) )));
Ref<EditorSceneImportPlugin> _scene_import = memnew(EditorSceneImportPlugin(this) );
Ref<EditorSceneImporterCollada> _collada_import = memnew( EditorSceneImporterCollada);
_scene_import->add_importer(_collada_import);
//Ref<EditorSceneImporterFBXConv> _fbxconv_import = memnew( EditorSceneImporterFBXConv);
//_scene_import->add_importer(_fbxconv_import);
editor_import_export->add_import_plugin( _scene_import);
// TODO: This plugin has no code, it should be either implemented or dropped (GH-3667)
// editor_import_export->add_import_plugin( Ref<EditorSceneAnimationImportPlugin>( memnew(EditorSceneAnimationImportPlugin(this))));
editor_import_export->add_import_plugin( Ref<EditorMeshImportPlugin>( memnew(EditorMeshImportPlugin(this))));
editor_import_export->add_import_plugin( Ref<EditorFontImportPlugin>( memnew(EditorFontImportPlugin(this))));
// editor_import_export->add_import_plugin( Ref<EditorSampleImportPlugin>( memnew(EditorSampleImportPlugin(this))));
editor_import_export->add_import_plugin( Ref<EditorTranslationImportPlugin>( memnew(EditorTranslationImportPlugin(this))));
editor_import_export->add_import_plugin( Ref<EditorBitMaskImportPlugin>( memnew(EditorBitMaskImportPlugin(this))));
editor_import_export->add_export_plugin( Ref<EditorTextureExportPlugin>( memnew(EditorTextureExportPlugin)));
// editor_import_export->add_export_plugin( Ref<EditorSampleExportPlugin>( memnew(EditorSampleExportPlugin)));
editor_import_export->add_export_plugin( Ref<EditorSceneExportPlugin>( memnew(EditorSceneExportPlugin)));
add_editor_plugin( memnew( AnimationPlayerEditorPlugin(this) ) ); add_editor_plugin( memnew( AnimationPlayerEditorPlugin(this) ) );
add_editor_plugin( memnew( CanvasItemEditorPlugin(this) ) ); add_editor_plugin( memnew( CanvasItemEditorPlugin(this) ) );

View file

@ -340,7 +340,7 @@ private:
Vector<ToolButton*> main_editor_buttons; Vector<ToolButton*> main_editor_buttons;
Vector<EditorPlugin*> editor_table; Vector<EditorPlugin*> editor_table;
EditorReImportDialog *reimport_dialog; // EditorReImportDialog *reimport_dialog;
ProgressDialog *progress_dialog; ProgressDialog *progress_dialog;
BackgroundProgress *progress_hb; BackgroundProgress *progress_hb;
@ -391,8 +391,8 @@ private:
EditorData editor_data; EditorData editor_data;
EditorRun editor_run; EditorRun editor_run;
EditorSelection *editor_selection; EditorSelection *editor_selection;
ProjectExport *project_export; // ProjectExport *project_export;
ProjectExportDialog *project_export_settings; // ProjectExportDialog *project_export_settings;
EditorResourcePreview *resource_preview; EditorResourcePreview *resource_preview;
EditorFileServer *file_server; EditorFileServer *file_server;
@ -647,9 +647,6 @@ public:
void add_control_to_dock(DockSlot p_slot,Control* p_control); void add_control_to_dock(DockSlot p_slot,Control* p_control);
void remove_control_from_dock(Control* p_control); void remove_control_from_dock(Control* p_control);
void add_editor_import_plugin(const Ref<EditorImportPlugin>& p_editor_import);
void remove_editor_import_plugin(const Ref<EditorImportPlugin>& p_editor_import);
void set_addon_plugin_enabled(const String& p_addon,bool p_enabled); void set_addon_plugin_enabled(const String& p_addon,bool p_enabled);
bool is_addon_plugin_enabled(const String &p_addon) const; bool is_addon_plugin_enabled(const String &p_addon) const;

View file

@ -319,27 +319,6 @@ EditorResourcePreview *EditorPlugin::get_resource_previewer() {
return EditorResourcePreview::get_singleton(); 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);
}
void EditorPlugin::remove_import_plugin(const Ref<EditorImportPlugin>& p_editor_import){
EditorNode::get_singleton()->remove_editor_import_plugin(p_editor_import);
}
void EditorPlugin::add_export_plugin(const Ref<EditorExportPlugin>& p_editor_export){
EditorImportExport::get_singleton()->add_export_plugin(p_editor_export);
}
void EditorPlugin::remove_export_plugin(const Ref<EditorExportPlugin>& p_editor_export){
EditorImportExport::get_singleton()->remove_export_plugin(p_editor_export);
}
Control *EditorPlugin::get_base_control() { Control *EditorPlugin::get_base_control() {
return EditorNode::get_singleton()->get_gui_base(); return EditorNode::get_singleton()->get_gui_base();
@ -378,12 +357,6 @@ void EditorPlugin::_bind_methods() {
ClassDB::bind_method(_MD("remove_custom_type","type"),&EditorPlugin::remove_custom_type); ClassDB::bind_method(_MD("remove_custom_type","type"),&EditorPlugin::remove_custom_type);
ClassDB::bind_method(_MD("get_editor_viewport:Control"), &EditorPlugin::get_editor_viewport); ClassDB::bind_method(_MD("get_editor_viewport:Control"), &EditorPlugin::get_editor_viewport);
ClassDB::bind_method(_MD("add_import_plugin","plugin:EditorImportPlugin"),&EditorPlugin::add_import_plugin);
ClassDB::bind_method(_MD("remove_import_plugin","plugin:EditorImportPlugin"),&EditorPlugin::remove_import_plugin);
ClassDB::bind_method(_MD("add_export_plugin","plugin:EditorExportPlugin"),&EditorPlugin::add_export_plugin);
ClassDB::bind_method(_MD("remove_export_plugin","plugin:EditorExportPlugin"),&EditorPlugin::remove_export_plugin);
ClassDB::bind_method(_MD("get_resource_previewer:EditorResourcePreview"),&EditorPlugin::get_resource_previewer); ClassDB::bind_method(_MD("get_resource_previewer:EditorResourcePreview"),&EditorPlugin::get_resource_previewer);
ClassDB::bind_method(_MD("get_resource_filesystem:EditorFileSystem"),&EditorPlugin::get_resource_file_system); ClassDB::bind_method(_MD("get_resource_filesystem:EditorFileSystem"),&EditorPlugin::get_resource_file_system);

View file

@ -139,12 +139,6 @@ public:
void make_bottom_panel_item_visible(Control *p_item); void make_bottom_panel_item_visible(Control *p_item);
void hide_bottom_panel(); void hide_bottom_panel();
void add_import_plugin(const Ref<EditorImportPlugin>& p_editor_import);
void remove_import_plugin(const Ref<EditorImportPlugin>& p_editor_import);
void add_export_plugin(const Ref<EditorExportPlugin>& p_editor_export);
void remove_export_plugin(const Ref<EditorExportPlugin>& p_editor_export);
EditorSelection* get_selection(); EditorSelection* get_selection();
//EditorImportExport *get_import_export(); //EditorImportExport *get_import_export();
EditorSettings *get_editor_settings(); EditorSettings *get_editor_settings();

View file

@ -31,6 +31,7 @@
#include "editor_file_system.h" #include "editor_file_system.h"
#include "editor_node.h" #include "editor_node.h"
#if 0
void EditorReImportDialog::popup_reimport() { void EditorReImportDialog::popup_reimport() {
if (EditorFileSystem::get_singleton()->is_scanning()) { if (EditorFileSystem::get_singleton()->is_scanning()) {
@ -144,3 +145,4 @@ EditorReImportDialog::EditorReImportDialog() {
scene_must_save=false; scene_must_save=false;
} }
#endif

View file

@ -29,6 +29,7 @@
#ifndef EDITOR_REIMPORT_DIALOG_H #ifndef EDITOR_REIMPORT_DIALOG_H
#define EDITOR_REIMPORT_DIALOG_H #define EDITOR_REIMPORT_DIALOG_H
#if 0
#include "scene/gui/dialogs.h" #include "scene/gui/dialogs.h"
#include "scene/gui/tree.h" #include "scene/gui/tree.h"
@ -49,3 +50,4 @@ public:
}; };
#endif // EDITOR_REIMPORT_DIALOG_H #endif // EDITOR_REIMPORT_DIALOG_H
#endif

View file

@ -32,7 +32,7 @@
void EditorRunNative::_notification(int p_what) { void EditorRunNative::_notification(int p_what) {
#if 0
if (p_what==NOTIFICATION_ENTER_TREE) { if (p_what==NOTIFICATION_ENTER_TREE) {
List<StringName> ep; List<StringName> ep;
@ -97,11 +97,12 @@ void EditorRunNative::_notification(int p_what) {
first=false; first=false;
} }
} }
#endif
} }
void EditorRunNative::_run_native(int p_idx,const String& p_platform) { void EditorRunNative::_run_native(int p_idx,const String& p_platform) {
#if 0
Ref<EditorExportPlatform> eep = EditorImportExport::get_singleton()->get_export_platform(p_platform); Ref<EditorExportPlatform> eep = EditorImportExport::get_singleton()->get_export_platform(p_platform);
ERR_FAIL_COND(eep.is_null()); ERR_FAIL_COND(eep.is_null());
if (p_idx == -1) { if (p_idx == -1) {
@ -125,6 +126,8 @@ void EditorRunNative::_run_native(int p_idx,const String& p_platform) {
flags|=EditorExportPlatform::EXPORT_VIEW_NAVIGATION; flags|=EditorExportPlatform::EXPORT_VIEW_NAVIGATION;
eep->run(p_idx,flags); eep->run(p_idx,flags);
#endif
} }
void EditorRunNative::_bind_methods() { void EditorRunNative::_bind_methods() {

View file

@ -363,11 +363,11 @@ void FileSystemDock::_search(EditorFileSystemDirectory *p_path,List<FileInfo>* m
fi.import_status=0; fi.import_status=0;
} }
for(int j=0;j<p_path->get_source_count(i);j++) { for(int j=0;j<p_path->get_source_count(i);j++) {
String s = EditorImportPlugin::expand_source_path(p_path->get_source_file(i,j)); /*String s = EditorImportPlugin::expand_source_path(p_path->get_source_file(i,j));
if (p_path->is_source_file_missing(i,j)) { if (p_path->is_source_file_missing(i,j)) {
s+=" (Missing)"; s+=" (Missing)";
} }
fi.sources.push_back(s); fi.sources.push_back(s);*/
} }
matches->push_back(fi); matches->push_back(fi);
@ -510,11 +510,11 @@ void FileSystemDock::_update_files(bool p_keep_selection) {
} }
for(int j=0;j<efd->get_source_count(i);j++) { for(int j=0;j<efd->get_source_count(i);j++) {
String s = EditorImportPlugin::expand_source_path(efd->get_source_file(i,j)); /*String s = EditorImportPlugin::expand_source_path(efd->get_source_file(i,j));
if (efd->is_source_file_missing(i,j)) { if (efd->is_source_file_missing(i,j)) {
s+=" (Missing)"; s+=" (Missing)";
} }
fi.sources.push_back(s); fi.sources.push_back(s);*/
} }
} else { } else {
fi.import_status=0; fi.import_status=0;
@ -1068,7 +1068,7 @@ void FileSystemDock::_file_option(int p_option) {
} }
ERR_FAIL_COND(reimport.size()==0); ERR_FAIL_COND(reimport.size()==0);
/*
Ref<ResourceImportMetadata> rimd = ResourceLoader::load_import_metadata(reimport[0]); Ref<ResourceImportMetadata> rimd = ResourceLoader::load_import_metadata(reimport[0]);
ERR_FAIL_COND(!rimd.is_valid()); ERR_FAIL_COND(!rimd.is_valid());
String editor=rimd->get_editor(); String editor=rimd->get_editor();
@ -1086,6 +1086,7 @@ void FileSystemDock::_file_option(int p_option) {
rimp->reimport_multiple_files(reimport); rimp->reimport_multiple_files(reimport);
} }
*/
} break; } break;
case FILE_COPY_PATH: case FILE_COPY_PATH:
@ -1542,6 +1543,7 @@ void FileSystemDock::_files_list_rmb_select(int p_item,const Vector2& p_pos) {
} else { } else {
/*
Ref<ResourceImportMetadata> rimd = ResourceLoader::load_import_metadata(path); Ref<ResourceImportMetadata> rimd = ResourceLoader::load_import_metadata(path);
if (rimd.is_valid()) { if (rimd.is_valid()) {
@ -1554,7 +1556,7 @@ void FileSystemDock::_files_list_rmb_select(int p_item,const Vector2& p_pos) {
} else { } else {
all_can_reimport=false; all_can_reimport=false;
} }*/
} }
} else { } else {
all_can_reimport=false; all_can_reimport=false;
@ -1603,7 +1605,7 @@ void FileSystemDock::_files_list_rmb_select(int p_item,const Vector2& p_pos) {
if (all_can_reimport && types.size()==1) { //all can reimport and are of the same type if (all_can_reimport && types.size()==1) { //all can reimport and are of the same type
/*
bool valid=true; bool valid=true;
Ref<EditorImportPlugin> rimp = EditorImportExport::get_singleton()->get_import_plugin_by_name(types.front()->get()); Ref<EditorImportPlugin> rimp = EditorImportExport::get_singleton()->get_import_plugin_by_name(types.front()->get());
if (rimp.is_valid()) { if (rimp.is_valid()) {
@ -1619,6 +1621,7 @@ void FileSystemDock::_files_list_rmb_select(int p_item,const Vector2& p_pos) {
file_options->add_separator(); file_options->add_separator();
file_options->add_item(TTR("Re-Import.."),FILE_REIMPORT); file_options->add_item(TTR("Re-Import.."),FILE_REIMPORT);
} }
*/
} }
file_options->set_pos(files->get_global_pos() + p_pos); file_options->set_pos(files->get_global_pos() + p_pos);

View file

@ -27,7 +27,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/ /*************************************************************************/
#include "editor_bitmask_import_plugin.h" #include "editor_bitmask_import_plugin.h"
#if 0
#include "io/image_loader.h" #include "io/image_loader.h"
#include "tools/editor/editor_file_dialog.h" #include "tools/editor/editor_file_dialog.h"
#include "tools/editor/editor_dir_dialog.h" #include "tools/editor/editor_dir_dialog.h"
@ -384,3 +384,4 @@ EditorBitMaskImportPlugin::EditorBitMaskImportPlugin(EditorNode* p_editor) {
EditorBitMaskExportPlugin::EditorBitMaskExportPlugin() { EditorBitMaskExportPlugin::EditorBitMaskExportPlugin() {
} }
#endif

View file

@ -28,7 +28,7 @@
/*************************************************************************/ /*************************************************************************/
#ifndef EDITOR_BITMASK_IMPORT_PLUGIN_H #ifndef EDITOR_BITMASK_IMPORT_PLUGIN_H
#define EDITOR_BITMASK_IMPORT_PLUGIN_H #define EDITOR_BITMASK_IMPORT_PLUGIN_H
#if 0
#include "tools/editor/editor_import_export.h" #include "tools/editor/editor_import_export.h"
#include "scene/resources/font.h" #include "scene/resources/font.h"
@ -66,4 +66,5 @@ public:
EditorBitMaskExportPlugin(); EditorBitMaskExportPlugin();
}; };
#endif
#endif // EDITOR_SAMPLE_IMPORT_PLUGIN_H #endif // EDITOR_SAMPLE_IMPORT_PLUGIN_H

View file

@ -27,7 +27,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/ /*************************************************************************/
#include "editor_export_scene.h" #include "editor_export_scene.h"
#if 0
#include "io/resource_loader.h" #include "io/resource_loader.h"
#include "io/resource_saver.h" #include "io/resource_saver.h"
#include "os/dir_access.h" #include "os/dir_access.h"
@ -139,3 +139,4 @@ Vector<uint8_t> EditorSceneExportPlugin::custom_export(String& p_path,const Ref<
EditorSceneExportPlugin::EditorSceneExportPlugin() EditorSceneExportPlugin::EditorSceneExportPlugin()
{ {
} }
#endif

View file

@ -31,7 +31,7 @@
#include "tools/editor/editor_import_export.h" #include "tools/editor/editor_import_export.h"
#if 0
class EditorSceneExportPlugin : public EditorExportPlugin { class EditorSceneExportPlugin : public EditorExportPlugin {
GDCLASS( EditorSceneExportPlugin, EditorExportPlugin ); GDCLASS( EditorSceneExportPlugin, EditorExportPlugin );
public: public:
@ -40,5 +40,5 @@ public:
EditorSceneExportPlugin(); EditorSceneExportPlugin();
}; };
#endif
#endif // EDITOR_EXPORT_SCENE_H #endif // EDITOR_EXPORT_SCENE_H

View file

@ -27,7 +27,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/ /*************************************************************************/
#include "editor_font_import_plugin.h" #include "editor_font_import_plugin.h"
#if 0
#include "scene/gui/dialogs.h" #include "scene/gui/dialogs.h"
#include "tools/editor/editor_file_dialog.h" #include "tools/editor/editor_file_dialog.h"
#include "tools/editor/editor_node.h" #include "tools/editor/editor_node.h"
@ -1701,3 +1701,4 @@ EditorFontImportPlugin::EditorFontImportPlugin(EditorNode* p_editor) {
dialog = memnew( EditorFontImportDialog(this) ); dialog = memnew( EditorFontImportDialog(this) );
p_editor->get_gui_base()->add_child(dialog); p_editor->get_gui_base()->add_child(dialog);
} }
#endif

View file

@ -31,7 +31,7 @@
#include "tools/editor/editor_import_export.h" #include "tools/editor/editor_import_export.h"
#include "scene/resources/font.h" #include "scene/resources/font.h"
#if 0
class EditorNode; class EditorNode;
class EditorFontImportDialog; class EditorFontImportDialog;
@ -55,3 +55,4 @@ public:
}; };
#endif // EDITOR_FONT_IMPORT_PLUGIN_H #endif // EDITOR_FONT_IMPORT_PLUGIN_H
#endif

View file

@ -28,6 +28,7 @@
/*************************************************************************/ /*************************************************************************/
#include "editor_import_collada.h" #include "editor_import_collada.h"
#if 0
#include "collada/collada.h" #include "collada/collada.h"
#include "scene/3d/spatial.h" #include "scene/3d/spatial.h"
#include "scene/3d/skeleton.h" #include "scene/3d/skeleton.h"
@ -2464,3 +2465,4 @@ EditorSceneImporterCollada::EditorSceneImporterCollada() {
} }
#endif

View file

@ -31,7 +31,7 @@
#include "tools/editor/io_plugins/editor_scene_import_plugin.h" #include "tools/editor/io_plugins/editor_scene_import_plugin.h"
#if 0
class EditorSceneImporterCollada : public EditorSceneImporter { class EditorSceneImporterCollada : public EditorSceneImporter {
@ -46,6 +46,6 @@ public:
EditorSceneImporterCollada(); EditorSceneImporterCollada();
}; };
#endif
#endif #endif

View file

@ -28,6 +28,8 @@
/*************************************************************************/ /*************************************************************************/
#include "editor_mesh_import_plugin.h" #include "editor_mesh_import_plugin.h"
#if 0
#include "tools/editor/editor_file_dialog.h" #include "tools/editor/editor_file_dialog.h"
#include "tools/editor/editor_dir_dialog.h" #include "tools/editor/editor_dir_dialog.h"
#include "tools/editor/editor_node.h" #include "tools/editor/editor_node.h"
@ -588,3 +590,4 @@ EditorMeshImportPlugin::EditorMeshImportPlugin(EditorNode* p_editor) {
dialog = memnew( EditorMeshImportDialog(this)); dialog = memnew( EditorMeshImportDialog(this));
p_editor->get_gui_base()->add_child(dialog); p_editor->get_gui_base()->add_child(dialog);
} }
#endif

View file

@ -29,7 +29,7 @@
#ifndef EDITOR_MESH_IMPORT_PLUGIN_H #ifndef EDITOR_MESH_IMPORT_PLUGIN_H
#define EDITOR_MESH_IMPORT_PLUGIN_H #define EDITOR_MESH_IMPORT_PLUGIN_H
#if 0
#include "tools/editor/editor_import_export.h" #include "tools/editor/editor_import_export.h"
#include "scene/resources/font.h" #include "scene/resources/font.h"
@ -55,4 +55,5 @@ public:
EditorMeshImportPlugin(EditorNode* p_editor); EditorMeshImportPlugin(EditorNode* p_editor);
}; };
#endif
#endif // EDITOR_MESH_IMPORT_PLUGIN_H #endif // EDITOR_MESH_IMPORT_PLUGIN_H

View file

@ -27,7 +27,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/ /*************************************************************************/
#include "editor_scene_import_plugin.h" #include "editor_scene_import_plugin.h"
#if 0
#include "globals.h" #include "globals.h"
#include "tools/editor/editor_node.h" #include "tools/editor/editor_node.h"
#include "scene/resources/packed_scene.h" #include "scene/resources/packed_scene.h"
@ -2989,3 +2989,4 @@ EditorSceneAnimationImportPlugin::EditorSceneAnimationImportPlugin(EditorNode* p
} }
#endif

View file

@ -28,7 +28,7 @@
/*************************************************************************/ /*************************************************************************/
#ifndef EDITOR_SCENE_IMPORT_PLUGIN_H #ifndef EDITOR_SCENE_IMPORT_PLUGIN_H
#define EDITOR_SCENE_IMPORT_PLUGIN_H #define EDITOR_SCENE_IMPORT_PLUGIN_H
#if 0
#include "scene/gui/dialogs.h" #include "scene/gui/dialogs.h"
#include "scene/gui/tree.h" #include "scene/gui/tree.h"
#include "scene/gui/label.h" #include "scene/gui/label.h"
@ -196,5 +196,5 @@ public:
}; };
#endif
#endif // EDITOR_SCENE_IMPORT_PLUGIN_H #endif // EDITOR_SCENE_IMPORT_PLUGIN_H

View file

@ -27,7 +27,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/ /*************************************************************************/
#include "editor_texture_import_plugin.h" #include "editor_texture_import_plugin.h"
#if 0
#include "io/image_loader.h" #include "io/image_loader.h"
#include "tools/editor/editor_node.h" #include "tools/editor/editor_node.h"
#include "io/resource_saver.h" #include "io/resource_saver.h"
@ -1890,3 +1890,4 @@ EditorTextureExportPlugin::EditorTextureExportPlugin() {
} }
#endif

View file

@ -29,6 +29,7 @@
#ifndef EDITOR_TEXTURE_IMPORT_PLUGIN_H #ifndef EDITOR_TEXTURE_IMPORT_PLUGIN_H
#define EDITOR_TEXTURE_IMPORT_PLUGIN_H #define EDITOR_TEXTURE_IMPORT_PLUGIN_H
#if 0
#include "tools/editor/editor_import_export.h" #include "tools/editor/editor_import_export.h"
#include "scene/gui/dialogs.h" #include "scene/gui/dialogs.h"
#include "scene/gui/tree.h" #include "scene/gui/tree.h"
@ -170,3 +171,4 @@ public:
}; };
#endif // EDITOR_TEXTURE_IMPORT_PLUGIN_H #endif // EDITOR_TEXTURE_IMPORT_PLUGIN_H
#endif

View file

@ -28,6 +28,7 @@
/*************************************************************************/ /*************************************************************************/
#include "editor_translation_import_plugin.h" #include "editor_translation_import_plugin.h"
#if 0
#include "scene/gui/file_dialog.h" #include "scene/gui/file_dialog.h"
#include "tools/editor/editor_dir_dialog.h" #include "tools/editor/editor_dir_dialog.h"
#include "tools/editor/editor_node.h" #include "tools/editor/editor_node.h"
@ -474,3 +475,5 @@ EditorTranslationImportPlugin::EditorTranslationImportPlugin(EditorNode* p_edito
dialog = memnew(EditorTranslationImportDialog(this)); dialog = memnew(EditorTranslationImportDialog(this));
p_editor->get_gui_base()->add_child(dialog); p_editor->get_gui_base()->add_child(dialog);
} }
#endif

View file

@ -31,7 +31,7 @@
#include "tools/editor/editor_import_export.h" #include "tools/editor/editor_import_export.h"
#include "scene/resources/font.h" #include "scene/resources/font.h"
#if 0
class EditorNode; class EditorNode;
class EditorTranslationImportDialog; class EditorTranslationImportDialog;
@ -52,4 +52,5 @@ public:
EditorTranslationImportPlugin(EditorNode* p_editor); EditorTranslationImportPlugin(EditorNode* p_editor);
}; };
#endif
#endif // EDITOR_TRANSLATION_IMPORT_PLUGIN_H #endif // EDITOR_TRANSLATION_IMPORT_PLUGIN_H

View file

@ -27,7 +27,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/ /*************************************************************************/
#include "project_export.h" #include "project_export.h"
#if 0
#include "os/dir_access.h" #include "os/dir_access.h"
#include "os/file_access.h" #include "os/file_access.h"
#include "globals.h" #include "globals.h"
@ -2127,3 +2127,4 @@ ProjectExport::ProjectExport(EditorData* p_data) {
} }
#endif

View file

@ -46,6 +46,7 @@
#include "property_editor.h" #include "property_editor.h"
#include "editor_import_export.h" #include "editor_import_export.h"
#if 0
class EditorNode; class EditorNode;
class ProjectExportDialog : public ConfirmationDialog { class ProjectExportDialog : public ConfirmationDialog {
@ -242,3 +243,4 @@ public:
#endif // PROJECT_EXPORT_SETTINGS_H #endif // PROJECT_EXPORT_SETTINGS_H
#endif

View file

@ -1342,7 +1342,7 @@ ProjectSettings::ProjectSettings(EditorData *p_data) {
hbc->add_spacer(); hbc->add_spacer();
List<StringName> ep; /*List<StringName> ep;
EditorImportExport::get_singleton()->get_export_platforms(&ep); EditorImportExport::get_singleton()->get_export_platforms(&ep);
ep.sort_custom<StringName::AlphCompare>(); ep.sort_custom<StringName::AlphCompare>();
@ -1350,7 +1350,7 @@ ProjectSettings::ProjectSettings(EditorData *p_data) {
popup_platform->get_popup()->add_item( E->get() ); popup_platform->get_popup()->add_item( E->get() );
} }*/
popup_platform->get_popup()->connect("id_pressed",this,"_copy_to_platform"); popup_platform->get_popup()->connect("id_pressed",this,"_copy_to_platform");
get_ok()->set_text(TTR("Close")); get_ok()->set_text(TTR("Close"));

View file

@ -208,13 +208,13 @@ void CustomPropertyEditor::_menu_option(int p_which) {
case OBJ_MENU_REIMPORT: { case OBJ_MENU_REIMPORT: {
RES r=v; RES r=v;
if (r.is_valid() && r->get_import_metadata().is_valid()) { /* if (r.is_valid() && r->get_import_metadata().is_valid()) {
Ref<ResourceImportMetadata> rimd = r->get_import_metadata(); Ref<ResourceImportMetadata> rimd = r->get_import_metadata();
Ref<EditorImportPlugin> eip = EditorImportExport::get_singleton()->get_import_plugin_by_name(rimd->get_editor()); Ref<EditorImportPlugin> eip = EditorImportExport::get_singleton()->get_import_plugin_by_name(rimd->get_editor());
if (eip.is_valid()) { if (eip.is_valid()) {
eip->import_dialog(r->get_path()); eip->import_dialog(r->get_path());
} }
} }*/
} break; } break;
case OBJ_MENU_NEW_SCRIPT: { case OBJ_MENU_NEW_SCRIPT: {
@ -945,11 +945,11 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty
menu->add_icon_item(get_icon("EditResource","EditorIcons"),"Edit",OBJ_MENU_EDIT); menu->add_icon_item(get_icon("EditResource","EditorIcons"),"Edit",OBJ_MENU_EDIT);
menu->add_icon_item(get_icon("Del","EditorIcons"),"Clear",OBJ_MENU_CLEAR); menu->add_icon_item(get_icon("Del","EditorIcons"),"Clear",OBJ_MENU_CLEAR);
menu->add_icon_item(get_icon("Duplicate","EditorIcons"),"Make Unique",OBJ_MENU_MAKE_UNIQUE); menu->add_icon_item(get_icon("Duplicate","EditorIcons"),"Make Unique",OBJ_MENU_MAKE_UNIQUE);
RES r = v; /*RES r = v;
if (r.is_valid() && r->get_path().is_resource_file() && r->get_import_metadata().is_valid()) { if (r.is_valid() && r->get_path().is_resource_file() && r->get_import_metadata().is_valid()) {
menu->add_separator(); menu->add_separator();
menu->add_icon_item(get_icon("ReloadSmall","EditorIcons"),"Re-Import",OBJ_MENU_REIMPORT); menu->add_icon_item(get_icon("ReloadSmall","EditorIcons"),"Re-Import",OBJ_MENU_REIMPORT);
} }*/
/*if (r.is_valid() && r->get_path().is_resource_file()) { /*if (r.is_valid() && r->get_path().is_resource_file()) {
menu->set_item_tooltip(1,r->get_path()); menu->set_item_tooltip(1,r->get_path());
} else if (r.is_valid()) { } else if (r.is_valid()) {