Tanoda
Leap.Unity.HandModelManager Class Reference

The HandModelManager manages a pool of HandModelBases and makes HandRepresentations when a it detects a Leap Hand from its configured LeapProvider. More...

Inheritance diagram for Leap.Unity.HandModelManager:

Classes

class  ModelGroup
 

Public Member Functions

void ReturnToPool (HandModelBase model)
 
HandRepresentation MakeHandRepresentation (Hand hand, ModelType modelType)
 
void RemoveHandRepresentation (HandRepresentation handRepresentation)
 
void EnableGroup (string groupName)
 
void DisableGroup (string groupName)
 
void ToggleGroup (string groupName)
 
void AddNewGroup (string groupName, HandModelBase leftModel, HandModelBase rightModel)
 
void RemoveGroup (string groupName)
 
GetHandModel< T > (int handId)
 

Protected Member Functions

virtual void OnUpdateFrame (Frame frame)
 
virtual void OnFixedFrame (Frame frame)
 
virtual void UpdateHandRepresentations (Dictionary< int, HandRepresentation > all_hand_reps, ModelType modelType, Frame frame)
 
virtual void OnEnable ()
 
virtual void OnDisable ()
 

Protected Attributes

Dictionary< int, HandRepresentationgraphicsHandReps = new Dictionary<int, HandRepresentation>()
 
Dictionary< int, HandRepresentationphysicsHandReps = new Dictionary<int, HandRepresentation>()
 
bool graphicsEnabled = true
 
bool physicsEnabled = true
 

Properties

bool GraphicsEnabled [get, set]
 
bool PhysicsEnabled [get, set]
 
LeapProvider leapProvider [get, set]
 

Detailed Description

The HandModelManager manages a pool of HandModelBases and makes HandRepresentations when a it detects a Leap Hand from its configured LeapProvider.

When a HandRepresentation is created, a HandModelBase is removed from the pool. When a HandRepresentation is finished, its HandModelBase is returned to the pool.

This class was formerly known as HandPool.

Definition at line 31 of file HandModelManager.cs.

Member Function Documentation

◆ AddNewGroup()

void Leap.Unity.HandModelManager.AddNewGroup ( string  groupName,
HandModelBase  leftModel,
HandModelBase  rightModel 
)

Definition at line 446 of file HandModelManager.cs.

◆ DisableGroup()

void Leap.Unity.HandModelManager.DisableGroup ( string  groupName)

DisableGroup finds and removes the ModelGroup's HandModelBases from their HandRepresentations, returns them to their ModelGroup and sets the groups IsEnabled to false.

Parameters
groupNameTakes a string that matches the ModelGroup's groupName serialized in the Inspector

Definition at line 402 of file HandModelManager.cs.

◆ EnableGroup()

void Leap.Unity.HandModelManager.EnableGroup ( string  groupName)

EnableGroup finds suitable HandRepresentations and adds HandModelBases from the ModelGroup, returns them to their ModelGroup and sets the groups IsEnabled to true.

Parameters
groupNameTakes a string that matches the ModelGroup's groupName serialized in the Inspector

Definition at line 373 of file HandModelManager.cs.

◆ GetHandModel< T >()

T Leap.Unity.HandModelManager.GetHandModel< T > ( int  handId)
Type Constraints
T :HandModelBase 

Definition at line 466 of file HandModelManager.cs.

◆ MakeHandRepresentation()

HandRepresentation Leap.Unity.HandModelManager.MakeHandRepresentation ( Hand  hand,
ModelType  modelType 
)

MakeHandRepresentation receives a Hand and combines that with a HandModelBase to create a HandRepresentation

Parameters
handThe Leap Hand data to be drive a HandModelBase
modelTypeFilters for a type of hand model, for example, physics or graphics hands.

Definition at line 277 of file HandModelManager.cs.

◆ OnDisable()

