static int ISearchLayerRecur(hsGMaterial* mat, const ST::string &segName, hsTArray<plKey>& keys)
{
    ST::string name = ( segName.compare( ENTIRE_ANIMATION_NAME ) == 0 ) ? ST::null : segName;
    int i;
    for( i = 0; i < mat->GetNumLayers(); i++ )
        ISearchLayerRecur(mat->GetLayer(i), name, keys);
    return keys.GetCount();
}
Exemple #2
0
plLocation plPluginResManager::ICreateLocation(const ST::string& age, const ST::string& page, int32_t seqNum, bool itinerant)
{
    bool willBeReserved = age.compare_i("global") == 0;

    int32_t oldNum = seqNum;
    seqNum = VerifySeqNumber(seqNum, age, page);
    if (seqNum != oldNum)
    {
        hsAssert(false, "Conflicting page sequence number. Somebody called NameToLoc without verifying their seq# first!"); 
    }

    if (seqNum < 0)
    {
        willBeReserved = true;
        seqNum = -seqNum;
    }

    plLocation newLoc;
    if (willBeReserved)
        newLoc = plLocation::MakeReserved(seqNum);
    else
        newLoc = plLocation::MakeNormal(seqNum);

    // Flag common pages
    for (int i = 0; i < plAgeDescription::kNumCommonPages; i++)
    {
        if (page.compare(plAgeDescription::GetCommonPage(i)) == 0)
        {
            newLoc.SetFlags(plLocation::kBuiltIn);
            break;
        }
    }

    // If we have an age description file for the age we're creating a location
    // for, grab some extra flags from it
    plAgeDescription* ageDesc = plPageInfoUtils::GetAgeDesc(age.c_str());
    plAgePage* agePage = ageDesc ? ageDesc->FindPage(page.c_str()) : nil;
    if (agePage)
    {
        if (agePage->GetFlags() & plAgePage::kIsLocalOnly)
            newLoc.SetFlags(plLocation::kLocalOnly);

        if (agePage->GetFlags() & plAgePage::kIsVolatile)
            newLoc.SetFlags(plLocation::kVolatile);
    }
    if (itinerant)
        newLoc.SetFlags(plLocation::kItinerant);

    delete ageDesc;
    return newLoc;
}
static bool IsMarkerSelected(IParamBlock2* pb, int paramID, const ST::string& marker, bool remove=false)
{
    int numMarkers = pb->Count(paramID);
    for (int i = 0; i < numMarkers; i++)
    {
        if (marker.compare(pb->GetStr(paramID, 0, i)) == 0)
        {
            if (remove)
                pb->Delete(paramID, i, 1);
            return true;
        }
    }

    return false;
}
void    plAnimStealthNode::StuffToTimeConvert( plAnimTimeConvert &convert, float maxLength )
{
    ST::string segName = GetSegmentName();
    bool isEntire = ( segName.is_empty() || segName.compare( ENTIRE_ANIMATION_NAME ) == 0 );

    if( isEntire )
    {
        convert.SetBegin( 0 );
        convert.SetEnd( maxLength );
    }
    else
    {
        SegmentSpec *spec = IGetSegmentSpec();
        convert.SetBegin( ( spec != nil ) ? spec->fStart : 0.f );
        convert.SetEnd( ( spec != nil ) ? spec->fEnd : 0.f );
    }

    // Even if we're not looping, set the loop points. (A responder
    // could tell us later to start looping.)
    if( isEntire )
        convert.SetLoopPoints( 0, maxLength );
    else
    {
        float loopStart, loopEnd;
        GetLoopPoints( loopStart, loopEnd );
        convert.SetLoopPoints( loopStart, loopEnd );
    }   
    convert.Loop( GetLoop() );

    // Auto-start
    if( GetAutoStart() )
        convert.Start( 0 );
    else
        convert.Stop( true );

    // Stuff stop points
    GetAllStopPoints( convert.GetStopPoints() );

    // Ease curve stuff
    if( GetEaseInType() != plAnimEaseTypes::kNoEase )
    {
        convert.SetEase( true, GetEaseInType(), GetEaseInMin(), GetEaseInMax(), GetEaseInLength() );
    }
    if( GetEaseOutType() != plAnimEaseTypes::kNoEase )
    {
        convert.SetEase( false, GetEaseOutType(), GetEaseOutMin(), GetEaseOutMax(), GetEaseOutLength() );
    }
}
static void ISearchLayerRecur( plLayerInterface *layer, const ST::string &segName, hsTArray<plKey>& keys )
{
    if( !layer )
        return;

    plLayerAnimation *animLayer = plLayerAnimation::ConvertNoRef(layer);
    if (animLayer)
    {
        ST::string ID = animLayer->GetSegmentID();
        if (!ID.compare(segName))
        {
            if( keys.kMissingIndex == keys.Find(animLayer->GetKey()) )
                keys.Append(animLayer->GetKey());
        }
    }

    ISearchLayerRecur(layer->GetAttached(), segName, keys);
}