diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index 26b1dac6f11..120cb0000b2 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -1772,6 +1772,7 @@ void _Thread::_start_func(void *ud) { memdelete(tud); Variant::CallError ce; const Variant* arg[1]={&t->userdata}; + t->ret=t->target_instance->call(t->target_method,arg,1,ce); if (ce.error!=Variant::CallError::CALL_OK) { @@ -1796,6 +1797,7 @@ void _Thread::_start_func(void *ud) { default: {} } + ERR_EXPLAIN("Could not call function '"+t->target_method.operator String()+"'' starting thread ID: "+t->get_id()+" Reason: "+reason); ERR_FAIL(); } diff --git a/core/globals.cpp b/core/globals.cpp index 8a7d66b68af..062adc21f99 100644 --- a/core/globals.cpp +++ b/core/globals.cpp @@ -1321,7 +1321,7 @@ Vector Globals::get_optimizer_presets() const { if (!E->get().name.begins_with("optimizer_presets/")) continue; - names.push_back(E->get().name.get_slice("/",1)); + names.push_back(E->get().name.get_slicec('/',1)); } names.sort(); diff --git a/core/image.cpp b/core/image.cpp index 037018519e3..c31fa478479 100644 --- a/core/image.cpp +++ b/core/image.cpp @@ -1016,10 +1016,10 @@ void Image::create( const char ** p_xpm ) { String line_str=line_ptr; line_str.replace("\t"," "); - size_width=line_str.get_slice(" ",0).to_int(); - size_height=line_str.get_slice(" ",1).to_int(); - colormap_size=line_str.get_slice(" ",2).to_int(); - pixelchars=line_str.get_slice(" ",3).to_int(); + size_width=line_str.get_slicec(' ',0).to_int(); + size_height=line_str.get_slicec(' ',1).to_int(); + colormap_size=line_str.get_slicec(' ',2).to_int(); + pixelchars=line_str.get_slicec(' ',3).to_int(); ERR_FAIL_COND(colormap_size > 32766); ERR_FAIL_COND(pixelchars > 5); ERR_FAIL_COND(size_width > 32767); diff --git a/core/io/http_client.cpp b/core/io/http_client.cpp index dbd009e3197..24012660d2f 100644 --- a/core/io/http_client.cpp +++ b/core/io/http_client.cpp @@ -325,7 +325,7 @@ Error HTTPClient::poll(){ if (i==0 && responses[i].begins_with("HTTP")) { - String num = responses[i].get_slice(" ",1); + String num = responses[i].get_slicec(' ',1); response_num=num.to_int(); } else { diff --git a/core/io/ip_address.cpp b/core/io/ip_address.cpp index c5506f1a749..ed5a45c9ef9 100644 --- a/core/io/ip_address.cpp +++ b/core/io/ip_address.cpp @@ -47,7 +47,7 @@ IP_Address::IP_Address(const String& p_string) { } for(int i=0;i<4;i++) { - field[i]=p_string.get_slice(".",i).to_int(); + field[i]=p_string.get_slicec('.',i).to_int(); } } diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp index 0f6f8a74b11..c6cf631de61 100644 --- a/core/io/resource_format_binary.cpp +++ b/core/io/resource_format_binary.cpp @@ -1819,7 +1819,7 @@ Error ResourceFormatSaverBinaryInstance::save(const String &p_path,const RES& p_ Property p; p.name_idx=get_string_index(F->get().name); p.value=E->get()->get(F->get().name); - if (F->get().usage&PROPERTY_USAGE_STORE_IF_NONZERO && p.value.is_zero()) + if ((F->get().usage&PROPERTY_USAGE_STORE_IF_NONZERO && p.value.is_zero())||(F->get().usage&PROPERTY_USAGE_STORE_IF_NONONE && p.value.is_one()) ) continue; p.pi=F->get(); diff --git a/core/io/resource_format_xml.cpp b/core/io/resource_format_xml.cpp index 36746a41118..b744cbf9678 100644 --- a/core/io/resource_format_xml.cpp +++ b/core/io/resource_format_xml.cpp @@ -1207,47 +1207,47 @@ Error ResourceInteractiveLoaderXML::parse_property(Variant& r_v, String &r_name) r_v=Vector3( - data.get_slice(",",0).to_double(), - data.get_slice(",",1).to_double(), - data.get_slice(",",2).to_double() + data.get_slicec(',',0).to_double(), + data.get_slicec(',',1).to_double(), + data.get_slicec(',',2).to_double() ); } else if (type=="vector2") { r_v=Vector2( - data.get_slice(",",0).to_double(), - data.get_slice(",",1).to_double() + data.get_slicec(',',0).to_double(), + data.get_slicec(',',1).to_double() ); } else if (type=="plane") { r_v=Plane( - data.get_slice(",",0).to_double(), - data.get_slice(",",1).to_double(), - data.get_slice(",",2).to_double(), - data.get_slice(",",3).to_double() + data.get_slicec(',',0).to_double(), + data.get_slicec(',',1).to_double(), + data.get_slicec(',',2).to_double(), + data.get_slicec(',',3).to_double() ); } else if (type=="quaternion") { r_v=Quat( - data.get_slice(",",0).to_double(), - data.get_slice(",",1).to_double(), - data.get_slice(",",2).to_double(), - data.get_slice(",",3).to_double() + data.get_slicec(',',0).to_double(), + data.get_slicec(',',1).to_double(), + data.get_slicec(',',2).to_double(), + data.get_slicec(',',3).to_double() ); } else if (type=="rect2") { r_v=Rect2( Vector2( - data.get_slice(",",0).to_double(), - data.get_slice(",",1).to_double() + data.get_slicec(',',0).to_double(), + data.get_slicec(',',1).to_double() ), Vector2( - data.get_slice(",",2).to_double(), - data.get_slice(",",3).to_double() + data.get_slicec(',',2).to_double(), + data.get_slicec(',',3).to_double() ) ); @@ -1256,14 +1256,14 @@ Error ResourceInteractiveLoaderXML::parse_property(Variant& r_v, String &r_name) r_v=AABB( Vector3( - data.get_slice(",",0).to_double(), - data.get_slice(",",1).to_double(), - data.get_slice(",",2).to_double() + data.get_slicec(',',0).to_double(), + data.get_slicec(',',1).to_double(), + data.get_slicec(',',2).to_double() ), Vector3( - data.get_slice(",",3).to_double(), - data.get_slice(",",4).to_double(), - data.get_slice(",",5).to_double() + data.get_slicec(',',3).to_double(), + data.get_slicec(',',4).to_double(), + data.get_slicec(',',5).to_double() ) ); @@ -1272,7 +1272,7 @@ Error ResourceInteractiveLoaderXML::parse_property(Variant& r_v, String &r_name) Matrix32 m3; for (int i=0;i<3;i++) { for (int j=0;j<2;j++) { - m3.elements[i][j]=data.get_slice(",",i*2+j).to_double(); + m3.elements[i][j]=data.get_slicec(',',i*2+j).to_double(); } } r_v=m3; @@ -1282,7 +1282,7 @@ Error ResourceInteractiveLoaderXML::parse_property(Variant& r_v, String &r_name) Matrix3 m3; for (int i=0;i<3;i++) { for (int j=0;j<3;j++) { - m3.elements[i][j]=data.get_slice(",",i*3+j).to_double(); + m3.elements[i][j]=data.get_slicec(',',i*3+j).to_double(); } } r_v=m3; @@ -1292,24 +1292,24 @@ Error ResourceInteractiveLoaderXML::parse_property(Variant& r_v, String &r_name) Transform tr; for (int i=0;i<3;i++) { for (int j=0;j<3;j++) { - tr.basis.elements[i][j]=data.get_slice(",",i*3+j).to_double(); + tr.basis.elements[i][j]=data.get_slicec(',',i*3+j).to_double(); } } tr.origin=Vector3( - data.get_slice(",",9).to_double(), - data.get_slice(",",10).to_double(), - data.get_slice(",",11).to_double() + data.get_slicec(',',9).to_double(), + data.get_slicec(',',10).to_double(), + data.get_slicec(',',11).to_double() ); r_v=tr; } else if (type=="color") { r_v=Color( - data.get_slice(",",0).to_double(), - data.get_slice(",",1).to_double(), - data.get_slice(",",2).to_double(), - data.get_slice(",",3).to_double() + data.get_slicec(',',0).to_double(), + data.get_slicec(',',1).to_double(), + data.get_slicec(',',2).to_double(), + data.get_slicec(',',3).to_double() ); } else if (type=="node_path") { @@ -1674,8 +1674,8 @@ void ResourceInteractiveLoaderXML::open(FileAccess *p_f) { ERR_FAIL(); } - int major = version.get_slice(".",0).to_int(); - int minor = version.get_slice(".",1).to_int(); + int major = version.get_slicec('.',0).to_int(); + int minor = version.get_slicec('.',1).to_int(); if (major>VERSION_MAJOR) { @@ -2607,9 +2607,12 @@ Error ResourceFormatSaverXMLInstance::save(const String &p_path,const RES& p_res String name = PE->get().name; Variant value = res->get(name); - if (PE->get().usage&PROPERTY_USAGE_STORE_IF_NONZERO && value.is_zero()) + + + if ((PE->get().usage&PROPERTY_USAGE_STORE_IF_NONZERO && value.is_zero())||(PE->get().usage&PROPERTY_USAGE_STORE_IF_NONONE && value.is_one()) ) continue; + write_property(name,value); } diff --git a/core/method_bind.cpp b/core/method_bind.cpp index 3429e5f0afd..ce573804347 100644 --- a/core/method_bind.cpp +++ b/core/method_bind.cpp @@ -40,8 +40,8 @@ PropertyInfo MethodBind::get_argument_info(int p_argument) const { PropertyInfo pi( get_argument_type(p_argument), name ); if ((pi.type==Variant::OBJECT) && name.find(":")!=-1) { pi.hint=PROPERTY_HINT_RESOURCE_TYPE; - pi.hint_string=name.get_slice(":",1); - pi.name=name.get_slice(":",0); + pi.hint_string=name.get_slicec(':',1); + pi.name=name.get_slicec(':',0); } return pi; diff --git a/core/object.cpp b/core/object.cpp index 6bb7973cef8..07ac430d7ab 100644 --- a/core/object.cpp +++ b/core/object.cpp @@ -258,12 +258,15 @@ bool Object::_predelete() { _predelete_ok=1; notification(NOTIFICATION_PREDELETE,true); + if (_predelete_ok) { + _type_ptr=NULL; //must restore so destructors can access type ptr correctly + } return _predelete_ok; } void Object::_postinitialize() { - + _type_ptr=_get_type_namev(); _initialize_typev(); notification(NOTIFICATION_POSTINITIALIZE); @@ -1707,7 +1710,7 @@ bool Object::is_edited() const { Object::Object() { - + _type_ptr=NULL; _block_signals=false; _predelete_ok=0; _instance_ID=0; diff --git a/core/object.h b/core/object.h index 9680af924a4..eb0e78a8c3d 100644 --- a/core/object.h +++ b/core/object.h @@ -82,7 +82,8 @@ enum PropertyUsageFlags { PROPERTY_USAGE_BUNDLE=128, //used for optimized bundles PROPERTY_USAGE_CATEGORY=256, PROPERTY_USAGE_STORE_IF_NONZERO=512, //only store if nonzero - PROPERTY_USAGE_NO_INSTANCE_STATE=1024, + PROPERTY_USAGE_STORE_IF_NONONE=1024, //only store if false + PROPERTY_USAGE_NO_INSTANCE_STATE=2048, PROPERTY_USAGE_DEFAULT=PROPERTY_USAGE_STORAGE|PROPERTY_USAGE_EDITOR|PROPERTY_USAGE_NETWORK, PROPERTY_USAGE_DEFAULT_INTL=PROPERTY_USAGE_STORAGE|PROPERTY_USAGE_EDITOR|PROPERTY_USAGE_NETWORK|PROPERTY_USAGE_INTERNATIONALIZED, @@ -97,6 +98,8 @@ enum PropertyUsageFlags { #define ADD_PROPERTYI( m_property, m_setter, m_getter, m_index ) ObjectTypeDB::add_property( get_type_static(), m_property, m_setter, m_getter, m_index ) #define ADD_PROPERTYNZ( m_property, m_setter, m_getter ) ObjectTypeDB::add_property( get_type_static(), (m_property).added_usage(PROPERTY_USAGE_STORE_IF_NONZERO), m_setter, m_getter ) #define ADD_PROPERTYINZ( m_property, m_setter, m_getter, m_index ) ObjectTypeDB::add_property( get_type_static(), (m_property).added_usage(PROPERTY_USAGE_STORE_IF_NONZERO), m_setter, m_getter, m_index ) +#define ADD_PROPERTYNO( m_property, m_setter, m_getter ) ObjectTypeDB::add_property( get_type_static(), (m_property).added_usage(PROPERTY_USAGE_STORE_IF_NONONE), m_setter, m_getter ) +#define ADD_PROPERTYINO( m_property, m_setter, m_getter, m_index ) ObjectTypeDB::add_property( get_type_static(), (m_property).added_usage(PROPERTY_USAGE_STORE_IF_NONONE), m_setter, m_getter, m_index ) struct PropertyInfo { @@ -179,10 +182,10 @@ public:\ virtual String get_type() const { \ return String(#m_type);\ }\ -virtual StringName get_type_name() const { \ +virtual const StringName* _get_type_namev() const { \ if (!_type_name)\ _type_name=get_type_static();\ - return _type_name;\ + return &_type_name;\ }\ static _FORCE_INLINE_ void* get_type_ptr_static() { \ static int ptr;\ @@ -388,6 +391,8 @@ friend void postinitialize_handler(Object*); ScriptInstance *script_instance; RefPtr script; Dictionary metadata; + mutable StringName _type_name; + mutable const StringName* _type_ptr; void _add_user_signal(const String& p_name, const Array& p_pargs=Array()); bool _has_user_signal(const StringName& p_name) const; @@ -445,7 +450,11 @@ protected: Variant _call_deferred_bind(const Variant** p_args, int p_argcount, Variant::CallError& r_error); - + virtual const StringName* _get_type_namev() const { + if (!_type_name) + _type_name=get_type_static(); + return &_type_name; + } DVector _get_meta_list_bind() const; Array _get_property_list_bind() const; @@ -523,11 +532,19 @@ public: virtual String get_type() const { return "Object"; } virtual String get_save_type() const { return get_type(); } //type stored when saving - virtual StringName get_type_name() const { return StringName("Object"); } + + + virtual bool is_type(const String& p_type) const { return (p_type=="Object"); } virtual bool is_type_ptr(void *p_ptr) const { return get_type_ptr_static()==p_ptr; } - + _FORCE_INLINE_ const StringName& get_type_name() const { + if (!_type_ptr) { + return *_get_type_namev(); + } else { + return *_type_ptr; + } + } /* IAPI */ // void set(const String& p_name, const Variant& p_value); diff --git a/core/object_type_db.cpp b/core/object_type_db.cpp index a2cae50940a..c2917145737 100644 --- a/core/object_type_db.cpp +++ b/core/object_type_db.cpp @@ -205,7 +205,7 @@ ObjectTypeDB::TypeInfo::~TypeInfo() { } -bool ObjectTypeDB::is_type(const String &p_type,const String& p_inherits) { +bool ObjectTypeDB::is_type(const StringName &p_type,const StringName& p_inherits) { OBJTYPE_LOCK; @@ -220,7 +220,7 @@ bool ObjectTypeDB::is_type(const String &p_type,const String& p_inherits) { return false; } -void ObjectTypeDB::get_type_list( List *p_types) { +void ObjectTypeDB::get_type_list( List *p_types) { OBJTYPE_LOCK; @@ -235,7 +235,7 @@ void ObjectTypeDB::get_type_list( List *p_types) { } -void ObjectTypeDB::get_inheriters_from( const String& p_type,List *p_types) { +void ObjectTypeDB::get_inheriters_from( const StringName& p_type,List *p_types) { OBJTYPE_LOCK; @@ -249,7 +249,7 @@ void ObjectTypeDB::get_inheriters_from( const String& p_type,List *p_typ } -String ObjectTypeDB::type_inherits_from(const String& p_type) { +StringName ObjectTypeDB::type_inherits_from(const StringName& p_type) { OBJTYPE_LOCK; @@ -258,7 +258,7 @@ String ObjectTypeDB::type_inherits_from(const String& p_type) { return ti->inherits; } -bool ObjectTypeDB::type_exists(const String &p_type) { +bool ObjectTypeDB::type_exists(const StringName &p_type) { OBJTYPE_LOCK; return types.has(p_type); @@ -269,7 +269,7 @@ void ObjectTypeDB::add_compatibility_type(const StringName& p_type,const StringN compat_types[p_type]=p_fallback; } -Object *ObjectTypeDB::instance(const String &p_type) { +Object *ObjectTypeDB::instance(const StringName &p_type) { TypeInfo *ti; { @@ -287,7 +287,7 @@ Object *ObjectTypeDB::instance(const String &p_type) { return ti->creation_func(); } -bool ObjectTypeDB::can_instance(const String &p_type) { +bool ObjectTypeDB::can_instance(const StringName &p_type) { OBJTYPE_LOCK; @@ -650,7 +650,13 @@ bool ObjectTypeDB::set_property(Object* p_object,const StringName& p_property, c Variant index=psg->index; const Variant* arg[2]={&index,&p_value}; Variant::CallError ce; - p_object->call(psg->setter,arg,2,ce); +// p_object->call(psg->setter,arg,2,ce); + if (psg->_setptr) { + psg->_setptr->call(p_object,arg,2,ce); + } else { + p_object->call(psg->setter,arg,2,ce); + } + } else { const Variant* arg[1]={&p_value}; diff --git a/core/object_type_db.h b/core/object_type_db.h index 27c15069601..caa5baddd5a 100644 --- a/core/object_type_db.h +++ b/core/object_type_db.h @@ -228,13 +228,13 @@ public: T::register_custom_data_to_otdb(); } - static void get_type_list( List *p_types); - static void get_inheriters_from( const String& p_type,List *p_types); - static String type_inherits_from(const String& p_type); - static bool type_exists(const String &p_type); - static bool is_type(const String &p_type,const String& p_inherits); - static bool can_instance(const String &p_type); - static Object *instance(const String &p_type); + static void get_type_list( List *p_types); + static void get_inheriters_from( const StringName& p_type,List *p_types); + static StringName type_inherits_from(const StringName& p_type); + static bool type_exists(const StringName &p_type); + static bool is_type(const StringName &p_type,const StringName& p_inherits); + static bool can_instance(const StringName &p_type); + static Object *instance(const StringName &p_type); #if 0 template diff --git a/core/script_debugger_local.cpp b/core/script_debugger_local.cpp index 2266b05f6d0..649bbe89f0b 100644 --- a/core/script_debugger_local.cpp +++ b/core/script_debugger_local.cpp @@ -60,7 +60,7 @@ void ScriptDebuggerLocal::debug(ScriptLanguage *p_script,bool p_can_continue) { if (line.get_slice_count(" ")==1) { print_line("*Frame "+itos(current_frame)+" - "+p_script->debug_get_stack_level_source(current_frame)+":"+itos(p_script->debug_get_stack_level_line(current_frame))+" in function '"+p_script->debug_get_stack_level_function(current_frame)+"'"); } else { - int frame = line.get_slice(" ",1).to_int(); + int frame = line.get_slicec(' ',1).to_int(); if (frame<0 || frame >=total_frames) { print_line("Error: Invalid frame."); } else { @@ -108,7 +108,7 @@ void ScriptDebuggerLocal::debug(ScriptLanguage *p_script,bool p_can_continue) { print_line("Usage: print "); } else { - String expr = line.get_slice(" ",2); + String expr = line.get_slicec(' ',2); String res = p_script->debug_parse_stack_level_expression(current_frame,expr); print_line(res); } @@ -130,9 +130,9 @@ void ScriptDebuggerLocal::debug(ScriptLanguage *p_script,bool p_can_continue) { } else { - String bppos=line.get_slice(" ",1); - String source=bppos.get_slice(":",0).strip_edges(); - int line=bppos.get_slice(":",1).strip_edges().to_int(); + String bppos=line.get_slicec(' ',1); + String source=bppos.get_slicec(':',0).strip_edges(); + int line=bppos.get_slicec(':',1).strip_edges().to_int(); source = breakpoint_find_source(source); @@ -147,9 +147,9 @@ void ScriptDebuggerLocal::debug(ScriptLanguage *p_script,bool p_can_continue) { clear_breakpoints(); } else { - String bppos=line.get_slice(" ",1); - String source=bppos.get_slice(":",0).strip_edges(); - int line=bppos.get_slice(":",1).strip_edges().to_int(); + String bppos=line.get_slicec(' ',1); + String source=bppos.get_slicec(':',0).strip_edges(); + int line=bppos.get_slicec(':',1).strip_edges().to_int(); source = breakpoint_find_source(source); diff --git a/core/string_db.cpp b/core/string_db.cpp index 57fdd6e70f9..b48d9f37d40 100644 --- a/core/string_db.cpp +++ b/core/string_db.cpp @@ -158,7 +158,7 @@ void StringName::operator=(const StringName& p_name) { _data = p_name._data; } } - +/* was inlined StringName::operator String() const { if (_data) @@ -166,7 +166,7 @@ StringName::operator String() const { return ""; } - +*/ StringName::StringName(const StringName& p_name) { ERR_FAIL_COND(!configured); diff --git a/core/string_db.h b/core/string_db.h index 912d7513ad9..3b3249bf5e9 100644 --- a/core/string_db.h +++ b/core/string_db.h @@ -114,7 +114,17 @@ public: } bool operator!=(const StringName& p_name) const; - operator String() const; + _FORCE_INLINE_ operator String() const { + + if (_data) { + if (_data->cname ) + return String(_data->cname); + else + return _data->name; + } + + return String(); + } static StringName search(const char *p_name); static StringName search(const CharType *p_name); diff --git a/core/ustring.cpp b/core/ustring.cpp index 5df95ac4c2e..945c841568d 100644 --- a/core/ustring.cpp +++ b/core/ustring.cpp @@ -486,7 +486,7 @@ String String::capitalize() const { String cap; for (int i=0;i0) { slice[0]=_find_upper(slice[0]); @@ -577,6 +577,41 @@ String String::get_slice(String p_splitter, int p_slice) const { } +String String::get_slicec(CharType p_splitter, int p_slice) const { + + if (empty()) + return String(); + + if (p_slice<0) + return String(); + + const CharType *c=this->ptr(); + int i=0; + int prev=0; + int count=0; + while(true) { + + + if (c[i]==0 || c[i]==p_splitter) { + + if (p_slice==count) { + + return substr(prev,i-prev); + } else { + count++; + prev=i+1; + } + + } + + i++; + + } + + return String(); //no find! + +} + Vector String::split_spaces() const { @@ -3333,8 +3368,8 @@ String String::path_to(const String& p_path) const { //nothing } else { //dos style - String src_begin=src.get_slice("/",0); - String dst_begin=dst.get_slice("/",0); + String src_begin=src.get_slicec('/',0); + String dst_begin=dst.get_slicec('/',0); if (src_begin!=dst_begin) return p_path; //impossible to do this diff --git a/core/ustring.h b/core/ustring.h index 53ed319862f..1000c1cc8a9 100644 --- a/core/ustring.h +++ b/core/ustring.h @@ -153,6 +153,7 @@ public: int get_slice_count(String p_splitter) const; String get_slice(String p_splitter,int p_slice) const; + String get_slicec(CharType splitter,int p_slice) const; Vector split(const String &p_splitter,bool p_allow_empty=true) const; Vector split_spaces() const; diff --git a/core/variant.cpp b/core/variant.cpp index 034dc2b4fca..e0bceb4dd8f 100644 --- a/core/variant.cpp +++ b/core/variant.cpp @@ -878,6 +878,63 @@ bool Variant::is_zero() const { return false; } + +bool Variant::is_one() const { + + switch( type ) { + case NIL: { + + return true; + } break; + + // atomic types + case BOOL: { + + return _data._bool==true; + } break; + case INT: { + + return _data._int==1; + + } break; + case REAL: { + + return _data._real==1; + + } break; + case VECTOR2: { + + return *reinterpret_cast(_data._mem)==Vector2(1,1); + + } break; + case RECT2: { + + return *reinterpret_cast(_data._mem)==Rect2(1,1,1,1); + + } break; + case VECTOR3: { + + return *reinterpret_cast(_data._mem)==Vector3(1,1,1); + + } break; + case PLANE: { + + return *reinterpret_cast(_data._mem)==Plane(1,1,1,1); + + } break; + case COLOR: { + + return *reinterpret_cast(_data._mem)==Color(1,1,1,1); + + } break; + + default: { return !is_zero(); } + } + + return false; +} + + void Variant::reference(const Variant& p_variant) { diff --git a/core/variant.h b/core/variant.h index 5f338ef667f..8fd9662c36c 100644 --- a/core/variant.h +++ b/core/variant.h @@ -185,6 +185,7 @@ public: _FORCE_INLINE_ bool is_array() const { return type>=ARRAY; }; bool is_shared() const; bool is_zero() const; + bool is_one() const; operator bool() const; operator signed int() const; diff --git a/core/vector.h b/core/vector.h index b93d9a0deab..d1034006226 100644 --- a/core/vector.h +++ b/core/vector.h @@ -340,12 +340,14 @@ template void Vector::remove(int p_index) { ERR_FAIL_INDEX(p_index, size()); - for (int i=p_index; i diff --git a/main/main.cpp b/main/main.cpp index 15f969f466a..f68bde003ee 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -524,8 +524,8 @@ Error Main::setup(const char *execpath,int argc, char *argv[],bool p_second_phas ScriptDebuggerRemote *sdr = memnew( ScriptDebuggerRemote ); uint16_t debug_port = GLOBAL_DEF("debug/remote_port",6007); if (debug_host.find(":")!=-1) { - debug_port=debug_host.get_slice(":",1).to_int(); - debug_host=debug_host.get_slice(":",0); + debug_port=debug_host.get_slicec(':',1).to_int(); + debug_host=debug_host.get_slicec(':',0); } Error derr = sdr->connect_to_host(debug_host,debug_port); @@ -546,8 +546,8 @@ Error Main::setup(const char *execpath,int argc, char *argv[],bool p_second_phas file_access_network_client=memnew(FileAccessNetworkClient); int port; if (remotefs.find(":")!=-1) { - port=remotefs.get_slice(":",1).to_int(); - remotefs=remotefs.get_slice(":",0); + port=remotefs.get_slicec(':',1).to_int(); + remotefs=remotefs.get_slicec(':',0); } else { port=6010; } @@ -1219,7 +1219,7 @@ bool Main::start() { String s = E->get().name; if (!s.begins_with("autoload/")) continue; - String name = s.get_slice("/",1); + String name = s.get_slicec('/',1); String path = Globals::get_singleton()->get(s); RES res = ResourceLoader::load(path); ERR_EXPLAIN("Can't autoload: "+path); diff --git a/modules/gdscript/gd_script.cpp b/modules/gdscript/gd_script.cpp index b6ad7aa716b..63bb44784d0 100644 --- a/modules/gdscript/gd_script.cpp +++ b/modules/gdscript/gd_script.cpp @@ -2556,9 +2556,9 @@ void GDScriptLanguage::init() { //populate native classes - List class_list; + List class_list; ObjectTypeDB::get_type_list(&class_list); - for(List::Element *E=class_list.front();E;E=E->next()) { + for(List::Element *E=class_list.front();E;E=E->next()) { StringName n = E->get(); String s = String(n); diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp index 121b23001d7..4f0daf329f6 100644 --- a/modules/gridmap/grid_map.cpp +++ b/modules/gridmap/grid_map.cpp @@ -130,8 +130,8 @@ bool GridMap::_set(const StringName& p_name, const Variant& p_value) { } else if (name.begins_with("areas/")) { - int which = name.get_slice("/",1).to_int(); - String what=name.get_slice("/",2); + int which = name.get_slicec('/',1).to_int(); + String what=name.get_slicec('/',2); if (what=="bounds") { ERR_FAIL_COND_V(area_map.has(which),false); create_area(which,p_value); @@ -215,8 +215,8 @@ bool GridMap::_get(const StringName& p_name,Variant &r_ret) const { r_ret= d; } else if (name.begins_with("areas/")) { - int which = name.get_slice("/",1).to_int(); - String what=name.get_slice("/",2); + int which = name.get_slicec('/',1).to_int(); + String what=name.get_slicec('/',2); if (what=="bounds") r_ret= area_get_bounds(which); else if (what=="name") diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp index d169ec51d5a..0f9ce8081f1 100644 --- a/platform/android/export/export.cpp +++ b/platform/android/export/export.cpp @@ -317,7 +317,7 @@ bool EditorExportPlatformAndroid::_set(const StringName& p_name, const Variant& apk_expansion_pkey=p_value; else if (n.begins_with("permissions/")) { - String what = n.get_slice("/",1).to_upper(); + String what = n.get_slicec('/',1).to_upper(); bool state = p_value; if (state) perms.insert(what); @@ -325,7 +325,7 @@ bool EditorExportPlatformAndroid::_set(const StringName& p_name, const Variant& perms.erase(what); } else if (n.begins_with("user_permissions/")) { - int which = n.get_slice("/",1).to_int(); + int which = n.get_slicec('/',1).to_int(); ERR_FAIL_INDEX_V(which,MAX_USER_PERMISSIONS,false); user_perms[which]=p_value; @@ -390,11 +390,11 @@ bool EditorExportPlatformAndroid::_get(const StringName& p_name,Variant &r_ret) r_ret=apk_expansion_pkey; else if (n.begins_with("permissions/")) { - String what = n.get_slice("/",1).to_upper(); + String what = n.get_slicec('/',1).to_upper(); r_ret = perms.has(what); } else if (n.begins_with("user_permissions/")) { - int which = n.get_slice("/",1).to_int(); + int which = n.get_slicec('/',1).to_int(); ERR_FAIL_INDEX_V(which,MAX_USER_PERMISSIONS,false); r_ret=user_perms[which]; } else diff --git a/scene/2d/animated_sprite.cpp b/scene/2d/animated_sprite.cpp index e350a34013c..0b00ac95605 100644 --- a/scene/2d/animated_sprite.cpp +++ b/scene/2d/animated_sprite.cpp @@ -330,11 +330,11 @@ void AnimatedSprite::_bind_methods() { ADD_PROPERTYNZ( PropertyInfo( Variant::OBJECT, "frames",PROPERTY_HINT_RESOURCE_TYPE,"SpriteFrames"), _SCS("set_sprite_frames"),_SCS("get_sprite_frames")); ADD_PROPERTYNZ( PropertyInfo( Variant::INT, "frame",PROPERTY_HINT_SPRITE_FRAME), _SCS("set_frame"),_SCS("get_frame")); - ADD_PROPERTY( PropertyInfo( Variant::BOOL, "centered"), _SCS("set_centered"),_SCS("is_centered")); + ADD_PROPERTYNO( PropertyInfo( Variant::BOOL, "centered"), _SCS("set_centered"),_SCS("is_centered")); ADD_PROPERTYNZ( PropertyInfo( Variant::VECTOR2, "offset"), _SCS("set_offset"),_SCS("get_offset")); - ADD_PROPERTY( PropertyInfo( Variant::BOOL, "flip_h"), _SCS("set_flip_h"),_SCS("is_flipped_h")); - ADD_PROPERTY( PropertyInfo( Variant::BOOL, "flip_v"), _SCS("set_flip_v"),_SCS("is_flipped_v")); - ADD_PROPERTY( PropertyInfo( Variant::COLOR, "modulate"), _SCS("set_modulate"),_SCS("get_modulate")); + ADD_PROPERTYNZ( PropertyInfo( Variant::BOOL, "flip_h"), _SCS("set_flip_h"),_SCS("is_flipped_h")); + ADD_PROPERTYNZ( PropertyInfo( Variant::BOOL, "flip_v"), _SCS("set_flip_v"),_SCS("is_flipped_v")); + ADD_PROPERTYNO( PropertyInfo( Variant::COLOR, "modulate"), _SCS("set_modulate"),_SCS("get_modulate")); } diff --git a/scene/2d/area_2d.cpp b/scene/2d/area_2d.cpp index f9e79e25bcb..c44b46adbfd 100644 --- a/scene/2d/area_2d.cpp +++ b/scene/2d/area_2d.cpp @@ -428,8 +428,9 @@ void Area2D::set_enable_monitoring(bool p_enable) { if (monitoring) { - Physics2DServer::get_singleton()->area_set_monitor_callback(get_rid(),this,"_body_inout"); - Physics2DServer::get_singleton()->area_set_area_monitor_callback(get_rid(),this,"_area_inout"); + Physics2DServer::get_singleton()->area_set_monitor_callback(get_rid(),this,SceneStringNames::get_singleton()->_body_inout); + Physics2DServer::get_singleton()->area_set_area_monitor_callback(get_rid(),this,SceneStringNames::get_singleton()->_area_inout); + } else { Physics2DServer::get_singleton()->area_set_monitor_callback(get_rid(),NULL,StringName()); Physics2DServer::get_singleton()->area_set_area_monitor_callback(get_rid(),NULL,StringName()); @@ -652,17 +653,17 @@ void Area2D::_bind_methods() { ADD_PROPERTYNZ( PropertyInfo(Variant::INT,"space_override",PROPERTY_HINT_ENUM,"Disabled,Combine,Replace"),_SCS("set_space_override_mode"),_SCS("get_space_override_mode")); - ADD_PROPERTY( PropertyInfo(Variant::BOOL,"gravity_point"),_SCS("set_gravity_is_point"),_SCS("is_gravity_a_point")); - ADD_PROPERTY( PropertyInfo(Variant::REAL,"gravity_distance_scale", PROPERTY_HINT_RANGE,"0,1024,0.001"),_SCS("set_gravity_distance_scale"),_SCS("get_gravity_distance_scale")); + ADD_PROPERTYNZ( PropertyInfo(Variant::BOOL,"gravity_point"),_SCS("set_gravity_is_point"),_SCS("is_gravity_a_point")); + ADD_PROPERTYNZ( PropertyInfo(Variant::REAL,"gravity_distance_scale", PROPERTY_HINT_RANGE,"0,1024,0.001"),_SCS("set_gravity_distance_scale"),_SCS("get_gravity_distance_scale")); ADD_PROPERTY( PropertyInfo(Variant::VECTOR2,"gravity_vec"),_SCS("set_gravity_vector"),_SCS("get_gravity_vector")); ADD_PROPERTY( PropertyInfo(Variant::REAL,"gravity",PROPERTY_HINT_RANGE,"-1024,1024,0.01"),_SCS("set_gravity"),_SCS("get_gravity")); ADD_PROPERTY( PropertyInfo(Variant::REAL,"linear_damp",PROPERTY_HINT_RANGE,"0,1024,0.001"),_SCS("set_linear_damp"),_SCS("get_linear_damp")); ADD_PROPERTY( PropertyInfo(Variant::REAL,"angular_damp",PROPERTY_HINT_RANGE,"0,1024,0.001"),_SCS("set_angular_damp"),_SCS("get_angular_damp")); ADD_PROPERTYNZ( PropertyInfo(Variant::INT,"priority",PROPERTY_HINT_RANGE,"0,128,1"),_SCS("set_priority"),_SCS("get_priority")); - ADD_PROPERTY( PropertyInfo(Variant::BOOL,"monitoring"),_SCS("set_enable_monitoring"),_SCS("is_monitoring_enabled")); - ADD_PROPERTY( PropertyInfo(Variant::BOOL,"monitorable"),_SCS("set_monitorable"),_SCS("is_monitorable")); - ADD_PROPERTY( PropertyInfo(Variant::INT,"collision/layers",PROPERTY_HINT_ALL_FLAGS),_SCS("set_layer_mask"),_SCS("get_layer_mask")); - ADD_PROPERTY( PropertyInfo(Variant::INT,"collision/mask",PROPERTY_HINT_ALL_FLAGS),_SCS("set_collision_mask"),_SCS("get_collision_mask")); + ADD_PROPERTYNO( PropertyInfo(Variant::BOOL,"monitoring"),_SCS("set_enable_monitoring"),_SCS("is_monitoring_enabled")); + ADD_PROPERTYNO( PropertyInfo(Variant::BOOL,"monitorable"),_SCS("set_monitorable"),_SCS("is_monitorable")); + ADD_PROPERTYNO( PropertyInfo(Variant::INT,"collision/layers",PROPERTY_HINT_ALL_FLAGS),_SCS("set_layer_mask"),_SCS("get_layer_mask")); + ADD_PROPERTYNO( PropertyInfo(Variant::INT,"collision/mask",PROPERTY_HINT_ALL_FLAGS),_SCS("set_collision_mask"),_SCS("get_collision_mask")); } diff --git a/scene/2d/canvas_item.cpp b/scene/2d/canvas_item.cpp index 6a1ea0728dd..789c6bdbe4a 100644 --- a/scene/2d/canvas_item.cpp +++ b/scene/2d/canvas_item.cpp @@ -1103,14 +1103,14 @@ void CanvasItem::_bind_methods() { BIND_VMETHOD(MethodInfo("_draw")); - ADD_PROPERTY( PropertyInfo(Variant::BOOL,"visibility/visible"), _SCS("_set_visible_"),_SCS("_is_visible_") ); - ADD_PROPERTY( PropertyInfo(Variant::REAL,"visibility/opacity",PROPERTY_HINT_RANGE, "0,1,0.01"), _SCS("set_opacity"),_SCS("get_opacity") ); - ADD_PROPERTY( PropertyInfo(Variant::REAL,"visibility/self_opacity",PROPERTY_HINT_RANGE, "0,1,0.01"), _SCS("set_self_opacity"),_SCS("get_self_opacity") ); + ADD_PROPERTYNO( PropertyInfo(Variant::BOOL,"visibility/visible"), _SCS("_set_visible_"),_SCS("_is_visible_") ); + ADD_PROPERTYNO( PropertyInfo(Variant::REAL,"visibility/opacity",PROPERTY_HINT_RANGE, "0,1,0.01"), _SCS("set_opacity"),_SCS("get_opacity") ); + ADD_PROPERTYNO( PropertyInfo(Variant::REAL,"visibility/self_opacity",PROPERTY_HINT_RANGE, "0,1,0.01"), _SCS("set_self_opacity"),_SCS("get_self_opacity") ); ADD_PROPERTYNZ( PropertyInfo(Variant::BOOL,"visibility/behind_parent"), _SCS("set_draw_behind_parent"),_SCS("is_draw_behind_parent_enabled") ); ADD_PROPERTY( PropertyInfo(Variant::BOOL,"visibility/on_top",PROPERTY_HINT_NONE,"",0), _SCS("_set_on_top"),_SCS("_is_on_top") ); //compatibility ADD_PROPERTYNZ( PropertyInfo(Variant::INT,"visibility/blend_mode",PROPERTY_HINT_ENUM, "Mix,Add,Sub,Mul,PMAlpha"), _SCS("set_blend_mode"),_SCS("get_blend_mode") ); - ADD_PROPERTYNZ( PropertyInfo(Variant::INT,"visibility/light_mask",PROPERTY_HINT_ALL_FLAGS), _SCS("set_light_mask"),_SCS("get_light_mask") ); + ADD_PROPERTYNO( PropertyInfo(Variant::INT,"visibility/light_mask",PROPERTY_HINT_ALL_FLAGS), _SCS("set_light_mask"),_SCS("get_light_mask") ); ADD_PROPERTYNZ( PropertyInfo(Variant::OBJECT,"material/material",PROPERTY_HINT_RESOURCE_TYPE, "CanvasItemMaterial"), _SCS("set_material"),_SCS("get_material") ); ADD_PROPERTYNZ( PropertyInfo(Variant::BOOL,"material/use_parent"), _SCS("set_use_parent_material"),_SCS("get_use_parent_material") ); //exporting these two things doesn't really make much sense i think diff --git a/scene/2d/collision_object_2d.cpp b/scene/2d/collision_object_2d.cpp index f577b815981..8b8caf13d33 100644 --- a/scene/2d/collision_object_2d.cpp +++ b/scene/2d/collision_object_2d.cpp @@ -115,19 +115,16 @@ void CollisionObject2D::_update_shapes() { bool CollisionObject2D::_set(const StringName& p_name, const Variant& p_value) { String name=p_name; - if (name=="shape_count") { + if (name.begins_with("shapes/")) { - shapes.resize(p_value); - _update_shapes(); - _change_notify(); - - } else if (name.begins_with("shapes/")) { - - int idx=name.get_slice("/",1).to_int(); - String what=name.get_slice("/",2); - if (what=="shape") - set_shape(idx,RefPtr(p_value)); - else if (what=="transform") + int idx=name.get_slicec('/',1).to_int(); + String what=name.get_slicec('/',2); + if (what=="shape") { + if (idx>=shapes.size()) + add_shape(RefPtr(p_value)); + else + set_shape(idx,RefPtr(p_value)); + } else if (what=="transform") set_shape_transform(idx,p_value); else if (what=="trigger") set_shape_as_trigger(idx,p_value); @@ -143,12 +140,10 @@ bool CollisionObject2D::_get(const StringName& p_name,Variant &r_ret) const { String name=p_name; - if (name=="shape_count") { - r_ret= shapes.size(); - } else if (name.begins_with("shapes/")) { + if (name.begins_with("shapes/")) { - int idx=name.get_slice("/",1).to_int(); - String what=name.get_slice("/",2); + int idx=name.get_slicec('/',1).to_int(); + String what=name.get_slicec('/',2); if (what=="shape") r_ret= get_shape(idx); else if (what=="transform") @@ -163,7 +158,7 @@ bool CollisionObject2D::_get(const StringName& p_name,Variant &r_ret) const { void CollisionObject2D::_get_property_list( List *p_list) const { - p_list->push_back( PropertyInfo(Variant::INT,"shape_count",PROPERTY_HINT_RANGE,"0,256,1",PROPERTY_USAGE_NOEDITOR|PROPERTY_USAGE_NO_INSTANCE_STATE) ); + //p_list->push_back( PropertyInfo(Variant::INT,"shape_count",PROPERTY_HINT_RANGE,"0,256,1",PROPERTY_USAGE_NOEDITOR|PROPERTY_USAGE_NO_INSTANCE_STATE) ); for(int i=0;i& p_shape, const Matrix32& p_transform) { + ERR_FAIL_COND(p_shape.is_null()); + ShapeData sdata; sdata.shape=p_shape; sdata.xform=p_transform; sdata.trigger=false; - shapes.push_back(sdata); - _update_shapes(); + + if (area) + Physics2DServer::get_singleton()->area_add_shape(get_rid(),p_shape->get_rid(),p_transform); + else + Physics2DServer::get_singleton()->body_add_shape(get_rid(),p_shape->get_rid(),p_transform); + + shapes.push_back(sdata); } int CollisionObject2D::get_shape_count() const { @@ -270,8 +272,15 @@ int CollisionObject2D::get_shape_count() const { void CollisionObject2D::set_shape(int p_shape_idx, const Ref& p_shape) { ERR_FAIL_INDEX(p_shape_idx,shapes.size()); + ERR_FAIL_COND(p_shape.is_null()); + shapes[p_shape_idx].shape=p_shape; - _update_shapes(); + if (area) + Physics2DServer::get_singleton()->area_set_shape(get_rid(),p_shape_idx,p_shape->get_rid()); + else + Physics2DServer::get_singleton()->body_set_shape(get_rid(),p_shape_idx,p_shape->get_rid()); + +// _update_shapes(); } void CollisionObject2D::set_shape_transform(int p_shape_idx, const Matrix32& p_transform) { @@ -279,7 +288,12 @@ void CollisionObject2D::set_shape_transform(int p_shape_idx, const Matrix32& p_t ERR_FAIL_INDEX(p_shape_idx,shapes.size()); shapes[p_shape_idx].xform=p_transform; - _update_shapes(); + if (area) + Physics2DServer::get_singleton()->area_set_shape_transform(get_rid(),p_shape_idx,p_transform); + else + Physics2DServer::get_singleton()->body_set_shape_transform(get_rid(),p_shape_idx,p_transform); + +// _update_shapes(); } Ref CollisionObject2D::get_shape(int p_shape_idx) const { diff --git a/scene/2d/node_2d.cpp b/scene/2d/node_2d.cpp index 99c33c787d2..6141b6a09e2 100644 --- a/scene/2d/node_2d.cpp +++ b/scene/2d/node_2d.cpp @@ -398,11 +398,11 @@ void Node2D::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_relative_transform"),&Node2D::get_relative_transform); - ADD_PROPERTY(PropertyInfo(Variant::VECTOR2,"transform/pos"),_SCS("set_pos"),_SCS("get_pos")); - ADD_PROPERTY(PropertyInfo(Variant::REAL,"transform/rot",PROPERTY_HINT_RANGE,"-1440,1440,0.1"),_SCS("_set_rotd"),_SCS("_get_rotd")); - ADD_PROPERTY(PropertyInfo(Variant::VECTOR2,"transform/scale"),_SCS("set_scale"),_SCS("get_scale")); - ADD_PROPERTY(PropertyInfo(Variant::INT,"z/z",PROPERTY_HINT_RANGE,itos(VS::CANVAS_ITEM_Z_MIN)+","+itos(VS::CANVAS_ITEM_Z_MAX)+",1"),_SCS("set_z"),_SCS("get_z")); - ADD_PROPERTY(PropertyInfo(Variant::BOOL,"z/relative"),_SCS("set_z_as_relative"),_SCS("is_z_relative")); + ADD_PROPERTYNZ(PropertyInfo(Variant::VECTOR2,"transform/pos"),_SCS("set_pos"),_SCS("get_pos")); + ADD_PROPERTYNZ(PropertyInfo(Variant::REAL,"transform/rot",PROPERTY_HINT_RANGE,"-1440,1440,0.1"),_SCS("_set_rotd"),_SCS("_get_rotd")); + ADD_PROPERTYNO(PropertyInfo(Variant::VECTOR2,"transform/scale"),_SCS("set_scale"),_SCS("get_scale")); + ADD_PROPERTYNZ(PropertyInfo(Variant::INT,"z/z",PROPERTY_HINT_RANGE,itos(VS::CANVAS_ITEM_Z_MIN)+","+itos(VS::CANVAS_ITEM_Z_MAX)+",1"),_SCS("set_z"),_SCS("get_z")); + ADD_PROPERTYNO(PropertyInfo(Variant::BOOL,"z/relative"),_SCS("set_z_as_relative"),_SCS("is_z_relative")); } diff --git a/scene/2d/particles_2d.cpp b/scene/2d/particles_2d.cpp index f0b7c2be600..8f805ceba29 100644 --- a/scene/2d/particles_2d.cpp +++ b/scene/2d/particles_2d.cpp @@ -1072,19 +1072,19 @@ void Particles2D::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT,"config/amount",PROPERTY_HINT_EXP_RANGE,"1,1024"),_SCS("set_amount"),_SCS("get_amount") ); ADD_PROPERTY(PropertyInfo(Variant::REAL,"config/lifetime",PROPERTY_HINT_EXP_RANGE,"0.1,3600,0.1"),_SCS("set_lifetime"),_SCS("get_lifetime") ); - ADD_PROPERTY(PropertyInfo(Variant::REAL,"config/time_scale",PROPERTY_HINT_EXP_RANGE,"0.01,128,0.01"),_SCS("set_time_scale"),_SCS("get_time_scale") ); - ADD_PROPERTY(PropertyInfo(Variant::REAL,"config/preprocess",PROPERTY_HINT_EXP_RANGE,"0.1,3600,0.1"),_SCS("set_pre_process_time"),_SCS("get_pre_process_time") ); - ADD_PROPERTY(PropertyInfo(Variant::REAL,"config/emit_timeout",PROPERTY_HINT_RANGE,"0,3600,0.1"),_SCS("set_emit_timeout"),_SCS("get_emit_timeout") ); - ADD_PROPERTY(PropertyInfo(Variant::BOOL,"config/emitting"),_SCS("set_emitting"),_SCS("is_emitting") ); - ADD_PROPERTY(PropertyInfo(Variant::VECTOR2,"config/offset"),_SCS("set_emissor_offset"),_SCS("get_emissor_offset")); - ADD_PROPERTY(PropertyInfo(Variant::VECTOR2,"config/half_extents"),_SCS("set_emission_half_extents"),_SCS("get_emission_half_extents")); - ADD_PROPERTY(PropertyInfo(Variant::BOOL,"config/local_space"),_SCS("set_use_local_space"),_SCS("is_using_local_space")); - ADD_PROPERTY(PropertyInfo(Variant::REAL,"config/explosiveness",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_explosiveness"),_SCS("get_explosiveness")); - ADD_PROPERTY(PropertyInfo(Variant::BOOL,"config/flip_h"),_SCS("set_flip_h"),_SCS("is_flipped_h")); - ADD_PROPERTY(PropertyInfo(Variant::BOOL,"config/flip_v"),_SCS("set_flip_v"),_SCS("is_flipped_v")); - ADD_PROPERTY(PropertyInfo(Variant::OBJECT,"config/texture",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture")); - ADD_PROPERTY(PropertyInfo(Variant::INT,"config/h_frames",PROPERTY_HINT_RANGE,"1,512,1"),_SCS("set_h_frames"),_SCS("get_h_frames")); - ADD_PROPERTY(PropertyInfo(Variant::INT,"config/v_frames",PROPERTY_HINT_RANGE,"1,512,1"),_SCS("set_v_frames"),_SCS("get_v_frames")); + ADD_PROPERTYNO(PropertyInfo(Variant::REAL,"config/time_scale",PROPERTY_HINT_EXP_RANGE,"0.01,128,0.01"),_SCS("set_time_scale"),_SCS("get_time_scale") ); + ADD_PROPERTYNZ(PropertyInfo(Variant::REAL,"config/preprocess",PROPERTY_HINT_EXP_RANGE,"0.1,3600,0.1"),_SCS("set_pre_process_time"),_SCS("get_pre_process_time") ); + ADD_PROPERTYNZ(PropertyInfo(Variant::REAL,"config/emit_timeout",PROPERTY_HINT_RANGE,"0,3600,0.1"),_SCS("set_emit_timeout"),_SCS("get_emit_timeout") ); + ADD_PROPERTYNO(PropertyInfo(Variant::BOOL,"config/emitting"),_SCS("set_emitting"),_SCS("is_emitting") ); + ADD_PROPERTYNZ(PropertyInfo(Variant::VECTOR2,"config/offset"),_SCS("set_emissor_offset"),_SCS("get_emissor_offset")); + ADD_PROPERTYNZ(PropertyInfo(Variant::VECTOR2,"config/half_extents"),_SCS("set_emission_half_extents"),_SCS("get_emission_half_extents")); + ADD_PROPERTYNO(PropertyInfo(Variant::BOOL,"config/local_space"),_SCS("set_use_local_space"),_SCS("is_using_local_space")); + ADD_PROPERTYNO(PropertyInfo(Variant::REAL,"config/explosiveness",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_explosiveness"),_SCS("get_explosiveness")); + ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL,"config/flip_h"),_SCS("set_flip_h"),_SCS("is_flipped_h")); + ADD_PROPERTYNZ(PropertyInfo(Variant::BOOL,"config/flip_v"),_SCS("set_flip_v"),_SCS("is_flipped_v")); + ADD_PROPERTYNZ(PropertyInfo(Variant::OBJECT,"config/texture",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture")); + ADD_PROPERTYNO(PropertyInfo(Variant::INT,"config/h_frames",PROPERTY_HINT_RANGE,"1,512,1"),_SCS("set_h_frames"),_SCS("get_h_frames")); + ADD_PROPERTYNO(PropertyInfo(Variant::INT,"config/v_frames",PROPERTY_HINT_RANGE,"1,512,1"),_SCS("set_v_frames"),_SCS("get_v_frames")); for(int i=0;i& p_texture) { if (p_texture==texture) return; +#ifdef DEBUG_ENABLED if (texture.is_valid()) { texture->disconnect(CoreStringNames::get_singleton()->changed,this,SceneStringNames::get_singleton()->update); } +#endif texture=p_texture; +#ifdef DEBUG_ENABLED if (texture.is_valid()) { texture->set_flags(texture->get_flags()); //remove repeat from texture, it looks bad in sprites texture->connect(CoreStringNames::get_singleton()->changed,this,SceneStringNames::get_singleton()->update); } +#endif update(); item_rect_changed(); } @@ -313,17 +317,17 @@ void Sprite::_bind_methods() { ADD_SIGNAL(MethodInfo("frame_changed")); - ADD_PROPERTY( PropertyInfo( Variant::OBJECT, "texture", PROPERTY_HINT_RESOURCE_TYPE,"Texture"), _SCS("set_texture"),_SCS("get_texture")); - ADD_PROPERTY( PropertyInfo( Variant::BOOL, "centered"), _SCS("set_centered"),_SCS("is_centered")); - ADD_PROPERTY( PropertyInfo( Variant::VECTOR2, "offset"), _SCS("set_offset"),_SCS("get_offset")); - ADD_PROPERTY( PropertyInfo( Variant::BOOL, "flip_h"), _SCS("set_flip_h"),_SCS("is_flipped_h")); - ADD_PROPERTY( PropertyInfo( Variant::BOOL, "flip_v"), _SCS("set_flip_v"),_SCS("is_flipped_v")); - ADD_PROPERTY( PropertyInfo( Variant::INT, "vframes"), _SCS("set_vframes"),_SCS("get_vframes")); - ADD_PROPERTY( PropertyInfo( Variant::INT, "hframes"), _SCS("set_hframes"),_SCS("get_hframes")); - ADD_PROPERTY( PropertyInfo( Variant::INT, "frame",PROPERTY_HINT_SPRITE_FRAME), _SCS("set_frame"),_SCS("get_frame")); - ADD_PROPERTY( PropertyInfo( Variant::COLOR, "modulate"), _SCS("set_modulate"),_SCS("get_modulate")); - ADD_PROPERTY( PropertyInfo( Variant::BOOL, "region"), _SCS("set_region"),_SCS("is_region")); - ADD_PROPERTY( PropertyInfo( Variant::RECT2, "region_rect"), _SCS("set_region_rect"),_SCS("get_region_rect")); + ADD_PROPERTYNZ( PropertyInfo( Variant::OBJECT, "texture", PROPERTY_HINT_RESOURCE_TYPE,"Texture"), _SCS("set_texture"),_SCS("get_texture")); + ADD_PROPERTYNO( PropertyInfo( Variant::BOOL, "centered"), _SCS("set_centered"),_SCS("is_centered")); + ADD_PROPERTYNZ( PropertyInfo( Variant::VECTOR2, "offset"), _SCS("set_offset"),_SCS("get_offset")); + ADD_PROPERTYNZ( PropertyInfo( Variant::BOOL, "flip_h"), _SCS("set_flip_h"),_SCS("is_flipped_h")); + ADD_PROPERTYNZ( PropertyInfo( Variant::BOOL, "flip_v"), _SCS("set_flip_v"),_SCS("is_flipped_v")); + ADD_PROPERTYNO( PropertyInfo( Variant::INT, "vframes"), _SCS("set_vframes"),_SCS("get_vframes")); + ADD_PROPERTYNO( PropertyInfo( Variant::INT, "hframes"), _SCS("set_hframes"),_SCS("get_hframes")); + ADD_PROPERTYNZ( PropertyInfo( Variant::INT, "frame",PROPERTY_HINT_SPRITE_FRAME), _SCS("set_frame"),_SCS("get_frame")); + ADD_PROPERTYNO( PropertyInfo( Variant::COLOR, "modulate"), _SCS("set_modulate"),_SCS("get_modulate")); + ADD_PROPERTYNZ( PropertyInfo( Variant::BOOL, "region"), _SCS("set_region"),_SCS("is_region")); + ADD_PROPERTYNZ( PropertyInfo( Variant::RECT2, "region_rect"), _SCS("set_region_rect"),_SCS("get_region_rect")); } @@ -530,10 +534,10 @@ void ViewportSprite::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_modulate","modulate"),&ViewportSprite::set_modulate); ObjectTypeDB::bind_method(_MD("get_modulate"),&ViewportSprite::get_modulate); - ADD_PROPERTY( PropertyInfo( Variant::NODE_PATH, "viewport"), _SCS("set_viewport_path"),_SCS("get_viewport_path")); - ADD_PROPERTY( PropertyInfo( Variant::BOOL, "centered"), _SCS("set_centered"),_SCS("is_centered")); - ADD_PROPERTY( PropertyInfo( Variant::VECTOR2, "offset"), _SCS("set_offset"),_SCS("get_offset")); - ADD_PROPERTY( PropertyInfo( Variant::COLOR, "modulate"), _SCS("set_modulate"),_SCS("get_modulate")); + ADD_PROPERTYNZ( PropertyInfo( Variant::NODE_PATH, "viewport"), _SCS("set_viewport_path"),_SCS("get_viewport_path")); + ADD_PROPERTYNO( PropertyInfo( Variant::BOOL, "centered"), _SCS("set_centered"),_SCS("is_centered")); + ADD_PROPERTYNZ( PropertyInfo( Variant::VECTOR2, "offset"), _SCS("set_offset"),_SCS("get_offset")); + ADD_PROPERTYNO( PropertyInfo( Variant::COLOR, "modulate"), _SCS("set_modulate"),_SCS("get_modulate")); } diff --git a/scene/3d/area.cpp b/scene/3d/area.cpp index a00946a07a5..58cbbdba22a 100644 --- a/scene/3d/area.cpp +++ b/scene/3d/area.cpp @@ -299,8 +299,8 @@ void Area::set_enable_monitoring(bool p_enable) { if (monitoring) { - PhysicsServer::get_singleton()->area_set_monitor_callback(get_rid(),this,"_body_inout"); - PhysicsServer::get_singleton()->area_set_area_monitor_callback(get_rid(),this,"_area_inout"); + PhysicsServer::get_singleton()->area_set_monitor_callback(get_rid(),this,SceneStringNames::get_singleton()->_body_inout); + PhysicsServer::get_singleton()->area_set_area_monitor_callback(get_rid(),this,SceneStringNames::get_singleton()->_area_inout); } else { PhysicsServer::get_singleton()->area_set_monitor_callback(get_rid(),NULL,StringName()); PhysicsServer::get_singleton()->area_set_area_monitor_callback(get_rid(),NULL,StringName()); diff --git a/scene/3d/collision_object.cpp b/scene/3d/collision_object.cpp index efc5db50e1e..5ecadb48b82 100644 --- a/scene/3d/collision_object.cpp +++ b/scene/3d/collision_object.cpp @@ -122,8 +122,8 @@ bool CollisionObject::_set(const StringName& p_name, const Variant& p_value) { } else if (name.begins_with("shapes/")) { - int idx=name.get_slice("/",1).to_int(); - String what=name.get_slice("/",2); + int idx=name.get_slicec('/',1).to_int(); + String what=name.get_slicec('/',2); if (what=="shape") set_shape(idx,RefPtr(p_value)); else if (what=="transform") @@ -148,8 +148,8 @@ bool CollisionObject::_get(const StringName& p_name,Variant &r_ret) const { r_ret= shapes.size(); } else if (name.begins_with("shapes/")) { - int idx=name.get_slice("/",1).to_int(); - String what=name.get_slice("/",2); + int idx=name.get_slicec('/',1).to_int(); + String what=name.get_slicec('/',2); if (what=="shape") r_ret= get_shape(idx); else if (what=="transform") diff --git a/scene/3d/skeleton.cpp b/scene/3d/skeleton.cpp index ee1b28a8ae6..9df29f70ec0 100644 --- a/scene/3d/skeleton.cpp +++ b/scene/3d/skeleton.cpp @@ -41,8 +41,8 @@ bool Skeleton::_set(const StringName& p_path, const Variant& p_value) { if (!path.begins_with("bones/")) return false; - int which=path.get_slice("/",1).to_int(); - String what=path.get_slice("/",2); + int which=path.get_slicec('/',1).to_int(); + String what=path.get_slicec('/',2); if (which==bones.size() && what=="name") { @@ -88,8 +88,8 @@ bool Skeleton::_get(const StringName& p_name,Variant &r_ret) const { if (!path.begins_with("bones/")) return false; - int which=path.get_slice("/",1).to_int(); - String what=path.get_slice("/",2); + int which=path.get_slicec('/',1).to_int(); + String what=path.get_slicec('/',2); ERR_FAIL_INDEX_V( which, bones.size(), false ); diff --git a/scene/3d/spatial.cpp b/scene/3d/spatial.cpp index c672d0e94f2..7117c591767 100644 --- a/scene/3d/spatial.cpp +++ b/scene/3d/spatial.cpp @@ -758,7 +758,7 @@ void Spatial::_bind_methods() { ADD_PROPERTY( PropertyInfo(Variant::VECTOR3,"transform/rotation",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_EDITOR), _SCS("_set_rotation_deg"), _SCS("_get_rotation_deg") ); ADD_PROPERTY( PropertyInfo(Variant::VECTOR3,"transform/rotation_rad",PROPERTY_HINT_NONE,"",0), _SCS("set_rotation"), _SCS("get_rotation") ); ADD_PROPERTY( PropertyInfo(Variant::VECTOR3,"transform/scale",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_EDITOR), _SCS("set_scale"), _SCS("get_scale") ); - ADD_PROPERTY( PropertyInfo(Variant::BOOL,"visibility/visible"), _SCS("_set_visible_"), _SCS("_is_visible_") ); + ADD_PROPERTYNO( PropertyInfo(Variant::BOOL,"visibility/visible"), _SCS("_set_visible_"), _SCS("_is_visible_") ); //ADD_PROPERTY( PropertyInfo(Variant::TRANSFORM,"transform/local"), _SCS("set_transform"), _SCS("get_transform") ); ADD_SIGNAL( MethodInfo("visibility_changed" ) ); diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp index 74ae2c0d559..f8b58b5cb59 100644 --- a/scene/animation/animation_player.cpp +++ b/scene/animation/animation_player.cpp @@ -35,10 +35,10 @@ bool AnimationPlayer::_set(const StringName& p_name, const Variant& p_value) { String name=p_name; - if (name=="playback/speed" || name=="speed") { //bw compatibility + if (p_name==SceneStringNames::get_singleton()->playback_speed || p_name==SceneStringNames::get_singleton()->speed) { //bw compatibility set_speed(p_value); - } else if (name=="playback/active") { + } else if (p_name==SceneStringNames::get_singleton()->playback_active) { set_active(p_value); } else if (name.begins_with("playback/play")) { @@ -52,16 +52,16 @@ bool AnimationPlayer::_set(const StringName& p_name, const Variant& p_value) { } else if (name.begins_with("anims/")) { - String which=name.get_slice("/",1); + String which=name.get_slicec('/',1); add_animation(which,p_value); } else if (name.begins_with("next/")) { - String which=name.get_slice("/",1); + String which=name.get_slicec('/',1); animation_set_next(which,p_value); - } else if (name=="blend_times") { + } else if (p_name==SceneStringNames::get_singleton()->blend_times) { Array array=p_value; int len = array.size(); @@ -77,7 +77,7 @@ bool AnimationPlayer::_set(const StringName& p_name, const Variant& p_value) { set_blend_time(from,to,time); } - } else if (name=="autoplay") { + } else if (p_name==SceneStringNames::get_singleton()->autoplay) { autoplay=p_value; } else @@ -106,12 +106,12 @@ bool AnimationPlayer::_get(const StringName& p_name,Variant &r_ret) const { } else if (name.begins_with("anims/")) { - String which=name.get_slice("/",1); + String which=name.get_slicec('/',1); r_ret= get_animation(which).get_ref_ptr(); } else if (name.begins_with("next/")) { - String which=name.get_slice("/",1); + String which=name.get_slicec('/',1); r_ret= animation_get_next(which); @@ -661,8 +661,11 @@ void AnimationPlayer::_animation_process(float p_delta) { Error AnimationPlayer::add_animation(const StringName& p_name, const Ref& p_animation) { +#ifdef DEBUG_ENABLED ERR_EXPLAIN("Invalid animation name: "+String(p_name)); ERR_FAIL_COND_V( String(p_name).find("/")!=-1 || String(p_name).find(":")!=-1 || String(p_name).find(",")!=-1 || String(p_name).find("[")!=-1, ERR_INVALID_PARAMETER ); +#endif + ERR_FAIL_COND_V( p_animation.is_null() , ERR_INVALID_PARAMETER ); //print_line("Add anim: "+String(p_name)+" name: "+p_animation->get_name()); @@ -1271,7 +1274,7 @@ AnimationPlayer::AnimationPlayer() { animation_process_mode=ANIMATION_PROCESS_IDLE; processing=false; default_blend_time=0; - root=NodePath(".."); + root=SceneStringNames::get_singleton()->path_pp; playing = false; active=true; } diff --git a/scene/audio/sample_player.cpp b/scene/audio/sample_player.cpp index 25e83df39d1..b93f7e7dddb 100644 --- a/scene/audio/sample_player.cpp +++ b/scene/audio/sample_player.cpp @@ -102,7 +102,7 @@ bool SamplePlayer::_get(const StringName& p_name,Variant &r_ret) const { r_ret= get_sample_library(); } else if (name.begins_with("default/")) { - String what=name.get_slice("/",1); + String what=name.get_slicec('/',1); if (what=="volume_db") r_ret= get_default_volume_db(); diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp index 8b6f433c9c2..965e7f399dd 100644 --- a/scene/gui/base_button.cpp +++ b/scene/gui/base_button.cpp @@ -390,10 +390,10 @@ void BaseButton::_bind_methods() { ADD_SIGNAL( MethodInfo("pressed" ) ); ADD_SIGNAL( MethodInfo("released" ) ); ADD_SIGNAL( MethodInfo("toggled", PropertyInfo( Variant::BOOL,"pressed") ) ); - ADD_PROPERTY( PropertyInfo( Variant::BOOL, "disabled"), _SCS("set_disabled"), _SCS("is_disabled")); + ADD_PROPERTYNZ( PropertyInfo( Variant::BOOL, "disabled"), _SCS("set_disabled"), _SCS("is_disabled")); ADD_PROPERTY( PropertyInfo( Variant::BOOL, "toggle_mode"), _SCS("set_toggle_mode"), _SCS("is_toggle_mode")); - ADD_PROPERTY( PropertyInfo( Variant::BOOL, "is_pressed"), _SCS("set_pressed"), _SCS("is_pressed")); - ADD_PROPERTY( PropertyInfo( Variant::BOOL, "click_on_press"), _SCS("set_click_on_press"), _SCS("get_click_on_press")); + ADD_PROPERTYNZ( PropertyInfo( Variant::BOOL, "is_pressed"), _SCS("set_pressed"), _SCS("is_pressed")); + ADD_PROPERTYNZ( PropertyInfo( Variant::BOOL, "click_on_press"), _SCS("set_click_on_press"), _SCS("get_click_on_press")); BIND_CONSTANT( DRAW_NORMAL ); diff --git a/scene/gui/button.cpp b/scene/gui/button.cpp index b465db5c80a..edeb18bfc1b 100644 --- a/scene/gui/button.cpp +++ b/scene/gui/button.cpp @@ -225,11 +225,11 @@ void Button::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_text_align"),&Button::get_text_align); ObjectTypeDB::bind_method(_MD("is_flat"),&Button::is_flat); - ADD_PROPERTY( PropertyInfo( Variant::STRING, "text", PROPERTY_HINT_NONE,"",PROPERTY_USAGE_DEFAULT_INTL ), _SCS("set_text"),_SCS("get_text") ); - ADD_PROPERTY( PropertyInfo( Variant::OBJECT, "icon", PROPERTY_HINT_RESOURCE_TYPE, "Texture" ), _SCS("set_button_icon"),_SCS("get_button_icon") ); + ADD_PROPERTYNZ( PropertyInfo( Variant::STRING, "text", PROPERTY_HINT_NONE,"",PROPERTY_USAGE_DEFAULT_INTL ), _SCS("set_text"),_SCS("get_text") ); + ADD_PROPERTYNZ( PropertyInfo( Variant::OBJECT, "icon", PROPERTY_HINT_RESOURCE_TYPE, "Texture" ), _SCS("set_button_icon"),_SCS("get_button_icon") ); ADD_PROPERTY( PropertyInfo( Variant::BOOL, "flat" ), _SCS("set_flat"),_SCS("is_flat") ); - ADD_PROPERTY( PropertyInfo( Variant::BOOL, "clip_text" ), _SCS("set_clip_text"),_SCS("get_clip_text") ); - ADD_PROPERTY( PropertyInfo( Variant::INT, "align",PROPERTY_HINT_ENUM,"Left,Center,Right" ), _SCS("set_text_align"),_SCS("get_text_align") ); + ADD_PROPERTYNZ( PropertyInfo( Variant::BOOL, "clip_text" ), _SCS("set_clip_text"),_SCS("get_clip_text") ); + ADD_PROPERTYNO( PropertyInfo( Variant::INT, "align",PROPERTY_HINT_ENUM,"Left,Center,Right" ), _SCS("set_text_align"),_SCS("get_text_align") ); } diff --git a/scene/gui/button_array.cpp b/scene/gui/button_array.cpp index 7f565de244b..b86e32dda75 100644 --- a/scene/gui/button_array.cpp +++ b/scene/gui/button_array.cpp @@ -34,7 +34,7 @@ bool ButtonArray::_set(const StringName& p_name, const Variant& p_value) { String n=String(p_name); if (n.begins_with("button/")) { - String what = n.get_slice("/",1); + String what = n.get_slicec('/',1); if (what=="count") { int new_size=p_value; if (new_size>0 && buttons.size()==0) { @@ -57,7 +57,7 @@ bool ButtonArray::_set(const StringName& p_name, const Variant& p_value) { } else { int idx=what.to_int(); ERR_FAIL_INDEX_V(idx,buttons.size(),false); - String f = n.get_slice("/",2); + String f = n.get_slicec('/',2); if (f=="text") buttons[idx].text=p_value; else if (f=="icon") @@ -80,7 +80,7 @@ bool ButtonArray::_get(const StringName& p_name,Variant &r_ret) const { String n=String(p_name); if (n.begins_with("button/")) { - String what = n.get_slice("/",1); + String what = n.get_slicec('/',1); if (what=="count") { r_ret=buttons.size(); } else if (what=="align") { @@ -92,7 +92,7 @@ bool ButtonArray::_get(const StringName& p_name,Variant &r_ret) const { } else { int idx=what.to_int(); ERR_FAIL_INDEX_V(idx,buttons.size(),false); - String f = n.get_slice("/",2); + String f = n.get_slicec('/',2); if (f=="text") r_ret=buttons[idx].text; else if (f=="icon") diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index 2367c03e994..a1c06446502 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -136,27 +136,27 @@ bool Control::_set(const StringName& p_name, const Variant& p_value) { if (p_value.get_type()==Variant::NIL) { if (name.begins_with("custom_icons/")) { - String dname = name.get_slice("/",1); + String dname = name.get_slicec('/',1); data.icon_override.erase(dname); notification(NOTIFICATION_THEME_CHANGED); update(); } else if (name.begins_with("custom_styles/")) { - String dname = name.get_slice("/",1); + String dname = name.get_slicec('/',1); data.style_override.erase(dname); notification(NOTIFICATION_THEME_CHANGED); update(); } else if (name.begins_with("custom_fonts/")) { - String dname = name.get_slice("/",1); + String dname = name.get_slicec('/',1); data.font_override.erase(dname); notification(NOTIFICATION_THEME_CHANGED); update(); } else if (name.begins_with("custom_colors/")) { - String dname = name.get_slice("/",1); + String dname = name.get_slicec('/',1); data.color_override.erase(dname); notification(NOTIFICATION_THEME_CHANGED); update(); } else if (name.begins_with("custom_constants/")) { - String dname = name.get_slice("/",1); + String dname = name.get_slicec('/',1); data.constant_override.erase(dname); notification(NOTIFICATION_THEME_CHANGED); update(); @@ -165,23 +165,23 @@ bool Control::_set(const StringName& p_name, const Variant& p_value) { } else { if (name.begins_with("custom_icons/")) { - String dname = name.get_slice("/",1); + String dname = name.get_slicec('/',1); notification(NOTIFICATION_THEME_CHANGED); add_icon_override(dname,p_value); } else if (name.begins_with("custom_styles/")) { - String dname = name.get_slice("/",1); + String dname = name.get_slicec('/',1); add_style_override(dname,p_value); notification(NOTIFICATION_THEME_CHANGED); } else if (name.begins_with("custom_fonts/")) { - String dname = name.get_slice("/",1); + String dname = name.get_slicec('/',1); add_font_override(dname,p_value); notification(NOTIFICATION_THEME_CHANGED); } else if (name.begins_with("custom_colors/")) { - String dname = name.get_slice("/",1); + String dname = name.get_slicec('/',1); add_color_override(dname,p_value); notification(NOTIFICATION_THEME_CHANGED); } else if (name.begins_with("custom_constants/")) { - String dname = name.get_slice("/",1); + String dname = name.get_slicec('/',1); add_constant_override(dname,p_value); notification(NOTIFICATION_THEME_CHANGED); } else @@ -217,22 +217,22 @@ bool Control::_get(const StringName& p_name,Variant &r_ret) const { return false; if (sname.begins_with("custom_icons/")) { - String name = sname.get_slice("/",1); + String name = sname.get_slicec('/',1); r_ret= data.icon_override.has(name)?Variant(data.icon_override[name]):Variant(); } else if (sname.begins_with("custom_styles/")) { - String name = sname.get_slice("/",1); + String name = sname.get_slicec('/',1); r_ret= data.style_override.has(name)?Variant(data.style_override[name]):Variant(); } else if (sname.begins_with("custom_fonts/")) { - String name = sname.get_slice("/",1); + String name = sname.get_slicec('/',1); r_ret= data.font_override.has(name)?Variant(data.font_override[name]):Variant(); } else if (sname.begins_with("custom_colors/")) { - String name = sname.get_slice("/",1); + String name = sname.get_slicec('/',1); r_ret= data.color_override.has(name)?Variant(data.color_override[name]):Variant(); } else if (sname.begins_with("custom_constants/")) { - String name = sname.get_slice("/",1); + String name = sname.get_slicec('/',1); r_ret= data.constant_override.has(name)?Variant(data.constant_override[name]):Variant(); } else @@ -2832,16 +2832,16 @@ void Control::_bind_methods() { ADD_PROPERTYNZ( PropertyInfo(Variant::VECTOR2,"rect/size", PROPERTY_HINT_NONE, "",PROPERTY_USAGE_EDITOR), _SCS("set_size"),_SCS("get_size") ); ADD_PROPERTYNZ( PropertyInfo(Variant::VECTOR2,"rect/min_size"), _SCS("set_custom_minimum_size"),_SCS("get_custom_minimum_size") ); ADD_PROPERTYNZ( PropertyInfo(Variant::STRING,"hint/tooltip", PROPERTY_HINT_MULTILINE_TEXT), _SCS("set_tooltip"),_SCS("_get_tooltip") ); - ADD_PROPERTYI( PropertyInfo(Variant::NODE_PATH,"focus_neighbour/left" ), _SCS("set_focus_neighbour"),_SCS("get_focus_neighbour"),MARGIN_LEFT ); - ADD_PROPERTYI( PropertyInfo(Variant::NODE_PATH,"focus_neighbour/top" ), _SCS("set_focus_neighbour"),_SCS("get_focus_neighbour"),MARGIN_TOP ); - ADD_PROPERTYI( PropertyInfo(Variant::NODE_PATH,"focus_neighbour/right" ), _SCS("set_focus_neighbour"),_SCS("get_focus_neighbour"),MARGIN_RIGHT ); - ADD_PROPERTYI( PropertyInfo(Variant::NODE_PATH,"focus_neighbour/bottom" ), _SCS("set_focus_neighbour"),_SCS("get_focus_neighbour"),MARGIN_BOTTOM ); + ADD_PROPERTYINZ( PropertyInfo(Variant::NODE_PATH,"focus_neighbour/left" ), _SCS("set_focus_neighbour"),_SCS("get_focus_neighbour"),MARGIN_LEFT ); + ADD_PROPERTYINZ( PropertyInfo(Variant::NODE_PATH,"focus_neighbour/top" ), _SCS("set_focus_neighbour"),_SCS("get_focus_neighbour"),MARGIN_TOP ); + ADD_PROPERTYINZ( PropertyInfo(Variant::NODE_PATH,"focus_neighbour/right" ), _SCS("set_focus_neighbour"),_SCS("get_focus_neighbour"),MARGIN_RIGHT ); + ADD_PROPERTYINZ( PropertyInfo(Variant::NODE_PATH,"focus_neighbour/bottom" ), _SCS("set_focus_neighbour"),_SCS("get_focus_neighbour"),MARGIN_BOTTOM ); ADD_PROPERTY( PropertyInfo(Variant::BOOL,"focus/ignore_mouse"), _SCS("set_ignore_mouse"),_SCS("is_ignoring_mouse") ); ADD_PROPERTY( PropertyInfo(Variant::BOOL,"focus/stop_mouse"), _SCS("set_stop_mouse"),_SCS("is_stopping_mouse") ); ADD_PROPERTYNZ( PropertyInfo(Variant::INT,"size_flags/horizontal", PROPERTY_HINT_FLAGS, "Expand,Fill"), _SCS("set_h_size_flags"),_SCS("get_h_size_flags") ); ADD_PROPERTYNZ( PropertyInfo(Variant::INT,"size_flags/vertical", PROPERTY_HINT_FLAGS, "Expand,Fill"), _SCS("set_v_size_flags"),_SCS("get_v_size_flags") ); - ADD_PROPERTY( PropertyInfo(Variant::INT,"size_flags/stretch_ratio", PROPERTY_HINT_RANGE, "1,128,0.01"), _SCS("set_stretch_ratio"),_SCS("get_stretch_ratio") ); + ADD_PROPERTYNO( PropertyInfo(Variant::INT,"size_flags/stretch_ratio", PROPERTY_HINT_RANGE, "1,128,0.01"), _SCS("set_stretch_ratio"),_SCS("get_stretch_ratio") ); ADD_PROPERTYNZ( PropertyInfo(Variant::OBJECT,"theme/theme", PROPERTY_HINT_RESOURCE_TYPE, "Theme"), _SCS("set_theme"),_SCS("get_theme") ); BIND_CONSTANT( ANCHOR_BEGIN ); diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp index 27d0f568a2d..e7af4fa3490 100644 --- a/scene/gui/label.cpp +++ b/scene/gui/label.cpp @@ -613,11 +613,11 @@ void Label::_bind_methods() { BIND_CONSTANT( VALIGN_BOTTOM ); BIND_CONSTANT( VALIGN_FILL ); - ADD_PROPERTY( PropertyInfo( Variant::STRING, "text",PROPERTY_HINT_MULTILINE_TEXT,"",PROPERTY_USAGE_DEFAULT_INTL), _SCS("set_text"),_SCS("get_text") ); - ADD_PROPERTY( PropertyInfo( Variant::INT, "align", PROPERTY_HINT_ENUM,"Left,Center,Right,Fill" ),_SCS("set_align"),_SCS("get_align") ); - ADD_PROPERTY( PropertyInfo( Variant::INT, "valign", PROPERTY_HINT_ENUM,"Top,Center,Bottom,Fill" ),_SCS("set_valign"),_SCS("get_valign") ); - ADD_PROPERTY( PropertyInfo( Variant::BOOL, "autowrap"),_SCS("set_autowrap"),_SCS("has_autowrap") ); - ADD_PROPERTY( PropertyInfo( Variant::BOOL, "uppercase"),_SCS("set_uppercase"),_SCS("is_uppercase") ); + ADD_PROPERTYNZ( PropertyInfo( Variant::STRING, "text",PROPERTY_HINT_MULTILINE_TEXT,"",PROPERTY_USAGE_DEFAULT_INTL), _SCS("set_text"),_SCS("get_text") ); + ADD_PROPERTYNZ( PropertyInfo( Variant::INT, "align", PROPERTY_HINT_ENUM,"Left,Center,Right,Fill" ),_SCS("set_align"),_SCS("get_align") ); + ADD_PROPERTYNZ( PropertyInfo( Variant::INT, "valign", PROPERTY_HINT_ENUM,"Top,Center,Bottom,Fill" ),_SCS("set_valign"),_SCS("get_valign") ); + ADD_PROPERTYNZ( PropertyInfo( Variant::BOOL, "autowrap"),_SCS("set_autowrap"),_SCS("has_autowrap") ); + ADD_PROPERTYNZ( PropertyInfo( Variant::BOOL, "uppercase"),_SCS("set_uppercase"),_SCS("is_uppercase") ); ADD_PROPERTY( PropertyInfo( Variant::REAL, "percent_visible", PROPERTY_HINT_RANGE,"0,1,0.001"),_SCS("set_percent_visible"),_SCS("get_percent_visible") ); } diff --git a/scene/gui/texture_button.cpp b/scene/gui/texture_button.cpp index 823fd55c6e6..5b2caecb5bb 100644 --- a/scene/gui/texture_button.cpp +++ b/scene/gui/texture_button.cpp @@ -157,14 +157,14 @@ void TextureButton::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_scale"),&TextureButton::get_scale); ObjectTypeDB::bind_method(_MD("get_modulate"),&TextureButton::get_modulate); - ADD_PROPERTY(PropertyInfo(Variant::OBJECT,"textures/normal",PROPERTY_HINT_RESOURCE_TYPE,"Texture"), _SCS("set_normal_texture"), _SCS("get_normal_texture")); - ADD_PROPERTY(PropertyInfo(Variant::OBJECT,"textures/pressed",PROPERTY_HINT_RESOURCE_TYPE,"Texture"), _SCS("set_pressed_texture"), _SCS("get_pressed_texture")); - ADD_PROPERTY(PropertyInfo(Variant::OBJECT,"textures/hover",PROPERTY_HINT_RESOURCE_TYPE,"Texture"), _SCS("set_hover_texture"), _SCS("get_hover_texture")); - ADD_PROPERTY(PropertyInfo(Variant::OBJECT,"textures/disabled",PROPERTY_HINT_RESOURCE_TYPE,"Texture"), _SCS("set_disabled_texture"), _SCS("get_disabled_texture")); - ADD_PROPERTY(PropertyInfo(Variant::OBJECT,"textures/focused",PROPERTY_HINT_RESOURCE_TYPE,"Texture"), _SCS("set_focused_texture"), _SCS("get_focused_texture")); - ADD_PROPERTY(PropertyInfo(Variant::OBJECT,"textures/click_mask",PROPERTY_HINT_RESOURCE_TYPE,"BitMap"), _SCS("set_click_mask"), _SCS("get_click_mask")) ; - ADD_PROPERTY(PropertyInfo(Variant::VECTOR2,"params/scale",PROPERTY_HINT_RANGE,"0.01,1024,0.01"), _SCS("set_scale"), _SCS("get_scale")); - ADD_PROPERTY(PropertyInfo(Variant::COLOR,"params/modulate"), _SCS("set_modulate"), _SCS("get_modulate")); + ADD_PROPERTYNZ(PropertyInfo(Variant::OBJECT,"textures/normal",PROPERTY_HINT_RESOURCE_TYPE,"Texture"), _SCS("set_normal_texture"), _SCS("get_normal_texture")); + ADD_PROPERTYNZ(PropertyInfo(Variant::OBJECT,"textures/pressed",PROPERTY_HINT_RESOURCE_TYPE,"Texture"), _SCS("set_pressed_texture"), _SCS("get_pressed_texture")); + ADD_PROPERTYNZ(PropertyInfo(Variant::OBJECT,"textures/hover",PROPERTY_HINT_RESOURCE_TYPE,"Texture"), _SCS("set_hover_texture"), _SCS("get_hover_texture")); + ADD_PROPERTYNZ(PropertyInfo(Variant::OBJECT,"textures/disabled",PROPERTY_HINT_RESOURCE_TYPE,"Texture"), _SCS("set_disabled_texture"), _SCS("get_disabled_texture")); + ADD_PROPERTYNZ(PropertyInfo(Variant::OBJECT,"textures/focused",PROPERTY_HINT_RESOURCE_TYPE,"Texture"), _SCS("set_focused_texture"), _SCS("get_focused_texture")); + ADD_PROPERTYNZ(PropertyInfo(Variant::OBJECT,"textures/click_mask",PROPERTY_HINT_RESOURCE_TYPE,"BitMap"), _SCS("set_click_mask"), _SCS("get_click_mask")) ; + ADD_PROPERTYNO(PropertyInfo(Variant::VECTOR2,"params/scale",PROPERTY_HINT_RANGE,"0.01,1024,0.01"), _SCS("set_scale"), _SCS("get_scale")); + ADD_PROPERTYNO(PropertyInfo(Variant::COLOR,"params/modulate"), _SCS("set_modulate"), _SCS("get_modulate")); } diff --git a/scene/gui/texture_frame.cpp b/scene/gui/texture_frame.cpp index 931fb1cb1a2..5a6bc866385 100644 --- a/scene/gui/texture_frame.cpp +++ b/scene/gui/texture_frame.cpp @@ -77,9 +77,9 @@ void TextureFrame::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_expand","enable"), & TextureFrame::set_expand ); ObjectTypeDB::bind_method(_MD("has_expand"), & TextureFrame::has_expand ); - ADD_PROPERTY( PropertyInfo( Variant::OBJECT, "texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture"), _SCS("set_texture"),_SCS("get_texture") ); - ADD_PROPERTY( PropertyInfo( Variant::COLOR, "modulate"), _SCS("set_modulate"),_SCS("get_modulate") ); - ADD_PROPERTY( PropertyInfo( Variant::BOOL, "expand" ), _SCS("set_expand"),_SCS("has_expand") ); + ADD_PROPERTYNZ( PropertyInfo( Variant::OBJECT, "texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture"), _SCS("set_texture"),_SCS("get_texture") ); + ADD_PROPERTYNO( PropertyInfo( Variant::COLOR, "modulate"), _SCS("set_modulate"),_SCS("get_modulate") ); + ADD_PROPERTYNZ( PropertyInfo( Variant::BOOL, "expand" ), _SCS("set_expand"),_SCS("has_expand") ); } diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index a09920cb2b1..6c15f1cae4f 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -1106,7 +1106,7 @@ int Tree::draw_item(const Point2i& p_pos,const Point2& p_draw_ofs, const Size2& int option = (int)p_item->cells[i].val; String s = p_item->cells[i].text; - s=s.get_slice(",",option); + s=s.get_slicec(',',option); Ref downarrow = cache.select_arrow; @@ -1527,7 +1527,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos,int x_ofs,int y_ofs,bool p_ popup_menu->clear(); for (int i=0;iadd_item(s,i); } @@ -2234,7 +2234,7 @@ bool Tree::edit_selected() { popup_menu->clear(); for (int i=0;iadd_item(s,i); } diff --git a/scene/main/node.cpp b/scene/main/node.cpp index b7fa5c8301c..7e31bf8dd07 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -1891,7 +1891,7 @@ void Node::_bind_methods() { #ifdef TOOLS_ENABLED ObjectTypeDB::bind_method(_MD("_set_import_path","import_path"),&Node::set_import_path); ObjectTypeDB::bind_method(_MD("_get_import_path"),&Node::get_import_path); - ADD_PROPERTY( PropertyInfo(Variant::NODE_PATH,"_import_path",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("_set_import_path"),_SCS("_get_import_path")); + ADD_PROPERTYNZ( PropertyInfo(Variant::NODE_PATH,"_import_path",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("_set_import_path"),_SCS("_get_import_path")); #endif diff --git a/scene/resources/animation.cpp b/scene/resources/animation.cpp index 095406dad98..9d668a57162 100644 --- a/scene/resources/animation.cpp +++ b/scene/resources/animation.cpp @@ -42,8 +42,8 @@ bool Animation::_set(const StringName& p_name, const Variant& p_value) { set_step(p_value); else if (name.begins_with("tracks/")) { - int track=name.get_slice("/",1).to_int(); - String what=name.get_slice("/",2); + int track=name.get_slicec('/',1).to_int(); + String what=name.get_slicec('/',2); if (tracks.size()==track && what=="type") { @@ -257,8 +257,8 @@ bool Animation::_get(const StringName& p_name,Variant &r_ret) const { r_ret= step; else if (name.begins_with("tracks/")) { - int track=name.get_slice("/",1).to_int(); - String what=name.get_slice("/",2); + int track=name.get_slicec('/',1).to_int(); + String what=name.get_slicec('/',2); ERR_FAIL_INDEX_V( track, tracks.size(), false ); if (what=="type") { diff --git a/scene/resources/baked_light.cpp b/scene/resources/baked_light.cpp index 226edec9ae2..31282a02742 100644 --- a/scene/resources/baked_light.cpp +++ b/scene/resources/baked_light.cpp @@ -311,11 +311,11 @@ bool BakedLight::_set(const StringName& p_name, const Variant& p_value) { String n = p_name; if (!n.begins_with("lightmap")) return false; - int idx = n.get_slice("/",1).to_int(); + int idx = n.get_slicec('/',1).to_int(); ERR_FAIL_COND_V(idx<0,false); ERR_FAIL_COND_V(idx>lightmaps.size(),false); - String what = n.get_slice("/",2); + String what = n.get_slicec('/',2); Ref tex; Size2 gens; @@ -343,11 +343,11 @@ bool BakedLight::_get(const StringName& p_name,Variant &r_ret) const{ String n = p_name; if (!n.begins_with("lightmap")) return false; - int idx = n.get_slice("/",1).to_int(); + int idx = n.get_slicec('/',1).to_int(); ERR_FAIL_COND_V(idx<0,false); ERR_FAIL_COND_V(idx>lightmaps.size(),false); - String what = n.get_slice("/",2); + String what = n.get_slicec('/',2); if (what=="texture") { if (idx==lightmaps.size()) diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp index 039a4788d54..8cb0904415e 100644 --- a/scene/resources/mesh.cpp +++ b/scene/resources/mesh.cpp @@ -99,7 +99,7 @@ bool Mesh::_set(const StringName& p_name, const Variant& p_value) { if (sl==-1) return false; int idx=sname.substr(8,sl-8).to_int()-1; - String what = sname.get_slice("/",1); + String what = sname.get_slicec('/',1); if (what=="material") surface_set_material(idx,p_value); else if (what=="name") @@ -117,8 +117,8 @@ bool Mesh::_set(const StringName& p_name, const Variant& p_value) { return false; - int idx=sname.get_slice("/",1).to_int(); - String what=sname.get_slice("/",2); + int idx=sname.get_slicec('/',1).to_int(); + String what=sname.get_slicec('/',2); if (idx==surfaces.size()) { @@ -180,7 +180,7 @@ bool Mesh::_get(const StringName& p_name,Variant &r_ret) const { if (sl==-1) return false; int idx=sname.substr(8,sl-8).to_int()-1; - String what = sname.get_slice("/",1); + String what = sname.get_slicec('/',1); if (what=="material") r_ret=surface_get_material(idx); else if (what=="name") @@ -195,7 +195,7 @@ bool Mesh::_get(const StringName& p_name,Variant &r_ret) const { return false; - int idx=sname.get_slice("/",1).to_int(); + int idx=sname.get_slicec('/',1).to_int(); ERR_FAIL_INDEX_V(idx,surfaces.size(),false); Dictionary d; diff --git a/scene/resources/mesh_library.cpp b/scene/resources/mesh_library.cpp index ffa29572ffa..5ebab9be769 100644 --- a/scene/resources/mesh_library.cpp +++ b/scene/resources/mesh_library.cpp @@ -35,8 +35,8 @@ bool MeshLibrary::_set(const StringName& p_name, const Variant& p_value) { String name=p_name; if (name.begins_with("item/")) { - int idx = name.get_slice("/",1).to_int(); - String what = name.get_slice("/",2); + int idx = name.get_slicec('/',1).to_int(); + String what = name.get_slicec('/',2); if (!item_map.has(idx)) create_item(idx); @@ -60,9 +60,9 @@ bool MeshLibrary::_set(const StringName& p_name, const Variant& p_value) { bool MeshLibrary::_get(const StringName& p_name,Variant &r_ret) const { String name=p_name; - int idx = name.get_slice("/",1).to_int(); + int idx = name.get_slicec('/',1).to_int(); ERR_FAIL_COND_V(!item_map.has(idx),false); - String what = name.get_slice("/",2); + String what = name.get_slicec('/',2); if(what=="name") r_ret= get_item_name(idx); diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp index a1cb1205e5c..b6082c3a761 100644 --- a/scene/resources/packed_scene.cpp +++ b/scene/resources/packed_scene.cpp @@ -53,7 +53,7 @@ Node *PackedScene::instance(bool p_gen_edit_state) const { if (prop_count) props=&variants[0]; - Vector properties; + //Vector properties; const NodeData *nd = &nodes[0]; @@ -257,10 +257,13 @@ Error PackedScene::_parse_node(Node *p_owner,Node *p_node,int p_parent_idx, Map< String name = E->get().name; Variant value = p_node->get( E->get().name ); - if (E->get().usage & PROPERTY_USAGE_STORE_IF_NONZERO && value.is_zero()) { + if (nd.instance<0 && ((E->get().usage & PROPERTY_USAGE_STORE_IF_NONZERO) && value.is_zero()) || ((E->get().usage & PROPERTY_USAGE_STORE_IF_NONONE) && value.is_one())) { continue; } + print_line("PASSED!"); + print_line("at: "+String(p_node->get_name())+"::"+name+": - nz: "+itos(E->get().usage&PROPERTY_USAGE_STORE_IF_NONZERO)+" no: "+itos(E->get().usage&PROPERTY_USAGE_STORE_IF_NONONE)); + print_line("value: "+String(value)+" is zero: "+itos(value.is_zero())+" is one" +itos(value.is_one())); if (nd.instance>=0) { //only save changed properties in instance @@ -278,7 +281,7 @@ Error PackedScene::_parse_node(Node *p_owner,Node *p_node,int p_parent_idx, Map< continue; } - if (instance_state[name]==value) { + if (instance_state.has(name) && instance_state[name]==value) { continue; } diff --git a/scene/resources/sample_library.cpp b/scene/resources/sample_library.cpp index 6bb9bc0d061..ffcaa1e6753 100644 --- a/scene/resources/sample_library.cpp +++ b/scene/resources/sample_library.cpp @@ -34,7 +34,7 @@ bool SampleLibrary::_set(const StringName& p_name, const Variant& p_value) { if (String(p_name).begins_with("samples/")) { - String name=String(p_name).get_slice("/",1); + String name=String(p_name).get_slicec('/',1); if (p_value.get_type()==Variant::NIL) sample_map.erase(name); else { @@ -66,7 +66,7 @@ bool SampleLibrary::_get(const StringName& p_name,Variant &r_ret) const { if (String(p_name).begins_with("samples/")) { - String name=String(p_name).get_slice("/",1); + String name=String(p_name).get_slicec('/',1); if(sample_map.has(name)) { Dictionary d; d["sample"]=sample_map[name].sample; diff --git a/scene/resources/theme.cpp b/scene/resources/theme.cpp index 21bdb6c0ab9..3060fe41b41 100644 --- a/scene/resources/theme.cpp +++ b/scene/resources/theme.cpp @@ -40,9 +40,9 @@ bool Theme::_set(const StringName& p_name, const Variant& p_value) { if (sname.find("/")!=-1) { - String type=sname.get_slice("/",1); - String node_type=sname.get_slice("/",0); - String name=sname.get_slice("/",2); + String type=sname.get_slicec('/',1); + String node_type=sname.get_slicec('/',0); + String name=sname.get_slicec('/',2); if (type=="icons") { @@ -75,9 +75,9 @@ bool Theme::_get(const StringName& p_name,Variant &r_ret) const { if (sname.find("/")!=-1) { - String type=sname.get_slice("/",1); - String node_type=sname.get_slice("/",0); - String name=sname.get_slice("/",2); + String type=sname.get_slicec('/',1); + String node_type=sname.get_slicec('/',0); + String name=sname.get_slicec('/',2); if (type=="icons") { diff --git a/scene/scene_string_names.cpp b/scene/scene_string_names.cpp index 2689c147187..9509878dc93 100644 --- a/scene/scene_string_names.cpp +++ b/scene/scene_string_names.cpp @@ -68,6 +68,8 @@ SceneStringNames::SceneStringNames() { area_enter_shape = StaticCString::create("area_enter_shape"); area_exit_shape = StaticCString::create("area_exit_shape"); + _body_inout = StaticCString::create("_body_inout"); + _area_inout = StaticCString::create("_area_inout"); idle=StaticCString::create("idle"); iteration=StaticCString::create("iteration"); @@ -161,4 +163,11 @@ SceneStringNames::SceneStringNames() { frame_changed=StaticCString::create("frame_changed"); + playback_speed=StaticCString::create("playback/speed"); + playback_active=StaticCString::create("playback/active"); + autoplay=StaticCString::create("autoplay"); + blend_times=StaticCString::create("blend_times"); + speed=StaticCString::create("speed"); + + path_pp=NodePath(".."); } diff --git a/scene/scene_string_names.h b/scene/scene_string_names.h index 83e817dbf75..48f17ed38b3 100644 --- a/scene/scene_string_names.h +++ b/scene/scene_string_names.h @@ -30,7 +30,7 @@ #define SCENE_STRING_NAMES_H #include "string_db.h" - +#include "path_db.h" class SceneStringNames { friend void register_scene_types(); @@ -87,6 +87,8 @@ public: StringName area_enter_shape; StringName area_exit_shape; + StringName _body_inout; + StringName _area_inout; StringName _get_gizmo_geometry; @@ -170,6 +172,14 @@ public: StringName frame_changed; + StringName playback_speed; + StringName playback_active; + StringName autoplay; + StringName blend_times; + StringName speed; + + NodePath path_pp; + }; diff --git a/tools/collada/collada.cpp b/tools/collada/collada.cpp index b7ec5c9d045..deec5f60c73 100644 --- a/tools/collada/collada.cpp +++ b/tools/collada/collada.cpp @@ -2054,8 +2054,8 @@ void Collada::_parse_animation(XMLParser& parser) { } if (target.find("/")!=-1) { //transform component - track.target=target.get_slice("/",0); - track.param=target.get_slice("/",1); + track.target=target.get_slicec('/',0); + track.param=target.get_slicec('/',1); if (track.param.find(".")!=-1) track.component=track.param.get_slice(".",1).to_upper(); track.param=track.param.get_slice(".",0); diff --git a/tools/doc/doc_data.cpp b/tools/doc/doc_data.cpp index b3eb6b08f78..08697ab72d5 100644 --- a/tools/doc/doc_data.cpp +++ b/tools/doc/doc_data.cpp @@ -137,9 +137,9 @@ void DocData::merge_from(const DocData& p_data) { void DocData::generate(bool p_basic_types) { - List classes; + List classes; ObjectTypeDB::get_type_list(&classes); - classes.sort(); + classes.sort_custom(); while(classes.size()) { @@ -547,7 +547,7 @@ void DocData::generate(bool p_basic_types) { Globals::Singleton &s=E->get(); pd.name=s.name; pd.type=s.ptr->get_type(); - while (ObjectTypeDB::type_inherits_from(pd.type)!="Object") + while (String(ObjectTypeDB::type_inherits_from(pd.type))!="Object") pd.type=ObjectTypeDB::type_inherits_from(pd.type); if (pd.type.begins_with("_")) pd.type=pd.type.substr(1,pd.type.length()); diff --git a/tools/docdump/doc_dump.cpp b/tools/docdump/doc_dump.cpp index 17aff3dc740..5f108ee9c8c 100644 --- a/tools/docdump/doc_dump.cpp +++ b/tools/docdump/doc_dump.cpp @@ -76,10 +76,10 @@ static String _escape_string(const String& p_str) { void DocDump::dump(const String& p_file) { - List class_list; + List class_list; ObjectTypeDB::get_type_list(&class_list); - class_list.sort(); + class_list.sort_custom(); FileAccess *f = FileAccess::open(p_file,FileAccess::WRITE); diff --git a/tools/editor/create_dialog.cpp b/tools/editor/create_dialog.cpp index c0f35a4ac2b..a9119349c81 100644 --- a/tools/editor/create_dialog.cpp +++ b/tools/editor/create_dialog.cpp @@ -128,7 +128,7 @@ void CreateDialog::_update_search() { _parse_fs(EditorFileSystem::get_singleton()->get_filesystem()); */ - List type_list; + List type_list; ObjectTypeDB::get_type_list(&type_list); HashMap types; @@ -137,7 +137,7 @@ void CreateDialog::_update_search() { root->set_text(0,base_type); - List::Element *I=type_list.front(); + List::Element *I=type_list.front(); TreeItem *to_select=NULL; for(;I;I=I->next()) { diff --git a/tools/editor/editor_help.cpp b/tools/editor/editor_help.cpp index 25fc526bf96..213c18e1b0f 100644 --- a/tools/editor/editor_help.cpp +++ b/tools/editor/editor_help.cpp @@ -79,7 +79,7 @@ void EditorHelpSearch::_update_search() { _parse_fs(EditorFileSystem::get_singleton()->get_filesystem()); */ - List type_list; + List type_list; ObjectTypeDB::get_type_list(&type_list); DocData *doc=EditorHelp::get_doc_data(); @@ -1241,13 +1241,13 @@ void EditorHelp::_update_doc() { class_list->clear(); - List type_list; + List type_list; tree_item_map.clear(); TreeItem *root = class_list->create_item(); class_list->set_hide_root(true); - List::Element *I=type_list.front(); + List::Element *I=type_list.front(); for(Map::Element *E=doc->class_list.front();E;E=E->next()) { diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp index b15abf80965..3ef240e74cf 100644 --- a/tools/editor/plugins/script_editor_plugin.cpp +++ b/tools/editor/plugins/script_editor_plugin.cpp @@ -321,10 +321,10 @@ void ScriptTextEditor::_load_theme_settings() { //colorize engine types Color type_color= EDITOR_DEF("text_editor/engine_type_color",Color(0.0,0.2,0.4)); - List types; + List types; ObjectTypeDB::get_type_list(&types); - for(List::Element *E=types.front();E;E=E->next()) { + for(List::Element *E=types.front();E;E=E->next()) { get_text_edit()->add_keyword_color(E->get(),type_color); } diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp index 2fa8b98ff1f..955c426d2b2 100644 --- a/tools/editor/property_editor.cpp +++ b/tools/editor/property_editor.cpp @@ -614,9 +614,9 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty Set valid_inheritors; valid_inheritors.insert(base); - List inheritors; + List inheritors; ObjectTypeDB::get_inheriters_from(base.strip_edges(),&inheritors); - List::Element *E=inheritors.front(); + List::Element *E=inheritors.front(); while(E) { valid_inheritors.insert(E->get()); E=E->next();