Connecting Objects #707

Open
IcemarkUK opened this Issue Jul 29, 2014 · 15 comments

Comments

Projects
None yet
5 participants
@IcemarkUK

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.

screen-shot-2014-07-29-at-17 58 27

screen-shot-2014-07-29-at-17 54

@bjorn bjorn added the Feature label Jul 29, 2014

@bjorn

This comment has been minimized.

Show comment
Hide comment
@bjorn

bjorn Jul 29, 2014

Owner

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.

Owner

bjorn commented Jul 29, 2014

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.

@IcemarkUK

This comment has been minimized.

Show comment
Hide comment
@IcemarkUK

IcemarkUK Jul 29, 2014

What's involved in sponsoring a feature?

What's involved in sponsoring a feature?

@bjorn

This comment has been minimized.

Show comment
Hide comment
@bjorn

bjorn Jul 29, 2014

Owner

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 bjorn@lindeijer.nl and include information about when you would need this feature to be done.

Owner

bjorn commented Jul 29, 2014

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 bjorn@lindeijer.nl and include information about when you would need this feature to be done.

@naiello

This comment has been minimized.

Show comment
Hide comment
@naiello

naiello Oct 6, 2015

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 commented Oct 6, 2015

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?

@bjorn

This comment has been minimized.

Show comment
Hide comment
@bjorn

bjorn Oct 6, 2015

Owner

@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.

Owner

bjorn commented Oct 6, 2015

@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.

@kdrnic

This comment has been minimized.

Show comment
Hide comment
@kdrnic

kdrnic Aug 14, 2016

I reiterate the usefulness of this feature

kdrnic commented Aug 14, 2016

I reiterate the usefulness of this feature

@bjorn

This comment has been minimized.

Show comment
Hide comment
@bjorn

bjorn Aug 15, 2016

Owner

@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.

Owner

bjorn commented Aug 15, 2016

@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.

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Nov 17, 2016

I'm doing Warping right now:
image

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 lineTo is used and relatively speaking math isn't probably a problem for you. Not sure what to use in your system. I'd argue your time is what is at play than silly math. But yeah, this feature would be extremely beneficial. Also, it would be awesome for a future teaser trailer of tiled and showcase the new additions!

ghost commented Nov 17, 2016

I'm doing Warping right now:
image

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 lineTo is used and relatively speaking math isn't probably a problem for you. Not sure what to use in your system. I'd argue your time is what is at play than silly math. But yeah, this feature would be extremely beneficial. Also, it would be awesome for a future teaser trailer of tiled and showcase the new additions!

@rosshadden

This comment has been minimized.

Show comment
Hide comment
@rosshadden

rosshadden Nov 24, 2016

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.

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.

@rosshadden

This comment has been minimized.

Show comment
Hide comment
@rosshadden

rosshadden Nov 24, 2016

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.

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.

@bjorn

This comment has been minimized.

Show comment
Hide comment
@bjorn

bjorn Nov 24, 2016

Owner

@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.

Owner

bjorn commented Nov 24, 2016

@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.

@IcemarkUK

This comment has been minimized.

Show comment
Hide comment
@IcemarkUK

IcemarkUK Nov 24, 2016

@rosshadden Multiple connections?

@rosshadden Multiple connections?

@rosshadden

This comment has been minimized.

Show comment
Hide comment
@rosshadden

rosshadden Nov 24, 2016

You would simply add another property, pointing to another object.

You would simply add another property, pointing to another object.

@rosshadden

This comment has been minimized.

Show comment
Hide comment
@rosshadden

rosshadden Nov 24, 2016

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 imemented sometime soon 😋

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 imemented sometime soon 😋

@IcemarkUK

This comment has been minimized.

Show comment
Hide comment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment