Move Array:set_typed to internal GDExtension structure.

pull/1013/head
bruvzg 2023-01-24 19:55:02 +02:00
parent 0f3a0913f1
commit 40d3cfd97b
No known key found for this signature in database
GPG Key ID: 7960FCF39844EC38
5 changed files with 1635 additions and 1712 deletions

View File

@ -696,6 +696,7 @@ def generate_builtin_class_header(builtin_api, size, used_classes, fully_used_cl
if class_name == "Array": if class_name == "Array":
result.append(f"\tconst Variant &operator[](int p_index) const;") result.append(f"\tconst Variant &operator[](int p_index) const;")
result.append(f"\tVariant &operator[](int p_index);") result.append(f"\tVariant &operator[](int p_index);")
result.append(f"\tvoid set_typed(uint32_t p_type, const StringName &p_class_name, const Variant &p_script);")
if class_name == "Dictionary": if class_name == "Dictionary":
result.append(f"\tconst Variant &operator[](const Variant &p_key) const;") result.append(f"\tconst Variant &operator[](const Variant &p_key) const;")

File diff suppressed because it is too large Load Diff

View File

@ -551,6 +551,7 @@ typedef struct {
GDExtensionVariantPtr (*array_operator_index)(GDExtensionTypePtr p_self, GDExtensionInt p_index); // p_self should be an Array ptr GDExtensionVariantPtr (*array_operator_index)(GDExtensionTypePtr p_self, GDExtensionInt p_index); // p_self should be an Array ptr
GDExtensionVariantPtr (*array_operator_index_const)(GDExtensionConstTypePtr p_self, GDExtensionInt p_index); // p_self should be an Array ptr GDExtensionVariantPtr (*array_operator_index_const)(GDExtensionConstTypePtr p_self, GDExtensionInt p_index); // p_self should be an Array ptr
void (*array_set_typed)(GDExtensionTypePtr p_self, uint32_t p_type, GDExtensionConstStringNamePtr p_class_name, GDExtensionConstVariantPtr p_script); // p_self should be an Array ptr
/* Dictionary functions */ /* Dictionary functions */

View File

@ -208,6 +208,10 @@ Variant &Array::operator[](int p_index) {
return *var; return *var;
} }
void Array::set_typed(uint32_t p_type, const StringName &p_class_name, const Variant &p_script) {
internal::gde_interface->array_set_typed((GDExtensionTypePtr *)this, p_type, (GDExtensionConstStringNamePtr)&p_class_name, (GDExtensionConstVariantPtr)&p_script);
}
const Variant &Dictionary::operator[](const Variant &p_key) const { const Variant &Dictionary::operator[](const Variant &p_key) const {
const Variant *var = (const Variant *)internal::gde_interface->dictionary_operator_index_const((GDExtensionTypePtr *)this, (GDExtensionVariantPtr)&p_key); const Variant *var = (const Variant *)internal::gde_interface->dictionary_operator_index_const((GDExtensionTypePtr *)this, (GDExtensionVariantPtr)&p_key);
return *var; return *var;

View File

@ -57,9 +57,6 @@ func _ready():
prints("String += operator") prints("String += operator")
prints(" test string +=", $Example.test_string_ops()) prints(" test string +=", $Example.test_string_ops())
prints("WorkerThreadPool")
prints(" test worker_thread_pool", $Example.test_workpool_ops())
prints("PackedArray iterators") prints("PackedArray iterators")
prints(" test packed array iterators", $Example.test_vector_ops()) prints(" test packed array iterators", $Example.test_vector_ops())