I am writing an addon that needs to access faces and face maps in edit mode. (I am referering to the face maps that appeared in Blender 3.0 and can be used similar to vertex groups rather than UV face maps)

Except for the edit mode, the same question was already asked here Access Face Maps using python script . The accepted solution was for object mode only.

I understand that I have to evaluate the bmesh object, and then attach the face map to it. I fail to understand how to find the face map data in this approach.

This is the code so far. It draws a panel in the 3D view. It needs to show some statistics in Object mode, and interact with faces and face maps in Edit mode:

import bpy


class Shaper_Panel(bpy.types.Panel):
    bl_category = "Shaper SVG"
    bl_space_type = 'VIEW_3D'
    bl_region_type = 'UI'

class BG_PT_Shaper_SVG(Shaper_Panel):
    bl_label = "Export Shaper SVG"

    def draw(self, context) -> None:
        obj = context.object

        if obj.mode == 'OBJECT' and obj.data.face_maps.active is not None:
                for polygon_id, face_map_data in enumerate(obj.data.face_maps.active.data):
                    face_map_id = face_map_data.value
                    if face_map_id > -1:

                        name = obj.face_maps[face_map_id].name

                        # displaying coordinates as placeholder for exporting them
                        for vertex_id in obj.data.polygons[polygon_id].vertices:
                            co = obj.data.vertices[vertex_id].co
                            coordinates = f'({co.x:.1f}, {co.y:.1f}, {co.z:.1f})'

        elif obj.mode == 'EDIT':

            depsgraph = bpy.context.evaluated_depsgraph_get()
            evaluated_mesh = obj.evaluated_get(depsgraph).data
            # ???

Is it really impossible to get the actual facemap data in edit mode (with the current Python API), or is it just complicated?



You must log in to answer this question.

Browse other questions tagged .