mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-14 10:37:41 -04:00
Fix string usage that was broken from enabling the Max plugin build
This commit is contained in:
@ -2158,7 +2158,7 @@ void hsControlConverter::IExportAnimatedCameraFOV(plMaxNode* node, hsTArray <hsG
|
||||
pMsg->AddReceiver(pCamMod->GetKey());
|
||||
pMsg->SetSender(pAnim->GetModKey(node));
|
||||
pMsg->SetCmd(plAnimCmdMsg::kAddCallbacks);
|
||||
pMsg->SetAnimName(ENTIRE_ANIMATION_NAME);
|
||||
pMsg->SetAnimName(_TEMP_CONVERT_FROM_LITERAL(ENTIRE_ANIMATION_NAME));
|
||||
pMsg->fTime = kfArray[0][i].fFrame / MAX_FRAMES_PER_SEC;
|
||||
pMsg->AddCallback(pCall);
|
||||
hsRefCnt_SafeUnRef(pCall);
|
||||
|
@ -346,7 +346,7 @@ INode* hsConverterUtils::FindINodeFromKeyedObject(hsKeyedObject* obj)
|
||||
{
|
||||
hsGuardBegin("hsConverterUtils::FindINodeFromKeyedObject");
|
||||
|
||||
INode* retVal = FindINodeFromMangledName(obj->GetKey()->GetName());
|
||||
INode* retVal = FindINodeFromMangledName(_TEMP_CONVERT_TO_CONST_CHAR(obj->GetKey()->GetName()));
|
||||
if( retVal )
|
||||
return (retVal);
|
||||
|
||||
|
@ -308,7 +308,7 @@ void AttachLinkMtlAnims(plMaxNode *node, hsGMaterial *mat)
|
||||
animLayer = new plLayerLinkAnimation;
|
||||
animLayer->SetLinkKey(node->GetAvatarSO()->GetKey());
|
||||
//animLayer->fLeavingAge = leaving[x];
|
||||
TSTR fullAnimName = TSTR(oldLayer->GetKeyName()) + TSTR("_") + TSTR(animName) + TSTR("_") + TSTR(suff);
|
||||
plString fullAnimName = plString::Format("%s_%s_%s", oldLayer->GetKeyName().c_str(), animName, suff);
|
||||
hsgResMgr::ResMgr()->NewKey(fullAnimName, animLayer, node->GetLocation());
|
||||
animLayer->SetOpacityCtl(opaCtl);
|
||||
animLayer->GetTimeConvert().SetBegin(times[0]);
|
||||
@ -758,11 +758,11 @@ hsMaterialConverter::CreateMaterialArray(Mtl *maxMaterial, plMaxNode *node, uint
|
||||
|
||||
hsBool enviro = fConverterUtils.IsEnvironHolder(node);
|
||||
|
||||
TSTR name;
|
||||
plString name;
|
||||
if (maxMaterial)
|
||||
name = maxMaterial->GetName();
|
||||
name = plString::FromUtf8(maxMaterial->GetName());
|
||||
else
|
||||
name = "nil";
|
||||
name = _TEMP_CONVERT_FROM_LITERAL("nil");
|
||||
|
||||
/// Get the material
|
||||
hsBool isMultiMat = IsMultiMat( maxMaterial );
|
||||
@ -905,8 +905,7 @@ hsGMaterial* hsMaterialConverter::NonAlphaHackPrint(plMaxNode* node, Texmap* bas
|
||||
if( !(baseTex && node) )
|
||||
return nil;
|
||||
|
||||
char name[256];
|
||||
sprintf(name, "%s_%s_%d", node->GetName(), baseTex->GetName(), 0);
|
||||
plString name = plString::Format("%s_%s_%d", node->GetName(), baseTex->GetName(), 0);
|
||||
|
||||
// Search done materials for it
|
||||
|
||||
@ -948,8 +947,7 @@ hsGMaterial* hsMaterialConverter::AlphaHackPrint(plMaxNode* node, Texmap* baseTe
|
||||
if( !(baseTex && node) )
|
||||
return nil;
|
||||
|
||||
char name[256];
|
||||
sprintf(name, "%s_%s_%d_AH", node->GetName(), baseTex->GetName(), 0);
|
||||
plString name = plString::Format("%s_%s_%d_AH", node->GetName(), baseTex->GetName(), 0);
|
||||
|
||||
// Search done materials for it
|
||||
|
||||
@ -998,8 +996,7 @@ hsGMaterial* hsMaterialConverter::NonAlphaHackVersion(plMaxNode* node, Mtl* mtl,
|
||||
return nil;
|
||||
}
|
||||
|
||||
char name[256];
|
||||
sprintf(name, "%s_%s_%d", node->GetName(), mtl->GetName(), subIndex);
|
||||
plString name = plString::Format("%s_%s_%d", node->GetName(), mtl->GetName(), subIndex);
|
||||
|
||||
return ICreateMaterial(mtl, node, name, subIndex, 1, false);
|
||||
}
|
||||
@ -1014,8 +1011,7 @@ hsGMaterial* hsMaterialConverter::AlphaHackVersion(plMaxNode* node, Mtl* mtl, in
|
||||
return nil;
|
||||
}
|
||||
|
||||
char name[256];
|
||||
sprintf(name, "%s_%s_%d_AH", node->GetName(), mtl->GetName(), subIndex);
|
||||
plString name = plString::Format("%s_%s_%d_AH", node->GetName(), mtl->GetName(), subIndex);
|
||||
|
||||
return ICreateMaterial(mtl, node, name, subIndex, 1, true);
|
||||
}
|
||||
@ -1024,7 +1020,7 @@ hsGMaterial* hsMaterialConverter::AlphaHackVersion(plMaxNode* node, Mtl* mtl, in
|
||||
// Big kahuna converter function
|
||||
// (Though meshConverter should be calling CreateMaterialArray instead)
|
||||
//
|
||||
hsGMaterial *hsMaterialConverter::ICreateMaterial(Mtl *mtl, plMaxNode *node, const char *name, int subIndex,
|
||||
hsGMaterial *hsMaterialConverter::ICreateMaterial(Mtl *mtl, plMaxNode *node, const plString &name, int subIndex,
|
||||
int numUVChannels, hsBool makeAlphaLayer)
|
||||
{
|
||||
hsGuardBegin("hsMaterialConverter::ICreateMaterial");
|
||||
@ -1133,7 +1129,7 @@ hsGMaterial *hsMaterialConverter::ICreateMaterial(Mtl *mtl, plMaxNode *node, con
|
||||
//
|
||||
// Handle materials for normal non-light, non-particle nodes.
|
||||
//
|
||||
hsGMaterial *hsMaterialConverter::IProcessMaterial(Mtl *mtl, plMaxNode *node, const char *name,
|
||||
hsGMaterial *hsMaterialConverter::IProcessMaterial(Mtl *mtl, plMaxNode *node, const plString &name,
|
||||
int UVChan, int subMtlFlags /* = 0 */)
|
||||
{
|
||||
hsGuardBegin("hsMaterialConverter::IProcessMaterial");
|
||||
@ -1187,11 +1183,11 @@ hsGMaterial *hsMaterialConverter::IProcessMaterial(Mtl *mtl, plMaxNode *node, co
|
||||
|
||||
plLayer* hLay = new plLayer;
|
||||
hLay->InitToDefault();
|
||||
hsgResMgr::ResMgr()->NewKey(TSTR(name) + TSTR("_DefLay"), hLay, nodeLoc);
|
||||
hsgResMgr::ResMgr()->NewKey(name + _TEMP_CONVERT_FROM_LITERAL("_DefLay"), hLay, nodeLoc);
|
||||
IAddLayerToMaterial(hMat, hLay);
|
||||
}
|
||||
|
||||
if( node->UserPropExists("WetMe") && !strstr(hMat->GetKey()->GetName(), "Wet(*)") )
|
||||
if( node->UserPropExists("WetMe") && (hMat->GetKey()->GetName().Find("Wet(*)") < 0) )
|
||||
IAppendWetLayer(node, hMat);
|
||||
// hsgResMgr::ResMgr()->NewKey(name, hMat,nodeLoc);
|
||||
}
|
||||
@ -1337,11 +1333,11 @@ hsGMaterial *hsMaterialConverter::IAddDefaultMaterial(plMaxNode *node)
|
||||
plLocation loc = node->GetLocation();
|
||||
|
||||
hsGMaterial *hMat = new hsGMaterial;
|
||||
hsgResMgr::ResMgr()->NewKey(TSTR(node->GetName()) + TSTR("_DefMat"), hMat, loc);
|
||||
hsgResMgr::ResMgr()->NewKey(plString::Format("%s_DefMat", node->GetName()), hMat, loc);
|
||||
|
||||
plLayer *layer = new plLayer;
|
||||
layer->InitToDefault();
|
||||
hsgResMgr::ResMgr()->NewKey(TSTR(hMat->GetKeyName()) + TSTR("_DefLay"), layer, loc);
|
||||
hsgResMgr::ResMgr()->NewKey(hMat->GetKeyName() + _TEMP_CONVERT_FROM_LITERAL("_DefLay"), layer, loc);
|
||||
|
||||
DWORD color = node->GetWireColor();
|
||||
float r = float(GetRValue(color)) / 255.f;
|
||||
@ -1357,7 +1353,8 @@ hsGMaterial *hsMaterialConverter::IAddDefaultMaterial(plMaxNode *node)
|
||||
|
||||
plMipmap *hsMaterialConverter::IGetUVTransTexture(plMaxNode *node, hsBool useU /* = true */)
|
||||
{
|
||||
char* texName = (useU ? "ALPHA_BLEND_FILTER_U2ALPHA_TRANS_64x4" : "ALPHA_BLEND_FILTER_V2ALPHA_TRANS_4x64" );
|
||||
plString texName = (useU ? _TEMP_CONVERT_FROM_LITERAL("ALPHA_BLEND_FILTER_U2ALPHA_TRANS_64x4")
|
||||
: _TEMP_CONVERT_FROM_LITERAL("ALPHA_BLEND_FILTER_V2ALPHA_TRANS_4x64") );
|
||||
|
||||
int w = (useU ? 64 : 4);
|
||||
int h = (useU ? 4 : 64);
|
||||
@ -1415,7 +1412,7 @@ void hsMaterialConverter::IInsertSingleBlendLayer(plMipmap *texture, hsGMaterial
|
||||
|
||||
plLayer* layer = new plLayer;
|
||||
layer->InitToDefault();
|
||||
hsgResMgr::ResMgr()->NewKey(TSTR(underLay->GetKeyName()) + TSTR("_AlphaBlend"), layer, node->GetLocation());
|
||||
hsgResMgr::ResMgr()->NewKey(underLay->GetKeyName() + _TEMP_CONVERT_FROM_LITERAL("_AlphaBlend"), layer, node->GetLocation());
|
||||
hsgResMgr::ResMgr()->AddViaNotify(texture->GetKey(), new plLayRefMsg(layer->GetKey(), plRefMsg::kOnCreate, 0, plLayRefMsg::kTexture), plRefFlags::kActiveRef);
|
||||
layer->SetAmbientColor(hsColorRGBA().Set(1.f, 1.f, 1.f, 1.f));
|
||||
// layer->SetZFlags(hsGMatState::kZNoZWrite | hsGMatState::kZIncLayer);
|
||||
@ -1570,16 +1567,14 @@ void hsMaterialConverter::IInsertCompBlendingLayers(Mtl *mtl, plMaxNode *node, h
|
||||
return;
|
||||
}
|
||||
|
||||
hsGMaterial *hsMaterialConverter::IProcessCompositeMtl(Mtl *mtl, plMaxNode *node, const char *name, int UVChan, int subMtlFlags)
|
||||
hsGMaterial *hsMaterialConverter::IProcessCompositeMtl(Mtl *mtl, plMaxNode *node, const plString &name, int UVChan, int subMtlFlags)
|
||||
{
|
||||
if (!mtl || mtl->ClassID() != COMP_MTL_CLASS_ID)
|
||||
return nil;
|
||||
uint32_t *layerCounts = new uint32_t[mtl->NumSubMtls()];
|
||||
IParamBlock2 *pb = mtl->GetParamBlockByID(plCompositeMtl::kBlkPasses);
|
||||
char suff[10];
|
||||
sprintf(suff, "_%d", subMtlFlags);
|
||||
hsGMaterial *mat = new hsGMaterial;
|
||||
hsgResMgr::ResMgr()->NewKey(TSTR(name) + TSTR(suff), mat, node->GetLocation());
|
||||
hsgResMgr::ResMgr()->NewKey(plString::Format("%s_%d", name.c_str(), subMtlFlags), mat, node->GetLocation());
|
||||
|
||||
int multiIndex = IFindSubIndex(node, mtl);
|
||||
hsBool needAlphaHack = node->AlphaHackLayersNeeded(multiIndex) > 0;
|
||||
@ -1593,8 +1588,7 @@ hsGMaterial *hsMaterialConverter::IProcessCompositeMtl(Mtl *mtl, plMaxNode *node
|
||||
hsBool usingSubMtl = (i == 0 || pb->GetInt(kCompOn, 0, i - 1));
|
||||
if ((bitMask & subMtlFlags) != 0 && usingSubMtl)
|
||||
{
|
||||
char pref[256];
|
||||
sprintf(pref, "%s_%d", mat->GetKey()->GetName(), i);
|
||||
plString pref = plString::Format("%s_%d", mat->GetKey()->GetName().c_str(), i);
|
||||
|
||||
subMtl = mtl->GetSubMtl(i);
|
||||
if (subMtl != nil && subMtl->ClassID() == PASS_MTL_CLASS_ID)
|
||||
@ -1673,7 +1667,7 @@ hsGMaterial *hsMaterialConverter::IProcessCompositeMtl(Mtl *mtl, plMaxNode *node
|
||||
return mat;
|
||||
}
|
||||
|
||||
hsGMaterial *hsMaterialConverter::IProcessMultipassMtl(Mtl *mtl, plMaxNode *node, const char *name, int UVChan)
|
||||
hsGMaterial *hsMaterialConverter::IProcessMultipassMtl(Mtl *mtl, plMaxNode *node, const plString &name, int UVChan)
|
||||
{
|
||||
if (!mtl || mtl->ClassID() != MULTIMTL_CLASS_ID)
|
||||
return nil;
|
||||
@ -1705,7 +1699,7 @@ hsGMaterial *hsMaterialConverter::IProcessMultipassMtl(Mtl *mtl, plMaxNode *node
|
||||
return mat;
|
||||
}
|
||||
|
||||
hsGMaterial *hsMaterialConverter::IProcessParticleMtl(Mtl *mtl, plMaxNode *node, const char *name)
|
||||
hsGMaterial *hsMaterialConverter::IProcessParticleMtl(Mtl *mtl, plMaxNode *node, const plString &name)
|
||||
{
|
||||
hsGuardBegin("hsMaterialConverter::IProcessParticleMaterial");
|
||||
|
||||
@ -1713,7 +1707,7 @@ hsGMaterial *hsMaterialConverter::IProcessParticleMtl(Mtl *mtl, plMaxNode *node,
|
||||
char* dbgNodeName = node->GetName();
|
||||
|
||||
hsGMaterial *mat = new hsGMaterial;
|
||||
hsgResMgr::ResMgr()->NewKey(name, mat,nodeLoc);
|
||||
hsgResMgr::ResMgr()->NewKey(name, mat, nodeLoc);
|
||||
|
||||
|
||||
if(!mtl)
|
||||
@ -1732,10 +1726,10 @@ hsGMaterial *hsMaterialConverter::IProcessParticleMtl(Mtl *mtl, plMaxNode *node,
|
||||
Color dif = basicPB->GetColor(plParticleMtl::kColor);
|
||||
float opac = float(basicPB->GetInt(plParticleMtl::kOpacity)) / 100.0f;
|
||||
|
||||
fErrorMsg->Set(opac < 0.0 || opac > 1.0, dbgNodeName, "Bad opacity on mat %s", name).CheckAndAsk();
|
||||
fErrorMsg->Set(dif.r < 0.0 || dif.r > 1.0, dbgNodeName, "Bad color (r) on mat %s", name).CheckAndAsk();
|
||||
fErrorMsg->Set(dif.g < 0.0 || dif.g > 1.0, dbgNodeName, "Bad color (g) on mat %s", name).CheckAndAsk();
|
||||
fErrorMsg->Set(dif.b < 0.0 || dif.b > 1.0, dbgNodeName, "Bad color (b) on mat %s", name).CheckAndAsk();
|
||||
fErrorMsg->Set(opac < 0.0 || opac > 1.0, dbgNodeName, "Bad opacity on mat %s", name.c_str()).CheckAndAsk();
|
||||
fErrorMsg->Set(dif.r < 0.0 || dif.r > 1.0, dbgNodeName, "Bad color (r) on mat %s", name.c_str()).CheckAndAsk();
|
||||
fErrorMsg->Set(dif.g < 0.0 || dif.g > 1.0, dbgNodeName, "Bad color (g) on mat %s", name.c_str()).CheckAndAsk();
|
||||
fErrorMsg->Set(dif.b < 0.0 || dif.b > 1.0, dbgNodeName, "Bad color (b) on mat %s", name.c_str()).CheckAndAsk();
|
||||
|
||||
Color col = dif;
|
||||
|
||||
@ -1817,7 +1811,7 @@ hsGMaterial *hsMaterialConverter::IProcessParticleMtl(Mtl *mtl, plMaxNode *node,
|
||||
}
|
||||
|
||||
plLayerAnimation *IConvertNoteTrackAnims(plLayerAnimation *animLayer, SegmentMap *segMap, plMaxNode *node,
|
||||
const char *name)
|
||||
const plString &name)
|
||||
{
|
||||
plLayerAnimation *prev = animLayer;
|
||||
|
||||
@ -1827,7 +1821,7 @@ plLayerAnimation *IConvertNoteTrackAnims(plLayerAnimation *animLayer, SegmentMap
|
||||
if (spec->fType == SegmentSpec::kAnim)
|
||||
{
|
||||
plLayerAnimation *noteAnim = new plLayerAnimation;
|
||||
TSTR animName = TSTR(name) + TSTR("_anim_") + TSTR(spec->fName);
|
||||
plString animName = plString::Format("%s_anim_%s", name.c_str(), spec->fName);
|
||||
hsgResMgr::ResMgr()->NewKey(animName, noteAnim, node->GetLocation());
|
||||
|
||||
if (animLayer->GetPreshadeColorCtl())
|
||||
@ -1854,8 +1848,8 @@ plLayerAnimation *IConvertNoteTrackAnims(plLayerAnimation *animLayer, SegmentMap
|
||||
|
||||
void ISetDefaultAnim(plPassMtlBase* mtl, plAnimTimeConvert& tc, SegmentMap* segMap)
|
||||
{
|
||||
const char *animName = mtl->GetAnimName();
|
||||
if( segMap && animName && (segMap->find(animName) != segMap->end()) )
|
||||
plString animName = _TEMP_CONVERT_FROM_LITERAL( mtl->GetAnimName() );
|
||||
if( segMap && !animName.IsNull() && (segMap->find(animName) != segMap->end()) )
|
||||
{
|
||||
SegmentSpec *spec = (*segMap)[animName];
|
||||
tc.SetBegin(spec->fStart);
|
||||
@ -1874,8 +1868,8 @@ void ISetDefaultAnim(plPassMtlBase* mtl, plAnimTimeConvert& tc, SegmentMap* segM
|
||||
float loopEnd = tc.GetEnd();
|
||||
|
||||
// If there's a loop, use it
|
||||
const char *loopName = mtl->GetAnimLoopName();
|
||||
if (loopName && *loopName && segMap)
|
||||
plString loopName = plString::FromUtf8(mtl->GetAnimLoopName());
|
||||
if (!loopName.IsEmpty() && segMap)
|
||||
GetSegMapAnimTime(loopName, segMap, SegmentSpec::kLoop, loopStart, loopEnd);
|
||||
|
||||
tc.SetLoopPoints(loopStart, loopEnd);
|
||||
@ -1960,8 +1954,8 @@ static plAnimStealthNode* IGetEntireAnimation(plPassMtlBase* mtl)
|
||||
{
|
||||
plAnimStealthNode* stealth = mtl->GetStealth(i);
|
||||
|
||||
const char *segName = stealth->GetSegmentName();
|
||||
if( !segName || !*segName || !stricmp(segName, ENTIRE_ANIMATION_NAME) )
|
||||
plString segName = stealth->GetSegmentName();
|
||||
if( segName.IsEmpty() || !segName.Compare(ENTIRE_ANIMATION_NAME, plString::kCaseInsensitive) )
|
||||
return stealth;
|
||||
|
||||
}
|
||||
@ -1998,20 +1992,20 @@ static plLayerInterface* IProcessLayerMovie(plPassMtlBase* mtl, plLayerTex* layT
|
||||
sprintf(movieName, "avi/%s", plFileUtils::GetFileName(fileName));
|
||||
|
||||
plLayerMovie* movieLayer = nil;
|
||||
const char* moviePostfix = nil;
|
||||
plString moviePostfix;
|
||||
|
||||
if (isBink)
|
||||
{
|
||||
movieLayer = new plLayerBink;
|
||||
moviePostfix = "_bink";
|
||||
moviePostfix = _TEMP_CONVERT_FROM_LITERAL("_bink");
|
||||
}
|
||||
else if (isAvi)
|
||||
{
|
||||
movieLayer = new plLayerAVI;
|
||||
moviePostfix = "_avi";
|
||||
moviePostfix = _TEMP_CONVERT_FROM_LITERAL("_avi");
|
||||
}
|
||||
|
||||
TSTR movieKeyName = TSTR(layerIFace->GetKeyName()) + moviePostfix;
|
||||
plString movieKeyName = layerIFace->GetKeyName() + moviePostfix;
|
||||
hsgResMgr::ResMgr()->NewKey(movieKeyName, movieLayer, node->GetLocation());
|
||||
|
||||
movieLayer->SetMovieName(movieName);
|
||||
@ -2040,7 +2034,7 @@ static plLayerInterface* IProcessLayerMovie(plPassMtlBase* mtl, plLayerTex* layT
|
||||
}
|
||||
|
||||
plLayerInterface* IProcessLayerAnimation(plPassMtlBase* mtl, plLayerTex* layTex, plMaxNode* node,
|
||||
const char *name, plLayerInterface* layerIFace)
|
||||
const plString &name, plLayerInterface* layerIFace)
|
||||
{
|
||||
hsControlConverter& cc = hsControlConverter::Instance();
|
||||
|
||||
@ -2055,7 +2049,7 @@ plLayerInterface* IProcessLayerAnimation(plPassMtlBase* mtl, plLayerTex* layTex,
|
||||
if( mtl->GetUseGlobal() )
|
||||
{
|
||||
plLayerSDLAnimation *SDLLayer = new plLayerSDLAnimation;
|
||||
TSTR animName = TSTR(name) + TSTR("_anim_") + TSTR(mtl->GetGlobalVarName());
|
||||
plString animName = plString::Format("%s_anim_%s", name.c_str(), mtl->GetGlobalVarName());
|
||||
hsgResMgr::ResMgr()->NewKey(animName, SDLLayer, node->GetLocation());
|
||||
|
||||
SDLLayer->SetVarName((char*)mtl->GetGlobalVarName());
|
||||
@ -2078,10 +2072,11 @@ plLayerInterface* IProcessLayerAnimation(plPassMtlBase* mtl, plLayerTex* layTex,
|
||||
plLayerAnimation *noteAnim = new plLayerAnimation;
|
||||
node->CheckSynchOptions(noteAnim);
|
||||
|
||||
const char *segName = stealth->GetSegmentName();
|
||||
bool isDefault = ( segName == nil || strcmp( segName, ENTIRE_ANIMATION_NAME ) == 0 ) ? true : false;
|
||||
plString segName = stealth->GetSegmentName();
|
||||
bool isDefault = ( segName.IsNull() || segName.Compare( ENTIRE_ANIMATION_NAME ) == 0 ) ? true : false;
|
||||
|
||||
TSTR animName = TSTR( name ) + ( ( isDefault ) ? TSTR( "_LayerAnim_" ) : ( TSTR("_LayerAnim") + TSTR( segName ) ) );
|
||||
plString animName = name + ( ( isDefault ) ? _TEMP_CONVERT_FROM_LITERAL( "_LayerAnim_" )
|
||||
: ( _TEMP_CONVERT_FROM_LITERAL("_LayerAnim") + segName ) );
|
||||
hsgResMgr::ResMgr()->NewKey( animName, noteAnim, node->GetLocation() );
|
||||
|
||||
StdUVGen *uvGen = (StdUVGen *)layTex->GetTheUVGen();
|
||||
@ -2093,7 +2088,7 @@ plLayerInterface* IProcessLayerAnimation(plPassMtlBase* mtl, plLayerTex* layTex,
|
||||
|
||||
// Set segment name if we're not the default
|
||||
if( !isDefault )
|
||||
noteAnim->SetSegmentID( (char *)segName );
|
||||
noteAnim->SetSegmentID( segName );
|
||||
|
||||
// And attach!
|
||||
noteAnim->AttachViaNotify( layerIFace );
|
||||
@ -2106,7 +2101,7 @@ plLayerInterface* IProcessLayerAnimation(plPassMtlBase* mtl, plLayerTex* layTex,
|
||||
|
||||
}
|
||||
|
||||
plLayerInterface* IProcessAnimation(plPassMtlBase *mtl, plMaxNode *node, const char *name,
|
||||
plLayerInterface* IProcessAnimation(plPassMtlBase *mtl, plMaxNode *node, const plString &name,
|
||||
plLayerInterface *layerIFace)
|
||||
{
|
||||
hsControlConverter& cc = hsControlConverter::Instance();
|
||||
@ -2155,7 +2150,7 @@ plLayerInterface* IProcessAnimation(plPassMtlBase *mtl, plMaxNode *node, const c
|
||||
// return layerIFace;
|
||||
|
||||
plLayerSDLAnimation *SDLLayer = new plLayerSDLAnimation;
|
||||
TSTR animName = TSTR(name) + TSTR("_anim_") + TSTR(mtl->GetGlobalVarName());
|
||||
plString animName = plString::Format("%s_anim_%s", name.c_str(), mtl->GetGlobalVarName());
|
||||
hsgResMgr::ResMgr()->NewKey(animName, SDLLayer, node->GetLocation());
|
||||
|
||||
SDLLayer->SetVarName((char*)mtl->GetGlobalVarName());
|
||||
@ -2193,10 +2188,11 @@ plLayerInterface* IProcessAnimation(plPassMtlBase *mtl, plMaxNode *node, const c
|
||||
plLayerAnimation *noteAnim = new plLayerAnimation;
|
||||
node->CheckSynchOptions(noteAnim);
|
||||
|
||||
const char *segName = stealth->GetSegmentName();
|
||||
bool isDefault = ( segName == nil || strcmp( segName, ENTIRE_ANIMATION_NAME ) == 0 ) ? true : false;
|
||||
plString segName = stealth->GetSegmentName();
|
||||
bool isDefault = ( segName.IsNull() || segName.Compare( ENTIRE_ANIMATION_NAME ) == 0 ) ? true : false;
|
||||
|
||||
TSTR animName = TSTR( name ) + ( ( isDefault ) ? TSTR( "_anim" ) : ( TSTR("_anim_") + TSTR( segName ) ) );
|
||||
plString animName = name + ( ( isDefault ) ? _TEMP_CONVERT_FROM_LITERAL( "_anim" )
|
||||
: ( _TEMP_CONVERT_FROM_LITERAL("_anim_") + segName ) );
|
||||
hsgResMgr::ResMgr()->NewKey( animName, noteAnim, node->GetLocation() );
|
||||
|
||||
plController *noteColCtl = cc.MakeColorController( maxColCtl, node );
|
||||
@ -2221,7 +2217,7 @@ plLayerInterface* IProcessAnimation(plPassMtlBase *mtl, plMaxNode *node, const c
|
||||
|
||||
// Set segment name if we're not the default
|
||||
if( !isDefault )
|
||||
noteAnim->SetSegmentID( (char *)segName );
|
||||
noteAnim->SetSegmentID( segName );
|
||||
|
||||
// And attach!
|
||||
noteAnim->AttachViaNotify( layerIFace );
|
||||
@ -2274,7 +2270,7 @@ int hsMaterialConverter::IFindSubIndex(plMaxNode* node, Mtl* mtl)
|
||||
//
|
||||
|
||||
// Now handles both plPassMtl and plDecalMtl which derive from plPassMtlBase
|
||||
hsBool hsMaterialConverter::IProcessPlasmaMaterial(Mtl *mtl, plMaxNode *node, hsGMaterial *mat, const char* name)
|
||||
hsBool hsMaterialConverter::IProcessPlasmaMaterial(Mtl *mtl, plMaxNode *node, hsGMaterial *mat, const plString& name)
|
||||
{
|
||||
hsGuardBegin("hsMaterialConverter::IProcessPlasmaMaterial");
|
||||
|
||||
@ -2307,13 +2303,13 @@ hsBool hsMaterialConverter::IProcessPlasmaMaterial(Mtl *mtl, plMaxNode *node, hs
|
||||
|
||||
float opac = float(passBase->GetOpacity()) / 100.0f;
|
||||
|
||||
fErrorMsg->Set(opac < 0.0 || opac > 1.0, dbgNodeName, "Bad opacity on mat %s", name).CheckAndAsk();
|
||||
fErrorMsg->Set(dif.r < 0.0 || dif.r > 1.0, dbgNodeName, "Bad color (r) on mat %s", name).CheckAndAsk();
|
||||
fErrorMsg->Set(dif.g < 0.0 || dif.g > 1.0, dbgNodeName, "Bad color (g) on mat %s", name).CheckAndAsk();
|
||||
fErrorMsg->Set(dif.b < 0.0 || dif.b > 1.0, dbgNodeName, "Bad color (b) on mat %s", name).CheckAndAsk();
|
||||
fErrorMsg->Set(runDif.r < 0.0 || runDif.r > 1.0, dbgNodeName, "Bad runtime color (r) on mat %s", name).CheckAndAsk();
|
||||
fErrorMsg->Set(runDif.g < 0.0 || runDif.g > 1.0, dbgNodeName, "Bad runtime color (g) on mat %s", name).CheckAndAsk();
|
||||
fErrorMsg->Set(runDif.b < 0.0 || runDif.b > 1.0, dbgNodeName, "Bad runtime color (b) on mat %s", name).CheckAndAsk();
|
||||
fErrorMsg->Set(opac < 0.0 || opac > 1.0, dbgNodeName, "Bad opacity on mat %s", name.c_str()).CheckAndAsk();
|
||||
fErrorMsg->Set(dif.r < 0.0 || dif.r > 1.0, dbgNodeName, "Bad color (r) on mat %s", name.c_str()).CheckAndAsk();
|
||||
fErrorMsg->Set(dif.g < 0.0 || dif.g > 1.0, dbgNodeName, "Bad color (g) on mat %s", name.c_str()).CheckAndAsk();
|
||||
fErrorMsg->Set(dif.b < 0.0 || dif.b > 1.0, dbgNodeName, "Bad color (b) on mat %s", name.c_str()).CheckAndAsk();
|
||||
fErrorMsg->Set(runDif.r < 0.0 || runDif.r > 1.0, dbgNodeName, "Bad runtime color (r) on mat %s", name.c_str()).CheckAndAsk();
|
||||
fErrorMsg->Set(runDif.g < 0.0 || runDif.g > 1.0, dbgNodeName, "Bad runtime color (g) on mat %s", name.c_str()).CheckAndAsk();
|
||||
fErrorMsg->Set(runDif.b < 0.0 || runDif.b > 1.0, dbgNodeName, "Bad runtime color (b) on mat %s", name.c_str()).CheckAndAsk();
|
||||
|
||||
// Color col = dif - amb;
|
||||
Color col = dif;
|
||||
@ -2778,9 +2774,8 @@ hsGMaterial *hsMaterialConverter::IWrapTextureInMaterial(Texmap *texMap, plMaxNo
|
||||
texMap->GetClassName(className);
|
||||
|
||||
// We want to keep it. Handle appropriately.
|
||||
BitmapTex *bitmapTex = (BitmapTex *)texMap;
|
||||
char txtFileName[256];
|
||||
strcpy(txtFileName, bitmapTex->GetMapName());
|
||||
BitmapTex *bitmapTex = (BitmapTex *)texMap;
|
||||
plString txtFileName = plString::FromUtf8( bitmapTex->GetMapName() );
|
||||
|
||||
// hsRegistryKey* key = hsgResMgr::ResMgr()->FindKey(txtFileName, hsGMaterial::Index());
|
||||
plKey key = node->FindPageKey( hsGMaterial::Index(), txtFileName );
|
||||
@ -3090,8 +3085,7 @@ void hsMaterialConverter::IAppendFunkyLayer(plMaxNode* node, Texmap* texMap, hsG
|
||||
|
||||
plBitmap* funkRamp = IGetFunkyRamp(node, funkyType);
|
||||
|
||||
char name[512];
|
||||
sprintf(name, "%s_funkRamp", prevLay->GetKey()->GetName());
|
||||
plString name = plString::Format("%s_funkRamp", prevLay->GetKey()->GetName().c_str());
|
||||
|
||||
plLayer* layer = new plLayer;
|
||||
layer->InitToDefault();
|
||||
@ -3134,7 +3128,7 @@ void hsMaterialConverter::IAppendFunkyLayer(plMaxNode* node, Texmap* texMap, hsG
|
||||
|
||||
plBitmap* hsMaterialConverter::IGetFunkyRamp(plMaxNode* node, uint32_t funkyType)
|
||||
{
|
||||
const char* funkName = funkyType & kFunkyAdd ? "FunkyRampAdd" : "FunkyRampMult";
|
||||
plString funkName = funkyType & kFunkyAdd ? _TEMP_CONVERT_FROM_LITERAL("FunkyRampAdd") : _TEMP_CONVERT_FROM_LITERAL("FunkyRampMult");
|
||||
|
||||
const int kLUTWidth = 16;
|
||||
const int kLUTHeight = 16;
|
||||
@ -3230,8 +3224,7 @@ void hsMaterialConverter::IAppendWetLayer(plMaxNode* node, hsGMaterial* mat)
|
||||
uvwXfm.fMap[1][2] = -1.f / (tr - op);
|
||||
uvwXfm.fMap[1][3] = uvwXfm.fMap[1][2] * -tr;
|
||||
|
||||
char name[512];
|
||||
sprintf(name, "%s_funkRamp", prevLay->GetKey()->GetName());
|
||||
plString name = plString::Format("%s_funkRamp", prevLay->GetKey()->GetName().c_str());
|
||||
|
||||
plLayer* layer = nil;
|
||||
plKey key = node->FindPageKey( plLayer::Index(), name );
|
||||
@ -3517,7 +3510,7 @@ BitmapTex* hsMaterialConverter::GetBumpLayer(plMaxNode* node, Mtl* mtl)
|
||||
|
||||
plMipmap *hsMaterialConverter::IGetBumpLutTexture(plMaxNode *node)
|
||||
{
|
||||
const char* texName = "BumpLutTexture";
|
||||
const plString texName = _TEMP_CONVERT_FROM_LITERAL("BumpLutTexture");
|
||||
|
||||
//#define FUNKYBUMP
|
||||
#ifndef FUNKYBUMP
|
||||
@ -3697,19 +3690,19 @@ plMipmap *hsMaterialConverter::IGetBumpLutTexture(plMaxNode *node)
|
||||
return texture;
|
||||
}
|
||||
|
||||
plLayer* hsMaterialConverter::IMakeBumpLayer(plMaxNode* node, const char* nameBase, hsGMaterial* mat, uint32_t miscFlag)
|
||||
plLayer* hsMaterialConverter::IMakeBumpLayer(plMaxNode* node, const plString& nameBase, hsGMaterial* mat, uint32_t miscFlag)
|
||||
{
|
||||
char name[256];
|
||||
plString name;
|
||||
switch( miscFlag & hsGMatState::kMiscBumpChans )
|
||||
{
|
||||
case hsGMatState::kMiscBumpDu:
|
||||
sprintf(name, "%s_DU_BumpLut", nameBase);
|
||||
name = plString::Format("%s_DU_BumpLut", nameBase.c_str());
|
||||
break;
|
||||
case hsGMatState::kMiscBumpDv:
|
||||
sprintf(name, "%s_DV_BumpLut", nameBase);
|
||||
name = plString::Format("%s_DV_BumpLut", nameBase.c_str());
|
||||
break;
|
||||
case hsGMatState::kMiscBumpDw:
|
||||
sprintf(name, "%s_DW_BumpLut", nameBase);
|
||||
name = plString::Format("%s_DW_BumpLut", nameBase.c_str());
|
||||
break;
|
||||
default:
|
||||
hsAssert(false, "Bogus flag input to MakeBumpLayer");
|
||||
@ -3787,7 +3780,7 @@ void hsMaterialConverter::IInsertBumpLayers(plMaxNode* node, hsGMaterial* mat, i
|
||||
(bumpLay->GetBlendFlags() & ~hsGMatState::kBlendMask)
|
||||
| hsGMatState::kBlendDot3);
|
||||
|
||||
const char* name = mat->GetLayer(bumpLayerIdx)->GetKey()->GetName();
|
||||
plString name = mat->GetLayer(bumpLayerIdx)->GetKey()->GetName();
|
||||
|
||||
plLayer* layerDu = IMakeBumpLayer(node, name, mat, hsGMatState::kMiscBumpDu);
|
||||
plLayer* layerDv = IMakeBumpLayer(node, name, mat, hsGMatState::kMiscBumpDv);
|
||||
@ -4532,7 +4525,7 @@ void hsMaterialConverter::CollectConvertedMaterials(Mtl *mtl, hsTArray<hsGMateri
|
||||
|
||||
plClothingItem *hsMaterialConverter::GenerateClothingItem(plClothingMtl *mtl, const plLocation &loc)
|
||||
{
|
||||
char clothKeyName[256];
|
||||
plString clothKeyName;
|
||||
plClothingItem *cloth = new plClothingItem();
|
||||
cloth->SetName(mtl->GetName());
|
||||
cloth->fSortOrder = (mtl->GetDefault() ? 0 : 1);
|
||||
@ -4550,7 +4543,7 @@ plClothingItem *hsMaterialConverter::GenerateClothingItem(plClothingMtl *mtl, co
|
||||
cloth->fDefaultTint2[1] = tint2.g * 255;
|
||||
cloth->fDefaultTint2[2] = tint2.b * 255;
|
||||
|
||||
sprintf(clothKeyName, "CItm_%s", cloth->fName);
|
||||
clothKeyName = plString::Format("CItm_%s", cloth->fName);
|
||||
hsgResMgr::ResMgr()->NewKey(clothKeyName, cloth, loc);
|
||||
|
||||
plNodeRefMsg* nodeRefMsg = new plNodeRefMsg(plKeyFinder::Instance().FindSceneNodeKey(loc),
|
||||
@ -4629,7 +4622,7 @@ static int ICompareBaseLayerTexture(const hsMaterialConverter::DoneMaterialData*
|
||||
if( !oneTex && twoTex )
|
||||
return -1;
|
||||
|
||||
return _stricmp(oneTex->GetKey()->GetName(), twoTex->GetKey()->GetName());
|
||||
return oneTex->GetKey()->GetName().Compare(twoTex->GetKey()->GetName(), plString::kCaseInsensitive);
|
||||
}
|
||||
|
||||
static int IIsAnimatedLayer(const plLayerInterface* lay)
|
||||
@ -4686,7 +4679,7 @@ static int ICompareDoneLayers(const plLayerInterface* one, const plLayerInterfac
|
||||
|
||||
if( one->GetTexture() && two->GetTexture() )
|
||||
{
|
||||
retVal = _stricmp(one->GetTexture()->GetKey()->GetName(), two->GetTexture()->GetKey()->GetName());
|
||||
retVal = one->GetTexture()->GetKey()->GetName().Compare(two->GetTexture()->GetKey()->GetName(), plString::kCaseInsensitive);
|
||||
if( retVal < 0 )
|
||||
return -1;
|
||||
else if( retVal > 0 )
|
||||
@ -4957,8 +4950,8 @@ void hsMaterialConverter::IPrintDoneMat(hsStream* stream, const char* prefix, Do
|
||||
layer->GetLODBias());
|
||||
stream->WriteString(buff);
|
||||
|
||||
sprintf(buff, "\t\t\tTexture %s\n", layer->GetTexture() && layer->GetTexture()->GetKey() && layer->GetTexture()->GetKey()->GetName()
|
||||
? layer->GetTexture()->GetKey()->GetName()
|
||||
sprintf(buff, "\t\t\tTexture %s\n", layer->GetTexture() && layer->GetTexture()->GetKey()
|
||||
? layer->GetTexture()->GetKey()->GetName().s_str("None")
|
||||
: "None");
|
||||
stream->WriteString(buff);
|
||||
|
||||
@ -5139,9 +5132,8 @@ hsMaterialConverter::DoneMaterialData* hsMaterialConverter::IFindDoneMaterial(Do
|
||||
|
||||
plMipmap *hsMaterialConverter::GetStaticColorTexture(Color c, plLocation &loc)
|
||||
{
|
||||
char texName[256];
|
||||
uint32_t colorHex = MakeUInt32Color(c.r, c.g, c.b, 1.f);
|
||||
sprintf(texName, "StaticColorTex_4x4_%X", colorHex);
|
||||
plString texName = plString::Format("StaticColorTex_4x4_%X", colorHex);
|
||||
|
||||
int w = 4;
|
||||
int h = 4;
|
||||
|
@ -63,6 +63,7 @@ class hsGAnimLayer;
|
||||
class plBitmap;
|
||||
class plMipmap;
|
||||
class plErrorMsg;
|
||||
class plString;
|
||||
|
||||
class Mtl;
|
||||
class Texmap;
|
||||
@ -138,10 +139,10 @@ public:
|
||||
static int GetCoordMapping(StdUVGen *uvgen);
|
||||
static void GetNodesByMaterial(Mtl *mtl, hsTArray<plMaxNode*> &out);
|
||||
|
||||
static uint32_t VertexChannelsRequestMask(plMaxNode* node, int iSubMtl, Mtl* mtl);
|
||||
static uint32_t VertexChannelsRequiredMask(plMaxNode* node, int iSubMtl);
|
||||
static uint32_t VertexChannelsRequestMask(plMaxNode* node, int iSubMtl, Mtl* mtl);
|
||||
static uint32_t VertexChannelsRequiredMask(plMaxNode* node, int iSubMtl);
|
||||
static int NumVertexOpacityChannelsRequired(plMaxNode* node, int iSubMtl);
|
||||
static uint32_t ColorChannelsUseMask(plMaxNode* node, int iSubMtl);
|
||||
static uint32_t ColorChannelsUseMask(plMaxNode* node, int iSubMtl);
|
||||
static int MaxUsedUVWSrc(plMaxNode* node, Mtl* mtl);
|
||||
|
||||
|
||||
@ -235,7 +236,7 @@ enum {
|
||||
hsBool fSubMultiMat;
|
||||
hsBool fOwnedCopy;
|
||||
hsBool fRuntimeLit;
|
||||
uint32_t fSubMtlFlags;
|
||||
uint32_t fSubMtlFlags;
|
||||
int fNumUVChannels;
|
||||
hsBool fMakeAlphaLayer;
|
||||
};
|
||||
@ -265,21 +266,21 @@ private:
|
||||
void IInsertSingleBlendLayer(plMipmap *texture, hsGMaterial *mat, plMaxNode *node,
|
||||
int layerIdx, int UVChan);
|
||||
|
||||
hsGMaterial *ICreateMaterial(Mtl *mtl, plMaxNode *node, const char *name, int subIndex, int numUVChannels, hsBool makeAlphaLayer);
|
||||
hsGMaterial *IProcessMaterial(Mtl *mtl, plMaxNode *node, const char *name, int UVChan, int subMtlFlags = 0);
|
||||
hsGMaterial *ICreateMaterial(Mtl *mtl, plMaxNode *node, const plString &name, int subIndex, int numUVChannels, hsBool makeAlphaLayer);
|
||||
hsGMaterial *IProcessMaterial(Mtl *mtl, plMaxNode *node, const plString &name, int UVChan, int subMtlFlags = 0);
|
||||
|
||||
// ... calls one of:
|
||||
hsGMaterial *IProcessMultipassMtl(Mtl *mtl, plMaxNode *node, const char *name, int UVChan);
|
||||
hsGMaterial *IProcessCompositeMtl(Mtl *mtl, plMaxNode *node, const char *name, int UVChan, int subMtlFlags);
|
||||
hsGMaterial *IProcessParticleMtl(Mtl *mtl, plMaxNode *node, const char *name);
|
||||
hsBool IProcessPlasmaMaterial(Mtl *mtl, plMaxNode *node, hsGMaterial *mat, const char* namePrefix);
|
||||
hsGMaterial *IProcessMultipassMtl(Mtl *mtl, plMaxNode *node, const plString &name, int UVChan);
|
||||
hsGMaterial *IProcessCompositeMtl(Mtl *mtl, plMaxNode *node, const plString &name, int UVChan, int subMtlFlags);
|
||||
hsGMaterial *IProcessParticleMtl(Mtl *mtl, plMaxNode *node, const plString &name);
|
||||
hsBool IProcessPlasmaMaterial(Mtl *mtl, plMaxNode *node, hsGMaterial *mat, const plString& namePrefix);
|
||||
|
||||
hsGMaterial* IInsertDoneMaterial(Mtl *mtl, hsGMaterial *hMat, plMaxNode *node, hsBool isMultiMat,
|
||||
hsBool forceCopy, hsBool runtimeLit, uint32_t subMtlFlags, int numUVChannels, hsBool makeAlphaLayer);
|
||||
|
||||
void IInsertBumpLayers(plMaxNode* node, hsGMaterial* mat, int bumpLayerIdx);
|
||||
void IInsertBumpLayers(plMaxNode* node, hsGMaterial* mat);
|
||||
plLayer* IMakeBumpLayer(plMaxNode* node, const char* nameBase, hsGMaterial* mat, uint32_t miscFlag);
|
||||
plLayer* IMakeBumpLayer(plMaxNode* node, const plString& nameBase, hsGMaterial* mat, uint32_t miscFlag);
|
||||
plMipmap* IGetBumpLutTexture(plMaxNode* node);
|
||||
|
||||
hsBool IHasSubMtl(Mtl* base, Mtl* sub);
|
||||
@ -328,19 +329,19 @@ private:
|
||||
static plBitmap* IGetFunkyRamp(plMaxNode* node, uint32_t funkyType);
|
||||
static void IAppendFunkyLayer(plMaxNode* node, Texmap* texMap, hsGMaterial* mat);
|
||||
static hsBool IHasFunkyOpacity(plMaxNode* node, Texmap* texMap);
|
||||
static uint32_t IGetFunkyType(Texmap* texMap);
|
||||
static uint32_t IGetOpacityRanges(plMaxNode* node, Texmap* texMap, float& tr0, float& op0, float& op1, float& tr1);
|
||||
static uint32_t IGetFunkyType(Texmap* texMap);
|
||||
static uint32_t IGetOpacityRanges(plMaxNode* node, Texmap* texMap, float& tr0, float& op0, float& op1, float& tr1);
|
||||
|
||||
Interface *fInterface;
|
||||
hsConverterUtils& fConverterUtils;
|
||||
hsBool fSave;
|
||||
plErrorMsg *fErrorMsg;
|
||||
|
||||
int32_t fSubIndex;
|
||||
int32_t fSubIndex;
|
||||
hsBool fChangedTimes;
|
||||
|
||||
char *fNodeName;
|
||||
uint32_t fWarned;
|
||||
uint32_t fWarned;
|
||||
|
||||
|
||||
DoneMaterialData fLastMaterial;
|
||||
|
@ -521,7 +521,8 @@ plBitmap *plBitmapCreator::ICreateTexture( plBitmapData *bd, const plLocation &l
|
||||
}
|
||||
|
||||
// Get and mangle key name
|
||||
char name[ 256 ], temp[ 256 ];
|
||||
plString name;
|
||||
char temp[ 256 ];
|
||||
_splitpath(bd->fileName, NULL, NULL, temp, NULL);
|
||||
|
||||
// Somehow, sometimes, we get the same file in with different cases. So we need to force the
|
||||
@ -534,21 +535,21 @@ plBitmap *plBitmapCreator::ICreateTexture( plBitmapData *bd, const plLocation &l
|
||||
{
|
||||
// Mangle of the form: name@dropStart&dropStop&max&min
|
||||
if( clipID != -1 )
|
||||
sprintf( name, "%s*%x#%d@%s&%3.2f&%3.2f&%3.2f&%3.2f", temp, bd->texFlags, clipID,
|
||||
name = plString::Format( "%s*%x#%d@%s&%3.2f&%3.2f&%3.2f&%3.2f", temp, bd->texFlags, clipID,
|
||||
bd->createFlags & plMipmap::kCreateDetailAlpha ? "al" : ( bd->createFlags & plMipmap::kCreateDetailAdd ? "ad" : "mu" ),
|
||||
bd->detailDropoffStart, bd->detailDropoffStop, bd->detailMax, bd->detailMin );
|
||||
else
|
||||
sprintf( name, "%s*%x@%s&%3.2f&%3.2f&%3.2f&%3.2f", temp, bd->texFlags,
|
||||
name = plString::Format( "%s*%x@%s&%3.2f&%3.2f&%3.2f&%3.2f", temp, bd->texFlags,
|
||||
bd->createFlags & plMipmap::kCreateDetailAlpha ? "al" : ( bd->createFlags == plMipmap::kCreateDetailAdd ? "ad" : "mu" ),
|
||||
bd->detailDropoffStart, bd->detailDropoffStop, bd->detailMax, bd->detailMin );
|
||||
}
|
||||
else if( clipID != -1 )
|
||||
sprintf( name, "%s*%x#%d", temp, bd->texFlags, clipID );
|
||||
name = plString::Format( "%s*%x#%d", temp, bd->texFlags, clipID );
|
||||
else
|
||||
sprintf( name, "%s*%x", temp, bd->texFlags );
|
||||
name = plString::Format( "%s*%x", temp, bd->texFlags );
|
||||
if( bd->invertAlpha )
|
||||
strcat( name, "_inva" );
|
||||
strcat( name, ".hsm" );
|
||||
name += _TEMP_CONVERT_FROM_LITERAL( "_inva" );
|
||||
name += _TEMP_CONVERT_FROM_LITERAL( ".hsm" );
|
||||
|
||||
|
||||
// Has this texture been used before?
|
||||
@ -672,7 +673,7 @@ void plBitmapCreator::IAddBitmap( plBitmap *bitmap, hsBool dontRef )
|
||||
// of "converted" maps to clean up at the end of export.
|
||||
|
||||
plMipmap *plBitmapCreator::CreateBlankMipmap( uint32_t width, uint32_t height, unsigned config, uint8_t numLevels,
|
||||
const char *keyName, const plLocation &keyLocation )
|
||||
const plString &keyName, const plLocation &keyLocation )
|
||||
{
|
||||
hsGuardBegin( "plBitmapCreator::CreateBlankMipmap" );
|
||||
|
||||
|
@ -100,7 +100,7 @@ class plBitmapCreator
|
||||
static plBitmapCreator &Instance();
|
||||
|
||||
plBitmap *CreateTexture( plBitmapData *bd, const plLocation &loc, int clipID = -1 );
|
||||
plMipmap *CreateBlankMipmap( uint32_t width, uint32_t height, unsigned config, uint8_t numLevels, const char *keyName, const plLocation &keyLocation );
|
||||
plMipmap *CreateBlankMipmap( uint32_t width, uint32_t height, unsigned config, uint8_t numLevels, const plString &keyName, const plLocation &keyLocation );
|
||||
|
||||
void Init( hsBool save, plErrorMsg *msg );
|
||||
void DeInit( void );
|
||||
|
@ -106,8 +106,7 @@ plClusterGroup* plClusterUtil::CreateGroup(plMaxNode* templNode, const char* nam
|
||||
{
|
||||
plClusterGroup* retVal = new plClusterGroup;
|
||||
|
||||
char buff[256];
|
||||
sprintf(buff, "%s_%s_%d", name, templNode->GetName(), fIdx++);
|
||||
plString buff = plString::Format("%s_%s_%d", name, templNode->GetName(), fIdx++);
|
||||
hsgResMgr::ResMgr()->NewKey(buff, retVal, templNode->GetLocation(), templNode->GetLoadMask());
|
||||
|
||||
plKey sceneNode = templNode->GetRoomKey();
|
||||
|
@ -295,7 +295,7 @@ plLayerInterface *plLayerConverter::IConvertLayerTex( plPlasmaMAXLayer *layer
|
||||
}
|
||||
|
||||
// Get a new layer to play with
|
||||
plLayer *plasmaLayer = ICreateLayer( layer->GetName(), upperLayer, loc );
|
||||
plLayer *plasmaLayer = ICreateLayer( plString::FromUtf8( layer->GetName() ), upperLayer, loc );
|
||||
|
||||
// We're using a texture, try and get its info
|
||||
PBBitmap *pbbm = nil;
|
||||
@ -430,7 +430,7 @@ plLayerInterface *plLayerConverter::IConvertStaticEnvLayer( plPlasmaMAXLayer
|
||||
}
|
||||
|
||||
// Get a new layer to play with
|
||||
plLayer *plasmaLayer = ICreateLayer( layer->GetName(), upperLayer, loc );
|
||||
plLayer *plasmaLayer = ICreateLayer( plString::FromUtf8( layer->GetName() ), upperLayer, loc );
|
||||
|
||||
// Get the texture info
|
||||
PBBitmap *pbbm = bitmapPB->GetBitmap( plStaticEnvLayer::kBmpFrontBitmap + 0 );
|
||||
@ -540,7 +540,7 @@ plLayerInterface *plLayerConverter::IConvertDynamicEnvLayer( plPlasmaMAXLayer
|
||||
}
|
||||
|
||||
// Get a new layer to play with
|
||||
plLayer *plasmaLayer = ICreateLayer( layer->GetName(), upperLayer, loc );
|
||||
plLayer *plasmaLayer = ICreateLayer( plString::FromUtf8( layer->GetName() ), upperLayer, loc );
|
||||
|
||||
// Get the anchor node
|
||||
plMaxNode *anchor = (plMaxNode *)bitmapPB->GetINode( plDynamicEnvLayer::kBmpAnchorNode );
|
||||
@ -550,7 +550,7 @@ plLayerInterface *plLayerConverter::IConvertDynamicEnvLayer( plPlasmaMAXLayer
|
||||
|
||||
if( !anchor->CanConvert() || !( anchor->GetForceLocal() || anchor->GetDrawable() ) )
|
||||
{
|
||||
fErrorMsg->Set( true, "Plasma Layer Error", "The dynamic envMap material %s has an invalid anchor specified. Please specify a valid Plasma scene object as an anchor.", plasmaLayer->GetKeyName() ).Show();
|
||||
fErrorMsg->Set( true, "Plasma Layer Error", "The dynamic envMap material %s has an invalid anchor specified. Please specify a valid Plasma scene object as an anchor.", plasmaLayer->GetKeyName().c_str() ).Show();
|
||||
fErrorMsg->Set();
|
||||
return (plLayerInterface *)plasmaLayer;
|
||||
}
|
||||
@ -563,14 +563,14 @@ plLayerInterface *plLayerConverter::IConvertDynamicEnvLayer( plPlasmaMAXLayer
|
||||
plasmaLayer->SetUVWSrc( plasmaLayer->GetUVWSrc() | plLayerInterface::kUVWReflect );
|
||||
|
||||
// Create the texture. If it works, assign it to the layer
|
||||
char texName[ 256 ];
|
||||
plString texName;
|
||||
if( anchor == maxNode )
|
||||
{
|
||||
// Self-anchoring material, make sure the name is unique via the nodeName
|
||||
sprintf( texName, "%s_cubicRT@%s", plasmaLayer->GetKeyName(), maxNode->GetName() );
|
||||
texName = plString::Format( "%s_cubicRT@%s", plasmaLayer->GetKeyName().c_str(), maxNode->GetName() );
|
||||
}
|
||||
else
|
||||
sprintf( texName, "%s_cubicRT", plasmaLayer->GetKeyName() );
|
||||
texName = plString::Format( "%s_cubicRT", plasmaLayer->GetKeyName().c_str() );
|
||||
|
||||
plBitmap *texture = (plBitmap *)IMakeCubicRenderTarget( texName, maxNode, anchor );
|
||||
if( texture )
|
||||
@ -606,7 +606,7 @@ plLayerInterface *plLayerConverter::IConvertCameraLayer(plPlasmaMAXLayer *lay
|
||||
return nil;
|
||||
}
|
||||
|
||||
plLayer *plasmaLayer = ICreateLayer (layer->GetName(), upperLayer, loc);
|
||||
plLayer *plasmaLayer = ICreateLayer (plString::FromUtf8(layer->GetName()), upperLayer, loc);
|
||||
|
||||
plMaxNode *rootNode = (plMaxNode*)pb->GetINode(ParamID(plMAXCameraLayer::kRootNode));
|
||||
plDynamicCamMap *map = plEnvMapComponent::GetCamMap(rootNode ? rootNode : maxNode);
|
||||
@ -678,7 +678,7 @@ plLayerInterface *plLayerConverter::IConvertDynamicTextLayer( plPlasmaMAXLaye
|
||||
}
|
||||
|
||||
// Get a new layer to play with
|
||||
plLayer *plasmaLayer = ICreateLayer( maxLayer->GetName(), upperLayer, loc );
|
||||
plLayer *plasmaLayer = ICreateLayer( plString::FromUtf8( maxLayer->GetName() ), upperLayer, loc );
|
||||
|
||||
|
||||
/// UV Gen
|
||||
@ -772,8 +772,7 @@ static uint32_t MakeUInt32Color(float r, float g, float b, float a)
|
||||
|
||||
plBitmap* plLayerConverter::IGetAttenRamp(plMaxNode *node, BOOL isAdd, int loClamp, int hiClamp)
|
||||
{
|
||||
char funkName[512];
|
||||
sprintf(funkName, "%s_%d_%d",
|
||||
plString funkName = plString::Format("%s_%d_%d",
|
||||
isAdd ? "AttenRampAdd" : "AttenRampMult",
|
||||
loClamp,
|
||||
hiClamp);
|
||||
@ -831,7 +830,7 @@ plBitmap* plLayerConverter::IGetAttenRamp(plMaxNode *node, BOOL isAdd, int loCla
|
||||
}
|
||||
|
||||
|
||||
plLayer* plLayerConverter::ICreateAttenuationLayer(const char* name, plMaxNode *node, int uvwSrc,
|
||||
plLayer* plLayerConverter::ICreateAttenuationLayer(const plString& name, plMaxNode *node, int uvwSrc,
|
||||
float tr0, float op0, float tr1, float op1,
|
||||
int loClamp, int hiClamp)
|
||||
{
|
||||
@ -917,7 +916,7 @@ plLayerInterface* plLayerConverter::IConvertAngleAttenLayer(plPlasmaMAXLayer *la
|
||||
|
||||
int uvwSrc = aaLay->Reflect() ? plLayerInterface::kUVWReflect : plLayerInterface::kUVWNormal;
|
||||
|
||||
plLayer* lut = ICreateAttenuationLayer(layer->GetName(), maxNode, uvwSrc, tr0, op0, tr1, op1, loClamp, hiClamp);
|
||||
plLayer* lut = ICreateAttenuationLayer(plString::FromUtf8(layer->GetName()), maxNode, uvwSrc, tr0, op0, tr1, op1, loClamp, hiClamp);
|
||||
|
||||
return lut;
|
||||
|
||||
@ -925,7 +924,7 @@ plLayerInterface* plLayerConverter::IConvertAngleAttenLayer(plPlasmaMAXLayer *la
|
||||
}
|
||||
//// ICreateLayer /////////////////////////////////////////////////////////////
|
||||
|
||||
plLayer *plLayerConverter::ICreateLayer( const char *name, hsBool upperLayer, plLocation &loc )
|
||||
plLayer *plLayerConverter::ICreateLayer( const plString &name, hsBool upperLayer, plLocation &loc )
|
||||
{
|
||||
hsGuardBegin( "plPlasmaMAXLayer::ICreateLayer" );
|
||||
|
||||
@ -969,11 +968,11 @@ void plLayerConverter::IProcessUVGen( plPlasmaMAXLayer *srcLayer, plLayer *de
|
||||
// UVW Src
|
||||
int32_t uvwSrc = srcLayer->GetMapChannel() - 1;
|
||||
|
||||
if( fErrorMsg->Set( !( fWarned & kWarnedTooManyUVs ) &&
|
||||
( ( uvwSrc < 0 ) || ( uvwSrc >= plGeometrySpan::kMaxNumUVChannels ) ),
|
||||
destLayer->GetKeyName(), "Only %d UVW channels (1-%d) currently supported",
|
||||
if( fErrorMsg->Set( !( fWarned & kWarnedTooManyUVs ) &&
|
||||
( ( uvwSrc < 0 ) || ( uvwSrc >= plGeometrySpan::kMaxNumUVChannels ) ),
|
||||
destLayer->GetKeyName().c_str(), "Only %d UVW channels (1-%d) currently supported",
|
||||
plGeometrySpan::kMaxNumUVChannels, plGeometrySpan::kMaxNumUVChannels).CheckAskOrCancel() )
|
||||
fWarned |= kWarnedTooManyUVs;
|
||||
fWarned |= kWarnedTooManyUVs;
|
||||
fErrorMsg->Set( false );
|
||||
|
||||
destLayer->SetUVWSrc( uvwSrc );
|
||||
@ -989,19 +988,18 @@ void plLayerConverter::IProcessUVGen( plPlasmaMAXLayer *srcLayer, plLayer *de
|
||||
|
||||
//// ICreateDynTextMap ////////////////////////////////////////////////////////
|
||||
|
||||
plDynamicTextMap *plLayerConverter::ICreateDynTextMap( const char *layerName, uint32_t width, uint32_t height,
|
||||
plDynamicTextMap *plLayerConverter::ICreateDynTextMap( const plString &layerName, uint32_t width, uint32_t height,
|
||||
hsBool includeAlphaChannel, plMaxNode *node )
|
||||
{
|
||||
hsGuardBegin( "plPlasmaMAXLayer::ICreateDynTextMap" );
|
||||
|
||||
char texName[ 256 ];
|
||||
plKey key;
|
||||
plDynamicTextMap *map = nil;
|
||||
|
||||
|
||||
// Need a unique key name for every layer that uses one. We could also key
|
||||
// off of width and height, but layerName should be more than plenty
|
||||
sprintf( texName, "%s_dynText", layerName );
|
||||
plString texName = plString::Format( "%s_dynText", layerName );
|
||||
|
||||
// Does it already exist?
|
||||
key = node->FindPageKey( plDynamicTextMap::Index(), texName );
|
||||
@ -1086,13 +1084,12 @@ plLayer *plLayerConverter::IAssignTexture( plBitmapData *bd, plMaxNode *maxNode,
|
||||
// Makes a plCubicRenderTarget as a texture. Also constructs the associated
|
||||
// modifier and attaches it to the necessary object (hacked for now)
|
||||
|
||||
plCubicRenderTarget *plLayerConverter::IMakeCubicRenderTarget( const char *name, plMaxNode *node, plMaxNode *anchor )
|
||||
plCubicRenderTarget *plLayerConverter::IMakeCubicRenderTarget( const plString &name, plMaxNode *node, plMaxNode *anchor )
|
||||
{
|
||||
plDynamicEnvMap* env = plEnvMapComponent::GetEnvMap(anchor);
|
||||
if( env )
|
||||
return env;
|
||||
|
||||
char modName[ 256 ];
|
||||
plCubicRenderTarget *cubic = nil;
|
||||
|
||||
|
||||
@ -1123,7 +1120,7 @@ plCubicRenderTarget *plLayerConverter::IMakeCubicRenderTarget( const char *name,
|
||||
|
||||
/// Now make a modifier
|
||||
plCubicRenderTargetModifier *mod = new plCubicRenderTargetModifier();
|
||||
sprintf( modName, "%s_mod", name );
|
||||
plString modName = plString::Format( "%s_mod", name.c_str() );
|
||||
|
||||
hsgResMgr::ResMgr()->NewKey( modName, mod, node->GetLocation() );
|
||||
hsgResMgr::ResMgr()->AddViaNotify( cubic->GetKey(), new plGenRefMsg( mod->GetKey(), plRefMsg::kOnCreate, 0, 0 ), plRefFlags::kPassiveRef );
|
||||
|
@ -72,6 +72,7 @@ class plBitmap;
|
||||
class plCubicRenderTarget;
|
||||
class hsConverterUtils;
|
||||
class plDynamicTextLayer;
|
||||
class plString;
|
||||
|
||||
class plLayerConverter
|
||||
{
|
||||
@ -112,12 +113,12 @@ class plLayerConverter
|
||||
hsTArray<plPlasmaMAXLayer *> fConvertedLayers;
|
||||
|
||||
|
||||
plLayer *ICreateLayer( const char *name, hsBool upperLayer, plLocation &loc );
|
||||
plLayer *ICreateLayer( const plString &name, hsBool upperLayer, plLocation &loc );
|
||||
void IProcessUVGen( plPlasmaMAXLayer *srcLayer, plLayer *destLayer, plBitmapData *bitmapData, hsBool preserveUVOffset );
|
||||
plDynamicTextMap *ICreateDynTextMap( const char *layerName, uint32_t width, uint32_t height, hsBool includeAlpha, plMaxNode *node );
|
||||
plDynamicTextMap *ICreateDynTextMap( const plString &layerName, uint32_t width, uint32_t height, hsBool includeAlpha, plMaxNode *node );
|
||||
|
||||
plLayer *IAssignTexture( plBitmapData *bd, plMaxNode *maxNode, plLayer *destLayer, hsBool upperLayer, int clipID = -1 );
|
||||
plCubicRenderTarget *IMakeCubicRenderTarget( const char *name, plMaxNode *maxNode, plMaxNode *anchor );
|
||||
plCubicRenderTarget *IMakeCubicRenderTarget( const plString &name, plMaxNode *maxNode, plMaxNode *anchor );
|
||||
|
||||
// Add your function to process your layer type here
|
||||
plLayerInterface *IConvertLayerTex( plPlasmaMAXLayer *layer, plMaxNode *maxNode, uint32_t blendFlags, hsBool preserveUVOffset, hsBool upperLayer );
|
||||
@ -127,12 +128,12 @@ class plLayerConverter
|
||||
plLayerInterface *IConvertDynamicTextLayer( plPlasmaMAXLayer *layer, plMaxNode *maxNode, uint32_t blendFlags, hsBool preserveUVOffset, hsBool upperLayer );
|
||||
|
||||
plBitmap* IGetAttenRamp( plMaxNode *maxNode, BOOL isAdd, int loClamp, int hiClamp);
|
||||
plLayer* ICreateAttenuationLayer(const char* name, plMaxNode *maxNode, int uvwSrc, float tr0, float op0, float tr1, float op1, int loClamp, int hiClamp);
|
||||
plLayer* ICreateAttenuationLayer(const plString& name, plMaxNode *maxNode, int uvwSrc, float tr0, float op0, float tr1, float op1, int loClamp, int hiClamp);
|
||||
plLayerInterface* IConvertAngleAttenLayer(plPlasmaMAXLayer *layer, plMaxNode *maxNode, uint32_t blendFlags, hsBool preserveUVOffset, hsBool upperLayer);
|
||||
|
||||
void IRegisterConversion( plPlasmaMAXLayer *origLayer, plLayerInterface *convertedLayer );
|
||||
|
||||
uint32_t *IGetInitBitmapBuffer( plDynamicTextLayer *layer ) const;
|
||||
uint32_t *IGetInitBitmapBuffer( plDynamicTextLayer *layer ) const;
|
||||
|
||||
};
|
||||
|
||||
|
@ -365,8 +365,7 @@ hsBool plLightMapGen::ICompressLightMaps()
|
||||
{
|
||||
const plLocation &textureLoc = plPluginResManager::ResMgr()->GetCommonPage(orig->GetKey()->GetUoid().GetLocation(),
|
||||
plAgeDescription::kTextures );
|
||||
char name[512];
|
||||
sprintf(name, "%s_DX", orig->GetKey()->GetName());
|
||||
plString name = plString::Format("%s_DX", orig->GetKey()->GetName().c_str());
|
||||
|
||||
plKey compKey = hsgResMgr::ResMgr()->FindKey(plUoid(textureLoc, plMipmap::Index(), name));
|
||||
if( compKey )
|
||||
@ -1252,8 +1251,7 @@ plLayerInterface* plLightMapGen::IMakeLightMapLayer(plMaxNode* node, plGeometryS
|
||||
return mat->GetPiggyBack(i);
|
||||
}
|
||||
|
||||
char newMatName[256];
|
||||
sprintf(newMatName, "%s_%s_LIGHTMAPGEN", mat->GetKey()->GetName(), node->GetName());
|
||||
plString newMatName = plString::Format("%s_%s_LIGHTMAPGEN", mat->GetKey()->GetName().c_str(), node->GetName());
|
||||
plLocation nodeLoc = node->GetLocation();
|
||||
|
||||
plKey matKey = hsgResMgr::ResMgr()->FindKey(plUoid(nodeLoc, hsGMaterial::Index(), newMatName));
|
||||
@ -1291,8 +1289,7 @@ plLayerInterface* plLightMapGen::IMakeLightMapLayer(plMaxNode* node, plGeometryS
|
||||
// Make sure layer (and mip) name are unique across pages by putting the page name in
|
||||
const plPageInfo* pageInfo = plKeyFinder::Instance().GetLocationInfo(node->GetLocation());
|
||||
|
||||
char layName[256];
|
||||
sprintf(layName, "%s_%s_LIGHTMAPGEN", pageInfo->GetPage(), node->GetName());
|
||||
plString layName = plString::Format("%s_%s_LIGHTMAPGEN", pageInfo->GetPage(), node->GetName());
|
||||
|
||||
plKey layKey = node->FindPageKey(plLayer::Index(), layName);
|
||||
|
||||
@ -1309,8 +1306,7 @@ plLayerInterface* plLightMapGen::IMakeLightMapLayer(plMaxNode* node, plGeometryS
|
||||
}
|
||||
else
|
||||
{
|
||||
char mipmapName[ 256 ];
|
||||
sprintf( mipmapName, "%s_mip", layName );
|
||||
plString mipmapName = plString::Format( "%s_mip", layName.c_str() );
|
||||
|
||||
// Deleted the NOTE here because it was incorrect in every meaningful sense of the word. - mf
|
||||
|
||||
@ -1320,8 +1316,7 @@ plLayerInterface* plLightMapGen::IMakeLightMapLayer(plMaxNode* node, plGeometryS
|
||||
|
||||
if( !mipKey && !fRecalcLightMaps )
|
||||
{
|
||||
char compressedName[512];
|
||||
sprintf(compressedName, "%s_DX", mipmapName);
|
||||
plString compressedName = plString::Format("%s_DX", mipmapName.c_str());
|
||||
|
||||
plKey compKey = hsgResMgr::ResMgr()->FindKey(plUoid(textureLoc, plMipmap::Index(), compressedName));
|
||||
|
||||
|
Reference in New Issue
Block a user