diff options
Diffstat (limited to 'scene')
-rw-r--r-- | scene/main/node.cpp | 14 | ||||
-rw-r--r-- | scene/main/node.h | 3 | ||||
-rw-r--r-- | scene/resources/scene_format_text.cpp | 55 | ||||
-rw-r--r-- | scene/resources/scene_format_text.h | 2 |
4 files changed, 52 insertions, 22 deletions
diff --git a/scene/main/node.cpp b/scene/main/node.cpp index 11b400d4a9..bea6e75aef 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -2085,6 +2085,15 @@ bool Node::is_owned_by_parent() const { return data.parent_owned; } +void Node::set_display_folded(bool p_folded) { + data.display_folded=p_folded; +} + +bool Node::is_displayed_folded() const { + + return data.display_folded; +} + void Node::_bind_methods() { ObjectTypeDB::bind_method(_MD("_add_child_below_node","node:Node","child_node:Node","legible_unique_name"),&Node::add_child_below_node,DEFVAL(false)); @@ -2140,6 +2149,8 @@ void Node::_bind_methods() { ObjectTypeDB::bind_method(_MD("can_process"),&Node::can_process); ObjectTypeDB::bind_method(_MD("print_stray_nodes"),&Node::_print_stray_nodes); ObjectTypeDB::bind_method(_MD("get_position_in_parent"),&Node::get_position_in_parent); + ObjectTypeDB::bind_method(_MD("set_display_folded","fold"),&Node::set_display_folded); + ObjectTypeDB::bind_method(_MD("is_displayed_folded"),&Node::is_displayed_folded); ObjectTypeDB::bind_method(_MD("get_tree:SceneTree"),&Node::get_tree); @@ -2194,6 +2205,7 @@ void Node::_bind_methods() { //ADD_PROPERTYNZ( PropertyInfo( Variant::BOOL, "process/input" ), _SCS("set_process_input"),_SCS("is_processing_input" ) ); //ADD_PROPERTYNZ( PropertyInfo( Variant::BOOL, "process/unhandled_input" ), _SCS("set_process_unhandled_input"),_SCS("is_processing_unhandled_input" ) ); ADD_PROPERTYNZ( PropertyInfo( Variant::INT, "process/pause_mode",PROPERTY_HINT_ENUM,"Inherit,Stop,Process" ), _SCS("set_pause_mode"),_SCS("get_pause_mode" ) ); + ADD_PROPERTYNZ( PropertyInfo( Variant::BOOL, "editor/display_folded",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR ), _SCS("set_display_folded"),_SCS("is_displayed_folded" ) ); BIND_VMETHOD( MethodInfo("_process",PropertyInfo(Variant::REAL,"delta")) ); BIND_VMETHOD( MethodInfo("_fixed_process",PropertyInfo(Variant::REAL,"delta")) ); @@ -2231,6 +2243,7 @@ Node::Node() { data.in_constructor=true; data.viewport=NULL; data.use_placeholder=false; + data.display_folded=false; } Node::~Node() { @@ -2240,6 +2253,7 @@ Node::~Node() { data.owned.clear(); data.children.clear(); + ERR_FAIL_COND(data.parent); ERR_FAIL_COND(data.children.size()); diff --git a/scene/main/node.h b/scene/main/node.h index 88334f32f0..dcc3829d15 100644 --- a/scene/main/node.h +++ b/scene/main/node.h @@ -111,6 +111,7 @@ private: bool in_constructor; bool use_placeholder; + bool display_folded; } data; @@ -325,6 +326,8 @@ public: void update_configuration_warning(); + void set_display_folded(bool p_folded); + bool is_displayed_folded() const; /* CANVAS */ Node(); diff --git a/scene/resources/scene_format_text.cpp b/scene/resources/scene_format_text.cpp index c7e2fc4e73..95645107d4 100644 --- a/scene/resources/scene_format_text.cpp +++ b/scene/resources/scene_format_text.cpp @@ -67,12 +67,17 @@ Error ResourceInteractiveLoaderText::_parse_sub_resource(VariantParser::Stream* String path = local_path+"::"+itos(index); - if (!ResourceCache::has(path)) { - r_err_str="Can't load cached sub-resource: "+path; - return ERR_PARSE_ERROR; - } + if (!ignore_resource_parsing) { - r_res=RES(ResourceCache::get(path)); + if (!ResourceCache::has(path)) { + r_err_str="Can't load cached sub-resource: "+path; + return ERR_PARSE_ERROR; + } + + r_res=RES(ResourceCache::get(path)); + } else { + r_res=RES(); + } VariantParser::get_token(p_stream,token,line,r_err_str); if (token.type!=VariantParser::TK_PARENTHESIS_CLOSE) { @@ -95,25 +100,29 @@ Error ResourceInteractiveLoaderText::_parse_ext_resource(VariantParser::Stream* int id = token.value; + if (!ignore_resource_parsing) { - if (!ext_resources.has(id)) { - r_err_str="Can't load cached ext-resource #"+itos(id); - return ERR_PARSE_ERROR; - } + if (!ext_resources.has(id)) { + r_err_str="Can't load cached ext-resource #"+itos(id); + return ERR_PARSE_ERROR; + } - String path = ext_resources[id].path; - String type = ext_resources[id].type; + String path = ext_resources[id].path; + String type = ext_resources[id].type; - if (path.find("://")==-1 && path.is_rel_path()) { - // path is relative to file being loaded, so convert to a resource path - path=Globals::get_singleton()->localize_path(res_path.get_base_dir().plus_file(path)); + if (path.find("://")==-1 && path.is_rel_path()) { + // path is relative to file being loaded, so convert to a resource path + path=Globals::get_singleton()->localize_path(res_path.get_base_dir().plus_file(path)); - } + } - r_res=ResourceLoader::load(path,type); + r_res=ResourceLoader::load(path,type); - if (r_res.is_null()) { - WARN_PRINT(String("Couldn't load external resource: "+path).utf8().get_data()); + if (r_res.is_null()) { + WARN_PRINT(String("Couldn't load external resource: "+path).utf8().get_data()); + } + } else { + r_res=RES(); } VariantParser::get_token(p_stream,token,line,r_err_str); @@ -625,6 +634,7 @@ void ResourceInteractiveLoaderText::get_dependencies(FileAccess *f,List<String> open(f); + ignore_resource_parsing=true; ERR_FAIL_COND(error!=OK); while(next_tag.name=="ext_resource") { @@ -662,6 +672,7 @@ void ResourceInteractiveLoaderText::get_dependencies(FileAccess *f,List<String> Error err = VariantParser::parse_tag(&stream,lines,error_text,next_tag,&rp); if (err) { + print_line(error_text+" - "+itos(lines)); error_text="Unexpected end of file"; _printerr(); error=ERR_FILE_CORRUPT; @@ -676,7 +687,7 @@ Error ResourceInteractiveLoaderText::rename_dependencies(FileAccess *p_f, const open(p_f,true); ERR_FAIL_COND_V(error!=OK,error); - + ignore_resource_parsing=true; //FileAccess FileAccess *fw = NULL; @@ -794,7 +805,7 @@ void ResourceInteractiveLoaderText::open(FileAccess *p_f,bool p_skip_first_tag) stream.f=f; is_scene=false; - + ignore_resource_parsing=false; resource_current=0; @@ -879,6 +890,8 @@ String ResourceInteractiveLoaderText::recognize(FileAccess *p_f) { stream.f=f; + ignore_resource_parsing=true; + VariantParser::Tag tag; Error err = VariantParser::parse_tag(&stream,lines,error_text,tag); @@ -1296,7 +1309,7 @@ Error ResourceFormatSaverTextInstance::save(const String &p_path,const RES& p_re if ((PE->get().usage&PROPERTY_USAGE_STORE_IF_NONZERO && value.is_zero())||(PE->get().usage&PROPERTY_USAGE_STORE_IF_NONONE && value.is_one()) ) continue; - if (PE->get().type==Variant::OBJECT && value.is_zero() && (!PE->get().usage&PROPERTY_USAGE_STORE_IF_NULL)) + if (PE->get().type==Variant::OBJECT && value.is_zero() && !(PE->get().usage&PROPERTY_USAGE_STORE_IF_NULL)) continue; String vars; diff --git a/scene/resources/scene_format_text.h b/scene/resources/scene_format_text.h index 8dbfbfda48..6122a1f9d8 100644 --- a/scene/resources/scene_format_text.h +++ b/scene/resources/scene_format_text.h @@ -56,7 +56,7 @@ class ResourceInteractiveLoaderText : public ResourceInteractiveLoader { bool is_scene; String res_type; - + bool ignore_resource_parsing; // Map<String,String> remaps; |