EDIT: This apparently is a bug (https://developer.blender.org/T52723)
However, I'm still creating bmeshes in the draw method of my panels which is bad practice, but not the cause of this problem.
I've been developing an add-on for Re-Volt file types for a while.
I'm not sure if I discovered a bug or if I'm doing something wrong:
As soon as I call
bm.faces.layers.int.new("LayerName"), the UV Unwrap Reset operator starts behaving weirdly.
Usually, when you reset the UV on a cube, you get the faces mapped as squares. After creating a new int layer on the bmesh, it starts mapping faces to lines or other weird shapes that sometimes go beyond the UV bounds.
I create those int layers to store flags for each face. The layers are created upon import and in Edit mode. I made a tool panel for setting those flags. It all works fine, it just breaks the
Launching Blender with --debug-all also didn't reveal any interesting details. Everything in the logs looks like it's supposed to.
I also tried opening the Blender files with that problem in older and newer versions than 2.78 and the problem persists there, it seems to be in the mesh.
Here's a .blend with the problem: http://pasteall.org/blend/index.php?id=47471
Here's the wider context of creating a new int layer (panel in the 3D view):
class RevoltFacePropertiesPanel(bpy.types.Panel): bl_label = "Face Properties" bl_space_type = "VIEW_3D" bl_region_type = "TOOLS" bl_context = "mesh_edit" bl_category = "Re-Volt" selection = None selected_face_count = None @classmethod def poll(self, context): return (context.object is not None) def draw(self, context): pass obj = context.object mesh = obj.data bm = bmesh.from_edit_mesh(mesh) flags = bm.faces.layers.int.get("RVFlags") or bm.faces.layers.int.new("RVFlags") texture = bm.faces.layers.int.get("RVTexture") or bm.faces.layers.int.new("RVTexture")
Here's the section on GitHub if that helps: https://github.com/Dummiesman/HabitatB/blob/dev/io_scene_habitatb/panels.py#L104
Please tell me if I could provide more information. I'd be really thankful if someone has an idea.