Skip to content

Conversation

@Sakura-Luna
Copy link

I found that the presets could not be applied because its organization is very messy.
This commit does two things:

  • Provides an "Order" priority for preset to ensure execution order
  • Ignores applying all default presets

@JasonMa0012
Copy link
Owner

I think adding the order is indeed helpful, but the default value of order (-1) does not affect the default value of the current material, which might lead to some misunderstandings.

What was your reason for adding this feature?

@Sakura-Luna
Copy link
Author

I think adding the order is indeed helpful, but the default value of order (-1) does not affect the default value of the current material, which might lead to some misunderstandings.

What was your reason for adding this feature?

If you're referring to preset.order, initially I tried to configure the order for each preset, so I added a default value. However, I realized it would increase management overhead, and now the -1 is just a placeholder so I can clean it up.

@JasonMa0012
Copy link
Owner

I want to ask what the intention is behind "Ignores applying all default presets"?

@Sakura-Luna
Copy link
Author

I want to ask what the intention is behind "Ignores applying all default presets"?

I haven't fully reviewed this project, but I've noticed that every setup includes all associated default presets, which is clearly problematic. The solution is to either prepend all default presets or ignore them. Considering that users may apply presets multiple times, it's valuable to separate them.
If the default presets are needed, refresh them individually, just once.

@Sakura-Luna
Copy link
Author

This is exactly why I say that the preset organization is confusing, because there is no way to confirm whether the preset obtained is from the user, which makes the default preset have two meanings. To simplify this problem, the configuration of the default preset should use another entry.

@JasonMa0012
Copy link
Owner

In certain cases, all active presets must be applied, for example:

  1. Creating materials
  2. Resetting materials

LWGUI determines the default values under the current material settings by creating a new material and then compares them with existing values to decide whether to display the undo button.

If all presets are not applied when creating a material, the default values are only influenced by the Shader, which contradicts the original design intention of the PresetDrawer.

Additionally, if there are overlapping properties among multiple active presets, their priority should be from top to bottom, meaning that properties lower in the material editor have higher priority.

@JasonMa0012
Copy link
Owner

This is exactly why I say that the preset organization is confusing, because there is no way to confirm whether the preset obtained is from the user, which makes the default preset have two meanings. To simplify this problem, the configuration of the default preset should use another entry.

I'm sorry, I didn't understand your point. Could you provide a specific example and screenshot?

@Sakura-Luna
Copy link
Author

Additionally, if there are overlapping properties among multiple active presets, their priority should be from top to bottom, meaning that properties lower in the material editor have higher priority.

I don't quite understand what you mean. A higher priority means that the configuration is kept first, which means it is applied later, which is consistent with the ascending order. If the configuration below is more important, its order needs to be greater than the one above.

@JasonMa0012
Copy link
Owner

Yes, the order of props generation is consistent with the order arranged in the Shader. Therefore, the lower the position, the later the preset is applied.

@Sakura-Luna
Copy link
Author

Set preset before filter: Alpha, Both, Default, Default, Default, Disabled, Opaque, (None), Default, (None), Default, (None), (None), (None).
Set preset: Alpha, Both is Done.

This is a before and after comparison of the results of applying a material. The first two items are from the user and are invalid because they are overwritten by the default preset.

@Sakura-Luna
Copy link
Author

As I said before, if you need to apply the default configuration, you should use another entry. On the one hand, you cannot confirm the source of the configuration, and on the other hand, the default presets also need to be sorted.

@JasonMa0012
Copy link
Owner

Did you encounter this issue when calling PresetHelper.ApplyPresetsInMaterial()?

And you want to apply only the Alpha/Both user-modified Presets, skipping other unmodified PresetDrawers, correct?

@Sakura-Luna
Copy link
Author

Sakura-Luna commented Oct 13, 2025

Did you encounter this issue when calling PresetHelper.ApplyPresetsInMaterial()?

Yes.

And you want to apply only the Alpha/Both user-modified Presets, skipping other unmodified PresetDrawers, correct?

No, but due to the default values ​​for newly created materials, there is no need to apply a default preset. If you want the default presets to be included, just use lwguiShaderPropertyPreset.order + (index != 0 ? 0 : int.MinValue).

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants