Skip to content

Conversation

@xxSeys1
Copy link
Contributor

@xxSeys1 xxSeys1 commented Oct 25, 2024

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.

image
image
image

Makes the name shorter, fits into comboboxes more easily
@mafiesto4 mafiesto4 added enhancement New feature or request terrain labels Nov 5, 2024
@mafiesto4 mafiesto4 added this to the 1.10 milestone Nov 5, 2024
/// 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();
Copy link
Member

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).

Copy link
Contributor Author

@xxSeys1 xxSeys1 Nov 16, 2024

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:
image
Before it looked like this:
image

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.

@xxSeys1 xxSeys1 requested a review from mafiesto4 November 16, 2024 16:31
@xxSeys1 xxSeys1 requested a review from mafiesto4 November 23, 2024 16:17
@flaxtechnology flaxtechnology merged commit 6146ea8 into FlaxEngine:master Nov 26, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request terrain

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants