I actually figured out the solution to this, so this isn't a personal issue I have now but a way the plugin could be expanded.
I'm not an experienced developed, or at 3D animations, I've never contributed to open source, but I figured this would help some people. I'm not doing a PR at this stage but I may in the future if I wasn't mistaken about some things here. This could help someone else do a PR though if they wanted, by all means.
Solution:
In VERY short to avoid reading below if you're just looking for a solution with the current plugin:
- Make sure your file is .fbx, not .FBX. This fixes the retarget.
- Rename all occurrences of "mixamo_com" in "mixamo_animation_retargeter.gd" with whatever animation name is under AnimationPlayer in your fbx file. This fixes the file not saving despite no error message.
- You have to make your own mapping to suit your source. Duplicate the existing one "mixamo_bone_map.tres" and change them to the ones you can find by inheriting scene on your fbx file -> Skeleton -> Look to the right. You'll notice pretty obviously your syntax for limbs will be something like "Head_L" rather than the default mapping of "mixamorig_Head". You also need to change the path referenced in "mixamo_animation_retargeter" do your new mapping resource you've just made.
Also delete this line subresources["nodes"]["PATH:Skeleton3D"]["retarget/remove_tracks/unmapped_bones"] = true
In order to see when your mappings are broken instead of having them temporarily delete your animations. (I'm unsure of any negative side effects to doing this)
The issue I had was trying to import some fbx files from a unity package I'd downloaded into godot. I figured it wouldn't work as this plugin was for mixamo, and I checked and it didn't, but looking more into the code I felt it should with a bit of tweaking.
First issue I encountered, if a file is named ".FBX" rather than ".fbx" as some people do, it won't work with the plugin and it won't tell you anything is wrong even. Renaming the file sorts it out. Fixing it would be in RetargetMixamoAnimation() I believe.
Second issue I encountered was no errors would occur, every print seemed to say "Import successful" etc. yet no file would be created. I'm still not sure what made that precisely happen, but the issue itself was the animation file in mixamo fbx files is called "mixamo_com". You can fix this issue by changing every reference to "mixamo_com" to whatever you find in the fbx file you're trying to import, by double clicking in the file inspector and then seeing what is under AnimationPlayer. In my case it happened to be "Unreal Take". This could be resolved by having somewhere to edit this string when importing, and utilizing that instead of the magic string "mixamo_com" that only handles 1 use case the plugin was initially designed for.
Third issue I encountered (which took some time to resolve due to the nature of the issue), was animations being seemingly deleted from the base .fbx files when 'Retarget Mixamo Animation/s' was used after the second issue was resolved. What's worse is that the ordinary manual import I could do successfully by just created a new bone map, reimporting, and then changing the reimport to an animation library, no longer worked either, the animation was gone from that too. It looked to be permanently deleting this part (though in the end, it wasn't truly).
The issue turned out to be with this line:
subresources["nodes"]["PATH:Skeleton3D"]["retarget/remove_tracks/unmapped_bones"] = true
Now I'm not sure of its purpose, but this line I think could be removed entirely from the plugin as it only caused me confusion and I haven't seen downsides to removing it yet, though I'm unsure what issues that might cause.
After removing this, the animations successfully came back when retargeting, though when playing them, my character had a stretched neck and was clearly broken. This finally clued me in to the actual issue, which is my mappings weren't correct to the bones.
I'd originally overlooked this issue as manually importing without providing ANY details for my mappings worked fine. I'm unsure if Godot when doing this from the inspector just figures it out? But when doing things manually, it seems you do need to provide what your file's mappings really are. I had seen this plugin did provide its own mapping file for mixamo, but like I said, I didn't see how this data was needed if I could do what I wanted without providing any, but that was wrong. I also overlooked this issue as the issue of missing animations seemed far more important to resolve, as the mapping issue itself was obscured by the code removing animations if they weren't mapped properly.
In short, the third issue can be resolved by duplicating the existing mapping file, and then changing the mappings to reflect those found if you create an inherited scene with your fbx file then click on Skeleton and look to the right side. Compare with a mixamo file to help, but you'll notice pretty obviously your syntax for limbs will be something like "Head_L" rather than the default mapping of "mixamorig_Head". So you need to replace all of these references with the right ones. Obviously this part is prone to error so be cautious, but I just asked chatgpt to replace the mappings once I figured out the syntax rule, it worked, but do it manually or double check to be sure. I believe the worst that will happen is your mapping will be broken and it'll look wonky, then you can just look over your work again if its wrong.
After this, you need to provide the new path for this mapping under _process_fbx_file(). If this were changed to a variable somewhere that could be changed outside of the code, this would also help so you could switch between mappings, but this isn't a PR so I don't know.
And I also heavily recommend just deleting/commenting this line to avoid misunderstandings and temporary clears to your animations. It becomes very obvious if you've mapped something wrong if your limbs look wonky.
subresources["nodes"]["PATH:Skeleton3D"]["retarget/remove_tracks/unmapped_bones"] = true
I have in fact, only tested this on 1 other source for fbx files, and these things can be finnicky but given how simple it ended up being, I don't see why this couldn't apply to more than just this source, which would open up this plugin to be "Godot Animation Retargeter" rather than just "Godot Mixamo Animation Retargeter", whilst continuing to use almost all of the existing code. As far as I'm aware, this would be a great addition to the community since I don't believe any such plugin currently exists, and 90%+ of the info about importing animations is FAR more tedious and prone to error than it has to be. Not to mention, if you're making a 3D game beyond a tech demo, you're going to want more animation sources than just mixamo.
I tried to write this all out as it was fresh in my head, but it was quite a bit so I may have forgotten something or gotten things wrong in my confusion.
I'd appreciate any corrections on stuff I got wrong here, but I felt if it even helped 1 person resolve what I did, it'd be a healthy contribution, so I'll leave it at that.
I actually figured out the solution to this, so this isn't a personal issue I have now but a way the plugin could be expanded.
I'm not an experienced developed, or at 3D animations, I've never contributed to open source, but I figured this would help some people. I'm not doing a PR at this stage but I may in the future if I wasn't mistaken about some things here. This could help someone else do a PR though if they wanted, by all means.
Solution:
In VERY short to avoid reading below if you're just looking for a solution with the current plugin:
Also delete this line
subresources["nodes"]["PATH:Skeleton3D"]["retarget/remove_tracks/unmapped_bones"] = trueIn order to see when your mappings are broken instead of having them temporarily delete your animations. (I'm unsure of any negative side effects to doing this)
The issue I had was trying to import some fbx files from a unity package I'd downloaded into godot. I figured it wouldn't work as this plugin was for mixamo, and I checked and it didn't, but looking more into the code I felt it should with a bit of tweaking.
First issue I encountered, if a file is named ".FBX" rather than ".fbx" as some people do, it won't work with the plugin and it won't tell you anything is wrong even. Renaming the file sorts it out. Fixing it would be in RetargetMixamoAnimation() I believe.
Second issue I encountered was no errors would occur, every print seemed to say "Import successful" etc. yet no file would be created. I'm still not sure what made that precisely happen, but the issue itself was the animation file in mixamo fbx files is called "mixamo_com". You can fix this issue by changing every reference to "mixamo_com" to whatever you find in the fbx file you're trying to import, by double clicking in the file inspector and then seeing what is under AnimationPlayer. In my case it happened to be "Unreal Take". This could be resolved by having somewhere to edit this string when importing, and utilizing that instead of the magic string "mixamo_com" that only handles 1 use case the plugin was initially designed for.
Third issue I encountered (which took some time to resolve due to the nature of the issue), was animations being seemingly deleted from the base .fbx files when 'Retarget Mixamo Animation/s' was used after the second issue was resolved. What's worse is that the ordinary manual import I could do successfully by just created a new bone map, reimporting, and then changing the reimport to an animation library, no longer worked either, the animation was gone from that too. It looked to be permanently deleting this part (though in the end, it wasn't truly).
The issue turned out to be with this line:
subresources["nodes"]["PATH:Skeleton3D"]["retarget/remove_tracks/unmapped_bones"] = trueNow I'm not sure of its purpose, but this line I think could be removed entirely from the plugin as it only caused me confusion and I haven't seen downsides to removing it yet, though I'm unsure what issues that might cause.
After removing this, the animations successfully came back when retargeting, though when playing them, my character had a stretched neck and was clearly broken. This finally clued me in to the actual issue, which is my mappings weren't correct to the bones.
I'd originally overlooked this issue as manually importing without providing ANY details for my mappings worked fine. I'm unsure if Godot when doing this from the inspector just figures it out? But when doing things manually, it seems you do need to provide what your file's mappings really are. I had seen this plugin did provide its own mapping file for mixamo, but like I said, I didn't see how this data was needed if I could do what I wanted without providing any, but that was wrong. I also overlooked this issue as the issue of missing animations seemed far more important to resolve, as the mapping issue itself was obscured by the code removing animations if they weren't mapped properly.
In short, the third issue can be resolved by duplicating the existing mapping file, and then changing the mappings to reflect those found if you create an inherited scene with your fbx file then click on Skeleton and look to the right side. Compare with a mixamo file to help, but you'll notice pretty obviously your syntax for limbs will be something like "Head_L" rather than the default mapping of "mixamorig_Head". So you need to replace all of these references with the right ones. Obviously this part is prone to error so be cautious, but I just asked chatgpt to replace the mappings once I figured out the syntax rule, it worked, but do it manually or double check to be sure. I believe the worst that will happen is your mapping will be broken and it'll look wonky, then you can just look over your work again if its wrong.
After this, you need to provide the new path for this mapping under _process_fbx_file(). If this were changed to a variable somewhere that could be changed outside of the code, this would also help so you could switch between mappings, but this isn't a PR so I don't know.
And I also heavily recommend just deleting/commenting this line to avoid misunderstandings and temporary clears to your animations. It becomes very obvious if you've mapped something wrong if your limbs look wonky.
subresources["nodes"]["PATH:Skeleton3D"]["retarget/remove_tracks/unmapped_bones"] = trueI have in fact, only tested this on 1 other source for fbx files, and these things can be finnicky but given how simple it ended up being, I don't see why this couldn't apply to more than just this source, which would open up this plugin to be "Godot Animation Retargeter" rather than just "Godot Mixamo Animation Retargeter", whilst continuing to use almost all of the existing code. As far as I'm aware, this would be a great addition to the community since I don't believe any such plugin currently exists, and 90%+ of the info about importing animations is FAR more tedious and prone to error than it has to be. Not to mention, if you're making a 3D game beyond a tech demo, you're going to want more animation sources than just mixamo.
I tried to write this all out as it was fresh in my head, but it was quite a bit so I may have forgotten something or gotten things wrong in my confusion.
I'd appreciate any corrections on stuff I got wrong here, but I felt if it even helped 1 person resolve what I did, it'd be a healthy contribution, so I'll leave it at that.