Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy/Paste of TileMap from one scene to another removes TileSet from initial scene #83218

Closed
ysfdc opened this issue Oct 12, 2023 · 12 comments · Fixed by #88280
Closed

Copy/Paste of TileMap from one scene to another removes TileSet from initial scene #83218

ysfdc opened this issue Oct 12, 2023 · 12 comments · Fixed by #88280

Comments

@ysfdc
Copy link

ysfdc commented Oct 12, 2023

Godot version

Godot Engine v4.1.1.stable.official.bd6af8e0e

System information

OpenGL API 4.1 Metal - 83 - Compatibility - Using Device: Apple - Apple M2

Issue description

I have tested this in 4.1, 4.1.1, and 4.1.2 and all three versions experienced the same issue. This did not happen in either 4.0 or 4.0.3.

When copying and pasting a TileMap node that has a TileSet assigned and has been laid out in the UI, from one scene to another, results in the original TileMap no longer having a TileSet and the UI shows just at atlas with some dots (see attached file).

It did not seem to matter if both scenes existed and then the process occurred. It also does not matter if you use it in the UI, although that makes it more clear that the TileSet has been removed from the TileMap node.

tilemap

Steps to reproduce

  1. In any of the versions noted in the description create a 2DScene
  2. Add a TileMap Node
  3. Add a TileSet
  4. Use the TileSet in the scene
  5. Create a new 2DScene
  6. Copy the TileMap Node from the original scene
  7. Paste into the new scene
  8. Look at the original scene and see UI no longer shows what you added and if you click on the TileMap, the TileSet is no longer connected

Minimal reproduction project

N/A

@Calinou
Copy link
Member

Calinou commented Oct 12, 2023

I have tested this in 4.1, 4.1.1, and 4.1.2 and all three versions experienced the same issue. This did not happen in either 4.0 or 4.0.3.

Can you reproduce this in 4.1 dev/beta/RC releases? You can download them here.

@bkerz
Copy link

bkerz commented Oct 12, 2023

Hey @Calinou I've tested on 4.2 beta 1 and it's still happening, here I leave a minimal reproduction project:
testing_project.zip

And also this is what the output shows after you copy paste the tilemap to another scene:
image

@ETHEYtheDREAMER
Copy link

ETHEYtheDREAMER commented Oct 17, 2023

I'm definitely experiencing this. It was in the middle of a Godot course where the instructor asked to copy a tilemap node in one scene and in the other scene paste it. The new scene had everything intact however the tilemap in the first scene is missing all references. It appears identical to OP's image. I repeated the instructor's steps from the beginning and got the same results. I scoured the internet/YouTube for a solution (if I'm just doing something wrong) and only found this github page.

edit: This is also on v4.1.1.stable.mono.official in Windows 11

@ysfdc
Copy link
Author

ysfdc commented Oct 17, 2023

I'm definitely experiencing this. It was in the middle of a Godot course where the instructor asked to copy a tilemap node in one scene and in the other scene paste it. The new scene had everything intact however the tilemap in the first scene is missing all references. It appears identical to OP's image. I repeated the instructor's steps from the beginning and got the same results. I scoured the internet/YouTube for a solution (if I'm just doing something wrong) and only found this github page.

edit: This is also on v4.1.1.stable.mono.official in Windows 11

Was it this video: https://youtu.be/FNEAJsry5sA?si=n932nWsCXjeiI2mT ?

@ETHEYtheDREAMER
Copy link

ETHEYtheDREAMER commented Oct 18, 2023

I'm definitely experiencing this. It was in the middle of a Godot course where the instructor asked to copy a tilemap node in one scene and in the other scene paste it. The new scene had everything intact however the tilemap in the first scene is missing all references. It appears identical to OP's image. I repeated the instructor's steps from the beginning and got the same results. I scoured the internet/YouTube for a solution (if I'm just doing something wrong) and only found this github page.
edit: This is also on v4.1.1.stable.mono.official in Windows 11

Was it this video: https://youtu.be/FNEAJsry5sA?si=n932nWsCXjeiI2mT ?

Oddly enough no, it was one from Zenva I got in a massive Godot humble bundle, specifically one for creating a basic 2D platformer using tilemaps. It's funny too because it's pretty obvious why all of a sudden there's an influx of deals for Godot courses!

The process in your tutorial is the same though and I felt really dumb for awhile until I stumbled across this. I'd REALLY love it if this bug gets fixed soon so I can finish the course.

@Calinou please let me know if you need me for anything. I used to work in UAT so hopefully I can be helpful <3

@ysfdc
Copy link
Author

ysfdc commented Oct 18, 2023 via email

@rakkarage
Copy link
Contributor

rakkarage commented Oct 25, 2023

I believe this issue only occurs for ‘internal’ tilesets that are saved in the scene. I’ve traced the problem to this section of code in the tile_set.cpp file:

DestinationTileSet::add_source calls SourceTileSet::remove_source

https://github.com/godotengine/godot/blob/e8d57afaeccf0d9f9726746f49936eb93aa0039b/scene/resources/tile_set.cpp#L484C1-L486C3

This code is part of a pull request:

#78477

After removing the deletion or only for internal tilesets (specifically, this line: if (p_tile_set_source->get_path().find("::") == -1)), it seems to work. However, the sub_resource_id of the source tileset still changes during copy, even though nothing in the source should change. If you close the source without saving (since it’s not marked as ‘dirty’), nothing happens.

This might be due to another section of code in the same file, which no longer matches its comment:

https://github.com/godotengine/godot/blob/e8d57afaeccf0d9f9726746f49936eb93aa0039b/scene/resources/tile_set.cpp#L3159C1-L3168C3

This code is also part of the same pull request. It seems like the pull request was made to handle severing ties during the ‘make local’ operation, but this function is also called when copying a tilemap between scenes.

Thanks.

@EigenLaw
Copy link

I'm definitely experiencing this. It was in the middle of a Godot course where the instructor asked to copy a tilemap node in one scene and in the other scene paste it. The new scene had everything intact however the tilemap in the first scene is missing all references. It appears identical to OP's image. I repeated the instructor's steps from the beginning and got the same results. I scoured the internet/YouTube for a solution (if I'm just doing something wrong) and only found this github page.

edit: This is also on v4.1.1.stable.mono.official in Windows 11

me too

@KilliannH
Copy link

Me too, anyone can merge the linked pull request ? I think it's a huge one

@Albaii22
Copy link

Albaii22 commented Mar 2, 2024

The only thing you have to do is save the tileset where your first node is and then import it into the tileset of the new node where we want to work with the same thing.
image
image2

@Conga0
Copy link

Conga0 commented Mar 5, 2024

Hey, I'm still having this problem occur.

It's happening in both Godot 4.1.1 and 4.2.1

https://youtu.be/agLpfY3m6mk

@KoBeWi
Copy link
Member

KoBeWi commented Mar 5, 2024

The issue was fixed in Godot 4.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment