1
0
mirror of synced 2024-12-01 02:27:22 +01:00

Fix DAE export if no skeleton is used

This commit is contained in:
KillzXGaming 2019-11-16 13:48:06 -05:00
parent 13933911cb
commit e7246fb79f
3 changed files with 25 additions and 3 deletions

View File

@ -123,7 +123,11 @@ namespace FirstPlugin.NLG
model.Materials = Materials;
model.Objects = Renderer.Meshes;
DAE.Export(fileName, settings, model, textures);
STSkeleton skeleton = null;
if (DrawableContainer.Drawables.Count > 1)
skeleton = (STSkeleton)DrawableContainer.Drawables[1];
DAE.Export(fileName, settings, model, textures, skeleton);
}
public enum SectionMagic : uint

View File

@ -486,6 +486,7 @@ namespace Toolbox.Library.Collada
{
Writer.WriteEndElement();
if (Joints?.Count > 0)
CreateControllerSection();
CreateVisualNodeSection();
@ -611,6 +612,7 @@ namespace Toolbox.Library.Collada
InvBinds[i * 16 + j] = meshJoints[i].BindPose[j];
}
}
var Weights = new List<object>();
var WeightIndices = new List<int>();
foreach (var v in BoneWeight.Item2)

View File

@ -11,6 +11,7 @@ using System.Xml;
using OpenTK;
using Toolbox.Library.Rendering;
using Toolbox.Library.Collada;
using Toolbox.Library.IO;
namespace Toolbox.Library
{
@ -84,7 +85,22 @@ namespace Toolbox.Library
if (settings.ExportTextures) {
var bitmap = Textures[i].GetBitmap();
bitmap.Save($"{TexturePath}/{Textures[i].Text}.png");
string textureName = Textures[i].Text;
if (textureName.RemoveIllegaleFileNameCharacters() != textureName)
{
string properName = textureName.RemoveIllegaleFileNameCharacters();
for (int m = 0; m < Materials?.Count; m++) {
foreach (var tex in Materials[m].TextureMaps) {
if (tex.Name == textureName)
tex.Name = properName;
}
}
textureName = properName;
}
bitmap.Save($"{TexturePath}/{textureName}.png");
bitmap.Dispose();
GC.Collect();