mirror of
https://github.com/godotengine/godot.git
synced 2025-11-03 15:11:19 +00:00
Implement inherits_script() for NativeScript and PluginScript
This commit is contained in:
parent
f2efa6f4f3
commit
2dcd064056
2 changed files with 33 additions and 6 deletions
|
|
@ -114,9 +114,25 @@ void NativeScript::_placeholder_erased(PlaceHolderScriptInstance *p_placeholder)
|
|||
#endif
|
||||
|
||||
bool NativeScript::inherits_script(const Ref<Script> &p_script) const {
|
||||
#ifndef _MSC_VER
|
||||
#warning inheritance needs to be implemented in NativeScript
|
||||
#endif
|
||||
Ref<NativeScript> ns = p_script;
|
||||
if (ns.is_null()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const NativeScriptDesc *other_s = ns->get_script_desc();
|
||||
if (!other_s) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const NativeScriptDesc *s = get_script_desc();
|
||||
|
||||
while (s) {
|
||||
if (s == other_s) {
|
||||
return true;
|
||||
}
|
||||
s = s->base_data;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue