1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-02-22 21:43:13 +00:00

Some final touches, i think it's ready now

This commit is contained in:
Variable 2024-09-01 14:35:52 +05:00
parent c4755b2628
commit 1caaf5487c
2 changed files with 9 additions and 1 deletions

View file

@ -5,4 +5,4 @@ signal resource_updated
func _init(_frames: Array[Frame] = [], _name := tr("untitled"), _size := Vector2i(64, 64)) -> void:
super._init(_frames, _name + " (Texture Resource)", _size)
super._init(_frames, _name + " (Virtual Resource)", _size)

View file

@ -359,9 +359,17 @@ static func _get_loaded_texture(params: Dictionary, parameter_name: String) -> I
static func _shader_update_texture(
resource_proj: ResourceProject, value_changed: Callable, parameter_name: String
) -> void:
var warnings = ""
if resource_proj.frames.size() > 1:
warnings += "This resource is intended to have 1 frame only. Extra frames will be ignored."
if resource_proj.layers.size() > 1:
warnings += "\nThis resource is intended to have 1 layer only. layers will be blended."
var updated_image = Image.create_empty(
resource_proj.size.x, resource_proj.size.y, false, Image.FORMAT_RGBA8
)
var frame = resource_proj.frames[0]
DrawingAlgos.blend_layers(updated_image, frame, Vector2i.ZERO, resource_proj)
value_changed.call(ImageTexture.create_from_image(updated_image), parameter_name)
if not warnings.is_empty():
Global.popup_error(warnings)