示例#1
0
 def refreshViewports(self):
     
     G.deferredManager.removeFromQueue("MT_refreshViewports")
     
     for loopViewport in utilMod.getAllViewports():    
 
         view        = OpenMayaUI.M3dView()
         OpenMayaUI.M3dView.getM3dViewFromModelPanel(loopViewport, view)            
         
         view.refresh(True, True) 
示例#2
0
 def addMessages(self):
     
     G.callbackManager.removeFromQueue("MT_anim")        
     G.callbackManager.removeFromQueue("MT_view")
     
     viewports   = utilMod.getAllViewports()
     
     G.callbackManager.sendToQueue(OpenMayaAnim.MAnimMessage.addAnimCurveEditedCallback(self.callbackCurveEdited), "OpenMayaAnim.MAnimMessage", "MT_anim")
     
     for loopViewport in viewports:
         G.callbackManager.sendToQueue(OpenMayaUI.MUiMessage.add3dViewPostRenderMsgCallback(loopViewport, self.drawViewports), "OpenMayaUI.MUiMessage", "MT_view")
    
     self.addNodeMessages()
示例#3
0
 def drawViewports(self, *args):
             
     glRenderer      = OpenMayaRender.MHardwareRenderer.theRenderer()
     glFT            = glRenderer.glFunctionTable()      
     currFrame       = int(cmds.currentTime(query=True))
             
     for loopViewport in utilMod.getAllViewports():  
         
         rendererName = cmds.modelEditor(loopViewport, query=True, rendererName=True)
               
         for loopMotionTrail in self.nodeInfo.keys():
             
             
             viewportCamera  = cmds.modelEditor(loopViewport, query=True, camera=True) if self.cameraRelativeMode else None
             camera          = viewportCamera if viewportCamera in self.cameraInfo.keys() and self.cameraRelativeMode else None
             points          = self.getPointsArray(loopMotionTrail, currFrame, camera)
             pointArray      = points["camera"] if camera else points["world"]   
             loopKeysTimes   = [] if not self.keysTimesDict.has_key(loopMotionTrail) else self.keysTimesDict[loopMotionTrail]
             indexMap        = self.getIndexMap(loopMotionTrail, loopKeysTimes, currFrame, pointArray)  
             lineColor       = self.nodeInfo[loopMotionTrail]["lineColor"]      
             view            = OpenMayaUI.M3dView()
             
             
             OpenMayaUI.M3dView.getM3dViewFromModelPanel(loopViewport, view)
             view.beginGL()
             glFT.glPushAttrib(OpenMayaRender.MGL_ALL_ATTRIB_BITS)
             glFT.glPushMatrix()
             glFT.glDepthRange(0,0)                
             glFT.glEnable( OpenMayaRender.MGL_LINE_SMOOTH )
             glFT.glEnable( OpenMayaRender.MGL_POINT_SMOOTH )
             glFT.glEnable( OpenMayaRender.MGL_BLEND )
             glFT.glDisable(OpenMayaRender.MGL_LIGHTING)
             glFT.glBlendFunc( OpenMayaRender.MGL_SRC_ALPHA, OpenMayaRender.MGL_ONE_MINUS_SRC_ALPHA )
             
             #DRAW
             if rendererName == "ogsRenderer":               
                 self.drawLine(glFT, indexMap, pointArray, lineColor)
                 self.drawPoints(glFT, indexMap, pointArray) 
             else:                    
                 self.drawPoints(glFT, indexMap, pointArray)                
                 self.drawLine(glFT, indexMap, pointArray, lineColor)
           
             #WRAP
             glFT.glDisable( OpenMayaRender.MGL_BLEND )
             glFT.glDisable( OpenMayaRender.MGL_LINE_SMOOTH )
             glFT.glDisable( OpenMayaRender.MGL_POINT_SMOOTH )
             glFT.glEnable(OpenMayaRender.MGL_LIGHTING)
             glFT.glPopMatrix()
             glFT.glPopAttrib()
             view.endGL()