Example #1
0
 def sendScaling(self):
     """ send scaling msg to cover """
     _infoer.function = str(self.sendScaling)
     _infoer.write("scaling %s" %(self.params.scaling))
     if (self.params.documentName!=None and self.params.imageName!=None and self.covise_key!='No key'):
         msg = coGRSetDocScaleMsg( self.params.documentName, self.params.scaling )
         covise.sendRendMsg(msg.c_str())
Example #2
0
 def sendPageNo(self):
     """ send pageNo msg to cover """
     _infoer.function = str(self.sendPageNo)
     _infoer.write("pageno %d" %(self.params.pageNo))
     if (self.params.documentName!=None and self.params.imageName!=None and self.covise_key!='No key'):
         msg = coGRSetDocPageMsg( self.params.documentName, self.params.pageNo )
         covise.sendRendMsg(msg.c_str())
Example #3
0
 def sendSize(self):
     """ send size msg to cover """
     _infoer.function = str(self.sendSize)
     _infoer.write("size [%f %f]" %(self.params.size[0], self.params.size[1]))
     if (self.params.size!=(-1,-1) and self.params.documentName!=None and self.params.imageName!=None and self.covise_key!='No key'):
         msg = coGRSetDocPageSizeMsg( self.params.documentName, self.params.pageNo, self.params.size[0], self.params.size[1] )
         covise.sendRendMsg(msg.c_str())
Example #4
0
 def sendAppearance(self):
     """ send appearance msg to cover """
     if not self.covise_key=='No key':
         for scopeName, color in iter(self.params.appearance_colors.items()):
             coverColor = [float(c)/255.0 for c in list(color)]
             msg = coGRObjSetAppearanceMsg( self.covise_key, str(scopeName), *coverColor)
             covise.sendRendMsg(msg.c_str())
Example #5
0
 def sendClipPlane(self):
     msg = coGRObjAttachedClipPlaneMsg(coGRMsg.ATTACHED_CLIPPLANE,
                                       self.covise_key,
                                       self.params.attachedClipPlane_index,
                                       self.params.attachedClipPlane_offset,
                                       self.params.attachedClipPlane_flip)
     covise.sendRendMsg(msg.c_str())
Example #6
0
 def sendParamsToCover(self):
    msg = coGRSetTrackingParamsMsg( \
             self.params.rotateMode == 'Point', \
             self.params.showRotatePoint, \
             self.params.rotationPointSize, \
             self.params.rotatePointX, \
             self.params.rotatePointY, \
             self.params.rotatePointZ, \
             self.params.rotateMode == 'Axis', \
             self.params.rotateAxisX, \
             self.params.rotateAxisY, \
             self.params.rotateAxisZ, \
             self.params.translateRestrict, \
             self.params.translateMinX, \
             self.params.translateMaxX, \
             self.params.translateMinY, \
             self.params.translateMaxY, \
             self.params.translateMinZ, \
             self.params.translateMaxZ, \
             self.params.translateFactor, \
             self.params.scaleRestrict, \
             self.params.scaleMin, \
             self.params.scaleMax, \
             self.params.scaleFactor, \
             self.params.trackingOn, \
             self.params.navigationMode)
    covise.sendRendMsg(msg.c_str())
Example #7
0
    def change(self):

        # for change viewpoint send msg to COVER with ViewpointID
        # get COVER id of viewpoint for message
        id = -1
        for key, param in self.params.status.items():
            # viewpoints have parameter 'view', the viewpoint connected to this step is visible
            if hasattr(param, 'view') and hasattr(param, 'isVisible') and param.isVisible == True:
                id = param.id
        # send ChangeViewpointMsg
        if id != -1:
            msg = coGRChangeViewpointMsg( id )
            covise.sendRendMsg(msg.c_str())

        # find the number of all keys
        numkeys = len(globalKeyHandler().getAllElements())
        if numkeys <1: # if that goes wrong, use only the keys in this step
            numkeys = self.key

        # walk through all keys, even if they are not allready in the step
        for key in range(numkeys):
            obj = globalKeyHandler().getObject(key)
            if obj:
                if not hasattr(obj.params, 'view') and objIsRelevant(obj):
                    self.params.status[key] = CopyParams(obj.params)
Example #8
0
 def startPreview(self):
     if self.mode == 0:
         msg = coGRTurnTableAnimationMsg(10.0)
         covise.sendRendMsg(msg.c_str())
     if self.mode == 1:
         msg = coGRTurnTableAnimationMsg(20.0)
         covise.sendRendMsg(msg.c_str())
