Skip to content

Commit

Permalink
Merge pull request #133 from Haidra-Org/transparent
Browse files Browse the repository at this point in the history
feat: images with transparent background
  • Loading branch information
db0 authored Jul 25, 2024
2 parents 4537b41 + 97bc59c commit 931c340
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: "📣 Release on push"
- name: "📣 Prepare new release"
id: release
uses: rymndhng/release-on-push-action@v0.28.0
env:
Expand Down
27 changes: 19 additions & 8 deletions LucidCreations.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -352,14 +352,14 @@ custom_styles/panel = ExtResource( 39 )
margin_left = 10.0
margin_top = 10.0
margin_right = 330.0
margin_bottom = 340.0
margin_bottom = 400.0
rect_min_size = Vector2( 320, 0 )
size_flags_vertical = 3

[node name="PromptCC" type="MarginContainer" parent="Margin/Panel/Display/Panels/Controls/Prompt"]
unique_name_in_owner = true
margin_right = 320.0
margin_bottom = 262.0
margin_bottom = 322.0
rect_min_size = Vector2( 41, 41 )
size_flags_horizontal = 3
size_flags_vertical = 3
Expand All @@ -368,7 +368,7 @@ script = ExtResource( 31 )
[node name="PromptLine" type="TextEdit" parent="Margin/Panel/Display/Panels/Controls/Prompt/PromptCC"]
unique_name_in_owner = true
margin_right = 320.0
margin_bottom = 262.0
margin_bottom = 322.0
size_flags_horizontal = 3
highlight_all_occurrences = true
smooth_scrolling = true
Expand All @@ -380,7 +380,7 @@ caret_blink_speed = 0.5
unique_name_in_owner = true
visible = false
margin_right = 320.0
margin_bottom = 262.0
margin_bottom = 322.0
color = Color( 0.12, 0.12, 0.12, 0.392157 )

[node name="Tween" type="Tween" parent="Margin/Panel/Display/Panels/Controls/Prompt/PromptCC"]
Expand Down Expand Up @@ -414,9 +414,9 @@ caret_blink = true
caret_blink_speed = 0.5

[node name="Buttons" type="VBoxContainer" parent="Margin/Panel/Display/Panels/Controls/Prompt"]
margin_top = 266.0
margin_top = 326.0
margin_right = 320.0
margin_bottom = 330.0
margin_bottom = 390.0

[node name="NegativePrompt" type="CheckButton" parent="Margin/Panel/Display/Panels/Controls/Prompt/Buttons"]
unique_name_in_owner = true
Expand Down Expand Up @@ -515,7 +515,6 @@ text = "Image is control"

[node name="Basic" type="VBoxContainer" parent="Margin/Panel/Display/Panels/Controls"]
unique_name_in_owner = true
visible = false
margin_left = 10.0
margin_top = 10.0
margin_right = 330.0
Expand Down Expand Up @@ -1120,7 +1119,7 @@ visible = false
margin_left = 10.0
margin_top = 10.0
margin_right = 330.0
margin_bottom = 386.0
margin_bottom = 422.0
rect_min_size = Vector2( 320, 0 )
size_flags_horizontal = 3
size_flags_vertical = 3
Expand Down Expand Up @@ -1215,6 +1214,18 @@ size_flags_horizontal = 3
pressed = true
text = "HiResFix"

[node name="HBC2" type="HBoxContainer" parent="Margin/Panel/Display/Panels/Controls/Advanced"]
margin_top = 384.0
margin_right = 320.0
margin_bottom = 412.0

[node name="Transparent" type="CheckButton" parent="Margin/Panel/Display/Panels/Controls/Advanced/HBC2"]
unique_name_in_owner = true
margin_right = 320.0
margin_bottom = 28.0
size_flags_horizontal = 3
text = "Transparent"

