Merge pull request #13 from EnragedAntelope/claude/review-comfyui-compatibility-015ch9jXYy18WsgXqoj8t5CF
CRITICAL: Fix tensor bug and improve defaults
This commit is contained in:
@@ -34,7 +34,7 @@ class RegionalPrompterSimple:
|
||||
},
|
||||
"optional": {
|
||||
"region2_prompt": ("STRING", {
|
||||
"default": "street vendor",
|
||||
"default": "giraffe wearing sunglasses",
|
||||
"multiline": True,
|
||||
"tooltip": "Region 2 - Second region/box (see canvas below)"
|
||||
}),
|
||||
@@ -224,7 +224,7 @@ class RegionalPrompterFlux:
|
||||
"tooltip": "Region 1 strength (5-8 for Flux, increase if region doesn't show)"
|
||||
}),
|
||||
"region2_prompt": ("STRING", {
|
||||
"default": "street vendor",
|
||||
"default": "giraffe wearing sunglasses",
|
||||
"multiline": True,
|
||||
"tooltip": "Region 2 - Second region/box (see canvas below)"
|
||||
}),
|
||||
@@ -439,10 +439,10 @@ Tips: Increase per-region strength if regions don't show. 3-4 regions max for Fl
|
||||
mask[0, y_end - 1 - edge_idx, x_latent:x_end] = fade
|
||||
# Left edge
|
||||
if x_latent + edge_idx < x_end:
|
||||
mask[0, y_latent:y_end, x_latent + edge_idx] = min(mask[0, y_latent:y_end, x_latent + edge_idx], fade)
|
||||
mask[0, y_latent:y_end, x_latent + edge_idx] = torch.minimum(mask[0, y_latent:y_end, x_latent + edge_idx], torch.tensor(fade))
|
||||
# Right edge
|
||||
if x_end - 1 - edge_idx >= x_latent:
|
||||
mask[0, y_latent:y_end, x_end - 1 - edge_idx] = min(mask[0, y_latent:y_end, x_end - 1 - edge_idx], fade)
|
||||
mask[0, y_latent:y_end, x_end - 1 - edge_idx] = torch.minimum(mask[0, y_latent:y_end, x_end - 1 - edge_idx], torch.tensor(fade))
|
||||
|
||||
# Apply mask to conditioning
|
||||
for t in encoded_conditionings[i]:
|
||||
|
||||
@@ -209,7 +209,7 @@ function addRegionalPrompterCanvas(node, app) {
|
||||
computeCanvasSize(node, node.size);
|
||||
}, 100);
|
||||
|
||||
return { minWidth: 200, minHeight: 250, widget } // Reduced to prevent overlap with box widgets
|
||||
return { minWidth: 200, minHeight: 350, widget } // Balanced size for canvas visibility
|
||||
}
|
||||
|
||||
app.registerExtension({
|
||||
@@ -224,10 +224,10 @@ app.registerExtension({
|
||||
this.setProperty("height", 512)
|
||||
// Default template: Two example boxes pre-drawn
|
||||
// Region 1 (red sports car): left side, 200x250px starting at (50, 150)
|
||||
// Region 2 (street vendor): right side, 180x250px starting at (280, 150)
|
||||
// Region 2 (giraffe): right side, 180x300px starting at (280, 100) - taller for giraffe
|
||||
this.setProperty("values", [
|
||||
[50, 150, 200, 250, 2.0], // Region 1 - increased strength
|
||||
[280, 150, 180, 250, 2.0] // Region 2 - increased strength
|
||||
[50, 150, 200, 250, 2.0], // Region 1 - red sports car
|
||||
[280, 100, 180, 300, 2.0] // Region 2 - giraffe (taller box)
|
||||
])
|
||||
|
||||
this.selected = false
|
||||
@@ -329,10 +329,10 @@ app.registerExtension({
|
||||
this.setProperty("height", 1024)
|
||||
// Default template: Two example boxes pre-drawn
|
||||
// Region 1 (red sports car): left side, 400x500px starting at (100, 300)
|
||||
// Region 2 (street vendor): right side, 350x500px starting at (560, 300)
|
||||
// Region 2 (giraffe): right side, 350x600px starting at (560, 200) - taller for giraffe
|
||||
this.setProperty("values", [
|
||||
[100, 300, 400, 500, 2.0], // Region 1 - increased strength for Flux
|
||||
[560, 300, 350, 500, 2.0] // Region 2 - increased strength for Flux
|
||||
[100, 300, 400, 500, 2.0], // Region 1 - red sports car
|
||||
[560, 200, 350, 600, 2.0] // Region 2 - giraffe (taller box)
|
||||
])
|
||||
|
||||
this.selected = false
|
||||
|
||||
+3
-3
@@ -134,7 +134,7 @@ export function getDrawColor(percent, alpha) {
|
||||
export function computeCanvasSize(node, size) {
|
||||
if (node.widgets[0].last_y == null) return;
|
||||
|
||||
const MIN_SIZE = 250; // Reduced to prevent canvas overlap with widgets
|
||||
const MIN_SIZE = 300; // Balanced size for proper canvas visibility
|
||||
|
||||
let y = LiteGraph.NODE_WIDGET_HEIGHT * Math.max(node.inputs.length, node.outputs.length) + 5;
|
||||
let freeSpace = size[1] - y;
|
||||
@@ -162,8 +162,8 @@ export function computeCanvasSize(node, size) {
|
||||
node.graph.setDirtyCanvas(true);
|
||||
}
|
||||
|
||||
// Add bottom padding to prevent canvas from overlapping widgets/node border
|
||||
const BOTTOM_PADDING = 20;
|
||||
// Add small bottom padding to prevent canvas from overlapping widgets/node border
|
||||
const BOTTOM_PADDING = 10;
|
||||
const canvasHeight = Math.max(MIN_SIZE - BOTTOM_PADDING, freeSpace - BOTTOM_PADDING);
|
||||
|
||||
// Position each of the widgets
|
||||
|
||||
Reference in New Issue
Block a user