powroupi / blender_mmd_tools

mmd_tools is a blender addon for importing Models and Motions of MikuMikuDance.
GNU General Public License v3.0
1.79k stars 277 forks source link

adding english bone names & morph names to a model #61

Closed Hogarth-MMD closed 6 years ago

Hogarth-MMD commented 7 years ago

Many MMD models have no English morph names and no English bone names. Is there yet any feature of mmd_tools or any other script which can automatically mass add English bone names and English morph names to a model? Pymeshio has a file called englishmap.py for translations. mmd_tools has a translations.py file for translating bone names. Is there any reason why these translations are an impossibility with mmd_tools?

Hogarth-MMD commented 7 years ago

https://gist.github.com/osima/711089

I found this python script to convert from Hiragana to Romaji. I don't know how many MMD users would want to have Latin alphabet transliterations of Japanese words. I would like to have that, though, to help me to be able to read the Japanese names of bones and morphs.

Hogarth-MMD commented 7 years ago
import bpy

bpy.ops.object.mode_set(mode='OBJECT')

# If the armature is hidden you get a context is incorrect error, 
# so we unhide all armatures
for o in bpy.context.scene.objects:
    if o.type == 'ARMATURE':
        o.hide = False

for o in bpy.context.scene.objects:
    if o.type == 'EMPTY':
        if len(o.mmd_root.vertex_morphs) > 0:
            for vm in o.mmd_root.vertex_morphs:
                for s2 in skinMap:
                    if vm.name == s2[1]:
                        vm.name_e = s2[0]

for o in bpy.context.scene.objects:
    if o.type == 'ARMATURE':
        bpy.context.scene.objects.active = o
        bpy.ops.object.mode_set(mode='POSE')
        for b in bpy.context.active_object.pose.bones:
            for b2 in boneMap:
                if b.mmd_bone.name_j == b2[1]:
                    b.mmd_bone.name_e = b2[0]
        bpy.ops.object.mode_set(mode='OBJECT')
Hogarth-MMD commented 7 years ago

With the above code, I successfully mass added English bone names and English morph names to an MMD model (importing and exporting the model with mmd_tools). I copied boneMap and skinMap from pymeshio's englishmap.py .

Hogarth-MMD commented 7 years ago

Link to mmd_tools translations.py : https://github.com/powroupi/blender_mmd_tools/blob/dev_test/mmd_tools/translations.py

LInk to pymeshio's englishmap.py: https://github.com/ousttrue/pymeshio/blob/master/pymeshio/englishmap.py

Hogarth-MMD commented 7 years ago

7 more bones words from Yakumo Ran Arlvit style: ['内', '角', 'ふさ', '耳 , 'アクセサリ', '掛', '接続']

['inside', 'corner', 'tusa', 'ear,' accessory ',' hanging ',' connection ']

What is tusa? (translation from Google translate)

Hogarth-MMD commented 7 years ago

From Wikipedia: Traditionally, Japanese is written in a format called tategaki (縦書き?), which is inspired by the traditional Chinese system. In this format, the characters are written in columns going from top to bottom, with columns ordered from right to left. After reaching the bottom of each column, the reader continues at the top of the column to the left of the current one.

Modern Japanese also uses another writing format, called yokogaki (横書き?). This writing format is horizontal and reads from left to right, as in English.

A book printed in tategaki opens with the spine of the book to the right, while a book printed in yokogaki opens with the spine to the left.

Hogarth-MMD commented 7 years ago

Oh my God, how does a Japanese person learn English? You need to read English cross-eyed and standing on your head or something like that..

Hogarth-MMD commented 7 years ago

Other than Google translate, what other translation engine is a better alternative? The list of morphs in englishmap.py is far from complete. Probably I could make a more complete list of Japanese morph names, But how do I translate them? @ptrthomas how did you do the translation of the Japanese bones words? And what does tusa ('ふさ') mean? Google translate did not translate this word.

ptrthomas commented 7 years ago

@Hogarth-MMD bragging time :P I self-studied and actually cleared the Japanese N4 proficiency test mostly driven by my interest in vocaloid, mmd and anime. I recommend this website called wanikani.com, I think it would be a good fit for you. I hear duolingo has introduced Japanese, but don't know how good it is. You already know the craziness of the language, so you can expect how difficult and time-consuminig it will be. Sadly, I'm not practicing using Japanese now, and Google translate had a large role to play in me implementing translations.py

ふさ is actually "fusa" and Google says it means fuzzy. If you send me the link to the model I can try figure more from context. But I'm sure others on this list who are proper Japanese ( @nagadomi ?) can provide more details.

I can volunteer to help, how about you create a google spread-sheet and I can take a first stab, and can help with transliteration as well.

nagadomi commented 7 years ago

Maybe ふさ is abbreviation for ふさふさ(fluffy or bushy (tail)), if that bone is related to her tail or ear. or 房?(cluster/bunch) Also 角 has another meaning, a horn.

If someone provide japanese name list, I can translate it. However, I think that some bone/morph/material name can not be translated without confirming the model. Also, many bone/material names are specific to models, so we can not translate everything, it is not 100% reliable.

Hogarth-MMD commented 7 years ago
[
('怒り目', 'Anger'),
 ('困り目', 'Trouble'),
 ('下上', 'Bottom top'),
 ('憂い目', 'Sorrowful eye'),
 ('左目縮小', 'Left eye reduction'),
 ('右目縮小', 'Right eye reduction'),
 ('二重狭く', 'Double narrow'),
 ('怒り2', 'Anger 2'),
 ('困る2', 'I am in trouble 2'),
 ('右眉上', 'On the right eyebrow'),
 ('左眉上', 'On the left eyebrow'),
 ('ハの字', 'Ha character'),
 ('にこ3', 'Niko 3'),
 ('目細める', 'To narrow down'),
 ('怒る', 'Get angry'),
 ('あ3', 'Ah'),
 ('笑顔', 'A smile'),
 ('ぷく', 'To wipe'),
 ('にこ2', 'Niko 2'),
 ('口上', 'Mouth'),
 ('下唇を噛む', 'Bite the lower lip'),
 ('アヒル口', 'Duck mouth'),
 ('すぼめる', 'To shrink'),
 ('べ', 'What'),
 ('べ2', '2'),
 ('目笑い', 'Eye laughter'),
 ('目2', 'Eye 2'),
 ('二重の幅', 'Double width'),
 ('たれ目', 'Sagami'),
 ('涙袋', 'Tear bag'),
 ('目大', 'An eye'),
 ('あ2', 'Ah'),
 ('い2', '2'),
 ('う2', 'Mu'),
 ('にやり2', 'Girls 2'),
 ('にやり3', 'Girls 3'),
 ('うへ', 'Sea urchin'),
 ('イー', 'E'),
 ('ベー', 'Bay'),
 ('下唇噛む', 'Lower lip bites'),
 ('はぁ!?', 'Huh'),
 ('口角拡', 'Mouth corner expansion'),
 ('唇小', 'Small lip'),
 ('唇厚', 'Lip thickness'),
 ('唇薄', 'Lip thin'),
 ('目上', 'superior'),
 ('二重幅', 'Double width'),
 ('目小', 'Small eyes'),
 ('まつげ伸', 'Eyelash extension'),
 ('眉細', 'Graininess'),
 ('眉寄せる', 'To draw eyebrows'),
 ('眉ヘ', 'Eyebrow'),
 ('口角下', 'Corner of the mouth'),
 ('口角上', 'Above the mouth corners'),
 ('見開く', 'Spread apart'),
 ('い3', 'Three'),
 ('お2', '2'),
 ('えー2', 'Eh 2'),
 ('じと目2', 'Ji and Eye 2'),
 ('細める', 'Narrow down'),
 ('怒り目2', 'Angry 2'),
 ('><', '> <'),
 ('眉間にしわ', 'Wrinkles between the eyebrows'),
 ('眉尻下', 'Below the bottom of the eyebrows'),
 ('左開き', 'Left opening'),
 ('右開き', 'Open right'),
 ('ウィンク2', 'Wink 2'),
 ('ウィンク2右', 'Wink 2 right'),
 ('M', 'M'),
 ('イヒヒ', 'Hee hee'),
 ('てへっ', 'Be warned'),
 ('上歯上', 'Upper teeth'),
 ('上歯下', 'Upper tooth below'),
 ('下歯上', 'On the lower teeth'),
 ('下歯下', 'Lower teeth beneath'),
 ('歯なし', 'No tooth'),
 ('じと目左', 'Ji and the eye left'),
 ('じと目右', 'Ji and eyes right'),
 ('なぬ!左', 'None! left'),
 ('なぬ!右', 'None! right'),
 ('マジデ', 'Majde'),
 ('瞳丸', 'Hitomi'),
 ('瞳色', 'Eye color'),
 ('○', '○'),
 ('○2', '○ 2'),
 ('●', '●'),
 ('●2', '● 2'),
 ('◎', '◎'),
 ('涙左', 'Tears left'),
 ('涙左上', 'Upper left of tears'),
 ('涙左下', 'Tear drop down'),
 ('涙右', 'Right of tears'),
 ('涙右上', 'Upper right of tears'),
 ('涙右下', 'Tear drop down right'),
 ('涙左幅', 'Left tears width'),
 ('涙右幅', 'Tear Right Width'),
 ('角度上', 'On the angle'),
 ('角度下', 'Under the angle'),
 ('シエスタ', 'Siesta'),
 ('真面目左', 'Serious left'),
 ('真面目右', 'Serious right'),
 ('困る左', 'The embarrassing left'),
 ('困る右', 'Troubled Right'),
 ('にこり左', 'Few left'),
 ('にこり右', 'Lumpy right'),
 ('怒り左', 'Angry left'),
 ('怒り右', 'Anger right'),
 ('上左', 'Upper left'),
 ('上右', 'Upper right'),
 ('下左', 'Bottom left'),
 ('下右', 'Lower right'),
 ('太', 'Thick'),
 ('太左', 'Thick left'),
 ('太右', 'Right up right'),
 ('前', 'Before'),
 ('あ+', 'Ah'),
 ('むっ', 'Stuffy'),
 ('ぷぅ', 'Puu'),
 ('てへっ2', 'Heel 2'),
 ('歯奥', 'Tooth'),
 ('はぅ左', 'Ha left'),
 ('はぅ右', 'Hu Right'),
 ('不満', 'Dissatisfied'),
 ('悪だくみ', 'Evil mechanism'),
 ('○涙', '○ Tears'),
 ('◎2', '◎ 2'),
 ('X', 'X'),
 ('ん', 'Hmm'),
 ('笑', 'Lol'),
 ('なごみ2', 'Nagomi 2'),
 ('寄せる', 'To bring'),
 ('ふーん', 'Hmm.'),
 ('G上歯開', 'G upper tooth opening'),
 ('G下歯開', 'G lower tooth opening'),
 ('舌', 'tongue'),
 ('口幅', 'Mouth width'),
 ('眼力アップ', 'Increase your eye strength'),
 ('瞳孔小', 'Small pupil'),
 ('瞳幅', 'Pupil width'),
 ('つり目', 'A fist'),
 ('眉尻下げ左', 'Bottom eye down left'),
 ('眉尻下げ右', 'Bottom eye down right')
]
Hogarth-MMD commented 7 years ago

This list of tuples has 142 new morphs for adding of English morph names to MMD models. The translations are courtesy of Google translate. But Google translate does not make perfect translations. So the next task is to proofread and correct these translations. These morphs are all facial expression morphs. I have not yet tried to collect any "other" morphs. And soon I hope that mmd_tools will have a beautiful new ability to mass add English morph names and English bone names to MMD models. :-)

Hogarth-MMD commented 7 years ago

"Why have the smile morphs disappeared?" I was saying to myself. Niko = smile. The Niko video web site is named after the Japanese word for smile. Apparently Google translate thinks that this Japanese word is referring to the Niko video web site and not to the smile facial expression. :-)

Hogarth-MMD commented 7 years ago

I cannot do this proofreading, because I don't know Japanese. I have 2 volunteers. Should I pretend that I am the boss and say @ptrthomas the first 71 morphs and @nagadomi the last 71 morphs? Do these 2 volunteers wish to discuss this? Or should I just relax and let whoever finishes this task first to post his results? :-)

ptrthomas commented 7 years ago

@Hogarth-MMD give me a day and I plan to create a google spreadsheet so that anyone can collaborate on MMD translations and keep adding more as they are found.

Hogarth-MMD commented 7 years ago

Okay, @ptrthomas , this is a completely new idea for me (google spreadsheet), so I'll wait and see how that works and what that is.

Hogarth-MMD commented 7 years ago

For doing this kind of translation work, it would be helpful to have a software translation dictionary which can give you dictionary definitions and translations of many words at the same time. I have never seen this kind of software dictionary, though. With every dictionary that I have seen, you can only look up one word at a time.

Hogarth-MMD commented 7 years ago

Apparently there are online spreadsheets, other than Google spreadsheet: https://en.wikipedia.org/wiki/Online_spreadsheet

What about just posting the morph name translations on Github, maybe as a .csv file? Collaborative editing can happen by means of pull requests. What do you think would be the pros and cons of using Github, instead of using an online spreadsheet?

