33 using Alembic::AbcGeom::CameraSample;
34 using Alembic::AbcGeom::ICamera;
35 using Alembic::AbcGeom::ICompoundProperty;
36 using Alembic::AbcGeom::IFloatProperty;
37 using Alembic::AbcGeom::ISampleSelector;
38 using Alembic::AbcGeom::kWrapExisting;
45 ICamera abc_cam(
m_iobject, kWrapExisting);
46 m_schema = abc_cam.getSchema();
53 return m_schema.valid();
57 const Alembic::AbcCoreAbstract::ObjectHeader &alembic_header,
59 const char **err_str)
const
61 if (!Alembic::AbcGeom::ICamera::matches(alembic_header)) {
63 "Object type mismatch, Alembic object path pointed to Camera when importing, but not any "
69 *err_str =
"Object type mismatch, Alembic object path points to Camera.";
80 CameraSample cam_sample;
81 m_schema.get(cam_sample, sample_sel);
83 ICompoundProperty customDataContainer = m_schema.getUserProperties();
85 if (customDataContainer.valid() && customDataContainer.getPropertyHeader(
"stereoDistance") &&
86 customDataContainer.getPropertyHeader(
"eyeSeparation")) {
87 IFloatProperty convergence_plane(customDataContainer,
"stereoDistance");
88 IFloatProperty eye_separation(customDataContainer,
"eyeSeparation");
94 const float lens =
static_cast<float>(cam_sample.getFocalLength());
95 const float apperture_x =
static_cast<float>(cam_sample.getHorizontalAperture());
96 const float apperture_y =
static_cast<float>(cam_sample.getVerticalAperture());
97 const float h_film_offset =
static_cast<float>(cam_sample.getHorizontalFilmOffset());
98 const float v_film_offset =
static_cast<float>(cam_sample.getVerticalFilmOffset());
99 const float film_aspect = apperture_x / apperture_y;
104 bcam->
shiftx = h_film_offset / apperture_x;
105 bcam->
shifty = v_film_offset / apperture_y / film_aspect;
106 bcam->
clip_start =
max_ff(0.1f,
static_cast<float>(cam_sample.getNearClippingPlane()));
107 bcam->
clip_end =
static_cast<float>(cam_sample.getFarClippingPlane());
Camera data-block and utility functions.
void * BKE_camera_add(struct Main *bmain, const char *name)
General operations, lookup, etc. for blender objects.
struct Object * BKE_object_add_only_object(struct Main *bmain, int type, const char *name) ATTR_NONNULL(1) ATTR_RETURNS_NONNULL
MINLINE float max_ff(float a, float b)
Object is a sort of wrapper for general info.
bool accepts_object_type(const Alembic::AbcCoreAbstract::ObjectHeader &alembic_header, const Object *const ob, const char **err_str) const
AbcCameraReader(const Alembic::Abc::IObject &object, ImportSettings &settings)
void readObjectData(Main *bmain, const Alembic::Abc::ISampleSelector &sample_sel)
std::string m_object_name
Alembic::Abc::IObject m_iobject
void get_min_max_time(const Alembic::AbcGeom::IObject &object, const Schema &schema, chrono_t &min, chrono_t &max)
float convergence_distance
float interocular_distance
struct CameraStereoSettings stereo
struct CameraDOFSettings dof