Fix #100596: Use sequencer override camera for line art in render

Line art doesn't take sequencer scene override camera into account when
computing line results, now it will try to get override camera info from
render and use that camera if line art override camera itself isn't set.

This will however not fix VSE preview line art result, since the preview
render doesn't give actual camera object, but rather uses a set of clip
planes and matrix info, thus it's probably not possible to do preview
camera override under current architecture.

Pull Request: https://projects.blender.org/blender/blender/pulls/110287
This commit is contained in:
ChengduLittleA 2023-09-19 15:27:47 +02:00 committed by YimingWu
parent dd23e957ea
commit 954ae19b2b
2 changed files with 22 additions and 10 deletions

View File

@ -13,6 +13,7 @@ set(INC
../editors/include
../makesrna
../render
../render/intern
../windowmanager
../../../intern/eigen

View File

@ -52,6 +52,9 @@
#include "DNA_scene_types.h"
#include "MEM_guardedalloc.h"
#include "RE_pipeline.h"
#include "render_types.h"
#include "lineart_intern.h"
struct LineartIsecSingle {
@ -4991,34 +4994,42 @@ bool MOD_lineart_compute_feature_lines(Depsgraph *depsgraph,
LineartData *ld;
Scene *scene = DEG_get_evaluated_scene(depsgraph);
int intersections_only = 0; /* Not used right now, but preserve for future. */
Object *use_camera;
Object *lineart_camera = nullptr;
double t_start;
if (G.debug_value == 4000) {
t_start = PIL_check_seconds_timer();
}
bool use_render_camera_override = false;
if (lmd->calculation_flags & LRT_USE_CUSTOM_CAMERA) {
if (!lmd->source_camera ||
(use_camera = DEG_get_evaluated_object(depsgraph, lmd->source_camera))->type != OB_CAMERA)
(lineart_camera = DEG_get_evaluated_object(depsgraph, lmd->source_camera))->type !=
OB_CAMERA)
{
return false;
}
}
else {
BKE_scene_camera_switch_update(scene);
if (!scene->camera) {
return false;
Render *render = RE_GetSceneRender(scene);
if (render && render->camera_override) {
lineart_camera = DEG_get_evaluated_object(depsgraph, render->camera_override);
use_render_camera_override = true;
}
if (!lineart_camera) {
BKE_scene_camera_switch_update(scene);
if (!scene->camera) {
return false;
}
lineart_camera = scene->camera;
}
use_camera = scene->camera;
}
LineartCache *lc = lineart_init_cache();
*cached_result = lc;
ld = lineart_create_render_buffer(scene, lmd, use_camera, scene->camera, lc);
ld = lineart_create_render_buffer(
scene, lmd, lineart_camera, use_render_camera_override ? lineart_camera : scene->camera, lc);
/* Triangle thread testing data size varies depending on the thread count.
* See definition of LineartTriangleThread for details. */
@ -5042,7 +5053,7 @@ bool MOD_lineart_compute_feature_lines(Depsgraph *depsgraph,
lineart_main_load_geometries(depsgraph,
scene,
use_camera,
lineart_camera,
ld,
lmd->calculation_flags & LRT_ALLOW_DUPLI_OBJECTS,
false,