Пример #1
0
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();

        layoutPath = target as LayoutPath;
        if (GUILayout.Button("Import XML"))
        {
            var path = EditorUtility.OpenFilePanel("Select the XML that contains the spline path points",
                                                   "",
                                                   "xml");
            if (path.Length != 0)
            {
                layoutPath.BuildObject(path);
            }
        }
        if (selectedIndex >= 0)
        {
            if (GUILayout.Button("Remove selected point"))
            {
                layoutPath.RemoveAt(selectedIndex);
            }
        }
        if (GUILayout.Button("Clear"))
        {
            layoutPath.Clear();
        }
        insertMerker = GUILayout.Toggle(insertMerker, "Add marker");
    }
Пример #2
0
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();

        layoutPath = target as LayoutPath;
        if(GUILayout.Button("Import XML"))
        {
            var path = EditorUtility.OpenFilePanel("Select the XML that contains the spline path points",
                "",
                "xml");
            if (path.Length != 0)
            {
                layoutPath.BuildObject(path);
            }
        }
        if (selectedIndex >= 0)
        {
            if (GUILayout.Button("Remove selected point"))
            {
                layoutPath.RemoveAt(selectedIndex);
            }
        }
        if (GUILayout.Button("Clear"))
        {
            layoutPath.Clear();
        }
        insertMerker = GUILayout.Toggle (insertMerker, "Add marker");
    }
Пример #3
0
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();

        layoutPath = target as LayoutPath;

        GUILayout.Space(10);
        GUILayout.Label("Import from Max spline generated", EditorStyles.boldLabel);
        GUI.backgroundColor = new Color32(157, 220, 207, 255);
        if (GUILayout.Button("Import XML"))
        {
            var path = EditorUtility.OpenFilePanel("Select the XML that contains the spline path points", "", "xml");
            if (path.Length != 0)
            {
                layoutPath.BuildObject(path);
            }
        }

        GUILayout.Space(10);
        GUI.backgroundColor = new Color(0.0f, 0.8f, 0.5176f);
        GUILayout.Label("Import from Sentieri waypoints", EditorStyles.boldLabel);
        if (GUILayout.Button("Create path"))
        {
            layoutPath.GenerateFromWaypoints();
        }
        if (GUILayout.Button("Export path"))
        {
            layoutPath.ExportFromWaypoints();
        }

        GUILayout.Space(10);
        GUILayout.Label("Import from Moose Procedural Rally stages", EditorStyles.boldLabel);
        GUI.backgroundColor = new Color32(248, 200, 81, 255);
        if (GUILayout.Button("Import spline.rsd"))
        {
            var path = EditorUtility.OpenFilePanel("Select the spline.rsd file", "", "rsd");
            if (path.Length != 0)
            {
                if (layoutPath.ImportMooseBin(path))
                {
                    EditorUtility.DisplayDialog("Moose Import", "Path imported!", "Ok!!");
                }
                else
                {
                    EditorUtility.DisplayDialog("Moose Import", "ERROR!, no points added\r\nCheck the file!", "Ok!!");
                }
            }
        }

#if VEGETATION_STUDIO || VEGETATION_STUDIO_PRO
        GUILayout.Space(10);
        GUI.backgroundColor = Color.white;
        GUILayout.Label("Vegetation Studio road mask creation", EditorStyles.boldLabel);

        layoutPath.VS_RemoveGrass        = EditorGUILayout.Toggle("Remove Grass", layoutPath.VS_RemoveGrass);
        layoutPath.VS_RemovePlants       = EditorGUILayout.Toggle("Remove Plants", layoutPath.VS_RemovePlants);
        layoutPath.VS_RemoveTrees        = EditorGUILayout.Toggle("Remove Trees", layoutPath.VS_RemoveTrees);
        layoutPath.VS_RemoveObjects      = EditorGUILayout.Toggle("Remove Objects", layoutPath.VS_RemoveObjects);
        layoutPath.VS_RemoveLargeObjects = EditorGUILayout.Toggle("Remove Large Objects", layoutPath.VS_RemoveLargeObjects);

        AwesomeTechnologies.Common.EditorFunctions.FloatRangeField("Additional Grass Perimeter", ref layoutPath.VS_AdditionalGrassPerimiter, ref layoutPath.VS_AdditionalGrassPerimiterMax, 0, 40);
        AwesomeTechnologies.Common.EditorFunctions.FloatRangeField("Additional Plant Perimeter", ref layoutPath.VS_AdditionalPlantPerimiter, ref layoutPath.VS_AdditionalPlantPerimiterMax, 0, 40);
        AwesomeTechnologies.Common.EditorFunctions.FloatRangeField("Additional Tree Perimeter", ref layoutPath.VS_AdditionalTreePerimiter, ref layoutPath.VS_AdditionalTreePerimiterMax, 0, 40);
        AwesomeTechnologies.Common.EditorFunctions.FloatRangeField("Additional Object Perimeter", ref layoutPath.VS_AdditionalObjectPerimiter, ref layoutPath.VS_AdditionalObjectPerimiterMax, 0, 40);
        AwesomeTechnologies.Common.EditorFunctions.FloatRangeField("Additional Large Perimeter", ref layoutPath.VS_AdditionalLargeObjectPerimiter, ref layoutPath.VS_AdditionalLargeObjectPerimiterMax, 0, 40);
        layoutPath.VS_LineWidth = EditorGUILayout.FloatField("Line Width", layoutPath.VS_LineWidth);

        GUILayout.Space(5);
        layoutPath.VS_SkipPoints = EditorGUILayout.IntField("Skip points", layoutPath.VS_SkipPoints);
        GUILayout.Space(5);

        GUI.backgroundColor = new Color32(99, 194, 214, 255);
        if (GUILayout.Button("Create"))
        {
            if (layoutPath.GenerateVsRoadMask())
            {
                EditorUtility.DisplayDialog("Vegetation Studio", "Road mask created!", "Ok!!");
            }
            else
            {
                EditorUtility.DisplayDialog("Vegetation Studio", "ERROR!, no road mask created!", "Ok!!");
            }
        }
#endif

        GUILayout.Space(10);
        GUILayout.Label("Utility", EditorStyles.boldLabel);
        GUI.backgroundColor = new Color32(115, 242, 252, 255);
        if (GUILayout.Button("Update Length"))
        {
            layoutPath.calcLength();
        }

        /* ??
         * GUI.backgroundColor = Color.white;
         * //GUILayout.Label("Import from Max spline generated", EditorStyles.boldLabel);
         * if (GUILayout.Button("Export XML"))
         * {
         *  var path = EditorUtility.SaveFilePanel("Select the folder to store the XML",
         *      "", "path.xml", "xml");
         *  if (path.Length != 0)
         *  {
         *      layoutPath.ExportXml(path);
         *  }
         * }*/
        if (selectedIndex >= 0)
        {
            GUI.backgroundColor = Color.red;
            if (GUILayout.Button("Remove selected point"))
            {
                layoutPath.RemoveAt(selectedIndex);
            }
        }

        GUI.backgroundColor = new Color32(220, 157, 170, 255);
        if (GUILayout.Button("Invert points"))
        {
            layoutPath.Invert();
        }

        GUI.backgroundColor = new Color(1.0f, 0.647f, 0.0f);
        if (GUILayout.Button("Clear"))
        {
            layoutPath.Clear();
        }

        GUI.backgroundColor = Color.white;
    }