GDScript: Avoid using get_global_class_native_base
This commit is contained in:
parent
c7ceb94e37
commit
847c9bd248
5 changed files with 24 additions and 23 deletions
|
|
@ -1153,11 +1153,13 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
|||
if (TOOL_CREATE_FAVORITE == p_tool) {
|
||||
String name = selected_favorite_root.get_slicec(' ', 0);
|
||||
if (ScriptServer::is_global_class(name)) {
|
||||
new_node = Object::cast_to<Node>(ClassDB::instantiate(ScriptServer::get_global_class_native_base(name)));
|
||||
Ref<Script> scr = ResourceLoader::load(ScriptServer::get_global_class_path(name), "Script");
|
||||
if (new_node && scr.is_valid()) {
|
||||
new_node->set_script(scr);
|
||||
new_node->set_name(name);
|
||||
if (scr.is_valid()) {
|
||||
new_node = Object::cast_to<Node>(ClassDB::instantiate(scr->get_instance_base_type()));
|
||||
if (new_node) {
|
||||
new_node->set_script(scr);
|
||||
new_node->set_name(name);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
new_node = Object::cast_to<Node>(ClassDB::instantiate(selected_favorite_root));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue