Jump to content
The Dark Mod Forums

Exporting models from Blender into TDM


Recommended Posts

  • Replies 84
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

The LWO export script has now been updated to support Autosmooth settings. A new option is present in the export dialog, allowing you to choose No Smoothing, Full Smoothing (looks the same as ASE), an

Alright, so I've checked out the four existing .ase importers, and they all could probably work with minimal tweaking, but they're all fairly basic. So this time I decided to write one from scratch.

On to the bad news. From what I currently understand, it is impossible for .lwo models to be smoothed independently of the way they are triangulated. The effect is hard to notice when a detailed mater

Posted Images

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
Link to post
Share on other sites
  • 2 weeks later...

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

'What do I care for your suffering?'

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
Link to post
Share on other sites
  • 2 months later...

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.

Link to post
Share on other sites
  • 4 weeks later...

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
Link to post
Share on other sites
  • 2 weeks later...
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.

  • Like 1
  • Thanks 1
Link to post
Share on other sites
  • 1 year later...

The LWO export script has now been updated to support Autosmooth settings. A new option is present in the export dialog, allowing you to choose No Smoothing, Full Smoothing (looks the same as ASE), and Use Autosmooth settings. If you choose Use Autosmooth settings, the settings of Autosmooth in Blender will be exported into the LWO file, allowing you to use both smoothing and flat shading on the same model without needing to manually split vertices.

smoothing.png.aa0141bbd2ca2c90aef94810bb2f4667.png

  • Like 1
  • Thanks 3
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.


×
×
  • Create New...