Being able to have an array custom property #1493

Open
issy123 opened this Issue Mar 16, 2017 · 9 comments

Comments

Projects
4 participants
@issy123

issy123 commented Mar 16, 2017

Request

It would be nice if we could add a custom property of type array.
Mostly an array of strings.

I can't really see use for other datatypes, so just add array as option (which would be an array of strings)

Example

image

Reason

We currently use a comma seperated list to write down which doors a button would open. But this is prone to errors and prefer an array list.

@TurBoss

This comment has been minimized.

Show comment
Hide comment
@TurBoss

TurBoss Mar 16, 2017

you can use json, i think...

TurBoss commented Mar 16, 2017

you can use json, i think...

@bjorn bjorn added the feature label Mar 16, 2017

@bjorn

This comment has been minimized.

Show comment
Hide comment
@bjorn

bjorn Mar 16, 2017

Owner

While you can of course write JSON or comma separated values in a string property, I do think it would indeed make sense to support array properties explicitly, though it should ideally allow an array of any available type. Alternatively, the elements in the array could each be allowed to be of any type.

Owner

bjorn commented Mar 16, 2017

While you can of course write JSON or comma separated values in a string property, I do think it would indeed make sense to support array properties explicitly, though it should ideally allow an array of any available type. Alternatively, the elements in the array could each be allowed to be of any type.

@issy123

This comment has been minimized.

Show comment
Hide comment
@issy123

issy123 Mar 16, 2017

@bjorn What use case would satisfy the need of having any type of array?
I can only see a use case in string arrays.

Also why heterogeneous arrays? If they need heterogeneous arrays let them add custom properties of that type. This would also add complexity to parsing this, because you need to check for each array item what type it is.

It's fine by me adding those other types of arrays but it would create a huge list of options and maybe make them confused or being not user-friendly.

issy123 commented Mar 16, 2017

@bjorn What use case would satisfy the need of having any type of array?
I can only see a use case in string arrays.

Also why heterogeneous arrays? If they need heterogeneous arrays let them add custom properties of that type. This would also add complexity to parsing this, because you need to check for each array item what type it is.

It's fine by me adding those other types of arrays but it would create a huge list of options and maybe make them confused or being not user-friendly.

@EJlol

This comment has been minimized.

Show comment
Hide comment
@EJlol

EJlol Mar 17, 2017

I definitely can see use cases for other types too. A few use cases I can come up with:
A Chest object that contains several items (id / integer)
A Monster spawn area with several recolored monsters (color)
A light object that sends some kind of morse code (boolean)

EJlol commented Mar 17, 2017

I definitely can see use cases for other types too. A few use cases I can come up with:
A Chest object that contains several items (id / integer)
A Monster spawn area with several recolored monsters (color)
A light object that sends some kind of morse code (boolean)

@bjorn

This comment has been minimized.

Show comment
Hide comment
@bjorn

bjorn Mar 17, 2017

Owner

Also why heterogeneous arrays? If they need heterogeneous arrays let them add custom properties of that type. This would also add complexity to parsing this, because you need to check for each array item what type it is.

There shouldn't be much additional complexity to parsing heterogeneous arrays than to parsing heterogeneous property values. Anyway, the reason I considered it is because it is the normal state of affairs for any dynamically typed language. The type is associated with each value rather than with the array, and this is something many people are used to working with. It's also how JSON arrays work. So actually enforcing that each value be of the same type may be more complicated than just allowing them to have different types.

That said, I do agree the use-case is rare, so I will leave both options open until we can evaluate them while implementing this feature.

It's fine by me adding those other types of arrays but it would create a huge list of options and maybe make them confused or being not user-friendly.

That depends on how it is implemented. Most of the work is probably going to be in adjusting the Properties view to be able to work with arrays and allowing to add/remove elements. Maybe it can be done inline, or maybe it makes more sense to spawn a dialog for this. And all this work is not going to be much harder if any data is supported rather than just supporting strings.

So I'm not talking about adding just a "string array" type of property, but rather adding an "Array" checkbox separate of the type (or adding just an "array" property type, if values will be allowed to be heterogeneous).

Owner

bjorn commented Mar 17, 2017

Also why heterogeneous arrays? If they need heterogeneous arrays let them add custom properties of that type. This would also add complexity to parsing this, because you need to check for each array item what type it is.

There shouldn't be much additional complexity to parsing heterogeneous arrays than to parsing heterogeneous property values. Anyway, the reason I considered it is because it is the normal state of affairs for any dynamically typed language. The type is associated with each value rather than with the array, and this is something many people are used to working with. It's also how JSON arrays work. So actually enforcing that each value be of the same type may be more complicated than just allowing them to have different types.

That said, I do agree the use-case is rare, so I will leave both options open until we can evaluate them while implementing this feature.

It's fine by me adding those other types of arrays but it would create a huge list of options and maybe make them confused or being not user-friendly.

That depends on how it is implemented. Most of the work is probably going to be in adjusting the Properties view to be able to work with arrays and allowing to add/remove elements. Maybe it can be done inline, or maybe it makes more sense to spawn a dialog for this. And all this work is not going to be much harder if any data is supported rather than just supporting strings.

So I'm not talking about adding just a "string array" type of property, but rather adding an "Array" checkbox separate of the type (or adding just an "array" property type, if values will be allowed to be heterogeneous).

@issy123

This comment has been minimized.

Show comment
Hide comment
@issy123

issy123 Oct 17, 2017

4 upvotes, looks like they want it.

@bjorn is it going to be implemented?

issy123 commented Oct 17, 2017

4 upvotes, looks like they want it.

@bjorn is it going to be implemented?

@bjorn

This comment has been minimized.

Show comment
Hide comment
@bjorn

bjorn Oct 17, 2017

Owner

@issy123 Yes, it's going to be implemented. But currently I'm trying to focus on getting Tiled 1.1 out since there are already plenty of new features since 1.0. But unfortunately there are some things that remain to be done as seen on the Roadmap.

Owner

bjorn commented Oct 17, 2017

@issy123 Yes, it's going to be implemented. But currently I'm trying to focus on getting Tiled 1.1 out since there are already plenty of new features since 1.0. But unfortunately there are some things that remain to be done as seen on the Roadmap.

@issy123

This comment has been minimized.

Show comment
Hide comment
@issy123

issy123 Oct 17, 2017

Awesome man!
I never knew github has such feature.

I'll be sure to support you on patreon!

issy123 commented Oct 17, 2017

Awesome man!
I never knew github has such feature.

I'll be sure to support you on patreon!

@bjorn

This comment has been minimized.

Show comment
Hide comment
@bjorn

bjorn Oct 17, 2017

Owner

Thanks, that's really appreciated!

Owner

bjorn commented Oct 17, 2017

Thanks, that's really appreciated!

@bjorn bjorn added this to Future in Roadmap Nov 21, 2017

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