diff options
36 files changed, 443 insertions, 113 deletions
diff --git a/SConstruct b/SConstruct index 691536c956..01b1f2ce8e 100644 --- a/SConstruct +++ b/SConstruct @@ -144,6 +144,7 @@ opts.Add('unix_global_settings_path', 'unix-specific path to system-wide setting opts.Add('disable_3d', 'Disable 3D nodes for smaller executable (yes/no)', "no") opts.Add('disable_advanced_gui', 'Disable advance 3D gui nodes and behaviors (yes/no)', "no") opts.Add('colored', 'Enable colored output for the compilation (yes/no)', 'no') +opts.Add('deprecated','Enable deprecated features (yes/no)','yes') opts.Add('extra_suffix', 'Custom extra suffix added to the base filename of all generated binary files.', '') opts.Add('vsproj', 'Generate Visual Studio Project. (yes/no)', 'no') @@ -179,6 +180,9 @@ if (env_base['target']=='debug'): env_base.Append(CPPFLAGS=['-DDEBUG_MEMORY_ALLOC']); env_base.Append(CPPFLAGS=['-DSCI_NAMESPACE']) +if (env_base['deprecated']!='no'): + env_base.Append(CPPFLAGS=['-DENABLE_DEPRECATED']); + env_base.platforms = {} diff --git a/core/path_remap.cpp b/core/path_remap.cpp index d4cb883f41..8f189187f2 100644 --- a/core/path_remap.cpp +++ b/core/path_remap.cpp @@ -59,12 +59,20 @@ String PathRemap::get_remap(const String& p_from) const { 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]); - return 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("_"); @@ -73,7 +81,14 @@ String PathRemap::get_remap(const String& p_from) const { if (ptr->locale.has(locale)) { if (OS::get_singleton()->is_stdout_verbose()) print_line("remap found: "+p_from+" -> "+ptr->locale[locale]); - return 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]; + } } diff --git a/doc/base/classes.xml b/doc/base/classes.xml index 805f64ad8a..4b5c424d4b 100644 --- a/doc/base/classes.xml +++ b/doc/base/classes.xml @@ -2517,12 +2517,6 @@ Return whether the animation has the loop flag set. </description> </method> - <method name="has_loop_interpolation" qualifiers="const"> - <return type="bool"> - </return> - <description> - </description> - </method> <method name="method_track_get_key_indices" qualifiers="const"> <return type="IntArray"> </return> @@ -2579,12 +2573,6 @@ Set a flag indicating that the animation must loop. This is uses for correct interpolation of animation cycles, and for hinting the player that it must restart the animation. </description> </method> - <method name="set_loop_interpolation"> - <argument index="0" name="enabled" type="bool"> - </argument> - <description> - </description> - </method> <method name="set_step"> <argument index="0" name="size_sec" type="float"> </argument> @@ -4685,6 +4673,12 @@ </description> </method> </methods> + <signals> + <signal name="atlas_changed"> + <description> + </description> + </signal> + </signals> <constants> </constants> </class> @@ -6994,6 +6988,12 @@ Set a custom transform for drawing. Anything drawn afterwards will be transformed by this. </description> </method> + <method name="draw_set_transform_matrix"> + <argument index="0" name="xform" type="Matrix32"> + </argument> + <description> + </description> + </method> <method name="draw_string"> <argument index="0" name="font" type="Font"> </argument> @@ -17507,6 +17507,13 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) <description> </description> </method> + <method name="get_selected_items"> + <return type="IntArray"> + </return> + <description> + Returns a list of selected indexes. + </description> + </method> <method name="is_item_disabled" qualifiers="const"> <return type="bool"> </return> @@ -18912,6 +18919,34 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) Clear the [LineEdit] text. </description> </method> + <method name="cursor_get_blink_enabled" qualifiers="const"> + <return type="bool"> + </return> + <description> + Gets whether the line edit caret is blinking. + </description> + </method> + <method name="cursor_get_blink_speed" qualifiers="const"> + <return type="float"> + </return> + <description> + Gets the line edit caret blink speed. + </description> + </method> + <method name="cursor_set_blink_enabled"> + <argument index="0" name="enable" type="bool"> + </argument> + <description> + Set the line edit caret to blink. + </description> + </method> + <method name="cursor_set_blink_speed"> + <argument index="0" name="blink_speed" type="float"> + </argument> + <description> + Set the line edit caret blink speed. Cannot be less then or equal to 0. + </description> + </method> <method name="get_align" qualifiers="const"> <return type="int"> </return> @@ -18991,34 +19026,6 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) Set the cursor position inside the [LineEdit], causing it to scroll if needed. </description> </method> - <method name="cursor_set_blink_enabled"> - <argument index="0" name="enable" type="bool"> - </argument> - <description> - Set the line edit caret to blink. - </description> - </method> - <method name="cursor_get_blink_enabled" qualifiers="const"> - <return type="float"> - </return> - <description> - Gets whether the line edit caret is blinking. - </description> - </method> - <method name="cursor_set_blink_speed"> - <argument index="0" name="blink_speed" type="float"> - </argument> - <description> - Set the line edit caret blink speed. Cannot be less then or equal to 0. - </description> - </method> - <method name="cursor_get_blink_speed" qualifiers="const"> - <return type="float"> - </return> - <description> - Gets the line edit caret blink speed. - </description> - </method> <method name="set_editable"> <argument index="0" name="enabled" type="bool"> </argument> @@ -24036,6 +24043,12 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) Return the mirroring of the ParallaxLayer. </description> </method> + <method name="get_motion_offset" qualifiers="const"> + <return type="Vector2"> + </return> + <description> + </description> + </method> <method name="get_motion_scale" qualifiers="const"> <return type="Vector2"> </return> @@ -24050,6 +24063,12 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) Set the mirroring of the ParallaxLayer. If an axis is set to 0 then that axis will have no mirroring. </description> </method> + <method name="set_motion_offset"> + <argument index="0" name="offset" type="Vector2"> + </argument> + <description> + </description> + </method> <method name="set_motion_scale"> <argument index="0" name="scale" type="Vector2"> </argument> @@ -24882,6 +24901,12 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8) </description> </method> </methods> + <signals> + <signal name="texture_changed"> + <description> + </description> + </signal> + </signals> <constants> </constants> </class> @@ -36504,6 +36529,10 @@ A similar effect may be achieved moving this node's descendants. <description> </description> </signal> + <signal name="texture_changed"> + <description> + </description> + </signal> </signals> <constants> </constants> @@ -38495,6 +38524,12 @@ A similar effect may be achieved moving this node's descendants. </description> </method> </methods> + <signals> + <signal name="texture_changed"> + <description> + </description> + </signal> + </signals> <constants> </constants> </class> @@ -39357,6 +39392,10 @@ A similar effect may be achieved moving this node's descendants. </theme_item> <theme_item name="completion" type="StyleBox"> </theme_item> + <theme_item name="completion_background_color" type="Color"> + </theme_item> + <theme_item name="completion_existing_color" type="Color"> + </theme_item> <theme_item name="completion_lines" type="int"> </theme_item> <theme_item name="completion_max_width" type="int"> @@ -39365,6 +39404,8 @@ A similar effect may be achieved moving this node's descendants. </theme_item> <theme_item name="completion_scroll_width" type="int"> </theme_item> + <theme_item name="completion_selected_color" type="Color"> + </theme_item> <theme_item name="current_line_color" type="Color"> </theme_item> <theme_item name="focus" type="StyleBox"> diff --git a/drivers/openssl/stream_peer_openssl.cpp b/drivers/openssl/stream_peer_openssl.cpp index 67f58b6028..9349df3793 100644 --- a/drivers/openssl/stream_peer_openssl.cpp +++ b/drivers/openssl/stream_peer_openssl.cpp @@ -309,6 +309,9 @@ Error StreamPeerOpenSSL::connect(Ref<StreamPeer> p_base, bool p_validate_certs, validate_certs=p_validate_certs; validate_hostname=p_for_hostname!=""; + + + if (p_validate_certs) { @@ -380,6 +383,10 @@ Error StreamPeerOpenSSL::connect(Ref<StreamPeer> p_base, bool p_validate_certs, bio->ptr = this; SSL_set_bio( ssl, bio, bio ); + if (p_for_hostname!=String()) { + SSL_set_tlsext_host_name(ssl,p_for_hostname.utf8().get_data()); + } + use_blocking=true; // let handshake use blocking // Set the SSL to automatically retry on failure. SSL_set_mode(ssl, SSL_MODE_AUTO_RETRY); diff --git a/modules/gdscript/gd_compiler.cpp b/modules/gdscript/gd_compiler.cpp index 7481eac620..d9bbe42979 100644 --- a/modules/gdscript/gd_compiler.cpp +++ b/modules/gdscript/gd_compiler.cpp @@ -1497,7 +1497,8 @@ Error GDCompiler::_parse_class(GDScript *p_script, GDScript *p_owner, const GDPa String sub = p_class->extends_class[i]; if (script->subclasses.has(sub)) { - script=script->subclasses[sub]; + Ref<Script> subclass = script->subclasses[sub]; //avoid reference from dissapearing + script=subclass; } else { _set_error("Could not find subclass: "+sub,p_class); @@ -1683,6 +1684,7 @@ Error GDCompiler::_parse_class(GDScript *p_script, GDScript *p_owner, const GDPa if (err) return err; + p_script->constants.insert(name,subclass); //once parsed, goes to the list of constants p_script->subclasses.insert(name,subclass); diff --git a/modules/gdscript/gd_editor.cpp b/modules/gdscript/gd_editor.cpp index b1da7e782c..07a5a636d4 100644 --- a/modules/gdscript/gd_editor.cpp +++ b/modules/gdscript/gd_editor.cpp @@ -212,7 +212,7 @@ String GDScriptLanguage::debug_get_stack_level_source(int p_level) const { ERR_FAIL_INDEX_V(p_level,_debug_call_stack_pos,""); int l = _debug_call_stack_pos - p_level -1; - return _call_stack[l].function->get_script()->get_path(); + return _call_stack[l].function->get_source(); } void GDScriptLanguage::debug_get_stack_level_locals(int p_level,List<String> *p_locals, List<Variant> *p_values, int p_max_subitems,int p_max_depth) { diff --git a/modules/gdscript/gd_function.cpp b/modules/gdscript/gd_function.cpp index 6e52686de4..de86eb2ab9 100644 --- a/modules/gdscript/gd_function.cpp +++ b/modules/gdscript/gd_function.cpp @@ -846,6 +846,8 @@ Variant GDFunction::call(GDInstance *p_instance, const Variant **p_args, int p_a gdfs->state._class=_class; gdfs->state.ip=ip+ipofs; gdfs->state.line=line; + gdfs->state.instance_id=(p_instance && p_instance->get_owner())?p_instance->get_owner()->get_instance_ID():0; + gdfs->state.script_id=_class->get_instance_ID(); //gdfs->state.result_pos=ip+ipofs-1; gdfs->state.defarg=defarg; gdfs->state.instance=p_instance; @@ -1352,6 +1354,18 @@ GDFunction::~GDFunction() { Variant GDFunctionState::_signal_callback(const Variant** p_args, int p_argcount, Variant::CallError& r_error) { +#ifdef DEBUG_ENABLED + if (state.instance_id && !ObjectDB::get_instance(state.instance_id)) { + ERR_EXPLAIN("Resumed after yield, but class instance is gone"); + ERR_FAIL_V(Variant()); + } + + if (state.script_id && !ObjectDB::get_instance(state.script_id)) { + ERR_EXPLAIN("Resumed after yield, but script is gone"); + ERR_FAIL_V(Variant()); + } +#endif + Variant arg; r_error.error=Variant::CallError::CALL_OK; @@ -1398,6 +1412,17 @@ bool GDFunctionState::is_valid() const { Variant GDFunctionState::resume(const Variant& p_arg) { ERR_FAIL_COND_V(!function,Variant()); +#ifdef DEBUG_ENABLED + if (state.instance_id && !ObjectDB::get_instance(state.instance_id)) { + ERR_EXPLAIN("Resumed after yield, but class instance is gone"); + ERR_FAIL_V(Variant()); + } + + if (state.script_id && !ObjectDB::get_instance(state.script_id)) { + ERR_EXPLAIN("Resumed after yield, but script is gone"); + ERR_FAIL_V(Variant()); + } +#endif state.result=p_arg; Variant::CallError err; diff --git a/modules/gdscript/gd_function.h b/modules/gdscript/gd_function.h index 1f790eaadc..e09c6509dd 100644 --- a/modules/gdscript/gd_function.h +++ b/modules/gdscript/gd_function.h @@ -136,6 +136,9 @@ public: struct CallState { + ObjectID instance_id; //by debug only + ObjectID script_id; + GDInstance *instance; Vector<uint8_t> stack; int stack_size; @@ -160,6 +163,7 @@ public: int get_default_argument_count() const; int get_default_argument_addr(int p_idx) const; GDScript *get_script() const { return _script; } + StringName get_source() const { return source; } void debug_get_stack_member_state(int p_line,List<Pair<StringName,int> > *r_stackvars) const; diff --git a/modules/gdscript/gd_parser.cpp b/modules/gdscript/gd_parser.cpp index 3ef42f81a4..6c6560efa6 100644 --- a/modules/gdscript/gd_parser.cpp +++ b/modules/gdscript/gd_parser.cpp @@ -31,6 +31,7 @@ #include "io/resource_loader.h" #include "os/file_access.h" #include "script_language.h" +#include "gd_script.h" template<class T> T* GDParser::alloc_node() { @@ -477,7 +478,7 @@ GDParser::Node* GDParser::_parse_expression(Node *p_parent,bool p_static,bool p_ } else if (tokenizer->get_token()==GDTokenizer::TK_IDENTIFIER) { //identifier (reference) - const ClassNode* cln = static_cast<const ClassNode*>(get_parse_tree()); + const ClassNode* cln = current_class; bool bfn = false; StringName identifier; if (_get_completable_identifier(COMPLETION_IDENTIFIER,identifier)) { @@ -494,6 +495,14 @@ GDParser::Node* GDParser::_parse_expression(Node *p_parent,bool p_static,bool p_ } } + if (GDScriptLanguage::get_singleton()->get_global_map().has(identifier)) { + //check from constants + ConstantNode *constant = alloc_node<ConstantNode>(); + constant->value = GDScriptLanguage::get_singleton()->get_global_array()[ GDScriptLanguage::get_singleton()->get_global_map()[identifier] ]; + expr=constant; + bfn = true; + } + if ( !bfn ) { IdentifierNode *id = alloc_node<IdentifierNode>(); id->name = identifier; diff --git a/modules/gdscript/gd_script.cpp b/modules/gdscript/gd_script.cpp index e37a2ca155..d9783c218a 100644 --- a/modules/gdscript/gd_script.cpp +++ b/modules/gdscript/gd_script.cpp @@ -874,6 +874,10 @@ GDScript::~GDScript() { memdelete( E->get() ); } + for (Map<StringName,Ref<GDScript> >::Element *E=subclasses.front();E;E=E->next()) { + E->get()->_owner=NULL; //bye, you are no longer owned cause I died + } + #ifdef DEBUG_ENABLED if (GDScriptLanguage::get_singleton()->lock) { GDScriptLanguage::get_singleton()->lock->lock(); @@ -960,11 +964,16 @@ bool GDInstance::get(const StringName& p_name, Variant &r_ret) const { } { - const Map<StringName,Variant>::Element *E = script->constants.find(p_name); - if (E) { - r_ret=E->get(); - return true; //index found + const GDScript *sl = sptr; + while(sl) { + const Map<StringName,Variant>::Element *E = sl->constants.find(p_name); + if (E) { + r_ret=E->get(); + return true; //index found + + } + sl=sl->_base; } } diff --git a/modules/gdscript/gd_script.h b/modules/gdscript/gd_script.h index 166e29ad70..723761c3a9 100644 --- a/modules/gdscript/gd_script.h +++ b/modules/gdscript/gd_script.h @@ -202,6 +202,8 @@ friend class GDCompiler; public: + _FORCE_INLINE_ Object* get_owner() { return owner; } + virtual bool set(const StringName& p_name, const Variant& p_value); virtual bool get(const StringName& p_name, Variant &r_ret) const; virtual void get_property_list(List<PropertyInfo> *p_properties) const; diff --git a/scene/3d/skeleton.cpp b/scene/3d/skeleton.cpp index d0b739e17f..c996a8123c 100644 --- a/scene/3d/skeleton.cpp +++ b/scene/3d/skeleton.cpp @@ -64,15 +64,17 @@ bool Skeleton::_set(const StringName& p_path, const Variant& p_value) { else if (what=="bound_childs") { Array children=p_value; - bones[which].nodes_bound.clear(); + if (is_inside_tree()) { + bones[which].nodes_bound.clear(); - for (int i=0;i<children.size();i++) { + for (int i=0;i<children.size();i++) { - NodePath path=children[i]; - ERR_CONTINUE( path.operator String()=="" ); - Node *node = get_node(path); - ERR_CONTINUE(!node); - bind_child_node_to_bone(which,node); + NodePath path=children[i]; + ERR_CONTINUE( path.operator String()=="" ); + Node *node = get_node(path); + ERR_CONTINUE(!node); + bind_child_node_to_bone(which,node); + } } } else { return false; diff --git a/scene/audio/stream_player.cpp b/scene/audio/stream_player.cpp index 050e945c8f..99ecace1ed 100644 --- a/scene/audio/stream_player.cpp +++ b/scene/audio/stream_player.cpp @@ -77,7 +77,7 @@ void StreamPlayer::sp_update() { if (to_mix==0) { if (!stop_request) { stop_request=true; - call_deferred("stop"); + call_deferred("_do_stop"); } return; } @@ -91,7 +91,10 @@ void StreamPlayer::sp_update() { } } - +void StreamPlayer::_do_stop() { + stop(); + emit_signal("finished"); +} void StreamPlayer::_notification(int p_what) { @@ -181,7 +184,7 @@ void StreamPlayer::stop() { stop_request=false; playback->stop(); resampler.flush(); - emit_signal("finished"); + //set_idle_process(false); } @@ -381,6 +384,7 @@ void StreamPlayer::_bind_methods() { ObjectTypeDB::bind_method(_MD("_set_play","play"),&StreamPlayer::_set_play); ObjectTypeDB::bind_method(_MD("_get_play"),&StreamPlayer::_get_play); + ObjectTypeDB::bind_method(_MD("_do_stop"),&StreamPlayer::_do_stop); ADD_PROPERTY( PropertyInfo(Variant::OBJECT, "stream/stream", PROPERTY_HINT_RESOURCE_TYPE,"AudioStream"), _SCS("set_stream"), _SCS("get_stream") ); ADD_PROPERTY( PropertyInfo(Variant::BOOL, "stream/play"), _SCS("_set_play"), _SCS("_get_play") ); diff --git a/scene/audio/stream_player.h b/scene/audio/stream_player.h index 475139c2a4..4facc3c816 100644 --- a/scene/audio/stream_player.h +++ b/scene/audio/stream_player.h @@ -71,6 +71,8 @@ class StreamPlayer : public Node { AudioRBResampler resampler; + void _do_stop(); + bool _play; void _set_play(bool p_play); bool _get_play() const; diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp index 5379836746..d63c483ef9 100644 --- a/scene/gui/item_list.cpp +++ b/scene/gui/item_list.cpp @@ -1245,6 +1245,19 @@ real_t ItemList::get_icon_scale() const { return icon_scale; } +Vector<int> ItemList::get_selected_items() { + Vector<int> selected; + for (int i = 0; i < items.size(); i++) { + if (items[i].selected) { + selected.push_back(i); + if (this->select_mode == SELECT_SINGLE) { + break; + } + } + } + return selected; +} + void ItemList::_bind_methods(){ ObjectTypeDB::bind_method(_MD("add_item","text","icon:Texture","selectable"),&ItemList::add_item,DEFVAL(Variant()),DEFVAL(true)); @@ -1277,6 +1290,7 @@ void ItemList::_bind_methods(){ ObjectTypeDB::bind_method(_MD("select","idx","single"),&ItemList::select,DEFVAL(true)); ObjectTypeDB::bind_method(_MD("unselect","idx"),&ItemList::unselect); ObjectTypeDB::bind_method(_MD("is_selected","idx"),&ItemList::is_selected); + ObjectTypeDB::bind_method(_MD("get_selected_items"),&ItemList::get_selected_items); ObjectTypeDB::bind_method(_MD("get_item_count"),&ItemList::get_item_count); ObjectTypeDB::bind_method(_MD("remove_item","idx"),&ItemList::remove_item); @@ -1330,8 +1344,6 @@ void ItemList::_bind_methods(){ ADD_SIGNAL( MethodInfo("item_activated",PropertyInfo(Variant::INT,"index"))); } - - ItemList::ItemList() { current=-1; diff --git a/scene/gui/item_list.h b/scene/gui/item_list.h index aa6dd64c50..e1902d1c1f 100644 --- a/scene/gui/item_list.h +++ b/scene/gui/item_list.h @@ -144,6 +144,7 @@ public: void select(int p_idx,bool p_single=true); void unselect(int p_idx); bool is_selected(int p_idx) const; + Vector<int> get_selected_items(); void set_current(int p_current); int get_current() const; diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 6fd6137ac8..3adf129ce5 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -852,6 +852,11 @@ void TextEdit::_notification(int p_what) { k++; } + // check for space between name and bracket + while (k < str.length() && (str[k] == '\t' || str[k] == ' ')) { + k++; + } + if (str[k] == '(') { in_function_name = true; } @@ -4541,6 +4546,7 @@ TextEdit::TextEdit() { scroll_past_end_of_file_enabled=false; auto_brace_completion_enabled=false; brace_matching_enabled=false; + highlight_all_occurrences=false; auto_indent=false; insert_mode = false; window_has_focus=true; 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/main/viewport.cpp b/scene/main/viewport.cpp index ff8f0d05f1..68f5a252e5 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -1331,11 +1331,11 @@ Matrix32 Viewport::_get_input_pre_xform() const { Matrix32 pre_xf; if (render_target) { - ERR_FAIL_COND_V(to_screen_rect.size.x==0,pre_xf); - ERR_FAIL_COND_V(to_screen_rect.size.y==0,pre_xf); + if (to_screen_rect!=Rect2()) { - pre_xf.elements[2]=-to_screen_rect.pos; - pre_xf.scale(rect.size/to_screen_rect.size); + pre_xf.elements[2]=-to_screen_rect.pos; + pre_xf.scale(rect.size/to_screen_rect.size); + } } else { pre_xf.elements[2]=-rect.pos; diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp index ac528e6659..50852dc1f7 100644 --- a/scene/resources/packed_scene.cpp +++ b/scene/resources/packed_scene.cpp @@ -375,7 +375,7 @@ Error SceneState::_parse_node(Node *p_owner,Node *p_node,int p_parent_idx, Map<S PackState ps; ps.node=node; ps.state=state; - pack_state_stack.push_front(ps); + pack_state_stack.push_back(ps); instanced_by_owner=false; } } @@ -545,6 +545,7 @@ https://github.com/godotengine/godot/issues/3127 } #endif + if (exists) { //check if already exists and did not change @@ -556,6 +557,7 @@ https://github.com/godotengine/godot/issues/3127 if (Math::abs(a-b)<CMP_EPSILON) continue; } else if (bool(Variant::evaluate(Variant::OP_EQUAL,value,original))) { + continue; } } 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; diff --git a/tools/doc/doc_data.cpp b/tools/doc/doc_data.cpp index e3689cf13d..470dd078ae 100644 --- a/tools/doc/doc_data.cpp +++ b/tools/doc/doc_data.cpp @@ -455,6 +455,12 @@ void DocData::generate(bool p_basic_types) { } + { + //so it can be documented that it does not exist + class_list["Variant"]=ClassDoc(); + class_list["Variant"].name="Variant"; + } + if (!p_basic_types) return; diff --git a/tools/editor/asset_library_editor_plugin.cpp b/tools/editor/asset_library_editor_plugin.cpp index a2448921d7..ee535310bc 100644 --- a/tools/editor/asset_library_editor_plugin.cpp +++ b/tools/editor/asset_library_editor_plugin.cpp @@ -1366,7 +1366,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) { repository = memnew( OptionButton ); repository->add_item("Godot"); - repository->set_item_metadata(0, "http://godotengine.org/asset-library/api"); + repository->set_item_metadata(0, "https://godotengine.org/asset-library/api"); repository->add_item("Localhost"); // TODO: Maybe remove? repository->set_item_metadata(1, "http://127.0.0.1/asset-library/api"); repository->connect("item_selected",this,"_repository_changed"); diff --git a/tools/editor/editor_data.cpp b/tools/editor/editor_data.cpp index 4c4fecdd83..0f10041034 100644 --- a/tools/editor/editor_data.cpp +++ b/tools/editor/editor_data.cpp @@ -565,6 +565,8 @@ bool EditorData::check_and_update_scene(int p_idx) { bool must_reload = _find_updated_instances(edited_scene[p_idx].root,edited_scene[p_idx].root,checked_scenes); + print_line("MUST RELOAD? "+itos(must_reload)); + if (must_reload) { Ref<PackedScene> pscene; pscene.instance(); @@ -762,6 +764,8 @@ Ref<ResourceImportMetadata> EditorData::get_edited_scene_import_metadata() const return edited_scene[current_edited_scene].medatata; } + + void EditorData::clear_edited_scenes() { for(int i=0;i<edited_scene.size();i++) { diff --git a/tools/editor/editor_file_dialog.cpp b/tools/editor/editor_file_dialog.cpp index e68a53659b..b8abd1d32c 100644 --- a/tools/editor/editor_file_dialog.cpp +++ b/tools/editor/editor_file_dialog.cpp @@ -144,11 +144,11 @@ void EditorFileDialog::_unhandled_input(const InputEvent& p_event) { dir->grab_focus(); handled=true; } - if (ED_IS_SHORTCUT("file_dialog/mode_favorite_up", p_event)) { + if (ED_IS_SHORTCUT("file_dialog/move_favorite_up", p_event)) { _favorite_move_up(); handled=true; } - if (ED_IS_SHORTCUT("file_dialog/mode_favorite_down", p_event)) { + if (ED_IS_SHORTCUT("file_dialog/move_favorite_down", p_event)) { _favorite_move_down(); handled=true; } @@ -1290,14 +1290,14 @@ EditorFileDialog::EditorFileDialog() { ED_SHORTCUT("file_dialog/go_back", TTR("Go Back"), KEY_MASK_ALT|KEY_LEFT); ED_SHORTCUT("file_dialog/go_forward", TTR("Go Forward"), KEY_MASK_ALT|KEY_RIGHT); ED_SHORTCUT("file_dialog/go_up", TTR("Go Up"), KEY_MASK_ALT|KEY_UP); - ED_SHORTCUT("file_dialog/refresh", TTR("Refresh"), KEY_MASK_CMD|KEY_F5); // ctrl + f5 else it launches the game as well.. + ED_SHORTCUT("file_dialog/refresh", TTR("Refresh"), KEY_F5); ED_SHORTCUT("file_dialog/toggle_hidden_files", TTR("Toggle Hidden Files"), KEY_MASK_CMD|KEY_H); ED_SHORTCUT("file_dialog/toggle_favorite", TTR("Toggle Favorite"), KEY_MASK_ALT|KEY_F); ED_SHORTCUT("file_dialog/toggle_mode", TTR("Toggle Mode"), KEY_MASK_ALT|KEY_V); ED_SHORTCUT("file_dialog/create_folder", TTR("Create Folder"), KEY_MASK_CMD|KEY_N); ED_SHORTCUT("file_dialog/focus_path", TTR("Focus Path"), KEY_MASK_CMD|KEY_D); - ED_SHORTCUT("file_dialog/mode_favorite_up", TTR("Mode Favorite Up"), KEY_MASK_CMD|KEY_UP); - ED_SHORTCUT("file_dialog/mode_favorite_down", TTR("Mode Favorite Down"), KEY_MASK_CMD|KEY_DOWN); + ED_SHORTCUT("file_dialog/move_favorite_up", TTR("Move Favorite Up"), KEY_MASK_CMD|KEY_UP); + ED_SHORTCUT("file_dialog/move_favorite_down", TTR("Move Favorite Down"), KEY_MASK_CMD|KEY_DOWN); HBoxContainer *pathhb = memnew( HBoxContainer ); diff --git a/tools/editor/editor_file_system.cpp b/tools/editor/editor_file_system.cpp index 303f81477d..1f414f80a0 100644 --- a/tools/editor/editor_file_system.cpp +++ b/tools/editor/editor_file_system.cpp @@ -830,12 +830,10 @@ void EditorFileSystem::_scan_fs_changes(EditorFileSystemDirectory *p_dir,const S } } + da->list_dir_end(); memdelete(da); - - - } for(int i=0;i<p_dir->files.size();i++) { diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index 58da0e8478..2bba97251d 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -3429,7 +3429,10 @@ Dictionary EditorNode::_get_main_scene_state() { return state; } -void EditorNode::_set_main_scene_state(Dictionary p_state) { +void EditorNode::_set_main_scene_state(Dictionary p_state,Node* p_for_scene) { + + if (get_edited_scene()!=p_for_scene && p_for_scene!=NULL) + return; //not for this scene //print_line("set current 7 "); changing_scene=false; @@ -3573,7 +3576,7 @@ void EditorNode::set_current_scene(int p_idx) { }*/ //_set_main_scene_state(state); - call_deferred("_set_main_scene_state",state); //do after everything else is done setting up + call_deferred("_set_main_scene_state",state,get_edited_scene()); //do after everything else is done setting up //print_line("set current 6 "); @@ -5115,6 +5118,78 @@ void EditorNode::_file_access_close_error_notify(const String& p_str) { add_io_error("Unable to write to file '"+p_str+"', file in use, locked or lacking permissions."); } + +void EditorNode::reload_scene(const String& p_path) { + + + //first of all, reload textures as they might have changed on disk + + List<Ref<Resource> > cached; + ResourceCache::get_cached_resources(&cached); + List<Ref<Resource> > to_clear; //clear internal resources from previous scene from being used + for(List<Ref<Resource> >::Element *E=cached.front();E;E=E->next()) { + + if (E->get()->get_path().begins_with(p_path+"::")) //subresources of existing scene + to_clear.push_back(E->get()); + + if (!E->get()->cast_to<Texture>()) + continue; + if (!E->get()->get_path().is_resource_file() && !E->get()->get_path().is_abs_path()) + continue; + if (!FileAccess::exists(E->get()->get_path())) + continue; + uint64_t mt = FileAccess::get_modified_time(E->get()->get_path()); + if (mt!=E->get()->get_last_modified_time()) { + E->get()->reload_from_file(); + } + } + + //so reload reloads everything, clear subresources of previous scene + while(to_clear.front()) { + to_clear.front()->get()->set_path(""); + to_clear.pop_front(); + } + + int scene_idx=-1; + for(int i=0;i<editor_data.get_edited_scene_count();i++) { + + if (editor_data.get_scene_path(i)==p_path) { + scene_idx=i; + break; + } + } + + int current_tab = editor_data.get_edited_scene(); + + + if (scene_idx==-1) { + if (get_edited_scene()) { + //scene is not open, so at it might be instanced, just refresh, set tab to itself and it will reload + set_current_scene(current_tab); + editor_data.get_undo_redo().clear_history(); + } + return; + } + + + if (current_tab==scene_idx) { + editor_data.apply_changes_in_editors(); + _set_scene_metadata(p_path); + + } + //remove scene + _remove_scene(scene_idx); + //reload scene + load_scene(p_path); + //adjust index so tab is back a the previous position + editor_data.move_edited_scene_to_index(scene_idx); + get_undo_redo()->clear_history(); + //recover the tab + scene_tabs->set_current_tab(current_tab); + _scene_tab_changed(current_tab); +} + + void EditorNode::_bind_methods() { diff --git a/tools/editor/editor_node.h b/tools/editor/editor_node.h index a0a03341fc..9b0edda75e 100644 --- a/tools/editor/editor_node.h +++ b/tools/editor/editor_node.h @@ -555,7 +555,7 @@ private: void _scene_tab_script_edited(int p_tab); Dictionary _get_main_scene_state(); - void _set_main_scene_state(Dictionary p_state); + void _set_main_scene_state(Dictionary p_state,Node* p_for_scene); int _get_current_main_editor(); @@ -716,6 +716,8 @@ public: void update_keying(); + void reload_scene(const String& p_path); + bool is_exiting() const { return exiting; } ToolButton *get_pause_button() { return pause_button; } diff --git a/tools/editor/io_plugins/editor_scene_import_plugin.cpp b/tools/editor/io_plugins/editor_scene_import_plugin.cpp index d5d0fac2b6..b27539b933 100644 --- a/tools/editor/io_plugins/editor_scene_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_scene_import_plugin.cpp @@ -2790,15 +2790,16 @@ Error EditorSceneImportPlugin::import2(Node *scene, const String& p_dest_path, c Ref<PackedScene> packer = memnew( PackedScene ); packer->pack(scene); - packer->set_path(p_dest_path); + //packer->set_path(p_dest_path); do not take over, let the changed files reload themselves packer->set_import_metadata(from); print_line("SAVING TO: "+p_dest_path); - err = ResourceSaver::save(p_dest_path,packer,ResourceSaver::FLAG_REPLACE_SUBRESOURCE_PATHS); + err = ResourceSaver::save(p_dest_path,packer); //do not take over, let the changed files reload themselves //EditorFileSystem::get_singleton()->update_resource(packer); memdelete(scene); + /* scene->set_filename(p_dest_path); if (r_scene) { @@ -2818,6 +2819,7 @@ Error EditorSceneImportPlugin::import2(Node *scene, const String& p_dest_path, c */ + EditorNode::get_singleton()->reload_scene(p_dest_path); return err; diff --git a/tools/editor/plugins/animation_player_editor_plugin.cpp b/tools/editor/plugins/animation_player_editor_plugin.cpp index 10c7bf79a3..203564e612 100644 --- a/tools/editor/plugins/animation_player_editor_plugin.cpp +++ b/tools/editor/plugins/animation_player_editor_plugin.cpp @@ -1404,6 +1404,7 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor) { hb->add_child(animation); animation->set_h_size_flags(SIZE_EXPAND_FILL); animation->set_tooltip(TTR("Display list of animations in player.")); + animation->set_clip_text(true); autoplay = memnew( ToolButton ); hb->add_child(autoplay); diff --git a/tools/editor/plugins/sprite_frames_editor_plugin.cpp b/tools/editor/plugins/sprite_frames_editor_plugin.cpp index 4f59287994..e29a0c8d52 100644 --- a/tools/editor/plugins/sprite_frames_editor_plugin.cpp +++ b/tools/editor/plugins/sprite_frames_editor_plugin.cpp @@ -31,7 +31,7 @@ #include "io/resource_loader.h" #include "globals.h" #include "tools/editor/editor_settings.h" - +#include "scene/3d/sprite_3d.h" @@ -355,6 +355,35 @@ void SpriteFramesEditor::_animation_select() { } + +static void _find_anim_sprites(Node* p_node,List<Node*> *r_nodes,Ref<SpriteFrames> p_sfames) { + + Node *edited = EditorNode::get_singleton()->get_edited_scene(); + if (!edited) + return; + if (p_node!=edited && p_node->get_owner()!=edited) + return; + + { + AnimatedSprite *as = p_node->cast_to<AnimatedSprite>(); + if (as && as->get_sprite_frames()==p_sfames) { + r_nodes->push_back(p_node); + } + } + + { + AnimatedSprite3D *as = p_node->cast_to<AnimatedSprite3D>(); + if (as && as->get_sprite_frames()==p_sfames) { + r_nodes->push_back(p_node); + } + } + + for(int i=0;i<p_node->get_child_count();i++) { + _find_anim_sprites(p_node->get_child(i),r_nodes,p_sfames); + } + +} + void SpriteFramesEditor::_animation_name_edited(){ if (updating) @@ -381,9 +410,24 @@ void SpriteFramesEditor::_animation_name_edited(){ name=new_name+" "+itos(counter); } + List<Node*> nodes; + _find_anim_sprites(EditorNode::get_singleton()->get_edited_scene(),&nodes,Ref<SpriteFrames>(frames)); + undo_redo->create_action(TTR("Rename Animation")); undo_redo->add_do_method(frames,"rename_animation",edited_anim,name); undo_redo->add_undo_method(frames,"rename_animation",name,edited_anim); + + for(List<Node*>::Element *E=nodes.front();E;E=E->next()) { + + String current = E->get()->call("get_animation"); + if (current!=edited_anim) + continue; + + undo_redo->add_do_method(E->get(),"set_animation",name); + undo_redo->add_undo_method(E->get(),"set_animation",edited_anim); + + } + undo_redo->add_do_method(this,"_update_library"); undo_redo->add_undo_method(this,"_update_library"); @@ -406,12 +450,28 @@ void SpriteFramesEditor::_animation_add(){ name=new_name+" "+itos(counter); } + List<Node*> nodes; + _find_anim_sprites(EditorNode::get_singleton()->get_edited_scene(),&nodes,Ref<SpriteFrames>(frames)); + + undo_redo->create_action(TTR("Add Animation")); undo_redo->add_do_method(frames,"add_animation",name); undo_redo->add_undo_method(frames,"remove_animation",name); undo_redo->add_do_method(this,"_update_library"); undo_redo->add_undo_method(this,"_update_library"); + + for(List<Node*>::Element *E=nodes.front();E;E=E->next()) { + + String current = E->get()->call("get_animation"); + if (frames->has_animation(current)) + continue; + + undo_redo->add_do_method(E->get(),"set_animation",name); + undo_redo->add_undo_method(E->get(),"set_animation",current); + + } + edited_anim=new_name; undo_redo->commit_action(); @@ -426,6 +486,7 @@ void SpriteFramesEditor::_animation_remove(){ if (!frames->has_animation(edited_anim)) return; + undo_redo->create_action(TTR("Remove Animation")); undo_redo->add_do_method(frames,"remove_animation",edited_anim); undo_redo->add_undo_method(frames,"add_animation",edited_anim); diff --git a/tools/editor/plugins/texture_region_editor_plugin.cpp b/tools/editor/plugins/texture_region_editor_plugin.cpp index 8515008982..63d8e2e1cf 100644 --- a/tools/editor/plugins/texture_region_editor_plugin.cpp +++ b/tools/editor/plugins/texture_region_editor_plugin.cpp @@ -302,7 +302,6 @@ void TextureRegionEditor::_region_input(const InputEvent& p_input) } } } else if (edited_margin < 0) { - print_line("EDIT RECTANGLE!!!"); drag_from=mtx.affine_inverse().xform(Vector2(mb.x,mb.y)); if (snap_mode == SNAP_PIXEL) drag_from = drag_from.snapped(Vector2(1,1)); @@ -332,7 +331,6 @@ void TextureRegionEditor::_region_input(const InputEvent& p_input) } } else if (drag) { - print_line("DRAGING!!!"); if (edited_margin >= 0) { undo_redo->create_action("Set Margin"); static Margin m[4] = {MARGIN_TOP,MARGIN_BOTTOM,MARGIN_LEFT,MARGIN_RIGHT}; @@ -776,6 +774,8 @@ TextureRegionEditor::TextureRegionEditor(EditorNode* p_editor) snap_step=Vector2(10,10); snap_separation = Vector2(0,0); + edited_margin = -1; + drag_index = -1; drag=false; VBoxContainer *main_vb = memnew( VBoxContainer ); diff --git a/tools/editor/scene_tree_editor.cpp b/tools/editor/scene_tree_editor.cpp index a155f0c0cf..f174bc2f1b 100644 --- a/tools/editor/scene_tree_editor.cpp +++ b/tools/editor/scene_tree_editor.cpp @@ -302,8 +302,15 @@ bool SceneTreeEditor::_add_nodes(Node *p_node,TreeItem *p_parent) { item->set_selectable(0,true); if (can_rename) { - - bool collapsed = p_node->has_meta("_editor_collapsed") ? (bool)p_node->get_meta("_editor_collapsed") : false; +#ifdef ENABLE_DEPRECATED + if (p_node->has_meta("_editor_collapsed")) { + //remove previous way of storing folding, which did not get along with scene inheritance and instancing + if ((bool)p_node->get_meta("_editor_collapsed")) + p_node->set_display_folded(true); + p_node->set_meta("_editor_collapsed",Variant()); + } +#endif + bool collapsed = p_node->is_displayed_folded(); if (collapsed) item->set_collapsed(true); } @@ -896,10 +903,7 @@ void SceneTreeEditor::_cell_collapsed(Object *p_obj) { Node *n=get_node(np); ERR_FAIL_COND(!n); - if (collapsed) - n->set_meta("_editor_collapsed",true); - else - n->set_meta("_editor_collapsed",Variant()); + n->set_display_folded(collapsed); } diff --git a/tools/translations/tools.pot b/tools/translations/tools.pot index cf59d9a8a2..a5385f3bad 100644 --- a/tools/translations/tools.pot +++ b/tools/translations/tools.pot @@ -1181,11 +1181,11 @@ msgid "Focus Path" msgstr "" #: tools/editor/editor_file_dialog.cpp -msgid "Mode Favorite Up" +msgid "Move Favorite Up" msgstr "" #: tools/editor/editor_file_dialog.cpp -msgid "Mode Favorite Down" +msgid "Move Favorite Down" msgstr "" #: tools/editor/editor_file_dialog.cpp tools/editor/scenes_dock.cpp |