예제 #1
0
 def __init__(self):
     self.win = 'AudioOffsetManager'
     self.__bwav_reference=None
     
     # bind ProPack Timecode node
     if r9Setup.has_pro_pack():
         self.pro_audio=bind_pro_audio()
예제 #2
0
 def __init__(self, audioNode=None, filepath=None):
     self.__path=''
     self.__audioNode=None
     self.isLoaded=False  # if true we're only working on an audioPath, NOT an active Maya soundNode
     self.pro_bwav=None
     
     if not filepath:
         if audioNode:
             if issubclass(type(audioNode), AudioNode):
                 #log.info('Audio is already an instatiated audioNode')
                 self.audioNode = audioNode.audioNode
             self.audioNode = audioNode
         else:
             self.audioNode = audioSelected()
         if self.audioNode:
             self.isLoaded=True
     else:
         #You can't load a wav more than once, if path is mapped to a current node, switch the class to that
         isAudioloaded = audioPathLoaded(filepath)
         if isAudioloaded:
             log.info('given audio filePath is already assigned to a Maya node, connecting to that : %s' % isAudioloaded[0])
             self.isLoaded=True
             self.audioNode=isAudioloaded[0]
         else:
             self.isLoaded=False
         self.path=filepath
 
     # bind ProPack bwav support
     if r9Setup.has_pro_pack():
         self.pro_audio=bind_pro_audio()
         self.pro_bwav = self.pro_audio.BWav_Handler(self.path)
예제 #3
0
 def _showUI(self):
     if cmds.window(self.win, exists=True):
         cmds.deleteUI(self.win, window=True)
     cmds.window(self.win, title=self.win, widthHeight=(400, 220))
     cmds.columnLayout('uicl_audioMain',adjustableColumn=True)
     cmds.separator(h=15, style='none')
     cmds.separator(h=15, style='in')
     cmds.rowColumnLayout(numberOfColumns=3, columnWidth=[(1, 100), (2, 90), (3, 100)])
     cmds.button(label='<< Offset',
                 ann='Nudge selected Audio Backwards',
                 command=partial(self.offsetSelectedBy,'negative'))
     cmds.floatField('AudioOffsetBy', value=10)
     cmds.button(label='Offset >>',
                 ann='Nudge selected Audio Forwards',
                 command=partial(self.offsetSelectedBy,'positive'))
     cmds.setParent('..')
     cmds.separator(h=15, style='in')
     cmds.rowColumnLayout(numberOfColumns=2, columnWidth=[(1, 200), (2, 90)])
     cmds.button(label='Offset Range to Start at:',
                 ann='offset the selected range of audionodes such that they start at the given frame',
                 command=self.offsetSelectedTo)
     cmds.floatField('AudioOffsetToo', value=10)
     cmds.setParent('..')
     cmds.button(label='Ripple selected',
                 ann="Ripple offset the selected audio nodes so they're timed one after another",
                 command=self.offsetRipple)
     cmds.separator(h=15, style='none')
     cmds.frameLayout(label='PRO : Broadcast Wav support', cll=True, cl=False, borderStyle='etchedOut')
     cmds.columnLayout(adjustableColumn=True, en=r9Setup.has_pro_pack())
     cmds.separator(h=5, style='none')
     cmds.text(label="NOTE: These will only run if the audio is\nin the Bwav format and has internal timecode data.")
     cmds.separator(h=10, style='none')
     cmds.button(label='Sync Bwavs to Internal Timecode',
                 ann='Sync audio nodes to their originally recorded internal timecode reference',
                 command=self.sync_bwavs)
     cmds.separator(h=10, style='in')
     cmds.rowColumnLayout(numberOfColumns=2, columnWidth=[(1, 100)], columnSpacing=[(2,20)])
     cmds.button(label='Set Timecode Ref',
                 ann="Set the audio node to use as the reference timecode so all other become relative to this offset",
                 command=self.__uicb_setReferenceBwavNode)
     cmds.text('bwavRefTC', label='No Reference Set')
     cmds.setParent('..')
     cmds.button(label='Sync Bwavs Relative to Selected',
                 ann="Sync audio nodes via their internal timecodes such that they're relative to that of the given reference",
                 command=self.sync_bwavsRelativeToo)
     cmds.separator(h=10, style='in')
     cmds.rowColumnLayout(numberOfColumns=2, columnWidth=[(1, 140),(2,140)])
     cmds.button(label='Timecode HUD : ON',
                 ann="Live monitor internal Timecode - From a selected node with Timecode Attrs",
                 command=self.timecodeHud)
     cmds.button(label='Timecode HUD : Kill',
                 ann="Kill all HUD's",
                 command=r9Meta.hardKillMetaHUD)
     cmds.setParent('uicl_audioMain')
     cmds.separator(h=10, style='none')
     cmds.iconTextButton(style='iconOnly', bgc=(0.7, 0, 0), image1='Rocket9_buttonStrap2.bmp',
                          c=lambda *args: (r9Setup.red9ContactInfo()), h=22, w=200)
     cmds.showWindow(self.win)
     cmds.window(self.win, e=True, widthHeight=(290, 350))
 def Show(cls):
     if r9Setup.has_pro_pack():
         cmds.confirmDialog(
             title='UI Deprecated',
             message=
             ('This version of the AnimationBinder has been superseded by '
              'the new build in Red9 ProPack and is here for legacy purposes.\n'
              '\nIf making a fresh Binder we recommend using the version in ProPack!'
              ),
             icon='information',
             button='thankyou',
             messageAlign='center')
     cls()._UI()
예제 #5
0
def bind_pro_audio():
    '''
    This is a wrap to import the pro_audio extensions. We have to
    lazy load this to avoid cyclic issues in the boot and wrapping it
    like this makes it easy to consume in the classes
    '''
    if r9Setup.has_pro_pack():
        try:
            import Red9.pro_pack.core.audio as r9paudio  # dev mode only ;)
        except StandardError, err:
            from Red9.pro_pack import r9pro
            r9paudio = r9pro.r9import('r9paudio')
        return r9paudio
예제 #6
0
def bind_pro_audio():
    '''
    This is a wrap to import the pro_audio extensions. We have to
    lazy load this to avoid cyclic issues in the boot and wrapping it
    like this makes it easy to consume in the classes
    '''
    if r9Setup.has_pro_pack():
        try:
            import Red9.pro_pack.core.audio as r9paudio  # dev mode only ;)
        except:
            from Red9.pro_pack import r9pro
            r9pro.r9import('r9paudio')
            import r9paudio
        return r9paudio
예제 #7
0
    def timecodeHud(self,*args):
        '''
        PRO_PACK
        '''
        if r9Setup.has_pro_pack():
            try:
                import Red9.pro_pack.core.metadata_pro as r9pmeta   # dev mode only ;)
            except:
                from Red9.pro_pack import r9pro
                r9pro.r9import('r9pmeta')
                import r9pmeta
        else:
            log.warning('Timecode is ONLY supported in ProPack...')

        nodes=cmds.ls(sl=True)
        if nodes:
            tcHUD=r9pmeta.MetaTimeCodeHUD()
            for node in nodes:
                tcHUD.addMonitoredTimecodeNode(node)
            tcHUD.drawHUD()
예제 #8
0
    def timecodeHud(self, *args):
        '''
        PRO_PACK
        '''
        if r9Setup.has_pro_pack():
            try:
                import Red9.pro_pack.core.metadata_pro as r9pmeta  # dev mode only ;)
            except:
                from Red9.pro_pack import r9pro
                r9pro.r9import('r9pmeta')
                import r9pmeta
        else:
            log.warning('Timecode is ONLY supported in ProPack...')

        nodes = cmds.ls(sl=True)
        if nodes:
            tcHUD = r9pmeta.MetaTimeCodeHUD()
            for node in nodes:
                tcHUD.addMonitoredTimecodeNode(node)
            tcHUD.drawHUD()
예제 #9
0
 def _showUI(self):
     if cmds.window(self.win, exists=True):
         cmds.deleteUI(self.win, window=True)
     cmds.window(self.win, title=self.win, widthHeight=(400, 220))
     cmds.columnLayout('uicl_audioMain',adjustableColumn=True)
     cmds.separator(h=15, style='none')
     cmds.separator(h=15, style='in')
     cmds.rowColumnLayout(numberOfColumns=3, columnWidth=[(1, 100), (2, 90), (3, 100)])
     cmds.button(label='<< Offset',
                 ann='Nudge selected Audio Backwards',
                 command=partial(self.offsetSelectedBy,'negative'))
     cmds.floatField('AudioOffsetBy', value=10)
     cmds.button(label='Offset >>',
                 ann='Nudge selected Audio Forwards',
                 command=partial(self.offsetSelectedBy,'positive'))
     cmds.setParent('..')
     cmds.separator(h=15, style='in')
     cmds.rowColumnLayout(numberOfColumns=2, columnWidth=[(1, 200), (2, 90)])
     cmds.button(label='Offset Range to Start at:',
                 ann='offset the selected range of audionodes such that they start at the given frame',
                 command=self.offsetSelectedTo)
     cmds.floatField('AudioOffsetToo', value=10)
     cmds.setParent('..')
     cmds.button(label='Ripple selected',
                 ann="Ripple offset the selected audio nodes so they're timed one after another",
                 command=self.offsetRipple)
     cmds.separator(h=15, style='none')
     cmds.frameLayout(label='PRO : Broadcast Wav support', cll=True, cl=False, borderStyle='etchedOut')
     cmds.columnLayout(adjustableColumn=True, en=r9Setup.has_pro_pack())
     cmds.separator(h=5, style='none')
     cmds.text(label="NOTE: These will only run if the audio is\nin the Bwav format and has internal timecode data.")
     cmds.separator(h=10, style='none')
     cmds.button(label='Sync Bwavs to Internal Timecode',
                 ann='Sync audio nodes to their originally recorded internal timecode reference',
                 command=self.sync_bwavs)
     cmds.separator(h=15, style='in')
     cmds.text('bwavRefTC', label='No Timecode Reference Set')
     cmds.separator(h=5, style='none')
     cmds.rowColumnLayout(numberOfColumns=2, columnWidth=[(1, 140),(2, 140)])
     cmds.button(label='Timecode Ref from Node',
                 ann="Set the audio node to use as the reference timecode so all other become relative to this offset",
                 command=self.__uicb_setReferenceBwavNode)
     cmds.button(label='Manual Timecode Ref',
                 ann="Manually add the timecode reference",
                 command=self.__uicb_setReferenceBwavTCfromUI)
     cmds.setParent('..')
     cmds.button(label='Sync Bwavs Relative to Selected',
                 ann="Sync audio nodes via their internal timecodes such that they're relative to that of the given reference",
                 command=self.sync_bwavsRelativeToo)
     cmds.separator(h=10, style='in')
     cmds.rowColumnLayout(numberOfColumns=2, columnWidth=[(1, 140),(2,140)])
     cmds.button(label='Timecode HUD : ON',
                 ann="Live monitor internal Timecode - From a selected node with Timecode Attrs",
                 command=self.timecodeHud)
     cmds.button(label='Timecode HUD : Kill',
                 ann="Kill all HUD's",
                 command=r9Meta.hardKillMetaHUD)
     cmds.setParent('uicl_audioMain')
     cmds.separator(h=10, style='none')
     cmds.iconTextButton(style='iconOnly', bgc=(0.7, 0, 0), image1='Rocket9_buttonStrap2.bmp',
                          c=lambda *args: (r9Setup.red9ContactInfo()), h=22, w=200)
     cmds.showWindow(self.win)
     cmds.window(self.win, e=True, widthHeight=(290, 380))