Ploaj/StudioSB

StudioSB throws exception upon exporting model as .dae, .obj, and .smd

Opened this issue · 1 comments

Using the latest commit of StudioSB, upon exporting any vanilla model as .dae results in this exception:

System.NullReferenceException: Object reference not set to an instance of an object.
   at IONET.Collada.ColladaExporter.ProcessMesh(IOMesh mesh, IOModel model)
   at IONET.Collada.ColladaExporter.ProcessModel(IOModel model)
   at IONET.Collada.ColladaExporter.ExportScene(IOScene scene, String filePath)
   at IONET.IOManager.ExportScene(IOScene scene, String filePath, ExportSettings settings)
   at StudioSB.MainForm.SaveScene(Object sender, EventArgs args)

Exporting as OBJ and SMD provide a different exception but share the same one (aside from the line with the forward slash):

System.ArgumentException: An item with the same key has already been added.
   at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at IONET.Core.IOScene.CleanMaterialNames()
   at IONET.Wavefront.OBJExporter.ExportScene(IOScene scene, String filePath) / at IONET.SMD.SMDExporter.ExportScene(IOScene scene, String filePath)
   at IONET.IOManager.ExportScene(IOScene scene, String filePath, ExportSettings settings)
   at StudioSB.MainForm.SaveScene(Object sender, EventArgs args)

Newest latest commit appears to have fixed OBJ and SMD exporting, however DAE exporting still remains to be fixed. It turns out exporting the model from: /stage/mario_castledx/normal/model/ring_set/ leads to a different exception for exporting as DAE:

System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
   at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
   at IONET.Collada.ColladaExporter.<>c__DisplayClass14_1.<GenerateGeometry>b__3(IOVertex e)
   at System.Linq.Enumerable.<SelectManyIterator>d__17`2.MoveNext()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at IONET.Collada.ColladaExporter.GenerateGeometry(IOMesh mesh)
   at IONET.Collada.ColladaExporter.GenerateGeometryController(IOMesh mesh, IOSkeleton skeleton)
   at IONET.Collada.ColladaExporter.ProcessMesh(IOMesh mesh, IOModel model)
   at IONET.Collada.ColladaExporter.ProcessModel(IOModel model)
   at IONET.Collada.ColladaExporter.ExportScene(IOScene scene, String filePath, ExportSettings settings)
   at IONET.IOManager.ExportScene(IOScene scene, String filePath, ExportSettings settings)
   at StudioSB.MainForm.SaveScene(Object sender, EventArgs args)

It also turns out exporting Min Min's model successfully exports the model as DAE, but for the models I've tested (which are stages) it results in one of the two above exceptions.