浏览代码

Removing extra logic around enabling or disabling visualizations. Still have a bug with labelers being reset when serialized fields change, resulting in duplicate UI.

/aisv647_visualizations
Jon Hogins 4 年前
当前提交
e1f9399c
共有 2 个文件被更改,包括 4 次插入18 次删除
  1. 6
      com.unity.perception/Runtime/GroundTruth/Labelers/CameraLabeler.cs
  2. 16
      com.unity.perception/Runtime/GroundTruth/PerceptionCamera.cs

6
com.unity.perception/Runtime/GroundTruth/Labelers/CameraLabeler.cs


}
/// <summary>
/// Static counter shared by all lableler classes. If any visualizers are
/// active then perception camera cannot operate in asynchronous mode.
/// </summary>
private static int activeVisualizers = 0;
/// <summary>
/// Retrieve a handle to the visualization canvas <see cref="VisualizationCanvas"/>. This is the specific canvas that all visualization
/// labelers should be added to. The canvas has helper functions to create many common visualization components.
/// </summary>

16
com.unity.perception/Runtime/GroundTruth/PerceptionCamera.cs


[SerializeField]
public bool showVisualizations = true;
bool m_ShowingVisualizations;
/// <summary>
/// The <see cref="SensorHandle"/> associated with this camera. Use this to report additional annotations and metrics at runtime.
/// </summary>

}
#endif
VisualizationCanvas visualizationCanvas => isVisualizedPerceptionCamera ? s_VisualizationCanvas.GetComponent<VisualizationCanvas>() : null;
bool isVisualizedPerceptionCamera => s_VisualizedPerceptionCamera == this;
VisualizationCanvas visualizationCanvas => m_ShowingVisualizations ? s_VisualizationCanvas.GetComponent<VisualizationCanvas>() : null;
/// <summary>
/// Add a data object which will be added to the dataset with each capture. Overrides existing sensor data associated with the given key.

if (!showVisualizations)
return;
m_ShowingVisualizations = true;
s_VisualizedPerceptionCamera = this;
// set up to render to a render texture instead of the screen

}
labeler.InternalOnUpdate();
}
//disable async readback when visualizations are enabled to ensure data is read and visualized in the same frame
if (showVisualizations)
CaptureOptions.useAsyncReadbackIfSupported = false;
if (isVisualizedPerceptionCamera)
{
s_VisualizationCanvas.SetActive(showVisualizations);
}
}

正在加载...
取消
保存