In the bigger framework of making PreSel addon work better, I have made a patch for Blender source code that enables getting occlusion state information of BMesh elements in a given RegionView3D from Python API. The patch download.
It works as such:
rv3d = bpy.context.space_data.region_3d
v = bm.verts[0]
state = v.occlusion_get(rv3d)
Posting it here cause getting it in trunk might not work / take long…
Ah, you cant use it in draw handler function cause then drawing to backbuffer messes up your custom drawing code.
I’m thinking pulling in all those higher level module dependencies into the bmesh (and bmesh python) module isn’t such a good idea, The Powers That Be™ are pretty picky about stuff like that.
Well, what can I say, I dont see any other way of implementing this… Is there something fundamentally wrong with my approach?
Better ways of doing this?
Your best bet would be to ask on the mailing list or poke Campbell on the IRC.
It might be a simple matter of shuffling around some code so you don’t have do things like include *_internal headers into external modules and such. I’m not familiar enough with bmesh to give any kind of helpful answers here but do know that kind of cross-module ‘pollution’ is frowned upon.