Sequencer - Tweaking colors

Also fixed a bug where selecting a track wouldn't unselect previously
selected segment.
This commit is contained in:
Emmanuel BENOîT 2017-11-26 11:57:26 +01:00
parent 4e5991d2ea
commit 052d51a22f

View file

@ -559,8 +559,8 @@ void T_SyncViewImpl_::sequencerWidget( ) noexcept
if ( io.MouseDown[ 0 ] || io.MouseDown[ 1 ] ) { if ( io.MouseDown[ 0 ] || io.MouseDown[ 1 ] ) {
selId = dTrack.id; selId = dTrack.id;
selIsOverride = dTrack.isOverride; selIsOverride = dTrack.isOverride;
selSegment = {}; selSegment = decltype( selSegment ){};
selPoint = {}; selPoint = decltype( selPoint ){};
sub = E_SubWindow::SW_TRACK; sub = E_SubWindow::SW_TRACK;
} }
} else if ( mp.type == E_MousePosType::SEGMENT ) { } else if ( mp.type == E_MousePosType::SEGMENT ) {
@ -570,7 +570,7 @@ void T_SyncViewImpl_::sequencerWidget( ) noexcept
selId = dTrack.id; selId = dTrack.id;
selIsOverride = dTrack.isOverride; selIsOverride = dTrack.isOverride;
selSegment = dSeg.seg; selSegment = dSeg.seg;
selPoint = {}; selPoint = decltype( selPoint ){};
sub = E_SubWindow::SW_SEGMENT; sub = E_SubWindow::SW_SEGMENT;
} }
} }
@ -765,9 +765,13 @@ void T_SyncViewImpl_::sequencerTrack(
// Compute colors // Compute colors
using namespace ImGui; using namespace ImGui;
const auto bgColor{ ColorHSVAToU32( hue , .25f , 1.f , .25f ) } , const bool sCurve{ selId && !selIsOverride && selId == id };
borderColor{ ColorHSVAToU32( hue , .88f , 1.f , 1.f ) }; const float scv{ sCurve ? 1.f : .7f };
const uint32_t segColors[ 2 ] = { const auto bgColor{ ColorHSVAToU32( hue , .25f , scv , .25f ) } ,
borderColor{ ColorHSVAToU32( hue , .5f , scv , 1.f ) };
const uint32_t segColors[] = {
ColorHSVAToU32( hue - .03f , .4f , .7f , 1.f ) ,
ColorHSVAToU32( hue + .03f , .4f , .7f , 1.f ) ,
ColorHSVAToU32( hue - .03f , .4f , 1.f , 1.f ) , ColorHSVAToU32( hue - .03f , .4f , 1.f , 1.f ) ,
ColorHSVAToU32( hue + .03f , .4f , 1.f , 1.f ) , ColorHSVAToU32( hue + .03f , .4f , 1.f , 1.f ) ,
}; };
@ -802,7 +806,6 @@ void T_SyncViewImpl_::sequencerTrack(
const auto nSeg{ curve ? curve->segments.size( ) : 0u }; const auto nSeg{ curve ? curve->segments.size( ) : 0u };
uint32_t segStart{ 0 }; uint32_t segStart{ 0 };
for ( auto i = 0u ; i < nSeg ; i ++ ) { for ( auto i = 0u ; i < nSeg ; i ++ ) {
const auto color{ segColors[ i % 2 ] };
auto const& seg{ curve->segments[ i ] }; auto const& seg{ curve->segments[ i ] };
const auto segDur{ [&](){ const auto segDur{ [&](){
auto t{ 0u }; auto t{ 0u };
@ -823,6 +826,11 @@ void T_SyncViewImpl_::sequencerTrack(
} }
// Add segment to displayed list // Add segment to displayed list
const bool sSegment{ sCurve && selSegment && *selSegment == i };
if ( sSegment ) {
printf( "SelSeg! %d\n" , *selSegment );
}
const auto color{ segColors[ i % 2 + ( sSegment ? 2 : 0 ) ] };
auto dSegIdx{ dspSegments.size( ) }; auto dSegIdx{ dspSegments.size( ) };
auto& dSeg{ dspSegments.addNew( ) }; auto& dSeg{ dspSegments.addNew( ) };
dSeg.area = segFull; dSeg.area = segFull;
@ -1362,7 +1370,7 @@ void T_SyncViewImpl_::displaySegmentWindow( ) noexcept
if ( curve->segments.size( ) > 1 ) { if ( curve->segments.size( ) > 1 ) {
selSegment = ( sid == 0 ? 0 : ( sid - 1 ) ); selSegment = ( sid == 0 ? 0 : ( sid - 1 ) );
} else { } else {
selSegment = {}; selSegment = decltype( selSegment ){};
} }
SyncEditor::DeleteSegment( selId , sid ); SyncEditor::DeleteSegment( selId , sid );
} }