Esempio n. 1
0
        private static void ApplyRecursive(Transform transform, StaticEditorFlags staticFlags)
        {
            GameObjectUtility.SetStaticEditorFlags(transform.gameObject, staticFlags);

            foreach (Transform child in transform)
            {
                HierarchyProEditorStaticFlags.ApplyRecursive(child, staticFlags);
            }
        }
        //private HierarchyProEditorRenderers renderers;
        //private HierarchyProEditorColliders colliders;

        public HierarchyProEditor(GameObject gameObject)
        {
            this.gameObject  = gameObject;
            this.staticFlags = new HierarchyProEditorStaticFlags(this);
            this.components  = new HierarchyProEditorComponents(this);
            this.prefabs     = new HierarchyProEditorPrefabs(this);
            this.layersTags  = new HierarchyProEditorLayersTags(this);

            //this.colliders = new HierarchyProEditorColliders(this);
            //this.renderers = new HierarchyProEditorRenderers(this);
        }
Esempio n. 3
0
        public override void Draw(Rect rect)
        {
            if (GUI.Button(rect, GUIContent.none, EditorStyles.label))
            {
                if (Event.current.shift)
                {
                    if (EditorUtility.DisplayDialog("Apply to children?", "Do you want to apply these flags to all child objects?", "Yes", "No"))
                    {
                        HierarchyProEditorStaticFlags.ApplyRecursive(this.Transform, this.StaticFlags);
                    }
                }
                else
                {
                    this.ShowMenu();
                }
            }

            Rect  iconRect;
            Color disconnectedColor, disconnectedTint = new Color(0.3f, 0.3f, 0.3f, 0.1f);
            Color activeColor = !this.GameObject.activeInHierarchy && this.GameObject.activeSelf ? Color.gray : Color.white;

            Rect left = new Rect(rect)
            {
                width = rect.width / 7, height = (rect.height - 4) / 2, y = rect.y + 2
            };

            disconnectedColor = (this.StaticFlags & StaticEditorFlags.LightmapStatic) > 0 ? Color.white : disconnectedTint;
            iconRect          = left.GetCenteredIconRect(HierarchyProEditorIcons.Pin, false);
            GUI.color         = HierarchyProEditorColors.Red.Pastel * activeColor * disconnectedColor;
            GUI.DrawTexture(iconRect, HierarchyProEditorIcons.Pin);

            left.x           += left.width;
            left.y           += left.height;
            disconnectedColor = (this.StaticFlags & StaticEditorFlags.BatchingStatic) > 0 ? Color.white : disconnectedTint;
            iconRect          = left.GetCenteredIconRect(HierarchyProEditorIcons.Pin, false);
            GUI.color         = HierarchyProEditorColors.Orange.Pastel * activeColor * disconnectedColor;
            GUI.DrawTexture(iconRect, HierarchyProEditorIcons.Pin);

            left.x           += left.width;
            left.y           -= left.height;
            disconnectedColor = (this.StaticFlags & StaticEditorFlags.NavigationStatic) > 0 ? Color.white : disconnectedTint;
            iconRect          = left.GetCenteredIconRect(HierarchyProEditorIcons.Pin, false);
            GUI.color         = HierarchyProEditorColors.Yellow.Pastel * activeColor * disconnectedColor;
            GUI.DrawTexture(iconRect, HierarchyProEditorIcons.Pin);

            left.x           += left.width;
            left.y           += left.height;
            disconnectedColor = (this.StaticFlags & StaticEditorFlags.OccludeeStatic) > 0 ? Color.white : disconnectedTint;
            iconRect          = left.GetCenteredIconRect(HierarchyProEditorIcons.Pin, false);
            GUI.color         = HierarchyProEditorColors.Green.Pastel * activeColor * disconnectedColor;
            GUI.DrawTexture(iconRect, HierarchyProEditorIcons.Pin);

            left.x           += left.width;
            left.y           -= left.height;
            disconnectedColor = (this.StaticFlags & StaticEditorFlags.OccluderStatic) > 0 ? Color.white : disconnectedTint;
            iconRect          = left.GetCenteredIconRect(HierarchyProEditorIcons.Pin, false);
            GUI.color         = HierarchyProEditorColors.Blue.Pastel * activeColor * disconnectedColor;
            GUI.DrawTexture(iconRect, HierarchyProEditorIcons.Pin);

            left.x           += left.width;
            left.y           += left.height;
            disconnectedColor = (this.StaticFlags & StaticEditorFlags.OffMeshLinkGeneration) > 0 ? Color.white : disconnectedTint;
            iconRect          = left.GetCenteredIconRect(HierarchyProEditorIcons.Pin, false);
            GUI.color         = HierarchyProEditorColors.Indigo.Pastel * activeColor * disconnectedColor;
            GUI.DrawTexture(iconRect, HierarchyProEditorIcons.Pin);

            left.x           += left.width;
            left.y           -= left.height;
            disconnectedColor = (this.StaticFlags & StaticEditorFlags.ReflectionProbeStatic) > 0 ? Color.white : disconnectedTint;
            iconRect          = left.GetCenteredIconRect(HierarchyProEditorIcons.Pin, false);
            GUI.color         = HierarchyProEditorColors.Violet.Pastel * activeColor * disconnectedColor;
            GUI.DrawTexture(iconRect, HierarchyProEditorIcons.Pin);

            GUI.color = Color.white;
        }