diff --git a/core/pool_vector.h b/core/pool_vector.h
index 63a35d1f135..176671b77e1 100644
--- a/core/pool_vector.h
+++ b/core/pool_vector.h
@@ -499,6 +499,7 @@ public:
inline T operator[](int p_index) const;
Error resize(int p_size);
+ Error clear() { return resize(0); }
void invert();
void sort();
diff --git a/core/variant_call.cpp b/core/variant_call.cpp
index 11e9501ba24..e948bd986ed 100644
--- a/core/variant_call.cpp
+++ b/core/variant_call.cpp
@@ -696,6 +696,7 @@ struct _VariantCall {
VCALL_LOCALMEM1(PoolByteArray, push_back);
VCALL_LOCALMEM1(PoolByteArray, fill);
VCALL_LOCALMEM1(PoolByteArray, resize);
+ VCALL_LOCALMEM0(PoolByteArray, clear);
VCALL_LOCALMEM2R(PoolByteArray, insert);
VCALL_LOCALMEM1(PoolByteArray, remove);
VCALL_LOCALMEM1(PoolByteArray, append);
@@ -715,6 +716,7 @@ struct _VariantCall {
VCALL_LOCALMEM1(PoolIntArray, push_back);
VCALL_LOCALMEM1(PoolIntArray, fill);
VCALL_LOCALMEM1(PoolIntArray, resize);
+ VCALL_LOCALMEM0(PoolIntArray, clear);
VCALL_LOCALMEM2R(PoolIntArray, insert);
VCALL_LOCALMEM1(PoolIntArray, remove);
VCALL_LOCALMEM1(PoolIntArray, append);
@@ -733,6 +735,7 @@ struct _VariantCall {
VCALL_LOCALMEM1(PoolRealArray, push_back);
VCALL_LOCALMEM1(PoolRealArray, fill);
VCALL_LOCALMEM1(PoolRealArray, resize);
+ VCALL_LOCALMEM0(PoolRealArray, clear);
VCALL_LOCALMEM2R(PoolRealArray, insert);
VCALL_LOCALMEM1(PoolRealArray, remove);
VCALL_LOCALMEM1(PoolRealArray, append);
@@ -751,6 +754,7 @@ struct _VariantCall {
VCALL_LOCALMEM1(PoolStringArray, push_back);
VCALL_LOCALMEM1(PoolStringArray, fill);
VCALL_LOCALMEM1(PoolStringArray, resize);
+ VCALL_LOCALMEM0(PoolStringArray, clear);
VCALL_LOCALMEM2R(PoolStringArray, insert);
VCALL_LOCALMEM1(PoolStringArray, remove);
VCALL_LOCALMEM1(PoolStringArray, append);
@@ -770,6 +774,7 @@ struct _VariantCall {
VCALL_LOCALMEM1(PoolVector2Array, push_back);
VCALL_LOCALMEM1(PoolVector2Array, fill);
VCALL_LOCALMEM1(PoolVector2Array, resize);
+ VCALL_LOCALMEM0(PoolVector2Array, clear);
VCALL_LOCALMEM2R(PoolVector2Array, insert);
VCALL_LOCALMEM1(PoolVector2Array, remove);
VCALL_LOCALMEM1(PoolVector2Array, append);
@@ -788,6 +793,7 @@ struct _VariantCall {
VCALL_LOCALMEM1(PoolVector3Array, push_back);
VCALL_LOCALMEM1(PoolVector3Array, fill);
VCALL_LOCALMEM1(PoolVector3Array, resize);
+ VCALL_LOCALMEM0(PoolVector3Array, clear);
VCALL_LOCALMEM2R(PoolVector3Array, insert);
VCALL_LOCALMEM1(PoolVector3Array, remove);
VCALL_LOCALMEM1(PoolVector3Array, append);
@@ -806,6 +812,7 @@ struct _VariantCall {
VCALL_LOCALMEM1(PoolColorArray, push_back);
VCALL_LOCALMEM1(PoolColorArray, fill);
VCALL_LOCALMEM1(PoolColorArray, resize);
+ VCALL_LOCALMEM0(PoolColorArray, clear);
VCALL_LOCALMEM2R(PoolColorArray, insert);
VCALL_LOCALMEM1(PoolColorArray, remove);
VCALL_LOCALMEM1(PoolColorArray, append);
@@ -1981,6 +1988,7 @@ void register_variant_methods() {
ADDFUNC1(POOL_BYTE_ARRAY, NIL, PoolByteArray, remove, INT, "idx", varray());
ADDFUNC2R(POOL_BYTE_ARRAY, INT, PoolByteArray, insert, INT, "idx", INT, "byte", varray());
ADDFUNC1(POOL_BYTE_ARRAY, NIL, PoolByteArray, resize, INT, "idx", varray());
+ ADDFUNC0(POOL_BYTE_ARRAY, NIL, PoolByteArray, clear, varray());
ADDFUNC0(POOL_BYTE_ARRAY, NIL, PoolByteArray, invert, varray());
ADDFUNC2R(POOL_BYTE_ARRAY, POOL_BYTE_ARRAY, PoolByteArray, subarray, INT, "from", INT, "to", varray());
ADDFUNC2R(POOL_BYTE_ARRAY, INT, PoolByteArray, find, INT, "value", INT, "from", varray(0));
@@ -2006,6 +2014,7 @@ void register_variant_methods() {
ADDFUNC1(POOL_INT_ARRAY, NIL, PoolIntArray, remove, INT, "idx", varray());
ADDFUNC2R(POOL_INT_ARRAY, INT, PoolIntArray, insert, INT, "idx", INT, "integer", varray());
ADDFUNC1(POOL_INT_ARRAY, NIL, PoolIntArray, resize, INT, "idx", varray());
+ ADDFUNC0(POOL_INT_ARRAY, NIL, PoolIntArray, clear, varray());
ADDFUNC0(POOL_INT_ARRAY, NIL, PoolIntArray, invert, varray());
ADDFUNC2R(POOL_INT_ARRAY, INT, PoolIntArray, find, INT, "value", INT, "from", varray(0));
ADDFUNC2R(POOL_INT_ARRAY, INT, PoolIntArray, rfind, INT, "value", INT, "from", varray(-1));
@@ -2023,6 +2032,7 @@ void register_variant_methods() {
ADDFUNC1(POOL_REAL_ARRAY, NIL, PoolRealArray, remove, INT, "idx", varray());
ADDFUNC2R(POOL_REAL_ARRAY, INT, PoolRealArray, insert, INT, "idx", REAL, "value", varray());
ADDFUNC1(POOL_REAL_ARRAY, NIL, PoolRealArray, resize, INT, "idx", varray());
+ ADDFUNC0(POOL_REAL_ARRAY, NIL, PoolRealArray, clear, varray());
ADDFUNC0(POOL_REAL_ARRAY, NIL, PoolRealArray, invert, varray());
ADDFUNC2R(POOL_REAL_ARRAY, INT, PoolRealArray, find, REAL, "value", INT, "from", varray(0));
ADDFUNC2R(POOL_REAL_ARRAY, INT, PoolRealArray, rfind, REAL, "value", INT, "from", varray(-1));
@@ -2040,6 +2050,7 @@ void register_variant_methods() {
ADDFUNC1(POOL_STRING_ARRAY, NIL, PoolStringArray, remove, INT, "idx", varray());
ADDFUNC2R(POOL_STRING_ARRAY, INT, PoolStringArray, insert, INT, "idx", STRING, "string", varray());
ADDFUNC1(POOL_STRING_ARRAY, NIL, PoolStringArray, resize, INT, "idx", varray());
+ ADDFUNC0(POOL_STRING_ARRAY, NIL, PoolStringArray, clear, varray());
ADDFUNC0(POOL_STRING_ARRAY, NIL, PoolStringArray, invert, varray());
ADDFUNC1(POOL_STRING_ARRAY, STRING, PoolStringArray, join, STRING, "delimiter", varray());
ADDFUNC2R(POOL_STRING_ARRAY, INT, PoolStringArray, find, STRING, "value", INT, "from", varray(0));
@@ -2058,6 +2069,7 @@ void register_variant_methods() {
ADDFUNC1(POOL_VECTOR2_ARRAY, NIL, PoolVector2Array, remove, INT, "idx", varray());
ADDFUNC2R(POOL_VECTOR2_ARRAY, INT, PoolVector2Array, insert, INT, "idx", VECTOR2, "vector2", varray());
ADDFUNC1(POOL_VECTOR2_ARRAY, NIL, PoolVector2Array, resize, INT, "idx", varray());
+ ADDFUNC0(POOL_VECTOR2_ARRAY, NIL, PoolVector2Array, clear, varray());
ADDFUNC0(POOL_VECTOR2_ARRAY, NIL, PoolVector2Array, invert, varray());
ADDFUNC2R(POOL_VECTOR2_ARRAY, INT, PoolVector2Array, find, VECTOR2, "value", INT, "from", varray(0));
ADDFUNC2R(POOL_VECTOR2_ARRAY, INT, PoolVector2Array, rfind, VECTOR2, "value", INT, "from", varray(-1));
@@ -2075,6 +2087,7 @@ void register_variant_methods() {
ADDFUNC1(POOL_VECTOR3_ARRAY, NIL, PoolVector3Array, remove, INT, "idx", varray());
ADDFUNC2R(POOL_VECTOR3_ARRAY, INT, PoolVector3Array, insert, INT, "idx", VECTOR3, "vector3", varray());
ADDFUNC1(POOL_VECTOR3_ARRAY, NIL, PoolVector3Array, resize, INT, "idx", varray());
+ ADDFUNC0(POOL_VECTOR3_ARRAY, NIL, PoolVector3Array, clear, varray());
ADDFUNC0(POOL_VECTOR3_ARRAY, NIL, PoolVector3Array, invert, varray());
ADDFUNC2R(POOL_VECTOR3_ARRAY, INT, PoolVector3Array, find, VECTOR3, "value", INT, "from", varray(0));
ADDFUNC2R(POOL_VECTOR3_ARRAY, INT, PoolVector3Array, rfind, VECTOR3, "value", INT, "from", varray(-1));
@@ -2092,6 +2105,7 @@ void register_variant_methods() {
ADDFUNC1(POOL_COLOR_ARRAY, NIL, PoolColorArray, remove, INT, "idx", varray());
ADDFUNC2R(POOL_COLOR_ARRAY, INT, PoolColorArray, insert, INT, "idx", COLOR, "color", varray());
ADDFUNC1(POOL_COLOR_ARRAY, NIL, PoolColorArray, resize, INT, "idx", varray());
+ ADDFUNC0(POOL_COLOR_ARRAY, NIL, PoolColorArray, clear, varray());
ADDFUNC0(POOL_COLOR_ARRAY, NIL, PoolColorArray, invert, varray());
ADDFUNC2R(POOL_COLOR_ARRAY, INT, PoolColorArray, find, COLOR, "value", INT, "from", varray(0));
ADDFUNC2R(POOL_COLOR_ARRAY, INT, PoolColorArray, rfind, COLOR, "value", INT, "from", varray(-1));
diff --git a/doc/classes/PoolByteArray.xml b/doc/classes/PoolByteArray.xml
index b00c7111118..df7c5a31ed8 100644
--- a/doc/classes/PoolByteArray.xml
+++ b/doc/classes/PoolByteArray.xml
@@ -42,6 +42,11 @@
Appends a [PoolByteArray] at the end of this array.
+
+
+ Clears the array. This is equivalent to using [method resize] with a size of [code]0[/code].
+
+
diff --git a/doc/classes/PoolColorArray.xml b/doc/classes/PoolColorArray.xml
index 03e218844a4..351525fca66 100644
--- a/doc/classes/PoolColorArray.xml
+++ b/doc/classes/PoolColorArray.xml
@@ -42,6 +42,11 @@
Appends a [PoolColorArray] at the end of this array.
+
+
+ Clears the array. This is equivalent to using [method resize] with a size of [code]0[/code].
+
+
diff --git a/doc/classes/PoolIntArray.xml b/doc/classes/PoolIntArray.xml
index 86aefff843b..f581808e54d 100644
--- a/doc/classes/PoolIntArray.xml
+++ b/doc/classes/PoolIntArray.xml
@@ -43,6 +43,11 @@
Appends a [PoolIntArray] at the end of this array.
+
+
+ Clears the array. This is equivalent to using [method resize] with a size of [code]0[/code].
+
+
diff --git a/doc/classes/PoolRealArray.xml b/doc/classes/PoolRealArray.xml
index 2499d9a5dde..d892beba0c5 100644
--- a/doc/classes/PoolRealArray.xml
+++ b/doc/classes/PoolRealArray.xml
@@ -43,6 +43,11 @@
Appends a [PoolRealArray] at the end of this array.
+
+
+ Clears the array. This is equivalent to using [method resize] with a size of [code]0[/code].
+
+
diff --git a/doc/classes/PoolStringArray.xml b/doc/classes/PoolStringArray.xml
index 5aa6c0dd1dc..aadede94301 100644
--- a/doc/classes/PoolStringArray.xml
+++ b/doc/classes/PoolStringArray.xml
@@ -43,6 +43,11 @@
Appends a [PoolStringArray] at the end of this array.
+
+
+ Clears the array. This is equivalent to using [method resize] with a size of [code]0[/code].
+
+
diff --git a/doc/classes/PoolVector2Array.xml b/doc/classes/PoolVector2Array.xml
index 7b1e6bcb1a9..c89ea76fd50 100644
--- a/doc/classes/PoolVector2Array.xml
+++ b/doc/classes/PoolVector2Array.xml
@@ -43,6 +43,11 @@
Appends a [PoolVector2Array] at the end of this array.
+
+
+ Clears the array. This is equivalent to using [method resize] with a size of [code]0[/code].
+
+
diff --git a/doc/classes/PoolVector3Array.xml b/doc/classes/PoolVector3Array.xml
index 6a9fbaa273e..a587019596a 100644
--- a/doc/classes/PoolVector3Array.xml
+++ b/doc/classes/PoolVector3Array.xml
@@ -42,6 +42,11 @@
Appends a [PoolVector3Array] at the end of this array.
+
+
+ Clears the array. This is equivalent to using [method resize] with a size of [code]0[/code].
+
+