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

Fixes OptionButton selection index being reset to zero at instanciation #16739

Closed
wants to merge 3 commits into from
Closed

Fixes OptionButton selection index being reset to zero at instanciation #16739

wants to merge 3 commits into from

Conversation

Alexander-Alekseev
Copy link
Contributor

@Alexander-Alekseev Alexander-Alekseev commented Feb 16, 2018

What we want to see is:

  • Create OptionButton;
  • Add items;
  • Select desired item.

Till you are in GUI, the logic flow is correct. When you click Save Scene and/or Run Project the logic flow is:

  • Create OptionButton (yes, save/run option creates a new one);
  • Select desired item; <-- it fails because there are no items in popup as @bojidar-bg mentioned
  • Add items. <-- when you have more than 1 item, this one selects item with index == 0

The root cause is that properties in OptionButton class placed in the order:

  1. selected (_select_int method);
  2. items (_set_items method).

Engine executes properties in this order once we save scene/run project.

This fix changes the order.

Bugsquad edit: fixes #10213

Alexander-Alekseev and others added 3 commits February 15, 2018 09:14
Bug: engine tries to set selected item before items were added during save scene/run project, because of wrong properties order.
@ghost ghost added this to the 3.1 milestone Feb 16, 2018
@groud groud changed the title Fix for #10213. Fixes OptionButton selection index being reset to zero at instanciation Feb 16, 2018
@akien-mga
Copy link
Member

Thanks for the fix! I've merged it manually as 66c39b1 to add an explanatory comment and remove the extraneous merge commits. (See PR workflow for help on how to update your fork without generating such merge commits).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OptionButton selected value always set to 0 when run
3 participants