Beispiel #1
0
    def testAttributeColorFloat3(self):
        '''Test the ColorFloat3 attribute type.'''

        # Use our engine method to run the bulk of the test (all the stuff from
        # the Attribute base class). We use the visibility attribute which is
        # an ColorFloat3 type.
        ufeAttr, usdAttr = attrDict = self.runTestAttribute(
            path='/Room_set/Props/Ball_35/Looks/BallLook/Base',
            attrName='emitColor',
            ufeAttrClass=ufe.AttributeColorFloat3,
            ufeAttrType=ufe.Attribute.kColorFloat3)

        # Now we test the ColorFloat3 specific methods.

        # Compare the initial UFE value to that directly from USD.
        self.assertColorAlmostEqual(ufeAttr.get(), usdAttr.Get())

        # Set the attribute in UFE with some random color values.
        vec = ufe.Color3f(random.random(), random.random(), random.random())
        ufeAttr.set(vec)

        # Then make sure that new UFE value matches what it in USD.
        self.assertColorAlmostEqual(ufeAttr.get(), usdAttr.Get())

        # The following causes a segmentation fault on CentOS 7.
        # self.runUndoRedo(ufeAttr,
        #                  ufe.Color3f(vec.r()+1.0, vec.g()+2.0, vec.b()+3.0))
        # Entered as MAYA-102168.
        newVec = ufe.Color3f(vec.color[0] + 1.0, vec.color[1] + 2.0,
                             vec.color[2] + 3.0)
        self.runUndoRedo(ufeAttr, newVec)
Beispiel #2
0
    def testUIInfo(self):
        rid = ufe.RunTimeMgr.instance().getId('USD')
        ufeUIInfo = ufe.UIInfoHandler.uiInfoHandler(rid)
        self.assertIsNotNone(ufeUIInfo)

        # We won't test the actual string. Just make sure its not empty.
        self.assertNotEqual(0, len(ufeUIInfo.getLongRunTimeLabel()))

        # Deactivate one of the balls.
        cmds.delete('|transform1|proxyShape1,/Ball_set/Props/Ball_3')

        # Now ask for the treeViewCellInfo and test that some values were set
        # (because the ball is inactive).
        ball3Path = ufe.PathString.path(
            '|transform1|proxyShape1,/Ball_set/Props/Ball_3')
        ball3Hier = ufe.Hierarchy.createItem(ball3Path)

        # A return value of true means something was set.
        # Note: operator= in Python creates a new variable that shares the reference
        #       of the original object. So don't create initTextFgClr from ci.textFgColor.
        ci = ufe.CellInfo()
        initTextFgClr = ufe.Color3f(ci.textFgColor.r(), ci.textFgColor.g(),
                                    ci.textFgColor.b())
        changed = ufeUIInfo.treeViewCellInfo(ball3Hier, ci)
        self.assertTrue(changed)

        # Strikeout should be be set and the text fg color changed.
        self.assertTrue(ci.fontStrikeout)
        self.assertTrue(initTextFgClr != ci.textFgColor)

        if (os.getenv('UFE_PREVIEW_VERSION_NUM', '0000') >= '2024'):
            # Ball_3 should have a specific node type icon set and no badge.
            icon = ufeUIInfo.treeViewIcon(ball3Hier)
            self.assertEqual(icon.baseIcon, "out_USD_Sphere.png")
            self.assertFalse(icon.badgeIcon)  # empty string
Beispiel #3
0
    def testAttributeColorFloat3(self):
        '''Test the ColorFloat3 attribute type.'''

        # Use our engine method to run the bulk of the test (all the stuff from
        # the Attribute base class). We use the visibility attribute which is
        # an ColorFloat3 type.
        ufeAttr, usdAttr = attrDict = self.runTestAttribute(
            path='/Room_set/Props/Ball_35/Looks/BallLook/Base',
            attrName='emitColor',
            ufeAttrClass=ufe.AttributeColorFloat3,
            ufeAttrType=ufe.Attribute.kColorFloat3)

        # Now we test the ColorFloat3 specific methods.

        # Compare the initial UFE value to that directly from USD.
        self.assertColorAlmostEqual(ufeAttr.get(), usdAttr.Get())

        # Set the attribute in UFE with some random color values.
        vec = ufe.Color3f(random.random(), random.random(), random.random())
        ufeAttr.set(vec)

        # Then make sure that new UFE value matches what it in USD.
        self.assertColorAlmostEqual(ufeAttr.get(), usdAttr.Get())