Search code examples
godotgdscript

How can I determine where the parsing of my Scene file has an error


I got the following problem. I got an Player Scene which currently only has a Node2D as root, a Sprite2D with my Spritesheet and an Animation player in it. The spritesheet contains animation sprites for 5 actions in 8 directions each (front, left, right, back, left_back, left_front etc) In the animation player I created only the front animation for each action via godot.

In the tscn file a animation looks like this:

[sub_resource type="Animation" id="Animation_e7hpv"] 
resource_name = "looking_around_front"
length = 3.6
step = 0.4
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:frame_coords")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.4, 0.8, 1.2, 1.6, 2, 2.4, 2.8, 3.2, 3.6),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2i(6, 0), Vector2i(5, 0), Vector2i(4, 0), Vector2i(5, 0), Vector2i(6, 0), Vector2i(6, 0), Vector2i(7, 0), Vector2i(4, 1), Vector2i(7, 0), Vector2i(6, 0)] 
}

Because the only thing changing is the y coordinate in the values, I thought I could generate the remaining animations with a small programm and inserted them directly into my tscn file.
To do that I copied the original sub_resource for each action and altered the id, resource name and values. Keeping the rest as is.

Then I added them into the tscn and altered the AnimationLibrary data object to hold all of my generated animations.

I uploaded the final file here, if you might want to take a look.

When I now try to open the file I get the following error:

 scene/resources/resource_format_text.cpp:592 - res://hero_kitten.tscn:709 - Parse Error: Expected Identifier
  Failed loading resource: res://hero_kitten.tscn. Make sure resources have been imported by opening the project in the editor at least once.

Line 709 is my root node which I did not alter in the generate process:

[node "name"="HeroKitten" type="Node2D"]

So I don't understand how this could be the problem. As I said the scene was created in godot I only added animation sub*resources.
*
I checked, that all ids are unique and are included into the animation_libray data object.

Is tried to copy samples of my generated animations into another scene and that worked. But adding all 42 animations seems to cause the problem..

Any ideas how I could pinpoint the error to a specific line? If I have to delete every animation once to check if it's the problem, I could as well just create the animations by hand..

TLDR what I tried:

  • copied sample code to another scene to check, if it's still possible to open
  • Checked all generated Ids for duplicates
  • Checked all generated sub_resources are in the AnimaitonLibrary
  • Increased the load_steps attributes to check if it makes a diffrence

Solution

  • I do not know how this got messed up, but this line:

    [node "name"="HeroKitten" type="Node2D"]
    

    Should be like this:

    [node name="HeroKitten" type="Node2D"]
    

    And that is the first error in the file, there are a couple other cases of "name" instead of name afterwards.