pub struct PlayerData {Show 13 fields
pub schema: u32,
pub title: String,
pub subtitle: String,
pub target: Target,
pub steps: Vec<PlayerStep>,
pub tools: Vec<ToolUse>,
pub tool_pictures: BTreeMap<String, String>,
pub meshes: Vec<PlayerMesh>,
pub nodes: Vec<PlayerNode>,
pub assembly: Vec<PlayerComponent>,
pub motion: Option<Motion>,
pub style: Style,
pub record_key: String,
}Fields§
§schema: u32§title: String§subtitle: String§target: Target§steps: Vec<PlayerStep>Every step in reading order (a step’s children before it).
tools: Vec<ToolUse>Distinct tools, in first-use order.
tool_pictures: BTreeMap<String, String>A picture per tool of the library (by toolId): the server’s own
/api/tools/<id>/picture as built, which the page the PLM serves
loads same-site; the offline page carries only data:image pictures
(PlayerData::inline_tool_pictures), the rest dropped.
meshes: Vec<PlayerMesh>§nodes: Vec<PlayerNode>§assembly: Vec<PlayerComponent>The assembly’s occurrence tree, depth first (a component before its children): the Model tab’s tree and the Parts tab’s cards. Absent from data made before the tree was carried, and from a motion study’s.
motion: Option<Motion>A motion study’s baked frames: with no chapters the page is the study’s player (a timeline over the frames); a step may carry one too (its motion). Absent from instructions made before motion existed.
style: StyleHow the page draws the steps: the document’s style. Data made before styles existed reads as Shaded, as it was drawn; a motion study is Shaded.
record_key: StringWhat an offline page keys a build’s record by in the browser’s
storage (record_key): the instructions’ content, so two documents,
or two revisions of one, never share values. Absent from data made
before the record was kept, and from a motion study’s.
Implementations§
Source§impl PlayerData
impl PlayerData
Sourcepub fn build(block: &Instructions, scene: Scene) -> Result<Self, String>
pub fn build(block: &Instructions, scene: Scene) -> Result<Self, String>
The player data of block over scene.
Sourcepub fn inline_tool_pictures(
&mut self,
fetched: &BTreeMap<String, Option<(String, Vec<u8>)>>,
) -> usize
pub fn inline_tool_pictures( &mut self, fetched: &BTreeMap<String, Option<(String, Vec<u8>)>>, ) -> usize
Put the fetched tool pictures in: for each tool with a picture entry,
fetched[id] as Some((media type, bytes)) becomes a data:image
URL when the type is one the page shows (PNG, JPEG, WebP) and the
bytes are within TOOL_PICTURE_MAX_BYTES; any other entry (not
fetched, no picture, another type, too large) is dropped, so an
offline page never carries a picture it cannot load. Returns how many
were put in.
Sourcepub fn motion_study(
title: &str,
subtitle: &str,
target: Target,
scene: Scene,
motion: Motion,
) -> Result<Self, String>
pub fn motion_study( title: &str, subtitle: &str, target: Target, scene: Scene, motion: Motion, ) -> Result<Self, String>
A motion study’s player: no steps, the scene’s meshes and nodes, and
the study’s frames as motion. title is the study’s name.