Moving python-made channels freezes Blender #81628

Closed
opened 2020-10-11 16:36:57 +02:00 by RedMser · 18 comments
Contributor

System Information
Operating system: Windows-10-10.0.18362-SP0 64 Bits
Operating system: Linux-4.15.0-45-generic-x86_64-with-debian-buster-sid 64 Bits
Graphics card: GeForce RTX 2080/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 456.55

Blender Version
Broken: version: 2.91.0 Alpha, branch: master, commit date: 2020-10-09 21:39, hash: 7ab8d7c939
Broken in Blender 2.83 and 2.79 as well, so it maybe never worked before?

Short description of error
Moving a channel of an animated curve created with Python gets Blender stuck in an infinite loop.

Exact steps for others to reproduce the error

  • Create a NURBS curve which has two animated vertices
@@ -264,27 +264,27 @@ class ANIM_OT_insert_keyframe_animall(Operator):
                                     or CV.select_left_handle
                                     or CV.select_right_handle):
                                 if animall_properties.key_points:
-                                    insert_key(CV, 'co', group="Spline %s CV %s" % (s_i, v_i))
-                                    insert_key(CV, 'handle_left', group="Spline %s CV %s" % (s_i, v_i))
-                                    insert_key(CV, 'handle_right', group="Spline %s CV %s" % (s_i, v_i))
+                                    insert_key(CV, 'co', group="S%s V%s" % (s_i, v_i))
+                                    insert_key(CV, 'handle_left', group="S%s V%s" % (s_i, v_i))
+                                    insert_key(CV, 'handle_right', group="S%s V%s" % (s_i, v_i))
 
                                 if animall_properties.key_radius:
-                                    insert_key(CV, 'radius', group="Spline %s CV %s" % (s_i, v_i))
+                                    insert_key(CV, 'radius', group="S%s V%s" % (s_i, v_i))
 
                                 if animall_properties.key_tilt:
-                                    insert_key(CV, 'tilt', group="Spline %s CV %s" % (s_i, v_i))
+                                    insert_key(CV, 'tilt', group="S%s V%s" % (s_i, v_i))
 
                     elif spline.type in ('POLY', 'NURBS'):
                         for v_i, CV in enumerate(spline.points):
                             if not animall_properties.key_selected or CV.select:
                                 if animall_properties.key_points:
-                                    insert_key(CV, 'co', group="Spline %s CV %s" % (s_i, v_i))
+                                    insert_key(CV, 'co', group="S%s V%s" % (s_i, v_i))
 
                                 if animall_properties.key_radius:
-                                    insert_key(CV, 'radius', group="Spline %s CV %s" % (s_i, v_i))
+                                    insert_key(CV, 'radius', group="S%s V%s" % (s_i, v_i))
 
                                 if animall_properties.key_tilt:
-                                    insert_key(CV, 'tilt', group="Spline %s CV %s" % (s_i, v_i))
+                                    insert_key(CV, 'tilt', group="S%s V%s" % (s_i, v_i))
 
         bpy.ops.object.mode_set(mode='OBJECT')
  • Simple file for easy reproduction of this step: anim-move-curve-channel-crash.blend
  • In the Dopesheet Editor, click on Channel -> Move -> Up (or Down)
  • Blender gets frozen until you manually kill the process

Note that without my changes to the addon, this does not happen.
See this file for comparison - same steps as above, but using the default AnimAll addon, no crash here: anim-move-curve-channel-no-crash.blend
So it's probably related to the names of the keyframe groups?

To help with debugging, Blender gets stuck forever inside rearrange_action_channels -> join_groups_action_temp -> for (fcu = agrp->channels.first; fcu; fcu = fcu->next) in file anim_channels_edit.c

