Exemplo n.º 1
0
        public override void DrawZone(string sectionName, float areaMaxHeight, RealIvyWindow realIvyProWindow, IvyParametersGUI ivyParametersGUI,
                                      GUISkin windowSkin, RealIvyProWindowController controller,
                                      ref float YSpace, ref float presetDropDownYSpace, ref float areaYSpace, Rect generalArea,
                                      Color bgColor, AnimationCurve animationCurve)
        {
            base.DrawZone(sectionName, areaMaxHeight, realIvyProWindow, ivyParametersGUI,
                          windowSkin, controller, ref YSpace, ref presetDropDownYSpace,
                          ref areaYSpace, generalArea, bgColor, animationCurve);

            this.animationCurve = animationCurve;

            GUILayout.BeginArea(areaRect);

            EditorGUI.DrawRect(new Rect(0f, areaYSpace, generalArea.width, 50f), bgColor);
            GUI.Label(new Rect(15f, areaYSpace + 15f, 100f, 25f), "Orientation", windowSkin.label);
            realIvyProWindow.OrientationToggle(100f, areaYSpace);
            UIUtils.CustomIntFloatField(ivyParametersGUI.leaveEvery, 0.01f, "Leaves Interval", 50f, areaYSpace, 250f, windowSkin, realIvyProWindow.OnUpdatingParameter);
            UIUtils.CustomIntFloatField(ivyParametersGUI.randomLeaveEvery, 0.01f, "Random", 50f, areaYSpace, 330f, windowSkin, realIvyProWindow.OnUpdatingParameter);
            areaYSpace += 45f;

            if (controller.infoPool.ivyParameters.globalOrientation)
            {
                GUI.Label(new Rect(15f, areaYSpace + 15f, 100f, 25f), "Global Rotation", windowSkin.label);
                UIUtils.CustomIntFloatField(ivyParametersGUI.globalRotationX, 0.01f, "X", 50f, areaYSpace + 40f, 15f, windowSkin, realIvyProWindow.OnUpdatingParameter);
                UIUtils.CustomIntFloatField(ivyParametersGUI.globalRotationY, 0.01f, "Y", 50f, areaYSpace + 40f, 70f, windowSkin, realIvyProWindow.OnUpdatingParameter);
                UIUtils.CustomIntFloatField(ivyParametersGUI.globalRotationZ, 0.01f, "Z", 50f, areaYSpace + 40f, 125f, windowSkin, realIvyProWindow.OnUpdatingParameter);
            }
            else
            {
                GUI.Label(new Rect(15f, areaYSpace + 15f, 100f, 25f), "Local Rotation", windowSkin.label);
                UIUtils.CustomIntFloatField(ivyParametersGUI.rotationX, 0.01f, "X", 50f, areaYSpace + 40f, 15f, windowSkin, realIvyProWindow.OnUpdatingParameter);
                UIUtils.CustomIntFloatField(ivyParametersGUI.rotationY, 0.01f, "Y", 50f, areaYSpace + 40f, 70f, windowSkin, realIvyProWindow.OnUpdatingParameter);
                UIUtils.CustomIntFloatField(ivyParametersGUI.rotationZ, 0.01f, "Z", 50f, areaYSpace + 40f, 125f, windowSkin, realIvyProWindow.OnUpdatingParameter);
            }

            //EditorGUI.DrawRect(new Rect(0f, leavesAreaYSpace - 5f, generalAreaWidth, 80f), bckgColor2);
            GUI.Label(new Rect(15f + 200f, areaYSpace + 15f, 100f, 25f), "Randomness", windowSkin.label);
            UIUtils.CustomIntFloatField(ivyParametersGUI.randomRotationX, 0.01f, "X", 50f, areaYSpace + 40f, 215f, windowSkin, realIvyProWindow.OnUpdatingParameter);
            UIUtils.CustomIntFloatField(ivyParametersGUI.randomRotationY, 0.01f, "Y", 50f, areaYSpace + 40f, 270f, windowSkin, realIvyProWindow.OnUpdatingParameter);
            UIUtils.CustomIntFloatField(ivyParametersGUI.randomRotationZ, 0.01f, "Z", 50f, areaYSpace + 40f, 325f, windowSkin, realIvyProWindow.OnUpdatingParameter);
            areaYSpace += 80f;

            EditorGUI.DrawRect(new Rect(0f, areaYSpace + 15f, generalArea.width, 80f), bgColor);
            GUI.Label(new Rect(15f, areaYSpace + 15f, 100f, 25f), "Position", windowSkin.label);
            UIUtils.CustomIntFloatField(ivyParametersGUI.offsetX, 0.001f, "X", 50f, areaYSpace + 40f, 15f, windowSkin, realIvyProWindow.OnUpdatingParameter);
            UIUtils.CustomIntFloatField(ivyParametersGUI.offsetY, 0.001f, "Y", 50f, areaYSpace + 40f, 70f, windowSkin, realIvyProWindow.OnUpdatingParameter);
            UIUtils.CustomIntFloatField(ivyParametersGUI.offsetZ, 0.001f, "Z", 50f, areaYSpace + 40f, 125f, windowSkin, realIvyProWindow.OnUpdatingParameter);

            GUI.Label(new Rect(215f, areaYSpace + 15f, 100f, 25f), "Scale", windowSkin.label);
            UIUtils.CustomIntFloatField(ivyParametersGUI.minScale, 0.01f, "Min", 50f, areaYSpace + 40f, 215f, windowSkin, realIvyProWindow.OnUpdatingParameter);
            UIUtils.CustomIntFloatField(ivyParametersGUI.maxScale, 0.01f, "Max", 50f, areaYSpace + 40f, 270f, windowSkin, realIvyProWindow.OnUpdatingParameter);


            areaYSpace += 100f;

            GUILayout.EndArea();

            YSpace += areaRect.height;
            realIvyProWindow.Repaint();
        }
        public void Init(RealIvyWindow realIvyProWindow, IvyParametersGUI ivyParametersGUI)
        {
            Selection.selectionChanged += OnSelectionChanged;

            this.ivyParametersGUI = ivyParametersGUI;
            this.realIvyProWindow = realIvyProWindow;
        }
