Ejemplo n.º 1
0
    def setUp(self):
        ''' Called initially to set up the maya test environment '''
        # Load plugins
        self.assertTrue(self.pluginsLoaded)

        # These tests requires no additional setup.
        if self._testMethodName in [
                'testAddNewPrim', 'testAddNewPrimWithDelete'
        ]:
            return

        # Open top_layer.ma scene in test-samples
        mayaUtils.openTopLayerScene()

        # Clear selection to start off.
        ufe.GlobalSelection.get().clear()

        # Select Ball_35.
        ball35Path = ufe.Path([
            mayaUtils.createUfePathSegment("|world|transform1|proxyShape1"),
            usdUtils.createUfePathSegment("/Room_set/Props/Ball_35")
        ])
        self.ball35Item = ufe.Hierarchy.createItem(ball35Path)
        self.ball35Prim = usdUtils.getPrimFromSceneItem(self.ball35Item)

        ufe.GlobalSelection.get().append(self.ball35Item)

        # Create a ContextOps interface for it.
        self.contextOps = ufe.ContextOps.contextOps(self.ball35Item)
Ejemplo n.º 2
0
    def setUp(self):
        ''' Called initially to set up the maya test environment '''
        # Load plugins
        self.assertTrue(self.pluginsLoaded)

        # Set up memento, a list of snapshots.
        self.memento = []

        # Callables to get current object translation and rotation using the
        # run-time and UFE.
        self.move = 0
        self.rotate = 1
        self.scale = 2
        self.ops = [self.move, self.rotate, self.scale]
        self.runTimes = [None, None, None]
        self.ufes = [None, None, None]

        self.noSpace = None
        self.spaces = [om.MSpace.kObject, om.MSpace.kWorld]

        # Open top_layer.ma scene in test-samples
        mayaUtils.openTopLayerScene()

        # Create some extra Maya nodes
        cmds.polySphere()
        cmds.polyCube()

        # Clear selection to start off
        cmds.select(clear=True)
Ejemplo n.º 3
0
    def setUp(self):
        ''' Called initially to set up the maya test environment '''
        # Load plugins
        self.assertTrue(self.pluginsLoaded)

        # Open top_layer.ma scene in test-samples
        mayaUtils.openTopLayerScene()

        # Create a proxy shape with empty stage to start with.
        import mayaUsd_createStageWithNewLayer
        mayaUsd_createStageWithNewLayer.createStageWithNewLayer()

        # Clear selection to start off.
        ufe.GlobalSelection.get().clear()

        # Select Ball_35.
        ball35Path = ufe.Path([
            mayaUtils.createUfePathSegment("|world|transform1|proxyShape1"),
            usdUtils.createUfePathSegment("/Room_set/Props/Ball_35")
        ])
        self.ball35Item = ufe.Hierarchy.createItem(ball35Path)

        ufe.GlobalSelection.get().append(self.ball35Item)

        # Create a ContextOps interface for it.
        self.contextOps = ufe.ContextOps.contextOps(self.ball35Item)
Ejemplo n.º 4
0
    def setUpClass(cls):
        if not cls.pluginsLoaded:
            cls.pluginsLoaded = mayaUtils.isMayaUsdPluginLoaded()

        # Open top_layer.ma scene in test-samples
        mayaUtils.openTopLayerScene()

        random.seed()
Ejemplo n.º 5
0
    def setUp(self):
        ''' Called initially to set up the Maya test environment '''
        # Load plugins
        self.assertTrue(self.pluginsLoaded)

        # Open top_layer.ma scene in test-samples
        mayaUtils.openTopLayerScene()

        # Clear selection to start off
        cmds.select(clear=True)
Ejemplo n.º 6
0
    def testVisibility(self):
        '''Test the Object3d visibility methods.'''

        # Open top_layer.ma scene in test-samples
        mayaUtils.openTopLayerScene()

        # Get a scene item for Ball_35.
        ball35Path = ufe.Path([
            mayaUtils.createUfePathSegment("|world|transform1|proxyShape1"),
            usdUtils.createUfePathSegment("/Room_set/Props/Ball_35")
        ])
        ball35Item = ufe.Hierarchy.createItem(ball35Path)

        # Create an Object3d interface for it.
        object3d = ufe.Object3d.object3d(ball35Item)

        visObs = TestObserver()

        # We start off with no visibility observers.
        self.assertFalse(ufe.Object3d.hasObserver(visObs))
        self.assertEqual(ufe.Object3d.nbObservers(), 0)

        # Set the observer for visibility changes.
        ufe.Object3d.addObserver(visObs)
        self.assertTrue(ufe.Object3d.hasObserver(visObs))
        self.assertEqual(ufe.Object3d.nbObservers(), 1)

        # No notifications yet.
        self.assertEqual(visObs.notifications(), 0)

        # Initially it should be visible.
        self.assertTrue(object3d.visibility())

        # Make it invisible.
        object3d.setVisibility(False)
        self.assertFalse(object3d.visibility())

        # We should have got 'one' notification.
        self.assertEqual(visObs.notifications(), 1)

        # Make it visible.
        object3d.setVisibility(True)
        self.assertTrue(object3d.visibility())

        # We should have got one more notification.
        self.assertEqual(visObs.notifications(), 2)

        # Remove the observer.
        ufe.Object3d.removeObserver(visObs)
        self.assertFalse(ufe.Object3d.hasObserver(visObs))
        self.assertEqual(ufe.Object3d.nbObservers(), 0)
Ejemplo n.º 7
0
    def setUp(self):
        ''' Called initially to set up the maya test environment '''
        # Load plugins
        self.assertTrue(self.pluginsLoaded)

        # Set up memento - [[mayaSelection, ufeSelection], ...]
        self.memento = []

        # Open top_layer.ma scene in test-samples
        mayaUtils.openTopLayerScene()

        # Create some extra Maya nodes
        cmds.polySphere()
        cmds.polyCube()

        # Clear selection to start off
        cmds.select(clear=True)
Ejemplo n.º 8
0
    def setUp(self):
        ''' Called initially to set up the maya test environment '''
        # Load plugins
        self.assertTrue(self.pluginsLoaded)
        
        # Set up memento, a list of snapshots.
        self.memento = []
        
        # Callables to get current object translation using the run-time and
        # UFE.
        self.runTimeTranslation = None
        self.ufeTranslation = None

        # Open top_layer.ma scene in test-samples
        mayaUtils.openTopLayerScene()
        
        # Create some extra Maya nodes
        cmds.polySphere()
        cmds.polyCube()
        
        # Clear selection to start off
        cmds.select(clear=True)
Ejemplo n.º 9
0
    def setUp(self):
        ''' Called initially to set up the maya test environment '''
        self.assertTrue(self.pluginsLoaded)

        # Open top_layer.ma scene in test-samples
        mayaUtils.openTopLayerScene()