Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve Max texture paths before exporting #1623

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Sources/MaxPlugin/MaxComponent/plGUIComponents.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4793,6 +4793,7 @@ bool plGUISkinComp::Convert(plMaxNode *node, plErrorMsg *pErrMsg)
PBBitmap *texture = layer->GetPBBitmap();
if (texture != nullptr)
{
BMMGetFullFilename(&texture->bi);
plBitmap *bMap = plLayerConverter::Instance().CreateSimpleTexture( M2ST(texture->bi.Name()), fConvertedSkin->GetKey()->GetUoid().GetLocation(), 0, plMipmap::kForceNonCompressed | plMipmap::kAlphaChannelFlag | plMipmap::kNoMaxSize );
if (bMap != nullptr && plMipmap::ConvertNoRef(bMap) != nullptr)
{
Expand Down
1 change: 1 addition & 0 deletions Sources/MaxPlugin/MaxComponent/plMiscComponents.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2538,6 +2538,7 @@ bool pfImageLibComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg)
PBBitmap *texture = layer->GetPBBitmap();
if (texture != nullptr)
{
BMMGetFullFilename(&texture->bi);
uint32_t flags = plBitmap::kAlphaChannelFlag;

plBitmap *bMap;
Expand Down
2 changes: 2 additions & 0 deletions Sources/MaxPlugin/MaxConvert/hsMaterialConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1957,6 +1957,7 @@ static plLayerInterface* IProcessLayerMovie(plPassMtlBase* mtl, plLayerTex* layT
if( !bi || !bi->Name() || !*bi->Name() )
return layerIFace;

BMMGetFullFilename(bi);
plFileName fileName = bi->Name();

plAnimStealthNode* stealth = IGetEntireAnimation(mtl);
Expand Down Expand Up @@ -4529,6 +4530,7 @@ plClothingItem *hsMaterialConverter::GenerateClothingItem(plClothingMtl *mtl, co
if (layer == nullptr || layer->GetPBBitmap() == nullptr)
continue;

BMMGetFullFilename(&layer->GetPBBitmap()->bi);
ST::string texName = M2ST(layer->GetPBBitmap()->bi.Name());

for (clipLevels = 0, startWidth = layer->GetPBBitmap()->bi.Width();
Expand Down
3 changes: 3 additions & 0 deletions Sources/MaxPlugin/MaxConvert/plLayerConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ plLayerInterface *plLayerConverter::IConvertLayerTex( plPlasmaMAXLayer *layer

// Setup the texture creation parameters
plBitmapData bd;
BMMGetFullFilename(bi);
bd.fileName = bi->Name();

// Create texture and add it to list if unique
Expand Down Expand Up @@ -442,6 +443,7 @@ plLayerInterface *plLayerConverter::IConvertStaticEnvLayer( plPlasmaMAXLayer

// Setup the texture creation parameters
plBitmapData bd;
BMMGetFullFilename(bi);
bd.fileName = bi->Name();

// Create texture and add it to list if unique
Expand Down Expand Up @@ -474,6 +476,7 @@ plLayerInterface *plLayerConverter::IConvertStaticEnvLayer( plPlasmaMAXLayer
PBBitmap *face = bitmapPB->GetBitmap( plStaticEnvLayer::kBmpFrontBitmap + i );
if( !face )
return (plLayerInterface *)plasmaLayer;
BMMGetFullFilename(&face->bi);
bd.faceNames[ i ] = face->bi.Name();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@ bool plPlasmaMAXLayer::GetBitmapFileName( TCHAR* destFilename, int maxLength,
if (GetPBBitmap(index) == nullptr)
return false;

BMMGetFullFilename(&GetPBBitmap(index)->bi);
_tcsncpy( destFilename, GetPBBitmap( index )->bi.Name(), maxLength );
Comment on lines +403 to 404
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
BMMGetFullFilename(&GetPBBitmap(index)->bi);
_tcsncpy( destFilename, GetPBBitmap( index )->bi.Name(), maxLength );
BMMGetFullFilename(GetPBBitmap( index )->bi.Name(), destFilename, maxLength);

return true;
}
Expand Down