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 objects in Object Manager

    Scheduled Pinned Locked Moved PYTHON Development
    10 Posts 0 Posters 1.0k 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 21/01/2013 at 14:08, xxxxxxxx wrote:

      Hi guys.

      Why does this code don't work from Python plugin?

      self.obj.ChangeNBit(c4d.NBIT_OHIDE, c4d.NBITCONTROL_CLEAR) - I know I am missing something simple, but cannot figure it out.

      Under a python tag I used something similar, and it worked just fine: #obj.ChangeNBit(c4d.NBIT_OHIDE, c4d.NBITCONTROL_CLEAR)      - what am I doing wrong?

      Please help:)
      Thank you.

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        On 21/01/2013 at 15:48, xxxxxxxx wrote:

        Hi, try this one:

        You clear the bit with NBITCONTROL_CLEAR, use c4d.NBITCONTROL_SET instead.

        Cheers, Sebastian

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          On 21/01/2013 at 15:58, xxxxxxxx wrote:

          Oh yeah, that did the trick.
          Thanks Sebastian.

          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

            On 22/01/2013 at 01:34, xxxxxxxx wrote:

            May I ask another question?
            Hiding objects in Object Manager works like a charm. However, I still get that "+" sign on parent null object, that holds all those hidden objects. But if I press on that "+" - nothing unfolds - the "+" just disappears. Maybe I need to send some command to refresh a viewport or something? Or is there another way to get rid of that unnecessary "+" sign that holds nothing?

            my code looks like this right now:

            doc = c4d.documents.GetActiveDocument()   
                    MASTER_NULL = c4d.BaseObject(c4d.Onull)
                    doc.InsertObject(MASTER_NULL, node)
                    MASTER_NULL.ChangeNBit(c4d.NBIT_OHIDE, c4d.NBITCONTROL_SET)

            Thanks in advance.

            1 Reply Last reply Reply Quote 0
            • H Offline
              Helper
              last edited by

              On 22/01/2013 at 02:43, xxxxxxxx wrote:

              try c4d.EventAdd()as your last script line.

              1 Reply Last reply Reply Quote 0
              • H Offline
                Helper
                last edited by

                On 22/01/2013 at 03:08, xxxxxxxx wrote:

                Seems that c4d.EventAdd() didn't do a trick. Unnecessary "+" is still there:)

                1 Reply Last reply Reply Quote 0
                • H Offline
                  Helper
                  last edited by

                  On 22/01/2013 at 03:49, xxxxxxxx wrote:

                  So I ended up by adding some more code:

                  node.ChangeNBit(c4d.NBIT_OM1_FOLD, c4d.NBITCONTROL_SET)

                  ...that basically unfolds that object (though there's nothing to unfold) - and I get rid of that "+" sign.

                  1 Reply Last reply Reply Quote 0
                  • H Offline
                    Helper
                    last edited by

                    On 22/01/2013 at 03:55, xxxxxxxx wrote:

                    a bit diffrent approach, which could be considered as more natural i guess . 
                    i have never used this bit unil now. you just want to add an invisible child ?

                    import c4d
                    from c4d import gui
                    #Welcome to the world of Python
                      
                      
                    def main() :
                        # this line is not necessary in a script, doc is one of
                        # the predefined variables like doc or tp
                     ~~    doc = c4d.documents.GetActiveDocument()~~
                      
                        # get the selected object
                        parent = doc.GetActiveObject() 
                        # create a child node
                        child = c4d.BaseObject(c4d.Onull)
                        # insert the child under the parent
                        child.InsertUnderLast(parent)
                        # hide the child
                        child.ChangeNBit(c4d.NBIT_OHIDE, c4d.NBITCONTROL_SET)
                        c4d.EventAdd()
                      
                    if __name__=='__main__':
                        main()
                    
                    1 Reply Last reply Reply Quote 0
                    • H Offline
                      Helper
                      last edited by

                      On 22/01/2013 at 04:59, xxxxxxxx wrote:

                      Your method seems to work the same way I did it:)
                      But at the end I still get that problem with"+"

                      So will stick with adding additional line of code to unfold that object.

                      Cheers, and thanks for input.

                      1 Reply Last reply Reply Quote 0
                      • H Offline
                        Helper
                        last edited by

                        On 22/01/2013 at 06:39, xxxxxxxx wrote:

                        Originally posted by xxxxxxxx

                        Your method seems to work the same way I did it:)
                        But at the end I still get that problem with"+"

                        So will stick with adding additional line of code to unfold that object.

                        Cheers, and thanks for input.

                        i am using a GeListNode Method to insert the object rather than the more general 
                        BaseDocument.InsertObject method. the snippet works fine for me (nothing happens
                        visually).

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