-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Scripting: Assigned map.selectedLayers displays incorrectly #3451
Labels
bug
Broken behavior.
Comments
lhiginbotham
added a commit
to lhiginbotham/tiled
that referenced
this issue
Oct 24, 2022
- fixes mapeditor#3451 where layer selection highlighting was bugging out if the newly set selection was not ordered by layer ID - this seems to be an event interplay issue with the following sequence: - script sets the layer selection to some array - first step in handling that is to set the currently selected layers to be the full array, triggering LayerView::selectedLayersChanged to select the whole range - second step is to make sure that the mCurrentLayer variable is pointing to an object within that array selection, which in this bad cause it is not, so we end up calling setSelectedLayers with one item, triggering LayerView::selectedLayersChanged again with a single item and effectively clearing out the selection we had just highlighted - first this by doing the second step before the first step
lhiginbotham
added a commit
to lhiginbotham/tiled
that referenced
this issue
Oct 24, 2022
- fixes mapeditor#3451 where layer selection highlighting was bugging out if the newly set selection was not ordered by layer ID - this seems to be an event interplay issue with the following sequence: - script sets the layer selection to some array - first step in handling that is to set the currently selected layers to be the full array, triggering LayerView::selectedLayersChanged to select the whole range - second step is to make sure that the mCurrentLayer variable is pointing to an object within that array selection, which in this bad case it is not, so we end up calling setSelectedLayers with one item, triggering LayerView::selectedLayersChanged again with a single item and effectively clearing out the selection we had just highlighted - first this by doing the second step before the first step
lhiginbotham
added a commit
to lhiginbotham/tiled
that referenced
this issue
Oct 24, 2022
- fixes mapeditor#3451 where layer selection highlighting was bugging out if the newly set selection was not ordered by layer ID - this seems to be an event interplay issue with the following sequence: - script sets the layer selection to some array - first step in handling that is to set the currently selected layers to be the full array, triggering LayerView::selectedLayersChanged to select the whole range - second step is to make sure that the mCurrentLayer variable is pointing to an object within that array selection, which in this bad case it is not, so we end up calling setSelectedLayers with one item, triggering LayerView::selectedLayersChanged again with a single item and effectively clearing out the selection we had just highlighted - fix this by doing the second step before the first step
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When assigning to
TileMap.selectedLayers
, if the assigned array has its layers in any order other than ascending by layer ID and doesn't contain every layer in the map, the layers will be selected, but the Layers panel will only highlight the bottom-most layer. I confirmed that the layers were selected via Highlight Current Layer, and viatiled.activeAsset.selectedLayers
.Here for example, I selected all "Invalid" layers via script, in order from bottom to top (the same order they appear in
map.layers
). The layers are sorted by their ID (which I've added to their layer name, for convenience), so everything is highlighted correctly:But here, I've switched layers 2 and 3, so they're no longer in ascending order, and thus only the bottom-most selected layer is highlighted (but all three layers are actually selected):
Sorting the layers prior to assigning to
map.selectedLayers
works to correctly highlight all layers regardless of order:Selecting every layer in the map also highlights the layers correctly, regardless of their order in the array.
The text was updated successfully, but these errors were encountered: