Add some better handling for Highlights, add copy/paste buttons for colors.

This commit is contained in:
Ottermandias 2024-01-18 00:50:06 +01:00
parent 805e192d63
commit d13e3ccbd7
5 changed files with 113 additions and 36 deletions

View file

@ -210,8 +210,8 @@ public class StateEditor
}
/// <summary> Change the customize flags of a character. </summary>
public bool ChangeParameter(ActorState state, CustomizeParameterFlag flag, CustomizeParameterValue value, StateChanged.Source source, out CustomizeParameterValue oldValue,
uint key = 0)
public bool ChangeParameter(ActorState state, CustomizeParameterFlag flag, CustomizeParameterValue value, StateChanged.Source source,
out CustomizeParameterValue oldValue, uint key = 0)
{
oldValue = state.ModelData.Parameters[flag];
if (!state.CanUnlock(key))
@ -219,6 +219,7 @@ public class StateEditor
state.ModelData.Parameters.Set(flag, value);
state[flag] = source;
return true;
}

View file

@ -312,6 +312,10 @@ public class StateManager(
public void ChangeCustomizeParameter(ActorState state, CustomizeParameterFlag flag, CustomizeParameterValue value,
StateChanged.Source source, uint key = 0)
{
// Also apply main color to highlights when highlights is off.
if (!state.ModelData.Customize.Highlights && flag is CustomizeParameterFlag.HairDiffuse)
ChangeCustomizeParameter(state, CustomizeParameterFlag.HairHighlight, value, source, key);
if (!_editor.ChangeParameter(state, flag, value, source, out var old, key))
return;
@ -410,6 +414,12 @@ public class StateManager(
foreach (var flag in CustomizeParameterExtensions.AllFlags.Where(design.DoApplyParameter))
_editor.ChangeParameter(state, flag, design.DesignData.Parameters[flag], paramSource, out _, key);
// Do not apply highlights from a design if highlights is unchecked.
if (!state.ModelData.Customize.Highlights)
_editor.ChangeParameter(state, CustomizeParameterFlag.HairHighlight,
state.ModelData.Parameters[CustomizeParameterFlag.HairDiffuse],
state[CustomizeParameterFlag.HairDiffuse], out _, key);
}
var actors = ApplyAll(state, redraw, false);