diff options
65 files changed, 900 insertions, 1670 deletions
diff --git a/bin/tests/test_math.cpp b/bin/tests/test_math.cpp index 2ffef83f79..e3e74af14c 100644 --- a/bin/tests/test_math.cpp +++ b/bin/tests/test_math.cpp @@ -477,6 +477,20 @@ uint32_t ihash3( uint32_t a) MainLoop* test() { + Matrix3 m; + m.rotate(Vector3(0,1,0),Math_PI*0.5); + + print_line(m.scaled(Vector3(0.5,1,1))); + Matrix3 s; + s.scale(Vector3(0.5,1.0,1.0)); + + print_line(m * s); + + + + + + return NULL; List<String> cmdlargs = OS::get_singleton()->get_cmdline_args(); diff --git a/core/os/memory.cpp b/core/os/memory.cpp index 4922a18335..cf42c3681a 100644 --- a/core/os/memory.cpp +++ b/core/os/memory.cpp @@ -30,9 +30,68 @@ #include "error_macros.h" #include "copymem.h" #include <stdio.h> +#include <stdlib.h> + + +MID::MID(MemoryPoolDynamic::ID p_id) { + + data = (Data*)memalloc(sizeof(Data)); + data->refcount.init(); + data->id=p_id; +} + +void MID::unref() { + + if (!data) + return; + if (data->refcount.unref()) { + + if (data->id!=MemoryPoolDynamic::INVALID_ID) + MemoryPoolDynamic::get_singleton()->free(data->id); + memfree(data); + } + + data=NULL; +} +Error MID::_resize(size_t p_size) { + + if (p_size==0 && (!data || data->id==MemoryPoolDynamic::INVALID_ID)) + return OK; + if (p_size && !data) { + // create data because we'll need it + data = (Data*)memalloc(sizeof(Data)); + ERR_FAIL_COND_V( !data,ERR_OUT_OF_MEMORY ); + data->refcount.init(); + data->id=MemoryPoolDynamic::INVALID_ID; + } + + if (p_size==0 && data && data->id==MemoryPoolDynamic::INVALID_ID) { + + MemoryPoolDynamic::get_singleton()->free(data->id); + data->id=MemoryPoolDynamic::INVALID_ID; + } + + if (p_size>0) { + + if (data->id==MemoryPoolDynamic::INVALID_ID) { + + data->id=MemoryPoolDynamic::get_singleton()->alloc(p_size,"Unnamed MID"); + ERR_FAIL_COND_V( data->id==MemoryPoolDynamic::INVALID_ID, ERR_OUT_OF_MEMORY ); + + } else { + + MemoryPoolDynamic::get_singleton()->realloc(data->id,p_size); + ERR_FAIL_COND_V( data->id==MemoryPoolDynamic::INVALID_ID, ERR_OUT_OF_MEMORY ); + + } + } + + return OK; +} + void * operator new(size_t p_size,const char *p_description) { - return Memory::alloc_static( p_size, p_description ); + return Memory::alloc_static( p_size, false ); } void * operator new(size_t p_size,void* (*p_allocfunc)(size_t p_size)) { @@ -42,49 +101,147 @@ void * operator new(size_t p_size,void* (*p_allocfunc)(size_t p_size)) { #include <stdio.h> -void * Memory::alloc_static(size_t p_bytes,const char *p_alloc_from) { +#ifdef DEBUG_ENABLED +size_t Memory::mem_usage=0; +size_t Memory::max_usage=0; +#endif - ERR_FAIL_COND_V( !MemoryPoolStatic::get_singleton(), NULL ); - return MemoryPoolStatic::get_singleton()->alloc(p_bytes,p_alloc_from); -} -void * Memory::realloc_static(void *p_memory,size_t p_bytes) { +size_t Memory::alloc_count=0; - ERR_FAIL_COND_V( !MemoryPoolStatic::get_singleton(), NULL ); - return MemoryPoolStatic::get_singleton()->realloc(p_memory,p_bytes); -} -void Memory::free_static(void *p_ptr) { +void * Memory::alloc_static(size_t p_bytes,bool p_pad_align) { - ERR_FAIL_COND( !MemoryPoolStatic::get_singleton()); - MemoryPoolStatic::get_singleton()->free(p_ptr); -} +#ifdef DEBUG_ENABLED + bool prepad=true; +#else + bool prepad=p_pad_align; +#endif + + void * mem = malloc( p_bytes + (prepad?PAD_ALIGN:0)); + + alloc_count++; -size_t Memory::get_static_mem_available() { + ERR_FAIL_COND_V(!mem,NULL); - ERR_FAIL_COND_V( !MemoryPoolStatic::get_singleton(), 0); - return MemoryPoolStatic::get_singleton()->get_available_mem(); + if (prepad) { + uint64_t *s = (uint64_t*)mem; + *s=p_bytes; + uint8_t *s8 = (uint8_t*)mem; + +#ifdef DEBUG_ENABLED + mem_usage+=p_bytes; + if (mem_usage>max_usage) { + max_usage=mem_usage; + } +#endif + return s8 + PAD_ALIGN; + } else { + return mem; + } } -size_t Memory::get_static_mem_max_usage() { +void * Memory::realloc_static(void *p_memory,size_t p_bytes,bool p_pad_align) { + + if (p_memory==NULL) { + return alloc_static(p_bytes,p_pad_align); + } + + uint8_t *mem = (uint8_t*)p_memory; + +#ifdef DEBUG_ENABLED + bool prepad=true; +#else + bool prepad=p_pad_align; +#endif + + if (prepad) { + mem-=PAD_ALIGN; + uint64_t *s = (uint64_t*)mem; + +#ifdef DEBUG_ENABLED + mem_usage-=*s; + mem_usage+=p_bytes; +#endif + + if (p_bytes==0) { + free(mem); + return NULL; + } else { + *s=p_bytes; + + mem = (uint8_t*)realloc(mem,p_bytes+PAD_ALIGN); + ERR_FAIL_COND_V(!mem,NULL); + + s = (uint64_t*)mem; + + *s=p_bytes; + + return mem+PAD_ALIGN; + } + } else { + + mem = (uint8_t*)realloc(mem,p_bytes); + + ERR_FAIL_COND_V(mem==NULL && p_bytes>0,NULL); - ERR_FAIL_COND_V( !MemoryPoolStatic::get_singleton(), 0); - return MemoryPoolStatic::get_singleton()->get_max_usage(); + return mem; + } } -size_t Memory::get_static_mem_usage() { +void Memory::free_static(void *p_ptr,bool p_pad_align) { - ERR_FAIL_COND_V( !MemoryPoolStatic::get_singleton(), 0); - return MemoryPoolStatic::get_singleton()->get_total_usage(); + ERR_FAIL_COND(p_ptr==NULL); + + uint8_t *mem = (uint8_t*)p_ptr; + +#ifdef DEBUG_ENABLED + bool prepad=true; +#else + bool prepad=p_pad_align; +#endif + + alloc_count--; + + if (prepad) { + mem-=PAD_ALIGN; + uint64_t *s = (uint64_t*)mem; + +#ifdef DEBUG_ENABLED + mem_usage-=*s; +#endif + + free(mem); + } else { + + free(mem); + } } -void Memory::dump_static_mem_to_file(const char* p_file) { +size_t Memory::get_mem_available() { + + return 0xFFFFFFFFFFFFF; + +} - MemoryPoolStatic::get_singleton()->dump_mem_to_file(p_file); +size_t Memory::get_mem_usage(){ +#ifdef DEBUG_ENABLED + return mem_usage; +#else + return 0; +#endif +} +size_t Memory::get_mem_max_usage(){ +#ifdef DEBUG_ENABLED + return max_usage; +#else + return 0; +#endif } + MID Memory::alloc_dynamic(size_t p_bytes, const char *p_descr) { MemoryPoolDynamic::ID id = MemoryPoolDynamic::get_singleton()->alloc(p_bytes,p_descr); diff --git a/core/os/memory.h b/core/os/memory.h index b3b806f7c6..6a939e3d6f 100644 --- a/core/os/memory.h +++ b/core/os/memory.h @@ -32,13 +32,18 @@ #include <stddef.h> #include "safe_refcount.h" #include "os/memory_pool_dynamic.h" -#include "os/memory_pool_static.h" + /** @author Juan Linietsky <reduzio@gmail.com> */ +#ifndef PAD_ALIGN +#define PAD_ALIGN 16 //must always be greater than this at much +#endif + + class MID { struct Data { @@ -49,19 +54,7 @@ class MID { mutable Data *data; - void unref() { - if (!data) - return; - if (data->refcount.unref()) { - - if (data->id!=MemoryPoolDynamic::INVALID_ID) - MemoryPoolDynamic::get_singleton()->free(data->id); - MemoryPoolStatic::get_singleton()->free(data); - } - - data=NULL; - } void ref(Data *p_data) { @@ -95,49 +88,13 @@ friend class MID_Lock; return NULL; } - Error _resize(size_t p_size) { - - if (p_size==0 && (!data || data->id==MemoryPoolDynamic::INVALID_ID)) - return OK; - if (p_size && !data) { - // create data because we'll need it - data = (Data*)MemoryPoolStatic::get_singleton()->alloc(sizeof(Data),"MID::Data"); - ERR_FAIL_COND_V( !data,ERR_OUT_OF_MEMORY ); - data->refcount.init(); - data->id=MemoryPoolDynamic::INVALID_ID; - } - - if (p_size==0 && data && data->id==MemoryPoolDynamic::INVALID_ID) { - - MemoryPoolDynamic::get_singleton()->free(data->id); - data->id=MemoryPoolDynamic::INVALID_ID; - } - - if (p_size>0) { - - if (data->id==MemoryPoolDynamic::INVALID_ID) { - data->id=MemoryPoolDynamic::get_singleton()->alloc(p_size,"Unnamed MID"); - ERR_FAIL_COND_V( data->id==MemoryPoolDynamic::INVALID_ID, ERR_OUT_OF_MEMORY ); + void unref(); + Error _resize(size_t p_size); - } else { - - MemoryPoolDynamic::get_singleton()->realloc(data->id,p_size); - ERR_FAIL_COND_V( data->id==MemoryPoolDynamic::INVALID_ID, ERR_OUT_OF_MEMORY ); - - } - } - - return OK; - } friend class Memory; - MID(MemoryPoolDynamic::ID p_id) { - - data = (Data*)MemoryPoolStatic::get_singleton()->alloc(sizeof(Data),"MID::Data"); - data->refcount.init(); - data->id=p_id; - } + MID(MemoryPoolDynamic::ID p_id); public: bool is_valid() const { return data; } @@ -173,15 +130,23 @@ public: class Memory{ Memory(); +#ifdef DEBUG_ENABLED + static size_t mem_usage; + static size_t max_usage; +#endif + + static size_t alloc_count; + public: - static void * alloc_static(size_t p_bytes,const char *p_descr=""); - static void * realloc_static(void *p_memory,size_t p_bytes); - static void free_static(void *p_ptr); - static size_t get_static_mem_available(); - static size_t get_static_mem_usage(); - static size_t get_static_mem_max_usage(); - static void dump_static_mem_to_file(const char* p_file); + static void * alloc_static(size_t p_bytes,bool p_pad_align=false); + static void * realloc_static(void *p_memory,size_t p_bytes,bool p_pad_align=false); + static void free_static(void *p_ptr,bool p_pad_align=false); + + static size_t get_mem_available(); + static size_t get_mem_usage(); + static size_t get_mem_max_usage(); + static MID alloc_dynamic(size_t p_bytes, const char *p_descr=""); static Error realloc_dynamic(MID p_mid,size_t p_bytes); @@ -191,15 +156,10 @@ public: }; -template<class T> -struct MemAalign { - static _FORCE_INLINE_ int get_align() { return DEFAULT_ALIGNMENT; } -}; - class DefaultAllocator { public: - _FORCE_INLINE_ static void *alloc(size_t p_memory) { return Memory::alloc_static(p_memory, ""); } - _FORCE_INLINE_ static void free(void *p_ptr) { return Memory::free_static(p_ptr); } + _FORCE_INLINE_ static void *alloc(size_t p_memory) { return Memory::alloc_static(p_memory, false); } + _FORCE_INLINE_ static void free(void *p_ptr) { return Memory::free_static(p_ptr,false); } }; @@ -209,19 +169,10 @@ void * operator new(size_t p_size,void* (*p_allocfunc)(size_t p_size)); ///< ope void * operator new(size_t p_size,void *p_pointer,size_t check, const char *p_description); ///< operator new that takes a description and uses a pointer to the preallocated memory -#ifdef DEBUG_MEMORY_ENABLED - -#define memalloc(m_size) Memory::alloc_static(m_size, __FILE__ ":" __STR(__LINE__) ", memalloc.") -#define memrealloc(m_mem,m_size) Memory::realloc_static(m_mem,m_size) -#define memfree(m_size) Memory::free_static(m_size) - -#else - #define memalloc(m_size) Memory::alloc_static(m_size) #define memrealloc(m_mem,m_size) Memory::realloc_static(m_mem,m_size) #define memfree(m_size) Memory::free_static(m_size) -#endif #ifdef DEBUG_MEMORY_ENABLED #define dynalloc(m_size) Memory::alloc_dynamic(m_size, __FILE__ ":" __STR(__LINE__) ", type: DYNAMIC") @@ -245,16 +196,8 @@ _ALWAYS_INLINE_ T *_post_initialize(T *p_obj) { return p_obj; } -#ifdef DEBUG_MEMORY_ENABLED - -#define memnew(m_class) _post_initialize(new(__FILE__ ":" __STR(__LINE__) ", memnew type: " __STR(m_class)) m_class) - -#else - #define memnew(m_class) _post_initialize(new("") m_class) -#endif - _ALWAYS_INLINE_ void * operator new(size_t p_size,void *p_pointer,size_t check, const char *p_description) { // void *failptr=0; // ERR_FAIL_COND_V( check < p_size , failptr); /** bug, or strange compiler, most likely */ @@ -275,7 +218,7 @@ void memdelete(T *p_class) { if (!predelete_handler(p_class)) return; // doesn't want to be deleted p_class->~T(); - Memory::free_static(p_class); + Memory::free_static(p_class,false); } template<class T,class A> @@ -288,15 +231,9 @@ void memdelete_allocator(T *p_class) { } #define memdelete_notnull(m_v) { if (m_v) memdelete(m_v); } -#ifdef DEBUG_MEMORY_ENABLED - -#define memnew_arr( m_class, m_count ) memnew_arr_template<m_class>(m_count,__FILE__ ":" __STR(__LINE__) ", memnew_arr type: " _STR(m_class)) - -#else #define memnew_arr( m_class, m_count ) memnew_arr_template<m_class>(m_count) -#endif template<typename T> T* memnew_arr_template(size_t p_elements,const char *p_descr="") { @@ -307,11 +244,11 @@ T* memnew_arr_template(size_t p_elements,const char *p_descr="") { same strategy used by std::vector, and the DVector class, so it should be safe.*/ size_t len = sizeof(T) * p_elements; - unsigned int *mem = (unsigned int*)Memory::alloc_static( len + MAX(sizeof(size_t), DEFAULT_ALIGNMENT), p_descr ); + uint64_t *mem = (uint64_t*)Memory::alloc_static( len , true ); T *failptr=0; //get rid of a warning ERR_FAIL_COND_V( !mem, failptr ); - *mem=p_elements; - mem = (unsigned int *)( ((uint8_t*)mem) + MAX(sizeof(size_t), DEFAULT_ALIGNMENT)); + *(mem-1)=p_elements; + T* elems = (T*)mem; /* call operator new */ @@ -330,20 +267,22 @@ T* memnew_arr_template(size_t p_elements,const char *p_descr="") { template<typename T> size_t memarr_len(const T *p_class) { - uint8_t* ptr = ((uint8_t*)p_class) - MAX(sizeof(size_t), DEFAULT_ALIGNMENT); - return *(size_t*)ptr; + uint64_t* ptr = (uint64_t*)p_class; + return *(ptr-1); } template<typename T> void memdelete_arr(T *p_class) { - unsigned int * elems = (unsigned int*)(((uint8_t*)p_class) - MAX(sizeof(size_t), DEFAULT_ALIGNMENT)); + uint64_t* ptr = (uint64_t*)p_class; + + uint64_t elem_count = *(ptr-1); - for (unsigned int i=0;i<*elems;i++) { + for (uint64_t i=0;i<elem_count;i++) { p_class[i].~T(); }; - Memory::free_static(elems); + Memory::free_static(ptr,true); } diff --git a/core/os/memory_pool_dynamic_static.cpp b/core/os/memory_pool_dynamic_static.cpp index 9db4916cbd..b7a1bbc19f 100644 --- a/core/os/memory_pool_dynamic_static.cpp +++ b/core/os/memory_pool_dynamic_static.cpp @@ -221,7 +221,7 @@ Error MemoryPoolDynamicStatic::unlock(ID p_id) { size_t MemoryPoolDynamicStatic::get_available_mem() const { - return Memory::get_static_mem_available(); + return Memory::get_mem_available(); } size_t MemoryPoolDynamicStatic::get_total_usage() const { diff --git a/core/os/memory_pool_dynamic_static.h b/core/os/memory_pool_dynamic_static.h index 85c969174a..a72d39355c 100644 --- a/core/os/memory_pool_dynamic_static.h +++ b/core/os/memory_pool_dynamic_static.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/core/os/memory_pool_static.cpp b/core/os/memory_pool_static.cpp deleted file mode 100644 index bd2ca1436f..0000000000 --- a/core/os/memory_pool_static.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/*************************************************************************/ -/* memory_pool_static.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#include "memory_pool_static.h" - -MemoryPoolStatic *MemoryPoolStatic::singleton=0; - -MemoryPoolStatic *MemoryPoolStatic::get_singleton() { - - return singleton; -} - - -MemoryPoolStatic::MemoryPoolStatic() { - - singleton=this; -} - - -MemoryPoolStatic::~MemoryPoolStatic() { - singleton=NULL; -} - - diff --git a/core/os/memory_pool_static.h b/core/os/memory_pool_static.h deleted file mode 100644 index 634d3eda60..0000000000 --- a/core/os/memory_pool_static.h +++ /dev/null @@ -1,69 +0,0 @@ -/*************************************************************************/ -/* memory_pool_static.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#ifndef MEMORY_POOL_STATIC_H -#define MEMORY_POOL_STATIC_H - -#include <stddef.h> - -#include "core/typedefs.h" - -/** - @author Juan Linietsky <red@lunatea> -*/ -class MemoryPoolStatic { -private: - - static MemoryPoolStatic *singleton; - -public: - - static MemoryPoolStatic *get_singleton(); - - virtual void* alloc(size_t p_bytes,const char *p_description)=0; ///< Pointer in p_description shold be to a const char const like "hello" - virtual void* realloc(void * p_memory,size_t p_bytes)=0; ///< Pointer in p_description shold be to a const char const like "hello" - virtual void free(void *p_ptr)=0; ///< Pointer in p_description shold be to a const char const - - virtual size_t get_available_mem() const=0; - virtual size_t get_total_usage()=0; - virtual size_t get_max_usage()=0; - - /* Most likely available only if memory debugger was compiled in */ - virtual int get_alloc_count()=0; - virtual void * get_alloc_ptr(int p_alloc_idx)=0; - virtual const char* get_alloc_description(int p_alloc_idx)=0; - virtual size_t get_alloc_size(int p_alloc_idx)=0; - - virtual void dump_mem_to_file(const char* p_file)=0; - - MemoryPoolStatic(); - virtual ~MemoryPoolStatic(); - -}; - -#endif diff --git a/core/os/os.cpp b/core/os/os.cpp index 75773a9076..7333d667db 100644 --- a/core/os/os.cpp +++ b/core/os/os.cpp @@ -187,7 +187,7 @@ const char *OS::get_last_error() const { void OS::dump_memory_to_file(const char* p_file) { - Memory::dump_static_mem_to_file(p_file); +// Memory::dump_static_mem_to_file(p_file); } static FileAccess *_OSPRF=NULL; @@ -367,7 +367,7 @@ Error OS::dialog_input_text(String p_title, String p_description, String p_parti int OS::get_static_memory_usage() const { - return Memory::get_static_mem_usage(); + return Memory::get_mem_usage(); } int OS::get_dynamic_memory_usage() const{ @@ -376,7 +376,7 @@ int OS::get_dynamic_memory_usage() const{ int OS::get_static_memory_peak_usage() const { - return Memory::get_static_mem_max_usage(); + return Memory::get_mem_max_usage(); } Error OS::set_cwd(const String& p_cwd) { @@ -392,7 +392,7 @@ bool OS::has_touchscreen_ui_hint() const { int OS::get_free_static_memory() const { - return Memory::get_static_mem_available(); + return Memory::get_mem_available(); } void OS::yield() { diff --git a/core/pool_allocator.cpp b/core/pool_allocator.cpp index 00351890c7..e425218060 100644 --- a/core/pool_allocator.cpp +++ b/core/pool_allocator.cpp @@ -604,7 +604,7 @@ void PoolAllocator::create_pool(void * p_mem,int p_size,int p_max_entries) { PoolAllocator::PoolAllocator(int p_size,bool p_needs_locking,int p_max_entries) { - mem_ptr=Memory::alloc_static( p_size,"PoolAllocator()"); + mem_ptr=memalloc( p_size); ERR_FAIL_COND(!mem_ptr); align=1; create_pool(mem_ptr,p_size,p_max_entries); @@ -648,7 +648,7 @@ PoolAllocator::PoolAllocator(int p_align,int p_size,bool p_needs_locking,int p_m PoolAllocator::~PoolAllocator() { if (mem_ptr) - Memory::free_static( mem_ptr ); + memfree( mem_ptr ); memdelete_arr( entry_array ); memdelete_arr( entry_indices ); diff --git a/core/safe_refcount.cpp b/core/safe_refcount.cpp index de6b688b8a..f0d4fbd610 100644 --- a/core/safe_refcount.cpp +++ b/core/safe_refcount.cpp @@ -29,27 +29,76 @@ #include "safe_refcount.h" +// Atomic functions, these are used for multithread safe reference counters! + +#ifdef NO_THREADS + + +uint32_t atomic_conditional_increment( register uint32_t * pw ) { + + if (*pw==0) + return 0; + + (*pw)++; + + return *pw; +} + +uint32_t atomic_decrement( register uint32_t * pw ) { + + (*pw)--; + + return *pw; + +} + +#else + #ifdef _MSC_VER // don't pollute my namespace! #include <windows.h> -long atomic_conditional_increment( register long * pw ) { +uint32_t atomic_conditional_increment( register uint32_t * pw ) { /* try to increment until it actually works */ // taken from boost while (true) { - long tmp = static_cast< long const volatile& >( *pw ); + uint32_t tmp = static_cast< uint32_t const volatile& >( *pw ); if( tmp == 0 ) - return 0; // if zero, can't add to it anymore - if( InterlockedCompareExchange( pw, tmp + 1, tmp ) == tmp ) + return 0; // if zero, can't add to it anymore + if( InterlockedCompareExchange( (LONG volatile*)pw, tmp + 1, tmp ) == tmp ) return tmp+1; } +} + +uint32_t atomic_decrement( register uint32_t * pw ) { + return InterlockedDecrement( (LONG volatile*)pw ); +} + +#elif defined(__GNUC__) +uint32_t atomic_conditional_increment( register uint32_t * pw ) { + + while (true) { + uint32_t tmp = static_cast< uint32_t const volatile& >( *pw ); + if( tmp == 0 ) + return 0; // if zero, can't add to it anymore + if( __sync_val_compare_and_swap( pw, tmp, tmp + 1 ) == tmp ) + return tmp+1; + } } -long atomic_decrement( register long * pw ) { - return InterlockedDecrement( pw ); +uint32_t atomic_decrement( register uint32_t * pw ) { + + return __sync_sub_and_fetch(pw,1); + } +#else + //no threads supported? +#error Must provide atomic functions for this platform or compiler! + +#endif + #endif diff --git a/core/safe_refcount.h b/core/safe_refcount.h index 5bb2a4564b..08bea9d244 100644 --- a/core/safe_refcount.h +++ b/core/safe_refcount.h @@ -33,309 +33,17 @@ /* x86/x86_64 GCC */ #include "platform_config.h" +#include "typedefs.h" -#ifdef NO_THREADS - -struct SafeRefCount { - - int count; - -public: - - // destroy() is called when weak_count_ drops to zero. - - bool ref() { //true on success - - if (count==0) - return false; - count++; - - return true; - } - - int refval() { //true on success - - if (count==0) - return 0; - count++; - return count; - } - - bool unref() { // true if must be disposed of - - if (count>0) - count--; - - return count==0; - } - - long get() const { // nothrow - - return static_cast<int const volatile &>( count ); - } - - void init(int p_value=1) { - - count=p_value; - }; - -}; - - - - - - - - -#else - -#if defined( PLATFORM_REFCOUNT ) - -#include "platform_refcount.h" - - -#elif defined( __GNUC__ ) && ( defined( __i386__ ) || defined( __x86_64__ ) ) - -#define REFCOUNT_T volatile int -#define REFCOUNT_GET_T int const volatile& - -static inline int atomic_conditional_increment( volatile int * pw ) { - // int rv = *pw; - // if( rv != 0 ) ++*pw; - // return rv; - - int rv, tmp; - - __asm__ - ( - "movl %0, %%eax\n\t" - "0:\n\t" - "test %%eax, %%eax\n\t" - "je 1f\n\t" - "movl %%eax, %2\n\t" - "incl %2\n\t" - "lock\n\t" - "cmpxchgl %2, %0\n\t" - "jne 0b\n\t" - "1:": - "=m"( *pw ), "=&a"( rv ), "=&r"( tmp ): // outputs (%0, %1, %2) - "m"( *pw ): // input (%3) - "cc" // clobbers - ); - - return rv; -} - -static inline int atomic_decrement( volatile int *pw) { - - // return --(*pw); - - unsigned char rv; - - __asm__ - ( - "lock\n\t" - "decl %0\n\t" - "setne %1": - "=m" (*pw), "=qm" (rv): - "m" (*pw): - "memory" - ); - return static_cast<int>(rv); -} - -/* PowerPC32/64 GCC */ - -#elif ( defined( __GNUC__ ) ) && ( defined( __powerpc__ ) || defined( __ppc__ ) ) - -#define REFCOUNT_T int -#define REFCOUNT_GET_T int const volatile& - -inline int atomic_conditional_increment( int * pw ) -{ - // if( *pw != 0 ) ++*pw; - // return *pw; - - int rv; - - __asm__ - ( - "0:\n\t" - "lwarx %1, 0, %2\n\t" - "cmpwi %1, 0\n\t" - "beq 1f\n\t" - "addi %1, %1, 1\n\t" - "1:\n\t" - "stwcx. %1, 0, %2\n\t" - "bne- 0b": - - "=m"( *pw ), "=&b"( rv ): - "r"( pw ), "m"( *pw ): - "cc" - ); - - return rv; -} - - -inline int atomic_decrement( int * pw ) -{ - // return --*pw; - - int rv; - - __asm__ __volatile__ - ( - "sync\n\t" - "0:\n\t" - "lwarx %1, 0, %2\n\t" - "addi %1, %1, -1\n\t" - "stwcx. %1, 0, %2\n\t" - "bne- 0b\n\t" - "isync": - - "=m"( *pw ), "=&b"( rv ): - "r"( pw ), "m"( *pw ): - "memory", "cc" - ); - - return rv; -} - -/* CW ARM */ - -#elif defined( __GNUC__ ) && ( defined( __arm__ ) ) - -#define REFCOUNT_T int -#define REFCOUNT_GET_T int const volatile& - -inline int atomic_conditional_increment(volatile int* v) -{ - int t; - int tmp; - - __asm__ __volatile__( - "1: ldrex %0, [%2] \n" - " cmp %0, #0 \n" - " beq 2f \n" - " add %0, %0, #1 \n" - "2: \n" - " strex %1, %0, [%2] \n" - " cmp %1, #0 \n" - " bne 1b \n" - - : "=&r" (t), "=&r" (tmp) - : "r" (v) - : "cc", "memory"); - - return t; -} - - -inline int atomic_decrement(volatile int* v) -{ - int t; - int tmp; - - __asm__ __volatile__( - "1: ldrex %0, [%2] \n" - " add %0, %0, #-1 \n" - " strex %1, %0, [%2] \n" - " cmp %1, #0 \n" - " bne 1b \n" - - : "=&r" (t), "=&r" (tmp) - : "r" (v) - : "cc", "memory"); - - return t; -} - - - -/* CW PPC */ - -#elif ( defined( __MWERKS__ ) ) && defined( __POWERPC__ ) - -inline long atomic_conditional_increment( register long * pw ) -{ - register int a; - - asm - { - loop: - - lwarx a, 0, pw - cmpwi a, 0 - beq store - - addi a, a, 1 - - store: - - stwcx. a, 0, pw - bne- loop - } - - return a; -} - - -inline long atomic_decrement( register long * pw ) -{ - register int a; - - asm { - - sync - - loop: - - lwarx a, 0, pw - addi a, a, -1 - stwcx. a, 0, pw - bne- loop - - isync - } - - return a; -} - -/* Any Windows (MSVC) */ - -#elif defined( _MSC_VER ) - -// made functions to not pollute namespace.. - -#define REFCOUNT_T long -#define REFCOUNT_GET_T long const volatile& - -long atomic_conditional_increment( register long * pw ); -long atomic_decrement( register long * pw ); - -#if 0 -#elif defined( __GNUC__ ) && defined( ARMV6_ENABLED) - - -#endif - - - - -#else - -#error This platform cannot use safe refcount, compile with NO_THREADS or implement it. - -#endif +uint32_t atomic_conditional_increment( register uint32_t * counter ); +uint32_t atomic_decrement( register uint32_t * pw ); struct SafeRefCount { - REFCOUNT_T count; + uint32_t count; public: @@ -346,7 +54,7 @@ public: return atomic_conditional_increment( &count ) != 0; } - int refval() { //true on success + uint32_t refval() { //true on success return atomic_conditional_increment( &count ); } @@ -360,20 +68,18 @@ public: return false; } - long get() const { // nothrow + uint32_t get() const { // nothrow - return static_cast<REFCOUNT_GET_T>( count ); + return count; } - void init(int p_value=1) { + void init(uint32_t p_value=1) { count=p_value; - }; + } }; -#endif // no thread safe - #endif diff --git a/core/typedefs.h b/core/typedefs.h index b24f259cc6..176c77570d 100644 --- a/core/typedefs.h +++ b/core/typedefs.h @@ -77,10 +77,6 @@ #endif -#ifndef DEFAULT_ALIGNMENT -#define DEFAULT_ALIGNMENT 1 -#endif - //custom, gcc-safe offsetof, because gcc complains a lot. template<class T> diff --git a/core/vector.h b/core/vector.h index 8113099a61..3227561000 100644 --- a/core/vector.h +++ b/core/vector.h @@ -46,19 +46,20 @@ class Vector { // internal helpers - _FORCE_INLINE_ SafeRefCount* _get_refcount() const { + _FORCE_INLINE_ uint32_t* _get_refcount() const { if (!_ptr) return NULL; - return reinterpret_cast<SafeRefCount*>((uint8_t*)_ptr-sizeof(int)-sizeof(SafeRefCount)); + return reinterpret_cast<uint32_t*>(_ptr)-2; } - _FORCE_INLINE_ int* _get_size() const { + _FORCE_INLINE_ uint32_t* _get_size() const { if (!_ptr) - return NULL; - return reinterpret_cast<int*>((uint8_t*)_ptr-sizeof(int)); + return NULL; + + return reinterpret_cast<uint32_t*>(_ptr)-1; } _FORCE_INLINE_ T* _get_data() const { @@ -71,7 +72,7 @@ class Vector { _FORCE_INLINE_ size_t _get_alloc_size(size_t p_elements) const { //return nearest_power_of_2_templated(p_elements*sizeof(T)+sizeof(SafeRefCount)+sizeof(int)); - return nearest_power_of_2(p_elements*sizeof(T)+sizeof(SafeRefCount)+sizeof(int)); + return nearest_power_of_2(p_elements*sizeof(T)); } _FORCE_INLINE_ bool _get_alloc_size_checked(size_t p_elements, size_t *out) const { @@ -79,8 +80,8 @@ class Vector { size_t o; size_t p; if (_mul_overflow(p_elements, sizeof(T), &o)) return false; - if (_add_overflow(o, sizeof(SafeRefCount)+sizeof(int), &p)) return false; - *out = nearest_power_of_2(p); + *out = nearest_power_of_2(o); + if (_add_overflow(o, 32, &p)) return false; //no longer allocated here return true; #else // Speed is more important than correctness here, do the operations unchecked @@ -104,7 +105,7 @@ public: _FORCE_INLINE_ void clear() { resize(0); } _FORCE_INLINE_ int size() const { - int* size = _get_size(); + uint32_t* size = (uint32_t*)_get_size(); if (size) return *size; else @@ -190,22 +191,22 @@ void Vector<T>::_unref(void *p_data) { if (!p_data) return; - SafeRefCount *src = reinterpret_cast<SafeRefCount*>((uint8_t*)p_data-sizeof(int)-sizeof(SafeRefCount)); + uint32_t *refc = _get_refcount(); - if (!src->unref()) + if (atomic_decrement(refc)>0) return; // still in use // clean up - int *count = (int*)(src+1); + uint32_t *count = _get_size(); T *data = (T*)(count+1); - for (int i=0;i<*count;i++) { + for (uint32_t i=0;i<*count;i++) { // call destructors data[i].~T(); } // free mem - memfree((uint8_t*)p_data-sizeof(int)-sizeof(SafeRefCount)); + Memory::free_static((uint8_t*)p_data,true); } @@ -215,18 +216,22 @@ void Vector<T>::_copy_on_write() { if (!_ptr) return; - if (_get_refcount()->get() > 1 ) { + uint32_t *refc = _get_refcount(); + + if (*refc > 1) { /* in use by more than me */ - void* mem_new = memalloc(_get_alloc_size(*_get_size())); - SafeRefCount *src_new=(SafeRefCount *)mem_new; - src_new->init(); - int * _size = (int*)(src_new+1); - *_size=*_get_size(); + uint32_t current_size = *_get_size(); + + uint32_t* mem_new = (uint32_t*)Memory::alloc_static(_get_alloc_size(current_size),true); - T*_data=(T*)(_size+1); + + *(mem_new-2)=1; //refcount + *(mem_new-1)=current_size; //size + + T*_data=(T*)(mem_new); // initialize new elements - for (int i=0;i<*_size;i++) { + for (uint32_t i=0;i<current_size;i++) { memnew_placement(&_data[i], T( _get_data()[i] ) ); } @@ -280,16 +285,17 @@ Error Vector<T>::resize(int p_size) { if (size()==0) { // alloc from scratch - void* ptr=memalloc(alloc_size); + uint32_t *ptr=(uint32_t*)Memory::alloc_static(alloc_size,true); ERR_FAIL_COND_V( !ptr ,ERR_OUT_OF_MEMORY); - _ptr=(T*)((uint8_t*)ptr+sizeof(int)+sizeof(SafeRefCount)); - _get_refcount()->init(); // init refcount - *_get_size()=0; // init size (currently, none) + *(ptr-1)=0; //size, currently none + *(ptr-2)=1; //refcount + + _ptr=(T*)ptr; } else { - void *_ptrnew = (T*)memrealloc((uint8_t*)_ptr-sizeof(int)-sizeof(SafeRefCount), alloc_size); + void *_ptrnew = (T*)Memory::realloc_static(_ptr, alloc_size,true); ERR_FAIL_COND_V( !_ptrnew ,ERR_OUT_OF_MEMORY); - _ptr=(T*)((uint8_t*)_ptrnew+sizeof(int)+sizeof(SafeRefCount)); + _ptr=(T*)(_ptrnew); } // construct the newly created elements @@ -305,16 +311,16 @@ Error Vector<T>::resize(int p_size) { } else if (p_size<size()) { // deinitialize no longer needed elements - for (int i=p_size;i<*_get_size();i++) { + for (uint32_t i=p_size;i<*_get_size();i++) { T* t = &_get_data()[i]; t->~T(); } - void *_ptrnew = (T*)memrealloc((uint8_t*)_ptr-sizeof(int)-sizeof(SafeRefCount), alloc_size); + void *_ptrnew = (T*)Memory::realloc_static(_ptr, alloc_size,true); ERR_FAIL_COND_V( !_ptrnew ,ERR_OUT_OF_MEMORY); - _ptr=(T*)((uint8_t*)_ptrnew+sizeof(int)+sizeof(SafeRefCount)); + _ptr=(T*)(_ptrnew); *_get_size()=p_size; @@ -382,8 +388,9 @@ void Vector<T>::_copy_from(const Vector& p_from) { if (!p_from._ptr) return; //nothing to do - if (p_from._get_refcount()->ref()) // could reference + if (atomic_conditional_increment(p_from._get_refcount())>0) { // could reference _ptr=p_from._ptr; + } } diff --git a/drivers/gles3/shader_gles3.cpp b/drivers/gles3/shader_gles3.cpp index 778d3b23ec..13b2160ec6 100644 --- a/drivers/gles3/shader_gles3.cpp +++ b/drivers/gles3/shader_gles3.cpp @@ -370,7 +370,7 @@ ShaderGLES3::Version* ShaderGLES3::get_current_version() { } - char *ilogmem = (char*)Memory::alloc_static(iloglen+1); + char *ilogmem = (char*)memalloc(iloglen+1); ilogmem[iloglen]=0; glGetShaderInfoLog(v.vert_id, iloglen, &iloglen, ilogmem); @@ -378,7 +378,7 @@ ShaderGLES3::Version* ShaderGLES3::get_current_version() { err_string+=ilogmem; _display_error_with_code(err_string,strings); - Memory::free_static(ilogmem); + memfree(ilogmem); glDeleteShader(v.vert_id); glDeleteProgram( v.id ); v.id=0; @@ -473,7 +473,7 @@ ShaderGLES3::Version* ShaderGLES3::get_current_version() { iloglen = 4096; //buggy driver (Adreno 220+....) } - char *ilogmem = (char*)Memory::alloc_static(iloglen+1); + char *ilogmem = (char*)memalloc(iloglen+1); ilogmem[iloglen]=0; glGetShaderInfoLog(v.frag_id, iloglen, &iloglen, ilogmem); @@ -482,7 +482,7 @@ ShaderGLES3::Version* ShaderGLES3::get_current_version() { err_string+=ilogmem; _display_error_with_code(err_string,strings); ERR_PRINT(err_string.ascii().get_data()); - Memory::free_static(ilogmem); + memfree(ilogmem); glDeleteShader(v.frag_id); glDeleteShader(v.vert_id); glDeleteProgram( v.id ); diff --git a/drivers/unix/memory_pool_static_malloc.cpp b/drivers/unix/memory_pool_static_malloc.cpp index a7720cd44a..139597f9cb 100644 --- a/drivers/unix/memory_pool_static_malloc.cpp +++ b/drivers/unix/memory_pool_static_malloc.cpp @@ -1,434 +1,2 @@ -/*************************************************************************/ -/* memory_pool_static_malloc.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#include "memory_pool_static_malloc.h" -#include "error_macros.h" -#include "os/memory.h" -#include <stdlib.h> -#include <stdio.h> -#include "os/copymem.h" -#include "os/os.h" - -/** - * NOTE NOTE NOTE NOTE - * in debug mode, this prepends the memory size to the allocated block - * so BE CAREFUL! - */ - -void* MemoryPoolStaticMalloc::alloc(size_t p_bytes,const char *p_description) { - - #if DEFAULT_ALIGNMENT == 1 - - return _alloc(p_bytes, p_description); - - #else - - size_t total; - #if defined(_add_overflow) - if (_add_overflow(p_bytes, DEFAULT_ALIGNMENT, &total)) return NULL; - #else - total = p_bytes + DEFAULT_ALIGNMENT; - #endif - uint8_t* ptr = (uint8_t*)_alloc(total, p_description); - ERR_FAIL_COND_V( !ptr, ptr ); - int ofs = (DEFAULT_ALIGNMENT - ((uintptr_t)ptr & (DEFAULT_ALIGNMENT - 1))); - ptr[ofs-1] = ofs; - return (void*)(ptr + ofs); - #endif -}; - -void* MemoryPoolStaticMalloc::_alloc(size_t p_bytes,const char *p_description) { - - ERR_FAIL_COND_V(p_bytes==0,0); - - MutexLock lock(mutex); - -#ifdef DEBUG_MEMORY_ENABLED - - size_t total; - #if defined(_add_overflow) - if (_add_overflow(p_bytes, sizeof(RingPtr), &total)) return NULL; - #else - total = p_bytes + sizeof(RingPtr); - #endif - void *mem=malloc(total); /// add for size and ringlist - - if (!mem) { - printf("**ERROR: out of memory while allocating %lu bytes by %s?\n", (unsigned long) p_bytes, p_description); - printf("**ERROR: memory usage is %lu\n", (unsigned long) get_total_usage()); - }; - - ERR_FAIL_COND_V(!mem,0); //out of memory, or unreasonable request - - /* setup the ringlist element */ - - RingPtr *ringptr = (RingPtr*)mem; - - /* setup the ringlist element data (description and size ) */ - - ringptr->size = p_bytes; - ringptr->descr=p_description; - - if (ringlist) { /* existing ringlist */ - - /* assign next */ - ringptr->next = ringlist->next; - ringlist->next = ringptr; - /* assign prev */ - ringptr->prev = ringlist; - ringptr->next->prev = ringptr; - } else { /* non existing ringlist */ - - ringptr->next=ringptr; - ringptr->prev=ringptr; - ringlist=ringptr; - - } - - total_mem+=p_bytes; - - /* update statistics */ - if (total_mem > max_mem ) - max_mem = total_mem; - - total_pointers++; - - if (total_pointers > max_pointers) - max_pointers=total_pointers; - - return ringptr + 1; /* return memory after ringptr */ - -#else - void *mem=malloc(p_bytes); - - ERR_FAIL_COND_V(!mem,0); //out of memory, or unreasonable request - return mem; -#endif -} - - -void* MemoryPoolStaticMalloc::realloc(void *p_memory,size_t p_bytes) { - - #if DEFAULT_ALIGNMENT == 1 - - return _realloc(p_memory,p_bytes); - #else - if (!p_memory) - return alloc(p_bytes); - - size_t total; - #if defined(_add_overflow) - if (_add_overflow(p_bytes, DEFAULT_ALIGNMENT, &total)) return NULL; - #else - total = p_bytes + DEFAULT_ALIGNMENT; - #endif - uint8_t* mem = (uint8_t*)p_memory; - int ofs = *(mem-1); - mem = mem - ofs; - uint8_t* ptr = (uint8_t*)_realloc(mem, total); - ERR_FAIL_COND_V(ptr == NULL, NULL); - int new_ofs = (DEFAULT_ALIGNMENT - ((uintptr_t)ptr & (DEFAULT_ALIGNMENT - 1))); - if (new_ofs != ofs) { - - //printf("realloc moving %i bytes\n", p_bytes); - movemem((ptr + new_ofs), (ptr + ofs), p_bytes); - ptr[new_ofs-1] = new_ofs; - }; - return ptr + new_ofs; - #endif -}; - -void* MemoryPoolStaticMalloc::_realloc(void *p_memory,size_t p_bytes) { - - if (p_memory==NULL) { - - return alloc( p_bytes ); - } - - if (p_bytes==0) { - - this->free(p_memory); - ERR_FAIL_COND_V( p_bytes < 0 , NULL ); - return NULL; - } - - MutexLock lock(mutex); - -#ifdef DEBUG_MEMORY_ENABLED - - - RingPtr *ringptr = (RingPtr*)p_memory; - ringptr--; /* go back an element to find the tingptr */ - - bool single_element = (ringptr->next == ringptr) && (ringptr->prev == ringptr); - bool is_list = ( ringlist == ringptr ); - - RingPtr *new_ringptr=(RingPtr*)::realloc(ringptr, p_bytes+sizeof(RingPtr)); - - ERR_FAIL_COND_V( new_ringptr == 0, NULL ); /// reallocation failed - - /* actualize mem used */ - total_mem -= new_ringptr->size; - new_ringptr->size = p_bytes; - total_mem += new_ringptr->size; - - if (total_mem > max_mem ) //update statistics - max_mem = total_mem; - - if (new_ringptr == ringptr ) - return ringptr + 1; // block didn't move, don't do anything - - if (single_element) { - - new_ringptr->next=new_ringptr; - new_ringptr->prev=new_ringptr; - } else { - - new_ringptr->next->prev=new_ringptr; - new_ringptr->prev->next=new_ringptr; - } - - if (is_list) - ringlist=new_ringptr; - - - return new_ringptr + 1; - -#else - return ::realloc( p_memory, p_bytes ); -#endif -} - -void MemoryPoolStaticMalloc::free(void *p_ptr) { - - ERR_FAIL_COND( !MemoryPoolStatic::get_singleton()); - - #if DEFAULT_ALIGNMENT == 1 - - _free(p_ptr); - #else - - uint8_t* mem = (uint8_t*)p_ptr; - int ofs = *(mem-1); - mem = mem - ofs; - - _free(mem); - #endif -}; - - -void MemoryPoolStaticMalloc::_free(void *p_ptr) { - - MutexLock lock(mutex); - -#ifdef DEBUG_MEMORY_ENABLED - - if (p_ptr==0) { - printf("**ERROR: STATIC ALLOC: Attempted free of NULL pointer.\n"); - return; - }; - - RingPtr *ringptr = (RingPtr*)p_ptr; - - ringptr--; /* go back an element to find the ringptr */ - - -#if 0 - { // check for existing memory on free. - RingPtr *p = ringlist; - - bool found=false; - - if (ringlist) { - do { - if (p==ringptr) { - found=true; - break; - } - - p=p->next; - } while (p!=ringlist); - } - - if (!found) { - printf("**ERROR: STATIC ALLOC: Attempted free of unknown pointer at %p\n",(ringptr+1)); - return; - } - - } -#endif - /* proceed to erase */ - - bool single_element = (ringptr->next == ringptr) && (ringptr->prev == ringptr); - bool is_list = ( ringlist == ringptr ); - - if (single_element) { - /* just get rid of it */ - ringlist=0; - - } else { - /* auto-remove from ringlist */ - if (is_list) - ringlist=ringptr->next; - - ringptr->prev->next = ringptr->next; - ringptr->next->prev = ringptr->prev; - } - - total_mem -= ringptr->size; - total_pointers--; - // catch more errors - zeromem(ringptr,sizeof(RingPtr)+ringptr->size); - ::free(ringptr); //just free that pointer - -#else - ERR_FAIL_COND(p_ptr==0); - - ::free(p_ptr); -#endif -} - - -size_t MemoryPoolStaticMalloc::get_available_mem() const { - - return 0xffffffff; -} - -size_t MemoryPoolStaticMalloc::get_total_usage() { - -#ifdef DEBUG_MEMORY_ENABLED - - return total_mem; -#else - return 0; -#endif - -} - -size_t MemoryPoolStaticMalloc::get_max_usage() { - - return max_mem; -} - -/* Most likely available only if memory debugger was compiled in */ -int MemoryPoolStaticMalloc::get_alloc_count() { - - return total_pointers; -} -void * MemoryPoolStaticMalloc::get_alloc_ptr(int p_alloc_idx) { - - return 0; -} -const char* MemoryPoolStaticMalloc::get_alloc_description(int p_alloc_idx) { - - - return ""; -} -size_t MemoryPoolStaticMalloc::get_alloc_size(int p_alloc_idx) { - - return 0; -} - -void MemoryPoolStaticMalloc::dump_mem_to_file(const char* p_file) { - -#ifdef DEBUG_MEMORY_ENABLED - - ERR_FAIL_COND( !ringlist ); /** WTF BUG !? */ - RingPtr *p = ringlist; - FILE *f = fopen(p_file,"wb"); - - do { - fprintf(f,"%p-%i-%s\n", p+1, (int)p->size, (p->descr?p->descr:"") ); - p=p->next; - } while (p!=ringlist); - - fclose(f); -#endif - -} - -MemoryPoolStaticMalloc::MemoryPoolStaticMalloc() { - -#ifdef DEBUG_MEMORY_ENABLED - total_mem=0; - total_pointers=0; - ringlist=0; - max_mem=0; - max_pointers=0; - - -#endif - - mutex=NULL; -#ifndef NO_THREADS - - mutex=Mutex::create(); // at this point, this should work -#endif - -} - - -MemoryPoolStaticMalloc::~MemoryPoolStaticMalloc() { - - Mutex *old_mutex=mutex; - mutex=NULL; - if (old_mutex) - memdelete(old_mutex); - -#ifdef DEBUG_MEMORY_ENABLED - - if (OS::get_singleton()->is_stdout_verbose()) { - if (total_mem > 0 ) { - printf("**ERROR: STATIC ALLOC: ** MEMORY LEAKS DETECTED **\n"); - printf("**ERROR: STATIC ALLOC: %i bytes of memory in use at exit.\n",(int)total_mem); - - if (1){ - printf("**ERROR: STATIC ALLOC: Following is the list of leaked allocations: \n"); - - ERR_FAIL_COND( !ringlist ); /** WTF BUG !? */ - RingPtr *p = ringlist; - - do { - printf("\t%p - %i bytes - %s\n", (RingPtr*)(p+1), (int)p->size, (p->descr?p->descr:"") ); - p=p->next; - } while (p!=ringlist); - - printf("**ERROR: STATIC ALLOC: End of Report.\n"); - }; - - printf("mem - max %i, pointers %i, leaks %i.\n",(int)max_mem,max_pointers,(int)total_mem); - } else { - - printf("INFO: mem - max %i, pointers %i, no leaks.\n",(int)max_mem,max_pointers); - } - } - -#endif -} diff --git a/drivers/unix/memory_pool_static_malloc.h b/drivers/unix/memory_pool_static_malloc.h index 0d34bac78b..e69de29bb2 100644 --- a/drivers/unix/memory_pool_static_malloc.h +++ b/drivers/unix/memory_pool_static_malloc.h @@ -1,82 +0,0 @@ -/*************************************************************************/ -/* memory_pool_static_malloc.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#ifndef MEMORY_POOL_STATIC_MALLOC_H -#define MEMORY_POOL_STATIC_MALLOC_H - -#include "os/memory_pool_static.h" -#include "os/mutex.h" -/** - @author Juan Linietsky <red@lunatea> -*/ -class MemoryPoolStaticMalloc : public MemoryPoolStatic { - - struct RingPtr { - - size_t size; - const char *descr; /* description of memory */ - RingPtr *next; - RingPtr *prev; - }; - - RingPtr *ringlist; - size_t total_mem; - int total_pointers; - - size_t max_mem; - int max_pointers; - - Mutex *mutex; - - void* _alloc(size_t p_bytes,const char *p_description=""); ///< Pointer in p_description shold be to a const char const like "hello" - void* _realloc(void *p_memory,size_t p_bytes); ///< Pointer in - void _free(void *p_ptr); ///< Pointer in p_description shold be to a const char const - -public: - - virtual void* alloc(size_t p_bytes,const char *p_description=""); ///< Pointer in p_description shold be to a const char const like "hello" - virtual void free(void *p_ptr); ///< Pointer in p_description shold be to a const char const - virtual void* realloc(void *p_memory,size_t p_bytes); ///< Pointer in - virtual size_t get_available_mem() const; - virtual size_t get_total_usage(); - virtual size_t get_max_usage(); - - /* Most likely available only if memory debugger was compiled in */ - virtual int get_alloc_count(); - virtual void * get_alloc_ptr(int p_alloc_idx); - virtual const char* get_alloc_description(int p_alloc_idx); - virtual size_t get_alloc_size(int p_alloc_idx); - - void dump_mem_to_file(const char* p_file); - - MemoryPoolStaticMalloc(); - ~MemoryPoolStaticMalloc(); - -}; - -#endif diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp index f6266c8fc5..1e8b76f505 100644 --- a/drivers/unix/os_unix.cpp +++ b/drivers/unix/os_unix.cpp @@ -30,7 +30,7 @@ #ifdef UNIX_ENABLED -#include "memory_pool_static_malloc.h" + #include "os/memory_pool_dynamic_static.h" #include "thread_posix.h" #include "semaphore_posix.h" @@ -116,7 +116,6 @@ int OS_Unix::unix_initialize_audio(int p_audio_driver) { return 0; } -static MemoryPoolStaticMalloc *mempool_static=NULL; static MemoryPoolDynamicStatic *mempool_dynamic=NULL; @@ -145,7 +144,6 @@ void OS_Unix::initialize_core() { PacketPeerUDPPosix::make_default(); IP_Unix::make_default(); #endif - mempool_static = new MemoryPoolStaticMalloc; mempool_dynamic = memnew( MemoryPoolDynamicStatic ); ticks_start=0; @@ -157,7 +155,6 @@ void OS_Unix::finalize_core() { if (mempool_dynamic) memdelete( mempool_dynamic ); - delete mempool_static; } diff --git a/main/performance.cpp b/main/performance.cpp index 28b42ae689..637ff2b079 100644 --- a/main/performance.cpp +++ b/main/performance.cpp @@ -121,9 +121,9 @@ float Performance::get_monitor(Monitor p_monitor) const { case TIME_FPS: return OS::get_singleton()->get_frames_per_second(); case TIME_PROCESS: return _process_time; case TIME_FIXED_PROCESS: return _fixed_process_time; - case MEMORY_STATIC: return Memory::get_static_mem_usage(); + case MEMORY_STATIC: return Memory::get_mem_usage(); case MEMORY_DYNAMIC: return Memory::get_dynamic_mem_usage(); - case MEMORY_STATIC_MAX: return Memory::get_static_mem_max_usage(); + case MEMORY_STATIC_MAX: return Memory::get_mem_max_usage(); case MEMORY_DYNAMIC_MAX: return Memory::get_dynamic_mem_available(); case MEMORY_MESSAGE_BUFFER_MAX: return MessageQueue::get_singleton()->get_max_buffer_usage(); case OBJECT_COUNT: return ObjectDB::get_object_count(); diff --git a/modules/gridmap/grid_map_editor_plugin.cpp b/modules/gridmap/grid_map_editor_plugin.cpp index e55665b1f5..08f2c4fbbc 100644 --- a/modules/gridmap/grid_map_editor_plugin.cpp +++ b/modules/gridmap/grid_map_editor_plugin.cpp @@ -731,7 +731,7 @@ void GridMapEditor::update_pallete() { theme_pallete->set_icon_mode(ItemList::ICON_MODE_LEFT); } - float min_size = EDITOR_DEF("grid_map/preview_size",64); + float min_size = EDITOR_DEF("editors/grid_map/preview_size",64); theme_pallete->set_fixed_icon_size(Size2(min_size, min_size)); theme_pallete->set_fixed_column_width(min_size*3/2); theme_pallete->set_max_text_lines(2); @@ -1201,7 +1201,7 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) { editor=p_editor; undo_redo=p_editor->get_undo_redo(); - int mw = EDITOR_DEF("grid_map/palette_min_width",230); + int mw = EDITOR_DEF("editors/grid_map/palette_min_width",230); Control *ec = memnew( Control); ec->set_custom_minimum_size(Size2(mw,0)); add_child(ec); @@ -1263,7 +1263,7 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) { settings_pick_distance->set_max(10000.0f); settings_pick_distance->set_min(500.0f); settings_pick_distance->set_step(1.0f); - settings_pick_distance->set_value(EDITOR_DEF("grid_map/pick_distance", 5000.0)); + settings_pick_distance->set_value(EDITOR_DEF("editors/grid_map/pick_distance", 5000.0)); settings_vbc->add_margin_child("Pick Distance:", settings_pick_distance); clip_mode=CLIP_DISABLED; @@ -1296,6 +1296,8 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) { hb->add_child(mode_list); mode_list->connect("pressed", this, "_set_display_mode", varray(DISPLAY_LIST)); + EDITOR_DEF("editors/grid_map/preview_size",64) + display_mode = DISPLAY_THUMBNAIL; selected_area=-1; diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp index f9285fcf6c..91c22fc02b 100644 --- a/modules/visual_script/visual_script_editor.cpp +++ b/modules/visual_script/visual_script_editor.cpp @@ -485,8 +485,8 @@ void VisualScriptEditor::_update_graph(int p_only_id) { gnode->set_overlay(GraphNode::OVERLAY_BREAKPOINT); } - if (EditorSettings::get_singleton()->has("visual_script_editor/color_"+node->get_category())) { - gnode->set_modulate(EditorSettings::get_singleton()->get("visual_script_editor/color_"+node->get_category())); + if (EditorSettings::get_singleton()->has("editors/visual_script/color_"+node->get_category())) { + gnode->set_modulate(EditorSettings::get_singleton()->get("editors/visual_script/color_"+node->get_category())); } @@ -3500,12 +3500,12 @@ void VisualScriptEditor::free_clipboard() { static void register_editor_callback() { ScriptEditor::register_create_script_editor_function(create_editor); - EditorSettings::get_singleton()->set("visual_script_editor/color_functions",Color(1,0.9,0.9)); - EditorSettings::get_singleton()->set("visual_script_editor/color_data",Color(0.9,1.0,0.9)); - EditorSettings::get_singleton()->set("visual_script_editor/color_operators",Color(0.9,0.9,1.0)); - EditorSettings::get_singleton()->set("visual_script_editor/color_flow_control",Color(1.0,1.0,0.8)); - EditorSettings::get_singleton()->set("visual_script_editor/color_custom",Color(0.8,1.0,1.0)); - EditorSettings::get_singleton()->set("visual_script_editor/color_constants",Color(1.0,0.8,1.0)); + EditorSettings::get_singleton()->set("editors/visual_script/color_functions",Color(1,0.9,0.9)); + EditorSettings::get_singleton()->set("editors/visual_script/color_data",Color(0.9,1.0,0.9)); + EditorSettings::get_singleton()->set("editors/visual_script/color_operators",Color(0.9,0.9,1.0)); + EditorSettings::get_singleton()->set("editors/visual_script/color_flow_control",Color(1.0,1.0,0.8)); + EditorSettings::get_singleton()->set("editors/visual_script/color_custom",Color(0.8,1.0,1.0)); + EditorSettings::get_singleton()->set("editors/visual_script/color_constants",Color(1.0,0.8,1.0)); ED_SHORTCUT("visual_script_editor/delete_selected", TTR("Delete Selected")); diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp index 3259f0a165..e836258e04 100644 --- a/platform/android/export/export.cpp +++ b/platform/android/export/export.cpp @@ -1212,9 +1212,9 @@ Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_d if (p_flags&EXPORT_DUMB_CLIENT) { - /*String host = EditorSettings::get_singleton()->get("file_server/host"); - int port = EditorSettings::get_singleton()->get("file_server/post"); - String passwd = EditorSettings::get_singleton()->get("file_server/password"); + /*String host = EditorSettings::get_singleton()->get("filesystem/file_server/host"); + int port = EditorSettings::get_singleton()->get("filesystem/file_server/post"); + String passwd = EditorSettings::get_singleton()->get("filesystem/file_server/password"); cl.push_back("-rfs"); cl.push_back(host+":"+itos(port)); if (passwd!="") { @@ -1305,7 +1305,7 @@ Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_d if (_signed) { - String jarsigner=EditorSettings::get_singleton()->get("android/jarsigner"); + String jarsigner=EditorSettings::get_singleton()->get("export/android/jarsigner"); if (!FileAccess::exists(jarsigner)) { EditorNode::add_io_error("'jarsigner' could not be found.\nPlease supply a path in the editor settings.\nResulting apk is unsigned."); return OK; @@ -1315,9 +1315,9 @@ Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_d String password; String user; if (p_debug) { - keystore=EditorSettings::get_singleton()->get("android/debug_keystore"); - password=EditorSettings::get_singleton()->get("android/debug_keystore_pass"); - user=EditorSettings::get_singleton()->get("android/debug_keystore_user"); + keystore=EditorSettings::get_singleton()->get("export/android/debug_keystore"); + password=EditorSettings::get_singleton()->get("export/android/debug_keystore_pass"); + user=EditorSettings::get_singleton()->get("export/android/debug_keystore_user"); ep.step("Signing Debug APK..",103); @@ -1340,7 +1340,7 @@ Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_d args.push_back("SHA1"); args.push_back("-sigalg"); args.push_back("MD5withRSA"); - String tsa_url=EditorSettings::get_singleton()->get("android/timestamping_authority_url"); + String tsa_url=EditorSettings::get_singleton()->get("export/android/timestamping_authority_url"); if (tsa_url != "") { args.push_back("-tsa"); args.push_back(tsa_url); @@ -1506,7 +1506,7 @@ void EditorExportPlatformAndroid::_device_poll_thread(void *ud) { while(!ea->quit_request) { - String adb=EditorSettings::get_singleton()->get("android/adb"); + String adb=EditorSettings::get_singleton()->get("export/android/adb"); if (FileAccess::exists(adb)) { String devices; @@ -1628,8 +1628,8 @@ void EditorExportPlatformAndroid::_device_poll_thread(void *ud) { } - if (EditorSettings::get_singleton()->get("android/shutdown_adb_on_exit")) { - String adb=EditorSettings::get_singleton()->get("android/adb"); + if (EditorSettings::get_singleton()->get("export/android/shutdown_adb_on_exit")) { + String adb=EditorSettings::get_singleton()->get("export/android/adb"); if (!FileAccess::exists(adb)) { return; //adb not configured } @@ -1647,7 +1647,7 @@ Error EditorExportPlatformAndroid::run(int p_device, int p_flags) { EditorProgress ep("run","Running on "+devices[p_device].name,3); - String adb=EditorSettings::get_singleton()->get("android/adb"); + String adb=EditorSettings::get_singleton()->get("export/android/adb"); if (adb=="") { EditorNode::add_io_error("ADB executable not configured in settings, can't run."); @@ -1659,7 +1659,7 @@ Error EditorExportPlatformAndroid::run(int p_device, int p_flags) { ep.step("Exporting APK",0); - bool use_adb_over_usb = bool(EDITOR_DEF("android/use_remote_debug_over_adb",true)); + bool use_adb_over_usb = bool(EDITOR_DEF("export/android/use_remote_debug_over_adb",true)); if (use_adb_over_usb) { p_flags|=EXPORT_REMOTE_DEBUG_LOCALHOST; @@ -1728,7 +1728,7 @@ Error EditorExportPlatformAndroid::run(int p_device, int p_flags) { err = OS::get_singleton()->execute(adb,args,true,NULL,NULL,&rv); print_line("Reverse result: "+itos(rv)); - int fs_port = EditorSettings::get_singleton()->get("file_server/port"); + int fs_port = EditorSettings::get_singleton()->get("filesystem/file_server/port"); args.clear(); args.push_back("reverse"); @@ -1822,7 +1822,7 @@ EditorExportPlatformAndroid::EditorExportPlatformAndroid() { bool EditorExportPlatformAndroid::can_export(String *r_error) const { bool valid=true; - String adb=EditorSettings::get_singleton()->get("android/adb"); + String adb=EditorSettings::get_singleton()->get("export/android/adb"); String err; if (!FileAccess::exists(adb)) { @@ -1831,7 +1831,7 @@ bool EditorExportPlatformAndroid::can_export(String *r_error) const { err+="ADB executable not configured in editor settings.\n"; } - String js = EditorSettings::get_singleton()->get("android/jarsigner"); + String js = EditorSettings::get_singleton()->get("export/android/jarsigner"); if (!FileAccess::exists(js)) { @@ -1839,7 +1839,7 @@ bool EditorExportPlatformAndroid::can_export(String *r_error) const { err+="OpenJDK 6 jarsigner not configured in editor settings.\n"; } - String dk = EditorSettings::get_singleton()->get("android/debug_keystore"); + String dk = EditorSettings::get_singleton()->get("export/android/debug_keystore"); if (!FileAccess::exists(dk)) { @@ -1893,20 +1893,20 @@ EditorExportPlatformAndroid::~EditorExportPlatformAndroid() { void register_android_exporter() { String exe_ext=OS::get_singleton()->get_name()=="Windows"?"exe":""; - EDITOR_DEF("android/adb",""); + EDITOR_DEF("export/android/adb",""); EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING,"android/adb",PROPERTY_HINT_GLOBAL_FILE,exe_ext)); - EDITOR_DEF("android/jarsigner",""); + EDITOR_DEF("export/android/jarsigner",""); EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING,"android/jarsigner",PROPERTY_HINT_GLOBAL_FILE,exe_ext)); - EDITOR_DEF("android/debug_keystore",""); + EDITOR_DEF("export/android/debug_keystore",""); EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING,"android/debug_keystore",PROPERTY_HINT_GLOBAL_FILE,"keystore")); - EDITOR_DEF("android/debug_keystore_user","androiddebugkey"); - EDITOR_DEF("android/debug_keystore_pass","android"); + EDITOR_DEF("export/android/debug_keystore_user","androiddebugkey"); + EDITOR_DEF("export/android/debug_keystore_pass","android"); //EDITOR_DEF("android/release_keystore",""); //EDITOR_DEF("android/release_username",""); //EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING,"android/release_keystore",PROPERTY_HINT_GLOBAL_FILE,"*.keystore")); - EDITOR_DEF("android/timestamping_authority_url",""); - EDITOR_DEF("android/use_remote_debug_over_adb",false); - EDITOR_DEF("android/shutdown_adb_on_exit",true); + EDITOR_DEF("export/android/timestamping_authority_url",""); + EDITOR_DEF("export/android/use_remote_debug_over_adb",false); + EDITOR_DEF("export/android/shutdown_adb_on_exit",true); Ref<EditorExportPlatformAndroid> exporter = Ref<EditorExportPlatformAndroid>( memnew(EditorExportPlatformAndroid) ); EditorImportExport::get_singleton()->add_export_platform(exporter); diff --git a/platform/bb10/export/export.cpp b/platform/bb10/export/export.cpp index 6ba97b8b6e..cc994c8f24 100644 --- a/platform/bb10/export/export.cpp +++ b/platform/bb10/export/export.cpp @@ -469,7 +469,7 @@ Error EditorExportPlatformBB10::export_project(const String& p_path, bool p_debu ep.step("Creating BAR Package..",104); - String bb_packager=EditorSettings::get_singleton()->get("blackberry/host_tools"); + String bb_packager=EditorSettings::get_singleton()->get("export/blackberry/host_tools"); bb_packager=bb_packager.plus_file("blackberry-nativepackager"); if (OS::get_singleton()->get_name()=="Windows") bb_packager+=".bat"; @@ -485,7 +485,7 @@ Error EditorExportPlatformBB10::export_project(const String& p_path, bool p_debu args.push_back(p_path); if (p_debug) { - String debug_token=EditorSettings::get_singleton()->get("blackberry/debug_token"); + String debug_token=EditorSettings::get_singleton()->get("export/blackberry/debug_token"); if (!FileAccess::exists(debug_token)) { EditorNode::add_io_error("Debug token not found!"); } else { @@ -554,7 +554,7 @@ void EditorExportPlatformBB10::_device_poll_thread(void *ud) { while(!ea->quit_request) { - String bb_deploy=EditorSettings::get_singleton()->get("blackberry/host_tools"); + String bb_deploy=EditorSettings::get_singleton()->get("export/blackberry/host_tools"); bb_deploy=bb_deploy.plus_file("blackberry-deploy"); bool windows = OS::get_singleton()->get_name()=="Windows"; if (windows) @@ -567,10 +567,10 @@ void EditorExportPlatformBB10::_device_poll_thread(void *ud) { for (int i=0;i<MAX_DEVICES;i++) { - String host = EditorSettings::get_singleton()->get("blackberry/device_"+itos(i+1)+"/host"); + String host = EditorSettings::get_singleton()->get("export/blackberry/device_"+itos(i+1)+"/host"); if (host==String()) continue; - String pass = EditorSettings::get_singleton()->get("blackberry/device_"+itos(i+1)+"/password"); + String pass = EditorSettings::get_singleton()->get("export/blackberry/device_"+itos(i+1)+"/password"); if (pass==String()) continue; @@ -661,7 +661,7 @@ Error EditorExportPlatformBB10::run(int p_device, int p_flags) { ERR_FAIL_INDEX_V(p_device,devices.size(),ERR_INVALID_PARAMETER); - String bb_deploy=EditorSettings::get_singleton()->get("blackberry/host_tools"); + String bb_deploy=EditorSettings::get_singleton()->get("export/blackberry/host_tools"); bb_deploy=bb_deploy.plus_file("blackberry-deploy"); if (OS::get_singleton()->get_name()=="Windows") bb_deploy+=".bat"; @@ -714,8 +714,8 @@ Error EditorExportPlatformBB10::run(int p_device, int p_flags) { args.push_back("-installApp"); args.push_back("-launchApp"); args.push_back("-device"); - String host = EditorSettings::get_singleton()->get("blackberry/device_"+itos(p_device+1)+"/host"); - String pass = EditorSettings::get_singleton()->get("blackberry/device_"+itos(p_device+1)+"/password"); + String host = EditorSettings::get_singleton()->get("export/blackberry/device_"+itos(p_device+1)+"/host"); + String pass = EditorSettings::get_singleton()->get("export/blackberry/device_"+itos(p_device+1)+"/password"); args.push_back(host); args.push_back("-password"); args.push_back(pass); @@ -761,7 +761,7 @@ EditorExportPlatformBB10::EditorExportPlatformBB10() { bool EditorExportPlatformBB10::can_export(String *r_error) const { bool valid=true; - String bb_deploy=EditorSettings::get_singleton()->get("blackberry/host_tools"); + String bb_deploy=EditorSettings::get_singleton()->get("export/blackberry/host_tools"); String err; if (!FileAccess::exists(bb_deploy.plus_file("blackberry-deploy"))) { @@ -775,7 +775,7 @@ bool EditorExportPlatformBB10::can_export(String *r_error) const { err+="No export template found.\nDownload and install export templates.\n"; } - String debug_token=EditorSettings::get_singleton()->get("blackberry/debug_token"); + String debug_token=EditorSettings::get_singleton()->get("export/blackberry/debug_token"); if (!FileAccess::exists(debug_token)) { valid=false; @@ -806,20 +806,20 @@ EditorExportPlatformBB10::~EditorExportPlatformBB10() { void register_bb10_exporter() { - EDITOR_DEF("blackberry/host_tools",""); - EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING,"blackberry/host_tools",PROPERTY_HINT_GLOBAL_DIR)); - EDITOR_DEF("blackberry/debug_token",""); - EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING,"blackberry/debug_token",PROPERTY_HINT_GLOBAL_FILE,"bar")); - EDITOR_DEF("blackberry/device_1/host",""); - EDITOR_DEF("blackberry/device_1/password",""); - EDITOR_DEF("blackberry/device_2/host",""); - EDITOR_DEF("blackberry/device_2/password",""); - EDITOR_DEF("blackberry/device_3/host",""); - EDITOR_DEF("blackberry/device_3/password",""); - EDITOR_DEF("blackberry/device_4/host",""); - EDITOR_DEF("blackberry/device_4/password",""); - EDITOR_DEF("blackberry/device_5/host",""); - EDITOR_DEF("blackberry/device_5/password",""); + EDITOR_DEF("export/blackberry/host_tools",""); + EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING,"export/blackberry/host_tools",PROPERTY_HINT_GLOBAL_DIR)); + EDITOR_DEF("export/blackberry/debug_token",""); + EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING,"export/blackberry/debug_token",PROPERTY_HINT_GLOBAL_FILE,"bar")); + EDITOR_DEF("export/blackberry/device_1/host",""); + EDITOR_DEF("export/blackberry/device_1/password",""); + EDITOR_DEF("export/blackberry/device_2/host",""); + EDITOR_DEF("export/blackberry/device_2/password",""); + EDITOR_DEF("export/blackberry/device_3/host",""); + EDITOR_DEF("export/blackberry/device_3/password",""); + EDITOR_DEF("export/blackberry/device_4/host",""); + EDITOR_DEF("export/blackberry/device_4/password",""); + EDITOR_DEF("export/blackberry/device_5/host",""); + EDITOR_DEF("export/blackberry/device_5/password",""); Ref<EditorExportPlatformBB10> exporter = Ref<EditorExportPlatformBB10>( memnew(EditorExportPlatformBB10) ); EditorImportExport::get_singleton()->add_export_platform(exporter); diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 84db94db23..97ed8d7ae0 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -30,7 +30,6 @@ #include "os_windows.h" #include "drivers/gles3/rasterizer_gles3.h" -#include "drivers/unix/memory_pool_static_malloc.h" #include "os/memory_pool_dynamic_static.h" #include "drivers/windows/thread_windows.h" #include "drivers/windows/semaphore_windows.h" @@ -167,7 +166,6 @@ const char * OS_Windows::get_audio_driver_name(int p_driver) const { return AudioDriverManagerSW::get_driver(p_driver)->get_name(); } -static MemoryPoolStatic *mempool_static=NULL; static MemoryPoolDynamic *mempool_dynamic=NULL; void OS_Windows::initialize_core() { @@ -196,7 +194,6 @@ void OS_Windows::initialize_core() { StreamPeerWinsock::make_default(); PacketPeerUDPWinsock::make_default(); - mempool_static = new MemoryPoolStaticMalloc; #if 1 mempool_dynamic = memnew( MemoryPoolDynamicStatic ); #else @@ -1308,7 +1305,6 @@ void OS_Windows::finalize_core() { if (mempool_dynamic) memdelete( mempool_dynamic ); - delete mempool_static; TCPServerWinsock::cleanup(); diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp index bd0ee2d420..ceb3b69f2f 100644 --- a/scene/gui/color_picker.cpp +++ b/scene/gui/color_picker.cpp @@ -88,7 +88,7 @@ void ColorPicker::set_color(const Color& p_color) { if (!is_inside_tree()) return; - + return; //it crashes, so returning uv_edit->get_child(0)->cast_to<Control>()->update(); w_edit->get_child(0)->cast_to<Control>()->update(); _update_color(); diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index bb78dbf941..6589dfcef0 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -1387,7 +1387,7 @@ void Control::set_anchor(Margin p_margin,AnchorType p_anchor, bool p_keep_margin void Control::_set_anchor(Margin p_margin,AnchorType p_anchor) { #ifdef TOOLS_ENABLED if (is_inside_tree() && get_tree()->is_editor_hint()) { - set_anchor(p_margin, p_anchor, EDITOR_DEF("2d_editor/keep_margins_when_changing_anchors", false)); + set_anchor(p_margin, p_anchor, EDITOR_DEF("editors/2d/keep_margins_when_changing_anchors", false)); } else { set_anchor(p_margin, p_anchor, false); } diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index 414602fe85..6537791faf 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -551,8 +551,8 @@ void LineEdit::_notification(int p_what) { #ifdef TOOLS_ENABLED case NOTIFICATION_ENTER_TREE: { if (get_tree()->is_editor_hint()) { - cursor_set_blink_enabled(EDITOR_DEF("text_editor/caret_blink", false)); - cursor_set_blink_speed(EDITOR_DEF("text_editor/caret_blink_speed", 0.65)); + cursor_set_blink_enabled(EDITOR_DEF("text_editor/cursor/caret_blink", false)); + cursor_set_blink_speed(EDITOR_DEF("text_editor/cursor/caret_blink_speed", 0.65)); if (!EditorSettings::get_singleton()->is_connected("settings_changed",this,"_editor_settings_changed")) { EditorSettings::get_singleton()->connect("settings_changed",this,"_editor_settings_changed"); @@ -1228,8 +1228,8 @@ PopupMenu *LineEdit::get_menu() const { #ifdef TOOLS_ENABLED void LineEdit::_editor_settings_changed() { - cursor_set_blink_enabled(EDITOR_DEF("text_editor/caret_blink", false)); - cursor_set_blink_speed(EDITOR_DEF("text_editor/caret_blink_speed", 0.65)); + cursor_set_blink_enabled(EDITOR_DEF("text_editor/cursor/caret_blink", false)); + cursor_set_blink_speed(EDITOR_DEF("text_editor/cursor/caret_blink_speed", 0.65)); } #endif diff --git a/tools/editor/animation_editor.cpp b/tools/editor/animation_editor.cpp index 89b24f2fd4..084b4edc7e 100644 --- a/tools/editor/animation_editor.cpp +++ b/tools/editor/animation_editor.cpp @@ -3233,7 +3233,7 @@ void AnimationKeyEditor::_query_insert(const InsertData& p_id) { insert_data.push_back(p_id); if (p_id.track_idx==-1) { - if (bool(EDITOR_DEF("animation/confirm_insert_track",true))) { + if (bool(EDITOR_DEF("editors/animation/confirm_insert_track",true))) { //potential new key, does not exist if (insert_data.size()==1) insert_confirm->set_text(vformat(TTR("Create NEW track for %s and insert key?"),p_id.query)); diff --git a/tools/editor/code_editor.cpp b/tools/editor/code_editor.cpp index e3ceb20880..284d589ba7 100644 --- a/tools/editor/code_editor.cpp +++ b/tools/editor/code_editor.cpp @@ -1043,7 +1043,7 @@ void CodeTextEditor::_reset_zoom() { Ref<DynamicFont> font = text_editor->get_font("font"); // reset source font size to default if (font.is_valid()) { - EditorSettings::get_singleton()->set("global/source_font_size",14); + EditorSettings::get_singleton()->set("interface/source_font_size",14); font->set_size(14); } } @@ -1097,7 +1097,7 @@ void CodeTextEditor::_font_resize_timeout() { int size=font->get_size()+font_resize_val; if (size>=8 && size<=96) { - EditorSettings::get_singleton()->set("global/source_font_size",size); + EditorSettings::get_singleton()->set("interface/source_font_size",size); font->set_size(size); } @@ -1107,20 +1107,20 @@ void CodeTextEditor::_font_resize_timeout() { void CodeTextEditor::update_editor_settings() { - text_editor->set_auto_brace_completion(EditorSettings::get_singleton()->get("text_editor/auto_brace_complete")); - text_editor->set_scroll_pass_end_of_file(EditorSettings::get_singleton()->get("text_editor/scroll_past_end_of_file")); - text_editor->set_tab_size(EditorSettings::get_singleton()->get("text_editor/tab_size")); - text_editor->set_draw_tabs(EditorSettings::get_singleton()->get("text_editor/draw_tabs")); - text_editor->set_show_line_numbers(EditorSettings::get_singleton()->get("text_editor/show_line_numbers")); - text_editor->set_line_numbers_zero_padded(EditorSettings::get_singleton()->get("text_editor/line_numbers_zero_padded")); - text_editor->set_show_line_length_guideline(EditorSettings::get_singleton()->get("text_editor/show_line_length_guideline")); - text_editor->set_line_length_guideline_column(EditorSettings::get_singleton()->get("text_editor/line_length_guideline_column")); - text_editor->set_syntax_coloring(EditorSettings::get_singleton()->get("text_editor/syntax_highlighting")); - text_editor->set_highlight_all_occurrences(EditorSettings::get_singleton()->get("text_editor/highlight_all_occurrences")); - text_editor->cursor_set_blink_enabled(EditorSettings::get_singleton()->get("text_editor/caret_blink")); - text_editor->cursor_set_blink_speed(EditorSettings::get_singleton()->get("text_editor/caret_blink_speed")); - text_editor->set_draw_breakpoint_gutter(EditorSettings::get_singleton()->get("text_editor/show_breakpoint_gutter")); - text_editor->cursor_set_block_mode(EditorSettings::get_singleton()->get("text_editor/block_caret")); + text_editor->set_auto_brace_completion(EditorSettings::get_singleton()->get("text_editor/completion/auto_brace_complete")); + text_editor->set_scroll_pass_end_of_file(EditorSettings::get_singleton()->get("text_editor/cursor/scroll_past_end_of_file")); + text_editor->set_tab_size(EditorSettings::get_singleton()->get("text_editor/indent/tab_size")); + text_editor->set_draw_tabs(EditorSettings::get_singleton()->get("text_editor/indent/draw_tabs")); + text_editor->set_show_line_numbers(EditorSettings::get_singleton()->get("text_editor/line_numbers/show_line_numbers")); + text_editor->set_line_numbers_zero_padded(EditorSettings::get_singleton()->get("text_editor/line_numbers/line_numbers_zero_padded")); + text_editor->set_show_line_length_guideline(EditorSettings::get_singleton()->get("text_editor/line_numbers/show_line_length_guideline")); + text_editor->set_line_length_guideline_column(EditorSettings::get_singleton()->get("text_editor/line_numbers/line_length_guideline_column")); + text_editor->set_syntax_coloring(EditorSettings::get_singleton()->get("text_editor/highlighting/syntax_highlighting")); + text_editor->set_highlight_all_occurrences(EditorSettings::get_singleton()->get("text_editor/highlighting/highlight_all_occurrences")); + text_editor->cursor_set_blink_enabled(EditorSettings::get_singleton()->get("text_editor/cursor/caret_blink")); + text_editor->cursor_set_blink_speed(EditorSettings::get_singleton()->get("text_editor/cursor/caret_blink_speed")); + text_editor->set_draw_breakpoint_gutter(EditorSettings::get_singleton()->get("text_editor/line_numbers/show_breakpoint_gutter")); + text_editor->cursor_set_block_mode(EditorSettings::get_singleton()->get("text_editor/cursor/block_caret")); } void CodeTextEditor::set_error(const String& p_error) { @@ -1137,7 +1137,7 @@ void CodeTextEditor::set_error(const String& p_error) { void CodeTextEditor::_update_font() { // FONTS - String editor_font = EDITOR_DEF("text_editor/font", ""); + String editor_font = EDITOR_DEF("text_editor/theme/font", ""); bool font_overridden = false; if (editor_font!="") { Ref<Font> fnt = ResourceLoader::load(editor_font); @@ -1158,19 +1158,19 @@ void CodeTextEditor::_on_settings_change() { // AUTO BRACE COMPLETION text_editor->set_auto_brace_completion( - EDITOR_DEF("text_editor/auto_brace_complete", true) + EDITOR_DEF("text_editor/completion/auto_brace_complete", true) ); code_complete_timer->set_wait_time( - EDITOR_DEF("text_editor/code_complete_delay",.3f) + EDITOR_DEF("text_editor/completion/code_complete_delay",.3f) ); - enable_complete_timer = EDITOR_DEF("text_editor/enable_code_completion_delay",true); + enable_complete_timer = EDITOR_DEF("text_editor/completion/enable_code_completion_delay",true); // call hint settings text_editor->set_callhint_settings( - EDITOR_DEF("text_editor/put_callhint_tooltip_below_current_line", true), - EDITOR_DEF("text_editor/callhint_tooltip_offset", Vector2()) + EDITOR_DEF("text_editor/completion/put_callhint_tooltip_below_current_line", true), + EDITOR_DEF("text_editor/completion/callhint_tooltip_offset", Vector2()) ); } @@ -1252,14 +1252,14 @@ CodeTextEditor::CodeTextEditor() { idle = memnew( Timer ); add_child(idle); idle->set_one_shot(true); - idle->set_wait_time(EDITOR_DEF("text_editor/idle_parse_delay",2)); + idle->set_wait_time(EDITOR_DEF("text_editor/completion/idle_parse_delay",2)); code_complete_timer = memnew(Timer); add_child(code_complete_timer); code_complete_timer->set_one_shot(true); - enable_complete_timer = EDITOR_DEF("text_editor/enable_code_completion_delay",true); + enable_complete_timer = EDITOR_DEF("text_editor/completion/enable_code_completion_delay",true); - code_complete_timer->set_wait_time(EDITOR_DEF("text_editor/code_complete_delay",.3f)); + code_complete_timer->set_wait_time(EDITOR_DEF("text_editor/completion/code_complete_delay",.3f)); error = memnew( Label ); status_bar->add_child(error); diff --git a/tools/editor/connections_dialog.cpp b/tools/editor/connections_dialog.cpp index f60dfff49c..ba1298eebc 100644 --- a/tools/editor/connections_dialog.cpp +++ b/tools/editor/connections_dialog.cpp @@ -395,7 +395,7 @@ ConnectDialog::ConnectDialog() { make_callback = memnew( CheckButton ); make_callback->set_toggle_mode(true); - make_callback->set_pressed( EDITOR_DEF("text_editor/create_signal_callbacks",true)); + make_callback->set_pressed( EDITOR_DEF("text_editor/tools/create_signal_callbacks",true)); make_callback->set_text(TTR("Make Function")); dstm_hb->add_child(make_callback); diff --git a/tools/editor/create_dialog.cpp b/tools/editor/create_dialog.cpp index e1d21e4cd9..87f043783f 100644 --- a/tools/editor/create_dialog.cpp +++ b/tools/editor/create_dialog.cpp @@ -183,7 +183,7 @@ void CreateDialog::add_type(const String& p_type,HashMap<String,TreeItem*>& p_ty } - if (bool(EditorSettings::get_singleton()->get("scenetree_editor/start_create_dialog_fully_expanded"))) { + if (bool(EditorSettings::get_singleton()->get("docks/scene_tree/start_create_dialog_fully_expanded"))) { item->set_collapsed(false); } else { // don't collapse search results diff --git a/tools/editor/editor_dir_dialog.cpp b/tools/editor/editor_dir_dialog.cpp index 46eafa0266..c246506858 100644 --- a/tools/editor/editor_dir_dialog.cpp +++ b/tools/editor/editor_dir_dialog.cpp @@ -46,7 +46,7 @@ void EditorDirDialog::_update_dir(TreeItem* p_item) { List<String> dirs; bool ishidden; - bool show_hidden = EditorSettings::get_singleton()->get("file_dialog/show_hidden_files"); + bool show_hidden = EditorSettings::get_singleton()->get("filesystem/file_dialog/show_hidden_files"); while(p!="") { diff --git a/tools/editor/editor_file_dialog.cpp b/tools/editor/editor_file_dialog.cpp index e2202bbc21..dfdd14673c 100644 --- a/tools/editor/editor_file_dialog.cpp +++ b/tools/editor/editor_file_dialog.cpp @@ -87,10 +87,10 @@ void EditorFileDialog::_notification(int p_what) { } else if (p_what==EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) { - bool show_hidden=EditorSettings::get_singleton()->get("file_dialog/show_hidden_files"); + bool show_hidden=EditorSettings::get_singleton()->get("filesystem/file_dialog/show_hidden_files"); if (show_hidden_files!=show_hidden) set_show_hidden_files(show_hidden); - set_display_mode((DisplayMode)EditorSettings::get_singleton()->get("file_dialog/display_mode").operator int()); + set_display_mode((DisplayMode)EditorSettings::get_singleton()->get("filesystem/file_dialog/display_mode").operator int()); } } @@ -121,7 +121,7 @@ void EditorFileDialog::_unhandled_input(const InputEvent& p_event) { if (ED_IS_SHORTCUT("file_dialog/toggle_hidden_files", p_event)) { bool show=!show_hidden_files; set_show_hidden_files(show); - EditorSettings::get_singleton()->set("file_dialog/show_hidden_files",show); + EditorSettings::get_singleton()->set("filesystem/file_dialog/show_hidden_files",show); handled=true; } if (ED_IS_SHORTCUT("file_dialog/toggle_favorite", p_event)) { @@ -490,7 +490,7 @@ void EditorFileDialog::_item_dc_selected(int p_item) { void EditorFileDialog::update_file_list() { - int thumbnail_size = EditorSettings::get_singleton()->get("file_dialog/thumbnail_size"); + int thumbnail_size = EditorSettings::get_singleton()->get("filesystem/file_dialog/thumbnail_size"); thumbnail_size*=EDSCALE; Ref<Texture> folder_thumbnail; Ref<Texture> file_thumbnail; diff --git a/tools/editor/editor_fonts.cpp b/tools/editor/editor_fonts.cpp index 49b1ccc397..3e128e7759 100644 --- a/tools/editor/editor_fonts.cpp +++ b/tools/editor/editor_fonts.cpp @@ -122,7 +122,7 @@ void editor_register_fonts(Ref<Theme> p_theme) { dfmono->set_font_ptr(_font_source_code_pro,_font_source_code_pro_size); //dfd->set_force_autohinter(true); //just looks better..i think? - MAKE_DROID_SANS(df,int(EditorSettings::get_singleton()->get("global/font_size"))*EDSCALE); + MAKE_DROID_SANS(df,int(EditorSettings::get_singleton()->get("interface/font_size"))*EDSCALE); p_theme->set_default_theme_font(df); @@ -131,9 +131,9 @@ void editor_register_fonts(Ref<Theme> p_theme) { // Ref<BitmapFont> doc_title_font = make_font(_bi_font_doc_title_font_height,_bi_font_doc_title_font_ascent,0,_bi_font_doc_title_font_charcount,_bi_font_doc_title_font_characters,p_theme->get_icon("DocTitleFont","EditorIcons")); // Ref<BitmapFont> doc_code_font = make_font(_bi_font_doc_code_font_height,_bi_font_doc_code_font_ascent,0,_bi_font_doc_code_font_charcount,_bi_font_doc_code_font_characters,p_theme->get_icon("DocCodeFont","EditorIcons")); - MAKE_DROID_SANS(df_title,int(EDITOR_DEF("help/help_title_font_size",18))*EDSCALE); + MAKE_DROID_SANS(df_title,int(EDITOR_DEF("text_editor/help/help_title_font_size",18))*EDSCALE); - MAKE_DROID_SANS(df_doc,int(EDITOR_DEF("help/help_font_size",16))*EDSCALE); + MAKE_DROID_SANS(df_doc,int(EDITOR_DEF("text_editor/help/help_font_size",16))*EDSCALE); p_theme->set_font("doc","EditorFonts",df_doc); @@ -142,7 +142,7 @@ void editor_register_fonts(Ref<Theme> p_theme) { Ref<DynamicFont> df_code; df_code.instance(); - df_code->set_size(int(EditorSettings::get_singleton()->get("global/source_font_size"))*EDSCALE); + df_code->set_size(int(EditorSettings::get_singleton()->get("interface/source_font_size"))*EDSCALE); df_code->set_font_data(dfmono); MAKE_FALLBACKS(df_code); @@ -150,7 +150,7 @@ void editor_register_fonts(Ref<Theme> p_theme) { Ref<DynamicFont> df_doc_code; df_doc_code.instance(); - df_doc_code->set_size(int(EDITOR_DEF("help/help_source_font_size",14))*EDSCALE); + df_doc_code->set_size(int(EDITOR_DEF("text_editor/help/help_source_font_size",14))*EDSCALE); df_doc_code->set_font_data(dfmono); MAKE_FALLBACKS(df_doc_code); diff --git a/tools/editor/editor_help.cpp b/tools/editor/editor_help.cpp index a276eefbdf..5af6b154a8 100644 --- a/tools/editor/editor_help.cpp +++ b/tools/editor/editor_help.cpp @@ -660,7 +660,7 @@ void EditorHelp::_add_type(const String& p_type) { t="void"; bool can_ref = (t!="int" && t!="real" && t!="bool" && t!="void"); - class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/base_type_color")); + class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/base_type_color")); if (can_ref) class_desc->push_meta("#"+t); //class class_desc->add_text(t); @@ -719,9 +719,9 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { h_color=Color(1,1,1,1); class_desc->push_font(doc_title_font); - class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/keyword_color")); + class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/keyword_color")); class_desc->add_text(TTR("Class:")+" "); - class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/base_type_color")); + class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/base_type_color")); _add_text(p_class); class_desc->pop(); class_desc->pop(); @@ -730,7 +730,7 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { if (cd.inherits!="") { - class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/keyword_color")); + class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/keyword_color")); class_desc->push_font(doc_title_font); class_desc->add_text(TTR("Inherits:")+" "); class_desc->pop(); @@ -764,7 +764,7 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { if (E->get().inherits == cd.name) { if (!found) { - class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/keyword_color")); + class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/keyword_color")); class_desc->push_font(doc_title_font); class_desc->add_text(TTR("Inherited by:")+" "); class_desc->pop(); @@ -795,7 +795,7 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { if (cd.brief_description!="") { - class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/keyword_color")); + class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/keyword_color")); class_desc->push_font(doc_title_font); class_desc->add_text(TTR("Brief Description:")); class_desc->pop(); @@ -803,7 +803,7 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { //class_desc->add_newline(); class_desc->add_newline(); - class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/text_color")); + class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/text_color")); class_desc->push_font( doc_font ); class_desc->push_indent(1); _add_text(cd.brief_description); @@ -820,7 +820,7 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { if (cd.properties.size()) { - class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/keyword_color")); + class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/keyword_color")); class_desc->push_font(doc_title_font); class_desc->add_text(TTR("Members:")); class_desc->pop(); @@ -865,7 +865,7 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { } class_desc->push_font(doc_code_font); - class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/text_color")); + class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/text_color")); _add_text(cd.properties[i].name); if (describe) { @@ -876,7 +876,7 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { if (cd.properties[i].brief_description!="") { class_desc->push_font(doc_font); class_desc->add_text(" "); - class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/comment_color")); + class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/comment_color")); _add_text(cd.properties[i].description); class_desc->pop(); class_desc->pop(); @@ -903,7 +903,7 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { bool method_descr=false; - bool sort_methods = EditorSettings::get_singleton()->get("help/sort_functions_alphabetically"); + bool sort_methods = EditorSettings::get_singleton()->get("text_editor/help/sort_functions_alphabetically"); Vector<DocData::MethodDoc> methods; @@ -918,7 +918,7 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { if (sort_methods) methods.sort(); - class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/keyword_color")); + class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/keyword_color")); class_desc->push_font(doc_title_font); class_desc->add_text(TTR("Public Methods:")); class_desc->pop(); @@ -951,16 +951,16 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { method_descr=true; class_desc->push_meta("@"+methods[i].name); } - class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/text_color")); + class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/text_color")); _add_text(methods[i].name); class_desc->pop(); if (methods[i].description!="") class_desc->pop(); - class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/symbol_color")); + class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/symbol_color")); class_desc->add_text(methods[i].arguments.size()?"( ":"("); class_desc->pop(); for(int j=0;j<methods[i].arguments.size();j++) { - class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/text_color")); + class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/text_color")); if (j>0) class_desc->add_text(", "); _add_type(methods[i].arguments[j].type); @@ -968,7 +968,7 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { _add_text(methods[i].arguments[j].name); if (methods[i].arguments[j].default_value!="") { - class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/symbol_color")); + class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/symbol_color")); class_desc->add_text("="); class_desc->pop(); _add_text(methods[i].arguments[j].default_value); @@ -978,20 +978,20 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { } if (methods[i].qualifiers.find("vararg")!=-1) { - class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/text_color")); + class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/text_color")); class_desc->add_text(","); - class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/symbol_color")); + class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/symbol_color")); class_desc->add_text(" ... "); class_desc->pop(); class_desc->pop(); } - class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/symbol_color")); + class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/symbol_color")); class_desc->add_text(methods[i].arguments.size()?" )":")"); class_desc->pop(); if (methods[i].qualifiers!="") { - class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/keyword_color")); + class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/keyword_color")); class_desc->add_text(" "); _add_text(methods[i].qualifiers); class_desc->pop(); @@ -1013,7 +1013,7 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { if (cd.theme_properties.size()) { - class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/keyword_color")); + class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/keyword_color")); class_desc->push_font(doc_title_font); class_desc->add_text(TTR("GUI Theme Items:")); class_desc->pop(); @@ -1029,7 +1029,7 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { theme_property_line[cd.theme_properties[i].name]=class_desc->get_line_count()-2; //gets overriden if description class_desc->push_font(doc_code_font); _add_type(cd.theme_properties[i].type); - class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/text_color")); + class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/text_color")); class_desc->add_text(" "); _add_text(cd.theme_properties[i].name); class_desc->pop(); @@ -1038,7 +1038,7 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { if (cd.theme_properties[i].description!="") { class_desc->push_font(doc_font); class_desc->add_text(" "); - class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/comment_color")); + class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/comment_color")); _add_text(cd.theme_properties[i].description); class_desc->pop(); class_desc->pop(); @@ -1057,7 +1057,7 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { if (sort_methods) { cd.signals.sort(); } - class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/keyword_color")); + class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/keyword_color")); class_desc->push_font(doc_title_font); class_desc->add_text(TTR("Signals:")); class_desc->pop(); @@ -1074,14 +1074,14 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { class_desc->push_font(doc_code_font); // monofont //_add_type("void"); //class_desc->add_text(" "); - class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/text_color")); + class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/text_color")); _add_text(cd.signals[i].name); class_desc->pop(); - class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/symbol_color")); + class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/symbol_color")); class_desc->add_text(cd.signals[i].arguments.size()?"( ":"("); class_desc->pop(); for(int j=0;j<cd.signals[i].arguments.size();j++) { - class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/text_color")); + class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/text_color")); if (j>0) class_desc->add_text(", "); _add_type(cd.signals[i].arguments[j].type); @@ -1089,7 +1089,7 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { _add_text(cd.signals[i].arguments[j].name); if (cd.signals[i].arguments[j].default_value!="") { - class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/symbol_color")); + class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/symbol_color")); class_desc->add_text("="); class_desc->pop(); _add_text(cd.signals[i].arguments[j].default_value); @@ -1098,13 +1098,13 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { class_desc->pop(); } - class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/symbol_color")); + class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/symbol_color")); class_desc->add_text(cd.signals[i].arguments.size()?" )":")"); class_desc->pop(); class_desc->pop(); // end monofont if (cd.signals[i].description!="") { - class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/comment_color")); + class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/comment_color")); class_desc->add_text(" "); _add_text(cd.signals[i].description); class_desc->pop(); @@ -1122,7 +1122,7 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { if (cd.constants.size()) { - class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/keyword_color")); + class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/keyword_color")); class_desc->push_font(doc_title_font); class_desc->add_text(TTR("Constants:")); class_desc->pop(); @@ -1136,20 +1136,20 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { constant_line[cd.constants[i].name]=class_desc->get_line_count()-2; class_desc->push_font(doc_code_font); - class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/base_type_color")); + class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/base_type_color")); _add_text(cd.constants[i].name); class_desc->pop(); - class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/symbol_color")); + class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/symbol_color")); class_desc->add_text(" = "); class_desc->pop(); - class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/keyword_color")); + class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/keyword_color")); _add_text(cd.constants[i].value); class_desc->pop(); class_desc->pop(); if (cd.constants[i].description!="") { class_desc->push_font(doc_font); class_desc->add_text(" "); - class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/comment_color")); + class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/comment_color")); _add_text(cd.constants[i].description); class_desc->pop(); class_desc->pop(); @@ -1167,7 +1167,7 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { if (cd.description!="") { description_line=class_desc->get_line_count()-2; - class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/keyword_color")); + class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/keyword_color")); class_desc->push_font(doc_title_font); class_desc->add_text(TTR("Description:")); class_desc->pop(); @@ -1175,7 +1175,7 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { class_desc->add_newline(); class_desc->add_newline(); - class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/text_color")); + class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/text_color")); class_desc->push_font( doc_font ); class_desc->push_indent(1); _add_text(cd.description); @@ -1188,7 +1188,7 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { if (property_descr) { - class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/keyword_color")); + class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/keyword_color")); class_desc->push_font(doc_title_font); class_desc->add_text(TTR("Property Description:")); class_desc->pop(); @@ -1206,7 +1206,7 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { _add_type(cd.properties[i].type); class_desc->add_text(" "); - class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/text_color")); + class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/text_color")); _add_text(cd.properties[i].name); class_desc->pop(); //color @@ -1219,11 +1219,11 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { class_desc->push_font( doc_font ); class_desc->push_indent(2); - class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/keyword_color")); + class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/keyword_color")); class_desc->add_text("Setter: "); class_desc->pop(); - class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/text_color")); + class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/text_color")); class_desc->add_text(cd.properties[i].setter+"(value)"); class_desc->pop(); //color @@ -1238,11 +1238,11 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { class_desc->push_font( doc_font ); class_desc->push_indent(2); - class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/keyword_color")); + class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/keyword_color")); class_desc->add_text("Getter: "); class_desc->pop(); - class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/text_color")); + class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/text_color")); class_desc->add_text(cd.properties[i].getter+"()"); class_desc->pop(); //color @@ -1254,7 +1254,7 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { class_desc->add_newline(); - class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/text_color")); + class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/text_color")); class_desc->push_font( doc_font ); class_desc->push_indent(1); _add_text(cd.properties[i].description); @@ -1271,7 +1271,7 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { if (method_descr) { - class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/keyword_color")); + class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/keyword_color")); class_desc->push_font(doc_title_font); class_desc->add_text(TTR("Method Description:")); class_desc->pop(); @@ -1289,14 +1289,14 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { _add_type(methods[i].return_type); class_desc->add_text(" "); - class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/text_color")); + class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/text_color")); _add_text(methods[i].name); class_desc->pop(); - class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/symbol_color")); + class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/symbol_color")); class_desc->add_text(methods[i].arguments.size()?"( ":"("); class_desc->pop(); for(int j=0;j<methods[i].arguments.size();j++) { - class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/text_color")); + class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/text_color")); if (j>0) class_desc->add_text(", "); _add_type(methods[i].arguments[j].type); @@ -1304,7 +1304,7 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { _add_text(methods[i].arguments[j].name); if (methods[i].arguments[j].default_value!="") { - class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/symbol_color")); + class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/symbol_color")); class_desc->add_text("="); class_desc->pop(); _add_text(methods[i].arguments[j].default_value); @@ -1313,12 +1313,12 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { class_desc->pop(); } - class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/symbol_color")); + class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/symbol_color")); class_desc->add_text(methods[i].arguments.size()?" )":")"); class_desc->pop(); if (methods[i].qualifiers!="") { - class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/keyword_color")); + class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/keyword_color")); class_desc->add_text(" "); _add_text(methods[i].qualifiers); class_desc->pop(); @@ -1328,7 +1328,7 @@ Error EditorHelp::_goto_desc(const String& p_class,int p_vscr) { class_desc->pop(); class_desc->add_newline(); - class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/text_color")); + class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/text_color")); class_desc->push_font( doc_font ); class_desc->push_indent(1); _add_text(methods[i].description); @@ -1408,7 +1408,7 @@ static void _add_text_to_rt(const String& p_bbcode,RichTextLabel *p_rt) { DocData *doc = EditorHelp::get_doc_data(); String base_path; - /*p_rt->push_color(EditorSettings::get_singleton()->get("text_editor/text_color")); + /*p_rt->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/text_color")); p_rt->push_font( get_font("normal","Fonts") ); p_rt->push_indent(1);*/ int pos = 0; @@ -1524,7 +1524,7 @@ static void _add_text_to_rt(const String& p_bbcode,RichTextLabel *p_rt) { } else if (tag.begins_with("method ")) { String m = tag.substr(7,tag.length()); - p_rt->push_color(EditorSettings::get_singleton()->get("text_editor/keyword_color")); + p_rt->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/keyword_color")); p_rt->push_meta("@"+m); p_rt->add_text(m+"()"); p_rt->pop(); @@ -1534,7 +1534,7 @@ static void _add_text_to_rt(const String& p_bbcode,RichTextLabel *p_rt) { } else if (doc->class_list.has(tag)) { - p_rt->push_color(EditorSettings::get_singleton()->get("text_editor/keyword_color")); + p_rt->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/keyword_color")); p_rt->push_meta("#"+tag); p_rt->add_text(tag); p_rt->pop(); @@ -1550,7 +1550,7 @@ static void _add_text_to_rt(const String& p_bbcode,RichTextLabel *p_rt) { } else if (tag=="i") { //use italics font - Color text_color = EditorSettings::get_singleton()->get("text_editor/text_color"); + Color text_color = EditorSettings::get_singleton()->get("text_editor/highlighting/text_color"); //no italics so emphasize with color text_color.r*=1.1; text_color.g*=1.1; @@ -1808,7 +1808,7 @@ EditorHelp::EditorHelp() { VBoxContainer *vbc = this; - EDITOR_DEF("help/sort_functions_alphabetically",true); + EDITOR_DEF("text_editor/help/sort_functions_alphabetically",true); //class_list->connect("meta_clicked",this,"_class_list_select"); //class_list->set_selection_enabled(true); @@ -1816,7 +1816,7 @@ EditorHelp::EditorHelp() { { Panel *pc = memnew( Panel ); Ref<StyleBoxFlat> style( memnew( StyleBoxFlat ) ); - style->set_bg_color( EditorSettings::get_singleton()->get("text_editor/background_color") ); + style->set_bg_color( EditorSettings::get_singleton()->get("text_editor/highlighting/background_color") ); pc->set_v_size_flags(SIZE_EXPAND_FILL); pc->add_style_override("panel", style); //get_stylebox("normal","TextEdit")); vbc->add_child(pc); diff --git a/tools/editor/editor_import_export.cpp b/tools/editor/editor_import_export.cpp index d0525af482..1245efafa1 100644 --- a/tools/editor/editor_import_export.cpp +++ b/tools/editor/editor_import_export.cpp @@ -1115,8 +1115,8 @@ void EditorExportPlatform::gen_export_flags(Vector<String> &r_flags, int p_flags host="localhost"; if (p_flags&EXPORT_DUMB_CLIENT) { - int port = EditorSettings::get_singleton()->get("file_server/port"); - String passwd = EditorSettings::get_singleton()->get("file_server/password"); + int port = EditorSettings::get_singleton()->get("filesystem/file_server/port"); + String passwd = EditorSettings::get_singleton()->get("filesystem/file_server/password"); r_flags.push_back("-rfs"); r_flags.push_back(host+":"+itos(port)); if (passwd!="") { diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index 2fd9216b66..bcdc2cbbf0 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -120,7 +120,7 @@ EditorNode *EditorNode::singleton=NULL; void EditorNode::_update_scene_tabs() { - bool show_rb = EditorSettings::get_singleton()->get("global/show_script_in_scene_tabs"); + bool show_rb = EditorSettings::get_singleton()->get("interface/show_script_in_scene_tabs"); scene_tabs->clear_tabs(); Ref<Texture> script_icon = gui_base->get_icon("Script","EditorIcons"); @@ -391,7 +391,7 @@ void EditorNode::_notification(int p_what) { } */ - if (bool(EDITOR_DEF("resources/auto_reload_modified_images",true))) { + if (bool(EDITOR_DEF("filesystem/resources/auto_reload_modified_images",true))) { _menu_option_confirm(DEPENDENCY_LOAD_CHANGED_IMAGES,true); } @@ -407,7 +407,7 @@ void EditorNode::_notification(int p_what) { }; if (p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) { - scene_tabs->set_tab_close_display_policy( (bool(EDITOR_DEF("global/always_show_close_button_in_scene_tabs", false)) ? Tabs::CLOSE_BUTTON_SHOW_ALWAYS : Tabs::CLOSE_BUTTON_SHOW_ACTIVE_ONLY) ); + scene_tabs->set_tab_close_display_policy( (bool(EDITOR_DEF("interface/always_show_close_button_in_scene_tabs", false)) ? Tabs::CLOSE_BUTTON_SHOW_ALWAYS : Tabs::CLOSE_BUTTON_SHOW_ACTIVE_ONLY) ); } } @@ -434,7 +434,7 @@ void EditorNode::_fs_changed() { void EditorNode::_sources_changed(bool p_exist) { - if (p_exist && bool(EditorSettings::get_singleton()->get("import/automatic_reimport_on_sources_changed"))) { + if (p_exist && bool(EditorSettings::get_singleton()->get("filesystem/import/automatic_reimport_on_sources_changed"))) { p_exist=false; List<String> changed_sources; @@ -555,9 +555,9 @@ void EditorNode::save_resource_in_path(const Ref<Resource>& p_resource,const Str editor_data.apply_changes_in_editors(); int flg=0; - if (EditorSettings::get_singleton()->get("on_save/compress_binary_resources")) + if (EditorSettings::get_singleton()->get("filesystem/on_save/compress_binary_resources")) flg|=ResourceSaver::FLAG_COMPRESS; - //if (EditorSettings::get_singleton()->get("on_save/save_paths_as_relative")) + //if (EditorSettings::get_singleton()->get("filesystem/on_save/save_paths_as_relative")) // flg|=ResourceSaver::FLAG_RELATIVE_PATHS; String path = GlobalConfig::get_singleton()->localize_path(p_path); @@ -914,7 +914,7 @@ void EditorNode::_save_scene_with_preview(String p_file) { save.step(TTR("Creating Thumbnail"),3); #if 0 Image img = VS::get_singleton()->viewport_texture(scree_capture(viewport); - int preview_size = EditorSettings::get_singleton()->get("file_dialog/thumbnail_size");; + int preview_size = EditorSettings::get_singleton()->get("filesystem/file_dialog/thumbnail_size");; preview_size*=EDSCALE; int width,height; if (img.get_width() > preview_size && img.get_width() >= img.get_height()) { @@ -1003,9 +1003,9 @@ void EditorNode::_save_scene(String p_file, int idx) { sdata->set_import_metadata(editor_data.get_edited_scene_import_metadata(idx)); int flg=0; - if (EditorSettings::get_singleton()->get("on_save/compress_binary_resources")) + if (EditorSettings::get_singleton()->get("filesystem/on_save/compress_binary_resources")) flg|=ResourceSaver::FLAG_COMPRESS; - //if (EditorSettings::get_singleton()->get("on_save/save_paths_as_relative")) + //if (EditorSettings::get_singleton()->get("filesystem/on_save/save_paths_as_relative")) // flg|=ResourceSaver::FLAG_RELATIVE_PATHS; flg|=ResourceSaver::FLAG_REPLACE_SUBRESOURCE_PATHS; @@ -1667,7 +1667,7 @@ void EditorNode::_edit_current() { if (main_plugin) { // special case if use of external editor is true - if (main_plugin->get_name() == "Script" && bool(EditorSettings::get_singleton()->get("external_editor/use_external_editor"))){ + if (main_plugin->get_name() == "Script" && bool(EditorSettings::get_singleton()->get("text_editor/external/use_external_editor"))){ main_plugin->edit(current_obj); } @@ -1891,7 +1891,7 @@ void EditorNode::_run(bool p_current,const String& p_custom) { } - if (bool(EDITOR_DEF("run/auto_save_before_running",true))) { + if (bool(EDITOR_DEF("run/auto_save/save_before_running",true))) { if (unsaved_cache) { @@ -2688,7 +2688,7 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { } break; case RUN_PLAY_NATIVE: { - bool autosave = EDITOR_DEF("run/auto_save_before_running",true); + bool autosave = EDITOR_DEF("run/auto_save/save_before_running",true); if (autosave) { _menu_option_confirm(FILE_SAVE_ALL_SCENES, false); } @@ -5409,7 +5409,7 @@ EditorNode::EditorNode() { bool use_single_dock_column = false; { - int dpi_mode = EditorSettings::get_singleton()->get("global/hidpi_mode"); + int dpi_mode = EditorSettings::get_singleton()->get("interface/hidpi_mode"); if (dpi_mode==0) { editor_set_scale( OS::get_singleton()->get_screen_dpi(0) > 150 && OS::get_singleton()->get_screen_size(OS::get_singleton()->get_current_screen()).x>2000 ? 2.0 : 1.0 ); @@ -5428,9 +5428,9 @@ EditorNode::EditorNode() { ResourceLoader::set_abort_on_missing_resources(false); - FileDialog::set_default_show_hidden_files(EditorSettings::get_singleton()->get("file_dialog/show_hidden_files")); - EditorFileDialog::set_default_show_hidden_files(EditorSettings::get_singleton()->get("file_dialog/show_hidden_files")); - EditorFileDialog::set_default_display_mode((EditorFileDialog::DisplayMode)EditorSettings::get_singleton()->get("file_dialog/display_mode").operator int()); + FileDialog::set_default_show_hidden_files(EditorSettings::get_singleton()->get("filesystem/file_dialog/show_hidden_files")); + EditorFileDialog::set_default_show_hidden_files(EditorSettings::get_singleton()->get("filesystem/file_dialog/show_hidden_files")); + EditorFileDialog::set_default_display_mode((EditorFileDialog::DisplayMode)EditorSettings::get_singleton()->get("filesystem/file_dialog/display_mode").operator int()); ResourceLoader::set_error_notify_func(this,_load_error_notify); ResourceLoader::set_dependency_error_notify_func(this,_dependency_error_report); @@ -5664,7 +5664,7 @@ EditorNode::EditorNode() { scene_tabs=memnew( Tabs ); scene_tabs->add_tab("unsaved"); scene_tabs->set_tab_align(Tabs::ALIGN_CENTER); - scene_tabs->set_tab_close_display_policy( (bool(EDITOR_DEF("global/always_show_close_button_in_scene_tabs", false)) ? Tabs::CLOSE_BUTTON_SHOW_ALWAYS : Tabs::CLOSE_BUTTON_SHOW_ACTIVE_ONLY) ); + scene_tabs->set_tab_close_display_policy( (bool(EDITOR_DEF("interface/always_show_close_button_in_scene_tabs", false)) ? Tabs::CLOSE_BUTTON_SHOW_ALWAYS : Tabs::CLOSE_BUTTON_SHOW_ACTIVE_ONLY) ); scene_tabs->connect("tab_changed",this,"_scene_tab_changed"); scene_tabs->connect("right_button_pressed",this,"_scene_tab_script_edited"); scene_tabs->connect("tab_close", this, "_scene_tab_closed"); @@ -6260,7 +6260,7 @@ EditorNode::EditorNode() { scenes_dock = memnew( FileSystemDock(this) ); scenes_dock->set_name(TTR("FileSystem")); - scenes_dock->set_display_mode(int(EditorSettings::get_singleton()->get("filesystem_dock/display_mode"))); + scenes_dock->set_display_mode(int(EditorSettings::get_singleton()->get("docks/filesystem/display_mode"))); if (use_single_dock_column) { dock_slot[DOCK_SLOT_RIGHT_BL]->add_child(scenes_dock); diff --git a/tools/editor/editor_resource_preview.cpp b/tools/editor/editor_resource_preview.cpp index c43aea06dd..76ae53d821 100644 --- a/tools/editor/editor_resource_preview.cpp +++ b/tools/editor/editor_resource_preview.cpp @@ -154,7 +154,7 @@ Ref<Texture> EditorResourcePreview::_generate_preview(const QueueItem& p_item,co // cache the preview in case it's a resource on disk if (generated.is_valid()) { //print_line("was generated"); - int thumbnail_size = EditorSettings::get_singleton()->get("file_dialog/thumbnail_size"); + int thumbnail_size = EditorSettings::get_singleton()->get("filesystem/file_dialog/thumbnail_size"); thumbnail_size*=EDSCALE; //wow it generated a preview... save cache ResourceSaver::save(cache_base+".png",generated); @@ -207,7 +207,7 @@ void EditorResourcePreview::_thread() { //print_line("pop from queue "+item.path); - int thumbnail_size = EditorSettings::get_singleton()->get("file_dialog/thumbnail_size"); + int thumbnail_size = EditorSettings::get_singleton()->get("filesystem/file_dialog/thumbnail_size"); thumbnail_size*=EDSCALE; diff --git a/tools/editor/editor_run.cpp b/tools/editor/editor_run.cpp index 2a0212f29e..7d79412b3b 100644 --- a/tools/editor/editor_run.cpp +++ b/tools/editor/editor_run.cpp @@ -63,7 +63,7 @@ Error EditorRun::run(const String& p_scene,const String p_custom_args,const List args.push_back("-debugnav"); } - int screen = EditorSettings::get_singleton()->get("game_window_placement/screen"); + int screen = EditorSettings::get_singleton()->get("run/window_placement/screen"); if (screen==0) { screen=OS::get_singleton()->get_current_screen(); @@ -90,7 +90,7 @@ Error EditorRun::run(const String& p_scene,const String p_custom_args,const List } - int window_placement=EditorSettings::get_singleton()->get("game_window_placement/rect"); + int window_placement=EditorSettings::get_singleton()->get("run/window_placement/rect"); switch(window_placement) { case 0: { // default @@ -104,7 +104,7 @@ Error EditorRun::run(const String& p_scene,const String p_custom_args,const List args.push_back(itos(pos.x)+"x"+itos(pos.y)); } break; case 2: { // custom pos - Vector2 pos = EditorSettings::get_singleton()->get("game_window_placement/rect_custom_position"); + Vector2 pos = EditorSettings::get_singleton()->get("run/window_placement/rect_custom_position"); pos+=screen_rect.pos; args.push_back("-p"); args.push_back(itos(pos.x)+"x"+itos(pos.y)); diff --git a/tools/editor/editor_settings.cpp b/tools/editor/editor_settings.cpp index 2724bd7d3e..ef2aaeda53 100644 --- a/tools/editor/editor_settings.cpp +++ b/tools/editor/editor_settings.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* http:/www.godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ @@ -123,8 +123,10 @@ bool EditorSettings::_get(const StringName& p_name,Variant &r_ret) const { } const VariantContainer *v=props.getptr(p_name); - if (!v) + if (!v) { + //print_line("WARNING NOT FOUND: "+String(p_name)); return false; + } r_ret = v->variant; return true; } @@ -323,20 +325,13 @@ void EditorSettings::create() { // path at least is validated, so validate config file - config_file_path = config_path+"/"+config_dir+"/editor_settings.tres"; + config_file_path = config_path+"/"+config_dir+"/editor_config.tres"; String open_path = config_file_path; - if (!dir->file_exists("editor_settings.tres")) { - - open_path = config_path+"/"+config_dir+"/editor_settings.xml"; - - if (!dir->file_exists("editor_settings.xml")) { + if (!dir->file_exists("editor_config.tres")) { - memdelete(dir); - WARN_PRINT("Config file does not exist, creating."); - goto fail; - } + goto fail; } memdelete(dir); @@ -402,9 +397,9 @@ String EditorSettings::get_settings_path() const { void EditorSettings::setup_language() { - String lang = get("global/editor_language"); + String lang = get("interface/editor_language"); if (lang=="en") - return; //none to do + return;//none to do for(int i=0;i<translations.size();i++) { if (translations[i]->get_locale()==lang) { @@ -506,158 +501,159 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { best="en"; } - set("global/editor_language",best); - hints["global/editor_language"]=PropertyInfo(Variant::STRING,"global/editor_language",PROPERTY_HINT_ENUM,lang_hint,PROPERTY_USAGE_DEFAULT|PROPERTY_USAGE_RESTART_IF_CHANGED); + set("interface/editor_language",best); + hints["interface/editor_language"]=PropertyInfo(Variant::STRING,"interface/editor_language",PROPERTY_HINT_ENUM,lang_hint,PROPERTY_USAGE_DEFAULT|PROPERTY_USAGE_RESTART_IF_CHANGED); } - set("global/hidpi_mode",0); - hints["global/hidpi_mode"]=PropertyInfo(Variant::INT,"global/hidpi_mode",PROPERTY_HINT_ENUM,"Auto,VeryLoDPI,LoDPI,MidDPI,HiDPI",PROPERTY_USAGE_DEFAULT|PROPERTY_USAGE_RESTART_IF_CHANGED); - set("global/show_script_in_scene_tabs",false); - set("global/font_size",14); - hints["global/font_size"]=PropertyInfo(Variant::INT,"global/font_size",PROPERTY_HINT_RANGE,"10,40,1",PROPERTY_USAGE_DEFAULT|PROPERTY_USAGE_RESTART_IF_CHANGED); - set("global/source_font_size",14); - hints["global/source_font_size"]=PropertyInfo(Variant::INT,"global/source_font_size",PROPERTY_HINT_RANGE,"8,96,1",PROPERTY_USAGE_DEFAULT|PROPERTY_USAGE_RESTART_IF_CHANGED); - set("global/custom_font",""); - hints["global/custom_font"]=PropertyInfo(Variant::STRING,"global/custom_font",PROPERTY_HINT_GLOBAL_FILE,"*.fnt",PROPERTY_USAGE_DEFAULT|PROPERTY_USAGE_RESTART_IF_CHANGED); - set("global/custom_theme",""); - hints["global/custom_theme"]=PropertyInfo(Variant::STRING,"global/custom_theme",PROPERTY_HINT_GLOBAL_FILE,"*.res,*.tres,*.theme",PROPERTY_USAGE_DEFAULT|PROPERTY_USAGE_RESTART_IF_CHANGED); - - - set("global/autoscan_project_path",""); - hints["global/autoscan_project_path"]=PropertyInfo(Variant::STRING,"global/autoscan_project_path",PROPERTY_HINT_GLOBAL_DIR); - set("global/default_project_path",""); - hints["global/default_project_path"]=PropertyInfo(Variant::STRING,"global/default_project_path",PROPERTY_HINT_GLOBAL_DIR); - set("global/default_project_export_path",""); + set("interface/hidpi_mode",0); + hints["interface/hidpi_mode"]=PropertyInfo(Variant::INT,"interface/hidpi_mode",PROPERTY_HINT_ENUM,"Auto,VeryLoDPI,LoDPI,MidDPI,HiDPI",PROPERTY_USAGE_DEFAULT|PROPERTY_USAGE_RESTART_IF_CHANGED); + set("interface/show_script_in_scene_tabs",false); + set("interface/font_size",14); + hints["interface/font_size"]=PropertyInfo(Variant::INT,"interface/font_size",PROPERTY_HINT_RANGE,"10,40,1",PROPERTY_USAGE_DEFAULT|PROPERTY_USAGE_RESTART_IF_CHANGED); + set("interface/source_font_size",14); + hints["interface/source_font_size"]=PropertyInfo(Variant::INT,"interface/source_font_size",PROPERTY_HINT_RANGE,"8,96,1",PROPERTY_USAGE_DEFAULT|PROPERTY_USAGE_RESTART_IF_CHANGED); + set("interface/custom_font",""); + hints["interface/custom_font"]=PropertyInfo(Variant::STRING,"interface/custom_font",PROPERTY_HINT_GLOBAL_FILE,"*.fnt",PROPERTY_USAGE_DEFAULT|PROPERTY_USAGE_RESTART_IF_CHANGED); + set("interface/custom_theme",""); + hints["interface/custom_theme"]=PropertyInfo(Variant::STRING,"interface/custom_theme",PROPERTY_HINT_GLOBAL_FILE,"*.res,*.tres,*.theme",PROPERTY_USAGE_DEFAULT|PROPERTY_USAGE_RESTART_IF_CHANGED); + + + set("filesystem/directories/autoscan_project_path",""); + hints["filesystem/directories/autoscan_project_path"]=PropertyInfo(Variant::STRING,"filesystem/directories/autoscan_project_path",PROPERTY_HINT_GLOBAL_DIR); + set("filesystem/directories/default_project_path",""); + hints["filesystem/directories/default_project_path"]=PropertyInfo(Variant::STRING,"filesystem/directories/default_project_path",PROPERTY_HINT_GLOBAL_DIR); + set("filesystem/directories/default_project_export_path",""); hints["global/default_project_export_path"]=PropertyInfo(Variant::STRING,"global/default_project_export_path",PROPERTY_HINT_GLOBAL_DIR); - set("global/show_script_in_scene_tabs",false); - - - set("text_editor/color_theme","Default"); - hints["text_editor/color_theme"]=PropertyInfo(Variant::STRING,"text_editor/color_theme",PROPERTY_HINT_ENUM,"Default"); - - _load_default_text_editor_theme(); - - set("text_editor/syntax_highlighting", true); + set("interface/show_script_in_scene_tabs",false); - set("text_editor/highlight_all_occurrences", true); - set("text_editor/scroll_past_end_of_file", false); - set("text_editor/tab_size", 4); - hints["text_editor/tab_size"]=PropertyInfo(Variant::INT,"text_editor/tab_size",PROPERTY_HINT_RANGE,"1, 64, 1"); // size of 0 crashes. - set("text_editor/draw_tabs", true); + set("text_editor/theme/color_theme","Default"); + hints["text_editor/theme/color_theme"]=PropertyInfo(Variant::STRING,"text_editor/theme/color_theme",PROPERTY_HINT_ENUM,"Default"); - set("text_editor/line_numbers_zero_padded", false); + set("text_editor/theme/line_spacing",4); - set("text_editor/show_line_numbers", true); - set("text_editor/show_breakpoint_gutter", true); - set("text_editor/show_line_length_guideline", false); - set("text_editor/line_length_guideline_column", 80); - hints["text_editor/line_length_guideline_column"]=PropertyInfo(Variant::INT,"text_editor/line_length_guideline_column",PROPERTY_HINT_RANGE,"20, 160, 10"); - - set("text_editor/trim_trailing_whitespace_on_save", false); - set("text_editor/idle_parse_delay",2); - set("text_editor/create_signal_callbacks",true); - set("text_editor/autosave_interval_secs",0); - - set("text_editor/block_caret", false); - set("text_editor/caret_blink", false); - set("text_editor/caret_blink_speed", 0.65); - hints["text_editor/caret_blink_speed"]=PropertyInfo(Variant::REAL,"text_editor/caret_blink_speed",PROPERTY_HINT_RANGE,"0.1, 10, 0.1"); - - set("text_editor/font",""); - hints["text_editor/font"]=PropertyInfo(Variant::STRING,"text_editor/font",PROPERTY_HINT_GLOBAL_FILE,"*.fnt"); - set("text_editor/auto_brace_complete", false); - set("text_editor/restore_scripts_on_load",true); - - - //set("scenetree_editor/display_old_action_buttons",false); - set("scenetree_editor/start_create_dialog_fully_expanded",false); - set("scenetree_editor/draw_relationship_lines",false); - set("scenetree_editor/relationship_line_color",Color::html("464646")); - - set("grid_map/pick_distance", 5000.0); - - set("3d_editor/grid_color",Color(0,1,0,0.2)); - hints["3d_editor/grid_color"]=PropertyInfo(Variant::COLOR,"3d_editor/grid_color", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT|PROPERTY_USAGE_RESTART_IF_CHANGED); - - set("3d_editor/default_fov",45.0); - set("3d_editor/default_z_near",0.1); - set("3d_editor/default_z_far",500.0); - - set("3d_editor/navigation_scheme",0); - hints["3d_editor/navigation_scheme"]=PropertyInfo(Variant::INT,"3d_editor/navigation_scheme",PROPERTY_HINT_ENUM,"Godot,Maya,Modo"); - set("3d_editor/zoom_style",0); - hints["3d_editor/zoom_style"]=PropertyInfo(Variant::INT,"3d_editor/zoom_style",PROPERTY_HINT_ENUM,"Vertical, Horizontal"); - set("3d_editor/orbit_modifier",0); - hints["3d_editor/orbit_modifier"]=PropertyInfo(Variant::INT,"3d_editor/orbit_modifier",PROPERTY_HINT_ENUM,"None,Shift,Alt,Meta,Ctrl"); - set("3d_editor/pan_modifier",1); - hints["3d_editor/pan_modifier"]=PropertyInfo(Variant::INT,"3d_editor/pan_modifier",PROPERTY_HINT_ENUM,"None,Shift,Alt,Meta,Ctrl"); - set("3d_editor/zoom_modifier",4); - hints["3d_editor/zoom_modifier"]=PropertyInfo(Variant::INT,"3d_editor/zoom_modifier",PROPERTY_HINT_ENUM,"None,Shift,Alt,Meta,Ctrl"); - set("3d_editor/emulate_numpad",false); - set("3d_editor/emulate_3_button_mouse", false); - - set("2d_editor/bone_width",5); - set("2d_editor/bone_color1",Color(1.0,1.0,1.0,0.9)); - set("2d_editor/bone_color2",Color(0.75,0.75,0.75,0.9)); - set("2d_editor/bone_selected_color",Color(0.9,0.45,0.45,0.9)); - set("2d_editor/bone_ik_color",Color(0.9,0.9,0.45,0.9)); - - set("2d_editor/keep_margins_when_changing_anchors", false); + _load_default_text_editor_theme(); - set("game_window_placement/rect",0); - hints["game_window_placement/rect"]=PropertyInfo(Variant::INT,"game_window_placement/rect",PROPERTY_HINT_ENUM,"Default,Centered,Custom Position,Force Maximized,Force Full Screen"); + set("text_editor/highlighting/syntax_highlighting", true); + + set("text_editor/highlighting/highlight_all_occurrences", true); + set("text_editor/cursor/scroll_past_end_of_file", false); + + set("text_editor/indent/tab_size", 4); + hints["text_editor/indent/tab_size"]=PropertyInfo(Variant::INT,"text_editor/indent/tab_size",PROPERTY_HINT_RANGE,"1, 64, 1"); // size of 0 crashes. + set("text_editor/indent/draw_tabs", true); + + set("text_editor/line_numbers/show_line_numbers", true); + set("text_editor/line_numbers/line_numbers_zero_padded", false); + set("text_editor/line_numbers/show_breakpoint_gutter", true); + set("text_editor/line_numbers/show_line_length_guideline", false); + set("text_editor/line_numbers/line_length_guideline_column", 80); + hints["text_editor/line_numbers/line_length_guideline_column"]=PropertyInfo(Variant::INT,"text_editor/line_numbers/line_length_guideline_column",PROPERTY_HINT_RANGE,"20, 160, 10"); + + set("text_editor/files/trim_trailing_whitespace_on_save", false); + set("text_editor/completion/idle_parse_delay",2); + set("text_editor/tools/create_signal_callbacks",true); + set("text_editor/files/autosave_interval_secs",0); + + set("text_editor/cursor/block_caret", false); + set("text_editor/cursor/caret_blink", false); + set("text_editor/cursor/caret_blink_speed", 0.65); + hints["text_editor/cursor/caret_blink_speed"]=PropertyInfo(Variant::REAL,"text_editor/cursor/caret_blink_speed",PROPERTY_HINT_RANGE,"0.1, 10, 0.1"); + + set("text_editor/theme/font",""); + hints["text_editor/theme/font"]=PropertyInfo(Variant::STRING,"text_editor/theme/font",PROPERTY_HINT_GLOBAL_FILE,"*.fnt"); + set("text_editor/completion/auto_brace_complete", false); + set("text_editor/files/restore_scripts_on_load",true); + + + //set("docks/scene_tree/display_old_action_buttons",false); + set("docks/scene_tree/start_create_dialog_fully_expanded",false); + set("docks/scene_tree/draw_relationship_lines",false); + set("docks/scene_tree/relationship_line_color",Color::html("464646")); + + set("editors/grid_map/pick_distance", 5000.0); + + set("editors/3d/grid_color",Color(0,1,0,0.2)); + hints["editors/3d/grid_color"]=PropertyInfo(Variant::COLOR,"editors/3d/grid_color", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT|PROPERTY_USAGE_RESTART_IF_CHANGED); + + set("editors/3d/default_fov",45.0); + set("editors/3d/default_z_near",0.1); + set("editors/3d/default_z_far",500.0); + + set("editors/3d/navigation_scheme",0); + hints["editors/3d/navigation_scheme"]=PropertyInfo(Variant::INT,"editors/3d/navigation_scheme",PROPERTY_HINT_ENUM,"Godot,Maya,Modo"); + set("editors/3d/zoom_style",0); + hints["editors/3d/zoom_style"]=PropertyInfo(Variant::INT,"editors/3d/zoom_style",PROPERTY_HINT_ENUM,"Vertical, Horizontal"); + set("editors/3d/orbit_modifier",0); + hints["editors/3d/orbit_modifier"]=PropertyInfo(Variant::INT,"editors/3d/orbit_modifier",PROPERTY_HINT_ENUM,"None,Shift,Alt,Meta,Ctrl"); + set("editors/3d/pan_modifier",1); + hints["editors/3d/pan_modifier"]=PropertyInfo(Variant::INT,"editors/3d/pan_modifier",PROPERTY_HINT_ENUM,"None,Shift,Alt,Meta,Ctrl"); + set("editors/3d/zoom_modifier",4); + hints["editors/3d/zoom_modifier"]=PropertyInfo(Variant::INT,"editors/3d/zoom_modifier",PROPERTY_HINT_ENUM,"None,Shift,Alt,Meta,Ctrl"); + set("editors/3d/emulate_numpad",false); + set("editors/3d/emulate_3_button_mouse", false); + + set("editors/2d/bone_width",5); + set("editors/2d/bone_color1",Color(1.0,1.0,1.0,0.9)); + set("editors/2d/bone_color2",Color(0.75,0.75,0.75,0.9)); + set("editors/2d/bone_selected_color",Color(0.9,0.45,0.45,0.9)); + set("editors/2d/bone_ik_color",Color(0.9,0.9,0.45,0.9)); + + set("editors/2d/keep_margins_when_changing_anchors", false); + + set("run/window_placement/rect",0); + hints["run/window_placement/rect"]=PropertyInfo(Variant::INT,"run/window_placement/rect",PROPERTY_HINT_ENUM,"Default,Centered,Custom Position,Force Maximized,Force Full Screen"); String screen_hints=TTR("Default (Same as Editor)"); for(int i=0;i<OS::get_singleton()->get_screen_count();i++) { screen_hints+=",Monitor "+itos(i+1); } - set("game_window_placement/rect_custom_position",Vector2()); - set("game_window_placement/screen",0); - hints["game_window_placement/screen"]=PropertyInfo(Variant::INT,"game_window_placement/screen",PROPERTY_HINT_ENUM,screen_hints); + set("run/window_placement/rect_custom_position",Vector2()); + set("run/window_placement/screen",0); + hints["run/window_placement/screen"]=PropertyInfo(Variant::INT,"run/window_placement/screen",PROPERTY_HINT_ENUM,screen_hints); - set("on_save/compress_binary_resources",true); - set("on_save/save_modified_external_resources",true); - //set("on_save/save_paths_as_relative",false); - //set("on_save/save_paths_without_extension",false); + set("filesystem/on_save/compress_binary_resources",true); + set("filesystem/on_save/save_modified_external_resources",true); + //set("filesystem/on_save/save_paths_as_relative",false); + //set("filesystem/on_save/save_paths_without_extension",false); - set("text_editor/create_signal_callbacks",true); + set("text_editor/tools/create_signal_callbacks",true); - set("file_dialog/show_hidden_files", false); - set("file_dialog/display_mode", 0); - hints["file_dialog/display_mode"]=PropertyInfo(Variant::INT,"file_dialog/display_mode",PROPERTY_HINT_ENUM,"Thumbnails,List"); - set("file_dialog/thumbnail_size", 64); - hints["file_dialog/thumbnail_size"]=PropertyInfo(Variant::INT,"file_dialog/thumbnail_size",PROPERTY_HINT_RANGE,"32,128,16"); + set("filesystem/file_dialog/show_hidden_files", false); + set("filesystem/file_dialog/display_mode", 0); + hints["filesystem/file_dialog/display_mode"]=PropertyInfo(Variant::INT,"filesystem/file_dialog/display_mode",PROPERTY_HINT_ENUM,"Thumbnails,List"); + set("filesystem/file_dialog/thumbnail_size", 64); + hints["filesystem/file_dialog/thumbnail_size"]=PropertyInfo(Variant::INT,"filesystem/file_dialog/thumbnail_size",PROPERTY_HINT_RANGE,"32,128,16"); - set("filesystem_dock/display_mode", 0); - hints["filesystem_dock/display_mode"]=PropertyInfo(Variant::INT,"filesystem_dock/display_mode",PROPERTY_HINT_ENUM,"Thumbnails,List"); - set("filesystem_dock/thumbnail_size", 64); - hints["filesystem_dock/thumbnail_size"]=PropertyInfo(Variant::INT,"filesystem_dock/thumbnail_size",PROPERTY_HINT_RANGE,"32,128,16"); + set("docks/filesystem/display_mode", 0); + hints["docks/filesystem/display_mode"]=PropertyInfo(Variant::INT,"docks/filesystem/display_mode",PROPERTY_HINT_ENUM,"Thumbnails,List"); + set("docks/filesystem/thumbnail_size", 64); + hints["docks/filesystem/thumbnail_size"]=PropertyInfo(Variant::INT,"docks/filesystem/thumbnail_size",PROPERTY_HINT_RANGE,"32,128,16"); - set("animation/autorename_animation_tracks",true); - set("animation/confirm_insert_track",true); + set("editors/animation/autorename_animation_tracks",true); + set("editors/animation/confirm_insert_track",true); - set("property_editor/texture_preview_width",48); - set("property_editor/auto_refresh_interval",0.3); - set("help/doc_path",""); + set("docks/property_editor/texture_preview_width",48); + set("docks/property_editor/auto_refresh_interval",0.3); + set("text_editor/help/doc_path",""); - set("import/ask_save_before_reimport",false); + set("filesystem/import/ask_save_before_reimport",false); - set("import/pvrtc_texture_tool",""); + set("filesystem/import/pvrtc_texture_tool",""); #ifdef WINDOWS_ENABLED - hints["import/pvrtc_texture_tool"]=PropertyInfo(Variant::STRING,"import/pvrtc_texture_tool",PROPERTY_HINT_GLOBAL_FILE,"*.exe"); + hints["filesystem/import/pvrtc_texture_tool"]=PropertyInfo(Variant::STRING,"import/pvrtc_texture_tool",PROPERTY_HINT_GLOBAL_FILE,"*.exe"); #else hints["import/pvrtc_texture_tool"]=PropertyInfo(Variant::STRING,"import/pvrtc_texture_tool",PROPERTY_HINT_GLOBAL_FILE,""); #endif - // TODO: Rename to "import/pvrtc_fast_conversion" to match other names? - set("PVRTC/fast_conversion",false); + // TODO: Rename to "filesystem/import/pvrtc_fast_conversion" to match other names? + set("filesystem/import/pvrtc_fast_conversion",false); - set("run/auto_save_before_running",true); - set("resources/save_compressed_resources",true); - set("resources/auto_reload_modified_images",true); + set("run/auto_save/save_before_running",true); + set("filesystem/resources/save_compressed_resources",true); + set("filesystem/resources/auto_reload_modified_images",true); - set("import/automatic_reimport_on_sources_changed",true); + set("filesystem/import/automatic_reimport_on_sources_changed",true); if (p_extra_config.is_valid()) { @@ -691,34 +687,34 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { } void EditorSettings::_load_default_text_editor_theme() { - set("text_editor/background_color",Color::html("3b000000")); - set("text_editor/completion_background_color", Color::html("2C2A32")); - set("text_editor/completion_selected_color", Color::html("434244")); - set("text_editor/completion_existing_color", Color::html("21dfdfdf")); - set("text_editor/completion_scroll_color", Color::html("ffffff")); - set("text_editor/completion_font_color", Color::html("aaaaaa")); - set("text_editor/caret_color",Color::html("aaaaaa")); - set("text_editor/caret_background_color", Color::html("000000")); - set("text_editor/line_number_color",Color::html("66aaaaaa")); - set("text_editor/text_color",Color::html("aaaaaa")); - set("text_editor/text_selected_color",Color::html("000000")); - set("text_editor/keyword_color",Color::html("ffffb3")); - set("text_editor/base_type_color",Color::html("a4ffd4")); - set("text_editor/engine_type_color",Color::html("83d3ff")); - set("text_editor/function_color",Color::html("66a2ce")); - set("text_editor/member_variable_color",Color::html("e64e59")); - set("text_editor/comment_color",Color::html("676767")); - set("text_editor/string_color",Color::html("ef6ebe")); - set("text_editor/number_color",Color::html("EB9532")); - set("text_editor/symbol_color",Color::html("badfff")); - set("text_editor/selection_color",Color::html("7b5dbe")); - set("text_editor/brace_mismatch_color",Color(1,0.2,0.2)); - set("text_editor/current_line_color",Color(0.3,0.5,0.8,0.15)); - set("text_editor/mark_color", Color(1.0,0.4,0.4,0.4)); - set("text_editor/breakpoint_color", Color(0.8,0.8,0.4,0.2)); - set("text_editor/word_highlighted_color",Color(0.8,0.9,0.9,0.15)); - set("text_editor/search_result_color",Color(0.05,0.25,0.05,1)); - set("text_editor/search_result_border_color",Color(0.1,0.45,0.1,1)); + set("text_editor/highlighting/background_color",Color::html("3b000000")); + set("text_editor/highlighting/completion_background_color", Color::html("2C2A32")); + set("text_editor/highlighting/completion_selected_color", Color::html("434244")); + set("text_editor/highlighting/completion_existing_color", Color::html("21dfdfdf")); + set("text_editor/highlighting/completion_scroll_color", Color::html("ffffff")); + set("text_editor/highlighting/completion_font_color", Color::html("aaaaaa")); + set("text_editor/highlighting/caret_color",Color::html("aaaaaa")); + set("text_editor/highlighting/caret_background_color", Color::html("000000")); + set("text_editor/highlighting/line_number_color",Color::html("66aaaaaa")); + set("text_editor/highlighting/text_color",Color::html("aaaaaa")); + set("text_editor/highlighting/text_selected_color",Color::html("000000")); + set("text_editor/highlighting/keyword_color",Color::html("ffffb3")); + set("text_editor/highlighting/base_type_color",Color::html("a4ffd4")); + set("text_editor/highlighting/engine_type_color",Color::html("83d3ff")); + set("text_editor/highlighting/function_color",Color::html("66a2ce")); + set("text_editor/highlighting/member_variable_color",Color::html("e64e59")); + set("text_editor/highlighting/comment_color",Color::html("676767")); + set("text_editor/highlighting/string_color",Color::html("ef6ebe")); + set("text_editor/highlighting/number_color",Color::html("EB9532")); + set("text_editor/highlighting/symbol_color",Color::html("badfff")); + set("text_editor/highlighting/selection_color",Color::html("7b5dbe")); + set("text_editor/highlighting/brace_mismatch_color",Color(1,0.2,0.2)); + set("text_editor/highlighting/current_line_color",Color(0.3,0.5,0.8,0.15)); + set("text_editor/highlighting/mark_color", Color(1.0,0.4,0.4,0.4)); + set("text_editor/highlighting/breakpoint_color", Color(0.8,0.8,0.4,0.2)); + set("text_editor/highlighting/word_highlighted_color",Color(0.8,0.9,0.9,0.15)); + set("text_editor/highlighting/search_result_color",Color(0.05,0.25,0.05,1)); + set("text_editor/highlighting/search_result_border_color",Color(0.1,0.45,0.1,1)); } void EditorSettings::notify_changes() { @@ -854,16 +850,16 @@ void EditorSettings::list_text_editor_themes() { d->list_dir_end(); memdelete(d); } - add_property_hint(PropertyInfo(Variant::STRING,"text_editor/color_theme",PROPERTY_HINT_ENUM,themes)); + add_property_hint(PropertyInfo(Variant::STRING,"text_editor/theme/color_theme",PROPERTY_HINT_ENUM,themes)); } void EditorSettings::load_text_editor_theme() { - if (get("text_editor/color_theme") == "Default") { + if (get("text_editor/theme/color_theme") == "Default") { _load_default_text_editor_theme(); // sorry for "Settings changed" console spam return; } - String theme_path = get_settings_path() + "/text_editor_themes/" + get("text_editor/color_theme") + ".tet"; + String theme_path = get_settings_path() + "/text_editor_themes/" + get("text_editor/theme/color_theme") + ".tet"; Ref<ConfigFile> cf = memnew( ConfigFile ); Error err = cf->load(theme_path); @@ -913,7 +909,7 @@ bool EditorSettings::import_text_editor_theme(String p_file) { bool EditorSettings::save_text_editor_theme() { - String p_file = get("text_editor/color_theme"); + String p_file = get("text_editor/theme/color_theme"); if (p_file.get_file().to_lower() == "default") { return false; @@ -937,7 +933,7 @@ bool EditorSettings::save_text_editor_theme_as(String p_file) { String theme_name = p_file.substr(0, p_file.length() - 4).get_file(); if (p_file.get_base_dir() == get_settings_path() + "/text_editor_themes") { - set("text_editor/color_theme", theme_name); + set("text_editor/theme/color_theme", theme_name); load_text_editor_theme(); } return true; diff --git a/tools/editor/editor_themes.cpp b/tools/editor/editor_themes.cpp index fd71c80a4f..56654cad7a 100644 --- a/tools/editor/editor_themes.cpp +++ b/tools/editor/editor_themes.cpp @@ -62,12 +62,12 @@ Ref<Theme> create_custom_theme() { Ref<Theme> theme; - String custom_theme = EditorSettings::get_singleton()->get("global/custom_theme"); + String custom_theme = EditorSettings::get_singleton()->get("interface/custom_theme"); if (custom_theme!="") { theme = ResourceLoader::load(custom_theme); } - String global_font = EditorSettings::get_singleton()->get("global/custom_font"); + String global_font = EditorSettings::get_singleton()->get("interface/custom_font"); if (global_font!="") { Ref<Font> fnt = ResourceLoader::load(global_font); if (fnt.is_valid()) { diff --git a/tools/editor/fileserver/editor_file_server.cpp b/tools/editor/fileserver/editor_file_server.cpp index 727deef0b8..d640b0ad1d 100644 --- a/tools/editor/fileserver/editor_file_server.cpp +++ b/tools/editor/fileserver/editor_file_server.cpp @@ -321,8 +321,8 @@ void EditorFileServer::start() { stop(); - port=EDITOR_DEF("file_server/port",6010); - password=EDITOR_DEF("file_server/password",""); + port=EDITOR_DEF("filesystem/file_server/port",6010); + password=EDITOR_DEF("filesystem/file_server/password",""); cmd=CMD_ACTIVATE; } @@ -346,8 +346,8 @@ EditorFileServer::EditorFileServer() { cmd=CMD_NONE; thread=Thread::create(_thread_start,this); - EDITOR_DEF("file_server/port",6010); - EDITOR_DEF("file_server/password",""); + EDITOR_DEF("filesystem/file_server/port",6010); + EDITOR_DEF("filesystem/file_server/password",""); } EditorFileServer::~EditorFileServer() { diff --git a/tools/editor/filesystem_dock.cpp b/tools/editor/filesystem_dock.cpp index d8dcb092db..cea7a6ec83 100644 --- a/tools/editor/filesystem_dock.cpp +++ b/tools/editor/filesystem_dock.cpp @@ -201,7 +201,7 @@ void FileSystemDock::_notification(int p_what) { } break; case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { - int new_mode = int(EditorSettings::get_singleton()->get("filesystem_dock/display_mode")); + int new_mode = int(EditorSettings::get_singleton()->get("docks/filesystem/display_mode")); if (new_mode != display_mode) { set_display_mode(new_mode); @@ -323,7 +323,7 @@ void FileSystemDock::_change_file_display() { button_display_mode->set_icon( get_icon("FileList","EditorIcons")); } - EditorSettings::get_singleton()->set("filesystem_dock/display_mode", display_mode); + EditorSettings::get_singleton()->set("docks/filesystem/display_mode", display_mode); _update_files(true); } @@ -397,7 +397,7 @@ void FileSystemDock::_update_files(bool p_keep_selection) { if (!efd) return; - int thumbnail_size = EditorSettings::get_singleton()->get("filesystem_dock/thumbnail_size"); + int thumbnail_size = EditorSettings::get_singleton()->get("docks/filesystem/thumbnail_size"); thumbnail_size*=EDSCALE; Ref<Texture> folder_thumbnail; Ref<Texture> file_thumbnail; diff --git a/tools/editor/plugins/animation_player_editor_plugin.cpp b/tools/editor/plugins/animation_player_editor_plugin.cpp index 23e2f2e712..4cc396a57b 100644 --- a/tools/editor/plugins/animation_player_editor_plugin.cpp +++ b/tools/editor/plugins/animation_player_editor_plugin.cpp @@ -375,9 +375,9 @@ void AnimationPlayerEditor::_animation_load() { void AnimationPlayerEditor::_animation_save_in_path(const Ref<Resource>& p_resource, const String& p_path) { int flg = 0; - if (EditorSettings::get_singleton()->get("on_save/compress_binary_resources")) + if (EditorSettings::get_singleton()->get("filesystem/on_save/compress_binary_resources")) flg |= ResourceSaver::FLAG_COMPRESS; - //if (EditorSettings::get_singleton()->get("on_save/save_paths_as_relative")) + //if (EditorSettings::get_singleton()->get("filesystem/on_save/save_paths_as_relative")) // flg |= ResourceSaver::FLAG_RELATIVE_PATHS; String path = GlobalConfig::get_singleton()->localize_path(p_path); diff --git a/tools/editor/plugins/canvas_item_editor_plugin.cpp b/tools/editor/plugins/canvas_item_editor_plugin.cpp index 04b8f7ce65..5fa0d88ca5 100644 --- a/tools/editor/plugins/canvas_item_editor_plugin.cpp +++ b/tools/editor/plugins/canvas_item_editor_plugin.cpp @@ -1317,7 +1317,7 @@ void CanvasItemEditor::_viewport_input_event(const InputEvent& p_event) { { bone_ik_list.clear(); float closest_dist=1e20; - int bone_width = EditorSettings::get_singleton()->get("2d_editor/bone_width"); + int bone_width = EditorSettings::get_singleton()->get("editors/2dbone_width"); for(Map<ObjectID,BoneList>::Element *E=bone_list.front();E;E=E->next()) { if (E->get().from == E->get().to) @@ -2117,11 +2117,11 @@ void CanvasItemEditor::_viewport_draw() { } if (skeleton_show_bones) { - int bone_width = EditorSettings::get_singleton()->get("2d_editor/bone_width"); - Color bone_color1 = EditorSettings::get_singleton()->get("2d_editor/bone_color1"); - Color bone_color2 = EditorSettings::get_singleton()->get("2d_editor/bone_color2"); - Color bone_ik_color = EditorSettings::get_singleton()->get("2d_editor/bone_ik_color"); - Color bone_selected_color = EditorSettings::get_singleton()->get("2d_editor/bone_selected_color"); + int bone_width = EditorSettings::get_singleton()->get("editors/2dbone_width"); + Color bone_color1 = EditorSettings::get_singleton()->get("editors/2dbone_color1"); + Color bone_color2 = EditorSettings::get_singleton()->get("editors/2dbone_color2"); + Color bone_ik_color = EditorSettings::get_singleton()->get("editors/2dbone_ik_color"); + Color bone_selected_color = EditorSettings::get_singleton()->get("editors/2dbone_selected_color"); for(Map<ObjectID,BoneList>::Element*E=bone_list.front();E;E=E->next()) { diff --git a/tools/editor/plugins/collision_polygon_2d_editor_plugin.cpp b/tools/editor/plugins/collision_polygon_2d_editor_plugin.cpp index 0f82f8eefc..e6e8d94d78 100644 --- a/tools/editor/plugins/collision_polygon_2d_editor_plugin.cpp +++ b/tools/editor/plugins/collision_polygon_2d_editor_plugin.cpp @@ -122,7 +122,7 @@ bool CollisionPolygon2DEditor::forward_input_event(const InputEvent& p_event) { Vector<Vector2> poly = node->get_polygon(); //first check if a point is to be added (segment split) - real_t grab_treshold=EDITOR_DEF("poly_editor/point_grab_radius",8); + real_t grab_treshold=EDITOR_DEF("editors/poly_editor/point_grab_radius",8); switch(mode) { diff --git a/tools/editor/plugins/collision_polygon_editor_plugin.cpp b/tools/editor/plugins/collision_polygon_editor_plugin.cpp index 8420f04eef..5ac4023177 100644 --- a/tools/editor/plugins/collision_polygon_editor_plugin.cpp +++ b/tools/editor/plugins/collision_polygon_editor_plugin.cpp @@ -147,7 +147,7 @@ bool CollisionPolygonEditor::forward_spatial_input_event(Camera* p_camera,const Vector<Vector2> poly = node->get_polygon(); //first check if a point is to be added (segment split) - real_t grab_treshold=EDITOR_DEF("poly_editor/point_grab_radius",8); + real_t grab_treshold=EDITOR_DEF("editors/poly_editor/point_grab_radius",8); switch(mode) { diff --git a/tools/editor/plugins/cube_grid_theme_editor_plugin.cpp b/tools/editor/plugins/cube_grid_theme_editor_plugin.cpp index a5f447cfd9..a981089cc5 100644 --- a/tools/editor/plugins/cube_grid_theme_editor_plugin.cpp +++ b/tools/editor/plugins/cube_grid_theme_editor_plugin.cpp @@ -151,8 +151,8 @@ void MeshLibraryEditor::_import_scene(Node *p_scene, Ref<MeshLibrary> p_library, VS::ViewportRect vr; vr.x=0; vr.y=0; - vr.width=EditorSettings::get_singleton()->get("grid_map/preview_size"); - vr.height=EditorSettings::get_singleton()->get("grid_map/preview_size"); + vr.width=EditorSettings::get_singleton()->get("editors/grid_map/preview_size"); + vr.height=EditorSettings::get_singleton()->get("editors/grid_map/preview_size"); VS::get_singleton()->viewport_set_rect(vp,vr); VS::get_singleton()->viewport_set_as_render_target(vp,true); VS::get_singleton()->viewport_set_render_target_update_mode(vp,VS::RENDER_TARGET_UPDATE_ALWAYS); @@ -343,7 +343,7 @@ void MeshLibraryEditorPlugin::make_visible(bool p_visible){ MeshLibraryEditorPlugin::MeshLibraryEditorPlugin(EditorNode *p_node) { - EDITOR_DEF("grid_map/preview_size",64); + EDITOR_DEF("editors/grid_map/preview_size",64); theme_editor = memnew( MeshLibraryEditor(p_node) ); p_node->get_viewport()->add_child(theme_editor); diff --git a/tools/editor/plugins/editor_preview_plugins.cpp b/tools/editor/plugins/editor_preview_plugins.cpp index c07eacf69e..5a41f7e9e8 100644 --- a/tools/editor/plugins/editor_preview_plugins.cpp +++ b/tools/editor/plugins/editor_preview_plugins.cpp @@ -65,7 +65,7 @@ Ref<Texture> EditorTexturePreviewPlugin::generate(const RES& p_from) { img.clear_mipmaps(); - int thumbnail_size = EditorSettings::get_singleton()->get("file_dialog/thumbnail_size"); + int thumbnail_size = EditorSettings::get_singleton()->get("filesystem/file_dialog/thumbnail_size"); thumbnail_size*=EDSCALE; if (img.is_compressed()) { if (img.decompress()!=OK) @@ -141,7 +141,7 @@ Ref<Texture> EditorBitmapPreviewPlugin::generate(const RES& p_from) { Image img(bm->get_size().width,bm->get_size().height,0,Image::FORMAT_L8,data); - int thumbnail_size = EditorSettings::get_singleton()->get("file_dialog/thumbnail_size"); + int thumbnail_size = EditorSettings::get_singleton()->get("filesystem/file_dialog/thumbnail_size"); thumbnail_size*=EDSCALE; if (img.is_compressed()) { if (img.decompress()!=OK) @@ -264,7 +264,7 @@ Ref<Texture> EditorMaterialPreviewPlugin::generate(const RES& p_from) { //print_line("captured!"); VS::get_singleton()->mesh_surface_set_material(sphere,0,RID()); - int thumbnail_size = EditorSettings::get_singleton()->get("file_dialog/thumbnail_size"); + int thumbnail_size = EditorSettings::get_singleton()->get("filesystem/file_dialog/thumbnail_size"); thumbnail_size*=EDSCALE; img.resize(thumbnail_size,thumbnail_size); @@ -433,17 +433,17 @@ Ref<Texture> EditorScriptPreviewPlugin::generate(const RES& p_from) { int line = 0; int col=0; - int thumbnail_size = EditorSettings::get_singleton()->get("file_dialog/thumbnail_size"); + int thumbnail_size = EditorSettings::get_singleton()->get("filesystem/file_dialog/thumbnail_size"); thumbnail_size*=EDSCALE; Image img(thumbnail_size,thumbnail_size,0,Image::FORMAT_RGBA8); - Color bg_color = EditorSettings::get_singleton()->get("text_editor/background_color"); + Color bg_color = EditorSettings::get_singleton()->get("text_editor/highlighting/background_color"); bg_color.a=1.0; - Color keyword_color = EditorSettings::get_singleton()->get("text_editor/keyword_color"); - Color text_color = EditorSettings::get_singleton()->get("text_editor/text_color"); - Color symbol_color = EditorSettings::get_singleton()->get("text_editor/symbol_color"); + Color keyword_color = EditorSettings::get_singleton()->get("text_editor/highlighting/keyword_color"); + Color text_color = EditorSettings::get_singleton()->get("text_editor/highlighting/text_color"); + Color symbol_color = EditorSettings::get_singleton()->get("text_editor/highlighting/symbol_color"); for(int i=0;i<thumbnail_size;i++) { @@ -533,7 +533,7 @@ Ref<Texture> EditorSamplePreviewPlugin::generate(const RES& p_from) { ERR_FAIL_COND_V(smp.is_null(),Ref<Texture>()); - int thumbnail_size = EditorSettings::get_singleton()->get("file_dialog/thumbnail_size"); + int thumbnail_size = EditorSettings::get_singleton()->get("filesystem/file_dialog/thumbnail_size"); thumbnail_size*=EDSCALE; DVector<uint8_t> img; int w = thumbnail_size; @@ -841,7 +841,7 @@ Ref<Texture> EditorMeshPreviewPlugin::generate(const RES& p_from) { //print_line("captured!"); VS::get_singleton()->instance_set_base(mesh_instance,RID()); - int thumbnail_size = EditorSettings::get_singleton()->get("file_dialog/thumbnail_size"); + int thumbnail_size = EditorSettings::get_singleton()->get("filesystem/file_dialog/thumbnail_size"); thumbnail_size*=EDSCALE; img.resize(thumbnail_size,thumbnail_size); diff --git a/tools/editor/plugins/light_occluder_2d_editor_plugin.cpp b/tools/editor/plugins/light_occluder_2d_editor_plugin.cpp index b468c1da7b..9d49cccac4 100644 --- a/tools/editor/plugins/light_occluder_2d_editor_plugin.cpp +++ b/tools/editor/plugins/light_occluder_2d_editor_plugin.cpp @@ -132,7 +132,7 @@ bool LightOccluder2DEditor::forward_input_event(const InputEvent& p_event) { Vector<Vector2> poly = Variant(node->get_occluder_polygon()->get_polygon()); //first check if a point is to be added (segment split) - real_t grab_treshold=EDITOR_DEF("poly_editor/point_grab_radius",8); + real_t grab_treshold=EDITOR_DEF("editors/poly_editor/point_grab_radius",8); switch(mode) { diff --git a/tools/editor/plugins/navigation_polygon_editor_plugin.cpp b/tools/editor/plugins/navigation_polygon_editor_plugin.cpp index 031fca0b7b..d08c89c1ef 100644 --- a/tools/editor/plugins/navigation_polygon_editor_plugin.cpp +++ b/tools/editor/plugins/navigation_polygon_editor_plugin.cpp @@ -148,7 +148,7 @@ bool NavigationPolygonEditor::forward_input_event(const InputEvent& p_event) { //first check if a point is to be added (segment split) - real_t grab_treshold=EDITOR_DEF("poly_editor/point_grab_radius",8); + real_t grab_treshold=EDITOR_DEF("editors/poly_editor/point_grab_radius",8); switch(mode) { diff --git a/tools/editor/plugins/path_2d_editor_plugin.cpp b/tools/editor/plugins/path_2d_editor_plugin.cpp index 2a5dfbdb80..85bd751d23 100644 --- a/tools/editor/plugins/path_2d_editor_plugin.cpp +++ b/tools/editor/plugins/path_2d_editor_plugin.cpp @@ -86,7 +86,7 @@ bool Path2DEditor::forward_input_event(const InputEvent& p_event) { : node->get_global_transform().affine_inverse().xform( canvas_item_editor->snap_point(canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpoint)) ); //first check if a point is to be added (segment split) - real_t grab_treshold=EDITOR_DEF("poly_editor/point_grab_radius",8); + real_t grab_treshold=EDITOR_DEF("editors/poly_editor/point_grab_radius",8); diff --git a/tools/editor/plugins/polygon_2d_editor_plugin.cpp b/tools/editor/plugins/polygon_2d_editor_plugin.cpp index 4ab827017a..7900f032c0 100644 --- a/tools/editor/plugins/polygon_2d_editor_plugin.cpp +++ b/tools/editor/plugins/polygon_2d_editor_plugin.cpp @@ -239,7 +239,7 @@ bool Polygon2DEditor::forward_input_event(const InputEvent& p_event) { Vector<Vector2> poly = Variant(node->get_polygon()); //first check if a point is to be added (segment split) - real_t grab_treshold=EDITOR_DEF("poly_editor/point_grab_radius",8); + real_t grab_treshold=EDITOR_DEF("editors/poly_editor/point_grab_radius",8); switch(mode) { diff --git a/tools/editor/plugins/sample_editor_plugin.cpp b/tools/editor/plugins/sample_editor_plugin.cpp index 0130ca41aa..a8fb5743b0 100644 --- a/tools/editor/plugins/sample_editor_plugin.cpp +++ b/tools/editor/plugins/sample_editor_plugin.cpp @@ -392,7 +392,7 @@ SampleEditor::SampleEditor() { add_child(stop); peakdisplay=Ref<ImageTexture>( memnew( ImageTexture) ); - peakdisplay->create( EDITOR_DEF("audio/sample_editor_preview_width",512),EDITOR_DEF("audio/sample_editor_preview_height",128),Image::FORMAT_RGB8); + peakdisplay->create( EDITOR_DEF("editors/sample_editor/preview_width",512),EDITOR_DEF("editors/sample_editor/preview_height",128),Image::FORMAT_RGB8); sample_texframe->set_expand(true); sample_texframe->set_texture(peakdisplay); diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp index d441fa7a11..b3d86817c7 100644 --- a/tools/editor/plugins/script_editor_plugin.cpp +++ b/tools/editor/plugins/script_editor_plugin.cpp @@ -672,7 +672,7 @@ bool ScriptEditor::_test_script_times_on_disk(Ref<Script> p_for_script) { bool need_ask=false; bool need_reload=false; - bool use_autoreload=bool(EDITOR_DEF("text_editor/auto_reload_scripts_on_external_change",false)); + bool use_autoreload=bool(EDITOR_DEF("text_editor/files/auto_reload_scripts_on_external_change",false)); @@ -783,7 +783,7 @@ void ScriptEditor::_menu_option(int p_option) { file_dialog_option = FILE_SAVE_THEME_AS; file_dialog->clear_filters(); file_dialog->add_filter("*.tet"); - file_dialog->set_current_path(EditorSettings::get_singleton()->get_settings_path() + "/text_editor_themes/" + EditorSettings::get_singleton()->get("text_editor/color_theme")); + file_dialog->set_current_path(EditorSettings::get_singleton()->get_settings_path() + "/text_editor_themes/" + EditorSettings::get_singleton()->get("text_editor/theme/color_theme")); file_dialog->popup_centered_ratio(); file_dialog->set_title(TTR("Save Theme As..")); } break; @@ -991,7 +991,7 @@ void ScriptEditor::_notification(int p_what) { script_split->connect("dragged",this,"_script_split_dragged"); autosave_timer->connect("timeout",this,"_autosave_scripts"); { - float autosave_time = EditorSettings::get_singleton()->get("text_editor/autosave_interval_secs"); + float autosave_time = EditorSettings::get_singleton()->get("text_editor/files/autosave_interval_secs"); if (autosave_time>0) { autosave_timer->set_wait_time(autosave_time); autosave_timer->start(); @@ -1343,12 +1343,12 @@ struct _ScriptEditorItemData { void ScriptEditor::_update_script_colors() { - bool script_temperature_enabled = EditorSettings::get_singleton()->get("text_editor/script_temperature_enabled"); - bool highlight_current = EditorSettings::get_singleton()->get("text_editor/highlight_current_script"); + bool script_temperature_enabled = EditorSettings::get_singleton()->get("text_editor/open_scripts/script_temperature_enabled"); + bool highlight_current = EditorSettings::get_singleton()->get("text_editor/open_scripts/highlight_current_script"); - int hist_size = EditorSettings::get_singleton()->get("text_editor/script_temperature_history_size"); - Color hot_color=EditorSettings::get_singleton()->get("text_editor/script_temperature_hot_color"); - Color cold_color=EditorSettings::get_singleton()->get("text_editor/script_temperature_cold_color"); + int hist_size = EditorSettings::get_singleton()->get("text_editor/open_scripts/script_temperature_history_size"); + Color hot_color=EditorSettings::get_singleton()->get("text_editor/open_scripts/script_temperature_hot_color"); + Color cold_color=EditorSettings::get_singleton()->get("text_editor/open_scripts/script_temperature_cold_color"); for(int i=0;i<script_list->get_item_count();i++) { @@ -1395,7 +1395,7 @@ void ScriptEditor::_update_script_names() { } script_list->clear(); - bool split_script_help = EditorSettings::get_singleton()->get("text_editor/group_help_pages"); + bool split_script_help = EditorSettings::get_singleton()->get("text_editor/open_scripts/group_help_pages"); Vector<_ScriptEditorItemData> sedata; @@ -1481,12 +1481,12 @@ void ScriptEditor::edit(const Ref<Script>& p_script, bool p_grab_focus) { // see if already has it - bool open_dominant = EditorSettings::get_singleton()->get("text_editor/open_dominant_script_on_scene_change"); + bool open_dominant = EditorSettings::get_singleton()->get("text_editor/files/open_dominant_script_on_scene_change"); - if (p_script->get_path().is_resource_file() && bool(EditorSettings::get_singleton()->get("external_editor/use_external_editor"))) { + if (p_script->get_path().is_resource_file() && bool(EditorSettings::get_singleton()->get("text_editor/external/use_external_editor"))) { - String path = EditorSettings::get_singleton()->get("external_editor/exec_path"); - String flags = EditorSettings::get_singleton()->get("external_editor/exec_flags"); + String path = EditorSettings::get_singleton()->get("text_editor/external/exec_path"); + String flags = EditorSettings::get_singleton()->get("text_editor/external/exec_flags"); List<String> args; flags=flags.strip_edges(); if (flags!=String()) { @@ -1694,8 +1694,8 @@ void ScriptEditor::_save_layout() { void ScriptEditor::_editor_settings_changed() { - trim_trailing_whitespace_on_save = EditorSettings::get_singleton()->get("text_editor/trim_trailing_whitespace_on_save"); - float autosave_time = EditorSettings::get_singleton()->get("text_editor/autosave_interval_secs"); + trim_trailing_whitespace_on_save = EditorSettings::get_singleton()->get("text_editor/files/trim_trailing_whitespace_on_save"); + float autosave_time = EditorSettings::get_singleton()->get("text_editor/files/autosave_interval_secs"); if (autosave_time>0) { autosave_timer->set_wait_time(autosave_time); autosave_timer->start(); @@ -1704,9 +1704,9 @@ void ScriptEditor::_editor_settings_changed() { } if (current_theme == "") { - current_theme = EditorSettings::get_singleton()->get("text_editor/color_theme"); - } else if (current_theme != EditorSettings::get_singleton()->get("text_editor/color_theme")) { - current_theme = EditorSettings::get_singleton()->get("text_editor/color_theme"); + current_theme = EditorSettings::get_singleton()->get("text_editor/theme/color_theme"); + } else if (current_theme != EditorSettings::get_singleton()->get("text_editor/theme/color_theme")) { + current_theme = EditorSettings::get_singleton()->get("text_editor/theme/color_theme"); EditorSettings::get_singleton()->load_text_editor_theme(); } @@ -1720,7 +1720,7 @@ void ScriptEditor::_editor_settings_changed() { } _update_script_colors(); - ScriptServer::set_reload_scripts_on_save(EDITOR_DEF("text_editor/auto_reload_and_parse_scripts_on_save",true)); + ScriptServer::set_reload_scripts_on_save(EDITOR_DEF("text_editor/files/auto_reload_and_parse_scripts_on_save",true)); } @@ -1761,7 +1761,7 @@ void ScriptEditor::_unhandled_input(const InputEvent& p_event) { void ScriptEditor::set_window_layout(Ref<ConfigFile> p_layout) { - if (!bool(EDITOR_DEF("text_editor/restore_scripts_on_load",true))) { + if (!bool(EDITOR_DEF("text_editor/files/restore_scripts_on_load",true))) { return; } @@ -1974,9 +1974,9 @@ void ScriptEditor::_history_back(){ } void ScriptEditor::set_scene_root_script( Ref<Script> p_script ) { - bool open_dominant = EditorSettings::get_singleton()->get("text_editor/open_dominant_script_on_scene_change"); + bool open_dominant = EditorSettings::get_singleton()->get("text_editor/files/open_dominant_script_on_scene_change"); - if (bool(EditorSettings::get_singleton()->get("external_editor/use_external_editor"))) + if (bool(EditorSettings::get_singleton()->get("text_editor/external/use_external_editor"))) return; if (open_dominant && p_script.is_valid() && _can_open_in_editor(p_script.ptr())) { @@ -2416,20 +2416,20 @@ ScriptEditorPlugin::ScriptEditorPlugin(EditorNode *p_node) { script_editor->hide(); - EDITOR_DEF("text_editor/auto_reload_scripts_on_external_change",true); - ScriptServer::set_reload_scripts_on_save(EDITOR_DEF("text_editor/auto_reload_and_parse_scripts_on_save",true)); - EDITOR_DEF("text_editor/open_dominant_script_on_scene_change",true); - EDITOR_DEF("external_editor/use_external_editor",false); - EDITOR_DEF("external_editor/exec_path",""); - EDITOR_DEF("text_editor/script_temperature_enabled",true); - EDITOR_DEF("text_editor/highlight_current_script", true); - EDITOR_DEF("text_editor/script_temperature_history_size",15); - EDITOR_DEF("text_editor/script_temperature_hot_color",Color(1,0,0,0.3)); - EDITOR_DEF("text_editor/script_temperature_cold_color",Color(0,0,1,0.3)); - EDITOR_DEF("text_editor/current_script_background_color",Color(0.81,0.81,0.14,0.63)); - EDITOR_DEF("text_editor/group_help_pages",true); - EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING,"external_editor/exec_path",PROPERTY_HINT_GLOBAL_FILE)); - EDITOR_DEF("external_editor/exec_flags",""); + EDITOR_DEF("text_editor/files/auto_reload_scripts_on_external_change",true); + ScriptServer::set_reload_scripts_on_save(EDITOR_DEF("text_editor/files/auto_reload_and_parse_scripts_on_save",true)); + EDITOR_DEF("text_editor/files/open_dominant_script_on_scene_change",true); + EDITOR_DEF("text_editor/external/use_external_editor",false); + EDITOR_DEF("text_editor/external/exec_path",""); + EDITOR_DEF("text_editor/open_scripts/script_temperature_enabled",true); + EDITOR_DEF("text_editor/open_scripts/highlight_current_script", true); + EDITOR_DEF("text_editor/open_scripts/script_temperature_history_size",15); + EDITOR_DEF("text_editor/open_scripts/script_temperature_hot_color",Color(1,0,0,0.3)); + EDITOR_DEF("text_editor/open_scripts/script_temperature_cold_color",Color(0,0,1,0.3)); + EDITOR_DEF("text_editor/open_scripts/current_script_background_color",Color(0.81,0.81,0.14,0.63)); + EDITOR_DEF("text_editor/open_scripts/group_help_pages",true); + EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING,"text_editor/external/exec_path",PROPERTY_HINT_GLOBAL_FILE)); + EDITOR_DEF("text_editor/external/exec_flags",""); } diff --git a/tools/editor/plugins/script_text_editor.cpp b/tools/editor/plugins/script_text_editor.cpp index 56e64fccda..3921c05fd1 100644 --- a/tools/editor/plugins/script_text_editor.cpp +++ b/tools/editor/plugins/script_text_editor.cpp @@ -100,32 +100,32 @@ void ScriptTextEditor::_load_theme_settings() { /* keyword color */ - text_edit->add_color_override("background_color", EDITOR_DEF("text_editor/background_color",Color(0,0,0,0))); - text_edit->add_color_override("completion_background_color", EDITOR_DEF("text_editor/completion_background_color", Color(0,0,0,0))); - text_edit->add_color_override("completion_selected_color", EDITOR_DEF("text_editor/completion_selected_color", Color::html("434244"))); - text_edit->add_color_override("completion_existing_color", EDITOR_DEF("text_editor/completion_existing_color", Color::html("21dfdfdf"))); - text_edit->add_color_override("completion_scroll_color", EDITOR_DEF("text_editor/completion_scroll_color", Color::html("ffffff"))); - text_edit->add_color_override("completion_font_color", EDITOR_DEF("text_editor/completion_font_color", Color::html("aaaaaa"))); - text_edit->add_color_override("font_color",EDITOR_DEF("text_editor/text_color",Color(0,0,0))); - text_edit->add_color_override("line_number_color",EDITOR_DEF("text_editor/line_number_color",Color(0,0,0))); - text_edit->add_color_override("caret_color",EDITOR_DEF("text_editor/caret_color",Color(0,0,0))); - text_edit->add_color_override("caret_background_color",EDITOR_DEF("text_editor/caret_background_color",Color(0,0,0))); - text_edit->add_color_override("font_selected_color",EDITOR_DEF("text_editor/text_selected_color",Color(1,1,1))); - text_edit->add_color_override("selection_color",EDITOR_DEF("text_editor/selection_color",Color(0.2,0.2,1))); - text_edit->add_color_override("brace_mismatch_color",EDITOR_DEF("text_editor/brace_mismatch_color",Color(1,0.2,0.2))); - text_edit->add_color_override("current_line_color",EDITOR_DEF("text_editor/current_line_color",Color(0.3,0.5,0.8,0.15))); - text_edit->add_color_override("word_highlighted_color",EDITOR_DEF("text_editor/word_highlighted_color",Color(0.8,0.9,0.9,0.15))); - text_edit->add_color_override("number_color",EDITOR_DEF("text_editor/number_color",Color(0.9,0.6,0.0,2))); - text_edit->add_color_override("function_color",EDITOR_DEF("text_editor/function_color",Color(0.4,0.6,0.8))); - text_edit->add_color_override("member_variable_color",EDITOR_DEF("text_editor/member_variable_color",Color(0.9,0.3,0.3))); - text_edit->add_color_override("mark_color", EDITOR_DEF("text_editor/mark_color", Color(1.0,0.4,0.4,0.4))); - text_edit->add_color_override("breakpoint_color", EDITOR_DEF("text_editor/breakpoint_color", Color(0.8,0.8,0.4,0.2))); - text_edit->add_color_override("search_result_color",EDITOR_DEF("text_editor/search_result_color",Color(0.05,0.25,0.05,1))); - text_edit->add_color_override("search_result_border_color",EDITOR_DEF("text_editor/search_result_border_color",Color(0.1,0.45,0.1,1))); - text_edit->add_color_override("symbol_color",EDITOR_DEF("text_editor/symbol_color",Color::hex(0x005291ff))); - text_edit->add_constant_override("line_spacing", EDITOR_DEF("text_editor/line_spacing",4)); - - Color keyword_color= EDITOR_DEF("text_editor/keyword_color",Color(0.5,0.0,0.2)); + text_edit->add_color_override("background_color", EDITOR_DEF("text_editor/highlighting/background_color",Color(0,0,0,0))); + text_edit->add_color_override("completion_background_color", EDITOR_DEF("text_editor/highlighting/completion_background_color", Color(0,0,0,0))); + text_edit->add_color_override("completion_selected_color", EDITOR_DEF("text_editor/highlighting/completion_selected_color", Color::html("434244"))); + text_edit->add_color_override("completion_existing_color", EDITOR_DEF("text_editor/highlighting/completion_existing_color", Color::html("21dfdfdf"))); + text_edit->add_color_override("completion_scroll_color", EDITOR_DEF("text_editor/highlighting/completion_scroll_color", Color::html("ffffff"))); + text_edit->add_color_override("completion_font_color", EDITOR_DEF("text_editor/highlighting/completion_font_color", Color::html("aaaaaa"))); + text_edit->add_color_override("font_color",EDITOR_DEF("text_editor/highlighting/text_color",Color(0,0,0))); + text_edit->add_color_override("line_number_color",EDITOR_DEF("text_editor/highlighting/line_number_color",Color(0,0,0))); + text_edit->add_color_override("caret_color",EDITOR_DEF("text_editor/highlighting/caret_color",Color(0,0,0))); + text_edit->add_color_override("caret_background_color",EDITOR_DEF("text_editor/highlighting/caret_background_color",Color(0,0,0))); + text_edit->add_color_override("font_selected_color",EDITOR_DEF("text_editor/highlighting/text_selected_color",Color(1,1,1))); + text_edit->add_color_override("selection_color",EDITOR_DEF("text_editor/highlighting/selection_color",Color(0.2,0.2,1))); + text_edit->add_color_override("brace_mismatch_color",EDITOR_DEF("text_editor/highlighting/brace_mismatch_color",Color(1,0.2,0.2))); + text_edit->add_color_override("current_line_color",EDITOR_DEF("text_editor/highlighting/current_line_color",Color(0.3,0.5,0.8,0.15))); + text_edit->add_color_override("word_highlighted_color",EDITOR_DEF("text_editor/highlighting/word_highlighted_color",Color(0.8,0.9,0.9,0.15))); + text_edit->add_color_override("number_color",EDITOR_DEF("text_editor/highlighting/number_color",Color(0.9,0.6,0.0,2))); + text_edit->add_color_override("function_color",EDITOR_DEF("text_editor/highlighting/function_color",Color(0.4,0.6,0.8))); + text_edit->add_color_override("member_variable_color",EDITOR_DEF("text_editor/highlighting/member_variable_color",Color(0.9,0.3,0.3))); + text_edit->add_color_override("mark_color", EDITOR_DEF("text_editor/highlighting/mark_color", Color(1.0,0.4,0.4,0.4))); + text_edit->add_color_override("breakpoint_color", EDITOR_DEF("text_editor/highlighting/breakpoint_color", Color(0.8,0.8,0.4,0.2))); + text_edit->add_color_override("search_result_color",EDITOR_DEF("text_editor/highlighting/search_result_color",Color(0.05,0.25,0.05,1))); + text_edit->add_color_override("search_result_border_color",EDITOR_DEF("text_editor/highlighting/search_result_border_color",Color(0.1,0.45,0.1,1))); + text_edit->add_color_override("symbol_color",EDITOR_DEF("text_editor/highlighting/symbol_color",Color::hex(0x005291ff))); + text_edit->add_constant_override("line_spacing", EDITOR_DEF("text_editor/theme/line_spacing",4)); + + Color keyword_color= EDITOR_DEF("text_editor/highlighting/keyword_color",Color(0.5,0.0,0.2)); List<String> keywords; script->get_language()->get_reserved_words(&keywords); @@ -135,7 +135,7 @@ void ScriptTextEditor::_load_theme_settings() { } //colorize core types - Color basetype_color= EDITOR_DEF("text_editor/base_type_color",Color(0.3,0.3,0.0)); + Color basetype_color= EDITOR_DEF("text_editor/highlighting/base_type_color",Color(0.3,0.3,0.0)); text_edit->add_keyword_color("Vector2",basetype_color); text_edit->add_keyword_color("Vector3",basetype_color); @@ -151,7 +151,7 @@ void ScriptTextEditor::_load_theme_settings() { text_edit->add_keyword_color("NodePath",basetype_color); //colorize engine types - Color type_color= EDITOR_DEF("text_editor/engine_type_color",Color(0.0,0.2,0.4)); + Color type_color= EDITOR_DEF("text_editor/highlighting/engine_type_color",Color(0.0,0.2,0.4)); List<StringName> types; ClassDB::get_class_list(&types); @@ -166,7 +166,7 @@ void ScriptTextEditor::_load_theme_settings() { } //colorize comments - Color comment_color = EDITOR_DEF("text_editor/comment_color",Color::hex(0x797e7eff)); + Color comment_color = EDITOR_DEF("text_editor/highlighting/comment_color",Color::hex(0x797e7eff)); List<String> comments; script->get_language()->get_comment_delimiters(&comments); @@ -180,7 +180,7 @@ void ScriptTextEditor::_load_theme_settings() { } //colorize strings - Color string_color = EDITOR_DEF("text_editor/string_color",Color::hex(0x6b6f00ff)); + Color string_color = EDITOR_DEF("text_editor/highlighting/string_color",Color::hex(0x6b6f00ff)); List<String> strings; script->get_language()->get_string_delimiters(&strings); @@ -438,7 +438,7 @@ static void _find_changed_scripts_for_external_editor(Node* p_base, Node*p_curre void ScriptEditor::_update_modified_scripts_for_external_editor(Ref<Script> p_for_script) { - if (!bool(EditorSettings::get_singleton()->get("external_editor/use_external_editor"))) + if (!bool(EditorSettings::get_singleton()->get("text_editor/external/use_external_editor"))) return; Set<Ref<Script> > scripts; @@ -1264,8 +1264,8 @@ ScriptTextEditor::ScriptTextEditor() { update_settings(); code_editor->get_text_edit()->set_callhint_settings( - EditorSettings::get_singleton()->get("text_editor/put_callhint_tooltip_below_current_line"), - EditorSettings::get_singleton()->get("text_editor/callhint_tooltip_offset")); + EditorSettings::get_singleton()->get("text_editor/completion/put_callhint_tooltip_below_current_line"), + EditorSettings::get_singleton()->get("text_editor/completion/callhint_tooltip_offset")); code_editor->get_text_edit()->set_select_identifiers_on_hover(true); code_editor->get_text_edit()->set_context_menu_enabled(false); diff --git a/tools/editor/plugins/shader_editor_plugin.cpp b/tools/editor/plugins/shader_editor_plugin.cpp index f8dfbad744..1760191349 100644 --- a/tools/editor/plugins/shader_editor_plugin.cpp +++ b/tools/editor/plugins/shader_editor_plugin.cpp @@ -72,31 +72,31 @@ void ShaderTextEditor::_load_theme_settings() { /* keyword color */ - get_text_edit()->add_color_override("background_color", EDITOR_DEF("text_editor/background_color",Color(0,0,0,0))); - get_text_edit()->add_color_override("completion_background_color", EDITOR_DEF("text_editor/completion_background_color", Color(0,0,0,0))); - get_text_edit()->add_color_override("completion_selected_color", EDITOR_DEF("text_editor/completion_selected_color", Color::html("434244"))); - get_text_edit()->add_color_override("completion_existing_color", EDITOR_DEF("text_editor/completion_existing_color", Color::html("21dfdfdf"))); - get_text_edit()->add_color_override("completion_scroll_color", EDITOR_DEF("text_editor/completion_scroll_color", Color::html("ffffff"))); - get_text_edit()->add_color_override("completion_font_color", EDITOR_DEF("text_editor/completion_font_color", Color::html("aaaaaa"))); - get_text_edit()->add_color_override("font_color",EDITOR_DEF("text_editor/text_color",Color(0,0,0))); - get_text_edit()->add_color_override("line_number_color",EDITOR_DEF("text_editor/line_number_color",Color(0,0,0))); - get_text_edit()->add_color_override("caret_color",EDITOR_DEF("text_editor/caret_color",Color(0,0,0))); - get_text_edit()->add_color_override("caret_background_color",EDITOR_DEF("text_editor/caret_background_color",Color(0,0,0))); - get_text_edit()->add_color_override("font_selected_color",EDITOR_DEF("text_editor/text_selected_color",Color(1,1,1))); - get_text_edit()->add_color_override("selection_color",EDITOR_DEF("text_editor/selection_color",Color(0.2,0.2,1))); - get_text_edit()->add_color_override("brace_mismatch_color",EDITOR_DEF("text_editor/brace_mismatch_color",Color(1,0.2,0.2))); - get_text_edit()->add_color_override("current_line_color",EDITOR_DEF("text_editor/current_line_color",Color(0.3,0.5,0.8,0.15))); - get_text_edit()->add_color_override("word_highlighted_color",EDITOR_DEF("text_editor/word_highlighted_color",Color(0.8,0.9,0.9,0.15))); - get_text_edit()->add_color_override("number_color",EDITOR_DEF("text_editor/number_color",Color(0.9,0.6,0.0,2))); - get_text_edit()->add_color_override("function_color",EDITOR_DEF("text_editor/function_color",Color(0.4,0.6,0.8))); - get_text_edit()->add_color_override("member_variable_color",EDITOR_DEF("text_editor/member_variable_color",Color(0.9,0.3,0.3))); - get_text_edit()->add_color_override("mark_color", EDITOR_DEF("text_editor/mark_color", Color(1.0,0.4,0.4,0.4))); - get_text_edit()->add_color_override("breakpoint_color", EDITOR_DEF("text_editor/breakpoint_color", Color(0.8,0.8,0.4,0.2))); - get_text_edit()->add_color_override("search_result_color",EDITOR_DEF("text_editor/search_result_color",Color(0.05,0.25,0.05,1))); - get_text_edit()->add_color_override("search_result_border_color",EDITOR_DEF("text_editor/search_result_border_color",Color(0.1,0.45,0.1,1))); - get_text_edit()->add_color_override("symbol_color",EDITOR_DEF("text_editor/symbol_color",Color::hex(0x005291ff))); - - Color keyword_color= EDITOR_DEF("text_editor/keyword_color",Color(0.5,0.0,0.2)); + get_text_edit()->add_color_override("background_color", EDITOR_DEF("text_editor/highlighting/background_color",Color(0,0,0,0))); + get_text_edit()->add_color_override("completion_background_color", EDITOR_DEF("text_editor/highlighting/completion_background_color", Color(0,0,0,0))); + get_text_edit()->add_color_override("completion_selected_color", EDITOR_DEF("text_editor/highlighting/completion_selected_color", Color::html("434244"))); + get_text_edit()->add_color_override("completion_existing_color", EDITOR_DEF("text_editor/highlighting/completion_existing_color", Color::html("21dfdfdf"))); + get_text_edit()->add_color_override("completion_scroll_color", EDITOR_DEF("text_editor/highlighting/completion_scroll_color", Color::html("ffffff"))); + get_text_edit()->add_color_override("completion_font_color", EDITOR_DEF("text_editor/highlighting/completion_font_color", Color::html("aaaaaa"))); + get_text_edit()->add_color_override("font_color",EDITOR_DEF("text_editor/highlighting/text_color",Color(0,0,0))); + get_text_edit()->add_color_override("line_number_color",EDITOR_DEF("text_editor/highlighting/line_number_color",Color(0,0,0))); + get_text_edit()->add_color_override("caret_color",EDITOR_DEF("text_editor/highlighting/caret_color",Color(0,0,0))); + get_text_edit()->add_color_override("caret_background_color",EDITOR_DEF("text_editor/highlighting/caret_background_color",Color(0,0,0))); + get_text_edit()->add_color_override("font_selected_color",EDITOR_DEF("text_editor/highlighting/text_selected_color",Color(1,1,1))); + get_text_edit()->add_color_override("selection_color",EDITOR_DEF("text_editor/highlighting/selection_color",Color(0.2,0.2,1))); + get_text_edit()->add_color_override("brace_mismatch_color",EDITOR_DEF("text_editor/highlighting/brace_mismatch_color",Color(1,0.2,0.2))); + get_text_edit()->add_color_override("current_line_color",EDITOR_DEF("text_editor/highlighting/current_line_color",Color(0.3,0.5,0.8,0.15))); + get_text_edit()->add_color_override("word_highlighted_color",EDITOR_DEF("text_editor/highlighting/word_highlighted_color",Color(0.8,0.9,0.9,0.15))); + get_text_edit()->add_color_override("number_color",EDITOR_DEF("text_editor/highlighting/number_color",Color(0.9,0.6,0.0,2))); + get_text_edit()->add_color_override("function_color",EDITOR_DEF("text_editor/highlighting/function_color",Color(0.4,0.6,0.8))); + get_text_edit()->add_color_override("member_variable_color",EDITOR_DEF("text_editor/highlighting/member_variable_color",Color(0.9,0.3,0.3))); + get_text_edit()->add_color_override("mark_color", EDITOR_DEF("text_editor/highlighting/mark_color", Color(1.0,0.4,0.4,0.4))); + get_text_edit()->add_color_override("breakpoint_color", EDITOR_DEF("text_editor/highlighting/breakpoint_color", Color(0.8,0.8,0.4,0.2))); + get_text_edit()->add_color_override("search_result_color",EDITOR_DEF("text_editor/highlighting/search_result_color",Color(0.05,0.25,0.05,1))); + get_text_edit()->add_color_override("search_result_border_color",EDITOR_DEF("text_editor/highlighting/search_result_border_color",Color(0.1,0.45,0.1,1))); + get_text_edit()->add_color_override("symbol_color",EDITOR_DEF("text_editor/highlighting/symbol_color",Color::hex(0x005291ff))); + + Color keyword_color= EDITOR_DEF("text_editor/highlighting/keyword_color",Color(0.5,0.0,0.2)); List<String> keywords; @@ -131,7 +131,7 @@ void ShaderTextEditor::_load_theme_settings() { //colorize comments - Color comment_color = EDITOR_DEF("text_editor/comment_color",Color::hex(0x797e7eff)); + Color comment_color = EDITOR_DEF("text_editor/highlighting/comment_color",Color::hex(0x797e7eff)); get_text_edit()->add_color_region("/*","*/",comment_color,false); get_text_edit()->add_color_region("//","",comment_color,false); @@ -376,17 +376,17 @@ void ShaderEditor::_params_changed() { void ShaderEditor::_editor_settings_changed() { - shader_editor->get_text_edit()->set_auto_brace_completion(EditorSettings::get_singleton()->get("text_editor/auto_brace_complete")); - shader_editor->get_text_edit()->set_scroll_pass_end_of_file(EditorSettings::get_singleton()->get("text_editor/scroll_past_end_of_file")); - shader_editor->get_text_edit()->set_tab_size(EditorSettings::get_singleton()->get("text_editor/tab_size")); - shader_editor->get_text_edit()->set_draw_tabs(EditorSettings::get_singleton()->get("text_editor/draw_tabs")); - shader_editor->get_text_edit()->set_show_line_numbers(EditorSettings::get_singleton()->get("text_editor/show_line_numbers")); - shader_editor->get_text_edit()->set_syntax_coloring(EditorSettings::get_singleton()->get("text_editor/syntax_highlighting")); - shader_editor->get_text_edit()->set_highlight_all_occurrences(EditorSettings::get_singleton()->get("text_editor/highlight_all_occurrences")); - shader_editor->get_text_edit()->cursor_set_blink_enabled(EditorSettings::get_singleton()->get("text_editor/caret_blink")); - shader_editor->get_text_edit()->cursor_set_blink_speed(EditorSettings::get_singleton()->get("text_editor/caret_blink_speed")); - shader_editor->get_text_edit()->add_constant_override("line_spacing", EditorSettings::get_singleton()->get("text_editor/line_spacing")); - shader_editor->get_text_edit()->cursor_set_block_mode(EditorSettings::get_singleton()->get("text_editor/block_caret")); + shader_editor->get_text_edit()->set_auto_brace_completion(EditorSettings::get_singleton()->get("text_editor/completion/auto_brace_complete")); + shader_editor->get_text_edit()->set_scroll_pass_end_of_file(EditorSettings::get_singleton()->get("text_editor/cursor/scroll_past_end_of_file")); + shader_editor->get_text_edit()->set_tab_size(EditorSettings::get_singleton()->get("text_editor/indent/tab_size")); + shader_editor->get_text_edit()->set_draw_tabs(EditorSettings::get_singleton()->get("text_editor/indent/draw_tabs")); + shader_editor->get_text_edit()->set_show_line_numbers(EditorSettings::get_singleton()->get("text_editor/line_numbers/show_line_numbers")); + shader_editor->get_text_edit()->set_syntax_coloring(EditorSettings::get_singleton()->get("text_editor/highlighting/syntax_highlighting")); + shader_editor->get_text_edit()->set_highlight_all_occurrences(EditorSettings::get_singleton()->get("text_editor/highlighting/highlight_all_occurrences")); + shader_editor->get_text_edit()->cursor_set_blink_enabled(EditorSettings::get_singleton()->get("text_editor/cursor/caret_blink")); + shader_editor->get_text_edit()->cursor_set_blink_speed(EditorSettings::get_singleton()->get("text_editor/cursor/caret_blink_speed")); + shader_editor->get_text_edit()->add_constant_override("line_spacing", EditorSettings::get_singleton()->get("text_editor/theme/line_spacing")); + shader_editor->get_text_edit()->cursor_set_block_mode(EditorSettings::get_singleton()->get("text_editor/cursor/block_caret")); } void ShaderEditor::_bind_methods() { diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp index 79ce7a44c3..439b884937 100644 --- a/tools/editor/plugins/spatial_editor_plugin.cpp +++ b/tools/editor/plugins/spatial_editor_plugin.cpp @@ -854,7 +854,7 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) { } break; case BUTTON_RIGHT: { - NavigationScheme nav_scheme = _get_navigation_schema("3d_editor/navigation_scheme"); + NavigationScheme nav_scheme = _get_navigation_schema("editors/3d/navigation_scheme"); if (b.pressed && _edit.gizmo.is_valid()) { //restore @@ -1014,7 +1014,7 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) { if (b.pressed) { - NavigationScheme nav_scheme = _get_navigation_schema("3d_editor/navigation_scheme"); + NavigationScheme nav_scheme = _get_navigation_schema("editors/3d/navigation_scheme"); if ( (nav_scheme==NAVIGATION_MAYA || nav_scheme==NAVIGATION_MODO) && b.mod.alt) { break; } @@ -1251,7 +1251,7 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) { } - NavigationScheme nav_scheme = _get_navigation_schema("3d_editor/navigation_scheme"); + NavigationScheme nav_scheme = _get_navigation_schema("editors/3d/navigation_scheme"); NavigationMode nav_mode = NAVIGATION_NONE; if (_edit.gizmo.is_valid()) { @@ -1558,7 +1558,7 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) { nav_mode = NAVIGATION_PAN; } - } else if (EditorSettings::get_singleton()->get("3d_editor/emulate_3_button_mouse")) { + } else if (EditorSettings::get_singleton()->get("editors/3d/emulate_3_button_mouse")) { // Handle trackpad (no external mouse) use case int mod = 0; if (m.mod.shift) @@ -2222,7 +2222,7 @@ void SpatialEditorViewport::update_transform_gizmo_view() { if (dd==0) dd=0.0001; - float gsize = EditorSettings::get_singleton()->get("3d_editor/manipulator_gizmo_size"); + float gsize = EditorSettings::get_singleton()->get("editors/3d/manipulator_gizmo_size"); gizmo_scale=(gsize/Math::abs(dd)); Vector3 scale = Vector3(1,1,1) * gizmo_scale; @@ -3184,7 +3184,7 @@ void SpatialEditor::_init_indicators() { Vector<Color> origin_colors; Vector<Vector3> origin_points; - Color grid_color = EditorSettings::get_singleton()->get("3d_editor/grid_color"); + Color grid_color = EditorSettings::get_singleton()->get("editors/3d/grid_color"); for(int i=0;i<3;i++) { Vector3 axis; @@ -3294,7 +3294,7 @@ void SpatialEditor::_init_indicators() { //move gizmo - float gizmo_alph = EditorSettings::get_singleton()->get("3d_editor/manipulator_gizmo_opacity"); + float gizmo_alph = EditorSettings::get_singleton()->get("editors/3d/manipulator_gizmo_opacity"); gizmo_hl = Ref<FixedSpatialMaterial>( memnew( FixedSpatialMaterial ) ); gizmo_hl->set_flag(FixedSpatialMaterial::FLAG_UNSHADED, true); @@ -3721,9 +3721,9 @@ void SpatialEditor::_bind_methods() { void SpatialEditor::clear() { - settings_fov->set_value(EDITOR_DEF("3d_editor/default_fov",60.0)); - settings_znear->set_value(EDITOR_DEF("3d_editor/default_z_near",0.1)); - settings_zfar->set_value(EDITOR_DEF("3d_editor/default_z_far",1500.0)); + settings_fov->set_value(EDITOR_DEF("editors/3d/default_fov",60.0)); + settings_znear->set_value(EDITOR_DEF("editors/3d/default_z_near",0.1)); + settings_zfar->set_value(EDITOR_DEF("editors/3d/default_z_far",1500.0)); for(int i=0;i<4;i++) { viewports[i]->reset(); @@ -4045,21 +4045,21 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) { settings_fov->set_max(179); settings_fov->set_min(1); settings_fov->set_step(0.01); - settings_fov->set_value(EDITOR_DEF("3d_editor/default_fov",60.0)); + settings_fov->set_value(EDITOR_DEF("editors/3d/default_fov",60.0)); settings_vbc->add_margin_child(TTR("Perspective FOV (deg.):"),settings_fov); settings_znear = memnew( SpinBox ); settings_znear->set_max(10000); settings_znear->set_min(0.1); settings_znear->set_step(0.01); - settings_znear->set_value(EDITOR_DEF("3d_editor/default_z_near",0.1)); + settings_znear->set_value(EDITOR_DEF("editors/3d/default_z_near",0.1)); settings_vbc->add_margin_child(TTR("View Z-Near:"),settings_znear); settings_zfar = memnew( SpinBox ); settings_zfar->set_max(10000); settings_zfar->set_min(0.1); settings_zfar->set_step(0.01); - settings_zfar->set_value(EDITOR_DEF("3d_editor/default_z_far",1500)); + settings_zfar->set_value(EDITOR_DEF("editors/3d/default_z_far",1500)); settings_vbc->add_margin_child(TTR("View Z-Far:"),settings_zfar); //settings_dialog->get_cancel()->hide(); @@ -4127,9 +4127,9 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) { set_process_unhandled_key_input(true); add_to_group("_spatial_editor_group"); - EDITOR_DEF("3d_editor/manipulator_gizmo_size",80); + EDITOR_DEF("editors/3d/manipulator_gizmo_size",80); EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::INT,"3d_editor/manipulator_gizmo_size",PROPERTY_HINT_RANGE,"16,1024,1")); - EDITOR_DEF("3d_editor/manipulator_gizmo_opacity",0.2); + EDITOR_DEF("editors/3d/manipulator_gizmo_opacity",0.2); over_gizmo_handle=-1; } diff --git a/tools/editor/plugins/tile_map_editor_plugin.cpp b/tools/editor/plugins/tile_map_editor_plugin.cpp index 9bdf80c314..c4bde13352 100644 --- a/tools/editor/plugins/tile_map_editor_plugin.cpp +++ b/tools/editor/plugins/tile_map_editor_plugin.cpp @@ -212,10 +212,10 @@ void TileMapEditor::_update_palette() { if (tiles.empty()) return; - float min_size = EDITOR_DEF("tile_map/preview_size", 64); + float min_size = EDITOR_DEF("editors/tile_map/preview_size", 64); min_size *= EDSCALE; - int hseparation = EDITOR_DEF("tile_map/palette_item_hseparation",8); - bool show_tile_names = bool(EDITOR_DEF("tile_map/show_tile_names", true)); + int hseparation = EDITOR_DEF("editors/tile_map/palette_item_hseparation",8); + bool show_tile_names = bool(EDITOR_DEF("editors/tile_map/show_tile_names", true)); palette->add_constant_override("hseparation", hseparation*EDSCALE); palette->add_constant_override("vseparation", 8*EDSCALE); @@ -1204,7 +1204,7 @@ void TileMapEditor::_canvas_draw() { canvas_item_editor->draw_line(endpoints[i],endpoints[(i+1)%4],col,2); - bool bucket_preview = EditorSettings::get_singleton()->get("tile_map/bucket_fill_preview"); + bool bucket_preview = EditorSettings::get_singleton()->get("editors/tile_map/bucket_fill_preview"); if (tool==TOOL_SELECTING || tool==TOOL_PICKING || !bucket_preview) { return; } @@ -1453,7 +1453,7 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) { size_slider->connect("value_changed", this, "_icon_size_changed"); add_child(size_slider); - int mw = EDITOR_DEF("tile_map/palette_min_width", 80); + int mw = EDITOR_DEF("editors/tile_map/palette_min_width", 80); // Add tile palette palette = memnew( ItemList ); @@ -1579,10 +1579,10 @@ void TileMapEditorPlugin::make_visible(bool p_visible) { TileMapEditorPlugin::TileMapEditorPlugin(EditorNode *p_node) { - EDITOR_DEF("tile_map/preview_size",64); - EDITOR_DEF("tile_map/palette_item_hseparation",8); - EDITOR_DEF("tile_map/show_tile_names", true); - EDITOR_DEF("tile_map/bucket_fill_preview", true); + EDITOR_DEF("editors/tile_map/preview_size",64); + EDITOR_DEF("editors/tile_map/palette_item_hseparation",8); + EDITOR_DEF("editors/tile_map/show_tile_names", true); + EDITOR_DEF("editors/tile_map/bucket_fill_preview", true); tile_map_editor = memnew( TileMapEditor(p_node) ); add_control_to_container(CONTAINER_CANVAS_EDITOR_SIDE, tile_map_editor); diff --git a/tools/editor/project_export.cpp b/tools/editor/project_export.cpp index 095ae747a7..b183de7c7b 100644 --- a/tools/editor/project_export.cpp +++ b/tools/editor/project_export.cpp @@ -733,7 +733,7 @@ void ProjectExportDialog::_create_android_keystore() { info=info.replace("$"+names[i], edit->get_text()); } - String jarsigner=EditorSettings::get_singleton()->get("android/jarsigner"); + String jarsigner=EditorSettings::get_singleton()->get("export/android/jarsigner"); String keytool=jarsigner.get_base_dir().plus_file("keytool"); String os_name=OS::get_singleton()->get_name(); if (os_name.to_lower()=="windows") { @@ -1661,7 +1661,7 @@ ProjectExportDialog::ProjectExportDialog(EditorNode *p_editor) { file_export = memnew( EditorFileDialog ); add_child(file_export); file_export->set_access(EditorFileDialog::ACCESS_FILESYSTEM); - file_export->set_current_dir( EditorSettings::get_singleton()->get("global/default_project_export_path") ); + file_export->set_current_dir( EditorSettings::get_singleton()->get("filesystem/directories/default_project_export_path") ); file_export->set_title(TTR("Export Project")); file_export->connect("file_selected", this,"_export_action"); @@ -1673,7 +1673,7 @@ ProjectExportDialog::ProjectExportDialog(EditorNode *p_editor) { pck_export = memnew( EditorFileDialog ); pck_export->set_access(EditorFileDialog::ACCESS_FILESYSTEM); - pck_export->set_current_dir( EditorSettings::get_singleton()->get("global/default_project_export_path") ); + pck_export->set_current_dir( EditorSettings::get_singleton()->get("filesystem/directories/default_project_export_path") ); pck_export->set_title(TTR("Export Project PCK")); pck_export->connect("file_selected", this,"_export_action_pck"); pck_export->add_filter("*.pck ; Data Pack"); diff --git a/tools/editor/project_manager.cpp b/tools/editor/project_manager.cpp index 7c775ac188..2af95516fa 100644 --- a/tools/editor/project_manager.cpp +++ b/tools/editor/project_manager.cpp @@ -451,7 +451,7 @@ public: fdialog = memnew( FileDialog ); add_child(fdialog); fdialog->set_access(FileDialog::ACCESS_FILESYSTEM); - fdialog->set_current_dir( EditorSettings::get_singleton()->get("global/default_project_path") ); + fdialog->set_current_dir( EditorSettings::get_singleton()->get("filesystem/directories/default_project_path") ); project_name->connect("text_changed", this,"_text_changed"); project_path->connect("text_changed", this,"_path_text_changed"); fdialog->connect("dir_selected", this,"_path_selected"); @@ -1218,7 +1218,7 @@ ProjectManager::ProjectManager() { EditorSettings::get_singleton()->set_optimize_save(false); //just write settings as they came { - int dpi_mode = EditorSettings::get_singleton()->get("global/hidpi_mode"); + int dpi_mode = EditorSettings::get_singleton()->get("interface/hidpi_mode"); if (dpi_mode==0) { editor_set_scale( OS::get_singleton()->get_screen_dpi(0) > 150 && OS::get_singleton()->get_screen_size(OS::get_singleton()->get_current_screen()).x>2000 ? 2.0 : 1.0 ); } else if (dpi_mode==1) { @@ -1232,7 +1232,7 @@ ProjectManager::ProjectManager() { } } - FileDialog::set_default_show_hidden_files(EditorSettings::get_singleton()->get("file_dialog/show_hidden_files")); + FileDialog::set_default_show_hidden_files(EditorSettings::get_singleton()->get("filesytem/file_dialog/show_hidden_files")); set_area_as_parent_rect(); set_theme(create_editor_theme()); @@ -1341,7 +1341,7 @@ ProjectManager::ProjectManager() { scan_dir->set_access(FileDialog::ACCESS_FILESYSTEM); scan_dir->set_mode(FileDialog::MODE_OPEN_DIR); scan_dir->set_title(TTR("Select a Folder to Scan")); // must be after mode or it's overridden - scan_dir->set_current_dir( EditorSettings::get_singleton()->get("global/default_project_path") ); + scan_dir->set_current_dir( EditorSettings::get_singleton()->get("filesystem/directories/default_project_path") ); gui_base->add_child(scan_dir); scan_dir->connect("dir_selected",this,"_scan_begin"); @@ -1418,8 +1418,8 @@ ProjectManager::ProjectManager() { npdialog->connect("project_created", this,"_on_project_created"); _load_recent_projects(); - if ( EditorSettings::get_singleton()->get("global/autoscan_project_path") ) { - _scan_begin( EditorSettings::get_singleton()->get("global/autoscan_project_path") ); + if ( EditorSettings::get_singleton()->get("filesystem/directories/autoscan_project_path") ) { + _scan_begin( EditorSettings::get_singleton()->get("filesystem/directories/autoscan_project_path") ); } //get_ok()->set_text("Open"); diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp index 7fd067a22a..294a71aa50 100644 --- a/tools/editor/property_editor.cpp +++ b/tools/editor/property_editor.cpp @@ -2405,7 +2405,7 @@ void PropertyEditor::set_item_text(TreeItem *p_item, int p_type, const String& p } else { RES res = obj->get( p_name ).operator RefPtr(); if (res->is_class("Texture")) { - int tw = EditorSettings::get_singleton()->get("property_editor/texture_preview_width"); + int tw = EditorSettings::get_singleton()->get("docks/property_editor/texture_preview_width"); p_item->set_icon_max_width(1,tw); p_item->set_icon(1,res); p_item->set_text(1,""); @@ -2929,7 +2929,7 @@ void PropertyEditor::refresh() { if (refresh_countdown>0) return; - refresh_countdown=EditorSettings::get_singleton()->get("property_editor/auto_refresh_interval"); + refresh_countdown=EditorSettings::get_singleton()->get("docks/property_editor/auto_refresh_interval"); } @@ -3669,7 +3669,7 @@ void PropertyEditor::update_tree() { RES res = obj->get( p.name ).operator RefPtr(); if (res->is_class("Texture")) { - int tw = EditorSettings::get_singleton()->get("property_editor/texture_preview_width"); + int tw = EditorSettings::get_singleton()->get("docks/property_editor/texture_preview_width"); item->set_icon_max_width(1,tw); item->set_icon(1,res); item->set_text(1,""); @@ -4249,7 +4249,7 @@ void PropertyEditor::_resource_preview_done(const String& p_path,const Ref<Textu ERR_FAIL_COND(!ti); - int tw = EditorSettings::get_singleton()->get("property_editor/texture_preview_width"); + int tw = EditorSettings::get_singleton()->get("docks/property_editor/texture_preview_width"); ti->set_icon(1,p_preview); //should be scaled I think? ti->set_icon_max_width(1,tw); @@ -4422,7 +4422,7 @@ PropertyEditor::PropertyEditor() { use_doc_hints=false; use_filter=false; subsection_selectable=false; - show_type_icons=EDITOR_DEF("inspector/show_type_icons",false); + show_type_icons=EDITOR_DEF("interface/show_type_icons",false); } @@ -4492,6 +4492,9 @@ class SectionedPropertyEditorFilter : public Object { PropertyInfo pi=E->get(); int sp = pi.name.find("/"); + if (pi.name=="resource_path" || pi.name=="resource_name") //skip resource stuff + continue; + if (sp==-1) { pi.name="Global/"+pi.name; @@ -4644,7 +4647,7 @@ void SectionedPropertyEditor::update_category_list() { else if ( !(pi.usage&PROPERTY_USAGE_EDITOR) ) continue; - if (pi.name.find(":")!=-1 || pi.name=="script/script" || pi.name.begins_with("resource/")) + if (pi.name.find(":")!=-1 || pi.name=="script/script" || pi.name=="resource_name" || pi.name=="resource_path") continue; int sp = pi.name.find("/"); if (sp==-1) diff --git a/tools/editor/pvrtc_compress.cpp b/tools/editor/pvrtc_compress.cpp index e9ef311e79..7f84d8d00e 100644 --- a/tools/editor/pvrtc_compress.cpp +++ b/tools/editor/pvrtc_compress.cpp @@ -38,7 +38,7 @@ static void (*_base_image_compress_pvrtc4_func)(Image *)=NULL; static void _compress_image(Image::CompressMode p_mode,Image *p_image) { - String ttpath = EditorSettings::get_singleton()->get("PVRTC/texture_tool"); + String ttpath = EditorSettings::get_singleton()->get("filesystem/import/pvrtc_texture_tool"); if (ttpath.strip_edges()=="" || !FileAccess::exists(ttpath)) { switch(p_mode) { @@ -82,7 +82,7 @@ static void _compress_image(Image::CompressMode p_mode,Image *p_image) { } - if (EditorSettings::get_singleton()->get("PVRTC/fast_conversion").operator bool()) { + if (EditorSettings::get_singleton()->get("filesystem/import/pvrtc_fast_conversion").operator bool()) { args.push_back("-pvrtcfast"); } if (p_image->has_mipmaps()) diff --git a/tools/editor/scene_tree_dock.cpp b/tools/editor/scene_tree_dock.cpp index c6f6f226ff..d9d5e82cfd 100644 --- a/tools/editor/scene_tree_dock.cpp +++ b/tools/editor/scene_tree_dock.cpp @@ -846,7 +846,7 @@ void SceneTreeDock::_fill_path_renames(Vector<StringName> base_path,Vector<Strin void SceneTreeDock::fill_path_renames(Node* p_node, Node *p_new_parent, List<Pair<NodePath,NodePath> > *p_renames) { - if (!bool(EDITOR_DEF("animation/autorename_animation_tracks",true))) + if (!bool(EDITOR_DEF("editors/animation/autorename_animation_tracks",true))) return; @@ -879,7 +879,7 @@ void SceneTreeDock::perform_node_renames(Node* p_base,List<Pair<NodePath,NodePat if (!r_rem_anims) r_rem_anims=&rem_anims; - if (!bool(EDITOR_DEF("animation/autorename_animation_tracks",true))) + if (!bool(EDITOR_DEF("editors/animation/autorename_animation_tracks",true))) return; if (!p_base) { @@ -1554,9 +1554,9 @@ void SceneTreeDock::_new_scene_from(String p_file) { } int flg=0; - if (EditorSettings::get_singleton()->get("on_save/compress_binary_resources")) + if (EditorSettings::get_singleton()->get("filesystem/on_save/compress_binary_resources")) flg|=ResourceSaver::FLAG_COMPRESS; - //if (EditorSettings::get_singleton()->get("on_save/save_paths_as_relative")) + //if (EditorSettings::get_singleton()->get("filesystem/on_save/save_paths_as_relative")) // flg|=ResourceSaver::FLAG_RELATIVE_PATHS; diff --git a/tools/editor/scene_tree_editor.cpp b/tools/editor/scene_tree_editor.cpp index b02372bae7..b4c8761fa3 100644 --- a/tools/editor/scene_tree_editor.cpp +++ b/tools/editor/scene_tree_editor.cpp @@ -1087,8 +1087,8 @@ void SceneTreeEditor::_warning_changed(Node* p_for_node) { void SceneTreeEditor::_editor_settings_changed() { - bool enable_rl = EditorSettings::get_singleton()->get("scenetree_editor/draw_relationship_lines"); - Color rl_color = EditorSettings::get_singleton()->get("scenetree_editor/relationship_line_color"); + bool enable_rl = EditorSettings::get_singleton()->get("docks/scene_tree/draw_relationship_lines"); + Color rl_color = EditorSettings::get_singleton()->get("docks/scene_tree/relationship_line_color"); if (enable_rl) { tree->add_constant_override("draw_relationship_lines",1); diff --git a/tools/editor/settings_config_dialog.cpp b/tools/editor/settings_config_dialog.cpp index 97dc2647e4..112dee291f 100644 --- a/tools/editor/settings_config_dialog.cpp +++ b/tools/editor/settings_config_dialog.cpp @@ -55,7 +55,7 @@ void EditorSettingsDialog::_settings_property_edited(const String& p_name) { // Small usability workaround to update the text color settings when the // color theme is changed - if (full_name == "text_editor/color_theme") { + if (full_name == "text_editor/theme/color_theme") { property_editor->get_property_editor()->update_tree(); } } |