New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Keep original bone structure. #29
Comments
Looking back, I kind of forgot what is gained by using CATS to fix the model... I've always it used as part of the process because it nicely connects the main bones together but like you said, using it at all wrecks the bone structure. The plugin code expects the bone changes CATS makes, so currently you're forced to use CATS if you want to use the plugin. It'd probably be easy to copy their code to do just the bone connections, and if that were done then I think CATS could be dropped and the armature could be preserved to match the one in koikatsu. Though, now that this plugin advertises CATS export compatibility + Unity compatibility, I'd have to check what exactly CATS does so nothing is broken by not using it. (Also, I'm looking into using the fbx files now, even with the scaling issues. I was originally going to make the fbx files match the pmx files then send it through CATS, but maybe this could be a good opportunity to move away from CATS instead...) |
Conversion list. Source:
Converted:
A useful tool https://wtools.io/convert-list-to-json-array Both of the cf_j_foot_(L/R) bones need to be reparented to cf_j_leg03_(L/R) |
Thanks for this info! I took a slightly different route: https://github.com/FlailingFog/KK-Blender-Shader-Pack/blob/V5-merger/importing/finalizepmx.py
Then I imported the fbx animation, selected the pmx armature, then shift selected the fbx animation armature and ran this: https://github.com/FlailingFog/KK-Blender-Shader-Pack/blob/V5-merger/extras/importanimation.py
I forgot I make additional armature edits during the bonedrivers.py script, so that's another thing that could break this
It visually connects bones together like fingers and skirt bones. And turns out it's accessible through an ops command: bpy.ops.cats_manual.connect_bones() |
Here's V2 of my script. Now it should keep all accessory bones that are in use, and instead of directly deleting the bones, it selects them and then you manually use CATS to merge them to parents.
|
That could work!
I have no idea. I just assumed CATS renames the bones so they can be automatically detected in Unity. I haven't tried importing the model without the renamed bones to see what it does. I also think bone names like 'Hips' rather than 'cf_j_hips' are easier to identify
They're connected correctly on mine too, and it doesn't need to be done. I just think it makes for a slightly cleaner armature, even if it deviates from the KK armature structure (one center bone instead of multiple).
The ca_slot bones
Interesting! I didn't know that was possible. Though, I want a specific setup for use inside of blender and the animations would still need to be edited with that specific setup. I want a way to add IKs to the arms to use for non-premade animations and the only way I've found to do it is to connect the tail of the arm bone to the head of the hand bone. This reorients the bone, so the animations for those bones have to be reoriented as well. I guess I consider this another reason to not worry about changing the armature structure, since this setup would require code to get the animations to work anyway. Another thought: What if there were two configurations you could choose from?
|
That would be perfect, haha |
Okay, will do then |
So, made a script to batch retarget all Armature animations (using the Rokoko addon) in the
|
I don't see why it couldn't be added. I can put it in as a toggle. |
Most of this is in the latest commit, so you can try it if you want.
I haven't installed the rokoko plugin yet so I don't know if the toggle works Haven't put in the "survey" code for removing the useless pmx bones yet, right now it just removes the k_f_ bones and the cf_hit bones that the pmx armature comes with. There's a dictionary with the fbx bone names in finalizepmx.py so I think I'm going to use that instead of importing the fbx armature to generate the bone list. If you load another animation in it'll overwrite the current one You can switch between the two armature types, but going from modified to stock will just mute the IK/joint drivers and stow the extra (modified) bones created during bonedrivers.py under the pv_root_bone. Do those extra bones matter when retargeting animations with other software (rokoko/unity/unreal)? If it doesn't, then I'll probably keep that behaviour because it makes it easier to switch |
GME's fbx?
Hmm, I'm not sure using KKBP to import animations is really that useful (For me anyway, since I need to convert many animations) What do you think? |
The ripped fbx animations from \Koikatsu\abdata\action\animator\
That's fair, and if you uncheck the modify armature toggle then it'll preserve everything. |
I think the way it works now is good. If you had included the "survey" code to remove unused bones, the naming scheme of separate characters (after export) would be different. As it is now (I think, needs testing) every character that goes through KKBP will have the same bone structure, and that, I feel, is a good thing, because it makes creating multiple characters in Unity/UE4 easier, e.g. no need to code for separate skeletons. |
Okay I'll leave it as is then. If needed later it can be added as a toggle |
If you want, I could make the new KKBP_Exporter plugin not add these extra bones and change bone names. |
All right, I made changes to the plugin, now it exports the rig 1 to 1 (no extra physics/ik/renamed bones) |
Bug fix |
After more testing, i found that this is incorrect. So maybe it would be good to either use the survey code to delete unused bones Edit: it might still cause issues if we remove unused bones during finalize, I think having a button in Extras is better. |
Having the original bone structure would help, I'd just have to redo some parts during the finalize step. |
@FlailingFog So would it be possible to keep them? |
There is also an issue when NOT using Modified armature to Finalize PMX:
Changing that line to this solves the issue
But reintroduces the issue to bonedrivers.py Line 852 Also changing that line to this solves the issue
I'm not sure why this happens though. |
Thanks for finding these. The hit/kf bones are on armature layers 12 and 13 now |
It shouldn't do that anymore. And semi-related to this, sometimes the original pmx exporter creates a model with broken tongue and lower teeth shapekeys (kuti_sita and kuti_ha). This bug carried over into your new version as well. It only happens on certain cards (like that megumin card from a while back) and I haven't noticed a trend for what causes it. Since you have the source, do you happen to know what could cause it to break only those shapekeys like that? |
Thanks!
Sure! If it works, please let me know and ill add it to the project. |
Are the shapekey names supposed to change with this too? I'm still seeing the original ones (and seeing the same behavior too) |
Ah, pity, I'll investigate this issue more. |
Yeah it happens on that one. I've tracked it down to a specific accessory on the card that's causing the tongue shapekeys to become corrupted called "Tiny ahoge no movement". I also had one more question for armature stuff, do you care if the accessory bone names are renamed in the original armature structure? Some characters have duplicate accessory bone names and that's causing the following issue: |
Cool, thank you, I'll see if I can fix it in the dll plugin
Yeah, I think as long as the base skeleton is unchanged the acc bones can be renamed. |
I've been trying to work the duplicate vertex group issue I noted above, and after looking into it a little further I think the KK pmx exporter is the one causing the vertex groups to merge, not Blender's pmx importer. When I take the pmx file into another program (PMXEditor) it's showing that the vertex groups are already merged. I feel like this would resolve itself if the KKBP exporter didn't merge all the objects into one like it usually does, and instead kept everything in separate objects, similar to how Grey's mesh exporter does it. Is this an easy thing to do? I'm guessing the pmx exporter merges the meshes at some point, so would it be as simple as deleting that chunk of code? I'll continue trying to get it to work with the code I have now, but so far the trick I'm using isn't completely cutting it for dense groups of accessories (like when people make hair completely out of accessories). |
Ok, yeah, I think I found a bug in the plugin, I'll try and fix it. |
PR #61 |
V5 is great, thanks! |
As you may have noticed, the current workflow (PMX and CATS) completely nukes the original bone structure, making retargeting animations taken from Koikatsu very time consuming.
One workflow I used was to, use the PMX model, not fix the bones through CATS and manually delete all the extra bones (while comparing the bone structure to GME's fbx export)
This works well but takes an awfully long time.
Since GMEs armature has issues with scale, we also can't use the exported fbx.
Any ideas?
Thanks.
The text was updated successfully, but these errors were encountered: