Message 1 of 4

Not applicable
04-06-2017
04:50 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi everyone!
I'm trying to receive submaterials and submaps of not standard materials and not standard maps (like VRay and Corona). For these purposes I used IParamblock2 of Mtl and BitmapTex respectively.
I'm checking type of parameter if it's TYPE_MTL
void VRnetReader::FindInMtl(Mtl *mat, list<BitmapTex*> &diffuseMaps, list<BitmapTex*> &bumpMaps) { if(mat == NULL) return; MaterialNum numerator(mat); IParamBlock2 * pblock = mat->GetParamBlock(ip->GetTime()); if(pblock == NULL) return; int pbCount = pblock->GetDesc()->count; for(int i = 0; i < pbCount; i++){ int id = pblock->GetDesc()->IndextoID(i); ParamType2 ptype = pblock->GetParameterType(id); if(ptype == ParamType2::TYPE_MTL){ Interval validity; Mtl *inMtl = pblock->GetMtl(id,ip->GetTime(),validity); if(inMtl != NULL) FindInMtl(inMtl,diffuseMaps,bumpMaps); } } BitmapTex *diffTM = NULL, *bumpTM = NULL; if(numerator.DIFFINDEX >= 0){ diffTM = (BitmapTex *) mat->GetSubTexmap(numerator.DIFFINDEX); } if(numerator.BUMPINDEX >= 0){ bumpTM = (BitmapTex *) mat->GetSubTexmap(numerator.BUMPINDEX); } if(diffTM != NULL){ diffuseMaps.push_back(diffTM); } if(bumpTM != NULL){ bumpMaps.push_back(bumpTM); } }
and if it's TYPE_TEXMAP / TYPE_BITMAP (receiving at least one texture if we have it at all):
PBBitmap *VRnetReader::GetBitmap(BitmapTex **texture) { IParamBlock2 *pb2 = (*texture)->GetParamBlock(ip->GetTime()); Interval val; if(pb2 == NULL) return NULL; int count = pb2->GetDesc()->Count(); ParamType2 ptype; for(int i = 0; i < count; i++){ ParamID id = pb2->IndextoID(i); ptype = pb2->GetParameterType(id); if(ptype == ParamType2::TYPE_TEXMAP){ BitmapTex *buffTex = (BitmapTex *) pb2->GetTexmap(id,ip->GetTime(),val); if(buffTex != NULL){ PBBitmap *buff = GetBitmap(&buffTex); if(buff != NULL){ *texture = buffTex; return buff; } } } if(ptype == ParamType2::TYPE_BITMAP){ PBBitmap *buff = pb2->GetBitmap(id,ip->GetTime(),val); if(buff != NULL) return buff; } } return NULL; }
But sometimes type of parameter is TYPE_MTL_TAB, TYPE_TEXMAP_TAB or TYPE_BITMAP_TAB. As much as I understood, it means that the object that we can receive is Tab<Mtl*>, Tab<Texmap*> or Tab<BitmapTex*> respectively.
Thing is, I haven't found how to extract this mentioned table.
Any ideas how to receive it?
Solved! Go to Solution.