Fix #92621: foreach_get/set doesn't work for enum #115508
No reviewers
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
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
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
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
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
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
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
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
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#115508
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "Mysteryem/blender:fix_non_raw_enum_foreach_getset"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
There were two issues at play here.
The first is that only enum properties with raw array access were
supported.
The second is that if the item property pointer was found immediately,
rna_raw_access
could fall back to the slower loop without checking ifthe property was an enum property, which the slower loop did not
support. This would cause the code to go through the entire slower loop
without doing anything. In the case of
foreach_get
without acompatible buffer, this meant that the temporary, uninitialized array
(which was supposed to be set by
rna_raw_access
) would be converted toPython integers, causing garbage values to be retrieved by
foreach_get
, since they were created from uninitialized memory.This patch adds support for enum properties that are not arrays and adds
asserts if an enum array property is encountered because they do not
exist.
Additional unreachable asserts have been added to the default case of
each switch block within the slower loop because there are prior checks
that the property type is supported, so the switch blocks should never
get an unsupported property type.
I'm not sure if enum array properties are even supported in general, in which case, it might be a good idea to add an assertion.edit: Asserts have been added and the PR description has been updated.@blender-bot build
This LGTM, though would not mind having a second eye on it as well, @brecht or @ideasman42 ?
Enum array properties do not exist, they can not be created with either the C or Python API.
That should be an assert rather than an error message.
I've replaced the enum array error messages with asserts.
I think I could also add
BLI_assert_unreachable();
to the default case of each of the switch blocks?Adding
BLI_assert_unreachable()
as well sounds good.Thomas Barlow referenced this pull request2023-12-09 02:13:25 +01:00
@blender-bot build