public void Setup(EdgeObjectMaker EOM) { EdgeObject = EOM.EdgeObject; bCombineMesh = EOM.bCombineMesh; bCombineMeshCollider = EOM.bCombineMeshCollider; MeterSep = EOM.MeterSep; bToggle = EOM.bToggle; bMaterialOverride = EOM.bMaterialOverride; EdgeMaterial1 = EOM.EdgeMaterial1; EdgeMaterial2 = EOM.EdgeMaterial2; HorizontalSep = EOM.HorizontalSep; HorizontalCurve = EOM.HorizontalCurve; VerticalRaise = EOM.VerticalRaise; VerticalCurve = EOM.VerticalCurve; bMatchTerrain = EOM.bMatchTerrain; CustomRotation = EOM.CustomRotation; bOncomingRotation = EOM.bOncomingRotation; bStatic = EOM.bStatic; bSingle = EOM.bSingle; SinglePosition = EOM.SinglePosition; tName = EOM.tName; StartTime = EOM.StartTime; EndTime = EOM.EndTime; SingleOnlyBridgePercent = EOM.SingleOnlyBridgePercent; bStartMatchRoadDefinition = EOM.bStartMatchRoadDefinition; StartMatchRoadDef = EOM.StartMatchRoadDef; }
public void LoadTo(EdgeObjectMaker EOM) { EOM.EdgeObject = EdgeObject; EOM.bMaterialOverride = bMaterialOverride; EOM.EdgeMaterial1 = EdgeMaterial1; EOM.EdgeMaterial2 = EdgeMaterial2; EOM.bCombineMesh = bCombineMesh; EOM.bCombineMeshCollider = bCombineMeshCollider; EOM.SubType = SubType; EOM.MeterSep = MeterSep; EOM.bToggle = bToggle; EOM.HorizontalSep = HorizontalSep; EOM.HorizontalCurve = HorizontalCurve; EOM.VerticalRaise = VerticalRaise; EOM.VerticalCurve = VerticalCurve; EOM.bMatchTerrain = bMatchTerrain; EOM.CustomRotation = CustomRotation; EOM.bOncomingRotation = bOncomingRotation; EOM.bStatic = bStatic; EOM.bSingle = bSingle; EOM.StartTime = StartTime; EOM.EndTime = EndTime; EOM.SinglePosition = SinglePosition; EOM.tName = tName; EOM.SingleOnlyBridgePercent = SingleOnlyBridgePercent; EOM.bStartMatchRoadDefinition = bStartMatchRoadDefinition; EOM.StartMatchRoadDef = StartMatchRoadDef; }
public void Setup(EdgeObjectMaker EOM) { EdgeObjectString = EOM.EdgeObjectString; bCombineMesh = EOM.bCombineMesh; bCombineMeshCollider = EOM.bCombineMeshCollider; // GSD.Roads.SignPlacementSubTypeEnum SubType = EOM.SubType; MeterSep = EOM.MeterSep; bToggle = EOM.bToggle; bIsGSD = EOM.bIsGSD; bMaterialOverride = EOM.bMaterialOverride; EdgeMaterial1String = EOM.EdgeMaterial1String; EdgeMaterial2String = EOM.EdgeMaterial2String; HorizontalSep = EOM.HorizontalSep; HorizontalCurve = EOM.HorizontalCurve; VerticalRaise = EOM.VerticalRaise; VerticalCurve = EOM.VerticalCurve; bMatchTerrain = EOM.bMatchTerrain; CustomRotation = EOM.CustomRotation; bOncomingRotation = EOM.bOncomingRotation; bStatic = EOM.bStatic; bSingle = EOM.bSingle; SinglePosition = EOM.SinglePosition; tName = EOM.tName; SingleOnlyBridgePercent = EOM.SingleOnlyBridgePercent; bStartMatchRoadDefinition = EOM.bStartMatchRoadDefinition; StartMatchRoadDef = EOM.StartMatchRoadDef; ThumbString = EOM.ThumbString; Desc = EOM.Desc; bIsBridge = EOM.bIsBridge; DisplayName = EOM.DisplayName; }
public void LoadTo(EdgeObjectMaker EOM) { EOM.EdgeObjectString = EdgeObjectString; #if UNITY_EDITOR EOM.EdgeObject = (GameObject)UnityEditor.AssetDatabase.LoadAssetAtPath(EdgeObjectString, typeof(GameObject)); #endif EOM.bMaterialOverride = bMaterialOverride; #if UNITY_EDITOR if (EdgeMaterial1String.Length > 0) { EOM.EdgeMaterial1 = (Material)UnityEditor.AssetDatabase.LoadAssetAtPath(EdgeMaterial1String, typeof(Material)); } if (EdgeMaterial2String.Length > 0) { EOM.EdgeMaterial2 = (Material)UnityEditor.AssetDatabase.LoadAssetAtPath(EdgeMaterial2String, typeof(Material)); } #endif EOM.bCombineMesh = bCombineMesh; EOM.bCombineMeshCollider = bCombineMeshCollider; EOM.SubType = SubType; EOM.MeterSep = MeterSep; EOM.bToggle = bToggle; EOM.bIsGSD = bIsGSD; EOM.HorizontalSep = HorizontalSep; EOM.HorizontalCurve = HorizontalCurve; EOM.VerticalRaise = VerticalRaise; EOM.VerticalCurve = VerticalCurve; EOM.bMatchTerrain = bMatchTerrain; EOM.CustomRotation = CustomRotation; EOM.bOncomingRotation = bOncomingRotation; EOM.bStatic = bStatic; EOM.bSingle = bSingle; EOM.SinglePosition = SinglePosition; EOM.tName = tName; EOM.SingleOnlyBridgePercent = SingleOnlyBridgePercent; EOM.bStartMatchRoadDefinition = bStartMatchRoadDefinition; EOM.StartMatchRoadDef = StartMatchRoadDef; EOM.ThumbString = ThumbString; EOM.Desc = Desc; EOM.bIsBridge = bIsBridge; EOM.DisplayName = DisplayName; }
private void DoGUI() { if (bNoGUI) { return; } if (oList == null) { Close(); return; } GUILayout.Space(4f); EditorGUILayout.BeginHorizontal(); if (tNode.bIsBridgeStart) { xWindowType = (WindowTypeEnum)EditorGUILayout.Popup("Category: ", (int)tWindowType, WindowTypeDescBridge, GUILayout.Width(312f)); } else { if (xWindowType == WindowTypeEnum.Edge) { SxWindowType = WindowTypeEnumShort.Edge; } else if (xWindowType == WindowTypeEnum.Extrusion) { SxWindowType = WindowTypeEnumShort.Extrusion; } else { SxWindowType = WindowTypeEnumShort.Groups; } SxWindowType = (WindowTypeEnumShort)EditorGUILayout.Popup("Category: ", (int)StWindowType, WindowTypeDesc, GUILayout.Width(312f)); if (SxWindowType == WindowTypeEnumShort.Extrusion) { xWindowType = WindowTypeEnum.Extrusion; } else if (SxWindowType == WindowTypeEnumShort.Edge) { xWindowType = WindowTypeEnum.Edge; } else { xWindowType = WindowTypeEnum.Groups; } StWindowType = SxWindowType; } if (xWindowType != tWindowType) { Initialize(xWindowType, tNode); EditorGUILayout.EndHorizontal(); return; } EditorGUILayout.LabelField(""); EditorGUILayout.LabelField("Single-click items to load", EditorStyles.boldLabel, GUILayout.Width(200f)); EditorGUILayout.EndHorizontal(); if (oList.Count == 0) { return; } int oCount = oList.Count; int WidthSpacing = 160; int HeightSpacing = 200; int HeightOffset = 30; int ScrollHeightOffset = 25; int xCount = 0; int yCount = 0; int yMod = Mathf.FloorToInt((float)position.width / 142f) - 1; int yMax = 0; if (yMod == 0) { yMax = 1; } else { yMax = Mathf.CeilToInt((float)oCount / (float)yMod); } bool bScrolling = false; if ((((yMax) * HeightSpacing) + 25) > position.height) { scrollPos = GUI.BeginScrollView(new Rect(0, 25, position.width - 10, position.height - 30), scrollPos, new Rect(0, 0, (yMod * WidthSpacing) + 25, (((yMax) * HeightSpacing) + 50))); bScrolling = true; HeightOffset = ScrollHeightOffset; } EditorGUILayout.BeginHorizontal(); bool bClicked = false; for (int i = 0; i < oCount; i++) { if (i > 0) { if (yMod == 0) { EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); yCount += 1; xCount = 0; } else { if (i % yMod == 0) { EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); yCount += 1; xCount = 0; } } } if (xCount == 0) { bClicked = DoItem((xCount * WidthSpacing) + 5, (yCount * HeightSpacing) + HeightOffset, i); } else { bClicked = DoItem(xCount * WidthSpacing, (yCount * HeightSpacing) + HeightOffset, i); } if (bClicked) { if (tWindowType == WindowTypeEnum.Extrusion) { GSD.Roads.Splination.SplinatedMeshMaker SMM = tNode.AddSplinatedObject(); SMM.SetDefaultTimes(tNode.bIsEndPoint, tNode.tTime, tNode.NextTime, tNode.idOnSpline, tNode.GSDSpline.distance); SMM.LoadFromLibrary(oList[i].FileName, oList[i].bIsDefault); SMM.bIsGSD = oList[i].bIsDefault; SMM.Setup(true); } else if (tWindowType == WindowTypeEnum.Edge) { GSD.Roads.EdgeObjects.EdgeObjectMaker EOM = tNode.AddEdgeObject(); EOM.SetDefaultTimes(tNode.bIsEndPoint, tNode.tTime, tNode.NextTime, tNode.idOnSpline, tNode.GSDSpline.distance); EOM.LoadFromLibrary(oList[i].FileName, oList[i].bIsDefault); EOM.bIsGSD = oList[i].bIsDefault; EOM.Setup(); } else if (tWindowType == WindowTypeEnum.Groups) { tNode.LoadWizardObjectsFromLibrary(oList[i].FileName, oList[i].bIsDefault, oList[i].bIsBridge); } else if (tWindowType == WindowTypeEnum.BridgeComplete) { tNode.LoadWizardObjectsFromLibrary(oList[i].FileName, oList[i].bIsDefault, oList[i].bIsBridge); } tNode.bQuitGUI = true; oList.Clear(); oList = null; EditorGUILayout.EndHorizontal(); if (bScrolling) { GUI.EndScrollView(); } bNoGUI = true; Close(); return; } xCount += 1; } EditorGUILayout.EndHorizontal(); if (bScrolling) { GUI.EndScrollView(); } }
public EdgeObjectMaker Copy() { EdgeObjectMaker EOM = new EdgeObjectMaker(); EOM.EdgeObjectString = EdgeObjectString; #if UNITY_EDITOR EOM.EdgeObject = (GameObject)UnityEditor.AssetDatabase.LoadAssetAtPath(EdgeObjectString, typeof(GameObject)); #endif EOM.bIsGSD = bIsGSD; EOM.bCombineMesh = bCombineMesh; EOM.bCombineMeshCollider = bCombineMeshCollider; EOM.SubType = SubType; EOM.MeterSep = MeterSep; EOM.bToggle = bToggle; EOM.bMatchTerrain = bMatchTerrain; EOM.bMaterialOverride = bMaterialOverride; EOM.EdgeMaterial1 = EdgeMaterial1; EOM.EdgeMaterial2 = EdgeMaterial2; EOM.MasterObj = MasterObj; EOM.EdgeObjectLocations = EdgeObjectLocations; EOM.EdgeObjectRotations = EdgeObjectRotations; EOM.tNode = tNode; EOM.StartTime = StartTime; EOM.EndTime = EndTime; EOM.StartPos = StartPos; EOM.EndPos = EndPos; EOM.SingleOnlyBridgePercent = SingleOnlyBridgePercent; EOM.bIsBridge = bIsBridge; EOM.HorizontalSep = HorizontalSep; EOM.HorizontalCurve = new AnimationCurve(); if (HorizontalCurve != null && HorizontalCurve.keys.Length > 0) { for (int i = 0; i < HorizontalCurve.keys.Length; i++) { EOM.HorizontalCurve.AddKey(HorizontalCurve.keys[i]); } } EOM.VerticalRaise = VerticalRaise; EOM.VerticalCurve = new AnimationCurve(); if (VerticalCurve != null && VerticalCurve.keys.Length > 0) { for (int i = 0; i < VerticalCurve.keys.Length; i++) { EOM.VerticalCurve.AddKey(VerticalCurve.keys[i]); } } EOM.CustomRotation = CustomRotation; EOM.bOncomingRotation = bOncomingRotation; EOM.bStatic = bStatic; EOM.bSingle = bSingle; EOM.SinglePosition = SinglePosition; EOM.bStartMatchRoadDefinition = bStartMatchRoadDefinition; EOM.StartMatchRoadDef = StartMatchRoadDef; EOM.SetupUniqueIdentifier(); EOM.tName = tName; EOM.ThumbString = ThumbString; EOM.Desc = Desc; EOM.DisplayName = DisplayName; return(EOM); }
public bool IsEqual(EdgeObjectMaker EOM) { if (EOM.EdgeObject != EdgeObject) { return(false); } if (EOM.bMaterialOverride != bMaterialOverride) { return(false); } if (EOM.EdgeMaterial1 != EdgeMaterial1) { return(false); } if (EOM.EdgeMaterial2 != EdgeMaterial2) { return(false); } if (EOM.bCombineMesh != bCombineMesh) { return(false); } if (EOM.bCombineMeshCollider != bCombineMeshCollider) { return(false); } if (EOM.SubType != SubType) { return(false); } if (!GSDRootUtil.IsApproximately(EOM.MeterSep, MeterSep, 0.001f)) { return(false); } // if(EOM.bToggle != bToggle){ return false; } if (!GSDRootUtil.IsApproximately(EOM.HorizontalSep, HorizontalSep, 0.001f)) { return(false); } if (EOM.HorizontalCurve != HorizontalCurve) { return(false); } if (!GSDRootUtil.IsApproximately(EOM.VerticalRaise, VerticalRaise, 0.001f)) { return(false); } if (EOM.VerticalCurve != VerticalCurve) { return(false); } if (EOM.bMatchTerrain != bMatchTerrain) { return(false); } if (EOM.CustomRotation != CustomRotation) { return(false); } if (EOM.bOncomingRotation != bOncomingRotation) { return(false); } if (EOM.bStatic != bStatic) { return(false); } if (EOM.bSingle != bSingle) { return(false); } if (!GSDRootUtil.IsApproximately(EOM.SinglePosition, SinglePosition, 0.001f)) { return(false); } if (!GSDRootUtil.IsApproximately(EOM.StartTime, StartTime, 0.001f)) { return(false); } if (!GSDRootUtil.IsApproximately(EOM.EndTime, EndTime, 0.001f)) { return(false); } if (EOM.tName != tName) { return(false); } if (!GSDRootUtil.IsApproximately(EOM.SingleOnlyBridgePercent, SingleOnlyBridgePercent, 0.001f)) { return(false); } if (EOM.bStartMatchRoadDefinition != bStartMatchRoadDefinition) { return(false); } if (!GSDRootUtil.IsApproximately(EOM.StartMatchRoadDef, StartMatchRoadDef, 0.001f)) { return(false); } return(true); }
public void UpdateEdgeObjects(){ if(!tNode.CanSplinate()){ return; } eCount = tNode.EdgeObjects.Count; for(int i=0;i<tNode.EdgeObjects.Count;i++){ EOM = tNode.EdgeObjects[i]; if(EOM.EM != null){ if(!EOM.EM.IsEqual(EOM)){ EOM.EM.LoadTo(EOM); EOM.UpdatePositions(); EOM.Setup(); // Debug.Log ("Setup EOM"); } } } }
public EdgeObjectMaker Copy(){ EdgeObjectMaker EOM = new EdgeObjectMaker(); EOM.EdgeObjectString = EdgeObjectString; #if UNITY_EDITOR EOM.EdgeObject = (GameObject)UnityEditor.AssetDatabase.LoadAssetAtPath(EdgeObjectString,typeof(GameObject)); #endif EOM.bIsGSD = bIsGSD; EOM.bCombineMesh = bCombineMesh; EOM.bCombineMeshCollider = bCombineMeshCollider; EOM.SubType = SubType; EOM.MeterSep = MeterSep; EOM.bToggle = bToggle; EOM.bMatchTerrain = bMatchTerrain; EOM.bMaterialOverride = bMaterialOverride; EOM.EdgeMaterial1 = EdgeMaterial1; EOM.EdgeMaterial2 = EdgeMaterial2; EOM.MasterObj = MasterObj; EOM.EdgeObjectLocations = EdgeObjectLocations; EOM.EdgeObjectRotations = EdgeObjectRotations; EOM.tNode = tNode; EOM.StartTime = StartTime; EOM.EndTime = EndTime; EOM.StartPos = StartPos; EOM.EndPos = EndPos; EOM.SingleOnlyBridgePercent = SingleOnlyBridgePercent; EOM.bIsBridge = bIsBridge; EOM.HorizontalSep = HorizontalSep; EOM.HorizontalCurve = new AnimationCurve(); if(HorizontalCurve != null && HorizontalCurve.keys.Length > 0){ for(int i=0;i<HorizontalCurve.keys.Length;i++){ EOM.HorizontalCurve.AddKey(HorizontalCurve.keys[i]); } } EOM.VerticalRaise = VerticalRaise; EOM.VerticalCurve = new AnimationCurve(); if(VerticalCurve != null && VerticalCurve.keys.Length > 0){ for(int i=0;i<VerticalCurve.keys.Length;i++){ EOM.VerticalCurve.AddKey(VerticalCurve.keys[i]); } } EOM.CustomRotation = CustomRotation; EOM.bOncomingRotation = bOncomingRotation; EOM.bStatic = bStatic; EOM.bSingle = bSingle; EOM.SinglePosition = SinglePosition; EOM.bStartMatchRoadDefinition = bStartMatchRoadDefinition; EOM.StartMatchRoadDef = StartMatchRoadDef; EOM.SetupUniqueIdentifier(); EOM.tName = tName; EOM.ThumbString = ThumbString; EOM.Desc = Desc; EOM.DisplayName = DisplayName; return EOM; }
public bool IsEqual(EdgeObjectMaker EOM){ if(EOM.EdgeObject != EdgeObject){ return false; } if(EOM.bMaterialOverride != bMaterialOverride){ return false; } if(EOM.EdgeMaterial1 != EdgeMaterial1){ return false; } if(EOM.EdgeMaterial2 != EdgeMaterial2){ return false; } if(EOM.bCombineMesh != bCombineMesh){ return false; } if(EOM.bCombineMeshCollider != bCombineMeshCollider){ return false; } if(EOM.SubType != SubType){ return false; } if(!GSDRootUtil.IsApproximately(EOM.MeterSep,MeterSep,0.001f)){ return false; } // if(EOM.bToggle != bToggle){ return false; } if(!GSDRootUtil.IsApproximately(EOM.HorizontalSep,HorizontalSep,0.001f)){ return false; } if(EOM.HorizontalCurve != HorizontalCurve){ return false; } if(!GSDRootUtil.IsApproximately(EOM.VerticalRaise,VerticalRaise,0.001f)){ return false; } if(EOM.VerticalCurve != VerticalCurve){ return false; } if(EOM.bMatchTerrain != bMatchTerrain){ return false; } if(EOM.CustomRotation != CustomRotation){ return false; } if(EOM.bOncomingRotation != bOncomingRotation){ return false; } if(EOM.bStatic != bStatic){ return false; } if(EOM.bSingle != bSingle){ return false; } if(!GSDRootUtil.IsApproximately(EOM.SinglePosition,SinglePosition,0.001f)){ return false; } if(!GSDRootUtil.IsApproximately(EOM.StartTime,StartTime,0.001f)){ return false; } if(!GSDRootUtil.IsApproximately(EOM.EndTime,EndTime,0.001f)){ return false; } if(EOM.tName != tName){ return false; } if(!GSDRootUtil.IsApproximately(EOM.SingleOnlyBridgePercent,SingleOnlyBridgePercent,0.001f)){ return false; } if(EOM.bStartMatchRoadDefinition != bStartMatchRoadDefinition){ return false; } if(!GSDRootUtil.IsApproximately(EOM.StartMatchRoadDef,StartMatchRoadDef,0.001f)){ return false; } return true; }
public void LoadTo(EdgeObjectMaker EOM){ EOM.EdgeObject = EdgeObject; EOM.bMaterialOverride = bMaterialOverride; EOM.EdgeMaterial1 = EdgeMaterial1; EOM.EdgeMaterial2 = EdgeMaterial2; EOM.bCombineMesh = bCombineMesh; EOM.bCombineMeshCollider = bCombineMeshCollider; EOM.SubType = SubType; EOM.MeterSep = MeterSep; EOM.bToggle = bToggle; EOM.HorizontalSep = HorizontalSep; EOM.HorizontalCurve = HorizontalCurve; EOM.VerticalRaise = VerticalRaise; EOM.VerticalCurve = VerticalCurve; EOM.bMatchTerrain = bMatchTerrain; EOM.CustomRotation = CustomRotation; EOM.bOncomingRotation = bOncomingRotation; EOM.bStatic = bStatic; EOM.bSingle = bSingle; EOM.StartTime = StartTime; EOM.EndTime = EndTime; EOM.SinglePosition = SinglePosition; EOM.tName = tName; EOM.SingleOnlyBridgePercent = SingleOnlyBridgePercent; EOM.bStartMatchRoadDefinition = bStartMatchRoadDefinition; EOM.StartMatchRoadDef = StartMatchRoadDef; }
public void Setup(EdgeObjectMaker EOM){ EdgeObject = EOM.EdgeObject; bCombineMesh = EOM.bCombineMesh; bCombineMeshCollider = EOM.bCombineMeshCollider; MeterSep = EOM.MeterSep; bToggle = EOM.bToggle; bMaterialOverride = EOM.bMaterialOverride; EdgeMaterial1 = EOM.EdgeMaterial1; EdgeMaterial2 = EOM.EdgeMaterial2; HorizontalSep = EOM.HorizontalSep; HorizontalCurve = EOM.HorizontalCurve; VerticalRaise = EOM.VerticalRaise; VerticalCurve = EOM.VerticalCurve; bMatchTerrain = EOM.bMatchTerrain; CustomRotation = EOM.CustomRotation; bOncomingRotation = EOM.bOncomingRotation; bStatic = EOM.bStatic; bSingle = EOM.bSingle; SinglePosition = EOM.SinglePosition; tName = EOM.tName; StartTime = EOM.StartTime; EndTime = EOM.EndTime; SingleOnlyBridgePercent = EOM.SingleOnlyBridgePercent; bStartMatchRoadDefinition = EOM.bStartMatchRoadDefinition; StartMatchRoadDef = EOM.StartMatchRoadDef; }
public void LoadTo(EdgeObjectMaker EOM){ EOM.EdgeObjectString = EdgeObjectString; #if UNITY_EDITOR EOM.EdgeObject = (GameObject)UnityEditor.AssetDatabase.LoadAssetAtPath(EdgeObjectString,typeof(GameObject)); #endif EOM.bMaterialOverride = bMaterialOverride; #if UNITY_EDITOR if(EdgeMaterial1String.Length > 0){ EOM.EdgeMaterial1 = (Material)UnityEditor.AssetDatabase.LoadAssetAtPath(EdgeMaterial1String,typeof(Material)); } if(EdgeMaterial2String.Length > 0){ EOM.EdgeMaterial2 = (Material)UnityEditor.AssetDatabase.LoadAssetAtPath(EdgeMaterial2String,typeof(Material)); } #endif EOM.bCombineMesh = bCombineMesh; EOM.bCombineMeshCollider = bCombineMeshCollider; EOM.SubType = SubType; EOM.MeterSep = MeterSep; EOM.bToggle = bToggle; EOM.bIsGSD = bIsGSD; EOM.HorizontalSep = HorizontalSep; EOM.HorizontalCurve = HorizontalCurve; EOM.VerticalRaise = VerticalRaise; EOM.VerticalCurve = VerticalCurve; EOM.bMatchTerrain = bMatchTerrain; EOM.CustomRotation = CustomRotation; EOM.bOncomingRotation = bOncomingRotation; EOM.bStatic = bStatic; EOM.bSingle = bSingle; EOM.SinglePosition = SinglePosition; EOM.tName = tName; EOM.SingleOnlyBridgePercent = SingleOnlyBridgePercent; EOM.bStartMatchRoadDefinition = bStartMatchRoadDefinition; EOM.StartMatchRoadDef = StartMatchRoadDef; EOM.ThumbString = ThumbString; EOM.Desc = Desc; EOM.bIsBridge = bIsBridge; EOM.DisplayName = DisplayName; }
public void Setup(EdgeObjectMaker EOM){ EdgeObjectString = EOM.EdgeObjectString; bCombineMesh = EOM.bCombineMesh; bCombineMeshCollider = EOM.bCombineMeshCollider; // GSD.Roads.SignPlacementSubTypeEnum SubType = EOM.SubType; MeterSep = EOM.MeterSep; bToggle = EOM.bToggle; bIsGSD = EOM.bIsGSD; bMaterialOverride = EOM.bMaterialOverride; EdgeMaterial1String = EOM.EdgeMaterial1String; EdgeMaterial2String = EOM.EdgeMaterial2String; HorizontalSep = EOM.HorizontalSep; HorizontalCurve = EOM.HorizontalCurve; VerticalRaise = EOM.VerticalRaise; VerticalCurve = EOM.VerticalCurve; bMatchTerrain = EOM.bMatchTerrain; CustomRotation = EOM.CustomRotation; bOncomingRotation = EOM.bOncomingRotation; bStatic = EOM.bStatic; bSingle = EOM.bSingle; SinglePosition = EOM.SinglePosition; tName = EOM.tName; SingleOnlyBridgePercent = EOM.SingleOnlyBridgePercent; bStartMatchRoadDefinition = EOM.bStartMatchRoadDefinition; StartMatchRoadDef = EOM.StartMatchRoadDef; ThumbString = EOM.ThumbString; Desc = EOM.Desc; bIsBridge = EOM.bIsBridge; DisplayName = EOM.DisplayName; }
public void UpdateEdgeObjects_OnUndo(){ if(!tNode.CanSplinate()){ return; } eCount = tNode.EdgeObjects.Count; for(int i=0;i<tNode.EdgeObjects.Count;i++){ EOM = tNode.EdgeObjects[i]; EOM.Setup(); } }
public void Initialize(ref Rect _rect, WindowTypeEnum _windowType, GSDSplineN _node, GSD.Roads.Splination.SplinatedMeshMaker _SMM = null, GSD.Roads.EdgeObjects.EdgeObjectMaker _EOM = null) { int Rheight = 300; int Rwidth = 360; float Rx = ((float)_rect.width / 2f) - ((float)Rwidth / 2f) + _rect.x; float Ry = ((float)_rect.height / 2f) - ((float)Rheight / 2f) + _rect.y; if (Rx < 0) { Rx = _rect.x; } if (Ry < 0) { Ry = _rect.y; } if (Rx > (_rect.width + _rect.x)) { Rx = _rect.x; } if (Ry > (_rect.height + _rect.y)) { Ry = _rect.y; } Rect fRect = new Rect(Rx, Ry, Rwidth, Rheight); if (fRect.width < 300) { fRect.width = 300; fRect.x = _rect.x; } if (fRect.height < 300) { fRect.height = 300; fRect.y = _rect.y; } position = fRect; tWindowType = _windowType; Show(); titleContent.text = "Save"; if (tWindowType == WindowTypeEnum.Extrusion) { titleText = "Save extrusion"; tSMMs = new GSD.Roads.Splination.SplinatedMeshMaker[1]; tSMMs[0] = _SMM; if (_SMM != null) { fileName = _SMM.tName; displayName = fileName; } } else if (tWindowType == WindowTypeEnum.Edge) { titleText = "Save edge object"; tEOMs = new GSD.Roads.EdgeObjects.EdgeObjectMaker[1]; tEOMs[0] = _EOM; if (_EOM != null) { fileName = _EOM.tName; displayName = fileName; } } else if (tWindowType == WindowTypeEnum.BridgeWizard) { isBridge = true; tSMMs = _node.SplinatedObjects.ToArray(); tEOMs = _node.EdgeObjects.ToArray(); titleText = "Save group"; fileName = "Group" + Random.Range(0, 10000).ToString(); displayName = fileName; } if (xPath.Length < 5) { xPath = GSDRootUtil.Dir_GetLibrary(); } if (tWindowType == WindowTypeEnum.Edge) { if (System.IO.File.Exists(xPath + "EOM" + fileName + ".gsd")) { fileExists = true; } else { fileExists = false; } } else if (tWindowType == WindowTypeEnum.Extrusion) { if (System.IO.File.Exists(xPath + "ESO" + fileName + ".gsd")) { fileExists = true; } else { fileExists = false; } } else { if (System.IO.File.Exists(xPath + "B/" + fileName + ".gsd")) { fileExists = true; } else { fileExists = false; } } }
public EdgeObjectMaker AddEdgeObject(){ EdgeObjectMaker EOM = new EdgeObjectMaker(); EOM.tNode = this; EOM.SetDefaultTimes(bIsEndPoint,tTime,NextTime,idOnSpline,GSDSpline.distance); EOM.StartPos = GSDSpline.GetSplineValue(EOM.StartTime); EOM.EndPos = GSDSpline.GetSplineValue(EOM.EndTime); EdgeObjects.Add(EOM); return EOM; }
public void DoEdgeObjects(){ if(!tNode.CanSplinate()){ return; } if(tNode.EdgeObjects == null){ tNode.EdgeObjects = new List<GSD.Roads.EdgeObjects.EdgeObjectMaker>(); } eCount = tNode.EdgeObjects.Count; EOM = null; for(int i=0;i<tNode.EdgeObjects.Count;i++){ EOM = tNode.EdgeObjects[i]; if(EOM.EM == null){ EOM.EM = new GSD.Roads.EdgeObjects.EdgeObjectMaker.EdgeObjectEditorMaker(); } EOM.EM.Setup(EOM); currentCount +=1; EditorGUILayout.BeginVertical("TextArea"); if(EOM.bNeedsUpdate){ EOM.Setup(); } EOM.bNeedsUpdate = false; EditorGUILayout.BeginHorizontal(); EOM.bToggle = EditorGUILayout.Foldout(EOM.bToggle,"#" + currentCount.ToString() + ": " + EOM.tName); if(GUILayout.Button(btnEdgeText,GSDImageButton,GUILayout.Width(32f))){ } if(GUILayout.Button(btnRefreshText,GSDImageButton,GUILayout.Width(16f))){ EOM.Setup(); } if(GUILayout.Button(btnSaveText,GSDImageButton,GUILayout.Width(16f))){ GSDSaveWindow tSave = EditorWindow.GetWindow<GSDSaveWindow>(); tSave.Initialize(ref tSceneRect,GSDSaveWindow.WindowTypeEnum.Edge,tNode,null,EOM); } if(GUILayout.Button(btnCopyText,GSDImageButton,GUILayout.Width(16f))){ Undo.RecordObject(tNode,"Copy"); tNode.CopyEdgeObject(i); EditorUtility.SetDirty(tNode); } if(GUILayout.Button(btnDeleteText,GSDImageButton,GUILayout.Width(16f))){ Undo.RecordObject(tNode,"Delete"); tNode.RemoveEdgeObject(i); EditorUtility.SetDirty(tNode); } EditorGUILayout.EndHorizontal(); if(!EOM.bToggle){ EditorGUILayout.EndVertical(); continue; } GUILayout.Space(8f); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("General options:"); if(GUILayout.Button("Online manual",EditorStyles.miniButton,GUILayout.Width(120f))){ Application.OpenURL("http://microgsd.com/Support/RoadArchitectManual.aspx"); } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginVertical("box"); //Name: EOM.EM.tName = EditorGUILayout.TextField("Name: ",EOM.tName); //Edge object: EOM.EM.EdgeObject = (GameObject)EditorGUILayout.ObjectField("Edge object: ",EOM.EdgeObject,typeof(GameObject), false); if(EOM.EM.EdgeObject != EOM.EdgeObject){ EOM.bEdgeSignLabelInit = false; EOM.bEdgeSignLabel = false; } //Material override: EOM.EM.bMaterialOverride = EditorGUILayout.Toggle("Material override: ",EOM.bMaterialOverride); if(!EOM.bMaterialOverride){ EOM.EM.EdgeMaterial1 = null; EOM.EM.EdgeMaterial2 = null; } if(!EOM.bEdgeSignLabelInit){ EOM.bEdgeSignLabel = false; if(string.CompareOrdinal(EOM.EM.EdgeObject.name,"GSDSignDiamond") == 0){ EOM.bEdgeSignLabel = true; EOM.EdgeSignLabel = "GSDFedSign-diamond"; }else if(string.CompareOrdinal(EOM.EM.EdgeObject.name,"GSDSignSquare-Small") == 0){ EOM.bEdgeSignLabel = true; EOM.EdgeSignLabel = "GSDFedSign-Square"; }else if(string.CompareOrdinal(EOM.EM.EdgeObject.name,"GSDSignSquare") == 0){ EOM.bEdgeSignLabel = true; EOM.EdgeSignLabel = "GSDFedSign-Square"; }else if(string.CompareOrdinal(EOM.EM.EdgeObject.name,"GSDSign988-Small") == 0){ EOM.bEdgeSignLabel = true; EOM.EdgeSignLabel = "GSDFedSign-988"; }else if(string.CompareOrdinal(EOM.EM.EdgeObject.name,"GSDSign988") == 0){ EOM.bEdgeSignLabel = true; EOM.EdgeSignLabel = "GSDFedSign-988"; }else if(string.CompareOrdinal(EOM.EM.EdgeObject.name,"GSDSign861-Small") == 0){ EOM.bEdgeSignLabel = true; EOM.EdgeSignLabel = "GSDFedSign-861"; }else if(string.CompareOrdinal(EOM.EM.EdgeObject.name,"GSDSign861") == 0){ EOM.bEdgeSignLabel = true; EOM.EdgeSignLabel = "GSDFedSign-861"; }else if(string.CompareOrdinal(EOM.EM.EdgeObject.name,"GSDSign617-Small") == 0){ EOM.bEdgeSignLabel = true; EOM.EdgeSignLabel = "GSDFedSign-617"; }else if(string.CompareOrdinal(EOM.EM.EdgeObject.name,"GSDSign617") == 0){ EOM.bEdgeSignLabel = true; EOM.EdgeSignLabel = "GSDFedSign-617"; }else if(string.CompareOrdinal(EOM.EM.EdgeObject.name,"GSDSign396") == 0){ EOM.bEdgeSignLabel = true; EOM.EdgeSignLabel = "GSDFedSign-396"; }else if(string.CompareOrdinal(EOM.EM.EdgeObject.name,"GSDSign330") == 0){ EOM.bEdgeSignLabel = true; EOM.EdgeSignLabel = "GSDFedSign-330"; } } if(EOM.bMaterialOverride){ if(EOM.bEdgeSignLabel){ EditorGUILayout.TextField("Material search term: ",EOM.EdgeSignLabel); } EOM.EM.EdgeMaterial1 = (Material)EditorGUILayout.ObjectField("Override mat #1: ",EOM.EdgeMaterial1,typeof(Material), false); EOM.EM.EdgeMaterial2 = (Material)EditorGUILayout.ObjectField("Override mat #2: ",EOM.EdgeMaterial2,typeof(Material), false); } if(EOM.bSingle){ EOM.EM.bCombineMesh = false; }else{ EOM.EM.bCombineMesh = EditorGUILayout.Toggle("Combine meshes: ",EOM.bCombineMesh); if(EOM.bCombineMesh){ EOM.EM.bCombineMeshCollider = EditorGUILayout.Toggle("Combined mesh collider: ",EOM.bCombineMeshCollider); } } EOM.EM.bSingle = EditorGUILayout.Toggle("Single object only: ",EOM.bSingle); if(EOM.EM.bSingle != EOM.bSingle){ EOM.EM.EndTime = tNode.NextTime; // EOM.EM.EndPos = tNode.GSDSpline.GetSplineValue(EOM.EM.EndTime,false); EOM.EM.SinglePosition = tNode.tTime+0.025f; if(EOM.EM.bSingle){ EOM.EM.bCombineMesh = false; } } if(EOM.bSingle){ EOM.EM.SinglePosition = EditorGUILayout.Slider("Single location: ",EOM.SinglePosition,tNode.tTime,1f); if(tNode.bIsBridgeStart && tNode.bIsBridgeMatched){ EOM.EM.SingleOnlyBridgePercent = EditorGUILayout.Slider("Bridge %: ",EOM.SingleOnlyBridgePercent,0f,1f); if(!GSDRootUtil.IsApproximately(EOM.SingleOnlyBridgePercent,EOM.EM.SingleOnlyBridgePercent,0.001f)){ EOM.EM.SingleOnlyBridgePercent = Mathf.Clamp(EOM.EM.SingleOnlyBridgePercent,0f,1f); float tDist = (EOM.EM.SingleOnlyBridgePercent * (tNode.BridgeCounterpartNode.tDist - tNode.tDist) + tNode.tDist); EOM.EM.SinglePosition = tNode.GSDSpline.TranslateDistBasedToParam(tDist); } } } EOM.EM.bStatic = EditorGUILayout.Toggle("Static: ",EOM.bStatic); EOM.EM.bMatchTerrain = EditorGUILayout.Toggle("Match ground height: ",EOM.bMatchTerrain); if(!EOM.bSingle){ EOM.EM.MeterSep = EditorGUILayout.Slider("Dist between objects: ",EOM.MeterSep,1f,256f); } EOM.EM.bStartMatchRoadDefinition = EditorGUILayout.Toggle("Match road definition: ",EOM.bStartMatchRoadDefinition); if(EOM.bStartMatchRoadDefinition){ EOM.EM.StartMatchRoadDef = EditorGUILayout.Slider("Position fine tuning: ",EOM.StartMatchRoadDef,0f,1f); if(!GSDRootUtil.IsApproximately(EOM.EM.StartMatchRoadDef,EOM.StartMatchRoadDef,0.001f)){ EOM.EM.StartMatchRoadDef = Mathf.Clamp(EOM.EM.StartMatchRoadDef,0f,1f); } } if(!EOM.bSingle){ if(EOM.EM.StartTime < tNode.MinSplination){ EOM.EM.StartTime = tNode.MinSplination; } if(EOM.EM.EndTime > tNode.MaxSplination){ EOM.EM.EndTime = tNode.MaxSplination; } EditorGUILayout.BeginHorizontal(); EOM.EM.StartTime = EditorGUILayout.Slider("Start param: ",EOM.StartTime,tNode.MinSplination,EOM.EndTime); if(EOM.EM.EndTime < EOM.EM.StartTime){ EOM.EM.EndTime = Mathf.Clamp(EOM.StartTime+0.01f,0f,1f); } if(GUILayout.Button("match node",EditorStyles.miniButton, GUILayout.Width(80f))){ EOM.EM.StartTime = tNode.tTime; } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EOM.EM.EndTime = EditorGUILayout.Slider("End param: ",EOM.EndTime,EOM.StartTime,tNode.MaxSplination); if(EOM.EM.StartTime > EOM.EM.EndTime){ EOM.EM.StartTime = Mathf.Clamp(EOM.EndTime-0.01f,0f,1f); } if(GUILayout.Button("match next",EditorStyles.miniButton, GUILayout.Width(80f))){ EOM.EM.EndTime = tNode.NextTime; } EditorGUILayout.EndHorizontal(); } EditorGUILayout.EndVertical(); //Vertical offset: EditorGUILayout.LabelField("Vertical options:"); EditorGUILayout.BeginVertical("box"); EditorGUILayout.BeginHorizontal(); EOM.EM.VerticalRaise = EditorGUILayout.Slider("Vertical raise magnitude:",EOM.VerticalRaise,-512f,512f); if(GUILayout.Button(btnDefaultText,GSDImageButton,GUILayout.Width(16f))){ EOM.EM.VerticalRaise = 0f; } EditorGUILayout.EndHorizontal(); if(EOM.VerticalCurve == null || EOM.VerticalCurve.keys.Length < 2){ EnforceCurve(ref EOM.VerticalCurve); } EditorGUILayout.BeginHorizontal(); EOM.EM.VerticalCurve = EditorGUILayout.CurveField("Curve: ",EOM.VerticalCurve); if(GUILayout.Button(btnDefaultText,GSDImageButton,GUILayout.Width(16f))){ ResetCurve(ref EOM.EM.VerticalCurve); } EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); //Horizontal offsets: EditorGUILayout.LabelField("Horizontal offset options:"); EditorGUILayout.BeginVertical("box"); tHorizMatching = HorizMatchingDefaultsEnum.None; tHorizMatching = (HorizMatchingDefaultsEnum)EditorGUILayout.Popup((int)tHorizMatching,HorizMatchSubTypeDescriptions, GUILayout.Width(100f)); if(tHorizMatching != HorizMatchingDefaultsEnum.None){ if(tHorizMatching == HorizMatchingDefaultsEnum.MatchCenter){ EOM.EM.HorizontalSep = 0f; }else if(tHorizMatching == HorizMatchingDefaultsEnum.MatchRoadLeft){ EOM.EM.HorizontalSep = (tNode.GSDSpline.tRoad.RoadWidth()*0.5f)*-1; }else if(tHorizMatching == HorizMatchingDefaultsEnum.MatchShoulderLeft){ if(tNode.GSDSpline.tRoad.opt_bShouldersEnabled){ EOM.EM.HorizontalSep = ((tNode.GSDSpline.tRoad.RoadWidth()*0.5f) + tNode.GSDSpline.tRoad.opt_ShoulderWidth)*-1; }else{ EOM.EM.HorizontalSep = ((tNode.GSDSpline.tRoad.RoadWidth()*0.5f))*-1; } }else if(tHorizMatching == HorizMatchingDefaultsEnum.MatchRoadRight){ EOM.EM.HorizontalSep = (tNode.GSDSpline.tRoad.RoadWidth()*0.5f); }else if(tHorizMatching == HorizMatchingDefaultsEnum.MatchShoulderRight){ if(tNode.GSDSpline.tRoad.opt_bShouldersEnabled){ EOM.EM.HorizontalSep = (tNode.GSDSpline.tRoad.RoadWidth()*0.5f) + tNode.GSDSpline.tRoad.opt_ShoulderWidth; }else{ EOM.EM.HorizontalSep = (tNode.GSDSpline.tRoad.RoadWidth()*0.5f); } } tHorizMatching = HorizMatchingDefaultsEnum.None; } if(!GSDRootUtil.IsApproximately(EOM.EM.HorizontalSep,EOM.HorizontalSep)){ EOM.EM.HorizontalSep = Mathf.Clamp(EOM.EM.HorizontalSep,(-1f*HorizRoadMax),HorizRoadMax); } EditorGUILayout.BeginHorizontal(); EOM.EM.HorizontalSep = EditorGUILayout.Slider("Horiz offset magnitude:",EOM.EM.HorizontalSep,(-1f*HorizRoadMax),HorizRoadMax); if(GUILayout.Button(btnDefaultText,GSDImageButton,GUILayout.Width(16f))){ EOM.EM.HorizontalSep = 0f; } if(!GSDRootUtil.IsApproximately(EOM.EM.HorizontalSep,EOM.HorizontalSep)){ EOM.EM.HorizontalSep = Mathf.Clamp(EOM.EM.HorizontalSep,(-1f*HorizRoadMax),HorizRoadMax); } EditorGUILayout.EndHorizontal(); if(EOM.HorizontalCurve == null || EOM.HorizontalCurve.keys.Length < 2){ EnforceCurve(ref EOM.HorizontalCurve); } EditorGUILayout.BeginHorizontal(); EOM.EM.HorizontalCurve = EditorGUILayout.CurveField("Curve: ",EOM.HorizontalCurve); if(GUILayout.Button(btnDefaultText,GSDImageButton,GUILayout.Width(16f))){ ResetCurve(ref EOM.EM.HorizontalCurve); } EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); EditorGUILayout.LabelField("Rotation options:"); EditorGUILayout.BeginVertical("box"); if(EOM.HorizontalSep < 0f){ EOM.EM.bOncomingRotation = EditorGUILayout.Toggle("Auto rotate oncoming objects: ",EOM.bOncomingRotation); } EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Custom rotation: "); if(GUILayout.Button(btnDefaultText,GSDImageButton,GUILayout.Width(16f))){ EOM.EM.CustomRotation = new Vector3(0f,0f,0f); } EditorGUILayout.EndHorizontal(); EOM.EM.CustomRotation.x = EditorGUILayout.Slider("x-axis: ",EOM.CustomRotation.x,-360f,360f); EOM.EM.CustomRotation.y = EditorGUILayout.Slider("y-axis: ",EOM.CustomRotation.y,-360f,360f); EOM.EM.CustomRotation.z = EditorGUILayout.Slider("z-axis: ",EOM.CustomRotation.z,-360f,360f); EditorGUILayout.EndVertical(); EditorGUILayout.EndVertical(); } }