private void Construction_Cleanup(){ FixZ(); if(TerrainCalcsJob != null){ TerrainCalcsJob.Abort(); TerrainCalcsJob = null; } if(RoadCalcsJob1 != null){ RoadCalcsJob1.Abort(); RoadCalcsJob1 = null; } if(RoadCalcsJob2 != null){ RoadCalcsJob2.Abort(); RoadCalcsJob2 = null; } Editor_bIsConstructing = false; int mCount = GSDSpline.GetNodeCount(); GSDSplineN tNode; for(int i=0;i<mCount;i++){ tNode = GSDSpline.mNodes[i]; if(tNode.bIsIntersection){ if(tNode.iConstruction != null){ tNode.iConstruction.Nullify(); tNode.iConstruction = null; } } tNode.SetupSplinationLimits(); tNode.SetupEdgeObjects(false); tNode.SetupSplinatedMeshes(false); } if(GSDSpline.HeightHistory != null){ GSDSpline.HeightHistory.Clear(); GSDSpline.HeightHistory = null; } if(RCS != null){ RCS.Nullify(); RCS = null; } if(GSDRS.opt_bSaveMeshes){ UnityEditor.AssetDatabase.SaveAssets(); } bEditorProgressBar = false; EditorUtility.ClearProgressBar(); //Make sure terrain history out of memory if necessary (redudant but keep): if(opt_SaveTerrainHistoryOnDisk && TerrainHistory != null){ TerrainHistory.Clear(); TerrainHistory = null; } //Collect: bTriggerGC = true; if (tRoadMaterialDropdownOLD != opt_tRoadMaterialDropdown) { tRoadMaterialDropdownOLD = opt_tRoadMaterialDropdown; SetAllCutsToCurrentMaterials(); } if(PiggyBacks != null && PiggyBacks.Length > 0){ for(int i=0;i<PiggyBacks.Length;i++){ if(PiggyBacks[i] == null){ PiggyBacks = null; break; } } if(PiggyBacks != null){ GSDSplineC tPiggy = PiggyBacks[0]; GSDSplineC[] NewPiggys = null; PiggyBacks[0] = null; if(PiggyBacks.Length > 1){ NewPiggys = new GSDSplineC[PiggyBacks.Length-1]; for(int i=1;i<PiggyBacks.Length;i++){ NewPiggys[i-1] = PiggyBacks[i]; } } if(NewPiggys != null){ tPiggy.tRoad.PiggyBacks = NewPiggys; } NewPiggys = null; tPiggy.Setup_Trigger(); } } }
void OnEnable(){ if(!Application.isEditor){ return; } // if(Application.isEditor && !UnityEditor.EditorApplication.isPlaying){ Editor_bIsConstructing = false; UnityEditor.EditorApplication.update += delegate { EditorUpdate(); }; UnityEditor.EditorApplication.hierarchyWindowChanged += delegate { hWindowChanged(); }; // } if(GSDSpline == null || GSDSpline.mNodes == null){ MostRecentNodeCount = 0; }else{ MostRecentNodeCount = GSDSpline.GetNodeCount(); } tRoadMaterialDropdownOLD = opt_tRoadMaterialDropdown; CheckMats(); }