Exemplo n.º 3
0
        public void Init(RealIvyWindow realIvyProWindow, InfoPool infoPool)
        {
            //instance = (RealIvyProTools)EditorWindow.GetWindow(typeof(RealIvyProTools));

            //this.realIvyProWindow = realIvyProWindow;
            this.infoPool = infoPool;

            modePaint = new ModePaint();
            modePaint.realIvyProWindow = realIvyProWindow;
            modeMove      = new ModeMove();
            modeSmooth    = new ModeSmooth();
            modeRefine    = new ModeRefine();
            modeOptimize  = new ModeOptimize();
            modeCut       = new ModeCut();
            modeDelete    = new ModeDelete();
            modeShave     = new ModeShave();
            modeAddLeaves = new ModeAddLeaves();

            windowSkin       = RealIvyWindow.windowSkin;
            modePaintTex     = (Texture2D)AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath("7433ea681d2ea9a43a91283aec7779dc"), typeof(Texture2D));
            modeMoveTex      = (Texture2D)AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath("baa7fb0fea158214195003054cbdc848"), typeof(Texture2D));
            modeSmoothTex    = (Texture2D)AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath("da81d4c81a2ef904cb9ec2f020f9f0e4"), typeof(Texture2D));
            modeRefineTex    = (Texture2D)AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath("58c807f93561e014ba108036e7ac3788"), typeof(Texture2D));
            modeOptimizeTex  = (Texture2D)AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath("d901243b259e1fb40883227b5a342b16"), typeof(Texture2D));
            modeCutTex       = (Texture2D)AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath("be698aee7a1cd6e4bbac6ef223909851"), typeof(Texture2D));
            modeDeleteTex    = (Texture2D)AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath("4cd137b68f1323f4484094d30b90f926"), typeof(Texture2D));
            modeShaveTex     = (Texture2D)AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath("46994a3c472a4d142964853d08614149"), typeof(Texture2D));
            modeAddLeavesTex = (Texture2D)AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath("4845df643447cae4499501434c4147b4"), typeof(Texture2D));
            downArrowTex     = (Texture2D)AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath("8ee6aee77df7d3e4485148aa889f9b6b"), typeof(Texture2D));
            upArrowTex       = (Texture2D)AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath("47e4d534b75170047b81b09581c4f3d9"), typeof(Texture2D));

            FillGUIContent();

            RealIvyProWindowController.OnIvyGoCreated += OnIvyGoCreated;
        }
