Merge branch 'blender-v2.93-release'

This commit is contained in:
Antonio Vazquez 2021-05-17 13:06:59 +02:00
commit 50eceb2a37
3 changed files with 17 additions and 1 deletions

View File

@ -68,6 +68,17 @@ GpencilIO::GpencilIO(const GpencilIOParams *iparams)
gpd_ = (params_.ob != nullptr) ? (bGPdata *)params_.ob->data : nullptr;
cfra_ = iparams->frame_cur;
/* Calculate camera matrix. */
prepare_camera_params(iparams);
}
void GpencilIO::prepare_camera_params(const GpencilIOParams *iparams)
{
params_ = *iparams;
const bool is_pdf = params_.mode == GP_EXPORT_TO_PDF;
const bool any_camera = (params_.v3d->camera != nullptr);
const bool force_camera_view = is_pdf && any_camera;
/* Calculate camera matrix. */
Object *cam_ob = params_.v3d->camera;
if (cam_ob != nullptr) {
@ -96,7 +107,7 @@ GpencilIO::GpencilIO(const GpencilIOParams *iparams)
winy_ = params_.region->winy;
/* Camera rectangle. */
if (rv3d_->persp == RV3D_CAMOB) {
if ((rv3d_->persp == RV3D_CAMOB) || (force_camera_view)) {
render_x_ = (scene_->r.xsch * scene_->r.size) / 100;
render_y_ = (scene_->r.ysch * scene_->r.size) / 100;

View File

@ -50,6 +50,7 @@ class GpencilIO {
GpencilIO(const GpencilIOParams *iparams);
void frame_number_set(const int value);
void prepare_camera_params(const GpencilIOParams *iparams);
protected:
GpencilIOParams params_;

View File

@ -121,6 +121,7 @@ static bool gpencil_io_export_pdf(Depsgraph *depsgraph,
CFRA = i;
BKE_scene_graph_update_for_newframe(depsgraph);
exporter->prepare_camera_params(iparams);
exporter->frame_number_set(i);
exporter->add_newpage();
exporter->add_body();
@ -132,6 +133,7 @@ static bool gpencil_io_export_pdf(Depsgraph *depsgraph,
BKE_scene_graph_update_for_newframe(depsgraph);
}
else {
exporter->prepare_camera_params(iparams);
exporter->add_newpage();
exporter->add_body();
result = exporter->write();
@ -151,6 +153,8 @@ static bool gpencil_io_export_frame_svg(GpencilExporterSVG *exporter,
{
bool result = false;
exporter->frame_number_set(iparams->frame_cur);
exporter->prepare_camera_params(iparams);
if (newpage) {
result |= exporter->add_newpage();
}