Ejemplo n.º 1
0
        public void Update()
        {
            ShowGraphSettings_Internal(m_GraphSettingsContainer);

            m_NodeSettingsContainer.Clear();

            try
            {
                bool anySelectables = false;
                foreach (var selectable in selection)
                {
                    if (selectable is IInspectable inspectable)
                    {
                        DrawInspectable(m_NodeSettingsContainer, inspectable);
                        anySelectables = true;
                    }
                }
                if (anySelectables)
                {
                    // Anything selectable in the graph (GraphSettings not included) is only ever interacted with through the
                    // Node Settings tab so we can make the assumption they want to see that tab
                    m_GraphInspectorView.Activate(m_GraphInspectorView.Q <TabButton>("NodeSettingsButton"));
                }
            }
            catch (Exception e)
            {
                Debug.LogError(e);
            }

            // Store this for update checks later, copying list deliberately as we dont want a reference
            m_CachedSelectionList = new List <ISelectable>(selection);

            m_NodeSettingsContainer.MarkDirtyRepaint();
        }
Ejemplo n.º 2
0
        public InspectorView(GraphView graphView) : base(graphView)
        {
            m_GraphInspectorView     = m_MainContainer.Q <TabbedView>("GraphInspectorView");
            m_GraphSettingsContainer = m_GraphInspectorView.Q <VisualElement>("GraphSettingsContainer");
            m_NodeSettingsContainer  = m_GraphInspectorView.Q <VisualElement>("NodeSettingsContainer");
            m_ContentContainer.Add(m_GraphInspectorView);

            var unregisteredPropertyDrawerTypes = TypeCache.GetTypesDerivedFrom <IPropertyDrawer>().ToList();

            foreach (var type in unregisteredPropertyDrawerTypes)
            {
                RegisterPropertyDrawer(type);
            }

            // By default at startup, show graph settings
            m_GraphInspectorView.Activate(m_GraphInspectorView.Q <TabButton>("GraphSettingsButton"));
        }
Ejemplo n.º 3
0
        public InspectorView(InspectorViewModel viewModel) : base(viewModel)
        {
            m_GraphInspectorView     = m_MainContainer.Q <TabbedView>("GraphInspectorView");
            m_GraphSettingsContainer = m_GraphInspectorView.Q <VisualElement>("GraphSettingsContainer");
            m_NodeSettingsContainer  = m_GraphInspectorView.Q <VisualElement>("NodeSettingsContainer");
            m_MaxItemsMessageLabel   = m_GraphInspectorView.Q <Label>("maxItemsMessageLabel");
            m_ContentContainer.Add(m_GraphInspectorView);

            isWindowScrollable = true;
            isWindowResizable  = true;

            var unregisteredPropertyDrawerTypes = TypeCache.GetTypesDerivedFrom <IPropertyDrawer>().ToList();

            foreach (var type in unregisteredPropertyDrawerTypes)
            {
                RegisterPropertyDrawer(type);
            }

            // By default at startup, show graph settings
            m_GraphInspectorView.Activate(m_GraphInspectorView.Q <TabButton>("GraphSettingsButton"));
        }
Ejemplo n.º 4
0
        public void Update()
        {
            ShowGraphSettings_Internal(m_GraphSettingsContainer);

            m_NodeSettingsContainer.Clear();
            m_CurrentlyInspectedElementsCount = 0;

            try
            {
                bool anySelectables = false;
                foreach (var selectable in selection)
                {
                    if (selectable is IInspectable inspectable)
                    {
                        DrawInspectable(m_NodeSettingsContainer, inspectable);
                        m_CurrentlyInspectedElementsCount++;
                        anySelectables = true;
                    }

                    if (m_CurrentlyInspectedElementsCount == k_InspectorElementLimit)
                    {
                        m_NodeSettingsContainer.Add(m_MaxItemsMessageLabel);
                        m_MaxItemsMessageLabel.style.visibility = Visibility.Visible;
                        break;
                    }
                }
                if (anySelectables && forceNodeView)
                {
                    // Anything selectable in the graph (GraphSettings not included) is only ever interacted with through the
                    // Node Settings tab so we can make the assumption they want to see that tab
                    m_GraphInspectorView.Activate(m_GraphInspectorView.Q <TabButton>("NodeSettingsButton"));
                }
            }
            catch (Exception e)
            {
                Debug.LogError(e);
            }

            if (doesInspectorNeedUpdate)
            {
                doesInspectorNeedUpdate = false;
            }

            m_NodeSettingsContainer.MarkDirtyRepaint();
        }