private static int ConvertSkinnedModel(SkinnedModelToGltfOptions opts) { try { Skeleton skeleton = ReadSkeleton(opts.SkeletonPath); List <(string, LeagueAnimation)> animations = null; if (!string.IsNullOrEmpty(opts.AnimationsFolder)) { string[] animationFiles = Directory.GetFiles(opts.AnimationsFolder, "*.anm"); animations = ReadAnimations(animationFiles); } else { animations = ReadAnimations(opts.AnimationPaths); } // Check animation compatibility foreach (var animation in animations) { if (!animation.Item2.IsCompatibleWithSkeleton(skeleton)) { Console.WriteLine("Warning: Found an animation that's potentially not compatible with the provided skeleton - " + animation.Item1); } } SkinnedModelToGltf skinnedModelToGltf = new SkinnedModelToGltf() { OutputPath = opts.OutputPath, Animations = animations, MaterialTextures = CreateMaterialTextureMap(opts.MaterialTextures), SimpleSkinPath = opts.SimpleSkinPath, SkeletonPath = opts.SkeletonPath }; LeagueConverter.ConvertSkinnedModel(skinnedModelToGltf); } catch (Exception exception) { Console.WriteLine("Failed to convert Skinned Model to glTF"); Console.WriteLine(exception); } return(1); }
private static int ConvertMapGeometryToGltf(ConvertMapGeometryToGltfOptions opts) { try { ConvertMapGeometryToGltf convertMapGeometryToGltf = new ConvertMapGeometryToGltf() { MapGeometryPath = opts.MapGeometryPath, OutputPath = opts.OutputPath }; LeagueConverter.ConvertMapGeometryToGltf(convertMapGeometryToGltf); } catch (Exception exception) { Console.WriteLine("Failed to convert Map Geometry to glTF"); Console.WriteLine(exception); } return(1); }
// ------------- COMMANDS ------------- \\ private static int ConvertSimpleSkin(SimpleSkinToGltfOptions opts) { try { SimpleSkinToGltf simpleSkinToGltf = new SimpleSkinToGltf() { OutputPath = opts.OutputPath, SimpleSkinPath = opts.SimpleSkinPath, MaterialTextures = CreateMaterialTextureMap(opts.MaterialTextures) }; LeagueConverter.ConvertSimpleSkin(simpleSkinToGltf); } catch (Exception exception) { Console.WriteLine("Failed to convert Simple Skin to glTF"); Console.WriteLine(exception); } return(1); }
private static int CreateSimpleSkinFromLegacy(CreateSimpleSkinFromLegacyOptions opts) { try { CreateSimpleSkinFromLegacy createSimpleSkinFromLegacy = new CreateSimpleSkinFromLegacy() { SimpleSkinPath = opts.SimpleSkinPath, StaticObjectPath = opts.StaticObjectPath, WeightFilePath = opts.WeightFilePath }; LeagueConverter.CreateSimpleSkinFromLegacy(createSimpleSkinFromLegacy); } catch (Exception exception) { Console.WriteLine("Failed to convert Simple Skin to glTF"); Console.WriteLine(exception); } return(1); }