Keyframe returned by keyframe_points.insert() gets ruined by any other call to keyframe_points.insert() #83044
Labels
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
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#83044
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
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?
System Information
Operating system: Windows-7-6.1.7601-SP1 64 Bits
Graphics card: Quadro K2000/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 385.69
Blender Version
Broken: version: 2.83.4, branch: master, commit date: 2020-08-05 06:00, hash:
c113af8288
Worked: (newest version of Blender that worked as expected)
Short description of error
Keyframe_points handles not set
Exact steps for others to reproduce the error
Default startup with Cube
A simple script not setting the keyframe_points handles to the specified points
Note :The handles of the last point are correct
A simple script setting them to their correct points
keyframe_points.insert
insert_bezt_fcurve
will actually realloc the wholefcu->bezt
[which holds your "keyframes"], see [here ]] and [ https:*developer.blender.org/diffusion/B/browse/master/source/blender/editors/animation/keyframing.c$453 | hereTo check, just compare the memory addresses:
Added subscriber: @martburg
it get' even better when more points are added the already correct handles get overwritten
Added subscriber: @lichtwerk
Changed status from 'Needs Triage' to: 'Confirmed'
Will check
Not sure how this is supposed to work correctly, but here are my findings:
keyframe_points.insert
insert_bezt_fcurve
will actually realloc the wholefcu->bezt
[which holds your "keyframes"], see [here ]] and [ https:*developer.blender.org/diffusion/B/browse/master/source/blender/editors/animation/keyframing.c$453 | hereTo check, just compare the memory addresses:
Now, one might come to the conclusion that the return value is still usable for the time no other keyframe has been inserted, but this fails as well (I havent tracked down this further):
So to me it looks like the returned Keyframe of
keyframe_points.insert
gets broken by every other call tokeyframe_points.insert
.And the way inserting keyframes happens internally, there is also no easy way out.
Keyframe_points handles not setto Keyframe returned by keyframe_points.insert() gets ruined by any other call to keyframe_points.insert()I think this also answers the point raised in #82227 (Inconsistent Behavior T81299)
Yes, it does ---- you were faster
THX
Martin
Added subscriber: @dr.sybren
fcurve.keyframe_points.insert()
sorts the keyframes to ensure they're stored in order of timestamp. This means that Python objects created before the call are not necessarily valid after that call. Passoptions={'FAST'}
to prevent this, and callfcurve.update()
after the work on the curve is done.@dr.sybren: thx looking into this.
Unfortunately, this doesnt seem to work...
#83044.blend
Am I doing something wrong?
Looks like all of this is still true -- even for
options={'FAST'}
For the last call, address is the same, previous ones are ruined.
Changed status from 'Confirmed' to: 'Archived'
Ah yes, I confused two things.
options={'FAST'}
skips the calculation of automatic handles. Reordering of the keyframes always happens.I'm closing this as invalid, as this is not a bug but simply how Blender works. This is similar to the array re-allocation described in the "Gochas" section of the Python API documentation.
This is good to know!