Example #9
0
 def __sendColor(self):
     """ send interactor geometry to cover """
     if self.keyRegistered():
         _infoer.function = str(self.__sendColor)
         _infoer.write("send")
         msg = coGRObjColorObjMsg( coGRMsg.COLOR_OBJECT, self.covise_key, self.params.r, self.params.g, self.params.b)
         covise.sendRendMsg(msg.c_str())
Example #10
0
 def __sendColor(self):
     """ send interactor geometry to cover """
     if self.keyRegistered():
         _infoer.function = str(self.__sendColor)
         _infoer.write("send")
         msg = coGRObjColorObjMsg( coGRMsg.COLOR_OBJECT, self.covise_key, self.params.r, self.params.g, self.params.b)
         covise.sendRendMsg(msg.c_str())
Example #11
0
    def setParams(self, params, negMsgHandler=None, sendToCover=True):
        """ set parameters from outside """
        _infoer.function = str(self.setParams)
        _infoer.write("setParams")

        if not params.isVisible == self.params.isVisible:
            if params.isVisible and not self.__connected:
                connect(self.connectionPoint(), globalRenderer().connectionPoint())
                self.__connected = True
            elif not params.isVisible and self.__connected:
                disconnect(self.connectionPoint(), globalRenderer().connectionPoint())
                self.__connected = False

        realChange = ParamsDiff(self.params, params)
        VisItem.setParams(self, params, negMsgHandler, sendToCover)

        if params.clickedSensorID != None:
            msg = coGRObjSensorEventMsg(coGRMsg.SENSOR_EVENT, params.filename, params.clickedSensorID, True, True)
            covise.sendRendMsg(msg.c_str())
            msg = coGRObjSensorEventMsg(coGRMsg.SENSOR_EVENT, params.filename, params.clickedSensorID, True, False)
            covise.sendRendMsg(msg.c_str())

            # clickedSensorButtonEvent was handled and can be removed
            self.params.clickedSensorID = None
            self.sendParams()
Example #12
0
    def change(self):

        # for change viewpoint send msg to COVER with ViewpointID
        # get COVER id of viewpoint for message
        id = -1
        for key, param in self.params.status.items():
            # viewpoints have parameter 'view', the viewpoint connected to this step is visible
            if hasattr(param, 'view') and hasattr(
                    param, 'isVisible') and param.isVisible == True:
                id = param.id
        # send ChangeViewpointMsg
        if id != -1:
            msg = coGRChangeViewpointMsg(id)
            covise.sendRendMsg(msg.c_str())

        # find the number of all keys
        numkeys = len(globalKeyHandler().getAllElements())
        if numkeys < 1:  # if that goes wrong, use only the keys in this step
            numkeys = self.key

        # walk through all keys, even if they are not allready in the step
        for key in range(numkeys):
            obj = globalKeyHandler().getObject(key)
            if obj:
                if not hasattr(obj.params, 'view') and objIsRelevant(obj):
                    self.params.status[key] = CopyParams(obj.params)
Example #13
0
    def change(self):
        _infoer.function = str(self.change)
        _infoer.write("")
        # add asker
        msgBox = QtWidgets.QMessageBox(Application.vrpApp.mw)
        msgBox.setWindowTitle(self.__tr("Save changed viewpoint"))
        msgBox.setText(
            self.__tr("Do you want to save this view for the viewpoint?"))
        msgBox.setStandardButtons(QtWidgets.QMessageBox.Save
                                  | QtWidgets.QMessageBox.Cancel)
        msgBox.setDefaultButton(QtWidgets.QMessageBox.Save)
        acceptedOrRejected = msgBox.exec_()
        if acceptedOrRejected == QtWidgets.QMessageBox.Save:
            # take eighter current key or if selection in list is disabled use the latest
            key = -1
            if self._currentKey != -1:
                key = self._currentKey
            elif self.lastKey != -1:
                key = self.lastKey

            if key > -1:
                # get COVER id
                id = ObjectMgr().getParamsOfObject(key).id
                msg = coGRChangeViewpointMsg(id)
                covise.sendRendMsg(msg.c_str())
Example #14
0
    def setParams(self, params, negMsgHandler=None, sendToCover=True):
        """ set parameters from outside """
        _infoer.function = str(self.setParams)
        _infoer.write("setParams")

        if not params.isVisible == self.params.isVisible:
            if params.isVisible and not self.__connected:
                connect(self.connectionPoint(),
                        globalRenderer().connectionPoint())
                self.__connected = True
            elif not params.isVisible and self.__connected:
                disconnect(self.connectionPoint(),
                           globalRenderer().connectionPoint())
                self.__connected = False

        realChange = ParamsDiff(self.params, params)
        VisItem.setParams(self, params, negMsgHandler, sendToCover)

        if params.clickedSensorID != None:
            msg = coGRObjSensorEventMsg(coGRMsg.SENSOR_EVENT, params.filename,
                                        params.clickedSensorID, True, True)
            covise.sendRendMsg(msg.c_str())
            msg = coGRObjSensorEventMsg(coGRMsg.SENSOR_EVENT, params.filename,
                                        params.clickedSensorID, True, False)
            covise.sendRendMsg(msg.c_str())

            # clickedSensorButtonEvent was handled and can be removed
            self.params.clickedSensorID = None
            self.sendParams()
