diff options
-rw-r--r-- | editor/import/resource_importer_scene.cpp | 16 | ||||
-rw-r--r-- | scene/resources/packed_scene.cpp | 8 |
2 files changed, 17 insertions, 7 deletions
diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp index aa8fb9b25b..798f57f8c3 100644 --- a/editor/import/resource_importer_scene.cpp +++ b/editor/import/resource_importer_scene.cpp @@ -986,6 +986,8 @@ void ResourceImporterScene::_make_external_resources(Node *p_node, const String List<PropertyInfo> pi; + print_line("node: " + String(p_node->get_name())); + p_node->get_property_list(&pi); for (List<PropertyInfo>::Element *E = pi.front(); E; E = E->next()) { @@ -993,6 +995,7 @@ void ResourceImporterScene::_make_external_resources(Node *p_node, const String if (E->get().type == Variant::OBJECT) { Ref<Material> mat = p_node->get(E->get().name); + if (p_make_materials && mat.is_valid() && mat->get_name() != "") { if (!p_materials.has(mat)) { @@ -1045,7 +1048,8 @@ void ResourceImporterScene::_make_external_resources(Node *p_node, const String if (!p_materials.has(mat)) { - String ext_name = p_base_path + "." + _make_extname(mat->get_name()) + ".material"; + String ext_name = p_base_path.plus_file(_make_extname(mat->get_name()) + ".material"); + ; if (FileAccess::exists(ext_name)) { //if exists, use it Ref<Material> existing = ResourceLoader::load(ext_name); @@ -1104,9 +1108,9 @@ void ResourceImporterScene::get_import_options(List<ImportOption> *r_options, in r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "materials/location", PROPERTY_HINT_ENUM, "Node,Mesh"), meshes_out ? 1 : 0)); r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "materials/storage", PROPERTY_HINT_ENUM, "Built-In,Files", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), materials_out ? 1 : 0)); r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "materials/keep_on_reimport"), materials_out ? true : false)); - r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "geometry/compress"), true)); - r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "geometry/ensure_tangents"), true)); - r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "geometry/storage", PROPERTY_HINT_ENUM, "Built-In,Files"), meshes_out ? true : false)); + r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "meshes/compress"), true)); + r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "meshes/ensure_tangents"), true)); + r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "meshes/storage", PROPERTY_HINT_ENUM, "Built-In,Files"), meshes_out ? true : false)); r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "external_files/store_in_subdir"), true)); r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "animation/import", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), true)); r_options->push_back(ImportOption(PropertyInfo(Variant::REAL, "animation/fps", PROPERTY_HINT_RANGE, "1,120,1"), 15)); @@ -1176,7 +1180,7 @@ Error ResourceImporterScene::import(const String &p_source_file, const String &p if (bool(p_options["animation/import"])) import_flags |= EditorSceneImporter::IMPORT_ANIMATION; - if (bool(p_options["geometry/ensure_tangents"])) + if (bool(p_options["meshes/ensure_tangents"])) import_flags |= EditorSceneImporter::IMPORT_GENERATE_TANGENT_ARRAYS; if (int(p_options["materials/location"]) == 0) @@ -1250,7 +1254,7 @@ Error ResourceImporterScene::import(const String &p_source_file, const String &p } bool external_materials = p_options["materials/storage"]; - bool external_meshes = p_options["geometry/storage"]; + bool external_meshes = p_options["meshes/storage"]; bool external_scenes = int(p_options["nodes/storage"]) == 1; String base_path = p_source_file.get_base_dir(); diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp index 169c956546..4dfc23fa67 100644 --- a/scene/resources/packed_scene.cpp +++ b/scene/resources/packed_scene.cpp @@ -242,7 +242,8 @@ Node *SceneState::instance(GenEditState p_edit_state) const { value = local_dupe; } - res->setup_local_to_scene(); + //this here may reference nodes not iniialized so this line is commented and used after loading all nodes + //res->setup_local_to_scene(); } //must make a copy, because this res is local to scene } @@ -293,6 +294,11 @@ Node *SceneState::instance(GenEditState p_edit_state) const { } } + for (Map<Ref<Resource>, Ref<Resource> >::Element *E = resources_local_to_scene.front(); E; E = E->next()) { + + E->get()->setup_local_to_scene(); + } + //do connections int cc = connections.size(); |