Menu

#21 Save & Save as md3 without animations causes crash

Development
closed-fixed
7
2007-01-23
2007-01-19
Anonymous
No

I honestly fail to understand how these thing go unnoticed, since it's easy to reproduce, over and over and over again. You can not save or save as to the md3 file format.

terminate called after throwing an instance of 'std::logic_error'
what(): basic_string::_S_construct NULL not valid
Aborted

Discussion

  • Kevin Worcester

    Kevin Worcester - 2007-01-19

    Logged In: YES
    user_id=1056544
    Originator: NO

    I think the problem you're having is that MM3D expects model faces to be in groups and there must be at least one frame of a "Frame" (or mesh deformation) animation. It's the latter that is causing the crash. My tests were all using animated models, which is why this was not caught. Obviously the program shouldn't crash, regardless of what MM3D "expects".

    I have a fix for the development branch (which aborts the save and gives an error message). The attached file applies this fix to 1.3.1. The fix will be in version 1.3.2.

    I do pre-releases for stuff like this. I know for a fact that other users were testing MD3 export and they didn't catch it either. It's unfortunate when bugs like this slip through, but it does happen from time to time. I appreciate that you took the time to file a bug report; however, your tone could have been a bit more polite.

    If you still have the problem after applying this fix, save the model as .mm3d and attach it to this bug so I can reproduce the behavior you're seeing.

    File Added: md3filter.cc

     
  • Kevin Worcester

    Kevin Worcester - 2007-01-19
    • priority: 5 --> 7
    • assigned_to: nobody --> kworces
    • summary: Save&Save as md3 crashes - Linux --> Save & Save as md3 without animations causes crash
     
  • Nobody/Anonymous

    Logged In: NO

    Hey, let me know when you get some code that might work, sadly md3 is the only reason I need a modeling program.

    callihn at hotmail dot com

    http://english-87526592206.spampoison.com

     
  • Nobody/Anonymous

    Logged In: NO

    Hey, let me know when you get some code that might work, sadly md3 is the only reason I need a modeling program.

    callihn at hotmail dot com

    http://english-87526592206.spampoison.com

     
  • Nobody/Anonymous

    Logged In: NO

    Kevin,

    I apologize that you felt I was not being polite and didn't mean to offend you, however I must confess that I honestly fail to see where I was anything but polite, perhaps you are too easily offended.

    I also wanted to say that I just love Misfit, nice work.

    Also you are one of the better project admins I have seen, glad to see you are on top of things.

    I don't think I fully understand the details of the problem here, the md3 is a game model and is not animated and was already working and everything was in a group, so wouldn't that just be a single frame?

     
  • Nobody/Anonymous

    Logged In: NO

    Well, it saves now but I am having to add the frame animation, so it looks like it's not getting that from the model since the model already existed and was working fine in the game, it also appears that it is not getting the MD3_PATH from the model either, because the model obviously has to have these things and again it was working fine in the game, I only opened the existing model and attempted to save it, no changes were made, at which that time I was prompted to add a frame animation to it in order to save and the md3_PATH is getting set to model/ when the model was working before with the materials in the same folder as the model.

    Hope that helps and hope it's something you can get squared away.

    Thanks

     
  • Kevin Worcester

    Kevin Worcester - 2007-01-20

    Logged In: YES
    user_id=1056544
    Originator: NO

    This bug fits into the Kevin-doesn't-understand-his-users department. It wasn't until after I wrote up the response and attached the fix that I remembered some people use MD3 for static models. This is perfectly acceptable usage, and the behavior is definitely broken--as you've noted. :-)

    So I've attached a fix that does not require animations.

    Now textures are a tricky matter, because different programs handle the pk3 path differently. The file may or may not have a pk3 path for the model embedded in it. The model file may or may not be in a path that looks like the pk3 path. The textures may or may not be in the same directory as the model. I could test this all weekend and still miss corner cases.

    It sounds like the model you're working on doesn't have a PK3 path in file itself. The guy who originally wrote the md3 filter defaulted to "model/" if there wasn't a path in the file. I don't know what his reasons were. I hadn't touched the texture handling until tonight because it always just worked for me. I think I've fixed your case and I hope I didn't break anything in the process.

    The following are the rules for texture handling (I need to add this to the MD3 format documentation once this bug is fixed). If something doesn't work right either your model doesn't fit neatly into these rules or there are bugs that I still need to work out.

    Loading:

    1) If the model contains a pk3 path, MM3D will set MD3_PATH, otherwise it will default to "" (so that it saves the same way it loaded)
    2) MM3D attempts to load texture files from the same directory as the model
    3) If the texture files are not in the same directory as the model, but MD3_PATH is set, MM3D removes MD3_PATH from the model path, and appends the shader's relative path from the file and tries again
    4) If MD3_PATH is not set, the relative shader path is preserved (error fallback)

    Saving:

    1) If MD3_PATH is set, it is prepended to the model filename as the pk3 path and saved into the MD3 file, otherwise just the base filename is written
    2) If the model path and the texture path are the same, the pk3 path is used to reference the texture as the shader name
    3) If the path is relative it is written out exactly as specified (error fallback case)
    4) Otherwise, if the texture path is absolute, pk3Path is removed from the model's path and checked against the texture path. If the truncated path matches, the matching part is removed and the remainder is used as the shader name
    5) Otherwise, if the texture path is absolute, the base filename is written without any path

    There are a lot of ways texture path handling can go wrong. I tried to handle as many cases as I could think of. See the attached file (static model and texture path fix). Let me know either way if it works or not.

    If this still doesn't work then I'll almost certainly need an example model as well as the full path you're referencing the model as in order to fix it. If you can't attach it here for copyright reasons, you can check the contact page and email me directly.

    I'm completely booked this weekend, so there's no more time I can devote bug fixing until sometime next week--though I will probably be able to follow-up here to answer questions as needed.
    File Added: md3filter-statictexture.tar.gz

     
  • Nobody/Anonymous

    Logged In: NO

    Hmmmm,

    Let's try this to be sure, because I want the filter to work right for everyone, however I do want to note that I myself have never seen a model in .md3 format that wasn't made to be used in an ID gaming engine and thus static, though again if it's suppose to go both ways then I that's what I would like to see.

    So that being said, you obviously are able to test the animated ones, so I'll supply you with a static one packaged just like it's used and that will allow you to test it and hopefully get everything working right for anyone that needs this filter.

    Also, here are some specs and info that may or may not help along with the attached example.

    http://icculus.org/homepages/phaethon/q3a/formats/md3format.html

    Also since the Quake III engine is now GPLed it's code may or may not help with this.

    Opps I can't attach anything, I've tried a zillion times to register here but it never seems to work.

    So....

    You can get it here:

    http://mout.sytes.net/wreck.tar.gz

     
  • Nobody/Anonymous

    Logged In: NO

    Then again maybe it's just not reading something rite because I see another page that talks about the animated ones being in the game, maybe they have different IDs or something, I dunno, but I'm sure you can get to the bottom of this.

    http://www.xbdev.net/3dformats/md3/index.php

     
  • Kevin Worcester

    Kevin Worcester - 2007-01-20

    backslash fix

     
  • Kevin Worcester

    Kevin Worcester - 2007-01-20

    Logged In: YES
    user_id=1056544
    Originator: NO

    Ah! Backlashes!

    The guy who wrote the filter originally accounted for backslashes when reading texture files but not when reading the pk3 name. I used this version of the filter on the model you provided and it works for me (in mm3d). I don't have a game engine to test it in so you'll have to check that.

    See backslash fix attachment below.
    File Added: md3filter-backslash.tar.gz

     
  • Nobody/Anonymous

    Logged In: NO

    Well, that did it alright.

    Only a few questions remain.

    Since there are apparently two types anamated and static is this going to work with both?

    Are the materials/textures rolled into the model itself?

    If not how is the path handled?

    Cause if it's not I'm confused about how it worked. ;)

    B.T.W. I like Misfit MUCH better than Blender, which B.T.W. I found harder to learn and use and it crashed on export to md3 and the person that wrote the plugin couldn't be contacted at the time, probably still can't be, I dunno when emails start bouncing I generally give it up.

    Thanks

     
  • Nobody/Anonymous

    Logged In: NO

    Aside from that I'll just leave you with my wish list:

    Filters for .ase .bsp and .lwo

    Default to not have include back faces checked, drove me crazy for an hour cause I had the check box off screen. ;)

    And this one might just be me, but a note on the grid unit setting telling what measurement we are dealing with for example if I set it to two, what is it, two miles or two inches, or two centimeters.

    Anyway, I think you have a great program here and look forward to see it's future.

    Thanks again

     
  • Kevin Worcester

    Kevin Worcester - 2007-01-21

    Logged In: YES
    user_id=1056544
    Originator: NO

    I'm glad that final patch worked for you. I'll mark this fixed when 1.3.2 is finalized (and remove the two previous patches for the sake of clarity).

    The texture stuff is independent of the animation stuff. The animation stuff continues to work fine.

    Textures are external. They are supposed to be referenced by a relative path--relative to the quake 3 virtual file system. But many MD3 exporters don't handle this correctly so there's a bunch of configurations that are possible. Hence, the texture woes you encountered with mm3d.

    > ASE and LWO

    I'll add them to the list.

    > BSP

    I'm not sure I want to get into that. :-)

    > grid units

    The units are just open GL units. They can mean whatever you want them to mean (or whatever your game engine will treat them as). I thought this was in the docs, but I don't see it after a quick search, so I'll add a note on that in the help documentation.

     
  • Nobody/Anonymous

    Logged In: NO

    Yeah, sorry I didn't mean .bsp, geez that wouldn't be useful and would take a ton of work, I ment .map, you can save brushwork in GTKRadiant to a .map file, which is basicly text and you can use q3map2 to convert that to a .ase, the problem with that methos though is two fold, first it places a box around the model, so for example if it was a chair you couldn't get in the seat and second it screws the texture alignment and scaling up totally. Just a thought though.

    Thanks

     
  • Nobody/Anonymous

    Logged In: NO

    Ohh, sorry about the texture question I must have been asleep, LOL!

    On the grid, what I don't understand, keep in mind I'm new to modeling, but how do I know that for example if I made say a handgun for a game, how do I know it's not as big as a house?

     
  • Kevin Worcester

    Kevin Worcester - 2007-01-23

    Logged In: YES
    user_id=1056544
    Originator: NO

    This fix is in 1.3.2, which is now available.

     
  • Kevin Worcester

    Kevin Worcester - 2007-01-23
    • status: open --> closed-fixed
     

Log in to post a comment.

Monday.com Logo