diff --git a/sync.cc b/sync.cc index 1761677..cda34cd 100644 --- a/sync.cc +++ b/sync.cc @@ -2,6 +2,80 @@ #include "sync.hh" +void T_SyncManager::makeUI( ) +{ + auto const& dspSize( ImGui::GetIO( ).DisplaySize ); + + if ( wOverrides ) { + ImGui::SetNextWindowSize( ImVec2( 300 , dspSize.y - 300 ) , + ImGuiSetCond_Once ); + ImGui::SetNextWindowPos( ImVec2( 0 , 150 ) , + ImGuiSetCond_Once ); + ImGui::Begin( "Input overrides" ); + displayOvSections( uiRoot , true ); + ImGui::End( ); + } + if ( wCurves ) { + ImGui::SetNextWindowSize( ImVec2( dspSize.x , 150 ) , + ImGuiSetCond_Once ); + ImGui::SetNextWindowPos( ImVec2( 0 , dspSize.y - 150 ) , + ImGuiSetCond_Once ); + ImGui::Begin( "Curve editor" ); + // XXX contents + ImGui::End( ); + } +} + +void T_SyncManager::displayOvSections( + __rw__ T_SyncUISections& sections , + __rd__ const bool topLevel ) +{ + for ( auto& s : sections ) { + const bool display( topLevel + ? ImGui::CollapsingHeader( s->title.c_str( ) ) + : ImGui::TreeNode( s->title.c_str( ) ) ); + if ( !display ) { + continue; + } + displayOvSections( s->subsections ); + if ( s->subsections.size( ) && s->overrides.size( ) ) { + ImGui::Separator( ); + } + displayOvControls( s->overrides ); + if ( !topLevel ) { + ImGui::TreePop( ); + } + } +} + +void T_SyncManager::displayOvControls( + __rw__ T_SyncUIOverrides& overrides ) +{ + for ( auto& o : overrides ) { + // XXX enable override checkbox should be selected and disabled + // if there is no curve + const bool changed( ImGui::Checkbox( "" , &o->enabled ) ); + if ( changed ) { + // XXX mark the inputs as coming from the UI / the curves + } + ImGui::SameLine( ); + + switch ( o->type ) { + case T_SyncUIOverride::FLOAT: + case T_SyncUIOverride::VEC2: + case T_SyncUIOverride::VEC3: + case T_SyncUIOverride::VEC4: + case T_SyncUIOverride::INT: + case T_SyncUIOverride::COLOR: + case T_SyncUIOverride::COLOR_GRADING: + case T_SyncUIOverride::CAMERA: + break; + } + } +} + +/*============================================================================*/ + const T_SyncVariable T_SyncData::MissingVariable_{ }; T_SyncData::T_SyncData( ) diff --git a/sync.hh b/sync.hh index 8e7c6ef..fda3cea 100644 --- a/sync.hh +++ b/sync.hh @@ -29,6 +29,7 @@ struct T_SyncUIOverride COLOR , COLOR_GRADING , CAMERA }; + std::string title; E_Type type; std::vector< std::string > inputs; bool enabled; @@ -81,6 +82,7 @@ struct T_SyncCurveCache T_SyncCurve const* variable; std::vector< T_SegRef > segRefs; std::vector< float > segStarts; + uint32_t curPos; T_SyncCurveCache( __rd__ T_SyncCurve const* const variable , @@ -127,6 +129,15 @@ struct T_SyncManager T_SyncUISections uiRoot; void makeUI( ); + bool wOverrides = false; + bool wCurves = false; + + private: + void displayOvSections( + __rw__ T_SyncUISections& sections , + __rd__ const bool topLevel = false ); + void displayOvControls( + __rw__ T_SyncUIOverrides& overrides ); }; /*============================================================================*/