Rename some node inputs
This commit is contained in:
+1
-1
@@ -1,7 +1,7 @@
|
||||
[project]
|
||||
name = "comfyui-visualarea-nodes"
|
||||
description = "This is a collection of nodes created to aid when managing area conditionings."
|
||||
version = "1.0.6"
|
||||
version = "1.0.7"
|
||||
license = {file = "LICENSE"}
|
||||
|
||||
[project.urls]
|
||||
|
||||
@@ -8,8 +8,8 @@ class VisualAreaPrompt:
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"general_conditioning": ("CONDITIONING", { "tooltip": "Base conditioning. Will be concatenated to all other conditionings." }),
|
||||
"global_conditioning": ("CONDITIONING", { "tooltip": "Base conditioning. Will be applied to the whole image once." }),
|
||||
"all_area_conditioning": ("CONDITIONING", { "tooltip": "Base conditioning. Will be concatenated to all other conditionings, including global." }),
|
||||
"global_conditioning": ("CONDITIONING", { "tooltip": "Will be applied to the whole image once." }),
|
||||
"merge_global": ("BOOLEAN", { "default": False, "tooltip": "Turning this on will make it so that the global conditioning will be concatenated to all other conditionings before being applied. (will not affect combined_conditioning output)." }),
|
||||
},
|
||||
"hidden": {
|
||||
@@ -25,7 +25,7 @@ class VisualAreaPrompt:
|
||||
OUTPUT_NODE = False
|
||||
CATEGORY = "RegionalPrompt"
|
||||
|
||||
def run_node(self, general_conditioning, global_conditioning, merge_global, extra_pnginfo, unique_id, **kwargs):
|
||||
def run_node(self, all_area_conditioning, global_conditioning, merge_global, extra_pnginfo, unique_id, **kwargs):
|
||||
# Get values for the conditioning areas from the extra_pnginfo
|
||||
conditioning_areas: list[list[float]] = []
|
||||
for node in extra_pnginfo["workflow"]["nodes"]:
|
||||
@@ -38,7 +38,7 @@ class VisualAreaPrompt:
|
||||
# Create graph to evaluate the node
|
||||
graph: GraphBuilder = GraphBuilder()
|
||||
# Concat all other conditionings (to: (to: (to: general, from cond1), from cond2), from cond3... ... from global)
|
||||
last_concat: Node = graph.node("ConditioningConcat", conditioning_to=general_conditioning, conditioning_from=conditionings[0])
|
||||
last_concat: Node = graph.node("ConditioningConcat", conditioning_to=all_area_conditioning, conditioning_from=conditionings[0])
|
||||
# Start loop from the second element (first already concatenated)
|
||||
for cond in conditionings[1:]:
|
||||
last_concat: Node = graph.node("ConditioningConcat", conditioning_to=last_concat.out(0), conditioning_from=cond)
|
||||
@@ -47,7 +47,7 @@ class VisualAreaPrompt:
|
||||
# Concat general to all other area conditionings (to: general, from: cond)
|
||||
conditionings_general: list = []
|
||||
for cond in conditionings:
|
||||
conditionings_general.append(graph.node("ConditioningConcat", conditioning_to=general_conditioning, conditioning_from=cond))
|
||||
conditionings_general.append(graph.node("ConditioningConcat", conditioning_to=all_area_conditioning, conditioning_from=cond))
|
||||
# Apply area with percentage from conditionings
|
||||
conditionings_area: list = []
|
||||
for i in range(len(conditionings_general)):
|
||||
|
||||
@@ -15,7 +15,7 @@ const CANVAS_BORDER_COLOR = "#000000";
|
||||
// Id of the node
|
||||
const _ID = "VisualAreaPrompt";
|
||||
// Prefix of the input to add
|
||||
const _PREFIX = "area-conditioning_";
|
||||
const _PREFIX = "area_conditioning_";
|
||||
// Type of the input to add
|
||||
const _TYPE = "CONDITIONING";
|
||||
// Defaults for area widgets (make sure to copy, or it will be modified)
|
||||
@@ -183,12 +183,12 @@ app.registerExtension({
|
||||
// Add the canvas
|
||||
addAreaGraphWidget(this);
|
||||
// Add area selection control
|
||||
addNumberInput(this, "id", 0, (value, _, node) => {
|
||||
addNumberInput(this, "area_id", 0, (value, _, node) => {
|
||||
node.index = value;
|
||||
updateWidgetValues(node);
|
||||
}, { min: 0, max: 0, step: 10, precision: 0 });
|
||||
// Add conditioning controls
|
||||
["x", "y", "width", "height", "strength"].forEach((name, i) => {
|
||||
["x", "y", "width", "height", "conditioning_strength"].forEach((name, i) => {
|
||||
addNumberInput(this, name, [..._AREA_DEFAULTS][i], (value, _, node) => {
|
||||
node.properties["area_values"][node.index][i] = value;
|
||||
}, { min: 0, max: i === 4 ? 10 : 1, step: 0.1, precision: 2 });
|
||||
@@ -228,7 +228,7 @@ app.registerExtension({
|
||||
// Remove the input
|
||||
this.removeInput(slot_idx);
|
||||
}
|
||||
let slot_tracker = {};
|
||||
let counter = 0;
|
||||
let idx = 0;
|
||||
for (const slot of this.inputs) {
|
||||
// Skip static nodes
|
||||
@@ -242,12 +242,8 @@ app.registerExtension({
|
||||
continue;
|
||||
}
|
||||
idx += 1;
|
||||
const name = slot.name.split('_')[0];
|
||||
// Correctly increment the count in slot_tracker
|
||||
const count = (slot_tracker[name] || 0) + 1;
|
||||
slot_tracker[name] = count;
|
||||
// Update the slot name with the count if greater than 1
|
||||
slot.name = `${name}_${count - 1}`;
|
||||
slot.name = `${_PREFIX}${counter++}`;
|
||||
}
|
||||
// Set ID widget new max and value
|
||||
const countDynamicInputs = this.inputs.filter((input) => input.name.includes(_PREFIX)).length;
|
||||
|
||||
Reference in New Issue
Block a user