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

    Folding an object in the Object Manager

    Scheduled Pinned Locked Moved SDK Help
    8 Posts 0 Posters 528 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

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 04/06/2012 at 18:38, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   13 
      Platform:      Mac OSX  ; 
      Language(s) :       PYTHON  ;

      ---------
      I'm trying to force the folding of an object with children, in the Object Manager.
      I tried it in COFFEE and it didn't work.
      Now I was trying to do it in Python and it seems that it doesn't work either 😞
      I tried with:

      op.SetBit(BIT_OFOLD)

      and with

      op.SetBit(NBIT_OM1_FOLD)

      But nothing happens. Is it also not possible with Python?

      Rui Batista

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

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 05/06/2012 at 00:25, xxxxxxxx wrote:

        Have You tried 'GeListNode.ChangeNBit(c4d.NBIT_OM1_FOLD, c4d.NBITCONTROL_SET)' in Python?

        Cheers
        Peter

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

          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

          On 05/06/2012 at 03:28, xxxxxxxx wrote:

          How should I apply it?
          Like this?

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

          If it is, it is still not working 😞

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

            THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

            On 05/06/2012 at 03:54, xxxxxxxx wrote:

            It's necessary to inform the manager about the update with an EventAdd().

            Toggles the fold state:

              
            op.ChangeNBit(c4d.NBIT_OM1_FOLD, c4d.NBITCONTROL_TOGGLE)  
            op.Message(c4d.MSG_CHANGE)  
            c4d.EventAdd()  
            

            cheers,
            Matthias

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

              THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

              On 05/06/2012 at 04:21, xxxxxxxx wrote:

              Well, what I'm trying to achieve is an object that folds itself as soon as an object is dropped in or outside it.
              For that, I created a Python Generator with the following code:

                
              old_childs=0   
                
              import c4d   
              #Welcome to the world of Python   
                
              def main() :   
                  global old_childs   
                  childs=0   
                  current=op.GetDown()   
                  if current is None: return   
                     
                  while current is not None:   
                      childs=childs+1   
                      current=current.GetNext()   
                     
                  if childs==old_childs: return   
                  old_childs=childs   
                  op.ChangeNBit(c4d.NBIT_OM1_FOLD, c4d.NBITCONTROL_SET)   
                  op.Message(c4d.MSG_CHANGE)   
                  c4d.EventAdd()   
                  return c4d.BaseObject(c4d.Onull)   
              

              But it is not working. Could it be because the object is trying to fold itself?

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

                THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                On 05/06/2012 at 05:23, xxxxxxxx wrote:

                A bit confusing, but the clear bit folds the object.

                Example for Python generator:

                  
                import c4d  
                #Welcome to the world of Python  
                  
                  
                def main() :  
                  op.ChangeNBit(c4d.NBIT_OM1_FOLD, c4d.NBITCONTROL_CLEAR)  
                  op.Message(c4d.MSG_CHANGE)  
                  c4d.EventAdd()  
                   
                  return c4d.BaseObject(c4d.Ocube)  
                 
                

                Personally I think it's not a good idea to do and I'm not sure if it's thread safe etc.

                cheers,
                Matthias

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

                  THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                  On 05/06/2012 at 05:37, xxxxxxxx wrote:

                  Weird!! I would assume that to fold we would need to SET the bit.
                  This is for a Vault object - I would place in it objects that I want to keep but that I currently don't need.
                  It will only fold when objects are added or removed from it. But I can still fold/unfold it manually.
                  Thank you very much for your help, Matthias.

                  Rui Batista

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

                    THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                    On 05/06/2012 at 05:57, xxxxxxxx wrote:

                    This should work in an Python Expression Tag.
                    Let me know.
                    Should you need to do this via a Command script,
                    you would need to store the childcount in the parent object
                    itself, using a unique ID from PlugIn Cafe'.

                    Cheers
                    Lennart

                      
                    import c4d   
                      
                    childcountmemo = 0   
                      
                    def main() :   
                        global childcountmemo   
                        obj = op.GetObject()   
                        obj[c4d.TPYTHON_RESET] = False # Turn off 'Reset on Frame 0'   
                        obj[c4d.TPYTHON_FRAME] = False # and 'Frame Dependent'   
                        childcount = len(obj.GetChildren())   
                           
                        if childcount != childcountmemo and obj.GetNBit(c4d.NBIT_OM1_FOLD) :   
                            obj.ChangeNBit(c4d.NBIT_OM1_FOLD,c4d.NBITCONTROL_CLEAR)   
                              
                        childcountmemo = childcount   
                    
                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post