コード例 #1
0
        private void OnGUI()
        {
            if (verticalLayoutDirection)
            {
                GUILayout.BeginArea(new Rect(buttonPadding, buttonPadding, buttonHeight + buttonPadding, (buttons * buttonWidth)));
                GUILayout.BeginVertical();
            }
            else
            {
                GUILayout.BeginArea(new Rect(buttonPadding, buttonPadding, (buttons * buttonWidth), buttonHeight + buttonPadding));
                GUILayout.BeginHorizontal();
            }

            #region New Empty Game Object
            if (GUILayout.Button(newEmptyGameObjectContent, FSUSTStyle, GUILayout.Width(buttonWidth), GUILayout.Height(buttonHeight)))
            {
                if (Event.current.shift && (Selection.activeGameObject != null))  // holding (SHIFT)
                {
                    FS_NewGameObject.createAsChild();
                }
                else if (Event.current.alt && (Selection.activeGameObject != null)) // holding (ALT)
                {
                    FS_NewGameObject.createAsParents();
                }
                else if (Event.current.control && (Selection.activeGameObject != null)) // holding (CTRL)
                {
                    FS_NewGameObject.createAsParent();
                }
                else
                {
                    FS_NewGameObject.create();
                }
            }
            #endregion

            #region Reset PRS
            if (GUILayout.Button(resetPRSContent, FSUSTStyle, GUILayout.Width(buttonWidth), GUILayout.Height(buttonHeight)))
            {
                if (Event.current.shift) // holding (SHIFT)
                {
                    FS_ResetPRS.resetP();
                }
                else if (Event.current.alt) // holding (ALT)
                {
                    FS_ResetPRS.resetR();
                }
                else if (Event.current.control) // holding (CTRL)
                {
                    FS_ResetPRS.resetS();
                }
                else
                {
                    FS_ResetPRS.reset();
                }
            }
            #endregion

            #region Annotation
            if (GUILayout.Button(annotationContent, FSUSTStyle, GUILayout.Width(buttonWidth), GUILayout.Height(buttonHeight)))
            {
                if (Event.current.shift) // holding (SHIFT)
                {
                    FS_NewAnnotation.add();
                }
                else
                {
                    FS_NewAnnotation.create();
                }
            }
            #endregion

            #region Unparent
            if (GUILayout.Button(unparentContent, FSUSTStyle, GUILayout.Width(buttonWidth), GUILayout.Height(buttonHeight)))
            {
                if (Event.current.shift) // holding (SHIFT)
                {
                    FS_Unparent.toHierarchy();
                }
                else
                {
                    FS_Unparent.toRoot();
                }
            }
            #endregion

            #region Drop
            if (GUILayout.Button(dropContent, FSUSTStyle, GUILayout.Width(buttonWidth), GUILayout.Height(buttonHeight)))
            {
                FS_Drop.toGround();
            }
            #endregion

            #region Solo / Unsolo
            if (GUILayout.Button(soloObjectsContent, FSUSTStyle, GUILayout.Width(buttonWidth), GUILayout.Height(buttonHeight)))
            {
                FS_Solo.selection();
            }

            if (GUILayout.Button(unsoloObjectsContent, FSUSTStyle, GUILayout.Width(buttonWidth), GUILayout.Height(buttonHeight)))
            {
                FS_Unsolo.all();
            }
            #endregion

            if (verticalLayoutDirection)
            {
                GUILayout.EndVertical();
            }
            else
            {
                GUILayout.EndHorizontal();
            }
            GUILayout.EndArea();
        }
コード例 #2
0
        // create new annotation gameobject
        public static void create()
        {
            var annotationGO = FS_NewGameObject.create("Annotation");

            annotationGO.AddComponent <FS_Annotation>();
        }