Esempio n. 1
0
        /// <inheritdoc/>
        public IInspector LastSelectedActiveOrDefaultInspector(InspectorTargetingMode targetingMode, InspectorSplittability splittability)
        {
            if (targetingMode == InspectorTargetingMode.All)
            {
                return(LastSelectedActiveOrDefaultInspector(splittability));
            }

            if (splittability == InspectorSplittability.Any)
            {
                return(LastSelectedActiveOrDefaultInspector(targetingMode));
            }

            var  wrongTargetingMode = targetingMode == InspectorTargetingMode.Hierarchy ? InspectorTargetingMode.Project : InspectorTargetingMode.Hierarchy;
            bool splittable         = splittability == InspectorSplittability.IsSplittable;

            if (LastSelectedInspector != null && LastSelectedInspector.InspectorDrawer.InspectorTargetingMode != wrongTargetingMode && LastSelectedInspector.InspectorDrawer is ISplittableInspectorDrawer == splittable)
            {
                return(LastSelectedInspector);
            }

            if (activeInspector != null && activeInspector.InspectorDrawer.InspectorTargetingMode != wrongTargetingMode && activeInspector.InspectorDrawer is ISplittableInspectorDrawer == splittable)
            {
                return(activeInspector);
            }

            for (int n = activeInstances.Count - 1; n >= 0; n--)
            {
                if (activeInstances[n].InspectorDrawer.InspectorTargetingMode != wrongTargetingMode && activeInstances[n].InspectorDrawer is ISplittableInspectorDrawer == splittable)
                {
                    return(activeInstances[n]);
                }
            }

            return(null);
        }
Esempio n. 2
0
        /// <inheritdoc/>
        public IInspector LastSelectedActiveOrDefaultInspector(InspectorTargetingMode targetingMode)
        {
            if (targetingMode == InspectorTargetingMode.All)
            {
                return(LastSelectedActiveOrDefaultInspector());
            }

            var wrongTargetingMode = targetingMode == InspectorTargetingMode.Hierarchy ? InspectorTargetingMode.Project : InspectorTargetingMode.Hierarchy;

            if (LastSelectedInspector != null && LastSelectedInspector.InspectorDrawer.InspectorTargetingMode != wrongTargetingMode)
            {
                return(LastSelectedInspector);
            }

            if (activeInspector != null && activeInspector.InspectorDrawer.InspectorTargetingMode != wrongTargetingMode)
            {
                return(activeInspector);
            }

            for (int n = activeInstances.Count - 1; n >= 0; n--)
            {
                if (activeInstances[n].InspectorDrawer.InspectorTargetingMode != wrongTargetingMode)
                {
                    return(activeInstances[n]);
                }
            }

            return(null);
        }