Update() public method

public Update ( ) : void
return void
示例#1
0
    private void InitCurve()
    {
        int numNodes = path.nodes.Count;

        if (numNodes == 0)
        {
            return;
        }

        int curveResolution = 60;

        xys = new Spline(curveResolution);

        for (int i = 0; i < numNodes; i++)
        {
            MandelbrotPath.Node node = path.nodes[i];

            float scaleNorm = ScaleNormalizer(node.s);
            Debug.Log(scaleNorm);
            Vector3 point = new Vector3(node.x * scaleNorm, node.y * scaleNorm, node.s);

            SplineNode splineNode = new SplineNode(point, Vector3.zero);
            xys.AddNode(splineNode);
        }

        xys.Smooth(.25f);
        xys.Update();
    }
示例#2
0
        //================================      Public methods      =================================
        /// <inheritdoc />
        public override void OnInspectorGUI()
        {
            EditorGUILayout.HelpBox("Ope point mode: Editing a one point.", MessageType.Info);
            if (_selection < 0)
            {
                return;
            }
            Spline.Update();
            var needToUpdate = SplineGUILayout.PointField(Spline, _selection);
            var action       = SplineGUILayout.PointCreationControls(Spline.GetPointInfo(_selection));

            PointInfo info;

            if (SplineGUILayout.PointTypeControls(Spline.GetPoint(_selection), out info, Spline.Count))
            {
                Spline.SetPointInfo(_selection, info);
                needToUpdate = true;
            }

            if (action != SplineGUILayout.CreationType.None)
            {
                //TODO: Add creation methods
                if (action == SplineGUILayout.CreationType.AddLeft)
                {
                    Spline.AddLeftPoint(_selection);
                }
                needToUpdate = true;
            }
            if (!needToUpdate)
            {
                return;
            }
            Spline.ApplyModifiedProperties();
            SceneView.RepaintAll();
        }
示例#3
0
        //================================ Private|Protected methods ================================

        protected override void OnSceneGUI()
        {
            if (EditMode.editTool == Tool.Move)
            {
                base.OnSceneGUI();
                return;
            }
            Spline.Update();
            SplineContent[] points = FilterPoints(_selection);

            SplineHandles.DrawSegments(Spline.GetSegments(), _selection);
            SplineHandles.DrawNormals(FilterNormals(_selection), -1);

            if (points.Length == 0)
            {
                return;
            }
            var selection = Array.FindIndex(points, p => p.Index == _selection);

            //Draw points
            EditorGUI.BeginChangeCheck();
            selection = SplineHandles.PointsHandle(selection, points, EditMode.editTool == Tool.Rect);
            if (EditorGUI.EndChangeCheck())
            {
                _selection = points[selection].Index;
            }
            //Move points
            if (_selection < 0 || EditMode.editTool != Tool.Rect)
            {
                return;
            }
            Repaint();
            EditorGUI.BeginChangeCheck();
            Vector3 position = Spline[_selection];

            position = Handles.PositionHandle(position, Quaternion.identity);
            if (!EditorGUI.EndChangeCheck())
            {
                return;
            }
            MovePoint(_selection, position);
            Spline.ApplyModifiedProperties();
        }