Esempio n. 1
0
        public ArrowIndicator InitArrowIndicator()
        {
            ArrowIndicator arrowIndicator = ScriptableObject.CreateInstance <ArrowIndicator>();

            arrowIndicator.arrowPath = Instantiate(target as ArrowPath) as ArrowPath;
            if ((target as ArrowPath).arrowTail == null)
            {
                arrowIndicator.arrowPath.arrowTail = ScriptableObject.CreateInstance <ArrowTip>();
                arrowIndicator.arrowPath.arrowTail.arrowTipMode = ArrowTip.ArrowTipMode.None;
            }
            if ((target as ArrowPath).arrowTail == (target as ArrowPath).arrowHead && (target as ArrowPath).arrowHead != null)
            {
                arrowIndicator.arrowPath.arrowHead = Object.Instantiate((target as ArrowPath).arrowTail) as ArrowTip;
            }
            else
            {
                if ((target as ArrowPath).arrowHead == null)
                {
                    arrowIndicator.arrowPath.arrowHead = ScriptableObject.CreateInstance <ArrowTip>();
                    arrowIndicator.arrowPath.arrowHead.arrowTipMode = ArrowTip.ArrowTipMode.None;
                }
            }

            arrowIndicator.extrudeObject = ScriptableObject.CreateInstance <ComplexExtrude>();
            return(arrowIndicator);
        }
Esempio n. 2
0
        public ArrowIndicator InitArrowIndicator()
        {
            ArrowIndicator arrowIndicator = ScriptableObject.CreateInstance <ArrowIndicator>();

            arrowIndicator.arrowPath = ScriptableObject.CreateInstance <ArrowPath>();
            arrowIndicator.arrowPath.arrowPathMode          = ArrowPath.ArrowPathMode.None;
            arrowIndicator.arrowPath.arrowHead              = target as ArrowTip;
            arrowIndicator.arrowPath.arrowTail              = ScriptableObject.CreateInstance <ArrowTip>();
            arrowIndicator.arrowPath.arrowTail.arrowTipMode = ArrowTip.ArrowTipMode.None;
            arrowIndicator.extrudeObject = ScriptableObject.CreateInstance <ComplexExtrude>();
            return(arrowIndicator);
        }
Esempio n. 3
0
 void Awake()
 {
     arrowIndicator = ScriptableObject.CreateInstance <ArrowIndicator>();
     if (arrowPath == null)
     {
         arrowIndicator.arrowPath = ScriptableObject.CreateInstance <ArrowPath>();
         arrowPath = arrowIndicator.arrowPath;
         arrowIndicator.arrowPath.arrowPathMode = ArrowPath.ArrowPathMode.None;
     }
     arrowIndicator.arrowPath = arrowPath;
     if (!permanentScriptableObjects)
     {
         arrowIndicator.arrowPath = Instantiate(arrowIndicator.arrowPath);
         arrowPath = arrowIndicator.arrowPath;
     }
     if (arrowHead == null)
     {
         arrowHead = ScriptableObject.CreateInstance <ArrowTip>();
         arrowHead.arrowTipMode = ArrowTip.ArrowTipMode.None;
     }
     if (arrowTail == null)
     {
         arrowTail = ScriptableObject.CreateInstance <ArrowTip>();
         arrowTail.arrowTipMode = ArrowTip.ArrowTipMode.None;
     }
     arrowIndicator.arrowPath.arrowHead = arrowHead;
     arrowIndicator.arrowPath.arrowTail = arrowTail;
     if (permanentScriptableObjects)
     {
         if (arrowIndicator.arrowPath.arrowHead == arrowIndicator.arrowPath.arrowTail)
         {
             arrowIndicator.arrowPath.arrowTail = Instantiate(arrowIndicator.arrowPath.arrowTail);
             arrowTail = arrowIndicator.arrowPath.arrowTail;
         }
     }
     else
     {
         arrowIndicator.arrowPath.arrowHead = Instantiate(arrowIndicator.arrowPath.arrowHead);
         arrowHead = arrowIndicator.arrowPath.arrowHead;
         arrowIndicator.arrowPath.arrowTail = Instantiate(arrowIndicator.arrowPath.arrowTail);
         arrowTail = arrowIndicator.arrowPath.arrowTail;
     }
     if (flatShading)
     {
         arrowIndicator.extrudeObject = ScriptableObject.CreateInstance <FlatShadeExtrude>();
     }
     else
     {
         arrowIndicator.extrudeObject = ScriptableObject.CreateInstance <ComplexExtrude>();
     }
 }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
 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);
     }
 }
Esempio n. 6
0
 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);
     }
 }
Esempio n. 7
0
        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();
        }