AcTools.Kn5File.Kn5.FromModelsIniFile C# (CSharp) Method

FromModelsIniFile() public static method

public static FromModelsIniFile ( string filename, bool skipTextures = false ) : Kn5
filename string
skipTextures bool
return Kn5
        public static Kn5 FromModelsIniFile(string filename, bool skipTextures = false) {
            if (!File.Exists(filename)) {
                throw new FileNotFoundException(filename);
            }

            var result = CreateEmpty();
            var directory = Path.GetDirectoryName(filename) ?? "";
            foreach (var section in new IniFile(filename).GetSections("MODEL").Select(x => new {
                Filename = Path.Combine(directory, x.GetNonEmpty("FILE") ?? ""),
                Position = x.GetVector3F("POSITION"),
                Rotation = x.GetVector3F("ROTATION")
            }).Where(x => File.Exists(x.Filename))) {
                var kn5 = FromFile(section.Filename, skipTextures);
                result.Combine(kn5, section.Position, section.Rotation);
            }

            return result;
        }