sugiany / blender_mmd_tools Goto Github PK
View Code? Open in Web Editor NEWmmd_tools is a blender addon for importing Models and Motions of MikuMikuDance.
License: Other
mmd_tools is a blender addon for importing Models and Motions of MikuMikuDance.
License: Other
It seems I can't move my character without the hair and such still being tied to the rigid body, and the rigid body seems stuck.
Is there any way to move the whole character, including rigid body, joints, mesh, armature?
Hi. I was faced with some errors at import (and/or) export by mmd tools.
I use PMX Editor 0222c English version: http://ibozo.deviantart.com/art/PMDEditor-0139-and-0219-english-translation-375517501
and this model of Haruhi Suzumiya: http://u3.getuploader.com/valkyrie6666/download/130/%E3%83%8F%E3%83%AB%E3%83%92ver1.2.zip (password: haruhi)
Blender 2.74
And actually errors (png files in attach):
1.png: Errors in materials
2.png: Errors in bones
in 3.png I marked the most painful error
I tried to import some motion data to blender although the animations works fine it seems facial expressions in the motion file doesn't work. How to solve this?
Thank you
The MMD camera rig angle input field is not there with Blender 2.93 and 3.0 so the MMD camera angle is not transferred to blender camera focal length.
Hi there! It's been a few years more since my last post and still @sugiany hasn't shown any signs of activity yet. At this point I highly doubt sugiany will come back. Fortunately @powroupi is still maintaining the project in their fork. I'm honestly impressed by powroupi's commitment to the project, almost every month there is at least one commit.
So please, go here: https://github.com/powroupi/blender_mmd_tools and enjoy the most updated version of this tool.
Update:
powroupi is not currently maintaining this project, now the torch is in UuNyaa's hands: https://github.com/UuuNyaa/blender_mmd_tools/tree/main
Sadly it seems sugiany-san has abandoned the project. But if you are interested the project is being continued by powroupi you can help him here https://github.com/powroupi/blender_mmd_tools/tree/dev_test
just add model crash many times and cannot add vmd file
For a pair of symmetric bones in .pmx with "local axes" enabled(eg. 左腕 and 右腕 ), imported bones in blender are having same local X axes and opposite local Z axes, which is not compatible with default blender X-mirror manner, and also not compatible with imported symmetric bones with "local axes" disabled in .pmx. (symmetric bones should have same Z axes and opposite X axes).
( by word 'same' I mean a vector {x,y,z} is mirrored into {-x,y,z}, 'opposite' means {x,y,z} -> {x,-y,-z} .)
Editing one bone in X-mirror mode will instantly flip the roll (bpy.types.EditBone.roll) of another bone, causing it's highly inconvenient to edit imported models. (Also highly inconvenient to apply a imported .vmd file onto a character which is created in blender with x-mirror on)
Could you please change this (or add an option) to be compatible with default blender x-mirror manner? (Importing of .vmd files may also be changed accordingly)
Tested the pmx importer.
All face normals of the imported model incorrectly point inside the mesh.
rev. 57be84a
neither 4.0 nor 5.0 can convert materials for cycles and report error like this
Traceback (most recent call last):
File "G:\Blender\2.78\scripts\addons\mmd_tools\operators\material.py", line 18, in execute
cycles_converter.convertToCyclesShader(obj)
File "G:\Blender\2.78\scripts\addons\mmd_tools\cycles_converter.py", line 143, in convertToCyclesShader
i.material.node_tree.links.new(i.material.node_tree.nodes['Material Output'].inputs['Surface'], outplug)
KeyError: 'bpy_prop_collection[key]: key "Material Output" not found'
location: <unknown location>:-1
hope to fix it
VMD file interpolation data - What does it mean?
Using the Interpolation Curve in MikuMikuDance:
http://learnmmd.com/http:/learnmmd.com/using-the-interpolation-curve-in-mikumikudance/
More Motion Interpolation Curve Instruction for MMDers:
http://learnmmd.com/http:/learnmmd.com/more-motion-interpolation-curve-instruction-for-mmders/
The curve and its control points are located on a 128 X 128 grid (0-127 X 0-127) There are 2 control points for each interpolation curve. Each control point has an x co-ordinate and a y co-ordinate. Each co-ordinate is defined by a 2-byte integer. The x, y and z axes of a camera or of an ordinary rotating object each need to have a pair of control points. Therefore 24 bytes of interpolation data for a camera or for an ordinary rotating object.
Each bone has w,x,y and z values for quaternion rotation. Each bone needs to have 2 sets of quaternion values. Therefore 64 bytes of interpolation data for each bone.
Unfortunately, I have absolutely no idea why a bone would need to have 2 sets of quaternion values instead of just 1.
I am not sure if these ideas are correct, but I hope that they give a helpful clue to solving the puzzle. These ideas are just my own inductive/deductive theorizing. Sorry, but I don't have any authoritative or complete information.
says not compatible
Hello, can someone please review this list of MMD tools features and correct or fill in the blanks for me and also for other people:
MMD tools features:
Ability to pose or animate these morphs of an imported PMX model in Blender:
material morphs No.
UV morphs No.
bone pose morphs No.
group morphs No.
The data of these morphs is preserved and will be re-exported when a previously imported PMX model is exported from Blender:
material morphs - Yes.
UV morphs - Yes (dev_test by powroupi), No (master.zip).
bone pose morphs - Yes (dev_test by powroupi), No export (master.zip).
group morphs - Yes (dev_test by powroupi), No (master.zip).
Dual/bilingual naming of shape keys is preserved and will be re-exported when a previously imported PMX or PMD model is exported from Blender Yes. (with "Morph Tools" panel)
Imported shape keys can be edited, renamed, re-ordered and the re-exported from Blender with their data intact. Yes. (with "Morph Tools" panel)
Dual/bilingual naming of PMD and PMX bones and PMX materials is preserved and will be re-exported when a previously imported PMX or PMD model is exported from Blender Yes.
Correct display of an MMD model's ambient color in Blender. No.
Correct display of an MMD model's toon textures in Blender. No.
Correct display of an MMD model's sphere textures in Blender. Yes. (except "subtract blend" type)
Ability to use .fx effects in Blender. No.
Ability to import SDEF in Blender. No, SDEF is converted to BDEF.
Ability to import .vmd morphs animation. Yes.
Ability to import .vmd bones animation. Yes.
Ability to import .vmd camera animation. Yes.
Ability to import .vmd lamp animation. Yes.
Ability to export .vmd files from Blender. No.
Ability to import and re-export physics objects correctly. Yes (at least no bugs have been found yet).
Physics animation. Yes.
My recent deviantart journal entry:
MMD models in Blender
Some links to help people get started with importing, exporting, editing, converting or animating MMD models in Blender:
http://hogarth-mmd.deviantart.com/journal/MMD-models-in-Blender-626045612
I use a pmx mmd model transfromed from XNALaraXPS, and it is imported into blender(ver.2.79) well , but the character has no facial expression. And the in the Bone Morph I can see some tags like にやり左、真面目, so how do those bone morphs work? If I want to use these bone morph as facial expression, what should i do ?
When I try to enable the addon I get the error:
Trackback (most recent call last):
File "C:\Program Files (x86)\Blender\2.68\scripts\modules\addon_utils.py", line 294, in enable mod = import(module_name)
File "C:\Program Files (x86)\Blender\2.68\scripts\addons\mmd_tools_init_.py", line 11, in from . import import_pmx
ImportError: cannot import name import_pmx
In the console I saw that when I pressed "build" it would say "dependency cycle detected". This also prevented "build" from activating properly one time.
It often seems to involve the "shadow" bones. Deleting these through edit mode fixed the problem for me.
Your MMD Tools are probably the best Blender scripts for importing PMX/PMD models and it's very sad that there isn't an option for exporting too, it shouldn't be so difficult, all you need to do is to reverse the process of importing.
PD: Oh! I noticed that the feature is there, but it's not displayed on the UI, there is no button or option in File>Export
Thanks for your efforts, but it seems that I can only add a new morph if the 'empty' object is the active object. Otherwise I get a KeyError error message. (The easiest debugging solution is well-commented code. Then you can relax and enjoy life while other people do your debugging for you. :-) )
I get an error as I tried to import the TDA Convergence Luka Append Model: http://puu.sh/gaRG0/8cbab423bf.png
README.md says:
カメラはMMD_Cameraという名前のEmptyオブジェクトを生成し、このオブジェクトにモーションをアサインします。
However, the actual result is:
The empty object is named "Camera", while the original camera object is renamed to "Camera_mmd".
mmd_camera.py should be modified as follows:
diff --git a/mmd_tools/mmd_camera.py b/mmd_tools/mmd_camera.py
index 2b5a0cb..3f53598 100644
--- a/mmd_tools/mmd_camera.py
+++ b/mmd_tools/mmd_camera.py
@@ -61,8 +61,7 @@ class MMDCamera:
if MMDCamera.isMMDCamera(cameraObj):
return MMDCamera(cameraObj)
- name = cameraObj.name
- cameraObj.name = name + '_mmd'
+ name = 'MMD_' + cameraObj.name
empty = bpy.data.objects.new(name=name, object_data=None)
bpy.context.scene.objects.link(empty)
To keep consistency, mmd_lamp.py also should be modified:
diff --git a/mmd_tools/mmd_lamp.py b/mmd_tools/mmd_lamp.py
index 0bfb2ff..0e5486f 100644
--- a/mmd_tools/mmd_lamp.py
+++ b/mmd_tools/mmd_lamp.py
@@ -56,11 +56,11 @@ class MMDLamp:
if MMDLamp.isMMDLamp(lampObj):
return MMDLamp(lampObj)
- name = lampObj.name + '_mmd_target'
+ name = 'MMD_' + lampObj.name + '_target'
empty = bpy.data.objects.new(name=name, object_data=None)
bpy.context.scene.objects.link(empty)
- name = lampObj.name + '_mmd_source'
+ name = 'MMD_' + lampObj.name + '_source'
armature = bpy.data.armatures.new(name=name)
armatureObj = bpy.data.objects.new(name=name, object_data=armature)
bpy.context.scene.objects.link(armatureObj)
Hello,
I have a problem when exporting pmx file in fresh blender v2.78. Here is the error message:
Traceback (most recent call last):
File "C:\Program Files\Blender Foundation\Blender\2.78\scripts\addons\mmd_tools\operators\fileio.py", line 192, int execute
rig = mmd_model.Model(root)
File "C:\Program Files\Blender Foundation\Blender\2.78\scripts\addons\mmd_tools\core\model.py", line 60, in init
if root_obj.mmd != 'ROOT':
AttributeError: 'NoneType' object has no attribute 'mmd_type'location: : -1
Hiya,
Absolutely love the project. It has Pymeshio beast any day of the week!
I thought I'd raise the following issue I've found.
When importing to Blender, it seems to completely seperate UV shells in to all their individual triangles. This way, when trying to select UV shells, you just get individual triangles and not the whole shell.
I wonder if there is a fix for this?
The current workaround is having to manually select each triangle and merge them back together.
pmx importer forgets to apply "scale" option to some bones which are not connected to children.
The following patch should fix this:
diff --git a/mmd_tools/import_pmx.py b/mmd_tools/import_pmx.py
index 01b458c..cda29e3 100644
--- a/mmd_tools/import_pmx.py
+++ b/mmd_tools/import_pmx.py
@@ -143,7 +143,7 @@ class PMXImporter:
else:
b_bone.tail = b_bone.head
else:
- loc = mathutils.Vector(m_bone.displayConnection) * self.TO_BLE_MATRIX
+ loc = mathutils.Vector(m_bone.displayConnection) * self.TO_BLE_MATRIX * self.__scale
b_bone.tail = b_bone.head + loc
for b_bone in editBoneTable:
Note: This patch is for rigids_and_joints branch, not master branch.
The cloth baking seems to work fine (though I have to use "build" and "clean" quite a lot, and they take a while) except when I try to change the pose. I can't exactly tell what's going on but it seems like the rigid body locks to one area. I've had one result where the skirt and hair will try and get as close to the origin point as possible, if I move it away from there. Do you have any fix? I included a blend file too if it helps.
https://drive.google.com/file/d/0B5IEzRaoX1snUmt3cTBKX0dsUlE/view?usp=sharing
An Error occurs when attempting to export model in MMD format from blender.
Traceback (most recent call last): File "D:\Program Files\Blender\2.78\scripts\addons\mmdtools\operators\fileio.py", line 203, in execute copy_textures=self.copy_textures, File "D:\Program Files\Blender\2.78\scripts\addons\mmd_tools\core\pmx\exporter.py", line 754, in export exporter.execute(filepath, **kwargs) File "D:\Program Files\Blender\2.78\scripts\addons\mmd_tools\core\pmx\exporter.py", line 734, in execute mesh_data.append(self._loadMeshData(i)) File "D:\Program Files\Blender\2.78\scripts\addons\mmd_tools\core\pmx\exporter.py", line 645, in __loadMeshData for i in meshObj.data.shape_keys.key_blocks: AttributeError: 'NoneType' object has no attribute 'key_blocks'
location: :-1
I tried importing models from here:
http://naruchan101.deviantart.com/art/MMDxRWBY-RWBY-Volume-1-Pack-DL-491669276
using the latest version of blender.
I don't seem to get any errors but only the points are imported, whereas the flat faces do not appear.
Are the models just bad or is there something I'm doing wrong?
Couldn't find any support email/forum so I hope using issues is ok for this question?
With PMXEditor I can load a pmx model and then translate/set English bone/material/... names along with the Japanese. When the model is imported into blender however only the Japanese names show up. A work-around is to copy all the English names in PMXEditor and apply them to the Japanese names however this breaks importing VMD files in the MMD app as the correct bone names no longer exist and is extra work when someone provides an MMD with both En/Jp names already setup.
How practical would it be to have mmd_tools optionally create blender nodes using the English names during import instead of Japanese (I think it stores both Japanese and English names during read already?) so that blender displays English names.
I get an error 'invalid weight type 63' etc when reading pmx models with different vertex and bone index size;
the problem can be solved by changing all "readVertexIndex()" to "readBoneIndex()" inside BoneWeight.load() (line 294 - 319), not sure if this is an official fix though.
I appreciate this great work.Imported models work fine when I adjusted imported mmd motion but when I moved imported models, they distorts.
I can correctly move when I import a model with "import only non dynamics rigid bodies" option checked, but when you unchecked it or when you apply some costraint(like dumped track) to bones, it distorts.
Does anyone know how I can solve the problem?
Thanks.
When the frame margin is not equal to zero, the VMD importer inserts an extra keyframe on frame=1, but the interpolation data import doesn't take it into account so the interpolation data will be set to incorrect frames.
The following patch should fix this:
diff --git a/mmd_tools/import_vmd.py b/mmd_tools/import_vmd.py
index a75efce..66956b3 100644
--- a/mmd_tools/import_vmd.py
+++ b/mmd_tools/import_vmd.py
@@ -143,6 +143,8 @@ class VMDImporter:
idx = 3
frames = list(fcurve.keyframe_points)
frames.sort(key=lambda kp:kp.co.x)
+ if self.__frame_margin > 1:
+ del frames[0]
for i in range(1, len(keyFrames)):
self.__setInterpolation(keyFrames[i].interp[idx:16:4], frames[i - 1], frames[i])
When trying to import a model:
File "C:\Program Files\Blender Foundation\Blender\2.74\scripts\addons\mmd_tools\core\pmx\importer.py", line 195, in __sortPoseBonesByBoneIndex
r.append(pose_bones[i])
KeyError: 'bpy_prop_collection[key]: key "右瞳" not found'
Full log here: https://gist.github.com/darkf/eec0c9c2816941e0a129
Some vmd files have a broken multibyte string which ends with the first byte of a sjis character.
Such files cause UnicodeDecodeError so the import fails.
For example, I got the following traceback when importing "こっち向いてBabyキオゴスミク.vmd":
Traceback (most recent call last):
File "/home/irie/.config/blender/2.65/scripts/addons_extern/mmd_tools/__init__.py", line 79, in execute
importer = import_vmd.VMDImporter(filepath=self.filepath, scale=self.scale)
File "/home/irie/.config/blender/2.65/scripts/addons_extern/mmd_tools/import_vmd.py", line 17, in __init__
self.__vmdFile.load(filepath=filepath)
File "/home/irie/.config/blender/2.65/scripts/addons_extern/mmd_tools/vmd.py", line 165, in load
self.header.load(fin)
File "/home/irie/.config/blender/2.65/scripts/addons_extern/mmd_tools/vmd.py", line 24, in load
self.model_name = _toShiftJisString(struct.unpack('<20s', fin.read(20))[0])
File "/home/irie/.config/blender/2.65/scripts/addons_extern/mmd_tools/vmd.py", line 14, in _toShiftJisString
return byteString.decode("shift_jis")
UnicodeDecodeError: 'shift_jis' codec can't decode byte 0x88 in position 18: incomplete multibyte sequence
Thank you for this great tool. Let me report one issue I encountered.
Recently I installed mmd_tool commit f5591f3 (head of master as of 11/14/2015) to vanilla blender 2.76 and imported Tda式初音ミク・アペンド_Ver1.00.pmx. Then I realized its eyes moves unexpectedly when I change the angle of its head. But it works as expected with version 0.4.5 (stable).
I checked commit by commit and I found this issue doesn't happen with commit 58bd563(MMDモデル非選択にエラーが出力される不具合を修正) but happens from 7e3aa34(回転/移動付与のConstraint生成処理をpmxインポート処理から分離).
As far as I checked, additional rotation constraints related function seems to be called as expected at the end of import process. But I couldn't identify the exact reason why I'm seeing this. Thanks in advance for your support!
I am having a problem converting bvh to vmd. Can someone make a video of them converting bvh to vmd so i can follow the steps a bit more easier?
Since r53161, Blender disallows access to the context while addons import and register, so loading mmd_tools addon throws an error as follows and it's not usable:
Exception in module register(): '/home/irie/.config/blender/2.65/scripts/addons_extern/mmd_tools/__init__.py'
Traceback (most recent call last):
File "/usr/share/blender/2.65/scripts/modules/addon_utils.py", line 290, in enable
mod.register()
File "/home/irie/.config/blender/2.65/scripts/addons_extern/mmd_tools/__init__.py", line 144, in register
cycles_converter.create_MMDBasicShader()
File "/home/irie/.config/blender/2.65/scripts/addons_extern/mmd_tools/cycles_converter.py", line 5, in create_MMDBasicShader
bpy.context.scene.render.engine = 'CYCLES'
AttributeError: '_RestrictedContext' object has no attribute 'scene'
See the following for detail:
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=53161
http://projects.blender.org/tracker/?func=detail&atid=498&aid=33618&group_id=9
http://lists.blender.org/pipermail/bf-python/2012-December/005987.html
UI labels in the operator options panel of the importers are downcased, not capitalized.
For example, "rename bones" should be "Rename Bones".
Could you make a converter bvh to vmd?
My Blender is v2.78 on Windows 10 (as well as on Windows 7 until a few months ago). I've been working on my own model for quite some time and almost finished, this plugin has been a huge help! But once in awhile I notice a very annoying issue where, for some reason, I'm prevented from making changes and/or adding text into the top slot of where the Japanese name would go, as seen here:
When typing anything new, it automatically undoes it when clicking out or pushing enter, although it lets you delete text but that's it. The thing is, by default its completely fine and I am able to add whatever I want, but this issue only happens randomly whenever it feels like it. Even more bizarre is that once this happens then it stays that way unless I reload a previous save. This has happened about 3 or 4 times now where I have had to reload old saves to make it stop doing this and thankfully it hasn't caused any loss of progress. Reloading the plugin doesn't do anything either, it must be with a new save or if I create a brand new model listing (thus losing morph data which is a big no no).
I like to have all my model's settings prepared ahead of time before exporting as this means less I have to edit/change afterward. While it is a minor issue, its still annoying enough to piss me off and since this has been multiple times I feel I should mention it here I suppose!
I want to add mmd extension on other engines,i need to know the file farmat of mmd.
For example, the vertex storage arrangement in the PMX model, bone binding relationship, expression and expression drive, bone animation in vmd, and the arrangement of key frames of expression animation.
Now I come across a .pmx format model, I can open it with MikuMIkuDance, but not with the PMXEditor.exe tool. When I parse this .pmx file, data out of bounds occurs at the extended Morph location, I don’t know if I parse The problem with the algorithm is also the problem with the model itself.
When I Try to Import The zip into blender... it say it imported into blender even Though it didn't...
Since foreign users cannot read Japanese documents, they very often ask me how to use mmd_tools. So I think mmd_tools needs English version of README.md.
README.md file says:
モーションデータのアサインは"mmd_tools"でインポートしたモデルのみ可能です。
But actually that can be done if the imported model has the same bone structure and names with MMD models. I'm indeed using the vmd importer for 3D models which I made only with Blender.
So, the above sentence should be modified like this:
モーションデータのアサインは"mmd_tools"でインポートしたモデルでなくても可能ですが、ボーン構造及びボーン名がMMDモデルと一致している必要があります。特に他のpmd/pmxインポーターを用いる場合は、ボーン名を変換しないオプションを有効にするなどしてインポートしてください。
I think, for such models not using mmd_tools' pmd/pmx importer, "Rename Bones" button should be added to the "MMD Tools" panel in the tool shelf. Descrition of this button in README is as follows:
Rename Bones
ボーンの名前をblenderに適した名前にリネームします(右腕→腕.Lなど)。元のボーン名は個々のボーンのカスタムプロパティ(mmd_bone_name_j)に保存され、モーションのアサイン時に利用されます。
While using the addon on 2.78, I tried importing a model made by a specific person and it said the file type was invalid. I have tried importing models made by the same person earlier and they imported just fine. I have no idea what the problem is.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.