summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/array.cpp31
-rw-r--r--core/array.h2
-rw-r--r--core/io/http_client.h2
-rw-r--r--core/object.cpp18
-rw-r--r--core/object.h1
-rw-r--r--core/resource.cpp1
-rw-r--r--core/variant_call.cpp4
7 files changed, 58 insertions, 1 deletions
diff --git a/core/array.cpp b/core/array.cpp
index fef0fcbb40..1d283a14aa 100644
--- a/core/array.cpp
+++ b/core/array.cpp
@@ -155,6 +155,37 @@ int Array::find(const Variant& p_value) const {
return _p->array.find(p_value);
}
+int Array::find_last(const Variant& p_value) const {
+
+ if(_p->array.size() == 0)
+ return -1;
+
+ for (int i=_p->array.size()-1; i>=0; i--) {
+
+ if(_p->array[i] == p_value){
+ return i;
+ };
+ };
+
+ return -1;
+}
+
+int Array::count(const Variant& p_value) const {
+
+ if(_p->array.size() == 0)
+ return 0;
+
+ int amount=0;
+ for (int i=0; i<_p->array.size(); i++) {
+
+ if(_p->array[i] == p_value){
+ amount++;
+ };
+ };
+
+ return amount;
+}
+
void Array::remove(int p_pos) {
_p->array.remove(p_pos);
diff --git a/core/array.h b/core/array.h
index ecb91b69dc..9472a6dd21 100644
--- a/core/array.h
+++ b/core/array.h
@@ -72,6 +72,8 @@ public:
void invert();
int find(const Variant& p_value) const;
+ int find_last(const Variant& p_value) const;
+ int count(const Variant& p_value) const;
void erase(const Variant& p_value);
diff --git a/core/io/http_client.h b/core/io/http_client.h
index a9cfb1ed73..ceb0273a7d 100644
--- a/core/io/http_client.h
+++ b/core/io/http_client.h
@@ -40,7 +40,7 @@ class HTTPClient : public Reference {
OBJ_TYPE(HTTPClient,Reference);
public:
- enum RespondeCode {
+ enum ResponseCode {
// 1xx informational
RESPONSE_CONTINUE = 100,
diff --git a/core/object.cpp b/core/object.cpp
index d7878fd623..bedab63281 100644
--- a/core/object.cpp
+++ b/core/object.cpp
@@ -1383,6 +1383,24 @@ void Object::get_signal_connection_list(const StringName& p_signal,List<Connecti
}
+bool Object::has_persistent_signal_connections() const {
+
+ const StringName *S=NULL;
+
+ while((S=signal_map.next(S))) {
+
+ const Signal *s=&signal_map[*S];
+
+ for(int i=0;i<s->slot_map.size();i++) {
+
+ if (s->slot_map.getv(i).conn.flags&CONNECT_PERSIST)
+ return true;
+ }
+ }
+
+ return false;
+}
+
Error Object::connect(const StringName& p_signal, Object *p_to_object, const StringName& p_to_method,const Vector<Variant>& p_binds,uint32_t p_flags) {
diff --git a/core/object.h b/core/object.h
index f4a2472e88..e886aa3459 100644
--- a/core/object.h
+++ b/core/object.h
@@ -604,6 +604,7 @@ public:
void get_signal_list(List<MethodInfo> *p_signals ) const;
void get_signal_connection_list(const StringName& p_signal,List<Connection> *p_connections) const;
void get_all_signal_connections(List<Connection> *p_connections) const;
+ bool has_persistent_signal_connections() const;
Error connect(const StringName& p_signal, Object *p_to_object, const StringName& p_to_method,const Vector<Variant>& p_binds=Vector<Variant>(),uint32_t p_flags=0);
void disconnect(const StringName& p_signal, Object *p_to_object, const StringName& p_to_method);
diff --git a/core/resource.cpp b/core/resource.cpp
index b7a5bad4b8..97dee3e1d7 100644
--- a/core/resource.cpp
+++ b/core/resource.cpp
@@ -133,6 +133,7 @@ void ResourceImportMetadata::_bind_methods() {
ObjectTypeDB::bind_method(_MD("add_source","path","md5"),&ResourceImportMetadata::add_source, "");
ObjectTypeDB::bind_method(_MD("get_source_path","idx"),&ResourceImportMetadata::get_source_path);
ObjectTypeDB::bind_method(_MD("get_source_md5","idx"),&ResourceImportMetadata::get_source_md5);
+ ObjectTypeDB::bind_method(_MD("set_source_md5","idx", "md5"),&ResourceImportMetadata::set_source_md5);
ObjectTypeDB::bind_method(_MD("remove_source","idx"),&ResourceImportMetadata::remove_source);
ObjectTypeDB::bind_method(_MD("get_source_count"),&ResourceImportMetadata::get_source_count);
ObjectTypeDB::bind_method(_MD("set_option","key","value"),&ResourceImportMetadata::set_option);
diff --git a/core/variant_call.cpp b/core/variant_call.cpp
index 4be763a511..f5dcd75691 100644
--- a/core/variant_call.cpp
+++ b/core/variant_call.cpp
@@ -463,6 +463,8 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var
VCALL_LOCALMEM2(Array,insert);
VCALL_LOCALMEM1(Array,remove);
VCALL_LOCALMEM1R(Array,find);
+ VCALL_LOCALMEM1R(Array,find_last);
+ VCALL_LOCALMEM1R(Array,count);
VCALL_LOCALMEM1(Array,erase);
VCALL_LOCALMEM0(Array,sort);
VCALL_LOCALMEM2(Array,sort_custom);
@@ -1448,6 +1450,8 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl
ADDFUNC1(ARRAY,NIL,Array,remove,INT,"pos",varray());
ADDFUNC1(ARRAY,NIL,Array,erase,NIL,"value",varray());
ADDFUNC1(ARRAY,INT,Array,find,NIL,"value",varray());
+ ADDFUNC1(ARRAY,INT,Array,find_last,NIL,"value",varray());
+ ADDFUNC1(ARRAY,INT,Array,count,NIL,"value",varray());
ADDFUNC0(ARRAY,NIL,Array,pop_back,varray());
ADDFUNC0(ARRAY,NIL,Array,pop_front,varray());
ADDFUNC0(ARRAY,NIL,Array,sort,varray());