Fix force image depth conversion for index-based png.

This commit is contained in:
Tanasart 2024-09-21 14:56:17 +07:00
parent cb7dce84c0
commit 65755f4cf8
3 changed files with 8 additions and 8 deletions

View file

@ -50,7 +50,7 @@ function LOAD_PATH(path, readonly = false, safe_mode = false) {
if(_PROJECT == noone) {
PROJECTS = [ PROJECT ];
} else if(!_rep && _PROJECT.path == "" && !_PROJECT.modified) {
} else if(!_rep && ((_PROJECT.path == "" || _PROJECT.readonly) && !_PROJECT.modified)) {
var ind = array_find(PROJECTS, _PROJECT);
if(ind == -1) ind = 0;
PROJECTS[ind] = PROJECT;

View file

@ -83,16 +83,16 @@ function Node_Image_Animated(_x, _y, _group = noone) : Node(_x, _y, _group) cons
array_push(attributeEditors, [ "File Watcher", function() { return attributes.file_checker; },
new checkBox(function() { attributes.file_checker = !attributes.file_checker; }) ]);
on_drop_file = function(path) {
if(directory_exists(path)) {
on_drop_file = function(_path) {
if(directory_exists(_path)) {
with(dialogCall(o_dialog_drag_folder, WIN_W / 2, WIN_H / 2)) {
dir_paths = path;
dir_paths = _path;
target = other;
}
return true;
}
var paths = paths_to_array_ext(path);
var paths = paths_to_array_ext(_path);
inputs[0].setValue(paths);
if(updatePaths(paths)) {
@ -128,7 +128,7 @@ function Node_Image_Animated(_x, _y, _group = noone) : Node(_x, _y, _group) cons
case ".png" :
case ".jpg" :
case ".jpeg" :
var _real_path = sprite_path_check_depth(path);
var _real_path = sprite_path_check_depth(_path);
var _spr = sprite_add(_real_path, 1, false, false, 0, 0);
if(_spr == -1) {

View file

@ -24,8 +24,8 @@ function sprite_path_check_depth(path, noti = true) {
if(filename_ext(path) != ".png") return path;
var _data = read_png_header(path, noti);
if(_data == noone) return path;
if(_data.depth == 8) return path;
if(_data == noone) return path;
if(_data.depth <= 8) return path;
if(noti) noti_warning($"{_data.depth} bits image is not supported. Proxy will be used.");