Repository: godotengine/godot
File: editor/import/3d/resource_importer_scene.cpp (C++)

Code before:
		} break;
		case INTERNAL_IMPORT_CATEGORY_ANIMATION_NODE: {
			r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "import/skip_import", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), false));
			r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "optimizer/enabled", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), true));
			r_options->push_back(ImportOption(PropertyInfo(Variant::FLOAT, "optimizer/max_velocity_error", PROPERTY_HINT_RANGE, "0,1,0.01"), 0.01));
			r_options->push_back(ImportOption(PropertyInfo(Variant::FLOAT, "optimizer/max_angular_error", PROPERTY_HINT_RANGE, "0,1,0.01"), 0.01));
			r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "optimizer/max_precision_error", PROPERTY_HINT_NONE, "1,6,1"), 3));
			r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "compression/enabled", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), false));
			r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "compression/page_size", PROPERTY_HINT_RANGE, "4,512,1,suffix:kb"), 8));
			r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "import_tracks/position", PROPERTY_HINT_ENUM, "IfPresent,IfPresentForAll,Never"), 1));
			r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "import_tracks/rotation", PROPERTY_HINT_ENUM, "IfPresent,IfPresentForAll,Never"), 1));
			r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "import_tracks/scale", PROPERTY_HINT_ENUM, "IfPresent,IfPresentForAll,Never"), 1));
		} break;
		case INTERNAL_IMPORT_CATEGORY_SKELETON_3D_NODE: {
			r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "import/skip_import", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), false));
			r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "rest_pose/load_pose", PROPERTY_HINT_ENUM, "Default Pose,Use AnimationPlayer,Load External Animation", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), 0));
			r_options->push_back(ImportOption(PropertyInfo(Variant::OBJECT, "rest_pose/external_animation_library", PROPERTY_HINT_RESOURCE_TYPE, "Animation,AnimationLibrary", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), Variant()));
			r_options->push_back(ImportOption(PropertyInfo(Variant::STRING, "rest_pose/selected_animation", PROPERTY_HINT_ENUM, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), ""));
			r_options->push_back(ImportOption(PropertyInfo(Variant::FLOAT, "rest_pose/selected_timestamp", PROPERTY_HINT_RANGE, "0,1,0.001,allow_greater,suffix:s", PROPERTY_USAGE_DEFAULT), 0.0f));
			String mismatched_or_empty_profile_warning = String(
					"The external rest animation is missing some bones. "
					"Use \"Export skeleton rest\" on the Skeleton3D advanced import, or "
					"disable Remove Immutable Tracks."); // TODO: translate.
			r_options->push_back(ImportOption(
					PropertyInfo(
							Variant::STRING, U"rest_pose/\u26A0_warnings/mismatched_or_empty_profile",
							PROPERTY_HINT_MULTILINE_TEXT, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_READ_ONLY),
					Variant(mismatched_or_empty_profile_warning)));
			String profile_must_not_be_retargeted_warning = String(
					"This external rest animation appears to have been imported with a BoneMap. "
					"Find a model with the compatible rest pose "
					"choose \"Export Skeleton Rest Pose\" in its advanced importer."); // TODO: translate.
			r_options->push_back(ImportOption(
					PropertyInfo(
							Variant::STRING, U"rest_pose/\u26A0_warnings/profile_must_not_be_retargeted",
							PROPERTY_HINT_MULTILINE_TEXT, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_READ_ONLY),
					Variant(profile_must_not_be_retargeted_warning)));
			String no_animation_warning = String(
					"Please select an animation. Find a model with the compatible rest pose "
					"and choose \"Export Skeleton Rest Pose\" in its advanced importer."); // TODO: translate.
			r_options->push_back(ImportOption(
					PropertyInfo(
							Variant::STRING, U"rest_pose/\u26A0_warnings/no_animation_chosen",
							PROPERTY_HINT_MULTILINE_TEXT, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_READ_ONLY),
					Variant(no_animation_warning)));
			r_options->push_back(ImportOption(PropertyInfo(Variant::OBJECT, "retarget/bone_map", PROPERTY_HINT_RESOURCE_TYPE, "BoneMap", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), Variant()));
			r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "export_skeleton_rest_pose/enabled", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), false));
			r_options->push_back(ImportOption(PropertyInfo(Variant::STRING, "export_skeleton_rest_pose/path", PROPERTY_HINT_SAVE_FILE, "*.anim,*.res,*.tres"), ""));
		} break;
		default: {
		}

Review comment (suggestion):
```suggestion
							Variant::STRING, U"rest_pose/\u26A0_validation/mismatched_or_empty_profile",
```

I wonder if validation or something like is better than warnings.

Code after:
			String no_animation_warning = String(
					"Select an animation: Find a FBX or glTF in a compatible rest pose "
					"and export a compatible animation from its import settings."); // TODO: translate.
			r_options->push_back(ImportOption(
					PropertyInfo(
							Variant::STRING, U"rest_pose//no_animation_chosen",
							PROPERTY_HINT_MULTILINE_TEXT, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_READ_ONLY),
					Variant(no_animation_warning)));
			r_options->push_back(ImportOption(PropertyInfo(Variant::OBJECT, "retarget/bone_map", PROPERTY_HINT_RESOURCE_TYPE, "BoneMap", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), Variant()));
		} break;
		default: {
		}
	}

	for (int i = 0; i < post_importer_plugins.size(); i++) {
		post_importer_plugins.write[i]->get_internal_import_options(EditorScenePostImportPlugin::InternalImportCategory(p_category), r_options);
	}
}

bool ResourceImporterScene::get_internal_option_visibility(InternalImportCategory p_category, const String &p_option, const HashMap<StringName, Variant> &p_options) const {
	if (p_options.has("import/skip_import") && p_option != "import/skip_import" && bool(p_options["import/skip_import"])) {
		return false; //if skip import
	}
	switch (p_category) {
		case INTERNAL_IMPORT_CATEGORY_NODE: {
		} break;
		case INTERNAL_IMPORT_CATEGORY_MESH_3D_NODE: {
			const bool generate_physics =
					p_options.has("generate/physics") &&
					p_options["generate/physics"].operator bool();

			if (p_option.find("physics/") >= 0) {
				// Show if need to generate collisions.
				return generate_physics;
			}

			if (p_option.find("decomposition/") >= 0) {
				// Show if need to generate collisions.
				if (generate_physics &&
						// Show if convex is enabled.
						p_options["physics/shape_type"] == Variant(SHAPE_TYPE_DECOMPOSE_CONVEX)) {
					if (p_option == "decomposition/advanced") {
						return true;
					}

					const bool decomposition_advanced =
							p_options.has("decomposition/advanced") &&
							p_options["decomposition/advanced"].operator bool();

					if (p_option == "decomposition/precision") {
						return !decomposition_advanced;