コード例 #1
0
ファイル: MainWindow.xaml.cs プロジェクト: Nuke928/PonyKart
        /// <summary>
        /// Takes the stuff from the .scene loader and puts them into our NodeData classes
        /// </summary>
        private void OpenSceneFile(string filename)
        {
            DSL = new DotSceneLoader();
            DSL.ParseDotScene(filename);

            Data = new Collection<NodeData>();

            foreach (Node node in DSL.Nodes) {
                NodeData data = new NodeData {
                    Name = node.Name,
                    // basically, if our object's name has a # in it, it's treated as a thing. Otherwise it isn't.
                    UsesThing = node.Name.Contains("#"),
                    ThingFile = node.Name.Contains("#") ? node.Name.Substring(0, node.Name.IndexOf("#")) : "",
                    // have to split up all of these since the table doesn't know what to do with a Vector3 etc
                    PosX = node.Position.x,
                    PosY = node.Position.y,
                    PosZ = node.Position.z,
                    OrientX = node.Orientation.x,
                    OrientY = node.Orientation.y,
                    OrientZ = node.Orientation.z,
                    OrientW = node.Orientation.w,
                    ScaleX = node.Dimensions.x,
                    ScaleY = node.Dimensions.y,
                    ScaleZ = node.Dimensions.z,
                    // only using these for re-exporting the .scene with the things removed
                    Mesh = node.Entity != null ? node.Entity.Mesh : null,
                    Material = node.Entity != null ? node.Entity.Material : null,
                    Static = node.Entity != null ? node.Entity.Static : false,
                    CastShadows = node.Entity != null ? node.Entity.CastShadows : false,
                    ReceiveShadows = node.Entity != null ? node.Entity.ReceiveShadows : false,
                };

                Data.Add(data);
            }
            dataGrid.ItemsSource = Data;

            mapRegionTextBox.Text = "";
            Title = ".scene to .muffin converter - " + filename;
        }
コード例 #2
0
ファイル: MainWindow.xaml.cs プロジェクト: Nuke928/PonyKart
        /// <summary>
        /// Takes the stuff from the .scene loader and puts them into our NodeData classes
        /// </summary>
        private void OpenSceneFile(string filename)
        {
            DSL = new DotSceneLoader();
            DSL.ParseDotScene(filename);

            Data = new List<NodeData>();

            foreach (Node node in DSL.Nodes) {
                NodeData data = new NodeData {
                    // we'll use this as the trigger ID
                    Name = node.Name.Contains("_")
                        ? node.Name.Substring(13, node.Name.IndexOf("_") - 13)
                        : node.Name.Substring(13),
                    // have to split up all of these since the table doesn't know what to do with a Vector3 etc
                    PosX = node.Position.x,
                    PosY = node.Position.y,
                    PosZ = node.Position.z,
                    OrientX = node.Orientation.x,
                    OrientY = node.Orientation.y,
                    OrientZ = node.Orientation.z,
                    OrientW = node.Orientation.w,
                    ScaleX = node.Dimensions.x,
                    ScaleY = node.Dimensions.y,
                    ScaleZ = node.Dimensions.z,
                };
                // and we'll use this as the ID it goes to
                data.ThingFile = node.Name.Contains("_")
                        ? node.Name.Substring(node.Name.IndexOf("_") + 1)
                        : "" + (int.Parse(data.Name, culture) + 1);

                Data.Add(data);
            }
        }