From a1142225bf513e4afe0527ca604486d3988449cc Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Tue, 15 Dec 2015 23:39:36 -0300 Subject: -split view of property editor and editor settings --- core/globals.cpp | 20 ++++++++++++++++++-- core/globals.h | 7 +++++++ 2 files changed, 25 insertions(+), 2 deletions(-) (limited to 'core') diff --git a/core/globals.cpp b/core/globals.cpp index fd0f2dbe14..eed37c2308 100644 --- a/core/globals.cpp +++ b/core/globals.cpp @@ -132,8 +132,12 @@ bool Globals::_set(const StringName& p_name, const Variant& p_value) { if (props.has(p_name)) { if (!props[p_name].overrided) props[p_name].variant=p_value; + + if (props[p_name].order>=NO_ORDER_BASE && registering_order) { + props[p_name].order=last_order++; + } } else { - props[p_name]=VariantContainer(p_value,last_order++); + props[p_name]=VariantContainer(p_value,last_order++ + registering_order?0:NO_ORDER_BASE); } } @@ -741,6 +745,10 @@ static Variant _decode_variant(const String& p_string) { return Variant(); } +void Globals::set_registering_order(bool p_enable) { + + registering_order=p_enable; +} Error Globals::_load_settings_binary(const String p_path) { @@ -760,6 +768,8 @@ Error Globals::_load_settings_binary(const String p_path) { ERR_FAIL_V(ERR_FILE_CORRUPT;) } + set_registering_order(false); + uint32_t count=f->get_32(); for(int i=0;ieof_reached()) { @@ -877,6 +892,7 @@ Error Globals::_load_settings(const String p_path) { memdelete(f); + set_registering_order(true); return OK; } @@ -1388,7 +1404,7 @@ Globals::Globals() { singleton=this; last_order=0; disable_platform_override=false; - + registering_order=true; Array va; diff --git a/core/globals.h b/core/globals.h index 25c7f96be2..bfa400988f 100644 --- a/core/globals.h +++ b/core/globals.h @@ -54,6 +54,10 @@ public: protected: + enum { + NO_ORDER_BASE=1<<18 + }; + struct VariantContainer { int order; bool persist; @@ -64,6 +68,7 @@ protected: VariantContainer(const Variant& p_variant, int p_order, bool p_persist=false) { variant=p_variant; order=p_order; hide_from_editor=false; persist=p_persist; overrided=false; } }; + bool registering_order; int last_order; Map props; String resource_path; @@ -134,6 +139,8 @@ public: bool is_using_datapack() const; + void set_registering_order(bool p_registering); + Globals(); ~Globals(); -- cgit v1.2.3