MediaWidgetStateData
MediaWidgetStateData
Complete serializable state for MediaWidget. More…
#include <MediaWidgetStateData.hpp>
Public Attributes
| Name | |
|---|---|
| std::string | instance_id Unique instance ID (preserved across serialization). |
| std::string | display_name User-visible name for this widget. |
| std::string | displayed_media_key Primary media/video data key being displayed. |
| ViewportState | viewport Zoom, pan, and canvas state. |
| bool | canvas_coord_override_active |
| int | canvas_coord_override_width User-specified logical width (only used when canvas_coord_override_active is true). |
| int | canvas_coord_override_height User-specified logical height (only used when canvas_coord_override_active is true). |
| std::map< std::string, MediaDisplayOptions > | media_options Media/image display settings. |
| std::map< std::string, LineDisplayOptions > | line_options Line display settings. |
| std::map< std::string, MaskDisplayOptions > | mask_options Mask display settings. |
| std::map< std::string, PointDisplayOptions > | point_options Point display settings. |
| std::map< std::string, DigitalIntervalDisplayOptions > | interval_options Interval display settings. |
| std::map< std::string, TensorDisplayOptions > | tensor_options Tensor display settings. |
| LineInteractionPrefs | line_prefs Line tool preferences. |
| MaskInteractionPrefs | mask_prefs Mask tool preferences. |
| PointInteractionPrefs | point_prefs Point tool preferences. |
| RulerPrefs | ruler_prefs Pixel ruler display preferences. |
| SelectToolPrefs | select_prefs Select tool key-filter preferences. |
| EraserToolPrefs | eraser_prefs Eraser tool hover circle preferences. |
| SmoothToolPrefs | smooth_prefs Smooth tool hover circle preferences. |
| std::vector< TextOverlayData > | text_overlays All text overlays. |
| int | next_overlay_id Counter for assigning overlay IDs. |
| MediaToolId | active_media_tool Global Media Viewer toolbar tool. |
| LineToolMode | active_line_mode Current line tool mode. |
| MaskToolMode | active_mask_mode Current mask tool mode. |
| PointToolMode | active_point_mode Current point tool mode. |
| bool | developer_mode Toggle developer diagnostics panel. |
Detailed Description
struct MediaWidgetStateData;Complete serializable state for MediaWidget.
This struct contains all persistent state that should be saved/restored when serializing a workspace. Transient state (hover positions, active drag operations, preview masks, etc.) is intentionally excluded.
State Categories
| Category | Serialized | Examples |
|---|---|---|
| Display Options | ✅ Yes | Colors, alpha, line thickness |
| Viewport | ✅ Yes | Zoom, pan, canvas size |
| Tool Preferences | ✅ Yes | Brush size, edge snapping |
| Active Tool Mode | ✅ Yes | Current line/mask/point mode |
| Text Overlays | ✅ Yes | Labels and annotations |
| Transient State | ❌ No | Hover position, drag state |
Usage
MediaWidgetStateData data;
data.displayed_media_key = "video.mp4";
data.viewport.zoom = 2.0;
// Add line display options
LineDisplayOptions line_opts;
line_opts.hex_color() = "#ff0000";
line_opts.line_thickness = 3;
data.line_options["whisker_1"] = line_opts;
// Serialize to JSON
auto json = rfl::json::write(data);
// Deserialize from JSON
auto result = rfl::json::read<MediaWidgetStateData>(json);Public Attributes Documentation
variable instance_id
std::string instance_id;Unique instance ID (preserved across serialization).
variable display_name
std::string display_name = "Media Viewer";User-visible name for this widget.
variable displayed_media_key
std::string displayed_media_key;Primary media/video data key being displayed.
variable viewport
ViewportState viewport;Zoom, pan, and canvas state.
variable canvas_coord_override_active
bool canvas_coord_override_active {false};When true, the user has manually set the canvas coordinate system. The priority chain will not auto-update it from media or data objects.
variable canvas_coord_override_width
int canvas_coord_override_width {640};User-specified logical width (only used when canvas_coord_override_active is true).
variable canvas_coord_override_height
int canvas_coord_override_height {480};User-specified logical height (only used when canvas_coord_override_active is true).
variable media_options
std::map< std::string, MediaDisplayOptions > media_options;Media/image display settings.
variable line_options
std::map< std::string, LineDisplayOptions > line_options;Line display settings.
variable mask_options
std::map< std::string, MaskDisplayOptions > mask_options;Mask display settings.
variable point_options
std::map< std::string, PointDisplayOptions > point_options;Point display settings.
variable interval_options
std::map< std::string, DigitalIntervalDisplayOptions > interval_options;Interval display settings.
variable tensor_options
std::map< std::string, TensorDisplayOptions > tensor_options;Tensor display settings.
variable line_prefs
LineInteractionPrefs line_prefs;Line tool preferences.
variable mask_prefs
MaskInteractionPrefs mask_prefs;Mask tool preferences.
variable point_prefs
PointInteractionPrefs point_prefs;Point tool preferences.
variable ruler_prefs
RulerPrefs ruler_prefs;Pixel ruler display preferences.
variable select_prefs
SelectToolPrefs select_prefs;Select tool key-filter preferences.
variable eraser_prefs
EraserToolPrefs eraser_prefs;Eraser tool hover circle preferences.
variable smooth_prefs
SmoothToolPrefs smooth_prefs;Smooth tool hover circle preferences.
variable text_overlays
std::vector< TextOverlayData > text_overlays;All text overlays.
variable next_overlay_id
int next_overlay_id = 0;Counter for assigning overlay IDs.
variable active_media_tool
MediaToolId active_media_tool = MediaToolId::Select;Global Media Viewer toolbar tool.
variable active_line_mode
LineToolMode active_line_mode = LineToolMode::None;Current line tool mode.
variable active_mask_mode
MaskToolMode active_mask_mode = MaskToolMode::None;Current mask tool mode.
variable active_point_mode
PointToolMode active_point_mode = PointToolMode::None;Current point tool mode.
variable developer_mode
bool developer_mode = false;Toggle developer diagnostics panel.
Updated on 2026-11-13 at 20:25:39 +0000