public DisableData Clone() { DisableData clone = new DisableData(); clone.disableList = new List <IntVector3>(disableList); clone.faceList = new List <VoxelBase.Face>(faceList); clone.OnAfterDeserialize(); return(clone); }
public bool IsEqual(DisableData src) { if (disableList != null && src.disableList != null) { if (disableList.Count != src.disableList.Count) { return(false); } for (int i = 0; i < disableList.Count; i++) { if (disableList[i] != src.disableList[i]) { return(false); } } } else if (disableList != null && src.disableList == null) { return(false); } else if (disableList == null && src.disableList != null) { return(false); } if (faceList != null && src.faceList != null) { if (faceList.Count != src.faceList.Count) { return(false); } for (int i = 0; i < faceList.Count; i++) { if (faceList[i] != src.faceList[i]) { return(false); } } } else if (faceList != null && src.faceList == null) { return(false); } else if (faceList == null && src.faceList != null) { return(false); } return(true); }
public virtual void Save() { voxelFilePath = controller.voxelFilePath; voxelFileGUID = controller.voxelFileGUID; voxelFileObject = controller.voxelFileObject; voxelFileSubIndex = controller.voxelFileSubIndex; legacyVoxImport = controller.legacyVoxImport; legacySubAssetNaming = controller.legacyAssetNaming; importMode = controller.importMode; importFlags = controller.importFlags; importScale = controller.importScale; importOffset = controller.importOffset; enableFaceFlags = controller.enableFaceFlags; combineFaces = controller.combineFaces; ignoreCavity = controller.ignoreCavity; shareSameFace = controller.shareSameFace; removeUnusedPalettes = controller.removeUnusedPalettes; generateLightmapUVs = controller.generateLightmapUVs; generateLightmapUVsAngleError = controller.generateLightmapUVsAngleError; generateLightmapUVsAreaError = controller.generateLightmapUVsAreaError; generateLightmapUVsHardAngle = controller.generateLightmapUVsHardAngle; generateLightmapUVsPackMargin = controller.generateLightmapUVsPackMargin; generateTangents = controller.generateTangents; meshFaceVertexOffset = controller.meshFaceVertexOffset; generateMipMaps = controller.generateMipMaps; if (controller.disableData != null) { disableData = controller.disableData.Clone(); } else { disableData = null; } if (controller.materialData != null) { materialData = new MaterialData[controller.materialData.Count]; for (int i = 0; i < controller.materialData.Count; i++) { if (controller.materialData[i] != null) { materialData[i] = controller.materialData[i].Clone(); } } } else { materialData = null; } materialIndexes = controller.materialIndexes != null?controller.materialIndexes.ToArray() : null; }
public virtual void Save() { voxelFilePath = controller.voxelFilePath; voxelFileGUID = controller.voxelFileGUID; voxelFileObject = controller.voxelFileObject; voxelFileSubIndex = controller.voxelFileSubIndex; legacyVoxImport = controller.legacyVoxImport; importMode = controller.importMode; importFlags = controller.importFlags; importScale = controller.importScale; importOffset = controller.importOffset; enableFaceFlags = controller.enableFaceFlags; generateLightmapUVs = controller.generateLightmapUVs; generateLightmapUVsAngleError = controller.generateLightmapUVsAngleError; generateLightmapUVsAreaError = controller.generateLightmapUVsAreaError; generateLightmapUVsHardAngle = controller.generateLightmapUVsHardAngle; generateLightmapUVsPackMargin = controller.generateLightmapUVsPackMargin; generateTangents = controller.generateTangents; meshFaceVertexOffset = controller.meshFaceVertexOffset; generateMipMaps = controller.generateMipMaps; if (controller.disableData != null) disableData = controller.disableData.Clone(); else disableData = null; if (controller.materialData != null) { materialData = new MaterialData[controller.materialData.Count]; for (int i = 0; i < controller.materialData.Count; i++) { if (controller.materialData[i] != null) materialData[i] = controller.materialData[i].Clone(); } } else { materialData = null; } materialIndexes = controller.materialIndexes != null ? controller.materialIndexes.ToArray() : null; }
public virtual bool EditorInitialize() { //ver1.0.4 if (fileRefreshLastTimeTicks == 0) { fileRefreshLastTimeTicks = DateTime.Now.Ticks; } //ver1.0.5 if (!string.IsNullOrEmpty(voxelFileGUID) && voxelFileObject == null) { { var assetPath = UnityEditor.AssetDatabase.GUIDToAssetPath(voxelFileGUID); if (!string.IsNullOrEmpty(assetPath)) { voxelFileObject = UnityEditor.AssetDatabase.LoadAssetAtPath <UnityEngine.Object>(assetPath); } } } voxelFileGUID = null; //ver1.1.2 if (voxelFileObject == null && !string.IsNullOrEmpty(voxelFilePath) && voxelFilePath.Contains("Assets/")) { var assetPath = voxelFilePath.Substring(voxelFilePath.IndexOf("Assets/")); var fullPath = Application.dataPath + "/" + assetPath.Remove(0, "Assets/".Length); if (File.Exists(fullPath)) { voxelFileObject = UnityEditor.AssetDatabase.LoadAssetAtPath <UnityEngine.Object>(assetPath); } } //ver1.1.3 if (dataVersion < 113 && !string.IsNullOrEmpty(voxelFilePath)) { switch (fileType) { case FileType.vox: legacyVoxImport = true; break; } } //ver1.1.4 if (dataVersion < 114 && enableFaceFlags != FaceAllFlags && voxelData != null) { disableData = new DisableData(); var face = ~enableFaceFlags; foreach (var voxel in voxelData.voxels) { var visible = voxel.visible & face; if (visible == 0) { continue; } disableData.SetDisable(voxel.position, visible); } } #region DefaultScale if (voxelFileObject == null && string.IsNullOrEmpty(voxelFilePath)) { var x = UnityEditor.EditorPrefs.GetFloat("VoxelImporter_DefaultScaleX", 1f); var y = UnityEditor.EditorPrefs.GetFloat("VoxelImporter_DefaultScaleY", 1f); var z = UnityEditor.EditorPrefs.GetFloat("VoxelImporter_DefaultScaleZ", 1f); importScale = new Vector3(x, y, z); } #endregion return(false); }