mirror of
https://github.com/4sval/FModel.git
synced 2026-08-05 02:35:44 -05:00
Add optional .o.uasset editor-only data merging
This commit is contained in:
parent
0af2e0b704
commit
61df828b92
|
|
@ -282,6 +282,13 @@ namespace FModel.Settings
|
|||
set => SetProperty(ref _convertAudioOnBulkExport, value);
|
||||
}
|
||||
|
||||
private bool _mergeEditorOnlyDataExports = true;
|
||||
public bool MergeEditorOnlyDataExports
|
||||
{
|
||||
get => _mergeEditorOnlyDataExports;
|
||||
set => SetProperty(ref _mergeEditorOnlyDataExports, value);
|
||||
}
|
||||
|
||||
private bool _decompileLua;
|
||||
public bool DecompileLua
|
||||
{
|
||||
|
|
|
|||
|
|
@ -676,7 +676,34 @@ public class CUE4ParseViewModel : ViewModel
|
|||
|
||||
if (saveProperties || updateUi)
|
||||
{
|
||||
TabControl.SelectedTab.SetDocumentText(JsonConvert.SerializeObject(result.GetDisplayData(saveProperties), Formatting.Indented), saveProperties, updateUi);
|
||||
var displayData = result.GetDisplayData(saveProperties);
|
||||
|
||||
if (UserSettings.Default.MergeEditorOnlyDataExports && Provider.TryLoadPackage(entry.Path.SubstringBefore('.') + ".o.uasset", out var editorAsset))
|
||||
{
|
||||
var pkg = Provider.LoadPackage(entry.Path);
|
||||
var exports = pkg.GetExports().ToArray();
|
||||
var finalExports = new List<UObject>(exports);
|
||||
var editorOnlyDataExports = new HashSet<UObject>();
|
||||
|
||||
foreach (var export in exports)
|
||||
{
|
||||
var editorData = editorAsset.GetExportOrNull(export.Name + "EditorOnlyData");
|
||||
if (editorData == null)
|
||||
continue;
|
||||
|
||||
export.Properties.AddRange(editorData.Properties);
|
||||
editorOnlyDataExports.Add(editorData);
|
||||
}
|
||||
|
||||
if (editorOnlyDataExports.Count > 0)
|
||||
{
|
||||
finalExports.AddRange(editorAsset.GetExports().Where(editorExport => !editorOnlyDataExports.Contains(editorExport)));
|
||||
}
|
||||
|
||||
displayData = finalExports;
|
||||
}
|
||||
|
||||
TabControl.SelectedTab.SetDocumentText(JsonConvert.SerializeObject(displayData, Formatting.Indented), saveProperties, updateUi);
|
||||
if (saveProperties) break; // do not search for viewable exports if we are dealing with jsons
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@
|
|||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
|
|
@ -276,6 +277,18 @@
|
|||
TextChanged="CriwareKeyBox_TextChanged"
|
||||
Loaded="CriwareKeyBox_Loaded"/>
|
||||
|
||||
<TextBlock Grid.Row="22"
|
||||
Grid.Column="0"
|
||||
Text="Merge Editor-Only Data (.o.uasset)"
|
||||
VerticalAlignment="Center"
|
||||
ToolTip="Reads .o.uasset packages and merges their editor-only data into the parent asset. Useful for JSON-based asset export workflows"
|
||||
Margin="0 0 0 5" />
|
||||
<CheckBox Grid.Row="22"
|
||||
Grid.Column="2"
|
||||
Content="{Binding IsChecked, RelativeSource={RelativeSource Self}, Converter={x:Static converters:BoolToToggleConverter.Instance}}"
|
||||
IsChecked="{Binding MergeEditorOnlyDataExports, Source={x:Static local:Settings.UserSettings.Default}, Mode=TwoWay}"
|
||||
Margin="0 5 0 10"
|
||||
Style="{DynamicResource {x:Static adonisUi:Styles.ToggleSwitch}}" />
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
<DataTemplate x:Key="CreatorTemplate">
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user