浏览代码

Now with sliders in UI for transparency values

/aisv647_visualizations
Steven Borkman 4 年前
当前提交
ab4932e0
共有 2 个文件被更改,包括 24 次插入0 次删除
  1. 24
      com.unity.perception/Runtime/GroundTruth/Labelers/SemanticSegmentationLabeler.cs
  2. 0
      .gitmodules

24
com.unity.perception/Runtime/GroundTruth/Labelers/SemanticSegmentationLabeler.cs


Dictionary<int, AsyncAnnotation> m_AsyncAnnotations;
private float defaultSegmentTransparency = 0.8f;
private float defaultBackgroundTransparency = 0.0f;
/// <summary>
/// Creates a new SemanticSegmentationLabeler. Be sure to assign <see cref="labelConfig"/> before adding to a <see cref="PerceptionCamera"/>.
/// </summary>

EnableVisualization(enabled);
});
defaultSegmentTransparency = 0.8f;
defaultBackgroundTransparency = 0.0f;
var slider = GameObject.Instantiate(Resources.Load<GameObject>("GenericSlider"));
slider.transform.SetParent(panel.transform);
slider.GetComponentInChildren<Text>().text = "Object Alpha";
slider.GetComponentInChildren<Slider>().value = defaultSegmentTransparency;
slider.GetComponentInChildren<Slider>().onValueChanged.AddListener(val => {
if (segImage != null) segImage.material.SetFloat("_SegmentTransparency", val);
});
slider = GameObject.Instantiate(Resources.Load<GameObject>("GenericSlider"));
slider.transform.SetParent(panel.transform);
slider.GetComponentInChildren<Text>().text = "Background Alpha";
slider.GetComponentInChildren<Slider>().value = defaultBackgroundTransparency;
slider.GetComponentInChildren<Slider>().onValueChanged.AddListener(val => {
if (segImage != null) segImage.material.SetFloat("_BackTransparency", val);
});
segVisual = GameObject.Instantiate(Resources.Load<GameObject>("SegmentTexture"));
segVisual.transform.SetParent(panel.transform.parent, false);

segImage = segVisual.GetComponent<Image>();
segImage.material.SetFloat("_SegmentTransparency", defaultSegmentTransparency);
segImage.material.SetFloat("_BackTransparency", defaultBackgroundTransparency);
RectTransform rt = segVisual.transform as RectTransform;
rt.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, camWidth);

0
.gitmodules

正在加载...
取消
保存