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

Support removing TileMap layer at negative index #92015

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jonathandw743
Copy link

Added ability to TileMap.remove_layer using a negative index.

@jonathandw743 jonathandw743 requested a review from a team as a code owner May 16, 2024 12:48
@KoBeWi KoBeWi added this to the 4.x milestone May 16, 2024
@AThousandShips
Copy link
Member

The TileMap class is deprecated, so I don't think we should add new features to it like this, if we do this should be documented as well

@AThousandShips AThousandShips changed the title remove layer at negative index Support removing TileMap layer at negative index May 16, 2024
@KoBeWi
Copy link
Member

KoBeWi commented May 16, 2024

This is a follow-up to #54546, so it's probably fine for consistency.

@groud
Copy link
Member

groud commented May 16, 2024

The TileMap class is deprecated, so I don't think we should add new features to it like this, if we do this should be documented as well

I don't mind much adding it for consistency. We will probably keep the TileMap node for a little while, and I don't think adding small tweaks matter much.

My main goal in marking TileMap it as deprecated was to avoid contributors/users to implement/expect new features that would improve the TileMap node only, and that the focus will be on the TileMapLayer workflow instead. But like, if a new TileMap feature is small enough, restricted to the TileMap node, and does not need to be implemented in TileMapLayer too, I don't mind much.

@jonathandw743
Copy link
Author

The TileMap class is deprecated, so I don't think we should add new features to it like this, if we do this should be documented as well

I didn't realise this.
Just downloaded 4.3dev6 and the TileMapLayers are way better than having to pass a layer index into every function and keep track of which index corresponds to which layer etc.

Co-authored-by: A Thousand Ships <[email protected]>
@KoBeWi
Copy link
Member

KoBeWi commented May 16, 2024

Docs need description update here:

<method name="remove_layer">
<return type="void" />
<param index="0" name="layer" type="int" />
<description>
Removes the layer at index [param layer].
</description>

Example:

If [param layer] is negative, the layers are accessed from the last one.

Also you need to squash commits into 1.

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

Successfully merging this pull request may close these issues.

None yet

4 participants