forked from mirror/DotRecast
Fixed where the dynamic voxel save file browser doesn't appear In Demo
This commit is contained in:
parent
65c572a4c2
commit
b88b6096f6
|
@ -10,7 +10,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||
- Nothing
|
||||
|
||||
### Fixed
|
||||
- Nothing
|
||||
- Fixed bug where the dynamic voxel save file browser doesn't appear in Recast.Demo
|
||||
|
||||
### Changed
|
||||
- Changed to reuse samples and edges list in BuildPolyDetail()
|
||||
|
|
|
@ -116,7 +116,8 @@ public class DynamicUpdateSampleTool : ISampleTool
|
|||
|
||||
if (mode == RcDynamicUpdateToolMode.BUILD)
|
||||
{
|
||||
var loadVoxelPopupStrId = "Load Voxels Popup";
|
||||
const string loadVoxelPopupStrId = "Load Voxels Popup";
|
||||
|
||||
bool isLoadVoxelPopup = true;
|
||||
if (ImGui.Button("Load Voxels..."))
|
||||
{
|
||||
|
@ -135,7 +136,7 @@ public class DynamicUpdateSampleTool : ISampleTool
|
|||
ImGui.EndPopup();
|
||||
}
|
||||
|
||||
var saveVoxelPopupStrId = "Save Voxels Popup";
|
||||
const string saveVoxelPopupStrId = "Save Voxels Popup";
|
||||
bool isSaveVoxelPopup = true;
|
||||
|
||||
var dynaMesh = _tool.GetDynamicNavMesh();
|
||||
|
@ -144,7 +145,7 @@ public class DynamicUpdateSampleTool : ISampleTool
|
|||
ImGui.Checkbox("Compression", ref compression);
|
||||
if (ImGui.Button("Save Voxels..."))
|
||||
{
|
||||
ImGui.BeginPopup(saveVoxelPopupStrId);
|
||||
ImGui.OpenPopup(saveVoxelPopupStrId);
|
||||
}
|
||||
|
||||
if (ImGui.BeginPopupModal(saveVoxelPopupStrId, ref isSaveVoxelPopup, ImGuiWindowFlags.NoTitleBar))
|
||||
|
@ -152,9 +153,7 @@ public class DynamicUpdateSampleTool : ISampleTool
|
|||
var picker = ImFilePicker.GetFilePicker(saveVoxelPopupStrId, Path.Combine(Environment.CurrentDirectory), ".voxels");
|
||||
if (picker.Draw())
|
||||
{
|
||||
if (string.IsNullOrEmpty(picker.SelectedFile))
|
||||
Save(picker.SelectedFile);
|
||||
|
||||
Save(picker.SelectedFile);
|
||||
ImFilePicker.RemoveFilePicker(saveVoxelPopupStrId);
|
||||
}
|
||||
|
||||
|
|
|
@ -159,7 +159,7 @@ namespace DotRecast.Recast.Toolset.Tools
|
|||
public void Save(string filename, bool compression, IRcCompressor compressor)
|
||||
{
|
||||
DtVoxelFile voxelFile = DtVoxelFile.From(dynaMesh);
|
||||
using var fs = new FileStream(filename, FileMode.CreateNew, FileAccess.Write);
|
||||
using var fs = new FileStream(filename, FileMode.OpenOrCreate, FileAccess.Write, FileShare.ReadWrite);
|
||||
using var bw = new BinaryWriter(fs);
|
||||
DtVoxelFileWriter writer = new DtVoxelFileWriter(compressor);
|
||||
writer.Write(bw, voxelFile, compression);
|
||||
|
|
Loading…
Reference in New Issue