Merge pull request #73511 from dsnopek/gdextension-object-name
Add GDExtension function to get Object class name
This commit is contained in:
commit
80bf8fd186
5 changed files with 43 additions and 1 deletions
|
|
@ -1739,7 +1739,7 @@ void *Object::get_instance_binding(void *p_token, const GDExtensionInstanceBindi
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (unlikely(!binding)) {
|
||||
if (unlikely(!binding && p_callbacks)) {
|
||||
uint32_t current_size = next_power_of_2(_instance_binding_count);
|
||||
uint32_t new_size = next_power_of_2(_instance_binding_count + 1);
|
||||
|
||||
|
|
|
|||
|
|
@ -304,8 +304,10 @@ struct MethodInfo {
|
|||
|
||||
// API used to extend in GDExtension and other C compatible compiled languages.
|
||||
class MethodBind;
|
||||
class GDExtension;
|
||||
|
||||
struct ObjectGDExtension {
|
||||
GDExtension *library = nullptr;
|
||||
ObjectGDExtension *parent = nullptr;
|
||||
List<ObjectGDExtension *> children;
|
||||
StringName parent_class_name;
|
||||
|
|
@ -798,6 +800,18 @@ public:
|
|||
return *_class_name_ptr;
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ const StringName &get_class_name_for_extension(const GDExtension *p_library) const {
|
||||
// Only return the class name per the extension if it matches the given p_library.
|
||||
if (_extension && _extension->library == p_library) {
|
||||
return _extension->class_name;
|
||||
}
|
||||
// Otherwise, return the name of the built-in class.
|
||||
if (unlikely(!_class_name_ptr)) {
|
||||
return *_get_class_namev();
|
||||
}
|
||||
return *_class_name_ptr;
|
||||
}
|
||||
|
||||
/* IAPI */
|
||||
|
||||
void set(const StringName &p_name, const Variant &p_value, bool *r_valid = nullptr);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue