Ejemplo n.º 1
0
    def testLoad(self):
        skinCluster = 'skinCluster1'

        mll = flexmock()
        mll.should_receive('setCurrentMesh').once()
        mll.should_receive('listLayers').and_return(
            ((123, "layer1"), (456, "layer2"))).once()
        mll.should_receive('getLayerOpacity').with_args(123).and_return(0.9)
        mll.should_receive('getLayerOpacity').with_args(456).and_return(1.0)
        mll.should_receive('isLayerEnabled').with_args(123).and_return(True)
        mll.should_receive('isLayerEnabled').with_args(456).and_return(False)
        mll.should_receive('getLayerMask').with_args(123).and_return(
            [1.2, 1.1, 1.0, 0])
        mll.should_receive('getLayerMask').with_args(456).and_return(
            [1.2, 1.1, 1.0, 0])
        mll.should_receive('listLayerInfluences').with_args(123).and_return(
            (('infl1', 0), ('infl2', 1)))
        mll.should_receive('listLayerInfluences').with_args(456).and_return(
            (('infl3', 0), ('infl4', 1)))
        mll.should_receive('getInfluenceWeights').with_args(123, 0).and_return(
            [0, 0, 0, 0])
        mll.should_receive('getInfluenceWeights').with_args(123, 1).and_return(
            [0, 0, 0, 0])
        mll.should_receive('getInfluenceWeights').with_args(456, 0).and_return(
            [0, 0, 0, 0])
        mll.should_receive('getInfluenceWeights').with_args(456, 1).and_return(
            [0, 0, 0, 0])
        mll.should_receive('listManualMirrorInfluenceAssociations').and_return(
            {"a": "b"})

        model = LayerData()
        model.getFullNodePath = lambda a: a
        model.mll = mll
        model.loadFrom(skinCluster)

        self.assertEquals(model.layers[0].name, "layer1")
        self.assertEquals(model.layers[1].name, "layer2")
        self.assertEquals(model.layers[0].opacity, 0.9)
        self.assertEquals(model.layers[0].enabled, True)
        self.assertEquals(model.layers[1].enabled, False)

        self.assertEquals(model.layers[1].influences[0].influenceName, "infl3")
        self.assertEquals(model.layers[1].influences[1].influenceName, "infl4")

        self.assertEquals(model.layers[0].influences[0].logicalIndex, 0)
        self.assertEquals(model.layers[0].influences[1].logicalIndex, 1)
Ejemplo n.º 2
0
    def testLoad(self):
        skinCluster = 'skinCluster1'
        
        mll = flexmock()
        mll.should_receive('setCurrentMesh').once()
        mll.should_receive('listLayers').and_return(((123,"layer1"),(456,"layer2"))).once()
        mll.should_receive('getLayerOpacity').with_args(123).and_return(0.9)
        mll.should_receive('getLayerOpacity').with_args(456).and_return(1.0)
        mll.should_receive('isLayerEnabled').with_args(123).and_return(True)
        mll.should_receive('isLayerEnabled').with_args(456).and_return(False)
        mll.should_receive('getLayerMask').with_args(123).and_return([1.2,1.1,1.0,0])
        mll.should_receive('getLayerMask').with_args(456).and_return([1.2,1.1,1.0,0])
        mll.should_receive('listLayerInfluences').with_args(123).and_return((('infl1',0),('infl2',1)))
        mll.should_receive('listLayerInfluences').with_args(456).and_return((('infl3',0),('infl4',1)))
        mll.should_receive('getInfluenceWeights').with_args(123,0).and_return([0,0,0,0])
        mll.should_receive('getInfluenceWeights').with_args(123,1).and_return([0,0,0,0])
        mll.should_receive('getInfluenceWeights').with_args(456,0).and_return([0,0,0,0])
        mll.should_receive('getInfluenceWeights').with_args(456,1).and_return([0,0,0,0])
        mll.should_receive('listManualMirrorInfluenceAssociations').and_return({"a":"b"})
        
        
        model = LayerData()
        model.getFullNodePath = lambda a: a
        model.mll = mll
        model.loadFrom(skinCluster)
        
        self.assertEquals(model.layers[0].name, "layer1")
        self.assertEquals(model.layers[1].name, "layer2")
        self.assertEquals(model.layers[0].opacity, 0.9)
        self.assertEquals(model.layers[0].enabled, True)
        self.assertEquals(model.layers[1].enabled, False)

        self.assertEquals(model.layers[1].influences[0].influenceName, "infl3")
        self.assertEquals(model.layers[1].influences[1].influenceName, "infl4")
        
        self.assertEquals(model.layers[0].influences[0].logicalIndex, 0)
        self.assertEquals(model.layers[0].influences[1].logicalIndex, 1)
Ejemplo n.º 3
0
 def testNodePath(self):
     model = LayerData()
     self.assertEquals(model.getFullNodePath("persp"),"|persp")
Ejemplo n.º 4
0
 def testNodePath(self):
     model = LayerData()
     self.assertEquals(model.getFullNodePath("persp"), "|persp")