static public void UpdateVegetationMaskLine(GameObject go, ERVSData[] vsData, float grassPerimeter, float plantPerimeter, float treePerimeter, float objectPerimeter, float largeObjectPerimeter) { #if VEGETATION_STUDIO || VEGETATION_STUDIO_PRO AwesomeTechnologies.VegetationMaskLine vegetationMaskLine = go.GetComponent <AwesomeTechnologies.VegetationMaskLine>(); if (vegetationMaskLine == null) { vegetationMaskLine = go.AddComponent <AwesomeTechnologies.VegetationMaskLine>(); } vegetationMaskLine.AdditionalGrassPerimiter = grassPerimeter; vegetationMaskLine.AdditionalPlantPerimiter = plantPerimeter; vegetationMaskLine.AdditionalTreePerimiter = treePerimeter; vegetationMaskLine.AdditionalObjectPerimiter = objectPerimeter; vegetationMaskLine.AdditionalLargeObjectPerimiter = largeObjectPerimeter; vegetationMaskLine.ClearNodes(); foreach (ERVSData data in vsData) { vegetationMaskLine.AddNodeToEnd(data.position, data.width, data.active); } // vegetationMaskLine.AddNodeToEnd(nodePositions[0], widths[0], activeStates[0]); vegetationMaskLine.UpdateVegetationMask(); #endif }
public override void OnInspectorGUI() { HelpTopic = "home/vegetation-studio/components/vegetation-masks/vegetation-mask-line"; base.OnInspectorGUI(); GUILayout.BeginVertical("box"); EditorGUI.BeginChangeCheck(); VegetationMaskLine.LineWidth = EditorGUILayout.Slider("Width", VegetationMaskLine.LineWidth, 0.1f, 40f); if (EditorGUI.EndChangeCheck()) { VegetationMaskLine.UpdateVegetationMask(); EditorUtility.SetDirty(target); } EditorGUILayout.HelpBox("Set the width of the line segments in meters to define the mask area", MessageType.Info); GUILayout.EndVertical(); EditorGUI.BeginChangeCheck(); GUILayout.BeginVertical("box"); EditorGUILayout.LabelField("Show line segment settings", LabelStyle); _showLineSegmentSettings = EditorGUILayout.Toggle("Show settings", _showLineSegmentSettings); EditorGUILayout.HelpBox("Enable to edit width and status per line segment", MessageType.Info); GUILayout.EndVertical(); if (_showLineSegmentSettings) { GUILayout.BeginVertical("box"); EditorGUILayout.LabelField("Nodes", LabelStyle); for (int i = 0; i <= VegetationMaskLine.Nodes.Count - 2; i++) { GUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Node #" + (i + 1), LabelStyle, GUILayout.Width(63)); EditorGUIUtility.labelWidth = 50; VegetationMaskLine.Nodes[i].Active = EditorGUILayout.Toggle("Enabled", VegetationMaskLine.Nodes[i].Active, GUILayout.Width(65)); EditorGUIUtility.labelWidth = 85; VegetationMaskLine.Nodes[i].OverrideWidth = EditorGUILayout.Toggle("Custom width", VegetationMaskLine.Nodes[i].OverrideWidth, GUILayout.Width(105)); EditorGUIUtility.labelWidth = 50; VegetationMaskLine.Nodes[i].CustomWidth = EditorGUILayout.Slider("", VegetationMaskLine.Nodes[i].CustomWidth, 0.1f, 40f); GUILayout.EndHorizontal(); } GUILayout.EndVertical(); EditorGUIUtility.labelWidth = 0; } if (EditorGUI.EndChangeCheck()) { VegetationMaskLine.UpdateVegetationMask(); EditorUtility.SetDirty(target); } }