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

    InExcludeData - Crash Problem

    Scheduled Pinned Locked Moved SDK Help
    7 Posts 0 Posters 474 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 26/12/2007 at 15:11, xxxxxxxx wrote:

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

      ---------
      Hi,

      in my expression tag, I use an InExcludeList Element to get a list of objects from the user. But I have some problems...

      In the Execute() function, I do the following:

      1. Get the List of objects that are linked in the InExclude box:

      > _
      > GeData      myList;
      > tag->GetParameter(DescID(SCOOBYCAMEXP_LIST), myList, NULL);
      > InExcludeData* SC_List = static_cast<InExcludeData*>(myList.GetCustomDataType(CUSTOMDATATYPE_INEXCLUDE_LIST));
      > _

      2. Get the number of linked objects:

      > _
      > LONG      ListCount = SC_List->GetObjectCount();
      > _

      But the value that is returned, is not always correct. For example, I have linked 6 objects in the list, it returns 6. But when I delete some of those objects from the scene (without removing them from the InExclude box first) it still returns 6.

      I only want my calculations to be performed if there are at least 2 objects linked in the list. But because of the problem described above, the following code does not work:

      > _
      > if (ListCount > 1)
      > {
      > GePrint("Hello World");
      > }
      > _

      It always prints "Hello World", even if there is only 1 or even 0 objects in the list.

      What can I do? Is there some way to refresh the InExclude box? Do I have to free myList or SC_List at the end of the Execute() function? How would that work?

      Best regards & big thanks for any help,
      Jack

      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 26/12/2007 at 15:20, xxxxxxxx wrote:

        Since InExcludeData accepts pointers deleting the actual object doesn't remove the pointer from the InExcludeData object.

        Hope i'm not way off here, i didn't actually test this 😆

        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 26/12/2007 at 16:57, xxxxxxxx wrote:

          So what's best to do?

          Maybe iterating all items in the list, checking if there's a real object in it, and remove the item from the list if it's not?

          There must be an easier way, I can't believe they let all developers write this function themselves. That would be nasty 😉

          Greetings,
          Jack

          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 26/12/2007 at 17:15, xxxxxxxx wrote:

            There's nothing mentioned on pointers being deleted if there is no object, so i wouldn't think there is any way around this except removing them manually. I don't think those few extra lines of code would hurt you too much though.

            I hope someone with more experience with this will give you a better solution...

            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 27/12/2007 at 03:23, xxxxxxxx wrote:

              OK, now I get the ObjectCount from a separate function that first checks all object pointers in the list, and removes the invalid ones.

              But that means, this function is called every frame. Is there any function I could use instead of the Execute() so my function is only called when the user really *does* something in the ObjectManager ?

              Greetings,
              Jack

              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 27/12/2007 at 04:11, xxxxxxxx wrote:

                I'd use

                > virtual Bool Message(GeListNode* node, LONG type, void* data)

                you have tons of types of messages, just check the sdk for the one that suites you best

                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 28/12/2007 at 09:44, xxxxxxxx wrote:

                  Simply try direct container access. The list updates itself automatically:

                  (InExcludeData* )tag->GetDataInstance()->GetCustomDataType(SCOOBYCAMEXP_LIST, CUSTOMDATATYPE_INEXCLUDE_LIST);

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