@@ -5192,7 +5192,6 @@ void CEditor::RenderEnvelopeEditor(CUIRect View)
51925192 static int s_ActiveChannels = 0xf ;
51935193 {
51945194 CUIRect Button;
5195- std::shared_ptr<CEnvelope> pNewEnv = nullptr ;
51965195
51975196 // redo button
51985197 ToolBar.VSplitRight (25 .0f , &ToolBar, &Button);
@@ -5215,26 +5214,26 @@ void CEditor::RenderEnvelopeEditor(CUIRect View)
52155214 static int s_NewSoundButton = 0 ;
52165215 if (DoButton_Editor (&s_NewSoundButton, " Sound+" , 0 , &Button, BUTTONFLAG_LEFT, " Create a new sound envelope." ))
52175216 {
5218- m_Map. OnModify ( );
5219- pNewEnv = m_Map.NewEnvelope (CEnvelope::EType::SOUND) ;
5217+ m_EnvelopeEditorHistory. Execute (std::make_shared<CEditorActionEnvelopeAdd>( this , CEnvelope::EType::SOUND) );
5218+ pEnvelope = m_Map.m_vpEnvelopes [m_SelectedEnvelope] ;
52205219 }
52215220
52225221 ToolBar.VSplitRight (5 .0f , &ToolBar, nullptr );
52235222 ToolBar.VSplitRight (50 .0f , &ToolBar, &Button);
52245223 static int s_New4dButton = 0 ;
52255224 if (DoButton_Editor (&s_New4dButton, " Color+" , 0 , &Button, BUTTONFLAG_LEFT, " Create a new color envelope." ))
52265225 {
5227- m_Map. OnModify ( );
5228- pNewEnv = m_Map.NewEnvelope (CEnvelope::EType::COLOR) ;
5226+ m_EnvelopeEditorHistory. Execute (std::make_shared<CEditorActionEnvelopeAdd>( this , CEnvelope::EType::COLOR) );
5227+ pEnvelope = m_Map.m_vpEnvelopes [m_SelectedEnvelope] ;
52295228 }
52305229
52315230 ToolBar.VSplitRight (5 .0f , &ToolBar, nullptr );
52325231 ToolBar.VSplitRight (50 .0f , &ToolBar, &Button);
52335232 static int s_New2dButton = 0 ;
52345233 if (DoButton_Editor (&s_New2dButton, " Pos.+" , 0 , &Button, BUTTONFLAG_LEFT, " Create a new position envelope." ))
52355234 {
5236- m_Map. OnModify ( );
5237- pNewEnv = m_Map.NewEnvelope (CEnvelope::EType::POSITION) ;
5235+ m_EnvelopeEditorHistory. Execute (std::make_shared<CEditorActionEnvelopeAdd>( this , CEnvelope::EType::POSITION) );
5236+ pEnvelope = m_Map.m_vpEnvelopes [m_SelectedEnvelope] ;
52385237 }
52395238
52405239 if (m_SelectedEnvelope >= 0 )
@@ -5323,22 +5322,6 @@ void CEditor::RenderEnvelopeEditor(CUIRect View)
53235322 ToolBar.VSplitRight (7 .0f , &ToolBar, nullptr );
53245323 }
53255324
5326- if (pNewEnv) // add the default points
5327- {
5328- if (pNewEnv->GetChannels () == 4 )
5329- {
5330- pNewEnv->AddPoint (CFixedTime::FromSeconds (0 .0f ), {f2fx (1 .0f ), f2fx (1 .0f ), f2fx (1 .0f ), f2fx (1 .0f )});
5331- pNewEnv->AddPoint (CFixedTime::FromSeconds (1 .0f ), {f2fx (1 .0f ), f2fx (1 .0f ), f2fx (1 .0f ), f2fx (1 .0f )});
5332- }
5333- else
5334- {
5335- pNewEnv->AddPoint (CFixedTime::FromSeconds (0 .0f ), {0 , 0 , 0 , 0 });
5336- pNewEnv->AddPoint (CFixedTime::FromSeconds (1 .0f ), {0 , 0 , 0 , 0 });
5337- }
5338-
5339- m_EnvelopeEditorHistory.RecordAction (std::make_shared<CEditorActionEnvelopeAdd>(this , pNewEnv));
5340- }
5341-
53425325 CUIRect Shifter, Inc, Dec;
53435326 ToolBar.VSplitLeft (60 .0f , &Shifter, &ToolBar);
53445327 Shifter.VSplitRight (15 .0f , &Shifter, &Inc);
0 commit comments