-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial version I put together tonight. Known issue on first run: cmd window doesn't close after first run. Just click the 'x' to close it.
- Loading branch information
1 parent
aa5f823
commit 623ee16
Showing
17 changed files
with
492 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Normalize EOL for all files that Git considers text files. | ||
* text=auto eol=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Godot 4+ specific ignores | ||
.godot/ |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+16.5 KB
.vs/SHARK UI/FileContentIndex/f012726e-a1bf-422b-aa55-e23860b8aad6.vsidx
Binary file not shown.
Empty file.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<Project Sdk="Godot.NET.Sdk/4.0.0-beta.15"> | ||
<PropertyGroup> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<EnableDynamicLoading>true</EnableDynamicLoading> | ||
<RootNamespace>SHARKUI</RootNamespace> | ||
</PropertyGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 2012 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SHARK UI", "SHARK UI.csproj", "{C7EB7DDC-714A-4E06-8F17-D5F706C58F31}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
ExportDebug|Any CPU = ExportDebug|Any CPU | ||
ExportRelease|Any CPU = ExportRelease|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{C7EB7DDC-714A-4E06-8F17-D5F706C58F31}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{C7EB7DDC-714A-4E06-8F17-D5F706C58F31}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{C7EB7DDC-714A-4E06-8F17-D5F706C58F31}.ExportDebug|Any CPU.ActiveCfg = ExportDebug|Any CPU | ||
{C7EB7DDC-714A-4E06-8F17-D5F706C58F31}.ExportDebug|Any CPU.Build.0 = ExportDebug|Any CPU | ||
{C7EB7DDC-714A-4E06-8F17-D5F706C58F31}.ExportRelease|Any CPU.ActiveCfg = ExportRelease|Any CPU | ||
{C7EB7DDC-714A-4E06-8F17-D5F706C58F31}.ExportRelease|Any CPU.Build.0 = ExportRelease|Any CPU | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,188 @@ | ||
using Godot; | ||
using System; | ||
using System.Threading.Tasks; | ||
using System.Diagnostics; | ||
using System.IO; | ||
|
||
public partial class top : Control | ||
{ | ||
//cmdLine CL = new cmdLine(); | ||
// Called when the node enters the scene tree for the first time. | ||
public override void _Ready() | ||
{ | ||
//load settings | ||
settingsLocation = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData), settingsLocation); | ||
GD.Print(settingsLocation); | ||
if (!System.IO.File.Exists(settingsLocation)) | ||
{ | ||
GD.Print("File doesn't exist"); | ||
settingsCurrent = false; | ||
} | ||
else | ||
{ | ||
string s = File.ReadAllText (settingsLocation); | ||
if(Directory.Exists(s)) { sharkLocation = s;} | ||
} | ||
outputLocation = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Desktop), "Mori-Shark-Factory\\"); | ||
if (!Directory.Exists(outputLocation)) | ||
{ | ||
Directory.CreateDirectory(outputLocation); | ||
} | ||
opt = GetNode<OptionButton>("OptionButton"); | ||
tex = GetNode<TextEdit>("Data Entry/text"); | ||
} | ||
string settingsLocation = "mori-SHARK-factory\\settings.txt"; | ||
string settingsDirectory = "mori-SHARK-factory"; | ||
OptionButton opt; | ||
TextEdit tex; | ||
string sharkLocation; | ||
string outputLocation; | ||
bool settingsCurrent; | ||
// Called every frame. 'delta' is the elapsed time since the previous frame. | ||
public void _on_text_edit_text_changed() | ||
{ | ||
GD.Print("changed"); | ||
if(opt.Text == "Prompt") | ||
{ | ||
prompt = tex.Text; | ||
GD.Print(opt.Text + " text is now: " + prompt); | ||
} | ||
if(opt.Text == "Negative Prompt") | ||
{ | ||
negativePrompt = tex.Text; | ||
} | ||
if(opt.Text == "Seed") | ||
{ | ||
|
||
int c = seed; | ||
int.TryParse(tex.Text, out c); | ||
seed = c; | ||
} | ||
if(opt.Text == "Shark Install") | ||
{ | ||
sharkLocation = tex.Text; | ||
settingsCurrent = false; | ||
} | ||
if(opt.Text == "Output Directory") | ||
{ | ||
outputLocation = tex.Text; | ||
} | ||
|
||
} | ||
public void doop(int blah) | ||
{ | ||
GD.Print("Something or other"); | ||
} | ||
public void _onOptionChange(int blah) | ||
{ | ||
if (opt.Text == "Prompt") { | ||
GetNode<Control>("Prompts").Visible = true; | ||
GetNode<Control>("Data Entry").Visible = false; | ||
} else { GetNode<Control>("Prompts").Visible = false; GetNode<Control>("Data Entry").Visible = true; } | ||
if(opt.Text == "Negative Prompt") { tex.Text = negativePrompt; } | ||
if(opt.Text == "Seed") { tex.Text = seed.ToString(); } | ||
if (opt.Text == "Shark Install") { tex.Text = sharkLocation; } | ||
if(opt.Text == "Output Directory") { tex.Text = outputLocation; } | ||
} | ||
|
||
public override void _Process(double delta) | ||
{ | ||
if(werking == true) | ||
{ | ||
if (ta.IsCompleted) | ||
{ | ||
werking = false; | ||
GetNode<Button>("Button").Text = "Generate"; | ||
} | ||
} | ||
} | ||
string prompt = ""; | ||
string negativePrompt = ""; | ||
int seed = 42; | ||
Task ta; | ||
bool werking = false; | ||
public void generate() | ||
{ | ||
if (System.IO.Directory.Exists(outputLocation + "\\sharkOutputs") == false) | ||
{ | ||
System.IO.Directory.CreateDirectory(outputLocation + "\\sharkOutputs"); | ||
} | ||
if(settingsCurrent == false) | ||
{ | ||
settingsCurrent = true; | ||
GD.Print(settingsLocation); | ||
GD.Print(sharkLocation); | ||
string p = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData),settingsDirectory); | ||
GD.Print(p); | ||
if(!Directory.Exists(p)) { System.IO.Directory.CreateDirectory(p); } | ||
System.IO.File.WriteAllText(settingsLocation, sharkLocation); | ||
} | ||
if (GetNode<Button>("Button").Text == "Generate") | ||
{ | ||
GetNode<Button>("Button").Text = "WORKING"; | ||
prompt = GetNode<TextEdit>("Prompts/Positive").Text.Trim(); | ||
negativePrompt = GetNode<TextEdit>("Prompts/Negative").Text.Trim(); | ||
string se = GetNode<LineEdit>("Prompts/Seed").Text; | ||
int runs = 1; | ||
string rs = GetNode<LineEdit>("Prompts/Runs").Text; | ||
|
||
int.TryParse(rs, out runs); | ||
if(runs < 1) { runs = 1; } | ||
string ss = GetNode<LineEdit>("Prompts/Steps").Text; | ||
int steps = 0; | ||
int.TryParse(ss, out steps); | ||
if(steps <1) { steps = 1; } | ||
|
||
|
||
ta = Task.Run(() => | ||
{ | ||
werking = true; | ||
Process cmd; | ||
//generating the | ||
int seed = 0; | ||
se = GetNode<LineEdit>("Prompts/Seed").Text; | ||
if(int.TryParse(se, out seed) == false) | ||
{ | ||
System.Random r = new Random(); | ||
seed = r.Next(2147483647); | ||
} | ||
string sharkLoc = sharkLocation + "\\shark\\examples\\shark_inference\\stable_diffusion"; | ||
string outputLoc = outputLocation + "sharkOutputs"; | ||
string flags = " --no-progress_bar"; | ||
if (prompt.Trim().Length > 0) | ||
{ | ||
flags += " --prompts \""+prompt+"\""; | ||
} | ||
if(negativePrompt.Trim().Length > 0) { flags += " --negative-prompts \"" + negativePrompt + "\""; } | ||
flags += " --output_dir \"" + outputLoc + "\""; | ||
flags += " --seed " + seed.ToString(); | ||
flags += " --runs " + runs; | ||
flags += " --steps " + steps; | ||
cmd = new Process(); | ||
cmd.StartInfo.FileName = "cmd.exe"; | ||
cmd.StartInfo.RedirectStandardInput = true; | ||
cmd.StartInfo.RedirectStandardOutput = true; | ||
//cmd.StartInfo.CreateNoWindow = true; | ||
//cmd.StartInfo.UseShellExecute = false; | ||
cmd.Start(); | ||
cmd.StandardInput.WriteLine(sharkLocation + "\\shark.venv\\Scripts\\activate.bat"); | ||
string COM = "python " + sharkLoc + "\\main.py " + flags; | ||
GD.Print("Comman string: " + COM); | ||
cmd.StandardInput.WriteLine(COM); | ||
cmd.StandardInput.Flush(); | ||
cmd.StandardInput.Close(); | ||
cmd.WaitForExit(); | ||
}); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
[preset.0] | ||
|
||
name="Windows Desktop" | ||
platform="Windows Desktop" | ||
runnable=true | ||
dedicated_server=false | ||
custom_features="" | ||
export_filter="all_resources" | ||
include_filter="" | ||
exclude_filter="" | ||
export_path="../Mori-Shark-Factory/Mori-Shark-Factory.exe" | ||
encryption_include_filters="" | ||
encryption_exclude_filters="" | ||
encrypt_pck=false | ||
encrypt_directory=false | ||
script_encryption_key="" | ||
|
||
[preset.0.options] | ||
|
||
custom_template/debug="" | ||
custom_template/release="" | ||
debug/export_console_script=1 | ||
binary_format/embed_pck=false | ||
texture_format/bptc=false | ||
texture_format/s3tc=true | ||
texture_format/etc=false | ||
texture_format/etc2=false | ||
texture_format/no_bptc_fallbacks=true | ||
binary_format/architecture="x86_64" | ||
codesign/enable=false | ||
codesign/identity_type=0 | ||
codesign/identity="" | ||
codesign/password="" | ||
codesign/timestamp=true | ||
codesign/timestamp_server_url="" | ||
codesign/digest_algorithm=1 | ||
codesign/description="" | ||
codesign/custom_options=PackedStringArray() | ||
application/modify_resources=true | ||
application/icon="" | ||
application/console_wrapper_icon="" | ||
application/icon_interpolation=4 | ||
application/file_version="" | ||
application/product_version="" | ||
application/company_name="" | ||
application/product_name="" | ||
application/file_description="" | ||
application/copyright="" | ||
application/trademarks="" | ||
ssh_remote_deploy/enabled=false | ||
ssh_remote_deploy/host="user@host_ip" | ||
ssh_remote_deploy/port="22" | ||
ssh_remote_deploy/extra_args_ssh="" | ||
ssh_remote_deploy/extra_args_scp="" | ||
ssh_remote_deploy/run_script="Expand-Archive -LiteralPath '{temp_dir}\\{archive_name}' -DestinationPath '{temp_dir}' | ||
$action = New-ScheduledTaskAction -Execute '{temp_dir}\\{exe_name}' -Argument '{cmd_args}' | ||
$trigger = New-ScheduledTaskTrigger -Once -At 00:00 | ||
$settings = New-ScheduledTaskSettingsSet | ||
$task = New-ScheduledTask -Action $action -Trigger $trigger -Settings $settings | ||
Register-ScheduledTask godot_remote_debug -InputObject $task -Force:$true | ||
Start-ScheduledTask -TaskName godot_remote_debug | ||
while (Get-ScheduledTask -TaskName godot_remote_debug | ? State -eq running) { Start-Sleep -Milliseconds 100 } | ||
Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue" | ||
ssh_remote_deploy/cleanup_script="Stop-ScheduledTask -TaskName godot_remote_debug -ErrorAction:SilentlyContinue | ||
Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue | ||
Remove-Item -Recurse -Force '{temp_dir}'" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
[remap] | ||
|
||
importer="texture" | ||
type="CompressedTexture2D" | ||
uid="uid://msstmw4wxmp7" | ||
path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex" | ||
metadata={ | ||
"vram_texture": false | ||
} | ||
|
||
[deps] | ||
|
||
source_file="res://icon.svg" | ||
dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"] | ||
|
||
[params] | ||
|
||
compress/mode=0 | ||
compress/lossy_quality=0.7 | ||
compress/hdr_compression=1 | ||
compress/bptc_ldr=0 | ||
compress/normal_map=0 | ||
compress/channel_pack=0 | ||
mipmaps/generate=false | ||
mipmaps/limit=-1 | ||
roughness/mode=0 | ||
roughness/src_normal="" | ||
process/fix_alpha_border=true | ||
process/premult_alpha=false | ||
process/normal_map_invert_y=false | ||
process/hdr_as_srgb=false | ||
process/hdr_clamp_exposure=false | ||
process/size_limit=0 | ||
detect_3d/compress_to=1 | ||
svg/scale=1.0 | ||
editor/scale_with_editor_scale=false | ||
editor/convert_colors_with_editor_theme=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
; Engine configuration file. | ||
; It's best edited using the editor UI and not directly, | ||
; since the parameters that go here are not all obvious. | ||
; | ||
; Format: | ||
; [section] ; section goes between [] | ||
; param=value ; assign values to parameters | ||
|
||
config_version=5 | ||
|
||
[application] | ||
|
||
config/name="Mori-Shark-Factory" | ||
run/main_scene="res://top.tscn" | ||
config/features=PackedStringArray("4.0", "GL Compatibility") | ||
config/icon="res://icon.svg" | ||
|
||
[display] | ||
|
||
window/size/viewport_width=512 | ||
window/size/viewport_height=512 | ||
|
||
[dotnet] | ||
|
||
project/assembly_name="SHARK UI" | ||
|
||
[rendering] | ||
|
||
renderer/rendering_method="gl_compatibility" |
Oops, something went wrong.