|
|
|
|
|
|
.FindPropertyRelative(nameof(SemanticSegmentationLabelEntry.label))); |
|
|
|
addedLabel.colorField.BindProperty(m_SerializedLabelsArray.GetArrayElementAtIndex(i) |
|
|
|
.FindPropertyRelative(nameof(SemanticSegmentationLabelEntry.color))); |
|
|
|
addedLabel.hexLabel.text = "#"+ColorUtility.ToHtmlStringRGBA(m_SerializedLabelsArray.GetArrayElementAtIndex(i) |
|
|
|
.FindPropertyRelative(nameof(SemanticSegmentationLabelEntry.color)).colorValue); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
protected override string UxmlPath => k_UxmlDir + "ColoredLabelElementInLabelConfig.uxml"; |
|
|
|
|
|
|
|
public ColorField colorField; |
|
|
|
public Label hexLabel; |
|
|
|
|
|
|
|
public ColoredLabelElementInLabelConfig(LabelConfigEditor<SemanticSegmentationLabelEntry> editor, SerializedProperty labelsArray) : base(editor, labelsArray) |
|
|
|
{ } |
|
|
|
|
|
|
colorField = this.Q<ColorField>("label-color-value"); |
|
|
|
hexLabel = this.Q<Label>("label-color-hex"); |
|
|
|
|
|
|
|
colorField.RegisterValueChangedCallback((cEvent) => |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
Debug.LogWarning("A label with the chosen color " + cEvent.newValue + " has already been added to this label configuration."); |
|
|
|
} |
|
|
|
|
|
|
|
hexLabel.text = "#"+ColorUtility.ToHtmlStringRGBA(colorField.value); |
|
|
|
}); |
|
|
|
|
|
|
|
} |