浏览代码

Merge pull request #212 from Unity-Technologies/uniform-toggle-fix

Fixed categorical parameter uniform toggle issues in HDRP
/main
GitHub 4 年前
当前提交
d2c4ec52
共有 4 个文件被更改,包括 16 次插入10 次删除
  1. 2
      com.unity.perception/CHANGELOG.md
  2. 4
      com.unity.perception/Editor/Randomization/Uss/Styles.uss
  3. 6
      com.unity.perception/Editor/Randomization/VisualElements/Parameter/CategoricalOptionElement.cs
  4. 14
      com.unity.perception/Editor/Randomization/VisualElements/Parameter/ParameterElement.cs

2
com.unity.perception/CHANGELOG.md


### Fixed
Fixed a null reference error that appeared when adding options to categorical parameters.
Fixed ground truth not properly produced when there are other disabled PerceptionCameras present. Note: this does not yet add support for multiple enabled PerceptionCameras.
## [0.7.0-preview.2] - 2021-02-08

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;

正在加载...
取消
保存