static internal void Draw(h2Info info, Rect r, GameObject go)
        {
            if (h2Info.SelectionCount < 2)
            {
                return;
            }

            var idx = Array.IndexOf(h2Info.SelectedInstIDs, info.instID);

            if (idx == -1)
            {
                return;
            }

            using (GuiX.GUIColor(go == Selection.activeGameObject ? Color.red : Color.white)) {
                GUI.DrawTexture(r, EditorResource.GetTexture2D("circle"));
            }

            if (r.xLMB_isDown().noModifier)
            {
                //var instList = Selection.instanceIDs;
                Selection.activeInstanceID = go.GetInstanceID();
                Selection.instanceIDs      = h2Info.SelectedInstIDs;
            }
        }
        static internal void Draw(h2Info info, Rect r, GameObject go)
        {
            _api = (_api ?? (_api = new h2Active()));

            //TODO : read if info.Active == 0
            _api.texColor = info.Active == h2iActiveState.Changed ? _api.texColorChanged : _api.texColorOrg;
            _api.DrawTarget(r, go, (go.activeSelf && !go.activeInHierarchy) ? 2 : -1);
        }
        internal static float DrawIcons(h2Info info)
        {
            var offset = currentIconMode * (h2Settings.nIcons + 1);

            if (_iconModes == null)
            {
                h2LoadIconModes();
            }

            var r  = info.drawRect;
            var go = info.go;

            //Debug.Log("Draw :: " + Event.current.type + ":" + _iconModes[offset + 7]);
            //if (_iconModes[offset + 7]) h2Tag.Draw(info, r.xSubRight(out r, h2Tag.MaxWidth), go);
            if (_iconModes[offset + 0])
            {
                h2Script.Draw(info, r.xSubRight(out r, 6f), go);
            }
            if (_iconModes[offset + 1])
            {
                h2Lock.Draw(info, r.xSubRight(out r, 16f), go);
            }
            if (_iconModes[offset + 2])
            {
                h2Active.Draw(info, r.xSubRight(out r, 16f, 4f), go);
            }
            if (_iconModes[offset + 3])
            {
                h2Static.Draw(info, r.xSubRight(out r, 16f), go);
            }
            if (_iconModes[offset + 4])
            {
                h2Combine.Draw(info, r.xSubRight(out r, h2Combine.MaxWidth), go);
            }
            if (_iconModes[offset + 8])
            {
                h2Depth.Draw(info, r.xSubRight(out r, h2Depth.maxWidth), go);
            }
            if (_iconModes[offset + 5])
            {
                h2Prefab.Draw(info, r.xSubRight(out r, 14f), go);
            }
            if (_iconModes[offset + 6])
            {
                h2Layer.Draw(info, r.xSubRight(out r, h2Layer.maxWidth), go);
            }
            if (_iconModes[offset + 7])
            {
                h2Tag.Draw(info, r.xSubRight(out r, h2Tag.MaxWidth), go);
            }

            h2Component.Draw(info, r.xSubRight(out r, h2Component.MaxWidth), go);
            //h2SelectionHL.Draw(info, r.xSubRight(out r, 16f), go);

            return(info.drawRect.width - r.width);
        }
        static public void Draw(h2Info info, Rect r, GameObject go)
        {
            if (info.drawRect.xRMB_isDown().with_Ctrl)
            {
                if (Selection.activeGameObject != go)
                {
                    Selection.activeGameObject = go;
                }

                Targets = h2Info.SelectedGameObjects;
                Get(info).ShowAsContext();
            }
        }
        internal static void Draw(h2Info info, Rect r, GameObject go)
        {
            checkPrefab(info);

            if (info.Prefab == null)
            {
                return;
            }

            using (GuiX.DisableGroup(info.Prefab.type == PrefabType.MissingPrefabInstance)) {
                if (r.xMiniTag(info.Prefab.label, getTexture(info.Prefab.type)))
                {
                    go.xSelectPrefab();
                }
            }
        }
        static void OnDrawGO(h2Info info, Rect r)
        {
            if (info == null || info.go == null)
            {
                //info / go can be null if GameObjects being destroyed
                return;
            }

            info.drawRect = r.xOffset(h2Settings.iconOffset);//thirdPartyOffset +
            if (Event.current.type == EventType.Repaint)
            {
                if (_inspectorLocked == info.instID)
                {
                    r.xDrawBar(null, Color.red.xAlpha(0.2f));
                }
            }
            //AddTrackPoint("CalculateRect");
            h2Context.Draw(info, r, info.go);
            //AddTrackPoint("DrawContext");
            h2GameObjectHL.Draw(info, r, info.go);
            //AddTrackPoint("DrawGOHL");
            _width = Mathf.Max(_width, h2IconMode.DrawIcons(info));
            //AddTrackPoint("Draw Icons");

            //var r = info.drawRect;
            //var go = info.go;

            //h2Layer.Draw(r.xSubRight(out r, 40f), go);
            //h2Tag.Draw(info, r.xSubRight(out r, 70f));
            //h2Prefab.Draw(info, r.xSubRight(out r, 16f));

            //still long way to go, man ....

            //customscript icons
            //explorer & highlight objects collection

            //quickFind
            //quickInfo
            // Camera snapshot

            //PrefabEvo
            //MultiScene
            //FavoriteTabs
            //uScript
            //BehaviorDesigner
        }
