コード例 #1
0
        public JointField(Asset asset, SerializedProperty property, Asset.Metric metric)
        {
            m_Asset    = asset;
            m_Property = property;
            m_Metric   = metric;

            Foldout foldout = new Foldout {
                text = "Joints"
            };

            foldout.AddToClassList("jointToggle");
            foldout.value = property.isExpanded;
            Add(foldout);

            foldout.RegisterValueChangedCallback(evt => ToggleListVisibility());

            Add(m_ListView);
            m_ListView.AddToClassList("jointsListView");
            m_ListView.style.display = property.isExpanded ? DisplayStyle.Flex : DisplayStyle.None;
            Rebuild();

            RegisterCallback <AttachToPanelEvent>(OnAttachToPanel);
            RegisterCallback <DetachFromPanelEvent>(OnDetachFromPanel);

            focusable = true;

            m_ForceDisabled = false;
        }
コード例 #2
0
 void AddMetric()
 {
     Undo.RecordObject(m_Asset, k_AddTooltip);
     Asset.Metric newMetric = Asset.Metric.Copy(Asset.k_DefaultMetric);
     newMetric.TagTypes.Clear();
     newMetric.name = "New Metric";
     m_Asset.AddMetric(newMetric);
     RebuildRegisteredMetricsEditors();
 }