예제 #1
0
        private void DrawSelectedSegmentGUI()
        {
            int segmentIndex = splineEditingGUIDrawer.selectedSegmentIndex;

            if (segmentIndex < 0 ||
                segmentIndex >= water.Spline.Anchors.Count)
            {
                return;
            }
            string label = "Selected Segment";
            string id    = "poseidon-selected-segment";

            PEditorCommon.Foldout(label, true, id, () =>
            {
                EditorGUI.indentLevel -= 1;
                EditorGUI.BeginChangeCheck();
                PSplineSegment s                    = water.Spline.Segments[segmentIndex];
                GUI.enabled                         = !PSplineToolConfig.Instance.AutoTangent;
                s.StartTangent                      = PEditorCommon.InlineVector3Field("Start Tangent", s.StartTangent);
                s.EndTangent                        = PEditorCommon.InlineVector3Field("End Tangent", s.EndTangent);
                GUI.enabled                         = true;
                s.ResolutionMultiplierY             = EditorGUILayout.Slider("Resolution Multiplier Y", s.ResolutionMultiplierY, 0f, 2f);
                water.Spline.Segments[segmentIndex] = s;
                if (EditorGUI.EndChangeCheck())
                {
                    water.GenerateSplineMeshAtSegment(segmentIndex);
                }
                EditorGUI.indentLevel += 1;
            });
        }
예제 #2
0
        private void DrawVolumesGUI()
        {
            string label = "Volumes";
            string id    = "volumes" + instance.GetInstanceID();

            PEditorCommon.Foldout(label, false, id, () =>
            {
                instance.VolumeExtent = PEditorCommon.InlineVector3Field("Extent", instance.VolumeExtent);
                instance.VolumeLayer  = EditorGUILayout.LayerField("Layer", instance.VolumeLayer);
            });
        }
예제 #3
0
        private void DrawSelectedAnchorGUI()
        {
            int anchorIndex = splineEditingGUIDrawer.selectedAnchorIndex;

            if (anchorIndex < 0 ||
                anchorIndex >= water.Spline.Anchors.Count)
            {
                return;
            }
            string label = "Selected Anchor";
            string id    = "poseidon-selected-anchor";

            PEditorCommon.Foldout(label, true, id, () =>
            {
                EditorGUI.indentLevel -= 1;
                PSplineAnchor a        = water.Spline.Anchors[anchorIndex];
                EditorGUI.BeginChangeCheck();
                a.Position = PEditorCommon.InlineVector3Field("Position", a.Position);
                a.Rotation = Quaternion.Euler(PEditorCommon.InlineVector3Field("Rotation", a.Rotation.eulerAngles));
                a.Scale    = PEditorCommon.InlineVector3Field("Scale", a.Scale);
                water.Spline.Anchors[anchorIndex] = a;
                if (EditorGUI.EndChangeCheck())
                {
                    if (PSplineToolConfig.Instance.AutoTangent)
                    {
                        int[] segmentIndices = water.Spline.SmoothTangents(anchorIndex);
                        water.GenerateSplineMeshAtSegments(segmentIndices);
                    }
                    else
                    {
                        List <int> segmentIndices = water.Spline.FindSegments(anchorIndex);
                        water.GenerateSplineMeshAtSegments(segmentIndices);
                    }
                }
                EditorGUI.indentLevel += 1;
            });
        }