修复了ComfyUI在子图节点模式下,独立渲染模式的左右连线不生效的问题
This commit is contained in:
@@ -65,10 +65,11 @@
|
||||
3. **功能范围**:目前支持节点翻译,前端功能翻译正在开发中
|
||||
|
||||
## 📈 版本历史
|
||||
- **v3.1.5**(2025-08-05)
|
||||
-修复了ComfyUI在子图节点模式下,独立渲染模式的左右连线不生效的问题
|
||||
|
||||
### 最新版本
|
||||
- **v3.1.4**(2025-06-10)
|
||||
- 合并Suzu008的贡献分支
|
||||
- 合并Suzu008的贡献分支,添加了选中和悬停一起激活连线的模式
|
||||
|
||||
- **v3.1.3**(2025-01-24)
|
||||
- 给连线动画的速度从3档设置为6档
|
||||
|
||||
@@ -304,8 +304,9 @@ export class ConnectionAnimation {
|
||||
_shouldShowAnimation(link) {
|
||||
if (!link || !this.canvas || !this.canvas.graph) return false;
|
||||
|
||||
const originNode = link.origin_id === -10 ? this.canvas.graph.inputNode : this.canvas.graph._nodes_by_id[link.origin_id];
|
||||
const targetNode = link.target_id === -20 ? this.canvas.graph.outputNode : this.canvas.graph._nodes_by_id[link.target_id];
|
||||
// ComfyUI toNodeId(): subgraph IO ids are strings "-10"/"-20" (also accept legacy numbers)
|
||||
const originNode = link.origin_id == -10 ? this.canvas.graph.inputNode : this.canvas.graph._nodes_by_id[link.origin_id];
|
||||
const targetNode = link.target_id == -20 ? this.canvas.graph.outputNode : this.canvas.graph._nodes_by_id[link.target_id];
|
||||
|
||||
if (!originNode || !targetNode) return false;
|
||||
|
||||
@@ -552,8 +553,8 @@ export class ConnectionAnimation {
|
||||
}
|
||||
|
||||
// 获取节点和位置信息
|
||||
const outNode = link.origin_id === -10 ? this.canvas.graph.inputNode : this.canvas.graph.getNodeById(link.origin_id);
|
||||
const inNode = link.target_id === -20 ? this.canvas.graph.outputNode : this.canvas.graph.getNodeById(link.target_id);
|
||||
const outNode = link.origin_id == -10 ? this.canvas.graph.inputNode : this.canvas.graph.getNodeById(link.origin_id);
|
||||
const inNode = link.target_id == -20 ? this.canvas.graph.outputNode : this.canvas.graph.getNodeById(link.target_id);
|
||||
|
||||
if (!outNode || !inNode) return;
|
||||
|
||||
@@ -691,8 +692,8 @@ export class ConnectionAnimation {
|
||||
const graph = this.canvas.graph;
|
||||
if (!graph || !graph._nodes_by_id) return null;
|
||||
|
||||
const outNode = link.origin_id === -10 ? graph.inputNode : graph._nodes_by_id[link.origin_id];
|
||||
const inNode = link.target_id === -20 ? graph.outputNode : graph._nodes_by_id[link.target_id];
|
||||
const outNode = link.origin_id == -10 ? graph.inputNode : graph._nodes_by_id[link.origin_id];
|
||||
const inNode = link.target_id == -20 ? graph.outputNode : graph._nodes_by_id[link.target_id];
|
||||
|
||||
if (!outNode || !inNode) return null;
|
||||
|
||||
@@ -707,7 +708,7 @@ export class ConnectionAnimation {
|
||||
if (!pathInfo) return null;
|
||||
|
||||
// 获取基础颜色
|
||||
const baseColor = this.staticStyleManager.getCurrentStyle()?.getBaseColor(link.origin_id !== -10 ? outNode : inNode, link) || "#999999";
|
||||
const baseColor = this.staticStyleManager.getCurrentStyle()?.getBaseColor(link.origin_id != -10 ? outNode : inNode, link) || "#999999";
|
||||
|
||||
return {
|
||||
path: pathInfo.points,
|
||||
|
||||
@@ -911,8 +911,9 @@ class MapLinks {
|
||||
const allLinks = Object.values(graph.links || {});
|
||||
|
||||
allLinks.forEach(link => {
|
||||
const isSubgraphOrigin = link.origin_id === -10;
|
||||
const isSubgraphTarget = link.target_id === -20;
|
||||
// ComfyUI toNodeId(): subgraph IO ids are strings "-10"/"-20"
|
||||
const isSubgraphOrigin = link.origin_id == -10;
|
||||
const isSubgraphTarget = link.target_id == -20;
|
||||
if (!isSubgraphOrigin && !isSubgraphTarget) return;
|
||||
|
||||
const outNode = isSubgraphOrigin ? graph.inputNode : graph._nodes_by_id[link.origin_id];
|
||||
|
||||
@@ -135,15 +135,17 @@ export class StyleManager {
|
||||
|
||||
// 处理指定的连线
|
||||
linksToProcess.forEach(link => {
|
||||
const outNode = link.origin_id === -10 ? this.animationManager.canvas.graph.inputNode : this.animationManager.canvas.graph.getNodeById(link.origin_id);
|
||||
const inNode = link.target_id === -20 ? this.animationManager.canvas.graph.outputNode : this.animationManager.canvas.graph.getNodeById(link.target_id);
|
||||
// ComfyUI toNodeId(): subgraph IO ids are strings "-10"/"-20"
|
||||
const outNode = link.origin_id == -10 ? this.animationManager.canvas.graph.inputNode : this.animationManager.canvas.graph.getNodeById(link.origin_id);
|
||||
const inNode = link.target_id == -20 ? this.animationManager.canvas.graph.outputNode : this.animationManager.canvas.graph.getNodeById(link.target_id);
|
||||
if (!outNode || !inNode) return;
|
||||
|
||||
const outPos = link.origin_id === -10 ? outNode.slots[link.origin_slot].pos : this._getOutputPos(outNode, link.origin_slot);
|
||||
const inPos = link.target_id === -20 ? inNode.slots[link.target_slot].pos : this._getInputPos(inNode, link.target_slot);
|
||||
const outPos = link.origin_id == -10 ? outNode.slots?.[link.origin_slot]?.pos : this._getOutputPos(outNode, link.origin_slot);
|
||||
const inPos = link.target_id == -20 ? inNode.slots?.[link.target_slot]?.pos : this._getInputPos(inNode, link.target_slot);
|
||||
if (!outPos || !inPos) return;
|
||||
|
||||
// 使用统一的getBaseColor方法获取颜色
|
||||
const baseColor = this.currentStyle.getBaseColor(link.origin_id !== -10 ? outNode : inNode, link);
|
||||
const baseColor = this.currentStyle.getBaseColor(link.origin_id != -10 ? outNode : inNode, link);
|
||||
|
||||
// 计算路径点和类型
|
||||
const pathInfo = this.currentStyle.calculatePath(outNode, inNode, outPos, inPos, link);
|
||||
|
||||
@@ -854,8 +854,9 @@ class StaticMapLinks {
|
||||
const allLinks = Object.values(graph.links || {});
|
||||
|
||||
allLinks.forEach(link => {
|
||||
const isSubgraphOrigin = link.origin_id === -10;
|
||||
const isSubgraphTarget = link.target_id === -20;
|
||||
// ComfyUI toNodeId(): subgraph IO ids are strings "-10"/"-20"
|
||||
const isSubgraphOrigin = link.origin_id == -10;
|
||||
const isSubgraphTarget = link.target_id == -20;
|
||||
if (!isSubgraphOrigin && !isSubgraphTarget) return;
|
||||
|
||||
const outNode = isSubgraphOrigin ? graph.inputNode : graph._nodes_by_id[link.origin_id];
|
||||
|
||||
Reference in New Issue
Block a user