ptrthomas commented 7 years ago

@Hogarth-MMD yeah, sorry I didn't get time to get to this, hopefully tomorrow. The main advantage of the online spreadsheet is that a non-programmer can review / edit it.

Hogarth-MMD commented 7 years ago

@ptrthomas Okay, but a non-programmer can also edit text or csv. Please tell us if you can think of any other pros and cons, or if you have any ideas of how we might do it on Github with maximum time efficiency and minimum conflict. I am trying to think of how the translation list should be formatted, so that different translations by different people are preserved separately and can be compared to each other. We don't want one person's translation to arbitrarily overwrite another person's translation.

Hogarth-MMD commented 7 years ago

So, I could make a Github repository, which has 1 file for each person who is participating, for example, files named nagadomi.csv, , ptrthomas.csv . In that case, it is extremely simple to avoid one person's translation overwriting another person's translation. Then the unanswered question is: What software can open several files in a beautifully convenient, automated way to show side-by-side comparison of translations?

Hogarth-MMD commented 7 years ago

Git does file comparisons. Git is designed to compare a file to a previous version of that file. Is there maybe some technique to make Git do what we want.? We also need a feature to avoid duplicates, in case someone might try to add a duplicate morph name.

stefnotch commented 7 years ago

Well, if you are going to use GitHub for that, do note that a non-programmer won't really be able to help you. Reasons: a) They don't have a GitHub account and probably won't bother making one b) They have no clue how to send a pull/push request c) All of the other issues that you just listed d) GitHub is kind of confusing

Hogarth-MMD commented 7 years ago

Wow, this is a problem for translation. Even if I have a Japanese to English dictionary, I won't know where a Japanese word begins or ends:

Wikipedia: "In English, spaces are used for interword separation as well as separation between punctuation and words. In normal Japanese writing, no spaces are left between words, except if the writing is exclusively in hiragana or katakana (or with little or no kanji), in which case spaces may be required to avoid confusion."

Hogarth-MMD commented 7 years ago

I found this joke on a learning Japanese web site: 😄

"Finally, a major difference between Japanese and English is that Japanese has no stress. I don't mean there's no stress when learning Japanese. There's awful stress that will make you insane sometimes, especially when you encounter keigo (敬語 – honorific Japanese). But the words themselves have no stress. Try to pronounce each with flat intonation."

ptrthomas commented 7 years ago

All right people - this is what I got:

https://docs.google.com/spreadsheets/d/1RsKmQGo8JKezrEZ3wQPPJlA6SspzFOkmTuj6lSxAzxo/edit?usp=sharing

What's interesting is I was able to write a custom formula that uses the same translation algorithm in the mmd_tools blender/python code. If you are interested, you can go to Tools --> Script Editor to see it.

So the first sheet (main) is the equivalent of translations.py. Note that the translation routine will try to translate word pieces if it cannot get an exact match on the whole word. And therefore - just keep in mind that the order of stuff in this list matters.

The second sheet is "smart" so you can "test" the translation routine. To demonstrate, I took the list @Hogarth-MMD posted above and pasted it in, (note the formula in the second column). You can see that some of the words are getting translated. Hopefully we just need to evolve the "master set" of Japanese words (and word components) in the first sheet that can translate most if not all possible MMD words. I personally think this is better than trying to brute-force an exhaustive list.

