本文整理汇总了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
示例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']
示例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))
示例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']
示例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)
示例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)
示例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
示例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')
示例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()
示例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()
示例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)
示例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']
示例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'
示例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'
示例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]