Delgine 3D Tools & Content DeleD Community Edition
Forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Access violations after importing with custom plugin

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    DeleD Community Edition Forum Index -> DeleD Bugs
View previous topic :: View next topic  
Author Message
sevendoomers
Member


Joined: 19 Jun 2012
Posts: 8

PostPosted: Sun Jun 24, 2012 8:04 am    Post subject: Access violations after importing with custom plugin Reply with quote

I created a plugin to import models and it works just fine. But I've run into a small problem. After successfully importing a model, I can't create new items from the "item creation" panel. I'm getting "Access violation at address 004F27BB in module 'deled.exe'. Read of address 00000008."

Here's an example dxs produced by the plugin:
Code:
<scene version="1.6">
<settings name="import" author="" comments="" shadowOpacity="75"><ambient r="255" g="255" b="255"/></settings>
<materials highestID="1">
<category name="System">
<material id="0" name="system" lightmap="true" used="true" castShadows="true" receiveShadows="true">
<raytracing ambientReflection="0.1" diffuseReflection="0.9"><specularColor r="255" g="255" b="255"/><reflectiveColor r="255" g="255" b="255"/></raytracing>
<layer type="texture" blend="replace"><texture file="System\system.bmp"/></layer></material></category>
</materials>
<primitives highestID="1">
<primitive id="1" name="newsletter_machine" type="userdefined" visible="true" snap="none" autoUV="true" groupID="-1" skeletonID="-1"><vertices>
<vertex id="0" x="0.320000" y="-0.320000" z="1.282000" jointID="-1"/>
<vertex id="1" x="-0.320000" y="-0.320000" z="1.282000" jointID="-1"/>
<vertex id="2" x="0.291500" y="-0.291500" z="1.301200" jointID="-1"/>
<vertex id="3" x="-0.291500" y="-0.291500" z="1.301200" jointID="-1"/>
<vertex id="4" x="0.320000" y="0.320000" z="1.282000" jointID="-1"/>
<vertex id="5" x="0.320000" y="-0.320000" z="1.282000" jointID="-1"/>
<vertex id="6" x="0.291500" y="0.291500" z="1.301200" jointID="-1"/>
<vertex id="7" x="0.291500" y="-0.291500" z="1.301200" jointID="-1"/>
<vertex id="8" x="-0.320000" y="0.320000" z="1.282000" jointID="-1"/>
<vertex id="9" x="0.320000" y="0.320000" z="1.282000" jointID="-1"/>
<vertex id="10" x="-0.291500" y="0.291500" z="1.301200" jointID="-1"/>
<vertex id="11" x="0.291500" y="0.291500" z="1.301200" jointID="-1"/>
<vertex id="12" x="-0.320000" y="0.320000" z="0.002000" jointID="-1"/>
<vertex id="13" x="0.320000" y="0.320000" z="0.002000" jointID="-1"/>
<vertex id="14" x="-0.320000" y="0.320000" z="1.282000" jointID="-1"/>
<vertex id="15" x="0.320000" y="0.320000" z="1.282000" jointID="-1"/>
<vertex id="16" x="0.320000" y="0.320000" z="0.002000" jointID="-1"/>
<vertex id="17" x="-0.320000" y="0.320000" z="0.002000" jointID="-1"/>
<vertex id="18" x="0.320000" y="-0.320000" z="0.002000" jointID="-1"/>
<vertex id="19" x="-0.320000" y="-0.320000" z="0.002000" jointID="-1"/>
<vertex id="20" x="0.320000" y="0.320000" z="1.282000" jointID="-1"/>
<vertex id="21" x="0.320000" y="0.320000" z="0.002000" jointID="-1"/>
<vertex id="22" x="0.320000" y="-0.320000" z="1.282000" jointID="-1"/>
<vertex id="23" x="0.320000" y="-0.320000" z="0.002000" jointID="-1"/>
<vertex id="24" x="-0.320000" y="0.320000" z="0.002000" jointID="-1"/>
<vertex id="25" x="-0.320000" y="0.320000" z="1.282000" jointID="-1"/>
<vertex id="26" x="-0.320000" y="-0.320000" z="0.002000" jointID="-1"/>
<vertex id="27" x="-0.320000" y="-0.320000" z="1.282000" jointID="-1"/>
<vertex id="28" x="-0.291500" y="0.291500" z="1.301200" jointID="-1"/>
<vertex id="29" x="0.291500" y="0.291500" z="1.301200" jointID="-1"/>
<vertex id="30" x="-0.291500" y="-0.291500" z="1.301200" jointID="-1"/>
<vertex id="31" x="0.291500" y="-0.291500" z="1.301200" jointID="-1"/>
<vertex id="32" x="-0.320000" y="-0.320000" z="0.002000" jointID="-1"/>
<vertex id="33" x="-0.320000" y="-0.320000" z="1.282000" jointID="-1"/>
<vertex id="34" x="0.320000" y="-0.320000" z="0.002000" jointID="-1"/>
<vertex id="35" x="0.320000" y="-0.320000" z="1.282000" jointID="-1"/>
<vertex id="36" x="-0.320000" y="-0.320000" z="1.282000" jointID="-1"/>
<vertex id="37" x="-0.320000" y="0.320000" z="1.282000" jointID="-1"/>
<vertex id="38" x="-0.291500" y="-0.291500" z="1.301200" jointID="-1"/>
<vertex id="39" x="-0.291500" y="0.291500" z="1.301200" jointID="-1"/>
</vertices><polygons>
<poly mid="0"><vertex vid="0"/><vertex vid="1"/><vertex vid="2"/></poly>
<poly mid="0"><vertex vid="3"/><vertex vid="2"/><vertex vid="1"/></poly>
<poly mid="0"><vertex vid="4"/><vertex vid="5"/><vertex vid="6"/></poly>
<poly mid="0"><vertex vid="7"/><vertex vid="6"/><vertex vid="5"/></poly>
<poly mid="0"><vertex vid="8"/><vertex vid="9"/><vertex vid="10"/></poly>
<poly mid="0"><vertex vid="11"/><vertex vid="10"/><vertex vid="9"/></poly>
<poly mid="0"><vertex vid="12"/><vertex vid="13"/><vertex vid="14"/></poly>
<poly mid="0"><vertex vid="15"/><vertex vid="14"/><vertex vid="13"/></poly>
<poly mid="0"><vertex vid="16"/><vertex vid="17"/><vertex vid="18"/></poly>
<poly mid="0"><vertex vid="19"/><vertex vid="18"/><vertex vid="17"/></poly>
<poly mid="0"><vertex vid="20"/><vertex vid="21"/><vertex vid="22"/></poly>
<poly mid="0"><vertex vid="23"/><vertex vid="22"/><vertex vid="21"/></poly>
<poly mid="0"><vertex vid="24"/><vertex vid="25"/><vertex vid="26"/></poly>
<poly mid="0"><vertex vid="27"/><vertex vid="26"/><vertex vid="25"/></poly>
<poly mid="0"><vertex vid="28"/><vertex vid="29"/><vertex vid="30"/></poly>
<poly mid="0"><vertex vid="31"/><vertex vid="30"/><vertex vid="29"/></poly>
<poly mid="0"><vertex vid="32"/><vertex vid="33"/><vertex vid="34"/></poly>
<poly mid="0"><vertex vid="35"/><vertex vid="34"/><vertex vid="33"/></poly>
<poly mid="0"><vertex vid="36"/><vertex vid="37"/><vertex vid="38"/></poly>
<poly mid="0"><vertex vid="39"/><vertex vid="38"/><vertex vid="37"/></poly>
</polygons></primitive></primitives><skeletons /><lights highestID="1"/><paths highestID="1"/></scene>


