View Full Version : Restorint point/poly/volume mode after poly selections

02-13-2003, 01:19 PM

I could use some help; I have a script that needs to do some polygon selections, it's working OK but it always changes the Modeler selection mode button (bottom left of Modelers window) to Polygons.

Is there an easy way to store/restore the users current selection mode?


02-15-2003, 12:17 PM
first off, i dont know if you can even detect the user's CURRENT selection mode. so if you needed to go back to the selection mode prior to script execution, i dont think you can.

but if you want to go back to, say, point selection mode, a simple:


.. will usually get the job done. ;)

02-15-2003, 01:01 PM
Cheers faulknermano, it won't affect the useability of my script, my wanting to return to the users selection mode was just a courtesy.


02-18-2003, 12:51 AM

i found that when you use selmode(USER), you can only detect the selection in the current selection mode. for example, if you had selected a polygon and then switched to point mode, the poly is still selected. selmode(USER) will not detect the polygon, only the current point selection, if any.

otoh, selmode(DIRECT) will detect any selected element regardless of what mode you are in. so, in the case above, selmode(DIRECT) will enable polycount() to return some poly ids.

to conclude: to determine if the user is in point mode, selmode(DIRECT) to check if points were selected in the first place, and then selmode(USER) to check if points are indeed selected. if so, then it denotes that the user is in point mode.

going back to polygon mode will require a selpolygon(CLEAR). if you want to 'recover' the originally selected polys, simply run a selmode(DIRECT) and polycount() and store the ids into an array, later to be recalled at the end of a function, or script.

anyway... :)