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:
Cinema 4D Version: R13
Platform: Windows ;
Language(s) : C++ ;
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 ?
On 20/12/2012 at 01:16, xxxxxxxx wrote:
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)
BaseSelect *bs = ((SelectionTag* )btag)->GetBaseSelect();
LONG s = 0;
for (s=0; s<((PolygonObject* )obj)->GetPolygonCount(); s++)
printf(" Poly %d: selected\n", s );
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?
On 20/12/2012 at 14:07, xxxxxxxx wrote:
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.