Jump to content
The Dark Mod Forums
Sign in to follow this  
chedap

Exporting models from Blender into TDM

Recommended Posts

Hmmm, thats a shame, Im working on a coulple of terrain models that have vertex blending... Will be looking foward to the fix.

Share this post


Link to post
Share on other sites

I've committed some initial changes to stop the script from crashing when vertex colour information is present in the mesh, however I have not yet tested that the exported vertex colours are correct. You're welcome to try the latest version and see if it does what you expect.

 

EDIT: The results look fairly reasonable I think; at least this more or less matches what I see in Blender.

 

post-254-0-81081400-1553115294_thumb.png

  • Like 2

Share this post


Link to post
Share on other sites

I know that this thread is mostly focused on getting LWO and ASE from Blender, but I don't want to make another thread for this one.

 

I downloaded this https://sourceforge.net/p/blenderbitsbobs/wiki/MD5%20exporter/ and tried to check whether it'd work with Blender 2.80.0 and it didn't. I checked the code block by block in Blender's console, most of which resulted in no errors whatsoever until the menu and registering parts, which throwed up a lot of errors:

 

def menu_func_import_mesh(self, context):
    self.layout.operator(
        ImportMD5Mesh.bl_idname, text="MD5 Mesh (.md5mesh)")
def menu_func_import_anim(self, context):
    self.layout.operator(
        MaybeImportMD5Anim.bl_idname, text="MD5 Animation (.md5anim)")

def menu_func_export_mesh(self, context):
    self.layout.operator(
        MaybeExportMD5Mesh.bl_idname, text="MD5 Mesh (.md5mesh)")
def menu_func_export_anim(self, context):
    self.layout.operator(
        MaybeExportMD5Anim.bl_idname, text="MD5 Animation (.md5anim)")
def menu_func_export_batch(self, context):
    self.layout.operator(
        MaybeExportMD5Batch.bl_idname, text="MD5 (batch export)")

def register():
    bpy.utils.register_module(__name__)
    bpy.types.INFO_MT_file_import.append(menu_func_import_mesh)
    bpy.types.INFO_MT_file_import.append(menu_func_import_anim)
    bpy.types.INFO_MT_file_export.append(menu_func_export_mesh)
    bpy.types.INFO_MT_file_export.append(menu_func_export_anim)
    bpy.types.INFO_MT_file_export.append(menu_func_export_batch)

def unregister():
    bpy.utils.unregister_module(__name__)
    bpy.types.INFO_MT_file_import.remove(menu_func_import_mesh)
    bpy.types.INFO_MT_file_import.remove(menu_func_import_anim)
    bpy.types.INFO_MT_file_export.remove(menu_func_export_mesh)
    bpy.types.INFO_MT_file_export.remove(menu_func_export_anim)
    bpy.types.INFO_MT_file_export.remove(menu_func_export_batch)

if __name__ == "__main__":
    register()

 

 

 

 

 

>>> def menu_func_import_mesh(self, context):
...     self.layout.operator(
...         ImportMD5Mesh.bl_idname, text="MD5 Mesh (.md5mesh)")
... def menu_func_import_anim(self, context):
  File "<blender_console>", line 4
    def menu_func_import_anim(self, context):
      ^
SyntaxError: invalid syntax

>>>     self.layout.operator(
  File "<blender_console>", line 1
    self.layout.operator(
    ^
IndentationError: unexpected indent

>>>         MaybeImportMD5Anim.bl_idname, text="MD5 Animation (.md5anim)")
  File "<blender_console>", line 1
    MaybeImportMD5Anim.bl_idname, text="MD5 Animation (.md5anim)")
    ^
IndentationError: unexpected indent

>>> 
>>> def menu_func_export_mesh(self, context):
...     self.layout.operator(
...         MaybeExportMD5Mesh.bl_idname, text="MD5 Mesh (.md5mesh)")
... def menu_func_export_anim(self, context):
  File "<blender_console>", line 4
    def menu_func_export_anim(self, context):
      ^
