info-inventor-dev
[Top] [All Lists]

Re: Is there a way to replace nodes one-on-one?

To: Tomás Aguado Gómez <tomas.aguado@xxxxxxxxxxxxxx>
Subject: Re: Is there a way to replace nodes one-on-one?
From: Morten Eriksen <mortene@xxxxxx>
Date: Tue, 2 Nov 2004 19:20:07 +0100 (CET)
Cc: info-inventor-dev@xxxxxxxxxxx
In-reply-to: <4187CC96.1090303@xxxxxxxxxxxxxx>
References: <4187CC96.1090303@xxxxxxxxxxxxxx>
Sender: info-inventor-dev-bounce@xxxxxxxxxxx
On Tue, 2 Nov 2004, Tomás Aguado Gómez wrote:

> But I have a problem, I don't really want to "replace", I want to change
> one node for the other, that's changing the position of Node A in the
> COIN tree for Node B, and on the contrary too, I can't find any function
> or combination of functions to make this.¿How can I do It?.

It would go something like this:

        childA->ref(); // make sure ref-count don't go to zero
        parentX->replaceChild(childA, childB);
        parentY->replaceChild(childB, childA);
        childA->unref(); // set back ref-count

..where parentX is the original parent of A, and parentY for B.

Morten
-- 
http://www.coin3d.org

<Prev in Thread] Current Thread [Next in Thread>