Blender V5.3
abc_reader_curves.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2016 Kévin Dietrich. All rights reserved.
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include "abc_reader_curves.h"
10#include "abc_axis_conversion.h"
11#include "abc_util.h"
12
13#include "DNA_curves_types.h"
14#include "DNA_modifier_types.h"
15#include "DNA_object_types.h"
16
17#include "BKE_attribute.hh"
18#include "BKE_curves.hh"
19#include "BKE_geometry_set.hh"
20#include "BKE_object.hh"
21
22#include "BLI_vector.hh"
23
24#include "BLT_translation.hh"
25
26#include "CLG_log.h"
27#include "IO_validate.hh"
28
29namespace blender {
30
31using Alembic::Abc::FloatArraySamplePtr;
32using Alembic::Abc::Int32ArraySamplePtr;
33using Alembic::Abc::P3fArraySamplePtr;
34using Alembic::Abc::PropertyHeader;
35using Alembic::Abc::UcharArraySamplePtr;
36
37using Alembic::AbcGeom::CurvePeriodicity;
38using Alembic::AbcGeom::ICompoundProperty;
39using Alembic::AbcGeom::ICurves;
40using Alembic::AbcGeom::ICurvesSchema;
41using Alembic::AbcGeom::IFloatGeomParam;
42using Alembic::AbcGeom::IInt16Property;
43using Alembic::AbcGeom::ISampleSelector;
44using Alembic::AbcGeom::IV3fArrayProperty;
45using Alembic::AbcGeom::kWrapExisting;
46
47namespace io::alembic {
48
49static CLG_LogRef LOG = {"io.alembic"};
50
51static IndexRange get_sane_range(IndexRange range, size_t alembic_size)
52{
53 return IndexRange(std::min(range.size(), int64_t(alembic_size)));
54}
55
56/* Specialization of #has_animations() as defined in abc_reader_object.h. */
57template<> bool has_animations(Alembic::AbcGeom::ICurvesSchema &schema, ImportSettings *settings)
58{
59 if (settings->is_sequence || !schema.isConstant()) {
60 return true;
61 }
62
63 /* NOTE: ICurvesSchema::isConstant() checks a few attributes already, here we check for widths
64 * and velocities. There are other attributes which may be animated, like curve orders or
65 * periodicity, which we ignore for now until we meet such files in the wild. */
66
67 IFloatGeomParam widths_param = schema.getWidthsParam();
68 if (widths_param.valid() && !widths_param.isConstant()) {
69 return true;
70 }
71
72 IV3fArrayProperty velocities_prop = schema.getVelocitiesProperty();
73 if (velocities_prop.valid() && !velocities_prop.isConstant()) {
74 return true;
75 }
76
77 return false;
78}
79
80static int16_t get_curve_resolution(const ICurvesSchema &schema,
81 const Alembic::Abc::ISampleSelector &sample_sel)
82{
83 ICompoundProperty user_props = schema.getUserProperties();
84 if (!user_props) {
85 return 0;
86 }
87
88 const PropertyHeader *header = user_props.getPropertyHeader(ABC_CURVE_RESOLUTION_U_PROPNAME);
89 if (!header || !header->isScalar() || !IInt16Property::matches(*header)) {
90 return 0;
91 }
92
93 IInt16Property resolu(user_props, header->getName());
94 return resolu.getValue(sample_sel);
95}
96
97static int16_t get_curve_order(const Alembic::AbcGeom::CurveType abc_curve_type,
98 const UcharArraySamplePtr orders,
99 const size_t curve_index)
100{
101 switch (abc_curve_type) {
102 case Alembic::AbcGeom::kCubic:
103 return 4;
104 case Alembic::AbcGeom::kVariableOrder:
105 if (orders && orders->size() > curve_index) {
106 return int16_t((*orders)[curve_index]);
107 }
109 case Alembic::AbcGeom::kLinear:
110 default:
111 return 2;
112 }
113}
114
115static int8_t get_knot_mode(const Alembic::AbcGeom::CurveType abc_curve_type)
116{
117 if (abc_curve_type == Alembic::AbcGeom::kCubic) {
119 }
120
122}
123
124static int get_curve_overlap(const P3fArraySamplePtr positions,
125 const int idx,
126 const int num_verts,
127 const int16_t order)
128{
129 /* Check the number of points which overlap, we don't have overlapping points in Blender, but
130 * other software do use them to indicate that a curve is actually cyclic. Usually the number of
131 * overlapping points is equal to the order/degree of the curve.
132 */
133
134 const int start = idx;
135 const int end = idx + num_verts;
136 int overlap = 0;
137
138 const int safe_order = order <= num_verts ? order : num_verts;
139 for (int j = start, k = end - safe_order; j < (start + safe_order); j++, k++) {
140 const Imath::V3f &p1 = (*positions)[j];
141 const Imath::V3f &p2 = (*positions)[k];
142
143 if (p1 != p2) {
144 break;
145 }
146
147 overlap++;
148 }
149
150 /* TODO: Special case, need to figure out how it coincides with knots. */
151 if (overlap == 0 && num_verts > 2 && (*positions)[start] == (*positions)[end - 1]) {
152 overlap = 1;
153 }
154
155 return overlap;
156}
157
158static CurveType get_curve_type(const Alembic::AbcGeom::BasisType basis)
159{
160 switch (basis) {
161 case Alembic::AbcGeom::kNoBasis:
162 return CURVE_TYPE_POLY;
163 case Alembic::AbcGeom::kBezierBasis:
164 return CURVE_TYPE_BEZIER;
165 case Alembic::AbcGeom::kBsplineBasis:
166 return CURVE_TYPE_NURBS;
167 case Alembic::AbcGeom::kCatmullromBasis:
169 case Alembic::AbcGeom::kHermiteBasis:
170 case Alembic::AbcGeom::kPowerBasis:
171 /* Those types are unknown to Blender, use a default poly type. */
172 return CURVE_TYPE_POLY;
173 }
174 return CURVE_TYPE_POLY;
175}
176
177static inline int bezier_point_count(int alembic_count, bool is_cyclic)
178{
179 return is_cyclic ? (alembic_count / 3) : ((alembic_count / 3) + 1);
180}
181
182static inline float3 to_zup_float3(Imath::V3f v)
183{
184 float3 p;
185 copy_zup_from_yup(p, v.getValue());
186 return p;
187}
188
190 Span<int> preprocessed_offsets)
191{
192 if (curves.offsets() != preprocessed_offsets) {
193 return true;
194 }
195 return false;
196}
197
198template<typename SampleType>
199static bool samples_have_same_topology(const SampleType &sample, const SampleType &ceil_sample)
200{
201 const P3fArraySamplePtr positions = sample.getPositions();
202 const Int32ArraySamplePtr per_curve_vertices_count = sample.getCurvesNumVertices();
203
204 const P3fArraySamplePtr ceil_positions = ceil_sample.getPositions();
205 const Int32ArraySamplePtr ceil_per_curve_vertices_count = ceil_sample.getCurvesNumVertices();
206
207 /* It the counters are different, we can be sure the topology is different. */
208 const bool different_counters = positions->size() != ceil_positions->size() ||
209 per_curve_vertices_count->size() !=
210 ceil_per_curve_vertices_count->size();
211 if (different_counters) {
212 return false;
213 }
214
215 /* Otherwise check the curve vertex counts. */
216 if (memcmp(per_curve_vertices_count->get(),
217 ceil_per_curve_vertices_count->get(),
218 per_curve_vertices_count->size() * sizeof(int)) != 0)
219 {
220 return false;
221 }
222
223 return true;
224}
225
226/* Preprocessed data to help and simplify converting curve data from Alembic to Blender.
227 * As some operations may require to look up the Alembic sample multiple times, we just
228 * do it once and cache the results in this.
229 */
231 /* This holds one value for each spline. This will be used to lookup the data at the right
232 * indices, and will also be used to set #CurveGeometry.offsets. */
234 /* This holds one value for each spline, and tells where in the Alembic curve sample the spline
235 * actually starts, accounting for duplicate points indicating cyclicity. */
237 /* This holds one value for each spline to tell whether it is cyclic. */
239 /* This holds one value for each spline which define its order. */
241
242 /* True if any values of `curves_overlaps` is true. If so, we will need to copy the
243 * `curves_overlaps` to an attribute on the Blender curves. */
244 bool do_cyclic = false;
245
246 /* Only one curve type for the whole objects. */
249
250 /* Optional settings for reading interpolated vertices. If present, `ceil_positions` has to be
251 * valid. */
252 std::optional<SampleInterpolationSettings> interpolation_settings;
253
254 /* Store the pointers during preprocess so we do not have to look up the sample twice. */
255 P3fArraySamplePtr positions = nullptr;
256 P3fArraySamplePtr ceil_positions = nullptr;
257 FloatArraySamplePtr weights = nullptr;
258 FloatArraySamplePtr radii = nullptr;
259 Alembic::AbcGeom::GeometryScope radii_scope;
260
261 V3fArraySamplePtr velocities = nullptr;
262};
263
264/* Compute topological information about the curves. We do this step mainly to properly account
265 * for curves overlaps which imply different offsets between Blender and Alembic, but also to
266 * validate the data and cache some values. */
267static std::optional<PreprocessedSampleData> preprocess_sample(
268 StringRefNull iobject_name,
269 const AbcReadGeometryParams &read_params,
270 const ICurvesSchema &schema,
271 const ISampleSelector sample_sel)
272{
273
274 ICurvesSchema::Sample smp;
275 try {
276 smp = schema.getValue(sample_sel);
277 }
278 catch (Alembic::Util::Exception &ex) {
279 CLOG_WARN(&LOG,
280 "Error reading curve sample for '%s/%s' at time %f: %s",
281 iobject_name.c_str(),
282 schema.getName().c_str(),
283 sample_sel.getRequestedTime(),
284 ex.what());
285 return {};
286 }
287
288 /* NOTE: although Alembic can store knots, we do not read them as the functionality is not
289 * exposed by the Blender's Curves API yet. */
290 const Int32ArraySamplePtr per_curve_vertices_count = smp.getCurvesNumVertices();
291 const P3fArraySamplePtr positions = smp.getPositions();
292 const FloatArraySamplePtr weights = smp.getPositionWeights();
293 const CurvePeriodicity periodicity = smp.getWrap();
294 const UcharArraySamplePtr orders = smp.getOrders();
295
296 if (positions->size() == 0) {
297 return {};
298 }
299
300 if (!validate::size_fits_in_int(positions->size()) ||
301 !validate::size_fits_in_int(per_curve_vertices_count->size()))
302 {
303 CLOG_WARN(&LOG,
304 "Curves too large to import for '%s/%s' at time %f, exceeds max int size",
305 iobject_name.c_str(),
306 schema.getName().c_str(),
307 sample_sel.getRequestedTime());
308 return {};
309 }
310
311 const IFloatGeomParam widths_param = schema.getWidthsParam();
312 FloatArraySamplePtr radii;
313 if (widths_param.valid()) {
314 IFloatGeomParam::Sample wsample = widths_param.getExpandedValue(sample_sel);
315 radii = wsample.getVals();
316 }
317
318 const int curve_count = per_curve_vertices_count->size();
319
321 /* Add 1 as these store offsets with the actual value being `offset[i + 1] - offset[i]`. */
322 data.offset_in_blender.resize(curve_count + 1);
323 data.offset_in_alembic.resize(curve_count + 1);
324 data.curves_cyclic.resize(curve_count);
325 data.curve_type = get_curve_type(smp.getBasis());
326 data.knot_mode = get_knot_mode(smp.getType());
327 data.do_cyclic = periodicity == Alembic::AbcGeom::kPeriodic;
328
329 /* If #kVariableOrder is set then we must have order data. If not, this sample is suspect.
330 * Interpret the data as linear as a fallback. See #126324 for one such example.
331 * See also: Alembic source code in `ICurves.h`, #ICurvesSchema::Sample::valid() */
332 if (smp.getType() == Alembic::AbcGeom::kVariableOrder && !orders) {
333 data.curve_type = CURVE_TYPE_POLY;
334 data.knot_mode = NURBS_KNOT_MODE_NORMAL;
335 data.do_cyclic = false;
336 }
337
338 if (data.curve_type == CURVE_TYPE_NURBS) {
339 data.curves_orders.resize(curve_count);
340 }
341
342 /* Compute topological information. */
343
344 const int positions_size = positions->size();
345 int blender_offset = 0;
346 int alembic_offset = 0;
347 for (size_t i = 0; i < curve_count; i++) {
348 int vertices_count = (*per_curve_vertices_count)[i];
349
350 /* Guard against invalid vertex counts. */
351 if (vertices_count < 0 || vertices_count > positions_size - alembic_offset) {
352 vertices_count = std::max(0, positions_size - alembic_offset);
353 }
354
355 const int curve_order = get_curve_order(smp.getType(), orders, i);
356
357 data.offset_in_blender[i] = blender_offset;
358 data.offset_in_alembic[i] = alembic_offset;
359 data.curves_cyclic[i] = data.do_cyclic;
360
361 if (data.curve_type == CURVE_TYPE_NURBS) {
362 data.curves_orders[i] = curve_order;
363 }
364
365 /* Some software writes repeated vertices to indicate periodicity but Blender
366 * should skip these if present. */
367 const int overlap = data.do_cyclic ?
369 positions, alembic_offset, vertices_count, curve_order) :
370 0;
371
372 if (data.curve_type == CURVE_TYPE_BEZIER) {
373 blender_offset += bezier_point_count(vertices_count, data.do_cyclic);
374 }
375 else {
376 blender_offset += (overlap >= vertices_count) ? vertices_count : (vertices_count - overlap);
377 }
378
379 alembic_offset += vertices_count;
380 }
381 data.offset_in_blender[curve_count] = blender_offset;
382 data.offset_in_alembic[curve_count] = alembic_offset;
383
384 /* Store relevant pointers. */
385
386 data.positions = positions;
387
388 if (weights && weights->size() > 1) {
389 data.weights = weights;
390 }
391
392 if (radii && radii->size() >= 1) {
393 data.radii_scope = widths_param.getScope();
394 data.radii = radii;
395 }
396
397 const std::optional<SampleInterpolationSettings> interpolation_settings =
399 sample_sel, schema.getTimeSampling(), schema.getNumSamples());
400
401 const bool use_interpolation = read_params.read_flag & MOD_MESHSEQ_INTERPOLATE_VERTICES;
402 if (use_interpolation && interpolation_settings.has_value()) {
403 Alembic::AbcGeom::ICurvesSchema::Sample ceil_smp;
404 schema.get(ceil_smp, Alembic::Abc::ISampleSelector(interpolation_settings->ceil_index));
405 if (samples_have_same_topology(smp, ceil_smp)) {
406 data.ceil_positions = ceil_smp.getPositions();
407 data.interpolation_settings = interpolation_settings;
408 }
409 }
410
411 if (!read_params.velocity_name.empty() && read_params.velocity_scale != 0.0f) {
412 data.velocities = get_velocity_prop(schema, sample_sel, read_params.velocity_name);
413 }
414
415 return data;
416}
417
419{
420 ICurves abc_curves(m_iobject, kWrapExisting);
421 m_curves_schema = abc_curves.getSchema();
422}
423
425{
426 return m_curves_schema.valid();
427}
428
430 const Alembic::AbcCoreAbstract::ObjectHeader &alembic_header,
431 const Object *const ob,
432 const char **r_err_str) const
433{
434 if (!Alembic::AbcGeom::ICurves::matches(alembic_header)) {
435 *r_err_str = RPT_(
436 "Object type mismatch, Alembic object path pointed to Curves when importing, but not "
437 "anymore.");
438 return false;
439 }
440
441 if (ob->type != OB_CURVES) {
442 *r_err_str = RPT_("Object type mismatch, Alembic object path points to Curves.");
443 return false;
444 }
445
446 return true;
447}
448
449void AbcCurveReader::readObjectData(Main *bmain, const Alembic::Abc::ISampleSelector &sample_sel)
450{
451 Curves *curves = BKE_curves_add(bmain, m_data_name.c_str());
452
454 m_object->data = id_cast<ID *>(curves);
455
456 AbcReadGeometryParams read_params{};
457 read_curves_sample(curves, read_params, m_curves_schema, sample_sel);
458
461 }
462}
463
465 const Span<Imath::V3f> &ceil_positions,
466 int i,
467 float weight)
468{
469 float3 p;
470 const Imath::V3f &floor_pos = floor_positions[i];
471 const Imath::V3f &ceil_pos = ceil_positions[i];
472
473 interp_v3_v3v3(p, floor_pos.getValue(), ceil_pos.getValue(), weight);
474 copy_zup_from_yup(p, p);
475 return p;
476}
477
478static void add_bezier_control_point(int cp,
479 int offset,
480 const Span<Imath::V3f> floor_positions,
481 const Span<Imath::V3f> ceil_positions,
482 MutableSpan<float3> positions,
483 MutableSpan<float3> handles_left,
484 MutableSpan<float3> handles_right,
485 float weight)
486{
487 positions[cp] = interpolate_to_zup(floor_positions, ceil_positions, offset, weight);
488 if (offset == 0) {
489 handles_right[cp] = interpolate_to_zup(floor_positions, ceil_positions, offset + 1, weight);
490 handles_left[cp] = 2.0f * positions[cp] - handles_right[cp];
491 }
492 else if (offset == floor_positions.size() - 1) {
493 handles_left[cp] = interpolate_to_zup(floor_positions, ceil_positions, offset - 1, weight);
494 handles_right[cp] = 2.0f * positions[cp] - handles_left[cp];
495 }
496 else {
497 handles_left[cp] = interpolate_to_zup(floor_positions, ceil_positions, offset - 1, weight);
498 handles_right[cp] = interpolate_to_zup(floor_positions, ceil_positions, offset + 1, weight);
499 }
500}
501
503 const AbcReadGeometryParams &read_params,
504 const ICurvesSchema &schema,
505 const ISampleSelector &sample_sel)
506{
507 std::optional<PreprocessedSampleData> opt_preprocess = preprocess_sample(
508 m_iobject.getFullName(), read_params, schema, sample_sel);
509 if (!opt_preprocess) {
510 return;
511 }
512
513 const PreprocessedSampleData &data = opt_preprocess.value();
514
515 const int point_count = data.offset_in_blender.last();
516 const int curve_count = data.offset_in_blender.size() - 1;
517
518 bke::CurvesGeometry &curves = curves_id->geometry.wrap();
519
520 if (curves_topology_changed(curves, data.offset_in_blender)) {
521 curves.resize(point_count, curve_count);
522 curves.offsets_for_write().copy_from(data.offset_in_blender);
523 }
524
525 curves.fill_curve_types(data.curve_type);
526
527 if (data.curve_type != CURVE_TYPE_POLY) {
528 int16_t curve_resolution = get_curve_resolution(schema, sample_sel);
529 if (curve_resolution > 0) {
530 curves.resolution_for_write().fill(curve_resolution);
531 }
532 }
533
534 MutableSpan<float3> curves_positions = curves.positions_for_write();
535
536 Span<Imath::V3f> alembic_points{&(*data.positions)[0], int64_t((*data.positions).size())};
537 Span<Imath::V3f> alembic_points_ceil;
538 float interp_weight = 0.0f;
539 if (data.interpolation_settings.has_value()) {
540 alembic_points_ceil = {&(*data.ceil_positions)[0], int64_t((*data.ceil_positions).size())};
541 interp_weight = data.interpolation_settings->weight;
542 }
543 else {
544 alembic_points_ceil = alembic_points;
545 }
546
547 if (data.curve_type == CURVE_TYPE_BEZIER) {
548 curves.handle_types_left_for_write().fill(BEZIER_HANDLE_ALIGN);
549 curves.handle_types_right_for_write().fill(BEZIER_HANDLE_ALIGN);
550
551 MutableSpan<float3> handles_right = curves.handle_positions_right_for_write();
552 MutableSpan<float3> handles_left = curves.handle_positions_left_for_write();
553
554 int point_offset = 0;
555 for (const int i_curve : curves.curves_range()) {
556 const int alembic_point_offset = data.offset_in_alembic[i_curve];
557 const int alembic_point_count = data.offset_in_alembic[i_curve + 1] - alembic_point_offset;
558 const int cp_count = data.offset_in_blender[i_curve + 1] - data.offset_in_blender[i_curve];
559
560 int cp_offset = 0;
561 for (const int cp : IndexRange(cp_count)) {
563 cp,
564 cp_offset,
565 alembic_points.slice(alembic_point_offset, alembic_point_count),
566 alembic_points_ceil.slice(alembic_point_offset, alembic_point_count),
567 curves_positions.slice(point_offset, point_count),
568 handles_left.slice(point_offset, point_count),
569 handles_right.slice(point_offset, point_count),
570 interp_weight);
571 cp_offset += 3;
572 }
573
574 point_offset += cp_count;
575 }
576 }
577 else {
578 for (const int i_curve : curves.curves_range()) {
579 int position_offset = data.offset_in_alembic[i_curve];
580 for (const int i_point : curves.points_by_curve()[i_curve]) {
581 if (data.interpolation_settings.has_value()) {
582 curves_positions[i_point] = interpolate_to_zup(
583 alembic_points, alembic_points_ceil, position_offset++, interp_weight);
584 }
585 else {
586 curves_positions[i_point] = to_zup_float3(alembic_points[position_offset++]);
587 }
588 }
589 }
590 }
591
592 if (data.do_cyclic) {
593 curves.cyclic_for_write().copy_from(data.curves_cyclic);
594 }
595
596 if (data.radii) {
597 switch (data.radii_scope) {
598 case Alembic::AbcGeom::kConstantScope: {
599 const float radius = (*data.radii)[0] / 2.0f;
600 bke::MutableAttributeAccessor attribute_accessor = curves.attributes_for_write();
601 attribute_accessor.remove("radius");
602 attribute_accessor.add<float>(
604 break;
605 }
606 case Alembic::AbcGeom::kVertexScope:
607 case Alembic::AbcGeom::kVaryingScope:
608 case Alembic::AbcGeom::kFacevaryingScope: {
609 MutableSpan<float> radii = curves.radius_for_write();
610
611 Alembic::Abc::FloatArraySample alembic_widths = *data.radii;
612 for (const int i_point : get_sane_range(curves.points_range(), alembic_widths.size())) {
613 radii[i_point] = alembic_widths[i_point] / 2.0f;
614 }
615 break;
616 }
617 case Alembic::AbcGeom::kUniformScope: {
618 MutableSpan<float> radii = curves.radius_for_write();
619
620 Alembic::Abc::FloatArraySample alembic_widths = *data.radii;
621
622 for (const int i_curve : get_sane_range(curves.curves_range(), alembic_widths.size())) {
623 for (const int i_point : curves.points_by_curve()[i_curve]) {
624 radii[i_point] = alembic_widths[i_curve] / 2.0f;
625 }
626 }
627 break;
628 }
629 case Alembic::AbcGeom::kUnknownScope:
630 break;
631 }
632 }
633
634 if (data.curve_type == CURVE_TYPE_NURBS) {
635 curves.nurbs_orders_for_write().copy_from(data.curves_orders);
636 curves.nurbs_knots_modes_for_write().fill(data.knot_mode);
637
638 if (data.weights) {
639 MutableSpan<float> curves_weights = curves.nurbs_weights_for_write();
640 Span<float> data_weights_span = {data.weights->get(), int64_t(data.weights->size())};
641 for (const int i_curve : curves.curves_range()) {
642 const int alembic_offset = data.offset_in_alembic[i_curve];
643 const IndexRange points = curves.points_by_curve()[i_curve];
644 curves_weights.slice(points).copy_from(
645 data_weights_span.slice(alembic_offset, points.size()));
646 }
647 }
648 }
649
650 if (data.velocities && data.velocities->size() == curves.point_num) {
651 bke::MutableAttributeAccessor attributes = curves.attributes_for_write();
653 "velocity", bke::AttrDomain::Point);
654 MutableSpan<float3> velocity = attr.span;
655 for (int64_t i = 0; i < curves.point_num; i++) {
656 const Imath::V3f &vel_in = (*data.velocities)[i];
657 copy_zup_from_yup(velocity[i], vel_in.getValue());
658 mul_v3_fl(velocity[i], read_params.velocity_scale);
659 }
660 attr.finish();
661 }
662}
663
665 const Alembic::Abc::ISampleSelector &sample_sel,
666 const AbcReadGeometryParams &read_params,
667 const char ** /*r_err_str*/)
668{
669 Curves *curves = geometry_set.get_curves_for_write();
670
671 read_curves_sample(curves, read_params, m_curves_schema, sample_sel);
672}
673
674} // namespace io::alembic
675} // namespace blender
Low-level operations for curves.
General operations, lookup, etc. for blender objects.
#define ATTR_FALLTHROUGH
#define RPT_(msgid)
#define CLOG_WARN(clg_ref,...)
Definition CLG_log.h:189
Object is a sort of wrapper for general info.
#define BLI_INLINE
constexpr int64_t size() const
constexpr IndexRange()=default
constexpr MutableSpan slice(const int64_t start, const int64_t size) const
Definition BLI_span.hh:579
constexpr void copy_from(Span< T > values) const
Definition BLI_span.hh:745
constexpr Span slice(int64_t start, int64_t size) const
Definition BLI_span.hh:141
constexpr int64_t size() const
Definition BLI_span.hh:256
constexpr const char * c_str() const
bool add(const StringRef name, const AttrDomain domain, const AttrType data_type, const AttributeInit &initializer)
GSpanAttributeWriter lookup_or_add_for_write_span(StringRef name, AttrDomain domain, AttrType data_type, const AttributeInit &initializer=AttributeInitDefaultValue())
void readObjectData(Main *bmain, const Alembic::Abc::ISampleSelector &sample_sel) override
AbcCurveReader(const AbcReaderConstructorArgs &args)
void read_geometry(bke::GeometrySet &geometry_set, const Alembic::Abc::ISampleSelector &sample_sel, const AbcReadGeometryParams &read_params, const char **r_err_str) override
bool accepts_object_type(const Alembic::AbcCoreAbstract::ObjectHeader &alembic_header, const Object *const ob, const char **r_err_str) const override
void read_curves_sample(Curves *curves_id, const AbcReadGeometryParams &read_params, const Alembic::AbcGeom::ICurvesSchema &schema, const Alembic::Abc::ISampleSelector &sample_selector)
AbcObjectReader(const AbcReaderConstructorArgs &args)
static float3 to_zup_float3(Imath::V3f v)
static int16_t get_curve_resolution(const ICurvesSchema &schema, const Alembic::Abc::ISampleSelector &sample_sel)
static void add_bezier_control_point(int cp, int offset, const Span< Imath::V3f > floor_positions, const Span< Imath::V3f > ceil_positions, MutableSpan< float3 > positions, MutableSpan< float3 > handles_left, MutableSpan< float3 > handles_right, float weight)
static bool curves_topology_changed(const bke::CurvesGeometry &curves, Span< int > preprocessed_offsets)
static bool samples_have_same_topology(const SampleType &sample, const SampleType &ceil_sample)
BLI_INLINE void copy_zup_from_yup(float zup[3], const float yup[3])
static IndexRange get_sane_range(IndexRange range, size_t alembic_size)
static int8_t get_knot_mode(const Alembic::AbcGeom::CurveType abc_curve_type)
V3fArraySamplePtr get_velocity_prop(const Alembic::Abc::ICompoundProperty &schema, const Alembic::AbcGeom::ISampleSelector &selector, const std::string &name)
Definition abc_util.cc:91
static std::optional< PreprocessedSampleData > preprocess_sample(StringRefNull iobject_name, const AbcReadGeometryParams &read_params, const ICurvesSchema &schema, const ISampleSelector sample_sel)
BLI_INLINE float3 interpolate_to_zup(const Span< Imath::V3f > &floor_positions, const Span< Imath::V3f > &ceil_positions, int i, float weight)
bool has_animations(Alembic::AbcGeom::ICurvesSchema &schema, ImportSettings *settings)
static CurveType get_curve_type(const Alembic::AbcGeom::BasisType basis)
static int16_t get_curve_order(const Alembic::AbcGeom::CurveType abc_curve_type, const UcharArraySamplePtr orders, const size_t curve_index)
std::optional< SampleInterpolationSettings > get_sample_interpolation_settings(const Alembic::AbcGeom::ISampleSelector &selector, const Alembic::AbcCoreAbstract::TimeSamplingPtr &time_sampling, size_t samples_number)
Definition abc_util.cc:129
static int bezier_point_count(int alembic_count, bool is_cyclic)
static int get_curve_overlap(const P3fArraySamplePtr positions, const int idx, const int num_verts, const int16_t order)
bool size_fits_in_int(const int64_t size)
BMesh Iterators.
__int64 int64_t
Definition BKE_text.h:90
struct Curves * BKE_curves_add(struct Main *bmain, const char *name)
ATTR_WARN_UNUSED_RESULT const BMVert * v
MINLINE void mul_v3_fl(float r[3], float f)
@ NURBS_KNOT_MODE_ENDPOINT
@ NURBS_KNOT_MODE_NORMAL
BMesh const char void * data
void interp_v3_v3v3(float r[3], const float a[3], const float b[3], float t)
@ MOD_MESHSEQ_INTERPOLATE_VERTICES
@ CURVE_TYPE_CATMULL_ROM
static CLG_LogRef LOG
VecBase< float, 3 > float3
Object * BKE_object_add_only_object(Main *bmain, ObjectType type, const char *name) ATTR_RETURNS_NONNULL
Definition object.cc:2265
signed char int8_t
Definition BKE_text.h:76
signed short int16_t
Definition BKE_text.h:77
std::optional< SampleInterpolationSettings > interpolation_settings
Alembic::AbcGeom::GeometryScope radii_scope