Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Recent
    • Tags
    • Users
    • Login

    Message ID associated with ViewPort changes ?

    Scheduled Pinned Locked Moved PYTHON Development
    1 Posts 0 Posters 149 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

      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

      1 Reply Last reply Reply Quote 0
      • First post
        Last post