當前位置: 首頁>>代碼示例>>Python>>正文


Python core.Red9_CoreUtils類代碼示例

本文整理匯總了Python中Red9.core.Red9_CoreUtils的典型用法代碼示例。如果您正苦於以下問題:Python Red9_CoreUtils類的具體用法?Python Red9_CoreUtils怎麽用?Python Red9_CoreUtils使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Red9_CoreUtils類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_full_convert

    def test_full_convert(self):
        '''
        full round the houses process back to input value through all converts
        '''
        framerate=30.0
        timecode='00:10:13:22'
        
        a=r9Audio.timecode_to_milliseconds(timecode, smpte=True, framerate=framerate)
        assert r9Core.floatIsEqual(a, 613733.333333, 0.0001)
        
        b=r9Audio.milliseconds_to_frame(a, framerate=framerate)
        assert r9Core.floatIsEqual(b, 18412.0, 0.0001)
        
        c=r9Audio.frame_to_milliseconds(b, framerate=framerate)
        assert r9Core.floatIsEqual(c, 613733.333333, 0.0001)
        
        d=r9Audio.milliseconds_to_Timecode(c, smpte=False, framerate=framerate)
        assert d=='00:10:13:733'  # note converted to non-smpte
        
        e=r9Audio.timecode_to_frame(d, smpte=False, framerate=framerate)
        assert r9Core.floatIsEqual(e, 18411.99, 0.0001)
        
        f=r9Audio.frame_to_timecode(e, smpte=True, framerate=framerate)
        assert f=='00:10:13:22'
        
        assert f==timecode
        
        
    

        
                                                        
開發者ID:timmwagener,項目名稱:Red9_StudioPack,代碼行數:26,代碼來源:Red9_AudioTest.py

示例2: test_prioritizeList

 def test_prioritizeList(self):
     inputList=['aa','vv','gg','ee','yy','ab','ac']
     priority=['ac','vv']
     assert r9Core.prioritizeNodeList(inputList, priority)==['ac','vv','aa','gg','ee','yy','ab']
     
     inputList=['|dd|aa','vv','gg','ee','dd:yy','|ss|ab','|zz|xx|cc|ac']
     priority=['ac','vv']
     assert r9Core.prioritizeNodeList(inputList, priority)==['|zz|xx|cc|ac','vv','|dd|aa','gg','ee','dd:yy','|ss|ab']
     
     inputList=['|dd|aa','vv','gg','ee','dd:yy','|ss|ab','|zz|xx|cc|ac']
     priority=['ac','vv']
     assert r9Core.prioritizeNodeList(inputList, priority, prioritysOnly=True)==['|zz|xx|cc|ac','vv']
開發者ID:juggernate,項目名稱:Red9_StudioPack,代碼行數:12,代碼來源:Red9_CoreUtilTests.py

示例3: test_timeIsInRange

 def test_timeIsInRange(self):
     
     assert r9Core.timeIsInRange((0,100),(9,80))
     assert not r9Core.timeIsInRange((10,100),(9,80))
     assert not r9Core.timeIsInRange((-100,10),(9,80))
     assert r9Core.timeIsInRange((-100,10),(-100,0))
     
     assert r9Core.timeIsInRange((-100,None),(9,80))
     assert r9Core.timeIsInRange((0,None),(9,80))
     assert not r9Core.timeIsInRange((0,None),(-5,80))
     
     assert r9Core.timeIsInRange((None,100),(9,80))
     assert not r9Core.timeIsInRange((None,100),(9,101))
     assert r9Core.timeIsInRange((None,100),(-5,0))
開發者ID:satishgoda,項目名稱:Red9_StudioPack,代碼行數:14,代碼來源:Red9_CoreUtilTests.py

