Sequencer - Override data copy/paste

This commit is contained in:
Emmanuel BENOîT 2017-11-29 16:36:18 +01:00
parent 14899a530d
commit 551bd56982

View file

@ -435,9 +435,11 @@ struct T_SyncViewImpl_
T_TempCurveStorage_ selUpdatingOriginals;
T_TempCurveStorage_ selUpdatingCopies;
// Override edition
// Override edition and copypasta
T_PointData_ selEditor{ selId , selSegment , selPoint ,
selUpdatingOriginals , selUpdatingCopies };
T_String cpType;
T_AutoArray< float , 16 > cpData;
// Sub-windows
E_SubWindow sub{ SW_NONE };
@ -2056,6 +2058,33 @@ void T_SyncViewImpl_::displayPointWindow( ) noexcept
uint32_t i{ 0 };
changed = (UI::Sync( ).uiFor( *ovr ))(
*ovr , selEditor , i , stringBuffer );
if ( Button( "Copy data" , ImVec2{ -1 , 0 } ) && !changed ) {
auto const& iNames{ ovr->inputNames( ) };
cpType = ovr->type( );
cpData.clear( );
for ( auto i = 0u ; i < iNames.size( ) ; i ++ ) {
cpData.add( sync.getCurve( iNames[ i ] )->segments[ sid ].values[ pid ] );
}
}
if ( cpType != ovr->type( ) ) {
PushDisabled( );
}
if ( Button( "Paste data" , ImVec2{ -1 , 0 } ) && !changed ) {
auto const& iNames{ ovr->inputNames( ) };
for ( auto i = 0u ; i < iNames.size( ) ; i ++ ) {
auto c{ *sync.getCurve( iNames[ i ] ) };
selUpdatingOriginals.add( c );
c.segments[ sid ].values[ pid ] = cpData[ i ];
selUpdatingCopies.add( c );
sync.setCurve( std::move( c ) );
}
selUpdate = E_ChangeType::POINT_VALUE;
}
if ( cpType != ovr->type( ) ) {
PopDisabled( );
}
} else {
Text( "Value:" );
SameLine( 110 );
@ -2068,8 +2097,6 @@ void T_SyncViewImpl_::displayPointWindow( ) noexcept
const bool canUseButtons{ !changed && selUpdate == E_ChangeType::NONE };
if ( canDelete ) {
Separator( );
Text( " " );
SameLine( 110 );
if ( Button( "Delete point" , ImVec2{ -1 , 0 } ) && canUseButtons ) {
SyncEditor::DeletePoint( *selId , sid , pid );
@ -2081,16 +2108,12 @@ void T_SyncViewImpl_::displayPointWindow( ) noexcept
if ( canInsertAfter || canInsertBefore ) {
Separator( );
if ( canInsertBefore ) {
Text( " " );
SameLine( 110 );
if ( Button( "Insert before" , ImVec2{ -1 , 0 } ) && canUseButtons ) {
SyncEditor::InsertPoint( *selId , sid , pid );
(*selPoint) ++;
}
}
if ( canInsertAfter ) {
Text( " " );
SameLine( 110 );
if ( Button( "Insert after" , ImVec2{ -1 , 0 } ) && canUseButtons ) {
SyncEditor::InsertPoint( *selId , sid , pid + 1 );
}