virtual void Leap.Unity.HandModelManager.OnDisable ( )
protectedvirtual

Definition at line 317 of file HandModelManager.cs.

◆ OnEnable()

virtual void Leap.Unity.HandModelManager.OnEnable ( )
protectedvirtual

Definition at line 305 of file HandModelManager.cs.

◆ OnFixedFrame()

virtual void Leap.Unity.HandModelManager.OnFixedFrame ( Frame  frame)
protectedvirtual

Updates the physics HandRepresentations.

Definition at line 67 of file HandModelManager.cs.

◆ OnUpdateFrame()

virtual void Leap.Unity.HandModelManager.OnUpdateFrame ( Frame  frame)
protectedvirtual

Updates the graphics HandRepresentations.

Definition at line 60 of file HandModelManager.cs.

◆ RemoveGroup()

void Leap.Unity.HandModelManager.RemoveGroup ( string  groupName)

Definition at line 457 of file HandModelManager.cs.

◆ RemoveHandRepresentation()

void Leap.Unity.HandModelManager.RemoveHandRepresentation ( HandRepresentation  handRepresentation)

Definition at line 297 of file HandModelManager.cs.

◆ ReturnToPool()

void Leap.Unity.HandModelManager.ReturnToPool ( HandModelBase  model)

Definition at line 226 of file HandModelManager.cs.

◆ ToggleGroup()

void Leap.Unity.HandModelManager.ToggleGroup ( string  groupName)

Definition at line 429 of file HandModelManager.cs.

◆ UpdateHandRepresentations()

virtual void Leap.Unity.HandModelManager.UpdateHandRepresentations ( Dictionary< int, HandRepresentation all_hand_reps,
ModelType  modelType,
Frame  frame 
)
protectedvirtual

Updates HandRepresentations based in the specified HandRepresentation Dictionary. Active HandRepresentation instances are updated if the hand they represent is still present in the Provider's CurrentFrame; otherwise, the HandRepresentation is removed. If new Leap Hand objects are present in the Leap HandRepresentation Dictionary, new HandRepresentations are created and added to the dictionary.

Parameters
all_hand_reps= A dictionary of Leap Hand ID's with a paired HandRepresentation
modelTypeFilters for a type of hand model, for example, physics or graphics hands.
frameThe Leap Frame containing Leap Hand data for each currently tracked hand

Mark-and-sweep to finish unused HandRepresentations

Initialize toBeDeleted with a value to be deleted

Inform the representation that we will no longer be giving it any hand updates because the corresponding hand has gone away

Definition at line 83 of file HandModelManager.cs.

Member Data Documentation

◆ graphicsEnabled

bool Leap.Unity.HandModelManager.graphicsEnabled = true
protected

Definition at line 38 of file HandModelManager.cs.

◆ graphicsHandReps

Dictionary<int, HandRepresentation> Leap.Unity.HandModelManager.graphicsHandReps = new Dictionary<int, HandRepresentation>()
protected

Definition at line 35 of file HandModelManager.cs.

◆ physicsEnabled

bool Leap.Unity.HandModelManager.physicsEnabled = true
protected

Definition at line 39 of file HandModelManager.cs.

◆ physicsHandReps

Dictionary<int, HandRepresentation> Leap.Unity.HandModelManager.physicsHandReps = new Dictionary<int, HandRepresentation>()
protected

Definition at line 36 of file HandModelManager.cs.

Property Documentation

◆ GraphicsEnabled

bool Leap.Unity.HandModelManager.GraphicsEnabled
getset

Definition at line 41 of file HandModelManager.cs.

◆ leapProvider

LeapProvider Leap.Unity.HandModelManager.leapProvider
getset

Definition at line 130 of file HandModelManager.cs.

◆ PhysicsEnabled

bool Leap.Unity.HandModelManager.PhysicsEnabled
getset

Definition at line 50 of file HandModelManager.cs.


The documentation for this class was generated from the following file: