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

Introduce new attribute type: DynamicChoiceParam #2661

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

Conversation

yann-lty
Copy link
Member

Description

This PR introduces DynamicChoiceParam, which provides the same feature set as a ChoiceParam but supports override and serialization of the list of possible values.

Features list

  • Add DynamicChoiceParam attribute type.

Implementation remarks

DynamicChoiceParam is implemented as a specialized GroupAttribute, composed of 2 child attributes:

  • a ChoiceParam to hold the attribute value and as a backend to expose a ChoiceParam-compliant API
  • a ListAttribute to hold the list of possible values

Relying on a GroupAttribute allows to benefit from the existing serialization logic.
This has been preferred over implementing a specific serialization logic for the existing ChoiceParam type.

Add a new ChoiceParam-like type that supports the override and
serialization of the list of possible values.
GroupAttribute subclasses can override their `value` property to return the value
of a child attribute.
The `nodeCopy` method needs to evaluate the group's actual value.
Therefore, make sure to access the GroupAttribute's internal value and not an overriden
one.
@yann-lty yann-lty force-pushed the dev/dynamicChoiceParam branch from 57e5e92 to 70546c7 Compare January 29, 2025 13:59
Copy link

codecov bot commented Jan 29, 2025

Codecov Report

Attention: Patch coverage is 98.34711% with 2 lines in your changes missing coverage. Please review.

Project coverage is 70.49%. Comparing base (1f42ad3) to head (2f6d802).
Report is 12 commits behind head on develop.

Files with missing lines Patch % Lines
meshroom/core/attribute.py 93.10% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2661      +/-   ##
===========================================
+ Coverage    69.93%   70.49%   +0.56%     
===========================================
  Files          121      122       +1     
  Lines         7088     7199     +111     
===========================================
+ Hits          4957     5075     +118     
+ Misses        2131     2124       -7     

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

Skip value assignment when the value is a list identical to the ListAttribute's
current value.
This avoids internal models and graph update, which can have a
significant impact on performance when the number of elements grows.
@yann-lty yann-lty marked this pull request as ready for review January 31, 2025 09:15
@yann-lty yann-lty requested a review from fabiencastan January 31, 2025 09:20
@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