From 21eb3b2a83fd59f6d667688c95b4a198b3b6f689 Mon Sep 17 00:00:00 2001 From: Nathan Warden Date: Mon, 23 Mar 2015 00:08:07 -0500 Subject: Camel casing being capitalized only happens in the inspector now. --- core/ustring.cpp | 21 +++++++++++++++++++++ core/ustring.h | 1 + 2 files changed, 22 insertions(+) (limited to 'core') diff --git a/core/ustring.cpp b/core/ustring.cpp index 09d3d95b68..edb5da2bd2 100644 --- a/core/ustring.cpp +++ b/core/ustring.cpp @@ -498,6 +498,27 @@ String String::capitalize() const { return cap; } + +String String::camelcase_to_underscore() const { + const CharType * cstr = c_str(); + String newString; + const char A = 'A', Z = 'Z'; + int startIndex = 0; + + for ( int i = 1; i < this->size()-1; i++ ) { + bool isCapital = cstr[i] >= A && cstr[i] <= Z; + + if ( isCapital ) { + newString += "_" + this->substr(startIndex, i-startIndex); + startIndex = i; + } + } + + newString += "_" + this->substr(startIndex, this->size()-startIndex); + + return newString; +} + int String::get_slice_count(String p_splitter) const{ if (empty()) diff --git a/core/ustring.h b/core/ustring.h index d4b854ea76..f9f47d69c9 100644 --- a/core/ustring.h +++ b/core/ustring.h @@ -149,6 +149,7 @@ public: static double to_double(const CharType* p_str, const CharType **r_end=NULL); static int64_t to_int(const CharType* p_str,int p_len=-1); String capitalize() const; + String camelcase_to_underscore() const; int get_slice_count(String p_splitter) const; String get_slice(String p_splitter,int p_slice) const; -- cgit v1.2.3 From 4b3b5eba86d89e65e751b9e9b8e901a17f8e35ef Mon Sep 17 00:00:00 2001 From: Fabio Alessandrelli Date: Thu, 19 Mar 2015 23:53:54 +0000 Subject: Use Vector for storing areas --- core/vector.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'core') diff --git a/core/vector.h b/core/vector.h index 90a9bf715b..d6453a3b83 100644 --- a/core/vector.h +++ b/core/vector.h @@ -149,7 +149,16 @@ public: sort_custom<_DefaultComparator >(); } - + void ordered_insert(const T& p_val) { + int i; + for (i=0; i Date: Sat, 28 Mar 2015 18:34:28 +0100 Subject: add : bool Object.is_queued_for_deletion() `object.is_queued_for_deletion()` return true if the object was `object.queue_free()` or `SceneTree.queue_delete(object)`. --- core/object.cpp | 7 +++++++ core/object.h | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'core') diff --git a/core/object.cpp b/core/object.cpp index 2b83f728d1..f71521a0ff 100644 --- a/core/object.cpp +++ b/core/object.cpp @@ -1503,6 +1503,8 @@ void Object::_bind_methods() { ObjectTypeDB::bind_method(_MD("XL_MESSAGE","message"),&Object::XL_MESSAGE); ObjectTypeDB::bind_method(_MD("tr","message"),&Object::tr); + ObjectTypeDB::bind_method(_MD("is_queued_for_deletion"),&Object::is_queued_for_deletion); + ADD_SIGNAL( MethodInfo("script_changed")); BIND_VMETHOD( MethodInfo("_notification",PropertyInfo(Variant::INT,"what")) ); @@ -1566,6 +1568,10 @@ void Object::get_translatable_strings(List *p_strings) const { } +bool Object::is_queued_for_deletion() const { + return _is_queued_for_deletion; +} + #ifdef TOOLS_ENABLED void Object::set_edited(bool p_edited) { @@ -1587,6 +1593,7 @@ Object::Object() { _instance_ID=0; _instance_ID = ObjectDB::add_instance(this); _can_translate=true; + _is_queued_for_deletion=false; script_instance=NULL; #ifdef TOOLS_ENABLED diff --git a/core/object.h b/core/object.h index eb885f5d20..849bfc8510 100644 --- a/core/object.h +++ b/core/object.h @@ -397,7 +397,6 @@ friend void postinitialize_handler(Object*); protected: - virtual bool _use_builtin_script() const { return false; } virtual void _initialize_typev() { initialize_type(); } virtual bool _setv(const StringName& p_name,const Variant &p_property) { return false; }; @@ -589,6 +588,9 @@ public: StringName XL_MESSAGE(const StringName& p_message) const; //translate message (internationalization) StringName tr(const StringName& p_message) const; //translate message (alternative) + bool _is_queued_for_deletion; // set to true by SceneTree::queue_delete(), and returned by + bool is_queued_for_deletion() const; + _FORCE_INLINE_ void set_message_translation(bool p_enable) { _can_translate=p_enable; } _FORCE_INLINE_ bool can_translate_messages() const { return _can_translate; } Object(); -- cgit v1.2.3 From 9cca88eb9261587875cc944a23811c9f1e62f492 Mon Sep 17 00:00:00 2001 From: UsernameIsAReservedWord Date: Sat, 28 Mar 2015 18:42:01 +0100 Subject: Update object.h --- core/object.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'core') diff --git a/core/object.h b/core/object.h index 849bfc8510..0bd3d09c21 100644 --- a/core/object.h +++ b/core/object.h @@ -588,7 +588,7 @@ public: StringName XL_MESSAGE(const StringName& p_message) const; //translate message (internationalization) StringName tr(const StringName& p_message) const; //translate message (alternative) - bool _is_queued_for_deletion; // set to true by SceneTree::queue_delete(), and returned by + bool _is_queued_for_deletion; // set to true by SceneTree::queue_delete() bool is_queued_for_deletion() const; _FORCE_INLINE_ void set_message_translation(bool p_enable) { _can_translate=p_enable; } -- cgit v1.2.3 From af368b7e1accb27afdd958af59ef515413590823 Mon Sep 17 00:00:00 2001 From: hurikhan Date: Fri, 3 Apr 2015 15:00:55 -0400 Subject: set screen parameter names for gdscript --- core/bind/core_bind.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'core') diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index 5839467388..439855fbb7 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -709,13 +709,13 @@ void _OS::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_screen_count"),&_OS::get_screen_count); ObjectTypeDB::bind_method(_MD("get_current_screen"),&_OS::get_current_screen); - ObjectTypeDB::bind_method(_MD("set_current_screen"),&_OS::set_current_screen); - ObjectTypeDB::bind_method(_MD("get_screen_position"),&_OS::get_screen_position,DEFVAL(0)); - ObjectTypeDB::bind_method(_MD("get_screen_size"),&_OS::get_screen_size,DEFVAL(0)); + ObjectTypeDB::bind_method(_MD("set_current_screen","screen"),&_OS::set_current_screen); + ObjectTypeDB::bind_method(_MD("get_screen_position","screen"),&_OS::get_screen_position,DEFVAL(0)); + ObjectTypeDB::bind_method(_MD("get_screen_size","screen"),&_OS::get_screen_size,DEFVAL(0)); ObjectTypeDB::bind_method(_MD("get_window_position"),&_OS::get_window_position); - ObjectTypeDB::bind_method(_MD("set_window_position"),&_OS::set_window_position); + ObjectTypeDB::bind_method(_MD("set_window_position","position"),&_OS::set_window_position); ObjectTypeDB::bind_method(_MD("get_window_size"),&_OS::get_window_size); - ObjectTypeDB::bind_method(_MD("set_window_size"),&_OS::set_window_size); + ObjectTypeDB::bind_method(_MD("set_window_size","size"),&_OS::set_window_size); ObjectTypeDB::bind_method(_MD("set_window_fullscreen","enabled"),&_OS::set_window_fullscreen); ObjectTypeDB::bind_method(_MD("is_window_fullscreen"),&_OS::is_window_fullscreen); ObjectTypeDB::bind_method(_MD("set_window_resizable","enabled"),&_OS::set_window_resizable); -- cgit v1.2.3