Message ID associated with ViewPort changes ?



  • On 31/05/2013 at 11:43, xxxxxxxx wrote:

    Hi,

    is there a message associated with changes made to the active viewport ? I have a
    utils.ViewportSelect instance and I do not want to reinit on each call. Currently I am
    using this method :

        """--------------------------------------------------------------------------------------------"""   
        def checkViewportSelect(self, doc, bd) :
            """
            Handles / updates the viewportselect object.
            :param doc : The active document
            :param bd  : The active BaseDraw
            :return    : bool
            """
            if isinstance(bd, c4d.BaseDraw) :
                # create an instance
                if not isinstance(self.ViewPortSelect, utils.ViewportSelect) :
                    self.ViewPortSelect = utils.ViewportSelect()
                # (re)init the instance
                if (self.ViewPortFrame != bd.GetFrame() or
                    self.ViewPortMatrix != bd.GetMg()) :
                    self.ViewPortFrame = bd.GetFrame()
                    self.ViewPortMatrix = bd.GetMg()
                    wd = self.ViewPortFrame["cr"] - self.ViewPortFrame["cl"] + 1
                    hg = self.ViewPortFrame["cb"] - self.ViewPortFrame["ct"] + 1
                    self.ViewPortSelect.Init(w = wd, h = hg, bd = bd, ops = [self.Object], 
                                             mode = c4d.Mpolyedgepoint, onlyvisible = True, 
                                             flags = c4d.VIEWPORTSELECTFLAGS_IGNORE_HIDDEN_SEL)
                return True
            return False 
    

    Which is working fine, but it feels a bit 'unsafe'. So I am wondering if there is a message
    associated with active viewport changes (dimensions, camera pos, projection and so on).
    I am looking for a ToolData or CoreMessage.

    Not sure how you are doing that ? Initing the VPS object for each call the seems to be a
    bit overkill ?

    Happy rendering,
    Ferdinand


Log in to reply