FlailingFog / KK-Blender-Porter-Pack

Plugin pack for exporting Koikatsu characters to Blender.
Other
373 stars 30 forks source link

"prep for export" only available for the KKBP armature? #628

Open AnalogKnight opened 2 weeks ago

AnalogKnight commented 2 weeks ago

Hi there, I noticed that after 7.1.0 prep for export only works on KKBP armature. Previously this function could be used when importing via the other three armatures. But I noticed that “exportprep.py” is almost unchanged, and when I remove the condition required by 'row.Enabledd' prep for export still works fine and simplifies the skeleton. So I'm not sure what the purpose of adding this restriction is?

FlailingFog commented 2 weeks ago

The reason I added the restriction was because that button was only intended to be used with the KKBP armature (I didn't want to support the other armatures). I guess you're right though it looks like it simplifies the Koikatsu and PMX armatures, so I'll add those to the enabled list. It doesn't work for the rigify armature though, so I'll keep that one disabled

AnalogKnight commented 1 week ago

The reason I added the restriction was because that button was only intended to be used with the KKBP armature (I didn't want to support the other armatures). I guess you're right though it looks like it simplifies the Koikatsu and PMX armatures, so I'll add those to the enabled list. It doesn't work for the rigify armature though, so I'll keep that one disabled

@FlailingFog Thank you for your response. Yes, I think I misremembered, I haven't tried Rigify yet.

A little off topic, the reason I haven't used KKBP armature is because it and Rigify tweak bones like knees and elbows to make IK work. This causes these bones to be oriented differently than the other bones on the limb they are on. For the most part this doesn't cause a problem, but after exporting to some software this can make IK not work. For example, when animating in Unreal Engine, its IK requires that all bones on the limb face the same direction. I'll try to delve a little deeper into how to fix this myself, but I also wanted to share this idea with you, so if you're interested and know how to do it that would be great.

FlailingFog commented 6 days ago

I see, I've never tried exporting to Unreal so that's interesting. I think the only time the bones are bent in the KKBP armature is during this function. If you comment out line 676 and 684, or just revert that change during prep for export I believe that would do it. I'm not sure about what modifications the rigify armature does. Also, if that's the only change needed to make the KKBP armature work in Unreal, I can add a menu entry for the prep button like I've got for Unity

AnalogKnight commented 5 days ago

Yes, I noticed that these code makes changes to the skeleton. When I commented it out though, IK was broken. Unfortunately I don't know enough about Blender to know how to solve that. Ands yes, I believe this is the only change needed to make KKBP work in Unreal. BTW I have actually done some work on it, I tried to add a menu entry to modify the bone hierarchy in prep menu to make it match the Epic Skeleton. so far it's doing fine, so if you don't mind I'll create a Pull Request for that.

FlailingFog commented 5 days ago

That would be cool!

FlailingFog commented 5 days ago

@AnalogKnight Hey, actually I think I have a way to make the IKs work in blender without modifying the bone positions. Could you try the latest commit?

AnalogKnight commented 4 days ago

Thanks for the update. Unfortunately, I don't think that's the problem. Using the knee as an example, if I'm not mistaken, these two lines position the knee's tail to the height of the foot: https://github.com/FlailingFog/KK-Blender-Porter-Pack/blob/c601fbc7e683e521f0f315ce696f2480cf260cb0/importing/modifyarmature.py#L689-L690 The result of this is that the head of the knee bone faces up and the tail faces down. And the two bones leg and cf_j_leg03 (which I think should be the foot bones) are oriented in the opposite direction, with their heads facing down and tails facing up. This causes IK to not work in software like Unreal, which requires all bones on a limb to be oriented from the torso toward the end of the limb. If the knee bones were oriented the same way as both, I think that would solve the problem.