Example #15
0
    def run(self, runmode, negMsgHandler=None):
        if runmode == RUN_ALL:
            _infoer.function = str(self.run)
            _infoer.write("go")
            self.__update()
            if not self.__connected and self.params.isVisible:
                VisItem.connectToCover(self, self)
                self.__connected = True
            if not self.__loaded:
                saveExecute(self.performerScene)
                self.__loaded = True

        # dont auto-activate sensors in recreation
        if negMsgHandler and negMsgHandler.getInRecreation() == False:
            # bei run() die sensoren starten
            # wird (ausserhalb von recreate) nur vom presentation manager aufgerufen
            for sensorID in self.params.autoActiveSensorIDs:
                msg = coGRObjSensorEventMsg(coGRMsg.SENSOR_EVENT,
                                            self.params.filename, sensorID,
                                            True, True)
                covise.sendRendMsg(msg.c_str())
                msg = coGRObjSensorEventMsg(coGRMsg.SENSOR_EVENT,
                                            self.params.filename, sensorID,
                                            True, False)
                covise.sendRendMsg(msg.c_str())
Example #16
0
 def startPreview(self):
     if self.mode == 0:
         msg = coGRTurnTableAnimationMsg(10.0)
         covise.sendRendMsg(msg.c_str())
     if self.mode == 1:
         msg = coGRTurnTableAnimationMsg(20.0)
         covise.sendRendMsg(msg.c_str())
Example #17
0
 def takeSnapshot(self):
     _infoer.function = str(self.takeSnapshot)
     _infoer.write("")
     filename = ""
     if covise.coConfigIsOn("vr-prepare.ShowSnapshotDialog", True):
         directory = covise.getCoConfigEntry("COVER.Plugin.PBufferSnapShot.Directory")
         if (directory == None):
             directory = "snapshot.png"
         else:
             directory = directory + "/" + "snapshot.png"  
         filenameQt = QtWidgets.QFileDialog.getSaveFileName(
             self,
             self.__tr('Snapshot'),
             directory,
             self.__tr('Image (*.png)'),
             None,
             QtWidgets.QFileDialog.DontConfirmOverwrite)
         if filenameQt == "":
             return
         #filenameQt is filename + extension touple
         filename = filenameQt[0]
         print(filename)
         if not filename.lower().endswith(".png"):
             filename += ".png"
         if  os.path.exists(filename):
             asker = ReallyWantToOverrideAsker(self, filename)
             decicion = asker.exec_()
             if decicion == QtWidgets.QDialog.Rejected:
                 self.statusBar().showMessage( self.__tr('Cancelled overwrite of "%s"') % filename )
                 return
     msg = coGRSnapshotMsg( filename, "snapOnce" )
     covise.sendRendMsg(msg.c_str())
Example #18
0
 def sendShader(self):
     if (len(self.objects) > 0):
         return  # we only send shader messages to leafs (geodes or EOT-nodes)
     msg = coGRObjShaderObjMsg(coGRMsg.SHADER_OBJECT, self.covise_key,
                               self.params.shaderFilename, "", "", "", "",
                               "", "", "", "", "")
     covise.sendRendMsg(msg.c_str())
Example #19
0
 def sendPosition(self):
     """ send position msg to cover """
     _infoer.function = str(self.sendPosition)
     _infoer.write("position [%f %f %f]" %(self.params.pos[0], self.params.pos[1], self.params.pos[2]))
     if (self.params.documentName!=None and self.params.imageName!=None and self.covise_key!='No key'):
         msg = coGRSetDocPositionMsg( self.params.documentName, self.params.pos[0], self.params.pos[1], self.params.pos[2] )
         covise.sendRendMsg(msg.c_str())
Example #20
0
 def emitAnimationSpeed(self):
     params = ObjectMgr().getParamsOfObject(0)
     params.animationSpeed = self.widget().sliderSpeed.getValue()
     self.animSpeed = params.animationSpeed
     ObjectMgr().setParams(0, params)
     msg = coGRSetAnimationSpeedMsg( params.animationSpeed, params.animationSpeedMin, params.animationSpeedMax )
     covise.sendRendMsg(msg.c_str())
