Skip to content

Commit b55be46

Browse files
authored
Merge pull request #48 from Comfy-Org/Load3DAnimation
Add all the 3d related node docs
2 parents 3c961bd + 731eeda commit b55be46

File tree

36 files changed

+2621
-43
lines changed

36 files changed

+2621
-43
lines changed

.github/scripts/check_md_links.py

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
import os
2+
import re
3+
import sys
4+
from pathlib import Path
5+
6+
# Try to find the docs directory relative to the script location first
7+
# If that fails, try relative to current working directory
8+
script_based_docs = Path(__file__).parent.parent.parent / 'comfyui_embedded_docs' / 'docs'
9+
cwd_based_docs = Path.cwd() / 'comfyui_embedded_docs' / 'docs'
10+
11+
if script_based_docs.exists():
12+
DOCS_ROOT = script_based_docs
13+
elif cwd_based_docs.exists():
14+
DOCS_ROOT = cwd_based_docs
15+
else:
16+
# Fallback: search for the docs directory
17+
current = Path.cwd()
18+
while current != current.parent: # Stop at filesystem root
19+
potential_docs = current / 'comfyui_embedded_docs' / 'docs'
20+
if potential_docs.exists():
21+
DOCS_ROOT = potential_docs
22+
break
23+
current = current.parent
24+
else:
25+
DOCS_ROOT = script_based_docs # Default to original logic
26+
27+
# Supported file extensions
28+
doc_exts = {'.md', '.mdx'}
29+
30+
# Match Markdown images/links and HTML img/video/audio/source tag src attributes
31+
MD_LINK_RE = re.compile(r'!\[[^\]]*\]\(([^)]+)\)|\[[^\]]*\]\(([^)]+)\)')
32+
HTML_SRC_RE = re.compile(r'<(?:img|video|audio|source)[^>]+src=["\']([^"\'>]+)["\']', re.IGNORECASE)
33+
34+
# Only check local relative paths (not starting with http/https/data:)
35+
def is_local_link(link):
36+
link = link.strip()
37+
return not (link.startswith('http://') or link.startswith('https://') or link.startswith('data:'))
38+
39+
def find_links_in_line(line):
40+
links = []
41+
for m in MD_LINK_RE.finditer(line):
42+
for g in m.groups():
43+
if g and is_local_link(g):
44+
links.append(g)
45+
for m in HTML_SRC_RE.finditer(line):
46+
g = m.group(1)
47+
if g and is_local_link(g):
48+
links.append(g)
49+
return links
50+
51+
def check_links():
52+
if not DOCS_ROOT.exists():
53+
print(f"ERROR: DOCS_ROOT directory does not exist: {DOCS_ROOT}")
54+
print(f"Current working directory: {os.getcwd()}")
55+
print(f"Script location: {Path(__file__)}")
56+
sys.exit(1)
57+
58+
# Debug: Check if Load3D directory and asset folder exist
59+
load3d_dir = DOCS_ROOT / 'Load3D'
60+
load3d_asset_dir = load3d_dir / 'asset'
61+
print(f"DEBUG: Load3D directory exists: {load3d_dir.exists()}")
62+
if load3d_dir.exists():
63+
print(f"DEBUG: Load3D contents: {[p.name for p in load3d_dir.iterdir()]}")
64+
print(f"DEBUG: Load3D/asset directory exists: {load3d_asset_dir.exists()}")
65+
if load3d_asset_dir.exists():
66+
print(f"DEBUG: Load3D/asset contents: {[p.name for p in load3d_asset_dir.iterdir()]}")
67+
68+
errors = []
69+
for root, _, files in os.walk(DOCS_ROOT):
70+
for fname in files:
71+
if Path(fname).suffix.lower() in doc_exts:
72+
fpath = Path(root) / fname
73+
rel_fpath = fpath.relative_to(DOCS_ROOT.parent.parent)
74+
with open(fpath, encoding='utf-8') as f:
75+
for idx, line in enumerate(f, 1):
76+
for link in find_links_in_line(line):
77+
# Handle anchors and query parameters
78+
link_path = link.split('#')[0].split('?')[0]
79+
# Absolute path (starting with /) is relative to docs root
80+
if link_path.startswith('/'):
81+
abs_path = DOCS_ROOT / link_path.lstrip('/')
82+
else:
83+
# Use resolve() for relative paths but ensure proper handling
84+
try:
85+
abs_path = (fpath.parent / link_path).resolve()
86+
# Additional check: ensure the resolved path is still under expected directory
87+
if not abs_path.exists():
88+
# Try alternative resolution without resolve() for symlink issues
89+
abs_path_alt = (fpath.parent / link_path).absolute()
90+
if abs_path_alt.exists():
91+
abs_path = abs_path_alt
92+
except (OSError, ValueError):
93+
# Fallback for path resolution issues
94+
abs_path = (fpath.parent / link_path).absolute()
95+
96+
if not abs_path.exists():
97+
# Add detailed debugging information
98+
debug_info = []
99+
debug_info.append(f"Original link: {link}")
100+
debug_info.append(f"Link path (no anchor/query): {link_path}")
101+
debug_info.append(f"Source file: {fpath}")
102+
debug_info.append(f"Source parent: {fpath.parent}")
103+
debug_info.append(f"Resolved path: {abs_path}")
104+
debug_info.append(f"Path exists: {abs_path.exists()}")
105+
106+
# Check if parent directory exists
107+
debug_info.append(f"Parent dir exists: {abs_path.parent.exists()}")
108+
if abs_path.parent.exists():
109+
try:
110+
parent_contents = list(abs_path.parent.iterdir())
111+
debug_info.append(f"Parent dir contents: {[p.name for p in parent_contents]}")
112+
except Exception as e:
113+
debug_info.append(f"Error reading parent dir: {e}")
114+
115+
# Check if it's a case sensitivity issue
116+
if abs_path.parent.exists():
117+
actual_name = abs_path.name
118+
try:
119+
for item in abs_path.parent.iterdir():
120+
if item.name.lower() == actual_name.lower() and item.name != actual_name:
121+
debug_info.append(f"Case mismatch found: expected '{actual_name}', found '{item.name}'")
122+
except Exception:
123+
pass
124+
125+
error_msg = f"[NOT FOUND] {rel_fpath}:{idx}: {link} (resolved: {abs_path})"
126+
error_msg += "\n DEBUG: " + " | ".join(debug_info)
127+
errors.append(error_msg)
128+
if errors:
129+
print("\nThe following issues were found during link checking:")
130+
# Show first 5 errors with full debug info, then just count the rest
131+
for i, err in enumerate(errors):
132+
if i < 5:
133+
print(err)
134+
elif i == 5:
135+
print(f"\n... and {len(errors) - 5} more similar errors (showing first 5 with debug info)")
136+
break
137+
138+
# Show summary of remaining errors without debug info
139+
if len(errors) > 5:
140+
print("\nRemaining errors (summary):")
141+
for err in errors[5:]:
142+
# Extract just the basic error line
143+
basic_err = err.split('\n')[0]
144+
print(basic_err)
145+
146+
print(f"\nA total of {len(errors)} invalid links were found. Please fix the above issues.")
147+
sys.exit(1)
148+
else:
149+
print("All local resource links are valid.")
150+
151+
if __name__ == '__main__':
152+
check_links()
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Check Markdown Resource Links
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- 'comfyui_embedded_docs/docs/**/*.md'
7+
- 'comfyui_embedded_docs/docs/**/*.mdx'
8+
- '.github/scripts/check_md_links.py'
9+
- '.github/workflows/check-md-links.yml'
10+
11+
jobs:
12+
check-links:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v3
17+
with:
18+
fetch-depth: 0 # Fetch all history for all branches and tags
19+
- name: Set up Python
20+
uses: actions/setup-python@v4
21+
with:
22+
python-version: '3.9'
23+
- name: Debug git status
24+
run: |
25+
echo "Current branch: $(git branch --show-current)"
26+
echo "Current commit: $(git rev-parse HEAD)"
27+
echo "PR Head SHA: ${{ github.event.pull_request.head.sha }}"
28+
echo "Checking if Load3D/asset directory exists:"
29+
ls -la comfyui_embedded_docs/docs/Load3D/ || echo "Load3D directory not found"
30+
ls -la comfyui_embedded_docs/docs/Load3D/asset/ || echo "Load3D/asset directory not found"
31+
- name: Run Markdown resource link checker
32+
run: |
33+
python .github/scripts/check_md_links.py

comfyui_embedded_docs/docs/LatentUpscaleBy/zh.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
2-
<PhotoProvider>
3-
<PhotoView src="/latent/Upscale_latent_by.jpg">
4-
<img src="/latent/Upscale_latent_by.jpg" alt="comfyUI节点- Upscale latent by|Latent按系数缩放" className='rounded-lg' priority/>
5-
</PhotoView>
6-
</PhotoProvider>
7-
81
这一节点将使用特定算法对潜空间图像进行缩放,它允许调整放大比例和放大方法,提供在提高潜在样本分辨率方面的灵活性。
92

103
### 关于upscale_method中几个方法的说明介绍
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
The Load3DAnimation node is a core node for loading and processing 3D model files. When loading the node, it automatically retrieves available 3D resources from `ComfyUI/input/3d/`. You can also upload supported 3D files for preview using the upload function.
2+
3+
> - Most of the functions of this node are the same as the Load 3D node, but this node supports loading models with animations, and you can preview the corresponding animations in the node.
4+
> - The content of this documentation is the same as the Load3D node, because except for animation preview and playback, their capabilities are identical.
5+
6+
**Supported Formats**
7+
Currently, this node supports multiple 3D file formats, including `.gltf`, `.glb`, `.obj`, `.fbx`, and `.stl`.
8+
9+
**3D Node Preferences**
10+
Some related preferences for 3D nodes can be configured in ComfyUI's settings menu. Please refer to the following documentation for corresponding settings:
11+
12+
[Settings Menu](https://docs.comfy.org/interface/settings/3d)
13+
14+
Besides regular node outputs, Load3D has lots of 3D view-related settings in the canvas menu.
15+
16+
## Inputs
17+
18+
| Parameter Name | Type | Description | Default | Range |
19+
|---------------|----------|---------------------------------|---------|--------------|
20+
| model_file | File Selection | 3D model file path, supports upload, defaults to reading model files from `ComfyUI/input/3d/` | - | Supported formats |
21+
| width | INT | Canvas rendering width | 1024 | 1-4096 |
22+
| height | INT | Canvas rendering height | 1024 | 1-4096 |
23+
24+
## Outputs
25+
26+
| Parameter Name | Data Type | Description |
27+
|-----------------|----------------|------------------------------------|
28+
| image | IMAGE | Canvas rendered image |
29+
| mask | MASK | Mask containing current model position |
30+
| mesh_path | STRING | Model file path |
31+
| normal | IMAGE | Normal map |
32+
| lineart | IMAGE | Line art image output, corresponding `edge_threshold` can be adjusted in the canvas model menu |
33+
| camera_info | LOAD3D_CAMERA | Camera information |
34+
| recording_video | VIDEO | Recorded video (only when recording exists) |
35+
36+
All the outputs preview:
37+
![View Operation Demo](../Load3D/asset/load3d_outputs.webp)
38+
39+
## Canvas Area Description
40+
41+
The Load3D node's Canvas area contains numerous view operations, including:
42+
43+
- Preview view settings (grid, background color, preview view)
44+
- Camera control: Control FOV, camera type
45+
- Global illumination intensity: Adjust lighting intensity
46+
- Video recording: Record and export videos
47+
- Model export: Supports `GLB`, `OBJ`, `STL` formats
48+
- And more
49+
50+
![Load 3D Node UI](../Load3D/asset/load3d_ui.jpg)
51+
52+
1. Contains multiple menus and hidden menus of the Load 3D node
53+
2. Menu for `resizing preview window` and `canvas video recording`
54+
3. 3D view operation axis
55+
4. Preview thumbnail
56+
5. Preview size settings, scale preview view display by setting dimensions and then resizing window
57+
58+
### 1. View Operations
59+
60+
<video controls width="640" height="360">
61+
<source src="../Load3D/asset/view_operations.mp4" type="video/mp4">
62+
Your browser does not support video playback.
63+
</video>
64+
65+
View control operations:
66+
67+
- Left-click + drag: Rotate the view
68+
- Right-click + drag: Pan the view
69+
- Middle wheel scroll or middle-click + drag: Zoom in/out
70+
- Coordinate axis: Switch views
71+
72+
### 2. Left Menu Functions
73+
74+
![Menu](../Load3D/asset/menu.webp)
75+
76+
In the canvas, some settings are hidden in the menu. Click the menu button to expand different menus
77+
78+
- 1. Scene: Contains preview window grid, background color, preview settings
79+
- 2. Model: Model rendering mode, texture materials, up direction settings
80+
- 3. Camera: Switch between orthographic and perspective views, and set the perspective angle size
81+
- 4. Light: Scene global illumination intensity
82+
- 5. Export: Export model to other formats (GLB, OBJ, STL)
83+
84+
#### Scene
85+
86+
![scene menu](../Load3D/asset/menu_scene.webp)
87+
88+
The Scene menu provides some basic scene setting functions
89+
90+
1. Show/Hide grid
91+
2. Set background color
92+
3. Click to upload a background image
93+
4. Hide the preview
94+
95+
#### Model
96+
97+
![Menu_Scene](../Load3D/asset/menu_model.webp)
98+
99+
The Model menu provides some model-related functions
100+
101+
1. **Up direction**: Determine which axis is the up direction for the model
102+
2. **Material mode**: Switch model rendering modes - Original, Normal, Wireframe, Lineart
103+
104+
#### Camera
105+
106+
![menu_modelmenu_camera](../Load3D/asset/menu_camera.webp)
107+
108+
This menu provides switching between orthographic and perspective views, and perspective angle size settings
109+
110+
1. **Camera**: Quickly switch between orthographic and orthographic views
111+
2. **FOV**: Adjust FOV angle
112+
113+
#### Light
114+
115+
![menu_modelmenu_camera](../Load3D/asset/menu_light.webp)
116+
117+
Through this menu, you can quickly adjust the scene's global illumination intensity
118+
119+
#### Export
120+
121+
![menu_export](../Load3D/asset/menu_export.webp)
122+
123+
This menu provides the ability to quickly convert and export model formats
124+
125+
### 3. Right Menu Functions
126+
127+
<video controls width="640" height="360">
128+
<source src="../Load3D/asset/recording.mp4" type="video/mp4">
129+
Your browser does not support video playback.
130+
</video>
131+
132+
The right menu has two main functions:
133+
134+
1. **Reset view ratio**: After clicking the button, the view will adjust the canvas rendering area ratio according to the set width and height
135+
2. **Video recording**: Allows you to record current 3D view operations as video, allows import, and can be output as `recording_video` to subsequent nodes

0 commit comments

Comments
 (0)