22using Alembic::AbcGeom::CameraSample;
23using Alembic::AbcGeom::ICamera;
24using Alembic::AbcGeom::ICompoundProperty;
25using Alembic::AbcGeom::IFloatProperty;
26using Alembic::AbcGeom::ISampleSelector;
27using Alembic::AbcGeom::kWrapExisting;
34 ICamera abc_cam(
m_iobject, kWrapExisting);
35 m_schema = abc_cam.getSchema();
42 return m_schema.valid();
46 const Alembic::AbcCoreAbstract::ObjectHeader &alembic_header,
48 const char **r_err_str)
const
50 if (!Alembic::AbcGeom::ICamera::matches(alembic_header)) {
52 "Object type mismatch, Alembic object path pointed to Camera when importing, but not any "
58 *r_err_str =
RPT_(
"Object type mismatch, Alembic object path points to Camera");
69 CameraSample cam_sample;
70 m_schema.get(cam_sample, sample_sel);
72 ICompoundProperty customDataContainer = m_schema.getUserProperties();
74 if (customDataContainer.valid() && customDataContainer.getPropertyHeader(
"stereoDistance") &&
75 customDataContainer.getPropertyHeader(
"eyeSeparation"))
77 IFloatProperty convergence_plane(customDataContainer,
"stereoDistance");
78 IFloatProperty eye_separation(customDataContainer,
"eyeSeparation");
84 const float lens =
float(cam_sample.getFocalLength());
85 const float apperture_x =
float(cam_sample.getHorizontalAperture());
86 const float apperture_y =
float(cam_sample.getVerticalAperture());
87 const float h_film_offset =
float(cam_sample.getHorizontalFilmOffset());
88 const float v_film_offset =
float(cam_sample.getVerticalFilmOffset());
89 const float film_aspect = apperture_x / apperture_y;
94 bcam->
shiftx = h_film_offset / apperture_x;
95 bcam->
shifty = v_film_offset / apperture_y / film_aspect;
Camera data-block and utility functions.
void * BKE_camera_add(struct Main *bmain, const char *name)
General operations, lookup, etc. for blender objects.
Object * BKE_object_add_only_object(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 **r_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
draw_view in_light_buf[] float
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