Example #21
0
 def sendCaseName(self):
     """ send visibility msg to cover """
     if not self.covise_key=='No key':
         caseName = self.__getCaseName()
         if caseName:
             msg = coGRObjSetCaseMsg( coGRMsg.SET_CASE, self.covise_key, caseName)
             covise.sendRendMsg(msg.c_str())
Example #22
0
 def takeSnapshot(self):
     _infoer.function = str(self.takeSnapshot)
     _infoer.write("")
     filename = ""
     if covise.coConfigIsOn("vr-prepare.ShowSnapshotDialog", True):
         directory = covise.getCoConfigEntry(
             "COVER.Plugin.PBufferSnapShot.Directory")
         if (directory == None):
             directory = "snapshot.png"
         else:
             directory = directory + "/" + "snapshot.png"
         filenameQt = QtWidgets.QFileDialog.getSaveFileName(
             self, self.__tr('Snapshot'), directory,
             self.__tr('Image (*.png)'), None,
             QtWidgets.QFileDialog.DontConfirmOverwrite)
         if filenameQt == "":
             return
         #filenameQt is filename + extension touple
         filename = filenameQt[0]
         print(filename)
         if not filename.lower().endswith(".png"):
             filename += ".png"
         if os.path.exists(filename):
             asker = ReallyWantToOverrideAsker(self, filename)
             decicion = asker.exec_()
             if decicion == QtWidgets.QDialog.Rejected:
                 self.statusBar().showMessage(
                     self.__tr('Cancelled overwrite of "%s"') % filename)
                 return
     msg = coGRSnapshotMsg(filename, "snapOnce")
     covise.sendRendMsg(msg.c_str())
Example #23
0
 def sendParent(self):
     """ send parent to plugin (if parent couldn't send child because of a missing covise key)"""
     if not self.covise_key=='No key':
         if self.parentCoviseKeyToSend != 'No key':
             msg = coGRObjAddChildMsg( self.parentCoviseKeyToSend, self.covise_key, 0)
             covise.sendRendMsg(msg.c_str()) 
             self.parentCoviseKeyToSend = 'No key'  
Example #24
0
 def __sendTransparency(self):
     if self.keyRegistered():
         if self.params.transparencyOn:
             transparency = self.params.transparency
         else:
             transparency = 1.0
         msg = coGRObjSetTransparencyMsg(coGRMsg.SET_TRANSPARENCY, self.covise_key, transparency)
         covise.sendRendMsg(msg.c_str())
Example #25
0
 def emitLastAnimationStep(self):
     params = ObjectMgr().getParamsOfObject(0)
     if params == None:
         return 
     params.actTimeStep = params.numTimeSteps -1 
     ObjectMgr().setParams(0, params)
     msg = coGRSetTimestepMsg( params.actTimeStep, params.numTimeSteps)
     covise.sendRendMsg(msg.c_str())
Example #26
0
 def emitLastAnimationStep(self):
     params = ObjectMgr().getParamsOfObject(0)
     if params == None:
         return
     params.actTimeStep = params.numTimeSteps - 1
     ObjectMgr().setParams(0, params)
     msg = coGRSetTimestepMsg(params.actTimeStep, params.numTimeSteps)
     covise.sendRendMsg(msg.c_str())
Example #27
0
 def emitTimeStep(self):
     params = ObjectMgr().getParamsOfObject(0)
     if params == None:
         return 
     params.actTimeStep = int (self.widget().timestepSlider.getValue())
     ObjectMgr().setParams(0, params)
     msg = coGRSetTimestepMsg( params.actTimeStep, params.numTimeSteps)
     covise.sendRendMsg(msg.c_str())
Example #28
0
 def sendVariants(self):
     """ send variant msg to cover """
     if not self.covise_key == 'No key':
         for groupName, variantName in iter(
                 self.params.variant_selected.items()):
             msg = coGRObjSetVariantMsg(self.covise_key, str(groupName),
                                        str(variantName))
             covise.sendRendMsg(msg.c_str())
Example #29
0
    def __init__(self):
        VisItem.__init__(self, TYPE_VIEWPOINT_MGR, 'ViewpointMgr')
        self.params = coViewpointMgrParams()
        self.name = self.params.name

        # tell cover to send the default viewpoints
        msg = coGRKeyWordMsg("sendDefaultViewPoint", True)
        covise.sendRendMsg(msg.c_str())
Example #30
0
 def emitTimeStep(self):
     params = ObjectMgr().getParamsOfObject(0)
     if params == None:
         return
     params.actTimeStep = int(self.widget().timestepSlider.getValue())
     ObjectMgr().setParams(0, params)
     msg = coGRSetTimestepMsg(params.actTimeStep, params.numTimeSteps)
     covise.sendRendMsg(msg.c_str())
