THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 12/07/2007 at 20:02, xxxxxxxx wrote:
Cinema 4D Version: R8.2-R10
Platform: Windows ; Mac ; Mac OSX ;
Language(s) : C++ ;
How would one go about determining which view in a multi-view the cursor is actually in? Easy to determine which view is active, but the cursor coordinates donot bely which view, active or not, it is over.
I'm asking because I'd like to do control highlighting in the same way that the Cinema 4D tools do. They seem to know which view so that the highlighting only corresponds to that in all views. Otherwise, I get multiple highlights if two different controls occupy the same point in different views. Comprende?
On 12/07/2007 at 20:49, xxxxxxxx wrote:
I think that this works - might not work if the user has multiple View windows open using the same projection, but will work with Multiple Views:
In GetCursorInfo(), store the BaseDraw projection. In Draw(), check the BaseDraw projection against the stored value.
That works as well as can be expected.
On 13/07/2007 at 05:31, xxxxxxxx wrote:
Hmm, Here is a guess:
GetCursorInfos passed X and Y info may help you find out which view you´re in. They are relative to the active view. Check how big the active view actually is. When X is bigger than maxX of the active view, it´s in the view to its right (not sure if one can determine which view this is though). Same for the Y coordinate.
No clue if it works this way, but it just came to my mind.
At least Projection check seems kind of...unsafe.
On 13/07/2007 at 08:28, xxxxxxxx wrote:
I checked the X and Y for GetCursorInfo() and it is always relative to the view over which the cursor is whether active or not - so it isn't possible to determine which one by that method.
On 13/07/2007 at 08:31, xxxxxxxx wrote:
oh sh**. The docs said otherwise (Docs, ha, cannot rely on anything anymore..).
Hmm, must think.
On 13/07/2007 at 12:19, xxxxxxxx wrote:
With the docs I think its just a simple mistake, it should say relative to the passed basedraw.
I'm not sure I see the problem, how are you getting the cursor coords? in getcursorinfo the coords are relative to the basedraw that is passed so that is the one the cursor is over.
On 13/07/2007 at 12:31, xxxxxxxx wrote:
I agree that using the projection as a determiner is probably not sound, but I can find no other unique attribute between the views in a Multiple View set up.
It may be that ViewportSelect must be used here - as long as the virtual control object can be passed to it for initialization. The control objects are drawn in SceneHookData::Draw() using BaseDraw::DrawPolygonObject(). This would also exclude R8.2/8.5 support as this feature is not available in R8.
On 13/07/2007 at 12:41, xxxxxxxx wrote:
WRONG: In GetCursorInfo(), each available BaseDraw is passed (!). I checked this explicitly and if there are four Views, it gets called four times. Easy to determine the 'active' View by comparing (bd == doc- >GetActiveBaseDraw()), but not the one in which the cursor resides.
This needs to be edited: Only the current BaseDraw is passed to GetCursorInfo() as noted. Maybe it would be just as well to store the BaseDraw* and compare in Draw() - I'm just not too confortable with that. But that is the only way to determine this uniquely.
On 13/07/2007 at 23:54, xxxxxxxx wrote:
As you edited, the current basedraw (cursor basedraw) is passed to GetCursorInfo but draw will be called for all viewports that need to be drawn. Checking the pointer is fine, just don't use it as you can't be sure its still valid. Depending on what you need to check then you might want to check the pointer matches along with projection, dirty and anything else your code depends on.
On 14/07/2007 at 07:17, xxxxxxxx wrote:
The code is using the BaseDraw passed to Draw() for drawing but comparing to a pointer stored from GetCursorInfo() to validate which View the cursor is in before doing highlighting. That seems to be working.
Thank you very much!