BoneMap.profile property is not available to import scripts
Added note that the profile property is not available to import scripts.
Reason this change is needed...a lot of time was wasted by several people looking for a solution to retargetting the bones via script and a LOT of time would have been saved if this was noted.
It would be helpful to file an issue about the underlying problem.
a lot of time was wasted by several people
Can you please link to these discussion(s) for context? Discord links, forums, RocketChat, issues or anything else would all help.
As in godotengine/godot-docs#9740, I am still confused about how this note is written, for example what about this is specific to import scripts? Is there any example code that doesn't work but should have?
Just try it
@tool # Needed so it runs in editor. extends EditorScenePostImport func _post_import(scene): var bone_map = load("res://explosive_bone_map.tres") skeleton = scene.get_node("Armature/Skeleton3D") skeleton.bone_map = bone_map
After the edit, the code you posted is still incorrect, so I am having a little difficulty inferring what the intent is. For example, a Skeleton3D node does not have a bone_map property.
It also doesn't illustrate the profile property this PR is for.
I will need a better MRP or a discussion that explains what part is confusing or doesn't work.
How about you tell me this instead of making me go through days of chats...
How do you set a bone map from script?
All right, that's fair. I think I have some idea of what is tripping you up now.
so basically if I understand, you're looking at the double click importer (advanced import) and trying to set the properties that show up on its inspector, in which case, indeed bone_map would appear at first glance to be a property.
Indeed, if there is a workflow, it would not be the EditorScenePostImport script which is simple and runs after the entire import process has already finished, but instead could be in an EditorScenePostImportPlugin which is similar to how the retarget system is internally implemented.
However, if you did this, it might not be possible to modify the options dictionary (the settings like bone_map are actually properties in a dictionary). I would have to do research to see if it is possible to do so, but I spent several hours trying and suspect the answer is no.
Sp, what other options do you have? One option is to use an editor inspector plugin, which could override the place the bone_map is assigned. Another option would be to edit the .import file using the ConfigMap class. That is what I ended up doing in Unidot.
This is just one of the problems with the EditorScenePostImportPlugin apis. There are issues filed about other problems: I want to spend some time in the 4.4 cycle reworking those APIs.
I would have preferred if this was an issue but anyway I hope this explanation helps.
edit: in summary, the way I do it is to edit the .import file with script before the import process starts (or trigger another reimport_files after import is done)
Ok that all fair as well, then why NOT document it here that these things are not accessible for setting the bonemap / skeletonprofile? Wouldn't that be advantageous and prevent people spending time trying to make something work that LOOKS like it should work but doesn't?
The Retargetting Skeleton 3d manual page specifically references the bone_map property, which indicates it should be accessible
I would like this issue tracked somehow, so I wouldn't advocate for closing it like this.
So I understand now the example code you are showing about the bone_map property. (The godot-docs issue)
The thing I need for this issue is to understand why the profile property is not working on SkeletonProfile (this issue)
is the issue that the bone_map was null due to the bone_map property missing and therefore it was crashing when setting profile on null?
I do not mean this to be submitting this as an issue bug, I am submitting a suggested documentation improvement.
Regarding Issues, that process has seemed to be constrained to actual bugs in code. However in all support forums official and unofficial, I haven't gotten any meaningful response from anyone.
I apologize about the scriplet I submitted. I just created it quickly on the fly to demonstrate intent, but it's a little hard to go through the days of experimental code that didn't work and have been deleted.
Whether you try to set the SkeletonProfile.bone_map property, or the BoneMap.profile property, or whatever....you just can't get to it....
Yes there was some garbage about "unable to access bone_map property with a BoneMap object when attached to a null base" or something LIKE that...
I still think my suggested documentation update is a valid improvement. It will stop someone from trying to spend time trying to make it work. Especially since there IS a setter for the profile property....that sure indicates to me that you should be able to set it....Why not make a note that says, "these are not the droids you are looking for"
This is just one of the problems with the EditorScenePostImportPlugin apis. There are issues filed about other problems: I want to spend some time in the 4.4 cycle reworking those APIs.
I would very much like to be a part of this process if I could be...
Another option would be to edit the .import file using the ConfigMap class.
do you mean ConfigFile? I can't find ConfigMap, and I just want to be sure I am looking in the right place. ConfigFile seems to be what you are referring to, but the file extensions is uses as examples are .cfg files.
As of #100792 it is now possible to adjust the _subresources properties such as Skeleton3D -> bone_map, though documentation work could be helpful