Example #31
0
 def __init__(self):
     VisItem.__init__(self, TYPE_VIEWPOINT_MGR, 'ViewpointMgr')
     self.params = coViewpointMgrParams()
     self.name = self.params.name
     
     # tell cover to send the default viewpoints
     msg = coGRKeyWordMsg( "sendDefaultViewPoint" , True)
     covise.sendRendMsg(msg.c_str())
Example #32
0
 def sendParent(self):
     """ send parent to plugin (if parent couldn't send child because of a missing covise key)"""
     if not self.covise_key == 'No key':
         if self.parentCoviseKeyToSend != 'No key':
             msg = coGRObjAddChildMsg(self.parentCoviseKeyToSend,
                                      self.covise_key, 0)
             covise.sendRendMsg(msg.c_str())
             self.parentCoviseKeyToSend = 'No key'
Example #33
0
 def sendCaseName(self):
     """ send visibility msg to cover """
     if not self.covise_key == 'No key':
         caseName = self.__getCaseName()
         if caseName:
             msg = coGRObjSetCaseMsg(coGRMsg.SET_CASE, self.covise_key,
                                     caseName)
             covise.sendRendMsg(msg.c_str())
Example #34
0
 def sendAppearance(self):
     """ send appearance msg to cover """
     if not self.covise_key == 'No key':
         for scopeName, color in iter(
                 self.params.appearance_colors.items()):
             coverColor = [float(c) / 255.0 for c in list(color)]
             msg = coGRObjSetAppearanceMsg(self.covise_key, str(scopeName),
                                           *coverColor)
             covise.sendRendMsg(msg.c_str())
Example #35
0
 def emitAnimationSpeed(self):
     params = ObjectMgr().getParamsOfObject(0)
     params.animationSpeed = self.widget().sliderSpeed.getValue()
     self.animSpeed = params.animationSpeed
     ObjectMgr().setParams(0, params)
     msg = coGRSetAnimationSpeedMsg(params.animationSpeed,
                                    params.animationSpeedMin,
                                    params.animationSpeedMax)
     covise.sendRendMsg(msg.c_str())
Example #36
0
 def sendScaling(self):
     """ send scaling msg to cover """
     _infoer.function = str(self.sendScaling)
     _infoer.write("scaling %s" % (self.params.scaling))
     if (self.params.documentName != None and self.params.imageName != None
             and self.covise_key != 'No key'):
         msg = coGRSetDocScaleMsg(self.params.documentName,
                                  self.params.scaling)
         covise.sendRendMsg(msg.c_str())
Example #37
0
 def sendPageNo(self):
     """ send pageNo msg to cover """
     _infoer.function = str(self.sendPageNo)
     _infoer.write("pageno %d" % (self.params.pageNo))
     if (self.params.documentName != None and self.params.imageName != None
             and self.covise_key != 'No key'):
         msg = coGRSetDocPageMsg(self.params.documentName,
                                 self.params.pageNo)
         covise.sendRendMsg(msg.c_str())
Example #38
0
    def sendInteractorPosibility(self):
        """ send usability of interactor msg to cover """
        _infoer.function = str(self.sendInteractorPosibility)
        _infoer.write("")

        if self.keyRegistered():
            _infoer.function = str(self.sendInteractorPosibility)
            _infoer.write("send")
            msg = coGRObjVisMsg( coGRMsg.INTERACTOR_USED, self.covise_key, self.params.use2DPartKey==None )
            covise.sendRendMsg(msg.c_str())
Example #39
0
    def sendSmokeStatus(self):
        """ send status of smoke to cover """
        _infoer.function = str(self.sendSmokeStatus)
        _infoer.write("")

        if self.keyRegistered():
            _infoer.function = str(self.sendSmokeStatus)
            _infoer.write("send")
            msg = coGRObjVisMsg( coGRMsg.SMOKE_VISIBLE, self.covise_key, self.params.showSmoke )
            covise.sendRendMsg(msg.c_str())
Example #40
0
    def sendInteractorStatus(self):
        """ send visibility of interactor msg to cover """
        _infoer.function = str(self.sendInteractorStatus)
        _infoer.write("")

        if self.keyRegistered():
            _infoer.function = str(self.sendInteractorStatus)
            _infoer.write("send")
            msg = coGRObjVisMsg( coGRMsg.INTERACTOR_VISIBLE, self.covise_key, self.params.showInteractor )
            covise.sendRendMsg(msg.c_str())
