Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    [PYTHON] How to properly set the toggle of viewport solo

    Cinema 4D SDK
    python 2024 2023 s26
    2
    3
    505
    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
      BretBays
      last edited by

      Howdy,

      I was wondering how I could go about enabling/disabling the viewport solo through python(not through CallCommand). I don't see it as a BIT or NBIT to change, but it is also not a tool or modeling command as far as I can tell. Searching the API for VIEWPORT_SOLO_MODE doesn't turn anything up. I was wanting to be able to set and toggle it and the other solo options like Hierarchy etc. Does anyone have any info on how to work with that?

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

        Hello @BretBays,

        Thank you for reaching out to us. Object soloing is based on NBIT_EHIDE which will hide an object in the viewport. So, if you would want to replicate the soloing functionality, you would have to traverse all objects to set NBIT_EHIDE on all of them except for the objects which are BIT_ACTIVE, i.e., selected.

        But I do not really understand why you do not want to use CallCommand? Is it because of threading restrictions? If you think you can circumvent this by doing it yourself, I must strongly advise against changing the flag NBIT_EHIDE from a non-main-thread-thread. While setting flags from a non-main-thread-thread in general is allowed, setting NBIT_EHIDE will not just ignore objects when drawing but mute their caches. When you change this in the middle of an update cycle, you are bound to run into problems. A lot of things in the scene processing is checking for NBIT_EHIDE.

        When returning a cache in an object plugin or a Python Generator object, you can hide parts of your cache with NBIT_EHIDE (and the other hiding flags which do exist). The only other valid scenario is setting NBIT_EHIDE from the main thread or using the CallCommand from there.

        Cheers,
        Ferdinand

        MAXON SDK Specialist
        developers.maxon.net

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

          In the past I have refrained from CallCommands and CallButtons because they used to add to the undo queue or did. But I suppose in this instance I can just do it for thise purpose.

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