コード例 #1
0
        private static void IgnoreLockedSelection()
        {
            if (Preferences.AllowSelectingLockedObjects || !IsFirstVisible || !IsRepaintEvent)
            {
                return;
            }

            using (ProfilerSample.Get()) {
                var selection = Selection.objects;
                var changed   = false;

                for (var i = 0; i < selection.Length; i++)
                {
                    if (selection[i] is GameObject && (selection[i].hideFlags & HideFlags.NotEditable) != 0 && !EditorUtility.IsPersistent(selection[i]))
                    {
                        selection[i] = null;
                        changed      = true;
                    }
                }

                if (changed)
                {
                    Selection.objects = selection;
                    Reflected.SetHierarchySelectionNeedSync();
                    EditorApplication.RepaintHierarchyWindow();
                }
            }
        }
コード例 #2
0
        private static void ChildToggle()
        {
            using (ProfilerSample.Get()) {
                if (!Preferences.NumericChildExpand || !IsRepaintEvent || !IsGameObject || CurrentGameObject.transform.childCount <= 0)
                {
                    return;
                }

                var rect        = RawRect;
                var childString = CurrentGameObject.transform.childCount.ToString("00");
                var expanded    = Reflected.GetTransformIsExpanded(CurrentGameObject);

                rect.xMax  = rect.xMin - 1f;
                rect.xMin -= 15f;

                if (childString.Length > 2)
                {
                    rect.xMin -= 4f;
                }

                using (new GUIBackgroundColor(Styles.childToggleColor))
                    Styles.newToggleStyle.Draw(rect, Utility.GetTempGUIContent(childString), false, false, expanded, false);
            }
        }