Hope this makes sense !

Hogarth-MMD commented 7 years ago

Thank you for your time and efforts @ptrthomas . Is it possible to download this spreadsheet to work on it locally and how to do that?

Hogarth-MMD commented 7 years ago

These are not useless, but, like Google translate, they are inadequate for our purpose:

Excite translator for English and Japanese: http://www.excite.co.jp/world/english_japanese/

Kanji converter (includes transliteration to romaji/English) http://nihongo.j-talk.com/

ptrthomas commented 7 years ago

@Hogarth-MMD I would recommend you work directly on the spreadsheet, you will get used to it, really, I swear. You can certainly download it (look at the File menu) but I don't know what happens to the formulas etc.

Hey and who was it who collaborated with me a few hours earlier to do most of the romaji transliterations ? That was one of the most awesome experiences ever, to see someone help in real time, and it was done in a few minutes !! Amazing. Thank you, whoever you are :)

BTW there is a chat feature in google spreadsheets, I was trying to send a message there, do look out for that next time.

Hogarth-MMD commented 7 years ago

"Hopefully we just need to evolve the "master set" of Japanese words (and word components) in the first sheet that can translate most if not all possible MMD words. I personally think this is better than trying to brute-force an exhaustive list."

@ptrthomas I am watching with great interest to see how this is done. You have an eagerly interested audience in what you are doing. At this time I am feeling pretty helpless with the weird idiosyncrasies of the Japanese language. I don't know who did the romaji transliterations, but it wasn't me.

Hogarth-MMD commented 7 years ago

Subdividing Japanese text into individual components of meaning is called:

Japanese tokenization or morphological analysis

Apparently specialized computer software is needed to do this. Then each component of meaning can be translated to English separately.

Hogarth-MMD commented 7 years ago

I thought of 2 ideas which I thought were fairly clever. I thought that maybe I could get a better translation either

a) by adding 1 or more spaces into the Japanese word or b) adding the Japanese words for facial expression before or after.

Here are the weird results I got:

Japanese word(s) ; Google translate translation ; Excite translator translation

にやり     to do it      With a broad grin.

に やり    to do it      With a broad grin.

にや り    To a place    With a broad grin.

に や り   To a place    With a broad grin.

にやり2    Girls 2       With a broad grin, 2.

表情   Facial expressions

表情 にやり  Spear on a look   In an expression, doing

にやり 表情  Faced look        With a broad grin  Expression.
Hogarth-MMD commented 7 years ago

Is katakana ever used in MMD bone names or in MMD morph names? Or can we just completely ignore katakana, for purposes of translating MMD bone names and MMD morph names to English?

Hogarth-MMD commented 7 years ago

@ptrthomas or @nagadomi ,or whoever knows about this: Can you please recommend a good Japanese-to-English software dictionary which can be downloaded?

Hogarth-MMD commented 7 years ago

Here is a good online Japanese to English (and multilingual) dictionary: http://www.smartkanji.net/fixed/index.php?lang=en

And it doesn't limit you to one word at a time.

powroupi commented 7 years ago

(Just add some reference here) #41, #47 may be similar issues. :smiley:

Hogarth-MMD commented 7 years ago

How are you doing, @ptrthomas ? This issue is feeling lonely from the lack of recent comments from you, and I am feeling this also. @powroupi your first comment in this issue, hello to you. :smiley:

ptrthomas commented 7 years ago

hey :) I'll take a look this weekend. In the meantime I request everyone who needs translations to add their Japanese words (type them in) into the first column of the second sheet called "test".

Here is the link again: https://docs.google.com/spreadsheets/d/1RsKmQGo8JKezrEZ3wQPPJlA6SspzFOkmTuj6lSxAzxo/edit?usp=sharing

ptrthomas commented 7 years ago

I'll like to mention again that it should be very easy for anyone to contribute a translation. Go to the File --> Revision History menu to see the few rows (on the first sheet) that I added, and slowly this is how one can check if all the "test" words on the second sheet are getting translated, working from top to bottom.

Hogarth-MMD commented 7 years ago

Greetings @ptrthomas ! :smiley: Are you able to please answer this question for me? Is katakana ever used in MMD bone names or in MMD morph names? Or can we just completely ignore katakana, for purposes of translating MMD bone names and MMD morph names to English?

