From c478f3032112157865815c5ad892427b8d0fb531 Mon Sep 17 00:00:00 2001 From: Windy Darian Date: Tue, 29 Jan 2019 23:07:56 -0500 Subject: [PATCH] Support script global class (class_name) when importing a scene We could already choose a script global class for root_type at scene import config. However, it would fall back to default Spatial if a script global class is chosen. This will make sure the base type for the script class is used, and the script to root node is attached upon import. --- editor/import/resource_importer_scene.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp index f230fa1b8ba..cc852e75cba 100644 --- a/editor/import/resource_importer_scene.cpp +++ b/editor/import/resource_importer_scene.cpp @@ -1239,6 +1239,13 @@ Error ResourceImporterScene::import(const String &p_source_file, const String &p } String root_type = p_options["nodes/root_type"]; + root_type = root_type.split(" ")[0]; // full root_type is "ClassName (filename.gd)" for a script global class. + + Ref