One named piece of an ExplodedView3D: the models that draw it, plus its row of the part table. More...
| Import Statement: | import Clayground.Lab |
A part is a Node holding the Models of one piece, and the facts a view and a lesson need about it: which piece it is (partId), where it travels (offset, in which stage), where a mark or a fingertip lands on it (anchor), when it is explained (order) and what it is made of (role). Those facts are the part table; a subject keeps them in a Qt-free file beside its models and hands each part its row, so the table can be checked by node before a Model is built from it.
The part keeps its DECLARED position as the assembled pose: the owning view captures it into basePosition on completion and writes position itself from then on. That way the assembled scene is authored in plain coordinates - the same numbers the circuit kit's part uses - and the animation is not a binding every part has to carry a copy of.
A part may contain parts: a sub-assembly that comes off as a whole in one stage and then comes apart in the next. Its children's offsets are relative to it.
anchor exists because a mark must not land at the piece's origin: a Box3D's origin is its bottom-centre, so a ring there sits inside whatever is underneath. The anchor is a real child Node, so its scene position is Qt's answer to "where is that point now", not arithmetic that would have to be kept in step with every parent transform.
ExplodePart {
row: Anatomy.partById("case") // id, offset, anchor, order, stage, role
position: Qt.vector3d(0, 1.55, -0.35)
Model { source: "#Cylinder"; ... }
}
See also ExplodedView3D and MarkLayer.
anchor : vector3d |
The local point a mark, an assembly line or a fingertip lands on. Defaults to the piece's own origin.
anchorScene : vector3d |
anchor in scene coordinates, where the piece is now - what a mark or a fingertip is given.
assembledScene : vector3d |
anchor in scene coordinates as if the piece were back in its assembled pose - the other end of its assembly line. Moves with the parent the piece sits in.
basePosition : vector3d |
The assembled pose, captured from the authored position on completion. The view adds the displacement to this.
dimmed : bool |
True while some other piece holds the focus. Written by the owning ExplodedView3D.
displacement : vector3d |
Where the piece is relative to its assembled pose right now, in its own frame. Written by the owning ExplodedView3D.
fade : real |
How far a dimmed piece has faded, 0 (not at all) to 1 - dimOpacity. Written by the owning ExplodedView3D as its focusNow eases.
ghost : real |
A second, independent opacity factor - what an x-ray drives on a shell. Kept apart from focus dimming so a subject can set one without silently overriding the other.
offset : vector3d |
The whole displacement the piece takes at the end of its stage, in the frame of whatever it sits in.
order : int |
Place in the lesson, 1-based. 0 means the piece is drawn but never explained on its own (the silkscreen, the header).
partId : string |
Which piece this is - an authoring token (die.base), identical in every language, and the name every mechanism refers to it by.
role : string |
What the piece is made of, as a role name from the subject's table. The view does not read it; the subject colours by it.
row : var |
The part's row of the table: id, offset, anchor, order, stage, role, plain numbers. Every field the row names is copied into the property of that name; fields the row lacks keep what the part declares. Set it and the piece IS that row.
stage : int |
Which interval of the view's spread moves this piece: 1 travels while spread goes 0 to 1, 2 while it goes 1 to 2. The shell comes off first, then what is inside.