Example #41
0
    def _sendMatrix(self):
        return
        if self.covise_key == 'No key':
            return
        if not hasattr(self.params, 'rotX'):
            return
        if self.params.rotX==0.0 and self.params.rotY==0.0 and self.params.rotZ==0.0 and \
            self.params.transX==0.0 and self.params.transY==0.0 and self.params.transZ==0.0 and \
            self.params.scaleX==0.0 and self.params.scaleY==0.0 and self.params.scaleZ==0.0:
            return

        matrix = transformationMatrix(self.params)

        # transform the bbox and send to children
        bbox = self.importModule.getBox()
        bboxVec1 = [bbox.getXMin(), bbox.getYMin(), bbox.getZMin()]
        bboxVec2 = [bbox.getXMax(), bbox.getYMax(), bbox.getZMax()]
        if not (self.params.rotX == 0.0 and self.params.rotY == 0.0
                and self.params.rotZ == 0.0):
            mat = numpy.array(matrix[0:3, 0:3])
            bboxVec1 = multMatVec(mat, bboxVec1)
            bboxVec2 = multMatVec(mat, bboxVec2)
        #sort vecs min/max
        if bboxVec1[0] > bboxVec2[0]:
            tmp = bboxVec1[0]
            bboxVec1[0] = bboxVec2[0]
            bboxVec2[0] = tmp
        if bboxVec1[1] > bboxVec2[1]:
            tmp = bboxVec1[1]
            bboxVec1[1] = bboxVec2[1]
            bboxVec2[1] = tmp
        if bboxVec1[2] > bboxVec2[2]:
            tmp = bboxVec1[2]
            bboxVec1[2] = bboxVec2[2]
            bboxVec2[2] = tmp

        if not (self.params.transX == 0.0 and self.params.transY == 0.0
                and self.params.transZ == 0.0):
            bboxVec1[0] = bboxVec1[0] + self.params.transX
            bboxVec2[0] = bboxVec2[0] + self.params.transX
            bboxVec1[1] = bboxVec1[1] + self.params.transY
            bboxVec2[1] = bboxVec2[1] + self.params.transY
            bboxVec1[2] = bboxVec1[2] + self.params.transZ
            bboxVec2[2] = bboxVec2[2] + self.params.transZ

        bbox.setXMinMax([bboxVec1[0], bboxVec2[0]])
        bbox.setYMinMax([bboxVec1[1], bboxVec2[1]])
        bbox.setZMinMax([bboxVec1[2], bboxVec2[2]])

        Neg2Gui.theNegMsgHandler().sendBBox(self.key, bbox)

        # send transformation to COVER
        msg = coGRObjTransformMsg(self.covise_key,
                                  *numpy.reshape(matrix, (16, )))
        covise.sendRendMsg(msg.c_str())
Example #42
0
    def sendMaterial(self):
        if not self.params.transparencyOn:
            transparency = 1.0
        else:
            transparency = self.params.transparency

        msg = coGRObjMaterialObjMsg( coGRMsg.MATERIAL_OBJECT, self.covise_key, \
                self.params.ambient[0],self.params.ambient[1],self.params.ambient[2], \
                self.params.r, self.params.g, self.params.b, \
                self.params.specular[0],self.params.specular[1],self.params.specular[2], self.params.shininess, transparency)
        covise.sendRendMsg(msg.c_str())
Example #43
0
    def delete(self, isInitialized, negMsgHandler=None):
        if hasattr(self.params, 'confirmed') and self.params.confirmed == False:
            self.params.delete = True
            return
        if isInitialized:
            if self.params.view != 'default':
                msg = coGRDeleteViewpointMsg( self.params.id )
                covise.sendRendMsg(msg.c_str())

#        VisItem.delete(self, isInitialized, negMsgHandler)
        return coKeydObject.delete(self, isInitialized, negMsgHandler)
Example #44
0
 def reconnect(self):
     """ recreate is called after all classes of the session have been unpickled """
     #do not recreate default viewpoints
     if self.params.view == 'default' or self.params.id == None:
         return
     self.params.confirmed = False
     self.params.changed = False
     # the id is not used by cover
     # could be out of sync
     msg = coGRCreateViewpointMsg( self.params.name, self.params.id, self.params.view, self.params.clipplane  )
     covise.sendRendMsg(msg.c_str())
Example #45
0
    def sendMaterial(self):
        if not self.params.transparencyOn:
            transparency = 1.0
        else:
            transparency = self.params.transparency

        msg = coGRObjMaterialObjMsg( coGRMsg.MATERIAL_OBJECT, self.covise_key, \
                self.params.ambient[0],self.params.ambient[1],self.params.ambient[2], \
                self.params.r, self.params.g, self.params.b, \
                self.params.specular[0],self.params.specular[1],self.params.specular[2], self.params.shininess, transparency)
        covise.sendRendMsg(msg.c_str())
Example #46
0
 def sendObjMoved(self):
     """ send delete msg to cover """
     if not self.covise_key == 'No key':
         msg = coGRObjMovedMsg(self.covise_key, float(self.params.transX),
                               float(self.params.transY),
                               float(self.params.transZ),
                               float(self.params.rotX),
                               float(self.params.rotY),
                               float(self.params.rotZ),
                               float(self.params.rotAngle))
         covise.sendRendMsg(msg.c_str())
Example #47
0
    def sendSmokeStatus(self):
        """ send status of smoke to cover """
        _infoer.function = str(self.sendSmokeStatus)
        _infoer.write("")

        if self.keyRegistered():
            _infoer.function = str(self.sendSmokeStatus)
            _infoer.write("send")
            msg = coGRObjVisMsg(coGRMsg.SMOKE_VISIBLE, self.covise_key,
                                self.params.showSmoke)
            covise.sendRendMsg(msg.c_str())
Example #48
0
    def sendInteractorPosibility(self):
        """ send usability of interactor msg to cover """
        _infoer.function = str(self.sendInteractorPosibility)
        _infoer.write("")

        if self.keyRegistered():
            _infoer.function = str(self.sendInteractorPosibility)
            _infoer.write("send")
            msg = coGRObjVisMsg(coGRMsg.INTERACTOR_USED, self.covise_key,
                                self.params.use2DPartKey == None)
            covise.sendRendMsg(msg.c_str())
Example #49
0
 def sendVisibility(self):
     """ send visible msg to cover """
     _infoer.function = str(self.sendVisibility)
     _infoer.write("visible %d %s" %(self.params.isVisible, str(self.params.documentName)))
     if (self.params.documentName!=None and self.params.imageName!=None and self.covise_key!='No key'):
         if self.params.isVisible:
             visible = 1
         else:
             visible = 0
         msg = coGRDocVisibleMsg( self.params.documentName, visible )
         covise.sendRendMsg(msg.c_str())
Example #50
0
    def sendInteractorStatus(self):
        """ send visibility of interactor msg to cover """
        _infoer.function = str(self.sendInteractorStatus)
        _infoer.write("")

        if self.keyRegistered():
            _infoer.function = str(self.sendInteractorStatus)
            _infoer.write("send")
            msg = coGRObjVisMsg(coGRMsg.INTERACTOR_VISIBLE, self.covise_key,
                                self.params.showInteractor)
            covise.sendRendMsg(msg.c_str())
Example #51
0
 def turntableAnimation(self):
     _infoer.function = str(self.turntableAnimation)
     _infoer.write("")
     time = covise.getCoConfigEntry("vr-prepare.TurntableAnimationTime")
     fTime = 10.0
     if (time != None):
         try:
             fTime = float(time)
         except exception.ValueError:
             pass
     msg = coGRTurnTableAnimationMsg(fTime)
     covise.sendRendMsg(msg.c_str())
Example #52
0
 def sendTransformation(self):
     if not self.covise_key=='No key':        
         matrix = transformationMatrix(self.params)
         # send transformation to COVER
         self.params.matrix[3] = self.params.transX
         self.params.matrix[7] = self.params.transY
         self.params.matrix[11] = self.params.transZ            
         msg = coGRObjTransformMsg(self.covise_key, self.params.matrix[0], self.params.matrix[1], self.params.matrix[2], self.params.matrix[3], self.params.matrix[4], self.params.matrix[5], self.params.matrix[6], self.params.matrix[7], self.params.matrix[8], self.params.matrix[9], self.params.matrix[10], self.params.matrix[11], self.params.matrix[12], self.params.matrix[13], self.params.matrix[14], self.params.matrix[15])
         #msg = coGRObjMovedMsg(self.covise_key, self.params.transX, self.params.transY, self.params.transZ, self.params.rotX, self.params.rotY, self.params.rotZ, self.params.rotAngle )
         covise.sendRendMsg(msg.c_str())
         return True
     return False
Example #53
0
 def sendChildren(self):
     """ send list of children to plugin """
     if not self.covise_key=='No key':
         for childKey in self.params.children:
             covise_key_child = Neg2Gui.theNegMsgHandler().internalRequestObjectCoviseKey(childKey)
             if covise_key_child == 'No key':
                 child = globalKeyHandler().getObject(childKey)
                 if child:
                     child.parentCoviseKeyToSend = self.covise_key                  
             else:
                 msg = coGRObjAddChildMsg( self.covise_key, covise_key_child, 0)
                 covise.sendRendMsg(msg.c_str())
