Пример #1
0
        public void Refresh()
        {
            m_AttributesSection.Clear();

            if (currentVisualElement == null)
            {
                return;
            }

            m_AttributesSection.text = currentVisualElement.typeName;

            if (m_Selection.selectionType != BuilderSelectionType.Element &&
                m_Selection.selectionType != BuilderSelectionType.ElementInTemplateInstance &&
                m_Selection.selectionType != BuilderSelectionType.ElementInControlInstance)
            {
                return;
            }

            if (m_Selection.selectionType == BuilderSelectionType.ElementInTemplateInstance && string.IsNullOrEmpty(currentVisualElement.name))
            {
                var helpBox = new HelpBox();
                helpBox.AddToClassList(BuilderConstants.InspectorClassHelpBox);
                helpBox.text = BuilderConstants.NoNameElementAttributes;

                m_AttributesSection.Add(helpBox);
            }

            GenerateAttributeFields();

            // Forward focus to the panel header.
            m_AttributesSection
            .Query()
            .Where(e => e.focusable)
            .ForEach((e) => m_Inspector.AddFocusable(e));
        }
Пример #2
0
        void RefreshMatchingSelectorsContainer()
        {
            m_MatchingSelectorsFoldout.Clear();
            if (BuilderSharedStyles.IsSelectorElement(currentVisualElement))
            {
                return;
            }

            VisualElement matchingSelectors = GeneratedMatchingSelectors();

            if (matchingSelectors != null)
            {
                m_MatchingSelectorsFoldout.Add(matchingSelectors);

                // Forward focus to the panel header.
                matchingSelectors
                .Query()
                .Where(e => e.focusable)
                .ForEach((e) => m_Inspector.AddFocusable(e));
            }
            else
            {
                var label = new Label("None");
                label.AddToClassList(BuilderConstants.InspectorEmptyFoldoutLabelClassName);
                m_MatchingSelectorsFoldout.Add(label);
            }
        }
        public void Refresh()
        {
            m_AttributesSection.Clear();

            if (currentVisualElement == null)
            {
                return;
            }

            m_AttributesSection.text = currentVisualElement.typeName;

            if (m_Selection.selectionType != BuilderSelectionType.Element &&
                m_Selection.selectionType != BuilderSelectionType.ElementInTemplateInstance)
            {
                return;
            }

            GenerateAttributeFields();

            // Forward focus to the panel header.
            m_AttributesSection
            .Query()
            .Where(e => e.focusable)
            .ForEach((e) => m_Inspector.AddFocusable(e));
        }