Пример #1
0
        private static void WriteAttributesToFile()
        {
            if (!FileTools.TryOpenFolderDialog(out string folderPath, "Select Source Directory"))
            {
                return;
            }

            var meshesByAttribute = new Dictionary <string, List <string> >();


            foreach (var file in Directory.EnumerateFiles(folderPath, "*numshb", SearchOption.AllDirectories))
            {
                var node = new NumsbhNode(file);
                node.Open();

                UpdateMeshAttributes(folderPath, meshesByAttribute, file, node);
            }

            foreach (var pair in meshesByAttribute)
            {
                var outputText = new System.Text.StringBuilder();
                foreach (var value in pair.Value)
                {
                    outputText.AppendLine(value);
                }

                File.WriteAllText($"{pair.Key} Meshes.txt", outputText.ToString());
            }
        }
Пример #2
0
        public RNumdl(Modl modl, RSkeleton skeleton, Matl material, NumsbhNode meshNode, NuhlpbNode hlpbNode, Dictionary <string, Texture> textureByName)
        {
            Modl          = modl;
            Skeleton      = skeleton;
            Material      = material;
            TextureByName = textureByName;

            if (meshNode != null)
            {
                RenderModel = meshNode.GetRenderModel(Skeleton);
            }
            if (Material != null)
            {
                UpdateMaterials();
            }
            if (Skeleton != null)
            {
                hlpbNode?.AddToRenderSkeleton(Skeleton);
                UpdateBinds();
            }
        }
Пример #3
0
        private static void UpdateMeshAttributes(string folderPath, Dictionary <string, List <string> > meshesByAttribute, string file, NumsbhNode node)
        {
            foreach (var meshObject in node.mesh.Objects)
            {
                foreach (var attribute in meshObject.Attributes)
                {
                    if (!meshesByAttribute.ContainsKey(attribute.Name))
                    {
                        meshesByAttribute.Add(attribute.Name, new List <string>());
                    }

                    var text = $"{meshObject.Name} {file.Replace(folderPath, "")}";
                    if (!meshesByAttribute[attribute.Name].Contains(text))
                    {
                        meshesByAttribute[attribute.Name].Add(text);
                    }
                }
            }
        }