Code Monkey home page Code Monkey logo

mod3-mhw-importer's Introduction

Mod3-MHW-Importer

Blender Mod3 Import-Exporter for Monster Hunter World. Written for Blender 2.79, no update for further Blender versions is planned (feel free to fork if you are interested in doing it yourself).

Documentation

Documentation on functionality can be found on https://github.com/Ezekial711/MonsterHunterWorldModding/wiki/Asterisk's-Plugin-Features.

Additionaly under Asterisk's Plugin Notes are notes on the format that are not explained on the research template and cover advanced functionality.

Installation

As any other blender plugin. Download the zip of the project. Create a folder in your blender addon folder and drag the files in the zip there.

Author

  • AsteriskAmpersand/*&

Acknowledgements

  • Lukas Scone/Predator - For the initial reverse engineering of the MT Framework Model Format. - Predator's Dev Blog
  • CrazyT - For his work on the original blender importer plugin and his help during the coding of this version. - CrazyT's Github User Page
  • Jodo - For his tex to dds converter and compiling a custom version for this project. - Jodo's MHW Modding Site
  • Cristian Năvălici - For his crc32/crcjam code for python. - PyCRC Project Page
  • Chuck Walbourn - For the DirectXTex library for dds to png convertor. - DirectXTex Github Repo

mod3-mhw-importer's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mod3-mhw-importer's Issues

Cinema4d

Do you know if this could be done for cinema4d as well?

If not, do you know how can i open mod3 files with cinema4d?

Feature Request: 90 degree X rotation on import

Models imported using the MHW importer are off by -90 degrees on the X axis.

For example with this Great Jagras being off by -90 degrees makes it point up instead of forward.
image
Instead of:
image

This is not a problem for regular use but for batch operations with the LMT loader animations will be stuck in the -90 degree X orientation unless the operation includes a manual or python script rotation.

Error: "Animation Armature" on model with no skeleton

Blender version: 2.79b 2018-3-22 14:10
Importer version: latest as of 2019/7/4
MHW game version: 167589

Issue:
When importing a .mod3 file with the "Import Skeleton" setting set to "Animation Armature" but the model does not have a skeleton an error will occur.
This is not a problem for regular usage but batch conversion of models with and without skeletons will run into the error.
Occurs on the accessory acc011_002, files used https://mega.nz/#!2DZU0aIA!4dQN_qmfO0g_ZgAKy80DwpG6IuBdtzycRQgzMegA9qA

Suggestion:
A check on import so that if "Animation Armature" is selected and the model does not have a skeleton then armature import is skipped.

Console Error:
Traceback (most recent call last):
File "C:\Users\Adam\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\Mod3-MHW-Importer-master\operators\mod3import.py", line 102, in execute
Mod3IL.Mod3ToModel(Mod3File, BApi, options).execute(blenderContext)
File "C:\Users\Adam\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\Mod3-MHW-Importer-master\mod3\Mod3ImporterLayer.py", line 37, in execute
call(context)
File "C:\Users\Adam\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\Mod3-MHW-Importer-master\mod3\Mod3ImporterLayer.py", line 49, in
excecute.append(lambda c: skeletonOperator(c))
File "C:\Users\Adam\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\Mod3-MHW-Importer-master\mod3\Mod3ImporterLayer.py", line 83, in createArmature
self.api.createArmature(self.model.prepareArmature(),c)
File "C:\Users\Adam\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\Mod3-MHW-Importer-master\blender\BlenderMod3Importer.py", line 100, in createArmature
boneGraph = BoneGraph(armature)
File "C:\Users\Adam\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\Mod3-MHW-Importer-master\blender\BlenderMod3Importer.py", line 41, in init
self.roots = self.boneParentage[255]
KeyError: 255

Exporting models rigged using an armature

I have attempted to replace an NPC's model with a monster's model, and I've hit a wall in regards of actually making it look somewhat correct.

In order to make the model fit a humane shape, I need to manipulate it's mesh and rig a bit.
I've attempted bending the mesh using hooks between the empty nodes and vertex groups, but pretty much any bone rotation results in extreme warping of the model.
That issue doesn't happen when the model is imported with an armature, as from what I understand, the joints have physical size that prevents the mesh from warping and folding out of existence.
Unfortunately this plugin doesn't appear to be able to export such an armature as a rig for the mod3 format, which at this point pretty much forces me to do some mesh + armature + empty rig shenanigans in order to both be able to modify the model properly and export it into .mod3.

(Would also be nice if this plugin was made compatible with blender 2.92)

No material and bones are objects

Blender version: 2.79b 2018-3-22 14:10
Importer version: latest as of 12:00 GMT 1 today
MHW game version: 167589

Issue:
When importing any extracted .mod3 file the model has no material and the armature made of objects instead of bones.
image

This is not the case for the outdated TheCrazyT BlenderMhwModelImporter which gets the skeleton and a single material (joins multiple materials into one with broken UVs).

.mod3 file with fbx conversions for Mod3-MHW-Importer and BlenderMhwModelImporter versions
pl036_0000 Arm.zip

Merged hand weights

When imported using the latest release m_arm050_0500 has merged weights on the right fingers resulting the movement of one finger pulling the mesh of another.
Capture
image
m_arm050_0500.zip
This is with the skeleton set to animation armature and weights set to standard.
I tested a few other arms and they worked fine so it may be just this model.

Update:
After more checking I have found that the legs of the savage deviljho armour, barioth arms and various chest armour has mixed weights aswell.

em013 wrong weights

em013 (Fatalis) monster weight calculation is incorrect for weightDynamics 65 and 57 (8 weights) on Mod3VertexWeightExtended.

Changing Mod3VertexWeightExtended.WEIGHT_MULTIPLIER from 255 to 1023 and replacing the last weight (which is using an incorrect sum(1-...) with just 0 fixes it for this particular model (although it might break others, I haven't checked, but I don't know why the values have been different to begin with).

class Mod3VertexWeightExtended(CS.PyCStruct):
    WEIGHT_MULTIPLIER = 1023
    fields = OrderedDict([("tenBitWeight","uint32"),
                          ("byteWeights","ubyte[4]")])
    
    
    @staticmethod
    def weightFromBytes(byteWeights):
        return list(map(lambda x: x/Mod3VertexWeightExtended.WEIGHT_MULTIPLIER, byteWeights))
    @staticmethod
    def weightToBytes(weights):
        return [round(weight*Mod3VertexWeightExtended.WEIGHT_MULTIPLIER) for weight in weights]
    
    def marshall(self, data):
        super().marshall(data)
        self.weights = Mod3VertexWeightBase.weightFromBytes(Mod3VertexWeightBase.tenBitWeightSplit(self.tenBitWeight))
        self.weights += Mod3VertexWeightExtended.weightFromBytes(self.byteWeights)
        self.weights.append(0)
        self.bits = self.tenBitWeight>>30
        
    def construct(self, weightList):
        self.weights = weightList
        self.bits = 0
        
    def serialize(self):
        self.tenBitWeight = Mod3VertexWeightBase.tenBitWeightMerge(Mod3VertexWeightBase.weightToBytes(self.weights[:3]))+(self.bits<<30)
        self.byteWeights = Mod3VertexWeightExtended.weightToBytes(self.weights[3:7])
        return super().serialize()

Unavailable for 3.1

Tried installing multiple times, it shows up on the list as installed and yet when I go to import or export it doesnt appear. I tried 2.7, 2.8, 2.8.3 and even 2.9 and all it does is tell me I need 2.8X. Tried again on 3.1 and STILL doesnt appear.

please please PLEASE update it for 3.1

2.8 Suggestion

Idea for 2.80 exporter, only export selected collections.

Blender Installation Issues

Attempting to install the add-on just results in a error saying Blender 2.8x is needed, despite currently being on Blender 2.82

Capture1

Downloading the file using the 1.5v instead gives an error relating to a module

Capture

Capture2

Animation Armature not importing

Blender 2.80 with the most recent plugin version.

Tried to import an Animation Armature with the Vaal Hazak Y body (pl032_0020) and got this error:

bpy.data.window_managers["WinMan"].(null)` = 'Armature'
bpy.context.space_data.bookmarks_active = 0
bpy.ops.object.select_all(action='SELECT')
bpy.ops.object.delete()
Traceback (most recent call last):
  File "C:\Users\Brandon\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\Mod3-MHW-Importer-master\operators\mod3import.py", line 102, in execute
    Mod3IL.Mod3ToModel(Mod3File, BApi, options).execute(blenderContext)   
  File "C:\Users\Brandon\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\Mod3-MHW-Importer-master\mod3\Mod3ImporterLayer.py", line 37, in execute
    call(context)
  File "C:\Users\Brandon\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\Mod3-MHW-Importer-master\mod3\Mod3ImporterLayer.py", line 49, in <lambda>
    excecute.append(lambda c: skeletonOperator(c))
  File "C:\Users\Brandon\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\Mod3-MHW-Importer-master\mod3\Mod3ImporterLayer.py", line 83, in createArmature
    self.api.createArmature(self.model.prepareArmature(),c)
  File "C:\Users\Brandon\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\Mod3-MHW-Importer-master\blender\BlenderMod3Importer.py", line 93, in createArmature
    bpy.context.scene.update()
AttributeError: 'Scene' object has no attribute 'update'```

blender

Is this working?
2.8.2 version has an error.
3.1.0 version is not visible on import or export.

2.8 Update

bpy.types.INFO_MT_file_import ---> bpy.types.TOPBAR_MT_file_import
bpy.types.INFO_MT_file_export ---> bpy.types.TOPBAR_MT_file_export
bpy.context.scene.objects ---> bpy.context.scene.collection.objects
blenderMesh.uv_textures ---> blenderMesh.uv_layers
Explicitly pass arguments for the new() function
vertex_groups.new(groupName) ---> vertex_groups.new(name=groupName)
uv_textures.new(name) ---> blenderMesh.uv_layers.new(name=name)
And comment out basically anything related to QoL rendering like show_edge_sharp and show_x_ray

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.