39 Curve *curve = id_cast<Curve *>(context->object->data);
40 size_t num_nurbs = curve->
nurb.count();
42 const char *abc_parent_path = abc_parent.getFullName().c_str();
44 for (
size_t i = 0; i < num_nurbs; i++) {
45 std::stringstream patch_name_stream;
48 while (abc_parent.getChildHeader(patch_name_stream.str())) {
49 patch_name_stream <<
"_";
52 std::string patch_name = patch_name_stream.str();
53 CLOG_DEBUG(&
LOG,
"exporting %s/%s", abc_parent_path, patch_name.c_str());
56 abc_nurbs_.push_back(nurbs);
57 abc_nurbs_schemas_.push_back(nurbs.getSchema());
94static void get_knots(std::vector<float> &knots,
const int num_knots,
float *nu_knots)
102 knots.reserve(num_knots + 2);
104 knots.push_back(0.0f);
106 for (
int i = 0; i < num_knots; i++) {
107 knots.push_back(nu_knots[i]);
110 knots[0] = 2.0f * knots[1] - knots[2];
111 knots.push_back(2.0f * knots[num_knots] - knots[num_knots - 1]);
116 Curve *curve = id_cast<Curve *>(context.object->data);
117 ListBaseT<Nurb> *nulb;
119 if (context.object->runtime->curve_cache->deformed_nurbs.first_ !=
nullptr) {
120 nulb = &context.object->runtime->curve_cache->deformed_nurbs;
127 for (
Nurb *nu = nulb->first(); nu; nu = nu->
next, count++) {
128 std::vector<float> knotsU;
131 std::vector<float> knotsV;
134 const int size = nu->pntsu * nu->pntsv;
135 std::vector<Imath::V3f> positions(size);
136 std::vector<float> weights(size);
138 const BPoint *bp = nu->bp;
140 for (
int i = 0; i < size; i++, bp++) {
142 weights[i] = bp->
vec[3];
145 ONuPatchSchema::Sample
sample;
146 sample.setUOrder(nu->orderu + 1);
147 sample.setVOrder(nu->orderv + 1);
148 sample.setPositions(positions);
149 sample.setPositionWeights(weights);
150 sample.setUKnot(FloatArraySample(knotsU));
151 sample.setVKnot(FloatArraySample(knotsV));
157 OCompoundProperty user_props = abc_nurbs_schemas_[count].getUserProperties();
160 OBoolProperty prop(user_props,
"endpoint_u");
165 OBoolProperty prop(user_props,
"endpoint_v");
170 OBoolProperty prop(user_props,
"cyclic_u");
175 OBoolProperty prop(user_props,
"cyclic_v");
179 abc_nurbs_schemas_[count].set(
sample);