Hello,

there's an aspect to the compositeViewer that I don't think I quite understand. 
First I'd like to explain what I want to achieve:

I want to create a user interface that consists of one big hud, that contains 
different viewports on the scene, and if the user clicks somewhere a picking 
event is dispatched, identifying the node (hud or scene) that was picked and 
choosing a handler accordingly. I know how I could create one big scenegraph 
with multiple cameras and different viewports and render orders, but since this 
will be rather dynamic and user customizable, I want to keep concerns separated 
as neatly as possible.

To achieve that, I would rather like to use one (or multiple) view(s) to 
represent the "scene layer" and another to hold the hud/gui-layer, each with 
its own and distinct scene graph. So I create two views with the same viewport, 
Main and HUD, and hook up a simple GUIEventHandler subclass handling the 
picking in each view. I set both views to accept focus events. In the handle 
method I return true when an object of the corresponding graph was hit, false 
if not. 

Now, what I would expect from other GUI toolkits that returning false from a 
handler indicated that the event was indeed not handled in the first receiving 
view and should be propagated to the next views that contain the event's x and 
y, and conversely returning true should abort this cascade. 
This does not happen, however. The event is sent only to one of the handlers*, 
so I looked in CompositeViewer::eventTraversal and saw that the return values 
of handleWithCheckAgainstIgnoreHandledEventsMask are actually not used in 
determining if a cascade should happen or not.

So I have two questions:

1. Is using CompositeViewer with overlapping views actually a sane way to 
tackle this, or should I just go the single-view route described in the first 
paragraph? 
2. Are there plans to support event cascading in overlapping views for future 
releases? If not, what is the significance of the bool return value of handle?
 
Also, if you would be so kind, if there's some fundamental misunderstanding on 
my part, I hope you can point it out. 

Thank you!

Holiday Cheers,
Andreas


*) which instance of the handlers is chosen appearently is determined by the 
order in which the cameras' setGraphicsContext is called. The last one called 
receives the event, independent of view or render order.

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=51350#51350





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to