diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/bind/core_bind.cpp | 10 | ||||
-rw-r--r-- | core/object.cpp | 7 | ||||
-rw-r--r-- | core/object.h | 4 | ||||
-rw-r--r-- | core/ustring.cpp | 21 | ||||
-rw-r--r-- | core/ustring.h | 1 | ||||
-rw-r--r-- | core/vector.h | 11 |
6 files changed, 47 insertions, 7 deletions
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); 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<String> *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..0bd3d09c21 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() + 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(); 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; 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<T> >(); } - + void ordered_insert(const T& p_val) { + int i; + for (i=0; i<size(); i++) { + + if (p_val < operator[](i)) { + break; + }; + }; + insert(i, p_val); + } void operator=(const Vector& p_from); Vector(const Vector& p_from); |