Hi Vincent,

Vincent Bourdier schrieb:
Hi all,

I'm making some function to modify graph after some operation, and so I need to call some simple actions in functions.

The problem is about ref_ptr :

I need to do this :

    osg::ref_ptr<osg::Group> mygroup;
    [..]
    mygroup = NULL;
    [...]


To do that in a function, I use someting like :
addonstack(mygroup, NULL); //prototype is : addonstack(osg::ref_ptr<osg::Group> caller, osg::Node* arg1);

which did this :
osg::ref_ptr<osg::Node> nd = dynamic_cast<osg::Node*>(caller.get());
        if(nd.get()){
                nd =arg1;

But, the problem is that it doesn't change anything... I need, without making some modifications in the addonstack prototype, a way to put the ref_ptr to NULL .

Any idea ?
Thanks.

The addonstack function gets its own copy of the ref_ptr,
so it cannot modify the original ref_ptr.

To change the original ref_ptr you must change the signature to
addonstack(osg::ref_ptr<osg::Group>& caller, osg::Node* arg1);

But the code above (with the ref_ptr called "nd") will still not
work, since this is yet another copy of caller. You use the
reference "caller" directly, e.g.
   caller = arg1;

Regards,
    Vincent.

Hope this helps

Peter


------------------------------------------------------------------------

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

--
Vorstand/Board of Management:
Dr. Bernd Finkbeiner, Dr. Florian Geyer,
Dr. Roland Niemeier, Dr. Arno Steitz, Dr. Ingrid Zech
Vorsitzender des Aufsichtsrats/
Chairman of the Supervisory Board:
Prof. Dr. Hanns Ruder
Sitz/Registered Office: Tuebingen
Registergericht/Registration Court: Stuttgart
Registernummer/Commercial Register No.: HRB 382196

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

Reply via email to