Changeset View
Changeset View
Standalone View
Standalone View
source/blender/alembic/intern/abc_nurbs.cc
| Show First 20 Lines • Show All 97 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| static void get_knots(std::vector<float> &knots, const int num_knots, float *nu_knots) | static void get_knots(std::vector<float> &knots, const int num_knots, float *nu_knots) | ||||
| { | { | ||||
| if (num_knots <= 1) { | if (num_knots <= 1) { | ||||
| return; | return; | ||||
| } | } | ||||
| /* Add an extra knot at the beggining and end of the array since most apps | /* Add an extra knot at the beginning and end of the array since most apps | ||||
| * require/expect them. */ | * require/expect them. */ | ||||
| knots.reserve(num_knots + 2); | knots.reserve(num_knots + 2); | ||||
| knots.push_back(0.0f); | knots.push_back(0.0f); | ||||
| for (int i = 0; i < num_knots; ++i) { | for (int i = 0; i < num_knots; ++i) { | ||||
| knots.push_back(nu_knots[i]); | knots.push_back(nu_knots[i]); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 47 Lines • ▼ Show 20 Lines | for (Nurb *nu = static_cast<Nurb *>(nulb->first); nu; nu = nu->next, ++count) { | ||||
| sample.setVOrder(nu->orderv + 1); | sample.setVOrder(nu->orderv + 1); | ||||
| sample.setPositions(positions); | sample.setPositions(positions); | ||||
| sample.setPositionWeights(weights); | sample.setPositionWeights(weights); | ||||
| sample.setUKnot(FloatArraySample(knotsU)); | sample.setUKnot(FloatArraySample(knotsU)); | ||||
| sample.setVKnot(FloatArraySample(knotsV)); | sample.setVKnot(FloatArraySample(knotsV)); | ||||
| sample.setNu(nu->pntsu); | sample.setNu(nu->pntsu); | ||||
| sample.setNv(nu->pntsv); | sample.setNv(nu->pntsv); | ||||
| /* TODO(kevin): to accomodate other software we should duplicate control | /* TODO(kevin): to accommodate other software we should duplicate control | ||||
| * points to indicate that a NURBS is cyclic. */ | * points to indicate that a NURBS is cyclic. */ | ||||
| OCompoundProperty user_props = m_nurbs_schema[count].getUserProperties(); | OCompoundProperty user_props = m_nurbs_schema[count].getUserProperties(); | ||||
| if ((nu->flagu & CU_NURB_ENDPOINT) != 0) { | if ((nu->flagu & CU_NURB_ENDPOINT) != 0) { | ||||
| OBoolProperty prop(user_props, "endpoint_u"); | OBoolProperty prop(user_props, "endpoint_u"); | ||||
| prop.set(true); | prop.set(true); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 188 Lines • Show Last 20 Lines | |||||