//-***************************************************************************** M44d getFinalMatrix( IObject &iObj ) { M44d xf; xf.makeIdentity(); IObject parent = iObj.getParent(); while ( parent ) { accumXform( xf, parent ); parent = parent.getParent(); } return xf; }
void scopingTest(bool useOgawa) { { OObject top; { OArchive archive; if (useOgawa) { archive = CreateArchiveWithInfo( Alembic::AbcCoreOgawa::WriteArchive(), "archiveScopeTest.abc", "Alembic test", "", MetaData() ); } else { archive = CreateArchiveWithInfo( Alembic::AbcCoreHDF5::WriteArchive(), "archiveScopeTest.abc", "Alembic test", "", MetaData() ); } top = archive.getTop(); } OObject childA( top, "a"); OObject childB( top, "b"); ODoubleProperty prop(top.getProperties(), "prop", 0); TESTING_ASSERT(prop.getObject().getArchive().getName() == "archiveScopeTest.abc"); } { IObject top; { AbcF::IFactory factory; AbcF::IFactory::CoreType coreType; IArchive archive = factory.getArchive("archiveScopeTest.abc", coreType); TESTING_ASSERT( (useOgawa && coreType == AbcF::IFactory::kOgawa) || (!useOgawa && coreType == AbcF::IFactory::kHDF5) ); top = archive.getTop(); double start, end; GetArchiveStartAndEndTime( archive, start, end ); TESTING_ASSERT( start == DBL_MAX && end == -DBL_MAX ); } TESTING_ASSERT(top.getNumChildren() == 2 ); TESTING_ASSERT(top.getChildHeader("a") != NULL); TESTING_ASSERT(top.getChildHeader("b") != NULL); TESTING_ASSERT( ! top.getParent().valid() ); TESTING_ASSERT( top.getArchive().getName() == "archiveScopeTest.abc"); IScalarProperty prop(top.getProperties(), "prop"); TESTING_ASSERT(prop.valid()); TESTING_ASSERT(prop.getObject().getArchive().getName() == "archiveScopeTest.abc"); } }
const Matrix4 getConcatMatrix( IObject iObj, chrono_t curTime , bool interpolate) { Imath::M44d xf; xf.makeIdentity(); IObject parent = iObj.getParent(); // Once the Archive's Top Object is reached, IObject::getParent() will // return an invalid IObject, and that will evaluate to False. while ( parent ) { accumXform( xf, parent, curTime, interpolate ); parent = parent.getParent(); } Matrix4 ret_matrix = convert(xf); return ret_matrix; }
bool IsAncestorInvisible( IObject iObject, const Abc::ISampleSelector &iSS ) { ABCA_ASSERT ( iObject, "IsAncestorInvisible (): object passed in isn't valid."); IVisibilityProperty visibilityProperty = GetVisibilityProperty ( iObject ); ObjectVisibility visibilityValue = kVisibilityDeferred; if ( visibilityProperty ) { int8_t rawVisibilityValue; rawVisibilityValue = visibilityProperty.getValue( iSS ); visibilityValue = ObjectVisibility ( rawVisibilityValue ); } IObject currentObject = iObject; while ( visibilityValue == kVisibilityDeferred ) { // go up a level currentObject = currentObject.getParent(); if (! currentObject ) { return false; } visibilityProperty = GetVisibilityProperty ( currentObject ); if ( visibilityProperty && visibilityProperty.valid() ) { int8_t rawVisibilityValue; rawVisibilityValue = visibilityProperty.getValue( iSS ); visibilityValue = ObjectVisibility ( rawVisibilityValue ); } // At this point if we didn't find the visiblilty // property OR if the value was deferred we'll // continue up a level (so only if this object // says hidden OR explicitly says visible do we stop. } if ( visibilityValue == kVisibilityHidden ) return true; return false; }