1
0
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-17 10:52:46 +00:00

Fix string usage that was broken from enabling the Max plugin build

This commit is contained in:
2012-02-05 21:53:54 -08:00
parent bb0ed04a52
commit be4b0732d5
129 changed files with 952 additions and 1109 deletions

View File

@ -62,7 +62,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
//// Helpers /////////////////////////////////////////////////////////////////
static void ISearchLayerRecur( plLayerInterface *layer, const char *segName, hsTArray<plKey>& keys )
static void ISearchLayerRecur( plLayerInterface *layer, const plString &segName, hsTArray<plKey>& keys )
{
if( !layer )
return;
@ -70,10 +70,8 @@ static void ISearchLayerRecur( plLayerInterface *layer, const char *segName, hsT
plLayerAnimation *animLayer = plLayerAnimation::ConvertNoRef(layer);
if (animLayer)
{
char *ID = animLayer->GetSegmentID();
if (ID == nil)
ID = "";
if (!strcmp(ID, segName))
plString ID = animLayer->GetSegmentID();
if (!ID.Compare(segName))
{
if( keys.kMissingIndex == keys.Find(animLayer->GetKey()) )
keys.Append(animLayer->GetKey());
@ -83,17 +81,16 @@ static void ISearchLayerRecur( plLayerInterface *layer, const char *segName, hsT
ISearchLayerRecur(layer->GetAttached(), segName, keys);
}
static int ISearchLayerRecur(hsGMaterial* mat, const char *segName, hsTArray<plKey>& keys)
static int ISearchLayerRecur(hsGMaterial* mat, const plString &segName, hsTArray<plKey>& keys)
{
if (segName == nil || strcmp( segName, ENTIRE_ANIMATION_NAME ) == 0 )
segName = "";
plString name = (segName.IsNull() || segName.Compare( ENTIRE_ANIMATION_NAME ) == 0 ) ? _TEMP_CONVERT_FROM_LITERAL( "" ) : segName;
int i;
for( i = 0; i < mat->GetNumLayers(); i++ )
ISearchLayerRecur(mat->GetLayer(i), segName, keys);
ISearchLayerRecur(mat->GetLayer(i), name, keys);
return keys.GetCount();
}
static int GetMatAnimModKey(Mtl* mtl, plMaxNodeBase* node, const char* segName, hsTArray<plKey>& keys)
static int GetMatAnimModKey(Mtl* mtl, plMaxNodeBase* node, const plString& segName, hsTArray<plKey>& keys)
{
int retVal = 0;
@ -129,8 +126,8 @@ SegmentSpec *plAnimStealthNode::IGetSegmentSpec( void ) const
{
if( fCachedSegMap != nil )
{
const char *name = GetSegmentName();
if( name != nil )
plString name = GetSegmentName();
if( !name.IsNull() )
{
SegmentMap::iterator i = fCachedSegMap->find( name );
if( i != fCachedSegMap->end() )
@ -167,8 +164,8 @@ void plAnimStealthNode::GetLoopPoints( float &start, float &end ) const
start = GetSegStart();
end = GetSegEnd();
const char *loopName = GetLoopName();
if( loopName != nil && loopName[ 0 ] != 0 && fCachedSegMap != nil )
plString loopName = GetLoopName();
if( !loopName.IsEmpty() && fCachedSegMap != nil )
GetSegMapAnimTime( loopName, fCachedSegMap, SegmentSpec::kLoop, start, end );
}
@ -193,8 +190,8 @@ void plAnimStealthNode::GetAllStopPoints( hsTArray<float> &out )
void plAnimStealthNode::StuffToTimeConvert( plAnimTimeConvert &convert, float maxLength )
{
const char *segName = GetSegmentName();
bool isEntire = ( segName == nil || strcmp( segName, ENTIRE_ANIMATION_NAME ) == 0 ) ? true : false;
plString segName = GetSegmentName();
bool isEntire = ( segName.IsNull() || segName.Compare( ENTIRE_ANIMATION_NAME ) == 0 ) ? true : false;
if( isEntire )
{

View File

@ -250,12 +250,12 @@ plAnimStealthNode *plAnimStealthNode::ConvertToStealth( INode *objNode )
}
const char *plAnimStealthNode::GetSegmentName( void ) const
plString plAnimStealthNode::GetSegmentName( void ) const
{
const char *str = fParamBlock->GetStr( (ParamID)kPBName );
if( str == nil || str[ 0 ] == 0 )
return ENTIRE_ANIMATION_NAME;
return str;
return _TEMP_CONVERT_FROM_LITERAL( ENTIRE_ANIMATION_NAME );
return plString::FromUtf8(str);
}
void plAnimStealthNode::SetSegment( const char *name )
@ -710,8 +710,8 @@ void plStealthDlgProc::ILoadLoops(IParamBlock2 *pb)
int defIdx = SendMessage( hLoops, CB_ADDSTRING, 0, (LPARAM)ENTIRE_ANIMATION_NAME );
SendMessage( hLoops, CB_SETITEMDATA, defIdx, kDefault );
const char *segName = pb->GetStr( (ParamID)plAnimStealthNode::kPBName );
if( segName == nil || fSegMap == nil )
plString segName = plString::FromUtf8( pb->GetStr( (ParamID)plAnimStealthNode::kPBName ) );
if( segName.IsNull() || fSegMap == nil )
{
// Default of "entire animation", no other loop options
SendMessage( hLoops, CB_SETCURSEL, defIdx, 0 );
@ -733,7 +733,7 @@ void plStealthDlgProc::ILoadLoops(IParamBlock2 *pb)
(spec->fEnd == -1 || spec->fEnd <= animSpec->fEnd) )
{
// Add the name
int idx = SendMessage( hLoops, CB_ADDSTRING, 0, (LPARAM)spec->fName );
int idx = SendMessage( hLoops, CB_ADDSTRING, 0, (LPARAM)spec->fName.c_str() );
SendMessage( hLoops, CB_SETITEMDATA, idx, kName );
}
}
@ -878,11 +878,11 @@ void plAnimStealthNode::PickTargetNode( IParamBlock2 *destPB, ParamID destPar
pick.DoPick();
}
const char *plAnimStealthNode::GetIfaceSegmentName( hsBool allowNil )
plString plAnimStealthNode::GetIfaceSegmentName( hsBool allowNil )
{
// When sending messages to material animations, they're already addressed for the right
// layer, no need for a segment name
return nil;
return plString::Null;
}
//// Parameter Access Functions //////////////////////////////////////////////
@ -893,14 +893,11 @@ bool plAnimStealthNode::GetAutoStart( void ) const { return (bool)fParamBlo
void plAnimStealthNode::SetAutoStart( bool b ) { fParamBlock->SetValue( (ParamID)kPBAutoStart, 0, (int)b ); };
bool plAnimStealthNode::GetLoop( void ) const { return fParamBlock->GetInt( (ParamID)kPBLoop ); }
const char *plAnimStealthNode::GetLoopName( void ) const { return fParamBlock->GetStr( (ParamID)kPBLoopName ); }
void plAnimStealthNode::SetLoop( bool b, const char *name )
plString plAnimStealthNode::GetLoopName( void ) const { return plString::FromUtf8( fParamBlock->GetStr( (ParamID)kPBLoopName ) ); }
void plAnimStealthNode::SetLoop( bool b, const plString &name )
{
fParamBlock->SetValue( (ParamID)kPBLoop, 0, (int)b );
if( name == nil )
fParamBlock->SetValue( (ParamID)kPBLoopName, 0, "" );
else
fParamBlock->SetValue( (ParamID)kPBLoopName, 0, (char *)name );
fParamBlock->SetValue( (ParamID)kPBLoopName, 0, (char *)name.s_str() );
}
uint8_t plAnimStealthNode::GetEaseInType( void ) const { return (uint8_t)fParamBlock->GetInt( (ParamID)kPBEaseInType ); }

View File

@ -142,7 +142,7 @@ public:
HWND GetWinDlg( void ) const;
// Interesting functions
const char *GetSegmentName( void ) const;
plString GetSegmentName( void ) const;
void SetSegment( const char *name ); // nil for "entire animation"
// Conversion from stealth's INode to the actual object
@ -203,32 +203,32 @@ public:
void SetAutoStart( bool b );
bool GetLoop( void ) const;
const char *GetLoopName( void ) const;
void SetLoop( bool b, const char *name );
plString GetLoopName( void ) const;
void SetLoop( bool b, const plString &name );
uint8_t GetEaseInType( void ) const;
float GetEaseInLength( void ) const;
float GetEaseInMin( void ) const;
float GetEaseInMax( void ) const;
uint8_t GetEaseInType( void ) const;
float GetEaseInLength( void ) const;
float GetEaseInMin( void ) const;
float GetEaseInMax( void ) const;
void SetEaseIn( uint8_t type, float length, float min, float max );
uint8_t GetEaseOutType( void ) const;
float GetEaseOutLength( void ) const;
float GetEaseOutMin( void ) const;
float GetEaseOutMax( void ) const;
uint8_t GetEaseOutType( void ) const;
float GetEaseOutLength( void ) const;
float GetEaseOutMin( void ) const;
float GetEaseOutMax( void ) const;
void SetEaseOut( uint8_t type, float length, float min, float max );
// Conversion stuff
void GetAllStopPoints( hsTArray<float> &out );
float GetSegStart( void ) const;
float GetSegEnd( void ) const;
float GetSegStart( void ) const;
float GetSegEnd( void ) const;
void GetLoopPoints( float &start, float &end ) const;
void StuffToTimeConvert( plAnimTimeConvert &convert, float maxLength );
// plAnimObjInterface functions
virtual void PickTargetNode( IParamBlock2 *destPB, ParamID destParamID, ParamID typeID );
virtual hsBool IsNodeRestricted( void ) { return true; }
virtual const char *GetIfaceSegmentName( hsBool allowNil );
virtual plString GetIfaceSegmentName( hsBool allowNil );
virtual hsBool GetKeyList( INode *restrictedNode, hsTArray<plKey> &outKeys );
virtual hsBool MightRequireSeparateMaterial( void ) { return true; }

View File

@ -86,7 +86,7 @@ plBumpMtl::plBumpMtl(BOOL loading) : plPassMtlBase( loading )
// If we do this later (like, when the dialog loads) something blows up,
// somewhere in Max. It didn't in 4, it does in 7. This seems to fix it.
if (!loading)
IVerifyStealthPresent(ENTIRE_ANIMATION_NAME);
IVerifyStealthPresent(_TEMP_CONVERT_FROM_LITERAL(ENTIRE_ANIMATION_NAME));
}
ParamDlg* plBumpMtl::CreateParamDlg(HWND hwMtlEdit, IMtlParams *imp)

View File

@ -93,7 +93,7 @@ plDecalMtl::plDecalMtl(BOOL loading) : plPassMtlBase( loading )
// If we do this later (like, when the dialog loads) something blows up,
// somewhere in Max. It didn't in 4, it does in 7. This seems to fix it.
if (!loading)
IVerifyStealthPresent(ENTIRE_ANIMATION_NAME);
IVerifyStealthPresent(_TEMP_CONVERT_FROM_LITERAL(ENTIRE_ANIMATION_NAME));
}
ParamDlg* plDecalMtl::CreateParamDlg(HWND hwMtlEdit, IMtlParams *imp)

View File

@ -289,7 +289,7 @@ void plPassAnimDlgProc::ILoadNames(IParamBlock2 *pb )
plAnimStealthNode *stealth = mtl->IGetStealth( i, false );
if( stealth != nil )
{
int idx = SendMessage( hAnims, CB_ADDSTRING, 0, (LPARAM)stealth->GetSegmentName() );
int idx = SendMessage( hAnims, CB_ADDSTRING, 0, (LPARAM)stealth->GetSegmentName().c_str() );
SendMessage( hAnims, CB_SETITEMDATA, idx, (LPARAM)stealth );
}
}

View File

@ -96,7 +96,7 @@ plPassMtl::plPassMtl(BOOL loading) : plPassMtlBase( loading )
// If we do this later (like, when the dialog loads) something blows up,
// somewhere in Max. It didn't in 4, it does in 7. This seems to fix it.
if (!loading)
IVerifyStealthPresent(ENTIRE_ANIMATION_NAME);
IVerifyStealthPresent(_TEMP_CONVERT_FROM_LITERAL(ENTIRE_ANIMATION_NAME));
}
plPassMtl::~plPassMtl()

View File

@ -181,7 +181,7 @@ plAnimStealthNode *plPassMtlBase::IGetStealth( int index, hsBool update )
return (plAnimStealthNode *)fAnimPB->GetReferenceTarget( (ParamID)kPBAnimStealthNodes, 0, index );
}
plAnimStealthNode *plPassMtlBase::IFindStealth( const char *segmentName )
plAnimStealthNode *plPassMtlBase::IFindStealth( const plString &segmentName )
{
int i;
@ -189,9 +189,9 @@ plAnimStealthNode *plPassMtlBase::IFindStealth( const char *segmentName )
for( i = 0; i < fAnimPB->Count( (ParamID)kPBAnimStealthNodes ); i++ )
{
plAnimStealthNode *node = (plAnimStealthNode *)fAnimPB->GetReferenceTarget( (ParamID)kPBAnimStealthNodes, 0, i );
const char *name = node->GetSegmentName();
plString name = node->GetSegmentName();
if( node != nil && strcmp( name, segmentName ) == 0 )
if( node != nil && name.Compare( segmentName ) == 0 )
{
return node;
}
@ -203,7 +203,7 @@ plAnimStealthNode *plPassMtlBase::IFindStealth( const char *segmentName )
//// IVerifyStealthPresent ///////////////////////////////////////////////////
// Ensures that we have a stealth for the given segment.
plAnimStealthNode *plPassMtlBase::IVerifyStealthPresent( const char *animName )
plAnimStealthNode *plPassMtlBase::IVerifyStealthPresent( const plString &animName )
{
// If we're in the middle of loading, don't check
if (plPostLoadHandler::IsLoading())
@ -215,7 +215,7 @@ plAnimStealthNode *plPassMtlBase::IVerifyStealthPresent( const char *animName
// New segment, add a new stealth node
stealth = (plAnimStealthNode *)GetCOREInterface()->CreateInstance( HELPER_CLASS_ID, ANIMSTEALTH_CLASSID );
INode *node = GetCOREInterface()->CreateObjectNode( stealth );
stealth->SetSegment( ( strcmp(animName, ENTIRE_ANIMATION_NAME) != 0 ) ? animName : nil );
stealth->SetSegment( ( animName.Compare(ENTIRE_ANIMATION_NAME) != 0 ) ? _TEMP_CONVERT_TO_CONST_CHAR(animName) : nil );
stealth->SetNodeName( GetName() );
node->Freeze( true );
@ -231,7 +231,7 @@ plAnimStealthNode *plPassMtlBase::IVerifyStealthPresent( const char *animName
fAnimPB->Append( (ParamID)kPBAnimStealthNodes, 1, (ReferenceTarget **)&stealth );
const char *realName = stealth->GetSegmentName();
plString realName = stealth->GetSegmentName();
fStealthsChanged = true;
}
@ -277,7 +277,7 @@ void plPassMtlBase::IUpdateAnimNodes( void )
fStealthsChanged = false;
// Verify one for "entire animation"
plAnimStealthNode *stealth = IVerifyStealthPresent( ENTIRE_ANIMATION_NAME );
plAnimStealthNode *stealth = IVerifyStealthPresent( _TEMP_CONVERT_FROM_LITERAL(ENTIRE_ANIMATION_NAME) );
goodNodes.Append( stealth );
// Verify segment nodes
@ -517,9 +517,9 @@ void plPassMtlBase::PostLoadAnimPBFixup( void )
for( int i = 0; i < fAnimPB->Count( (ParamID)kPBAnimStealthNodes ); i++ )
{
plAnimStealthNode *node = (plAnimStealthNode *)fAnimPB->GetReferenceTarget( (ParamID)kPBAnimStealthNodes, 0, i );
const char *name = node->GetSegmentName();
plString name = node->GetSegmentName();
node->SetAutoStart( false );
node->SetLoop( true, ENTIRE_ANIMATION_NAME );
node->SetLoop( true, _TEMP_CONVERT_FROM_LITERAL( ENTIRE_ANIMATION_NAME ) );
node->SetEaseIn( plAnimEaseTypes::kNoEase, 1.f, 1.f, 1.f );
node->SetEaseOut( plAnimEaseTypes::kNoEase, 1.f, 1.f, 1.f );
}
@ -528,14 +528,14 @@ void plPassMtlBase::PostLoadAnimPBFixup( void )
const char *oldSel = (const char *)fAnimPB->GetStr( (ParamID)kPBAnimName );
if( oldSel == nil )
oldSel = ENTIRE_ANIMATION_NAME;
plAnimStealthNode *myNew = IFindStealth( oldSel );
plAnimStealthNode *myNew = IFindStealth( plString::FromUtf8( oldSel ) );
if( myNew != nil )
{
#pragma warning( push ) // Forcing value to bool true or false (go figure, i'm even explicitly casting)
#pragma warning( disable:4800 ) // Forcing value to bool true or false (go figure, i'm even explicitly casting)
myNew->SetAutoStart( (bool)fAnimPB->GetInt( (ParamID)kPBAnimAutoStart ) );
myNew->SetLoop( (bool)fAnimPB->GetInt( (ParamID)kPBAnimLoop ),
(char *)fAnimPB->GetStr( (ParamID)kPBAnimLoopName ) );
plString::FromUtf8( (char *)fAnimPB->GetStr( (ParamID)kPBAnimLoopName ) ) );
myNew->SetEaseIn( (uint8_t)fAnimPB->GetInt( (ParamID)kPBAnimEaseInType ),
(float)fAnimPB->GetFloat( (ParamID)kPBAnimEaseInLength ),
(float)fAnimPB->GetFloat( (ParamID)kPBAnimEaseInMin ),

View File

@ -55,6 +55,7 @@ class plPassAnimDlgProc;
class plStealthNodeAccessor;
class plMaxNode;
class plErrorMsg;
class plString;
class plPassMtlBase : public Mtl
{
@ -81,8 +82,8 @@ protected:
hsTArray<plMtlChangeCallback *> fChangeCallbacks;
void IUpdateAnimNodes( void );
plAnimStealthNode *IFindStealth( const char *animName );
plAnimStealthNode *IVerifyStealthPresent( const char *animName );
plAnimStealthNode *IFindStealth( const plString &animName );
plAnimStealthNode *IVerifyStealthPresent( const plString &animName );
int IGetNumStealths( hsBool update = true );
plAnimStealthNode *IGetStealth( int index, hsBool update = true );