# VPBuffers

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

On 29/08/2007 at 08:49, xxxxxxxx wrote:

Hello Philip,

where:
LONG subcnt = layer->GetLayerCount();

subcnt always is -1 so the internal cycle go in loop forewer.

What's mean that GetLayerCount() return -1 ?

cheers
Renato

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

On 29/08/2007 at 11:08, xxxxxxxx wrote:

But Philip did this in his loop:

for (j=0;j<subcnt || subcnt==-1;j++)

Probably explicitly to avoid the infinite loop. No idea about what -1 represents here though.

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

On 29/08/2007 at 11:35, xxxxxxxx wrote:

Hello dear Robert,

but when the subcnt == -1.. it loop

:)
renato

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

On 29/08/2007 at 12:29, xxxxxxxx wrote:

Are you sure of your types (LONG)? In actuality, all that is needed is:

for (j = 0; j < subcnt; ++j)

Since -1L is less than 0L, the loop should exit immediately. But if ULONG is used, -1L is of course 4 billion.

All else failing, just check for -1 on subcnt and avoid the loop altogether:

LONG subcnt = layer->GetLayerCount();
if (subcnt < 0)     continue;
for (j=0; j!=subcnt; ++j)
...

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

On 30/08/2007 at 01:54, xxxxxxxx wrote:

My excuses... one line of source code was missing!

LONG j,i,id;
LONG cnt = b3d->GetLayerCount();

for (i=0; i<cnt; i++)
{
MultipassBitmap *sublayer,*layer = b3d->GetLayerNum(i);
if (!layer) continue;

LONG subcnt = layer->GetLayerCount();

for (j=0;j<subcnt || subcnt==-1;j++)
{
if (subcnt>0)
sublayer   = layer->GetLayerNum(j);
else
sublayer = layer;

if (!sublayer) continue;

id = sublayer->GetParameter(MPB_USERID).GetLong();
if (subcnt==-1) break;
}
}

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

On 30/08/2007 at 11:10, xxxxxxxx wrote:

Hello Philip,

ok now :) but the objectID are the only buffers not detected with this way :(

any suggestions?

Cheers
Renato

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

On 30/08/2007 at 14:25, xxxxxxxx wrote:

To retrieve the alpha channels use:

cnt = b3d->GetAlphaLayerCount();
for (i=0; i<cnt; i++)
{
B3dBitmap *layer = b3d->GetAlphaLayerNum(i);
if (!layer) continue;

id = sublayer->GetParameter(MPB_USERID).GetLong();
if (!id) continue;

...
}

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

On 30/08/2007 at 14:26, xxxxxxxx wrote:

Ah.. thanks.. i forgot that ObjectID are in fact alpha channels :)

Thanks a lot
Renato