Started work on new sync manager

This commit is contained in:
Emmanuel BENOîT 2017-10-23 11:03:38 +02:00
parent b2d56781d3
commit a3a8c9c0a5
2 changed files with 85 additions and 0 deletions

74
sync.cc
View file

@ -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( )

11
sync.hh
View file

@ -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 );
};
/*============================================================================*/