raven
raven copied to clipboard
Enable/Disable Clips
This is a Work-In-Progress Pull Request meant to solve #19
Summary of Changes (WIP)
inspector.cpp
- added 'Enabled' checkbox for non-Gap items (Tracks and Clips) using
ImGui::Checkbox()
:
timeline.cpp
- In
DrawItem()
, added conditional graying out on disabled items- Disabled non-Gap items have a gray
fill_color
(obtained by callingUIColorFromName("")
to getIM_COL32(0x88, 0x88, 0x88, 0xff)
).
- Disabled non-Gap items have a gray
- Disabled tracks look like this:
- The color change seems to apply only to disabled clips and not disabled tracks
- The current color for disabled items is just a placeholder until I can find a better color to use.
Request for help - Use Checkbox while keeping Item::_enabled
private
The ImGui::Checkbox()
only works as presented if Item::_enabled
data member is exposed (made a non-private data member).
I couldn't get the checkbox to work otherwise. I tried using the public getter/setter methods (Item::enabled()
and Item::set_enabled()
) to make the checkbox functional but the checkbox would quickly un-tick itself once enabled.
I'd appreciate any advice on how to add a functional checkbox while keeping Item::_enabled
private.
- :x: - login: @rjwignar / name: Roy J. Wignarajah . The commit (e31acc62a833746ee3b4ae86ce41cbc45cd367a7, b4e0487c56e25cd7529c30cb00ad8dd71425a997, caff1b065ede9c6994d2bfd0716a7981e54ec889) is not authorized under a signed CLA. Please click here to be authorized. For further assistance with EasyCLA, please submit a support request ticket.
The typical ImGui pattern for dealing with setter/getters is something like this:
auto enabled = item->enabled();
if (ImGui::Checkbox("Enabled", &enabled)) {
item->set_enabled(enabled);
}
Is that what you tried already?
I believe the problem is that there might be more than one item named "Enabled" in the interface. ImGui requires all the gui elements to be uniquely identified and generally relies on a widgets label for that. So I bet, if you modify your code like the below, it will work.
ImGui::PushId(&item->_enabled);
bool x = ImGui::Checkbox("Enabled", &item->_enabled);
ImGui::PopId();
Closing in favour of #74
Thank you @jminor and @meshula for your suggestions. With your help I was able to redo this work in #74.