Exemplo n.º 4
0
        public virtual void DrawZone(string sectionName, float areaMaxHeight, RealIvyWindow realIvyProWindow, IvyParametersGUI ivyParametersGUI,
                                     GUISkin windowSkin, RealIvyProWindowController controller,
                                     ref float YSpace, ref float presetDropDownYSpace, ref float areaYSpace, Rect generalArea,
                                     Color bgColor, AnimationCurve animationCurve)
        {
            this.realIvyProWindow = realIvyProWindow;

            dropDownButton.Draw(sectionName, windowSkin, RealIvyWindow.downArrowTex,
                                generalArea, ref areaHeight, ref YSpace, areaMaxHeight, animationCurve, this);

            areaRect = new Rect(10f, YSpace, generalArea.width, areaHeight);
        }
Exemplo n.º 5
0
        public static void Init(bool createNewIvy)
        {
            instance = (RealIvyWindow)EditorWindow.GetWindow(typeof(RealIvyWindow));

            instance.minSize      = new Vector2(450f, 455f);
            instance.titleContent = new GUIContent("Real Ivy");

            Initialize(createNewIvy);

            EditorSceneManager.sceneOpened += OnSceneOpened;

            EditorPrefs.SetBool(KEY_WINDOW_OPENED, true);
        }
        public override void DrawZone(string sectionName, float areaMaxHeight, RealIvyWindow realIvyProWindow, IvyParametersGUI ivyParametersGUI,
                                      GUISkin windowSkin, RealIvyProWindowController controller,
                                      ref float YSpace, ref float presetDropDownYSpace, ref float areaYSpace, Rect generalArea,
                                      Color bgColor, AnimationCurve animationCurve)
        {
            base.DrawZone(sectionName, areaMaxHeight, realIvyProWindow, ivyParametersGUI, windowSkin,
                          controller, ref YSpace, ref presetDropDownYSpace,
                          ref areaYSpace, generalArea, bgColor, animationCurve);


            GUILayout.BeginArea(areaRect);

            this.animationCurve = animationCurve;

            EditorGUI.DrawRect(new Rect(0f, areaYSpace, generalArea.width, 55f), bgColor);
            GUI.Label(new Rect(15f, areaYSpace + 15f, 100f, 25f), "Radius", windowSkin.label);
            UIUtils.CustomIntFloatField(ivyParametersGUI.minRadius, 0.001f, "Min", 50f, areaYSpace, 100f, windowSkin, realIvyProWindow.OnUpdatingParameter);
            UIUtils.CustomIntFloatField(ivyParametersGUI.maxRadius, 0.001f, "Max", 50f, areaYSpace, 155f, windowSkin, realIvyProWindow.OnUpdatingParameter);
            UIUtils.CustomIntFloatField(ivyParametersGUI.radiusVarFreq, 0.01f, "Freq.", 50f, areaYSpace, 215f, windowSkin, realIvyProWindow.OnUpdatingParameter);
            UIUtils.CustomIntFloatField(ivyParametersGUI.radiusVarOffset, 0.01f, "Offset", 50f, areaYSpace, 275f, windowSkin, realIvyProWindow.OnUpdatingParameter);
            UIUtils.CustomIntFloatField(ivyParametersGUI.tipInfluence, 0.01f, "Tip", 50f, areaYSpace, 335f, windowSkin, realIvyProWindow.OnUpdatingParameter);
            areaYSpace += 60f;

            GUI.Label(new Rect(15f, areaYSpace + 15f, 100f, 25f), "UVs", windowSkin.label);
            UIUtils.CustomIntFloatField(ivyParametersGUI.uvScaleX, 0.01f, "X Scale", 50f, areaYSpace, 100f, windowSkin, realIvyProWindow.OnUpdatingParameter);
            UIUtils.CustomIntFloatField(ivyParametersGUI.uvScaleY, 0.01f, "Y Scale", 50f, areaYSpace, 155f, windowSkin, realIvyProWindow.OnUpdatingParameter);
            UIUtils.CustomIntFloatField(ivyParametersGUI.uvOffsetX, 0.01f, "X Offset", 50f, areaYSpace, 215f, windowSkin, realIvyProWindow.OnUpdatingParameter);
            UIUtils.CustomIntFloatField(ivyParametersGUI.uvOffsetY, 0.01f, "Y Offset", 50f, areaYSpace, 270f, windowSkin, realIvyProWindow.OnUpdatingParameter);
            areaYSpace += 60f;

            EditorGUI.DrawRect(new Rect(0f, areaYSpace - 5f, generalArea.width, 60f), bgColor);
            GUI.Label(new Rect(15f, areaYSpace + 15f, 100f, 25f), "Others", windowSkin.label);

            UIUtils.CustomIntFloatField(ivyParametersGUI.sides, 0.01f, "Sides", 50f, areaYSpace, 100f, windowSkin, realIvyProWindow.OnUpdatingParameter);

            ivyParametersGUI.halfgeom = GUI.Toggle(new Rect(230f, areaYSpace + 16f, 133f, 20f), ivyParametersGUI.halfgeom, "Half Section", windowSkin.toggle);

            areaYSpace += 60f;

            GUILayout.EndArea();

            YSpace += areaRect.height;
            realIvyProWindow.Repaint();
        }
