private void DoHeightsSection() { WorldStamp singleInstance = targets.Length == 1 ? target as WorldStamp : null; bool canEnable = !singleInstance || (singleInstance.Data.Heights != null && !singleInstance.Data.Heights.IsEmpty()); DoHeader("Heights", ref _heightsExpanded, _heightsEnabled, canEnable); if (_heightsExpanded) { EditorGUI.indentLevel++; GUI.enabled = canEnable; if (!canEnable) { EditorGUILayout.HelpBox("No Heights in Stamp", MessageType.Info); } EditorGUILayout.PropertyField(_layerHeightBlendMode, new GUIContent("Blend Mode")); EditorGUILayout.PropertyField(_heightOffset); GUI.enabled = true; EditorGUI.indentLevel--; } }
private void DoObjectsSection() { #region KILL ME ASAP foreach (var t in targets) { var stamp = t as WorldStamp; if (stamp && stamp.NeedsRelativeModeCheck && stamp.Data != null && stamp.Data.Objects.Count > 0) { stamp.NeedsRelativeModeCheck = false; //RelativeHeight = RelativeMode == WorldStamp.EObjectRelativeMode.RelativeToStamp, stamp.RelativeMode = stamp.Data.Objects[0].AbsoluteHeight ? WorldStamp.EObjectRelativeMode.RelativeToStamp : WorldStamp.EObjectRelativeMode.RelativeToTerrain; Debug.Log(string.Format("Updated stamp object relative mode of '{0}' to v0.1.2c. This set the Object Relative Mode to {1}. This should be a one time process.", stamp.name, stamp.RelativeMode), stamp); EditorUtility.SetDirty(stamp); } } #endregion WorldStamp singleInstance = targets.Length == 1 ? target as WorldStamp : null; bool canWrite = !singleInstance || singleInstance.Data.Objects.Count > 0; DoHeader("Objects", ref _objectsExpanded, _objectsEnabled, canWrite); if (_objectsExpanded) { EditorGUI.indentLevel++; if (!canWrite) { EditorGUILayout.HelpBox("No Objects in Stamp", MessageType.Info); } EditorGUILayout.PropertyField(_removeObjects, new GUIContent("Remove Existing Objects")); GUI.enabled = canWrite; EditorGUILayout.PropertyField(_stencilObjects); EditorGUILayout.PropertyField(_relativeObjectMode); GUI.enabled = true; EditorGUI.indentLevel--; } }
private void DoVegetationStudioSection() { WorldStamp singleInstance = targets.Length == 1 ? target as WorldStamp : null; bool canWrite = !(singleInstance && singleInstance.Data.VSData.Count == 0); DoHeader("Vegetation Studio", ref _vegetationStudioExpanded, _vegetationStudioEnabled, canWrite); if (_vegetationStudioExpanded) { EditorGUI.indentLevel++; if (!canWrite) { if (singleInstance) { singleInstance.VegetationStudioEnabled = false; } EditorGUILayout.HelpBox("No Vegetation Studio instances in Stamp", MessageType.Info); } EditorGUILayout.PropertyField(_removeExistingVSData); GUI.enabled = canWrite; EditorGUILayout.PropertyField(_stencilVSData); GUI.enabled = true; if (singleInstance) { if (_vsIgnoredPrototypesDrawer == null) { _vsIgnoredPrototypesDrawer = new VegetationStudioPrototypePickerDrawer(); } singleInstance.IgnoredVSPrototypes = (VegetationStudioPrototypePicker)_vsIgnoredPrototypesDrawer.DrawGUI( singleInstance.IgnoredVSPrototypes, "Ignored Protoypes", typeof(VegetationStudioPrototypePicker), null, singleInstance); if (singleInstance.Data.VSData.Any((x) => !x.Package)) { EditorGUILayout.HelpBox("Vegetation Instances are missing their VegetationStudioPackage! Select one now?", MessageType.Info); if (GUILayout.Button("Select Package")) { var path = EditorExtensions.OpenFilePanel("Select Vegetation Package", "asset"); if (!string.IsNullOrEmpty(path)) { var package = AssetDatabase.LoadAssetAtPath <VegetationPackage>(path); if (!package) { Debug.LogError("Failed to load Vegetation Package at " + path); } else { for (var i = 0; i < singleInstance.Data.VSData.Count; ++i) { if (!singleInstance.Data.VSData[i].Package) { singleInstance.Data.VSData[i].Package = package; } } } } } } } EditorGUI.indentLevel--; } }
private void DoTreesSection() { WorldStamp singleInstance = targets.Length == 1 ? target as WorldStamp : null; bool canWrite = !singleInstance || singleInstance.Data.Trees.Count > 0; DoHeader("Trees", ref _treesExpanded, _treesEnabled, canWrite); if (_treesExpanded) { EditorGUI.indentLevel++; if (!canWrite) { EditorGUILayout.HelpBox("No Trees in Stamp", MessageType.Info); } if (targets.Length > 1) { EditorGUILayout.HelpBox("Can't Edit Multiple Tree Ignores", MessageType.Info); } else { var stamp = target as WorldStamp; if (stamp.Data.Trees.Count > 0 && (stamp.Data.TreePrototypeCache == null || stamp.Data.TreePrototypeCache.Count == 0)) { stamp.Data.TreePrototypeCache = new List <GameObject>(); foreach (var tree in stamp.Data.Trees) { if (!stamp.Data.TreePrototypeCache.Contains(tree.Prototype)) { stamp.Data.TreePrototypeCache.Add(tree.Prototype); } } } for (var i = 0; i < stamp.Data.TreePrototypeCache.Count; ++i) { var prototype = stamp.Data.TreePrototypeCache[i]; if (prototype == null) { continue; } var ignored = stamp.IgnoredTrees.Contains(prototype); GUILayout.BeginHorizontal(); GUI.color = ignored ? Color.red : Color.green; var newPicked = (GameObject)EditorGUILayout.ObjectField(prototype, typeof(GameObject), false); if (newPicked != null && newPicked != prototype) { prototype = newPicked; EditorUtility.SetDirty(stamp); var prefab = PrefabUtility.GetPrefabObject(stamp); if (prefab) { EditorUtility.SetDirty(prefab); } } if (EditorGUILayoutX.IndentedButton(ignored ? "Unmute" : "Mute")) { if (stamp.IgnoredTrees.Contains(prototype)) { stamp.IgnoredTrees.Remove(prototype); } else { stamp.IgnoredTrees.Add(prototype); } } GUILayout.EndHorizontal(); } GUI.color = Color.white; } EditorGUILayout.PropertyField(_removeTrees, new GUIContent("Remove Existing Trees")); GUI.enabled = canWrite; EditorGUILayout.PropertyField(_stencilTrees); GUI.enabled = true; EditorGUI.indentLevel--; } }
private void DoSplatsSection() { WorldStamp singleInstance = targets.Length == 1 ? target as WorldStamp : null; bool canWrite = !singleInstance || (singleInstance.Data.SplatData != null && singleInstance.Data.SplatData.Count > 0); DoHeader("Splats", ref _splatsExpanded, _splatsEnabled, canWrite); if (_splatsExpanded) { EditorGUI.indentLevel++; if (!canWrite) { EditorGUILayout.HelpBox("No Splats in Stamp", MessageType.Info); } GUI.enabled = canWrite; EditorGUILayout.PropertyField(_stencilSplats); EditorGUILayout.PropertyField(_splatBlendMode); if (targets.Length > 1) { EditorGUILayout.HelpBox("Can't Edit Multiple Splat Ignores", MessageType.Info); } else { var stamp = target as WorldStamp; foreach (var keyValuePair in stamp.Data.SplatData) { var splatWrapper = keyValuePair.Wrapper; var ignored = stamp.IgnoredSplats.Contains(splatWrapper); GUILayout.BeginHorizontal(); GUI.color = ignored ? Color.red : Color.green; var newPicked = (SplatPrototypeWrapper)EditorGUILayout.ObjectField(splatWrapper, typeof(SplatPrototypeWrapper), false); if (newPicked != null && newPicked != splatWrapper) { keyValuePair.Wrapper = newPicked; EditorUtility.SetDirty(stamp); var prefab = PrefabUtility.GetPrefabObject(stamp); if (prefab) { EditorUtility.SetDirty(prefab); } } if (EditorGUILayoutX.IndentedButton(ignored ? "Unmute" : "Mute")) { if (stamp.IgnoredSplats.Contains(splatWrapper)) { stamp.IgnoredSplats.Remove(splatWrapper); } else { stamp.IgnoredSplats.Add(splatWrapper); } } GUILayout.EndHorizontal(); } GUI.color = Color.white; } GUI.enabled = true; EditorGUI.indentLevel--; } }