You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When resizing a layer via layer.width and layer.height, even if those added rows/columns are within the map bounds, Tiled will not draw them correctly.
Here's a small script that demonstrates the issue:
varchangeLayerSize=tiled.registerAction("LayerSizeTest",function(action){letmap=tiled.activeAsset;if(!map||!map.isTileMap||map.infinite)return;map.macro("Layer Size Test",function(){//Resize the map:map.height=map.height+3;map.width=map.width+3;letlayer=map.layerAt(0);lettile=layer.tileAt(0,0);//Resize the layer:layer.height=layer.height+3;layer.width=layer.width+3;letlayerEdit=layer.edit();//Fill new columns with tiles:for(lety=0;y<layer.height;++y){layerEdit.setTile(layer.width-1,y,tile);layerEdit.setTile(layer.width-2,y,tile);layerEdit.setTile(layer.width-3,y,tile);}//Fill new rows with tiles:for(x=0;x<layer.width;x++){layerEdit.setTile(x,layer.height-1,tile);layerEdit.setTile(x,layer.height-2,tile);layerEdit.setTile(x,layer.height-3,tile);}layerEdit.apply();});});changeLayerSize.text="Layer Size Test";tiled.extendMenu("Edit",[{action: "LayerSizeTest",before: "Preferences"},{separator: true}]);
This script extends the current map by 3 in width and height, extends its 0th layer by the same, and fills the new rows/columns with the tile that's in the top left corner.
This is what I expect to see after running it:
But this is what I actually get:
The "blank" tiles are populated - I can see the tile ID in the status bar, I can copy+paste them. If I save the map and reopen it, I get the expected result above. But for some reason, only the row/col immediately next to the old edge of the layer gets drawn while the others are not, and even those are drawn rather tentatively, they're not redrawn when the region next to them is drawn.
I imagine this has something to do with the fact that layer.width/height don't affect layer contents, but layer.resize(). which does affect contents, has its own problems (#3480), and I expect these "manual" size changes to still work fine as long as the resulting map size, layer size, and tile contents are all sensible, which I believe they are in this case.
The text was updated successfully, but these errors were encountered:
When resizing a layer via
layer.width
andlayer.height
, even if those added rows/columns are within the map bounds, Tiled will not draw them correctly.Here's a small script that demonstrates the issue:
This script extends the current map by 3 in width and height, extends its 0th layer by the same, and fills the new rows/columns with the tile that's in the top left corner.
![image](https://user-images.githubusercontent.com/70545646/192153236-1b5ec767-9d2f-45a4-9e62-9ed53c7d68ab.png)
![image](https://user-images.githubusercontent.com/70545646/192153225-de658368-a536-439a-a79e-e854e7d81752.png)
This is what I expect to see after running it:
But this is what I actually get:
The "blank" tiles are populated - I can see the tile ID in the status bar, I can copy+paste them. If I save the map and reopen it, I get the expected result above. But for some reason, only the row/col immediately next to the old edge of the layer gets drawn while the others are not, and even those are drawn rather tentatively, they're not redrawn when the region next to them is drawn.
I imagine this has something to do with the fact that layer.width/height don't affect layer contents, but layer.resize(). which does affect contents, has its own problems (#3480), and I expect these "manual" size changes to still work fine as long as the resulting map size, layer size, and tile contents are all sensible, which I believe they are in this case.
The text was updated successfully, but these errors were encountered: