本文整理汇总了C++中MFnNurbsCurve::partialPathName方法的典型用法代码示例。如果您正苦于以下问题:C++ MFnNurbsCurve::partialPathName方法的具体用法?C++ MFnNurbsCurve::partialPathName怎么用?C++ MFnNurbsCurve::partialPathName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MFnNurbsCurve
的用法示例。
在下文中一共展示了MFnNurbsCurve::partialPathName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: write
//.........这里部分代码省略.........
curve.getKnots(knotsArray);
knots.reserve(knotsArray.length() + 2);
// need to add a knot to the start and end (M + 2N + 1)
if (knotsArray.length() > 1)
{
unsigned int knotsLength = knotsArray.length();
if (knotsArray[0] == knotsArray[knotsLength - 1] ||
knotsArray[0] == knotsArray[1])
{
knots.push_back(knotsArray[0]);
}
else
{
knots.push_back(2 * knotsArray[0] - knotsArray[1]);
}
for (unsigned int j = 0; j < knotsLength; ++j)
{
knots.push_back(knotsArray[j]);
}
if (knotsArray[0] == knotsArray[knotsLength - 1] ||
knotsArray[knotsLength - 1] == knotsArray[knotsLength - 2])
{
knots.push_back(knotsArray[knotsLength - 1]);
}
else
{
knots.push_back(2 * knotsArray[knotsLength - 1] -
knotsArray[knotsLength - 2]);
}
}
// width
MPlug widthPlug = curve.findPlug("width");
if (!useConstWidth && !widthPlug.isNull())
{
MObject widthObj;
MStatus status = widthPlug.getValue(widthObj);
MFnDoubleArrayData fnDoubleArrayData(widthObj, &status);
MDoubleArray doubleArrayData = fnDoubleArrayData.array();
Alembic::Util::int32_t arraySum = doubleArrayData.length();
if (arraySum == numCVs)
{
for (Alembic::Util::int32_t i = 0; i < arraySum; i++)
{
width.push_back(static_cast<float>(doubleArrayData[i]));
}
}
else if (status == MS::kSuccess)
{
MString msg = "Curve ";
msg += curve.partialPathName();
msg += " has incorrect size for the width vector.";
msg += "\nUsing default constant width of 0.1.";
MGlobal::displayWarning(msg);
width.clear();
width.push_back(0.1f);
useConstWidth = true;
}
else
{
width.push_back(widthPlug.asFloat());
useConstWidth = true;
}
}
else if (!useConstWidth)
{
// pick a default value
width.clear();
width.push_back(0.1f);
useConstWidth = true;
}
}
Alembic::AbcGeom::GeometryScope scope = Alembic::AbcGeom::kVertexScope;
if (useConstWidth)
scope = Alembic::AbcGeom::kConstantScope;
samp.setCurvesNumVertices(Alembic::Abc::Int32ArraySample(nVertices));
samp.setPositions(Alembic::Abc::V3fArraySample(
(const Imath::V3f *)&points.front(), points.size() / 3 ));
samp.setWidths(Alembic::AbcGeom::OFloatGeomParam::Sample(
Alembic::Abc::FloatArraySample(width), scope) );
if (samp.getType() == Alembic::AbcGeom::kVariableOrder)
{
samp.setOrders(Alembic::Abc::UcharArraySample(orders));
}
if (!knots.empty())
{
samp.setKnots(Alembic::Abc::FloatArraySample(knots));
}
mSchema.set(samp);
}