Page MenuHome

uvmap causes crash when entering texture paint mode
Closed, ResolvedPublic


System Information
Operating system and graphics card
OS: windows 8.1 64bit

Blender Version
version 2.75 (sub 2), branch b'master', commit date b'2015-07-17' b'13:15', hash b'955c13d'
Worked: (optional)

Short description of error
when switching to texture paint mode blender crashes. i could pin it down to the uv map, when i remove it i can enter texture paint mode without crashing.

Exact steps for others to reproduce the error
Based on a (as simple as possible) attached .blend file with minimum amount of steps

blend file:

  1. open the blend file
  2. switch to texture paint mode with the object selected
  3. blender crashes


# Blender 2.75 (sub 2), Commit date: 2015-07-21 11:49, Hash 9ae39a1
bpy.ops.view3d.layers(nr=5, extend=False)  # Operator
bpy.context.scene.layers[10] = True  # Property
bpy.context.scene.layers[0] = True  # Property
bpy.ops.object.delete(use_global=False)  # Operator
bpy.ops.object.delete(use_global=False)  # Operator
bpy.context.space_data.recent_folders_active = 0  # Property
bpy.ops.object.delete(use_global=False)  # Operator
bpy.ops.object.delete(use_global=False)  # Operator
bpy.context.space_data.context = 'MODIFIER'  # Property
bpy.ops.object.modifier_remove(modifier="Shrinkwrap")  # Operator
bpy.ops.object.modifier_remove(modifier="Lattice")  # Operator
bpy.ops.paint.texture_paint_toggle()  # Operator

# backtrace
35: BLI_system_backtrace - 0xF2304F0
34: blender_crash_handler_backtrace - 0xDFCBC60
33: blender_crash_handler - 0xDFCBCB0
32: windows_exception_handler - 0xDFCBF30
31: UnhandledExceptionFilter - 0x715F1AD0
30: memset - 0x742C5140
29: _C_specific_handler - 0x742B2800
28: _chkstk - 0x742C3E70
27: RtlRaiseException - 0x74283920
26: KiUserExceptionDispatcher - 0x742C3060
25: copy_v2_v2 - 0xED5FA10
24: cdDM_buffer_copy_uv_texpaint - 0xED6B0D0
23: cdDM_copy_gpu_data - 0xED6B9B0
22: gpu_buffer_setup - 0xEAB4710
21: gpu_buffer_setup_type - 0xEAB4BA0
20: gpu_buffer_setup_common - 0xEAB4C60
19: GPU_texpaint_uv_setup - 0xEAAF550
18: cdDM_drawFacesTex_common - 0xED67830
17: cdDM_drawFacesTex - 0xED67EF0
16: draw_mesh_textured_old - 0xE190170
15: draw_mesh_textured - 0xE18C2F0
14: draw_mesh_fancy - 0xE148E50
13: draw_mesh_object - 0xE149E10
12: draw_object - 0xE137610
11: view3d_draw_objects - 0xE124F00
10: view3d_main_area_draw_objects - 0xE126E50
9: view3d_main_area_draw - 0xE11C310
8: ED_region_do_draw - 0xE4AA9D0
7: wm_method_draw_triple - 0xE002590
6: wm_draw_update - 0xE000610
5: WM_main - 0xDFD0FB0
4: main - 0xDFCF4D0
3: __tmainCRTStartup - 0x125E80F0
2: mainCRTStartup - 0x125E8310
1: BaseThreadInitThunk - 0x722113B0
0: RtlUserThreadStart - 0x74245410

Event Timeline

dan grauer (kromar) set Type to Bug.
dan grauer (kromar) created this task.
dan grauer (kromar) raised the priority of this task from to Needs Triage by Developer.
Antony Riakiotakis (psy-fi) triaged this task as Normal priority.Jul 24 2015, 4:11 PM

I would be very interested to know how this file was created.

The file even crashes on 2.75 official. It's caused by the stencil layer not being there (usually it's the same as the UV layer). Also looks like the stencil layer index is set to 2, while the mesh only has one UV layer. This should be impossible normally. I can add checks in the code to ensure it is within bounds, but best would be to know what caused the file to have this behaviour in the first place.

Deletion of Shrinkwrap and Lattice modifier is recorded in crashlog attached in detail, but such modifier is not set in attached .blend file.
Is crashlog a thing recorded with attached .blend file?

@antony kaua (antony): i will see if i can figure out what happened there
@perfection cat: it is the same blend file, i just stripped it down because i can not upload the full scene. but since it also happens when the modifiers are removed i dont think they are relevant to the problem.

dan grauer (kromar) renamed this task from uvmaap causes crash when entering texture paint mode to uvmap causes crash when entering texture paint mode.Jul 27 2015, 10:29 AM

so i looked into the scene to see how this came to be, and it has a long history. Models in the scene have been made in the age of 2.49 and were at some point ported to 2.5+, there was a lot of stuff like multiple uvmaps, drivers, and deformation setups with lattices and such that have been removed over the years and also stencil layers.
my best guess is that we manually assigned a uvmap to a stencil layer which later got removed and somehow created this special case.

How was the stencil layer assigned manually? was it through a python script?

The fix I will attempt will do two things:

  1. Block the code path that caused the issue from doing it (if it still exists, since this is such an old file, and only if you remember how it was done in the first place)
  2. Add code to the mesh_validate function to fix stencil indices. Then you'll have to run the function in the text editor. This should fix any invalid indices of stencils and you should be able to work on the file normally. I will post details here when it's ready.

i think it was manually, i cant remember ever using a script for stencils.

This comment was removed by dan grauer (kromar).

Since there is no recollection of how the file was produced and there's such a complicated history, we can do little to fix the real cause of the issue. There is a big chance this won't happen with regular use of recent versions though.

To fix the file, I have added functionality in mesh validation that fixes the invalid indices for you.
Just go to a text editor or a console and run this python script:

import bpy

for me in

thanks a lot for adding the functionality! i also dont think this will happen with recent files and probably not possible to reproduce this without messing with very old blender versions.