tiled icon indicating copy to clipboard operation
tiled copied to clipboard

Reset default value of class members the same way as for property values.

Open UliAbo opened this issue 2 years ago • 7 comments

Users can reset custom property values by selecting them and hitting their keyboard's "delete" key.

I would love to have the same feature for resetting values of class members as this would feel very logical for me.

Afaik, I currently need to remove the entire class to reset one specific value of a class member within - and this feels quite stressful for me. Or is there another way?

UliAbo avatar Mar 08 '22 20:03 UliAbo

Afaik, I currently need to remove the entire class to reset one specific value of a class member within - and this feels quite stressful for me. Or is there another way?

Yes, the way to reset class members is to click the value. To the right of the edit widget should be a small reset button, which you can use to reset class members:

image

bjorn avatar Mar 09 '22 07:03 bjorn

Oh I didn't know that! Good, that works well. Then I guess this Task here can be resolved?

UliAbo avatar Mar 09 '22 07:03 UliAbo

Oh I didn't know that! Good, that works well. Then I guess this Task here can be resolved?

Let's not close it, because I think making Delete key also perform a reset of the value is still a good idea, for both consistency and usability.

bjorn avatar Mar 09 '22 09:03 bjorn

Good point! Another somehow bit related thing: Is there a reason why within a class the properties are auto-sorted alphabetically, but not in an enum's value list? I would like to have it alphabetically, too.

UliAbo avatar Mar 09 '22 09:03 UliAbo

Another somehow bit related thing: Is there a reason why within a class the properties are auto-sorted alphabetically, but not in an enum's value list? I would like to have it alphabetically, too.

Well, a class is stored internally has a map, so the order is automatically alphabetical and irrelevant. In contrast, the order of the enum values is not irrelevant when the storage format is "number", in which case reordering them affects the values and would hence change the value of existing saved properties as well.

I still think reordering of enum values should be supported, but then we should associate the number value with each entry explicitly (a feature we should eventually have anyway), so that it can move along with the name.

bjorn avatar Mar 09 '22 10:03 bjorn

I think this will then be solved with fixing this bug at the end? https://github.com/mapeditor/tiled/issues/3409

UliAbo avatar Aug 09 '22 14:08 UliAbo

I think this will then be solved with fixing this bug at the end?

No, this issue ended up being about being able to use the Delete key to reset properties. This is still only possible for top-level properties, not yet for properties nested in a class.

bjorn avatar Aug 11 '22 07:08 bjorn