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
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Hide a specific object in a specific viewport but not in others?

    Cinema 4D SDK
    r20 python
    4
    9
    1.5k
    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.
    • B
      bentraje
      last edited by

      Hi,

      I understand there is a "localized" feature on viewports where meshes are visible in one viewport and not in other.
      However, it is general (i.e. all meshes). Is there any API function that would let me specify what specific object is present in one viewport and not in others?

      Thank you for looking at my problem.

      1 Reply Last reply Reply Quote 0
      • S
        s_bach
        last edited by

        Hello,

        can you explain a little bit more this "localized" feature? I'm not aware of an option to hide an object in a specific viewport window.

        best wishes,
        Sebastian

        MAXON SDK Specialist

        Development Blog, MAXON Registered Developer

        1 Reply Last reply Reply Quote 0
        • B
          bentraje
          last edited by

          @s_bach

          Please see the illustration here:
          https://www.dropbox.com/s/m76nrqz744ofysy/c4d136_localized_viewport.jpg?dl=0

          Thank you

          1 Reply Last reply Reply Quote 0
          • ferdinandF
            ferdinand
            last edited by ferdinand

            These are the viewport rendering options attached to a BaseDraw which you can adjust either globally or per viewport locally. The visibility flags of objects are stored in the in objects itself (check out N-Bit Handler in c4d.GeListNode for details).

            The only way I could think of would be to do it sort of manually.

            1. Hide the object from the viewports.
            2. Implement a plugin data type that provides an overridable Draw method.
            3. Identify the BaseDraw you want the object to appear in.
            4. Wait for your target BaseDraw to be passed to the Draw method.
            5. Draw in this BaseDraw your object manually.

            This does not seem to be a very practical approach unless you absolutely have to achieve your desired functionality.

            Cheers,
            zipit

            MAXON SDK Specialist
            developers.maxon.net

            1 Reply Last reply Reply Quote 1
            • ManuelM
              Manuel
              last edited by

              Hello,

              I totally forgot this option to "localize" option for viewport.... i remember playing with it, but never "used" it.

              Regarding your question, there's nothing on the API that will allow you to do it.

              If there''s a "strange" way to do it, we are not aware of it.

              Do you have a praticable example why you want this functionality ? (maybe we can open a suggestion)

              Cheers
              Manuel

              MAXON SDK Specialist

              MAXON Registered Developer

              1 Reply Last reply Reply Quote 1
              • B
                bentraje
                last edited by

                @zipit

                Thanks for the response and for pointing out the steps. By nbit handler, I guess you are referring to the NBIT_EHIDE parameter. That's indeed a bit hefty procedure. Plug-ins are new to me. I'm guessing the need for the plug-in is for it to constantly execute Draw() and BaseDraw() method?

                @m_magalhaes

                Thanks for the response. One of my intended is when animation. One viewport is for perspective. The other is for camera_shot and reference. The reference is a plane with an image sequence attached to it.

                The reference plane should be present in the camera_shot viewport but not in the perspective viewport.

                If its confusing, I can try sending what the set-up looks like in Maya (video screencap).

                I tried using the solo command but it also works for all the viewports. Correct me if I'm wrong.

                ferdinandF 1 Reply Last reply Reply Quote 0
                • ManuelM
                  Manuel
                  last edited by

                  hello,

                  I see the point.
                  if you have screen shots that can explain the process, the workflow that would be even better.

                  Cheers,
                  Manuel

                  MAXON SDK Specialist

                  MAXON Registered Developer

                  1 Reply Last reply Reply Quote 0
                  • ferdinandF
                    ferdinand @bentraje
                    last edited by

                    @zipit

                    Thanks for the response and for pointing out the steps. By nbit handler, I guess you are referring to the NBIT_EHIDE parameter. That's indeed a bit hefty procedure. Plug-ins are new to me. I'm guessing the need for the plug-in is for it to constantly execute Draw() and BaseDraw() method?

                    Yes, I was referring to the enum value NBIT_EHIDE. c4d.BaseDraw is not a method but a type which lets you draw into a view port, see here for details. Many (but not all) plugin data types (and also the Python Scripting Tag) support the implementation of a Draw() method. Cinema4D will call this method for each BaseDraw in your editor for every redraw of your document. Here is a very simple example for a python scripting tag which draws a red circle only into BaseDraws which return Perspective for GetName().

                    import c4d
                    
                    def main():
                        pass  #put in your code here
                    
                    def draw(bd):
                        """
                        """
                        if bd.GetName() == "Perspective":
                            bd.SetMatrix_Screen(4)
                            bd.SetPen(c4d.Vector(1., 0., 0.))
                            bd.DrawCircle2D(100., 100., 50.)
                            return True
                    

                    MAXON SDK Specialist
                    developers.maxon.net

                    1 Reply Last reply Reply Quote 1
                    • ManuelM
                      Manuel
                      last edited by

                      Hello,

                      This thread will be considered as solved tomorrow unless you have something to add ?

                      Cheers,
                      Manuel

                      MAXON SDK Specialist

                      MAXON Registered Developer

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