mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-05-25 17:14:34 +00:00
SkinPartOffset - Rename 'Name' field to 'Type'
This commit is contained in:
@@ -47,12 +47,12 @@ namespace PckStudio.Internal
|
||||
"TOOL1",
|
||||
};
|
||||
|
||||
public readonly string Name;
|
||||
public readonly string Type;
|
||||
public readonly float Value;
|
||||
|
||||
public SkinPartOffset(string name, float value)
|
||||
public SkinPartOffset(string type, float value)
|
||||
{
|
||||
Name = name;
|
||||
Type = type;
|
||||
Value = value;
|
||||
}
|
||||
|
||||
@@ -62,11 +62,11 @@ namespace PckStudio.Internal
|
||||
if (offset.Length < 3)
|
||||
throw new InvalidDataException("Format string does not contain enough data.");
|
||||
|
||||
string name = offset[0];
|
||||
string type = offset[0];
|
||||
|
||||
if (!ValidModelOffsetTypes.Contains(name))
|
||||
if (!ValidModelOffsetTypes.Contains(type))
|
||||
{
|
||||
Debug.WriteLine($"'{name}' is an invalid offset type.", category: nameof(SkinPartOffset));
|
||||
Debug.WriteLine($"'{type}' is an invalid offset type.", category: nameof(SkinPartOffset));
|
||||
}
|
||||
|
||||
// Ignore => Y assumed
|
||||
@@ -74,14 +74,14 @@ namespace PckStudio.Internal
|
||||
|
||||
if (!float.TryParse(offset[2], out float value))
|
||||
{
|
||||
Debug.WriteLine($"Failed to parse y offset for: '{name}'", category: nameof(SkinPartOffset));
|
||||
Debug.WriteLine($"Failed to parse y offset for: '{type}'", category: nameof(SkinPartOffset));
|
||||
}
|
||||
return new SkinPartOffset(name, value);
|
||||
return new SkinPartOffset(type, value);
|
||||
}
|
||||
|
||||
public (string, string) ToProperty()
|
||||
{
|
||||
string value = $"{Name} Y {Value}";
|
||||
string value = $"{Type} Y {Value}";
|
||||
return ("OFFSET", value.Replace(',', '.'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -258,35 +258,6 @@ namespace PckStudio.Rendering
|
||||
};
|
||||
}
|
||||
|
||||
public void SetPartOffset(SkinPartOffset offset)
|
||||
{
|
||||
SetPartOffset(offset.Name, offset.Value);
|
||||
}
|
||||
|
||||
public void SetPartOffset(string name, float value)
|
||||
{
|
||||
if (!partOffset.ContainsKey(name))
|
||||
{
|
||||
Debug.WriteLine($"'{name}' is not inside {nameof(partOffset)}");
|
||||
return;
|
||||
}
|
||||
partOffset[name] = value;
|
||||
}
|
||||
|
||||
private float GetOffset(string name)
|
||||
{
|
||||
return partOffset.ContainsKey(name) ? partOffset[name] : 0f;
|
||||
}
|
||||
|
||||
private void ModelData_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
if (e.Action != NotifyCollectionChangedAction.Move &&
|
||||
e.Action != NotifyCollectionChangedAction.Reset)
|
||||
{
|
||||
UpdateModelData();
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: calculate CameraDistance based on model size
|
||||
private const float DefaultCameraDistance = 64f;
|
||||
private void InitializeCamera()
|
||||
@@ -437,6 +408,35 @@ namespace PckStudio.Rendering
|
||||
}
|
||||
}
|
||||
|
||||
public void SetPartOffset(SkinPartOffset offset)
|
||||
{
|
||||
SetPartOffset(offset.Type, offset.Value);
|
||||
}
|
||||
|
||||
public void SetPartOffset(string name, float value)
|
||||
{
|
||||
if (!partOffset.ContainsKey(name))
|
||||
{
|
||||
Debug.WriteLine($"'{name}' is not inside {nameof(partOffset)}");
|
||||
return;
|
||||
}
|
||||
partOffset[name] = value;
|
||||
}
|
||||
|
||||
private float GetOffset(string name)
|
||||
{
|
||||
return partOffset.ContainsKey(name) ? partOffset[name] : 0f;
|
||||
}
|
||||
|
||||
private void ModelData_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
if (e.Action != NotifyCollectionChangedAction.Move &&
|
||||
e.Action != NotifyCollectionChangedAction.Reset)
|
||||
{
|
||||
UpdateModelData();
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateModelData()
|
||||
{
|
||||
ReInitialzeSkinData();
|
||||
|
||||
Reference in New Issue
Block a user