Exemplo n.º 7
0
        public override void DrawZone(string sectionName, float areaMaxHeight, RealIvyWindow realIvyProWindow, IvyParametersGUI ivyParametersGUI,
                                      GUISkin windowSkin, RealIvyProWindowController controller,
                                      ref float YSpace, ref float presetDropDownYSpace, ref float areaYSpace, Rect generalArea,
                                      Color bgColor, AnimationCurve animationCurve)
        {
            base.DrawZone(sectionName, areaMaxHeight, realIvyProWindow, ivyParametersGUI,
                          windowSkin, controller, ref YSpace, ref presetDropDownYSpace,
                          ref areaYSpace, generalArea, bgColor, animationCurve);

            GUILayout.BeginArea(areaRect);

            EditorGUI.DrawRect(new Rect(0f, areaYSpace, generalArea.width, 58f), bgColor);
            UIUtils.CustomIntFloatField(ivyParametersGUI.stepSize, 0.01f, "Step Size", 50f, areaYSpace, 20f, windowSkin, realIvyProWindow.OnUpdatingParameter);
            UIUtils.CustomIntFloatField(ivyParametersGUI.directionFrequency, 0.01f, "Dir. Frequency", 50f, areaYSpace, 120f, windowSkin, realIvyProWindow.OnUpdatingParameter);
            UIUtils.CustomIntFloatField(ivyParametersGUI.directionAmplitude, 0.01f, "Dir. Amplitude", 50f, areaYSpace, 225f, windowSkin, realIvyProWindow.OnUpdatingParameter);
            UIUtils.CustomIntFloatField(ivyParametersGUI.directionRandomness, 0.01f, "Dir. Random", 50f, areaYSpace, 320f, windowSkin, realIvyProWindow.OnUpdatingParameter);
            areaYSpace += 58f;

            GUI.Label(new Rect(15f, areaYSpace, 100f, 25f), "Gravity", windowSkin.label);
            UIUtils.CustomIntFloatField(ivyParametersGUI.gravityX, 0.01f, "X", 50f, areaYSpace + 25f, 15f, windowSkin, realIvyProWindow.OnUpdatingParameter);
            UIUtils.CustomIntFloatField(ivyParametersGUI.gravityY, 0.01f, "Y", 50f, areaYSpace + 25f, 70f, windowSkin, realIvyProWindow.OnUpdatingParameter);
            UIUtils.CustomIntFloatField(ivyParametersGUI.gravityZ, 0.01f, "Z", 50f, areaYSpace + 25f, 125f, windowSkin, realIvyProWindow.OnUpdatingParameter);
            UIUtils.CustomIntFloatField(ivyParametersGUI.stiffness, 0.01f, "Stiffness", 50f, areaYSpace + 25f, 225f, windowSkin, realIvyProWindow.OnUpdatingParameter);
            UIUtils.CustomIntFloatField(ivyParametersGUI.grabProvabilityOnFall, 0.01f, "Grab prob. on falling", 50f, areaYSpace + 25f, 320f, windowSkin, realIvyProWindow.OnUpdatingParameter);
            areaYSpace += 86f;

            EditorGUI.DrawRect(new Rect(0f, areaYSpace - 5f, generalArea.width, 60f), bgColor);
            GUI.Label(new Rect(15f, areaYSpace + 15f, 150f, 25f), "Distance to surface", windowSkin.label);
            UIUtils.CustomIntFloatField(ivyParametersGUI.maxDistanceToSurface, 0.001f, "Max", 50f, areaYSpace, 165f, windowSkin, realIvyProWindow.OnUpdatingParameter);
            UIUtils.CustomIntFloatField(ivyParametersGUI.minDistanceToSurface, 0.001f, "Min", 50f, areaYSpace, 225f, windowSkin, realIvyProWindow.OnUpdatingParameter);
            UIUtils.CustomIntFloatField(ivyParametersGUI.DTSFrequency, 0.01f, "Freq.", 50f, areaYSpace, 285f, windowSkin, realIvyProWindow.OnUpdatingParameter);
            UIUtils.CustomIntFloatField(ivyParametersGUI.DTSRandomness, 0.01f, "Random", 50f, areaYSpace, 345f, windowSkin, realIvyProWindow.OnUpdatingParameter);
            areaYSpace += 60f;

            UIUtils.CustomIntFloatField(ivyParametersGUI.maxBranchs, 0.1f, "Max. Branches", 50f, areaYSpace, 20f, windowSkin, realIvyProWindow.OnUpdatingParameter);
            UIUtils.CustomIntFloatField(ivyParametersGUI.branchProvability, 0.001f, "Branch probability", 50f, areaYSpace, 120f, windowSkin, realIvyProWindow.OnUpdatingParameter);
            areaYSpace += 55f;

            GUILayout.EndArea();

            YSpace += areaRect.height;
            realIvyProWindow.Repaint();
        }
