Context
A Context groups related canvases together, typically representing a camera
or pipeline stage. Contexts contain canvases and support canvas resolution
when input dimensions differ from the selected canvas.
fdl.Context(*, label, context_creator=None, canvases=None)
Bases: HandleWrapper
Context facade wrapping a C fdl_context_t handle.
custom_attrs
property
Return all custom attributes as a dictionary.
add_canvas(id, label, source_canvas_id, dimensions, anamorphic_squeeze)
Add a canvas to this context.
custom_attrs_count()
Return the number of custom attributes on this object.
from_model(model)
classmethod
Create a standalone Context facade from a Pydantic model.
Note: Creates a temporary backing document. The returned object is self-contained but not attached to any parent FDL document.
get_custom_attr(name)
Get a custom attribute value by name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Attribute name (without |
required |
Returns:
| Type | Description |
|---|---|
str | int | float | bool | PointFloat | DimensionsFloat | DimensionsInt | None
|
The attribute value, or None if not found. |
has_custom_attr(name)
Check if a custom attribute exists.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Attribute name (without |
required |
remove_custom_attr(name)
Remove a custom attribute.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Attribute name (without |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if the attribute was removed, False if it was not found. |
resolve_canvas_for_dimensions(input_dims, canvas, framing)
Find matching canvas when input dimensions differ from selected canvas.
set_custom_attr(name, value)
Set a custom attribute. Type is inferred from value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Attribute name (without |
required |
value
|
str | int | float | bool | PointFloat | DimensionsFloat | DimensionsInt
|
Attribute value (str, int, float, bool, PointFloat, DimensionsFloat, or DimensionsInt). |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
If value is not str, int, float, bool, PointFloat, DimensionsFloat, or DimensionsInt. |
ValueError
|
If an attribute with the same name exists with a different type. |
to_model()
Convert to a Pydantic ContextModel instance.
Returns a pure-data Pydantic model suitable for serialization, API responses, and interoperability with web frameworks.
fdl.ResolveCanvasResult(canvas, framing_decision, was_resolved)
dataclass
Result of resolving canvas for given input dimensions.
fdl.ClipID(handle, lib, doc_ref=None)
Bases: HandleWrapper
ClipID facade wrapping a C fdl_clip_id_t handle.
custom_attrs
property
Return all custom attributes as a dictionary.
custom_attrs_count()
Return the number of custom attributes on this object.
from_model(model)
classmethod
Create a standalone ClipID facade from a Pydantic model.
Note: Creates a temporary backing document. The returned object is self-contained but not attached to any parent FDL document.
get_custom_attr(name)
Get a custom attribute value by name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Attribute name (without |
required |
Returns:
| Type | Description |
|---|---|
str | int | float | bool | PointFloat | DimensionsFloat | DimensionsInt | None
|
The attribute value, or None if not found. |
has_custom_attr(name)
Check if a custom attribute exists.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Attribute name (without |
required |
remove_custom_attr(name)
Remove a custom attribute.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Attribute name (without |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if the attribute was removed, False if it was not found. |
set_custom_attr(name, value)
Set a custom attribute. Type is inferred from value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Attribute name (without |
required |
value
|
str | int | float | bool | PointFloat | DimensionsFloat | DimensionsInt
|
Attribute value (str, int, float, bool, PointFloat, DimensionsFloat, or DimensionsInt). |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
If value is not str, int, float, bool, PointFloat, DimensionsFloat, or DimensionsInt. |
ValueError
|
If an attribute with the same name exists with a different type. |
to_model()
Convert to a Pydantic ClipIDModel instance.
Returns a pure-data Pydantic model suitable for serialization, API responses, and interoperability with web frameworks.
validate()
Validate this clip_id for mutual exclusion rules.