Freestyle: Fix for assertion failure in viewport preview.
An assertion to check if `re->clipsta` < 0 (added as part of addressing T36009 in rBrB795034c17d76bef2a15e576ac9c70ae2268a823b) was failing when Freestyle viewport preview rendering takes place in the camera view with an orthographic camera (in this case, the user-defined clipping range is used without changes, so that `re->clipsta` is positive). The `re->clipsta` property has a negative value only when the 3D viewport is in an orthographic view but not in the camera view. It seems that this viewport setting cannot be identified from rendering settings accessible from Freestyle. Now a negative `re->clipsta` value is directly checked instead, without relying on other render flags.
This commit is contained in:
@@ -64,12 +64,11 @@ NodeGroup *BlenderFileLoader::Load()
|
||||
_viewplane_bottom = _re->viewplane.ymin;
|
||||
_viewplane_top = _re->viewplane.ymax;
|
||||
|
||||
if ((_re->r.scemode & R_VIEWPORT_PREVIEW) && (_re->r.mode & R_ORTHO)) {
|
||||
if (_re->clipsta < 0.f) {
|
||||
// Adjust clipping start/end and set up a Z offset when the viewport preview
|
||||
// is used with the orthographic view. In this case, _re->clipsta is negative,
|
||||
// while Freestyle assumes that imported mesh data are in the camera coordinate
|
||||
// system with the view point located at origin [bug #36009].
|
||||
BLI_assert(_re->clipsta < 0.f);
|
||||
_z_near = -0.001f;
|
||||
_z_offset = _re->clipsta + _z_near;
|
||||
_z_far = -_re->clipend + _z_offset;
|
||||
|
||||
Reference in New Issue
Block a user