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

    Remove BaseObjects and Insert again

    SDK Help
    0
    4
    422
    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
      Helper
      last edited by

      On 11/06/2014 at 00:16, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   13.061 
      Platform:   Windows  ;   
      Language(s) :     C++  ;

      ---------
      Hello,
       
      I need some help about my use case. I like to move a BaseObject in the tree of object manager.
      If I'm using simple the GeListNode::Remove() command and the GeListNode::InsertObject(...) it works sometimes. But mostly C4D hang up.
      I read the note in your SDK documentation that "documents must never be modified using the direct list functions .. Remove, InsertBefore etc."
       
      But how should I do this? Exist a workaround or anything other commands?
      Should I'm create new objects and copy the data to this new objects?
       
       
      regards

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

        On 11/06/2014 at 01:05, xxxxxxxx wrote:

        In what context do you do these operations? Scene modifications should only be done from the
        main thread, ie. not from ObjectData or Tag plugins, except in their Message() function.

        -Niklas

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

          On 11/06/2014 at 01:14, xxxxxxxx wrote:

          oh s...
          It's in a message context of a other ObjectData.
           
          What is the best way to do this in the main thread?

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

            On 11/06/2014 at 01:40, xxxxxxxx wrote:

            Well, if its in ObjectData::Message(), it should be fine (except if you called it yourself from another
            thread). Maybe you're doing something wrong with inserting the object (eg. op->InsertUnder(op)
            will crash C4D).

            You can also use GeIsMainThread() to check if the code is being executed from the main thread.
            But since Message() is supposed to be called from the main thread only, it should be (and Cinema
            will also call it from the main thread only. There could still be details about specific message type,
            but that does not apply to most of the built-in messages)

            -Niklas

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