Fix #102885: IDproperty subtype can cause Blender UI to throw exception #112582

Closed
Jorijn de Graaf wants to merge 2 commits from bonj/blender:fix/custom-property-subtype into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
Contributor

When the subtype of a custom property is set programmatically to something that isn't in the subtype enum of this operator, attempting to edit it will throw an error.
This check should avoid that, by simply not setting the subtype if it's not in the enum, resulting in a default subtype of NONE.
It would also be good to add some more subtypes for float array, but I'll do that in a separate PR.

When the subtype of a custom property is set programmatically to something that isn't in the subtype enum of this operator, attempting to edit it will throw an error. This check should avoid that, by simply not setting the subtype if it's not in the enum, resulting in a default subtype of NONE. It would also be good to add some more subtypes for float array, but I'll do that in a separate PR.
Jorijn de Graaf added 1 commit 2023-09-19 16:03:42 +02:00
a9c04195c1 Check whether custom property subtype is valid
When the subtype of a custom property is set programmatically to something that isn't in the subtype enum of this operator, attempting to edit it will throw an error.
This check should avoid that, by simply not setting the subtype if it's not in the enum, resulting in a default subtype of NONE.
Jorijn de Graaf requested review from Hans Goudey 2023-09-19 16:07:19 +02:00
Jorijn de Graaf requested review from Campbell Barton 2023-09-19 16:07:24 +02:00
Author
Contributor

Here is the PR that adds more subtypes for float array: #112583

Here is the PR that adds more subtypes for float array: https://projects.blender.org/blender/blender/pulls/112583

I'm not really up on the details. Is the subtype supported?

I feel like it would be better to somehow throw an error message the moment an invalid subtype is set instead of silently changing/hiding some setting when editing the property.

I'm not really up on the details. Is the subtype supported? I feel like it would be better to somehow throw an error message the moment an invalid subtype is set instead of silently changing/hiding some setting when editing the property.
Author
Contributor

Blender is fine with any subtype for any property, but not all of them make sense to use.
If a subtype doesn't make sense to use (for example PASSWORD for a float property), it behaves the same way as subtype NONE.
Currently the issue with this operator is that it only exposes a small number of subtypes to the user, and attempting to edit a property that has a subtype not in its list, results in an error.
This error isn't intentional, but result of an oversight, and prevents you from editing the property.

My solution comes in two parts: a different PR which adds more subtypes to this operator, and this PR which fixes the error when a subtype isn't in the list.
Without the error, you are able to set the subtype to any in the list, or cancel and leave it as-is.
I suppose an alternative solution would be to show all subtypes in the list, but it wouldn't be the best user experience.

Blender is fine with any subtype for any property, but not all of them make sense to use. If a subtype doesn't make sense to use (for example PASSWORD for a float property), it behaves the same way as subtype NONE. Currently the issue with this operator is that it only exposes a small number of subtypes to the user, and attempting to edit a property that has a subtype not in its list, results in an error. This error isn't intentional, but result of an oversight, and prevents you from editing the property. My solution comes in two parts: a different PR which adds more subtypes to this operator, and this PR which fixes the error when a subtype isn't in the list. Without the error, you are able to set the subtype to any in the list, or cancel and leave it as-is. I suppose an alternative solution would be to show all subtypes in the list, but it wouldn't be the best user experience.
Hans Goudey approved these changes 2023-09-26 19:47:48 +02:00
Author
Contributor

Is there anything I need to do here?

Is there anything I need to do here?
Jorijn de Graaf added 1 commit 2023-10-19 23:07:49 +02:00
Member

Hmm, sorry I had forgotten about this. The PR should be rebased to the 4.0 branch now though, since that's where bug fixes go at this stage of the release cycle. There's more info about that here: https://wiki.blender.org/wiki/Tools/Pull_Requests

Hmm, sorry I had forgotten about this. The PR should be rebased to the 4.0 branch now though, since that's where bug fixes go at this stage of the release cycle. There's more info about that here: https://wiki.blender.org/wiki/Tools/Pull_Requests
Jorijn de Graaf closed this pull request 2023-10-21 14:52:41 +02:00
Jorijn de Graaf changed title from Fix #102885: IDproperty subtype can cause Blender UI to throw exception to Fix #102885: IDproperty subtype can cause Blender UI to throw exception 2023-10-21 14:55:59 +02:00
Author
Contributor

I didn't intend to close it, guess messing with branches locally broke something.

I didn't intend to close it, guess messing with branches locally broke something.
Jorijn de Graaf changed title from Fix #102885: IDproperty subtype can cause Blender UI to throw exception to Fix #102885: IDproperty subtype can cause Blender UI to throw exception 2023-10-21 14:56:40 +02:00

Pull request closed

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
3 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#112582
No description provided.