How to get mesh data with modifiers

When referring to the mesh geometry – its vertices, edges, and polygons, Blender operates with the original data without the usage of modifiers added to the object.

For example, the number of vertices of the active object, we can get with the following command:

And it will be returned without considering the object’s Subdivision modifier, which modifies the mesh’s geometry, increasing it.

So for a cube that has the Subdivision modifier added:

To get the object’s geometry, considering the modifiers that change it, we need to refer to the object through the “depsgraph” structure, which makes it possible to access the real state of the scene.

First, we need to get the “depsgraph” object for the current context:

Then, to get the “evaluated” version of the desired object, in which the effect of all modifiers has already been taken:

And through the evaluated object, get the geometry data.

We obtained the real data of the cube’s geometry like the Subdivision modifier was applied.


Author: Nikita

Blender add-ons developer and articles writer.

0 0 vote
Article Rating
Notify of
0 Comment
Inline Feedbacks
View all comments