mirror of
https://github.com/godotengine/godot.git
synced 2025-10-20 16:33:30 +00:00
Implement inherits_script() for NativeScript and PluginScript
(cherry picked from commit 2dcd064056
)
This commit is contained in:
parent
417a69c643
commit
d272464e6e
2 changed files with 33 additions and 2 deletions
|
@ -137,7 +137,20 @@ bool PluginScript::can_instance() const {
|
|||
}
|
||||
|
||||
bool PluginScript::inherits_script(const Ref<Script> &p_script) const {
|
||||
WARN_PRINT_ONCE("Inheritance needs to be implemented in PluginScript.");
|
||||
Ref<PluginScript> ps = p_script;
|
||||
if (ps.is_null()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const PluginScript *s = this;
|
||||
|
||||
while (s) {
|
||||
if (s == p_script.ptr()) {
|
||||
return true;
|
||||
}
|
||||
s = Object::cast_to<PluginScript>(s->_ref_base_parent.ptr());
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue