Nodes/comfyui-original-character-generator/OC Generator / Save Settings JSON
ComfyUI Node

OC Generator / Save Settings JSON

The pack's persistence bridge

By nade-eaf4fc·Created 5 months ago·Updated 4 months ago· 1
OC Generator / Save Settings JSON
    • settings
    • settings_json
    • saved_name
    • saved_path
    settings_json{}
    file_nameoc_settings
    save_enabledtrue

    Here's the gap this node fills: everything else in the pack produces or consumes an OC_GENERATOR_SETTINGS object that only exists inside your ComfyUI graph. That's fine while you're in the editor, but it evaporates the moment you close the workflow. OC Generator / Save Settings JSON is the pack's persistence layer - it takes a settings_json string, parses it into a proper settings object, optionally writes it to user_presets/ as a reusable preset, and hands you back the normalized settings for the rest of the graph.

    It's also the import door for the pack's ecosystem. The companion web app (original-character-generator-web) can export compatible settings_json files - this node is how that output gets into ComfyUI. Same for presets you've edited by hand or received from someone else: paste the JSON in, let this node normalize it, done.

    The inputs that matter

    Three, all required:

    • settings_json - a multiline text box holding the JSON object. Defaults to {}. This is where the web app's export (or the settings_json output of the Settings node) goes. The parser is strict: invalid JSON raises an error rather than silently doing nothing, and it has to be a JSON object, not an array or a bare string.
    • file_name - the preset name, default oc_settings. Only used when saving is enabled. The node sanitizes it, so weird characters get stripped rather than producing a corrupt filename.
    • save_enabled - a boolean that decides whether a file actually gets written. Set it false and you get a pure parse-and-normalize node with no disk writes.

    The outputs

    • settings - the parsed OC_GENERATOR_SETTINGS object, normalized (fixed traits defaulted to none, weights clamped to 0–1, preset resolved). This is what you wire into a Generate Character or Show Settings node.
    • settings_json - the re-serialized, normalized JSON string. Feed it back into the input to see what the normalizer actually kept.
    • saved_name and saved_path - filled in when save_enabled is true: the sanitized preset name and the absolute path where it was written (.../custom_nodes/comfyui-original-character-generator/user_presets/<file_name>.json). Leave save_enabled off and these come back empty.

    It's flagged as an output node, so ComfyUI treats it as a graph terminal - it always runs, which is what you want for a node whose whole job is writing a file.

    Install and gotchas

    No dependencies, no model downloads - same as the whole pack:

    cd ComfyUI/custom_nodes
    git clone https://github.com/nade-eaf4fc/comfyui-original-character-generator.git
    

    or install comfyui-original-character-generator via ComfyUI Manager and restart.

    Two things to know. First, saved presets land in the pack's own user_presets/ directory inside custom_nodes - if you reinstall the pack by deleting the folder, you delete your presets. Back them up if you've built up a library. Second, the normalization is opinionated: it fills in defaults for anything missing, so a hand-written JSON with unknown fields will survive the round trip but come back reshaped. If you're diffing a settings file against what you typed, compare against the settings_json output, not your input - that's the ground truth the generators will actually see.

    CategoryOC Generator

    Inputs (3)

    NameTypeDefaultDescription
    settings_jsonSTRING{}
    file_nameSTRINGoc_settings
    save_enabledBOOLEANtrue

    Outputs (4)

    NameTypeDescription
    settingsOC_GENERATOR_SETTINGS
    settings_jsonSTRING
    saved_nameSTRING
    saved_pathSTRING