On 29/11/2016 at 12:56, xxxxxxxx wrote:
Hi I'm currently trying to change the tool used in function of which key are pressed during the selection.
I thinked to use the interaction tag but it's seem to not work. I guess it could be a thread issue but i'm not sure..
Here is the code I put into an interaction tag
#Tweak tag script #Predefined global variables : tag, op, proxy, doc, thread, qualifier import c4d from c4d import gui def onSelect() : mode = get_pressed_data() if mode == 1: doc.SetAction(c4d.ID_MODELING_MOVE) # Move elif mode ==2: doc.SetAction(c4d.ID_MODELING_ROTATE) # Rotate #tryed some s**t for tell the doc is updated... doc.SendInfo(c4d.MSG_DOCUMENTINFO_TYPE_TOOL_CHANGED,c4d.NOTOK,"",None,True) doc.SetChanged() c4d.SpecialEventAdd(c4d.EVMSG_TOOLCHANGED) def get_pressed_data() : res = c4d.BaseContainer() mode = 0 #SHIFT c4d.gui.GetInputState(c4d.BFM_INPUT_KEYBOARD, c4d.BFM_INPUT_QUALIFIER, res) if res.GetLong(c4d.BFM_INPUT_QUALIFIER) == c4d.QSHIFT: mode = 1 #CTRL + Shift c4d.gui.GetInputState(c4d.BFM_INPUT_KEYBOARD, c4d.BFM_INPUT_QUALIFIER, res) if res.GetLong(c4d.BFM_INPUT_QUALIFIER) == c4d.QCTRL + c4d.QSHIFT: mode = 2 return mode
I know i could do a basic tag and checkig if op is selected then do something... But that mean my tag will be executed at each event wich is not the best things and I guess the interaction tag is done for that and will be mroe optimized than my python tag. But in this case how to know which key was pressed?
Thanks in advance