Example #54
0
 def sendTransparency(self):
     if (globalKeyHandler().getObject(globalProjectKey).params.originalCoprjVersion >= 3):
         # behavior changed with coprj version 3
         if (len(self.objects) > 0):
             return # we only send transparency messages to leafs (geodes or EOT-nodes)
     if not self.params.transparencyOn:
         transparency = 1.0
     else:
         transparency = self.params.transparency
     # send transparency
     msg = coGRObjSetTransparencyMsg(coGRMsg.SET_TRANSPARENCY, self.covise_key, transparency)
     covise.sendRendMsg(msg.c_str())
Example #55
0
 def emitAnimationModeOn(self):
     self.widget().ToStartButton.setEnabled(False)
     self.widget().BackButton.setEnabled(False)
     self.widget().PlayButton.setEnabled(False)
     self.widget().StopButton.setEnabled(True)
     self.widget().ForwardButton.setEnabled(False)
     self.widget().ToEndButton.setEnabled(False)
     params = ObjectMgr().getParamsOfObject(0)
     params.animateOn = True
     ObjectMgr().setParams(0, params)
     msg = coGRAnimationOnMsg(True)
     covise.sendRendMsg(msg.c_str())
Example #56
0
    def setParams( self, params, negMsgHandler=None, sendToCover=True):
        _infoer.function = str(self.setParams)
        _infoer.write("%s" % params.isVisible)
        if params.id == None:
            return
        realChange = ParamsDiff( self.params, params )
        oldID = self.params.id
        if hasattr(self.params, 'confirmed'):
            oldConfirmed = self.params.confirmed
        else:
            oldConfirmed = True
        if hasattr(self.params, 'changed'):
            oldChanged = self.params.changed
        else:
            oldChanged = False
        VisItem.setParams(self, params, negMsgHandler, sendToCover)
        self.params.confirmed = oldConfirmed
        self.params.changed = oldChanged

        # confirmed and id in realChange happens when loading a project and having different default viewpoints
        if 'confirmed' in realChange and 'id' in realChange:
            self.params.confirmed = True
            if self.params.isVisible:
                self.show()
            # tell the coPresentationMgr that viewpoint is now confirmed and the id has changed
            globalKeyHandler().getObject(globalPresentationMgrKey).changeUnconfirmedViewpointID(oldID, params.id, negMsgHandler)
        else:
            if 'confirmed' in realChange:
                self.params.confirmed = True
                if self.params.isVisible:
                    self.show()
                # tell the coPresentationMgr that viewpoint is confirmed
                globalKeyHandler().getObject(globalPresentationMgrKey).setViewpointConfirmed(params.id, negMsgHandler)
            if 'id' in realChange:
                # tell the presenterManager that my id has changed
                globalKeyHandler().getObject(globalPresentationMgrKey).changeViewPointID(oldID, params.id, negMsgHandler)
        if hasattr(self.params, 'delete'):
            self.delete(False, negMsgHandler)
            return
        if 'isVisible' in realChange and sendToCover and params.isVisible and hasattr(self.params, 'confirmed') and self.params.confirmed:
            _infoer.function = str(self.setParams)
            _infoer.write("send viewpoint")
            self.show()
            globalKeyHandler().getObject(self.parentKey).makeOthersInvisible(self, negMsgHandler)
        if 'name' in realChange and sendToCover:
            #send new name to cover
            msg = coGRChangeViewpointNameMsg( self.params.id, params.name )
            covise.sendRendMsg(msg.c_str())

        # changed in realChange happens when viewpoint is changed in gui
        if 'changed' in realChange:
            # tell the coPresentationMgr that obj has changed
            globalKeyHandler().getObject(globalPresentationMgrKey).viewpointChanged(self.params.id, self.params.view, negMsgHandler)
Example #57
0
 def reconnect(self):
     """ recreate is called after all classes of the session have been unpickled """
     #do not recreate default viewpoints
     if self.params.view == 'default' or self.params.id == None:
         return
     self.params.confirmed = False
     self.params.changed = False
     # the id is not used by cover
     # could be out of sync
     msg = coGRCreateViewpointMsg(self.params.name, self.params.id,
                                  self.params.view, self.params.clipplane)
     covise.sendRendMsg(msg.c_str())
Example #58
0
 def emitAnimationModeOn(self):
     self.widget().ToStartButton.setEnabled(False)
     self.widget().BackButton.setEnabled(False)
     self.widget().PlayButton.setEnabled(False)
     self.widget().StopButton.setEnabled(True)
     self.widget().ForwardButton.setEnabled(False)
     self.widget().ToEndButton.setEnabled(False)
     params = ObjectMgr().getParamsOfObject(0)
     params.animateOn = True
     ObjectMgr().setParams(0, params)
     msg = coGRAnimationOnMsg(True)
     covise.sendRendMsg(msg.c_str())