Exemple #1
0
def buildSection_aim(self, parent):
    try:
        self.var_aimFrameCollapse
    except:
        self.create_guiOptionVar('aimFrameCollapse', defaultValue=0)

    _frame = mUI.MelFrameLayout(
        parent,
        label='Aim',
        vis=True,
        collapse=self.var_aimFrameCollapse.value,
        collapsable=True,
        enable=True,
        useTemplate='cgmUIHeaderTemplate',
        expandCommand=lambda: self.var_aimFrameCollapse.setValue(0),
        collapseCommand=lambda: self.var_aimFrameCollapse.setValue(1))
    _inside = mUI.MelColumnLayout(_frame, useTemplate='cgmUISubTemplate')

    #>>>Aim snap -------------------------------------------------------------------------------------
    _row_aim = mUI.MelHLayout(_inside, ut='cgmUISubTemplate', padding=5)

    mc.button(parent=_row_aim,
              l='Aim',
              ut='cgmUITemplate',
              c=lambda *a: SNAPCALLS.snap_action(None, 'aim', 'eachToLast'),
              ann="Aim snap in a from:to selection")

    mc.button(parent=_row_aim,
              ut='cgmUITemplate',
              l='Sel Order',
              c=lambda *a: SNAPCALLS.snap_action(None, 'aim', 'eachToNext'),
              ann="Aim in selection order from each to next")

    mc.button(parent=_row_aim,
              ut='cgmUITemplate',
              l='First to Mid',
              c=lambda *a: SNAPCALLS.snap_action(None, 'aim', 'firstToRest'),
              ann="Aim the first object to the midpoint of the rest")

    mc.button(parent=_row_aim,
              l='AimCast',
              ut='cgmUITemplate',
              c=lambda *a: SNAPCALLS.aimSnap_start(None),
              ann="AimCast snap selected objects")

    _row_aim.layout()

    buildRow_aimMode(self, _inside)
    buildSection_objDefaults(self, _inside, frame=False)