Hogarth-MMD commented 7 years ago

@ptrthomas Can you please post a direct download link to the Google spreadsheet? My computer has some problems with loading the Google spreadsheet in my web browser.

ptrthomas commented 7 years ago

@Hogarth-MMD try a different browser (e.g. Chrome if you haven't already). But anyway I'm attaching a PDF dump of the current state.

Yes, katakana is used in bone names. As a general rule, any non-native or "borrowed" word, most typically words of English origin are written in katakana. For e.g. センター (center, pronounced "senntaa") which is one of those main bones in the armature. I don't mind adding a column to identify which all words or characters are katakana in the sheet if you are interested, that would be simple to do.

mmd-translations.pdf

There is a feature in Google to publish a sheet as a plain HTML page, so see if this works for you:

https://docs.google.com/spreadsheets/d/1RsKmQGo8JKezrEZ3wQPPJlA6SspzFOkmTuj6lSxAzxo/pubhtml

nathanvasil commented 7 years ago

I've filled in a few blank spots, with the assistance of Google translate and a smattering of 20-year old high school Japanese.

You might have to be careful when using some of those words in compounds; they don't always mean the same thing as they would alone.

I notice there are a lot of commonly used words missing (like almost all of the vowel sounds). How are you organizing this? Do you want me to just paste additional characters in? Compounds or individual characters?

Some of these are sounds (presumably, を, wo) but they can also be used as prepositions/indicators of usage. For these small characters, I'm leaving the meaning empty and just providing the romaji, which should be sufficient to understand the sound.

ptrthomas commented 7 years ago

@nathanvasil awesome, I saw your romaji edits just now. yes please fill free to add in all the vowels

totally agree that some primitive translations would result - but IMO this is ok and the main intent is for english-speakers to be able to make sense of bones, morph names, and hopefully anything else (materials, non-standard bones) that can be translated.

the good thing is that if you strongly feel that a compound deserves a "proper" translation, just ensure it (longer word) appears "above" the (shorter) word / characters. that way, I think this translation table is pretty flexible. does that make sense ?

I'm planning a small script that will take the sheet and generate "translations.py" so we have a very clean approach for plugging this back into the code.

nathanvasil commented 7 years ago

Yeah, that all makes sense. I'll add a few things.

nathanvasil commented 7 years ago

Take a look at ウィンク , uinku, wink. Without the second entry, page 2 of spreadsheet isn't translating. 1st entry created by copy-pasting from PMXE. Do I need to be careful about my fonts?

ptrthomas commented 7 years ago

@nathanvasil I think you are doing the right thing, you need both versions, and both versions appear in the wild. there are other similar cases already in there, such as skirt, necktie, etc.

Hogarth-MMD commented 7 years ago

OMG, I can't believe what a ragtag bunch of amateur translators we are! What we lack in language expertise, we make up for with cleverness, determination and perseverance, and we will succeed! Go, team, go! :smiley:

ptrthomas commented 7 years ago

I think the translations are in good shape now. @Hogarth-MMD did this link work for you:

https://docs.google.com/spreadsheets/d/1RsKmQGo8JKezrEZ3wQPPJlA6SspzFOkmTuj6lSxAzxo/pubhtml

You can see your list translated if you click on "test" at the top. I have done a pass of the TDA default model as well.

I think we need to start adding material names.

nathanvasil commented 7 years ago

@ptrthomas If I can offer an idea, it seems like you might be able to more easily "grab" words in need of translation through the use of the plugin itself.

Once you start getting a lot of different words in there, it's going to be increasingly complex to make sure you avoid duplicates, and it'll be harder and harder to just eyeball a model file to see if there's anything new on there.

But if the plugin was in good shape, it seems to me that it wouldn't be too hard for it to keep a list of "exceptions" that it didn't know how to fully translate. By just loading a few models, you should be able to grab all of the most important words for automatic translation.

Extra note: although I added a few translations, note that these aren't necessarily unique, and you could potentially have a model full of unique identifiers converted into a model with duplicated identifiers. Not sure if that's a problem; it could probably be avoided without too much trouble just by arranging by English translation and replacing duplicates with synonyms.