示例4: test_prioritizeList

 def test_prioritizeList(self):
     inputList=['aa','vv','gg','ee','yy','ab','ac']
     priority=['ac','vv']
     assert r9Core.prioritizeNodeList(inputList, priority)==['ac','vv','aa','gg','ee','yy','ab']
     
     inputList=['|dd|aa','vv','gg','ee','dd:yy','|ss|ab','|zz|xx|cc|ac']
     priority=['ac','vv']
     assert r9Core.prioritizeNodeList(inputList, priority)==['|zz|xx|cc|ac','vv','|dd|aa','gg','ee','dd:yy','|ss|ab']
     
     inputList=['|dd|aa','vv','gg','ee','dd:yy','|ss|ab','|zz|xx|cc|ac']
     priority=['ac','vv']
     assert r9Core.prioritizeNodeList(inputList, priority, prioritysOnly=True)==['|zz|xx|cc|ac','vv']
     
     inputList=['AA','SS','FF','GGG','|shoulders|Head','CTRL_M_Head','CTRL_M_HeadPlate','CTRL_Mid_MiddleSpine','CTRL_Mid_MiddleSpine_01','CTRL_Mid_MiddleSpine_02','Mid_Middle','ccc','vvvv']
     priority=['Head','CTRL_Mid_MiddleSpine']
     assert r9Core.prioritizeNodeList(inputList, priority, prioritysOnly=True)== ['|shoulders|Head', 'CTRL_M_Head', 'CTRL_M_HeadPlate', 'CTRL_Mid_MiddleSpine', 'CTRL_Mid_MiddleSpine_01', 'CTRL_Mid_MiddleSpine_02']
開發者ID:hoorayfor3d,項目名稱:Red9_StudioPack,代碼行數:16,代碼來源:Red9_CoreUtilTests.py

示例5: test_decodeString

 def test_decodeString(self):
     assert isinstance(r9Core.decodeString('{"ssss":30}'), dict)
     assert isinstance(r9Core.decodeString('["ssss",30]'), list)
     assert isinstance(r9Core.decodeString('(1,2,3)'), tuple)
     assert isinstance(r9Core.decodeString('True'), bool)
     assert not r9Core.decodeString('None')
     assert isinstance(r9Core.decodeString('ehhehhehe'), str)
     assert isinstance(r9Core.decodeString('5.0'), float)
     assert isinstance(r9Core.decodeString('5'), int)
開發者ID:hoorayfor3d,項目名稱:Red9_StudioPack,代碼行數:9,代碼來源:Red9_CoreUtilTests.py

示例6: test_floatIsEqual

 def test_floatIsEqual(self):
     assert not r9Core.floatIsEqual(1, 0.5, tolerance=0.5, allowGimbal=True)
     assert  r9Core.floatIsEqual(1, 0.51, tolerance=0.5, allowGimbal=True)
     assert r9Core.floatIsEqual(0.1, 0.091, tolerance=0.01, allowGimbal=True)
     
     assert r9Core.floatIsEqual(1, 181, tolerance=0.01, allowGimbal=True)
     assert r9Core.floatIsEqual(1, 91, tolerance=0.01, allowGimbal=True)
     assert not r9Core.floatIsEqual(1, 91, tolerance=0.01, allowGimbal=False)
     assert not r9Core.floatIsEqual(1, -89, tolerance=0.01, allowGimbal=False)
     assert r9Core.floatIsEqual(0.05, 90, tolerance=1, allowGimbal=True)
開發者ID:hoorayfor3d,項目名稱:Red9_StudioPack,代碼行數:10,代碼來源:Red9_CoreUtilTests.py

示例7: test_full_convert

    def test_full_convert(self):
        '''
        full round the houses process back to input value through all converts
        '''
        framerate = 30.0
        timecode = '00:10:13:22'

        a = r9Audio.timecode_to_milliseconds(timecode, smpte=True, framerate=framerate)
        print a
        assert r9Core.floatIsEqual(a, 613733, 0.0001)

        b = r9Audio.milliseconds_to_frame(a, framerate=framerate)
        print b
        assert r9Core.floatIsEqual(b, 18412.0 , 0.0001)

        c = r9Audio.frame_to_milliseconds(b, framerate=framerate)
        print c
        assert r9Core.floatIsEqual(c, 613733.0, 0.0001)

        d = r9Audio.milliseconds_to_Timecode(c, smpte=False, framerate=framerate)
        print d
        assert d == '00:10:13:733'  # note converted to non-smpte

        e = r9Audio.timecode_to_frame(d, smpte=False, framerate=framerate)
        print e
        assert r9Core.floatIsEqual(e, 18412.0, 0.0001)

        f = r9Audio.frame_to_timecode(e, smpte=True, framerate=framerate)
        print e
        assert f == '00:10:13:22'

        assert f == timecode

        # try again with single tests
        assert r9Audio.timecode_to_frame('06:10:29:29', smpte=True, framerate=framerate) == 666899.0
        assert r9Audio.frame_to_timecode(666899.0) == '06:10:29:29'

        assert r9Audio.timecode_to_milliseconds('06:10:29:29') == 22229966
        assert r9Audio.milliseconds_to_Timecode(22229966) == '06:10:29:29'

        assert r9Audio.frame_to_milliseconds(666899.0) == 22229966
        assert r9Audio.milliseconds_to_frame(22229966) == 666899.0

        assert r9Audio.timecode_to_frame('06:10:29:29', smpte=True, framerate=29.97) == 666232.13
開發者ID:markj3d,項目名稱:Red9_StudioPack,代碼行數:44,代碼來源:Red9_AudioTest.py

示例8: test_validateString

 def test_validateString(self):
     # simple string tester for invalid chrs
     try:
         assert not r9Core.validateString('hello!')
     except ValueError:
         assert True
     try:
         assert not r9Core.validateString('#hello')
     except ValueError:
         assert True
     try:
         assert not r9Core.validateString('hello-test')
     except ValueError:
         assert True
     try:
         assert not r9Core.validateString('hello test')
     except ValueError:
         assert True
     assert r9Core.validateString('hellotest')
開發者ID:hoorayfor3d,項目名稱:Red9_StudioPack,代碼行數:19,代碼來源:Red9_CoreUtilTests.py

示例9: removeAttrFromHUD

def removeAttrFromHUD(node, attr):
    """
    remove attrs from the MetaHUD
    """
    currentHUDs = r9Meta.getMetaNodes(mTypes=r9Meta.MetaHUDNode,
                                      mAttrs='mNodeID=CBMonitorHUD')
    if currentHUDs:
        metaHUD=currentHUDs[0]
        if attr:
            metaHUD.killHud()
            monitoredAttr='%s_%s' % (r9Core.nodeNameStrip(node), attr)
            print 'removing attr :', attr, monitoredAttr
            try:
                metaHUD.removeMonitoredAttr(monitoredAttr)
            except:
                pass
        metaHUD.refreshHud()
開發者ID:sayehaye3d,項目名稱:ls-rigging-tools,代碼行數:17,代碼來源:__init__.py

示例10: addAttrToHUD

def addAttrToHUD(node, attr):
    """
    adds node.attr to the HUD using Red9_Meta.MetaHUDNode
    """
    currentHUDs = r9Meta.getMetaNodes(mTypes=r9Meta.MetaHUDNode,
                                      mAttrs='mNodeID=CBMonitorHUD')
    
    if not currentHUDs:
        metaHUD = r9Meta.MetaHUDNode(name='CBMonitorHUD')
    else:
        metaHUD = currentHUDs[0]
    
    monitoredAttr='%s_%s' % (r9Core.nodeNameStrip(node), attr)
    metaHUD.addMonitoredAttr(monitoredAttr,
                             value=mc.getAttr('%s.%s' % (node, attr)),
                             refresh=False)
    mc.connectAttr('%s.%s' % (node, attr), '%s.%s' % (metaHUD.mNode, monitoredAttr))
    metaHUD.refreshHud()
開發者ID:sayehaye3d,項目名稱:ls-rigging-tools,代碼行數:18,代碼來源:__init__.py

示例11: test_timeIsInRange

 def test_timeIsInRange(self):
     
     assert r9Core.timeIsInRange((0,100),(9,80))
     assert not r9Core.timeIsInRange((10,100),(9,80))
     assert not r9Core.timeIsInRange((-100,10),(9,80))
     assert r9Core.timeIsInRange((-100,10),(-100,0))
     
     assert r9Core.timeIsInRange((-100,None),(9,80))
     assert r9Core.timeIsInRange((0,None),(9,80))
     assert not r9Core.timeIsInRange((0,None),(-5,80))
     
     assert r9Core.timeIsInRange((None,100),(9,80))
     assert not r9Core.timeIsInRange((None,100),(9,101))
     assert r9Core.timeIsInRange((None,100),(-5,0))
     
     assert r9Core.timeIsInRange((40,100),(40,100), start_inRange=True, end_inRange=True)
     assert r9Core.timeIsInRange((40,100),(50,99), start_inRange=True, end_inRange=True)
     assert not r9Core.timeIsInRange((40,100),(40,101), start_inRange=True, end_inRange=True)
     assert r9Core.timeIsInRange((40,100),(50,101), start_inRange=True, end_inRange=False)
     assert r9Core.timeIsInRange((40,100),(20,50), start_inRange=False, end_inRange=True)
     assert not r9Core.timeIsInRange((40,100),(20,101), start_inRange=False, end_inRange=True)
