浏览代码

fixed categorical parameter uniform toggle issues in HDRP

/main
the-gooniest 4 年前
当前提交
6f563595
共有 3 个文件被更改,包括 14 次插入10 次删除
  1. 4
      com.unity.perception/Editor/Randomization/Uss/Styles.uss
  2. 6
      com.unity.perception/Editor/Randomization/VisualElements/Parameter/CategoricalOptionElement.cs
  3. 14
      com.unity.perception/Editor/Randomization/VisualElements/Parameter/ParameterElement.cs

4
com.unity.perception/Editor/Randomization/Uss/Styles.uss


flex-shrink: 0;
}
.parameter__categorical-option-property-field Label.unity-property-field__label {
display: none;
}
.parameter__categorical-options-list-button {
align-self: flex-end;
border-width: 0;

6
com.unity.perception/Editor/Randomization/VisualElements/Parameter/CategoricalOptionElement.cs


{
class CategoricalOptionElement : VisualElement
{
SerializedProperty m_CategoryProperty;
SerializedProperty m_CategoryProperty;
SerializedProperty m_ProbabilitiesProperty;
internal CategoricalOptionElement(

var optionProperty = m_CategoryProperty.GetArrayElementAtIndex(i);
var option = this.Q<PropertyField>("option");
option.BindProperty(optionProperty);
// Remove the redundant element label to save space
var label = option.Q<Label>();
label.parent.Remove(label);
var probabilityProperty = m_ProbabilitiesProperty.GetArrayElementAtIndex(i);
var probability = this.Q<FloatField>("probability");

14
com.unity.perception/Editor/Randomization/VisualElements/Parameter/ParameterElement.cs


var uniformProperty = m_SerializedProperty.FindPropertyRelative("uniform");
uniformToggle.BindProperty(uniformProperty);
if (uniformToggle.value)
listView.AddToClassList("collapsed");
else
listView.RemoveFromClassList("collapsed");
void ToggleUniform()
{
if (uniformToggle.value)
listView.AddToClassList("collapsed");
else
listView.RemoveFromClassList("collapsed");
}
ToggleUniform();
if (Application.isPlaying)
uniformToggle.SetEnabled(false);

listView.ToggleInClassList("collapsed");
ToggleUniform();
if (!evt.newValue)
return;
var numOptions = optionsProperty.arraySize;

正在加载...
取消
保存