-
-
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
Connecting Objects #707
Comments
This suggestion has come up before but you have thought it through and illustrated it really well. Thanks! When this gets implemented, care should also be taken that these connections are a good fit for defining joints between bodies for games using a physics library. Unfortunately it's impossible for me to say when I might get around to implementing this. In my current situation, unless somebody does a pull request or sponsors the feature it is unlikely to happen. |
What's involved in sponsoring a feature? |
I was somewhat afraid you would ask me that, since it's a busy time at work and at home so it's a little bit tricky to set time aside right now. Yet, the idea is that we agree on a fair compensation for the time I expect to spend on it and then I will prioritize it over other activities. If you're interested, please contact me privately about this at [email protected] and include information about when you would need this feature to be done. |
I'd potentially be interested in helping implement something like this. I used Tiled in a project at University last year and I had to work around this by referencing the name of an object in a custom property, so a connecting objects feature would've been really useful. Since you mentioned using object connections in order to model physical constraints between items, I was thinking each connection would need its own property or set of properties in order to specify the type of constraint (since a physical constraint could be rigid, elastic, rotary, slider, etc). What are your thoughts about the best way to show this in the Object Property dock? |
@naiello First of all, thanks for offering to help with this! Thinking about your question, I considered that actually a physical constraint between two objects would really just need to be its own object, since it would need its own set of custom properties for defining the parameters. And two of these parameters would be the actual "connection" to other objects, or most commonly, the bodyA and bodyB involved in the constraint. So I think the way to do this will be to add types to custom properties, and one of those types would be "Object reference" / "Link". That way, the custom property system can be used to add any number of named connections to other objects. Tiled now already has a simple system by which each object gets its own unique ID, so these IDs can be used as the values of these properties. When a custom property is added of this special type, a button would be available that allows choosing an object from the scene to connect to. I think also a text input should be available in which you could search objects by name to make the link. This could look similar to the file reference properties that you find for example as the "Image" property of an "Image Layer". Note that quite some work was previously done on this and submitted as pull request #182, but this code was never cleaned up and has meanwhile gotten very outdated. You could look at it but I'd recommend a fresh start. |
I reiterate the usefulness of this feature |
@lucasdealmeidasm I totally agree this feature would be very useful. I've added it now to the Roadmap so that I will remember to get around to it. |
I would flip shit if you could get this whenever @bjorn. This would be so, so amazing. But take your time, no rush! I know in HTML 5's canvas |
While I think there is a place for the plethora of features requested throughout this issue, I can't help but feel a simple "Object" property type would suffice. In the same way that the "File" type opens the native OS file browser, and "Color" opens a native color picker, I think all that would be needed is a button for the object value that puts the mouse in a selection mode let's users click an existing object. Which will of course insert that object's uuid as the value. |
And to be clear, this would only store the property on the object it was added to. Just like every other property. This would also work well for paths/waypoints, as each segment could have a pointer to the next, like a linked list. |
@rosshadden Definitely, that's exactly what I meant to say with my comment from October last year. I really need to see about getting around to this feature soon. |
@rosshadden Multiple connections? |
You would simply add another property, pointing to another object. |
Again though, this is a pretty basic implementation, not a robust one. I do think multiple connections could be a lot better, but I also want to see this get implemented sometime soon 😋 |
@rosshadden ok. |
Seeing, that there was no activity since 2016, is there any hope of seeing this feature in the future? Imo, this is one of the core features of any editor. |
Yes there is quite a lot of hope. I get the feeling @bjorn wants to implement this in some capacity because of the way he has mentioned it or discussed it in many other issues. Whether it's the feature-filled request in the OP, my watered-down version that I outlined a couple years ago, or something else entirely remains to be seen. It's also listed in the roadmap so he hasn't forgotten about it, but not slated for the upcoming 1.3 release so it isn't a high priority for him yet. I disagree with the last part you said about it being "one of the core features of any editor", but I'm sure your intentions are good and you are just enthusiastic about making an amazing tool even better 😎. |
Well, I don't understand, how it can be low priority and not core functionality. Without linking I cannot do the most basic things like linking button to the gate, so it will open, when the button is pressed. Yes, there are clunky workarounds, but they are, well, clunky. |
bump I am now using objects in Tiled and it would be fantastic to be able to link objects so I know which two doors are related and also so I know which key unlocks one of those doors :) |
This feature has been on the roadmap since a while, but so far kept being pushed forward due to other features taking priority. It was not essential for the Tiled 1.0 release, which had already grown much too large in itself anyway. Then Tiled 1.1 was mostly driven by the Google Summer of Code 2017, where this feature had been a suggested project but our students had picked other projects. Then Tiled 1.2 was mostly driven by direct requests from a few major patrons (though they requested features that benefited most people). And now for Tiled 1.3 I have picked a few important issues that I've been wanting to get around to since a long time as well. As it stands now, this issue would definitely be included in Tiled 1.4 if I were to plan it now. That said, the roadmap is not set in stone and for Tiled 1.3 I have so far only worked towards scriptability and configurable shortcuts. If there is more demand for connecting objects than for project support, then it could be swapped. |
looking forward to hopefully seeing this in 1.4, i too have the clunky workaround problem as my doors go over two tiles so linking inside tiled would be great |
suggestion 1. something such simple, easy could be done via scripting, if allow render some custom shapes (svg / canvas / glsl / existing primitives from objects - just disable selection, or let it be done over scripting too), same goes for showing / hiding stuff - easy can be done via scripts suggestion 2.
where 12 - is index relative {
"name": "onKey[a]",
"type": "string",
"value": "Move.west"
} they are quite simple - why not create API for scripting to allow users define they own custom types, (im not sure about XML) - but from json format - it looks quite easy to change create api for registering new type, and then just setting it as any type you wont just from script:
|
I would object references, and I have some suggestions.
|
This commit was based heavily on simlrh's PR of the same name, mapeditor#1408. Addresses some parts of issue mapeditor#707.
Today I've made some progress on visualizing the connections between objects, based on the new "object" custom property type: The patch still needs some work to make sure the lines are added/removed as appropriate, to change it to an arrow so that the direction is clear and to make this overlay optional. The shadow is also not rendering correctly when zoomed in. I rendered the lines in yellow here, but I think it would make sense to follow the target object's color. And maybe they should be dashed to make them look less like a polyline object. |
Visualization now committed to Final step for now would be implementing visually making, breaking and changing connections. I'm not entirely sure how I would implement this yet, but I guess it would make sense to make a separate tool for it. And then there should be a small button next to object reference properties that triggers this tool for choosing the target object. |
Looking great! |
Yeah, that's looking awesome 🔥 |
I'm going to close this and await further feedback to see what would be good to improve in upcoming releases. Here's a short list of potential further improvements:
Any other suggestions are welcome! |
Currently looking through Tiled to see if I can use it for a couple of my projects. I can get round most of my issues ( default properties on objects, easily creating objects of type ), but the one feature that would find very useful is the ability to connect two objects.
Sometimes you want to have a relationship between two objects, and you would like that relationship to by sticky. So it would be handy if you could select a connecting tool ( some combination of shift/alt/ctrl and select of object ) and drag a connection from one object to another.
You could have multiple connections from and to objects.
A connecting line would be visible on screen.
A connecting line could have name and properties to allow definition of the relationship.
Deleting an object would remove all connections on other objects.
For now workarounds are to place the name of an object into the properties of another object. But a visual process would be much nicer. I have looked at using the Polyline but not being able to resize is a pain, and not sticking to an object when you move it is more the real problem. Being able to meld the Polyline to objects would be a solution.
The text was updated successfully, but these errors were encountered: