Antonio Bleile wrote:
> Carsten Neumann wrote:
>>      Hello Antonio,
>>
>> Antonio Bleile wrote:
>>>  > You can override an Action's callbacks on a per instance basis
>>>  > (registerEnterFunction, registerLeaveFunction), so you can create a
>>>  > regular RenderAction and register a different callback for geometry.
>>>  > That callback would basically do the same as the regular one, but only
>>>  > after testing that the node has no children.
>>>
>>> OK, and here's the problem:
>>>
>>> Action::ResultE myTraverse(CNodePtr &  Cnode, Action *action)
>>> {
>>>      OSG::NodePtr node = action->getActNode();
>>>
>>>      if( node->getNChildren() )
>>>          return Action::Skip;
>>>      else
>>>          return Action::Continue;
>>> }
>> ah, well it is a bit more work than that ;)
>> You need to duplicate and modify the callback for Geometry, which is 
>> MaterialDrawable::renderActionHandler (see below). In there you check 
>> the node for children and if it has any you just return Action::Continue 
>>   otherwise do the usual thing:
> 
> Mh... Not sure if I got it. That means I have to hardcode that into
> a custom OpenSG version? Don't see how I could register such a
> callback at run-time. Or derive a custom Geometry node...Mh... Ok, if
> it's not possible in a more elegant/dynamic way I'll have to do the
> whole thing a bit different.

There is nothing special about the modified callback I posted and it 
need not be a member of MaterialDrawable. Just replace the body of your 
myTraverse above with what I posted, add some casting to get the 
material from a MaterialDrawable core and register it the same way you 
posted. That should do the trick.
Am I missing something ?

        Cheers,
                Carsten

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to