Exemple #1
0
        ///<inheritdoc/>
        public override VisualElement CreateInspectorGUI()
        {
            var rootElement = new VisualElement();

            UIElementsEditorUtilities.CreatePropertyFields(serializedObject, rootElement);
            return(rootElement);
        }
        public SamplerElement(SerializedProperty property)
        {
            var template = AssetDatabase.LoadAssetAtPath <VisualTreeAsset>(
                $"{StaticData.uxmlDir}/Sampler/SamplerElement.uxml");

            template.CloneTree(this);

            var displayName = this.Q <Label>("display-name");

            displayName.text = property.displayName;

            var fieldsContainer = this.Q <VisualElement>("fields-container");

            UIElementsEditorUtilities.CreatePropertyFields(property, fieldsContainer);
        }
Exemple #3
0
        void CreatePropertyFields()
        {
            m_InspectorPropertiesContainer = m_Root.Q <VisualElement>("inspector-properties");
            m_InspectorPropertiesContainer.Clear();

            m_ConstantsListVisualContainer = m_Root.Q <VisualElement>("constants-list");
            m_ConstantsListVisualContainer.Clear();

            var foundProperties = false;

            m_HasConstantsField = false;

            var iterator = m_SerializedObject.GetIterator();

            iterator.NextVisible(true);
            iterator.NextVisible(false);
            do
            {
                switch (iterator.name)
                {
                case "m_Randomizers":
                    m_RandomizerListPlaceholder.Add(new RandomizerList(iterator.Copy()));
                    break;

                case "constants":
                    m_HasConstantsField = true;
                    UIElementsEditorUtilities.CreatePropertyFields(iterator.Copy(), m_ConstantsListVisualContainer);
                    break;

                default:
                {
                    foundProperties = true;
                    var propertyField = UIElementsEditorUtilities.CreatePropertyField(iterator, m_Scenario.GetType());
                    m_InspectorPropertiesContainer.Add(propertyField);
                    break;
                }
                }
            } while (iterator.NextVisible(false));

            if (!foundProperties)
            {
                m_InspectorPropertiesContainer.style.display = new StyleEnum <DisplayStyle>(DisplayStyle.None);
            }
        }
Exemple #4
0
 void CreatePropertyFields()
 {
     m_RangeProperty = null;
     m_PropertiesContainer.Clear();
     UIElementsEditorUtilities.CreatePropertyFields(m_Property, m_PropertiesContainer);
 }