Maniphest T62632

Render Crash on Python Handler Manipulating Vertex Color
Closed, Duplicate

Assigned To
None
Authored By
hsab (hsab)
Mar 16 2019, 12:46 AM
Tags
  • BF Blender
Subscribers
hsab (hsab)

Description

System Information
Operating system: Linux-4.14.105-1-MANJARO-x86_64-with-arch-Manjaro-Linux 64 Bits
Graphics card: GeForce GTX 1080 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 418.43

Blender Version
Broken: version: 2.80 (sub 49), branch: master, commit date: 2019-03-15 18:31, hash: rBfb4bb611559b
Worked: 2.79

Intro
I've been having some real issues with the Python API and Vertex Colors. These issues initially started showing up while using Animation Nodes in 2.8. But I didn't want to occupy developer time for a 3rd party addon. However, I've been able to narrow down the issue using the Python API, purely in Blender.

Short description of error
Cylinder object with an animated armature and a subdiv modifier.
A python handler is responsible for randomizing vertex colors on every frame_change_pre.
Upon rendering the animation, blender crashes on the second frame, in both Eevee and Cycles.

def my_handler(scene):
    vc = bpy.data.meshes['Cylinder'].vertex_colors["Col"].data
    for i in range(0, len(vc)):
        rc = [random.random() for i in range(3)]
        vc[i].color = (rc[0], rc[1], rc[2], 1.0)
        print("Frame Change")


bpy.app.handlers.frame_change_pre.append(my_handler)

Exact steps for others to reproduce the error
"Run Script" in the attached file.
Then render the animation.


Event Timeline

hsab (hsab) created this task.Mar 16 2019, 12:46 AM
hsab (hsab) updated the task description.EditedMar 16 2019, 12:53 AM

For some unexplainable reason after changing the code to below, I have one blend file that renders successfully and one that crashes!

callCount = 0

def my_handler(scene):
    global callCount
    vc = bpy.data.meshes['Cylinder'].vertex_colors["Col"].data
    callCount = callCount + 1
    for i in range(0, len(vc)):
        rc = [random.random() for i in range(3)]
        vc[i].color = (rc[0], rc[1], rc[2], 1.0)
    print("Frame Change", callCount)


bpy.app.handlers.frame_change_pre.append(my_handler)

I've attached the files below:


Edit:
Please disregard this. The problem is that I can't manage to 100% replicate the crash on every trial. The working file also crashes:

hsab (hsab) updated the task description.Mar 16 2019, 1:03 AM