本文整理汇总了C++中alembic::abc::IObject::getParent方法的典型用法代码示例。如果您正苦于以下问题:C++ IObject::getParent方法的具体用法?C++ IObject::getParent怎么用?C++ IObject::getParent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类alembic::abc::IObject
的用法示例。
在下文中一共展示了IObject::getParent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: typedObject
//.........这里部分代码省略.........
const Alembic::Abc::V3f scalingAbc = info->scale[floorIndex]->get()[id < info->scale[floorIndex]->size() ? id : info->scale[floorIndex]->size() - 1] *
info->width[floorIndex]->get()[id < info->width[floorIndex]->size() ? id : info->width[floorIndex]->size() - 1] * float(1.0 - sampleInfo.alpha) +
info->scale[ceilIndex]->get()[id < info->scale[ceilIndex]->size() ? id : info->scale[ceilIndex]->size() - 1] *
info->width[ceilIndex]->get()[id < info->width[ceilIndex]->size() ? id : info->width[ceilIndex]->size() - 1] * float(sampleInfo.alpha);
matrixAbc.scale(scalingAbc);
}
else
{
const float width = info->width[floorIndex]->get()[id < info->width[floorIndex]->size() ? id : info->width[floorIndex]->size() - 1] * float(1.0 - sampleInfo.alpha) +
info->width[ceilIndex]->get()[id < info->width[ceilIndex]->size() ? id : info->width[ceilIndex]->size() - 1] * float(sampleInfo.alpha);
matrixAbc.scale(Alembic::Abc::V3f(width,width,width));
}
// if we have offset matrices
if(group->parents.size() > groupID && group->matrices.size() > groupID)
{
if(group->objects[groupID].valid() && group->parents[groupID].valid())
{
// we have a matrix map and a parent.
// now we need to check if we already exported the matrices
std::map<float,std::vector<Alembic::Abc::M44f> >::iterator it;
std::vector<Alembic::Abc::M44f> offsets;
it = group->matrices[groupID].find(centroidTime);
if(it == group->matrices[groupID].end())
{
std::vector<float> samples(ud->gMbKeys.size());
offsets.resize(ud->gMbKeys.size());
for(AtInt sampleIndex=0;sampleIndex<(AtInt)ud->gMbKeys.size(); ++sampleIndex)
{
offsets[sampleIndex].makeIdentity();
// centralize the time once more
samples[sampleIndex] = centroidTime + ud->gMbKeys[sampleIndex] - ud->gCentroidTime;
}
// if the transform differs, we need to compute the offset matrices
// get the parent, which should be a transform
Alembic::Abc::IObject parent = group->parents[groupID];
Alembic::Abc::IObject xform = group->objects[groupID].getParent();
while(Alembic::AbcGeom::IXform::matches(xform.getMetaData()) && xform.getFullName() != parent.getFullName())
{
// cast to a xform
Alembic::AbcGeom::IXform parentXform(xform,Alembic::Abc::kWrapExisting);
if(parentXform.getSchema().getNumSamples() == 0)
break;
// loop over all samples
for(size_t sampleIndex=0;sampleIndex<ud->gMbKeys.size(); ++sampleIndex)
{
SampleInfo sampleInfo = getSampleInfo(
samples[sampleIndex],
parentXform.getSchema().getTimeSampling(),
parentXform.getSchema().getNumSamples()
);
// get the data and blend it if necessary
Alembic::AbcGeom::XformSample sample;
parentXform.getSchema().get(sample,sampleInfo.floorIndex);
Alembic::Abc::M44f abcMatrix;
Alembic::Abc::M44d abcMatrixd = sample.getMatrix();
for(int x=0;x<4;x++)
for(int y=0;y<4;y++)
abcMatrix[x][y] = (float)abcMatrixd[x][y];
if(sampleInfo.alpha >= sampleTolerance)
{
parentXform.getSchema().get(sample,sampleInfo.ceilIndex);
Alembic::Abc::M44d ceilAbcMatrixd = sample.getMatrix();
Alembic::Abc::M44f ceilAbcMatrix;
for(int x=0;x<4;x++)
for(int y=0;y<4;y++)
ceilAbcMatrix[x][y] = (float)ceilAbcMatrixd[x][y];
abcMatrix = float(1.0 - sampleInfo.alpha) * abcMatrix + float(sampleInfo.alpha) * ceilAbcMatrix;
}
offsets[sampleIndex] = abcMatrix * offsets[sampleIndex];
}
// go upwards
xform = xform.getParent();
}
group->matrices[groupID].insert(std::pair<float,std::vector<Alembic::Abc::M44f> >(centroidTime,offsets));
}
else
offsets = it->second;
// this means we have the right amount of matrices to blend against
if(offsets.size() > j)
matrixAbc = offsets[j] * matrixAbc;
}
}
// store it to the array
AiArraySetMtx(matrices,(AtULong)j,matrixAbc.x);
}
AiNodeSetArray(shapeNode,"matrix",matrices);
AiNodeSetBool(shapeNode, "inherit_xform", FALSE);
return shapeNode;
}