Cursor coordinates
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 04/06/2007 at 13:24, xxxxxxxx wrote:
The SDK Docs say this for SceneHookData::MouseInput() and GetCursorInfo() :
Note: Make sure that you only use this function when the user is somehow working with your plugin, so that other plugins can also use this hook when it's their turn.
Sort of vague but it means that, yes, you need to find a way to allow Tools to do their thing despite the SceneHook plugin being there. What worries me is that the cursor/mouse could be being 'gobbled up' by the SceneHook and never passing the information to the Tools.
Maybe Matthias can provide a methodology for doing this?At first blush, InitSceneHook() and FreeSceneHook() might provide a framing wherein you should care about mouse-input/cursor positioning - allowing the Tools to work outside of that framing (before InitSceneHook and after FreeSceneHook).
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 07/06/2007 at 08:04, xxxxxxxx wrote:
<<<the cursor/mouse could be being 'gobbled up' by the SceneHook and never passing the information to the Tools>>>
Sure it does. I have checked it. Tool plugins not works with such sceneHook.
Furthermore InitSceneHook and FreeSceneHook functions are not for "turn hook on" or "turn hook off". Look what documentation say: <<<InitSceneHook ... Called before all scene hooks and expressions in a scene are calculated. Here you can allocate temporary data in the node>>>
<<<FreeSceneHook ... Called after all scene hooks and expressions in a scene are calculated, before the drawing starts. Here you can free temporary data allocated in InitSceneHook().>>>
Thus question is still open. -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 07/06/2007 at 08:38, xxxxxxxx wrote:
InitSceneHook/FreeSceneHook are certainly not 'turn hook on or off'. But did you consider that these might be called just before/after the hook is executed and you will only be caring about mouse/cursor while the SceneHook is in execution so that tools get the mouse/cursor when not being executed (before InitSceneHook is called and after FreeSceneHook). It is a good bet that the SceneHook is only doing its thing inbetween these two calls - otherwise Cinema 4D tools wouldn't work at all I would suspect.
In InitSceneHook, you set a Boolean to TRUE to signify that your SceneHook is about to be executed and you set it to FALSE in FreeSceneHook to signify that it is now finished executing. In your code to track the cursor position (in GetCursorInfo() for instance), you check that Boolean before doing anything - and return FALSE otherwise (see Thread 1 below).
Now, I can't say if this will work or not as I haven't needed to resort to a SceneHook yet and, as I mentioned, that Note is about as vague as you can get.
As mentioned other times and often, a SceneHook example in the cinema4Dsdk folder would be a very welcomed thing especially for something as dangerous as this.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 08/06/2007 at 00:49, xxxxxxxx wrote:
A scenehook definetly does work with a tool.
A scenehook is there all the time. The thing is not to think of "when can I NOT use it" but rather "when can I use it".I used a scenehook for my RulerTools plugin. I used it for drawing the ruler lines etc. and used MouseInput when my helpline tool was used (simply check which tool is currently active and if it´s yours), which was perfect because I needed it just before a redraw happened as there was nothing to change in the scene actually but only the helpline draw data.
That´s how I´ve done it and it worked charmingly. There´s no magic to it. Simply do your stuff in the according scenehook functions when your tool is used.However, I really don´t see the point in having a commanddata working with cursor information. What´s the point in that?? This is a job for a tool plugin, not for a command data pluggy.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 11/06/2007 at 12:55, xxxxxxxx wrote:
oh yes. Thanks a lot, guys.
I just was confused by this words from documentation:
<<< Return: FALSE If a problem occured during this function>>>
So I even not tryed to return FALSE
...
<<<What´s the point in that?? This is a job for a tool plugin, not for a command data pluggy.>>>
There is a point. I want to write a command-plugin that works according cursor position. If I made it via tool, it needs 3 clicks for use (choose tool, click, choose previous tool). Command needs only one click -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 12/06/2007 at 07:30, xxxxxxxx wrote:
hehe, true, that´s a point. BUT (there´s always a but how does the user choose the command if he doesn´t do it with the mouse? Which means he cannot click on the command with the mouse as it has to be at the location where he wants to use it. Imo, this is unintuitive. And especially when he wants to use it several times. A tool would be more intuitive and faster to handle several situations.
But hey, that´s just my opinion. go for it, curious to see what you are doing.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 12/06/2007 at 10:33, xxxxxxxx wrote:
Yes, right. Such command can only be used via keyboard shortcut.
Yes, it is not good for novice users. But really handy for pro. -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 12/06/2007 at 11:08, xxxxxxxx wrote:
Howdy,
Try this in your Execute function:
BaseContainer state; GetInputState(BFM_INPUT_MOUSE, BFM_INPUT_MOUSELEFT, state); Real mx = state.GetReal(BFM_INPUT_X); Real my = state.GetReal(BFM_INPUT_Y); GePrint("Cursor coordinates: x = "+RealToString(mx)+"; y = "+RealToString(my));
Although, that will return coordinates for the entire screen, not just the active view.
Adios,
Cactus Dan -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 12/06/2007 at 13:08, xxxxxxxx wrote:
It is just I looked for !
Using this I neednt add any SceneHooks into my CommandData plugin.
Thank you a lot ! -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 12/06/2007 at 13:14, xxxxxxxx wrote:
Howdy,
You're welcome. ;o)
Adios,
Cactus Dan