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
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Objects are still not displayed after ChangeNBit is works

    Bugs
    python 2024 2025
    2
    3
    814
    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.
    • gheyretG
      gheyret
      last edited by

      Hi Everyone!

      I'm Trying to use GeListNode.ChangeNBit(c4d.NBIT_EHIDE, c4d.NBITCONTROL_SET) to hide some objects and save the project file and close it.
      And I open the project file again and try to using GeListNode.ChangeNBit(c4d.NBIT_EHIDE, c4d.NBITCONTROL_CLEAR), I find that although the code works, but the hidden objects are still not displayed in viewport.

      Is this a bug or something special thing happend?


      This is the project file I tested, and it's already hide the 4 objects top of the OM:
      show-hide_test.c4d

      And this the simple testing code for displayed them:

      import c4d
      
      doc: c4d.documents.BaseDocument  # The currently active document.
      op: c4d.BaseObject | None  # The primary selected object in `doc`. Can be `None`.
      
      def main() -> None:
          objs = doc.GetObjects()
          for obj in objs:
              if obj.GetNBit(c4d.NBIT_EHIDE):
                  print(obj.ChangeNBit(c4d.NBIT_EHIDE, c4d.NBITCONTROL_CLEAR))
                  print(obj.GetNBit(c4d.NBIT_EHIDE))
      
          c4d.EventAdd()
      
      if __name__ == '__main__':
          main()
      

      P.S: I also found that after running the test code in the above project file and saving the project, closing it and then opening it again, those hidden objects came back.

      www.boghma.com

      1 Reply Last reply Reply Quote 0
      • M
        m_adam
        last edited by

        Hi, thanks a lot for the report, I filled a bug report.

        As a workaround you can enable and disable the deform mode and it will work.

        import c4d
        
        doc: c4d.documents.BaseDocument  # The currently active document.
        op: c4d.BaseObject | None  # The primary selected object in `doc`. Can be `None`.
        
        def main() -> None:
            objs = doc.GetObjects()
            for obj in objs:
                if obj.GetNBit(c4d.NBIT_EHIDE):
                    print(obj.ChangeNBit(c4d.NBIT_EHIDE, c4d.NBITCONTROL_CLEAR))
                    print(obj.GetNBit(c4d.NBIT_EHIDE))
                    if obj.GetDeformMode():
                        obj.SetDeformMode(False)
                        obj.SetDeformMode(True)
        
            c4d.EventAdd()
        
        if __name__ == '__main__':
            main()
        

        Cheers,
        Maxime.

        MAXON SDK Specialist

        Development Blog, MAXON Registered Developer

        gheyretG 1 Reply Last reply Reply Quote 0
        • M m_adam moved this topic from Cinema 4D SDK on
        • gheyretG
          gheyret @m_adam
          last edited by

          Thank you for your reply and solution!
          Cheers~

          www.boghma.com

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