godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.58k stars 21.27k forks source link

Error message from AnimationTree with root bone #76330

Open trollusk opened 1 year ago

trollusk commented 1 year ago

Godot version

4.0.2

System information

Windows 11

Issue description

I'm randomly getting error messages, usually when saving the project but also at other times, that say the following:

Found invalid node path 'Armature/Skeleton3D:mixamorig10_Root' on node 'PlayerTest/Player/AnimationTree'

The node has the bone listed above as its root_motion_track. The AnimationTree is working fine, including root motion.

The message seems to come from the function SceneTreeDock::_update_node_path. It looks like it's trying to treat a bone path as a node?

Steps to reproduce

Create scene with Skeleton3D, AnimationPlayer and AnimationTree. Set the AnimationTree's player to the AnimationPlayer. Create a bone in the skeleton and set it as the AnimationTree root_motion_track.

The message usually seems to happen when saving files in the editor.

Minimal reproduction project

N/A

Chaosus commented 1 year ago

Attach the MRP, please.

Coccusdge commented 1 year ago

I encountered the same issue with both versions 4.1 and 4.2, where any operation on the node would result in an error once the root motion is set.

AThousandShips commented 1 year ago

Please provide a minimal reproduction project:

Coccusdge commented 1 year ago

Temp.zip

TokisanGames commented 4 months ago

AnimationTree and AnimationPlayer now derive from AnimationMixer since this issue was created. In spite of multiple PR attempts at fixing it, the issue is still present in both AT & AP in Godot 4.2.2.

I have animated characters in a scene. If I reparent any unrelated object in the tree, say a rock, the animated characters report these errors, even though they have not been touched.

ERROR: Found invalid node path 'Armature/Skeleton3D:cc_base_boneroot' on node 'ForestWalk/dorian_mesh_v8_0/AnimationTree'
   at: (editor/scene_tree_dock.cpp:1691)
ERROR: Found invalid node path 'Armature/Skeleton3D:cc_base_boneroot' on node 'ForestWalk/npc_female/AnimationPlayer'
   at: (editor/scene_tree_dock.cpp:1691)

The animations and animationplayer/tree work fine. ForestWalk is a game level. dorian_mesh_v8_0.tscn and npc_female.tscn are character scenes. The AnimationPlayer root node, root_motion_track, and cc_base_body/skeleton are all connected properly, the scene inherits from a glb, imported from blender.

image

import file ``` [remap] importer="scene" importer_version=1 type="PackedScene" uid="uid://c41dopfu31odl" path="res://.godot/imported/npc_female.glb-7dc337dcf585e268675e4e5819571d5a.scn" [deps] source_file="res://assets/models/characters/npcs/npc_female.glb" dest_files=["res://.godot/imported/npc_female.glb-7dc337dcf585e268675e4e5819571d5a.scn"] [params] nodes/root_type="" nodes/root_name="" nodes/apply_root_scale=true nodes/root_scale=1.0 meshes/ensure_tangents=true meshes/generate_lods=true meshes/create_shadow_meshes=true meshes/light_baking=1 meshes/lightmap_texel_size=0.2 meshes/force_disable_compression=false skins/use_named_skins=true animation/import=true animation/fps=30 animation/trimming=false animation/remove_immutable_tracks=true import_script/path="" _subresources={ "nodes": { "PATH:Armature/Skeleton3D": { "retarget/bone_map": Resource("res://assets/models/characters/_animations/cc4_bone_map_lower.tres"), "retarget/bone_renamer/rename_bones": false, "retarget/bone_renamer/unique_node/skeleton_name": "Skeleton3D" } } } gltf/naming_version=1 gltf/embedded_image_handling=1 ```

I debugged editor/scene_tree_dock.cpp:1691 with my forest scene. Reparented an object and broke when one of the characters complained.

image

https://github.com/godotengine/godot/blob/4.2/editor/scene_tree_dock.cpp#L1691

target_node is null p_root_node: AnimationPlayer r_node_path: path = "Armature/Skeleton3D", subpath = "cc_base_boneroot"

I think the problem is that this character is imported with Armature and AnimationPlayer at the same level, but here AnimationPlayer is attempting to get_node_or_null("Armature/Skeleton3D"), when it should be "../Armature/Skeleton3D".

If I set AnimationPlayer root_motion_track to null, it removes the error. However this also breaks my root motion characters. Animations will play but will break player controllers that move based on RM.

cc: @KoBeWi


Related issues: https://github.com/godotengine/godot/issues/83209 https://github.com/godotengine/godot/issues/83255

Related PRs: https://github.com/godotengine/godot/pull/83263 https://github.com/godotengine/godot/pull/83934