PuppetSpec#
Import |
|
Defined in |
|
Install |
|
Since |
0.1 |
Stability |
Public: follows semantic versioning. Below 1.0, a minor release may change it, and the CHANGELOG says how. |
- class scenet.assets.contract.PuppetSpec[source]#
Bases:
StrictThe complete geometric contract for one character.
Everything the solver may know about a character, and nothing it draws: proportions in head units, a skeleton, named anchors, the face, its poses and expressions. The asset contract reference describes the file format, field by field.
Example
>>> from scenet import PuppetSpec, default_library >>> alice = default_library().get("alice") >>> isinstance(alice, PuppetSpec), alice.name, "mouth" in alice.anchors (True, 'alice', True)
See also
load_puppet, to read one from a file.Landmark, the crop lines it declares.- landmarks: dict[Landmark, float]#
Each vertical body landmark, as a distance down from the top of the head, in head units: the crop lines a shot type names.
- anchors: dict[str, AnchorSpec]#
Named attachment points, such as
mouthandeyes, each on a joint.
- expressions: dict[str, ExpressionSpec]#
Named expressions, each a state of brow, eyes and mouth.
- property heads_tall: float#
Height in head-heights – the classic figure-drawing proportion.
The unit the camera works in. Two puppets of different
heads_tallframed at the same shot produce figures of visibly different build, which is the whole reason the shipped library has a 7.5-head character and a taller one.
- pose_angles(pose)[source]#
Look up the joint angles for a named pose.
- Parameters:
pose (
str) – Name of a pose this puppet declares.- Return type:
- Returns:
Joint name to angle in degrees. Joints absent from the mapping keep their rest angle.
- Raises:
UnknownPoseError – This puppet has no pose by that name. The message lists the ones it does have. Also a
KeyError, soexcept KeyErrorkeeps working.
- expression_states(expression)[source]#
Look up the feature states for a named expression.
The counterpart of
pose_angles, and deliberately identical in shape down to the error: an expression is selected by name exactly as a pose is.- Parameters:
expression (
str) – Name of an expression this puppet declares.- Return type:
- Returns:
The states its features take.
- Raises:
UnknownExpressionError – This puppet has no expression by that name. The message lists the ones it does have. Also a
KeyError, soexcept KeyErrorkeeps working.
Example
>>> from scenet import default_library >>> alice = default_library().get("alice") >>> alice.expression_states("angry").mouth.value 'frown'