Compile¶
Compile declarative layer trees into backend-ready scenes.
compile(root, *, preserve_attributes=False)
¶
Compile a layer tree into a resolution-independent scene.
Traverses the layer tree, resolves channels, applies transforms and scales,
and finalises per-view data frames. Scene- and screen-space sizes remain in
their declared units; call :func:prepare_scene with the render configuration
before passing the scene to a backend.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root
|
Layer | object
|
Root visualization layer. |
required |
preserve_attributes
|
bool
|
Keep inactive source attributes in compiled meshes for observation and pixel picking. Defaults to False for lean render payloads. |
False
|
Returns:
| Type | Description |
|---|---|
Scene
|
A resolution-independent scene containing one view per leaf path. |
Source code in hakowan/compiler/compile.py
condense_layer_tree_to_scene(root)
¶
Flatten each leaf path into a resolved View and collect layout options.
Source code in hakowan/compiler/compile.py
prepare_scene(scene, config)
¶
Resolve configuration-dependent units and return a backend-ready scene.
Validation¶
Validate a Layer or Figure without rendering or mutating it.
Static checks cover attributes, channels, scales, transforms, resources,
scene settings, and backend capabilities. compile_check=True then runs
the real compiler on deep-copied data and checks empty geometry, camera
framing/clipping, and likely layer occlusion.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root
|
Layer | object
|
Layer or Figure to validate. |
required |
backend
|
BackendName | None
|
Target backend, or the configured default when omitted. |
None
|
strict
|
bool
|
Promote backend approximations and ignored features to errors. |
True
|
compile_check
|
bool
|
Compile and inspect the resolved scene after static checks. |
True
|
Returns:
| Type | Description |
|---|---|
ValidationReport
|
A structured report; intrinsic failures are errors in every mode. |
Source code in hakowan/workflow/validation.py
960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 | |
Validation result for a layer and target backend.
Source code in hakowan/workflow/validation.py
errors
property
¶
Return error diagnostics in their original order.
valid
property
¶
Return whether the report contains no error diagnostics.
warnings
property
¶
Return warning diagnostics in their original order.
raise_for_errors()
¶
to_dict()
¶
Return a JSON-safe report including the derived validity flag.
Source code in hakowan/workflow/validation.py
One actionable validation finding.
Source code in hakowan/workflow/validation.py
Bases: ValueError
Raised by :meth:ValidationReport.raise_for_errors.
Source code in hakowan/workflow/validation.py
__init__(report)
¶
Initialize the exception from a structured validation report.