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

UI: Redesign ChoiceParam UI component #2656

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open

Conversation

yann-lty
Copy link
Member

@yann-lty yann-lty commented Jan 23, 2025

Description

Re-design the UI control for editing a ChoiceParam.

Exclusive ChoiceParam

The exclusive ChoiceParam component has been resigned to address multiple issues with the current controls.

Before

Behavior

combo_current

Custom Value indicator

image

After (this PR)

Behavior

combo_new

Custom value indicator

image

Non-exclusive ChoiceParam

This component has been redesigned to display custom values outside the range of possible values.
That may happen when a node description is modified and potentially discard already serialized value in existing scenes.
image

This can be tried out by pasting this code snippet in Meshroom's script editor:

from meshroom.ui import uiInstance

graph = uiInstance.activeProject
node = graph.addNewNode("FeatureExtraction")
graph.selectedNode = node

graph.setAttribute(node.describerTypes, ["other", "custom"])

Features list

Exclusive ChoiceParam

  • Make custom value setting from filter an explicit action.
  • Use a less error-looking UI for indicating the use of a custom value.
  • Fix value being changed on non explicit actions (eg: when clicking outside the selection popup to discard it).
  • Fix incorrect value being displayed in the UI compared to the actual attribute value (eg: after an undo).

Non exclusive ChoiceParam

  • Enable support to display/edit value elements outside the list of possible values.

Implementation remarks

FilterComboBox

Rely as much as possible on the behaviors provided by the default ComboBox component to avoid custom logic for e.g keyboard navigation.
Move away from imperative code for handling value binding, simplifying the usage of the FilterComboBox component and making sure that the displayed value is always reflecting the actual attribute's value.
Simplify the filtering logic.

AttributeControls

Introduce a new subfolder (AttributeControls) to host the controls to view and edit attributes, in order to reduce the complexity of AttributeItemDelegate.qml.

Copy link

codecov bot commented Jan 23, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 69.96%. Comparing base (1f42ad3) to head (cb5b0e4).
Report is 21 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2656      +/-   ##
===========================================
+ Coverage    69.93%   69.96%   +0.02%     
===========================================
  Files          121      121              
  Lines         7088     7084       -4     
===========================================
- Hits          4957     4956       -1     
+ Misses        2131     2128       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Simplify the FilterComboBox to rely on the default behavior
provided by the ComboBox control.
Improve the filtering system and the ability to set a custom value.
Turn to a more declarative approach with regard to handling
value update and its mapping to the combobox's current index.
@yann-lty yann-lty marked this pull request as ready for review January 23, 2025 16:12
Start modularization of attribute controls for better readability
and maintenance.
Make Choice control independent from the MeshroomUI API.
* Move the control to its own file.
* Add support for displaying custom values (elements outside the predefined possible values).
@yann-lty yann-lty changed the title UI: Redesign exclusive ChoiceParam UI component UI: Redesign ChoiceParam UI component Jan 30, 2025
@yann-lty yann-lty added this to the Meshroom 2025.1.0 milestone Jan 31, 2025
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.

1 participant