25using Alembic::Abc::OObject;
26using Alembic::AbcGeom::FloatArraySample;
27using Alembic::AbcGeom::OBoolProperty;
28using Alembic::AbcGeom::OCompoundProperty;
29using Alembic::AbcGeom::ONuPatch;
30using Alembic::AbcGeom::ONuPatchSchema;
36 Curve *curve =
static_cast<Curve *
>(context->object->data);
38 OObject abc_parent =
args_.abc_parent;
39 const char *abc_parent_path = abc_parent.getFullName().c_str();
41 for (
size_t i = 0;
i < num_nurbs;
i++) {
42 std::stringstream patch_name_stream;
43 patch_name_stream <<
args_.abc_name <<
'_' <<
i;
45 while (abc_parent.getChildHeader(patch_name_stream.str())) {
46 patch_name_stream <<
"_";
49 std::string patch_name = patch_name_stream.str();
50 CLOG_DEBUG(&
LOG,
"exporting %s/%s", abc_parent_path, patch_name.c_str());
53 abc_nurbs_.push_back(nurbs);
54 abc_nurbs_schemas_.push_back(nurbs.getSchema());
60 if (abc_nurbs_.empty()) {
70 if (abc_nurbs_.empty()) {
71 return Alembic::Abc::OCompoundProperty();
82 Curve *cu =
static_cast<Curve *
>(context.object->data);
83 return (cu->
key !=
nullptr);
91static void get_knots(std::vector<float> &knots,
const int num_knots,
float *nu_knots)
99 knots.reserve(num_knots + 2);
101 knots.push_back(0.0f);
103 for (
int i = 0;
i < num_knots;
i++) {
104 knots.push_back(nu_knots[
i]);
107 knots[0] = 2.0f * knots[1] - knots[2];
108 knots.push_back(2.0f * knots[num_knots] - knots[num_knots - 1]);
113 Curve *curve =
static_cast<Curve *
>(context.object->data);
116 if (context.object->runtime->curve_cache->deformed_nurbs.first !=
nullptr) {
117 nulb = &context.object->runtime->curve_cache->deformed_nurbs;
125 std::vector<float> knotsU;
128 std::vector<float> knotsV;
131 const int size = nu->pntsu * nu->pntsv;
132 std::vector<Imath::V3f> positions(
size);
133 std::vector<float> weights(
size);
135 const BPoint *bp = nu->bp;
137 for (
int i = 0;
i <
size;
i++, bp++) {
139 weights[
i] = bp->
vec[3];
142 ONuPatchSchema::Sample
sample;
143 sample.setUOrder(nu->orderu + 1);
144 sample.setVOrder(nu->orderv + 1);
145 sample.setPositions(positions);
146 sample.setPositionWeights(weights);
147 sample.setUKnot(FloatArraySample(knotsU));
148 sample.setVKnot(FloatArraySample(knotsV));
154 OCompoundProperty user_props = abc_nurbs_schemas_[
count].getUserProperties();
157 OBoolProperty prop(user_props,
"endpoint_u");
162 OBoolProperty prop(user_props,
"endpoint_v");
167 OBoolProperty prop(user_props,
"cyclic_u");
172 OBoolProperty prop(user_props,
"cyclic_v");
ListBase * BKE_curve_nurbs_get(Curve *cu)
int BLI_listbase_count(const ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
#define CLOG_DEBUG(clg_ref,...)
Object is a sort of wrapper for general info.
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
ABCAbstractWriter(const ABCWriterConstructorArgs &args)
Alembic::Abc::OCompoundProperty abc_schema_prop_for_custom_props(T abc_schema)
uint32_t timesample_index_
const ABCWriterConstructorArgs args_
bool check_is_animated(const HierarchyContext &context) const override
bool is_supported(const HierarchyContext *context) const override
void create_alembic_objects(const HierarchyContext *context) override
ABCNurbsWriter(const ABCWriterConstructorArgs &args)
void do_write(HierarchyContext &context) override
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])