mapeditor/tiled

Do you want to work on this issue?

You can request for a bounty in order to promote it!

Unit selector for object layers #3345

duarm posted onGitHub

Is your feature request related to a problem? Please describe. I would like to have an object layer with objects positioned tile-relative, currently all objects are world relative. Is there a way to do this? read the whole "Working with Objects" docs and doesn't seem so.

I'm making a tile-based game and using an object layer to define world events. Events are positioned per tile, so objects with a world coordinate are inconvenient.

Describe the solution you'd like An option to make the object layer tile-relative, and they render correctly while editing.

Describe alternatives you've considered Doing a post-process of the generated tilemap file to make the objects tile-relative. This doesn't help while editing tho


I would like to have an object layer with objects positioned tile-relative, currently all objects are world relative. Is there a way to do this? read the whole "Working with Objects" docs and doesn't seem so.

Objects are positioned in pixels and there is no option to use tile coordinates. To not complicate the map format needlessly, there are no plans to add such an option. However, you can do two things:

  • Divide the pixel coordinates by the tile size, to obtain the tile coordinates.
  • Enable View > Snapping > Snap to Grid, to ensure the position and size of objects will match the grid.

Note that in case of tile objects, by default their "position" is the bottom-left. You can change the tile object alignment to top-left in the Tileset properties if this makes things easier for you.

posted by bjorn over 2 years ago

The inconvenience is just for those who are editing, I can still add a custom property to tell this layer uses tile coordinates if needed. It would help having a rectangle be: pos=2,3 size=11,19 for the artist instead of pos=64,96 size=352, 608. But I agree this is not urgent by any means, thanks for the clarification.

posted by duarm over 2 years ago

It would help having a rectangle be: pos=2,3 size=11,19 for the artist instead of pos=64,96 size=352, 608. But I agree this is not urgent by any means, thanks for the clarification.

Ah, that's right. A unit selector might be helpful there.

posted by bjorn over 2 years ago

Reopening since now this issue is about adding a unit selector in the Properties view for objects.

posted by bjorn over 2 years ago

Reopening since now this issue is about adding a unit selector in the Properties view for objects.

FWIW I think more valuable than unit selection in the Properties view would be the ability to view positions in tile units in the status bar when placing/moving/sizing objects with the various object tools, since those are how most object positioning adjustments happen. Might be easier to implement too, since it only affects the status bar output, and there might even be room to display both pixels and tiles at once.

Just making it a cosmetic display in the status bar would also avoid any confusion regarding which units are used to store the data - that would always just be pixels, including in the Properties panel.

posted by eishiya over 2 years ago

FWIW I think more valuable than unit selection in the Properties view would be the ability to view positions in tile units in the status bar when placing/moving/sizing

The tile position is already there isn't it?

Even so, an unit selector would be more user friendly, why do I need to look at the statusbar to view the tile pos when editing objects? as far as the user is concerned, there's no difference, he just wants to position the tile, and he can choose the unit. The user also doesn't care about which unit is being exported to the tmj file, only the one who's implementing a parser needs to know that, and he knows it's always pixels, regardless.

posted by duarm over 2 years ago

it would help a lot to show the tile position here too. Not sure how tho, a layer default unit perhaps? image

posted by duarm over 2 years ago

I find it interesting that you apparently want to use the properties panel but not the status bar. To me, the properties panel is more work. Different strokes for different folks :D You're right, the tile position is there for positions, I should've checked instead of relying on memory. Would be nice to have it for sizes too, though. When creating objects, there is no indicator of the size at all until after you've created it. The size is shown in the properties panel when resizing, but it would be nice to have it in the status bar too, similar to how some of the tile tools use the status bar: image

For the position in the objects list, since you can customise which columns are shown, I think it should work to just have Position (Pixels) and Position (Tiles) columns. This way the user can choose to have one or both units displayed at once, and there's no need to save any extra data with each map/layer. I think something similar should be done for the properties view - the display units should be a Tiled setting and not part of the map, and ideally, both units should be showable.

posted by eishiya over 2 years ago

I find it interesting that you apparently want to use the properties panel but not the status bar. To me, the properties panel is more work. Different strokes for different folks

The problem is not where I'm looking, it's consistency. I'm always looking at the properties to see the properties, one of them being the position. Maps, Layers, Tiles, the position I want to see is there on the properties, but for objects, the position I want is down there at the statusbar. Even if that wasn't the case, it would be about tiled abiding to more workflows, since if I'm positioning something tile relative, I might as well hide the pixel position, or at least place it in a less prominent position.

For the position in the objects list, since you can customise which columns are shown, I think it should work to just have Position (Pixels) and Position (Tiles) columns.

I agree, this seems like a better solution

posted by duarm over 2 years ago

Fund this Issue

$0.00
Funded
Only logged in users can fund an issue

Pull requests