19 using Alembic::AbcGeom::CameraSample;
20 using Alembic::AbcGeom::ICamera;
21 using Alembic::AbcGeom::ICompoundProperty;
22 using Alembic::AbcGeom::IFloatProperty;
23 using Alembic::AbcGeom::ISampleSelector;
24 using Alembic::AbcGeom::kWrapExisting;
31 ICamera abc_cam(
m_iobject, kWrapExisting);
32 m_schema = abc_cam.getSchema();
39 return m_schema.valid();
43 const Alembic::AbcCoreAbstract::ObjectHeader &alembic_header,
45 const char **err_str)
const
47 if (!Alembic::AbcGeom::ICamera::matches(alembic_header)) {
49 "Object type mismatch, Alembic object path pointed to Camera when importing, but not any "
55 *err_str =
"Object type mismatch, Alembic object path points to Camera.";
66 CameraSample cam_sample;
67 m_schema.get(cam_sample, sample_sel);
69 ICompoundProperty customDataContainer = m_schema.getUserProperties();
71 if (customDataContainer.valid() && customDataContainer.getPropertyHeader(
"stereoDistance") &&
72 customDataContainer.getPropertyHeader(
"eyeSeparation")) {
73 IFloatProperty convergence_plane(customDataContainer,
"stereoDistance");
74 IFloatProperty eye_separation(customDataContainer,
"eyeSeparation");
80 const float lens =
static_cast<float>(cam_sample.getFocalLength());
81 const float apperture_x =
static_cast<float>(cam_sample.getHorizontalAperture());
82 const float apperture_y =
static_cast<float>(cam_sample.getVerticalAperture());
83 const float h_film_offset =
static_cast<float>(cam_sample.getHorizontalFilmOffset());
84 const float v_film_offset =
static_cast<float>(cam_sample.getVerticalFilmOffset());
85 const float film_aspect = apperture_x / apperture_y;
90 bcam->
shiftx = h_film_offset / apperture_x;
91 bcam->
shifty = v_film_offset / apperture_y / film_aspect;
92 bcam->
clip_start =
max_ff(0.1f,
static_cast<float>(cam_sample.getNearClippingPlane()));
93 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_RETURNS_NONNULL
MINLINE float max_ff(float a, float b)
Object is a sort of wrapper for general info.
AbcCameraReader(const Alembic::Abc::IObject &object, ImportSettings &settings)
bool accepts_object_type(const Alembic::AbcCoreAbstract::ObjectHeader &alembic_header, const Object *const ob, const char **err_str) const override
void readObjectData(Main *bmain, const Alembic::Abc::ISampleSelector &sample_sel) override
bool valid() const override
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