Esempio n. 1
0
def uiFunc_updateTimeRange(self, which='slider', mode='slider'):
    _range = SEARCH.get_time(mode)
    if _range:
        if which == "min":
            self.uiFieldInt_start(edit=True, value=_range[0])
        elif which == "max":
            self.uiFieldInt_end(edit=True, value=_range[1])
        elif which == "slider":
            self.uiFieldInt_start(edit=True, value=_range[0])
            self.uiFieldInt_end(edit=True, value=_range[1])
    def uiFunc_bake(self, *args):
        mode = args[0]

        bake_range = [self.startFrameField(q=True, value=True), self.endFrameField(q=True, value=True)]
        current_frame = SEARCH.get_time('current')
        if mode == 'back':
            bake_range[1] = min(current_frame, bake_range[0], bake_range[1])
            bake_range[0] = current_frame
        if mode == 'forward':
            bake_range[1] = max(current_frame, bake_range[0], bake_range[1])
            bake_range[0] = current_frame

        mc.currentTime(bake_range[0])
        
        if len(self.connection_data) != len(self.parent_links):
            self.connection_data = self.get_ui_connection_data()

        if self.var_mocap_set_connection_at_bake.value:
            self.uiFunc_set_connection_pose()

        bake(self.connection_data, bake_range[0], bake_range[1]) 
 def uiFunc_updateTimeRange(self,mode = 'slider'):
     _range = SEARCH.get_time(mode)
     if _range:
         self.startFrameField(edit = True, value = _range[0])
         self.endFrameField(edit = True, value = _range[1])  
    def buildOptions(self,parent, asScroll = False):
 
        if asScroll:
            _inside = mUI.MelScrollLayout(parent,useTemplate = 'cgmUISubTemplate') 
        else:
            _inside = mUI.MelColumnLayout(parent,useTemplate = 'cgmUISubTemplate') 
        
        #>>>Objects Load Row ---------------------------------------------------------------------------------------
        
        mc.setParent(_inside)
        cgmUI.add_LineSubBreak()

        _row = mUI.MelHSingleStretchLayout(_inside,ut='cgmUISubTemplate',padding = 5,bgc=_subLineBGC)
        mUI.MelSpacer(_row,w=5)
        mUI.MelLabel(_row,l='Auto Link by')
        _row.setStretchWidget( mUI.MelSeparator(_row) )
    
        cgmUI.add_Button(_row,'Name',
                 cgmGEN.Callback(self.uiFunc_link_by_name,self),
                 _d_annotations.get('linkName','fix'), bgc=_buttonBGC) 
        cgmUI.add_Button(_row,'Distance',
                 cgmGEN.Callback(self.uiFunc_link_by_distance,self),
                 _d_annotations.get('linkDistance','fix'), bgc=_buttonBGC) 
        mUI.MelSpacer(_row,w=5)
        _row.layout()

        _row = mUI.MelHSingleStretchLayout(_inside,ut='cgmUISubTemplate',padding = 1,bgc=_subLineBGC)
        mUI.MelSpacer(_row,w=9)
        mUI.MelLabel(_row,l='Set Target Constraint to')
        _row.setStretchWidget( mUI.MelSeparator(_row) )

        cgmUI.add_Button(_row,'Point/Orient',
                 cgmGEN.Callback(self.uiFunc_set_constraint_type,1,True,self),
                 _d_annotations.get('setPointOrient','fix'), bgc=_buttonBGC) 
        cgmUI.add_Button(_row,'A',
                 cgmGEN.Callback(self.uiFunc_set_constraint_type,1,False,self),
                 _d_annotations.get('setPointOrientAll','fix'), bgc=_buttonBGC) 
        mUI.MelSpacer(_row,w=4)
        cgmUI.add_Button(_row,'Orient',
                 cgmGEN.Callback(self.uiFunc_set_constraint_type,0,True,self),
                 _d_annotations.get('setOrient','fix'), bgc=_buttonBGC) 
        cgmUI.add_Button(_row,'A',
                 cgmGEN.Callback(self.uiFunc_set_constraint_type,1,False,self),
                 _d_annotations.get('setOrientAll','fix'), bgc=_buttonBGC) 
        mUI.MelSpacer(_row,w=9)

        _row.layout()


        _row = mUI.MelHSingleStretchLayout(_inside,ut='cgmUISubTemplate',padding = 5,bgc=_subLineBGC)
        mUI.MelSpacer(_row,w=5)
        mUI.MelLabel(_row,l='Set Connection Pose')
        _row.setStretchWidget( mUI.MelSeparator(_row) )
        self.cb_set_connection_at_bake = mUI.MelCheckBox(_row,
                           v = self.var_mocap_set_connection_at_bake.value,
                           onCommand = lambda *a: self.var_mocap_set_connection_at_bake.setValue(1),
                           offCommand = lambda *a: self.var_mocap_set_connection_at_bake.setValue(0),
                           label="Set On Bake")
        cgmUI.add_Button(_row,'Manual Set',
                 cgmGEN.Callback(self.uiFunc_set_connection_pose,1,self),
                 _d_annotations.get('setConnectionPose','fix'), bgc = [.5,.2,0.2]) 
        mUI.MelSpacer(_row,w=5)

        _row.layout()

        # Bake Options

        timelineInfo = SEARCH.get_time('slider')

        mc.setParent(_inside)
        cgmUI.add_Header("Bake Options", overrideUpper = True)

        cgmUI.add_LineSubBreak()


        _row = mUI.MelHSingleStretchLayout(_inside,ut='cgmUISubTemplate',padding = 5,bgc=_subLineBGC)
        #self.timeSubMenu.append( _row )
        mUI.MelSpacer(_row,w=5)
        mUI.MelLabel(_row,l='Set Timeline Range')
        _row.setStretchWidget( mUI.MelSeparator(_row) )

        cgmUI.add_Button(_row,'Slider',
                 cgmGEN.Callback(self.uiFunc_updateTimeRange,'slider'),
                 _d_annotations.get('sliderRange','fix'), bgc=_buttonBGC) 
        cgmUI.add_Button(_row,'Sel',
                 cgmGEN.Callback(self.uiFunc_updateTimeRange,'selected'),
                 _d_annotations.get('selectedRange','fix'), bgc=_buttonBGC) 
        cgmUI.add_Button(_row,'Scene',
                 cgmGEN.Callback(self.uiFunc_updateTimeRange,'scene'),
                 _d_annotations.get('sceneRange','fix'), bgc=_buttonBGC) 
        mUI.MelSpacer(_row,w=5)
        _row.layout()


        _row = mUI.MelHSingleStretchLayout(_inside,ut='cgmUISubTemplate', padding=5,bgc=_subLineBGC)
        mUI.MelSpacer(_row,w=5)
        mUI.MelLabel(_row,l='Bake Range')
        _row.setStretchWidget( mUI.MelSeparator(_row) )

        mUI.MelLabel(_row,l='start')

        self.startFrameField = mUI.MelIntField(_row,'cgmLocWinStartFrameField',
                                           width = 40,
                                           value= timelineInfo[0])

        mUI.MelLabel(_row,l='end')

        self.endFrameField = mUI.MelIntField(_row,'cgmLocWinEndFrameField',
                                         width = 40,
                                         value= timelineInfo[1])

        cgmUI.add_Button(_row,' <<',
                         cgmGEN.Callback(self.uiFunc_bake,'back'),                         
                         #lambda *a: attrToolsLib.doAddAttributesToSelected(self),
                         _d_annotations.get('<<<','fix'), bgc=_buttonBGC)
    
        cgmUI.add_Button(_row,'Bake',
                         cgmGEN.Callback(self.uiFunc_bake,'all'),                         
                         _d_annotations.get('All','fix'), bgc=_buttonBGC)
        
        
        cgmUI.add_Button(_row,'>>',
                         cgmGEN.Callback(self.uiFunc_bake,'forward'),                         
                         _d_annotations.get('>>>','fix'), bgc=_buttonBGC)

        mUI.MelSpacer(_row,w=5)
        _row.layout()

        mc.setParent(_inside)
        cgmUI.add_LineSubBreak()

        return _inside