開發者ID:hoorayfor3d,項目名稱:Red9_StudioPack,代碼行數:21,代碼來源:Red9_CoreUtilTests.py

示例12: test_filterListByString

 def test_filterListByString(self):
     testlist=['big','fat','round','fluffy','redbigfat','flufgrub']
     assert r9Core.filterListByString(testlist, 'Ff', matchcase=False) == ['fluffy']
     assert r9Core.filterListByString(testlist, 'Ff', matchcase=True) == []
     assert r9Core.filterListByString(testlist, 'big,ff', matchcase=False) == ['big', 'fluffy', 'redbigfat']
     assert r9Core.filterListByString(testlist, 'Big,ff', matchcase=True) == ['fluffy']
開發者ID:hoorayfor3d,項目名稱:Red9_StudioPack,代碼行數:6,代碼來源:Red9_CoreUtilTests.py

示例13: test_stringReplace

 def test_stringReplace(self):
     a='this is a test of String replacement PPP'
     assert r9Core.stringReplace(a, {'String':'rhubarb'}) == 'this is a test of rhubarb replacement PPP'
     assert r9Core.stringReplace(a, {'PPP':'P.P.P'}) == 'this is a test of String replacement P.P.P'
     assert r9Core.stringReplace(a, {}) == 'this is a test of String replacement PPP'
開發者ID:hoorayfor3d,項目名稱:Red9_StudioPack,代碼行數:5,代碼來源:Red9_CoreUtilTests.py

示例14: test_nodeNameStrip

 def test_nodeNameStrip(self):
     assert r9Core.nodeNameStrip('|root|of|systems|ctrl') == 'ctrl'
     assert r9Core.nodeNameStrip('|AA:root|AA:of|AA:systems|AA:ctrl') == 'ctrl'
     assert r9Core.nodeNameStrip('|BBBB:ctrl') == 'ctrl'
開發者ID:hoorayfor3d,項目名稱:Red9_StudioPack,代碼行數:4,代碼來源:Red9_CoreUtilTests.py

示例15: Test_LockNodes

        
        assert r9Core.timeIsInRange((0,100),(9,80))
        assert not r9Core.timeIsInRange((10,100),(9,80))
        assert not r9Core.timeIsInRange((-100,10),(9,80))
        assert r9Core.timeIsInRange((-100,10),(-100,0))
        
        assert r9Core.timeIsInRange((-100,None),(9,80))
        assert r9Core.timeIsInRange((0,None),(9,80))
        assert not r9Core.timeIsInRange((0,None),(-5,80))
        
        assert r9Core.timeIsInRange((None,100),(9,80))
        assert not r9Core.timeIsInRange((None,100),(9,101))
        assert r9Core.timeIsInRange((None,100),(-5,0))
        
<<<<<<< HEAD
        assert r9Core.timeIsInRange((40,100),(40,100), start_inRange=True, end_inRange=True)
        assert r9Core.timeIsInRange((40,100),(50,99), start_inRange=True, end_inRange=True)
        assert not r9Core.timeIsInRange((40,100),(40,101), start_inRange=True, end_inRange=True)
        assert r9Core.timeIsInRange((40,100),(50,101), start_inRange=True, end_inRange=False)
        assert r9Core.timeIsInRange((40,100),(20,50), start_inRange=False, end_inRange=True)
        assert not r9Core.timeIsInRange((40,100),(20,101), start_inRange=False, end_inRange=True)

  
=======
        
>>>>>>> d7ab8a039c4da0838a07bf4a9ec3ad957667b21e
class Test_LockNodes(object):
    def setup(self):
        cmds.file(new=True,f=True)
        self.cube=cmds.ls(cmds.polyCube()[0],l=True)[0]
        
開發者ID:Italic-,項目名稱:maya-prefs,代碼行數:29,代碼來源:Red9_CoreUtilTests.py


注:本文中的Red9.core.Red9_CoreUtils類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。