@@ -1964,24 +1964,46 @@ def testVisibilityAttribute( self ) :
19641964
19651965 fileName = os .path .join ( self .temporaryDirectory (), "visibilityAttribute.abc" )
19661966 root = IECoreScene .SceneInterface .create ( fileName , IECore .IndexedIO .OpenMode .Write )
1967+
19671968 root .createChild ( "withoutAttribute" )
1968- child = root .createChild ( "withAttribute" )
1969+
1970+ child = root .createChild ( "withAnimatedAttribute" )
19691971 child .writeAttribute ( "scene:visible" , IECore .BoolData ( True ), 0 )
19701972 child .writeAttribute ( "scene:visible" , IECore .BoolData ( False ), 1 )
19711973
1974+ child = root .createChild ( "withStaticAttribute" )
1975+ child .writeAttribute ( "scene:visible" , IECore .BoolData ( True ), 0 )
1976+
19721977 del child , root
19731978
19741979 root = IECoreScene .SceneInterface .create ( fileName , IECore .IndexedIO .OpenMode .Read )
19751980
1976- child = root .child ( "withAttribute" )
1981+ child = root .child ( "withoutAttribute" )
1982+ self .assertNotIn ( "scene:visible" , child .attributeNames () )
1983+ self .assertFalse ( child .hasAttribute ( "scene:visible" ) )
1984+ withoutHash = child .hash ( IECoreScene .SceneInterface .HashType .AttributesHash , 0 )
1985+
1986+ child = root .child ( "withAnimatedAttribute" )
19771987 self .assertIn ( "scene:visible" , child .attributeNames () )
19781988 self .assertTrue ( child .hasAttribute ( "scene:visible" ) )
19791989 self .assertEqual ( child .readAttribute ( "scene:visible" , 0 ), IECore .BoolData ( True ) )
19801990 self .assertEqual ( child .readAttribute ( "scene:visible" , 1 ), IECore .BoolData ( False ) )
1991+ animatedFrame1Hash = child .hash ( IECoreScene .SceneInterface .HashType .AttributesHash , 1 )
1992+ self .assertNotEqual ( child .hash ( IECoreScene .SceneInterface .HashType .AttributesHash , 0 ), animatedFrame1Hash )
1993+ self .assertNotEqual ( child .hash ( IECoreScene .SceneInterface .HashType .AttributesHash , 0 ), withoutHash )
1994+ self .assertNotEqual ( animatedFrame1Hash , withoutHash )
19811995
1982- child = root .child ( "withoutAttribute" )
1983- self .assertNotIn ( "scene:visible" , child .attributeNames () )
1984- self .assertFalse ( child .hasAttribute ( "scene:visible" ) )
1996+ child = root .child ( "withStaticAttribute" )
1997+ self .assertIn ( "scene:visible" , child .attributeNames () )
1998+ self .assertTrue ( child .hasAttribute ( "scene:visible" ) )
1999+ self .assertEqual ( child .readAttribute ( "scene:visible" , 0 ), IECore .BoolData ( True ) )
2000+ self .assertEqual ( child .readAttribute ( "scene:visible" , 1 ), IECore .BoolData ( True ) )
2001+ self .assertEqual (
2002+ child .hash ( IECoreScene .SceneInterface .HashType .AttributesHash , 0 ),
2003+ child .hash ( IECoreScene .SceneInterface .HashType .AttributesHash , 1 ),
2004+ )
2005+ self .assertNotEqual ( child .hash ( IECoreScene .SceneInterface .HashType .AttributesHash , 1 ), animatedFrame1Hash )
2006+ self .assertNotEqual ( child .hash ( IECoreScene .SceneInterface .HashType .AttributesHash , 1 ), withoutHash )
19852007
19862008if __name__ == "__main__" :
19872009 unittest .main ()
0 commit comments