godotengine / godot

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

AnimationPlayer: and key symbol disappearing when Region is enabled #36313

Open golddotasksquestions opened 4 years ago

golddotasksquestions commented 4 years ago

Godot version: 3.2. stable

OS/device including version: Win 64

Issue description: Key symbol next to properties in the inspector are disappearing when Sprite Region is enabled. Effectively making it impossible to animate Sprite Regions.

Possibly related closed issue: https://github.com/godotengine/godot/issues/8306

Steps to reproduce:

  1. Create new scene
  2. Add Sprite and set texture.
  3. Enable region. Draw a region or chose autosclice in the bottom TextureRegion panel.
  4. Add AnimationPlayer and create a New Anim
  5. Make sure you have the AnimationPlayer Node selected, so key symbol is visible next to properties
  6. Click the Sprite node
  7. Wonder where the keys went.

region_animation_bug

Minimal reproduction project: Region-Bug.zip

Sidenote: Reimporting as "Region" seem to break everything: png still shows up in the File System, but disappears from the Viewport and Inspector, and cannot be loaded back into the Texture property anymore. Might have something to do with this update? Made a separate issue here: https://github.com/godotengine/godot/issues/37071

YeldhamDev commented 4 years ago

They disappear because the Animation Editor was switched to the TextureRegion Editor, opening the the Animation Editor again will make the keys come back, and the TextureRegion Editor won't come back.

golddotasksquestions commented 4 years ago

I just tested it again, and in Godot 3.2.1, it does seem to be possible to animate Region, however the bug still exist, so you have to follow a very specific flow:

  1. Add a Sprite and AnimationPlayer to your scene.
  2. Load the spritesheet texture to your Sprite Texture and create a "New Anim" in the AnimationPlayer.
  3. In the Sprite Inspector, enable "Region" and open the bottom "TextureRegion" panel.
  4. When you are doing this for the first time in your project, the "Snap Mode" will be set to "none". If you change it to "Autoslice" Godot won't actually slice your TextureRegion. You have to click some other Node in the ScenePanel, then again on your Sprite to make the Autoslices appear. (see bug description here: https://github.com/godotengine/godot/issues/37614)
  5. Now to animate: If I would click on the AnimationPlayer, and then click on the Sprite node like I would normally do to make the keys show up, the keys don't show up and you can't animate. Instead what you must do is to click on the Sprite node, click on the autosliced region you want to key (it gets a white border), then still while the Sprite is selected click in the bottom panel on "Animation" (next to TextureRegion). This will bring up the track and also make the key symbols show up in the Inspector.
  6. Only now you can click on the key symbol under Region > Rect. Click on "yes" if the pop up asks you if you want to create a track.
  7. To key the next autosliced region, click and drag the timestamp in the Animation to where you want your next key to be set, click on "TextureRegion" in the bottom Panel, click on the next region you want to key (get a white border), click on "Animation" again in the bottom Panel, go to the Inspector and again click on the key symbol next to Region > Rect. Repeat for as many keys you want in your animation.
  8. before you play the Animation be sure to set the track Update property to "discrete", otherwise the AnimationPlayer will interpolate the region_rect between keyframes.

Edit: corrected and updated thanks to comment from lukapascuttini

lukapascuttini commented 4 years ago

I just tested it again, and in Godot 3.2.1, it does seem to be possible to animate Region, however the bug still exist, so you have to follow a very specific flow:

  1. Add a Sprite and AnimationPlayer to your scene.
  2. Load the spritesheet texture to your Sprite Texture and create a "New Anim" in the AnimationPlayer.
  3. In the Sprite Inspector, enable "Region" and open the bottom "TextureRegion" panel.
  4. When you are doing this for the first time in your project, the "Snap Mode" will be set to "none". If you change it to "Autoslice" Godot won't actually slice your TextureRegion. You have to click some other Node in the ScenePanel, then again on your Sprite to make the Autoslices appear. (see bug description here: #37614)
  5. Now to animate: If I would click on the AnimationPlayer, and then click on the Sprite node like I would normally do to make the keys show up, the keys don't show up and you can't animate. Instead what you must do is to click on the Sprite node, click on the autosliced region you want to key (it gets a white border), then still while the Sprite is selected click in the bottom panel on "Animation" (next to TextureRegion). This will bring up the track and also make the key symbols show up in the Inspector.
  6. Only now you can click on the key symbol under Region > Rect. Click on "yes" if the pop up asks you if you want to create a track.
  7. To key the next autosliced region, click on "TextureRegion" in the bottom Panel, click on the next region you want to key (get a white border), click on "Animation" again in the bottom Panel, click and drag the timestamp in the Animation to where you want your next key to be set, go to the Inspector and again click on the key symbol next to Region > Rect. Repeat for as many keys you want in your animation.

excuse me but the number 7 just doesent work for me , i mean i do it all right but the animation just doesent move still... still

they keys simply do not copy the value of the region_rect, i mean all the keys still have the same value.

EDIT: OK figured it out SOLVED: by making the track discrete instead of continous... its on the right of the animation timeline... a straight line left of the trash can where you delete tracks, OH and your step 7 is kinda wrong, you have to pick the autosliced texture after dragging the timestamp in the Animation tab not before or it doesent copy the value of the new region_rect key.

golddotasksquestions commented 4 years ago

Thank you for the pointers @lukapascuttini You are right the timestamp position has to be adjusted before, and the discrete track setting. This is really finicky. You really have to take care to do all the steps 100% correct. I really hope it get's fixed soon and we can animate the region_rect like any other property. I've edited the step by step guide, so people can link to it and use it until then.

ghost commented 4 years ago

@golddotasksquestions thank you, that helps me in my unevenly spaced sprite sheets