Ejemplo n.º 1
0
        /// <summary>
        /// Displays the scene GUI handles.
        /// </summary>
        protected override void DisplaySceneGUIHandles()
        {
            base.DisplaySceneGUIHandles();
            HashSet <Object> undoObjects = new HashSet <Object>();

            for (int i = 0; i < this.Target.GetLeaves(ref s_Leaves); ++i)
            {
                undoObjects.Add(s_Leaves[i].BackFace);
                undoObjects.Add(s_Leaves[i].FrontFace);
            }
            undoObjects.Remove(null);
            Helix     newHelix  = null;
            Matrix4x4 oldMatrix = Handles.matrix;

            for (int i = 0; i < s_Leaves.Count; ++i)
            {
                if (s_Leaves[i].FrontFace == null || s_Leaves[i].BackFace == null)
                {
                    continue;
                }
                Handles.matrix = s_Leaves[i].FrontFace.transform.localToWorldMatrix;
                if (
                    SceneGUI.BeginHandles(undoObjects.ToArray(), "Modify Plant Leaf") &&
                    HelixMeshRibbonEditor.IsHandleEnabled
                    )
                {
                    newHelix = HelixHandles.MeshRibbon(
                        s_Leaves[i].FrontFace,
                        Vector3.zero,
                        Quaternion.identity,
                        Vector3.one,
                        HelixMeshRibbonEditor.HandleColor
                        );
                }
                if (SceneGUI.EndHandles())
                {
                    s_Leaves[i].FrontFace.Helix = newHelix;
                    s_Leaves[i].BackFace.Helix  = newHelix;
                }
            }
            Handles.matrix = oldMatrix;
        }
        /// <summary>
        /// Displays the scene GUI handles.
        /// </summary>
        protected override void DisplaySceneGUIHandles()
        {
            base.DisplaySceneGUIHandles();
            Helix newHelix = null;

            if (SceneGUI.BeginHandles(target, "Change Helix Mesh Ribbon") && s_HandleTogglePreference.CurrentValue)
            {
                newHelix = HelixHandles.MeshRibbon(
                    this.Target,
                    Vector3.zero,
                    Quaternion.identity,
                    Vector3.one,
                    s_HandleColorPreference.CurrentValue
                    );
            }
            if (SceneGUI.EndHandles())
            {
                this.Target.Helix = newHelix;
            }
        }