www.quadsoftware.com
FAQ  FAQ   Search  Search   Memberlist  Memberlist   Usergroups  Usergroups
Register  ::  Log in Log in to check your private messages


Post new topic  Reply to topic
 Help needed for tracking down plugin bug... « View previous topic :: View next topic » 
Author Message
cmusch
PostPosted: Thu Dec 13, 2007 11:51 am    Post subject: Help needed for tracking down plugin bug... Reply with quote



Joined: 02 Aug 2007
Posts: 33

Hello!

I have a very subtle bug that causes Grome to crash when exporting a level with our own plugin, but only when objects are previously loaded with our import plugin. I think our import plugin somehow corrupts Grome image/texture state, but I am not sure.

I tried to track down the error myself, but now I'm stuck and need your help Sad

If I disable texture loading in the import plugin, the crash does not happen. The relevant code is here:

Code:

    // construct name of texture.
        std::wstring tex_path = toUnicode(data_path_) + M_SZ("textures\\models");
        iStorage * img_storage = g_storage_man->GetStorageFromPath(tex_path.c_str());
        assert(img_storage);
      
        ret = img_storage->Parse();
        assert(M_SUCCEED(ret));
        AUTO_CLOSE(img_storage);

      
        for (unsigned t=0; t<cur_mesh->getTextureName().size(); ++t)
        {
            assert(cur_mesh->getTexData()[t].size() == cur_mesh->getVertexData().size());   

            // Create a texture with a default name, without storage.
            iTexture* tex = (iTexture*)g_sdk_root->NewNode(C_NODE_FACTORY_TEXTURE, NULL, NULL, NULL);
            assert(tex);

            // Set the image from the storage as the source of the texture.
            tex->SetSourceImage(toUnicode(cur_mesh->getTextureName()[t]).c_str(), img_storage);

            // Now load the image and fill the texture.
            ret = tex->Load();
            assert(M_SUCCEED(ret) && "Couldn't load texture");            

            surface.textures[t]               = tex;
            surface.texmaps[t]                = (void*)&cur_mesh->getTexData()[t][0];
            surface.texmaps_no[t]             = cur_mesh->getTexData()[t].size();
            surface.texmaps_indices[t]        = &indices[0];
            surface.texmaps_indices_stride[t] = 1;
        }



Could you just take a brief look at it and see if it does anything fundamentally wrong? Objects display nicely in grome, lightmap and all, so the basics should be ok.

If there is no mistake in the code above, I will send you a crash report and the exporter code which causes the crash.

regards
cm
Back to top
View user's profile Send private message
ALicu
PostPosted: Fri Dec 14, 2007 8:27 am    Post subject: Reply with quote



Joined: 12 Feb 2007
Posts: 1326

Hi,

I don't see anything wrong with your code. I've actually tried to replicate the bug with the following code (which does the same image operation):

Code:

   iStorage * img_storage = g_storage_man->GetStorageFromPath(M_SZ("C:\\temp"));
   img_storage->Parse();
   iTexture* tex = (iTexture*)g_sdk_root->NewNode(C_NODE_FACTORY_TEXTURE, NULL, NULL, NULL);
   tex->SetSourceImage(M_SZ("temp.dds"), img_storage);
   tex->Load();


It may something related to other operations (than the SDK loading of textures).

Please send us the crash report. It may not help since the crash is happening in the SDK. What I fear is that the bug is related to your data. It may happen only for some images.

Adrian L.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Based on a template by Dustin Baccetti
Powered by phpBB © 2001, 2005 phpBB Group