Comments (5)
Incidentally, one big improvement in the meantime is to do a check on whether the index of the list exists so that there is no exception and all the other element_id values get set properly anyway -- the user would just have to manually change the script to the one desired. As it stands, the exception of an index higher than the script list item count causes no values to be set, which is rough. Thanks.
from config-presets.
Working Example:
'def config_preset_dropdown_change(dropdown_value, *components_value):
config_preset = config_presets[dropdown_value]
print(f"[Config-Presets] Changed to: {dropdown_value}")
# update component values with user preset
current_components = dict(zip(component_map.keys(), components_value))
#print("Components before:", current_components)
current_components.update(config_preset)
# transform necessary components from index to value
for component_name, component_value in current_components.items():
#print(component_name, component_value)
if component_name in index_type_components and type(component_value) == int:
if (component_value < len(component_map[component_name].choices)): # <--------------
current_components[component_name] = component_map[component_name].choices[component_value]
#print("Components after :", current_components)
return list(current_components.values())'
from config-presets.
Sorry how do you mean? You can already specify the script name. It does have to be a number.
{
"Ultimate SD Upscale": {
"script_list": "Ultimate SD upscale"
}
}
from config-presets.
Yes, exactly -- currently it is stored as an int (index position of the script in the list when the configuration was saved), but if it were stored as the name of the script, as you have demonstrated, the CP logic would need a special IF block to handle the script_list field and search for the name of the script in the list of choices and convert that to the index position, then passing that to the component if an index was found.
from config-presets.
I meant to say it does NOT have to be a number. Setting it to a name already works (though bear in mind it's case sensitive).
This line handles it already.
current_components.update(config_preset)
from config-presets.
Related Issues (20)
- UI elements don't show up in 1.6 HOT 9
- FEATURE REQUEST: Checkbox groups HOT 5
- BUG: Config Presets breaks in A1111 v1.6 HOT 1
- Save causes error. HOT 5
- update my stable diffusion doesn't appear anymore HOT 2
- aDetailer Section Now Broken - Extension Load Fails HOT 6
- Tiled Diffusion - Tiled VAE elements changed IDs HOT 1
- Custom Options not applying HOT 4
- Feature request: Override setting field. HOT 1
- Confused on how to populate aDetailer fields in the add preset feature. HOT 4
- Feature Request : Ability to save Adetailer Separate Checkpoint HOT 1
- How do I save prompt and neg prompts? HOT 6
- [BUG] I get ERROR icons when saving sometimes AUTOMATIC1111 v1.7.0 HOT 9
- Uncommenting controlnet components breaks extension HOT 4
- Adding an Extension Checkbox Option HOT 5
- Config Presets not showing on img2img tab HOT 6
- Component with id 2096 not a valid input component. HOT 1
- The 4/13/2024 update breaks compatibility with Forge UI HOT 3
- Incompatibility with Tiled Diffusion HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from config-presets.