Astra Unity 2.6.6
Astra Unity Plugin
Astra.Asset.DecalItem Class Reference

DecalItems are attached to MeshItems and apply a blended material on top of an existing material. They can either completely replace the textures or be smoothly blended into the textures based on the PrimitiveDecal.MaterialTarget[x].MaterialBlendingFunction More...

Inheritance diagram for Astra.Asset.DecalItem:

Public Member Functions

void MarkDirty ()
 Used to manually trigger that a decal needs to be rebuilt. Use of this is only necessary if you directly manipulate the internal material of the decal. This will signal that the next frame should update DecalItem.Sync the decal.
 
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 ReferenceItems (bool force=false)
 Increments any references such as textures or materials This is used internally when creating and cloning items More...
 
void DereferenceItems ()
 Inverses ReferenceItems, does nothing if not referenced
 
void Sync (bool refresh=false, int parentJobId=Job.kNoParentJobId)
 Immediately schedule a reapply of the decal to the mesh, if needed.
It will only be reapplied if the decal is marked dirty, or if refresh is true. This will trigger the MeshItem.SyncDecals call for you. More...
 
void RemoveConflictingDecals ()
 Looks for other decals on this applied MeshItem and removes them. This is useful if you only want a single decal applie to a MeshItem at one time. This is automatically done for you if you use DecalLoadJob.DecalLoadOptions.autoEvict when loading a decal.
 
Color? GetColor (int submaterialSlot, int materialSlot=0)
 Retrieve the color tint for decal materials NOTE: materialSlot is IGNORED it's here so the function sig matches MeshItem More...
 
bool ApplyColor (Color color, int submaterialSlot=0, int materialSlot=0)
 Set the color tint for decal materials NOTE: materialSlot is IGNORED it's here so the function sig matches MeshItem More...
 
bool ClearColor (int subMaterialSlot=0, int materialSlot=0)
 Erases the existing color from the material/decal if any are set NOTE: materialSlot is IGNORED it's here so the function sig matches MeshItem More...
 
void SyncColorsIntoMaterial ()
 Used to copy any color data from the Colors dictionary into the DecalMaterials used by the decal system. This is useful if you are manipulating the Colors dictionary yourself manually and want them applied after. You can ignore this call if you are not manually altering the Colors dictionary. The inverse of this is CopyMaterialIntoColorData.
 
bool CopyMaterialIntoColorData (int subMaterialSlot=-1, int materialSlot=-1)
 Copies the "base material tints" from DecalMaterials into the Colors property. NOTE: materialSlot is IGNORED it's here so the function sig matches MeshItem The inverse of this is SyncColorsIntoMaterial. 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 ()
 Return the number of subMaterials this DecalItem has More...
 
void OnBeforeSceneSerialize ()
 Fired before a scene is saved in the Unity Editor NOTE: this is never fired in runtime builds More...
 
void OnAfterSceneDeserialize ()
 Fired after a scene has loaded NOTE: this IS fired in both the Unity Editor and runtime builds More...
 
bool IsSceneSerialized ()
 Tells the system if the object has been serialized or not. This should report True if and only if OnBeforeSceneSerialize was triggered and serialized and it has not yet been deserialized 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...
 

Public Attributes

List< MaterialTargetmaterialTargets = new List<MaterialTarget>()
 
string morphGuid
 
float Layer = 1.0f
 The stacking order, used with albedo and metals
 
float Strength = 1.0f
 if 0 none of the decal is visible, if 1 100% opacity, can be overdriven, range is 0->1 if overdriven you will end up with odd colors
 
List< string > Tags = new List<string>()
 List of tags assigned to this DecalItem
 
SerializableDictionaryIColor Colors = new SerializableDictionaryIColor()
 Allows tinting of the decal by material assignment just like MeshItem, this is just a handy way to normalize these values when we apply this tint to the material itself in the decal key is the "submaterialslot" not material slot (right now decals are limited to a single material)
 
SerializableDictionarySMat DecalMaterials = new SerializableDictionarySMat()
 The decal materials currently being used. It is unadvised to access these materials yourself rather let the decal system handle them for you. Key is the submesh guid being targetted. Value is the unity material that is generated. More...
 

Protected Attributes

bool _isApplied = false
 
MeshItem _meshItem
 
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 _isSceneSerialized = false
 
- Protected Attributes inherited from Astra.Asset.ItemBase
List< string > _trackingIds = null
 

Properties

override McsSdk20.Primitives.AstraPrimitiveType PrimitiveType [get]
 
override McsSdk20.Primitives.SchematicType SchematicType [get]
 
bool IsApplied [get]
 Whether the DecalItem is currently visible/enabled
 
MeshItem MeshItem [get]
 This is the mesh we're being applied to, it might be a figure or clothing or anything else
 
string MeshId [get]
 Guid of the MeshItem this decal is attached to
 
- 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]
 

Additional Inherited Members

- Protected Member Functions inherited from Astra.Asset.ItemBase
void TrackId (string id)
 
void UntrackIds ()
 

Detailed Description

DecalItems are attached to MeshItems and apply a blended material on top of an existing material. They can either completely replace the textures or be smoothly blended into the textures based on the PrimitiveDecal.MaterialTarget[x].MaterialBlendingFunction

