Browse Source

Merge pull request #5412 from vnen/dvector-invert-bind

Expose *Array.invert() to script
Rémi Verschelde 9 years ago
parent
commit
8a5d23c820
2 changed files with 49 additions and 0 deletions
  1. 14 0
      core/variant_call.cpp
  2. 35 0
      doc/base/classes.xml

+ 14 - 0
core/variant_call.cpp

@@ -516,6 +516,7 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var
 	VCALL_LOCALMEM1(ByteArray,remove);
 	VCALL_LOCALMEM1(ByteArray,append);
 	VCALL_LOCALMEM1(ByteArray,append_array);
+	VCALL_LOCALMEM0(ByteArray,invert);
 
 	VCALL_LOCALMEM0R(IntArray,size);
 	VCALL_LOCALMEM2(IntArray,set);
@@ -526,6 +527,7 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var
 	VCALL_LOCALMEM1(IntArray,remove);
 	VCALL_LOCALMEM1(IntArray,append);
 	VCALL_LOCALMEM1(IntArray,append_array);
+	VCALL_LOCALMEM0(IntArray,invert);
 
 	VCALL_LOCALMEM0R(RealArray,size);
 	VCALL_LOCALMEM2(RealArray,set);
@@ -536,6 +538,7 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var
 	VCALL_LOCALMEM1(RealArray,remove);
 	VCALL_LOCALMEM1(RealArray,append);
 	VCALL_LOCALMEM1(RealArray,append_array);
+	VCALL_LOCALMEM0(RealArray,invert);
 
 	VCALL_LOCALMEM0R(StringArray,size);
 	VCALL_LOCALMEM2(StringArray,set);
@@ -546,6 +549,7 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var
 	VCALL_LOCALMEM1(StringArray,remove);
 	VCALL_LOCALMEM1(StringArray,append);
 	VCALL_LOCALMEM1(StringArray,append_array);
+	VCALL_LOCALMEM0(StringArray,invert);
 
 	VCALL_LOCALMEM0R(Vector2Array,size);
 	VCALL_LOCALMEM2(Vector2Array,set);
@@ -556,6 +560,7 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var
 	VCALL_LOCALMEM1(Vector2Array,remove);
 	VCALL_LOCALMEM1(Vector2Array,append);
 	VCALL_LOCALMEM1(Vector2Array,append_array);
+	VCALL_LOCALMEM0(Vector2Array,invert);
 
 	VCALL_LOCALMEM0R(Vector3Array,size);
 	VCALL_LOCALMEM2(Vector3Array,set);
@@ -566,6 +571,7 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var
 	VCALL_LOCALMEM1(Vector3Array,remove);
 	VCALL_LOCALMEM1(Vector3Array,append);
 	VCALL_LOCALMEM1(Vector3Array,append_array);
+	VCALL_LOCALMEM0(Vector3Array,invert);
 
 	VCALL_LOCALMEM0R(ColorArray,size);
 	VCALL_LOCALMEM2(ColorArray,set);
@@ -576,6 +582,7 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var
 	VCALL_LOCALMEM1(ColorArray,remove);
 	VCALL_LOCALMEM1(ColorArray,append);
 	VCALL_LOCALMEM1(ColorArray,append_array);
+	VCALL_LOCALMEM0(ColorArray,invert);
 
 #define VCALL_PTR0(m_type,m_method)\
 static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Variant** p_args) { reinterpret_cast<m_type*>(p_self._data._ptr)->m_method(); }
@@ -1506,6 +1513,7 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl
 	ADDFUNC1(RAW_ARRAY,NIL,ByteArray,remove,INT,"idx",varray());
 	ADDFUNC2(RAW_ARRAY,INT,ByteArray,insert,INT,"idx",INT,"byte",varray());
 	ADDFUNC1(RAW_ARRAY,NIL,ByteArray,resize,INT,"idx",varray());
+	ADDFUNC0(RAW_ARRAY,NIL,ByteArray,invert,varray());
 
 	ADDFUNC0(RAW_ARRAY,STRING,ByteArray,get_string_from_ascii,varray());
 	ADDFUNC0(RAW_ARRAY,STRING,ByteArray,get_string_from_utf8,varray());
@@ -1519,6 +1527,7 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl
 	ADDFUNC1(INT_ARRAY,NIL,IntArray,remove,INT,"idx",varray());
 	ADDFUNC2(INT_ARRAY,INT,IntArray,insert,INT,"idx",INT,"integer",varray());
 	ADDFUNC1(INT_ARRAY,NIL,IntArray,resize,INT,"idx",varray());
+	ADDFUNC0(INT_ARRAY,NIL,IntArray,invert,varray());
 
 	ADDFUNC0(REAL_ARRAY,INT,RealArray,size,varray());
 	ADDFUNC2(REAL_ARRAY,NIL,RealArray,set,INT,"idx",REAL,"value",varray());
@@ -1528,6 +1537,7 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl
 	ADDFUNC1(REAL_ARRAY,NIL,RealArray,remove,INT,"idx",varray());
 	ADDFUNC2(REAL_ARRAY,INT,RealArray,insert,INT,"idx",REAL,"value",varray());
 	ADDFUNC1(REAL_ARRAY,NIL,RealArray,resize,INT,"idx",varray());
+	ADDFUNC0(REAL_ARRAY,NIL,RealArray,invert,varray());
 
 	ADDFUNC0(STRING_ARRAY,INT,StringArray,size,varray());
 	ADDFUNC2(STRING_ARRAY,NIL,StringArray,set,INT,"idx",STRING,"string",varray());
@@ -1537,6 +1547,7 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl
 	ADDFUNC1(STRING_ARRAY,NIL,StringArray,remove,INT,"idx",varray());
 	ADDFUNC2(STRING_ARRAY,INT,StringArray,insert,INT,"idx",STRING,"string",varray());
 	ADDFUNC1(STRING_ARRAY,NIL,StringArray,resize,INT,"idx",varray());
