Skip to content

Clean up numeric EditorProperty setup() methods #108065

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lodetrick
Copy link
Contributor

@lodetrick lodetrick commented Jun 28, 2025

Currently, the numeric EditorProperty setup() methods are somewhat brittle. When these properties are created, they are first bundled into a struct, which is then destructed in the method call. This PR changes the signature of the numeric setup() calls to use the struct directly. This has several benefits:

  • If any new functionality is wanted for these properties (like in Allow @export_range to support numeric types #105878), this change makes it easy to make these changes without adding any arguments.
  • It removes the use of "magic numbers". In several internal files, EditorPropertyIntegers are created directly (I don't know how much this should be encouraged). Their setup() calls have many seemingly arbitrary numbers and booleans that are hard to understand without looking at the editor_properties.h file. This change makes it clear within the file what the parameters that the code is changing.

Note: In making this change I found multiple invalid calls to setup(), most looking like: setup(-1, 99999, true); where there is a boolean in the third argument (which is defined as double p_step). I'm not sure what the intention was originally, but making this change will prevent future invalid calls and help catch other invalid calls before they are propagated.

@lodetrick lodetrick requested a review from a team as a code owner June 28, 2025 00:45
@lodetrick lodetrick force-pushed the range-hint-cleanup branch from 79be1dc to 11e31fd Compare June 28, 2025 00:56
@lodetrick lodetrick changed the title Clean Up numeric EditorProperty setup() methods Clean up numeric EditorProperty setup() methods Jun 28, 2025
@AThousandShips AThousandShips added this to the 4.x milestone Jun 30, 2025
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.

2 participants