class CrShader::TresReader

Overview

Reader and Serializer for Godot 4 ColorPalette .tres resources Operates directly on ColorPalette schemas containing PackedColorArray.

Defined in:

crshader/parser/tres_reader.cr

Constant Summary

COLOR_REGEX = /Color\(\s*([-\d.eE]+)\s*,\s*([-\d.eE]+)\s*,\s*([-\d.eE]+)(?:\s*,\s*([-\d.eE]+))?\s*\)/

Class Method Summary

Class Method Detail

def self.parse_string(content : String) : TresData #

Parses Godot 4 ColorPalette text resource (.tres) Extracts the PackedColorArray with type safety


def self.read(path : String, base_dir : String | Nil = nil) : TresData | Nil #

Reads ColorPalette .tres resource


def self.resolve_path(path : String, base_dir : String | Nil = nil) : String | Nil #

Resolves a Godot res:// or relative path to an existing filesystem path


def self.write_color_palette(path : String, colors : Array(Tuple(Float32, Float32, Float32, Float32))) : Bool #

Writes a Godot 4 ColorPalette .tres resource