Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Another mouse position and GeDialog topic

    Cinema 4D SDK
    1
    1
    235
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • C4DSC
      C4DS
      last edited by

      Hi,

      I have created yet another thread regarding this topic as I didn't want to interfere with existing threads:
      https://developers.maxon.net/forum/topic/12570/mouse-positions-and-screen-dimensions
      https://developers.maxon.net/forum/topic/12574/inconsistent-gedialog-open-position

      This one however isn't really about bringing up a problem and asking for a solution, or workaround or whatever. This here is just to point out my experience and findings, hoping it can help others ... without them having to go through all sorts of trial and testing before getting the big picture.

      I have been using a simple CommandData as plugin, which is assigned a short-cut (ctrl-t) to activate. On execution of the plugin a dialog is positioned at the current mouse position ... or that is the intention. Call the plugin again and the dialog will be removed.

      class MyCommand : public CommandData
      {
      	INSTANCEOF(MyCommand, CommandData)
      
      public:
      	virtual Bool Execute(BaseDocument* doc);
      
      private:
      	MyDialog mDlg;
      };
      
      Bool MyCommand::Execute(BaseDocument* doc)
      {
      	if (mDlg.IsOpen())
      	{
      		mDlg.Close();
      		return true;
      	}
      
      	BaseContainer bc;
      	if (GetInputState(BFM_INPUT_MOUSE, BFM_INPUT_MOUSELEFT, bc))
      	{
      		const Int32 mx = bc.GetInt32(BFM_INPUT_X);
      		const Int32 my = bc.GetInt32(BFM_INPUT_Y);
      
      		const Int32 w = 50;
      		const Int32 h = 50;
      		mDlg.Open(DLG_TYPE::ASYNC_POPUPEDIT, TEST_COMMAND_PLUGIN_ID, mx, my, w, h, 0);
      	}
      
      	return true;
      }
      

      One would expect that the dialog would be positioned exactly at the current mouse position ...

      Following is a screenshot showing the result of activating the plugin when Cinema4D is in fullscreen, and when windowed. It clearly shows that the obtained mouse coordinates, used to position the dialog, are relative to one point, while the positioning of the dialog itself uses a different origin.

      Fullscreen_vs_windowed.png

      Obviously, it would make more sense that both coordinate system uses the same origin ... but I guess that would make things just too simple.

      1 Reply Last reply Reply Quote 0
      • First post
        Last post