diff options
Diffstat (limited to 'scene/resources/theme.cpp')
-rw-r--r-- | scene/resources/theme.cpp | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/scene/resources/theme.cpp b/scene/resources/theme.cpp index 21bdb6c0ab..651e234b49 100644 --- a/scene/resources/theme.cpp +++ b/scene/resources/theme.cpp @@ -40,9 +40,9 @@ bool Theme::_set(const StringName& p_name, const Variant& p_value) { if (sname.find("/")!=-1) { - String type=sname.get_slice("/",1); - String node_type=sname.get_slice("/",0); - String name=sname.get_slice("/",2); + String type=sname.get_slicec('/',1); + String node_type=sname.get_slicec('/',0); + String name=sname.get_slicec('/',2); if (type=="icons") { @@ -75,9 +75,9 @@ bool Theme::_get(const StringName& p_name,Variant &r_ret) const { if (sname.find("/")!=-1) { - String type=sname.get_slice("/",1); - String node_type=sname.get_slice("/",0); - String name=sname.get_slice("/",2); + String type=sname.get_slicec('/',1); + String node_type=sname.get_slicec('/',0); + String name=sname.get_slicec('/',2); if (type=="icons") { @@ -601,7 +601,9 @@ Theme::~Theme() -RES ResourceFormatLoaderTheme::load(const String &p_path,const String& p_original_path) { +RES ResourceFormatLoaderTheme::load(const String &p_path, const String& p_original_path, Error *r_error) { + if (r_error) + *r_error=ERR_CANT_OPEN; Error err; FileAccess *f = FileAccess::open(p_path,FileAccess::READ,&err); @@ -611,6 +613,8 @@ RES ResourceFormatLoaderTheme::load(const String &p_path,const String& p_origina String base_path = p_path.get_base_dir(); Ref<Theme> theme( memnew( Theme ) ); Map<StringName,Variant> library; + if (r_error) + *r_error=ERR_FILE_CORRUPT; bool reading_library=false; int line=0; @@ -1003,6 +1007,9 @@ RES ResourceFormatLoaderTheme::load(const String &p_path,const String& p_origina f->close(); memdelete(f); + if (r_error) + *r_error=OK; + return theme; } |