Esempio n. 1
0
def match_transform(mode='', child_comp=False):
    from . import sisidebar_sub
    pre_sel = cmds.ls(sl=True, l=True)
    selection = cmds.ls(sl=True, l=True, type='transform')
    if not selection:
        return
    cmds.undoInfo(openChunk=True)
    set_maching(nodes=selection, mode=mode ,pre_sel=pre_sel, child_comp=child_comp)
    
    msg = lang.Lang(en=u"<hl>Select Matching Object</hl>",
                            ja=u"<hl>一致対象オブジェクトを選択してください</hl>")
    cmds.inViewMessage( amg=msg.output(), pos='midCenterTop', fade=True )
    #cmds.select(cl=True)
    maching_tool = cmds.scriptCtx( title='Much Transform',
                        totalSelectionSets=3,
                        cumulativeLists=True,
                        expandSelectionList=True,
                        toolCursorType="edit",
                        setNoSelectionPrompt='Select the object you want to matching transform.'
                        )
    #カスタムカーソルを設定
    image_path = os.path.join(os.path.dirname(__file__), 'icon/')
    my_cursor = QCursor(QPixmap(image_path+'picker.png'))
    QApplication.setOverrideCursor(my_cursor)
    #cmds.hudButton('HUDHelloButton', e=True, s=7, b=5, vis=1, l='Button', bw=80, bsh='roundRectangle', rc=match_cancel )
    global hud_but
    if maya_ver != 2017:
        try:
            hud_but = cmds.hudButton('HUD_match_cancel', s=7, b=5, vis=1, l='Cancel', bw=80, bsh='roundRectangle', rc=finish_matching)
            #print 'create'
        except:
            #print 'change'
            hud_but = cmds.hudButton('HUD_match_cancel',e=True, s=7, b=5, vis=1, l='Cancel', bw=80, bsh='roundRectangle', rc=finish_matching)
    jobNum = cmds.scriptJob(ro=True, e=('SelectionChanged', qt.Callback(trs_matching)), protected=True)
    sisidebar_sub.get_matrix()
    def ChangePersp(self, *args):
        cmds.undoInfo(openChunk = True)    
        
        TurntableClass.SetActiveCamera(self.Camera)

        cmds.hudButton("SnapButton", edit = True , label = "Update Image", rc = self.RefreshImage)
        
        cmds.undoInfo(closeChunk = True)
Esempio n. 3
0
 def HUDInterface(self):
     SelectedTab = cmds.tabLayout( "TabLayout", query = True, st = True)
     
     #Get the persp panel
     perspPanel = cmds.getPanel( withLabel='Persp View')
     #change the view to the camera
     cmds.modelPanel( perspPanel, edit = True, camera = "persp")
     
     #When the Project tab is clicked
     if SelectedTab == "CMProjectLayout":
         cmds.hudButton("SnapButton", edit = True , vis = False)
         self.TurntableHelper(False)
         
     #When Image tab is clicked
     elif SelectedTab == "SnapShotTabLayout":     
         cmds.hudButton("SnapButton", edit = True, rc = self.functions[0] , label = "Snap Image", vis = True)
         self.TurntableHelper(False)
          
     #When the turntable tab is clicked
     elif SelectedTab == "TurntableCounterLayout":
         cmds.hudButton("SnapButton", edit = True , rc = self.functions[1], label = "Create Turntable", vis = True)
         self.TurntableHelper(True)
          
     #When the Renderer tab is clicked
     elif SelectedTab == "BatchRendererCounterLayout":
         cmds.hudButton("SnapButton", edit = True , vis = False)
         self.TurntableHelper(False)
          
         #cmds.text("BatchRendererCounter", edit = True, label = "Image to render = " + str(BatchRendererFile.BatchRendererClass.ChangeCounter()))
    def RefreshImage( self ):
        cmds.undoInfo(openChunk = True)
        cmds.hudButton("SnapButton", edit = True, label = "Create Turntable", rc = TurntableClass.CreateTurntable)
        #If the active cam is not the current cam exit the function
        if self.GetActiveCamera() != self.Camera + "Shape":
            return 0
        
        #remove the old image
        os.remove( self.Snap) 
 
        #Create new Preview
        ScreenCapture.ScreenCapture( self.Snap, [309,160] ) 

        #Create preview image on window
        cmds.image( self.Image, edit = True, image = self.Snap )
        
        TurntableClass.SetActiveCamera("persp")
        cmds.undoInfo(closeChunk = True)
Esempio n. 5
0
    def edit(self, *args):
        # set to pose
        selPoseLoc = cmds.textScrollList(
            'r_poseTexScrList', q=True, selectItem=True)[0] + '_pose_loc'
        attrList = cmds.listAttr(selPoseLoc, userDefined=True)
        poseAttrList = []
        for attr in attrList:
            if 'pose' in attr:
                poseAttrList.append(attr)

        for poseAttr in poseAttrList:
            poseInfo = poseAttr.rsplit('_pose')
            poseInfo.append(cmds.getAttr('%s.%s' % (selPoseLoc, poseAttr)))
            cmds.setAttr('%s.rotate%s' % (poseInfo[0], poseInfo[1]),
                         poseInfo[2])

        # into the sculpt mode
        self.sculptMode()

        # create hud button
        cmds.hudButton('doneEditHudBtn',
                       s=3,
                       b=4,
                       vis=1,
                       l='Done Edit',
                       bw=80,
                       bsh='roundRectangle',
                       rc=self.doneEdit)
        cmds.hudButton('cancelEditHudBtn',
                       s=3,
                       b=6,
                       vis=1,
                       l='Cancel Edit',
                       bw=80,
                       bsh='roundRectangle',
                       rc=self.cancelEdit)
    def RefreshImage( self, *args ):
        print "Refreshing Image"
        cmds.undoInfo(openChunk = True)
        cmds.hudButton("SnapButton", edit = True, label = "Snap Image", rc = SnapShotClass.CreateSnapshot)
        #If the active cam is not the current cam exit the function
        
        if self.GetActiveCamera() != self.Camera + "Shape":
            return 0
        
        #remove the old image
        os.remove( self.Snap) 
 
        #Create new Preview
        ScreenCapture.ScreenCapture( self.Snap, [296,160] ) 

        #Create preview image on window
        cmds.image( self.Image, edit = True, image = self.Snap )
        
        if cmds.getAttr(self.Camera + ".CMSignature"):
            self.SetSqrCamera()
        
        SnapShotClass.SetActiveCamera("persp")
        cmds.undoInfo(closeChunk = True)
        print "Image refreshed"
Esempio n. 7
0
 def __init__(self):    
     self.functions = []
     
     if cmds.headsUpDisplay('SnapButton', exists = True):
         cmds.headsUpDisplay('SnapButton', rem = True)
     cmds.hudButton('SnapButton', s=7, b=5, vis = False, l='Snap Image', bw = 120, bsh ='roundRectangle' )