Exemple #7
0
        internal static void Draw(h2Info info, Rect r, GameObject go)
        {
            if (depthColors == null)
            {
                depthColors = h2Settings.color_Layers;
                depthTex    = new Texture2D[depthColors.Length];
                return;
            }

            var tInfo = info.Transform;

            if (Event.current.type == EventType.Repaint)
            {
                var l   = depthColors.Length;
                var idx = tInfo.parentCount % l;
                var tex = depthTex[idx];
                if (tex == null)
                {
                    tex           = depthColors[idx].xGetTexture2D();
                    depthTex[idx] = tex;
                }

                GUI.DrawTexture(r.dx(maxWidth - (tInfo.parentCount - min + 1) * DepthBarWidth).w(DepthBarWidth), tex);
            }

            /* - (HLFull ? 1 : 0)#1#;
             *
             * if (c < 0) return; //don't highlight level 0 on full mode
             *
             *
             *
             * /*if (HLFull) {
             *  r.width = r.x + r.width;
             *  r.x = 0;
             * } else {#1#
             *  var w = c*DepthBarWidth + 4f;
             *  r.x = r.x + r.width - w;
             *  r.width = DepthBarWidth;
             * /*}#1#
             *
             * //Debug.Log("settings.h2_depthColors="+ settings.h2_depthColors);
             * var depthColors = h2Settings.color_Depths;
             * GUI.DrawTexture(r, depthColors[c % depthColors.Length].xGetTexture2D());
             *  //.Alpha(0.5f).Adjust(0.3f)*/
        }
Exemple #8
0
        static internal void Draw(h2Info info, Rect r, GameObject go)
        {
            if (Event.current.type != EventType.Repaint)
            {
                return;                                          //only draw on repaint
            }
            var cInfo = info.Component;

            if (cInfo.status == h2cScriptStatus.NO_SCRIPT)
            {
                return;
            }

            var rr = useOldDepthStyle ? r.w(20f).dx(-17f) : r.w(4f).dx(3f);

            GUI.DrawTexture(rr, (cInfo.status == h2cScriptStatus.MISSING) ?
                            missingTex ?? (missingTex = ColorHSL.red.xProSkinAdjust(0.1f).xGetTexture2D()) :
                            scriptTex ?? (scriptTex = ColorHSL.green.xProSkinAdjust(0.1f).xGetTexture2D())
                            );
        }
Exemple #9
0
        static internal void Draw(h2Info info, Rect r, GameObject go)
        {
            if (go.layer == 0)
            {
                return;                //ignore default layer
            }
            if (layerMap == null)
            {
                RefreshCache();
            }

            if (Event.current.type == EventType.Repaint)
            {
                var layer = layerMap[go.layer];
                var d     = r.width - info.Transform.szLayer;
                r.xMin += d;

                GUI.DrawTexture(r, layer.bg);
                GUI.Label(r, layer.title, EditorStyles.miniLabel);
            }
        }
Exemple #10
0
        static internal void Draw(h2Info info, Rect r, GameObject go)
        {
            //Debug.Log("Draw xxx :: " + info.lbTag + ": " + info.tagWidth + ":" + go);
            var tInfo = info.Transform;

            if (string.IsNullOrEmpty(tInfo.lbTag))
            {
                return;
            }

            if (Event.current.type == EventType.Repaint)
            {
                if (bgTex == null)
                {
                    bgTex = ColorHSL.cyan.xProSkinAdjust().xGetTexture2D();
                }

                GUI.DrawTexture(r, bgTex);
                GUI.Label(r, tInfo.lbTag, EditorStyles.miniLabel);
            }
        }
Exemple #11
0
        static internal void Draw(h2Info info, Rect r, GameObject go)
        {
            var tInfo = info.Transform;

            if (tInfo.childCount == 0)
            {
                return;
            }

            Api.target = info.go;
            var value = _api.Get(info.go);

            if (r.Contains(Event.current.mousePosition))
            {
                _api.ReadModifier().ReadMouse().Check();
            }
            r.xMiniButton(info.Transform.lbCombine, false, 1f, value);
            if (_api.maxChildCount < tInfo.childCount)
            {
                _api.maxChildCount = tInfo.childCount;
            }
        }
        internal static void Draw(h2Info info, Rect r, GameObject go)
        {
            if (!showComponents)
            {
                return;
            }
            //if ((info.detail & h2iDetail.Component) == 0) info.ReadComponentInfo();

            var arr = info.Component.components;
            var w   = 0;
            var r0  = r.dl(r.width - 16f);

            for (var i = 0; i < arr.Count; i++)
            {
                var c = arr[i];

                if (c == null)
                {
                    continue;
                }
                if (!showUnusual && (c is Transform || c is MeshFilter
#if UNITY_4_6 || UNITY_5
                                     || c is CanvasRenderer
#endif
                                     ))
                {
                    continue;
                }
                if (!showRender && (c is Renderer || c is MeshFilter
#if UNITY_4_6 || UNITY_5
                                    || c is CanvasRenderer
#endif
                                    ))
                {
                    continue;
                }
                if (!showPhysics && (c is Collider || c is Rigidbody || c is Rigidbody2D || c is Collider2D))
                {
                    continue;
                }

                var icon      = AssetPreview.GetMiniThumbnail(c);
                var hasProp   = arr[i].xHasProperty("enabled");
                var willClear = hasProp && !(bool)arr[i].xGetProperty("enabled");

                using (GuiX.GUIColor(willClear ? Color.clear.xAlpha(0.2f) : Color.white)) {// :
                    GUI.DrawTexture(r0, icon);

                    if (Selection.activeGameObject == go && hasProp && r0.xLMB_isDown().noModifier)
                    {
                        Undo.RecordObject(c, "Toggle enable");
                        c.xSetProperty("enabled", willClear);
                        WindowX.Inspector.Repaint();
                    }
                }

                r0 = r0.dx(-16f);
                w += 16;
            }

            if (MaxWidth < w)
            {
                MaxWidth = w;
            }
        }
