Core: Add sub-types for float-type custom properties #106700

Merged
Colin Basnett merged 7 commits from cmbasnett/custom-property-float-subtypes into main 2023-04-28 05:44:55 +02:00
Member

This adds the ability for users to assign sub-types to Float type custom properties (e.g., distance, angle, time, power etc.)

image

image

This adds the ability for users to assign sub-types to `Float` type custom properties (e.g., distance, angle, time, power etc.) ![image](/attachments/9d25a030-17c6-44b0-9478-73e7d337e641) ![image](/attachments/cb3145ef-0690-4a7f-8497-e833d5823fe7)
Colin Basnett added 1 commit 2023-04-08 01:30:08 +02:00
Colin Basnett changed title from WIP: Add sub-types for float-type custom properties to Add sub-types for float-type custom properties 2023-04-08 01:30:36 +02:00
Colin Basnett self-assigned this 2023-04-08 01:31:12 +02:00
Colin Basnett changed title from Add sub-types for float-type custom properties to Core: Add sub-types for float-type custom properties 2023-04-08 02:02:15 +02:00
Colin Basnett added the
Module
Core
label 2023-04-08 02:02:33 +02:00
Colin Basnett requested review from Sybren A. Stüvel 2023-04-11 11:18:04 +02:00
Colin Basnett requested review from Campbell Barton 2023-04-11 11:18:18 +02:00
Campbell Barton requested changes 2023-04-13 09:22:26 +02:00
Campbell Barton left a comment
Owner

Initial review, I didn't check on the changes to _init_subtype in detail.

Initial review, I didn't check on the changes to `_init_subtype` in detail.
@ -1357,3 +1357,3 @@
)
# Most useful entries of rna_enum_property_subtype_items for number arrays:
rna_number_subtype_items = (

The reference to rna_enum_property_subtype_items was removed, this seems like it would be useful to keep, otherwise there is no hint that this is duplicating information defined elsewhere.

A reference to the enum the newly added list is copied from would be good here too.

The reference to `rna_enum_property_subtype_items` was removed, this seems like it would be useful to keep, otherwise there is no hint that this is duplicating information defined elsewhere. A reference to the enum the newly added list is copied from would be good here too.
Author
Member

I have restored the comment.

I have restored the comment.
@ -1366,6 +1375,21 @@ rna_vector_subtype_items = (
)
def subtype_items_cb(self, context):

This adds top-level functions without to wm.py which are isolated to WM_OT_properties_edit, prefer static methods on WM_OT_properties_edit to make it clear they're spesific to that operator.

This adds top-level functions without to `wm.py` which are isolated to `WM_OT_properties_edit`, prefer static methods on `WM_OT_properties_edit` to make it clear they're spesific to that operator.
Author
Member

I've moved them both into the WM_OT_properties_edit namespace.

I've moved them both into the WM_OT_properties_edit namespace.
Campbell Barton requested review from Hans Goudey 2023-04-13 09:23:02 +02:00
Colin Basnett added 1 commit 2023-04-14 11:08:40 +02:00
Colin Basnett requested review from Campbell Barton 2023-04-14 11:09:17 +02:00
Colin Basnett added 1 commit 2023-04-15 07:01:00 +02:00
Hans Goudey approved these changes 2023-04-18 22:44:29 +02:00
Hans Goudey left a comment
Member

This works pretty nicely in my testing. Campbell should probably have another look at it though.

This works pretty nicely in my testing. Campbell should probably have another look at it though.
@ -1372,6 +1382,19 @@ class WM_OT_properties_edit(Operator):
bl_label = "Edit Property"
# register only because invoke_props_popup requires.
bl_options = {'REGISTER', 'INTERNAL'}
Member

Trailing whitespace here

Trailing whitespace here
cmbasnett marked this conversation as resolved
@ -1375,0 +1385,4 @@
def subtype_items_cb(self, context):
subtype_items = [
('NONE', "Plain Data", "Data values without special behavior")
Member

It seems a bit simpler to duplicate NONE between the vector subtypes and the float subtypes. What do you think about that? Totally fine if you disagree, not a strong opinion at all.

It seems a bit simpler to duplicate `NONE` between the vector subtypes and the float subtypes. What do you think about that? Totally fine if you disagree, not a strong opinion at all.
Author
Member

I'd prefer to not have to duplicate the string literal and just have a single-source-of-truth for the NONE entry.

I'd prefer to not have to duplicate the string literal and just have a single-source-of-truth for the `NONE` entry.

Agree duplicating NONE is simpler but that can be done using a variable:

rna_generic_subtype_none_item = ('NONE', "Plain Data", "Data values without special behavior")

rna_number_subtype_items = (
    rna_generic_subtype_none_item,
    ('PIXEL', "Pixel", ""),
    ... snip ...
)

rna_vector_subtype_items = (
    rna_generic_subtype_none_item,
    ('COLOR', "Linear Color", "Color in the linear space"),
    ... snip ...
)
Agree duplicating NONE is simpler but that can be done using a variable: ``` rna_generic_subtype_none_item = ('NONE', "Plain Data", "Data values without special behavior") rna_number_subtype_items = ( rna_generic_subtype_none_item, ('PIXEL', "Pixel", ""), ... snip ... ) rna_vector_subtype_items = ( rna_generic_subtype_none_item, ('COLOR', "Linear Color", "Color in the linear space"), ... snip ... ) ```
Colin Basnett added 2 commits 2023-04-19 07:04:46 +02:00

The proposal looks good to me. As for the code, I'll step down as reviewer as I trust Hans and Campbell to already do a good job.

The proposal looks good to me. As for the code, I'll step down as reviewer as I trust Hans and Campbell to already do a good job.
Sybren A. Stüvel refused to review 2023-04-20 10:59:40 +02:00
Sybren A. Stüvel added the
Interest
Animation & Rigging
label 2023-04-20 11:00:11 +02:00
Campbell Barton approved these changes 2023-04-26 11:31:47 +02:00
Campbell Barton left a comment
Owner

Accepting with minor change requested.

Accepting with minor change requested.
Colin Basnett added 1 commit 2023-04-28 05:13:38 +02:00
Colin Basnett added 1 commit 2023-04-28 05:37:33 +02:00
Colin Basnett merged commit 6e2721da30 into main 2023-04-28 05:44:55 +02:00
Colin Basnett deleted branch cmbasnett/custom-property-float-subtypes 2023-04-28 05:44:56 +02:00
Howard Trickey referenced this issue from a commit 2023-05-29 02:51:43 +02:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#106700
No description provided.