Printing a faces material ID on mouse hover/click?


I’m trying to make a script that when you hover your mouse over an object’s face with a material ID, it’ll print that ID to the listener.

I’ve got 1 script that will print the matID but only when you’ve actually selected the face in sub object mode. This just simply uses polyOp.getFaceMatID and prints the selection as an array.

I also have an unrelated script where it will change an object’s wirecolor to whatever color I choose when I hover my mouse over the object. This uses #freemove and intersectRayScene to do this.

Is there anyway to essentially frankenstein these 2 together? I can’t for the life of me find out how to do this as 1, is it actually possible to get a faceMatID without being in sub-object mode or even have the object selected, just simply rolling the cursor over an object’s faces?