void plPlasmaMAXLayer::SetBitmap(BitmapInfo *bi, int index) { #ifdef MAXASS_AVAILABLE jvUniqueId targetAssetId; GetBitmapAssetId(targetAssetId, index); #endif Bitmap *BM = GetMaxBitmap(index); if (BM) { BM->DeleteThis(); BM = NULL; } if (bi) { #ifdef MAXASS_AVAILABLE if (!targetAssetId.IsEmpty()) { // If this texture has an assetId, we will check the // asset database and make sure we have the latest version // of the texture file before loading it MaxAssInterface* assInterface = GetMaxAssInterface(); if (assInterface) { char buf[20]; assInterface->UniqueIdToString(targetAssetId, buf); bi->SetDevice(buf); const char* filename = bi->Name(); // Download the latest version and retrieve the filename char newfilename[MAX_PATH]; if (assInterface->GetLatestVersionFile(targetAssetId, newfilename, sizeof(newfilename))) { // If the filename has changed, we have to reset the bitmap in the ParamBlock if(stricmp(filename, newfilename) != 0) bi->SetName(newfilename); } } } #endif BMMRES result; BM = TheManager->Load(bi, &result); if (result == BMMRES_SUCCESS) ISetMaxBitmap(BM, index); else ISetMaxBitmap(NULL, index); // The load may have failed, but we still want to set the paramblock. We // don't want to modify the layer if we're just missing the file. PBBitmap pbBitmap(*bi); ISetPBBitmap(&pbBitmap, index); } else { ISetMaxBitmap(NULL, index); ISetPBBitmap(NULL, index); } /* Bitmap *BM = GetMaxBitmap(index); if (BM) { BM->DeleteThis(); BM = NULL; } if (filename) { BitmapInfo bi; bi.SetName(filename); // If this texture has an assetId, get the latest version from AssetMan before loading it if (assetId && !assetId->IsEmpty()) { MaxAssInterface* maxAssInterface = GetMaxAssInterface(); if (maxAssInterface) { // Download the latest version and retrieve the filename char newfilename[MAX_PATH]; if (maxAssInterface->GetLatestVersionFile(*assetId, newfilename, sizeof(newfilename))) { // If the filename has changed, we have to reset the bitmap in the ParamBlock if (stricmp(filename, newfilename) != 0) { bi.SetName(newfilename); } } } } ISetMaxBitmap(TheManager->Load(&bi)); PBBitmap pbBitmap(bi); // TheManager->LoadInto(&pbBitmap.bi, &pbBitmap.bm, TRUE); ISetPBBitmap(&pbBitmap, index); if (assetId) SetBitmapAssetId(*assetId, index); } else { ISetMaxBitmap(NULL, index); ISetPBBitmap(NULL, index); } NotifyDependents(FOREVER, PART_ALL, REFMSG_CHANGE); */ }