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

    [melange] Wrong data in the Tpolygonselection tag

    Scheduled Pinned Locked Moved Bugs
    3 Posts 0 Posters 629 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 19/12/2012 at 18:32, xxxxxxxx wrote:

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

      ---------
      Hello everyone,

      I'm trying to use melange #68456 to import the polygon selection tags (Tpolygonselection) of a polygon object.

      The tag's BaseSelect* indicates the right count of polygons, but their indices make no sense. Even better, they are different in debug and release mode (yet wrong in both cases ^^).

      Is that a known bug or a feature non-implemented yet ?

      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 20/12/2012 at 01:16, xxxxxxxx wrote:

        Hi Jelly,

        I've just checked with this Melange version and it works quite well. I've used the following code and added this to the PrintTagInfo() function in the commandline example which is included in the Melange SDK.
                  // Polygon Selection Tag
                  if (btag->GetType() == Tpolygonselection && obj->GetType() == Opolygon)
                  {
                       printf("\n");
                       BaseSelect *bs = ((SelectionTag* )btag)->GetBaseSelect();
                       if (bs)
                       {
                            LONG s = 0;
                            for (s=0; s<((PolygonObject* )obj)->GetPolygonCount(); s++)
                            {
                                 if (bs->IsSelected(s))
                                      printf("     Poly %d: selected\n", s );
                                 else
                                      printf("     Poly %d: NOT selected\n", s );
                            }
                       }
                  }

        Just to be sure, BaseSelect::GetCount() does not return the polygon count of the object, it returns only the amount of selected elements. You have to go throught all polygon indices to check if it is selected or not (in the docs there's a faster way shown in using GetRange() btw.).
        If you already used to this please ignore this part 🙂

        Could you tell me how you've checked the indicies? Which function did you use?

        Cheers,
        Jens

        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 20/12/2012 at 14:07, xxxxxxxx wrote:

          Hi Rodnoc,

          Thank you for your sample, it works - indeed - like a charm ! The doc about GetRange() was very helpful too :).
          I'm not used to this SDK and have some difficulties to apprehend its "coding style".

          My error was that I tried to directly access the selected elements using the following code:

          LONG *indices = bs->GetData();
          for(LONG s = 0; s < bs->GetCount(); ++s)
          {
            LONG index = indices[s];
          }

          I thought the GetData() function was broken because I got right values in simple geometry cases.

          Thanks again,
          Rémi

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