IECore::ConstObjectPtr SceneReader::computeObject( const ScenePath &path, const Gaffer::Context *context, const ScenePlug *parent ) const { ConstSceneInterfacePtr s = scene( path ); if( !s || !s->hasObject() ) { return parent->objectPlug()->defaultValue(); } return s->readObject( context->getTime() ); }
void SceneReader::hashObject( const ScenePath &path, const Gaffer::Context *context, const ScenePlug *parent, IECore::MurmurHash &h ) const { ConstSceneInterfacePtr s = scene( path ); if( !s || !s->hasObject() ) { // no object h = parent->objectPlug()->defaultValue()->hash(); return; } SceneNode::hashObject( path, context, parent, h ); refreshCountPlug()->hash( h ); s->hash( SceneInterface::ObjectHash, context->getTime(), h ); }
void SceneReader::hashObject( const ScenePath &path, const Gaffer::Context *context, const ScenePlug *parent, IECore::MurmurHash &h ) const { ConstSceneInterfacePtr s = scene( path ); if( !s || !s->hasObject() ) { // no object h = parent->objectPlug()->defaultValue()->hash(); return; } FileSource::hashObject( path, context, parent, h ); const SampledSceneInterface *ss = runTimeCast<const SampledSceneInterface>( s.get() ); if( !ss || ss->numObjectSamples() > 1 ) { h.append( context->getFrame() ); } }
IECore::ConstObjectPtr SceneReader::computeObject( const ScenePath &path, const Gaffer::Context *context, const ScenePlug *parent ) const { std::string fileName = fileNamePlug()->getValue(); if( !fileName.size() ) { return parent->objectPlug()->defaultValue(); } ConstSceneInterfacePtr s = SharedSceneInterfaces::get( fileName ); s = s->scene( path ); ObjectPtr o; if( s->hasObject() ) { ConstObjectPtr o = s->readObject( context->getFrame() / g_frameRate ); return o ? o : ConstObjectPtr( parent->objectPlug()->defaultValue() ); } return parent->objectPlug()->defaultValue(); }
void OBJ_SceneCacheTransform::doExpandChildren( const SceneInterface *scene, OP_Network *parent, const Parameters ¶ms ) { UT_Interrupt *progress = UTgetInterrupt(); progress->setLongOpText( ( "Expanding " + scene->name().string() ).c_str() ); if ( progress->opInterrupt() ) { return; } OP_Network *inputNode = parent; if ( params.hierarchy == Parenting ) { parent = parent->getParent(); } SceneInterface::NameList children; scene->childNames( children ); for ( SceneInterface::NameList::const_iterator it=children.begin(); it != children.end(); ++it ) { ConstSceneInterfacePtr child = scene->child( *it ); OBJ_Node *childNode = 0; if ( params.hierarchy == SubNetworks ) { childNode = doExpandChild( child.get(), parent, params ); if ( params.depth == AllDescendants && child->hasObject() && tagged( child.get(), params.tagFilter ) ) { Parameters childParams( params ); childParams.depth = Children; doExpandObject( child.get(), childNode, childParams ); } } else if ( params.hierarchy == Parenting ) { if ( child->hasObject() ) { Parameters childParams( params ); childParams.depth = Children; childNode = doExpandObject( child.get(), parent, childParams ); } else { childNode = doExpandChild( child.get(), parent, params ); } childNode->setInput( 0, inputNode ); } if ( params.depth == AllDescendants ) { if ( params.hierarchy == SubNetworks && !tagged( child.get(), params.tagFilter ) ) { // we don't expand non-tagged children for SubNetwork mode, but we // do for Parenting mode, because otherwise the hierarchy would be // stuck in an un-expandable state. continue; } doExpandChildren( child.get(), childNode, params ); childNode->setInt( pExpanded.getToken(), 0, 0, 1 ); } } OP_Layout layout( parent ); #if UT_MAJOR_VERSION_INT >= 16 OP_SubnetIndirectInput *parentInput = parent->getParentInput( 0 ); layout.addLayoutItem( parentInput->getInputItem() ); for ( int i=0; i < parent->getNchildren(); ++i ) { layout.addLayoutItem( parent->getChild( i ) ); } #else layout.addLayoutOp( parent->getParentInput( 0 ) ); for ( int i=0; i < parent->getNchildren(); ++i ) { layout.addLayoutOp( parent->getChild( i ) ); } #endif layout.layoutOps( OP_LAYOUT_TOP_TO_BOT, parent, parent->getParentInput( 0 ) ); }