Fix DAE export if no skeleton is used
This commit is contained in:
parent
13933911cb
commit
e7246fb79f
@ -123,7 +123,11 @@ namespace FirstPlugin.NLG
|
|||||||
model.Materials = Materials;
|
model.Materials = Materials;
|
||||||
model.Objects = Renderer.Meshes;
|
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
|
public enum SectionMagic : uint
|
||||||
|
@ -486,6 +486,7 @@ namespace Toolbox.Library.Collada
|
|||||||
{
|
{
|
||||||
Writer.WriteEndElement();
|
Writer.WriteEndElement();
|
||||||
|
|
||||||
|
if (Joints?.Count > 0)
|
||||||
CreateControllerSection();
|
CreateControllerSection();
|
||||||
|
|
||||||
CreateVisualNodeSection();
|
CreateVisualNodeSection();
|
||||||
@ -611,6 +612,7 @@ namespace Toolbox.Library.Collada
|
|||||||
InvBinds[i * 16 + j] = meshJoints[i].BindPose[j];
|
InvBinds[i * 16 + j] = meshJoints[i].BindPose[j];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var Weights = new List<object>();
|
var Weights = new List<object>();
|
||||||
var WeightIndices = new List<int>();
|
var WeightIndices = new List<int>();
|
||||||
foreach (var v in BoneWeight.Item2)
|
foreach (var v in BoneWeight.Item2)
|
||||||
|
@ -11,6 +11,7 @@ using System.Xml;
|
|||||||
using OpenTK;
|
using OpenTK;
|
||||||
using Toolbox.Library.Rendering;
|
using Toolbox.Library.Rendering;
|
||||||
using Toolbox.Library.Collada;
|
using Toolbox.Library.Collada;
|
||||||
|
using Toolbox.Library.IO;
|
||||||
|
|
||||||
namespace Toolbox.Library
|
namespace Toolbox.Library
|
||||||
{
|
{
|
||||||
@ -84,7 +85,22 @@ namespace Toolbox.Library
|
|||||||
|
|
||||||
if (settings.ExportTextures) {
|
if (settings.ExportTextures) {
|
||||||
var bitmap = Textures[i].GetBitmap();
|
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();
|
bitmap.Dispose();
|
||||||
|
|
||||||
GC.Collect();
|
GC.Collect();
|
||||||
|
Loading…
Reference in New Issue
Block a user