Notifications
Clear all

[Closed] on mouse click function? or on selection?

Just want to know if there it a way to ctach a mouse click without using tool?

For example if the user clicks on a polygon, i want to update my script to show the material ID of the selected face.
In the same way that it happens in the edit poly rollout…

Thanks

13 Replies
 eek

you probably need to use a selectionchanged callback for this.

eek

sweet, thanks

is there a way to get it only when faces selected(or just subobject)?

I would sugesst taking a look at the polygon counter macroscript (in the UI/MacroScipts folder). You can extend the displayed text to include:

((($.selectedFaces as bitarray) as string)

which will add something like: #{1, 2…6, 50}
to the end of the number of faces listed in the viewport in the top left corner.

So what im trying to do is get the order of selected face,

ie pick one face, then pick a second face as the order theyre selected in is important.

the array for the selection order needs to be updated for only 2 polys, the last 2 polys selected in the correct order. So if you select 3 polys or more, theres no need to update the selection order array.

 eek

ah but arent faces/edges/vertices bitarrays i.e if you append them to an array they’ll automatically get sort. Hmm i’ll have a think.

eek

is an array always sorted? I would think an array would keep your values where you placed them?

 eek

yes normally but bit arrays are tricky little things. I suppose you could do…hhmm basically cant i dont think pick two faces in the order you want and append them to an array in that order. It’ll always go from low to hi eg. pick face 1020, then 30 it’ll put them in order 30,1020.

i think there a getpolyops $ face.selection but that still wont help. One way would be to manually do it pick face – append hmm maybe you could do it with mouse point.

so pick face on click – append no. to array. On second click the same. Then do an if check if this array.count > 2 then #stop. I havent done mouse events in a while. But youd need a mouse event callback to check what youve click and probably a selection callback.

on mouse clicked do
(
if clickno = 1 then
(
)
else
(
if clickno = 2 then etc etc…

eek

ok thanks, ill have to mess with it more…

ok i thought of an alternative idea, instead of on clicking or what ever, just have something that is contstantly doing a check?

Ie a loop that executes say once every second, is that possible? It would probly be easyer that way…

Page 1 / 2