[node name="Special" parent="Margin/Panel/Display/Panels/Controls" instance=ExtResource( 51 )]
visible = false
margin_bottom = 400.0
Expand Down
7 changes: 7 additions & 0 deletions StableHordeClient.gd
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ onready var generate_footer_button = $"%GenerateFooterButton"
onready var sampler_method : OptionButton = $"%SamplerMethod"
onready var karras := $"%Karras"
onready var hires_fix = $"%HiResFix"
onready var transparent = $"%Transparent"
onready var grid_scroll = $"%GridScroll"
onready var display_focus = $"%DisplayFocus"
onready var focused_image = $"%FocusedImage"
Expand Down Expand Up @@ -157,6 +158,7 @@ func _ready():
slider_config.set_value(stable_horde_client.get(slider_config.config_setting))
karras.pressed = stable_horde_client.karras
hires_fix.pressed = stable_horde_client.hires_fix
transparent.pressed = stable_horde_client.transparent
negative_prompt.pressed = globals.config.get_value("Options", "negative_prompt", false)
nsfw.pressed = stable_horde_client.nsfw
censor_nsfw.pressed = stable_horde_client.censor_nsfw
Expand Down Expand Up @@ -194,6 +196,7 @@ func _ready():
pp,
karras,
hires_fix,
transparent,
nsfw,
censor_nsfw,
trusted_workers,
Expand Down Expand Up @@ -528,6 +531,7 @@ func _connect_hover_signals() -> void:
seed_edit,
karras,
hires_fix,
transparent,
denoising_strength,
$"%PP",
$"%RememberPrompt",
Expand Down Expand Up @@ -692,6 +696,8 @@ func _accept_settings() -> void:
globals.set_setting("karras", karras.pressed)
stable_horde_client.set("hires_fix", hires_fix.pressed)
globals.set_setting("hires_fix", hires_fix.pressed)
stable_horde_client.set("transparent", transparent.pressed)
globals.set_setting("transparent", transparent.pressed)
stable_horde_client.set("nsfw", nsfw.pressed)
globals.set_setting("nsfw", nsfw.pressed)
stable_horde_client.set("censor_nsfw", censor_nsfw.pressed)
Expand Down Expand Up @@ -732,6 +738,7 @@ func _on_load_from_disk_gensettings_loaded(settings) -> void:
sampler_method.select(idx)
karras.pressed = settings.get("karras", true)
hires_fix.pressed = settings.get("hires_fix", false)
transparent.pressed = settings.get("transparent", false)
if globals.config.get_value("Options", "load_seed_from_disk", false):
seed_edit.text = settings["seed"]
if _set_prompt(settings["prompt"], true) == false:
Expand Down
2 changes: 2 additions & 0 deletions addons/stable_horde_client/stable_horde_client.gd
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ export(bool) var replacement_filter := true
export(Array) var workers := []
export(bool) var worker_blacklist := false
export(bool) var allow_downgrade := false
export(bool) var transparent := false
export(String, "auto-detect", "qr_code") var workflow := "auto-detect"
export(Array) var extra_texts = []

Expand Down Expand Up @@ -144,6 +145,7 @@ func generate(replacement_prompt := '', replacement_params := {}) -> void:
"seed": gen_seed,
"post_processing": post_processing,
"clip_skip": clip_skip,
"transparent": transparent,
}
if control_type != 'none':
imgen_params["control_type"] = control_type
Expand Down
3 changes: 3 additions & 0 deletions src/ParamBus.gd
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ var gen_seed_node: LineEdit
var post_processing_node: PostProcessingSelection
var karras_node: CheckButton
var hires_fix_node: CheckButton
var transparent_node: CheckButton
var nsfw_node: CheckButton
var censor_nsfw_node: CheckButton
var trusted_workers_node: CheckButton
Expand Down Expand Up @@ -92,6 +93,7 @@ func setup(
_post_processing_node: PostProcessingSelection,
_karras_node: CheckButton,
_hires_fix_node: CheckButton,
_transparent_node: CheckButton,
_nsfw_node: CheckButton,
_censor_nsfw_node: CheckButton,
_trusted_workers_node: CheckButton,
Expand All @@ -118,6 +120,7 @@ func setup(
post_processing_node = _post_processing_node
karras_node = _karras_node
hires_fix_node = _hires_fix_node
transparent_node = _transparent_node
nsfw_node = _nsfw_node
censor_nsfw_node = _censor_nsfw_node
trusted_workers_node = _trusted_workers_node
Expand Down

0 comments on commit 931c340

Please sign in to comment.