Skip to content

Commit

Permalink
SedEd: Sequences with ObjName property display name
Browse files Browse the repository at this point in the history
Fix TaskPane not showing file names
  • Loading branch information
SirCxyrtyx committed Jun 27, 2019
1 parent d515eaa commit ec26195
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 26 deletions.
35 changes: 21 additions & 14 deletions ME3Explorer/BinaryInterpreter/BinaryInterpreterWPF.xaml.cs
Expand Up @@ -2908,7 +2908,7 @@ private List<object> StartAnimSequenceScan(byte[] data, ref int binarystart)
{
var TrackOffsets = CurrentLoadedExport.GetProperty<ArrayProperty<IntProperty>>("CompressedTrackOffsets");
var animsetData = CurrentLoadedExport.GetProperty<ObjectProperty>("m_pBioAnimSetData");
var boneList = Pcc.getUExport(animsetData.Value).GetProperty<ArrayProperty<NameProperty>>("TrackBoneNames").ToList();
var boneList = Pcc.getUExport(animsetData.Value).GetProperty<ArrayProperty<NameProperty>>("TrackBoneNames");
Enum.TryParse(CurrentLoadedExport.GetProperty<EnumProperty>("RotationCompressionFormat").Value.Name, out AnimationCompressionFormat rotCompression);
int offset = binarystart;

Expand Down Expand Up @@ -2938,12 +2938,12 @@ private List<object> StartAnimSequenceScan(byte[] data, ref int binarystart)
};
subnodes.Add(BoneID);

for (int c = 0; c < bonePosCount; c++)
for (int j = 0; j < bonePosCount; j++)
{
offset = animBinStart + bonePosOffset + c * 12;
offset = animBinStart + bonePosOffset + j * 12;
var PosKeys = new BinInterpTreeItem
{
Header = $"0x{offset:X5} PosKey {c}",
Header = $"0x{offset:X5} PosKey {j}",
Name = "_" + offset,
Tag = NodeType.Unknown
};
Expand Down Expand Up @@ -2981,20 +2981,19 @@ private List<object> StartAnimSequenceScan(byte[] data, ref int binarystart)
i++;
var boneRotCount = TrackOffsets[i].Value;
int l = 12; // 12 length of rotation by default
var RotKeys = new BinInterpTreeItem();
switch(rotCompression)
{
case AnimationCompressionFormat.ACF_None:
case AnimationCompressionFormat.ACF_Float96NoW:
for (int r = 0; r < boneRotCount; r++)
for (int j = 0; j < boneRotCount; j++)
{
if (rotCompression == AnimationCompressionFormat.ACF_None)
l = 16;

offset = animBinStart + boneRotOffset + r * l;
RotKeys = new BinInterpTreeItem
offset = animBinStart + boneRotOffset + j * l;
var RotKeys = new BinInterpTreeItem
{
Header = $"0x{offset:X5} RotKey {r}",
Header = $"0x{offset:X5} RotKey {j}",
Name = "_" + offset,
Tag = NodeType.Unknown
};
Expand Down Expand Up @@ -3042,14 +3041,22 @@ private List<object> StartAnimSequenceScan(byte[] data, ref int binarystart)
case AnimationCompressionFormat.ACF_Fixed32NoW:
case AnimationCompressionFormat.ACF_IntervalFixed32NoW:
case AnimationCompressionFormat.ACF_Float32NoW:
case AnimationCompressionFormat.ACF_BioFixed48:
RotKeys = new BinInterpTreeItem
BoneID.Items.Add(new BinInterpTreeItem
{
Header = $"0x{offset:X5} Rotationformat {rotCompression} cannot be parsed at this time.",
Name = "_" + offset,
Tag = NodeType.Unknown
};
BoneID.Items.Add(RotKeys);
});
break;
case AnimationCompressionFormat.ACF_BioFixed48:
const float shift = 0.70710678118f;
const float scale = 1.41421356237f;
float x = (data[0] & 0x7FFF) / 32767.0f * scale - shift;
float y = (data[1] & 0x7FFF) / 32767.0f * scale - shift;
float z = (data[2] & 0x7FFF) / 32767.0f * scale - shift;
float w = 1.0f - (x * x + y * y + z * z);
w = w >= 0.0f ? (float)Math.Sqrt(w) : 0.0f;
int s = ((data[0] >> 14) & 2) | ((data[1] >> 15) & 1);
break;
}

Expand All @@ -3058,7 +3065,7 @@ private List<object> StartAnimSequenceScan(byte[] data, ref int binarystart)
}
catch (Exception ex)
{
subnodes.Add(new BinInterpTreeItem() { Header = $"Error reading binary data: {ex}" });
subnodes.Add(new BinInterpTreeItem { Header = $"Error reading binary data: {ex}" });
}
return subnodes;
}
Expand Down
7 changes: 6 additions & 1 deletion ME3Explorer/MEDirectories/ME1Directory.cs
Expand Up @@ -15,7 +15,12 @@ public static class ME1Directory
private static string _gamePath;
public static string gamePath
{
get => _gamePath;
get
{
if (_gamePath == null)
return null;
return Path.GetFullPath(_gamePath); //normalize
}
set
{
if (value != null)
Expand Down
9 changes: 7 additions & 2 deletions ME3Explorer/MEDirectories/ME2Directory.cs
Expand Up @@ -11,10 +11,15 @@ namespace ME3Explorer
{
public static class ME2Directory
{
private static string _gamePath = null;
private static string _gamePath;
public static string gamePath
{
get => _gamePath;
get
{
if (_gamePath == null)
return null;
return Path.GetFullPath(_gamePath); //normalize
}
set
{
if (value != null)
Expand Down
7 changes: 2 additions & 5 deletions ME3Explorer/MEDirectories/ME3Directory.cs
Expand Up @@ -11,17 +11,14 @@ namespace ME3Explorer
{
public static class ME3Directory
{
private static string _gamePath = null;
private static string _gamePath;
public static string gamePath
{
get
{
if (_gamePath == null)
return null;

if (!_gamePath.EndsWith("\\"))
_gamePath += '\\';
return _gamePath;
return Path.GetFullPath(_gamePath); //normalize
}
set
{
Expand Down
4 changes: 2 additions & 2 deletions ME3Explorer/Main Window/TaskPane.xaml
Expand Up @@ -40,7 +40,7 @@
<ColumnDefinition Width="16"/>
</Grid.ColumnDefinitions>
<Viewbox StretchDirection="DownOnly" HorizontalAlignment="Left" Width="375">
<TextBlock Text="{Binding FileName, Converter={StaticResource pathToFilenameConverter}, Mode=OneWay}" FontSize="19"
<TextBlock Text="{Binding FilePath, Converter={StaticResource pathToFilenameConverter}, Mode=OneWay}" FontSize="19"
FontFamily="{StaticResource TitilliumWeb-Regular}" Foreground="#FFFDFDFD"/>
</Viewbox>
<Image Grid.Column="1" Width="16" Height="16"
Expand Down Expand Up @@ -80,7 +80,7 @@
<Grid Grid.Column="1" Background="#6601050D">
<StackPanel Margin="14,17">
<TextBlock Text="Location:" FontFamily="{StaticResource TitilliumWeb-SemiBold}" FontSize="19" Foreground="#FFFDFDFD" VerticalAlignment="Center" Margin="0,-10,0,0"/>
<TextBlock Text="{Binding FileName, Converter={StaticResource pathToLocationConverter}, Mode=OneWay}" Foreground="#FFF9F9F9"
<TextBlock Text="{Binding FilePath, Converter={StaticResource pathToLocationConverter}, Mode=OneWay}" Foreground="#FFF9F9F9"
FontSize="16" FontFamily="{StaticResource TitilliumWeb-Light}" Margin="0,-5,0,0"/>
<TextBlock FontFamily="{StaticResource TitilliumWeb-SemiBold}" FontSize="15" Foreground="#FFFDFDFD" Margin="10,0,0,0">
Open In: <Run Text="{Binding Tools.Count, Mode=OneWay, Converter={StaticResource countToStringConverter}, ConverterParameter=tool}"
Expand Down
11 changes: 10 additions & 1 deletion ME3Explorer/Sequence Editor/SequenceEditorWPF.xaml.cs
Expand Up @@ -332,7 +332,16 @@ private void LoadSequences()

private TreeViewEntry FindSequences(ExportEntry rootSeq, bool wantFullName = false)
{
var root = new TreeViewEntry(rootSeq, $"#{rootSeq.UIndex}: {(wantFullName ? rootSeq.GetFullPath : rootSeq.ObjectName)}")
string seqName = wantFullName ? rootSeq.GetFullPath : "";
if (rootSeq.GetProperty<StrProperty>("ObjName") is StrProperty objName)
{
seqName += objName;
}
else
{
seqName += rootSeq.ObjectName;
}
var root = new TreeViewEntry(rootSeq, $"#{rootSeq.UIndex}: {seqName}")
{
IsExpanded = true
};
Expand Down
2 changes: 1 addition & 1 deletion ME3Explorer/Unreal/Classes/AnimSet.cs
Expand Up @@ -44,7 +44,7 @@ public AnimSet(ExportEntry export)

PropertyCollection props = export.GetProperties();
m_pBioAnimSetData = props.GetPropOrDefault<ObjectProperty>("m_pBioAnimSetData").Value;
if (pcc.isExport(m_pBioAnimSetData))
if (pcc.isUExport(m_pBioAnimSetData))
{
SetData = new BioAnimSetData(pcc.getUExport(m_pBioAnimSetData));
}
Expand Down

0 comments on commit ec26195

Please sign in to comment.