KeyFrame.handle_left_type/handle_right_type cannot be used with foreach_get/foreach_set #115413

Closed
opened 2023-11-25 16:37:12 +01:00 by Thomas Barlow · 3 comments
Member

System Information
Operating system: Windows-10-10.0.19041-SP0 64 Bits
Graphics card: NVIDIA GeForce GTX 1070 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 536.40

Blender Version
Broken: version: 2.91.0, branch: master, commit date: 2020-11-25 08:34, hash: rB0f45cab862b8 and 4.1.0a
Worked: 2.90.1, branch: master, commit date: 2020-09-23 06:43, hash: rB3e85bb34d0d7

Short description of error
Attempting to use foreach_set (seemingly does nothing) or foreach_get (reads garbage) with the handle_left_type or handle_right_type properties does not work.

Possible cause: 27a5da4dc3
The h1 and h2 fields of the BezTriple struct were changed from char type to uint8_t type. I suspect the issue may be caused by makesrna.cc#rna_set_raw_property() not being updated to support the uint8_t type (many other types appear to be missing too, some of which can be seen in the IS_DNATYPE_INT_COMPAT and IS_DNATYPE_BOOLEAN_COMPAT macros in RNA_define.hh).

This is similar to #92621, but I think this is a separate issue with similar symptoms because the example in #92621 uses an int field.

Exact steps for others to reproduce the error
Open the attached .blend, run the two scripts and observe the output in the System Console.

The first script runs foreach_get with the handle_left_type, handle_right_type, interpolation and easing enum properties and a Python list and prints the result of each.

2.90 2.91 and newer
image image

The second script runs foreach_get again, but with buffers that print a message when they are accessed as a sequence. From these messages, the C type that bpy_rna.cc#foreach_getset() thinks is compatible with each property can be determined.
In 2.90, it thinks all the properties are compatible with 'b' (signed char), but in 2.91, it thinks the handle_left_type and handle_right_type properties are instead compatible with 'i' (int).

My suspicion for why 2.91+ thinks these are now 'i' compatible is that rna_access.cc#RNA_property_raw_type returns PROP_RAW_INT for PROP_ENUM whose rawtype is PROP_RAW_UNSET.

2.90 2.91 and newer
image image
**System Information** Operating system: Windows-10-10.0.19041-SP0 64 Bits Graphics card: NVIDIA GeForce GTX 1070 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 536.40 **Blender Version** Broken: version: 2.91.0, branch: master, commit date: 2020-11-25 08:34, hash: `rB0f45cab862b8` and 4.1.0a Worked: 2.90.1, branch: master, commit date: 2020-09-23 06:43, hash: `rB3e85bb34d0d7` **Short description of error** Attempting to use foreach_set (seemingly does nothing) or foreach_get (reads garbage) with the `handle_left_type` or `handle_right_type` properties does not work. Possible cause: https://projects.blender.org/blender/blender/commit/27a5da4dc3a399e1fe7e88dc8722a891e9cfcf78 The `h1` and `h2` fields of the `BezTriple` struct were changed from `char` type to `uint8_t` type. I suspect the issue may be caused by `makesrna.cc#rna_set_raw_property()` not being updated to support the `uint8_t` type (many other types appear to be missing too, some of which can be seen in the `IS_DNATYPE_INT_COMPAT` and `IS_DNATYPE_BOOLEAN_COMPAT` macros in `RNA_define.hh`). This is similar to #92621, but I think this is a separate issue with similar symptoms because the example in #92621 uses an `int` field. **Exact steps for others to reproduce the error** Open the attached .blend, run the two scripts and observe the output in the System Console. The first script runs foreach_get with the `handle_left_type`, `handle_right_type`, `interpolation` and `easing` enum properties and a Python list and prints the result of each. | 2.90 | 2.91 and newer | | -- | -- | | ![image](/attachments/d6230a33-9b70-4e07-bfa8-f17b87cfe2c3) | ![image](/attachments/a5494ba0-4278-47e2-ab49-57858e7bd07d) | The second script runs foreach_get again, but with buffers that print a message when they are accessed as a sequence. From these messages, the C type that `bpy_rna.cc#foreach_getset()` thinks is compatible with each property can be determined. In 2.90, it thinks all the properties are compatible with `'b'` (`signed char`), but in 2.91, it thinks the `handle_left_type` and `handle_right_type` properties are instead compatible with `'i'` (`int`). My suspicion for why 2.91+ thinks these are now `'i'` compatible is that `rna_access.cc#RNA_property_raw_type` returns `PROP_RAW_INT` for `PROP_ENUM` whose `rawtype` is `PROP_RAW_UNSET`. | 2.90 | 2.91 and newer | | -- | -- | | ![image](/attachments/82e8d146-9853-429e-9209-99d97787c09b) | ![image](/attachments/0da097db-287a-4726-8b71-deb12341ecb4) |
Thomas Barlow added the
Priority
Normal
Type
Report
Status
Needs Triage
labels 2023-11-25 16:37:13 +01:00
Author
Member

I've been looking into how to update the FBX IO addon to more accurately import FBX animation curves (reading the correct tangents/interpolation instead of always assuming linear interpolation is used) and maybe to export Blender animation curves directly without baking, and this issue will be a blocker due to animation import/export being far too slow without foreach_get/foreach_set.

I will try to investigate this more and test some of my suspicions.

I've been looking into how to update the FBX IO addon to more accurately import FBX animation curves (reading the correct tangents/interpolation instead of always assuming linear interpolation is used) and maybe to export Blender animation curves directly without baking, and this issue will be a blocker due to animation import/export being far too slow without foreach_get/foreach_set. I will try to investigate this more and test some of my suspicions.
Author
Member

My suspicions appear to be correct, though rather than the fields being uint8_t, they get remapped to uchar. I'll see about putting a PR together to fix this tomorrow.

Notably, int8_t, ushort, int64_t and uint64_t are also unaccounted for in makesrna.cc#rna_set_raw_property(), though the 64 bit types don't have an equivalent RawPropertyType. The full list of types appears to be those in makes_dna.cc#make_structDNA.

My suspicions appear to be correct, though rather than the fields being `uint8_t`, they get remapped to `uchar`. I'll see about putting a PR together to fix this tomorrow. Notably, `int8_t`, `ushort`, `int64_t` and `uint64_t` are also unaccounted for in `makesrna.cc#rna_set_raw_property()`, though the 64 bit types don't have an equivalent `RawPropertyType`. The full list of types appears to be those in `makes_dna.cc#make_structDNA`.
Pratik Borhade added
Module
Python API
Status
Confirmed
and removed
Status
Needs Triage
labels 2023-12-08 05:53:42 +01:00
Author
Member

Since e503536775 adds support for enum properties that don't have raw array access, this issue is fixed now too.

Adding the missing raw types would make accessing handle_left_type/handle_right_type faster, but since that falls under an improvement rather than a bug, I think this issue can be closed.

Since https://projects.blender.org/blender/blender/commit/e5035367750c95519d376a99625cfae4f80d0b00 adds support for enum properties that don't have raw array access, this issue is fixed now too. Adding the missing raw types would make accessing `handle_left_type`/`handle_right_type` faster, but since that falls under an improvement rather than a bug, I think this issue can be closed.
Blender Bot added
Status
Archived
and removed
Status
Confirmed
labels 2023-12-20 02:08:01 +01: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
1 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#115413
No description provided.