Nodes/MKRShift_Nodes/Affinity Document Import
ComfyUI Node

Affinity Document Import

Bringing Affinity layer data into the graph as clean JSON

By criskb·Created 7 months ago·Updated 5 months ago· 0
Affinity Document Import
    • affinity_packet_json
    • layer_manifest_json
    • summary_json
    affinity_payload_json

    The MKRShift Nodes host-addon lane covers a lot of creative apps, and Affinity is one of the more interesting entries - not because of Affinity itself, but because the whole bridge is built on a compatibility trick. Affinity Photo runs Photoshop plugins, so this pack's Affinity route leans on that compatibility instead of building a native extension. Affinity Document Import is the front door of that lane: it takes whatever JSON payload the Affinity addon hands you and normalizes it into a standard, predictable bridge packet that the rest of the graph can consume.

    If you're new to this part of the pack: the addons are packet-first. Your host app (running the matching addon script from addons/affinity/) exports a JSON payload describing the document; the corresponding ComfyUI node ingests it. This node is the ingestion step for Affinity documents.

    How it works

    The single required input is affinity_payload_json, a multiline string of JSON. The node parses it and pulls out the fields that matter for a document handoff: document_name (defaulting to "Untitled.afphoto" if absent), persona (which Affinity persona the document is in - the app's Photo/Designer/Publisher modes), and layers, the list of layer data. It then packages them into a canonical mkrshift_affinity_bridge_v1 packet with a predictable shape, so anything downstream doesn't care whether the source was Affinity Photo, Designer, or a hand-written test payload.

    The layers list also comes out separately as layer_manifest_json - that's the output you'd wire into anything that reasons about layer structure, like a node that picks a target layer by name for placement. summary_json rounds it out with the document name, layer count, and any parse warnings.

    Outputs

    • affinity_packet_json - the normalized bridge packet (schema, document name, persona, layers)
    • layer_manifest_json - the layer list on its own, for layer-targeting logic
    • summary_json - document name, layer count, warnings

    Installation

    cd ComfyUI/custom_nodes
    git clone https://github.com/criskb/MKRShift_Nodes
    

    Restart ComfyUI, or search "MKRShift Nodes" in ComfyUI Manager. No pip dependencies - this node is pure JSON normalization.

    Common issues

    The one real gotcha is input shape. If the payload you paste isn't valid JSON, the parser silently falls back to defaults - you get "Untitled.afphoto" and zero layers, with a warning in the summary rather than a crash. So if your graph suddenly shows an empty document, check the payload first: the source defaults quietly, and quiet is the enemy. Second, remember this node only normalizes metadata - it does not load pixels. For actual image content you want the pack's image-import lane (like MKRAfterEffectsImageImport for AE); Affinity's layer data here is structural, not raster. And third, this is the "import document" half of a roundtrip: pair it with the Affinity export plan/output nodes to send results back, or you've built a one-way street. It's a small node, but it's the reason the Affinity lane can treat every document the same way regardless of persona.

    CategoryMKRShift Nodes/Addons/Affinity

    Inputs (1)

    NameTypeDefaultDescription
    affinity_payload_jsonSTRING

    Outputs (3)

    NameTypeDescription
    affinity_packet_jsonSTRING
    layer_manifest_jsonSTRING
    summary_jsonSTRING