Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable/Disable Clips #27

Closed
wants to merge 3 commits into from
Closed

Conversation

rjwignar
Copy link

@rjwignar rjwignar commented Nov 28, 2023

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():
    image

timeline.cpp

  • In DrawItem(), added conditional graying out on disabled items
    • Disabled non-Gap items have a gray fill_color
      (obtained by calling UIColorFromName("") to get IM_COL32(0x88, 0x88, 0x88, 0xff)).
  • Disabled tracks look like this:
    image
  • 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.

Copy link

CLA Not Signed

@jminor
Copy link
Member

jminor commented Jan 5, 2024

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?

@meshula
Copy link
Member

meshula commented Jan 17, 2024

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

@rjwignar
Copy link
Author

Closing in favour of #74

@rjwignar rjwignar closed this Sep 28, 2024
@rjwignar rjwignar mentioned this pull request Sep 28, 2024
@rjwignar
Copy link
Author

Thank you @jminor and @meshula for your suggestions. With your help I was able to redo this work in #74.

@rjwignar rjwignar deleted the issue-19 branch September 28, 2024 20:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants