[PR #20] [MERGED] Add MODEL_3D input encoder to close the encode-side gap #19

Closed
opened 2026-10-26 22:28:57 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Comfy-Org/comfy-remote-nodes/pull/20
Author: @Kosinkadink
Created: 5/17/2026
Status: ✅ Merged
Merged: 5/17/2026
Merged by: @Kosinkadink

Base: main ← Head: feat/model3d-input-encoder


📝 Commits (1)

  • 01f71bd Add MODEL_3D input encoder to close the encode-side gap

📊 Changes

2 files changed (+88 additions, -1 deletions)

View changed files

📝 proxy_node.py (+2 -0)
📝 serialization.py (+86 -1)

📄 Description

Adds the symmetric client-side encoder for File3D values so a remote node descriptor can declare a MODEL_3D input and consume a 3D mesh from an upstream local node (e.g. Load3D, TencentTextToModelNode, MeshyTextToModelNode).

Mirrors the existing AUDIO encoder (encode_audio_input / is_audio_input) and VIDEO encoder (encode_video_input / is_video_input — PR #19) added at comfy_remote_nodes/serialization.py:

  • encode_model3d_input(file3d) reads the primary mesh bytes via File3D.get_data() (returns a BytesIO, per comfy_api.latest._util.geometry_types.File3D) and emits a {type: "model_3d", encoding: "glb_inline", data: b64, format: ...} envelope. encoding="glb_inline" is the generic single-file inline encoding the server-side decoder (decode_model3d_envelope) already dispatches on; the decoder hands the bytes to File3D(BytesIO(...), format) regardless of whether the actual format is glb / obj / fbx / etc., so the encoding name is a logical "inline single-file 3D" tag and the format extra picks the file extension at decode time.
  • is_model3d_input(value) duck-types on the format string attribute + get_data callable. Both are present on the upstream File3D class and the BundledFile3D subclass built lazily in _bundled_file3d_class(). Avoids importing File3D at module load (which would pull torch via the comfy_api tree).
  • _encode_one in proxy_node.py dispatches AUDIO / VIDEO before MODEL_3D as defense-in-depth (the VideoInput shape — save_to + get_duration — does not expose a format string property, so VIDEO and MODEL_3D values don't collide either way).

Multi-file bundles (BundledFile3D-style values where every companion file matters — e.g. an OBJ with sibling .mtl + texture PNGs) are intentionally not supported on the encode path in this PR: the first server consumer is the Tencent Hunyuan3D MODEL_3D-input node family (TencentModelTo3DUVNode / Tencent3DPartNode / Tencent3DTextureEditNode / TencentSmartTopologyNode), and the upstream upload helper upload_3d_model_to_comfyapi(cls, model_3d, file_format) only uploads a single file (model_3d.get_data()). Bundle encode (bundle_inline) lands when a partner node actually needs the companion bytes.

This unblocks 4 Tencent Hunyuan3D nodes (out of 6 in the module) that were deferred to a follow-up PR — see matrix coverage TODO #6. First server consumers ship in a paired comfy-rnp-server PR (TencentModelTo3DUVNode_RNP + Tencent3DPartNode_RNP).


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Comfy-Org/comfy-remote-nodes/pull/20 **Author:** [@Kosinkadink](https://github.com/Kosinkadink) **Created:** 5/17/2026 **Status:** ✅ Merged **Merged:** 5/17/2026 **Merged by:** [@Kosinkadink](https://github.com/Kosinkadink) **Base:** `main` ← **Head:** `feat/model3d-input-encoder` --- ### 📝 Commits (1) - [`01f71bd`](https://github.com/Comfy-Org/comfy-remote-nodes/commit/01f71bd8068909922fad4f54e61e87b0a51b9a7e) Add MODEL_3D input encoder to close the encode-side gap ### 📊 Changes **2 files changed** (+88 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `proxy_node.py` (+2 -0) 📝 `serialization.py` (+86 -1) </details> ### 📄 Description Adds the symmetric client-side encoder for `File3D` values so a remote node descriptor can declare a `MODEL_3D` input and consume a 3D mesh from an upstream local node (e.g. `Load3D`, `TencentTextToModelNode`, `MeshyTextToModelNode`). Mirrors the existing AUDIO encoder (`encode_audio_input` / `is_audio_input`) and VIDEO encoder (`encode_video_input` / `is_video_input` — PR #19) added at `comfy_remote_nodes/serialization.py`: - `encode_model3d_input(file3d)` reads the primary mesh bytes via `File3D.get_data()` (returns a `BytesIO`, per `comfy_api.latest._util.geometry_types.File3D`) and emits a `{type: "model_3d", encoding: "glb_inline", data: b64, format: ...}` envelope. `encoding="glb_inline"` is the generic single-file inline encoding the server-side decoder (`decode_model3d_envelope`) already dispatches on; the decoder hands the bytes to `File3D(BytesIO(...), format)` regardless of whether the actual format is glb / obj / fbx / etc., so the encoding name is a logical "inline single-file 3D" tag and the `format` extra picks the file extension at decode time. - `is_model3d_input(value)` duck-types on the `format` string attribute + `get_data` callable. Both are present on the upstream `File3D` class and the `BundledFile3D` subclass built lazily in `_bundled_file3d_class()`. Avoids importing `File3D` at module load (which would pull torch via the `comfy_api` tree). - `_encode_one` in `proxy_node.py` dispatches AUDIO / VIDEO before MODEL_3D as defense-in-depth (the `VideoInput` shape — `save_to` + `get_duration` — does not expose a `format` string property, so VIDEO and MODEL_3D values don't collide either way). Multi-file bundles (`BundledFile3D`-style values where every companion file matters — e.g. an OBJ with sibling .mtl + texture PNGs) are intentionally not supported on the encode path in this PR: the first server consumer is the Tencent Hunyuan3D MODEL_3D-input node family (`TencentModelTo3DUVNode` / `Tencent3DPartNode` / `Tencent3DTextureEditNode` / `TencentSmartTopologyNode`), and the upstream upload helper `upload_3d_model_to_comfyapi(cls, model_3d, file_format)` only uploads a single file (`model_3d.get_data()`). Bundle encode (`bundle_inline`) lands when a partner node actually needs the companion bytes. This unblocks 4 Tencent Hunyuan3D nodes (out of 6 in the module) that were deferred to a follow-up PR — see matrix coverage TODO #6. First server consumers ship in a paired comfy-rnp-server PR (`TencentModelTo3DUVNode_RNP` + `Tencent3DPartNode_RNP`). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-26 22:28:57 +00:00
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Comfy-Org/comfy-remote-nodes#19
No description provided.