Get RAPTOR

RaptorHotspotApi

Hotspot queries and edits for modules, without the Hotspot internals.

NamespaceAssemblyKindStability
Raptor.EditorToolsRaptor.Editorclasspreview, since 0.1.0

Mesh and face types are passed through as opaque values.

public static class RaptorHotspotApi

Properties

RegistryEpoch

public static int RegistryEpoch { get; }

Increments on every RaptorHotspotRegistry.Refresh. Use it to invalidate caches built from the registry.

Methods

AutoPatch

public static int AutoPatch()

Resets each target face to its sheet's automatic fit, as one undo step.

Returns: The number of faces changed.

ClearSheetCache

public static void ClearSheetCache()

Clears the sheet cache. The next fit measures the sheets again.

CurrentPatch

public static bool CurrentPatch(PolygonMesh mesh, FaceHandle h, out string atlasGuid, out Vector4 rect)

Gets the patch shown on a face, as a member GUID and authored rect. For a companion, this is the companion's source panel.

ParameterTypeDescription
meshPolygonMeshThe Block's editable mesh.
hFaceHandleThe face handle.
atlasGuidout stringThe combo member's GUID.
rectout Vector4The patch's authored rect.

Returns: False when the face is not a sheet face or has no patch.

ExtractCompanions

public static int ExtractCompanions(RaptorHotspotAtlas atlas)

Creates a sheet's tiling companions, one for every tile-divisible panel shape across its combo. Companions that already exist, matched by name, are skipped.

ParameterTypeDescription
atlasRaptorHotspotAtlasThe sheet.

Returns: The number of companions created.

ExtractCompanions

public static int ExtractCompanions(RaptorHotspotAtlas atlas, Rect? onlyAuthoringRect, RaptorHotspotAtlas onlyMember = null)

Creates the companion for the panel whose authored rect is onlyAuthoringRect on onlyMember, or on atlas when onlyMember is null. Does nothing if that panel already has a companion.

ParameterTypeDefaultDescription
atlasRaptorHotspotAtlasThe sheet.
onlyAuthoringRectRect?The panel's authored rect, or null for every panel.
onlyMemberRaptorHotspotAtlasnullThe combo member the panel is on, or null for the sheet itself.

Returns: The number of companions created.

ForcedPatch

public static bool ForcedPatch(RaptorMeshEditable block, FaceHandle h, out string atlasGuid, out Vector4 rect)

Gets the patch a locked face is forced to, as a member GUID and authored rect.

ParameterTypeDescription
blockRaptorMeshEditableThe Block's editable mesh.
hFaceHandleThe face handle.
atlasGuidout stringThe combo member's GUID.
rectout Vector4The patch's authored rect.

Returns: False when automatic or not locked.

Notify

public static void Notify(string message)

Shows a short toast notification in the open RAPTOR window, the same toast the texture tools use. Does nothing when no RAPTOR window is open.

ParameterTypeDescription
messagestringThe text.

PickPatch

public static int PickPatch(string primaryGuid, string patchAtlasGuid, Vector4 patchRect)

Forces the target faces onto one patch of sheet primaryGuid, as one undo step. The patch is given by member patchAtlasGuid and authored rect patchRect.

ParameterTypeDescription
primaryGuidstringThe sheet's GUID.
patchAtlasGuidstringThe combo member's GUID.
patchRectVector4The patch's authored rect.

Returns: The number of faces changed.

RefitLiveBlocks

public static int RefitLiveBlocks()

Refits the locked faces that use a changed sheet on every live Block. Call it after a sheet changes, such as after a re-bake or a flag or patch edit.

Returns: The number of Blocks visited.

SheetOfFace

public static RaptorHotspotAtlas SheetOfFace(PolygonMesh mesh, FaceHandle h)

Gets the hotspot sheet of a Block face, which is the master of the face's material.

ParameterTypeDescription
meshPolygonMeshThe Block's editable mesh.
hFaceHandleThe face handle.

Returns: The sheet, or null.

SheetValueHash

public static int SheetValueHash(RaptorHotspotAtlas master, bool persistent)

Computes a content hash of a sheet's members, texture sizes, densities and patches. When persistent is true, members are identified by GUID and the hash is stable across sessions. Otherwise they are identified by instance, which suits a per-tick stamp.

ParameterTypeDescription
masterRaptorHotspotAtlasThe sheet.
persistentboolTrue to identify members by GUID.

Returns: The hash.

TargetFaces

public static List<MeshFace> TargetFaces()

Gets the Patch Picker's target faces. These are the hosted Mesh tool's texture faces: the selected faces in Face mode, or the Blocks' faces in Object mode.

Returns: A new list, or null when there is no hosted Mesh tool.