Merge pull request #34986 from toasteater/feature/is-instance-id-valid
Expose instance_from_id to GDNative
This commit is contained in:
commit
f8da87c763
@ -170,6 +170,10 @@ bool GDAPI godot_is_instance_valid(const godot_object *p_object) {
|
||||
return ObjectDB::instance_validate((Object *)p_object);
|
||||
}
|
||||
|
||||
godot_object GDAPI *godot_instance_from_id(godot_int p_instance_id) {
|
||||
return (godot_object *)ObjectDB::get_instance((ObjectID)p_instance_id);
|
||||
}
|
||||
|
||||
void *godot_get_class_tag(const godot_string_name *p_class) {
|
||||
StringName class_name = *(StringName *)p_class;
|
||||
ClassDB::ClassInfo *class_info = ClassDB::classes.getptr(class_name);
|
||||
|
@ -155,6 +155,13 @@
|
||||
["const godot_object *", "p_object"],
|
||||
["void *", "p_class_tag"]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "godot_instance_from_id",
|
||||
"return_type": "godot_object *",
|
||||
"arguments": [
|
||||
["godot_int", "p_instance_id"]
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -290,6 +290,9 @@ bool GDAPI godot_is_instance_valid(const godot_object *p_object);
|
||||
void GDAPI *godot_get_class_tag(const godot_string_name *p_class);
|
||||
godot_object GDAPI *godot_object_cast_to(const godot_object *p_object, void *p_class_tag);
|
||||
|
||||
// equivalent of GDScript's instance_from_id
|
||||
godot_object GDAPI *godot_instance_from_id(godot_int p_instance_id);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user