Exemplo n.º 8
0
        public override void OnInspectorGUI()
        {
            GUILayout.Space(12f);
            GUILayoutUtility.GetRect(0f, 38f);
            Rect texRect = new Rect(GUILayoutUtility.GetLastRect().width / 2 - 70f, GUILayoutUtility.GetLastRect().y, 151f, 38f);

            GUI.DrawTexture(texRect, logo);
            GUILayout.Space(10f);
            EditorGUILayout.HelpBox("This component holds the information for further editability of the Ivy.\r\n\r\nThe performance cost of this component is minimum, " +
                                    "but you can remove it if you want and the mesh will be preserved in the current state.", MessageType.Info);
            GUILayout.Space(5f);
            if (GUILayout.Button("Edit in Real Ivy Editor"))
            {
                IvyInfo ivyInfo = (IvyInfo)target;
                RealIvyWindow.Init();
                RealIvyWindow.controller.ModifyIvy(ivyInfo);
            }
            GUILayout.Space(5f);
        }
Exemplo n.º 9
0
        public void DrawZone(RealIvyWindow realIvyProWindow, IvyParametersGUI ivyParametersGUI,
                             GUISkin windowSkin, RealIvyProWindowController controller,
                             ref float YSpace, Rect generalArea, Color bgColor)
        {
            this.controller       = controller;
            this.realIvyProWindow = realIvyProWindow;
            this.ivyParametersGUI = ivyParametersGUI;
            this.windowSkin       = windowSkin;


            currentArea = new Rect(10f, 10f, generalArea.width, 520f);
            string gameObjectName = "None";

            if (controller.currentIvyInfo != null)
            {
                gameObjectName = controller.ivyGO.name;
            }

            string boxText = "Editing object: " + gameObjectName;

            GUI.Box(new Rect(0f, YSpace, generalArea.width + 20f, 40f), boxText, windowSkin.GetStyle("title"));
            YSpace += 45f;
            GUILayout.BeginArea(currentArea);
            GUIStyle placeButtonStyle = windowSkin.button;

            GUI.Label(new Rect(170f, YSpace - 15f, 100f, 40f), "Main Controls", windowSkin.label);
            YSpace += 25f;

            string placeButtonText = "Place Seed";

            if (realIvyProWindow.placingSeed)
            {
                placeButtonStyle = windowSkin.GetStyle("buttonorange");
                placeButtonText  = "Stop Placing";
            }

            GUIStyle startStopButtonStyle = windowSkin.button;
            string   startStopButtonText  = "Start Growth";

            if (controller.infoPool.growth.growing)
            {
                startStopButtonStyle = windowSkin.GetStyle("buttonorange");
                startStopButtonText  = "Stop Growth";
            }
            if (GUI.Button(new Rect(20f, YSpace, 100f, 25f), placeButtonText, placeButtonStyle))
            {
                realIvyProWindow.placingSeed = !realIvyProWindow.placingSeed;
            }


            if (GUI.Button(new Rect(140f, YSpace, 100f, 25f), "Randomize", windowSkin.button))
            {
                CheckRestrictions(Randomize);
            }
            if (GUI.Button(new Rect(20f, YSpace + 40f, 100f, 25f), startStopButtonText, startStopButtonStyle))
            {
                CheckIvySelectedBeforeAction(StartStopGrowth);
            }
            if (GUI.Button(new Rect(140f, YSpace + 40f, 100f, 25f), "Reset", windowSkin.button))
            {
                CheckIvySelectedBeforeAction(Reset);
            }

            if (GUI.Button(new Rect(275f, YSpace + 5f, 100f, 25f), "Optimize", windowSkin.button))
            {
                CheckRestrictions(Optimize);
            }

            Rect optimizeAngleLabel = new Rect(330f, YSpace + 35f, 50f, 20f);

            GUI.Label(optimizeAngleLabel, "Angle", windowSkin.label);
            if (EditorGUI.DropdownButton(optimizeAngleLabel, GUIContent.none, FocusType.Keyboard, windowSkin.GetStyle("transparent")))
            {
                realIvyProWindow.updatingParameter       = ivyParametersGUI.optAngleBias;
                realIvyProWindow.updatingValue           = true;
                realIvyProWindow.updatingValueMultiplier = 0.1f;
                realIvyProWindow.originalUpdatingValue   = ivyParametersGUI.optAngleBias;
                realIvyProWindow.mouseStartPoint         = GUIUtility.GUIToScreenPoint(Event.current.mousePosition).x;
            }
            if (optimizeAngleLabel.Contains(Event.current.mousePosition))
            {
                EditorGUIUtility.AddCursorRect(new Rect(Event.current.mousePosition, Vector2.one * 20f), MouseCursor.SlideArrow);
            }
            ivyParametersGUI.optAngleBias.value = EditorGUI.FloatField(new Rect(275, YSpace + 35f, 50f, 20f), "",
                                                                       ivyParametersGUI.optAngleBias, windowSkin.GetStyle("textfield"));

            YSpace += 65f;

            YSpace += 15f;
            EditorGUI.DrawRect(new Rect(0f, YSpace, generalArea.width, 2f), bgColor);
            YSpace += 20f;

            GUI.Label(new Rect(80f, YSpace - 20f, 200f, 40f), "Save ivy", windowSkin.label);
            if (GUI.Button(new Rect(10f, YSpace + 20f, 90f, 40f), "Save into Scene", windowSkin.button))
            {
                CheckRestrictions(SaveCurrentIvyIntoScene);
            }
            if (GUI.Button(new Rect(110f, YSpace + 20f, 90f, 40f), "Save as prefab", windowSkin.button))
            {
                CheckRestrictions(SaveAsPrefab);
            }

            EditorGUI.DrawRect(new Rect(209f, YSpace - 5f, 2f, 75f), bgColor);

            GUI.Label(new Rect(245f, YSpace - 20f, 200f, 40f), "Convert to runtime Ivy", windowSkin.label);
            if (GUI.Button(new Rect(220f, YSpace + 20f, 90f, 40f), "Runtime Procedural", windowSkin.button))
            {
                CheckRestrictions(PrepareRuntimeProcedural);
            }

            if (GUI.Button(new Rect(320f, YSpace + 20f, 90f, 40f), "Runtime Baked", windowSkin.button))
            {
                CheckRestrictions(PrepareRuntimeBaked);
            }
            YSpace += 90f;

            GUILayout.EndArea();
        }