Member Function Documentation

◆ ApplyColor()

bool Astra.Asset.DecalItem.ApplyColor ( Color  color,
int  submaterialSlot = 0,
int  materialSlot = 0 
)
inline

Set the color tint for decal materials NOTE: materialSlot is IGNORED it's here so the function sig matches MeshItem

Parameters
subMaterialSlotWhich sub material slot (0->3)
materialSlotThis is ignored. Only here to match MeshItem signature

Implements Astra.Asset.IColorInterface.

◆ ClearColor()

bool Astra.Asset.DecalItem.ClearColor ( int  subMaterialSlot = 0,
int  materialSlot = 0 
)
inline

Erases the existing color from the material/decal if any are set NOTE: materialSlot is IGNORED it's here so the function sig matches MeshItem

Parameters
subMaterialSlotWhich sub material slot (0->3)
materialSlotThis is ignored. Only here to match MeshItem signature

Implements Astra.Asset.IColorInterface.

◆ CopyMaterialIntoColorData()

bool Astra.Asset.DecalItem.CopyMaterialIntoColorData ( int  subMaterialSlot = -1,
int  materialSlot = -1 
)
inline

Copies the "base material tints" from DecalMaterials into the Colors property. NOTE: materialSlot is IGNORED it's here so the function sig matches MeshItem The inverse of this is SyncColorsIntoMaterial.

Parameters
subMaterialSlotWhich sub material slot (0->3)
materialSlotThis is ignored. Only here to match MeshItem signature
Returns
True if we were able to find a material and sync the colors into Colors, false otherwise

Implements Astra.Asset.IColorInterface.

◆ GetColor()

Color? Astra.Asset.DecalItem.GetColor ( int  submaterialSlot,
int  materialSlot = 0 
)
inline

Retrieve the color tint for decal materials NOTE: materialSlot is IGNORED it's here so the function sig matches MeshItem

Parameters
subMaterialSlotWhich sub material slot (0->3)
materialSlotThis is ignored. Only here to match MeshItem signature
Returns

Implements Astra.Asset.IColorInterface.

◆ GetColorOptionCount()

int Astra.Asset.DecalItem.GetColorOptionCount ( int  subMaterialSlot)
inline

Get the number of color options for the given sub material slot

Parameters
subMaterialSlotWhich sub material slot (0->3)

Implements Astra.Asset.IColorInterface.

◆ GetColorPaletteOptions()

List< List< Color > > Astra.Asset.DecalItem.GetColorPaletteOptions ( int  subMaterialSlot)
inline

Get the color options for what can go into the given sub material slot

Parameters
subMaterialSlotWhich sub material slot (0->3)

Implements Astra.Asset.IColorInterface.

◆ GetMaterialCount()

int Astra.Asset.DecalItem.GetMaterialCount ( )
inline

Return the number of subMaterials this DecalItem has

Implements Astra.Asset.IColorInterface.

◆ IsSceneSerialized()

bool Astra.Asset.DecalItem.IsSceneSerialized ( )
inline

Tells the system if the object has been serialized or not. This should report True if and only if OnBeforeSceneSerialize was triggered and serialized and it has not yet been deserialized

Returns
True if we've manipulated the object for scene saving, false otherwise

Implements Astra.Asset.ISceneSerializable.

◆ OnAfterSceneDeserialize()

void Astra.Asset.DecalItem.OnAfterSceneDeserialize ( )
inline

Fired after a scene has loaded NOTE: this IS fired in both the Unity Editor and runtime builds

Implements Astra.Asset.ISceneSerializable.

◆ OnBeforeSceneSerialize()

void Astra.Asset.DecalItem.OnBeforeSceneSerialize ( )
inline

Fired before a scene is saved in the Unity Editor NOTE: this is never fired in runtime builds

Implements Astra.Asset.ISceneSerializable.

◆ ReferenceItems()

void Astra.Asset.DecalItem.ReferenceItems ( bool  force = false)
inline

Increments any references such as textures or materials This is used internally when creating and cloning items

Parameters
forceIf true, will increase references even if already set

◆ SetReferencedItems()

void Astra.Asset.DecalItem.SetReferencedItems ( bool  referenced)
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

Parameters
referenced

◆ Sync()

void Astra.Asset.DecalItem.Sync ( bool  refresh = false,
int  parentJobId = Job.kNoParentJobId 
)
inline

Immediately schedule a reapply of the decal to the mesh, if needed.
It will only be reapplied if the decal is marked dirty, or if refresh is true. This will trigger the MeshItem.SyncDecals call for you.

Parameters
refreshIf true, force the decal to be synced, regardless of whether it is marked dirty
parentJobIdJob ID of a parent job for debugging purposes. Not required.

Member Data Documentation

◆ DecalMaterials

SerializableDictionarySMat Astra.Asset.DecalItem.DecalMaterials = new SerializableDictionarySMat()

The decal materials currently being used. It is unadvised to access these materials yourself rather let the decal system handle them for you. Key is the submesh guid being targetted. Value is the unity material that is generated.

Returns

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