Hide objects in Object Manager



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



  • 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



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

    Oh yeah, that did the trick.
    Thanks Sebastian.



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



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

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



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

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



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



  • 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()
    


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



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


Log in to reply