SyntaxError: invalid syntax

>>>     self.layout.operator(
  File "<blender_console>", line 1
    self.layout.operator(
    ^
IndentationError: unexpected indent

>>>         MaybeExportMD5Anim.bl_idname, text="MD5 Animation (.md5anim)")
  File "<blender_console>", line 1
    MaybeExportMD5Anim.bl_idname, text="MD5 Animation (.md5anim)")
    ^
IndentationError: unexpected indent

>>> def menu_func_export_batch(self, context):
...     self.layout.operator(
...         MaybeExportMD5Batch.bl_idname, text="MD5 (batch export)")
... 
>>> def register():
...     bpy.utils.register_module(__name__)
...     bpy.types.INFO_MT_file_import.append(menu_func_import_mesh)
...     bpy.types.INFO_MT_file_import.append(menu_func_import_anim)
...     bpy.types.INFO_MT_file_export.append(menu_func_export_mesh)
...     bpy.types.INFO_MT_file_export.append(menu_func_export_anim)
...     bpy.types.INFO_MT_file_export.append(menu_func_export_batch)
... 
>>> def unregister():
...     bpy.utils.unregister_module(__name__)
...     bpy.types.INFO_MT_file_import.remove(menu_func_import_mesh)
...     bpy.types.INFO_MT_file_import.remove(menu_func_import_anim)
...     bpy.types.INFO_MT_file_export.remove(menu_func_export_mesh)
...     bpy.types.INFO_MT_file_export.remove(menu_func_export_anim)
...     bpy.types.INFO_MT_file_export.remove(menu_func_export_batch)
... 
>>> if __name__ == "__main__":
...     register()
...     
Traceback (most recent call last):
  File "<blender_console>", line 2, in <module>
  File "<blender_console>", line 2, in register
AttributeError: module 'bpy.utils' has no attribute 'register_module' 

 

 

I'm not an expert of Blender API (in fact, I passionately hated earlier versions of the software), but I know that it was one of the major changes in 2.80.0 and I wanted to ask if the plugin may work correctly after updating this part.

Edited by Snehk

Share this post


Link to post
Share on other sites

Its more complicated than that. The script will really only work up to version 2.72. If you use it on version 2.79, eveything looks great and the model and animations will go through, but they will actually be corrupted internally. I wasted countless hours trying to make it work before it finally crossed my mind to use an earlier version, because there were no visible errors pointing out the problem. So updating the scripts would probably take a bit more work.

  • Like 2

Share this post


Link to post
Share on other sites

I guess that rewriting the scripts would be the best solution.

Share this post


Link to post
Share on other sites

I'm happy to update the script for API changes and bring it into my repository along with the LWO and ASE exports, but I don't have any experience with the MD5 animation system so testing it would be somewhat challenging.

 

Probably the most reliable way to do it would be to get hold of an example BLEND file along with the correct exported result (from earlier Blender versions) and then treating this export as canonical test data which the updated script needs to produce. In fact I should do that with the ASE and LWO scripts too, to make it easier to check for future breakages without having to do a full export and manual inspection in game.

Share this post


Link to post
Share on other sites

Hi OrbWeaver.

Each time I load Blender, for your ASE and LWO addons the console lists a load of warnings about properties that should be annotations. It doesn't say why, just that they should be.

Warning: class <class name> contains a property which should be an annotation!
...
    assign as a type annotation: EXPORT_OT_ase.filter_glob
    assign as a type annotation: EXPORT_OT_ase.filepath
...
    assign as a type annotation: EXPORT_OT_ase.option_scale

Fortunately all that's necessary is to change the = to a : and the console loses a lot of clutter.

  • Thanks 1

Share this post


Link to post
Share on other sites
On 6/29/2019 at 11:18 PM, R Soul said:

Each time I load Blender, for your ASE and LWO addons the console lists a load of warnings about properties that should be annotations. It doesn't say why, just that they should be.

Thanks, fixed in Git.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...