

def testHashPassThrough(self):
    sphere = IECore.SpherePrimitive()
    input = GafferSceneTest.CompoundObjectSource()
    input['in'].setValue(IECore.CompoundObject({
        'bound': IECore.Box3fData(sphere.bound()),
        'children': {
            'ball1': {
                'object': sphere,
                'bound': IECore.Box3fData(sphere.bound()),
            },
            'ball2': {
                'object': sphere,
                'bound': IECore.Box3fData(sphere.bound()),
            },
        },
    }))
    a = GafferScene.CustomAttributes()
    a['in'].setInput(input['out'])
    self.assertSceneHashesEqual(input['out'], a['out'])
    a['attributes'].addMember('ri:shadingRate', IECore.FloatData(2.0))
    self.assertSceneHashesEqual(input['out'], a['out'], childPlugNames=('globals', 'childNames', 'transform', 'bound', 'object'))
    self.assertSceneHashesNotEqual(input['out'], a['out'], childPlugNames=('attributes',))
    f = GafferScene.PathFilter()
    f['paths'].setValue(IECore.StringVectorData(['/ball1']))
    a['filter'].setInput(f['out'])
    self.assertSceneHashesEqual(input['out'], a['out'], pathsToIgnore=('/ball1',))
    c = Gaffer.Context()
    c['scene:path'] = IECore.InternedStringVectorData(['ball1'])
    with c:
        self.assertEqual(a['out']['childNames'].hash(), input['out']['childNames'].hash())
        self.assertEqual(a['out']['transform'].hash(), input['out']['transform'].hash())
        self.assertEqual(a['out']['bound'].hash(), input['out']['bound'].hash())
        self.assertEqual(a['out']['object'].hash(), input['out']['object'].hash())
        self.assertNotEqual(a['out']['attributes'].hash(), input['out']['attributes'].hash())

dataset/ETHPy150Open ImageEngine/gaffer/python/GafferSceneTest/CustomAttributesTest.py CustomAttributesTest.testHashPassThrough/original