call a mouse click command in viewport
-
On 30/04/2018 at 06:23, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 16+
Platform:
Language(s) : C++ ;---------
what I want to do:
pick camera focus (the pick icon from the camera object, then click in the viewport to pick the focus)I can already call the command for that camera button
doc->SetActiveObject(cam); DescriptionCommand dcommand; dcommand.id = CAMERAOBJECT_TARGETDISTANCE_PICK; cam->Message(MSG_DESCRIPTION_COMMAND, &dcommand); EventAdd();
now what I want is call a click in the viewport (I already have the BaseDraw*, x and y screen coordinates).
-
On 03/05/2018 at 02:10, xxxxxxxx wrote:
Hello Mohamed,
it is not possible to "inject" mouse clicks via the API.
Instead of virtually trying to imitate user behavior, rather do it the other way round.
You already know the coordinates and do have the BaseDraw. With this you should be able to get the needed distance in various ways and could then simply set the parameter for the camera object.Internally the "Pick Focus" button of the camera object uses the ViewportSelect class. See examples of its use in sculpting and pickobject examples in cinema4dsdk.
Another option may be the use of a pick session, see StartPickSession(), StopPickSession() and GetPickSession() as well as the PickSessionDataStruct (see some snippets of its usage here).
-
On 10/05/2018 at 15:58, xxxxxxxx wrote:
thanks, pickobject was what I needed.