Interaction tag change tool
-
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
-
On 30/11/2016 at 01:36, xxxxxxxx wrote:
Hello,
before the Interaction Tag (or to be more precise: the standard move tool) does something it will store the current tool and document mode. After the Interaction Tag has finished, it will restore this saved tool and mode. So it is explicitly not possible to change the tool or mode with the Interaction Tag.
best wishes,
Sebastian -
On 30/11/2016 at 01:50, xxxxxxxx wrote:
Humm so what will be the the way for doing what I want to do? ^^'
I guess maybe using a tagPlugin and checking MSG_EDIT for know the change on the document?Anyway thanks for the reply !
-
On 30/11/2016 at 08:05, xxxxxxxx wrote:
Hello,
could you open a new thread for your new questions? Thanks!
best wishes,
Sebastian -
On 02/08/2017 at 07:39, xxxxxxxx wrote:
Originally posted by xxxxxxxx
Hello,
before the Interaction Tag (or to be more precise: the standard move tool) does something it will store the current tool and document mode. After the Interaction Tag has finished, it will restore this saved tool and mode. So it is explicitly not possible to change the tool or mode with the Interaction Tag.
best wishes,
SebastianI hope you mean it's just currently broken... because:
** From R18's documentation:**
- With the Interaction tag, other objects in addition to the tagged object can be tweaked.
Scripts can also be used to execute specific actions when you tweak the object (e.g., when the cursor is positioned over the object, grabbing, double-clicking or releasing the object). For example, a specific tool can be called up when an object is clicked upon. Or touching an object can initiate a render process, etc.
It's literally one of the documented uses for the interaction tag. It also seems to work when selecting an object in the OM... but that defeats the purpose of the intent of the interaction tag (it's designed for interactions that occur in the viewport... per the documentation).
- With the Interaction tag, other objects in addition to the tagged object can be tweaked.
-
On 02/08/2017 at 08:45, xxxxxxxx wrote:
Hello,
you can use a different tool WHILE interacting with the object. E.g. you can write
def mouseDown() : doc.SetAction(200000089)
This will enable the "Scale" tool; then you can scale the host object during the interaction. But as soon as you end the interaction, the tag will restore the previous tool. So it is possible to use a different tool DURING the interaction, but it is not possible to change the active tool beyond that (change the document persistently).
best wishes,
Sebastian -
On 02/08/2017 at 11:06, xxxxxxxx wrote:
I've tried that... it doesn't work. I've made a visual slider in the viewport, a diamond shaped spline within a rectangle helper spline (that also has a spline title). The purpose being, when you select the helper spline (which is much larger) it will instead select the diamond spline (the actual rig control) via a proxy in the interaction tag, while also switching to the move tool.
Even if I do the "mouse down" technique to keep the interaction "live", it still doesn't change to the move tool. Even if the move tool was already active, I can't tweak the control (even though "transform proxy" is active in the interaction tag). The only way I can get any sort of interaction is to activate "tweakable", which only allows me to tweak the helper spline... which is the opposite of what I want and not at all helpful since the control's influence is relative to the helper spline.
I just find it ironic that every time I try to use the interaction tag, it fails to allow me to perform any sort of meaningful interaction. Sure, it's nifty that it can do things like initiate a save command because I hovered over an object in the viewport, but I don't find that at all useful. The useful stuff I would like to use the interaction tag for, however, seems well beyond its capabilities... even if those tasks are relatively simple and straight forward.
https://drive.google.com/file/d/0B45fBwTK-JmMUnBpTlotcEExMmM/view
-
On 02/08/2017 at 11:50, xxxxxxxx wrote:
OK, I figured out why the interaction tag was failing so spectacularly... it doesn't like when the proxy is a child of the object that contains the interaction tag. Putting both the control and the helper spline into a null (with same psr as the helper spline) seems to get it working with the "mouse down" "live" interaction... but my animators will likely not use this functionality.
It's nice that the tag can store the previous tool option and recall it when the interaction is over, but I really wish this was an option instead of always being the case. One of the most simple and straightforward uses I see for the interaction tag is to simply switch to the appropriate tool when selecting certain objects.
Looks like I have a feature request to write.