I also tried importing that with the example plugin in the sdk directory and the same thing happens. Only regular "Open" command allows it to work correctly.

I'm not completely sure how the primitives are linked to materials... Is it just in the order of used materials or what?[/code]
Back to top
View user's profile Send private message
Jeroen
Site Admin


Joined: 07 Aug 2004
Posts: 5332
Location: The Netherlands

PostPosted: Sun Jun 24, 2012 8:27 am    Post subject: Reply with quote

First thing that comes to mind is that vertices don't seem to have uv coordinates? The DXS should have something like:

Code:

        <poly mid="0">
          <vertex vid="0" u0="266.8719" v0="-0.25" />
          <vertex vid="1" u0="260.028" v0="36.13936" />
          <vertex vid="17" u0="156.1494" v0="8.888185" />
          <vertex vid="16" u0="157.8681" v0="-0.25" />
        </poly>


(uv values are just examples, you can set them to 0,0 in your case)

If no uv's are assigned, DeleD can't render things properly which can cause an access voilation. I can imagine that the Open command makes DeleD create its own uv list (all set to 0,0) while plugins really need to provide uv's on their own, but I'm not sure of that. You give it a try.

Btw, what happens if you go into wireframe mode, or solid mode?
_________________
Check out Figuro, our online 3D app! More powerful 3D tools for free.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
sevendoomers
Member


