Hi Stefan,

On Wed, 2004-05-19 at 14:24, Stephan Beck wrote:
> 
> My Question and Problem is:
> How can i tell "my" renderThread that there is a new Node in the
> Scenegraph which i created from Python. 

The ChangeList takes cares of creations and deletions too, so you don't
have to do anything. You just have to be careful about refcounting.

> I have a method
> in my wrapper "OSGPYNodePtr" which wrapps OSGNodePtr in the following
> way (_value is OSG::NodePtr):

It might be a good idea to use a OSG::RefPtr<OSG::NodePtr> here, to make
sure refcounting works right.

> void
> OSGPYNodePtr::addChild(OSGPYNodePtr value)
> {
>   beginEditCP(_value, Node::ChildrenFieldMask);
>   {
>     _value->addChild(value.theReal()); // value.theReal() is the real
> NodePtr e.g. a tie created with SceneFileHandler
>   }
>   endEditCP  (_value, Node::ChildrenFieldMask);
> 
>   Thread::getCurrent()->getChangeList()->applyTo(1); // 1 is the
> renderThread
>   Thread::getCurrent()->getChangeList()->clearAll();
> 
> }
> 
> then i say in python:
> tie = OSGPYSceneFileHandler_the.read("data/tie.wrl") # tie is an
> instance of OSGPYNodePtr
> 
> anothernode.addChild(tie) # this invokes the wrapper code above.
> 
> it works but the tiefighter which appears in the window is only white
> (texture is missing)
> 
> Whats wrong with my code above?
> 
>   Thread::getCurrent()->getChangeList()->applyTo(1); // "1" is the
> renderThread
>   Thread::getCurrent()->getChangeList()->clearAll();
> 
> is there a merge missing and how do use this merge call?

As Gerrit mentioned in another Thread thread, applyTo is deprecated and
is going away soon, because it can cause lots of trouble, because you
can essentially brute-force change another Thread's data without it
knowing. It's better for the other thread to pull data into it's graph
from a ChangeList at a good point. Can you try that first? Other than
that your code looks ok.

        Dirk
 




-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. 
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to