浏览代码
PR fixes
PR fixes
Some fairly major UI architecture changes to address comments made during the initial cut PR. Things make more sense now./aisv647_visualizations
Steven Borkman
4 年前
当前提交
217716eb
共有 51 个文件被更改,包括 883 次插入 和 232 次删除
-
66TestProjects/PerceptionURP/Assets/Scenes/SampleScene.unity
-
36com.unity.perception/Runtime/GroundTruth/Labelers/BoundingBoxLabeler.cs
-
157com.unity.perception/Runtime/GroundTruth/Labelers/CameraLabeler.cs
-
27com.unity.perception/Runtime/GroundTruth/Labelers/ObjectCountLabeler.cs
-
31com.unity.perception/Runtime/GroundTruth/Labelers/RenderedObjectInfoLabeler.cs
-
2com.unity.perception/Runtime/GroundTruth/Labelers/Resources.meta
-
41com.unity.perception/Runtime/GroundTruth/Labelers/SemanticSegmentationLabeler.cs
-
6com.unity.perception/Runtime/GroundTruth/RenderTextureReader.cs
-
2com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/Materials/SegmentationMaterial.mat
-
2com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/Resources/KeyValuePanel.prefab
-
8com.unity.perception/Runtime/GroundTruth/Labelers/Visualization.meta
-
128com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/ControlPanel.cs
-
11com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/ControlPanel.cs.meta
-
33com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/KeyValuePanel.cs
-
8com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/Materials.meta
-
8com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/Materials/SegmentationMaterial.mat.meta
-
8com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/Resources.meta
-
450com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/Resources/VisualizationUI.prefab
-
7com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/Resources/VisualizationUI.prefab.meta
-
8com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/Textures.meta
-
65com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/VisualizationCanvas.cs
-
11com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/VisualizationCanvas.cs.meta
-
0/com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/Resources/BoundingBoxPrefab.prefab
-
0/com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/Resources/BoundingBoxPrefab.prefab.meta
-
0/com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/Resources/GenericSlider.prefab
-
0/com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/Resources/GenericSlider.prefab.meta
-
0/com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/Resources/GenericToggle.prefab
-
0/com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/Resources/GenericToggle.prefab.meta
-
0/com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/Resources/Inter-Light.otf
-
0/com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/Resources/Inter-Light.otf.meta
-
0/com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/Materials/OutlineMaterial.mat
-
0/com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/Materials/OutlineMaterial.mat.meta
-
0/com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/Resources/SegmentTexture.prefab
-
0/com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/Resources/SegmentTexture.prefab.meta
-
0/com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/Textures/outline_box.png
-
0/com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/Textures/outline_box.png.meta
-
0/com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/Textures/sharp_done_white_18dp.png
-
0/com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/Textures/sharp_done_white_18dp.png.meta
-
0/com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/Resources/SegRemoveBackgroundShader.shader.meta
-
0/com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/Resources/SegRemoveBackgroundShader.shader
-
0/com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/Materials/SegmentationMaterial.mat
-
0/com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/HUDPanel.cs
-
0/com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/HUDPanel.cs.meta
-
0/com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/KeyValuePanel.cs.meta
-
0/com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/Resources/KeyValuePanel.prefab
-
0/com.unity.perception/Runtime/GroundTruth/Labelers/Visualization/Resources/KeyValuePanel.prefab.meta
|
|||
fileFormatVersion: 2 |
|||
guid: 881ad38fbb74b406f944b05f3a341b1f |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using UnityEngine; |
|||
using UnityEngine.Events; |
|||
using UnityEngine.UI; |
|||
|
|||
namespace UnityEngine.Perception.GroundTruth |
|||
{ |
|||
/// <summary>
|
|||
/// The control panel for labeler visualizers. This panel resides in the upper right hand corner of
|
|||
/// the display. Any UI element can be added to the panel, but it contains helper methods to quickly
|
|||
/// create some of the most common control panel display elements: toggles and sliders.
|
|||
/// </summary>
|
|||
public class ControlPanel : MonoBehaviour |
|||
{ |
|||
Dictionary<string, GameObject> controlMap = new Dictionary<string, GameObject>(); |
|||
|
|||
/// <summary>
|
|||
/// Adds a new UI control to the control panel. If the panel already contains an elment with the
|
|||
/// passed in name, the UI element will not be added and the method will return false. Also, all
|
|||
/// UI elements must have a LayoutElement component and if they do not, this method will reject
|
|||
/// the new element, and return false.
|
|||
/// </summary>
|
|||
public bool AddNewControl(string name, GameObject uiControl) |
|||
{ |
|||
if (uiControl.GetComponent<RectTransform>() == null) |
|||
{ |
|||
Debug.LogError("Control panel UI control must have a rect transform component."); |
|||
return false; |
|||
} |
|||
|
|||
if (uiControl.GetComponent<LayoutElement>() == null) |
|||
{ |
|||
Debug.LogError("Control panel UI control must contain a layout element component."); |
|||
return false; |
|||
} |
|||
|
|||
if (controlMap.ContainsKey(name)) |
|||
{ |
|||
Debug.LogWarning("A control with the name: " + name + " has already been registered with the control panel."); |
|||
return false; |
|||
} |
|||
|
|||
controlMap[name] = uiControl; |
|||
uiControl.transform.SetParent(this.transform, false); |
|||
|
|||
return true; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Removes the component with the passed in name from the control panel. Returns
|
|||
/// false if the element does not exist. Returns true on a successful removal.
|
|||
/// </summary>
|
|||
public bool RemoveControl(string name) |
|||
{ |
|||
if (!controlMap.ContainsKey(name)) |
|||
{ |
|||
Debug.LogWarning(name + " does not exist in control panel, cannot remove."); |
|||
return false; |
|||
} |
|||
|
|||
var control = controlMap[name]; |
|||
controlMap.Remove(name); |
|||
control.transform.SetParent(null); |
|||
GameObject.Destroy(control.gameObject); |
|||
|
|||
return true; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Creates a new toogle control with passed in name. The passed in listener will be
|
|||
/// called on toggle clicks. If anything goes wrong this method will return null.
|
|||
/// Returns the control panel elemet upon a succssful add.
|
|||
/// </summary>
|
|||
public GameObject AddToggleControl(string name, UnityAction<bool> listener) |
|||
{ |
|||
if (controlMap.ContainsKey(name)) |
|||
{ |
|||
Debug.LogWarning("A control with the name: " + name + " has already been registered with the control panel."); |
|||
return null; |
|||
} |
|||
|
|||
if (listener == null) |
|||
{ |
|||
Debug.LogWarning("Adding toggle to control panel without a listener, nothing will respond to user's clicks"); |
|||
} |
|||
|
|||
var toggle = GameObject.Instantiate(Resources.Load<GameObject>("GenericToggle")); |
|||
toggle.transform.SetParent(this.transform, false); |
|||
toggle.GetComponentInChildren<Text>().text = name; |
|||
toggle.GetComponent<Toggle>().onValueChanged.AddListener(listener); |
|||
|
|||
controlMap[name] = toggle; |
|||
|
|||
return toggle; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Creates a new slider control with the passed in name and default value. The passed in listener will be
|
|||
/// called on slider changes. If anything goes wrong this method will return null.
|
|||
/// Returns the control panel elemet upon a succssful add.
|
|||
/// </summary>
|
|||
public GameObject AddSliderControl(string name, float defaultValue, UnityAction<float> listener) |
|||
{ |
|||
if (controlMap.ContainsKey(name)) |
|||
{ |
|||
Debug.LogWarning("A control with the name: " + name + " has already been registered with the control panel."); |
|||
return null; |
|||
} |
|||
|
|||
if (listener == null) |
|||
{ |
|||
Debug.LogWarning("Adding slider to control panel without a listener, nothing will respond to user's interactions"); |
|||
} |
|||
|
|||
var gameObject = GameObject.Instantiate(Resources.Load<GameObject>("GenericSlider")); |
|||
gameObject.transform.SetParent(this.transform, false); |
|||
gameObject.GetComponentInChildren<Text>().text = name; |
|||
var slider = gameObject.GetComponentInChildren<Slider>(); |
|||
slider.value = defaultValue; |
|||
slider.onValueChanged.AddListener(listener); |
|||
|
|||
controlMap[name] = gameObject; |
|||
|
|||
return gameObject; |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 6dbb75c37e45a4cf68053401d3cfd19d |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using UnityEngine; |
|||
using UnityEngine.UI; |
|||
|
|||
namespace UnityEngine.Perception.GroundTruth |
|||
{ |
|||
/// <summary>
|
|||
///
|
|||
/// </summary>
|
|||
public class KeyValuePanel : MonoBehaviour |
|||
{ |
|||
public Text key = null; |
|||
public Text value = null; |
|||
|
|||
/// <summary>
|
|||
/// Sets the key of this key value pair
|
|||
/// </summary>
|
|||
public void SetKey(string k) |
|||
{ |
|||
if (k == null || k == string.Empty) return; |
|||
key.text = k; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Sets the value of this key value pair
|
|||
/// </summary>
|
|||
public void SetValue(string v) |
|||
{ |
|||
value.text = v; |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 0047f4aab94b34de280b855f85e27bfb |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: f81ae556e923c4b1d9a6047faeaa99aa |
|||
NativeFormatImporter: |
|||
externalObjects: {} |
|||
mainObjectFileID: 0 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 6998a51e743dc432c9e1edbbed2e2566 |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!1 &823664980992618516 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
serializedVersion: 6 |
|||
m_Component: |
|||
- component: {fileID: 823664980992618523} |
|||
- component: {fileID: 823664980992618527} |
|||
- component: {fileID: 823664980992618520} |
|||
- component: {fileID: 823664980992618521} |
|||
- component: {fileID: 823664980992618522} |
|||
- component: {fileID: 1952658930196979927} |
|||
m_Layer: 5 |
|||
m_Name: HUDPanel |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!224 &823664980992618523 |
|||
RectTransform: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 823664980992618516} |
|||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
|||
m_LocalPosition: {x: 0, y: 0, z: 0} |
|||
m_LocalScale: {x: 1, y: 1, z: 1} |
|||
m_Children: [] |
|||
m_Father: {fileID: 5586713418251329534} |
|||
m_RootOrder: 1 |
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
|||
m_AnchorMin: {x: 1, y: 0} |
|||
m_AnchorMax: {x: 1, y: 0} |
|||
m_AnchoredPosition: {x: -10, y: 10} |
|||
m_SizeDelta: {x: 0, y: 0} |
|||
m_Pivot: {x: 1, y: 0} |
|||
--- !u!222 &823664980992618527 |
|||
CanvasRenderer: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 823664980992618516} |
|||
m_CullTransparentMesh: 0 |
|||
--- !u!114 &823664980992618520 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 823664980992618516} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
m_Material: {fileID: 0} |
|||
m_Color: {r: 0.16470589, g: 0.16470589, b: 0.16470589, a: 0.8} |
|||
m_RaycastTarget: 1 |
|||
m_Maskable: 1 |
|||
m_OnCullStateChanged: |
|||
m_PersistentCalls: |
|||
m_Calls: [] |
|||
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} |
|||
m_Type: 1 |
|||
m_PreserveAspect: 0 |
|||
m_FillCenter: 1 |
|||
m_FillMethod: 4 |
|||
m_FillAmount: 1 |
|||
m_FillClockwise: 1 |
|||
m_FillOrigin: 0 |
|||
m_UseSpriteMesh: 0 |
|||
m_PixelsPerUnitMultiplier: 1 |
|||
--- !u!114 &823664980992618521 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 823664980992618516} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 8a8695521f0d02e499659fee002a26c2, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
m_Padding: |
|||
m_Left: 20 |
|||
m_Right: 20 |
|||
m_Top: 10 |
|||
m_Bottom: 10 |
|||
m_ChildAlignment: 0 |
|||
m_StartCorner: 0 |
|||
m_StartAxis: 0 |
|||
m_CellSize: {x: 180, y: 16} |
|||
m_Spacing: {x: 0, y: 2} |
|||
m_Constraint: 1 |
|||
m_ConstraintCount: 1 |
|||
--- !u!114 &823664980992618522 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 823664980992618516} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
m_HorizontalFit: 2 |
|||
m_VerticalFit: 2 |
|||
--- !u!114 &1952658930196979927 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 823664980992618516} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 9e7683afe2bbb40e8b416440cda6edb0, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
--- !u!1 &7652432179014024090 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
serializedVersion: 6 |
|||
m_Component: |
|||
- component: {fileID: 7652432179014024093} |
|||
- component: {fileID: 7652432179014024095} |
|||
- component: {fileID: 7652432179014024092} |
|||
m_Layer: 5 |
|||
m_Name: HeaderLabel |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!224 &7652432179014024093 |
|||
RectTransform: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 7652432179014024090} |
|||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
|||
m_LocalPosition: {x: 0, y: 0, z: 0} |
|||
m_LocalScale: {x: 0.5, y: 0.5, z: 1} |
|||
m_Children: [] |
|||
m_Father: {fileID: 7652432179980366449} |
|||
m_RootOrder: 0 |
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
|||
m_AnchorMin: {x: 0, y: 0} |
|||
m_AnchorMax: {x: 0, y: 0} |
|||
m_AnchoredPosition: {x: 0, y: 0} |
|||
m_SizeDelta: {x: 0, y: 0} |
|||
m_Pivot: {x: 0, y: 0.5} |
|||
--- !u!222 &7652432179014024095 |
|||
CanvasRenderer: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 7652432179014024090} |
|||
m_CullTransparentMesh: 0 |
|||
--- !u!114 &7652432179014024092 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 7652432179014024090} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
m_Material: {fileID: 0} |
|||
m_Color: {r: 1, g: 1, b: 1, a: 1} |
|||
m_RaycastTarget: 1 |
|||
m_Maskable: 1 |
|||
m_OnCullStateChanged: |
|||
m_PersistentCalls: |
|||
m_Calls: [] |
|||
m_FontData: |
|||
m_Font: {fileID: 12800000, guid: 397721830eb764bbc8cd9fecf3ab1290, type: 3} |
|||
m_FontSize: 28 |
|||
m_FontStyle: 0 |
|||
m_BestFit: 0 |
|||
m_MinSize: 2 |
|||
m_MaxSize: 40 |
|||
m_Alignment: 3 |
|||
m_AlignByGeometry: 0 |
|||
m_RichText: 1 |
|||
m_HorizontalOverflow: 1 |
|||
m_VerticalOverflow: 1 |
|||
m_LineSpacing: 1 |
|||
m_Text: Visualization Options |
|||
--- !u!1 &7652432179980366462 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
serializedVersion: 6 |
|||
m_Component: |
|||
- component: {fileID: 7652432179980366449} |
|||
- component: {fileID: 7652432179980366453} |
|||
- component: {fileID: 7652432179980366450} |
|||
- component: {fileID: 7652432179980366451} |
|||
- component: {fileID: 7652432179980366448} |
|||
- component: {fileID: 969056103226660559} |
|||
m_Layer: 5 |
|||
m_Name: VisualizationPanel |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!224 &7652432179980366449 |
|||
RectTransform: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 7652432179980366462} |
|||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
|||
m_LocalPosition: {x: 0, y: 0, z: 0} |
|||
m_LocalScale: {x: 1, y: 1, z: 1} |
|||
m_Children: |
|||
- {fileID: 7652432179014024093} |
|||
m_Father: {fileID: 5586713418251329534} |
|||
m_RootOrder: 0 |
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
|||
m_AnchorMin: {x: 1, y: 1} |
|||
m_AnchorMax: {x: 1, y: 1} |
|||
m_AnchoredPosition: {x: -10, y: -10} |
|||
m_SizeDelta: {x: 0, y: 0} |
|||
m_Pivot: {x: 1, y: 1} |
|||
--- !u!222 &7652432179980366453 |
|||
CanvasRenderer: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 7652432179980366462} |
|||
m_CullTransparentMesh: 0 |
|||
--- !u!114 &7652432179980366450 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 7652432179980366462} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
m_Material: {fileID: 0} |
|||
m_Color: {r: 0.21960784, g: 0.21960784, b: 0.21960784, a: 0.392} |
|||
m_RaycastTarget: 1 |
|||
m_Maskable: 1 |
|||
m_OnCullStateChanged: |
|||
m_PersistentCalls: |
|||
m_Calls: [] |
|||
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} |
|||
m_Type: 1 |
|||
m_PreserveAspect: 0 |
|||
m_FillCenter: 1 |
|||
m_FillMethod: 4 |
|||
m_FillAmount: 1 |
|||
m_FillClockwise: 1 |
|||
m_FillOrigin: 0 |
|||
m_UseSpriteMesh: 0 |
|||
m_PixelsPerUnitMultiplier: 1 |
|||
--- !u!114 &7652432179980366451 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 7652432179980366462} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 8a8695521f0d02e499659fee002a26c2, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
m_Padding: |
|||
m_Left: 10 |
|||
m_Right: 10 |
|||
m_Top: 5 |
|||
m_Bottom: 5 |
|||
m_ChildAlignment: 0 |
|||
m_StartCorner: 0 |
|||
m_StartAxis: 0 |
|||
m_CellSize: {x: 200, y: 20} |
|||
m_Spacing: {x: 0, y: 2} |
|||
m_Constraint: 1 |
|||
m_ConstraintCount: 1 |
|||
--- !u!114 &7652432179980366448 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 7652432179980366462} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
m_HorizontalFit: 2 |
|||
m_VerticalFit: 2 |
|||
--- !u!114 &969056103226660559 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 7652432179980366462} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 6dbb75c37e45a4cf68053401d3cfd19d, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
--- !u!1 &8560188994454015819 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
serializedVersion: 6 |
|||
m_Component: |
|||
- component: {fileID: 5586713418251329534} |
|||
- component: {fileID: 4436340584524174639} |
|||
- component: {fileID: 3544841974704459657} |
|||
- component: {fileID: 3089939011315108982} |
|||
- component: {fileID: -8103947867589289143} |
|||
m_Layer: 5 |
|||
m_Name: VisualizationUI |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!224 &5586713418251329534 |
|||
RectTransform: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 8560188994454015819} |
|||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
|||
m_LocalPosition: {x: 0, y: 0, z: 0} |
|||
m_LocalScale: {x: 0, y: 0, z: 0} |
|||
m_Children: |
|||
- {fileID: 7652432179980366449} |
|||
- {fileID: 823664980992618523} |
|||
m_Father: {fileID: 0} |
|||
m_RootOrder: 0 |
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
|||
m_AnchorMin: {x: 0, y: 0} |
|||
m_AnchorMax: {x: 1, y: 1} |
|||
m_AnchoredPosition: {x: 0, y: 0} |
|||
m_SizeDelta: {x: 0, y: 0} |
|||
m_Pivot: {x: 0.5, y: 0.5} |
|||
--- !u!223 &4436340584524174639 |
|||
Canvas: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 8560188994454015819} |
|||
m_Enabled: 1 |
|||
serializedVersion: 3 |
|||
m_RenderMode: 0 |
|||
m_Camera: {fileID: 0} |
|||
m_PlaneDistance: 100 |
|||
m_PixelPerfect: 0 |
|||
m_ReceivesEvents: 1 |
|||
m_OverrideSorting: 0 |
|||
m_OverridePixelPerfect: 0 |
|||
m_SortingBucketNormalizedSize: 0 |
|||
m_AdditionalShaderChannelsFlag: 0 |
|||
m_SortingLayerID: 0 |
|||
m_SortingOrder: 0 |
|||
m_TargetDisplay: 0 |
|||
--- !u!114 &3544841974704459657 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 8560188994454015819} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
m_UiScaleMode: 0 |
|||
m_ReferencePixelsPerUnit: 100 |
|||
m_ScaleFactor: 1 |
|||
m_ReferenceResolution: {x: 800, y: 600} |
|||
m_ScreenMatchMode: 0 |
|||
m_MatchWidthOrHeight: 0 |
|||
m_PhysicalUnit: 3 |
|||
m_FallbackScreenDPI: 96 |
|||
m_DefaultSpriteDPI: 96 |
|||
m_DynamicPixelsPerUnit: 1 |
|||
--- !u!114 &3089939011315108982 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 8560188994454015819} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
m_IgnoreReversedGraphics: 1 |
|||
m_BlockingObjects: 0 |
|||
m_BlockingMask: |
|||
serializedVersion: 2 |
|||
m_Bits: 4294967295 |
|||
--- !u!114 &-8103947867589289143 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 8560188994454015819} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 168e7de4774334a4b8c17799f9fe0699, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
controlPanel: {fileID: 969056103226660559} |
|||
hudPanel: {fileID: 1952658930196979927} |
|
|||
fileFormatVersion: 2 |
|||
guid: dd896a486440a4d0bbb12f506c4f4540 |
|||
PrefabImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 83860b6228dcb4df5acdc9ea3e144e9a |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using UnityEngine; |
|||
using UnityEngine.EventSystems; |
|||
|
|||
namespace UnityEngine.Perception.GroundTruth |
|||
{ |
|||
/// <summary>
|
|||
/// The visualization canvas. This canvas should contain all labeler visualization components.
|
|||
/// All visualizlation components should be added to this canvas via teh AddComponent method.
|
|||
/// </summary>
|
|||
public class VisualizationCanvas : MonoBehaviour |
|||
{ |
|||
public ControlPanel controlPanel; |
|||
public HUDPanel hudPanel; |
|||
|
|||
// Start is called before the first frame update
|
|||
void Start() |
|||
{ |
|||
if (GameObject.Find("EventSystem") == null) |
|||
{ |
|||
var eventSystemGo = new GameObject("EventSystem"); |
|||
eventSystemGo.AddComponent<UnityEngine.EventSystems.EventSystem>(); |
|||
eventSystemGo.AddComponent<StandaloneInputModule>(); |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Adds a new UI components to the visualization canvas. Pass in fullscreen if the component should take up
|
|||
/// the entire screen. Pass in setAsLowestElement if the component should be rendered behind all other components.
|
|||
/// This method will return false if the element could not be added, true if everything works properly.
|
|||
/// </summary>
|
|||
public bool AddComponent(GameObject component, bool fullScreen = true, bool setAsLowestElement = false) |
|||
{ |
|||
if (component == null) |
|||
{ |
|||
Debug.LogError("Trying to add a null component to VisualizationCanvas"); |
|||
return false; |
|||
} |
|||
|
|||
RectTransform trans = component.GetComponent<RectTransform>(); |
|||
if (trans == null) |
|||
{ |
|||
Debug.LogWarning("Adding UI element without a rect transform, adding one to it"); |
|||
trans = component.AddComponent<RectTransform>(); |
|||
} |
|||
|
|||
if (fullScreen) |
|||
{ |
|||
trans.anchorMin = new Vector2(0, 0); |
|||
trans.anchorMax = new Vector2(1, 1); |
|||
trans.pivot = new Vector2(0.5f, 0.5f); |
|||
|
|||
trans.offsetMax = new Vector2(0, 0); |
|||
trans.offsetMin = new Vector2(0, 0); |
|||
} |
|||
|
|||
trans.SetParent(this.transform, false); |
|||
|
|||
if (setAsLowestElement) component.transform.SetAsFirstSibling(); |
|||
|
|||
return true; |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 168e7de4774334a4b8c17799f9fe0699 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue