Astra Unity 2.6.6
Astra Unity Plugin
|
RigItem is an element item that wraps the bone GameObjects of a SkinnedMeshRenderer it's primary purpose is to facilitate skinning operations, animation opertations and tracking of individual bones. In Unity the RigItem allows the astra core system to interact with Unity's Humanoid Avatar definition more precisely than Mecanim's automated skeleton retargeting system. This aspect of RigItem will allow for the use of arbitrary bone chains useful in dynamics. RigItems serialize into a protocol buffer and are a primary building block for all skinned meshes and compound items. More...
Classes | |
class | BoneShiftWeight |
class | BoneTarget |
Public Member Functions | |
void | Freeze () |
Prevents the RigItem from automatically triggering Sync in the Update loop, manual calls to Sync will still work. Freezing a RigItem is useful when batching many manual changes to morphables where you don't need update to the avatar's rig during this window. When your changes are done you must trigger Thaw to start allowing the RigItem to Sync again. More... | |
void | Thaw () |
Allows a RigItem to start automatically syncing again after being frozen via Freeze, does nothing otherwise. More... | |
void | PauseSync () |
Pause all Sync operations, even manual operations. This is used internally when batching many operations such as loading multiple MorphableItems. Effectively this means that when Sync is called it will immediately return. More... | |
void | UnpauseSync () |
Unpause all sync operations More... | |
void | GatherBones () |
Find all BoneItems on this RigItem starting from RootBoneGO and add them to the skeleton | |
void | AppendBone (BoneItem bi) |
Add an additional bone to this RigItem's skeleton More... | |
void | AppendBones (BoneItem[] bis) |
BoneItem | GetBoneItemByGuid (string _gid) |
Finds the BoneItem for the given id More... | |
BoneItem | GetBoneItemByName (string _str) |
Finds the BoneItem for the given name More... | |
BoneItem | GetBoneItemByMecanimName (string mecanimName) |
Retrieves the bone item that matches the mecanim name, eg: Hips will return the hip bone item NOTE: this may return null if there is no mapping defined SEE: https://docs.unity3d.com/ScriptReference/HumanBodyBones.html More... | |
int | GetIndexByTransform (Transform _tran) |
int | GetIndexByName (string boneName) |
Get the index of the bone with this name More... | |
int | GetIndexByGuid (string boneGuid) |
Get the index of the bone with this guid More... | |
bool | TryGetBoneItemAndIndexByGuid (string boneGuid, out BoneItem boneItem, out int index) |
GameObject[] | GetBoneArray () |
Retrieve the list of bones as an array | |
Transform[] | GetBoneArrayTransforms () |
Get all the transforms for the bones attached to this RigItem's skeleton | |
delegate void | PostLoadMorphedRig (RigManager.MorphedRig morphedRig) |
delegate void | ImmediateSyncCallback () |
ApiJobNoResult | Sync (ImmediateSyncCallback callback=null, int parentJobId=Job.kNoParentJobId) |
Triggers a recalculation of the rig and bone positions based on the original rig and any morphs attached. This is automatically handled for you when a MorphableItem has a RigTarget (the morph has different bones from the original rig). This is unnecessary to trigger yourself unless you are manipulating the rig directly or using the pause of freeze system. More... | |
Vector3 | GetRootBonePosition () |
This is used to locate the translation of the root bone (usually a hip bone) when all morphs are driven at their specified value This is used to work around an issue with unity's mecanim system when we reapply it the character will sink or rise in Y translation. By forcing their root bone to be in this location (local) it will keep the avatar from shifting around. | |
void | AttachSupplementalRig (RigItem other, bool destroyOther=false) |
Takes another RigItem and marries it to this one by finding matching bones and ignore them and finding "new" bones (on other) and adding them to the hierachy Does nothing if already in the set More... | |
void | SetInBindPose () |
Places the rig in to it's rest or bind position This is the default position of the rig when first loaded Note: this | |
void | SnapshotPose () |
Generates a temporary PoseItem with the current pose of the avatar This only generates a PoseItem if there isn't a snapshot pose already as such this will replace a current snapshot of the character if there is one | |
bool | RestoreSnapshotPose () |
Restores the bone rotations to where they were in a snapshot More... | |
bool | SyncTest () |
![]() | |
virtual CompoundItem | FindParentCompound () |
Find the parent CompoundItem which this Item is attached to, if it exists, otherwise null | |
virtual AvatarItem | FindAvatarItem () |
Returns the AvatarItem this item is attached to (if found, note may return null) | |
virtual RigItem | FindRigItem () |
Finds the current RigItem associated on this Avatar Hierarchy More... | |
Public Attributes | |
GameObject | RootBoneGO |
This is a reference that points to the top most skeleton node, frequently called "root" or "hips" | |
ItemDict | Skeleton = new ItemDict() |
Dictionary of the BoneItems that make up this RigItem's skeleton | |
bool | DrawBones = true |
Whether to draw the bones in the scene | |
string | SourceRigId = null |
If not null, this means this rig is compatible with another one, this is common on supplemental rigs such as hairs like ponytails that have extra bone chains NOTE: similar bones will have identical guids between the two, but not the supplemental bones | |
SerializableDictionarySS | boneIdToMecanimId = null |
A dictionary that has a lookup between our local astra guid and the mecanim id, eg: "123-456" => "Hips" | |
SerializableDictionarySS | mecanimIdToBoneId = null |
A dictionary that has a lookup between the mecanim id and our local astra guid, eg: "Hips" => "123-456" | |
SerializableDictionarySRigItem | SupplementalRigItems = new SerializableDictionarySRigItem() |
A list of active rigs that are "merged" into this one | |
SerializableDictionarySMorphableItem | morphableItems = new SerializableDictionarySMorphableItem() |
If a morphable has a rig target, it will link itself into this dictionary, the key is the morphable guid | |
RigTarget | rigTarget |
RigTarget for this RigItem | |
RigManager.MorphedRig | morphedRig = null |
contains the current data for the last bone adjustment/sync | |
bool | isModified = false |
Tells you if the rig is customized, meaning a morphable with a Rig Target has been applied. This is necessary for performance reasons since we can no longer share a mesh without the same bindposes, which a rig target will dynamically modify based on the values. | |
Protected Member Functions | |
List< GameObject > | GatherBonesRecursive (GameObject _go) |
bool | IsDirty () |
void | UpdateLastValues () |
void | Recalculate () |
![]() | |
void | TrackId (string id) |
void | UntrackIds () |
Protected Attributes | |
bool | _dirty = false |
AvatarItem | _avatarItem |
Dictionary< string, BoneTarget > | boneTargets = null |
Dictionary< string, BoneShiftWeight > | perBoneShifts = null |
List< SkinnedMeshRenderer > | _dependentSMRs = new List<SkinnedMeshRenderer>() |
bool | _isSyncing = false |
Dictionary< string, float > | _lastMorphValues = new Dictionary<string, float>() |
System.Object | _lock = new object() |
PoseItem | _snapshotPoseItem = null |
![]() | |
List< string > | _trackingIds = null |
Properties | |
override McsSdk20.Primitives.AstraPrimitiveType | PrimitiveType [get] |
int | BoneCount [get] |
Number of bones in this skeleton | |
AvatarItem | avatarItem [getset] |
AvatarItem this RigItem is attached to | |
bool | IsSyncPaused [get] |
Whether all sync operations should be paused. Manual sync operations will be ignored if true. More... | |
![]() | |
virtual McsSdk20.Primitives.AstraPrimitiveType | PrimitiveType [get] |
Retrieve the primitive type for this item | |
virtual McsSdk20.Primitives.SchematicType | SchematicType [get] |
Retrieve the schematic type for this item | |
string | AstraGuid [getset] |
Guid for this item to identify it in the Astra Service | |
string | AstraName [getset] |
Display name for this item | |
string | AstraInstanceId [getset] |
Guid representing an instance of this item | |
![]() | |
string | AstraGuid [getset] |
string | AstraName [getset] |
string | AstraInstanceId [getset] |
RigItem is an element item that wraps the bone GameObjects of a SkinnedMeshRenderer it's primary purpose is to facilitate skinning operations, animation opertations and tracking of individual bones. In Unity the RigItem allows the astra core system to interact with Unity's Humanoid Avatar definition more precisely than Mecanim's automated skeleton retargeting system. This aspect of RigItem will allow for the use of arbitrary bone chains useful in dynamics. RigItems serialize into a protocol buffer and are a primary building block for all skinned meshes and compound items.
|
inline |
Add an additional bone to this RigItem's skeleton
bi |
|
inline |
Takes another RigItem and marries it to this one by finding matching bones and ignore them and finding "new" bones (on other) and adding them to the hierachy Does nothing if already in the set
|
inline |
Prevents the RigItem from automatically triggering Sync in the Update loop, manual calls to Sync will still work. Freezing a RigItem is useful when batching many manual changes to morphables where you don't need update to the avatar's rig during this window. When your changes are done you must trigger Thaw to start allowing the RigItem to Sync again.
You should never need to call this yourself unless you are directly manipulating the raw data of MorphableItems with RigTargets in them.
PauseSync is the more extreme version of freezing
|
inline |
|
inline |
Retrieves the bone item that matches the mecanim name, eg: Hips will return the hip bone item NOTE: this may return null if there is no mapping defined SEE: https://docs.unity3d.com/ScriptReference/HumanBodyBones.html
mecanimName | Mechanim name for the bone |
|
inline |
|
inline |
Get the index of the bone with this guid
boneName | Guid of the bone to look for |
|
inline |
Get the index of the bone with this name
boneName | Name of the bone to look for |
|
inline |
Pause all Sync operations, even manual operations. This is used internally when batching many operations such as loading multiple MorphableItems. Effectively this means that when Sync is called it will immediately return.
You should never need to call this yourself unless you are directly manipulating the raw data of MorphableItems with RigTargets in them.
Freeze is the more lesser version of pausing
|
inline |
Restores the bone rotations to where they were in a snapshot
|
inline |
Triggers a recalculation of the rig and bone positions based on the original rig and any morphs attached. This is automatically handled for you when a MorphableItem has a RigTarget (the morph has different bones from the original rig). This is unnecessary to trigger yourself unless you are manipulating the rig directly or using the pause of freeze system.
It is unlikely that you will need to trigger the Sync yourself unless you are directly manipulating the data yourself or need to adjust bones and want Astra to recalculate after you're done.
callback | Callback to call when this operation is complete, you should use the returned job if wanting to wait for completion instead. |
parentJobId | Job that triggered this job for debugging purposes. Optional. |
|
inline |
|
inline |
Unpause all sync operations
|
inlineprotected |
Used internally to keep track of what morphs are at what values this is used to determine if the rig is "dirty"
|
get |
Whether all sync operations should be paused. Manual sync operations will be ignored if true.