So basically I want to redraw my gui based on what object(s) the user has selected in the 3d window. Even if there were a scriptlink for this, scriptlink scripts don’t allow Draw.Register in them. Is there another event that I don’t know about? Draw.RIGHTMOUSE only works within the active script window, so it doesn’t register when a user clicks in a 3d window.
I’m open to other ideas, so any help would be appreciated.
you can use spacehandler scripts to capture events in the 3d window, then perform an action, or even remap keys or mouse presses.
to make your script a spacehandler add the following line to the top: #SPACEHANDLER.VIEW3D.EVENT
then you enable it in the view menu of the 3dview window.
Thanks so much dazzler! I wasn’t aware of the relatively new spacehandler script option. It’s very powerful and I’m sure I’ll end up using it for other things as well.
Space handelers can do a lot but scriptlinks can be good so as not to have python running every move you make. Could also be nice if the new scriptlink worked in with other methods of selection like the oops/outliner.
Good call, ideasman42. I wholeheartedly agree because after exploring the spacehandler script options, it doesn’t appear that I can update the gui of my other script based on an event in the 3d window. I’ll email the BfPython ML as you suggested.
I agree, it would be good to have a scriptlink for this. However, I doubt it will be created right away, so I thought I’d help you brainstorm a solution in the mean time. Could not you just use a spacehandler (or even a scriptlink on redraw) that monitors selection states, and then calls something like Window.RedrawAll()? You could use the registry to store and pass information. I haven’t tested it, and I’m just talking off the top of my head, but I think it should work if it was set up right.