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

bjorn opened this Issue Sep 6, 2017 · 2 comments


None yet
2 participants

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 #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 label Sep 6, 2017


This comment has been minimized.


bjorn commented Sep 6, 2017

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


This comment has been minimized.


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 referenced this issue Sep 6, 2017


Object templates #70

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