Keypress (down and up), mouse move, and mouse locking
jonathan_3c020989c4
Posts: 0
Does anyone know how to do either of these functions in Daz script:
Detecting:
Key Down
Key Up
Mouse Movement
Overriding:
Mouse Locking (into the center)
Where could I find out info like this? The documentation is VERY limited, and the most info I get is from examining other scripts on some of the sites out there.
Comments
Mouse movement isn't available to scripting - it would need a new plugin, which could then make the data available to scripts, but I don't think there's anything currently available. I'm not sure if it's possible to capture key-presses - I was thinking a text edit box might do the job, as a workaround, but it doesn't look like it.
Thanks to "Casual" for this:
ed = new DzLineEdit( wDlg );
connect( ed, "textChanged(const QString&)", textChanged );
function textChanged( s )
{
if( s.length > 0 )
{
ed.text = "";
switch(s.charAt(0))
{
case '1': bf1(); break;
case '2': bf2(); break;
case '3': bf3(); break;
case '4': bf4(); break;
case '5': bf5(); break;
case '6': bf6(); break;
case '7': bf7(); break;
case '8': bf8(); break;
case '9': bf9(); break;
}
}
}
I think it is interesting to realize in DzListView (in DzListBox too).
Signals - "mouseButtonPressed(int,DzListViewItem*,const QPoint&,int)" or "mouseButtonClicked(int,DzListViewItem*,const QPoint&,int)"
You can try signals for your actions :
"doubleClicked(DzListViewItem*,const QPoint&,int)"
"rightButtonClicked(DzListViewItem*,const QPoint&,int)"
The mouse click detection works, but I want it to trap a simple keystroke and print it.
how do I set up wDlg, as per Casual's script to do that? So far I have (but throws an error at line 1):
ed = new DzLineEdit( wDlg );
connect( ed, "textChanged(const QString&)", textChanged );
function textChanged( s )
{
if( s.length > 0 )
{
ed.text = "";
switch(s.charAt(0))
{
case '1': print("1");
}}}
Thats brilliant, thanks.
I can now rotate a node using the numeric keypad