Questions about doing some mesh/OGL weirdness with pure python

Alright, so I have an addon in mind that is relatively simple in theory (and would be super simple to implement in most other packages) but I’m worried might be a bit much for Blender’s python API.

Basically the part I’m having trouble with is a couple of steps I’d like for added user functionality.

A big part of the addon is allowing the user to specify face “zones” on their mesh to be stored for later use.

What I’d like is to have the zones accessible from Object mode as well (or whatever mode I decide to have the final tool function in) such that the user could hold down a modifier key (CTRL for instance) and hover over any of the zones of the mesh and have an OpenGL highlight of just that contiguous zone.

So my question is, is there any way to get this kind of mesh/face data accessible outside of Edit Mode? At a glance the data structures between edit and object modes seem completely different. I guess a nice proof of concept would be the ability to highlight vertex groups outside of edit mode. I’d like to do this without the creation of any intermediate objects (as that would defeat the eventual purpose of the addon), and just by simply highlighting the faces via OpenGL calls. Any ideas?

I think we spoke on IRC today, but short answer is - yes.

You can use object.ray_cast() to get the face index and access, mesh.vertices mesh.polygons - all in object mode.

There shouldn’t be anything in the Python API that limits this feature, but access to vertex groups is a little clumsy (access in BMesh is nicer).