@@ -97,7 +97,7 @@ LiveScene::LiveScene() : m_op( nullptr )
9797{
9898}
9999
100- LiveScene::LiveScene ( GeoOp *op, const std::string rootPath ) : m_op( op ), m_rootPath( rootPath )
100+ LiveScene::LiveScene ( GeoOp *op, const IECoreScene::SceneInterface::Path& rootPath ) : m_op( op ), m_rootPath( rootPath )
101101{
102102 m_pathMatcher = IECore::PathMatcher ();
103103 m_pathMatcher.addPath ( m_rootPath );
@@ -328,27 +328,26 @@ std::string LiveScene::fileName() const
328328
329329SceneInterface::Name LiveScene::name () const
330330{
331- IECoreScene::SceneInterface::Path path;
332- IECoreScene::SceneInterface::stringToPath ( m_rootPath, path );
333- if ( path.empty () )
331+ if ( m_rootPath.empty () )
334332 {
335333 return IECoreScene::SceneInterface::rootName;
336334 }
337335
338- return *path .rbegin ();
336+ return *m_rootPath .rbegin ();
339337}
340338
341339void LiveScene::path ( Path &p ) const
342340{
343341 p.clear ();
344- IECoreScene::SceneInterface::stringToPath ( m_rootPath, p ) ;
342+ p = m_rootPath ;
345343}
346344
347345Imath::Box3d LiveScene::readBound ( double time ) const
348346{
349347 Imath::Box3d bound;
350348 bound.makeEmpty ();
351- IECoreScene::SceneInterface::Path rootPath, currentPath;
349+ std::string rootPathStr;
350+ IECoreScene::SceneInterface::Path currentPath;
352351 for ( unsigned i=0 ; i < objects ( &time ); ++i )
353352 {
354353 auto nameValue = geoInfoPath ( i );
@@ -357,7 +356,7 @@ Imath::Box3d LiveScene::readBound( double time ) const
357356 {
358357 continue ;
359358 }
360- IECoreScene::SceneInterface::stringToPath ( m_rootPath, rootPath );
359+ IECoreScene::SceneInterface::pathToString ( m_rootPath, rootPathStr );
361360 IECoreScene::SceneInterface::stringToPath ( nameValue, currentPath );
362361
363362 auto info = object ( i, &time );
@@ -367,7 +366,7 @@ Imath::Box3d LiveScene::readBound( double time ) const
367366 }
368367
369368 Box3 objectBound;
370- if ( ( currentPath.size () > 1 ) && ( ( currentPath.size () == rootPath .size () + 1 ) || ( nameValue == m_rootPath ) ) )
369+ if ( ( currentPath.size () > 1 ) && ( ( currentPath.size () == m_rootPath .size () + 1 ) || ( nameValue == rootPathStr ) ) )
371370 {
372371 // object space bound
373372 objectBound = info->bbox ();
@@ -545,26 +544,27 @@ void LiveScene::childNames( NameList &childNames ) const
545544 }
546545
547546 // filter only children
548- IECoreScene::SceneInterface::Path allPath, rootPath;
549- IECoreScene::SceneInterface::stringToPath ( m_rootPath, rootPath );
547+ IECoreScene::SceneInterface::Path allPath;
548+ std::string rootPathStr;
549+ IECoreScene::SceneInterface::pathToString ( m_rootPath, rootPathStr );
550550 for ( auto & path : allPaths )
551551 {
552552 // ignore children with a different root path
553- if ( !( path.rfind ( m_rootPath , 0 ) == 0 ) )
553+ if ( !( path.rfind ( rootPathStr , 0 ) == 0 ) )
554554 {
555555 continue ;
556556 }
557557
558558 allPath.clear ();
559559 IECoreScene::SceneInterface::stringToPath ( path, allPath );
560- if ( rootPath .size () < allPath.size () )
560+ if ( m_rootPath .size () < allPath.size () )
561561 {
562562 // ignore duplicates.
563- if ( find ( childNames.begin (), childNames.end (), allPath[rootPath .size ()] ) != childNames.end () )
563+ if ( find ( childNames.begin (), childNames.end (), allPath[m_rootPath .size ()] ) != childNames.end () )
564564 {
565565 continue ;
566566 }
567- childNames.push_back ( allPath[rootPath .size ()] );
567+ childNames.push_back ( allPath[m_rootPath .size ()] );
568568 }
569569 }
570570}
@@ -595,15 +595,10 @@ SceneInterfacePtr LiveScene::child( const Name &name, MissingBehaviour missingBe
595595 }
596596 }
597597
598- IECoreScene::SceneInterface::Path newPath;
599- IECoreScene::SceneInterface::stringToPath ( m_rootPath, newPath );
600-
598+ IECoreScene::SceneInterface::Path newPath = m_rootPath;
601599 newPath.push_back ( name.string () );
602600
603- std::string newRoot;
604- IECoreScene::SceneInterface::pathToString ( newPath, newRoot );
605-
606- return new LiveScene ( m_op, newRoot );
601+ return new LiveScene ( m_op, newPath );
607602}
608603
609604ConstSceneInterfacePtr LiveScene::child ( const Name &name, MissingBehaviour missingBehaviour ) const
@@ -624,15 +619,10 @@ ConstSceneInterfacePtr LiveScene::child( const Name &name, MissingBehaviour miss
624619 }
625620 }
626621
627- IECoreScene::SceneInterface::Path newPath;
628- IECoreScene::SceneInterface::stringToPath ( m_rootPath, newPath );
629-
622+ IECoreScene::SceneInterface::Path newPath = m_rootPath;
630623 newPath.push_back ( name.string () );
631624
632- std::string newRoot;
633- IECoreScene::SceneInterface::pathToString ( newPath, newRoot );
634-
635- return new LiveScene ( m_op, newRoot );
625+ return new LiveScene ( m_op, newPath );
636626}
637627
638628SceneInterfacePtr LiveScene::createChild ( const Name &name )
@@ -663,10 +653,7 @@ ConstSceneInterfacePtr LiveScene::scene( const Path &path, MissingBehaviour miss
663653 }
664654 }
665655
666- std::string pathStr;
667- IECoreScene::SceneInterface::pathToString ( path, pathStr );
668-
669- return new LiveScene ( m_op, pathStr );
656+ return new LiveScene ( m_op, path );
670657}
671658
672659SceneInterfacePtr LiveScene::scene ( const Path &path, MissingBehaviour missingBehaviour )
@@ -692,9 +679,7 @@ SceneInterfacePtr LiveScene::scene( const Path &path, MissingBehaviour missingBe
692679 }
693680 }
694681
695- std::string pathStr;
696- IECoreScene::SceneInterface::pathToString ( path, pathStr );
697- return new LiveScene ( m_op, pathStr );
682+ return new LiveScene ( m_op, path );
698683}
699684
700685void LiveScene::hash ( HashType hashType, double time, MurmurHash &h ) const
0 commit comments