Is that possible to get data/object data from "mouse over polygon"?

Hi guys

Probably the best option to ask those question would be describe what the script should do:
We have some object with boolean modifier in the stack. Pink area its a result of those boolean operation.
Blue - its our cursor and polygon which we are pointing. Those blue polygon (and the other 2 ofcourse) are result of boolean operation.
Boolean object are hided.
By run the script we want to get access to object which was related to this boolean operation,. i.e. we want to select not the main object, but boolean object which was related to creating those blue face.

short answer: no. you can raycast to an object and get information about the hit face, and you’re able to get either the unevaluated mesh, or the evaluated mesh (ie: mesh data that is pre or post modifiers), but you can’t get any additional information about how that face was created, and modifiers don’t store any information about their geometry results.

more complicated answer: yes. If you’re desperate, technically you could loop through all of your modifiers and for each boolean object you find, loop through all of that object’s faces trying to find a face that is coplanar with the face under the mouse. there are a number of ways you could do this but I would probably create BVH trees and do overlap tests with the mouseover face just to narrow the list down a bit before doing a bunch of face testing. in some cases you might only get one overlap result and not even need to do any complanar tests. it’s not hard to do, but might be a pain depending on your comfort level with math/blender/python. Also, comparing normals isn’t enough, you need to make sure they are also cospatial- which is as easy as testing each vert of a face against the other face’s plane. i believe mathutils.geometry has a distance_point_to_plane function that would come in handy here.

1 Like