Skip to content

Commit f031689

Browse files
committed
Update viewer fixes and release 1.1.0
1 parent b33253a commit f031689

File tree

5 files changed

+59
-6
lines changed

5 files changed

+59
-6
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ git clone https://github.com/XuanYu-github/comfyui-PlyPreview.git
3838

3939
![加载与刷新 PLY 列表示例](Figure2.png)
4040

41+
### Preview Gaussian 节点键盘操作
42+
- 点击预览区域以获取焦点后,W/S/A/D 平移视角(前/后/左/右)。
43+
- Q/E 水平旋转(Q 左旋,E 右旋)。
44+
- R/F 俯仰旋转(R 上仰,F 下俯)。
45+
- 鼠标左键拖拽旋转,右键拖拽平移,滚轮缩放。
46+
4147
## 依赖
4248
- ComfyUI(默认已启用 DOM widgets)。
4349
- Python:`plyfile``numpy`(缺失时 `pip install plyfile numpy`)。

pyproject.toml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
[project]
2+
name = "comfyui-PlyPreview"
3+
description = "Gaussian Splat PLY loader + preview nodes for ComfyUI. Forked from GeometryPack and repackaged to avoid upstream overwrites. Includes front-end viewer (gsplat.js) bundled locally."
4+
version = "1.1.0"
5+
license = {file = "LICENSE"}
6+
# classifiers = [
7+
# # For OS-independent nodes (works on all operating systems)
8+
# "Operating System :: OS Independent",
9+
#
10+
# # OR for OS-specific nodes, specify the supported systems:
11+
# "Operating System :: Microsoft :: Windows", # Windows specific
12+
# "Operating System :: POSIX :: Linux", # Linux specific
13+
# "Operating System :: MacOS", # macOS specific
14+
#
15+
# # GPU Accelerator support. Pick the ones that are supported by your extension.
16+
# "Environment :: GPU :: NVIDIA CUDA", # NVIDIA CUDA support
17+
# "Environment :: GPU :: AMD ROCm", # AMD ROCm support
18+
# "Environment :: GPU :: Intel Arc", # Intel Arc support
19+
# "Environment :: NPU :: Huawei Ascend", # Huawei Ascend support
20+
# "Environment :: GPU :: Apple Metal", # Apple Metal support
21+
# ]
22+
23+
dependencies = ["numpy>=1.23", "plyfile>=1.0.3"]
24+
25+
[project.urls]
26+
Repository = "https://github.com/XuanYu-github/comfyui-PlyPreview"
27+
# Used by Comfy Registry https://registry.comfy.org
28+
Documentation = "https://github.com/XuanYu-github/comfyui-PlyPreview/wiki"
29+
"Bug Tracker" = "https://github.com/XuanYu-github/comfyui-PlyPreview/issues"
30+
31+
[tool.comfy]
32+
PublisherId = "xuanyu"
33+
DisplayName = "comfyui-PlyPreview"
34+
Icon = ""
35+
includes = []
36+
# "requires-comfyui" = ">=1.0.0" # ComfyUI version compatibility
37+

web/js/gaussian_preview.js

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,14 @@ app.registerExtension({
3333
const json = await resp.json();
3434
const files = Array.isArray(json.files) && json.files.length > 0 ? json.files : ["No PLY files found"];
3535
if (widget) {
36-
widget.options.values = files;
37-
widget.value = files[0];
36+
// Update dropdown choices and keep current selection if still present
37+
widget.options = { ...(widget.options || {}), values: files };
38+
if (!files.includes(widget.value)) {
39+
widget.value = files[0];
40+
widget.callback?.(widget.value);
41+
}
42+
// Force UI redraw
43+
widget.computeSize?.();
3844
this.setDirtyCanvas(true);
3945
app.graph.setDirtyCanvas(true, true);
4046
}
@@ -46,10 +52,13 @@ app.registerExtension({
4652
this.refreshPlyList = refreshList;
4753
refreshList();
4854

49-
// Add in-node refresh button instead of relying on context menu
50-
this.addWidget("button", "Refresh PLY list", () => this.refreshPlyList && this.refreshPlyList(), {
55+
// Hint label: user must right-click "Reload Node" to refresh PLY list
56+
const hintEl = document.createElement("div");
57+
hintEl.style.cssText = "font-size:10px;color:#888;text-align:center;padding:4px 8px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;";
58+
hintEl.textContent = "Right-click → Refresh Node to load new PLY files";
59+
this.addDOMWidget("ply_hint", "PLY_HINT", hintEl, {
5160
serialize: false,
52-
width: 180,
61+
hideOnZoom: false,
5362
});
5463

5564
return r;

web/js/gsplat-bundle.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2024,7 +2024,7 @@ void main () {
20242024
constructor(t = null, n = null) {
20252025
this._backgroundColor = new dt();
20262026
const i = t || document.createElement("canvas");
2027-
t || (i.style.display = "block", i.style.boxSizing = "border-box", i.style.width = "100%", i.style.height = "100%", i.style.margin = "0", i.style.padding = "0", document.body.appendChild(i)), i.style.background = this._backgroundColor.toHexString(), this._canvas = i, this._gl = i.getContext("webgl2", { antialias: false });
2027+
t || (i.style.display = "block", i.style.boxSizing = "border-box", i.style.width = "100%", i.style.height = "100%", i.style.margin = "0", i.style.padding = "0", document.body.appendChild(i)), i.style.background = this._backgroundColor.toHexString(), this._canvas = i, this._gl = i.getContext("webgl2", { antialias: false, preserveDrawingBuffer: true });
20282028
const e = n || [];
20292029
n || e.push(new Nt()), this._renderProgram = new Ct(this, e);
20302030
const A = [this._renderProgram];

web/viewer_gaussian.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@
169169
try {
170170
scene = new SPLAT.Scene();
171171
camera = new SPLAT.Camera();
172+
// WebGLRenderer - preserveDrawingBuffer enabled in gsplat-bundle.js
172173
renderer = new SPLAT.WebGLRenderer(canvas);
173174
controls = new SPLAT.OrbitControls(camera, canvas);
174175

0 commit comments

Comments
 (0)