mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2026-02-19 05:57:42 +01:00
Improve advanced dye stuff.
This commit is contained in:
parent
a194f88903
commit
10962cac6c
16 changed files with 342 additions and 113 deletions
|
|
@ -278,7 +278,7 @@ public class StateApplier(
|
|||
|
||||
public unsafe void ChangeMaterialValue(ActorData data, MaterialValueIndex index, ColorRow? value, bool force)
|
||||
{
|
||||
if (!force && !_config.UseAdvancedParameters)
|
||||
if (!force && !_config.UseAdvancedDyes)
|
||||
return;
|
||||
|
||||
foreach (var actor in data.Objects.Where(a => a is { IsCharacter: true, Model.IsHuman: true }))
|
||||
|
|
|
|||
|
|
@ -172,7 +172,8 @@ public class StateEditor(
|
|||
return;
|
||||
|
||||
var actors = Applier.ChangeMaterialValue(state, index, settings.Source.RequiresChange());
|
||||
Glamourer.Log.Verbose($"Set material value in state {state.Identifier.Incognito(null)} from {oldValue} to {newValue.Game}. [Affecting {actors.ToLazyString("nothing")}.]");
|
||||
Glamourer.Log.Verbose(
|
||||
$"Set material value in state {state.Identifier.Incognito(null)} from {oldValue} to {newValue.Game}. [Affecting {actors.ToLazyString("nothing")}.]");
|
||||
StateChanged.Invoke(StateChanged.Type.MaterialValue, settings.Source, state, actors, (oldValue, newValue.Game, index));
|
||||
}
|
||||
|
||||
|
|
@ -288,13 +289,25 @@ public class StateEditor(
|
|||
if (!value.Enabled)
|
||||
continue;
|
||||
|
||||
var idx = MaterialValueIndex.FromKey(key);
|
||||
// TODO
|
||||
//if (state.Materials.TryGetValue(idx, out var materialState))
|
||||
//{
|
||||
// if (!settings.RespectManual || materialState.Source.IsManual())
|
||||
// Editor.ChangeMaterialValue(state, idx, new MaterialValueState(materialState.Game, value.Value, materialState.DrawData));
|
||||
//}
|
||||
var idx = MaterialValueIndex.FromKey(key);
|
||||
var source = settings.Source.SetPending();
|
||||
if (state.Materials.TryGetValue(idx, out var materialState))
|
||||
{
|
||||
if (settings.RespectManual && !materialState.Source.IsManual())
|
||||
continue;
|
||||
|
||||
if (value.Revert)
|
||||
Editor.ChangeMaterialValue(state, idx, default, StateSource.Game, out _, settings.Key);
|
||||
else
|
||||
Editor.ChangeMaterialValue(state, idx,
|
||||
new MaterialValueState(materialState.Game, value.Value, materialState.DrawData, source), settings.Source, out _,
|
||||
settings.Key);
|
||||
}
|
||||
else if (!value.Revert)
|
||||
{
|
||||
Editor.ChangeMaterialValue(state, idx, new MaterialValueState(ColorRow.Empty, value.Value, CharacterWeapon.Empty, source),
|
||||
settings.Source, out _, settings.Key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -321,7 +334,8 @@ public class StateEditor(
|
|||
public void ApplyDesign(object data, DesignBase design, ApplySettings settings)
|
||||
{
|
||||
var merged = settings.MergeLinks && design is Design d
|
||||
? merger.Merge(d.AllLinks, ((ActorState)data).ModelData.Customize, ((ActorState)data).BaseData, false, Config.AlwaysApplyAssociatedMods)
|
||||
? merger.Merge(d.AllLinks, ((ActorState)data).ModelData.Customize, ((ActorState)data).BaseData, false,
|
||||
Config.AlwaysApplyAssociatedMods)
|
||||
: new MergedDesign(design);
|
||||
|
||||
ApplyDesign(data, merged, settings with
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ using Glamourer.Designs.Links;
|
|||
using Glamourer.Events;
|
||||
using Glamourer.GameData;
|
||||
using Glamourer.Interop;
|
||||
using Glamourer.Interop.Material;
|
||||
using Glamourer.Interop.Penumbra;
|
||||
using Glamourer.Interop.Structs;
|
||||
using Glamourer.Services;
|
||||
|
|
@ -11,6 +12,7 @@ using Penumbra.GameData.Actors;
|
|||
using Penumbra.GameData.DataContainers;
|
||||
using Penumbra.GameData.Enums;
|
||||
using Penumbra.GameData.Structs;
|
||||
using System;
|
||||
|
||||
namespace Glamourer.State;
|
||||
|
||||
|
|
@ -265,9 +267,16 @@ public sealed class StateManager(
|
|||
|
||||
var actors = ActorData.Invalid;
|
||||
if (source is not StateSource.Game)
|
||||
{
|
||||
actors = Applier.ChangeParameters(state, CustomizeParameterExtensions.All, true);
|
||||
foreach (var (idx, mat) in state.Materials.Values)
|
||||
Applier.ChangeMaterialValue(actors, MaterialValueIndex.FromKey(idx), mat.Game, true);
|
||||
}
|
||||
|
||||
state.Materials.Clear();
|
||||
|
||||
Glamourer.Log.Verbose(
|
||||
$"Reset advanced customization state of {state.Identifier.Incognito(null)} to game base. [Affecting {actors.ToLazyString("nothing")}.]");
|
||||
$"Reset advanced customization and dye state of {state.Identifier.Incognito(null)} to game base. [Affecting {actors.ToLazyString("nothing")}.]");
|
||||
StateChanged.Invoke(StateChanged.Type.Reset, source, state, actors, null);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue