Skip to content

Added fix to FnSceneShape, checks for an existing time connection before... #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 10, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion python/IECoreMaya/FnSceneShape.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down
2 changes: 2 additions & 0 deletions test/IECoreMaya/FnSceneShapeTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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 ) :
Expand Down
4 changes: 3 additions & 1 deletion test/IECoreMaya/MayaSceneTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down