Get mesh data with modifiers applied in 2.8?

Used to be ob.to_mesh() could give you modifiers applied.
Doesn’t seem to work in the latest 2.8 builds.
Any ideas?

Thanks!

dg = bpy.context.evaluated_depsgraph_get()
eval_obj = bpy.context.object.evaluated_get(dg)

eval_mesh = eval_obj.to_mesh()

Should work in both edit and object mode.

I just found it. It seems like you can skip that last step

eval_obj = bpy.context.object.evaluated_get(dg)
eval_mesh = eval_obj.to_mesh()

eval_obj.data is the same as eval_mesh

maybe there is a difference? I don’t know. It works though.

Thanks!

The last step is in case you’re in edit mode.

If you just access eval_obj.data while in edit mode, you get the mesh without modifiers applied.