Astra Unity 2.6.6
Astra Unity Plugin
|
MeshItem is an element item that wraps SkinnedMeshRenderers, MeshFilters and MeshRenderers. It eases the tracking of material assignments to submeshes with an additional string key. It provides utilities that exposes SMR vert / bone weighting information. It also provides a method to transfer vert weights from one RigItem to another. MeshItems serialize into a protocol buffer and are a primary building block for all ComoundItems. More...
Classes | |
struct | MaterialFeatures |
class | SerializableDictionarySMaterialFeatures |
class | TupletsSMaterialFeatures |
Public Member Functions | |
bool | SnapshotTriangles () |
Stores a pristine copy of the original source triangles (used for culling usually) | |
bool | RestoreTriangles () |
Sets the triangles to the last snapshot taken | |
bool | HasSnapshotTriangles () |
Whether a snapshot has been stored | |
void | DestroySnapshotTriangles () |
Remove the last snapshot taken | |
Mesh | GetMeshComponent () |
Retrieve the current Unity mesh | |
Material[] | GetMaterials () |
Retrieve all the materials attached to this mesh | |
Material | GetMaterialAt (int _index) |
Retrieve the material at the specified index More... | |
ApiJobNoResult | SyncDecals (int parentJobId=Job.kNoParentJobId) |
Reapply all decals to this mesh without waiting for next frame. Calling this yourself is unnecessary as Astra manages it for you, this is only necessary if you manually manipulate the decals or want to immediately schedule the process. Internally this schedules sub jobs that all wait for completion states. This call is relatively expensive and you should avoid calling it unless absolutely necessary such as needing to read or wait to show the final computed values of the decal system. More... | |
bool | HasMorph (string morphableGUID) |
Tells us if this mesh item already has a morph in it's smr More... | |
int | GetMorphBlendshapeIdx (string morphableGUID) |
Get the index of the blendshape for the given Morphable More... | |
void | MarkBoundsDirty () |
Flag that the bounds need to be recalculated on next frame, this is useful if you manually modify the mesh yourself outside of Astra. Failure to set this on manual changes of the mesh may make the avatar height calculation incorrect. This call will trigger a semi-expensive sync of the mesh bounds, avoid it's use if you do not need it. | |
void | MarkDecalsDirty () |
Flag that the decals need to be recomputed and applied to the mesh's material next frame, this is useful if you manually modify the decal records yourself outside of Astra. Failure to set this on manual changes will mean your decal on the mesh will not be accurate unless you modified the decal slot directly. | |
void | RecalculateBoundsNextFrame (bool approximate=false, int parentJobId=Job.kNoParentJobId) |
Triggers the mesh to recalculate its mesh at the end of the next frame More... | |
void | RecalculateBounds (bool approximate=false) |
Recalculate the bounding box for a mesh More... | |
Bounds | GetCurrentBounds (SkinnedMeshRenderer smr, bool approximate=false, bool zeroBlendshapes=false, bool fast=true) |
Get the current bounds for the given mesh renderer More... | |
void | RestoreMaterials () |
Puts the original materials back into the mesh, effectively wiping out decal and variation data until the next sync | |
void | StoreMaterials (bool refresh=false) |
Clones the existing materials into a serialized dictionary keyed on submesh id | |
void | SyncMaterialVariations () |
Applies material variations into the primary material keeping a copy of the original. It is unnecessary to call this yourself as Astra will manage it for you. You only need to call this if you directly manipulate MaterialVariationItems outside of Astra The result of this call is that your material will have the variation effects (such as color or textures) applied to it. | |
void | ReferenceItems (bool force=false) |
void | SetReferencedItems (bool referenced) |
Used to override the internal check for ReferenceItems and DereferenceItems This is ONLY useful if you're procedurally creating these assets yourself This will set the internal cache flag for reference counting w/o changing references More... | |
void | DereferenceItems () |
Color? | GetColor (int subMaterialSlot, int materialSlot) |
Returns a nullable color for the material inside the submaterial slot A color may be null if there is no current tracked value and you must account for this A null is an acceptable color, it means DO NOT OVERRIDE the material's color (think Color(0,0,0,0)) More... | |
bool | ApplyColor (Color color, int subMaterialSlot=0, int materialSlot=0) |
Sets the color tint for a material Defaults to the first slot of the submaterial Defaults to the first slot of the material if not specified More... | |
bool | ClearColor (int subMaterialSlot=0, int materialSlot=0) |
Removes any color tint from the material More... | |
bool | ApplyEmission (Color color, int subMaterialSlot=0, int materialSlot=0) |
Sets the emission for a material Defaults to the first slot of the submaterial Defaults to the first slot of the material if not specified More... | |
Color? | GetEmission (int subMaterialSlot=0, int materialSlot=0) |
Retrieves the materials emission defined by the slots, may return null if there is none More... | |
bool | ClearEmission (int subMaterialSlot=0, int materialSlot=0) |
Removes any color tint from the material's emission slots More... | |
bool | ApplyMetal (float metalness, int subMaterialSlot=0, int materialSlot=0) |
Sets the metal for a material Defaults to the first slot of the submaterial Defaults to the first slot of the material if not specified More... | |
bool | ClearMetal (int subMaterialSlot=0, int materialSlot=0) |
Removes any metal override for the mat More... | |
float? | GetMetal (int subMaterialSlot=0, int materialSlot=0) |
Retrieves the metalness value for the sub material More... | |
bool | ApplyGloss (float glossiness, int subMaterialSlot=0, int materialSlot=0) |
Sets the gloss for a material Defaults to the first slot of the submaterial Defaults to the first slot of the material if not specified More... | |
bool | ClearGloss (int subMaterialSlot=0, int materialSlot=0) |
Removes any gloss override for the mat More... | |
float? | GetGloss (int subMaterialSlot=0, int materialSlot=0) |
Retrieves the glossiness value (1-rougness) for the sub material More... | |
bool | CopyMaterialIntoColorData (int subMaterialSlot=-1, int materialSlot=-1) |
Do not use. Necessary to be defined due to the IColorInterface More... | |
List< List< Color > > | GetColorPaletteOptions (int subMaterialSlot) |
Get the color options for what can go into the given sub material slot More... | |
int | GetColorOptionCount (int subMaterialSlot) |
Get the number of color options for the given sub material slot More... | |
int | GetMaterialCount () |
Retrieves the number of materials assigned to this mesh More... | |
Dictionary< string, MorphableItem > | GetAvatarsMorphableItems () |
Get Dictionary of MorphableItem on avatar More... | |
Public Member Functions inherited from Astra.Asset.ItemBase | |
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... | |
Static Public Member Functions | |
static void | ToggleSMRUpdateWhenOffscreen (bool state) |
Whether the skinned mesh renderer should update when not visible More... | |
static void | AddToShaderSubMaterialSlotMap (string shaderName, Dictionary< string, int > shaderSubMaterialSlotMap) |
Allows a developer to extend the color lookup (tints) using their own custom shader. More... | |
static void | AddToShaderSubMaterialSlotMap (string shaderName, Dictionary< int, string > shaderSubMaterialSlotMap) |
Allows a developer to extend the color lookup (tints) using their own custom shader. This is deprecated please switch to MeshItem.AddToShaderSubMaterialSlotMap(string, Dictionary<string, int>) More... | |
static ? int | GetSubMaterialColorIntFromProperty (Material material, string property) |
Get the current tint slot from the given material's property More... | |
static Dictionary< string, int > | GetSubMaterialColorProperties (string shader) |
Get the list of keys and values from the materials on this mesh More... | |
static Dictionary< string, int > | GetSubMaterialColorProperties (Material mat) |
Get the list of keys and values from the given material More... | |
static string | GetSubMaterialColorProperty (string shader, int subMaterialSlot) |
Get the specific color property given from the materials on this MeshItem More... | |
static string | GetSubMaterialColorProperty (Material material, int subMaterialSlot) |
Get the specific color property given from the given material, makes use of shaderSubMaterialSlotMap, guesses otherwise More... | |
static ? Color | GetSubMaterialColor (Material material, int subMaterialSlot) |
Get the color from the given submaterial More... | |
Protected Member Functions | |
void | PostInit () |
void | ResetDecalMaterialSlot (Material submeshMaterial, string slot, Texture texNew) |
void | ReuseDecalMaterialSlot (Material submeshMaterial, string slot, Texture texNew) |
Color? | GetColorFromPropertyAndSlot (string prefix, int subMaterialSlot=0, int materialSlot=0) |
float? | GetFloatFromPropertyAndSlot (string prefix, int subMaterialSlot=0, int materialSlot=0) |
bool | SetColorFromPropertyAndSlot (Color color, string prefix, int subMaterialSlot=0, int materialSlot=0) |
bool | SetFloatFromPropertyAndSlot (float value, string prefix, int subMaterialSlot=0, int materialSlot=0) |
Protected Member Functions inherited from Astra.Asset.ItemBase | |
void | TrackId (string id) |
void | UntrackIds () |
Protected Attributes | |
RigItem | _rigItem = null |
List< BoneItem > | _bones = new List<BoneItem>() |
List< int[]> | _originalTriangles = null |
SerializableDictionarySB | _submeshToDecalActive = new SerializableDictionarySB() |
SerializableDictionarySMat | _originalMaterials = new SerializableDictionarySMat() |
int | _unityInstanceId = 0 |
We need to use these so we know if we're a copy, if we are we'll generate a new set of references | |
bool | _referencedItems = false |
bool | _isBeingDestroyed = false |
Protected Attributes inherited from Astra.Asset.ItemBase | |
List< string > | _trackingIds = null |
Static Protected Attributes | |
static List< string > | _knownTransferableDecalShaderNames |
static List< string > | _proceduralTextureProperties |
Properties | |
SerializableDictionarySMat | OriginalMaterials [get] |
This tuplet contains a copy of the original materials unless baked out Key is the submesh id and value is a unity material | |
Properties inherited from Astra.Asset.ItemBase | |
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 | |
Properties inherited from Astra.Asset.IAstraBaseInterface | |
string | AstraGuid [getset] |
string | AstraName [getset] |
string | AstraInstanceId [getset] |
MeshItem is an element item that wraps SkinnedMeshRenderers, MeshFilters and MeshRenderers. It eases the tracking of material assignments to submeshes with an additional string key. It provides utilities that exposes SMR vert / bone weighting information. It also provides a method to transfer vert weights from one RigItem to another. MeshItems serialize into a protocol buffer and are a primary building block for all ComoundItems.
|
inlinestatic |
Allows a developer to extend the color lookup (tints) using their own custom shader. This is deprecated please switch to MeshItem.AddToShaderSubMaterialSlotMap(string, Dictionary<string, int>)
shaderName | This is your shader name including the forward slahes eg: Astra/Skin |
shaderSubMaterialSlotMap | A map that specifies the color slot property of your shader to a tint slots 0, 1, or 2 eg: 0 => "_Color0" |
|
inlinestatic |
Allows a developer to extend the color lookup (tints) using their own custom shader.
shaderName | This is your shader name including the forward slahes eg: Astra/Skin |
shaderSubMaterialSlotMap | A map that specifies the color slot property of your shader to a tint slots 0, 1, or 2 eg: "_Color0" => 0 |
|
inline |
Sets the color tint for a material Defaults to the first slot of the submaterial Defaults to the first slot of the material if not specified
color | The color you want to tint, blends on alpha channel |
subMaterialSlot | Which sub material slot (0->3) |
materialSlot | Which submesh material slot, defaults to 0 |
Implements Astra.Asset.IColorInterface.
|
inline |
Sets the emission for a material Defaults to the first slot of the submaterial Defaults to the first slot of the material if not specified
color | The color you want to tint, blends on alpha channel |
subMaterialSlot | Which sub material slot (0->3) |
materialSlot | Which submesh material slot, defaults to 0 |
|
inline |
Sets the gloss for a material Defaults to the first slot of the submaterial Defaults to the first slot of the material if not specified
metal | A value from -1 to 1, where anything below 0 is "unapplied" and 0 means non metal and 1 means 100% metal |
subMaterialSlot | Which sub material slot (0->3) |
materialSlot | Which submesh material slot, defaults to 0 |
|
inline |
Sets the metal for a material Defaults to the first slot of the submaterial Defaults to the first slot of the material if not specified
metal | A value from -1 to 1, where anything below 0 is "unapplied" and 0 means non metal and 1 means 100% metal |
subMaterialSlot | Which sub material slot (0->3) |
materialSlot | Which submesh material slot, defaults to 0 |
|
inline |
Removes any color tint from the material
subMaterialSlot | Which sub material slot (0->3) |
materialSlot | Which submesh material slot, defaults to 0 |
Implements Astra.Asset.IColorInterface.
|
inline |
Removes any color tint from the material's emission slots
subMaterialSlot | Which sub material slot (0->3) |
materialSlot | Which submesh material slot, defaults to 0 |
|
inline |
Removes any gloss override for the mat
subMaterialSlot | Which sub material slot (0->3) |
materialSlot | Which submesh material slot, defaults to 0 |
|
inline |
Removes any metal override for the mat
subMaterialSlot | Which sub material slot (0->3) |
materialSlot | Which submesh material slot, defaults to 0 |
|
inline |
Do not use. Necessary to be defined due to the IColorInterface
Implements Astra.Asset.IColorInterface.
|
inline |
Get Dictionary of MorphableItem on avatar
|
inline |
Returns a nullable color for the material inside the submaterial slot A color may be null if there is no current tracked value and you must account for this A null is an acceptable color, it means DO NOT OVERRIDE the material's color (think Color(0,0,0,0))
submaterialSlot | Shaders support multiple color tints, this is the tint slot of the material |
materialSlot | This represents the material slot, or the submesh slot |
Implements Astra.Asset.IColorInterface.
|
inline |
Get the number of color options for the given sub material slot
subMaterialSlot | Which sub material slot (0->3) |
Implements Astra.Asset.IColorInterface.
|
inline |
Get the color options for what can go into the given sub material slot
subMaterialSlot | Which sub material slot (0->3) |
Implements Astra.Asset.IColorInterface.
|
inline |
Get the current bounds for the given mesh renderer
smr | Skinned mesh renderer to check against |
approximate | If false, just gets an approximate bounds for a cheaper call |
zeroBlendshapes | Whether the belendshape weights should be reset |
|
inline |
Retrieves the materials emission defined by the slots, may return null if there is none
subMaterialSlot | Which sub material slot (0->3) |
materialSlot | Which submesh material slot, defaults to 0 |
|
inline |
Retrieves the glossiness value (1-rougness) for the sub material
subMaterialSlot | Which sub material slot (0->3) |
materialSlot | Which submesh material slot, defaults to 0 |
|
inline |
Retrieve the material at the specified index
_index | Index of material to retrieve |
|
inline |
Retrieves the number of materials assigned to this mesh
Implements Astra.Asset.IColorInterface.
|
inline |
Retrieves the metalness value for the sub material
subMaterialSlot | Which sub material slot (0->3) |
materialSlot | Which submesh material slot, defaults to 0 |
|
inline |
Get the index of the blendshape for the given Morphable
morphableGUID | Morphable Guid to find |
|
inlinestatic |
Get the color from the given submaterial
material | Material to get the result from |
subMaterialSlot | Index of the sub material |
|
inlinestatic |
Get the current tint slot from the given material's property
material | Material to use |
property | Property to retrieve the value from |
|
inlinestatic |
Get the list of keys and values from the given material
mat | Material to get values out of |
|
inlinestatic |
Get the list of keys and values from the materials on this mesh
shader | Name of the shader to retrieve values from |
|
inlinestatic |
Get the specific color property given from the given material, makes use of shaderSubMaterialSlotMap, guesses otherwise
material | Material to get the result from |
subMaterialSlot | Index of the sub material |
|
inlinestatic |
Get the specific color property given from the materials on this MeshItem
shader | Shader to get the property from |
subMaterialSlot | Index of the sub material |
|
inline |
Tells us if this mesh item already has a morph in it's smr
morphableGUID | Morphable Guid to check against |
|
inline |
Recalculate the bounding box for a mesh
approximate | If true the bounding box will be re-created but may not be 100% accurate |
|
inline |
Triggers the mesh to recalculate its mesh at the end of the next frame
approximate | Currently unused |
parentJobId | The id of the parent if applicable. Optional. |
|
inline |
Used to override the internal check for ReferenceItems and DereferenceItems This is ONLY useful if you're procedurally creating these assets yourself This will set the internal cache flag for reference counting w/o changing references
referenced |
|
inline |
Reapply all decals to this mesh without waiting for next frame. Calling this yourself is unnecessary as Astra manages it for you, this is only necessary if you manually manipulate the decals or want to immediately schedule the process. Internally this schedules sub jobs that all wait for completion states. This call is relatively expensive and you should avoid calling it unless absolutely necessary such as needing to read or wait to show the final computed values of the decal system.
parentJobId | Id of the parent job, if it applies. Optional. |
|
inlinestatic |
Whether the skinned mesh renderer should update when not visible
state | True if it should update offscreen |
|
staticprotected |
|
staticprotected |