@@ -5082,7 +5082,6 @@ void CEditor::RenderEnvelopeEditor(CUIRect View)
50825082 static int s_ActiveChannels = 0xf ;
50835083 {
50845084 CUIRect Button;
5085- std::shared_ptr<CEnvelope> pNewEnv = nullptr ;
50865085
50875086 // redo button
50885087 ToolBar.VSplitRight (25 .0f , &ToolBar, &Button);
@@ -5105,26 +5104,26 @@ void CEditor::RenderEnvelopeEditor(CUIRect View)
51055104 static int s_NewSoundButton = 0 ;
51065105 if (DoButton_Editor (&s_NewSoundButton, " Sound+" , 0 , &Button, BUTTONFLAG_LEFT, " Create a new sound envelope." ))
51075106 {
5108- m_Map. OnModify ( );
5109- pNewEnv = m_Map.NewEnvelope (CEnvelope::EType::SOUND) ;
5107+ m_EnvelopeEditorHistory. Execute (std::make_shared<CEditorActionEnvelopeAdd>( this , CEnvelope::EType::SOUND) );
5108+ pEnvelope = m_Map.m_vpEnvelopes [m_SelectedEnvelope] ;
51105109 }
51115110
51125111 ToolBar.VSplitRight (5 .0f , &ToolBar, nullptr );
51135112 ToolBar.VSplitRight (50 .0f , &ToolBar, &Button);
51145113 static int s_New4dButton = 0 ;
51155114 if (DoButton_Editor (&s_New4dButton, " Color+" , 0 , &Button, BUTTONFLAG_LEFT, " Create a new color envelope." ))
51165115 {
5117- m_Map. OnModify ( );
5118- pNewEnv = m_Map.NewEnvelope (CEnvelope::EType::COLOR) ;
5116+ m_EnvelopeEditorHistory. Execute (std::make_shared<CEditorActionEnvelopeAdd>( this , CEnvelope::EType::COLOR) );
5117+ pEnvelope = m_Map.m_vpEnvelopes [m_SelectedEnvelope] ;
51195118 }
51205119
51215120 ToolBar.VSplitRight (5 .0f , &ToolBar, nullptr );
51225121 ToolBar.VSplitRight (50 .0f , &ToolBar, &Button);
51235122 static int s_New2dButton = 0 ;
51245123 if (DoButton_Editor (&s_New2dButton, " Pos.+" , 0 , &Button, BUTTONFLAG_LEFT, " Create a new position envelope." ))
51255124 {
5126- m_Map. OnModify ( );
5127- pNewEnv = m_Map.NewEnvelope (CEnvelope::EType::POSITION) ;
5125+ m_EnvelopeEditorHistory. Execute (std::make_shared<CEditorActionEnvelopeAdd>( this , CEnvelope::EType::POSITION) );
5126+ pEnvelope = m_Map.m_vpEnvelopes [m_SelectedEnvelope] ;
51285127 }
51295128
51305129 if (m_SelectedEnvelope >= 0 )
@@ -5213,22 +5212,6 @@ void CEditor::RenderEnvelopeEditor(CUIRect View)
52135212 ToolBar.VSplitRight (7 .0f , &ToolBar, nullptr );
52145213 }
52155214
5216- if (pNewEnv) // add the default points
5217- {
5218- if (pNewEnv->GetChannels () == 4 )
5219- {
5220- pNewEnv->AddPoint (CFixedTime::FromSeconds (0 .0f ), {f2fx (1 .0f ), f2fx (1 .0f ), f2fx (1 .0f ), f2fx (1 .0f )});
5221- pNewEnv->AddPoint (CFixedTime::FromSeconds (1 .0f ), {f2fx (1 .0f ), f2fx (1 .0f ), f2fx (1 .0f ), f2fx (1 .0f )});
5222- }
5223- else
5224- {
5225- pNewEnv->AddPoint (CFixedTime::FromSeconds (0 .0f ), {0 , 0 , 0 , 0 });
5226- pNewEnv->AddPoint (CFixedTime::FromSeconds (1 .0f ), {0 , 0 , 0 , 0 });
5227- }
5228-
5229- m_EnvelopeEditorHistory.RecordAction (std::make_shared<CEditorActionEnvelopeAdd>(this , pNewEnv));
5230- }
5231-
52325215 CUIRect Shifter, Inc, Dec;
52335216 ToolBar.VSplitLeft (60 .0f , &Shifter, &ToolBar);
52345217 Shifter.VSplitRight (15 .0f , &Shifter, &Inc);
0 commit comments