mirror of
https://github.com/godotengine/godot.git
synced 2025-10-20 00:13:30 +00:00
Refactored binding system for core types
Moved to a system using variadic templates, shared with CallableBind. New code is cleaner, faster and allows for much better optimization of core type functions from GDScript and GDNative. Added Variant::InternalMethod function for direct call access.
This commit is contained in:
parent
bc91e088e4
commit
b8c64184c6
15 changed files with 2229 additions and 1611 deletions
|
@ -330,9 +330,8 @@ struct _ArrayVariantSort {
|
|||
}
|
||||
};
|
||||
|
||||
Array &Array::sort() {
|
||||
void Array::sort() {
|
||||
_p->array.sort_custom<_ArrayVariantSort>();
|
||||
return *this;
|
||||
}
|
||||
|
||||
struct _ArrayVariantSortCustom {
|
||||
|
@ -349,14 +348,13 @@ struct _ArrayVariantSortCustom {
|
|||
return res;
|
||||
}
|
||||
};
|
||||
Array &Array::sort_custom(Object *p_obj, const StringName &p_function) {
|
||||
ERR_FAIL_NULL_V(p_obj, *this);
|
||||
void Array::sort_custom(Object *p_obj, const StringName &p_function) {
|
||||
ERR_FAIL_NULL(p_obj);
|
||||
|
||||
SortArray<Variant, _ArrayVariantSortCustom, true> avs;
|
||||
avs.compare.obj = p_obj;
|
||||
avs.compare.func = p_function;
|
||||
avs.sort(_p->array.ptrw(), _p->array.size());
|
||||
return *this;
|
||||
}
|
||||
|
||||
void Array::shuffle() {
|
||||
|
@ -415,9 +413,8 @@ int Array::bsearch_custom(const Variant &p_value, Object *p_obj, const StringNam
|
|||
return bisect(_p->array, p_value, p_before, less);
|
||||
}
|
||||
|
||||
Array &Array::invert() {
|
||||
void Array::invert() {
|
||||
_p->array.invert();
|
||||
return *this;
|
||||
}
|
||||
|
||||
void Array::push_front(const Variant &p_value) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue