Propagate error correctly when max texture size for lightmaps is too small.
Add error handling for BAKE_ERROR_LIGHTMAP_TOO_SMALL, which was previously ignored. Fixes #81453.
This commit is contained in:
parent
fc99492d30
commit
7dfb854556
|
@ -118,6 +118,9 @@
|
||||||
<constant name="BAKE_ERROR_USER_ABORTED" value="8" enum="BakeError">
|
<constant name="BAKE_ERROR_USER_ABORTED" value="8" enum="BakeError">
|
||||||
The user aborted the lightmap baking operation (typically by clicking the [b]Cancel[/b] button in the progress dialog).
|
The user aborted the lightmap baking operation (typically by clicking the [b]Cancel[/b] button in the progress dialog).
|
||||||
</constant>
|
</constant>
|
||||||
|
<constant name="BAKE_ERROR_TEXTURE_SIZE_TOO_SMALL" value="9" enum="BakeError">
|
||||||
|
Lightmap baking failed as the maximum texture size is too small to fit some of the meshes marked for baking.
|
||||||
|
</constant>
|
||||||
<constant name="ENVIRONMENT_MODE_DISABLED" value="0" enum="EnvironmentMode">
|
<constant name="ENVIRONMENT_MODE_DISABLED" value="0" enum="EnvironmentMode">
|
||||||
Ignore environment lighting when baking lightmaps.
|
Ignore environment lighting when baking lightmaps.
|
||||||
</constant>
|
</constant>
|
||||||
|
|
|
@ -103,6 +103,9 @@ void LightmapGIEditorPlugin::_bake_select_file(const String &p_file) {
|
||||||
case LightmapGI::BAKE_ERROR_FOREIGN_DATA: {
|
case LightmapGI::BAKE_ERROR_FOREIGN_DATA: {
|
||||||
EditorNode::get_singleton()->show_warning(TTR("Lightmap data is not local to the scene."));
|
EditorNode::get_singleton()->show_warning(TTR("Lightmap data is not local to the scene."));
|
||||||
} break;
|
} break;
|
||||||
|
case LightmapGI::BAKE_ERROR_TEXTURE_SIZE_TOO_SMALL: {
|
||||||
|
EditorNode::get_singleton()->show_warning(TTR("Maximum texture size is too small for the lightmap images."));
|
||||||
|
} break;
|
||||||
default: {
|
default: {
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1082,7 +1082,9 @@ LightmapGI::BakeError LightmapGI::bake(Node *p_from_node, String p_image_data_pa
|
||||||
|
|
||||||
Lightmapper::BakeError bake_err = lightmapper->bake(Lightmapper::BakeQuality(bake_quality), use_denoiser, bounces, bias, max_texture_size, directional, Lightmapper::GenerateProbes(gen_probes), environment_image, environment_transform, _lightmap_bake_step_function, &bsud, exposure_normalization);
|
Lightmapper::BakeError bake_err = lightmapper->bake(Lightmapper::BakeQuality(bake_quality), use_denoiser, bounces, bias, max_texture_size, directional, Lightmapper::GenerateProbes(gen_probes), environment_image, environment_transform, _lightmap_bake_step_function, &bsud, exposure_normalization);
|
||||||
|
|
||||||
if (bake_err == Lightmapper::BAKE_ERROR_LIGHTMAP_CANT_PRE_BAKE_MESHES) {
|
if (bake_err == Lightmapper::BAKE_ERROR_LIGHTMAP_TOO_SMALL) {
|
||||||
|
return BAKE_ERROR_TEXTURE_SIZE_TOO_SMALL;
|
||||||
|
} else if (bake_err == Lightmapper::BAKE_ERROR_LIGHTMAP_CANT_PRE_BAKE_MESHES) {
|
||||||
return BAKE_ERROR_MESHES_INVALID;
|
return BAKE_ERROR_MESHES_INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1566,6 +1568,7 @@ void LightmapGI::_bind_methods() {
|
||||||
BIND_ENUM_CONSTANT(BAKE_ERROR_MESHES_INVALID);
|
BIND_ENUM_CONSTANT(BAKE_ERROR_MESHES_INVALID);
|
||||||
BIND_ENUM_CONSTANT(BAKE_ERROR_CANT_CREATE_IMAGE);
|
BIND_ENUM_CONSTANT(BAKE_ERROR_CANT_CREATE_IMAGE);
|
||||||
BIND_ENUM_CONSTANT(BAKE_ERROR_USER_ABORTED);
|
BIND_ENUM_CONSTANT(BAKE_ERROR_USER_ABORTED);
|
||||||
|
BIND_ENUM_CONSTANT(BAKE_ERROR_TEXTURE_SIZE_TOO_SMALL);
|
||||||
|
|
||||||
BIND_ENUM_CONSTANT(ENVIRONMENT_MODE_DISABLED);
|
BIND_ENUM_CONSTANT(ENVIRONMENT_MODE_DISABLED);
|
||||||
BIND_ENUM_CONSTANT(ENVIRONMENT_MODE_SCENE);
|
BIND_ENUM_CONSTANT(ENVIRONMENT_MODE_SCENE);
|
||||||
|
|
|
@ -132,6 +132,7 @@ public:
|
||||||
BAKE_ERROR_MESHES_INVALID,
|
BAKE_ERROR_MESHES_INVALID,
|
||||||
BAKE_ERROR_CANT_CREATE_IMAGE,
|
BAKE_ERROR_CANT_CREATE_IMAGE,
|
||||||
BAKE_ERROR_USER_ABORTED,
|
BAKE_ERROR_USER_ABORTED,
|
||||||
|
BAKE_ERROR_TEXTURE_SIZE_TOO_SMALL,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum EnvironmentMode {
|
enum EnvironmentMode {
|
||||||
|
|
Loading…
Reference in New Issue