Enabling face orientation color highlighting in Blender using Python API

To enable color highlighting of mesh polygon orientation, we need to on the “Face Orientation” checkbox in the “Viewport Overlays” menu. To turn off the highlighting, we need to uncheck this checkbox. This can be done either manually or using the Blender Python API.

To turn on and off the polygon orientation highlighting, we need to change the value of the “show_face_orientation” property of the “overlay” object. To turn on the highlighting, we need to set this property to True.

If we execute this command not from the 3D viewport, but from the context of another area, for example, the Text Editor, we will need to override the context.

First, get a pointer to the 3D viewport area:

And specify it in the temporary context override block.

First, to get the current value – to find out whether the color backlight is already on or not.

The False value means that the highlight is off (the checkbox is unchecked).

To turn on the highlight and on the checkbox, assign this property the value of True.

As we can see visually, the checkbox is now checked and the back-oriented polygons are highlighted in red.

To turn the highlighting back off, we need to set this property to False in the same way.

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comment
Newest
Oldest Most Voted
Inline Feedbacks
View all comments