diff --git a/python/IECoreMaya/FnSceneShape.py b/python/IECoreMaya/FnSceneShape.py index d4a0686395..a2531a3a6f 100644 --- a/python/IECoreMaya/FnSceneShape.py +++ b/python/IECoreMaya/FnSceneShape.py @@ -278,7 +278,8 @@ def expandOnce( self ) : maya.cmds.setAttr( childNode+".drawTagsFilter", " ".join(commonTags),type="string" ) # Connect child time to its parent so they're in sync - maya.cmds.connectAttr( node+".time", childNode+".time", f=True ) + if not maya.cmds.isConnected( node+".time", childNode+".time" ): + maya.cmds.connectAttr( node+".time", childNode+".time", f=True ) if maya.cmds.listRelatives( childTransform, parent = True, f=True ) != [ transform ]: maya.cmds.parent( childTransform, transform, relative=True ) diff --git a/test/IECoreMaya/FnSceneShapeTest.py b/test/IECoreMaya/FnSceneShapeTest.py index d7e8a6a29f..5f78f3ac56 100644 --- a/test/IECoreMaya/FnSceneShapeTest.py +++ b/test/IECoreMaya/FnSceneShapeTest.py @@ -138,6 +138,7 @@ def testExpandOnce( self ) : self.assertTrue( maya.cmds.isConnected( fn.fullPathName()+".outTransform[0].outTranslate", "|test|sceneShape_1.translate" ) ) self.assertTrue( maya.cmds.isConnected( fn.fullPathName()+".outTransform[0].outRotate", "|test|sceneShape_1.rotate" ) ) self.assertTrue( maya.cmds.isConnected( fn.fullPathName()+".outTransform[0].outScale", "|test|sceneShape_1.scale" ) ) + self.assertTrue( maya.cmds.isConnected( fn.fullPathName()+".time", childFn.fullPathName()+".time" ) ) maya.cmds.setAttr( childFn.fullPathName()+".drawGeometry", 1 ) result = childFn.expandOnce() @@ -154,6 +155,7 @@ def testExpandOnce( self ) : self.assertTrue( maya.cmds.isConnected( childFn.fullPathName()+".outTransform[0].outRotate", "|test|sceneShape_1|child.rotate" ) ) self.assertTrue( maya.cmds.isConnected( childFn.fullPathName()+".outTransform[0].outScale", "|test|sceneShape_1|child.scale" ) ) self.assertEqual( maya.cmds.getAttr( result[0].fullPathName()+".drawGeometry"), 1 ) + self.assertTrue( maya.cmds.isConnected( childFn.fullPathName()+".time", result[0].fullPathName()+".time" ) ) def testCollapse( self ) : diff --git a/test/IECoreMaya/MayaSceneTest.py b/test/IECoreMaya/MayaSceneTest.py index 14d2421d54..b5209b192b 100644 --- a/test/IECoreMaya/MayaSceneTest.py +++ b/test/IECoreMaya/MayaSceneTest.py @@ -555,7 +555,9 @@ def testSceneShapeCustomReaders( self ): self.assertFalse( spheresScene.hasAttribute( IECore.LinkedScene.linkAttribute ) ) leafScene = spheresScene.child("A").child("a") self.assertTrue( leafScene.hasAttribute( IECore.LinkedScene.linkAttribute ) ) - self.assertEqual( leafScene.readAttribute( IECore.LinkedScene.linkAttribute, 0 ), IECore.CompoundData( { "fileName":IECore.StringData('test/IECore/data/sccFiles/animatedSpheres.scc'), "root":IECore.InternedStringVectorData([ 'A', 'a' ]) } ) ) + # When expanding, we connect the child time attributes to their scene shape parent time attribute to propagate time remapping. When checking for time remapping, the scene shape + # currently only checks the direct connection, so we have here time in the link attributes. Will have to look out for performance issues. + self.assertEqual( leafScene.readAttribute( IECore.LinkedScene.linkAttribute, 0 ), IECore.CompoundData( { "fileName":IECore.StringData('test/IECore/data/sccFiles/animatedSpheres.scc'), "root":IECore.InternedStringVectorData([ 'A', 'a' ]), 'time':IECore.DoubleData( 0 ) } ) ) self.assertFalse( leafScene.hasObject() ) # expand scene to meshes