Posing
Posing. A plugin puts each character in the scene with its skeleton, and hands its bones and weights here each frame, which Wraith changes in place. Any thread.
Posing
Section titled “Posing”Get it with Api.posing().
claim(changed: Wraith.Lease.Changed | null): Wraith.Leaseactive(): booleanpose(entity: import("salamander").Given<Wraith.Scene.Id>, matrices: number | bigint | Wraith.Mat4 | null): voidshapes(entity: import("salamander").Given<Wraith.Scene.Id>, weights: number | bigint): voidwanted(entity: import("salamander").Given<Wraith.Scene.Id>): booleanplace(entity: import("salamander").Given<Wraith.Scene.Id>, to_world: import("salamander").Given<Wraith.Mat4>): booleanaddSolver(info: import("salamander").Given<Wraith.Ik.Info>, solve: Wraith.Ik.Solve, options: Wraith.Ik.DrawOptions | null): voidremoveSolver(id: string): voidclaim(changed: Wraith.Lease.Changed|nil): Wraith.Leaseactive(): booleanpose(entity: Wraith.Scene.Id, matrices: integer|Wraith.Mat4|nil)shapes(entity: Wraith.Scene.Id, weights: integer)wanted(entity: Wraith.Scene.Id): booleanplace(entity: Wraith.Scene.Id, to_world: Wraith.Mat4): booleanaddSolver(info: Wraith.Ik.Info, solve: Wraith.Ik.Solve, options: Wraith.Ik.DrawOptions|nil)removeSolver(id: string)Wraith.Lease? Claim(Wraith.Lease.Changed? changed)bool Active()void Pose(Wraith.Scene.Id entity, Wraith.Mat4* matrices)void Shapes(Wraith.Scene.Id entity, float* weights)bool Wanted(Wraith.Scene.Id entity)bool Place(Wraith.Scene.Id entity, ref Wraith.Mat4 to_world)void AddSolver(Wraith.Ik.Info info, Wraith.Ik.Solve? solve, Wraith.Ik.DrawOptions? options)void RemoveSolver(string id)sal::Result<Wraith::Lease, Wraith::LeaseError> claim(Wraith::Lease_Changed changed) constbool active() constvoid pose(Wraith::Scene_Id entity, Wraith::Mat4 *matrices) constvoid shapes(Wraith::Scene_Id entity, float *weights) constbool wanted(Wraith::Scene_Id entity) constbool place(Wraith::Scene_Id entity, Wraith::Mat4 *to_world) constsal::Result<void, Wraith::PosingError> addSolver(Wraith::Ik::Info info, Wraith::Ik::Solve solve, Wraith::Ik::DrawOptions options) constvoid removeSolver(std::string_view id) constpub fn claim(&self, changed: wraith::LeaseChanged) -> Result<wraith::Lease, wraith::LeaseError>pub fn active(&self) -> boolpub fn pose(&self, entity: wraith::SceneId, matrices: *mut wraith::Mat4)pub fn shapes(&self, entity: wraith::SceneId, weights: *mut f32)pub fn wanted(&self, entity: wraith::SceneId) -> boolpub fn place(&self, entity: wraith::SceneId, to_world: *mut wraith::Mat4) -> boolpub fn add_solver(&self, info: wraith::ik::Info, solve: wraith::ik::Solve, options: wraith::ik::DrawOptions) -> Result<(), wraith::PosingError>pub fn remove_solver(&self, id: &str)fn claim(self: Wraith.Posing, changed: ?Wraith.Lease.Changed) (Wraith.LeaseError || rt.Failure)!Wraith.Leasefn active(self: Wraith.Posing) boolfn pose(self: Wraith.Posing, entity: Wraith.Scene.Id, matrices: *Wraith.Mat4) voidfn shapes(self: Wraith.Posing, entity: Wraith.Scene.Id, weights: *f32) voidfn wanted(self: Wraith.Posing, entity: Wraith.Scene.Id) boolfn place(self: Wraith.Posing, entity: Wraith.Scene.Id, to_world: *Wraith.Mat4) boolfn addSolver(self: Wraith.Posing, info: Wraith.Ik.Info, solve: Wraith.Ik.Solve, options: ?Wraith.Ik.DrawOptions) (Wraith.PosingError || rt.Failure)!voidfn removeSolver(self: Wraith.Posing, id: []const u8) voiduint32_t Wraith_Posing_claim(Wraith_Posing self, Wraith_Lease_Changed changed, Wraith_Lease *out)bool Wraith_Posing_active(Wraith_Posing self)void Wraith_Posing_pose(Wraith_Posing self, Wraith_Scene_Id entity, Wraith_Mat4 *matrices)void Wraith_Posing_shapes(Wraith_Posing self, Wraith_Scene_Id entity, float *weights)bool Wraith_Posing_wanted(Wraith_Posing self, Wraith_Scene_Id entity)bool Wraith_Posing_place(Wraith_Posing self, Wraith_Scene_Id entity, Wraith_Mat4 *to_world)uint32_t Wraith_Posing_addSolver(Wraith_Posing self, Wraith_Ik_Info info, Wraith_Ik_Solve solve, Wraith_Ik_DrawOptions options)void Wraith_Posing_removeSolver(Wraith_Posing self, sal_string id)A lease on posing the game’s characters, see Lease. Only the holder’s are posed.
Fails with LeaseError. Uses Lease.Changed, Lease.
active
Section titled “active”It holds the lease and posing’s in use. When false the game can skip handing bones over.
Each frame per entity with a skeleton, after animation and physics, before anything follows it.
matrices has one per bone, in the space its transform takes to the world’s, row vectors.
shapes
Section titled “shapes”Each frame per entity with shapes, after pose. weights has one per shape, 0 to 1.
Uses Scene.Id.
wanted
Section titled “wanted”Whether the player’s picked or posed it, so the game can animate it in full.
Uses Scene.Id.
Each frame per movable entity, before pose: to_world, where the game has it, becomes where the
player’s moved it, which its bones are handed over relative to. True if it’s moved.
addSolver
Section titled “addSolver”An IK solver chains can pick, till it’s removed or the plugin goes. The same id replaces it.
Fails with PosingError. Uses Ik.Info, Ik.Solve, Ik.DrawOptions.
removeSolver
Section titled “removeSolver”PosingError
Section titled “PosingError”What can go wrong, besides Cancelled, Unsupported and Gone.
| Code | Error | |
|---|---|---|
| 1 | Unavailable |
Posing hasn’t started |
| 2 | InvalidId |
Not letters, digits, _, - and . |
| 3 | InvalidInfo |
Too few or many bones |
| 4 | Failed |
Posing.Transform
Section titled “Posing.Transform”Scaled, then turned, then moved
A struct, 0x28 bytes, aligned to 4.
| Offset | Field | Type | |
|---|---|---|---|
| 0x0 | position |
Vec3 |
|
| 0xc | rotation |
Quat |
|
| 0x1c | scale |
Vec3 |
position: Wraith.Vec3rotation: Wraith.Quatscale: Wraith.Vec3position: Wraith.Vec3rotation: Wraith.Quatscale: Wraith.Vec3Wraith.Vec3 PositionWraith.Quat RotationWraith.Vec3 ScaleWraith::Vec3 positionWraith::Quat rotationWraith::Vec3 scalepub position: wraith::Vec3pub rotation: wraith::Quatpub scale: wraith::Vec3position: Wraith.Vec3rotation: Wraith.Quatscale: Wraith.Vec3Wraith_Vec3 positionWraith_Quat rotationWraith_Vec3 scalePosing.BonePose
Section titled “Posing.BonePose”A struct, 0x38 bytes, aligned to 8.
| Offset | Field | Type | |
|---|---|---|---|
| 0x0 | name |
string |
|
| 0x10 | transform |
Posing.Transform |
name: stringtransform: Wraith.Posing.Transformname: stringtransform: Wraith.Posing.Transformstring NameWraith.Posing.Transform Transformsal::String nameWraith::Posing_Transform transformpub name: salamander::Strpub transform: wraith::PosingTransformname: []const u8transform: Wraith.Posing.Transformsal_string nameWraith_Posing_Transform transformPosing.ShapePose
Section titled “Posing.ShapePose”A struct, 0x28 bytes, aligned to 8.
| Offset | Field | Type | |
|---|---|---|---|
| 0x0 | mesh |
string |
Empty in an edit for every mesh’s shape of that name |
| 0x10 | name |
string |
|
| 0x20 | weight |
f32 |
mesh: stringname: stringweight: numbermesh: stringname: stringweight: numberstring Meshstring Namefloat Weightsal::String meshsal::String namefloat weightpub mesh: salamander::Strpub name: salamander::Strpub weight: f32mesh: []const u8name: []const u8weight: f32sal_string meshsal_string namefloat weightPosing.PoseFile
Section titled “Posing.PoseFile”A .pose file, as JSON: a character as posed, and the edits that made it.
A struct, 0x78 bytes, aligned to 8.
| Offset | Field | Type | |
|---|---|---|---|
| 0x0 | version |
u32 |
Goes up when what’s in it changes |
| 0x8 | actor |
string |
|
| 0x18 | bones |
[]Posing.BonePose |
Each bone relative to its parent, as posed |
| 0x28 | edits |
[]Posing.BonePose |
Only the player’s changes, each in its bone’s own axes, on top of its animation. Till version 3 |
| 0x38 | shapes |
[]Posing.ShapePose |
Every shape’s weight, as posed |
| 0x48 | shape_edits |
[]Posing.ShapePose |
Till version 3 |
| 0x58 | ik |
[]Posing.IkChain |
IK chains, from version 2 |
| 0x68 | changes |
[]Posing.Edit |
Every edit, of every kind, from version 3 |
version: numberactor: stringbones: Array<Wraith.Posing.BonePose>edits: Array<Wraith.Posing.BonePose>shapes: Array<Wraith.Posing.ShapePose>shape_edits: Array<Wraith.Posing.ShapePose>ik: Array<Wraith.Posing.IkChain>changes: Array<Wraith.Posing.Edit>version: integeractor: stringbones: (Wraith.Posing.BonePose)[]edits: (Wraith.Posing.BonePose)[]shapes: (Wraith.Posing.ShapePose)[]shape_edits: (Wraith.Posing.ShapePose)[]ik: (Wraith.Posing.IkChain)[]changes: (Wraith.Posing.Edit)[]uint Versionstring ActorWraith.Posing.BonePose[] BonesWraith.Posing.BonePose[] EditsWraith.Posing.ShapePose[] ShapesWraith.Posing.ShapePose[] ShapeEditsWraith.Posing.IkChain[] IkWraith.Posing.Edit[] Changesuint32_t versionsal::String actorsal::Slice<Wraith::Posing_BonePose> bonessal::Slice<Wraith::Posing_BonePose> editssal::Slice<Wraith::Posing_ShapePose> shapessal::Slice<Wraith::Posing_ShapePose> shape_editssal::Slice<Wraith::Posing_IkChain> iksal::Slice<Wraith::Posing_Edit> changespub version: u32pub actor: salamander::Strpub bones: salamander::Slice<wraith::PosingBonePose>pub edits: salamander::Slice<wraith::PosingBonePose>pub shapes: salamander::Slice<wraith::PosingShapePose>pub shape_edits: salamander::Slice<wraith::PosingShapePose>pub ik: salamander::Slice<wraith::PosingIkChain>pub changes: salamander::Slice<wraith::PosingEdit>version: u32actor: []const u8bones: []const Wraith.Posing.BonePoseedits: []const Wraith.Posing.BonePoseshapes: []const Wraith.Posing.ShapePoseshape_edits: []const Wraith.Posing.ShapePoseik: []const Wraith.Posing.IkChainchanges: []const Wraith.Posing.Edituint32_t versionsal_string actorSlice_Wraith_Posing_BonePose bonesSlice_Wraith_Posing_BonePose editsSlice_Wraith_Posing_ShapePose shapesSlice_Wraith_Posing_ShapePose shape_editsSlice_Wraith_Posing_IkChain ikSlice_Wraith_Posing_Edit changesPosing.EditMode
Section titled “Posing.EditMode”An enum of u8.
| Value | Name | |
|---|---|---|
| 0 | relative |
On top of the game’s, which still moves under it |
| 1 | absolute |
In place of the game’s |
Posing.EditValueKind
Section titled “Posing.EditValueKind”An enum of u8.
| Value | Name | |
|---|---|---|
| 0 | transform |
|
| 1 | weight |
Posing.EditValue
Section titled “Posing.EditValue”A struct, 0x2c bytes, aligned to 4.
| Offset | Field | Type | |
|---|---|---|---|
| 0x0 | tag |
Posing.EditValueKind |
|
| 0x4 | payload |
Posing.EditValue.Members |
tag: Wraith.Posing.EditValueKind | Wraith.Posing.EditValueKindNamepayload: Wraith.Posing.EditValue.Memberstag: Wraith.Posing.EditValueKind|Wraith.Posing.EditValueKindNamepayload: Wraith.Posing.EditValue.MembersWraith.Posing.EditValueKind TagWraith.Posing.EditValue.Members PayloadWraith::Posing_EditValueKind tagWraith::Posing_EditValue_Members payloadpub tag: wraith::PosingEditValueKindpub payload: wraith::PosingEditValueMemberstag: Wraith.Posing.EditValueKindpayload: Wraith_Posing_EditValue_MembersWraith_Posing_EditValueKind tagWraith_Posing_EditValue_Members payloadPosing.Edit
Section titled “Posing.Edit”One of the player’s edits, of any kind.
A struct, 0x60 bytes, aligned to 8.
| Offset | Field | Type | |
|---|---|---|---|
| 0x0 | table |
string |
Its kind, like bones, shapes or placement |
| 0x10 | scope |
string |
What it’s within, like a shape’s mesh, empty for every one |
| 0x20 | key |
string |
What it’s on, like a bone, empty for the character itself |
| 0x30 | mode |
Posing.EditMode |
|
| 0x34 | value |
Posing.EditValue |
table: stringscope: stringkey: stringmode: Wraith.Posing.EditMode | Wraith.Posing.EditModeNamevalue: Wraith.Posing.EditValuetable: stringscope: stringkey: stringmode: Wraith.Posing.EditMode|Wraith.Posing.EditModeNamevalue: Wraith.Posing.EditValuestring Tablestring Scopestring KeyWraith.Posing.EditMode ModeWraith.Posing.EditValue Valuesal::String tablesal::String scopesal::String keyWraith::Posing_EditMode modeWraith::Posing_EditValue valuepub table: salamander::Strpub scope: salamander::Strpub key: salamander::Strpub mode: wraith::PosingEditModepub value: wraith::PosingEditValuetable: []const u8scope: []const u8key: []const u8mode: Wraith.Posing.EditModevalue: Wraith.Posing.EditValuesal_string tablesal_string scopesal_string keyWraith_Posing_EditMode modeWraith_Posing_EditValue valuePosing.IkSpace
Section titled “Posing.IkSpace”An enum of u8.
| Value | Name | |
|---|---|---|
| 0 | character |
Moves with the character |
| 1 | world |
Posing.IkChain
Section titled “Posing.IkChain”A chain of bones turned so its tip reaches a target, every frame after the edits.
A struct, 0x80 bytes, aligned to 8.
| Offset | Field | Type | |
|---|---|---|---|
| 0x0 | tip |
string |
The last bone, which reaches the target |
| 0x10 | bones |
u32 |
How many, the tip and those above it |
| 0x18 | solver |
string |
An Ik.Info id, like wraith.two_bone, or plugin.id for a plugin’s |
| 0x28 | target |
Posing.Transform |
In space. Its rotation only counts with match_rotation |
| 0x50 | space |
Posing.IkSpace |
|
| 0x51 | has_pole |
bool |
Where the bend points, in space, with has_pole |
| 0x54 | pole |
Vec3 |
|
| 0x60 | weight |
f32 |
0 to 1 |
| 0x64 | enabled |
bool |
|
| 0x65 | auto_bake |
bool |
Not solved each frame. Moving the target bakes it into the edits instead |
| 0x66 | match_rotation |
bool |
The tip turned to the target’s rotation too |
| 0x68 | iterations |
u32 |
|
| 0x6c | tolerance |
f32 |
|
| 0x70 | options |
string |
The solver’s own settings |
tip: stringbones: numbersolver: stringtarget: Wraith.Posing.Transformspace: Wraith.Posing.IkSpace | Wraith.Posing.IkSpaceNamehas_pole: booleanpole: Wraith.Vec3weight: numberenabled: booleanauto_bake: booleanmatch_rotation: booleaniterations: numbertolerance: numberoptions: stringtip: stringbones: integersolver: stringtarget: Wraith.Posing.Transformspace: Wraith.Posing.IkSpace|Wraith.Posing.IkSpaceNamehas_pole: booleanpole: Wraith.Vec3weight: numberenabled: booleanauto_bake: booleanmatch_rotation: booleaniterations: integertolerance: numberoptions: stringstring Tipuint Bonesstring SolverWraith.Posing.Transform TargetWraith.Posing.IkSpace Spacebool HasPoleWraith.Vec3 Polefloat Weightbool Enabledbool AutoBakebool MatchRotationuint Iterationsfloat Tolerancestring Optionssal::String tipuint32_t bonessal::String solverWraith::Posing_Transform targetWraith::Posing_IkSpace spacebool has_poleWraith::Vec3 polefloat weightbool enabledbool auto_bakebool match_rotationuint32_t iterationsfloat tolerancesal::String optionspub tip: salamander::Strpub bones: u32pub solver: salamander::Strpub target: wraith::PosingTransformpub space: wraith::PosingIkSpacepub has_pole: boolpub pole: wraith::Vec3pub weight: f32pub enabled: boolpub auto_bake: boolpub match_rotation: boolpub iterations: u32pub tolerance: f32pub options: salamander::Strtip: []const u8bones: u32solver: []const u8target: Wraith.Posing.Transformspace: Wraith.Posing.IkSpacehas_pole: boolpole: Wraith.Vec3weight: f32enabled: boolauto_bake: boolmatch_rotation: booliterations: u32tolerance: f32options: []const u8sal_string tipuint32_t bonessal_string solverWraith_Posing_Transform targetWraith_Posing_IkSpace spacebool has_poleWraith_Vec3 polefloat weightbool enabledbool auto_bakebool match_rotationuint32_t iterationsfloat tolerancesal_string optionsIk.Info
Section titled “Ik.Info”A struct, 0x40 bytes, aligned to 8.
| Offset | Field | Type | |
|---|---|---|---|
| 0x0 | id |
string |
Letters, digits, _, - and .. Chains name it as plugin.id |
| 0x10 | title |
string |
|
| 0x20 | help |
string |
|
| 0x30 | min_bones |
u32 |
Bones in a chain it takes, the tip included. 0 for no most |
| 0x34 | max_bones |
u32 |
|
| 0x38 | pole |
bool |
It bends toward Request.pole |
id: stringtitle: stringhelp: stringmin_bones: numbermax_bones: numberpole: booleanid: stringtitle: stringhelp: stringmin_bones: integermax_bones: integerpole: booleanstring Idstring Titlestring Helpuint MinBonesuint MaxBonesbool Polesal::String idsal::String titlesal::String helpuint32_t min_bonesuint32_t max_bonesbool polepub id: salamander::Strpub title: salamander::Strpub help: salamander::Strpub min_bones: u32pub max_bones: u32pub pole: boolid: []const u8title: []const u8help: []const u8min_bones: u32max_bones: u32pole: boolsal_string idsal_string titlesal_string helpuint32_t min_bonesuint32_t max_bonesbool poleIk.Request
Section titled “Ik.Request”A struct, 0x58 bytes, aligned to 8.
| Offset | Field | Type | |
|---|---|---|---|
| 0x0 | chain |
[]Mat4 |
Root first, tip last, each the one before’s child, in the character’s space, row vectors |
| 0x10 | bones |
[]string |
Root first, tip last, each the one before’s child, in the character’s space, row vectors |
| 0x20 | target |
Vec3 |
Where the tip goes, in the character’s space |
| 0x2c | has_pole |
bool |
|
| 0x30 | pole |
Vec3 |
|
| 0x3c | iterations |
u32 |
|
| 0x40 | tolerance |
f32 |
|
| 0x48 | options |
string |
The chain’s own settings, as DrawOptions left them |
chain: Array<Wraith.Mat4>bones: Array<string>target: Wraith.Vec3has_pole: booleanpole: Wraith.Vec3iterations: numbertolerance: numberoptions: stringchain: (Wraith.Mat4)[]bones: (string)[]target: Wraith.Vec3has_pole: booleanpole: Wraith.Vec3iterations: integertolerance: numberoptions: stringWraith.Mat4[] Chainstring[] BonesWraith.Vec3 Targetbool HasPoleWraith.Vec3 Poleuint Iterationsfloat Tolerancestring Optionssal::Slice<Wraith::Mat4> chainsal::Slice<sal::String> bonesWraith::Vec3 targetbool has_poleWraith::Vec3 poleuint32_t iterationsfloat tolerancesal::String optionspub chain: salamander::Slice<wraith::Mat4>pub bones: salamander::Slice<salamander::Str>pub target: wraith::Vec3pub has_pole: boolpub pole: wraith::Vec3pub iterations: u32pub tolerance: f32pub options: salamander::Strchain: []const Wraith.Mat4bones: []const []const u8target: Wraith.Vec3has_pole: boolpole: Wraith.Vec3iterations: u32tolerance: f32options: []const u8Slice_Wraith_Mat4 chainSlice_string bonesWraith_Vec3 targetbool has_poleWraith_Vec3 poleuint32_t iterationsfloat tolerancesal_string optionsIk.Solve
Section titled “Ik.Solve”Any thread, each chain each frame. The chain solved, root first, or empty to leave it, read before
the next call. Don’t call Posing from inside it.
Wraith.Ik.SolveWraith.Ik.SolveWraith.Ik.SolveWraith::Ik::Solvewraith::ik::SolveWraith.Ik.SolveWraith_Ik_SolveIk.DrawOptions
Section titled “Ik.DrawOptions”Render thread, under Wraith’s settings for a chain: its own, returning options as changed.
Wraith.Ik.DrawOptionsWraith.Ik.DrawOptionsWraith.Ik.DrawOptionsWraith::Ik::DrawOptionswraith::ik::DrawOptionsWraith.Ik.DrawOptionsWraith_Ik_DrawOptionswraith.io · Mods on the Hub · Get Wraith
Made with ♥ by Asgard
