Comfy-Org / Comfy-Org/ComfyUI_frontend
[Feature Request] Allow custom nodes to set default control_after_generate behavior for seed inputs
- Dominant language
- TypeScript
- Stars
- 2k
- Forks
- 699
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 490
Description
# [Feature Request] Allow custom nodes to set default `control_after_generate` behavior for seed inputs
## Summary
Custom node developers cannot reliably set the default `control_after_generate` behavior for seed inputs. All seed inputs default to "randomize" regardless of node developer preferences, and attempts to override this behavior through various methods have failed.
## Problem Description
When creating custom nodes with seed inputs, the seed widget always defaults to "randomize" in the `control_after_generate` dropdown. For many use cases (especially text-to-speech, voice cloning, and other deterministic workflows), developers want seeds to default to "fixed" behavior for reproducible results.
## Current Behavior
- All `INT` inputs named "seed" automatically get a `control_after_generate` dropdown
- This dropdown always defaults to "randomize"
- Users must manually change this to "fixed" for every node instance
- No method exists for node developers to override this default
## Desired Behavior
Custom node developers should be able to specify the default `control_after_generate` behavior in their node definitions, allowing nodes to default to "fixed", "increment", "decrement", or "randomize" as appropriate for their use case.
## Attempted Solutions (All Failed)
### 1. ❌ Python INPUT_TYPES Definition
**Attempt**: Adding `control_after_generate` parameter to seed input definition
```python
"seed": ("INT", {
"default": 1,
"min": 0,
"max": 2**32 - 1,
"control_after_generate": "fixed" # Attempted parameter
})
```
**Result**: Parameter ignored, still defaults to "randomize"
### 2. ❌ Alternative Parameter Names
**Attempt**: Tried variations of the parameter name
```python
"control_after_generation": "fixed" # Also tried this variation
```
**Result**: Also ignored
### 3. ❌ JavaScript Frontend Extension
**Attempt**: Created a ComfyUI extension to override seed behavior
```javascript
app.registerExtension({
name: "CustomSeedFix",
nodeCreated(node) {
const seedWidget = node.widgets?.find(w => w.name === "seed");
if (seedWidget && seedWidget.options) {
seedWidget.options.control_after_generate = "fixed";
}
}
});
```
**Result**: Extension loads but doesn't affect the dropdown default
### 4. ❌ Node Definition Override
**Attempt**: Tried overriding at `beforeRegisterNodeDef` level
```javascript
beforeRegisterNodeDef(nodeType, nodeData) {
if (nodeData.input?.required?.seed) {
const seedDef = nodeData.input.required.seed;
if (Array.isArray(seedDef) && seedDef[1]) {
seedDef[1].control_after_generate = "fixed";
}
}
}
```
**Result**: No effect on UI behavior
## Research Findings
From ComfyUI GitHub issues and discussions:
1. **Issue #3419**: Mentions that `control_after_generate` is defined in JavaScript frontend, not Python
2. **PR #7059**: States that frontend assigns `control_after_generate` for INT inputs named exactly "seed" or "noise_seed"
3. **Issue #2349**: Documents bugs with `control_after_generate=fixed` behavior
4. **Discussion #1101**: Discusses hiding `control_after_generate` for primitives
Quote from PR #7059:
> "Currently the frontend is assigning control_after_generate option for matching exactly INT input type and seed & noise_seed input name"
This suggests the behavior is hardcoded in the frontend with no override mechanism for custom nodes.
## Use Cases
Many node types would benefit from different seed defaults:
- **Text-to-Speech nodes**: Should default to "fixed" for reproducible voice generation
- **Voice cloning nodes**: Should default to "fixed" for consistent results
- **Deterministic processing nodes**: Should default to "fixed" for workflow stability
- **Creative generation nodes**: Current "randomize" default is appropriate
- **Batch processing nodes**: Might want "increment" as default
## Proposed Solution
Add support for a `control_after_generate` parameter in Python node definitions:
```python
"seed": ("INT", {
"default": 1,
"min": 0,
"max": 2**32 - 1,
"control_after_generate": "fixed" # Should be respected by frontend
})
```
This would require frontend changes to:
1. Check for `control_after_generate` in the node definition
2. Use that value as the default instead of hardcoded "randomize"
3. Fall back to "randomize" if not specified (backward compatibility)
## Impact
This enhancement would:
- ✅ Allow custom nodes to provide better default UX
- ✅ Reduce manual user configuration for deterministic workflows
- ✅ Maintain backward compatibility with existing nodes
- ✅ Give node developers more control over their node's behavior
## Environment
- ComfyUI version: Latest (tested with multiple versions)
- Frontend: Both old and new frontend versions
- Node type: Custom nodes with seed inputs
- Browser: Multiple browsers tested
## Additional Context
This issue affects custom node developers who want to provide more user-friendly defaults for their specific use cases. The current hardcoded "randomize" default is not suitable for all node types, particularly those focused on reproducible or deterministic workflows.
The lack of this feature forces users to manually change every seed input to "fixed" when using nodes that are designed for reproducible results, creating unnecessary friction in workflow setup.
┆Issue is synchronized with this [Notion page](https://www.notion.so/Issue-4460-Feature-Request-Allow-custom-nodes-to-set-default-control_after_generate-behavior-fo-2316d73d365081fd8b10c82abe3396dc) by [Unito](https://www.unito.io)
Contributor guide
Assessment
This issue has not been assessed yet.