mirror of
https://github.com/xivdev/Penumbra.git
synced 2026-02-08 08:54:39 +01:00
Update IEditors to use Luna, update Combos.
Some checks failed
.NET Build / build (push) Has been cancelled
Some checks failed
.NET Build / build (push) Has been cancelled
This commit is contained in:
parent
5e0a8a543a
commit
97a14db4d5
26 changed files with 87 additions and 116 deletions
2
Luna
2
Luna
|
|
@ -1 +1 @@
|
|||
Subproject commit 3d5e7105f2671d741416988be95a5dba773adaf5
|
||||
Subproject commit e52d0dab9fd7f64d108125b79e387052fae2434f
|
||||
|
|
@ -4,6 +4,7 @@ using Luna;
|
|||
using Penumbra.Api.Enums;
|
||||
using Penumbra.Api.IpcSubscribers;
|
||||
using Penumbra.GameData.Data;
|
||||
using Penumbra.UI;
|
||||
|
||||
namespace Penumbra.Api.IpcTester;
|
||||
|
||||
|
|
@ -26,7 +27,7 @@ public class CollectionsIpcTester(IDalamudPluginInterface pi) : IUiService
|
|||
if (!_)
|
||||
return;
|
||||
|
||||
EnumCombo<ApiCollectionType>.Instance.Draw("Collection Type"u8, ref _type, default, 200 * Im.Style.GlobalScale);
|
||||
Combos.ApiCollectionType.Draw("Collection Type"u8, ref _type, default, 200 * Im.Style.GlobalScale);
|
||||
Im.Input.Scalar("Object Index##Collections"u8, ref _objectIdx);
|
||||
if (_collectionId.HasValue)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ using Dalamud.Plugin;
|
|||
using ImSharp;
|
||||
using Penumbra.Api.Enums;
|
||||
using Penumbra.Api.IpcSubscribers;
|
||||
using Penumbra.UI;
|
||||
|
||||
namespace Penumbra.Api.IpcTester;
|
||||
|
||||
|
|
@ -28,7 +29,7 @@ public class EditingIpcTester(IDalamudPluginInterface pi) : Luna.IUiService
|
|||
Im.Input.Text("##outputPath"u8, ref _outputPath, "Output Texture Path..."u8);
|
||||
Im.Input.Text("##inputPath2"u8, ref _inputPath2, "Input Texture Path 2..."u8);
|
||||
Im.Input.Text("##outputPath2"u8, ref _outputPath2, "Output Texture Path 2..."u8);
|
||||
EnumCombo<TextureType>.Instance.Draw("Convert To"u8, ref _typeSelector, StringU8.Empty, 200 * Im.Style.GlobalScale);
|
||||
Combos.TextureType.Draw("Convert To"u8, ref _typeSelector, StringU8.Empty, 200 * Im.Style.GlobalScale);
|
||||
Im.Checkbox("Add MipMaps"u8, ref _mipMaps);
|
||||
|
||||
using var table = Im.Table.Begin("..."u8, 3, TableFlags.SizingFixedFit);
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ using Penumbra.Api.IpcSubscribers;
|
|||
using Penumbra.GameData.Enums;
|
||||
using Penumbra.GameData.Interop;
|
||||
using Penumbra.GameData.Structs;
|
||||
using Penumbra.UI;
|
||||
|
||||
namespace Penumbra.Api.IpcTester;
|
||||
|
||||
|
|
@ -34,7 +35,7 @@ public class ResourceTreeIpcTester(IDalamudPluginInterface pi, ObjectManager obj
|
|||
return;
|
||||
|
||||
Im.Input.Text("GameObject indices"u8, ref _gameObjectIndices);
|
||||
EnumCombo<ResourceType>.Instance.Draw("Resource type"u8, ref _type, default, Im.Item.CalculateWidth());
|
||||
Combos.ResourceType.Draw("Resource type"u8, ref _type, default, Im.Item.CalculateWidth());
|
||||
Im.Checkbox("Also get names and icons"u8, ref _withUiData);
|
||||
|
||||
using var table = Im.Table.Begin(StringU8.Empty, 3, TableFlags.SizingFixedFit);
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ using ImSharp;
|
|||
using Penumbra.Api.Enums;
|
||||
using Penumbra.Api.Helpers;
|
||||
using Penumbra.Api.IpcSubscribers;
|
||||
using Penumbra.UI;
|
||||
using MouseButton = Penumbra.Api.Enums.MouseButton;
|
||||
|
||||
namespace Penumbra.Api.IpcTester;
|
||||
|
|
@ -61,7 +62,7 @@ public class UiIpcTester : Luna.IUiService, IDisposable
|
|||
return;
|
||||
|
||||
Im.Input.Text("##openMod"u8, ref _modName, "Mod to Open at..."u8);
|
||||
EnumCombo<TabType>.Instance.Draw("Tab to Open at"u8, ref _selectTab, default, Im.Item.CalculateWidth());
|
||||
Combos.TabType.Draw("Tab to Open at"u8, ref _selectTab, default, Im.Item.CalculateWidth());
|
||||
using var table = Im.Table.Begin(StringU8.Empty, 3, TableFlags.SizingFixedFit);
|
||||
if (!table)
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ public readonly record struct EstEntry(ushort Value)
|
|||
}
|
||||
}
|
||||
|
||||
public static partial class EstTypeExtension
|
||||
public static partial class EstTypeExtensions
|
||||
{
|
||||
public static string ToSuffix(this EstType type)
|
||||
=> type switch
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=ui_005Ccombos/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=ui_005Cmodstab_005Cselector_005Cbuttons/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=ui_005Cmodstab_005Cselector_005Cfilter/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
||||
|
|
@ -8,7 +8,7 @@ using Penumbra.GameData.Files.StainMapStructs;
|
|||
using Penumbra.Interop.Services;
|
||||
using Penumbra.Interop.Structs;
|
||||
using Penumbra.UI.AdvancedWindow.Materials;
|
||||
using FilterComboColors = Penumbra.UI.Classes.FilterComboColors;
|
||||
using FilterComboColors = Penumbra.UI.FilterComboColors;
|
||||
using MouseWheelType = OtterGui.Widgets.MouseWheelType;
|
||||
|
||||
namespace Penumbra.Services;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ using Dalamud.Interface.ImGuiNotification;
|
|||
using ImSharp;
|
||||
using Luna;
|
||||
using Luna.Generators;
|
||||
using OtterGui;
|
||||
using OtterGui.Widgets;
|
||||
using Penumbra.Api.Enums;
|
||||
using Penumbra.Collections.Manager;
|
||||
|
|
@ -711,11 +710,11 @@ public class ItemSwapTab : IDisposable, ITab
|
|||
table.DrawFrameColumn(text);
|
||||
|
||||
table.NextColumn();
|
||||
_dirty |= Combos.Combos.Gender("##Gender", _currentGender, out _currentGender);
|
||||
_dirty |= Combos.Gender.Draw("##Gender"u8, ref _currentGender, StringU8.Empty, 120 * Im.Style.GlobalScale);
|
||||
if (drawRace is 1)
|
||||
{
|
||||
Im.Line.Same();
|
||||
_dirty |= Combos.Combos.Race("##Race", _currentRace, out _currentRace, InputWidth);
|
||||
_dirty |= Combos.ModelRace.Draw("##Race"u8, ref _currentRace, StringU8.Empty, InputWidth);
|
||||
}
|
||||
else if (drawRace is 2)
|
||||
{
|
||||
|
|
@ -723,12 +722,7 @@ public class ItemSwapTab : IDisposable, ITab
|
|||
if (_currentRace is not ModelRace.Miqote and not ModelRace.AuRa and not ModelRace.Hrothgar)
|
||||
_currentRace = ModelRace.Miqote;
|
||||
|
||||
_dirty |= ImGuiUtil.GenericEnumCombo("##Race", InputWidth, _currentRace, out _currentRace, [
|
||||
ModelRace.Miqote,
|
||||
ModelRace.AuRa,
|
||||
ModelRace.Hrothgar,
|
||||
],
|
||||
ModelRaceExtensions.ToName);
|
||||
_dirty |= Combos.TailedRace.Draw("##Race"u8, ref _currentRace, StringU8.Empty, InputWidth);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
using System.Collections.Frozen;
|
||||
using OtterGui.Text.Widget.Editors;
|
||||
using Luna;
|
||||
using Penumbra.GameData.Files.ShaderStructs;
|
||||
|
||||
namespace Penumbra.UI.AdvancedWindow.Materials;
|
||||
|
|
@ -20,7 +20,8 @@ public static class ConstantEditors
|
|||
|
||||
static ConstantEditors()
|
||||
{
|
||||
IReadOnlyList<Name> knownIntConstants = [
|
||||
IReadOnlyList<Name> knownIntConstants =
|
||||
[
|
||||
"g_ToonIndex",
|
||||
"g_ToonSpecIndex",
|
||||
];
|
||||
|
|
@ -30,11 +31,11 @@ public static class ConstantEditors
|
|||
|
||||
public static IEditor<byte> DefaultFor(Name name, MaterialTemplatePickers? materialTemplatePickers = null)
|
||||
{
|
||||
if (materialTemplatePickers != null)
|
||||
if (materialTemplatePickers is not null)
|
||||
{
|
||||
if (name == Names.SphereMapIndexConstantName)
|
||||
return materialTemplatePickers.SphereMapIndexPicker;
|
||||
else if (name == Names.TileIndexConstantName)
|
||||
if (name == Names.TileIndexConstantName)
|
||||
return materialTemplatePickers.TileIndexPicker;
|
||||
}
|
||||
|
||||
|
|
@ -60,11 +61,16 @@ public static class ConstantEditors
|
|||
where T : unmanaged, IPowerFunctions<T>, IComparisonOperators<T, T, bool>
|
||||
=> exponent == T.MultiplicativeIdentity
|
||||
? inner
|
||||
: inner.Converting(value => value < T.Zero ? -T.Pow(-value, T.MultiplicativeIdentity / exponent) : T.Pow(value, T.MultiplicativeIdentity / exponent), value => value < T.Zero ? -T.Pow(-value, exponent) : T.Pow(value, exponent));
|
||||
: inner.Converting(
|
||||
value => value < T.Zero
|
||||
? -T.Pow(-value, T.MultiplicativeIdentity / exponent)
|
||||
: T.Pow(value, T.MultiplicativeIdentity / exponent),
|
||||
value => value < T.Zero ? -T.Pow(-value, exponent) : T.Pow(value, exponent));
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static IEditor<T> WithFactorAndBias<T>(this IEditor<T> inner, T factor, T bias)
|
||||
where T : unmanaged, IMultiplicativeIdentity<T, T>, IAdditiveIdentity<T, T>, IMultiplyOperators<T, T, T>, IAdditionOperators<T, T, T>, ISubtractionOperators<T, T, T>, IDivisionOperators<T, T, T>, IEqualityOperators<T, T, bool>
|
||||
where T : unmanaged, IMultiplicativeIdentity<T, T>, IAdditiveIdentity<T, T>, IMultiplyOperators<T, T, T>, IAdditionOperators<T, T, T>,
|
||||
ISubtractionOperators<T, T, T>, IDivisionOperators<T, T, T>, IEqualityOperators<T, T, bool>
|
||||
=> factor == T.MultiplicativeIdentity && bias == T.AdditiveIdentity
|
||||
? inner
|
||||
: inner.Converting(value => (value - bias) / factor, value => value * factor + bias);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
using ImSharp;
|
||||
using Luna;
|
||||
using OtterGui.Text.Widget.Editors;
|
||||
using Penumbra.Interop.Services;
|
||||
using Penumbra.Interop.Structs;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
using ImSharp;
|
||||
using Luna;
|
||||
using OtterGui.Text.Widget.Editors;
|
||||
using Penumbra.GameData.Files.ShaderStructs;
|
||||
using static Penumbra.GameData.Files.ShpkFile;
|
||||
|
||||
|
|
@ -16,19 +15,6 @@ public partial class MtrlTab
|
|||
|
||||
private void UpdateConstants()
|
||||
{
|
||||
static List<T> FindOrAddGroup<T>(List<(string, List<T>)> groups, string name)
|
||||
{
|
||||
foreach (var (groupName, group) in groups)
|
||||
{
|
||||
if (string.Equals(name, groupName, StringComparison.Ordinal))
|
||||
return group;
|
||||
}
|
||||
|
||||
var newGroup = new List<T>(16);
|
||||
groups.Add((name, newGroup));
|
||||
return newGroup;
|
||||
}
|
||||
|
||||
Constants.Clear();
|
||||
string mpPrefix;
|
||||
if (_associatedShpk == null)
|
||||
|
|
@ -137,6 +123,21 @@ public partial class MtrlTab
|
|||
x.MonoFont ? x.Label.Replace("].w", "].{").Replace(mpPrefix, "}_MaterialParameter") : x.Label,
|
||||
y.MonoFont ? y.Label.Replace("].w", "].{").Replace(mpPrefix, "}_MaterialParameter") : y.Label));
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
static List<T> FindOrAddGroup<T>(List<(string, List<T>)> groups, string name)
|
||||
{
|
||||
foreach (var (groupName, group) in groups)
|
||||
{
|
||||
if (string.Equals(name, groupName, StringComparison.Ordinal))
|
||||
return group;
|
||||
}
|
||||
|
||||
var newGroup = new List<T>(16);
|
||||
groups.Add((name, newGroup));
|
||||
return newGroup;
|
||||
}
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
using ImSharp;
|
||||
using JetBrains.Annotations;
|
||||
using Luna;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using OtterGui.Text.Widget.Editors;
|
||||
using Penumbra.String.Classes;
|
||||
using static Penumbra.GameData.Files.ShpkFile;
|
||||
|
||||
|
|
@ -228,7 +229,7 @@ public partial class MtrlTab
|
|||
|
||||
private EnumEditor<T> CreateEnumEditor<T>(Func<double, T> convertValue)
|
||||
where T : unmanaged, IUtf8SpanFormattable, IEqualityOperators<T, T, bool>
|
||||
=> new(Array.ConvertAll(Values, value => (ToUtf8(value.Label), convertValue(value.Value), ToUtf8(value.Description))));
|
||||
=> new(Array.ConvertAll(Values, value => (new StringU8(value.Label), convertValue(value.Value), new StringU8(value.Description))));
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private static T ToInteger<T>(float value) where T : struct, INumberBase<T>
|
||||
|
|
@ -245,8 +246,5 @@ public partial class MtrlTab
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private static T? ToFloat<T>(float? value) where T : struct, INumberBase<T>
|
||||
=> value.HasValue ? T.CreateSaturating(value.Value) : null;
|
||||
|
||||
private static ReadOnlyMemory<byte> ToUtf8(string value)
|
||||
=> Encoding.UTF8.GetBytes(value);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ using Penumbra.GameData.Files.AtchStructs;
|
|||
using Penumbra.Meta;
|
||||
using Penumbra.Meta.Manipulations;
|
||||
using Penumbra.Mods.Editor;
|
||||
using Penumbra.UI.Combos;
|
||||
using Notification = Luna.Notification;
|
||||
|
||||
namespace Penumbra.UI.AdvancedWindow.Meta;
|
||||
|
|
@ -237,7 +236,7 @@ public sealed class AtchMetaDrawer : MetaDrawer<AtchIdentifier, AtchEntry>
|
|||
|
||||
private static bool DrawRace(ref AtchIdentifier identifier, float unscaledWidth = 100)
|
||||
{
|
||||
var ret = Combos.Combos.Race("##atchRace", identifier.Race, out var race, unscaledWidth);
|
||||
var ret = Combos.ModelRace.Draw("##atchRace"u8, identifier.Race, StringU8.Empty, unscaledWidth * Im.Style.GlobalScale, out var race);
|
||||
Im.Tooltip.OnHover("Model Race"u8);
|
||||
if (ret)
|
||||
identifier = identifier with { GenderRace = Names.CombinedRace(identifier.Gender, race) };
|
||||
|
|
|
|||
|
|
@ -135,8 +135,7 @@ public sealed class EqdpMetaDrawer(ModMetaEditor editor, MetaFileManager metaFil
|
|||
|
||||
public static bool DrawRace(ref EqdpIdentifier identifier, float unscaledWidth = 100)
|
||||
{
|
||||
var ret = Combos.Combos.Race("##eqdpRace", identifier.Race, out var race, unscaledWidth);
|
||||
Im.Tooltip.OnHover("Model Race"u8);
|
||||
var ret = Combos.ModelRace.Draw("##eqdpRace"u8, identifier.Race, "Model Race"u8, unscaledWidth * Im.Style.GlobalScale, out var race);
|
||||
if (ret)
|
||||
identifier = identifier with { GenderRace = Names.CombinedRace(identifier.Gender, race) };
|
||||
return ret;
|
||||
|
|
@ -144,8 +143,7 @@ public sealed class EqdpMetaDrawer(ModMetaEditor editor, MetaFileManager metaFil
|
|||
|
||||
public static bool DrawGender(ref EqdpIdentifier identifier, float unscaledWidth = 120)
|
||||
{
|
||||
var ret = Combos.Combos.Gender("##eqdpGender", identifier.Gender, out var gender, unscaledWidth);
|
||||
Im.Tooltip.OnHover("Gender"u8);
|
||||
var ret = Combos.Gender.Draw("##eqdpGender"u8, identifier.Gender, "Gender"u8, unscaledWidth * Im.Style.GlobalScale, out var gender);
|
||||
if (ret)
|
||||
identifier = identifier with { GenderRace = Names.CombinedRace(gender, identifier.Race) };
|
||||
return ret;
|
||||
|
|
@ -153,8 +151,7 @@ public sealed class EqdpMetaDrawer(ModMetaEditor editor, MetaFileManager metaFil
|
|||
|
||||
public static bool DrawEquipSlot(ref EqdpIdentifier identifier, float unscaledWidth = 100)
|
||||
{
|
||||
var ret = Combos.Combos.EqdpEquipSlot("##eqdpSlot", identifier.Slot, out var slot, unscaledWidth);
|
||||
Im.Tooltip.OnHover("Equip Slot"u8);
|
||||
var ret = Combos.EqdpEquipSlot.Draw("##eqdpSlot"u8, identifier.Slot, "Equip Slot"u8, unscaledWidth, out var slot);
|
||||
if (ret)
|
||||
identifier = identifier with { Slot = slot };
|
||||
return ret;
|
||||
|
|
|
|||
|
|
@ -128,8 +128,7 @@ public sealed class EqpMetaDrawer(ModMetaEditor editor, MetaFileManager metaFile
|
|||
|
||||
public static bool DrawEquipSlot(ref EqpIdentifier identifier, float unscaledWidth = 100)
|
||||
{
|
||||
var ret = Combos.Combos.EqpEquipSlot("##eqpSlot", identifier.Slot, out var slot, unscaledWidth);
|
||||
Im.Tooltip.OnHover("Equip Slot"u8);
|
||||
var ret = Combos.EqpEquipSlot.Draw("##eqpSlot"u8, identifier.Slot, "Equip Slot"u8, unscaledWidth * Im.Style.GlobalScale, out var slot);
|
||||
if (ret)
|
||||
identifier = identifier with { Slot = slot };
|
||||
return ret;
|
||||
|
|
|
|||
|
|
@ -125,8 +125,7 @@ public sealed class EstMetaDrawer(ModMetaEditor editor, MetaFileManager metaFile
|
|||
|
||||
public static bool DrawRace(ref EstIdentifier identifier, float unscaledWidth = 100)
|
||||
{
|
||||
var ret = Combos.Combos.Race("##estRace", identifier.Race, out var race, unscaledWidth);
|
||||
Im.Tooltip.OnHover("Model Race"u8);
|
||||
var ret = Combos.ModelRace.Draw("##estRace"u8, identifier.Race, "Model Race"u8, unscaledWidth * Im.Style.GlobalScale, out var race);
|
||||
if (ret)
|
||||
identifier = identifier with { GenderRace = Names.CombinedRace(identifier.Gender, race) };
|
||||
return ret;
|
||||
|
|
@ -134,8 +133,7 @@ public sealed class EstMetaDrawer(ModMetaEditor editor, MetaFileManager metaFile
|
|||
|
||||
public static bool DrawGender(ref EstIdentifier identifier, float unscaledWidth = 120)
|
||||
{
|
||||
var ret = Combos.Combos.Gender("##estGender", identifier.Gender, out var gender, unscaledWidth);
|
||||
Im.Tooltip.OnHover("Gender"u8);
|
||||
var ret = Combos.Gender.Draw("##estGender"u8, identifier.Gender, "Gender"u8, unscaledWidth * Im.Style.GlobalScale, out var gender);
|
||||
if (ret)
|
||||
identifier = identifier with { GenderRace = Names.CombinedRace(gender, identifier.Race) };
|
||||
return ret;
|
||||
|
|
@ -143,8 +141,7 @@ public sealed class EstMetaDrawer(ModMetaEditor editor, MetaFileManager metaFile
|
|||
|
||||
public static bool DrawSlot(ref EstIdentifier identifier, float unscaledWidth = 200)
|
||||
{
|
||||
var ret = Combos.Combos.EstSlot("##estSlot", identifier.Slot, out var slot, unscaledWidth);
|
||||
Im.Tooltip.OnHover("Extra Skeleton Type"u8);
|
||||
var ret = Combos.EstSlot.Draw("##estSlot"u8, identifier.Slot, "Extra Skeleton Type"u8, unscaledWidth * Im.Style.GlobalScale, out var slot);
|
||||
if (ret)
|
||||
identifier = identifier with { Slot = slot };
|
||||
return ret;
|
||||
|
|
|
|||
|
|
@ -150,8 +150,7 @@ public sealed class ImcMetaDrawer(ModMetaEditor editor, MetaFileManager metaFile
|
|||
|
||||
public static bool DrawObjectType(ref ImcIdentifier identifier, float width = 110)
|
||||
{
|
||||
var ret = Combos.Combos.ImcType("##imcType", identifier.ObjectType, out var type, width);
|
||||
Im.Tooltip.OnHover("Object Type"u8);
|
||||
var ret = Combos.ImcType.Draw("##imcType"u8, identifier.ObjectType, "Object Type"u8, width * Im.Style.GlobalScale, out var type);
|
||||
|
||||
if (ret)
|
||||
{
|
||||
|
|
@ -211,13 +210,12 @@ public sealed class ImcMetaDrawer(ModMetaEditor editor, MetaFileManager metaFile
|
|||
{
|
||||
case ObjectType.Equipment:
|
||||
case ObjectType.DemiHuman:
|
||||
ret = Combos.Combos.EqpEquipSlot("##slot", identifier.EquipSlot, out slot, unscaledWidth);
|
||||
ret = Combos.EqpEquipSlot.Draw("##slot"u8, identifier.EquipSlot, "Equip Slot"u8, unscaledWidth * Im.Style.GlobalScale, out slot);
|
||||
break;
|
||||
case ObjectType.Accessory: ret = Combos.Combos.AccessorySlot("##slot", identifier.EquipSlot, out slot, unscaledWidth); break;
|
||||
case ObjectType.Accessory: ret = Combos.AccessorySlot.Draw("##slot"u8, identifier.EquipSlot, "Equip Slot"u8, unscaledWidth * Im.Style.GlobalScale, out slot); break;
|
||||
default: return false;
|
||||
}
|
||||
|
||||
Im.Tooltip.OnHover("Equip Slot"u8);
|
||||
if (ret)
|
||||
identifier = identifier with { EquipSlot = slot };
|
||||
return ret;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
using ImSharp;
|
||||
using Luna;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using OtterGui;
|
||||
using Penumbra.Meta;
|
||||
using Penumbra.Meta.Manipulations;
|
||||
using Penumbra.Mods.Editor;
|
||||
|
|
@ -40,17 +39,10 @@ public abstract class MetaDrawer<TIdentifier, TEntry>(ModMetaEditor editor, Meta
|
|||
using var id = Im.Id.Push((int)Identifier.Type);
|
||||
DrawNew();
|
||||
|
||||
var height = ColumnHeight;
|
||||
var skips = ImGuiClip.GetNecessarySkipsAtPos(height, Im.Cursor.Y, Count);
|
||||
if (skips < Count)
|
||||
{
|
||||
var remainder = ImGuiClip.ClippedTableDraw(Enumerate(), skips, DrawLine, Count);
|
||||
if (remainder > 0)
|
||||
ImGuiClip.DrawEndDummy(remainder, height);
|
||||
}
|
||||
|
||||
void DrawLine((TIdentifier Identifier, TEntry Value) pair)
|
||||
=> DrawEntry(pair.Identifier, pair.Value);
|
||||
var height = ColumnHeight;
|
||||
using var clipper = new Im.ListClipper(Count, height);
|
||||
foreach (var (identifier, value) in clipper.Iterate(Enumerate()))
|
||||
DrawEntry(identifier, value);
|
||||
}
|
||||
|
||||
public abstract ReadOnlySpan<byte> Label { get; }
|
||||
|
|
@ -152,7 +144,7 @@ public abstract class MetaDrawer<TIdentifier, TEntry>(ModMetaEditor editor, Meta
|
|||
if (!ImEx.Icon.Button(LunaStyle.ToClipboardIcon, tooltip))
|
||||
return;
|
||||
|
||||
var text = Functions.ToCompressedBase64(manipulations.Value, 0);
|
||||
var text = CompressionFunctions.ToCompressedBase64(manipulations.Value, 0);
|
||||
if (text.Length > 0)
|
||||
Im.Clipboard.Set(text);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -98,8 +98,7 @@ public sealed class RspMetaDrawer(ModMetaEditor editor, MetaFileManager metaFile
|
|||
|
||||
public static bool DrawSubRace(ref RspIdentifier identifier, float unscaledWidth = 150)
|
||||
{
|
||||
var ret = Combos.Combos.SubRace("##rspSubRace", identifier.SubRace, out var subRace, unscaledWidth);
|
||||
Im.Tooltip.OnHover("Racial Clan"u8);
|
||||
var ret = Combos.Clan.Draw("##rspSubRace"u8, identifier.SubRace, "Racial Clan"u8, unscaledWidth * Im.Style.GlobalScale, out var subRace);
|
||||
if (ret)
|
||||
identifier = identifier with { SubRace = subRace };
|
||||
return ret;
|
||||
|
|
@ -107,8 +106,7 @@ public sealed class RspMetaDrawer(ModMetaEditor editor, MetaFileManager metaFile
|
|||
|
||||
public static bool DrawAttribute(ref RspIdentifier identifier, float unscaledWidth = 200)
|
||||
{
|
||||
var ret = Combos.Combos.RspAttribute("##rspAttribute", identifier.Attribute, out var attribute, unscaledWidth);
|
||||
Im.Tooltip.OnHover("Scaling Attribute"u8);
|
||||
var ret = Combos.RspType.Draw("##rspAttribute"u8, identifier.Attribute, "Scaling Attribute"u8, unscaledWidth, out var attribute);
|
||||
if (ret)
|
||||
identifier = identifier with { Attribute = attribute };
|
||||
return ret;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ using Dalamud.Interface;
|
|||
using ImSharp;
|
||||
using Lumina.Data.Parsing;
|
||||
using Luna;
|
||||
using OtterGui.Widgets;
|
||||
using Penumbra.GameData;
|
||||
using Penumbra.GameData.Files;
|
||||
using Penumbra.Import.Models;
|
||||
|
|
@ -646,7 +645,7 @@ public partial class ModEditWindow
|
|||
{
|
||||
using var t = Im.Tree.Node($"Additional Data (Size: {data.LastFile.RemainingData.Length})###AdditionalData");
|
||||
if (t)
|
||||
Widget.DrawHexViewer(data.LastFile.RemainingData);
|
||||
ImEx.HexViewer(data.LastFile.RemainingData);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
|
|||
|
|
@ -1,10 +1,8 @@
|
|||
using System.Collections.Frozen;
|
||||
using Dalamud.Interface.Components;
|
||||
using Dalamud.Interface.DragDrop;
|
||||
using Dalamud.Plugin.Services;
|
||||
using ImSharp;
|
||||
using Luna;
|
||||
using OtterGui;
|
||||
using Penumbra.Api.Enums;
|
||||
using Penumbra.Collections.Manager;
|
||||
using Penumbra.Communication;
|
||||
|
|
@ -24,7 +22,6 @@ using Penumbra.String.Classes;
|
|||
using Penumbra.UI.AdvancedWindow.Materials;
|
||||
using Penumbra.UI.AdvancedWindow.Meta;
|
||||
using Penumbra.UI.Classes;
|
||||
using Penumbra.UI.Combos;
|
||||
using MdlMaterialEditor = Penumbra.Mods.Editor.MdlMaterialEditor;
|
||||
|
||||
namespace Penumbra.UI.AdvancedWindow;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ using ImSharp;
|
|||
using Penumbra.GameData.Files.AtchStructs;
|
||||
using Penumbra.UI.AdvancedWindow.Meta;
|
||||
|
||||
namespace Penumbra.UI.Combos;
|
||||
namespace Penumbra.UI;
|
||||
|
||||
internal sealed class AtchPointCombo(AtchMetaDrawer parent)
|
||||
: SimpleFilterCombo<AtchType>(SimpleFilterType.Text)
|
||||
|
|
|
|||
|
|
@ -1,42 +1,34 @@
|
|||
using ImSharp;
|
||||
using OtterGui;
|
||||
using Penumbra.Api.Enums;
|
||||
using Penumbra.GameData.Enums;
|
||||
using Penumbra.Meta.Manipulations;
|
||||
|
||||
namespace Penumbra.UI.Combos;
|
||||
namespace Penumbra.UI;
|
||||
|
||||
public static class Combos
|
||||
{
|
||||
// Different combos to use with enums.
|
||||
public static bool Race(string label, ModelRace current, out ModelRace race, float unscaledWidth = 100)
|
||||
=> ImGuiUtil.GenericEnumCombo(label, unscaledWidth * Im.Style.GlobalScale, current, out race, ModelRaceExtensions.ToName, 1);
|
||||
public static readonly EnumCombo<ModelRace> ModelRace = new(ModelRaceExtensions.ToNameU8, ModelRaceExtensions.ToName);
|
||||
public static readonly EnumCombo<ModelRace> TailedRace = new(ModelRaceExtensions.ToNameU8, ModelRaceExtensions.ToName, null, [GameData.Enums.ModelRace.Miqote, GameData.Enums.ModelRace.AuRa, GameData.Enums.ModelRace.Hrothgar]);
|
||||
public static readonly EnumCombo<Gender> Gender = new(GenderExtensions.ToNameU8, GenderExtensions.ToName);
|
||||
|
||||
public static bool Gender(string label, Gender current, out Gender gender, float unscaledWidth = 120)
|
||||
=> ImGuiUtil.GenericEnumCombo(label, unscaledWidth, current, out gender, GenderExtensions.ToName, 1);
|
||||
public static readonly EnumCombo<EquipSlot> EqdpEquipSlot = new(EquipSlotExtensions.ToNameU8, EquipSlotExtensions.ToName, null,
|
||||
EquipSlotExtensions.EqdpSlots);
|
||||
|
||||
public static bool EqdpEquipSlot(string label, EquipSlot current, out EquipSlot slot, float unscaledWidth = 100)
|
||||
=> ImGuiUtil.GenericEnumCombo(label, unscaledWidth * Im.Style.GlobalScale, current, out slot, EquipSlotExtensions.EqdpSlots,
|
||||
EquipSlotExtensions.ToName);
|
||||
public static readonly EnumCombo<EquipSlot> EqpEquipSlot = new(EquipSlotExtensions.ToNameU8, EquipSlotExtensions.ToName, null,
|
||||
EquipSlotExtensions.EquipmentSlots);
|
||||
|
||||
public static bool EqpEquipSlot(string label, EquipSlot current, out EquipSlot slot, float unscaledWidth = 100)
|
||||
=> ImGuiUtil.GenericEnumCombo(label, unscaledWidth * Im.Style.GlobalScale, current, out slot, EquipSlotExtensions.EquipmentSlots,
|
||||
EquipSlotExtensions.ToName);
|
||||
public static readonly EnumCombo<EquipSlot> AccessorySlot = new(EquipSlotExtensions.ToNameU8, EquipSlotExtensions.ToName, null,
|
||||
EquipSlotExtensions.AccessorySlots);
|
||||
|
||||
public static bool AccessorySlot(string label, EquipSlot current, out EquipSlot slot, float unscaledWidth = 100)
|
||||
=> ImGuiUtil.GenericEnumCombo(label, unscaledWidth * Im.Style.GlobalScale, current, out slot, EquipSlotExtensions.AccessorySlots,
|
||||
EquipSlotExtensions.ToName);
|
||||
public static readonly EnumCombo<SubRace> Clan = new(SubRaceExtensions.ToNameU8, SubRaceExtensions.ToName);
|
||||
public static readonly EnumCombo<RspAttribute> RspType = new(RspAttributeExtensions.ToNameU8, RspAttributeExtensions.ToName);
|
||||
public static readonly EnumCombo<EstType> EstSlot = new(EstTypeExtensions.ToNameU8, EstTypeExtensions.ToName);
|
||||
|
||||
public static bool SubRace(string label, SubRace current, out SubRace subRace, float unscaledWidth = 150)
|
||||
=> ImGuiUtil.GenericEnumCombo(label, unscaledWidth * Im.Style.GlobalScale, current, out subRace, SubRaceExtensions.ToName, 1);
|
||||
public static readonly EnumCombo<ObjectType> ImcType = new(ObjectTypeExtensions.ToNameU8, ObjectTypeExtensions.ToName, null,
|
||||
ObjectTypeExtensions.ValidImcTypes);
|
||||
|
||||
public static bool RspAttribute(string label, RspAttribute current, out RspAttribute attribute, float unscaledWidth = 200)
|
||||
=> ImGuiUtil.GenericEnumCombo(label, unscaledWidth * Im.Style.GlobalScale, current, out attribute,
|
||||
RspAttributeExtensions.ToName, 0, 1);
|
||||
|
||||
public static bool EstSlot(string label, EstType current, out EstType attribute, float unscaledWidth = 200)
|
||||
=> ImGuiUtil.GenericEnumCombo(label, unscaledWidth * Im.Style.GlobalScale, current, out attribute);
|
||||
|
||||
public static bool ImcType(string label, ObjectType current, out ObjectType type, float unscaledWidth = 110)
|
||||
=> ImGuiUtil.GenericEnumCombo(label, unscaledWidth * Im.Style.GlobalScale, current, out type, ObjectTypeExtensions.ValidImcTypes,
|
||||
ObjectTypeExtensions.ToName);
|
||||
public static readonly EnumCombo<ApiCollectionType> ApiCollectionType = new();
|
||||
public static readonly EnumCombo<TextureType> TextureType = new();
|
||||
public static readonly EnumCombo<ResourceType> ResourceType = new();
|
||||
public static readonly EnumCombo<TabType> TabType = new();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ using Penumbra.Mods.SubMods;
|
|||
using Penumbra.UI.AdvancedWindow;
|
||||
using Penumbra.UI.Classes;
|
||||
|
||||
namespace Penumbra.UI.Combos;
|
||||
namespace Penumbra.UI;
|
||||
|
||||
public sealed class OptionSelectCombo : FilterComboBase<OptionSelectCombo.Option>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ using OtterGui.Log;
|
|||
using OtterGui.Raii;
|
||||
using OtterGui.Widgets;
|
||||
|
||||
namespace Penumbra.UI.Classes;
|
||||
namespace Penumbra.UI;
|
||||
|
||||
public class FilterComboColors : FilterComboCache<KeyValuePair<byte, (string Name, uint Color, bool Gloss)>>
|
||||
{
|
||||
Loading…
Add table
Add a link
Reference in a new issue