THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 08/05/2012 at 03:30, xxxxxxxx wrote:
Cinema 4D Version: 12
Platform: Windows ;
Language(s) : C++ ;
Is it possible to set the mouse position and input? I see you can get the position/input, but can you set it?
On 08/05/2012 at 05:09, xxxxxxxx wrote:
Nope. That is a system-level feature. You may be able to do it at that level but you would need to use system calls (Windows/MacOS).
On 08/05/2012 at 05:29, xxxxxxxx wrote:
I thought that may be the case. I've seen examples on how it can be done at a system level, so looks like I'll have to try that instead.
This raises another question though. If this is done through the system calls, are the #include "windows.h" files generally located in the same directory on all machines? Like all the Cinema ones?
For example, if I compile the plugin with the windows.h header, will the plugin 'generally' work on all windows machines? Or is this a machine specific request?
On 08/05/2012 at 06:58, xxxxxxxx wrote:
OK - I'm managing to get the mouse to move - so it's a start!
That'll give me something to go on with in the morning.
On 09/05/2012 at 20:22, xxxxxxxx wrote:
Alrighty, I can virtually execute the mouse in any way I want - moving around, clicking buttons etc, however the viewport doesn't seem to respond to the actions properly.
I'm simply trying to execute a selection drag in the viewport, but at specific coordinates. The coordinates I can get, the selection drag I can't.
int X = 500; // for testing purposes
int Y = 250; // for testing purposes
int begin = SetCursorPos(X,Y);
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, NULL);
int end = SetCursorPos(X+500,Y+250);
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, NULL);
Please note: mouse_event is now deprecated but it's easier to get working than SendInput for the time being. Also, the coordinates are made to fit my screen but you may need to adjust them for yours if you test it out.
Is there something going on in the viewport that might be preventing such actions? Or maybe the rectangle tool itself can't be actioned virtually? Any thoughts?
On 17/05/2012 at 05:56, xxxxxxxx wrote:
when a mouse is dragged, and then let go, is there a message that is sent to let the tool/Cinema know it's completed the action? Some sort of core message perhaps on (for examle) the left mouse button up?
For example - in my function, if I don't use the left mouse up flag the tool stays highlighted and the rectangle is seen in the viewport. So my function is working, but the left mouse up doesn't seem to complete the action. Is there a flag or core message of some sort I should be sending, or that Cinema needs to enable the selection to take place, or for the tool to be 'actioned'?
On 17/05/2012 at 09:43, xxxxxxxx wrote:
No. There is no mouse up event.
You have to handle that type of situation with a while loop.
See "InputEvents" in the SDK. And look at the bottom of the page where it talks about Continuous Polling.