Пример #1
0
        static void RenderHierarchyItem(int instanceID, ChiselNode node, Rect selectionRect)
        {
            if (!ChiselSceneGUIStyle.isInitialized)
            {
                return;
            }
            var model = node as ChiselModel;

            if (!ReferenceEquals(model, null))
            {
                if (model == ChiselModelManager.ActiveModel)
                {
                    var content = EditorGUIUtility.TrTempContent(node.name + " (active)");

                    bool selected = GUIView.HasFocus && Selection.Contains(instanceID);
                    GUI.Label(selectionRect, content, selected ? ChiselSceneGUIStyle.inspectorSelectedLabel : ChiselSceneGUIStyle.inspectorLabel);
                }
            }

            var icon = ChiselNodeDetailsManager.GetHierarchyIcon(node);

            if (icon != null)
            {
                RenderIcon(selectionRect, icon);
            }
        }
Пример #2
0
        static void RenderHierarchyItem(int instanceID, ChiselNode node, Rect selectionRect)
        {
            var model = node as ChiselModel;

            if (!ReferenceEquals(model, null))
            {
                if (model == ChiselModelManager.ActiveModel)
                {
                    const float kIconSize     = 16;
                    const float kOffsetToText = 0.0f;
                    //const float kOffsetToText = 24.0f;  // this used to be a random '24' in another version of unity?

                    var rect = selectionRect;
                    rect.xMin += kIconSize + kOffsetToText;

                    var content = EditorGUIUtility.TrTempContent(node.name + " (active)");

                    // TODO: figure out correct color depending on selection and proSkin

                    GUI.Label(rect, content);
                    rect.xMin += 0.5f;
                    GUI.Label(rect, content);
                }
            }

            var icon = ChiselNodeDetailsManager.GetHierarchyIcon(node);

            if (icon != null)
            {
                RenderIcon(selectionRect, icon);
            }
        }
        static void RenderHierarchyItem(int instanceID, ChiselNode node, Rect selectionRect)
        {
            if (!ChiselSceneGUIStyle.isInitialized)
            {
                return;
            }
            var model = node as ChiselModel;

            if (!ReferenceEquals(model, null))
            {
                if (model == ChiselModelManager.ActiveModel)
                {
                    var content = EditorGUIUtility.TrTempContent(node.name + " (active)");

                    bool selected = GUIView.HasFocus && Selection.Contains(instanceID);
                    GUI.Label(selectionRect, content, selected ? ChiselSceneGUIStyle.inspectorSelectedLabel : ChiselSceneGUIStyle.inspectorLabel);
                }
            }

            var active = node.isActiveAndEnabled;

            if (active)
            {
                var icon = ChiselNodeDetailsManager.GetHierarchyIcon(node, out bool hasValidState);
                if (icon != null)
                {
                    RenderIcon(selectionRect, icon);
                }

                if (!hasValidState)
                {
                    var warningIcon = sWarningContent;
                    if (warningIcon != null)
                    {
                        RenderIcon(selectionRect, warningIcon);
                    }
                }
            }
            else
            {
                var icon = ChiselNodeDetailsManager.GetHierarchyIcon(node);
                if (icon != null)
                {
                    var prevColor = GUI.color;
                    var newColor  = prevColor;
                    newColor.a *= 0.25f;
                    GUI.color   = newColor;
                    RenderIcon(selectionRect, icon);
                    GUI.color = prevColor;
                }
            }
        }
        internal static void OnHierarchyWindowItemGUI(CSGNode node, Rect selectionRect)
        {
            // TODO: implement material drag & drop support on hierarchy items

            if (Event.current.type != EventType.Repaint)
            {
                return;
            }

            var icon = ChiselNodeDetailsManager.GetHierarchyIcon(node);

            if (icon != null)
            {
                RenderIcon(selectionRect, icon);
            }
        }