Hi Lars,

On Mon, 2005-02-14 at 16:11, [EMAIL PROTECTED] wrote:
> Thanks for your reply.
> 
> I managed to find the MaterialGroup node that was above the geometry node
> and cast it into a ChunkMaterial. But I'm having great difficulty in
> casting the ChunkMaterial into TextureChunk.

your code looks ok to me. I replaced NamedNodeFinder::check in the
10loading.cpp tutorial with the following (based on your code):

Action::ResultE check(NodePtr& node)
{
if(node->getCore()->getType().isDerivedFrom(MaterialGroup::getClassType()))
{
    MaterialGroupPtr mg = MaterialGroupPtr::dcast(node->getCore());
    ChunkMaterialPtr material =
                        ChunkMaterialPtr::dcast(mg->getMaterial());
    MFStateChunkPtr* chunks = material->getMFChunks();
    TextureChunkPtr texture_chunk = NullFC;
    for ( MFStateChunkPtr::const_iterator i = chunks->begin(); 
            i != chunks->end(); i++ )
    {
        if ((*i)->getType() == TextureChunk::getClassType())
        {
            texture_chunk = TextureChunkPtr::dcast(*i);
        }
    }
    if (texture_chunk != NullFC)
    {
        std::cout << "create textureChunk" << std::endl;
    }
}
return Action::Continue;        
}

and it seems to work fine.

And to answer your other question: No, you don't have to do the
begin/endEdit if you're only reading, you only need that for changes.

Hope it helps

        Dirk




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to