Skip to content
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

Allow locking template properties #1726

Open
bjorn opened this issue Sep 6, 2017 · 2 comments
Open

Allow locking template properties #1726

bjorn opened this issue Sep 6, 2017 · 2 comments
Labels
feature It's a feature, not a bug.

Comments

@bjorn
Copy link
Member

bjorn commented Sep 6, 2017

A locked template property can't be changed on the instance level. This is mostly useful for restricting what can be done with a template, to simplify their use and avoid invalid scenarios for the game.

Supporting this feature will be a little complicated, since it will affect existing code in various places:

  • The "Select Objects" tool will need to take into account locked Rotation and Size, to avoid showing rotation or resize handles for such objects, and to avoid changing rotation or size of such objects when they are part of a group of selected objects.

  • The Properties view will need to disable the locked properties. That's probably the easiest bit. However, if the property was already changed before it was locked at the template level, it should probably still be possible to reset the property (issue Allow resetting overridden properties individually for template instances  #1725). At least I don't think locking a property should automatically unset it on all instances.

The process of locking a property can probably be done by adding a small lock icon next to each relevant property in the Properties view, when a template is selected. The same icon could be shown in a read-only way when instances are selected, to make it extra clear why some property can't be changed.

Problematic are properties without representation in the Properties view:

  • For polygon and polyline objects, we may want to lock their geometry. Maybe we should add a dummy property for this where we could feature the lock button. This would of course affect the "Edit Polygons" tool.

  • For tile objects, we may want to lock their tile. Again we probably would need to show a property for this. This lock would affect the "Replace Tile" action in the context menu.

@bjorn bjorn added the feature It's a feature, not a bug. label Sep 6, 2017
@bjorn
Copy link
Member Author

bjorn commented Sep 6, 2017

@thabetx Since you initially brought up this feature, feel free to add any further insights.

@thabetx
Copy link
Contributor

thabetx commented Sep 6, 2017

Your description is pretty good. I've started working on this feature but it turned out to be more complicated than what I expected.

I finished a good amount of the property browser related stuff, and allowed saving the locked properties with the templates. But I didn't get around to modify graphical editing of the locked properties like rotation or the properties not represented in the dock that you mentioned above.

I plan to open a new pull request soon to show the current work.

@bjorn bjorn mentioned this issue Sep 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature It's a feature, not a bug.
Projects
None yet
Development

No branches or pull requests

2 participants