Exemple #2
0
def buildSection_snap(self,parent):
    try:self.var_snapFrameCollapse
    except:self.create_guiOptionVar('snapFrameCollapse',defaultValue = 0) 

    _frame = mUI.MelFrameLayout(parent,label = 'Snap',vis=True,
                                collapse=self.var_snapFrameCollapse.value,
                                collapsable=True,
                                enable=True,
                                useTemplate = 'cgmUIHeaderTemplate',
                                expandCommand = lambda:self.var_snapFrameCollapse.setValue(0),
                                collapseCommand = lambda:self.var_snapFrameCollapse.setValue(1)
                                )	
    _inside = mUI.MelColumnLayout(_frame,useTemplate = 'cgmUISubTemplate') 


    #>>>Base snap -------------------------------------------------------------------------------------
    _row_base = mUI.MelHLayout(_inside,ut='cgmUISubTemplate',padding = 5)

    mc.button(parent=_row_base,
              l = 'Point',
              ut = 'cgmUITemplate',
              c = lambda *a:SNAPCALLS.snap_action(None,'point'),
              ann = "Point snap in a from:to selection")

    mc.button(parent=_row_base,
              l = 'Point - closest',
              ut = 'cgmUITemplate',                    
              c = lambda *a:SNAPCALLS.snap_action(None,'closestPoint'),
              ann = "Closest point on target")    

    mc.button(parent=_row_base,
              l = 'Parent',
              ut = 'cgmUITemplate',                    
              c = lambda *a:SNAPCALLS.snap_action(None,'parent'),
              ann = "Parent snap in a from:to selection")
    mc.button(parent=_row_base,
              l = 'Orient',
              ut = 'cgmUITemplate',                  
              c = lambda *a:SNAPCALLS.snap_action(None,'orient'),
              ann = "Orient snap in a from:to selection")        
    mc.button(parent=_row_base,
              l = 'RayCast',
              ut = 'cgmUITemplate',                                                        
              c = lambda *a:SNAPCALLS.raySnap_start(None),
              ann = "RayCast snap selected objects")
    _row_base.layout() 

    
    """
    #>>>Ray snap -------------------------------------------------------------------------------------
    _row_ray = mUI.MelHSingleStretchLayout(_inside,ut='cgmUISubTemplate',padding = 5)
    mUI.MelSpacer(_row_ray,w=5)                                              
    mUI.MelLabel(_row_ray,l='CastSnap:')
    _row_ray.setStretchWidget(mUI.MelSeparator(_row_ray)) 

    mc.button(parent=_row_ray,
              l = 'RayCast',
              ut = 'cgmUITemplate',                                                        
              c = lambda *a:SNAPCALLS.raySnap_start(None),
              ann = "RayCast snap selected objects")
    mc.button(parent=_row_ray,
              l = 'AimCast',
              ut = 'cgmUITemplate',                                                        
              c = lambda *a:SNAPCALLS.aimSnap_start(None),
              ann = "AimCast snap selected objects")   
    mUI.MelSpacer(_row_ray,w=5)                                              
    _row_ray.layout()    """         

    #>>>Match snap -------------------------------------------------------------------------------------
    buildRow_matchMode(self,_inside)     

    _row_match = mUI.MelHSingleStretchLayout(_inside,ut='cgmUISubTemplate',padding = 5)
    mUI.MelSpacer(_row_match,w=5)                                              
    mUI.MelLabel(_row_match,l='MatchSnap:')
    _row_match.setStretchWidget(mUI.MelSeparator(_row_match)) 

    mc.button(parent=_row_match,
              l = 'Self',
              ut = 'cgmUITemplate',                                                                    
              c = cgmGEN.Callback(MMCONTEXT.func_process, LOCINATOR.update_obj, None,'each','Match',False,**{'mode':'self'}),#'targetPivot':self.var_matchModePivot.value                                                                      
              ann = "Update selected objects to match object. If the object has no match object, a loc is created")
    mc.button(parent=_row_match,
              ut = 'cgmUITemplate',                                                                            
              l = 'Target',
              c = cgmGEN.Callback(MMCONTEXT.func_process, LOCINATOR.update_obj, None,'each','Match',False,**{'mode':'target'}),#'targetPivot':self.var_matchModePivot.value                                                                      
              ann = "Update the match object, not the object itself")
    mc.button(parent=_row_match,
              ut = 'cgmUITemplate',                                                                            
              l = 'Buffer',
              #c = cgmGEN.Callback(buttonAction,raySnap_start(_sel)),                    
              c = cgmGEN.Callback(LOCINATOR.update_obj,**{'mode':'buffer'}),#'targetPivot':self.var_matchModePivot.value                                                                      
              ann = "Update the buffer (if exists)")    
    mUI.MelSpacer(_row_match,w=5)                                              
    _row_match.layout()         

    #>>>Linear snap -------------------------------------------------------------------------------------
    _row_arrange = mUI.MelHSingleStretchLayout(_inside,ut='cgmUISubTemplate',padding = 5)
    mUI.MelSpacer(_row_arrange,w=5)                                              
    mUI.MelLabel(_row_arrange,l='Linear:')
    _row_arrange.setStretchWidget(mUI.MelSeparator(_row_arrange)) 

    mc.button(parent=_row_arrange,
              l = 'Even',
              ut = 'cgmUITemplate',
              c = cgmGEN.Callback(MMCONTEXT.func_process, ARRANGE.alongLine, None,'all', 'AlongLine', **{}),                                               
              ann = ARRANGE._d_arrangeLine_ann.get('linearEven'))
    mc.button(parent=_row_arrange,
              l = 'Spaced',
              ut = 'cgmUITemplate',
              c = cgmGEN.Callback(MMCONTEXT.func_process, ARRANGE.alongLine, None,'all', 'AlongLine', **{'mode':'spaced'}),                                               
              ann = ARRANGE._d_arrangeLine_ann.get('linearSpaced'))
    
    mUI.MelSpacer(_row_arrange,w=5)                                              
    _row_arrange.layout()
    

    #>>>Cubic snap -------------------------------------------------------------------------------------
    _row_arrange = mUI.MelHSingleStretchLayout(_inside,ut='cgmUISubTemplate',padding = 5)
    mUI.MelSpacer(_row_arrange,w=5)                                              
    mUI.MelLabel(_row_arrange,l='Cubic:')
    _row_arrange.setStretchWidget(mUI.MelSeparator(_row_arrange)) 

    mc.button(parent=_row_arrange,
              l = 'Curve[Even]',
              ut = 'cgmUITemplate',
              c = cgmGEN.Callback(MMCONTEXT.func_process, ARRANGE.alongLine, None,'all', 'AlongLine', **{'mode':'even','curve':'cubic'}),                                               
              ann = ARRANGE._d_arrangeLine_ann.get('cubicEven'))
    mc.button(parent=_row_arrange,
              l = 'Arc[Even]',
              ut = 'cgmUITemplate',
              c = cgmGEN.Callback(MMCONTEXT.func_process, ARRANGE.alongLine, None,'all', 'AlongLine', **{'mode':'even','curve':'cubicArc'}),                                               
              ann = ARRANGE._d_arrangeLine_ann.get('cubicArcEven'))
    mc.button(parent=_row_arrange,
              l = 'Arc[Spaced]',
              ut = 'cgmUITemplate',
              c = cgmGEN.Callback(MMCONTEXT.func_process, ARRANGE.alongLine, None,'all', 'AlongLine', **{'mode':'spaced','curve':'cubicArc'}),                                               
              ann = ARRANGE._d_arrangeLine_ann.get('cubicArcSpaced'))
    mUI.MelSpacer(_row_arrange,w=5)
    _row_arrange.layout()


    #>>>Arrange snap -------------------------------------------------------------------------------------
    _row_arrange = mUI.MelHSingleStretchLayout(_inside,ut='cgmUISubTemplate',padding = 5)
    mUI.MelSpacer(_row_arrange,w=5)                                              
    mUI.MelLabel(_row_arrange,l='Curve Rebuild:')
    _row_arrange.setStretchWidget(mUI.MelSeparator(_row_arrange)) 

    mc.button(parent=_row_arrange,
              l = '2[Even]',
              ut = 'cgmUITemplate',
              c = cgmGEN.Callback(MMCONTEXT.func_process, ARRANGE.alongLine, None,'all', 'AlongLine', **{'mode':'even','curve':'cubicRebuild','spans':2}),
              ann = ARRANGE._d_arrangeLine_ann.get('cubicRebuild2Even'))
    mc.button(parent=_row_arrange,
              l = '2[Spaced]',
              ut = 'cgmUITemplate',
              c = cgmGEN.Callback(MMCONTEXT.func_process, ARRANGE.alongLine, None,'all', 'AlongLine', **{'mode':'spaced','curve':'cubicRebuild','spans':2}),
              ann = ARRANGE._d_arrangeLine_ann.get('cubicRebuild2Spaced'))
    mc.button(parent=_row_arrange,
              l = '3[Even]',
              ut = 'cgmUITemplate',
              c = cgmGEN.Callback(MMCONTEXT.func_process, ARRANGE.alongLine, None,'all', 'AlongLine', **{'mode':'even','curve':'cubicRebuild','spans':2}),
              ann = ARRANGE._d_arrangeLine_ann.get('cubicRebuild3Even'))
    mc.button(parent=_row_arrange,
              l = '3[Spaced]',
              ut = 'cgmUITemplate',
              c = cgmGEN.Callback(MMCONTEXT.func_process, ARRANGE.alongLine, None,'all', 'AlongLine', **{'mode':'spaced','curve':'cubicRebuild','spans':3}),
              ann = ARRANGE._d_arrangeLine_ann.get('cubicRebuild3Spaced'))    

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