Joined: 19 Jun 2012
Posts: 8

PostPosted: Sun Jun 24, 2012 8:51 am    Post subject: Reply with quote

I actually tried a build where all u0's and v0's were set to zero. It didn't make any difference so I removed them.

Wireframe thing didn't help either. Same error emerges no matter how I switched between modes Sad .
Back to top
View user's profile Send private message
Jeroen
Site Admin


Joined: 07 Aug 2004
Posts: 5332
Location: The Netherlands

PostPosted: Sun Jun 24, 2012 8:56 am    Post subject: Reply with quote

Hmm... it's weird. I tried loading that DXS just now and it loads perfectly. So the problem is sending that same data through the plugin interface.

I'm rusty where plugin code is concerned (it's been a while since I looked at it Wink). Are you filling in everything that's needed? Are you actually sending uv's?

Also, first go to wireframe, then load the dxs and see what happens?

If you're in texturemode first, then load and then switch to wireframe, and there actually are no uv's, DeleD will produce that error (or at least, that's what I'm thinking right now).
_________________
Check out Figuro, our online 3D app! More powerful 3D tools for free.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
sevendoomers
Member


Joined: 19 Jun 2012
Posts: 8

PostPosted: Sun Jun 24, 2012 9:15 am    Post subject: Reply with quote

No, the problem persists... I did exactly what you said, and yes, I'm sending uvs now. Not completely sure about that "everything that's needed" though, but I tried to mimic the layout of DeleD's dxs files.

Did you try loading with DeleDImportPlugin? After that creating a cube for example causes that error.

I too think that the dxs is missing something relevant, I just need to figure out what...
Back to top
View user's profile Send private message
Jeroen
Site Admin


Joined: 07 Aug 2004
Posts: 5332
Location: The Netherlands

PostPosted: Sun Jun 24, 2012 10:47 am    Post subject: Reply with quote

Found the problem.

This DXS replaces the default System material which is the selected material by default, too. Replacing it will cause DeleD to not have a selected material anymore. Adding a new primitive while not having a material selected will cause the AV.

Quick solution: run the importer, then select a material, then add new primitives etc.

Robust solution: DeleD should make sure a material is selected no matter what. This is something to take care of within DeleD itself, of course.
_________________
Check out Figuro, our online 3D app! More powerful 3D tools for free.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
sevendoomers
Member


Joined: 19 Jun 2012
Posts: 8

PostPosted: Sun Jun 24, 2012 11:36 am    Post subject: Reply with quote

Thanks, that seems to work Smile
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    DeleD Community Edition Forum Index -> DeleD Bugs All times are GMT
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