0
$\begingroup$

I'm looking for a way to see the normal data of a face, represented as x, y and z in Blender 2.9x. Sounds simple, but I can't find the option anywhere. I seem to remember having the option in 2.79.

Just to clarify: I don't want to see the normal. I want the data.

$\endgroup$
1
  • 1
    $\begingroup$ I’m not sure you can have it display the numeric data in the viewport, but you can probably get to it with the python API. $\endgroup$
    – TheLabCat
    Feb 25 '21 at 18:45
1
$\begingroup$

Like ZargulTheWizard said, scripting was needed. It turned out I had the script saved in a file from years ago. I'm a bit reluctant to post the script as I'm fairly certain I didn't write it myself, but I can't find the source when searching. So in order to help others I'll post it here. If you are the author, please let me know and I'll give credit accordingly.

enter image description here

This script will create an additional property in the "Normals" menu of the "Object Data Properties" tab:

import bpy
import bmesh
from mathutils import Vector

def draw_func(self, context):
    layout = self.layout

    me = context.object.data

    if me.is_editmode:
        bm = bmesh.from_edit_mesh(me)
        if bm.faces.active is not None:
            row = layout.row()
            col = row.column()
            col.prop(context.window_manager, "active_face_normal", text="", expand=True)
            row.prop(context.window_manager, "active_face_normal", text="")

            if context.window_manager.active_face_normal != bm.faces.active.normal:
                context.window_manager.active_face_normal = bm.faces.active.normal

    else:
        p = me.polygons
        if p.active is not None:
            row = layout.row()
            col = row.column()
            col.prop(p[p.active], "normal", text="", expand=True)
            row.prop(p[p.active], "normal", text="")


def upd_normal(self, context):
    bm = bmesh.from_edit_mesh(context.object.data)
    bm.faces.active.normal = self.active_face_normal.normalized()

def register():
    bpy.types.DATA_PT_normals.prepend(draw_func)
    bpy.types.WindowManager.active_face_normal = bpy.props.FloatVectorProperty(subtype='DIRECTION', precision=3, update=upd_normal)


def unregister():
    bpy.types.DATA_PT_normals.remove(draw_func)
    del bpy.types.WindowManager.active_face_normal



if __name__ == "__main__":
    register()
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.