RaptorHotspotLocks
Block hotspot locks (Hotspot v2) for code that builds a derived copy of a Block's mesh.
| Namespace | Assembly | Kind | Stability |
|---|---|---|---|
Raptor.EditorTools | Raptor.Editor | class | preview, since 0.1.0 |
Use these members when code such as a modifier that cuts, rounds or re-tessellates a Block's mesh needs the copy to keep the Block's hotspot mapping. Locks are stored per mesh instance and keyed by that mesh's face indices. None of these members change how a lock is fitted.
The usual sequence for a derived copy:
- Call
CopyThrough(orLoad). - Make the cut.
- Call
Dropon the faces the cut rebuilt. - Call
Setto restore a face's earlier state. - Call
MarkAllFitted. - Call
InheritorReleaseon the new faces. - Call
Refit.
public static class RaptorHotspotLocksMethods
Any
public static bool Any(PolygonMesh mesh)Whether mesh has a lock table with at least one entry. Does not create a table.
| Parameter | Type | Description |
|---|---|---|
mesh | PolygonMesh | The Block's editable mesh. |
Returns: True when it has one.
CopyThrough
public static void CopyThrough(PolygonMesh from, PolygonMesh to, Dictionary<FaceHandle, FaceHandle> faceMap)Copies from's locks to a renumbered copy through its face map. Each lock, its island label and its fitted signature move with their face. Does nothing when from has no lock table.
| Parameter | Type | Description |
|---|---|---|
from | PolygonMesh | The source. |
to | PolygonMesh | The copy. |
faceMap | Dictionary<FaceHandle, FaceHandle> | Old face to new face. |
Drop
public static void Drop(PolygonMesh mesh, int face)Removes the lock, fitted signature and origin stored for face face. Use it when an operation reuses a face slot for a different face. Does not create a table.
| Parameter | Type | Description |
|---|---|---|
mesh | PolygonMesh | The Block's editable mesh. |
face | int | A face index of the mesh. |
Inherit
public static bool Inherit(PolygonMesh mesh, int face, int from)Gives face face the lock settings of face from as a separate island, with the same lock word, a new island label and an automatic pick. This is Hotspot v2's rule for a face grown from a locked neighbour.
| Parameter | Type | Description |
|---|---|---|
mesh | PolygonMesh | The Block's editable mesh. |
face | int | A face index of the mesh. |
from | int | The face to copy the lock from. |
Returns: False, with nothing changed, when face from has no entry.
IsLocked
public static bool IsLocked(PolygonMesh mesh, int face)Whether face face of mesh is locked, meaning it has an entry with a nonzero mode.
| Parameter | Type | Description |
|---|---|---|
mesh | PolygonMesh | The Block's editable mesh. |
face | int | A face index of the mesh. |
Returns: True when locked.
Load
public static void Load(PolygonMesh mesh, int[] stored)Replaces mesh's locks with a stored table, in the quadruple format RaptorMesh.HotspotLocks uses and indexed by mesh's faces. Every locked face is recorded as fitted.
| Parameter | Type | Description |
|---|---|---|
mesh | PolygonMesh | The Block's editable mesh. |
stored | int[] | The stored table. |
MarkAllFitted
public static void MarkAllFitted(PolygonMesh mesh)Records every locked face of mesh as fitted in its current state, so the next Refit skips it.
| Parameter | Type | Description |
|---|---|---|
mesh | PolygonMesh | The Block's editable mesh. |
Refit
public static int Refit(PolygonMesh mesh, bool all = false)Refits the locked islands of mesh that changed since they were fitted, or every island when all is true. Call it after new faces inherit. An island that fails to fit does not throw.
| Parameter | Type | Default | Description |
|---|---|---|---|
mesh | PolygonMesh | The Block's editable mesh. | |
all | bool | false | True refits every island. |
Returns: The number of faces written.
Release
public static void Release(PolygonMesh mesh, int face)Releases face face by setting its lock word to 0, so it does not inherit a lock later. Its fitted signature and origin are kept.
| Parameter | Type | Description |
|---|---|---|
mesh | PolygonMesh | The Block's editable mesh. |
face | int | A face index of the mesh. |
Set
public static void Set(PolygonMesh mesh, int face, RaptorHotspotLockState state)Sets the lock of face face to state. Its fitted signature and origin are unchanged.
| Parameter | Type | Description |
|---|---|---|
mesh | PolygonMesh | The Block's editable mesh. |
face | int | A face index of the mesh. |
state | RaptorHotspotLockState | The lock. |
SheetKey
public static object SheetKey(UnityEngine.Material material)Gets an identity object for the hotspot sheet that material belongs to, or null when it is not a sheet material. Materials of the same sheet return the same object. Compare keys with object.ReferenceEquals.
| Parameter | Type | Description |
|---|---|---|
material | UnityEngine.Material | The material. |
Returns: The key, or null.
TableFaces
public static List<int> TableFaces(PolygonMesh mesh)Gets every face index with an entry in mesh's lock table, including released faces, in table order. The list is empty when the mesh has no lock table.
| Parameter | Type | Description |
|---|---|---|
mesh | PolygonMesh | The Block's editable mesh. |
Returns: A new list.
TryGet
public static bool TryGet(PolygonMesh mesh, int face, out RaptorHotspotLockState state)Gets the lock of face face when it is locked. Returns false and sets state to default for a released face, a face with no entry, or a mesh with no lock table. Does not create a table.
| Parameter | Type | Description |
|---|---|---|
mesh | PolygonMesh | The Block's editable mesh. |
face | int | A face index of the mesh. |
state | out RaptorHotspotLockState | The lock. |
Returns: False when not locked.
Unfit
public static void Unfit(PolygonMesh mesh, int face)Releases face face by setting its lock word to 0, so it does not inherit a lock later, and clears its fitted signature. Its origin is kept.
| Parameter | Type | Description |
|---|---|---|
mesh | PolygonMesh | The Block's editable mesh. |
face | int | A face index of the mesh. |
Related types
- RaptorHotspotLockState: A face's hotspot lock as a value that can be copied to another face, read with RaptorHotspotLocks.TryGet and written with RaptorHotspotLocks.Set.
- RaptorMesh: A RAPTOR Mesh Block.