示例#1
0
static int GetMatAnimModKey(Mtl* mtl, plMaxNodeBase* node, const ST::string& segName, hsTArray<plKey>& keys)
{
    int retVal = 0;

    int i;

    //if( begin < 0 )
    //  begin = 0;

    if( mtl->ClassID() == Class_ID(MULTI_CLASS_ID,0) )
    {
        for( i = 0; i < mtl->NumSubMtls(); i++ )
            retVal += GetMatAnimModKey(mtl->GetSubMtl(i), node, segName, keys);
    }
    else
    {
        hsTArray<hsGMaterial*> matList;

        if (node)
            hsMaterialConverter::Instance().GetMaterialArray(mtl, (plMaxNode*)node, matList);
        else
            hsMaterialConverter::Instance().CollectConvertedMaterials(mtl, matList);

        for( i = 0; i < matList.GetCount(); i++ )
        {
            retVal += ISearchLayerRecur(matList[i], segName, keys);
        }
    }

    return retVal;
}
示例#2
0
bool plMtlEventComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg)
{
    if (!fCanExport)
        return false;

    plKey modKey = fLogicModKeys[node];
    plAnimEventModifier* mod = plAnimEventModifier::ConvertNoRef(modKey->GetObjectPtr());

    Mtl* mtl = fCompPB->GetMtl(kMtlMtl);
    plMaxNodeBase* mtlNode = (plMaxNodeBase*)fCompPB->GetINode(kMtlNode);
    ST::string mtlAnim = ST::string::from_utf8(fCompPB->GetStr(kMtlAnim));

    //
    // Create and setup the callback message
    //
    hsTArray<plKey> animKeys;
    GetMatAnimModKey(mtl, mtlNode, mtlAnim, animKeys);

    plAnimCmdMsg *animMsg = new plAnimCmdMsg;
    animMsg->SetCmd(plAnimCmdMsg::kAddCallbacks);
    animMsg->SetSender(modKey);
    animMsg->SetAnimName(mtlAnim);
    animMsg->AddReceivers(animKeys);

    if (fCompPB->GetInt(kMtlBegin))
    {
        plEventCallbackMsg *eventMsg = CreateCallbackMsg(animMsg, modKey);
        eventMsg->fEvent = kBegin;
    }
    if (fCompPB->GetInt(kMtlEnd))
    {
        plEventCallbackMsg *eventMsg = CreateCallbackMsg(animMsg, modKey);
        eventMsg->fEvent = kEnd;
    }
    if (fCompPB->Count(kMtlMarkers) > 0)
    {
        plNotetrackAnim anim(mtl, nil);
        plAnimInfo info = anim.GetAnimInfo(mtlAnim);

        int numMarkers = fCompPB->Count(kMtlMarkers);
        for (int i = 0; i < numMarkers; i++)
        {
            ST::string marker = ST::string::from_utf8(fCompPB->GetStr(kMtlMarkers, 0, i));
            float time = info.GetMarkerTime(marker);

            plEventCallbackMsg *eventMsg = CreateCallbackMsg(animMsg, modKey);
            eventMsg->fEvent = kTime;
            eventMsg->fEventTime = time;
        }
    }

    mod->SetCallback(animMsg);

    hsTArray<plKey> receivers;
    IGetReceivers(node, receivers);
    mod->SetReceivers(receivers);

    return true;
}
plKey plGameMarkerComponent::IGetMtlAnimKey(int paramID, plMaxNode* node)
{
    Mtl* mtl = fCompPB->GetMtl(kMarkerMtl);
    plMaxNode* mtlNode  = (plMaxNode*)fCompPB->GetINode(kMarkerMtlNode);
    hsTArray<plKey> keys;
    plString anim = plString::FromUtf8(fCompPB->GetStr(paramID));
    GetMatAnimModKey(mtl, mtlNode, anim, keys);
    hsAssert(keys.Count() == 1, "Wrong number of keys");
    return keys[0];
}
示例#4
0
bool    plAnimStealthNode::GetKeyList( INode *restrictedNode, hsTArray<plKey> &outKeys )
{
    if( !fPreppedForConvert )
    {
        hsMessageBox( "This messages is to warn you that mcn screwed up in his attempt to create "
        "a SetupProperties() pass for materials in this scene. You should probably let him know as soon as "
        "possible, and also make a copy of this exact scene so that he can test with it and figure out what "
        "is going wrong. Thank you.", "Mathew is Stupid Error", hsMessageBoxNormal );
    }

    GetMatAnimModKey( GetParentMtl(), (plMaxNode *)restrictedNode, GetSegmentName(), outKeys );
    return true;
}