// close current scene private static void CloseScene() { if (s_Scene != null) { Debug.Log("VCE close scene. sceneid = " + s_SceneId.ToString()); if (OnSceneClose != null) { OnSceneClose(s_Scene); } } // Selection DeselectAllTools(); DestroyBrushes(); ClearSelections(); // Destroy scene data DestroySceneData(); // Temporary materials VCEAssetMgr.ClearTempMaterials(); // Temporary decals VCEAssetMgr.ClearTempDecals(); // Reset Some vars // Ref plane s_Instance.m_UI.OnSceneClose(); VCERefPlane.Reset(); // History manager VCEHistory.Clear(); VCEHistory.s_Modified = false; // Mirror s_Mirror = null; }
private static void AfterSceneChanged(VCESceneSetting setting) { // Mirror s_Mirror = new VCEMirrorSetting(); s_Mirror.Reset(setting.m_EditorSize.x, setting.m_EditorSize.y, setting.m_EditorSize.z); // Mesh manager VCEditor.Instance.m_MeshMgr.m_VoxelSize = s_Scene.m_Setting.m_VoxelSize; VCEditor.Instance.m_MeshMgr.m_MeshMat = s_Scene.m_TempIsoMat.m_EditorMat; // Set gameobject parameters // Camera float scale = setting.m_EditorSize.ToVector3().magnitude *setting.m_VoxelSize; s_Instance.m_MainCamera.nearClipPlane = setting.m_VoxelSize * 0.5f; s_Instance.m_MainCamera.farClipPlane = scale * 5F; VCECamera vce_camera = s_Instance.m_MainCamera.GetComponent <VCECamera>(); if (s_Scene.m_IsoData.m_Voxels.Count == 0) { vce_camera.BeginTarget = setting.m_EditorSize.ToVector3() * setting.m_VoxelSize * 0.5F; vce_camera.BeginTarget.y = 0; vce_camera.BeginDistance = new Vector2(setting.m_EditorSize.x, setting.m_EditorSize.z).magnitude *setting.m_VoxelSize * 1.2F; vce_camera.MinDistance = setting.m_VoxelSize * 0.5f; vce_camera.MaxDistance = scale * 3F; vce_camera.Reset(); } else { vce_camera.BeginTarget = setting.m_EditorSize.ToVector3() * setting.m_VoxelSize * 0.5F; vce_camera.BeginDistance = setting.m_EditorSize.ToVector3().magnitude *setting.m_VoxelSize * 1.2F; vce_camera.MinDistance = setting.m_VoxelSize * 0.5f; vce_camera.MaxDistance = scale * 3F; vce_camera.Reset(); } // GLs GLGridPlane[] gps = s_Instance.m_GLGroup.GetComponentsInChildren <GLGridPlane>(true); GLBound[] gbs = s_Instance.m_GLGroup.GetComponentsInChildren <GLBound>(true); foreach (GLGridPlane gp in gps) { gp.m_CellCount = new IntVector3(setting.m_EditorSize.x, setting.m_EditorSize.y, setting.m_EditorSize.z); gp.m_CellSize = Vector3.one * setting.m_VoxelSize; gp.m_MajorGridInterval = setting.m_MajorInterval; gp.m_MinorGridInterval = setting.m_MinorInterval; gp.m_Fdisk = setting.m_Category == EVCCategory.cgDbSword; } foreach (GLBound gb in gbs) { gb.m_Bound = new Bounds(Vector3.zero, Vector3.zero); gb.m_Bound.SetMinMax(Vector3.zero, setting.m_EditorSize.ToVector3() * setting.m_VoxelSize); } // UIs s_Instance.m_UI.OnSceneCreate(); // VARS // Recent vars VCESelectMethod_Box.s_RecentDepth = 1; VCESelectMethod_Box.s_RecentFeatherLength = 0; VCESelectMethod_Box.s_RecentPlaneFeather = true; // Selected SelectedColor = Color.white; }