Alembic: export render resolution on cameras

Blender's cameras don't have specific resolution configured to them,
instead they use the scene's resolution.
This is a problem when exporting a camera using Alembic. Other software
(like Houdini) expects the resolution parameters on the camera itself.

So now store the scene's resolution on each camera that is exported.
Since this is not part of the concept of a camera in alembic itself,
export these as `userProperties` in a way other software can read this.

Fixes #116375

Pull Request: https://projects.blender.org/blender/blender/pulls/116782
This commit is contained in:
Philipp Oeser
2024-01-04 17:49:28 +01:00
committed by Philipp Oeser
parent 6cfbf9ef2f
commit 5412bd48a9

View File

@@ -10,6 +10,7 @@
#include "abc_hierarchy_iterator.h"
#include "BKE_camera.h"
#include "BKE_scene.h"
#include "BLI_assert.h"
@@ -44,6 +45,16 @@ void ABCCameraWriter::create_alembic_objects(const HierarchyContext * /*context*
abc_custom_data_container_, "stereoDistance", timesample_index_);
abc_eye_separation_ = OFloatProperty(
abc_custom_data_container_, "eyeSeparation", timesample_index_);
/* Export scene render resolution on cameras as userProperties, for other software (e.g.
* Houdini). */
OFloatProperty render_resx(abc_custom_data_container_, "resx");
OFloatProperty render_resy(abc_custom_data_container_, "resy");
Scene *scene = DEG_get_evaluated_scene(args_.depsgraph);
int width, height;
BKE_render_resolution(&scene->r, false, &width, &height);
render_resx.set(float(width));
render_resy.set(float(height));
}
Alembic::Abc::OObject ABCCameraWriter::get_alembic_object() const