Store shader directory as working directory and use this as the root for relative uniform image imports via !load directive, drop Windows compatibility - solves #7
This commit is contained in:
parent
b307635c09
commit
367dbe163c
6 changed files with 18 additions and 67 deletions
|
@ -7,8 +7,7 @@
|
||||||
|
|
||||||
## Supported Platforms
|
## Supported Platforms
|
||||||
|
|
||||||
- Linux [tested]
|
- Linux
|
||||||
- Windows
|
|
||||||
|
|
||||||
You can find the latest releases [here](https://github.com/ChaoticByte/GlitchApp/releases/latest).
|
You can find the latest releases [here](https://github.com/ChaoticByte/GlitchApp/releases/latest).
|
||||||
|
|
||||||
|
|
|
@ -37,66 +37,3 @@ unzip -o -q \"{temp_dir}/{archive_name}\" -d \"{temp_dir}\"
|
||||||
ssh_remote_deploy/cleanup_script="#!/usr/bin/env bash
|
ssh_remote_deploy/cleanup_script="#!/usr/bin/env bash
|
||||||
kill $(pgrep -x -f \"{temp_dir}/{exe_name} {cmd_args}\")
|
kill $(pgrep -x -f \"{temp_dir}/{exe_name} {cmd_args}\")
|
||||||
rm -rf \"{temp_dir}\""
|
rm -rf \"{temp_dir}\""
|
||||||
|
|
||||||
[preset.1]
|
|
||||||
|
|
||||||
name="Windows Desktop"
|
|
||||||
platform="Windows Desktop"
|
|
||||||
runnable=true
|
|
||||||
dedicated_server=false
|
|
||||||
custom_features=""
|
|
||||||
export_filter="all_resources"
|
|
||||||
include_filter=""
|
|
||||||
exclude_filter=""
|
|
||||||
export_path="dist/GlitchApp.exe"
|
|
||||||
encryption_include_filters=""
|
|
||||||
encryption_exclude_filters=""
|
|
||||||
encrypt_pck=false
|
|
||||||
encrypt_directory=false
|
|
||||||
|
|
||||||
[preset.1.options]
|
|
||||||
|
|
||||||
custom_template/debug=""
|
|
||||||
custom_template/release=""
|
|
||||||
debug/export_console_wrapper=1
|
|
||||||
binary_format/embed_pck=true
|
|
||||||
texture_format/bptc=true
|
|
||||||
texture_format/s3tc=true
|
|
||||||
texture_format/etc=false
|
|
||||||
texture_format/etc2=false
|
|
||||||
binary_format/architecture="x86_64"
|
|
||||||
codesign/enable=false
|
|
||||||
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="GlitchApp"
|
|
||||||
application/file_description=""
|
|
||||||
application/copyright="ChaoticByte"
|
|
||||||
application/trademarks=""
|
|
||||||
application/export_angle=0
|
|
||||||
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}'"
|
|
||||||
|
|
|
@ -220,20 +220,26 @@ func _on_save_shader_button_pressed():
|
||||||
save_shader_dialog.current_path = last_save_filepath
|
save_shader_dialog.current_path = last_save_filepath
|
||||||
save_shader_dialog.show()
|
save_shader_dialog.show()
|
||||||
|
|
||||||
func _on_open_shader_dialog_file_selected(path):
|
func _on_open_shader_dialog_file_selected(path: String):
|
||||||
|
print("Load ", path)
|
||||||
var file = FileAccess.open(path, FileAccess.READ)
|
var file = FileAccess.open(path, FileAccess.READ)
|
||||||
var shader_code = file.get_as_text()
|
var shader_code = file.get_as_text()
|
||||||
var shader = Shader.new()
|
var shader = Shader.new()
|
||||||
shader.code = shader_code
|
shader.code = shader_code
|
||||||
Globals.shader = shader
|
Globals.shader = shader
|
||||||
|
if "/" in path: # update current working directory
|
||||||
|
Globals.cwd = path.substr(0, path.rfind("/"))
|
||||||
Globals.target_viewport.update()
|
Globals.target_viewport.update()
|
||||||
update()
|
update()
|
||||||
last_save_filepath = path
|
last_save_filepath = path
|
||||||
|
|
||||||
func _on_save_shader_dialog_file_selected(path):
|
func _on_save_shader_dialog_file_selected(path):
|
||||||
|
print("Save ", path)
|
||||||
var file = FileAccess.open(path, FileAccess.WRITE)
|
var file = FileAccess.open(path, FileAccess.WRITE)
|
||||||
var content = Globals.shader.code
|
var content = Globals.shader.code
|
||||||
file.store_string(content)
|
file.store_string(content)
|
||||||
|
if "/" in path: # update current working directory
|
||||||
|
Globals.cwd = path.substr(0, path.rfind("/"))
|
||||||
last_save_filepath = path
|
last_save_filepath = path
|
||||||
|
|
||||||
func _on_apply_shader_button_pressed():
|
func _on_apply_shader_button_pressed():
|
||||||
|
|
|
@ -3,3 +3,4 @@ extends Node
|
||||||
var camera_freeze = false
|
var camera_freeze = false
|
||||||
@onready var shader: Shader = ShaderPresets.presets[ShaderPresets.default_preset]
|
@onready var shader: Shader = ShaderPresets.presets[ShaderPresets.default_preset]
|
||||||
var target_viewport: SubViewport
|
var target_viewport: SubViewport
|
||||||
|
var cwd = "."
|
||||||
|
|
|
@ -24,7 +24,13 @@ func update():
|
||||||
# load images from //!load directives and apply them to
|
# load images from //!load directives and apply them to
|
||||||
# the material as shader parameters
|
# the material as shader parameters
|
||||||
for m in load_uniform_regex.search_all(Globals.shader.code):
|
for m in load_uniform_regex.search_all(Globals.shader.code):
|
||||||
var u_image = Image.load_from_file(m.strings[2])
|
# this only works for Linux!
|
||||||
|
var img_path = m.strings[2]
|
||||||
|
if !img_path.begins_with("/"):
|
||||||
|
img_path = Globals.cwd + "/" + img_path.lstrip("./")
|
||||||
|
#
|
||||||
|
print("Load ", img_path)
|
||||||
|
var u_image = Image.load_from_file(img_path)
|
||||||
mat.set_shader_parameter(
|
mat.set_shader_parameter(
|
||||||
m.strings[1], # uniform param name
|
m.strings[1], # uniform param name
|
||||||
ImageTexture.create_from_image(u_image))
|
ImageTexture.create_from_image(u_image))
|
||||||
|
|
|
@ -14,6 +14,7 @@ func _on_open_image_button_pressed():
|
||||||
ui_control_fileopen.show()
|
ui_control_fileopen.show()
|
||||||
|
|
||||||
func _on_open_image_dialog_file_selected(path):
|
func _on_open_image_dialog_file_selected(path):
|
||||||
|
print("Load ", path)
|
||||||
var img = Image.new()
|
var img = Image.new()
|
||||||
var err = img.load(path)
|
var err = img.load(path)
|
||||||
if err == OK:
|
if err == OK:
|
||||||
|
@ -30,6 +31,7 @@ func _on_save_image_button_pressed():
|
||||||
ui_control_filesave.show()
|
ui_control_filesave.show()
|
||||||
|
|
||||||
func _on_save_image_dialog_file_selected(path):
|
func _on_save_image_dialog_file_selected(path):
|
||||||
|
print("Export ", path)
|
||||||
var err = image_viewport.get_result().save_png(path)
|
var err = image_viewport.get_result().save_png(path)
|
||||||
if err != OK:
|
if err != OK:
|
||||||
print("An error occured!")
|
print("An error occured!")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue