private void LoadBoxOccluder()
        {
            if (CurrentBoxOccluder == null)
            {
                ////Panel.Enabled = false;
                AddToProjectButton.Enabled = false;
                DeleteButton.Enabled       = false;
                CenterTextBox.Text         = string.Empty;
                SizeTextBox.Text           = string.Empty;
                SinCosZTextBox.Text        = string.Empty;
            }
            else
            {
                populatingui = true;
                var b = CurrentBoxOccluder;
                ////Panel.Enabled = true;
                AddToProjectButton.Enabled = !ProjectForm.YmapExistsInProject(CurrentBoxOccluder.Ymap);
                DeleteButton.Enabled       = !AddToProjectButton.Enabled;
                CenterTextBox.Text         = FloatUtil.GetVector3String(b.Position);
                SizeTextBox.Text           = FloatUtil.GetVector3String(b.Size);
                var dir = b.Orientation.Multiply(Vector3.UnitX) * 0.5f;
                SinCosZTextBox.Text = FloatUtil.GetVector2String(new Vector2(dir.X, dir.Y));
                populatingui        = false;

                if (ProjectForm.WorldForm != null)
                {
                    ProjectForm.WorldForm.SelectObject(CurrentBoxOccluder);
                }
            }
        }
Exemple #2
0
        private void CalcYmapExtents()
        {
            if (Ymap == null)
            {
                return;
            }

            var allents    = Ymap.AllEntities;
            var allbatches = Ymap.GrassInstanceBatches;

            if ((allents == null) && (allbatches == null))
            {
                MessageBox.Show("No items to calculate extents from.");
                return;
            }

            lock (ProjectForm.ProjectSyncRoot)
            {
                if (Ymap.CalcExtents())
                {
                    SetYmapHasChanged(true);
                }
            }

            populatingui = true;
            var md = Ymap.CMapData;

            YmapEntitiesExtentsMinTextBox.Text  = FloatUtil.GetVector3String(md.entitiesExtentsMin);
            YmapEntitiesExtentsMaxTextBox.Text  = FloatUtil.GetVector3String(md.entitiesExtentsMax);
            YmapStreamingExtentsMinTextBox.Text = FloatUtil.GetVector3String(md.streamingExtentsMin);
            YmapStreamingExtentsMaxTextBox.Text = FloatUtil.GetVector3String(md.streamingExtentsMax);
            populatingui = false;
        }
Exemple #3
0
        private void CalcYmapExtents()
        {
            if (populatingui)
            {
                return;
            }
            if (Ymap == null)
            {
                return;
            }

            lock (ProjectForm.ProjectSyncRoot)
            {
                if (Ymap.CalcExtents())
                {
                    SetYmapHasChanged(true);
                }
            }

            populatingui = true;
            var md = Ymap.CMapData;

            YmapEntitiesExtentsMinTextBox.Text  = FloatUtil.GetVector3String(md.entitiesExtentsMin);
            YmapEntitiesExtentsMaxTextBox.Text  = FloatUtil.GetVector3String(md.entitiesExtentsMax);
            YmapStreamingExtentsMinTextBox.Text = FloatUtil.GetVector3String(md.streamingExtentsMin);
            YmapStreamingExtentsMaxTextBox.Text = FloatUtil.GetVector3String(md.streamingExtentsMax);
            populatingui = false;
        }
Exemple #4
0
        private void LoadItems()
        {
            MultiItem = new MapSelection();
            MultiItem.Clear();
            MultiItem.SetMultipleSelectionItems(Items);

            if (Items == null)
            {
                PositionTextBox.Text  = string.Empty;
                RotationQuatBox.Value = Quaternion.Identity;
                ScaleTextBox.Text     = string.Empty;
                ItemsListBox.Items.Clear();
            }
            else
            {
                populatingui = true;


                PositionTextBox.Text  = FloatUtil.GetVector3String(MultiItem.MultipleSelectionCenter);
                RotationQuatBox.Value = MultiItem.MultipleSelectionRotation;
                ScaleTextBox.Text     = FloatUtil.GetVector3String(MultiItem.MultipleSelectionScale);
                ItemsListBox.Items.Clear();
                foreach (var item in Items)
                {
                    ItemsListBox.Items.Add(item);
                }

                populatingui = false;
            }
        }
Exemple #5
0
        private void LoadTriangle()
        {
            if (CurrentTriangle == null)
            {
                ////Panel.Enabled = false;
                TriangleAddToProjectButton.Enabled = false;
                TriangleDeleteButton.Enabled       = false;
                TriangleCenterTextBox.Text         = string.Empty;
                TriangleCorner1TextBox.Text        = string.Empty;
                TriangleCorner2TextBox.Text        = string.Empty;
                TriangleCorner3TextBox.Text        = string.Empty;
            }
            else
            {
                populatingui = true;
                var t = CurrentTriangle;
                ////Panel.Enabled = true;
                TriangleAddToProjectButton.Enabled = !ProjectForm.YmapExistsInProject(CurrentTriangle.Ymap);
                TriangleDeleteButton.Enabled       = !TriangleAddToProjectButton.Enabled;
                TriangleCenterTextBox.Text         = FloatUtil.GetVector3String(t.Center);
                TriangleCorner1TextBox.Text        = FloatUtil.GetVector3String(t.Corner1);
                TriangleCorner2TextBox.Text        = FloatUtil.GetVector3String(t.Corner2);
                TriangleCorner3TextBox.Text        = FloatUtil.GetVector3String(t.Corner3);
                populatingui = false;

                //if (ProjectForm.WorldForm != null)
                //{
                //    ProjectForm.WorldForm.SelectObject(CurrentTriangle);
                //}
            }
        }
        public void UpdateTrainTrackNodeUI()
        {
            if (TrainNode == null)
            {
                //TrainNodePanel.Enabled = false;
                TrainNodeDeleteButton.Enabled       = false;
                TrainNodeAddToProjectButton.Enabled = false;
                TrainNodePositionTextBox.Text       = string.Empty;
                TrainNodeTypeComboBox.SelectedIndex = -1;
            }
            else
            {
                populatingui = true;
                //TrainNodePanel.Enabled = true;
                TrainNodeDeleteButton.Enabled       = ProjectForm.TrainTrackExistsInProject(TrainNode.Track);
                TrainNodeAddToProjectButton.Enabled = !TrainNodeDeleteButton.Enabled;
                TrainNodePositionTextBox.Text       = FloatUtil.GetVector3String(TrainNode.Position);
                TrainNodeTypeComboBox.SelectedIndex = TrainNode.NodeType;
                populatingui = false;

                if (ProjectForm.WorldForm != null)
                {
                    ProjectForm.WorldForm.SelectTrainTrackNode(TrainNode);
                }
            }
        }
        private void EntitySearchExportResultsButton_Click(object sender, EventArgs e)
        {
            if (EntityResults.Count == 0)
            {
                MessageBox.Show("Nothing to export!");
                return;
            }

            SaveFileDialog.FileName = "Entities_" + EntitySearchTextBox.Text;
            if (SaveFileDialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            string fname = SaveFileDialog.FileName;

            StringBuilder sb = new StringBuilder();

            sb.AppendLine("ArchetypeName, PositionX, PositionY, PositionZ, RotationX, RotationY, RotationZ, RotationW, YmapFile");
            foreach (var ent in EntityResults)
            {
                sb.AppendLine(string.Format("{0}, {1}, {2}, {3}", ent.Name, FloatUtil.GetVector3String(ent._CEntityDef.position), FloatUtil.GetVector4String(ent._CEntityDef.rotation), ent.Ymap?.RpfFileEntry?.Path ?? ""));
            }

            File.WriteAllText(fname, sb.ToString());
        }
Exemple #8
0
        private void UpdateControls()
        {
            if (ProjectForm?.CurrentProjectFile == null)
            {
                return;
            }
            if (ProjectForm.GrassBatchExistsInProject(CurrentBatch))
            {
                GrassAddToProjectButton.Enabled = false;
                GrassDeleteButton.Enabled       = true;
            }
            else
            {
                GrassAddToProjectButton.Enabled = true;
                GrassDeleteButton.Enabled       = false;
            }

            ArchetypeNameTextBox.Text               = CurrentBatch.Batch.archetypeName.ToString();
            PositionTextBox.Text                    = FloatUtil.GetVector3String(CurrentBatch.Position);
            LodDistNumericUpDown.Value              = CurrentBatch.Batch.lodDist;
            LodFadeRangeNumericUpDown.Value         = (decimal)CurrentBatch.Batch.LodInstFadeRange;
            LodFadeStartDistanceNumericUpDown.Value = (decimal)CurrentBatch.Batch.LodFadeStartDist;
            ScaleRangeTextBox.Text                  = FloatUtil.GetVector3String(CurrentBatch.Batch.ScaleRange);
            OrientToTerrainNumericUpDown.Value      = (decimal)CurrentBatch.Batch.OrientToTerrain;
            OptmizationThresholdNumericUpDown.Value = 15;
            BrushModeCheckBox.Checked               = CurrentBatch.BrushEnabled;
            RadiusNumericUpDown.Value               = (decimal)CurrentBatch.BrushRadius;
            ExtentsMinTextBox.Text                  = FloatUtil.GetVector3String(CurrentBatch.AABBMin);
            ExtentsMaxTextBox.Text                  = FloatUtil.GetVector3String(CurrentBatch.AABBMax);
        }
 private void UpdateControls()
 {
     if (CurrentRoom != null)
     {
         RoomNameTextBox.Text  = CurrentRoom.RoomName;
         MinBoundsTextBox.Text = FloatUtil.GetVector3String(CurrentRoom.BBMin);
         MaxBoundsTextBox.Text = FloatUtil.GetVector3String(CurrentRoom.BBMax);
         RoomFlagsTextBox.Text = CurrentRoom._Data.flags.ToString();
     }
 }
Exemple #10
0
        private void LoadPathNodeTabPage()
        {
            CurrentPathLink = null;

            if (CurrentPathNode == null)
            {
                //YndNodePanel.Enabled = false;
                PathNodeDeleteButton.Enabled       = false;
                PathNodeAddToProjectButton.Enabled = false;
                PathNodeAreaIDUpDown.Value         = 0;
                PathNodeNodeIDUpDown.Value         = 0;
                PathNodePositionTextBox.Text       = string.Empty;
                PathNodeStreetHashTextBox.Text     = string.Empty;
                PathNodeStreetNameLabel.Text       = "Name: [None]";

                UpdatePathNodeFlagsUI(true, true);

                PathNodeLinkCountLabel.Text = "Link Count: 0";
                PathNodeLinksListBox.Items.Clear();
            }
            else
            {
                populatingui = true;
                var n = CurrentPathNode.RawData;
                //YndNodePanel.Enabled = true;
                PathNodeDeleteButton.Enabled       = ProjectForm.YndExistsInProject(CurrentYndFile);
                PathNodeAddToProjectButton.Enabled = !PathNodeDeleteButton.Enabled;
                var streetname = GlobalText.TryGetString(n.StreetName.Hash);
                PathNodeAreaIDUpDown.Value     = n.AreaID;
                PathNodeNodeIDUpDown.Value     = n.NodeID;
                PathNodePositionTextBox.Text   = FloatUtil.GetVector3String(CurrentPathNode.Position);
                PathNodeStreetHashTextBox.Text = n.StreetName.Hash.ToString();
                PathNodeStreetNameLabel.Text   = "Name: " + ((n.StreetName.Hash == 0) ? "[None]" : (string.IsNullOrEmpty(streetname) ? "[Not found]" : streetname));

                UpdatePathNodeFlagsUI(true, true);

                PathNodeLinkCountLabel.Text = "Link Count: " + CurrentPathNode.LinkCount.ToString();
                PathNodeLinksListBox.Items.Clear();
                if (CurrentPathNode.Links != null)
                {
                    foreach (var link in CurrentPathNode.Links)
                    {
                        PathNodeLinksListBox.Items.Add(link);
                    }
                }
                populatingui = false;


                if (ProjectForm.WorldForm != null)
                {
                    ProjectForm.WorldForm.SelectObject(CurrentPathNode);
                }
            }
        }
        private void UpdateControls()
        {
            if (CurrentArchetype != null)
            {
                ArchetypeDeleteButton.Enabled       = ProjectForm.YtypExistsInProject(CurrentArchetype.Ytyp);
                ArchetypeNameTextBox.Text           = CurrentArchetype.Name;
                AssetNameTextBox.Text               = CurrentArchetype.AssetName;
                LodDistNumericUpDown.Value          = (decimal)CurrentArchetype._BaseArchetypeDef.lodDist;
                HDTextureDistNumericUpDown.Value    = (decimal)CurrentArchetype._BaseArchetypeDef.hdTextureDist;
                SpecialAttributeNumericUpDown.Value = CurrentArchetype._BaseArchetypeDef.specialAttribute;
                ArchetypeFlagsTextBox.Text          = CurrentArchetype._BaseArchetypeDef.flags.ToString();
                TextureDictTextBox.Text             = CurrentArchetype._BaseArchetypeDef.textureDictionary.ToCleanString();
                ClipDictionaryTextBox.Text          = CurrentArchetype._BaseArchetypeDef.clipDictionary.ToCleanString();
                PhysicsDictionaryTextBox.Text       = CurrentArchetype._BaseArchetypeDef.physicsDictionary.ToCleanString();
                AssetTypeComboBox.Text              = CurrentArchetype._BaseArchetypeDef.assetType.ToString();
                BBMinTextBox.Text    = FloatUtil.GetVector3String(CurrentArchetype._BaseArchetypeDef.bbMin);
                BBMaxTextBox.Text    = FloatUtil.GetVector3String(CurrentArchetype._BaseArchetypeDef.bbMax);
                BSCenterTextBox.Text = FloatUtil.GetVector3String(CurrentArchetype._BaseArchetypeDef.bsCentre);
                BSRadiusTextBox.Text = FloatUtil.ToString(CurrentArchetype._BaseArchetypeDef.bsRadius);

                if (CurrentArchetype is MloArchetype MloArchetype)
                {
                    if (!TabControl.TabPages.Contains(MloArchetypeTabPage))
                    {
                        TabControl.TabPages.Add(MloArchetypeTabPage);
                    }

                    //MloInstanceData mloinstance = ProjectForm.TryGetMloInstance(MloArchetype);
                    //nothing to see here right now
                }
                else
                {
                    TabControl.TabPages.Remove(MloArchetypeTabPage);
                }



                if (CurrentArchetype is TimeArchetype TimeArchetype)
                {
                    if (!TabControl.TabPages.Contains(TimeArchetypeTabPage))
                    {
                        TabControl.TabPages.Add(TimeArchetypeTabPage);
                    }

                    TimeFlagsTextBox.Text = TimeArchetype.TimeFlags.ToString();
                }
                else
                {
                    TabControl.TabPages.Remove(TimeArchetypeTabPage);
                }
            }
        }
Exemple #12
0
 public void UpdateYnvUI()
 {
     if (Ynv?.Nav == null)
     {
         ////YnvPanel.Enabled = false;
         YnvRpfPathTextBox.Text            = string.Empty;
         YnvProjectPathTextBox.Text        = string.Empty;
         YnvAreaIDXUpDown.Value            = 0;
         YnvAreaIDYUpDown.Value            = 0;
         YnvAreaIDInfoLabel.Text           = "ID: -";
         YnvAABBSizeTextBox.Text           = string.Empty;
         YnvFlagsPolygonsCheckBox.Checked  = false;
         YnvFlagsPortalsCheckBox.Checked   = false;
         YnvFlagsVehicleCheckBox.Checked   = false;
         YnvFlagsUnknown8CheckBox.Checked  = false;
         YnvFlagsUnknown16CheckBox.Checked = false;
         YnvVertexCountLabel.Text          = "Vertex count: -";
         YnvPolyCountLabel.Text            = "Poly count: -";
         YnvPortalCountLabel.Text          = "Portal count: -";
         YnvPortalLinkCountLabel.Text      = "Portal link count: -";
         YnvPointCountLabel.Text           = "Sector unk count: -";
         YnvByteCountLabel.Text            = "Byte count: -";
         YnvVersionUnkHashTextBox.Text     = string.Empty;
     }
     else
     {
         var nv = Ynv.Nav;
         populatingui = true;
         ////YnvPanel.Enabled = true;
         YnvRpfPathTextBox.Text            = Ynv.RpfFileEntry.Path;
         YnvProjectPathTextBox.Text        = (Ynv != null) ? ProjectForm.CurrentProjectFile.GetRelativePath(Ynv.FilePath) : Ynv.FilePath;
         YnvAreaIDXUpDown.Value            = Ynv.CellX;
         YnvAreaIDYUpDown.Value            = Ynv.CellY;
         YnvAreaIDInfoLabel.Text           = "ID: " + Ynv.AreaID.ToString();
         YnvAABBSizeTextBox.Text           = FloatUtil.GetVector3String(nv.AABBSize);
         YnvFlagsPolygonsCheckBox.Checked  = nv.ContentFlags.HasFlag(NavMeshFlags.Polygons);
         YnvFlagsPortalsCheckBox.Checked   = nv.ContentFlags.HasFlag(NavMeshFlags.Portals);
         YnvFlagsVehicleCheckBox.Checked   = nv.ContentFlags.HasFlag(NavMeshFlags.Vehicle);
         YnvFlagsUnknown8CheckBox.Checked  = nv.ContentFlags.HasFlag(NavMeshFlags.Unknown8);
         YnvFlagsUnknown16CheckBox.Checked = nv.ContentFlags.HasFlag(NavMeshFlags.Unknown16);
         YnvVertexCountLabel.Text          = "Vertex count: " + nv.VerticesCount.ToString();
         YnvPolyCountLabel.Text            = "Poly count: " + nv.PolysCount.ToString();
         YnvPortalCountLabel.Text          = "Portal count: " + nv.PortalsCount.ToString();
         YnvPortalLinkCountLabel.Text      = "Portal link count: " + nv.PortalLinksCount.ToString();
         YnvPointCountLabel.Text           = "Point count: " + nv.PointsCount.ToString();
         YnvByteCountLabel.Text            = "Byte count: " + nv.TotalBytes.ToString();
         YnvVersionUnkHashTextBox.Text     = nv.VersionUnk2.Hash.ToString();
         YnvAdjAreaIDsTextBox.Text         = GetAdjAreaIDsString(nv.AdjAreaIDs.Values);
         populatingui = false;
     }
 }
        private void UpdateControls()
        {
            if (CurrentArchetype != null)
            {
                ArchetypeDeleteButton.Enabled       = ProjectForm.YtypExistsInProject(CurrentArchetype.Ytyp);
                ArchetypeNameTextBox.Text           = CurrentArchetype.Name;
                AssetNameTextBox.Text               = CurrentArchetype.AssetName;
                LodDistNumericUpDown.Value          = (decimal)CurrentArchetype._BaseArchetypeDef.lodDist;
                HDTextureDistNumericUpDown.Value    = (decimal)CurrentArchetype._BaseArchetypeDef.hdTextureDist;
                SpecialAttributeNumericUpDown.Value = CurrentArchetype._BaseArchetypeDef.specialAttribute;
                ArchetypeFlagsTextBox.Text          = CurrentArchetype._BaseArchetypeDef.flags.ToString();
                TextureDictTextBox.Text             = CurrentArchetype._BaseArchetypeDef.textureDictionary.ToCleanString();
                ClipDictionaryTextBox.Text          = CurrentArchetype._BaseArchetypeDef.clipDictionary.ToCleanString();
                PhysicsDictionaryTextBox.Text       = CurrentArchetype._BaseArchetypeDef.physicsDictionary.ToCleanString();
                AssetTypeComboBox.Text              = CurrentArchetype._BaseArchetypeDef.assetType.ToString();
                BBMinTextBox.Text    = FloatUtil.GetVector3String(CurrentArchetype._BaseArchetypeDef.bbMin);
                BBMaxTextBox.Text    = FloatUtil.GetVector3String(CurrentArchetype._BaseArchetypeDef.bbMax);
                BSCenterTextBox.Text = FloatUtil.GetVector3String(CurrentArchetype._BaseArchetypeDef.bsCentre);
                BSRadiusTextBox.Text = CurrentArchetype._BaseArchetypeDef.bsRadius.ToString(CultureInfo.InvariantCulture);

                EntitySetsListBox.Items.Clear();
                if (CurrentArchetype is MloArchetype MloArchetype)
                {
                    if (!TabControl.TabPages.Contains(MloArchetypeTabPage))
                    {
                        TabControl.TabPages.Add(MloArchetypeTabPage);
                    }

                    MloInstanceData mloinstance = ProjectForm.TryGetMloInstance(MloArchetype);
                    if (mloinstance != null)
                    {
                        EntitySetsListBox.Enabled = true;
                        foreach (var sets in mloinstance.EntitySets)
                        {
                            MloInstanceEntitySet set = sets.Value;
                            EntitySetsListBox.Items.Add(set.EntitySet.ToString(), set.Visible);
                        }
                    }
                    else
                    {
                        EntitySetsListBox.Enabled = false;
                    }
                }
                else
                {
                    TabControl.TabPages.Remove(MloArchetypeTabPage);
                }
            }
        }
Exemple #14
0
        public byte[] Save()
        {
            NodeCount = Nodes.Count;
            StringBuilder sb = new StringBuilder();

            sb.AppendLine(Nodes.Count.ToString());
            foreach (var node in Nodes)
            {
                var nstr = FloatUtil.GetVector3String(node.Position).Replace(",", "") + " " + node.NodeType.ToString();
                sb.AppendLine(nstr);
            }
            string str = sb.ToString();

            return(Encoding.UTF8.GetBytes(str));
        }
        private void UpdateControls()
        {
            if (CurrentPortal != null)
            {
                populatingui         = true;
                RoomFromTextBox.Text = CurrentPortal._Data.roomFrom.ToString();
                RoomToTextBox.Text   = CurrentPortal._Data.roomTo.ToString();
                FlagsTextBox.Text    = CurrentPortal._Data.flags.ToString();
                for (int i = 0; i < FlagsCheckedListBox.Items.Count; i++)
                {
                    var c = ((CurrentPortal._Data.flags & (1u << i)) > 0);
                    FlagsCheckedListBox.SetItemCheckState(i, c ? CheckState.Checked : CheckState.Unchecked);
                }
                MirrorPriorityTextBox.Text = CurrentPortal._Data.mirrorPriority.ToString();
                OpacityTextBox.Text        = CurrentPortal._Data.opacity.ToString();
                AudioOcclusionTextBox.Text = CurrentPortal._Data.audioOcclusion.ToString();

                var sb = new StringBuilder();
                if (CurrentPortal.Corners != null)
                {
                    foreach (var corner in CurrentPortal.Corners)
                    {
                        if (sb.Length > 0)
                        {
                            sb.AppendLine();
                        }
                        sb.Append(FloatUtil.GetVector3String(corner.XYZ()));
                    }
                }
                CornersTextBox.Text = sb.ToString();
                populatingui        = false;
            }
            else
            {
                RoomFromTextBox.Text       = string.Empty;
                RoomToTextBox.Text         = string.Empty;
                FlagsTextBox.Text          = string.Empty;
                MirrorPriorityTextBox.Text = string.Empty;
                OpacityTextBox.Text        = string.Empty;
                AudioOcclusionTextBox.Text = string.Empty;
                CornersTextBox.Text        = string.Empty;
            }
        }
        public void UpdateScenarioUI()
        {
            if (CurrentScenario == null)
            {
                populatingui = true;
                //ScenarioYmtPanel.Enabled = false;
                ScenarioYmtNameTextBox.Text         = string.Empty;
                ScenarioYmtVersionTextBox.Text      = string.Empty;
                ScenarioYmtGridMinTextBox.Text      = string.Empty;
                ScenarioYmtGridMaxTextBox.Text      = string.Empty;
                ScenarioYmtGridScaleTextBox.Text    = string.Empty;
                ScenarioYmtGridInfoLabel.Text       = "Total grid points: 0";
                ScenarioYmtExtentsMinTextBox.Text   = string.Empty;
                ScenarioYmtExtentsMaxTextBox.Text   = string.Empty;
                ScenarioYmtFileLocationTextBox.Text = string.Empty;
                ScenarioYmtProjectPathTextBox.Text  = string.Empty;
                populatingui = false;
            }
            else
            {
                var rgn  = CurrentScenario.CScenarioPointRegion;
                var accg = rgn?._Data.AccelGrid ?? new rage__spdGrid2D();
                var bvh  = CurrentScenario.ScenarioRegion?.BVH;
                var emin = bvh?.Box.Minimum ?? Vector3.Zero;
                var emax = bvh?.Box.Maximum ?? Vector3.Zero;

                populatingui = true;
                //ScenarioYmtPanel.Enabled = true;
                ScenarioYmtNameTextBox.Text         = CurrentScenario.Name;
                ScenarioYmtVersionTextBox.Text      = rgn?.VersionNumber.ToString() ?? "";
                ScenarioYmtGridMinTextBox.Text      = FloatUtil.GetVector2String(accg.Min);
                ScenarioYmtGridMaxTextBox.Text      = FloatUtil.GetVector2String(accg.Max);
                ScenarioYmtGridScaleTextBox.Text    = FloatUtil.GetVector2String(accg.Scale);
                ScenarioYmtGridInfoLabel.Text       = "Total grid points: " + (rgn?.Unk_3844724227?.Length ?? 0).ToString();
                ScenarioYmtExtentsMinTextBox.Text   = FloatUtil.GetVector3String(emin);
                ScenarioYmtExtentsMaxTextBox.Text   = FloatUtil.GetVector3String(emax);
                ScenarioYmtFileLocationTextBox.Text = CurrentScenario.RpfFileEntry?.Path ?? "";
                ScenarioYmtProjectPathTextBox.Text  = (ProjectForm.CurrentProjectFile != null) ? ProjectForm.CurrentProjectFile.GetRelativePath(CurrentScenario.FilePath) : CurrentScenario.FilePath;
                populatingui = false;
            }
        }
 public void UpdateYnvPortalUI()
 {
     if (YnvPortal == null)
     {
         DeletePortalButton.Enabled = false;
         AddToProjectButton.Enabled = false;
         PositionFromTextBox.Text   = string.Empty;
         PositionToTextBox.Text     = string.Empty;
         AngleUpDown.Value          = 0;
         TypeUpDown.Value           = 0;
         AreaIDFromUpDown.Value     = 0;
         AreaIDToUpDown.Value       = 0;
         PolyIDFrom1UpDown.Value    = 0;
         PolyIDTo1UpDown.Value      = 0;
         PolyIDFrom2UpDown.Value    = 0;
         PolyIDTo2UpDown.Value      = 0;
         Unk1UpDown.Value           = 0;
         Unk2UpDown.Value           = 0;
     }
     else
     {
         populatingui = true;
         DeletePortalButton.Enabled = ProjectForm.YnvExistsInProject(YnvPortal.Ynv);
         AddToProjectButton.Enabled = !DeletePortalButton.Enabled;
         PositionFromTextBox.Text   = FloatUtil.GetVector3String(YnvPortal.PositionFrom);
         PositionToTextBox.Text     = FloatUtil.GetVector3String(YnvPortal.PositionTo);
         AngleUpDown.Value          = YnvPortal.Angle;
         TypeUpDown.Value           = YnvPortal.Type;
         AreaIDFromUpDown.Value     = YnvPortal.AreaIDFrom;
         AreaIDToUpDown.Value       = YnvPortal.AreaIDTo;
         PolyIDFrom1UpDown.Value    = YnvPortal.PolyIDFrom1;
         PolyIDTo1UpDown.Value      = YnvPortal.PolyIDTo1;
         PolyIDFrom2UpDown.Value    = YnvPortal.PolyIDFrom2;
         PolyIDTo2UpDown.Value      = YnvPortal.PolyIDTo2;
         Unk1UpDown.Value           = YnvPortal.Unk1;
         Unk2UpDown.Value           = YnvPortal.Unk2;
         populatingui = false;
     }
 }
Exemple #18
0
        public void UpdateUI()
        {
            if (CollisionVertex == null)
            {
                AddToProjectButton.Enabled = false;
                DeleteButton.Enabled       = false;
                PositionTextBox.Text       = string.Empty;
                ColourTextBox.Text         = string.Empty;
            }
            else
            {
                populatingui = true;

                PositionTextBox.Text = FloatUtil.GetVector3String(CollisionVertex.Position);
                ColourTextBox.Text   = CollisionVertex.Colour.ToString();

                var ybn = CollisionVertex.Owner?.GetRootYbn();
                AddToProjectButton.Enabled = (ybn != null) ? !ProjectForm.YbnExistsInProject(ybn) : false;
                DeleteButton.Enabled       = !AddToProjectButton.Enabled;

                populatingui = false;
            }
        }
 public void UpdateYnvPointUI()
 {
     if (YnvPoint == null)
     {
         ////YnvPointPanel.Enabled = false;
         DeletePointButton.Enabled    = false;
         AddToProjectButton.Enabled   = false;
         YnvPointPositionTextBox.Text = string.Empty;
         YnvPointAngleUpDown.Value    = 0;
         YnvPointTypeUpDown.Value     = 0;
     }
     else
     {
         populatingui = true;
         ////YnvPortalPanel.Enabled = true;
         DeletePointButton.Enabled    = ProjectForm.YnvExistsInProject(YnvPoint.Ynv);
         AddToProjectButton.Enabled   = !DeletePointButton.Enabled;
         YnvPointPositionTextBox.Text = FloatUtil.GetVector3String(YnvPoint.Position);
         YnvPointAngleUpDown.Value    = YnvPoint.Angle;
         YnvPointTypeUpDown.Value     = YnvPoint.Type;
         populatingui = false;
     }
 }
 private void UpdateControls()
 {
     if (CurrentRoom != null)
     {
         populatingui          = true;
         NameTextBox.Text      = CurrentRoom.RoomName;
         MinBoundsTextBox.Text = FloatUtil.GetVector3String(CurrentRoom.BBMin);
         MaxBoundsTextBox.Text = FloatUtil.GetVector3String(CurrentRoom.BBMax);
         FlagsTextBox.Text     = CurrentRoom._Data.flags.ToString();
         for (int i = 0; i < FlagsCheckedListBox.Items.Count; i++)
         {
             var c = ((CurrentRoom._Data.flags & (1u << i)) > 0);
             FlagsCheckedListBox.SetItemCheckState(i, c ? CheckState.Checked : CheckState.Unchecked);
         }
         BlendTextBox.Text            = FloatUtil.ToString(CurrentRoom._Data.blend);
         TimecycleTextBox.Text        = CurrentRoom._Data.timecycleName.ToCleanString();
         Timecycle2TextBox.Text       = CurrentRoom._Data.secondaryTimecycleName.ToCleanString();
         PortalCountTextBox.Text      = CurrentRoom._Data.portalCount.ToString();
         FloorIDTextBox.Text          = CurrentRoom._Data.floorId.ToString();
         ExteriorVisDepthTextBox.Text = CurrentRoom._Data.exteriorVisibiltyDepth.ToString();
         populatingui = false;
     }
     else
     {
         NameTextBox.Text             = string.Empty;
         MinBoundsTextBox.Text        = string.Empty;
         MaxBoundsTextBox.Text        = string.Empty;
         FlagsTextBox.Text            = string.Empty;
         BlendTextBox.Text            = string.Empty;
         TimecycleTextBox.Text        = string.Empty;
         Timecycle2TextBox.Text       = string.Empty;
         PortalCountTextBox.Text      = string.Empty;
         FloorIDTextBox.Text          = string.Empty;
         ExteriorVisDepthTextBox.Text = string.Empty;
     }
 }
Exemple #21
0
        private void LoadEntity()
        {
            if (CurrentEntity == null)
            {
                //EntityPanel.Enabled = false;
                EntityAddToProjectButton.Enabled          = false;
                EntityDeleteButton.Enabled                = false;
                EntityArchetypeTextBox.Text               = string.Empty;
                EntityArchetypeHashLabel.Text             = "Hash: 0";
                EntityFlagsTextBox.Text                   = string.Empty;
                EntityGuidTextBox.Text                    = string.Empty;
                EntityPositionTextBox.Text                = string.Empty;
                EntityRotationTextBox.Text                = string.Empty;
                EntityScaleXYTextBox.Text                 = string.Empty;
                EntityScaleZTextBox.Text                  = string.Empty;
                EntityParentIndexTextBox.Text             = string.Empty;
                EntityLodDistTextBox.Text                 = string.Empty;
                EntityChildLodDistTextBox.Text            = string.Empty;
                EntityLodLevelComboBox.SelectedIndex      = 0; // Math.Max(EntityLodLevelComboBox.FindString(), 0);
                EntityNumChildrenTextBox.Text             = string.Empty;
                EntityPriorityLevelComboBox.SelectedIndex = 0; //Math.Max(..
                EntityAOMultiplierTextBox.Text            = string.Empty;
                EntityArtificialAOTextBox.Text            = string.Empty;
                EntityTintValueTextBox.Text               = string.Empty;
                EntityPivotEditCheckBox.Checked           = false;
                EntityPivotPositionTextBox.Text           = string.Empty;
                EntityPivotRotationTextBox.Text           = string.Empty;
                foreach (int i in EntityFlagsCheckedListBox.CheckedIndices)
                {
                    EntityFlagsCheckedListBox.SetItemCheckState(i, CheckState.Unchecked);
                }
            }
            else
            {
                populatingui = true;
                var e  = CurrentEntity.CEntityDef;
                var po = CurrentEntity.PivotOrientation;
                //EntityPanel.Enabled = true;
                EntityAddToProjectButton.Enabled          = !ProjectForm.YmapExistsInProject(CurrentEntity.Ymap);
                EntityDeleteButton.Enabled                = !EntityAddToProjectButton.Enabled;
                EntityArchetypeTextBox.Text               = e.archetypeName.ToString();
                EntityArchetypeHashLabel.Text             = "Hash: " + e.archetypeName.Hash.ToString();
                EntityFlagsTextBox.Text                   = e.flags.ToString();
                EntityGuidTextBox.Text                    = e.guid.ToString();
                EntityPositionTextBox.Text                = FloatUtil.GetVector3String(e.position);
                EntityRotationTextBox.Text                = FloatUtil.GetVector4String(e.rotation);
                EntityScaleXYTextBox.Text                 = FloatUtil.ToString(e.scaleXY);
                EntityScaleZTextBox.Text                  = FloatUtil.ToString(e.scaleZ);
                EntityParentIndexTextBox.Text             = e.parentIndex.ToString();
                EntityLodDistTextBox.Text                 = FloatUtil.ToString(e.lodDist);
                EntityChildLodDistTextBox.Text            = FloatUtil.ToString(e.childLodDist);
                EntityLodLevelComboBox.SelectedIndex      = Math.Max(EntityLodLevelComboBox.FindString(e.lodLevel.ToString()), 0);
                EntityNumChildrenTextBox.Text             = e.numChildren.ToString();
                EntityPriorityLevelComboBox.SelectedIndex = Math.Max(EntityPriorityLevelComboBox.FindString(e.priorityLevel.ToString()), 0);
                EntityAOMultiplierTextBox.Text            = e.ambientOcclusionMultiplier.ToString();
                EntityArtificialAOTextBox.Text            = e.artificialAmbientOcclusion.ToString();
                EntityTintValueTextBox.Text               = e.tintValue.ToString();
                EntityPivotPositionTextBox.Text           = FloatUtil.GetVector3String(CurrentEntity.PivotPosition);
                EntityPivotRotationTextBox.Text           = FloatUtil.GetVector4String(new Vector4(po.X, po.Y, po.Z, po.W));
                for (int i = 0; i < EntityFlagsCheckedListBox.Items.Count; i++)
                {
                    var cv = ((e.flags & (1u << i)) > 0);
                    EntityFlagsCheckedListBox.SetItemCheckState(i, cv ? CheckState.Checked : CheckState.Unchecked);
                }
                populatingui = false;



                ProjectForm.WorldForm?.SelectEntity(CurrentEntity); //hopefully the drawable is already loaded - this will try get from cache

                ////struct CEntityDef:
                //MetaHash archetypeName { get; set; } //8   8: Hash: 0: archetypeName
                //uint flags { get; set; } //12   12: UnsignedInt: 0: flags
                //uint guid { get; set; } //16   16: UnsignedInt: 0: guid
                //Vector3 position { get; set; } //32   32: Float_XYZ: 0: position
                //Vector4 rotation { get; set; } //48   48: Float_XYZW: 0: rotation
                //float scaleXY { get; set; } //64   64: Float: 0: 2627937847
                //float scaleZ { get; set; } //68   68: Float: 0: 284916802
                //int parentIndex { get; set; } //72   72: SignedInt: 0: parentIndex
                //float lodDist { get; set; } //76   76: Float: 0: lodDist
                //float childLodDist { get; set; } //80   80: Float: 0: childLodDist//3398912973
                //Unk_1264241711 lodLevel { get; set; } //84   84: IntEnum: 1264241711: lodLevel  //LODTYPES_DEPTH_
                //uint numChildren { get; set; } //88   88: UnsignedInt: 0: numChildren//2793909385
                //Unk_648413703 priorityLevel { get; set; } //92   92: IntEnum: 648413703: priorityLevel//647098393
                //Array_StructurePointer extensions { get; set; } //96   96: Array: 0: extensions  {0: StructurePointer: 0: 256}
                //int ambientOcclusionMultiplier { get; set; } //112   112: SignedInt: 0: ambientOcclusionMultiplier//415356295
                //int artificialAmbientOcclusion { get; set; } //116   116: SignedInt: 0: artificialAmbientOcclusion//599844163
                //uint tintValue { get; set; } //120   120: UnsignedInt: 0: tintValue//1015358759
            }
        }
Exemple #22
0
        private void LoadLodLight()
        {
            if (CurrentLodLight == null)
            {
                ////Panel.Enabled = false;
                AddToProjectButton.Enabled  = false;
                DeleteButton.Enabled        = false;
                PositionTextBox.Text        = string.Empty;
                DirectionTextBox.Text       = string.Empty;
                TypeComboBox.SelectedItem   = LightType.Point;
                IntensityUpDown.Value       = 0;
                ColourRUpDown.Value         = 0;
                ColourGUpDown.Value         = 0;
                ColourBUpDown.Value         = 0;
                ColourLabel.BackColor       = System.Drawing.Color.White;
                FalloffTextBox.Text         = "";
                FalloffExponentTextBox.Text = "";
                HashTextBox.Text            = "";
                InnerAngleUpDown.Value      = 0;
                OuterAngleUpDown.Value      = 0;
                CoronaIntensityUpDown.Value = 0;
                TimeStateFlagsTextBox.Text  = "";
                foreach (int i in TimeFlagsAMCheckedListBox.CheckedIndices)
                {
                    TimeFlagsAMCheckedListBox.SetItemCheckState(i, CheckState.Unchecked);
                }
                foreach (int i in TimeFlagsPMCheckedListBox.CheckedIndices)
                {
                    TimeFlagsPMCheckedListBox.SetItemCheckState(i, CheckState.Unchecked);
                }
                foreach (int i in StateFlags1CheckedListBox.CheckedIndices)
                {
                    StateFlags1CheckedListBox.SetItemCheckState(i, CheckState.Unchecked);
                }
                foreach (int i in StateFlags2CheckedListBox.CheckedIndices)
                {
                    StateFlags2CheckedListBox.SetItemCheckState(i, CheckState.Unchecked);
                }
            }
            else
            {
                populatingui = true;
                var l = CurrentLodLight;
                ////Panel.Enabled = true;
                AddToProjectButton.Enabled  = !ProjectForm.YmapExistsInProject(CurrentLodLight.Ymap);
                DeleteButton.Enabled        = !AddToProjectButton.Enabled;
                PositionTextBox.Text        = FloatUtil.GetVector3String(l.Position);
                DirectionTextBox.Text       = FloatUtil.GetVector3String(l.Direction);
                TypeComboBox.SelectedItem   = l.Type;
                IntensityUpDown.Value       = l.Colour.A;
                ColourRUpDown.Value         = l.Colour.R;
                ColourGUpDown.Value         = l.Colour.G;
                ColourBUpDown.Value         = l.Colour.B;
                ColourLabel.BackColor       = System.Drawing.Color.FromArgb(l.Colour.R, l.Colour.G, l.Colour.B);
                FalloffTextBox.Text         = FloatUtil.ToString(l.Falloff);
                FalloffExponentTextBox.Text = FloatUtil.ToString(l.FalloffExponent);
                HashTextBox.Text            = l.Hash.ToString();
                InnerAngleUpDown.Value      = l.ConeInnerAngle;
                OuterAngleUpDown.Value      = l.ConeOuterAngleOrCapExt;
                CoronaIntensityUpDown.Value = l.CoronaIntensity;
                TimeStateFlagsTextBox.Text  = l.TimeAndStateFlags.ToString();
                UpdateFlagsCheckBoxes();
                populatingui = false;

                if (ProjectForm.WorldForm != null)
                {
                    ProjectForm.WorldForm.SelectObject(CurrentLodLight);
                }
            }
        }
Exemple #23
0
        private void NormalizeDirectionButton_Click(object sender, EventArgs e)
        {
            Vector3 d = Vector3.Normalize(FloatUtil.ParseVector3String(DirectionTextBox.Text));

            DirectionTextBox.Text = FloatUtil.GetVector3String(d);
        }
Exemple #24
0
        public void UpdateUI()
        {
            var b = CollisionBounds;

            if (b == null)
            {
                AddToProjectButton.Enabled = false;
                DeleteButton.Enabled       = false;
                BBMinTextBox.Text          = string.Empty;
                BBMaxTextBox.Text          = string.Empty;
                BBCenterTextBox.Text       = string.Empty;
                BSCenterTextBox.Text       = string.Empty;
                BSRadiusTextBox.Text       = string.Empty;
                MarginTextBox.Text         = string.Empty;
                VolumeTextBox.Text         = string.Empty;
                UnkVectorTextBox.Text      = string.Empty;
                MaterialColourUpDown.Value = 0;
                MaterialCombo.Text         = "";
                ProceduralIDUpDown.Value   = 0;
                RoomIDUpDown.Value         = 0;
                PedDensityUpDown.Value     = 0;
                PolyFlagsUpDown.Value      = 0;
                UnkFlagsUpDown.Value       = 0;
                UnkTypeUpDown.Value        = 0;
                BoundsTabControl.TabPages.Remove(GeometryTabPage);
                CenterGeomTextBox.Text = string.Empty;
                QuantumTextBox.Text    = string.Empty;
                UnkFloat1TextBox.Text  = string.Empty;
                UnkFloat2TextBox.Text  = string.Empty;
                VertexCountLabel.Text  = "0 vertices";
                PolyCountLabel.Text    = "0 polygons";
            }
            else
            {
                populatingui = true;

                BBMinTextBox.Text           = FloatUtil.GetVector3String(b.BoxMin);
                BBMaxTextBox.Text           = FloatUtil.GetVector3String(b.BoxMax);
                BBCenterTextBox.Text        = FloatUtil.GetVector3String(b.BoxCenter);
                BSCenterTextBox.Text        = FloatUtil.GetVector3String(b.SphereCenter);
                BSRadiusTextBox.Text        = FloatUtil.ToString(b.SphereRadius);
                MarginTextBox.Text          = FloatUtil.ToString(b.Margin);
                VolumeTextBox.Text          = FloatUtil.ToString(b.Volume);
                UnkVectorTextBox.Text       = FloatUtil.GetVector3String(b.Unknown_60h);
                MaterialColourUpDown.Value  = b.MaterialColorIndex;
                MaterialCombo.SelectedIndex = b.MaterialIndex;
                ProceduralIDUpDown.Value    = b.ProceduralId;
                RoomIDUpDown.Value          = b.RoomId;
                PedDensityUpDown.Value      = b.PedDensity;
                PolyFlagsUpDown.Value       = b.PolyFlags;
                UnkFlagsUpDown.Value        = b.UnkFlags;
                UnkTypeUpDown.Value         = b.Unknown_3Ch;

                if (b is BoundGeometry bg)
                {
                    if (!BoundsTabControl.TabPages.Contains(GeometryTabPage))
                    {
                        BoundsTabControl.TabPages.Add(GeometryTabPage);
                    }

                    CenterGeomTextBox.Text = FloatUtil.GetVector3String(bg.CenterGeom);
                    QuantumTextBox.Text    = FloatUtil.GetVector3String(bg.Quantum);
                    UnkFloat1TextBox.Text  = FloatUtil.ToString(bg.Unknown_9Ch);
                    UnkFloat2TextBox.Text  = FloatUtil.ToString(bg.Unknown_ACh);
                    VertexCountLabel.Text  = bg.VerticesCount.ToString() + ((bg.VerticesCount == 1) ? " vertex" : " vertices");
                    PolyCountLabel.Text    = bg.PolygonsCount.ToString() + ((bg.PolygonsCount == 1) ? " polygon" : " polygons");
                }
                else
                {
                    BoundsTabControl.TabPages.Remove(GeometryTabPage);
                    CenterGeomTextBox.Text = string.Empty;
                    QuantumTextBox.Text    = string.Empty;
                    UnkFloat1TextBox.Text  = string.Empty;
                    UnkFloat2TextBox.Text  = string.Empty;
                    VertexCountLabel.Text  = "0 vertices";
                    PolyCountLabel.Text    = "0 polygons";
                }

                var ybn = b.GetRootYbn();
                AddToProjectButton.Enabled = (ybn != null) ? !ProjectForm.YbnExistsInProject(ybn) : false;
                DeleteButton.Enabled       = !AddToProjectButton.Enabled;

                populatingui = false;
            }
        }
Exemple #25
0
 public override string ToString()
 {
     return("(Size: " + FloatUtil.GetVector3String(AABBSize) + ")");
 }
Exemple #26
0
        private void LoadCarGen()
        {
            if (CurrentCarGen == null)
            {
                //CarGenPanel.Enabled = false;
                CarAddToProjectButton.Enabled      = false;
                CarDeleteButton.Enabled            = false;
                CarModelTextBox.Text               = string.Empty;
                CarModelHashLabel.Text             = "Hash: 0";
                CarPopGroupTextBox.Text            = string.Empty;
                CarPopGroupHashLabel.Text          = "Hash: 0";
                CarFlagsTextBox.Text               = string.Empty;
                CarPositionTextBox.Text            = string.Empty;
                CarOrientXTextBox.Text             = string.Empty;
                CarOrientYTextBox.Text             = string.Empty;
                CarPerpendicularLengthTextBox.Text = string.Empty;
                CarBodyColorRemap1TextBox.Text     = string.Empty;
                CarBodyColorRemap2TextBox.Text     = string.Empty;
                CarBodyColorRemap3TextBox.Text     = string.Empty;
                CarBodyColorRemap4TextBox.Text     = string.Empty;
                CarLiveryTextBox.Text              = string.Empty;
                foreach (int i in CarFlagsCheckedListBox.CheckedIndices)
                {
                    CarFlagsCheckedListBox.SetItemCheckState(i, CheckState.Unchecked);
                }
            }
            else
            {
                populatingui = true;
                var c = CurrentCarGen.CCarGen;
                //CarGenPanel.Enabled = true;
                CarAddToProjectButton.Enabled      = !ProjectForm.YmapExistsInProject(CurrentCarGen.Ymap);
                CarDeleteButton.Enabled            = !CarAddToProjectButton.Enabled;
                CarModelTextBox.Text               = c.carModel.ToString();
                CarModelHashLabel.Text             = "Hash: " + c.carModel.Hash.ToString();
                CarPopGroupTextBox.Text            = c.popGroup.ToString();
                CarPopGroupHashLabel.Text          = "Hash: " + c.popGroup.Hash.ToString();
                CarFlagsTextBox.Text               = c.flags.ToString();
                CarPositionTextBox.Text            = FloatUtil.GetVector3String(c.position);
                CarOrientXTextBox.Text             = FloatUtil.ToString(c.orientX);
                CarOrientYTextBox.Text             = FloatUtil.ToString(c.orientY);
                CarPerpendicularLengthTextBox.Text = FloatUtil.ToString(c.perpendicularLength);
                CarBodyColorRemap1TextBox.Text     = c.bodyColorRemap1.ToString();
                CarBodyColorRemap2TextBox.Text     = c.bodyColorRemap2.ToString();
                CarBodyColorRemap3TextBox.Text     = c.bodyColorRemap3.ToString();
                CarBodyColorRemap4TextBox.Text     = c.bodyColorRemap4.ToString();
                CarLiveryTextBox.Text              = c.livery.ToString();
                for (int i = 0; i < CarFlagsCheckedListBox.Items.Count; i++)
                {
                    var cv = ((c.flags & (1u << i)) > 0);
                    CarFlagsCheckedListBox.SetItemCheckState(i, cv ? CheckState.Checked : CheckState.Unchecked);
                }
                populatingui = false;

                if (ProjectForm.WorldForm != null)
                {
                    ProjectForm.WorldForm.SelectCarGen(CurrentCarGen);
                }

                ////struct CCarGen:
                //Vector3 position { get; set; } //16   16: Float_XYZ: 0: position
                //float orientX { get; set; } //32   32: Float: 0: orientX=735213009
                //float orientY { get; set; } //36   36: Float: 0: orientY=979440342
                //float perpendicularLength { get; set; } //40   40: Float: 0: perpendicularLength=124715667
                //MetaHash carModel { get; set; } //44   44: Hash: 0: carModel
                //uint flags { get; set; } //48   48: UnsignedInt: 0: flags
                //int bodyColorRemap1 { get; set; } //52   52: SignedInt: 0: bodyColorRemap1=1429703670
                //int bodyColorRemap2 { get; set; } //56   56: SignedInt: 0: bodyColorRemap2=1254848286
                //int bodyColorRemap3 { get; set; } //60   60: SignedInt: 0: bodyColorRemap3=1880965569
                //int bodyColorRemap4 { get; set; } //64   64: SignedInt: 0: bodyColorRemap4=1719152247
                //MetaHash popGroup { get; set; } //68   68: Hash: 0: popGroup=911358791
                //sbyte livery { get; set; } //72   72: SignedByte: 0: livery
            }
        }
Exemple #27
0
        private void NormalizeTangentButton_Click(object sender, EventArgs e)
        {
            Vector3 t = Vector3.Normalize(FloatUtil.ParseVector3String(TangentTextBox.Text));

            TangentTextBox.Text = FloatUtil.GetVector3String(t);
        }
Exemple #28
0
        public void UpdateUI()
        {
            var light = selectedLight;

            if (light == null)
            {
                DeleteLightButton.Enabled   = false;
                EditDeleteLightMenu.Enabled = false;
                populatingui                       = true;
                PositionTextBox.Text               = "";
                DirectionTextBox.Text              = "";
                TangentTextBox.Text                = "";
                TypeComboBox.SelectedItem          = "Point";
                ColourRUpDown.Value                = 0;
                ColourGUpDown.Value                = 0;
                ColourBUpDown.Value                = 0;
                IntensityTextBox.Text              = "";
                FlagsTextBox.Text                  = "";
                FlashinessUpDown.Value             = 0;
                BoneIDUpDown.Value                 = 0;
                GroupIDUpDown.Value                = 0;
                FalloffTextBox.Text                = "";
                FalloffExponentTextBox.Text        = "";
                InnerAngleTextBox.Text             = "";
                OuterAngleTextBox.Text             = "";
                CoronaSizeTextBox.Text             = "";
                CoronaIntensityTextBox.Text        = "";
                ExtentTextBox.Text                 = "";
                ShadowBlurUpDown.Value             = 0;
                LightFadeDistanceUpDown.Value      = 0;
                CoronaZBiasTextBox.Text            = "";
                TextureHashTextBox.Text            = "";
                VolumeIntensityTextBox.Text        = "";
                VolumeSizeScaleTextBox.Text        = "";
                VolumeColorRUpDown.Value           = 0;
                VolumeColorGUpDown.Value           = 0;
                VolumeColorBUpDown.Value           = 0;
                VolumeOuterExponentTextBox.Text    = "";
                ShadowFadeDistanceUpDown.Value     = 0;
                SpecularFadeDistanceUpDown.Value   = 0;
                VolumetricFadeDistanceUpDown.Value = 0;
                ShadowNearClipTextBox.Text         = "";
                CullingPlaneNormalTextBox.Text     = "";
                CullingPlaneOffsetTextBox.Text     = "";
                TimeFlagsTextBox.Text              = "";
                populatingui                       = false;
            }
            else
            {
                DeleteLightButton.Enabled   = true;
                EditDeleteLightMenu.Enabled = true;
                populatingui                       = true;
                PositionTextBox.Text               = FloatUtil.GetVector3String(light.Position);
                DirectionTextBox.Text              = FloatUtil.GetVector3String(light.Direction);
                TangentTextBox.Text                = FloatUtil.GetVector3String(light.Tangent);
                TypeComboBox.SelectedItem          = light.Type.ToString();
                ColourRUpDown.Value                = light.ColorR;
                ColourGUpDown.Value                = light.ColorG;
                ColourBUpDown.Value                = light.ColorB;
                ColourLabel.BackColor              = System.Drawing.Color.FromArgb(light.ColorR, light.ColorG, light.ColorB);
                IntensityTextBox.Text              = FloatUtil.ToString(light.Intensity);
                FlagsTextBox.Text                  = light.Flags.ToString();
                FlashinessUpDown.Value             = light.Flashiness;
                BoneIDUpDown.Value                 = light.BoneId;
                GroupIDUpDown.Value                = light.GroupId;
                FalloffTextBox.Text                = FloatUtil.ToString(light.Falloff);
                FalloffExponentTextBox.Text        = FloatUtil.ToString(light.FalloffExponent);
                InnerAngleTextBox.Text             = FloatUtil.ToString(light.ConeInnerAngle);
                OuterAngleTextBox.Text             = FloatUtil.ToString(light.ConeOuterAngle);
                CoronaSizeTextBox.Text             = FloatUtil.ToString(light.CoronaSize);
                CoronaIntensityTextBox.Text        = FloatUtil.ToString(light.CoronaIntensity);
                ExtentTextBox.Text                 = FloatUtil.GetVector3String(light.Extent);
                ShadowBlurUpDown.Value             = light.ShadowBlur;
                LightFadeDistanceUpDown.Value      = light.LightFadeDistance;
                CoronaZBiasTextBox.Text            = FloatUtil.ToString(light.CoronaZBias);
                TextureHashTextBox.Text            = light.ProjectedTextureHash.ToCleanString();
                VolumeIntensityTextBox.Text        = FloatUtil.ToString(light.VolumeIntensity);
                VolumeSizeScaleTextBox.Text        = FloatUtil.ToString(light.VolumeSizeScale);
                VolumeColorRUpDown.Value           = light.VolumeOuterColorR;
                VolumeColorGUpDown.Value           = light.VolumeOuterColorG;
                VolumeColorBUpDown.Value           = light.VolumeOuterColorB;
                VolumeColorLabel.BackColor         = System.Drawing.Color.FromArgb(light.VolumeOuterColorR, light.VolumeOuterColorG, light.VolumeOuterColorB);
                VolumeOuterExponentTextBox.Text    = FloatUtil.ToString(light.VolumeOuterExponent);
                ShadowFadeDistanceUpDown.Value     = light.ShadowFadeDistance;
                SpecularFadeDistanceUpDown.Value   = light.SpecularFadeDistance;
                VolumetricFadeDistanceUpDown.Value = light.VolumetricFadeDistance;
                ShadowNearClipTextBox.Text         = FloatUtil.ToString(light.ShadowNearClip);
                CullingPlaneNormalTextBox.Text     = FloatUtil.GetVector3String(light.CullingPlaneNormal);
                CullingPlaneOffsetTextBox.Text     = FloatUtil.ToString(light.CullingPlaneOffset);
                TimeFlagsTextBox.Text              = light.TimeFlags.ToString();
                UpdateFlagsCheckBoxes();
                populatingui = false;
            }
        }
Exemple #29
0
        private void UpdateUI()
        {
            if (CurrentZone?.AudioZone == null)
            {
                AddToProjectButton.Enabled = false;
                DeleteButton.Enabled       = false;

                populatingui           = true;
                NameTextBox.Text       = string.Empty;
                ShapeComboBox.Text     = string.Empty;
                InnerPosTextBox.Text   = string.Empty;
                InnerSizeTextBox.Text  = string.Empty;
                InnerAngleTextBox.Text = string.Empty;
                InnerVec1TextBox.Text  = string.Empty;
                InnerVec2TextBox.Text  = string.Empty;
                InnerVec3TextBox.Text  = string.Empty;
                OuterPosTextBox.Text   = string.Empty;
                OuterSizeTextBox.Text  = string.Empty;
                OuterAngleTextBox.Text = string.Empty;
                OuterVec1TextBox.Text  = string.Empty;
                OuterVec2TextBox.Text  = string.Empty;
                OuterVec3TextBox.Text  = string.Empty;
                UnkVec1TextBox.Text    = string.Empty;
                UnkVec2TextBox.Text    = string.Empty;
                UnkVec3TextBox.Text    = string.Empty;
                UnkBytesTextBox.Text   = string.Empty;
                Flags0TextBox.Text     = string.Empty;
                Flags1TextBox.Text     = string.Empty;
                Flags2TextBox.Text     = string.Empty;
                Hash0TextBox.Text      = string.Empty;
                Hash1TextBox.Text      = string.Empty;
                HashesTextBox.Text     = string.Empty;
                ExtParamsTextBox.Text  = string.Empty;
                populatingui           = false;
            }
            else
            {
                AddToProjectButton.Enabled = CurrentZone?.RelFile != null ? !ProjectForm.AudioFileExistsInProject(CurrentZone.RelFile) : false;
                DeleteButton.Enabled       = !AddToProjectButton.Enabled;

                populatingui = true;
                var z = CurrentZone.AudioZone;
                NameTextBox.Text       = z.NameHash.ToString();
                ShapeComboBox.Text     = z.Shape.ToString();
                InnerPosTextBox.Text   = FloatUtil.GetVector3String(z.PlaybackZonePosition);
                InnerSizeTextBox.Text  = FloatUtil.GetVector3String(z.PlaybackZoneSize);
                InnerAngleTextBox.Text = z.PlaybackZoneAngle.ToString();
                InnerVec1TextBox.Text  = FloatUtil.GetVector4String(z.PlaybackZoneVec1);
                InnerVec2TextBox.Text  = FloatUtil.GetVector4String(z.PlaybackZoneVec2);
                InnerVec3TextBox.Text  = FloatUtil.GetVector3String(z.PlaybackZoneVec3);
                OuterPosTextBox.Text   = FloatUtil.GetVector3String(z.ActivationZonePosition);
                OuterSizeTextBox.Text  = FloatUtil.GetVector3String(z.ActivationZoneSize);
                OuterAngleTextBox.Text = z.ActivationZoneAngle.ToString();
                OuterVec1TextBox.Text  = FloatUtil.GetVector4String(z.ActivationZoneVec1);
                OuterVec2TextBox.Text  = FloatUtil.GetVector4String(z.ActivationZoneVec2);
                OuterVec3TextBox.Text  = FloatUtil.GetVector3String(z.ActivationZoneVec3);
                UnkVec1TextBox.Text    = FloatUtil.GetVector4String(z.UnkVec1);
                UnkVec2TextBox.Text    = FloatUtil.GetVector4String(z.UnkVec2);
                UnkVec3TextBox.Text    = FloatUtil.GetVector2String(z.UnkVec3);
                UnkBytesTextBox.Text   = string.Format("{0}, {1}, {2}", z.Unk14, z.Unk15, z.Unk16);
                Flags0TextBox.Text     = z.Flags0.Hex;
                Flags1TextBox.Text     = z.Flags1.Hex;
                Flags2TextBox.Text     = z.Flags2.Hex;
                Hash0TextBox.Text      = z.UnkHash0.ToString();
                Hash1TextBox.Text      = z.UnkHash1.ToString();

                StringBuilder sb = new StringBuilder();
                if (z.Rules != null)
                {
                    foreach (var hash in z.Rules)
                    {
                        sb.AppendLine(hash.ToString());
                    }
                }
                HashesTextBox.Text = sb.ToString();

                sb.Clear();
                if (z.ExtParams != null)
                {
                    foreach (var extparam in z.ExtParams)
                    {
                        sb.Append(extparam.Hash.ToString());
                        sb.Append(", ");
                        sb.Append(FloatUtil.ToString(extparam.Value));
                        sb.AppendLine();
                    }
                }
                ExtParamsTextBox.Text = sb.ToString();

                populatingui = false;

                if (ProjectForm.WorldForm != null)
                {
                    ProjectForm.WorldForm.SelectObject(CurrentZone);
                }
            }
        }
Exemple #30
0
        public void UpdateYmapUI()
        {
            if (Ymap == null)
            {
                YmapNameTextBox.Text                 = "<No ymap selected>";
                YmapNameHashLabel.Text               = "Hash: 0";
                YmapParentTextBox.Text               = string.Empty;
                YmapParentHashLabel.Text             = "Hash: 0";
                YmapFlagsTextBox.Text                = string.Empty;
                YmapContentFlagsTextBox.Text         = string.Empty;
                YmapCFlagsHDCheckBox.Checked         = false;
                YmapCFlagsLODCheckBox.Checked        = false;
                YmapCFlagsSLOD2CheckBox.Checked      = false;
                YmapCFlagsInteriorCheckBox.Checked   = false;
                YmapCFlagsSLODCheckBox.Checked       = false;
                YmapCFlagsOcclusionCheckBox.Checked  = false;
                YmapCFlagsPhysicsCheckBox.Checked    = false;
                YmapCFlagsLODLightsCheckBox.Checked  = false;
                YmapCFlagsDistLightsCheckBox.Checked = false;
                YmapCFlagsCriticalCheckBox.Checked   = false;
                YmapCFlagsGrassCheckBox.Checked      = false;
                YmapFlagsScriptedCheckBox.Checked    = false;
                YmapFlagsLODCheckBox.Checked         = false;
                YmapPhysicsDictionariesTextBox.Text  = string.Empty;
                YmapEntitiesExtentsMinTextBox.Text   = string.Empty;
                YmapEntitiesExtentsMaxTextBox.Text   = string.Empty;
                YmapStreamingExtentsMinTextBox.Text  = string.Empty;
                YmapStreamingExtentsMaxTextBox.Text  = string.Empty;
                YmapFileLocationTextBox.Text         = string.Empty;
                YmapProjectPathTextBox.Text          = string.Empty;
            }
            else
            {
                populatingui = true;
                var md = Ymap.CMapData;
                if (md.name.Hash == 0)
                {
                    string name = Path.GetFileNameWithoutExtension(Ymap.Name);
                    JenkIndex.Ensure(name);
                    md.name = new MetaHash(JenkHash.GenHash(name));
                }

                var project = ProjectForm?.CurrentProjectFile;

                YmapNameTextBox.Text                = md.name.ToString();
                YmapNameHashLabel.Text              = "Hash: " + md.name.Hash.ToString();
                YmapParentTextBox.Text              = md.parent.ToString();
                YmapParentHashLabel.Text            = "Hash: " + md.parent.Hash.ToString();
                YmapEntitiesExtentsMinTextBox.Text  = FloatUtil.GetVector3String(md.entitiesExtentsMin);
                YmapEntitiesExtentsMaxTextBox.Text  = FloatUtil.GetVector3String(md.entitiesExtentsMax);
                YmapStreamingExtentsMinTextBox.Text = FloatUtil.GetVector3String(md.streamingExtentsMin);
                YmapStreamingExtentsMaxTextBox.Text = FloatUtil.GetVector3String(md.streamingExtentsMax);
                YmapFileLocationTextBox.Text        = Ymap.RpfFileEntry?.Path ?? Ymap.FilePath;
                YmapProjectPathTextBox.Text         = (project != null) ? project.GetRelativePath(Ymap.FilePath) : Ymap.FilePath;

                UpdateYmapFlagsUI(true, true);

                UpdateYmapPhysicsDictionariesUI();

                populatingui = false;

                ////struct CMapData:
                //MetaHash name { get; set; } //8   8: Hash: 0: name
                //MetaHash parent { get; set; } //12   12: Hash: 0: parent
                //uint flags { get; set; } //16   16: UnsignedInt: 0: flags
                //uint contentFlags { get; set; } //20   20: UnsignedInt: 0: contentFlags//1785155637
                //Vector3 streamingExtentsMin { get; set; } //32   32: Float_XYZ: 0: streamingExtentsMin//3710026271
                //Vector3 streamingExtentsMax { get; set; } //48   48: Float_XYZ: 0: streamingExtentsMax//2720965429
                //Vector3 entitiesExtentsMin { get; set; } //64   64: Float_XYZ: 0: entitiesExtentsMin//477478129
                //Vector3 entitiesExtentsMax { get; set; } //80   80: Float_XYZ: 0: entitiesExtentsMax//1829192759
                //Array_StructurePointer entities { get; set; } //96   96: Array: 0: entities  {0: StructurePointer: 0: 256}
                //Array_Structure containerLods { get; set; } //112   112: Array: 0: containerLods//2935983381  {0: Structure: 372253349: 256}
                //Array_Structure boxOccluders { get; set; } //128   128: Array: 0: boxOccluders//3983590932  {0: Structure: SectionUNKNOWN7: 256}
                //Array_Structure occludeModels { get; set; } //144   144: Array: 0: occludeModels//2132383965  {0: Structure: SectionUNKNOWN5: 256}
                //Array_uint physicsDictionaries { get; set; } //160   160: Array: 0: physicsDictionaries//949589348  {0: Hash: 0: 256}
                //rage__fwInstancedMapData instancedData { get; set; } //176   176: Structure: rage__fwInstancedMapData: instancedData//2569067561
                //Array_Structure timeCycleModifiers { get; set; } //224   224: Array: 0: timeCycleModifiers  {0: Structure: CTimeCycleModifier: 256}
                //Array_Structure carGenerators { get; set; } //240   240: Array: 0: carGenerators//3254823756  {0: Structure: CCarGen: 256}
                //CLODLight LODLightsSOA { get; set; } //256   256: Structure: CLODLight: LODLightsSOA//1774371066
                //CDistantLODLight DistantLODLightsSOA { get; set; } //392   392: Structure: CDistantLODLight: DistantLODLightsSOA//2954466641
                //CBlockDesc block { get; set; } //440   440: Structure: CBlockDesc//3072355914: block
            }
        }