-
-
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
Invert Y axis option #249
Comments
I think this should be done in the software that uses the map, i.e. if you're making an OpenGL game, have your OpenGL loader adjust the coordinates accordingly. I don't see a need for the GUI and all other loaders to support a feature like that. |
I guess it may still be confusing to see different coordinates in Tiled than in the game. So, when such a feature would be implemented in Tiled, it would have to be purely a presentation thing and not something that affects any internal data structures or the map format. |
In that case, also consider offsets. Maps in my game are chunks of a large world, so (0, 0) in a map might translate to (256, 512) in the game. |
You're right. I currently modify the coordinates for my game.. however, I =Chris On Tue, Aug 14, 2012 at 11:38 AM, Petr Viktorin [email protected]:
|
I think this is a good idea, rather than having to adjust the code in game it would make more sense just to have an option here. Then you wouldn't need to make boilerplate code just to invert the access in game for every object. |
This issue represents the most up-to-date state. After a short discussion there was a general agreement that it would be nice for Tiled to support this (indeed affecting the status bar display only), but so far no work has been done on it. It's not dead because it's still open for implementation. |
I'm thinking about forking and adding this feature but I'm not sure if it should just be a checkbox to invert or something more complicated as suggested above. I think that the best solution would be a pop-up on the status bar that lets you set an offset (x, y). If that sounds unreasonable let me know, or if you had a different idea. 😄 |
Offsets are a more advanced feature, the main thing here is Y flipping (in Tiled the Y coordinate grows down, in OpenGL it traditionally grows up). You can do that with a checkbox, plus some attribute saved in the map file. |
It seems to me that if you just add an offset you wouldn't need to flip it. X flipped would simply be setting an offset of your maps width. Unless displaying negative numbers is unacceptable, I think it would be a viable solution. Though I guess that it might not be immediately obvious to set the offset to your maps width or height in order to get the inverted values. |
I originally requested this feature because I use openGL coordinates to Chris Long On Thu, Oct 30, 2014 at 9:03 AM, Petr Viktorin [email protected]
|
@Beast96GT I'm talking about adding a check box (perhaps on the statusbar) that inverts y when ticked. Which was the original suggestion as far as I can tell, but other suggestions have been made since which I wanted to consider before I did any work. |
If you can do that, it would be awesome. I would think it would be On Thu, Oct 30, 2014 at 10:00 AM, Graham Hughes [email protected]
|
Unfortunately adding a checkbox on the actual status bar is not something I can accept in general, because it would add visual noise for the majority of people who have no need for this feature. I think it would be fine as a checkbox in the Preferences dialog, though. |
Sure. It should be in the general preferences as once it's set, you're On Thu, Oct 30, 2014 at 4:44 PM, Thorbjørn Lindeijer <
|
I'm much in favor of this feature request! :) |
Also requested on the forum. |
This feature would be very helpful. |
@davos555 I realize I'm a bit late with this reply, but I just thought I'd point out that I see this option as only a display option in Tiled. It would not affect the actual coordinates stored in a TMX file. So if you want to use the inverted coordinates in your game, you'll still have to invert them while or after loading the map. That is because if the TMX format would support storing inverted coordinates, then every loader out there would suddenly need to add such conversion code. |
@bjorn Why can't this conversion be applied transparently during the save process so that loaders do not have to do anything at all?.. Aren't coords actually saved? |
That's a sound idea, but the most important part for me is changing the y
coordinate in the status bar. It's much easier to implement.
…On Nov 28, 2016 3:19 PM, "Igor Savin" ***@***.***> wrote:
@bjorn <https://github.com/bjorn> Why can't this conversion be applied
transparently during the save process so that loaders do not have to do
anything at all?.. Aren't coords actually saved?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#249 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AMVB7u0ZZDuKkb7EGY-0oCzmDi7l3ZFqks5rC1OJgaJpZM4AFnjd>
.
|
@kibertoad There are many loaders either integrated into various game development frameworks or provided by 3rd parties, that both read the map file and render the map. When an option to invert the Y axis in the TMX file is introduced, then in order to render the map correctly, they would all need to be aware of this option and invert the Y axis when appropriate while rendering. I think it is better to keep a particular coordinate system on the file format level so that we are all on the same page. At the same time, I understand that some people are working with their coordinates inverted, and that it could help if Tiled could display them as such. @ShipshapeDetour In addition to the status bar I think it'll need to affect the Properties view as well, but still you're right that this is less work than changing the interpretation of the data. |
@bjorn Yes, if this is implemented as "invertCoords = true" parameter. What I mean by "transparently" is that if "invertCoords = true" is set, then on saving map Tiled will replace "X=1, Y=1" with "X=1, Y=100", and on loading (through Tiled) swap it all back. |
Any news on this feature? Would the option also affect x and y coordinates in Python export plugins? |
@viking This is currently not one of my priorities, though I think it would be a good issue for somebody new to Tiled development to look into, so I've now tagged it as such. To avoid making the map format more complex, it is planned to only affect the display of coordinates in Tiled. So it would not affect Python export plugins. |
I'm interested in trying to implement this feature. Just to be clear all that needs to be done is add a check box in the settings to flip the y coordinates of tiles that is being displayed in the status bar right? Nothing else involving actually saving the maps or modifying the properties view as mentioned above? I'm confident i can do that, but this is my first time contributing so any pointers would be greatly apreciated. :) |
Almost. Note that the status bar is not the only place where coordinates are displayed. And it does also affect the Properties view, since the flipping should probably be applied to both tile coordinates and the object coordinates:
Thanks for working on this, @divitto, and feel free to ask any additional questions! |
I've been looking over the source code in my spare time the last few days. I think it would help me a lot if you could more clearly define what exactly needs to be done, maybe a high level list of things you would do. I'm having a hard time figuring out where to start so to speak, and i think it stems from not clearly understanding the goal and everything it affects. Thanks for your time i understand you are busy with the real problems. :) |
@divitto So, there are several places that show a tile location to the user. One such location is the hovered coordinate in the status bar. Here's one place where this text is created: By finding usages of In addition, I mentioned the coordinates displayed in the Properties view for a selected object. This happens here: Since we should not confuse the user by presenting two coordinate systems, these coordinates will need to be inverted as well. But internally the coordinates will stay like they are, so when the user changes these values, they need to be inverted again before applying them to the object (in Finally (if I don't forget anything), the Objects view can optionally display object coordinates. This is done over here: Since there are so many places spread over the code where coordinates will need to be inverted, it will make sense to write a small helper class for this, which should check the user preferences (see |
Awesome i understand. I will get right on this as soon as possible. :) |
@bjorn I Believe i have completed the task. The only problem i am having is that if you place an object in standard mode and then switch to inverted coordinates (or vice-versa) the object you placed will not automaticly update it's coordinates in the PropertyBrowser, you have to move the object to make it update the coordinates in the PropertyBrowser. How do i get the PropertyBrowser to update it's display when the user clicks my checkBox in the preferences? I hope that is clear enough, I am still pretty new to the signals and slots system. It seems like i would want to create a signal whenever the checkBox is clicked that is connected to a slot that updates the PropertyBrowser but i can't seem to get it figured out. Otherwise everything looks great, any ideas? |
@divitto Sounds great! Please open a pull request so I could have a look at the implementation. Indeed I expect you have added a boolean property to the |
@bjorn I created the pull request a few days ago but i just noticed the little red X next to my request. Did everything work okay? |
Given the issue I raised in #2040 (comment), I've removed the "good first issue" and "help wanted" labels. Issues with open design questions aren't very good first issues, and I'm not actively looking for help with this issue either. |
At this point, I'm starting to think the correct thing to do is more than just shallow changes; an entire separate fork of Tiled needs to be created and maintained that flips Y at all levels - from UI down to data and data format. The industry has pretty much converged on positive Y being up in 2D and anything otherwise is just pure legacy. I think we need to at some point make an option for a clean break and for those who do, never look back. Could we come up with an effort estimate for that in terms of an initial change list? |
Currently the tiling y-axis starts with the height at 0 at the top and incrementing as it goes down the map. I think it would a be a nice feature, but relatively simple task, to add some kind of checkbox option to invert the Y axis so that (0,0) starts at the bottom and then (0, 1) is the tile above.
Thanks!
The text was updated successfully, but these errors were encountered: