Code/Editor/TrackView/GotoKeyUIControls.cpp
void CGotoKeyUIControls::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::Goto)
        {
            IDiscreteFloatKey discreteFloatKey;

            keyHandle.GetKey(&discreteFloatKey);
            SyncValue(mv_command, discreteFloatKey.m_fValue, false, pVar);

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

            if (isDuringUndo)
            {
                keyHandle.SetKey(&discreteFloatKey);
            }
            else
            {
                AzToolsFramework::ScopedUndoBatch undoBatch("Set Key Value");
                keyHandle.SetKey(&discreteFloatKey);
                undoBatch.MarkEntityDirty(sequence->GetSequenceComponentEntityId());
            }
        }
    }
}
//////////////////////////////////////////////////////////////////////////
// Called when UI variable changes.
Called when UI variable changes.
Called when UI variable changes .
void CGotoKeyUIControls::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::Goto)
        {
            IDiscreteFloatKey discreteFloatKey;
            keyHandle.GetKey(&discreteFloatKey);
            SyncValue(mv_command, discreteFloatKey.m_fValue, false, pVar);
            bool isDuringUndo = false;
            AzToolsFramework::ToolsApplicationRequests::Bus::BroadcastResult(isDuringUndo, &AzToolsFramework::ToolsApplicationRequests::Bus::Events::IsDuringUndoRedo);
            if (isDuringUndo)
            {
                keyHandle.SetKey(&discreteFloatKey);
            }
            else
            {
                AzToolsFramework::ScopedUndoBatch undoBatch("Set Key Value");
                keyHandle.SetKey(&discreteFloatKey);
                undoBatch.MarkEntityDirty(sequence->GetSequenceComponentEntityId());
            }
        }
    }
}
void CGotoKeyUIControls :: 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 :: Goto ) { IDiscreteFloatKey discreteFloatKey ; keyHandle . GetKey ( & discreteFloatKey ) ; SyncValue ( mv_command , discreteFloatKey . m_fValue , false , pVar ) ; bool isDuringUndo = false ; AzToolsFramework :: ToolsApplicationRequests :: Bus :: BroadcastResult ( isDuringUndo , & AzToolsFramework :: ToolsApplicationRequests :: Bus :: Events :: IsDuringUndoRedo ) ; if ( isDuringUndo ) { keyHandle . SetKey ( & discreteFloatKey ) ; } else { AzToolsFramework :: ScopedUndoBatch undoBatch ( " " ) ; keyHandle . SetKey ( & discreteFloatKey ) ; undoBatch . MarkEntityDirty ( sequence -> GetSequenceComponentEntityId ( ) ) ; } } } }
Called when UI variable changes.
Called when UI variable changes .