本文整理汇总了C++中alembic::abc::IObject::getMetaData方法的典型用法代码示例。如果您正苦于以下问题:C++ IObject::getMetaData方法的具体用法?C++ IObject::getMetaData怎么用?C++ IObject::getMetaData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类alembic::abc::IObject
的用法示例。
在下文中一共展示了IObject::getMetaData方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetEIObjectType
EAbcIObjectType GetEIObjectType( Alembic::Abc::IObject& in_object )
{
AbcA::MetaData l_md = in_object.getMetaData();
if ( IPolyMesh::matches( l_md ) )
return EIObject_Polymesh;
else if ( ISubD::matches( l_md ) )
return EIObject_Subd;
else if ( IPoints::matches( l_md ) )
return EIObject_Points;
else if ( IMaterial::matches( l_md ) )
return EIObject_Material;
else if ( ICamera::matches( l_md ) )
return EIObject_Camera;
else if ( IXform::matches( l_md ) )
return EIObject_Xform;
else if ( ICurves::matches( l_md ) )
return EIObject_Curves;
else if ( INuPatch::matches( l_md ) )
return EIObject_NuPatch;
else if ( IFaceSet::matches( l_md ) )
return EIObject_FaceSet;
else
return EIObject_Unknown;
}
示例2: getBasicSchemaDataFromObject
bool getBasicSchemaDataFromObject(Alembic::Abc::IObject &object, BasicSchemaData &bsd)
{
ESS_PROFILE_SCOPE("getBasicSchemaDataFromObject");
const Alembic::Abc::MetaData &md = object.getMetaData();
if(Alembic::AbcGeom::IXform::matches(md))
return __getBasicSchemaDataFromObject(BasicSchemaData::__XFORM, Alembic::AbcGeom::IXform(object,Alembic::Abc::kWrapExisting).getSchema(), bsd);
else if(Alembic::AbcGeom::IPolyMesh::matches(md))
return __getBasicSchemaDataFromObject(BasicSchemaData::__POLYMESH, Alembic::AbcGeom::IPolyMesh(object,Alembic::Abc::kWrapExisting).getSchema(), bsd);
else if(Alembic::AbcGeom::ICurves::matches(md))
return __getBasicSchemaDataFromObject(BasicSchemaData::__CURVES, Alembic::AbcGeom::ICurves(object,Alembic::Abc::kWrapExisting).getSchema(), bsd);
else if(Alembic::AbcGeom::INuPatch::matches(md))
return __getBasicSchemaDataFromObject(BasicSchemaData::__NUPATCH, Alembic::AbcGeom::INuPatch(object,Alembic::Abc::kWrapExisting).getSchema(), bsd);
else if(Alembic::AbcGeom::IPoints::matches(md))
return __getBasicSchemaDataFromObject(BasicSchemaData::__POINTS, Alembic::AbcGeom::IPoints(object,Alembic::Abc::kWrapExisting).getSchema(), bsd);
else if(Alembic::AbcGeom::ISubD::matches(md))
return __getBasicSchemaDataFromObject(BasicSchemaData::__SUBDIV, Alembic::AbcGeom::ISubD(object,Alembic::Abc::kWrapExisting).getSchema(), bsd);
else if(Alembic::AbcGeom::ICamera::matches(md))
return __getBasicSchemaDataFromObject(BasicSchemaData::__CAMERA, Alembic::AbcGeom::ICamera(object,Alembic::Abc::kWrapExisting).getSchema(), bsd);
else if(Alembic::AbcGeom::IFaceSet::matches(md))
return __getBasicSchemaDataFromObject(BasicSchemaData::__FACESET, Alembic::AbcGeom::IFaceSet(object,Alembic::Abc::kWrapExisting).getSchema(), bsd);
return false;
};
示例3: if
Alembic::Abc::TimeSamplingPtr getTimeSamplingFromObject(
Alembic::Abc::IObject& object)
{
ESS_PROFILE_SCOPE("getTimeSamplingFromObject");
const Alembic::Abc::MetaData& md = object.getMetaData();
if (Alembic::AbcGeom::IXform::matches(md)) {
return Alembic::AbcGeom::IXform(object, Alembic::Abc::kWrapExisting)
.getSchema()
.getTimeSampling();
}
else if (Alembic::AbcGeom::IPolyMesh::matches(md)) {
return Alembic::AbcGeom::IPolyMesh(object, Alembic::Abc::kWrapExisting)
.getSchema()
.getTimeSampling();
}
else if (Alembic::AbcGeom::ICurves::matches(md)) {
return Alembic::AbcGeom::ICurves(object, Alembic::Abc::kWrapExisting)
.getSchema()
.getTimeSampling();
}
else if (Alembic::AbcGeom::INuPatch::matches(md)) {
return Alembic::AbcGeom::INuPatch(object, Alembic::Abc::kWrapExisting)
.getSchema()
.getTimeSampling();
}
else if (Alembic::AbcGeom::IPoints::matches(md)) {
return Alembic::AbcGeom::IPoints(object, Alembic::Abc::kWrapExisting)
.getSchema()
.getTimeSampling();
}
else if (Alembic::AbcGeom::ISubD::matches(md)) {
return Alembic::AbcGeom::ISubD(object, Alembic::Abc::kWrapExisting)
.getSchema()
.getTimeSampling();
}
else if (Alembic::AbcGeom::ICamera::matches(md)) {
return Alembic::AbcGeom::ICamera(object, Alembic::Abc::kWrapExisting)
.getSchema()
.getTimeSampling();
}
else if (Alembic::AbcGeom::IFaceSet::matches(md)) {
return Alembic::AbcGeom::IFaceSet(object, Alembic::Abc::kWrapExisting)
.getSchema()
.getTimeSampling();
}
return Alembic::Abc::TimeSamplingPtr();
}
示例4: isObjectConstant
bool isObjectConstant(Alembic::Abc::IObject& object)
{
ESS_PROFILE_SCOPE("isObjectConstant");
const Alembic::Abc::MetaData& md = object.getMetaData();
if (Alembic::AbcGeom::IXform::matches(md)) {
return isObjectSchemaConstant(
Alembic::AbcGeom::IXform(object, Alembic::Abc::kWrapExisting)
.getSchema());
}
else if (Alembic::AbcGeom::IPolyMesh::matches(md)) {
return isObjectSchemaConstant(
Alembic::AbcGeom::IPolyMesh(object, Alembic::Abc::kWrapExisting)
.getSchema());
}
else if (Alembic::AbcGeom::ICurves::matches(md)) {
return isObjectSchemaConstant(
Alembic::AbcGeom::ICurves(object, Alembic::Abc::kWrapExisting)
.getSchema());
}
else if (Alembic::AbcGeom::INuPatch::matches(md)) {
return isObjectSchemaConstant(
Alembic::AbcGeom::INuPatch(object, Alembic::Abc::kWrapExisting)
.getSchema());
}
else if (Alembic::AbcGeom::IPoints::matches(md)) {
return isObjectSchemaConstant(
Alembic::AbcGeom::IPoints(object, Alembic::Abc::kWrapExisting)
.getSchema());
}
else if (Alembic::AbcGeom::ISubD::matches(md)) {
return isObjectSchemaConstant(
Alembic::AbcGeom::ISubD(object, Alembic::Abc::kWrapExisting)
.getSchema());
}
else if (Alembic::AbcGeom::ICamera::matches(md)) {
return isObjectSchemaConstant(
Alembic::AbcGeom::ICamera(object, Alembic::Abc::kWrapExisting)
.getSchema());
}
else if (Alembic::AbcGeom::IFaceSet::matches(md)) {
return isObjectSchemaConstant(
Alembic::AbcGeom::IFaceSet(object, Alembic::Abc::kWrapExisting)
.getSchema());
}
return true;
}
示例5: main
int main(int argc, char *argv[])
{
std::string toType;
std::string inFile;
std::string outFile;
std::string forceStr;
if (argc == 4)
{
toType = argv[1];
inFile = argv[2];
outFile = argv[3];
}
else if (argc == 5)
{
forceStr = argv[1];
toType = argv[2];
inFile = argv[3];
outFile = argv[4];
}
if ((argc == 4 || argc == 5) && (forceStr.empty() || forceStr == "-force"))
{
if (inFile == outFile)
{
printf("Error: inFile and outFile must not be the same!\n");
return 1;
}
if (toType != "-toHDF" && toType != "-toOgawa")
{
printf("Error: Unknown conversion type specified %s\n",
toType.c_str());
printf("Currently only -toHDF and -toOgawa are supported.\n");
return 1;
}
Alembic::AbcCoreFactory::IFactory factory;
Alembic::AbcCoreFactory::IFactory::CoreType coreType;
Alembic::Abc::IArchive archive = factory.getArchive(inFile, coreType);
if (!archive.valid())
{
printf("Error: Invalid Alembic file specified: %s\n",
inFile.c_str());
return 1;
}
else if ( forceStr != "-force" && (
(coreType == Alembic::AbcCoreFactory::IFactory::kHDF5 &&
toType == "-toHDF") ||
(coreType == Alembic::AbcCoreFactory::IFactory::kOgawa &&
toType == "-toOgawa")) )
{
printf("Warning: Alembic file specified: %s\n",inFile.c_str());
printf("is already of the type you want to convert to.\n");
printf("Please specify -force if you want to do this anyway.\n");
return 1;
}
Alembic::Abc::IObject inTop = archive.getTop();
Alembic::Abc::OArchive outArchive;
if (toType == "-toHDF")
{
outArchive = Alembic::Abc::OArchive(
Alembic::AbcCoreHDF5::WriteArchive(),
outFile, inTop.getMetaData(),
Alembic::Abc::ErrorHandler::kThrowPolicy);
}
else if (toType == "-toOgawa")
{
outArchive = Alembic::Abc::OArchive(
Alembic::AbcCoreOgawa::WriteArchive(),
outFile, inTop.getMetaData(),
Alembic::Abc::ErrorHandler::kThrowPolicy);
}
// start at 1, we don't need to worry about intrinsic default case
for (Alembic::Util::uint32_t i = 1; i < archive.getNumTimeSamplings();
++i)
{
outArchive.addTimeSampling(*archive.getTimeSampling(i));
}
Alembic::Abc::OObject outTop = outArchive.getTop();
copyObject(inTop, outTop);
return 0;
}
printf ("Usage: abcconvert [-force] OPTION inFile outFile\n");
printf ("Used to convert an Alembic file from one type to another.\n\n");
printf ("If -force is not provided and inFile happens to be the same\n");
printf ("type as OPTION no conversion will be done and a message will\n");
printf ("be printed out.\n");
printf ("OPTION has to be one of these:\n\n");
printf (" -toHDF Convert to HDF.\n");
printf (" -toOgawa Convert to Ogawa.\n");
return 1;
}
示例6: 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;
}
示例7: main
int main(int argc, char *argv[])
{
ConversionOptions options;
bool doConversion = false;
if (parseArgs( argc, argv, options, doConversion ) == false)
return 1;
if (doConversion)
{
for( std::vector<std::string>::const_iterator inFile = options.inFiles.begin(); inFile != options.inFiles.end(); inFile++ )
{
if (*inFile == options.outFile)
{
printf("Error: inFile and outFile must not be the same!\n");
return 1;
}
}
if (options.toType != IFactoryNS::kHDF5 && options.toType != IFactoryNS::kOgawa)
{
printf("Currently only -toHDF and -toOgawa are supported.\n");
return 1;
}
Alembic::AbcCoreFactory::IFactory factory;
Alembic::AbcCoreFactory::IFactory::CoreType coreType;
Alembic::Abc::IArchive archive;
if(options.inFiles.size() == 1)
{
archive = factory.getArchive(*options.inFiles.begin(), coreType);
if (!archive.valid())
{
printf("Error: Invalid Alembic file specified: %s\n",
options.inFiles.begin()->c_str());
return 1;
}
else if ( !options.force && (
(coreType == IFactoryNS::kHDF5 &&
options.toType == IFactoryNS::kHDF5) ||
(coreType == IFactoryNS::kOgawa &&
options.toType == IFactoryNS::kOgawa)) )
{
printf("Warning: Alembic file specified: %s\n", options.inFiles.begin()->c_str());
printf("is already of the type you want to convert to.\n");
printf("Please specify -force if you want to do this anyway.\n");
return 1;
}
}
else
{
archive = factory.getArchive(options.inFiles, coreType);
}
Alembic::Abc::IObject inTop = archive.getTop();
Alembic::Abc::OArchive outArchive;
if (options.toType == IFactoryNS::kHDF5)
{
outArchive = Alembic::Abc::OArchive(
Alembic::AbcCoreHDF5::WriteArchive(),
options.outFile, inTop.getMetaData(),
Alembic::Abc::ErrorHandler::kThrowPolicy);
}
else if (options.toType == IFactoryNS::kOgawa)
{
outArchive = Alembic::Abc::OArchive(
Alembic::AbcCoreOgawa::WriteArchive(),
options.outFile, inTop.getMetaData(),
Alembic::Abc::ErrorHandler::kThrowPolicy);
}
// start at 1, we don't need to worry about intrinsic default case
for (Alembic::Util::uint32_t i = 1; i < archive.getNumTimeSamplings();
++i)
{
outArchive.addTimeSampling(*archive.getTimeSampling(i));
}
Alembic::Abc::OObject outTop = outArchive.getTop();
copyObject(inTop, outTop);
}
return 0;
}