Exemple #13
0
 static internal void Draw(h2Info info, Rect r, GameObject go)
 {
     (_api ?? (_api = new h2Lock())).DrawTarget(r, go);
 }
Exemple #14
0
        public static void checkPrefab(h2Info info)
        {
            if (info.prefabTimeStamp == h2Info.timeStamp)
            {
                return;
            }
            info.prefabTimeStamp = h2Info.timeStamp;

            var go         = info.go;
            var prefabType = PrefabUtility.GetPrefabType(go);

            if (prefabType == PrefabType.None)
            {
                return;
            }

            var Prefab = info.Prefab;

            if (Prefab != null)   //clear old prefab info
            {
                var arr = Prefab.childrenInstIDs;

                for (var i = 0; i < arr.Count; i++)
                {
                    var info1 = h2Info.Get(arr[i]);
                    if (info1 != null)
                    {
                        info1.Prefab = null;
                    }
                }
            }

            var rootGO = PrefabUtility.FindRootGameObjectWithSameParentPrefab(go);

            if (rootGO != go)
            {
                var rootInfo = h2Info.Get(rootGO.GetInstanceID(), true);
                if (rootInfo.Prefab == null)
                {
                    checkPrefab(rootInfo);
                }
                Prefab = rootInfo.Prefab;
                if (Prefab.childrenInstIDs.Contains(info.instID))
                {
                    Debug.LogWarning("Something went wrong ... a prefab being check-in twice into its Root");
                }
                Prefab.childrenInstIDs.Add(info.instID);
            }
            else
            {
                var p = (GameObject)PrefabUtility.GetPrefabParent(rootGO);
                info.Prefab = new h2iPrefab
                {
                    type            = prefabType,
                    prefab          = p,
                    label           = p.name,
                    rootInstID      = info.instID,
                    childrenInstIDs = new List <int> {
                        info.instID
                    }
                };
            }
        }
        internal static void Draw(h2Info info, Rect r, GameObject go)
        {
            var hl = info.Highlight;

            if (info.highlightTimeStamp < h2Info.timeStamp)  //not yet checked
            {
                info.highlightTimeStamp = h2Info.timeStamp;
                info.Highlight          = null;

                var hlInfo = Get(go);

                if (hlInfo != null)
                {
                    hl = info.Highlight;
                    if (hl == null)
                    {
                        hl             = new h2iHighlight();
                        info.Highlight = hl;
                    }
                    hl.goHLStatus = h2HLType.Highlight;
                    hl.goHLColor  = hlInfo.c;
                }
                else
                {
                    var p = info.go.transform.parent;
                    if (p != null)
                    {
                        hlInfo = Get(p.gameObject);
                        if (hlInfo != null)
                        {
                            hl = info.Highlight;
                            if (hl == null)
                            {
                                hl             = new h2iHighlight();
                                info.Highlight = hl;
                            }

                            hl.goHLStatus = h2HLType.DirectChildren;
                            hl.goHLColor  = hlInfo.c.xAlpha(hlInfo.c.a * 0.5f);
                        }
                    }
                }
            }

            if (hl == null)
            {
                return;
            }

            var offsetX = hl.goHLStatus == h2HLType.Highlight ? 14f : 28f;
            var rr      = r.dw(offsetX).dx(-offsetX);

            //if (info.goHLStatus == h2HLType.Highlight) {
            //    GUI.DrawTexture(rr.w(2f), info.goHLColor.xAlpha(1f).xGetTexture2D());
            //}

            if ((Array.IndexOf(h2Info.SelectedInstIDs, info.instID) == -1) && info.instID != Hierarchy2.inspectorLock)
            {
                GUI.DrawTexture(rr, hl.goHLColor.xGetTexture2D());
            }
            else
            {
                GUI.DrawTexture(r.dx(-12f).w(2f), hl.goHLColor.xAlpha(1f).xGetTexture2D());
                //.DrawTexture(rr.w(rr.x).x(0), info.goHLColor.xAlpha(0.5f).xGetTexture2D());
            }
        }