Skip to main content

mur_common/hub/
style_preset.rs

1use serde::{Deserialize, Serialize};
2
3/// Top-level style preset descriptor, embedded as YAML in the binary for
4/// built-ins, or loaded from `~/.mur/hub/presets/<id>.yaml` for user presets.
5#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
6pub struct StylePreset {
7    pub id: String,
8    pub display_name: String,
9    pub author: String,
10    pub version: u32,
11    pub family: PresetFamily,
12    pub description: String,
13    pub llm_image_gen: LlmImageGen,
14    pub expressions: Vec<ExpressionDef>,
15    pub renderer: RendererConfig,
16}
17
18/// Visual style family — determines the render pipeline and default sizes.
19#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq)]
20#[serde(rename_all = "lowercase")]
21pub enum PresetFamily {
22    Chibi,
23    Pixel,
24    Live2d,
25    Polaroid,
26}
27
28/// LLM image generation parameters baked into the preset.
29#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
30pub struct LlmImageGen {
31    pub base_prompt: String,
32    pub negative_prompt: String,
33    /// Resolution string, e.g. "512x512".
34    pub size: String,
35    pub steps: u32,
36    /// img2img mode — required for the polaroid family.
37    #[serde(default)]
38    pub img2img: bool,
39    /// Whether the user must supply a source photo before render.
40    #[serde(default)]
41    pub requires_source_image: bool,
42}
43
44/// One of the 12 canonical expression slots with its prompt modifier.
45#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
46pub struct ExpressionDef {
47    pub id: String,
48    pub prompt_suffix: String,
49}
50
51/// Renderer display configuration baked into the preset.
52#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
53pub struct RendererConfig {
54    pub family: PresetFamily,
55    pub default_size: SizeConfig,
56    pub idle_animation: IdleAnimation,
57    /// Min / max blink interval in seconds (two-element array).
58    pub blink_interval_s: [f32; 2],
59    pub crossfade_ms: u32,
60}
61
62#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq)]
63pub struct SizeConfig {
64    pub w: u32,
65    pub h: u32,
66}
67
68#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq)]
69#[serde(rename_all = "lowercase")]
70pub enum IdleAnimation {
71    Breathe,
72    None,
73}