22 using Alembic::Abc::OObject;
23 using Alembic::AbcGeom::FloatArraySample;
24 using Alembic::AbcGeom::OBoolProperty;
25 using Alembic::AbcGeom::OCompoundProperty;
26 using Alembic::AbcGeom::ONuPatch;
27 using Alembic::AbcGeom::ONuPatchSchema;
38 const char *abc_parent_path = abc_parent.getFullName().c_str();
40 for (
size_t i = 0; i < num_nurbs; i++) {
41 std::stringstream patch_name_stream;
44 while (abc_parent.getChildHeader(patch_name_stream.str())) {
45 patch_name_stream <<
"_";
48 std::string patch_name = patch_name_stream.str();
49 CLOG_INFO(&
LOG, 2,
"exporting %s/%s", abc_parent_path, patch_name.c_str());
52 abc_nurbs_.push_back(nurbs);
53 abc_nurbs_schemas_.push_back(nurbs.getSchema());
59 if (abc_nurbs_.empty()) {
69 if (abc_nurbs_.empty()) {
70 return Alembic::Abc::OCompoundProperty();
82 return (cu->
key !=
nullptr);
90 static void get_knots(std::vector<float> &knots,
const int num_knots,
float *nu_knots)
98 knots.reserve(num_knots + 2);
100 knots.push_back(0.0f);
102 for (
int i = 0; i < num_knots; i++) {
103 knots.push_back(nu_knots[i]);
106 knots[0] = 2.0f * knots[1] - knots[2];
107 knots.push_back(2.0f * knots[num_knots] - knots[num_knots - 1]);
115 if (
context.object->runtime.curve_cache->deformed_nurbs.first !=
nullptr) {
116 nulb = &
context.object->runtime.curve_cache->deformed_nurbs;
124 std::vector<float> knotsU;
127 std::vector<float> knotsV;
130 const int size = nu->pntsu * nu->pntsv;
132 std::vector<float> weights(
size);
134 const BPoint *bp = nu->bp;
136 for (
int i = 0; i <
size; i++, bp++) {
138 weights[i] = bp->
vec[3];
141 ONuPatchSchema::Sample
sample;
142 sample.setUOrder(nu->orderu + 1);
143 sample.setVOrder(nu->orderv + 1);
145 sample.setPositionWeights(weights);
146 sample.setUKnot(FloatArraySample(knotsU));
147 sample.setVKnot(FloatArraySample(knotsV));
153 OCompoundProperty user_props = abc_nurbs_schemas_[
count].getUserProperties();
156 OBoolProperty prop(user_props,
"endpoint_u");
161 OBoolProperty prop(user_props,
"endpoint_v");
166 OBoolProperty prop(user_props,
"cyclic_u");
171 OBoolProperty prop(user_props,
"cyclic_v");
ListBase * BKE_curve_nurbs_get(struct Curve *cu)
int BLI_listbase_count(const struct ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
#define CLOG_INFO(clg_ref, level,...)
Object is a sort of wrapper for general info.
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Alembic::Abc::OCompoundProperty abc_schema_prop_for_custom_props(T abc_schema)
uint32_t timesample_index_
const ABCWriterConstructorArgs args_
virtual bool check_is_animated(const HierarchyContext &context) const override
virtual bool is_supported(const HierarchyContext *context) const override
virtual void create_alembic_objects(const HierarchyContext *context) override
ABCNurbsWriter(const ABCWriterConstructorArgs &args)
virtual void do_write(HierarchyContext &context) override
virtual Alembic::Abc::OObject get_alembic_object() const override
Alembic::Abc::OCompoundProperty abc_prop_for_custom_props() override
static void get_knots(std::vector< float > &knots, const int num_knots, float *nu_knots)
BLI_INLINE void copy_yup_from_zup(float yup[3], const float zup[3])
MutableSpan< float3 > positions
Alembic::Abc::OObject abc_parent