|
@@ -637,10 +637,10 @@ void _apply_permanent_scale_to_descendants(Node *p_root_node, Vector3 p_scale) {
|
|
_apply_scale_to_scalable_node_collection(scalable_node_collection, p_scale);
|
|
_apply_scale_to_scalable_node_collection(scalable_node_collection, p_scale);
|
|
}
|
|
}
|
|
|
|
|
|
-Node *ResourceImporterScene::_pre_fix_node(Node *p_node, Node *p_root, HashMap<Ref<ImporterMesh>, Vector<Ref<Shape3D>>> &r_collision_map, Pair<PackedVector3Array, PackedInt32Array> *r_occluder_arrays, List<Pair<NodePath, Node *>> &r_node_renames) {
|
|
|
|
|
|
+Node *ResourceImporterScene::_pre_fix_node(Node *p_node, Node *p_root, HashMap<Ref<ImporterMesh>, Vector<Ref<Shape3D>>> &r_collision_map, Pair<PackedVector3Array, PackedInt32Array> *r_occluder_arrays, List<Pair<NodePath, Node *>> &r_node_renames, const HashMap<StringName, Variant> &p_options) {
|
|
// Children first.
|
|
// Children first.
|
|
for (int i = 0; i < p_node->get_child_count(); i++) {
|
|
for (int i = 0; i < p_node->get_child_count(); i++) {
|
|
- Node *r = _pre_fix_node(p_node->get_child(i), p_root, r_collision_map, r_occluder_arrays, r_node_renames);
|
|
|
|
|
|
+ Node *r = _pre_fix_node(p_node->get_child(i), p_root, r_collision_map, r_occluder_arrays, r_node_renames, p_options);
|
|
if (!r) {
|
|
if (!r) {
|
|
i--; // Was erased.
|
|
i--; // Was erased.
|
|
}
|
|
}
|
|
@@ -750,6 +750,14 @@ Node *ResourceImporterScene::_pre_fix_node(Node *p_node, Node *p_root, HashMap<R
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ bool use_node_type_suffixes = true;
|
|
|
|
+ if (p_options.has("nodes/use_node_type_suffixes")) {
|
|
|
|
+ use_node_type_suffixes = p_options["nodes/use_node_type_suffixes"];
|
|
|
|
+ }
|
|
|
|
+ if (!use_node_type_suffixes) {
|
|
|
|
+ return p_node;
|
|
|
|
+ }
|
|
|
|
+
|
|
if (_teststr(name, "colonly") || _teststr(name, "convcolonly")) {
|
|
if (_teststr(name, "colonly") || _teststr(name, "convcolonly")) {
|
|
if (isroot) {
|
|
if (isroot) {
|
|
return p_node;
|
|
return p_node;
|
|
@@ -2373,6 +2381,7 @@ void ResourceImporterScene::get_import_options(const String &p_path, List<Import
|
|
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "nodes/apply_root_scale"), true));
|
|
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "nodes/apply_root_scale"), true));
|
|
r_options->push_back(ImportOption(PropertyInfo(Variant::FLOAT, "nodes/root_scale", PROPERTY_HINT_RANGE, "0.001,1000,0.001"), 1.0));
|
|
r_options->push_back(ImportOption(PropertyInfo(Variant::FLOAT, "nodes/root_scale", PROPERTY_HINT_RANGE, "0.001,1000,0.001"), 1.0));
|
|
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "nodes/import_as_skeleton_bones"), false));
|
|
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "nodes/import_as_skeleton_bones"), false));
|
|
|
|
+ r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "nodes/use_node_type_suffixes"), true));
|
|
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "meshes/ensure_tangents"), true));
|
|
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "meshes/ensure_tangents"), true));
|
|
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "meshes/generate_lods"), true));
|
|
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "meshes/generate_lods"), true));
|
|
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "meshes/create_shadow_meshes"), true));
|
|
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "meshes/create_shadow_meshes"), true));
|
|
@@ -2854,7 +2863,7 @@ Node *ResourceImporterScene::pre_import(const String &p_source_file, const HashM
|
|
|
|
|
|
HashMap<Ref<ImporterMesh>, Vector<Ref<Shape3D>>> collision_map;
|
|
HashMap<Ref<ImporterMesh>, Vector<Ref<Shape3D>>> collision_map;
|
|
List<Pair<NodePath, Node *>> node_renames;
|
|
List<Pair<NodePath, Node *>> node_renames;
|
|
- _pre_fix_node(scene, scene, collision_map, nullptr, node_renames);
|
|
|
|
|
|
+ _pre_fix_node(scene, scene, collision_map, nullptr, node_renames, p_options);
|
|
|
|
|
|
return scene;
|
|
return scene;
|
|
}
|
|
}
|
|
@@ -2992,7 +3001,7 @@ Error ResourceImporterScene::import(const String &p_source_file, const String &p
|
|
Pair<PackedVector3Array, PackedInt32Array> occluder_arrays;
|
|
Pair<PackedVector3Array, PackedInt32Array> occluder_arrays;
|
|
List<Pair<NodePath, Node *>> node_renames;
|
|
List<Pair<NodePath, Node *>> node_renames;
|
|
|
|
|
|
- _pre_fix_node(scene, scene, collision_map, &occluder_arrays, node_renames);
|
|
|
|
|
|
+ _pre_fix_node(scene, scene, collision_map, &occluder_arrays, node_renames, p_options);
|
|
|
|
|
|
for (int i = 0; i < post_importer_plugins.size(); i++) {
|
|
for (int i = 0; i < post_importer_plugins.size(); i++) {
|
|
post_importer_plugins.write[i]->pre_process(scene, p_options);
|
|
post_importer_plugins.write[i]->pre_process(scene, p_options);
|