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



  • 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.



  • 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





  • 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



  • 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



  • @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.



  • hello,

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

    Cheers,
    Manuel



  • @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
    


  • Hello,

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

    Cheers,
    Manuel


Log in to reply