public void HandleModelConfig(FileInfo sourceFile, ModelConfig baseModel, List <Model3D> modelCollection, DataTreeObject dataTreeParent = null, Transform3D globalTransform = null, Dictionary <string, dynamic> extraData = null) { StaticSetConfig staticSet = (StaticSetConfig)baseModel.implementation; SetupCosmeticInformation(staticSet, dataTreeParent); string depth1Name = ResourceDirectoryGrabber.GetDirectoryDepth(sourceFile); string fullDepthName = ResourceDirectoryGrabber.GetDirectoryDepth(sourceFile, -1); if (staticSet.meshes != null) { SKAnimatorToolsProxy.IncrementEnd(staticSet.meshes.size()); if (extraData != null && extraData.ContainsKey("DirectArgs")) { Dictionary <string, dynamic> directs = extraData["DirectArgs"]; SKAnimatorToolsProxy.IncrementEnd(1); SKAnimatorToolsProxy.SetProgressState(ProgressBarState.ExtraWork); bool got = false; foreach (string key in directs.Keys) { Parameter param = baseModel.getParameter(key); if (param is Parameter.Direct direct) { if (direct.paths.Contains("implementation.model")) { staticSet.model = directs[key]; XanLogger.WriteLine("Set model to " + staticSet.model, XanLogger.DEBUG); SKAnimatorToolsProxy.IncrementProgress(); got = true; break; } } else if (param is Parameter.Choice choice) { foreach (Parameter.Direct dir in choice.directs) { if (dir.paths.Contains("implementation.model")) { staticSet.model = directs[key]; XanLogger.WriteLine("Set model to " + staticSet.model, XanLogger.DEBUG); SKAnimatorToolsProxy.IncrementProgress(); got = true; break; } } } } if (!got) { SKAnimatorToolsProxy.IncrementProgress(); // Just inc anyway } } // Export them all! object[] keys = staticSet.meshes.keySet().toArray(); SKAnimatorToolsProxy.IncrementEnd(keys.Length); foreach (object key in keys) { MeshSet subModel = (MeshSet)staticSet.meshes.get(key); VisibleMesh[] meshes = subModel.visible; int idx = 0; SKAnimatorToolsProxy.IncrementEnd(meshes.Length); foreach (VisibleMesh mesh in meshes) { string meshTitle = "-MeshSets[" + key.ToString() + "].Mesh[" + idx + "]"; Model3D meshToModel = GeometryConfigTranslator.GetGeometryInformation(mesh.geometry, fullDepthName + meshTitle); meshToModel.Name = depth1Name + meshTitle; meshToModel.ExtraData["StaticSetEntryName"] = key.ToString(); meshToModel.ExtraData["StaticSetConfig"] = staticSet; if (globalTransform != null) { meshToModel.Transform = globalTransform.compose(meshToModel.Transform); } //meshToModel.Textures.SetFrom(ModelPropertyUtility.FindTexturesFromDirects(baseModel)); //meshToModel.ActiveTexture = mesh.texture; (List <string> textureFiles, string active) = ModelPropertyUtility.FindTexturesAndActiveFromDirects(baseModel, mesh.texture); meshToModel.Textures.SetFrom(textureFiles); meshToModel.ActiveTexture = active; modelCollection.Add(meshToModel); idx++; SKAnimatorToolsProxy.IncrementProgress(); } SKAnimatorToolsProxy.IncrementProgress(); } } }