Is there a more agnostic intersect() method for python not bound to single geos?

   879   2   0
User Avatar
Member
900 posts
Joined: Feb. 2016
Offline
I need to know which object (and which primnum) is under the mouse pointer during a custom viewport python state.
I could find only node.geometry().intersect() method, but indeed it works only for a single node/geometry, while I need to check different objects.

Workarounds I can think of:
1) Merge the different objects together, which result in a single messy geometry, full of useless attributes merged together. I don't like it but could be fast.
2) Or throw a ray for every object I need to check. Cleaner but, in case of many objects, could it potentially lead to lag in my viewport python state as the intersect is triggered at every mouse movement?


Do you have any advice?
thanks!
User Avatar
Member
7739 posts
Joined: Sept. 2011
Online
You don't need to loop over all objects to find the intersect. Look at selectPrimitiveUVs() in objecttoolutils.py
User Avatar
Member
900 posts
Joined: Feb. 2016
Offline
oh, thanks a lot!
queryNodeAtPixel(x, y) was the method I was looking for!
  • Quick Links