36 Curve *curve =
static_cast<Curve *
>(context->object->data);
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;
45 while (abc_parent.getChildHeader(patch_name_stream.str())) {
46 patch_name_stream <<
"_";
49 std::string patch_name = patch_name_stream.str();
50 CLOG_INFO(&
LOG, 2,
"exporting %s/%s", abc_parent_path, patch_name.c_str());
53 abc_nurbs_.push_back(nurbs);
54 abc_nurbs_schemas_.push_back(nurbs.getSchema());
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");