Esempio n. 1
0
        protected override void RenderContent(UnityEngine.Object undoRecordObject)
        {
            RTObjectSelectionGizmos gizmos = RTObjectSelectionGizmos.Get;
            GUIContent content             = new GUIContent();

            EditorGUILayout.BeginHorizontal();
            content.text    = "Inherit";
            content.tooltip = "Inherit different category of settings from the other gizmos (move, rotate or scale).";
            if (GUILayout.Button(content))
            {
                EditorUndoEx.Record(undoRecordObject);
                if (InheritCategory == UniversalGizmoSettingsCategory.Move)
                {
                    if (InheritType == UniversalGizmoSettingsType.Settings2D)
                    {
                        gizmos.UniversalGizmoSettings2D.Inherit(gizmos.MoveGizmoSettings2D);
                    }
                    else
                    if (InheritType == UniversalGizmoSettingsType.Settings3D)
                    {
                        gizmos.UniversalGizmoSettings3D.Inherit(gizmos.MoveGizmoSettings3D);
                    }
                    else
                    if (InheritType == UniversalGizmoSettingsType.LookAndFeel2D)
                    {
                        gizmos.UniversalGizmoLookAndFeel2D.Inherit(gizmos.MoveGizmoLookAndFeel2D);
                    }
                    else
                    if (InheritType == UniversalGizmoSettingsType.LookAndFeel3D)
                    {
                        gizmos.UniversalGizmoLookAndFeel3D.Inherit(gizmos.MoveGizmoLookAndFeel3D);
                    }
                }
                else
                if (InheritCategory == UniversalGizmoSettingsCategory.Rotate)
                {
                    if (InheritType == UniversalGizmoSettingsType.Settings3D)
                    {
                        gizmos.UniversalGizmoSettings3D.Inherit(gizmos.RotationGizmoSettings3D);
                    }
                    else
                    if (InheritType == UniversalGizmoSettingsType.LookAndFeel3D)
                    {
                        gizmos.UniversalGizmoLookAndFeel3D.Inherit(gizmos.RotationGizmoLookAndFeel3D);
                    }
                }
                else
                if (InheritCategory == UniversalGizmoSettingsCategory.Scale)
                {
                    if (InheritType == UniversalGizmoSettingsType.Settings3D)
                    {
                        gizmos.UniversalGizmoSettings3D.Inherit(gizmos.ScaleGizmoSettings3D);
                    }
                    else
                    if (InheritType == UniversalGizmoSettingsType.LookAndFeel3D)
                    {
                        gizmos.UniversalGizmoLookAndFeel3D.Inherit(gizmos.ScaleGizmoLookAndFeel3D);
                    }
                }
            }

            UniversalGizmoSettingsCategory newCategory;
            UniversalGizmoSettingsType     newInheritType;

            newCategory = (UniversalGizmoSettingsCategory)EditorGUILayout.EnumPopup(InheritCategory);
            if (newCategory != InheritCategory)
            {
                EditorUndoEx.Record(undoRecordObject);
                InheritCategory = newCategory;
            }
            newInheritType = (UniversalGizmoSettingsType)EditorGUILayout.EnumPopup(InheritType);
            if (newInheritType != InheritType)
            {
                EditorUndoEx.Record(undoRecordObject);
                InheritType = newInheritType;
            }
            EditorGUILayout.EndHorizontal();

            content.text    = "Display category";
            content.tooltip = "Specifies what category of settings are currently displayed for modification.";
            newCategory     = (UniversalGizmoSettingsCategory)EditorGUILayout.EnumPopup(content, DisplayCategory);
            if (newCategory != DisplayCategory)
            {
                EditorUndoEx.Record(undoRecordObject);
                DisplayCategory = newCategory;
            }

            gizmos.UniversalGizmoSettings2D.DisplayCategory    = DisplayCategory;
            gizmos.UniversalGizmoSettings3D.DisplayCategory    = DisplayCategory;
            gizmos.UniversalGizmoLookAndFeel2D.DisplayCategory = DisplayCategory;
            gizmos.UniversalGizmoLookAndFeel3D.DisplayCategory = DisplayCategory;

            gizmos.UniversalGizmoSettings2D.CanBeDisplayed    = true;
            gizmos.UniversalGizmoLookAndFeel2D.CanBeDisplayed = true;
            gizmos.UniversalGizmoSettings3D.CanBeDisplayed    = true;
            gizmos.UniversalGizmoLookAndFeel3D.CanBeDisplayed = true;

            if (DisplayCategory != UniversalGizmoSettingsCategory.Move)
            {
                gizmos.UniversalGizmoSettings2D.CanBeDisplayed    = false;
                gizmos.UniversalGizmoLookAndFeel2D.CanBeDisplayed = false;
            }
        }
        private void OnEnable()
        {
            _gizmos = target as RTObjectSelectionGizmos;

            _gizmos.Hotkeys.FoldoutLabel = "Hotkeys";
            _gizmos.Hotkeys.UsesFoldout  = true;

            var tab = _gizmos.MainToolbar.GetTabByIndex(_generalTab);

            tab.AddTargetSettings(_gizmos.Hotkeys);

            _gizmos.MoveGizmoSettings2D.FoldoutLabel     = "2D Mode settings";
            _gizmos.MoveGizmoSettings2D.UsesFoldout      = true;
            _gizmos.MoveGizmoSettings3D.FoldoutLabel     = "3D Mode settings";
            _gizmos.MoveGizmoSettings3D.UsesFoldout      = true;
            _gizmos.MoveGizmoLookAndFeel2D.FoldoutLabel  = "2D Mode look & feel";
            _gizmos.MoveGizmoLookAndFeel2D.UsesFoldout   = true;
            _gizmos.MoveGizmoLookAndFeel3D.FoldoutLabel  = "3D Mode look & feel";
            _gizmos.MoveGizmoLookAndFeel3D.UsesFoldout   = true;
            _gizmos.MoveGizmoHotkeys.FoldoutLabel        = "Hotkeys";
            _gizmos.MoveGizmoHotkeys.UsesFoldout         = true;
            _gizmos.ObjectMoveGizmoSettings.FoldoutLabel = "Object settings";
            _gizmos.ObjectMoveGizmoSettings.UsesFoldout  = true;

            _gizmos.RotationGizmoSettings3D.FoldoutLabel     = "Settings";
            _gizmos.RotationGizmoSettings3D.UsesFoldout      = true;
            _gizmos.RotationGizmoLookAndFeel3D.FoldoutLabel  = "Look & feel";
            _gizmos.RotationGizmoLookAndFeel3D.UsesFoldout   = true;
            _gizmos.RotationGizmoHotkeys.FoldoutLabel        = "Hotkeys";
            _gizmos.RotationGizmoHotkeys.UsesFoldout         = true;
            _gizmos.ObjectRotationGizmoSettings.FoldoutLabel = "Object settings";
            _gizmos.ObjectRotationGizmoSettings.UsesFoldout  = true;

            _gizmos.ScaleGizmoSettings3D.FoldoutLabel     = "Settings";
            _gizmos.ScaleGizmoSettings3D.UsesFoldout      = true;
            _gizmos.ScaleGizmoLookAndFeel3D.FoldoutLabel  = "Look & feel";
            _gizmos.ScaleGizmoLookAndFeel3D.UsesFoldout   = true;
            _gizmos.ScaleGizmoHotkeys.FoldoutLabel        = "Hotkeys";
            _gizmos.ScaleGizmoHotkeys.UsesFoldout         = true;
            _gizmos.ObjectScaleGizmoSettings.FoldoutLabel = "Object settings";
            _gizmos.ObjectScaleGizmoSettings.UsesFoldout  = true;

            _gizmos.UniversalGizmoSettings2D.FoldoutLabel     = "2D Mode settings";
            _gizmos.UniversalGizmoSettings2D.UsesFoldout      = true;
            _gizmos.UniversalGizmoSettings3D.FoldoutLabel     = "3D Mode settings";
            _gizmos.UniversalGizmoSettings3D.UsesFoldout      = true;
            _gizmos.UniversalGizmoLookAndFeel2D.FoldoutLabel  = "2D Mode look & feel";
            _gizmos.UniversalGizmoLookAndFeel2D.UsesFoldout   = true;
            _gizmos.UniversalGizmoLookAndFeel3D.FoldoutLabel  = "3D Mode look & feel";
            _gizmos.UniversalGizmoLookAndFeel3D.UsesFoldout   = true;
            _gizmos.UniversalGizmoHotkeys.FoldoutLabel        = "Hotkeys";
            _gizmos.UniversalGizmoHotkeys.UsesFoldout         = true;
            _gizmos.ObjectUniversalGizmoSettings.FoldoutLabel = "Object settings";
            _gizmos.ObjectUniversalGizmoSettings.UsesFoldout  = true;

            _gizmos.BoxScaleGizmoSettings3D.FoldoutLabel    = "Settings";
            _gizmos.BoxScaleGizmoSettings3D.UsesFoldout     = true;
            _gizmos.BoxScaleGizmoLookAndFeel3D.FoldoutLabel = "Look & feel";
            _gizmos.BoxScaleGizmoLookAndFeel3D.UsesFoldout  = true;
            _gizmos.BoxScaleGizmoHotkeys.FoldoutLabel       = "Hotkeys";
            _gizmos.BoxScaleGizmoHotkeys.UsesFoldout        = true;

            _gizmos.ExtrudeGizmoLookAndFeel3D.FoldoutLabel = "Look & feel";
            _gizmos.ExtrudeGizmoLookAndFeel3D.UsesFoldout  = true;
            _gizmos.ExtrudeGozmoHotkeys.FoldoutLabel       = "Hotkeys";
            _gizmos.ExtrudeGozmoHotkeys.UsesFoldout        = true;

            tab = _gizmos.MainToolbar.GetTabByIndex(_moveGizmoTab);
            tab.AddTargetSettings(_gizmos.ObjectMoveGizmoSettings);
            tab.AddTargetSettings(_gizmos.MoveGizmoSettings3D);
            tab.AddTargetSettings(_gizmos.MoveGizmoSettings2D);
            tab.AddTargetSettings(_gizmos.MoveGizmoLookAndFeel3D);
            tab.AddTargetSettings(_gizmos.MoveGizmoLookAndFeel2D);
            tab.AddTargetSettings(_gizmos.MoveGizmoHotkeys);

            tab = _gizmos.MainToolbar.GetTabByIndex(_rotationGizmoTab);
            tab.AddTargetSettings(_gizmos.ObjectRotationGizmoSettings);
            tab.AddTargetSettings(_gizmos.RotationGizmoSettings3D);
            tab.AddTargetSettings(_gizmos.RotationGizmoLookAndFeel3D);
            tab.AddTargetSettings(_gizmos.RotationGizmoHotkeys);

            tab = _gizmos.MainToolbar.GetTabByIndex(_scaleGizmoTab);
            tab.AddTargetSettings(_gizmos.ObjectScaleGizmoSettings);
            tab.AddTargetSettings(_gizmos.ScaleGizmoSettings3D);
            tab.AddTargetSettings(_gizmos.ScaleGizmoLookAndFeel3D);
            tab.AddTargetSettings(_gizmos.ScaleGizmoHotkeys);

            tab = _gizmos.MainToolbar.GetTabByIndex(_boxScaleGizmoTab);
            tab.AddTargetSettings(_gizmos.BoxScaleGizmoSettings3D);
            tab.AddTargetSettings(_gizmos.BoxScaleGizmoLookAndFeel3D);
            tab.AddTargetSettings(_gizmos.BoxScaleGizmoHotkeys);

            tab = _gizmos.MainToolbar.GetTabByIndex(_universalGizmoTab);
            tab.AddTargetSettings(_gizmos.UniversalGizmoConfig);
            tab.AddTargetSettings(_gizmos.ObjectUniversalGizmoSettings);
            tab.AddTargetSettings(_gizmos.UniversalGizmoSettings2D);
            tab.AddTargetSettings(_gizmos.UniversalGizmoSettings3D);
            tab.AddTargetSettings(_gizmos.UniversalGizmoLookAndFeel2D);
            tab.AddTargetSettings(_gizmos.UniversalGizmoLookAndFeel3D);
            tab.AddTargetSettings(_gizmos.UniversalGizmoHotkeys);

            tab = _gizmos.MainToolbar.GetTabByIndex(_extrudeGizmoTab);
            tab.AddTargetSettings(_gizmos.ExtrudeGizmoLookAndFeel3D);
            tab.AddTargetSettings(_gizmos.ExtrudeGozmoHotkeys);
        }