Skip to content

Commit 5dc375b

Browse files
committed
Merge pull request #105014 from aaronfranke/no-type-suffixes
Allow completely opting out of name suffix magic in 3D scene import
2 parents 57b127c + e968286 commit 5dc375b

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

doc/classes/ResourceImporterScene.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,11 @@
6868
<member name="nodes/root_type" type="String" setter="" getter="" default="&quot;&quot;">
6969
Override for the root node type. If empty, the root node will use what the scene specifies, or [Node3D] if the scene does not specify a root type. Using a node type that inherits from [Node3D] is recommended. Otherwise, you'll lose the ability to position the node directly in the 3D editor.
7070
</member>
71+
<member name="nodes/use_name_suffixes" type="bool" setter="" getter="" default="true">
72+
If [code]true[/code], will use suffixes in the names of imported objects such as nodes and resources to determine types and properties, such as [code]-noimp[/code] to skip import of a node or animation, [code]-alpha[/code] to enable alpha transparency on a material, and [code]-vcol[/code] to enable vertex colors on a material. Disabling this makes editor-imported files more similar to the original files, and more similar to files imported at runtime. See [url=$DOCS_URL/tutorials/assets_pipeline/importing_3d_scenes/node_type_customization.html]Node type customization using name suffixes[/url] for more information.
73+
</member>
7174
<member name="nodes/use_node_type_suffixes" type="bool" setter="" getter="" default="true">
72-
If [code]true[/code], use suffixes in the node names to determine the node type, such as [code]-col[/code] for collision shapes. Disabling this makes editor-imported files more similar to the original files, and more similar to importing files at runtime. See [url=$DOCS_URL/tutorials/assets_pipeline/importing_3d_scenes/node_type_customization.html]Node type customization using name suffixes[/url] for more information.
75+
If [code]true[/code], will use suffixes in the node names to determine the node type, such as [code]-col[/code] for collision shapes. This is only used when [member nodes/use_name_suffixes] is [code]true[/code]. Disabling this makes editor-imported files more similar to the original files, and more similar to files imported at runtime. See [url=$DOCS_URL/tutorials/assets_pipeline/importing_3d_scenes/node_type_customization.html]Node type customization using name suffixes[/url] for more information.
7376
</member>
7477
<member name="skins/use_named_skins" type="bool" setter="" getter="" default="true">
7578
If checked, use named [Skin]s for animation. The [MeshInstance3D] node contains 3 properties of relevance here: a skeleton [NodePath] pointing to the [Skeleton3D] node (usually [code]..[/code]), a mesh, and a skin:

editor/import/3d/resource_importer_scene.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,9 @@ bool ResourceImporterScene::get_option_visibility(const String &p_path, const St
303303
}
304304
}
305305

306+
if (p_option == "nodes/use_node_type_suffixes" && p_options.has("nodes/use_name_suffixes")) {
307+
return p_options["nodes/use_name_suffixes"];
308+
}
306309
if (p_option == "meshes/lightmap_texel_size" && int(p_options["meshes/light_baking"]) != 2) {
307310
// Only display the lightmap texel size import option when using the Static Lightmaps light baking mode.
308311
return false;
@@ -639,6 +642,14 @@ void _apply_permanent_scale_to_descendants(Node *p_root_node, Vector3 p_scale) {
639642
}
640643

641644
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) {
645+
bool use_name_suffixes = true;
646+
if (p_options.has("nodes/use_name_suffixes")) {
647+
use_name_suffixes = p_options["nodes/use_name_suffixes"];
648+
}
649+
if (!use_name_suffixes) {
650+
return p_node;
651+
}
652+
642653
// Children first.
643654
for (int i = 0; i < p_node->get_child_count(); i++) {
644655
Node *r = _pre_fix_node(p_node->get_child(i), p_root, r_collision_map, r_occluder_arrays, r_node_renames, p_options);
@@ -2409,6 +2420,7 @@ void ResourceImporterScene::get_import_options(const String &p_path, List<Import
24092420
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "nodes/apply_root_scale"), true));
24102421
r_options->push_back(ImportOption(PropertyInfo(Variant::FLOAT, "nodes/root_scale", PROPERTY_HINT_RANGE, "0.001,1000,0.001"), 1.0));
24112422
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "nodes/import_as_skeleton_bones"), false));
2423+
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "nodes/use_name_suffixes", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), true));
24122424
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "nodes/use_node_type_suffixes"), true));
24132425
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "meshes/ensure_tangents"), true));
24142426
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "meshes/generate_lods"), true));

0 commit comments

Comments
 (0)