+	ADDFUNC0(STRING_ARRAY,NIL,StringArray,invert,varray());
 
 	ADDFUNC0(VECTOR2_ARRAY,INT,Vector2Array,size,varray());
 	ADDFUNC2(VECTOR2_ARRAY,NIL,Vector2Array,set,INT,"idx",VECTOR2,"vector2",varray());
@@ -1546,6 +1557,7 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl
 	ADDFUNC1(VECTOR2_ARRAY,NIL,Vector2Array,remove,INT,"idx",varray());
 	ADDFUNC2(VECTOR2_ARRAY,INT,Vector2Array,insert,INT,"idx",VECTOR2,"vector2",varray());
 	ADDFUNC1(VECTOR2_ARRAY,NIL,Vector2Array,resize,INT,"idx",varray());
+	ADDFUNC0(VECTOR2_ARRAY,NIL,Vector2Array,invert,varray());
 
 	ADDFUNC0(VECTOR3_ARRAY,INT,Vector3Array,size,varray());
 	ADDFUNC2(VECTOR3_ARRAY,NIL,Vector3Array,set,INT,"idx",VECTOR3,"vector3",varray());
@@ -1555,6 +1567,7 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl
 	ADDFUNC1(VECTOR3_ARRAY,NIL,Vector3Array,remove,INT,"idx",varray());
 	ADDFUNC2(VECTOR3_ARRAY,INT,Vector3Array,insert,INT,"idx",VECTOR3,"vector3",varray());
 	ADDFUNC1(VECTOR3_ARRAY,NIL,Vector3Array,resize,INT,"idx",varray());
+	ADDFUNC0(VECTOR3_ARRAY,NIL,Vector3Array,invert,varray());
 
 	ADDFUNC0(COLOR_ARRAY,INT,ColorArray,size,varray());
 	ADDFUNC2(COLOR_ARRAY,NIL,ColorArray,set,INT,"idx",COLOR,"color",varray());
@@ -1564,6 +1577,7 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl
 	ADDFUNC1(COLOR_ARRAY,NIL,ColorArray,remove,INT,"idx",varray());
 	ADDFUNC2(COLOR_ARRAY,INT,ColorArray,insert,INT,"idx",COLOR,"color",varray());
 	ADDFUNC1(COLOR_ARRAY,NIL,ColorArray,resize,INT,"idx",varray());
+	ADDFUNC0(COLOR_ARRAY,NIL,ColorArray,invert,varray());
 
 	//pointerbased
 

+ 35 - 0
doc/base/classes.xml

@@ -8544,6 +8544,11 @@
 			Insert a new element at a given position in the array. The position must be valid, or at the end of the array (pos==size()).
 			</description>
 		</method>
+		<method name="invert">
+			<description>
+			Reverse the order of the elements in the array (so first element will now be the last).
+			</description>
+		</method>
 		<method name="push_back">
 			<argument index="0" name="color" type="Color">
 			</argument>
@@ -17192,6 +17197,11 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8)
 			Insert a new int at a given position in the array. The position must be valid, or at the end of the array (pos==size()).
 			</description>
 		</method>
+		<method name="invert">
+			<description>
+			Reverse the order of the elements in the array (so first element will now be the last).
+			</description>
+		</method>
 		<method name="push_back">
 			<argument index="0" name="integer" type="int">
 			</argument>
@@ -30279,6 +30289,11 @@ A similar effect may be achieved moving this node's descendants.
 			Insert a new element at a given position in the array. The position must be valid, or at the end of the array (pos==size()).
 			</description>
 		</method>
+		<method name="invert">
+			<description>
+			Reverse the order of the elements in the array (so first element will now be the last).
+			</description>
+		</method>
 		<method name="push_back">
 			<argument index="0" name="byte" type="int">
 			</argument>
@@ -30657,6 +30672,11 @@ A similar effect may be achieved moving this node's descendants.
 			Insert a new element at a given position in the array. The position must be valid, or at the end of the array (pos==size()).
 			</description>
 		</method>
+		<method name="invert">
+			<description>
+			Reverse the order of the elements in the array (so first element will now be the last).
+			</description>
+		</method>
 		<method name="push_back">
 			<argument index="0" name="value" type="float">
 			</argument>
@@ -38120,6 +38140,11 @@ A similar effect may be achieved moving this node's descendants.
 			Insert a new element at a given position in the array. The position must be valid, or at the end of the array (pos==size()).
 			</description>
 		</method>
+		<method name="invert">
+			<description>
+			Reverse the order of the elements in the array (so first element will now be the last).
+			</description>
+		</method>
 		<method name="push_back">
 			<argument index="0" name="string" type="String">
 			</argument>
@@ -43043,6 +43068,11 @@ A similar effect may be achieved moving this node's descendants.
 			Insert a new element at a given position in the array. The position must be valid, or at the end of the array (pos==size()).
 			</description>
 		</method>
+		<method name="invert">
+			<description>
+			Reverse the order of the elements in the array (so first element will now be the last).
+			</description>
+		</method>
 		<method name="push_back">
 			<argument index="0" name="vector2" type="Vector2">
 			</argument>
@@ -43334,6 +43364,11 @@ A similar effect may be achieved moving this node's descendants.
 			Insert a new element at a given position in the array. The position must be valid, or at the end of the array (pos==size()).
 			</description>
 		</method>
+		<method name="invert">
+			<description>
+			Reverse the order of the elements in the array (so first element will now be the last).
+			</description>
+		</method>
 		<method name="push_back">
 			<argument index="0" name="vector3" type="Vector3">
 			</argument>