add GDExtensionScriptInstanceGetClassCategory
Change GetClassCategory so it is handled in native directly
This commit is contained in:
parent
b905959f43
commit
531f56e830
3 changed files with 18 additions and 3 deletions
|
@ -1213,6 +1213,7 @@ static GDExtensionScriptInstancePtr gdextension_script_instance_create(const GDE
|
|||
info_2->get_func = p_info->get_func;
|
||||
info_2->get_property_list_func = p_info->get_property_list_func;
|
||||
info_2->free_property_list_func = p_info->free_property_list_func;
|
||||
info_2->get_class_category_func = nullptr;
|
||||
info_2->property_can_revert_func = p_info->property_can_revert_func;
|
||||
info_2->property_get_revert_func = p_info->property_get_revert_func;
|
||||
info_2->get_owner_func = p_info->get_owner_func;
|
||||
|
|
|
@ -430,6 +430,8 @@ typedef GDExtensionBool (*GDExtensionScriptInstanceSet)(GDExtensionScriptInstanc
|
|||
typedef GDExtensionBool (*GDExtensionScriptInstanceGet)(GDExtensionScriptInstanceDataPtr p_instance, GDExtensionConstStringNamePtr p_name, GDExtensionVariantPtr r_ret);
|
||||
typedef const GDExtensionPropertyInfo *(*GDExtensionScriptInstanceGetPropertyList)(GDExtensionScriptInstanceDataPtr p_instance, uint32_t *r_count);
|
||||
typedef void (*GDExtensionScriptInstanceFreePropertyList)(GDExtensionScriptInstanceDataPtr p_instance, const GDExtensionPropertyInfo *p_list);
|
||||
typedef GDExtensionBool (*GDExtensionScriptInstanceGetClassCategory)(GDExtensionScriptInstanceDataPtr p_instance, GDExtensionPropertyInfo *p_class_category);
|
||||
|
||||
typedef GDExtensionVariantType (*GDExtensionScriptInstanceGetPropertyType)(GDExtensionScriptInstanceDataPtr p_instance, GDExtensionConstStringNamePtr p_name, GDExtensionBool *r_is_valid);
|
||||
typedef GDExtensionBool (*GDExtensionScriptInstanceValidateProperty)(GDExtensionScriptInstanceDataPtr p_instance, GDExtensionPropertyInfo *p_property);
|
||||
|
||||
|
@ -508,6 +510,7 @@ typedef struct {
|
|||
GDExtensionScriptInstanceGet get_func;
|
||||
GDExtensionScriptInstanceGetPropertyList get_property_list_func;
|
||||
GDExtensionScriptInstanceFreePropertyList free_property_list_func;
|
||||
GDExtensionScriptInstanceGetClassCategory get_class_category_func;
|
||||
|
||||
GDExtensionScriptInstancePropertyCanRevert property_can_revert_func;
|
||||
GDExtensionScriptInstancePropertyGetRevert property_get_revert_func;
|
||||
|
|
|
@ -670,9 +670,20 @@ public:
|
|||
const GDExtensionPropertyInfo *pinfo = native_info->get_property_list_func(instance, &pcount);
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
Ref<Script> script = get_script();
|
||||
if (script.is_valid() && pcount > 0) {
|
||||
p_list->push_back(script->get_class_category());
|
||||
if (pcount > 0) {
|
||||
if (native_info->get_class_category_func) {
|
||||
GDExtensionPropertyInfo gdext_class_category;
|
||||
if (native_info->get_class_category_func(instance, &gdext_class_category)) {
|
||||
p_list->push_back(PropertyInfo(gdext_class_category));
|
||||
}
|
||||
#ifndef DISABLE_DEPRECATED
|
||||
} else {
|
||||
Ref<Script> script = get_script();
|
||||
if (script.is_valid()) {
|
||||
p_list->push_back(script->get_class_category());
|
||||
}
|
||||
#endif // DISABLE_DEPRECATED
|
||||
}
|
||||
}
|
||||
#endif // TOOLS_ENABLED
|
||||
|
||||
|
|
Loading…
Reference in a new issue