public void updateArrowMesh() { if (hideIndicator) { this.GetComponent <MeshRenderer>().enabled = false; } else { this.GetComponent <MeshRenderer>().enabled = true; arrowIndicator.generate(); this.GetComponent <MeshFilter>().mesh = arrowIndicator.mesh; } }
public override void OnInspectorGUI() { serializedObject.Update(); EditorGUILayout.PropertyField(arrowTipMode, new GUIContent("Endpoint Mode")); if (arrowTipMode.enumValueIndex != (int)ArrowTip.ArrowTipMode.None) { EditorGUILayout.PropertyField(size, new GUIContent("Size")); if (arrowTipMode.enumValueIndex != (int)ArrowTip.ArrowTipMode.Mesh) { EditorGUILayout.PropertyField(arrowTipPathType, new GUIContent("Path Mode")); if (arrowTipPathType.enumValueIndex == (int)ArrowPath.ArrowPathType.Function) { EditorGUILayout.PropertyField(levelOfDetailAlongPath, new GUIContent("Level Of Detail Along Path")); EditorGUILayout.PropertyField(pathAlongXFunctionLength, new GUIContent("Path Along X Function Length")); EditorGUILayout.PropertyField(pathAlongXFunction, new GUIContent("Path Along X Function")); EditorGUILayout.PropertyField(pathAlongYFunctionLength, new GUIContent("Path Along Y Function Length")); EditorGUILayout.PropertyField(pathAlongYFunction, new GUIContent("Path Along Y Function")); EditorGUILayout.PropertyField(pathAlongZFunctionLength, new GUIContent("Path Along Z Function Length")); EditorGUILayout.PropertyField(pathAlongZFunction, new GUIContent("Path Along Z Function")); } EditorGUILayout.PropertyField(widthFunctionLength, new GUIContent("Width Function Length")); EditorGUILayout.PropertyField(widthFunction, new GUIContent("Width Function")); EditorGUILayout.PropertyField(heightFunctionLength, new GUIContent("Height Function Length")); EditorGUILayout.PropertyField(heightFunction, new GUIContent("Height Function")); EditorGUILayout.PropertyField(rotationFunctionLength, new GUIContent("Rotation Function Length")); EditorGUILayout.PropertyField(rotateFunction, new GUIContent("Rotation Function")); EditorGUILayout.PropertyField(templatePrimitives, new GUIContent("Template Primitives")); EditorGUILayout.PropertyField(shapeFunctionLength, new GUIContent("Shape Function Length")); EditorGUILayout.PropertyField(shapeFunction, new GUIContent("Shape Function")); } else { EditorGUILayout.PropertyField(mesh, new GUIContent("Mesh")); } } serializedObject.ApplyModifiedProperties(); ArrowIndicator arrowIndicator = InitArrowIndicator(); if (GUILayout.Button("Save As Asset")) { arrowIndicator.generate(); assetName = EditorUtility.SaveFilePanelInProject("Save Mesh", assetName, "asset", "Please enter a file name to save the mesh to"); UnityEditor.AssetDatabase.CreateAsset(arrowIndicator.mesh, assetName); } showVertices = EditorGUILayout.Toggle("Show Vertices", showVertices); showWireframe = EditorGUILayout.Toggle("Show Wireframe", showWireframe); showNormals = EditorGUILayout.Toggle("Show Normals", showNormals); }
public virtual void OnSceneGUI(SceneView sceneView) { if ((showNormals || showVertices || showWireframe) && ((target as ArrowPath).arrowPathType != ArrowPath.ArrowPathType.PathArray || (target as ArrowPath).pathArray != null)) { ArrowIndicator arrowIndicator = InitArrowIndicator(); arrowIndicator.generate(); if (showVertices) { ProceduralMeshEditor.ShowVertices(arrowIndicator.position, arrowIndicator.mesh.vertices, arrowIndicator.mesh.colors32); } if (showWireframe) { ProceduralMeshEditor.ShowWireFrame(arrowIndicator.mesh.vertices, arrowIndicator.mesh.triangles); } if (showNormals) { ProceduralMeshEditor.ShowNormals(arrowIndicator.mesh.vertices, arrowIndicator.mesh.normals); } DestroyImmediate(arrowIndicator.mesh, true); DestroyImmediate(arrowIndicator, true); } }
public virtual void OnSceneGUI(SceneView sceneView) { if (showNormals || showVertices || showWireframe) { ArrowIndicator arrowIndicator = InitArrowIndicator(); arrowIndicator.generate(); if (showVertices) { ProceduralMeshEditor.ShowVertices(arrowIndicator.position, arrowIndicator.mesh.vertices, arrowIndicator.mesh.colors32); } if (showWireframe) { ProceduralMeshEditor.ShowWireFrame(arrowIndicator.mesh.vertices, arrowIndicator.mesh.triangles); } if (showNormals) { ProceduralMeshEditor.ShowNormals(arrowIndicator.mesh.vertices, arrowIndicator.mesh.normals); } DestroyImmediate(arrowIndicator.mesh, true); DestroyImmediate(arrowIndicator, true); } }
public override void OnInspectorGUI() { serializedObject.Update(); EditorGUILayout.PropertyField(arrowTail, new GUIContent("Arrow Tail")); EditorGUILayout.PropertyField(arrowHead, new GUIContent("Arrow Head")); EditorGUILayout.PropertyField(arrowPathMode, new GUIContent("Path Mode")); EditorGUILayout.PropertyField(arrowPathType, new GUIContent("Path Type")); if (arrowPathType.enumValueIndex == (int)ArrowPath.ArrowPathType.Function) { EditorGUILayout.PropertyField(startPoint, new GUIContent("Start Point"), true); EditorGUILayout.PropertyField(endPoint, new GUIContent("End Point"), true); EditorGUILayout.PropertyField(pathAlongXFunctionLength, new GUIContent("Path Along X Function Length")); EditorGUILayout.PropertyField(pathAlongXFunction, new GUIContent("Path Along X Function")); EditorGUILayout.PropertyField(pathAlongYFunctionLength, new GUIContent("Path Along Y Function Length")); EditorGUILayout.PropertyField(pathAlongYFunction, new GUIContent("Path Along Y Function")); EditorGUILayout.PropertyField(pathAlongZFunctionLength, new GUIContent("Path Along Z Function Length")); EditorGUILayout.PropertyField(pathAlongZFunction, new GUIContent("Path Along Z Function")); } else { if (arrowPathType.enumValueIndex == (int)ArrowPath.ArrowPathType.PathArray) { EditorGUILayout.PropertyField(pathArray, new GUIContent("Path Array"), true); if ((target as ArrowPath).pathArray == null) { EditorGUILayout.HelpBox("You need to set the path array", MessageType.Error); } } else { EditorGUILayout.PropertyField(editedPath, new GUIContent("Path Points"), true); } } if (arrowPathType.enumValueIndex != (int)ArrowPath.ArrowPathType.PathArray) { EditorGUILayout.PropertyField(levelOfDetailAlongPath, new GUIContent("Level Of Detail Along Path")); } if (arrowPathMode.enumValueIndex != (int)ArrowPath.ArrowPathMode.None) { if (arrowPathMode.enumValueIndex != (int)ArrowPath.ArrowPathMode.MadeOfShapes) { EditorGUILayout.PropertyField(widthFunctionLength, new GUIContent("Width Function Length")); EditorGUILayout.PropertyField(widthFunction, new GUIContent("Width Function")); EditorGUILayout.PropertyField(heightFunctionLength, new GUIContent("Height Function Length")); EditorGUILayout.PropertyField(heightFunction, new GUIContent("Height Function")); EditorGUILayout.PropertyField(rotationFunctionLength, new GUIContent("Rotation Function Length")); EditorGUILayout.PropertyField(rotateFunction, new GUIContent("Rotation Function")); EditorGUILayout.PropertyField(templatePrimitives, new GUIContent("Template primitives shape")); EditorGUILayout.PropertyField(shapeFunctionLength, new GUIContent("Shape Function Length")); EditorGUILayout.PropertyField(shapeFunction, new GUIContent("Shape Function")); } else { EditorGUILayout.PropertyField(rotationFunctionLength, new GUIContent("Rotation Function Length")); EditorGUILayout.PropertyField(rotateFunction, new GUIContent("Rotation Function")); EditorGUILayout.PropertyField(customShapes, new GUIContent("Custom Shapes"), true); EditorGUILayout.PropertyField(atPathPoints, new GUIContent("At Path Points")); if (atPathPoints.boolValue == false) { EditorGUILayout.PropertyField(distanceBetweenShapes, new GUIContent("Distances Custom Shapes"), true); } } if (arrowPathMode.enumValueIndex == (int)ArrowPath.ArrowPathMode.BrokenExtrude) { EditorGUILayout.PropertyField(brokenLineLength, new GUIContent("Broken Line length")); EditorGUILayout.PropertyField(brakeLength, new GUIContent("Brake length")); } } EditorGUILayout.PropertyField(colorFunctions, new GUIContent("Gradient"), true); EditorGUILayout.PropertyField(useShapeColors, new GUIContent("Use Shape Colors")); ArrowIndicator arrowIndicator = InitArrowIndicator(); if (((target as ArrowPath).arrowPathType != ArrowPath.ArrowPathType.PathArray || (target as ArrowPath).pathArray != null)) { if (GUILayout.Button("Save As Asset")) { arrowIndicator.generate(); assetName = EditorUtility.SaveFilePanelInProject("Save Mesh", assetName, "asset", "Please enter a file name to save the mesh to"); UnityEditor.AssetDatabase.CreateAsset(arrowIndicator.mesh, assetName); } showVertices = EditorGUILayout.Toggle("Show Vertices", showVertices); showWireframe = EditorGUILayout.Toggle("Show Wireframe", showWireframe); showNormals = EditorGUILayout.Toggle("Show Normals", showNormals); } serializedObject.ApplyModifiedProperties(); }