Exemplo n.º 10
0
        public override void DrawZone(string sectionName, float areaMaxHeight, RealIvyWindow realIvyProWindow, IvyParametersGUI ivyParametersGUI,
                                      GUISkin windowSkin, RealIvyProWindowController controller,
                                      ref float YSpace, ref float presetDropDownYSpace, ref float areaYSpace, Rect generalArea,
                                      Color bgColor, AnimationCurve animationCurve)
        {
            base.DrawZone(sectionName, areaMaxHeight, realIvyProWindow, ivyParametersGUI,
                          windowSkin, controller, ref YSpace, ref presetDropDownYSpace,
                          ref areaYSpace, generalArea, bgColor, animationCurve);

            GUILayout.BeginArea(areaRect);
            //EditorGUI.DrawRect(new Rect(0f, areaYSpace, generalArea.width, 58f), bgColor);

            //currentArea = new Rect(10f, 10f, generalArea.width, 520f);

            /*GUI.Box(new Rect(0f, areaYSpace, generalArea.width + 20f, 40f), "General Settings", windowSkin.GetStyle("sectionbutton"));*/
            //areaYSpace += 40f;

            //GUILayout.BeginArea(currentArea);
            GUI.Label(new Rect(5f, areaYSpace, 100f, 20f), "Preset:", windowSkin.label);

            areaYSpace += 20f;


            UIUtils.CustomObjectField <IvyPreset>(new Rect(0f, areaYSpace, areaRect.width / 2f, 25f),
                                                  controller.selectedPreset, windowSkin, realIvyProWindow.oldSkin, RealIvyWindow.presetTex, 489136168, string.Empty,
                                                  OnPresetChanged, controller.AreThereUnsavedChanges());


            //bool unsavedChanges = !controller.infoPool.ivyParameters.IsEqualTo(controller.selectedPreset);
            UIUtils.ButtonChangesAlert(new Rect(areaRect.width / 2f + 10f, areaYSpace, 60f, 25f), "Save", "Save *",
                                       windowSkin.button, windowSkin.GetStyle("bold"), false, SavePreset);

            /*if (GUI.Button(new Rect(currentArea.width / 2f + 10f, YSpace, 60f, 25f), "Save*", windowSkin.GetStyle("bold")))
             * {
             *      SavePreset();
             * }*/
            if (GUI.Button(new Rect(areaRect.width / 2f + 70f + 10f, areaYSpace, 130f, 25f), "Save preset as...", windowSkin.button))
            {
                SavePresetAs();
            }


            areaYSpace += 40f;
            GUI.Label(new Rect(5f, areaYSpace, 100f, 20f), "Generate...", windowSkin.label);
            areaYSpace += 20f;

            ivyParametersGUI.generateBranches    = GUI.Toggle(new Rect(0f, areaYSpace, 133f, 20f), ivyParametersGUI.generateBranches, "Vines", windowSkin.toggle);
            ivyParametersGUI.generateLeaves      = GUI.Toggle(new Rect(generalArea.width / 3f + 10f, areaYSpace, 133f, 20f), ivyParametersGUI.generateLeaves, "Leaves", windowSkin.toggle);
            ivyParametersGUI.generateLightmapUVs = GUI.Toggle(new Rect(generalArea.width / 3f * 2f + 10f, areaYSpace, 133f, 20f), ivyParametersGUI.generateLightmapUVs, "Lightmap UVs", windowSkin.toggle);
            areaYSpace += 20f;

            areaYSpace += 10f;
            GUI.Label(new Rect(5f, areaYSpace, generalArea.width / 3f - 5f, 20f), "Vines material:", windowSkin.label);
            GUI.Label(new Rect(generalArea.width / 3f + 10f, areaYSpace, generalArea.width / 3f - 5f, 20f), "Leaves prefabs:", windowSkin.label);
            areaYSpace += 20f;

            ivyParametersGUI.branchesMaterial = UIUtils.CustomObjectField <Material>(new Rect(0f, areaYSpace, generalArea.width / 3f - 5f, 25f),
                                                                                     ivyParametersGUI.branchesMaterial, windowSkin, realIvyProWindow.oldSkin, RealIvyWindow.materialTex, 489136169, string.Empty, OnVinesMaterialChanged, false);

            GUI.Label(new Rect(5f, areaYSpace + 35f, generalArea.width / 3f - 5f, 20f), "Layer Mask:", windowSkin.label);
            ivyParametersGUI.layerMask = EditorGUI.MaskField(new Rect(0f, areaYSpace + 55f, generalArea.width / 3f - 5f, 25f),
                                                             InternalEditorUtility.LayerMaskToConcatenatedLayersMask(ivyParametersGUI.layerMask),
                                                             InternalEditorUtility.layers,
                                                             windowSkin.GetStyle("dropdown"));
            GUI.DrawTexture(new Rect(generalArea.width / 3f - 30f, areaYSpace + 55f, 25f, 25f), RealIvyWindow.downArrowTex);
            ivyParametersGUI.layerMask = InternalEditorUtility.ConcatenatedLayersMaskToLayerMask(ivyParametersGUI.layerMask);

            ivyParametersGUI.buffer32Bits = GUI.Toggle(new Rect(0f, areaYSpace + 100f, 133f, 20f), ivyParametersGUI.buffer32Bits, "32 bits mesh buffer", windowSkin.toggle);

            GUI.Box(new Rect(generalArea.width / 3f + 5f, areaYSpace, (generalArea.width / 3f - 5f) * 2f, 120f), "", windowSkin.GetStyle("list"));

            float leaveButtonsMargin;

            if (ivyParametersGUI.leavesPrefabs.Count > 3)
            {
                leaveButtonsMargin = 50f;
            }
            else
            {
                leaveButtonsMargin = 35f;
            }

            realIvyProWindow.leavesPrefabsScrollView = GUI.BeginScrollView(new Rect(generalArea.width / 3f + 5f, areaYSpace, (generalArea.width / 3f - 5f) * 2f, 100f), realIvyProWindow.leavesPrefabsScrollView, new Rect(0f, 0f, (generalArea.width / 3f - 21f) * 2f, (ivyParametersGUI.leavesPrefabs.Count + 1) * 25f));

            for (int i = 0; i < ivyParametersGUI.leavesPrefabs.Count + 1; i++)
            {
                if (i < ivyParametersGUI.leavesPrefabs.Count)
                {
                    if (ivyParametersGUI.leavesPrefabs[i] != null)
                    {
                        if (GUI.Button(new Rect(0f, i * 25f, (generalArea.width / 3f - leaveButtonsMargin) * 2f, 25f), ivyParametersGUI.leavesPrefabs[i].name, windowSkin.GetStyle("listelement")))
                        {
                            EditorGUIUtility.PingObject(ivyParametersGUI.leavesPrefabs[i]);
                        }

                        GUI.DrawTexture(new Rect(0f, i * 25f, 25f, 25f), RealIvyWindow.leaveTex);

                        ivyParametersGUI.leavesProb[i] = EditorGUI.FloatField(new Rect(generalArea.width / 3f * 2f - leaveButtonsMargin * 2f + 10, i * 25f + 2, 25f, 20f), ivyParametersGUI.leavesProb[i], windowSkin.textArea);
                        GUI.Label(new Rect(generalArea.width / 3f * 2f - leaveButtonsMargin * 2f - 8f, i * 25f + 2, 25f, 20f), "%", windowSkin.GetStyle("whitelabel"));

                        if (GUI.Button(new Rect(generalArea.width / 3f * 2f - leaveButtonsMargin, i * 25f, 25f, 25f), "", windowSkin.GetStyle("removeelement")))
                        {
                            RemoveLeavePrefab(ivyParametersGUI, i);
                        }
                    }
                    else
                    {
                        RemoveLeavePrefab(ivyParametersGUI, i);
                    }
                }
                else
                {
                    GUI.Label(new Rect(0f, i * 25f, (generalArea.width / 3f - 5f) * 2, 25f), "Drag & Drop here to add", windowSkin.GetStyle("tooltip"));
                    UIUtils.DragAndDropArea(new Rect(0f, i * 25f, (generalArea.width / 3f - 5f) * 2f, 25f), OnObjectDragged, realIvyProWindow.SaveParameters);
                }
            }

            GUI.EndScrollView();


            GUILayout.EndArea();
            YSpace += areaRect.height;
            realIvyProWindow.Repaint();
        }