Code/Editor/TrackView/EventKeyUIControls.cpp
void CEventKeyUIControls::OnUIChange(IVariable* pVar, CTrackViewKeyBundle& selectedKeys)
{
    CTrackViewSequence* sequence = GetIEditor()->GetAnimation()->GetSequence();

    if (!sequence || !selectedKeys.AreAllKeysOfSameType())
    {
        return;
    }

    for (unsigned int keyIndex = 0; keyIndex < selectedKeys.GetKeyCount(); ++keyIndex)
    {
        CTrackViewKeyHandle keyHandle = selectedKeys.GetKey(keyIndex);

        CAnimParamType paramType = keyHandle.GetTrack()->GetParameterType();
        if (paramType == AnimParamType::Event)
        {
            IEventKey eventKey;
            keyHandle.GetKey(&eventKey);

            QByteArray event, value, animation;
            event = static_cast<QString>(mv_event).toUtf8();
            value = static_cast<QString>(mv_value).toUtf8();
            animation = static_cast<QString>(mv_animation).toUtf8();

            if (pVar == mv_event.GetVar())
            {
                eventKey.event = event.data();
            }
            if (pVar == mv_value.GetVar())
            {
                eventKey.eventValue = value.data();
            }
            if (pVar == mv_animation.GetVar())
            {
                eventKey.animation = animation.data();
            }
            SyncValue(mv_notrigger_in_scrubbing, eventKey.bNoTriggerInScrubbing, false, pVar);

            bool isDuringUndo = false;
            AzToolsFramework::ToolsApplicationRequests::Bus::BroadcastResult(isDuringUndo, &AzToolsFramework::ToolsApplicationRequests::Bus::Events::IsDuringUndoRedo);

            if (isDuringUndo)
            {
                keyHandle.SetKey(&eventKey);
            }
            else
            {
                AzToolsFramework::ScopedUndoBatch undoBatch("Set Key Value");
                keyHandle.SetKey(&eventKey);
                undoBatch.MarkEntityDirty(sequence->GetSequenceComponentEntityId());
            }
        }
    }
}
// Called when UI variable changes.
Called when UI variable changes.
Called when UI variable changes .
void CEventKeyUIControls::OnUIChange(IVariable* pVar, CTrackViewKeyBundle& selectedKeys)
{
    CTrackViewSequence* sequence = GetIEditor()->GetAnimation()->GetSequence();
    if (!sequence || !selectedKeys.AreAllKeysOfSameType())
    {
        return;
    }
    for (unsigned int keyIndex = 0; keyIndex < selectedKeys.GetKeyCount(); ++keyIndex)
    {
        CTrackViewKeyHandle keyHandle = selectedKeys.GetKey(keyIndex);
        CAnimParamType paramType = keyHandle.GetTrack()->GetParameterType();
        if (paramType == AnimParamType::Event)
        {
            IEventKey eventKey;
            keyHandle.GetKey(&eventKey);
            QByteArray event, value, animation;
            event = static_cast<QString>(mv_event).toUtf8();
            value = static_cast<QString>(mv_value).toUtf8();
            animation = static_cast<QString>(mv_animation).toUtf8();
            if (pVar == mv_event.GetVar())
            {
                eventKey.event = event.data();
            }
            if (pVar == mv_value.GetVar())
            {
                eventKey.eventValue = value.data();
            }
            if (pVar == mv_animation.GetVar())
            {
                eventKey.animation = animation.data();
            }
            SyncValue(mv_notrigger_in_scrubbing, eventKey.bNoTriggerInScrubbing, false, pVar);
            bool isDuringUndo = false;
            AzToolsFramework::ToolsApplicationRequests::Bus::BroadcastResult(isDuringUndo, &AzToolsFramework::ToolsApplicationRequests::Bus::Events::IsDuringUndoRedo);
            if (isDuringUndo)
            {
                keyHandle.SetKey(&eventKey);
            }
            else
            {
                AzToolsFramework::ScopedUndoBatch undoBatch("Set Key Value");
                keyHandle.SetKey(&eventKey);
                undoBatch.MarkEntityDirty(sequence->GetSequenceComponentEntityId());
            }
        }
    }
}
void CEventKeyUIControls :: OnUIChange ( IVariable * pVar , CTrackViewKeyBundle & selectedKeys ) { CTrackViewSequence * sequence = GetIEditor ( ) -> GetAnimation ( ) -> GetSequence ( ) ; if ( ! sequence || ! selectedKeys . AreAllKeysOfSameType ( ) ) { return ; } for ( unsigned int keyIndex = 0 ; keyIndex < selectedKeys . GetKeyCount ( ) ; ++ keyIndex ) { CTrackViewKeyHandle keyHandle = selectedKeys . GetKey ( keyIndex ) ; CAnimParamType paramType = keyHandle . GetTrack ( ) -> GetParameterType ( ) ; if ( paramType == AnimParamType :: Event ) { IEventKey eventKey ; keyHandle . GetKey ( & eventKey ) ; QByteArray event , value , animation ; event = static_cast < QString > ( mv_event ) . toUtf8 ( ) ; value = static_cast < QString > ( mv_value ) . toUtf8 ( ) ; animation = static_cast < QString > ( mv_animation ) . toUtf8 ( ) ; if ( pVar == mv_event . GetVar ( ) ) { eventKey . event = event . data ( ) ; } if ( pVar == mv_value . GetVar ( ) ) { eventKey . eventValue = value . data ( ) ; } if ( pVar == mv_animation . GetVar ( ) ) { eventKey . animation = animation . data ( ) ; } SyncValue ( mv_notrigger_in_scrubbing , eventKey . bNoTriggerInScrubbing , false , pVar ) ; bool isDuringUndo = false ; AzToolsFramework :: ToolsApplicationRequests :: Bus :: BroadcastResult ( isDuringUndo , & AzToolsFramework :: ToolsApplicationRequests :: Bus :: Events :: IsDuringUndoRedo ) ; if ( isDuringUndo ) { keyHandle . SetKey ( & eventKey ) ; } else { AzToolsFramework :: ScopedUndoBatch undoBatch ( " " ) ; keyHandle . SetKey ( & eventKey ) ; undoBatch . MarkEntityDirty ( sequence -> GetSequenceComponentEntityId ( ) ) ; } } } }
Called when UI variable changes.
Called when UI variable changes .