GeDialog.Command() Mouse Channel
-
On 13/02/2013 at 10:14, xxxxxxxx wrote:
I'm trying to obtain the input channel of the mouse when GeDialog.Command() is called. I was
trying to obtain the data via GeDialog.GetInputState() and c4d.gui.GetInputState(). Although
the call always succeeds, the channels stored in the returned container is always the channel
passed to the function, not the channel actually triggering the event.GeDialog.GetInputEvent() and c4d.gui.GetInputEvent() doesn't work at all. Please try the
following snippet in the Script Manager:import c4d class Dialog(c4d.gui.GeDialog) : def CreateLayout(self) : bc = c4d.BaseContainer() bc.SetBool(c4d.QUICKTAB_SHOWSINGLE, True) bc.SetBool(c4d.QUICKTAB_NOMULTISELECT, True) self.quicktabs = self.AddCustomGui(1000, c4d.CUSTOMGUI_QUICKTAB, "", c4d.BFH_SCALEFIT, 0, 0, bc) self.quicktabs.AppendString(0, "Item 1", False) self.quicktabs.AppendString(1, "Item 2", False) self.quicktabs.AppendString(2, "Item 3", False) self.quicktabs.DoLayoutChange() self.quicktabs.Select(0, True) self.AddComboBox(1001, c4d.BFH_SCALEFIT) self.AddChild(1001, 0, "GeDialog.GetInputState()") self.AddChild(1001, 1, "c4d.gui.GetInputState()") self.AddChild(1001, 2, "GeDialog.GetInputEvent()") self.AddChild(1001, 3, "c4d.gui.GetInputEvent()") return True def Command(self, id, msg) : if id == 1000: device = c4d.BFM_INPUT_MOUSE channel = c4d.BFM_INPUT_MOUSERIGHT method = self.GetLong(1001) state = c4d.BaseContainer() if method == 0: ok = self.GetInputState(device, channel, state) elif method == 1: ok = c4d.gui.GetInputState(device, channel, state) elif method == 2: ok = self.GetInputEvent(device, state) elif method == 3: ok = c4d.gui.GetInputEvent(device, state) else: return True if ok: print "Asked Channel:", channel print "Active Channel", state[c4d.BFM_INPUT_CHANNEL] else: print "No state retrieved." print "~" * 50 return True dlg = Dialog() dlg.Open(c4d.DLG_TYPE_MODAL)
Try pressing with left and right-click on any of the Quick Tabs. You can change the method in the
GUI. You will notice that GetInputEvent() doesn't work at all. GetInputState() always succeeds,
but that should not be correct. It should either return False for the left-mouse click or fills in
the correct value into the BFM_INPUT_CHANNEL item of the container!Is this a bug or am I doing something wrong?
Next, I printed out the contents of the msg container passed to Command().
# RIGHT CLICK 1835362660 : 1000 1835361394 : 0 1835365985 : 0 **1869443943** Container: 1768976737 : 0 1768975727 : 0 1768973430 : 1836021107 ** 1768973153 : 2** 1768978017 : 1 1768977985 : 1.0 1768978040 : 21.0 1768978041 : 20.0 1768978042 : 0.0 1769107316 : 0.0 1769237620 : 0.0 1768320615 : 0.0 1886547828 : 0.0 1768973410 : 0 # LEFT CLICK 1835362660 : 1000 1835361394 : 0 1835365985 : 0 **1869443943** Container: 1768976737 : 0 1768975727 : 0 1768973430 : 1836021107 ** 1768973153 : 1** 1768978017 : 1 1768977985 : 1.0 1768978040 : 24.0 1768978041 : 13.0 1768978042 : 0.0 1769107316 : 0.0 1769237620 : 0.0 1768320615 : 0.0 1886547828 : 0.0 1768973410 : 0
The container contains the information I want (the mouse channel that was used), but the id
1869443943 does not have a Symbol and it is also not documented in the C++ documentation,
nor in the Python documentation.Thanks in Advance,
-NiklasI'm using Cinema 4D R14.025.
-
On 13/02/2013 at 10:27, xxxxxxxx wrote:
hm ,
your posting confuses me a bit, but two things:
1. why don't you use the Message method to get hold of the pressed mouse button (which i assume is what you are after).
2. The ids:
...\MAXON\CINEMA 4D R14 Dev\resource\coffeesymbols.h 172,00 KB 05.12.2012 09:24:56 5807 BFM_INPUT_DEVICE=1768973430, 5808 BFM_INPUT_MOUSE=1836021107, 5811 BFM_INPUT_CHANNEL=1768973153,
-
On 13/02/2013 at 11:13, xxxxxxxx wrote:
Hi Ferdinand,
Oh I really forgot about the Message() function. Thanks for that, I'll check that out.
The ID which has no symbol is 1869443943, I know of the symbols you posted. I have highlighted
it red in my previous post, now.-Niklas
-
On 13/02/2013 at 12:11, xxxxxxxx wrote:
eh, my fault, i have just looked for 18something why don't you use the container anyways ?
it is the BFM_INPUT container, so who cares for the id ? for your posted code :print "Active Channel", state[c4d.BFM_INPUT_CHANNEL]
should it not be :
print "Active Channel", state[c4d.BFM_INPUT_VALUE]
otheriwse you will always just print the channel you have passsed. or am i wrong ?
edit: i have checked it, i was right
def main() : bc = c4d.BaseContainer() ok = c4d.gui.GetInputState(c4d.BFM_INPUT_MOUSE,c4d.BFM_INPUT_MOUSELEFT, bc) print bc[c4d.BFM_INPUT_VALUE]
paste it into a pyhton script tag, press play and LMB click into the editor (or somewhere else
where LMB does not stop the playback). -
On 13/02/2013 at 12:42, xxxxxxxx wrote:
Hi Ferdinand,
Oh I see. Thank you very much. I was tied to the assumption that BFM_INPUT_CHANNEL contains
the channel that is actually the state, not the channel I was asking for. But it makes very much
more sense to me, now. Thank you !-Niklas