Fix #133729: Crash when appending Glare node group
Blender crashes when appending a node group containing a Glare node from older versions. That's because the Glare node is versioned taking the scene resolution into account, and in case of appending a node group, there is associated scene, and accessing a nullptr scene causes the crash. To fix this, assume some default resolution in cases where the node can't be associated with a scene.
This commit is contained in:
@@ -992,9 +992,17 @@ static void do_version_glare_node_options_to_inputs(const Scene *scene,
|
||||
return 1.0f - blender::math::clamp(-mix, 0.0f, 1.0f);
|
||||
};
|
||||
|
||||
/* Function to remap the Size property to its new range. See function description. */
|
||||
/* Find the render size to guess the Size value. The node tree might not belong to a scene, so we
|
||||
* just assume an arbitrary HDTV 1080p render size. */
|
||||
blender::int2 render_size;
|
||||
BKE_render_resolution(&scene->r, true, &render_size.x, &render_size.y);
|
||||
if (scene) {
|
||||
BKE_render_resolution(&scene->r, true, &render_size.x, &render_size.y);
|
||||
}
|
||||
else {
|
||||
render_size = blender::int2(1920, 1080);
|
||||
}
|
||||
|
||||
/* Function to remap the Size property to its new range. See function description. */
|
||||
const int max_render_size = blender::math::reduce_max(render_size);
|
||||
auto size_to_linear = [&](const int size) {
|
||||
if (storage->type == CMP_NODE_GLARE_BLOOM) {
|
||||
|
||||
Reference in New Issue
Block a user