Пример #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 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();
        }
Пример #3
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();
        }
Пример #4
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();
        }