(First post 2006 ... Yay!)

Hi all! I hope you had a good holiday!

I'm having some problems merging chunk materials (more specifically, replacing one chunk with another).

This is what I do currently:

class MergeMaterialFunctor {
   ...
   void doEnter(ChunkMaterialPtr cm)
   ChunkMaterialPtr m_material;
}

void MergeMaterialFunctor::doEnter(ChunkMaterialPtr cm)
{
   const MFStateChunkPtr&  chunks = m_material->getChunks();
   const MFInt32&  slots = m_material->getSlots();

   CPEdit(cm, ChunkMaterial::ChunksFieldMask);
   for (unsigned int i = 0; i < chunks.size(); ++i) {
       int slot = i < slots.size() ? slots[i] : State::AutoSlotReplace;
       if (StateChunkPtr oldchunk = cm->find(chunks[i]->getType(), slot)) {
           cm->subChunk(oldchunk, slot);
       }
       cm->addChunk(chunks[i], slot);
   }
}

The problem is that the chunk returned by findChunk(), (that is, the oldchunk) sometimes (rarely, but repeatable) isn't found by subChunk(). It's probably a basic mistake, but I can't spot it and the chunk/slot-pairing semantics are a bit complex.

Any help welcome!

Best Regards,
/Marcus

P.S. In ChunkMaterial::find(), the ++index operation is inside the if-clause. Is that really correct?


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to