Fix shader include relative include by using ResourceLoader load() instead of loading the text from the file - fixes #56
This commit is contained in:
parent
ed10da0604
commit
b916f43f8b
4 changed files with 13 additions and 18 deletions
|
@ -13,13 +13,10 @@ var shader_path = "":
|
|||
if old != shader_path:
|
||||
store_last_opened_file()
|
||||
|
||||
var shader_code: String:
|
||||
var shader: Shader:
|
||||
get():
|
||||
print("Load ", shader_path)
|
||||
var file = FileAccess.open(shader_path, FileAccess.READ)
|
||||
if file != null:
|
||||
return file.get_as_text()
|
||||
else: return ""
|
||||
return load(shader_path)
|
||||
|
||||
var original_image: ImageTexture
|
||||
|
||||
|
|
|
@ -44,11 +44,9 @@ func shader_has_step_uniform(shader: Shader) -> bool:
|
|||
return false
|
||||
|
||||
func update(overwrite_image_path: String = "") -> Array: # returns error messages (strings)
|
||||
var original_shader_code = Filesystem.shader_code # read from disk
|
||||
if original_shader_code == "":
|
||||
return ["No shader loaded!"]
|
||||
var shader: Shader = Shader.new()
|
||||
shader.code = original_shader_code
|
||||
var shader = Filesystem.shader # read from disk
|
||||
if shader == null:
|
||||
return ["No shader opened!"]
|
||||
# get number of steps & check if code has STEP uniform
|
||||
var steps: int = ShaderDirectiveParser.parse_steps_directive(shader.code)
|
||||
var has_step_uniform: bool = shader_has_step_uniform(shader)
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
[gd_scene load_steps=12 format=3 uid="uid://bjah7k4bxo044"]
|
||||
|
||||
[ext_resource type="Script" path="res://src/Main.gd" id="1_64y3g"]
|
||||
[ext_resource type="Script" uid="uid://n6vumf2emghl" path="res://src/Main.gd" id="1_64y3g"]
|
||||
[ext_resource type="Script" path="res://src/ImageCompositor.gd" id="2_4ykh7"]
|
||||
[ext_resource type="Shader" path="res://src/shader/ivd_outline.gdshader" id="3_0fllm"]
|
||||
[ext_resource type="Script" path="res://src/ImageViewportDisplay.gd" id="4_pbpx2"]
|
||||
[ext_resource type="Script" path="res://src/Camera.gd" id="5_hkdq6"]
|
||||
[ext_resource type="Shader" uid="uid://on6oju7dt0dj" path="res://src/shader/ivd_outline.gdshader" id="3_0fllm"]
|
||||
[ext_resource type="Script" uid="uid://c51lc0hv2d7uq" path="res://src/ImageViewportDisplay.gd" id="4_pbpx2"]
|
||||
[ext_resource type="Script" uid="uid://t71vu44i5cr5" path="res://src/Camera.gd" id="5_hkdq6"]
|
||||
[ext_resource type="Theme" uid="uid://cwqlns34rj3vx" path="res://src/theme.tres" id="6_rjp5f"]
|
||||
[ext_resource type="Script" path="res://src/MainUI.gd" id="7_5puhk"]
|
||||
[ext_resource type="Script" path="res://src/VersionLabel.gd" id="8_kod8x"]
|
||||
[ext_resource type="Script" uid="uid://e5gf0r42elmx" path="res://src/MainUI.gd" id="7_5puhk"]
|
||||
[ext_resource type="Script" uid="uid://b254xv4j2uexg" path="res://src/VersionLabel.gd" id="8_kod8x"]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_y2ea0"]
|
||||
shader = ExtResource("3_0fllm")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue