mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-15 13:14:17 +01:00
Finish up mesh material combos
This commit is contained in:
parent
a581495c7e
commit
b22470ac79
2 changed files with 21 additions and 19 deletions
|
|
@ -1,4 +1,3 @@
|
||||||
using System.Collections.ObjectModel;
|
|
||||||
using OtterGui;
|
using OtterGui;
|
||||||
using Penumbra.GameData;
|
using Penumbra.GameData;
|
||||||
using Penumbra.GameData.Files;
|
using Penumbra.GameData.Files;
|
||||||
|
|
@ -24,11 +23,13 @@ public partial class ModEditWindow
|
||||||
// Meshes using the removed material are redirected to material 0, and those after the index are corrected.
|
// Meshes using the removed material are redirected to material 0, and those after the index are corrected.
|
||||||
for (var meshIndex = 0; meshIndex < Mdl.Meshes.Length; meshIndex++)
|
for (var meshIndex = 0; meshIndex < Mdl.Meshes.Length; meshIndex++)
|
||||||
{
|
{
|
||||||
var mesh = Mdl.Meshes[meshIndex];
|
var newIndex = Mdl.Meshes[meshIndex].MaterialIndex;
|
||||||
if (mesh.MaterialIndex == materialIndex)
|
if (newIndex == materialIndex)
|
||||||
mesh.MaterialIndex = 0;
|
newIndex = 0;
|
||||||
else if (mesh.MaterialIndex > materialIndex)
|
else if (newIndex > materialIndex)
|
||||||
mesh.MaterialIndex -= 1;
|
newIndex -= 1;
|
||||||
|
|
||||||
|
Mdl.Meshes[meshIndex].MaterialIndex = newIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
Mdl.Materials = Mdl.Materials.RemoveItems(materialIndex);
|
Mdl.Materials = Mdl.Materials.RemoveItems(materialIndex);
|
||||||
|
|
|
||||||
|
|
@ -158,27 +158,28 @@ public partial class ModEditWindow
|
||||||
|
|
||||||
var ret = false;
|
var ret = false;
|
||||||
|
|
||||||
// Mesh material.
|
// Mesh material
|
||||||
// var temp = tab.GetMeshMaterial(meshIndex);
|
|
||||||
// if (
|
|
||||||
// ImGui.InputText("Material", ref temp, Utf8GamePath.MaxGamePathLength, disabled ? ImGuiInputTextFlags.ReadOnly : ImGuiInputTextFlags.None)
|
|
||||||
// && temp.Length > 0
|
|
||||||
// && temp != tab.GetMeshMaterial(meshIndex)
|
|
||||||
// ) {
|
|
||||||
// tab.SetMeshMaterial(meshIndex, temp);
|
|
||||||
// ret = true;
|
|
||||||
// }
|
|
||||||
ImGui.TableNextColumn();
|
ImGui.TableNextColumn();
|
||||||
ImGui.Text("Material");
|
ImGui.Text("Material");
|
||||||
|
|
||||||
ImGui.TableNextColumn();
|
ImGui.TableNextColumn();
|
||||||
ImGui.SetNextItemWidth(-1);
|
ImGui.SetNextItemWidth(-1);
|
||||||
using (var materialCombo = ImRaii.Combo("##material", "TODO material"))
|
using (var materialCombo = ImRaii.Combo("##material", tab.Mdl.Materials[mesh.MaterialIndex]))
|
||||||
{
|
{
|
||||||
// todo
|
if (materialCombo)
|
||||||
|
{
|
||||||
|
foreach (var (material, materialIndex) in tab.Mdl.Materials.WithIndex())
|
||||||
|
{
|
||||||
|
if (ImGui.Selectable(material, mesh.MaterialIndex == materialIndex))
|
||||||
|
{
|
||||||
|
file.Meshes[meshIndex].MaterialIndex = (ushort)materialIndex;
|
||||||
|
ret = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Submeshes.
|
// Submeshes
|
||||||
for (var submeshOffset = 0; submeshOffset < mesh.SubMeshCount; submeshOffset++)
|
for (var submeshOffset = 0; submeshOffset < mesh.SubMeshCount; submeshOffset++)
|
||||||
{
|
{
|
||||||
using var submeshId = ImRaii.PushId(submeshOffset);
|
using var submeshId = ImRaii.PushId(submeshOffset);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue