Hi Dirk,

On Wed, 12 Nov 2003, Dirk Reiners wrote:

> On Wed, 2003-11-12 at 10:35, Akos Balazs wrote:
> > Hi Dirk,
> >
> > Sorry to do a followup on such an old mail, but I've managed to run
> > into new problems - as usual. :-)))
>
> new problem, new fun. ;)

Yeah. :) Especially just before a demonstration... :)


> > // Traverse the loaded scene and add alpha-keys to all materials //
> > Plus add the support for wireframe (polygonchunk) Action::ResultE
> > addChunks(NodePtr& node) {
> >     if(node->getCore()->getType().isDerivedFrom( 
> > ChunkMaterial::getClassType()))
>
> A ChunkMaterial can't be derived from NodeCore, so this doesn't do
> anything. You'll have to check for Geometry and get the Material from
> the Geometry.

OK, thanks for this info. Obviously I should've realised this looking at
the inheritance graph, but well... :)

Anyway, in this specific case it doesn't matter at all since Gerrit's VRML
loader creates MaterialGroups, and the Geometry Cores in the loaded graph
do not seem to have correct Materials.

While we're at it, would you care to explain what's this MaterialGroup and
how does it relate to the Material-Geometry pair? I'm just curious.

> >     {
> >         ChunkMaterialPtr m = ChunkMaterialPtr::dcast(node->getCore());
> >         if ( checkIfChunksPresent( m ) == false )
> >         {
> >             beginEditCP( m, ChunkMaterial::ChunksFieldId );
>
> ^^ You need to use the Mask, not the ID for begin/endEdit. this applies
> to all cases, I hope you're not doing this everywhere in your program.
> Then again, I can't think of any case where you would need to use the
> Id, you can probably just replace Id with Mask and be fine.

Yeah, _very_ embarrassing. :) This was some late-night coding session last
night and I just copied the FieldId stuff from the online docs without
paying too much attention. :) I did a quick grep and it seems this was the
only place I've used them. Point one. :)

> > The funny thing is that the polygonchunk works on the servers aswell
> > (i.e. I can switch to and from wireframe) so the material changes
> > _are_ propagated but the blending doesn't work at all. ;(
>
> That is strange. Did you begin/endEdit the BlendChunk when changing its
> parameters?

No, very embarrassing bug number two, and point two for Dirk. :-) Actually
I only setup the BlendChunk in the very beginning, before the traversal,
and I forgot the begin/endEdit. :-\ When using the polychunk this is
interactive, and in a different part of the code, and I've copied that
part from another program where it worked so I already had the
begin/endEdits in place. :)


> > BTW Gerrit's VRML loader creates MaterialGroups, that's why I was
> > playing with the beginEditCP/endEditpCP calls above but there was no
> > difference whatsoever.
>
> Try the Mask, and make sure you begin/endEdit the BlendCHunk. If that
> doesn't help we'll have to look for something else.

Thanks, it seems to work at least on my machine with 1 client + 2 servers
(running on the same machine), so I assume it'll work on the Powerwall
aswell.

Lessons learned: don't copy'n'paste stuff from the docs half asleep, and
double-triple check your begin/endEditCPs. :)

Thanks again,

        Akos




-------------------------------------------------------
This SF.Net email sponsored by: ApacheCon 2003,
16-19 November in Las Vegas. Learn firsthand the latest
developments in Apache, PHP, Perl, XML, Java, MySQL,
WebDAV, and more! http://www.apachecon.com/
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to