3.7. C# UI

3.7.1. UiManager.cs

class UI.UiManager : public MonoBehaviour

Handles easy creation of operations to be done on a mesh and the user interaction (2D UI, speech, gestures) that comes with it.

Public Functions

UiMeshDetails CreateDetailsPanel ()

Creates a new Details panel and initializes it

Return

The Vertical Scroll List parent to which items can be added as a child

Public Members

GameObject meshDetailsCanvasPrefab
GameObject headerPrefab
GameObject groupPrefab
GameObject textPrefab
GameObject buttonPrefab
GameObject togglePrefab
GameObject toggleActionPrefab
GameObject iconActionPrefab
GameObject selectionPrefab
GameObject selectionModePrefab
GameObject pivotModePrefab
Transform panelSpawnPoint
Transform genericUiListParent
Material uvGridMaterial
MeshRenderer[] toggleUvGridRenderers
LayerMask UiLayerMask
const int UiLayer = 5
UiPivotMode CurrentPivotMode

Public Static Attributes

UiManager get

Private Functions

void Awake ()
void Start ()
void InitializeStaticUi ()

Generates the UI unrelated to a mesh or to manipulate the active mesh MeshManager.ActiveMesh

void CreateActionSpeechUi (string uiText, UnityAction onClick, UiCollapsible collapsible = null, string[] speechKeywords = null)

Generates UI, gesture and speed entry points based on an action

Parameters
  • onClick: Code to execute when an entry point is triggered

  • collapsible: The group to add this item under

void OnDestroy ()

Private Members

bool _isShowingUvGrid
Material[] _uvGridInitialMaterials
UiCollapsible _toolGroup
UiCollapsible _meshGroup
UiCollapsible _debugGroup

3.7.2. UiMeshDetails.cs

class UI.UiMeshDetails : public MonoBehaviour

Contains all functionality related to the mesh UI panel. There is one of these per LibiglMesh. Contains most UI generation.

Public Functions

void Initialize (LibiglBehaviour behaviour)

Main function where UI is generated.

Parameters
  • behaviour: The behaviour we are generating the UI panel for.

void OnDestroy ()
void UpdatePreExecute ()

Called in PreExecute just before the input is consumed

void UpdatePostExecute ()

Update the UI Details panel after executing

bool AddSelection ()

Return

true if selection was successfully added, max 32 selections

Public Members

UiProgressIcon progressIcon
Button activeBtn
Button deleteBtn

Private Functions

void RepaintActiveMesh ()

Repaint based on which mesh is active. Should be called when MeshManager.OnActiveMeshChanged

Also called when the object is created as this happens just after a mesh was set

void RepaintActiveSelection ()

Repaint the active selection. Should be called when LibiglBehaviour.OnActiveSelectionChanged.

void UpdateVertexCountText ()

Private Members

LibiglBehaviour _behaviour

Access to the behaviour that this UI panel belongs to

Transform _listParent

The content of the scroll list view, add new components as a child of this transform.

Image activeImage = null
Sprite editSprite = null
Sprite activeSprite = null
Image background = null
Color activeBackgroundColor = Color.white
Color _defaultBackgroundColor
TMP_Text _vertexCount
UiCollapsible _selectionGroup
readonly List<UiSelection_selections = new List<UiSelection>()
int _activeSelectionId = -1

The active selection displayed in the UI

UiCollapsible _debugGroup
UiToggleAction _harmonicToggle
UiToggleAction _arapToggle