-
Notifications
You must be signed in to change notification settings - Fork 649
Add named terrain layers #3021
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
Add named terrain layers #3021
Conversation
Makes the name shorter, fits into comboboxes more easily
| /// The layers names. | ||
| /// </summary> | ||
| [EditorOrder(10), EditorDisplay("Terrain Layers", EditorDisplayAttribute.InlineStyle), Collection(CanResize = false, Display = CollectionAttribute.DisplayType.Inline)] | ||
| public string[] TerrainLayers = Enumerable.Repeat(string.Empty, 8).ToArray(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make it inlined to reduce engine startup time (JIT won't need to use Linq).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 75d4a11.
I also had to remove the ToArray(), which leads to the Terrain layer names being populated with Layer {index} by default:

Before it looked like this:

The new behavior might actually make more sense because there will always be 8 terrain layers, so they all need names (unlike f.e. "normal" layers).
However if that's a problem I can try to find a solution.
Adds the ability to assign names to terrain layers via a new section Terrain Layers in Layers And Tags Settings.
Uses a custom editor (
TerrainLayerEditor) to display the names.If there is no name assigned in the settings, the layer is displayed as "Layer" + layer index (f.e. "Layer 1").
It'd be cool if someone could test this a bit. I did some testing, but it was so much more easy to implement than I expected, I'm worried I missed something.
I'd like to receive feedback on
LayersAndTagsSettings.GetCurrentTerrainLayers(), especially about the part where I load the settings.