mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 18:27:24 +01:00
Add slots to demihuman imc.
This commit is contained in:
parent
d0ed8abab8
commit
f63903e3e6
3 changed files with 77 additions and 53 deletions
|
|
@ -130,37 +130,18 @@ public partial class TexToolsMeta
|
||||||
ushort i = 0;
|
ushort i = 0;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if( metaFileInfo.PrimaryType is ObjectType.Equipment or ObjectType.Accessory )
|
var manip = new ImcManipulation( metaFileInfo.PrimaryType, metaFileInfo.SecondaryType, metaFileInfo.PrimaryId, metaFileInfo.SecondaryId, i, metaFileInfo.EquipSlot,
|
||||||
|
new ImcEntry() );
|
||||||
|
var def = new ImcFile( manip );
|
||||||
|
var partIdx = ImcFile.PartIndex( manip.EquipSlot ); // Gets turned to unknown for things without equip, and unknown turns to 0.
|
||||||
|
foreach( var value in values )
|
||||||
{
|
{
|
||||||
var def = new ImcFile( new ImcManipulation( metaFileInfo.EquipSlot, i, metaFileInfo.PrimaryId, new ImcEntry() ) );
|
if( !value.Equals( def.GetEntry( partIdx, i ) ) )
|
||||||
var partIdx = ImcFile.PartIndex( metaFileInfo.EquipSlot );
|
|
||||||
foreach( var value in values )
|
|
||||||
{
|
{
|
||||||
if( !value.Equals( def.GetEntry( partIdx, i ) ) )
|
MetaManipulations.Add( manip.Copy( value ) );
|
||||||
{
|
|
||||||
MetaManipulations.Add( new ImcManipulation( metaFileInfo.EquipSlot, i, metaFileInfo.PrimaryId, value ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
++i;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var def = new ImcFile( new ImcManipulation( metaFileInfo.PrimaryType, metaFileInfo.SecondaryType, metaFileInfo.PrimaryId,
|
|
||||||
metaFileInfo.SecondaryId, i,
|
|
||||||
new ImcEntry() ) );
|
|
||||||
foreach( var value in values )
|
|
||||||
{
|
|
||||||
if( !value.Equals( def.GetEntry( 0, i ) ) )
|
|
||||||
{
|
|
||||||
MetaManipulations.Add( new ImcManipulation( metaFileInfo.PrimaryType, metaFileInfo.SecondaryType,
|
|
||||||
metaFileInfo.PrimaryId,
|
|
||||||
metaFileInfo.SecondaryId, i,
|
|
||||||
value ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
++i;
|
++i;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch( Exception e )
|
catch( Exception e )
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,8 @@ public readonly struct ImcManipulation : IMetaManipulation< ImcManipulation >
|
||||||
{
|
{
|
||||||
public ImcEntry Entry { get; private init; }
|
public ImcEntry Entry { get; private init; }
|
||||||
public ushort PrimaryId { get; private init; }
|
public ushort PrimaryId { get; private init; }
|
||||||
public ushort Variant { get; private init; }
|
|
||||||
public ushort SecondaryId { get; private init; }
|
public ushort SecondaryId { get; private init; }
|
||||||
|
public byte Variant { get; private init; }
|
||||||
|
|
||||||
[JsonConverter( typeof( StringEnumConverter ) )]
|
[JsonConverter( typeof( StringEnumConverter ) )]
|
||||||
public ObjectType ObjectType { get; private init; }
|
public ObjectType ObjectType { get; private init; }
|
||||||
|
|
@ -32,25 +32,13 @@ public readonly struct ImcManipulation : IMetaManipulation< ImcManipulation >
|
||||||
{
|
{
|
||||||
Entry = entry;
|
Entry = entry;
|
||||||
PrimaryId = primaryId;
|
PrimaryId = primaryId;
|
||||||
Variant = variant;
|
Variant = ( byte )variant;
|
||||||
SecondaryId = 0;
|
SecondaryId = 0;
|
||||||
ObjectType = equipSlot.IsAccessory() ? ObjectType.Accessory : ObjectType.Equipment;
|
ObjectType = equipSlot.IsAccessory() ? ObjectType.Accessory : ObjectType.Equipment;
|
||||||
EquipSlot = equipSlot;
|
EquipSlot = equipSlot;
|
||||||
BodySlot = BodySlot.Unknown;
|
BodySlot = BodySlot.Unknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ImcManipulation( ObjectType objectType, BodySlot bodySlot, ushort primaryId, ushort secondaryId, ushort variant,
|
|
||||||
ImcEntry entry )
|
|
||||||
{
|
|
||||||
Entry = entry;
|
|
||||||
ObjectType = objectType;
|
|
||||||
BodySlot = bodySlot;
|
|
||||||
SecondaryId = secondaryId;
|
|
||||||
PrimaryId = primaryId;
|
|
||||||
Variant = variant;
|
|
||||||
EquipSlot = EquipSlot.Unknown;
|
|
||||||
}
|
|
||||||
|
|
||||||
[JsonConstructor]
|
[JsonConstructor]
|
||||||
internal ImcManipulation( ObjectType objectType, BodySlot bodySlot, ushort primaryId, ushort secondaryId, ushort variant,
|
internal ImcManipulation( ObjectType objectType, BodySlot bodySlot, ushort primaryId, ushort secondaryId, ushort variant,
|
||||||
EquipSlot equipSlot, ImcEntry entry )
|
EquipSlot equipSlot, ImcEntry entry )
|
||||||
|
|
@ -58,13 +46,19 @@ public readonly struct ImcManipulation : IMetaManipulation< ImcManipulation >
|
||||||
Entry = entry;
|
Entry = entry;
|
||||||
ObjectType = objectType;
|
ObjectType = objectType;
|
||||||
PrimaryId = primaryId;
|
PrimaryId = primaryId;
|
||||||
Variant = variant;
|
Variant = ( byte )variant;
|
||||||
if( objectType is ObjectType.Accessory or ObjectType.Equipment )
|
if( objectType is ObjectType.Accessory or ObjectType.Equipment )
|
||||||
{
|
{
|
||||||
BodySlot = BodySlot.Unknown;
|
BodySlot = BodySlot.Unknown;
|
||||||
SecondaryId = 0;
|
SecondaryId = 0;
|
||||||
EquipSlot = equipSlot;
|
EquipSlot = equipSlot;
|
||||||
}
|
}
|
||||||
|
else if( objectType is ObjectType.DemiHuman )
|
||||||
|
{
|
||||||
|
BodySlot = BodySlot.Unknown;
|
||||||
|
SecondaryId = secondaryId;
|
||||||
|
EquipSlot = equipSlot;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
BodySlot = bodySlot;
|
BodySlot = bodySlot;
|
||||||
|
|
@ -115,6 +109,15 @@ public readonly struct ImcManipulation : IMetaManipulation< ImcManipulation >
|
||||||
return e != 0 ? e : Variant.CompareTo( other.Variant );
|
return e != 0 ? e : Variant.CompareTo( other.Variant );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( ObjectType is ObjectType.DemiHuman )
|
||||||
|
{
|
||||||
|
var e = EquipSlot.CompareTo( other.EquipSlot );
|
||||||
|
if( e != 0 )
|
||||||
|
{
|
||||||
|
return e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var s = SecondaryId.CompareTo( other.SecondaryId );
|
var s = SecondaryId.CompareTo( other.SecondaryId );
|
||||||
if( s != 0 )
|
if( s != 0 )
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ public partial class ModEditWindow
|
||||||
|
|
||||||
DrawEditHeader( _editor.Meta.Eqp, "Equipment Parameter Edits (EQP)###EQP", 5, EqpRow.Draw, EqpRow.DrawNew );
|
DrawEditHeader( _editor.Meta.Eqp, "Equipment Parameter Edits (EQP)###EQP", 5, EqpRow.Draw, EqpRow.DrawNew );
|
||||||
DrawEditHeader( _editor.Meta.Eqdp, "Racial Model Edits (EQDP)###EQDP", 7, EqdpRow.Draw, EqdpRow.DrawNew );
|
DrawEditHeader( _editor.Meta.Eqdp, "Racial Model Edits (EQDP)###EQDP", 7, EqdpRow.Draw, EqdpRow.DrawNew );
|
||||||
DrawEditHeader( _editor.Meta.Imc, "Variant Edits (IMC)###IMC", 9, ImcRow.Draw, ImcRow.DrawNew );
|
DrawEditHeader( _editor.Meta.Imc, "Variant Edits (IMC)###IMC", 10, ImcRow.Draw, ImcRow.DrawNew );
|
||||||
DrawEditHeader( _editor.Meta.Est, "Extra Skeleton Parameters (EST)###EST", 7, EstRow.Draw, EstRow.DrawNew );
|
DrawEditHeader( _editor.Meta.Est, "Extra Skeleton Parameters (EST)###EST", 7, EstRow.Draw, EstRow.DrawNew );
|
||||||
DrawEditHeader( _editor.Meta.Gmp, "Visor/Gimmick Edits (GMP)###GMP", 7, GmpRow.Draw, GmpRow.DrawNew );
|
DrawEditHeader( _editor.Meta.Gmp, "Visor/Gimmick Edits (GMP)###GMP", 7, GmpRow.Draw, GmpRow.DrawNew );
|
||||||
DrawEditHeader( _editor.Meta.Rsp, "Racial Scaling Edits (RSP)###RSP", 5, RspRow.Draw, RspRow.DrawNew );
|
DrawEditHeader( _editor.Meta.Rsp, "Racial Scaling Edits (RSP)###RSP", 5, RspRow.Draw, RspRow.DrawNew );
|
||||||
|
|
@ -143,7 +143,7 @@ public partial class ModEditWindow
|
||||||
ImGuiUtil.HoverTooltip( ModelSetIdTooltip );
|
ImGuiUtil.HoverTooltip( ModelSetIdTooltip );
|
||||||
|
|
||||||
ImGui.TableNextColumn();
|
ImGui.TableNextColumn();
|
||||||
if( EqpEquipSlotCombo( "##eqpSlot", _new.Slot, out var slot ) )
|
if( EqpEquipSlotCombo( "##eqpSlot", 100, _new.Slot, out var slot ) )
|
||||||
{
|
{
|
||||||
_new = new EqpManipulation( ExpandedEqpFile.GetDefault( setId ), slot, _new.SetId );
|
_new = new EqpManipulation( ExpandedEqpFile.GetDefault( setId ), slot, _new.SetId );
|
||||||
}
|
}
|
||||||
|
|
@ -358,8 +358,14 @@ public partial class ModEditWindow
|
||||||
ImGui.TableNextColumn();
|
ImGui.TableNextColumn();
|
||||||
if( ImcTypeCombo( "##imcType", _new.ObjectType, out var type ) )
|
if( ImcTypeCombo( "##imcType", _new.ObjectType, out var type ) )
|
||||||
{
|
{
|
||||||
_new = new ImcManipulation( type, _new.BodySlot, _new.PrimaryId, _new.SecondaryId == 0 ? ( ushort )1 : _new.SecondaryId,
|
var equipSlot = type switch
|
||||||
_new.Variant, _new.EquipSlot == EquipSlot.Unknown ? EquipSlot.Head : _new.EquipSlot, _new.Entry );
|
{
|
||||||
|
ObjectType.Equipment => _new.EquipSlot.IsEquipment() ? _new.EquipSlot : EquipSlot.Head,
|
||||||
|
ObjectType.DemiHuman => _new.EquipSlot.IsEquipment() ? _new.EquipSlot : EquipSlot.Head,
|
||||||
|
ObjectType.Accessory => _new.EquipSlot.IsAccessory() ? _new.EquipSlot : EquipSlot.Ears,
|
||||||
|
_ => EquipSlot.Unknown,
|
||||||
|
};
|
||||||
|
_new = new ImcManipulation( type, _new.BodySlot, _new.PrimaryId, _new.SecondaryId == 0 ? ( ushort )1 : _new.SecondaryId, _new.Variant, equipSlot, _new.Entry );
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGuiUtil.HoverTooltip( ObjectTypeTooltip );
|
ImGuiUtil.HoverTooltip( ObjectTypeTooltip );
|
||||||
|
|
@ -378,9 +384,19 @@ public partial class ModEditWindow
|
||||||
|
|
||||||
ImGui.TableNextColumn();
|
ImGui.TableNextColumn();
|
||||||
// Equipment and accessories are slightly different imcs than other types.
|
// Equipment and accessories are slightly different imcs than other types.
|
||||||
if( _new.ObjectType is ObjectType.Equipment or ObjectType.Accessory )
|
if( _new.ObjectType is ObjectType.Equipment )
|
||||||
{
|
{
|
||||||
if( EqdpEquipSlotCombo( "##imcSlot", _new.EquipSlot, out var slot ) )
|
if( EqpEquipSlotCombo( "##imcSlot", 100, _new.EquipSlot, out var slot ) )
|
||||||
|
{
|
||||||
|
_new = new ImcManipulation( _new.ObjectType, _new.BodySlot, _new.PrimaryId, _new.SecondaryId, _new.Variant, slot, _new.Entry ).Copy( GetDefault( _new )
|
||||||
|
?? new ImcEntry() );
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGuiUtil.HoverTooltip( EquipSlotTooltip );
|
||||||
|
}
|
||||||
|
else if( _new.ObjectType is ObjectType.Accessory )
|
||||||
|
{
|
||||||
|
if( AccessorySlotCombo( "##imcSlot", _new.EquipSlot, out var slot ) )
|
||||||
{
|
{
|
||||||
_new = new ImcManipulation( _new.ObjectType, _new.BodySlot, _new.PrimaryId, _new.SecondaryId, _new.Variant, slot, _new.Entry ).Copy( GetDefault( _new )
|
_new = new ImcManipulation( _new.ObjectType, _new.BodySlot, _new.PrimaryId, _new.SecondaryId, _new.Variant, slot, _new.Entry ).Copy( GetDefault( _new )
|
||||||
?? new ImcEntry() );
|
?? new ImcEntry() );
|
||||||
|
|
@ -406,6 +422,22 @@ public partial class ModEditWindow
|
||||||
?? new ImcEntry() );
|
?? new ImcEntry() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImGui.TableNextColumn();
|
||||||
|
if( _new.ObjectType is ObjectType.DemiHuman )
|
||||||
|
{
|
||||||
|
if( EqpEquipSlotCombo( "##imcSlot", 70, _new.EquipSlot, out var slot ) )
|
||||||
|
{
|
||||||
|
_new = new ImcManipulation( _new.ObjectType, _new.BodySlot, _new.PrimaryId, _new.SecondaryId, _new.Variant, slot, _new.Entry ).Copy( GetDefault( _new )
|
||||||
|
?? new ImcEntry() );
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGuiUtil.HoverTooltip( EquipSlotTooltip );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ImGui.Dummy( new Vector2( 70 * ImGuiHelpers.GlobalScale, 0 ) );
|
||||||
|
}
|
||||||
|
|
||||||
ImGuiUtil.HoverTooltip( VariantIdTooltip );
|
ImGuiUtil.HoverTooltip( VariantIdTooltip );
|
||||||
|
|
||||||
// Values
|
// Values
|
||||||
|
|
@ -470,6 +502,13 @@ public partial class ModEditWindow
|
||||||
ImGui.TextUnformatted( meta.Variant.ToString() );
|
ImGui.TextUnformatted( meta.Variant.ToString() );
|
||||||
ImGuiUtil.HoverTooltip( VariantIdTooltip );
|
ImGuiUtil.HoverTooltip( VariantIdTooltip );
|
||||||
|
|
||||||
|
ImGui.TableNextColumn();
|
||||||
|
ImGui.SetCursorPosX( ImGui.GetCursorPosX() + ImGui.GetStyle().FramePadding.X );
|
||||||
|
if( meta.ObjectType is ObjectType.DemiHuman )
|
||||||
|
{
|
||||||
|
ImGui.TextUnformatted( meta.EquipSlot.ToName() );
|
||||||
|
}
|
||||||
|
|
||||||
// Values
|
// Values
|
||||||
using var style = ImRaii.PushStyle( ImGuiStyleVar.ItemSpacing,
|
using var style = ImRaii.PushStyle( ImGuiStyleVar.ItemSpacing,
|
||||||
new Vector2( 3 * ImGuiHelpers.GlobalScale, ImGui.GetStyle().ItemSpacing.Y ) );
|
new Vector2( 3 * ImGuiHelpers.GlobalScale, ImGui.GetStyle().ItemSpacing.Y ) );
|
||||||
|
|
@ -827,12 +866,13 @@ public partial class ModEditWindow
|
||||||
=> ImGuiUtil.GenericEnumCombo( label, 120 * ImGuiHelpers.GlobalScale, current, out gender, RaceEnumExtensions.ToName, 1 );
|
=> ImGuiUtil.GenericEnumCombo( label, 120 * ImGuiHelpers.GlobalScale, current, out gender, RaceEnumExtensions.ToName, 1 );
|
||||||
|
|
||||||
private static bool EqdpEquipSlotCombo( string label, EquipSlot current, out EquipSlot slot )
|
private static bool EqdpEquipSlotCombo( string label, EquipSlot current, out EquipSlot slot )
|
||||||
=> ImGuiUtil.GenericEnumCombo( label, 100 * ImGuiHelpers.GlobalScale, current, out slot, EquipSlotExtensions.EqdpSlots,
|
=> ImGuiUtil.GenericEnumCombo( label, 100 * ImGuiHelpers.GlobalScale, current, out slot, EquipSlotExtensions.EqdpSlots, EquipSlotExtensions.ToName );
|
||||||
EquipSlotExtensions.ToName );
|
|
||||||
|
|
||||||
private static bool EqpEquipSlotCombo( string label, EquipSlot current, out EquipSlot slot )
|
private static bool EqpEquipSlotCombo( string label, float width, EquipSlot current, out EquipSlot slot )
|
||||||
=> ImGuiUtil.GenericEnumCombo( label, 100 * ImGuiHelpers.GlobalScale, current, out slot, EquipSlotExtensions.EquipmentSlots,
|
=> ImGuiUtil.GenericEnumCombo( label, width * ImGuiHelpers.GlobalScale, current, out slot, EquipSlotExtensions.EquipmentSlots, EquipSlotExtensions.ToName );
|
||||||
EquipSlotExtensions.ToName );
|
|
||||||
|
private static bool AccessorySlotCombo( string label, EquipSlot current, out EquipSlot slot )
|
||||||
|
=> ImGuiUtil.GenericEnumCombo( label, 100 * ImGuiHelpers.GlobalScale, current, out slot, EquipSlotExtensions.AccessorySlots, EquipSlotExtensions.ToName );
|
||||||
|
|
||||||
private static bool SubRaceCombo( string label, SubRace current, out SubRace subRace )
|
private static bool SubRaceCombo( string label, SubRace current, out SubRace subRace )
|
||||||
=> ImGuiUtil.GenericEnumCombo( label, 150 * ImGuiHelpers.GlobalScale, current, out subRace, RaceEnumExtensions.ToName, 1 );
|
=> ImGuiUtil.GenericEnumCombo( label, 150 * ImGuiHelpers.GlobalScale, current, out subRace, RaceEnumExtensions.ToName, 1 );
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue