示例#1
0
	def testRGBPPConversion( self ) :

		points = IECoreScene.PointsPrimitive( IECore.V3fVectorData( [ imath.V3f( x ) for x in range( 0, 10 ) ] ) )
		points["rgbPP"] = IECoreScene.PrimitiveVariable( IECoreScene.PrimitiveVariable.Interpolation.Vertex, IECore.Color3fVectorData( [ imath.Color3f( x ) for x in range( 10, 20 ) ] ) )
		parent = maya.cmds.createNode( "transform" )
		IECoreMaya.ToMayaParticleConverter( points ).convert( parent )

		children = maya.cmds.listRelatives( parent )
		self.assertEqual( len( children ), 1 )

		particleShape = children[0]
		self.assertEqual( maya.cmds.nodeType( particleShape ), "particle" )

		self.assertEqual( maya.cmds.particle( particleShape, query=True, count=True ), 10 )

		for i in range( 0, 10 ) :
			self.assertEqual( maya.cmds.particle( attribute="rgbPP", q=True, order=i ), [ i+10, i+10, i+10 ] )
示例#2
0
	def testConversion( self ) :

		points = IECoreScene.PointsPrimitive( IECore.V3fVectorData( [ imath.V3f( x ) for x in range( 0, 10 ) ] ) )

		parent = maya.cmds.createNode( "transform" )
		IECoreMaya.ToMayaParticleConverter( points ).convert( parent )

		children = maya.cmds.listRelatives( parent )
		self.assertEqual( len( children ), 1 )

		particleShape = children[0]
		self.assertEqual( maya.cmds.nodeType( particleShape ), "particle" )

		self.assertEqual( maya.cmds.particle( particleShape, query=True, count=True ), 10 )

		for i in range( 0, 10 ) :
			self.assertEqual( maya.cmds.particle( attribute="position", q=True, order=i ), [ i, i, i ] )

		self.failIf( "P" in maya.cmds.particle( particleShape, query=True, perParticleVector=True ) )
示例#3
0
	def testConversionFromDoubles( self ) :

		points = IECore.PointsPrimitive( 10 )
		points["P"] = IECore.PrimitiveVariable( IECore.PrimitiveVariable.Interpolation.Vertex, IECore.V3dVectorData( [ IECore.V3d( x ) for x in range( 0, 10 ) ] ) )
		points["rgbPP"] = IECore.PrimitiveVariable( IECore.PrimitiveVariable.Interpolation.Vertex, IECore.V3dVectorData( [ IECore.V3d( x ) for x in range( 10, 20 ) ] ) )
		
		parent = maya.cmds.createNode( "transform" )
		IECoreMaya.ToMayaParticleConverter( points ).convert( parent )
		
		children = maya.cmds.listRelatives( parent )		
		self.assertEqual( len( children ), 1 )
		
		particleShape = children[0]
		self.assertEqual( maya.cmds.nodeType( particleShape ), "particle" )
		
		self.assertEqual( maya.cmds.particle( particleShape, query=True, count=True ), 10 )
		
		for i in range( 0, 10 ) :
			self.assertEqual( maya.cmds.particle( attribute="position", q=True, order=i ), [ i, i, i ] )
		
		self.failIf( "P" in maya.cmds.particle( particleShape, query=True, perParticleVector=True ) )