**System Information** Operating system: Windows-10-10.0.18362-SP0 64 Bits Operating system: Linux-4.15.0-45-generic-x86_64-with-debian-buster-sid 64 Bits Graphics card: GeForce RTX 2080/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 456.55 **Blender Version** Broken: version: 2.91.0 Alpha, branch: master, commit date: 2020-10-09 21:39, hash: `7ab8d7c939` Broken in Blender 2.83 and 2.79 as well, so it maybe never worked before? **Short description of error** Moving a channel of an animated curve created with Python gets Blender stuck in an infinite loop. **Exact steps for others to reproduce the error** - Create a NURBS curve which has two animated vertices - I have slightly modified the AnimAll addon for this, see my changes here: [P1694: AnimAll changes](https://archive.blender.org/developer/P1694.txt) ```diff @@ -264,27 +264,27 @@ class ANIM_OT_insert_keyframe_animall(Operator): or CV.select_left_handle or CV.select_right_handle): if animall_properties.key_points: - insert_key(CV, 'co', group="Spline %s CV %s" % (s_i, v_i)) - insert_key(CV, 'handle_left', group="Spline %s CV %s" % (s_i, v_i)) - insert_key(CV, 'handle_right', group="Spline %s CV %s" % (s_i, v_i)) + insert_key(CV, 'co', group="S%s V%s" % (s_i, v_i)) + insert_key(CV, 'handle_left', group="S%s V%s" % (s_i, v_i)) + insert_key(CV, 'handle_right', group="S%s V%s" % (s_i, v_i)) if animall_properties.key_radius: - insert_key(CV, 'radius', group="Spline %s CV %s" % (s_i, v_i)) + insert_key(CV, 'radius', group="S%s V%s" % (s_i, v_i)) if animall_properties.key_tilt: - insert_key(CV, 'tilt', group="Spline %s CV %s" % (s_i, v_i)) + insert_key(CV, 'tilt', group="S%s V%s" % (s_i, v_i)) elif spline.type in ('POLY', 'NURBS'): for v_i, CV in enumerate(spline.points): if not animall_properties.key_selected or CV.select: if animall_properties.key_points: - insert_key(CV, 'co', group="Spline %s CV %s" % (s_i, v_i)) + insert_key(CV, 'co', group="S%s V%s" % (s_i, v_i)) if animall_properties.key_radius: - insert_key(CV, 'radius', group="Spline %s CV %s" % (s_i, v_i)) + insert_key(CV, 'radius', group="S%s V%s" % (s_i, v_i)) if animall_properties.key_tilt: - insert_key(CV, 'tilt', group="Spline %s CV %s" % (s_i, v_i)) + insert_key(CV, 'tilt', group="S%s V%s" % (s_i, v_i)) bpy.ops.object.mode_set(mode='OBJECT') ``` - Simple file for easy reproduction of this step: [anim-move-curve-channel-crash.blend](https://archive.blender.org/developer/F8979284/anim-move-curve-channel-crash.blend) - In the Dopesheet Editor, click on Channel -> Move -> Up (or Down) - Blender gets frozen until you manually kill the process Note that without my changes to the addon, this does not happen. See this file for comparison - same steps as above, but using the default AnimAll addon, no crash here: [anim-move-curve-channel-no-crash.blend](https://archive.blender.org/developer/F8979300/anim-move-curve-channel-no-crash.blend) So it's probably related to the names of the keyframe groups? To help with debugging, Blender gets stuck forever inside `rearrange_action_channels` -> `join_groups_action_temp` -> `for (fcu = agrp->channels.first; fcu; fcu = fcu->next)` in file `anim_channels_edit.c`
Author
Contributor

Added subscriber: @RedMser

Added subscriber: @RedMser
Member

Added subscriber: @lichtwerk

Added subscriber: @lichtwerk
Member

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'
Philipp Oeser self-assigned this 2020-10-12 10:44:43 +02:00
Member

Can confirm, will check on this.

Can confirm, will check on this.
Member

First note: for some reason the bActionGroups are not in the right order in the failing file.
I think what should always be the case is that the last ActionGroup's last FCurve should not have fcu->next set (it should be NULL).
The preceeding ActionGroups last FCurve fcu->next should point to something valid (probably the first FCurve in the next bActionGroup)

In the borked case of this modified Addon (or just the file that results from it), the first ActionGroup's last FCurve fcu->next is already NULL.

This confuses code in split_groups_action_temp, it then thinks there are channels outside of groups, puts them in a #TempGroup and things go downhill from here.

Needs a bit more investigation if this a possible failure in the Python API or if this fails elsewhere. Stay tuned.

First note: for some reason the `bActionGroup`s are not in the right order in the failing file. I *think* what should always be the case is that the **last** ActionGroup's last FCurve should not have `fcu->next` set (it should be NULL). The preceeding ActionGroups last FCurve `fcu->next` should point to something valid (probably the first FCurve in the next `bActionGroup`) In the borked case of this modified Addon (or just the file that results from it), the **first** ActionGroup's last FCurve `fcu->next` is already NULL. This confuses code in `split_groups_action_temp`, it then thinks there are channels outside of groups, puts them in a `#TempGroup` and things go downhill from here. Needs a bit more investigation if this a possible failure in the Python API or if this fails elsewhere. Stay tuned.

Added subscriber: @dr.sybren

Added subscriber: @dr.sybren

@lichtwerk do you have a simple way of reproducing the issue that doesn't rely on modifying some add-on?

@lichtwerk do you have a simple way of reproducing the issue that doesn't rely on modifying some add-on?
Member

@dr.sybren: I am off today, but this is on my list. I have only reproduced using the method shown here, but I assume this can be reproduced in a simpler way, too.

@dr.sybren: I am off today, but this is on my list. I have only reproduced using the method shown here, but I assume this can be reproduced in a simpler way, too.
Philipp Oeser removed their assignment 2020-11-02 16:37:55 +01:00
Member

Will step down to not block others

Will step down to not block others

Changed status from 'Confirmed' to: 'Needs User Info'

Changed status from 'Confirmed' to: 'Needs User Info'

Thanks for the report. Unfortunately the scenario described is too time consuming for us to track down, we require the bug reporter to narrow down the problem.

Normally .blend files can be simplified by removing most objects and disabling settings, until the problem reveals itself more clearly.

In this case, please make it possible to reproduce the issue with just a bit of Python code, instead of asking us to change the code of an add-on.

Thanks for the report. Unfortunately the scenario described is too time consuming for us to track down, we require the bug reporter to narrow down the problem. Normally .blend files can be simplified by removing most objects and disabling settings, until the problem reveals itself more clearly. In this case, please make it possible to reproduce the issue with just a bit of Python code, instead of asking us to change the code of an add-on.

No activity for more than a week. As per the tracker policy we assume the issue is gone and can be closed.

Thanks again for the report. If the problem persists please open a new report with the required information.

No activity for more than a week. As per the tracker policy we assume the issue is gone and can be closed. Thanks again for the report. If the problem persists please open a new report with the required information.
Member

Added subscriber: @pioverfour

Added subscriber: @pioverfour
Member

I don’t believe modifying AnimAll is necessary. I could reproduce the crash with the following script:

import bpy

# Setup
curve = bpy.data.curves.new("curve", "CURVE")
curve_obj = bpy.data.objects.new("curve", curve)

spline = curve.splines.new("NURBS")
spline.points.add(4)

bpy.context.collection.objects.link(curve_obj)
bpy.context.view_layer.objects.active = curve_obj
curve_obj.select_set(True)


# Insert keyframes
curve.splines- [x].points- [x].keyframe_insert("co", group="Spline 0 CV 3")
curve.splines- [x].points- [x].keyframe_insert("co", group="Spline 0 CV 0")

bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.object.mode_set(mode='OBJECT')
bpy.ops.object.mode_set(mode='EDIT')

The double mode toggling at the end is necessary for the crash to happen. This is done in AnimAll because some types of keyframes can only be inserted in a specific mode.
The steps to reproduce are thus:

  • Run this script
  • Open dope sheet
  • Select a channel group
  • Channel -> Move -> Up or press PageUp
I don’t believe modifying AnimAll is necessary. I could reproduce the crash with the following script: ```lang=python import bpy # Setup curve = bpy.data.curves.new("curve", "CURVE") curve_obj = bpy.data.objects.new("curve", curve) spline = curve.splines.new("NURBS") spline.points.add(4) bpy.context.collection.objects.link(curve_obj) bpy.context.view_layer.objects.active = curve_obj curve_obj.select_set(True) # Insert keyframes curve.splines- [x].points- [x].keyframe_insert("co", group="Spline 0 CV 3") curve.splines- [x].points- [x].keyframe_insert("co", group="Spline 0 CV 0") bpy.ops.object.mode_set(mode='EDIT') bpy.ops.object.mode_set(mode='OBJECT') bpy.ops.object.mode_set(mode='EDIT') ``` The double mode toggling at the end is necessary for the crash to happen. This is done in AnimAll because some types of keyframes can only be inserted in a specific mode. The steps to reproduce are thus: * Run this script * Open dope sheet * Select a channel group * Channel -> Move -> Up or press `PageUp`
Member

Changed status from 'Needs User Info' to: 'Needs Triage'

Changed status from 'Needs User Info' to: 'Needs Triage'

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'
Sybren A. Stüvel self-assigned this 2020-11-30 16:08:02 +01:00

This issue was referenced by 8c74c35ecb

This issue was referenced by 8c74c35ecb5b6416fcfc624e52c068ed90f48757

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
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
5 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#81628
No description provided.