diff --git a/PixelComposer.resource_order b/PixelComposer.resource_order index 69ca3f9b4..0227a3942 100644 --- a/PixelComposer.resource_order +++ b/PixelComposer.resource_order @@ -549,6 +549,7 @@ {"name":"s_node_pack_sprite","order":5,"path":"sprites/s_node_pack_sprite/s_node_pack_sprite.yy",}, {"name":"surface_valid","order":6,"path":"scripts/surface_valid/surface_valid.yy",}, {"name":"sh_blur_zoom","order":5,"path":"shaders/sh_blur_zoom/sh_blur_zoom.yy",}, + {"name":"node_isosurf","order":4,"path":"scripts/node_isosurf/node_isosurf.yy",}, {"name":"node_VFX_renderer","order":3,"path":"scripts/node_VFX_renderer/node_VFX_renderer.yy",}, {"name":"s_node_pb_fx_stack","order":2,"path":"sprites/s_node_pb_fx_stack/s_node_pb_fx_stack.yy",}, {"name":"fd_draw_sprite_to_collision_mask_surface","order":1,"path":"scripts/fd_draw_sprite_to_collision_mask_surface/fd_draw_sprite_to_collision_mask_surface.yy",}, diff --git a/PixelComposer.yyp b/PixelComposer.yyp index 6be1d050f..c69e03d9c 100644 --- a/PixelComposer.yyp +++ b/PixelComposer.yyp @@ -1117,6 +1117,7 @@ {"id":{"name":"surface_valid","path":"scripts/surface_valid/surface_valid.yy",},}, {"id":{"name":"steam_ugc_collection","path":"scripts/steam_ugc_collection/steam_ugc_collection.yy",},}, {"id":{"name":"sh_blur_zoom","path":"shaders/sh_blur_zoom/sh_blur_zoom.yy",},}, + {"id":{"name":"node_isosurf","path":"scripts/node_isosurf/node_isosurf.yy",},}, {"id":{"name":"node_VFX_renderer","path":"scripts/node_VFX_renderer/node_VFX_renderer.yy",},}, {"id":{"name":"s_node_pb_fx_stack","path":"sprites/s_node_pb_fx_stack/s_node_pb_fx_stack.yy",},}, {"id":{"name":"fd_draw_sprite_to_collision_mask_surface","path":"scripts/fd_draw_sprite_to_collision_mask_surface/fd_draw_sprite_to_collision_mask_surface.yy",},}, diff --git a/datafiles/data/themes/default.zip b/datafiles/data/themes/default.zip index 1e0533c09..876af807f 100644 Binary files a/datafiles/data/themes/default.zip and b/datafiles/data/themes/default.zip differ diff --git a/objects/o_dialog_splash/Create_0.gml b/objects/o_dialog_splash/Create_0.gml index a49021553..7ddf97487 100644 --- a/objects/o_dialog_splash/Create_0.gml +++ b/objects/o_dialog_splash/Create_0.gml @@ -72,8 +72,8 @@ event_inherited(); draw_sprite_stretched(THEME.ui_panel_bg, 1, fx, _y, ww, hg); if(thmb && _y + hg > 0 && _y < sp_recent.h) { - var sw = surface_get_width(thmb); - var sh = surface_get_height(thmb); + var sw = surface_get_width_safe(thmb); + var sh = surface_get_height_safe(thmb); var ss = (ww - ui(8)) / sw; var sy = (((sh * ss) - hg) * clamp((_y + hg) / (sp_recent.h + hg), 0, 1)) / ss; diff --git a/objects/o_main/Draw_75.gml b/objects/o_main/Draw_75.gml index 1a2260412..c6dbf865b 100644 --- a/objects/o_main/Draw_75.gml +++ b/objects/o_main/Draw_75.gml @@ -79,6 +79,8 @@ if(OS == os_windows && gameframe_is_minimized()) exit; case VALUE_TYPE.buffer : draw_tooltip_buffer(content); break; + default : + draw_tooltip_text(string(content)); } } else if(TOOLTIP != "") draw_tooltip_text(TOOLTIP); diff --git a/scripts/__VFX/__VFX.gml b/scripts/__VFX/__VFX.gml index c5a8f0f6c..feaddc978 100644 --- a/scripts/__VFX/__VFX.gml +++ b/scripts/__VFX/__VFX.gml @@ -195,8 +195,8 @@ function __part(_node) constructor { scy = sc_sy * scCurve; var _xx, _yy; - var s_w = surface_get_width(ss) * scx; - var s_h = surface_get_height(ss) * scy; + var s_w = surface_get_width_safe(ss) * scx; + var s_h = surface_get_height_safe(ss) * scy; if(boundary_data == -1) { var _pp = point_rotate(-s_w / 2, -s_h / 2, 0, 0, rot); diff --git a/scripts/__node_3d_displace/__node_3d_displace.gml b/scripts/__node_3d_displace/__node_3d_displace.gml index 18c75e097..bb126fb51 100644 --- a/scripts/__node_3d_displace/__node_3d_displace.gml +++ b/scripts/__node_3d_displace/__node_3d_displace.gml @@ -147,7 +147,7 @@ function __Node_3D_Displace(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr var str = 1; if(is_surface(_dspTex)) { - var c = surface_getpixel(_dspTex, v.textures[_texI][0] * surface_get_width(_dspTex), v.textures[_texI][1] * surface_get_height(_dspTex)); + var c = surface_getpixel(_dspTex, v.textures[_texI][0] * surface_get_width_safe(_dspTex), v.textures[_texI][1] * surface_get_height_safe(_dspTex)); var r = color_get_red(c) / 255; var g = color_get_green(c) / 255; var b = color_get_blue(c) / 255; diff --git a/scripts/__node_3d_extrude/__node_3d_extrude.gml b/scripts/__node_3d_extrude/__node_3d_extrude.gml index 1212d623e..168fe40f0 100644 --- a/scripts/__node_3d_extrude/__node_3d_extrude.gml +++ b/scripts/__node_3d_extrude/__node_3d_extrude.gml @@ -129,8 +129,8 @@ function __Node_3D_Extrude(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro var _smt = getSingleValue(19, index); if(!is_surface(_ins)) return noone; - var ww = surface_get_width(_ins); - var hh = surface_get_height(_ins); + var ww = surface_get_width_safe(_ins); + var hh = surface_get_height_safe(_ins); var tw = 1 / ww; var th = 1 / hh; @@ -159,8 +159,8 @@ function __Node_3D_Extrude(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro } if(useH) { - var hgw = surface_get_width(_hei); - var hgh = surface_get_height(_hei); + var hgw = surface_get_width_safe(_hei); + var hgh = surface_get_height_safe(_hei); var hgtW = hgw / ww; var hgtH = hgh / hh; @@ -479,8 +479,8 @@ function __Node_3D_Extrude(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro var _cam = new __3d_camera(_proj, _fov); if(_smt) { - var ww = surface_get_width(_ins); - var hh = surface_get_height(_ins); + var ww = surface_get_width_safe(_ins); + var hh = surface_get_height_safe(_ins); var ts = surface_create(ww, hh); surface_set_shader(ts, sh_3d_extrude_corner); diff --git a/scripts/__node_3d_plane/__node_3d_plane.gml b/scripts/__node_3d_plane/__node_3d_plane.gml index 25490e84c..581ff1b5d 100644 --- a/scripts/__node_3d_plane/__node_3d_plane.gml +++ b/scripts/__node_3d_plane/__node_3d_plane.gml @@ -153,8 +153,8 @@ function __Node_3D_Plane(_x, _y, _group = noone) : Node_Processor(_x, _y, _group switch(_out_type) { case OUTPUT_SCALING.same_as_input : inputs[| 5].setVisible(false); - _ww = surface_get_width(_data[0]); - _hh = surface_get_height(_data[0]); + _ww = surface_get_width_safe(_data[0]); + _hh = surface_get_height_safe(_data[0]); break; case OUTPUT_SCALING.constant : inputs[| 5].setVisible(true); @@ -163,8 +163,8 @@ function __Node_3D_Plane(_x, _y, _group = noone) : Node_Processor(_x, _y, _group break; case OUTPUT_SCALING.relative : inputs[| 5].setVisible(true); - _ww = surface_get_width(_data[0]) * _out[0]; - _hh = surface_get_height(_data[0]) * _out[1]; + _ww = surface_get_width_safe(_data[0]) * _out[0]; + _hh = surface_get_height_safe(_data[0]) * _out[1]; break; } diff --git a/scripts/__surface/__surface.gml b/scripts/__surface/__surface.gml index 7e0005687..8454afe92 100644 --- a/scripts/__surface/__surface.gml +++ b/scripts/__surface/__surface.gml @@ -18,8 +18,8 @@ function SurfaceAtlas(surface, position = [ 0, 0 ], rotation = 0, scale = [ 1, 1 function Surface(surface) constructor { static set = function(surface) { self.surface = surface; - w = surface_get_width(surface); - h = surface_get_height(surface); + w = surface_get_width_safe(surface); + h = surface_get_height_safe(surface); format = surface_get_format(surface); } set(surface); diff --git a/scripts/addon_lua/addon_lua.gml b/scripts/addon_lua/addon_lua.gml index a09ab9e37..5b6d26405 100644 --- a/scripts/addon_lua/addon_lua.gml +++ b/scripts/addon_lua/addon_lua.gml @@ -206,8 +206,8 @@ [ "surface_copy", surface_copy ], [ "surface_copy_part", surface_copy_part ], [ "surface_depth_disable", surface_depth_disable ], - [ "surface_get_height", surface_get_height ], - [ "surface_get_width", surface_get_width ], + [ "surface_get_height_safe", surface_get_height_safe ], + [ "surface_get_width_safe", surface_get_width_safe ], [ "surface_get_texture", surface_get_texture ], [ "surface_get_depth_disable", surface_get_depth_disable ], [ "surface_getpixel", surface_getpixel ], diff --git a/scripts/array_functions/array_functions.gml b/scripts/array_functions/array_functions.gml index 0455a3a29..154288340 100644 --- a/scripts/array_functions/array_functions.gml +++ b/scripts/array_functions/array_functions.gml @@ -207,7 +207,7 @@ function array_get_dimension(arr) { function array_shape(arr, first = true, isSurface = false) { if(!is_array(arr)) { if(isSurface && is_surface(arr)) - return (first? "" : " x ") + string(surface_get_width(arr)) + " x " + string(surface_get_height(arr)) + " px"; + return (first? "" : " x ") + string(surface_get_width_safe(arr)) + " x " + string(surface_get_height_safe(arr)) + " px"; return ""; } diff --git a/scripts/blurSurface/blurSurface.gml b/scripts/blurSurface/blurSurface.gml index 932493c38..4eb44a373 100644 --- a/scripts/blurSurface/blurSurface.gml +++ b/scripts/blurSurface/blurSurface.gml @@ -13,8 +13,8 @@ function surface_apply_gaussian(surface, size, bg = false, bg_c = c_white, sampl static uni_ovc = shader_get_uniform(sh_blur_gaussian, "overColor"); var format = surface_get_format(surface) - __blur_hori = surface_verify(__blur_hori, surface_get_width(surface), surface_get_height(surface), format); - __blur_vert = surface_verify(__blur_vert, surface_get_width(surface), surface_get_height(surface), format); + __blur_hori = surface_verify(__blur_hori, surface_get_width_safe(surface), surface_get_height_safe(surface), format); + __blur_vert = surface_verify(__blur_vert, surface_get_width_safe(surface), surface_get_height_safe(surface), format); #region kernel generation size = max(1, round(size)); @@ -38,7 +38,7 @@ function surface_apply_gaussian(surface, size, bg = false, bg_c = c_white, sampl draw_clear_alpha(bg_c, bg); shader_set(sh_blur_gaussian); - shader_set_uniform_f_array_safe(uni_dim, [ surface_get_width(surface), surface_get_height(surface) ]); + shader_set_uniform_f_array_safe(uni_dim, [ surface_get_width_safe(surface), surface_get_height_safe(surface) ]); shader_set_uniform_f_array_safe(uni_wei, gau_array); shader_set_uniform_i(uni_bor, sampleMode); diff --git a/scripts/buffer_functions/buffer_functions.gml b/scripts/buffer_functions/buffer_functions.gml index 79955ac5a..975b7223b 100644 --- a/scripts/buffer_functions/buffer_functions.gml +++ b/scripts/buffer_functions/buffer_functions.gml @@ -33,11 +33,11 @@ function buffer_from_surface(surface, size = true) { var bitSize = surface_format_get_bytes(surface_get_format(surface)); - var _b = buffer_create((header_length * size) + surface_get_width(surface) * surface_get_height(surface) * bitSize, buffer_fixed, 1); + var _b = buffer_create((header_length * size) + surface_get_width_safe(surface) * surface_get_height_safe(surface) * bitSize, buffer_fixed, 1); if(size) { buffer_write(_b, buffer_text, "PXCS"); - buffer_write(_b, buffer_u16, surface_get_width(surface)); - buffer_write(_b, buffer_u16, surface_get_height(surface)); + buffer_write(_b, buffer_u16, surface_get_width_safe(surface)); + buffer_write(_b, buffer_u16, surface_get_height_safe(surface)); buffer_write(_b, buffer_u8, surface_get_format(surface)); } diff --git a/scripts/d3d_scene/d3d_scene.gml b/scripts/d3d_scene/d3d_scene.gml index 896667843..27fbc63eb 100644 --- a/scripts/d3d_scene/d3d_scene.gml +++ b/scripts/d3d_scene/d3d_scene.gml @@ -175,8 +175,8 @@ function __3dScene(camera) constructor { static ssaoPass = function(deferData) { #region if(!ssao_enabled) return; - var _sw = surface_get_width(deferData.geometry_data[0]); - var _sh = surface_get_height(deferData.geometry_data[0]); + var _sw = surface_get_width_safe(deferData.geometry_data[0]); + var _sh = surface_get_height_safe(deferData.geometry_data[0]); var _ssao_surf = surface_create(_sw, _sh); surface_set_shader(_ssao_surf, sh_d3d_ssao); diff --git a/scripts/d3d_surface_extrude/d3d_surface_extrude.gml b/scripts/d3d_surface_extrude/d3d_surface_extrude.gml index 960deb40a..2421e1de4 100644 --- a/scripts/d3d_surface_extrude/d3d_surface_extrude.gml +++ b/scripts/d3d_surface_extrude/d3d_surface_extrude.gml @@ -29,8 +29,8 @@ function __3dSurfaceExtrude(surface = noone, height = noone, smooth = false) : _ var _surface = surface; var _height = height; - var ww = surface_get_width(_surface); - var hh = surface_get_height(_surface); + var ww = surface_get_width_safe(_surface); + var hh = surface_get_height_safe(_surface); surface_w = ww; surface_h = hh; @@ -61,8 +61,8 @@ function __3dSurfaceExtrude(surface = noone, height = noone, smooth = false) : _ } if(useH) { - var hgw = surface_get_width(_height); - var hgh = surface_get_height(_height); + var hgw = surface_get_width_safe(_height); + var hgh = surface_get_height_safe(_height); var hgtW = hgw / ww; var hgtH = hgh / hh; diff --git a/scripts/distribution_function/distribution_function.gml b/scripts/distribution_function/distribution_function.gml index c3c6eb24c..61bb771a9 100644 --- a/scripts/distribution_function/distribution_function.gml +++ b/scripts/distribution_function/distribution_function.gml @@ -1,8 +1,8 @@ function get_point_from_dist(distMap, attempt = 4) { if(!is_surface(distMap)) return noone; - var w = surface_get_width(distMap); - var h = surface_get_height(distMap); + var w = surface_get_width_safe(distMap); + var h = surface_get_height_safe(distMap); var v = 0; var res = noone; @@ -33,7 +33,7 @@ function get_points_from_dist(distMap, amount, seed = 0, attempt = 8) { BLEND_OVERRIDE; shader_set(sh_sample_points); shader_set_uniform_f(shader_get_uniform(sh_sample_points, "dimension"), - surface_get_width(distMap) / amount, surface_get_height(distMap)); + surface_get_width_safe(distMap) / amount, surface_get_height_safe(distMap)); shader_set_uniform_i(shader_get_uniform(sh_sample_points, "attempt"), attempt); shader_set_uniform_f(shader_get_uniform(sh_sample_points, "seed"), seed); @@ -47,8 +47,8 @@ function get_points_from_dist(distMap, amount, seed = 0, attempt = 8) { buffer_seek(b, buffer_seek_start, 0); var pos = array_create(amount); - var w = surface_get_width(distMap); - var h = surface_get_height(distMap); + var w = surface_get_width_safe(distMap); + var h = surface_get_height_safe(distMap); for( var i = 0; i < amount; i++ ) { var cc = buffer_read(b, buffer_u32); diff --git a/scripts/draw_fit/draw_fit.gml b/scripts/draw_fit/draw_fit.gml index fc35691f1..05648864e 100644 --- a/scripts/draw_fit/draw_fit.gml +++ b/scripts/draw_fit/draw_fit.gml @@ -4,8 +4,8 @@ function draw_sprite_fit(spr, ind, xx, yy, w, h, color = c_white, alpha = 1) { } function draw_surface_fit(surf, xx, yy, w, h, color = c_white, alpha = 1) { - var ss = min(w / surface_get_width(surf), h / surface_get_height(surf)); - draw_surface_ext_safe(surf, xx - surface_get_width(surf) * ss / 2, yy - surface_get_height(surf) * ss / 2, ss, ss,, color, alpha); + var ss = min(w / surface_get_width_safe(surf), h / surface_get_height_safe(surf)); + draw_surface_ext_safe(surf, xx - surface_get_width_safe(surf) * ss / 2, yy - surface_get_height_safe(surf) * ss / 2, ss, ss,, color, alpha); } function draw_surface_stretch_fit(surf, xx, yy, w, h, sw, sh) { diff --git a/scripts/draw_surface_blend/draw_surface_blend.gml b/scripts/draw_surface_blend/draw_surface_blend.gml index edd940086..d48eb7991 100644 --- a/scripts/draw_surface_blend/draw_surface_blend.gml +++ b/scripts/draw_surface_blend/draw_surface_blend.gml @@ -32,15 +32,15 @@ function draw_surface_blend(background, foreground, blend = 0, alpha = 1, _pre_a var uniform_presalpha = shader_get_uniform(sh, "preserveAlpha"); var surf = surface_get_target(); - var surf_w = surface_get_width(surf); - var surf_h = surface_get_height(surf); + var surf_w = surface_get_width_safe(surf); + var surf_h = surface_get_height_safe(surf); if(is_surface(foreground)) { shader_set(sh); texture_set_stage(uniform_foreground, surface_get_texture(foreground)); if(_mask) texture_set_stage(uniform_mask, surface_get_texture(_mask)); shader_set_uniform_i(uniform_is_mask, _mask != 0? 1 : 0); - shader_set_uniform_f_array(uniform_dim_rat, [ surface_get_width(background) / surface_get_width(foreground), surface_get_height(background) / surface_get_height(foreground) ]); + shader_set_uniform_f_array(uniform_dim_rat, [ surface_get_width_safe(background) / surface_get_width_safe(foreground), surface_get_height_safe(background) / surface_get_height_safe(foreground) ]); shader_set_uniform_f(uniform_alpha, alpha); shader_set_uniform_i(uniform_presalpha, _pre_alp); shader_set_uniform_i(uniform_tile, tile); diff --git a/scripts/draw_surface_functions/draw_surface_functions.gml b/scripts/draw_surface_functions/draw_surface_functions.gml index 8b9424d0f..a0c48051a 100644 --- a/scripts/draw_surface_functions/draw_surface_functions.gml +++ b/scripts/draw_surface_functions/draw_surface_functions.gml @@ -1,8 +1,8 @@ function draw_surface_align(surface, _x, _y, _s, _halign = fa_left, _valign = fa_top) { if(!is_surface(surface)) return; - var w = surface_get_width(surface) * _s; - var h = surface_get_height(surface) * _s; + var w = surface_get_width_safe(surface) * _s; + var h = surface_get_height_safe(surface) * _s; var _sx = _x, _sy = _y; switch(_halign) { diff --git a/scripts/draw_tooltip/draw_tooltip.gml b/scripts/draw_tooltip/draw_tooltip.gml index dbdb2d774..14c39cb2a 100644 --- a/scripts/draw_tooltip/draw_tooltip.gml +++ b/scripts/draw_tooltip/draw_tooltip.gml @@ -84,8 +84,8 @@ function draw_tooltip_surface_array(surf) { var i = floor(ind / col); var j = safe_mod(ind, col); - var sw = surface_get_width(surf[ind]); - var sh = surface_get_height(surf[ind]); + var sw = surface_get_width_safe(surf[ind]); + var sh = surface_get_height_safe(surf[ind]); var ss = nn / max(sw, sh); var cx = mx + ui(8) + j * nn + nn / 2; var cy = my + ui(8) + i * nn + nn / 2; @@ -103,8 +103,8 @@ function draw_tooltip_surface(surf) { } if(!is_surface(surf)) return; - var sw = surface_get_width(surf); - var sh = surface_get_height(surf); + var sw = surface_get_width_safe(surf); + var sh = surface_get_height_safe(surf); var ss = min(ui(128) / sw, ui(128) / sh); @@ -146,8 +146,8 @@ function draw_tooltip_atlas(atlas) { if(!is_surface(surf)) continue; - var sw = surface_get_width(surf); - var sh = surface_get_height(surf); + var sw = surface_get_width_safe(surf); + var sh = surface_get_height_safe(surf); var ss = min(ui(48) / sw, ui(48) / sh); draw_surface_ext_safe(surf, sx, _y, ss, ss); diff --git a/scripts/dynaSurf/dynaSurf.gml b/scripts/dynaSurf/dynaSurf.gml index ff599db22..bcb10a247 100644 --- a/scripts/dynaSurf/dynaSurf.gml +++ b/scripts/dynaSurf/dynaSurf.gml @@ -1,4 +1,4 @@ -function dynaSurf() constructor { +function DynaSurf() constructor { surfaces = []; static getWidth = function() { return 1; } diff --git a/scripts/dynaSurf_iso/dynaSurf_iso.gml b/scripts/dynaSurf_iso/dynaSurf_iso.gml index 1d8b6be5c..d9fbb3318 100644 --- a/scripts/dynaSurf_iso/dynaSurf_iso.gml +++ b/scripts/dynaSurf_iso/dynaSurf_iso.gml @@ -1,4 +1,4 @@ -function dynaSurf_iso_4() : dynaSurf() constructor { +function dynaSurf_iso_4() : DynaSurf() constructor { surfaces = array_create(4, noone); static getSurface = function(_rot) { diff --git a/scripts/gameframe/gameframe.gml b/scripts/gameframe/gameframe.gml index 962d536cd..5b0b3fa4a 100644 --- a/scripts/gameframe/gameframe.gml +++ b/scripts/gameframe/gameframe.gml @@ -801,7 +801,7 @@ function gameframe_caption_get_overlap() { if (window_get_fullscreen() || gameframe_isFullscreen_hx) return 0.; var _h = gameframe_caption_get_height(); var _rect = application_get_position(); - return max(0, _h - _rect[1]) / ((_rect[2] - _rect[0]) / surface_get_width(application_surface)); + return max(0, _h - _rect[1]) / ((_rect[2] - _rect[0]) / surface_get_width_safe(application_surface)); } function gameframe_caption_draw_border_default(__x, __y, __width, __height) { diff --git a/scripts/gif_reader/gif_reader.gml b/scripts/gif_reader/gif_reader.gml index 80299c4bc..df519937b 100644 --- a/scripts/gif_reader/gif_reader.gml +++ b/scripts/gif_reader/gif_reader.gml @@ -160,7 +160,7 @@ function gif_std_enum_getIndex() { surface_set_target(_ws); draw_clear(16777215); surface_reset_target(); - _white32 = sprite_create_from_surface(_ws, 0, 0, surface_get_width(_ws), surface_get_height(_ws), false, false, 0, 0); + _white32 = sprite_create_from_surface(_ws, 0, 0, surface_get_width_safe(_ws), surface_get_height_safe(_ws), false, false, 0, 0); surface_free(_ws); Gif_white32 = _white32; } @@ -182,11 +182,11 @@ function gif_std_enum_getIndex() { surface_copy(_sf, _frame.x, _frame.y, _frame.surface); if (_spr == -1) { - _spr = sprite_create_from_surface(_sf, 0, 0, surface_get_width(_sf), surface_get_height(_sf), false, false, 0, 0); + _spr = sprite_create_from_surface(_sf, 0, 0, surface_get_width_safe(_sf), surface_get_height_safe(_sf), false, false, 0, 0); } else { //spr_size = sprite_get_width(_spr) * sprite_get_height(_spr) * sprite_get_number(_spr); //show_debug_message(string(spr_size)); - sprite_add_from_surface(_spr, _sf, 0, 0, surface_get_width(_sf), surface_get_height(_sf), false, false); + sprite_add_from_surface(_spr, _sf, 0, 0, surface_get_width_safe(_sf), surface_get_height_safe(_sf), false, false); } var _fdelay = _frame.delay; @@ -234,7 +234,7 @@ function gif_std_enum_getIndex() { surface_set_target(_ws); draw_clear(16777215); surface_reset_target(); - _white32 = sprite_create_from_surface(_ws, 0, 0, surface_get_width(_ws), surface_get_height(_ws), false, false, 0, 0); + _white32 = sprite_create_from_surface(_ws, 0, 0, surface_get_width_safe(_ws), surface_get_height_safe(_ws), false, false, 0, 0); surface_free(_ws); Gif_white32 = _white32; } @@ -255,11 +255,11 @@ function gif_std_enum_getIndex() { surface_copy(_sf, _frame.x, _frame.y, _frame.surface); if (_spr == -1) { - _spr = sprite_create_from_surface(_sf, 0, 0, surface_get_width(_sf), surface_get_height(_sf), false, false, 0, 0); + _spr = sprite_create_from_surface(_sf, 0, 0, surface_get_width_safe(_sf), surface_get_height_safe(_sf), false, false, 0, 0); } else { //spr_size = sprite_get_width(_spr) * sprite_get_height(_spr) * sprite_get_number(_spr); //show_debug_message(string(spr_size)); - sprite_add_from_surface(_spr, _sf, 0, 0, surface_get_width(_sf), surface_get_height(_sf), false, false); + sprite_add_from_surface(_spr, _sf, 0, 0, surface_get_width_safe(_sf), surface_get_height_safe(_sf), false, false); } var _fdelay = _frame.delay; diff --git a/scripts/histogram_drawer/histogram_drawer.gml b/scripts/histogram_drawer/histogram_drawer.gml index d9ad0a883..4315ae8ea 100644 --- a/scripts/histogram_drawer/histogram_drawer.gml +++ b/scripts/histogram_drawer/histogram_drawer.gml @@ -56,8 +56,8 @@ function histogramUpdate(surface) { if(!is_surface(surface)) return; histMax = 0; - var sw = surface_get_width(surface); - var sh = surface_get_height(surface); + var sw = surface_get_width_safe(surface); + var sh = surface_get_height_safe(surface); var stw = max(1, sw / attributes.preview_sample); var sth = max(1, sh / attributes.preview_sample); diff --git a/scripts/mask_function/mask_function.gml b/scripts/mask_function/mask_function.gml index e2192b834..edcf283d1 100644 --- a/scripts/mask_function/mask_function.gml +++ b/scripts/mask_function/mask_function.gml @@ -14,7 +14,7 @@ function mask_apply(original, edited, mask, mix = 1) { shader_set_uniform_f(shader_get_uniform(sh_mask, "mixRatio"), mix); - draw_sprite_stretched(s_fx_pixel, 0, 0, 0, surface_get_width(original), surface_get_height(original)); + draw_sprite_stretched(s_fx_pixel, 0, 0, 0, surface_get_width_safe(original), surface_get_height_safe(original)); shader_reset(); surface_reset_target(); diff --git a/scripts/node_3d_depth/node_3d_depth.gml b/scripts/node_3d_depth/node_3d_depth.gml index a334fabcb..e7db11e52 100644 --- a/scripts/node_3d_depth/node_3d_depth.gml +++ b/scripts/node_3d_depth/node_3d_depth.gml @@ -51,16 +51,16 @@ function Node_3D_Depth(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) DRAW_CLEAR shader_set_surface("texMap", _tex); - shader_set_f("dimension", surface_get_width(_tex), surface_get_height(_tex)); + shader_set_f("dimension", surface_get_width_safe(_tex), surface_get_height_safe(_tex)); shader_set_surface("depthMap", _dep); - shader_set_f("depthDimension", surface_get_width(_dep), surface_get_height(_dep)); + shader_set_f("depthDimension", surface_get_width_safe(_dep), surface_get_height_safe(_dep)); shader_set_f("cameraPos", _cx, _cy, _cz); shader_set_f("cameraUp", up_x, up_y, up_z); shader_set_f("cameraRight", right_x, right_y, right_z); - draw_sprite_stretched(s_fx_pixel, 0, 0, 0, surface_get_width(_tex), surface_get_height(_tex)); + draw_sprite_stretched(s_fx_pixel, 0, 0, 0, surface_get_width_safe(_tex), surface_get_height_safe(_tex)); surface_reset_shader(); return _outSurf; diff --git a/scripts/node_9slice/node_9slice.gml b/scripts/node_9slice/node_9slice.gml index 36d0d632f..6d4f17bb5 100644 --- a/scripts/node_9slice/node_9slice.gml +++ b/scripts/node_9slice/node_9slice.gml @@ -27,7 +27,7 @@ function Node_9Slice(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co if(index == 0) { var s = inputs[| 0].getValue(); if(is_array(s)) s = s[0]; - inputs[| 1].setValue([surface_get_width(s), surface_get_height(s)]); + inputs[| 1].setValue([surface_get_width_safe(s), surface_get_height_safe(s)]); } } @@ -123,8 +123,8 @@ function Node_9Slice(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co shader_set_interpolation(_inSurf); var ww = _dim[0]; var hh = _dim[1]; - var in_w = surface_get_width(_inSurf); - var in_h = surface_get_height(_inSurf); + var in_w = surface_get_width_safe(_inSurf); + var in_h = surface_get_height_safe(_inSurf); var sp_r = _splice[0]; var sp_t = _splice[1]; var sp_l = _splice[2]; diff --git a/scripts/node_FXAA/node_FXAA.gml b/scripts/node_FXAA/node_FXAA.gml index 29c277295..40090d820 100644 --- a/scripts/node_FXAA/node_FXAA.gml +++ b/scripts/node_FXAA/node_FXAA.gml @@ -18,7 +18,7 @@ function Node_FXAA(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons static processData = function(_outSurf, _data, _output_index, _array_index) { surface_set_shader(_outSurf, sh_FXAA); gpu_set_tex_filter(true); - shader_set_f("dimension", surface_get_width(_data[0]), surface_get_height(_data[0])); + shader_set_f("dimension", surface_get_width_safe(_data[0]), surface_get_height_safe(_data[0])); draw_surface_safe(_data[0], 0, 0); gpu_set_tex_filter(false); surface_reset_shader(); diff --git a/scripts/node_VFX_renderer/node_VFX_renderer.gml b/scripts/node_VFX_renderer/node_VFX_renderer.gml index e3e3af50c..bef051581 100644 --- a/scripts/node_VFX_renderer/node_VFX_renderer.gml +++ b/scripts/node_VFX_renderer/node_VFX_renderer.gml @@ -92,8 +92,8 @@ function Node_VFX_Renderer(_x, _y, _group = noone) : Node(_x, _y, _group) constr else if(_blend == PARTICLE_BLEND_MODE.additive) BLEND_ADD; - var surf_w = surface_get_width(_outSurf); - var surf_h = surface_get_height(_outSurf); + var surf_w = surface_get_width_safe(_outSurf); + var surf_h = surface_get_height_safe(_outSurf); for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i++ ) { var parts = inputs[| i].getValue(_time); diff --git a/scripts/node_VFX_spawner/node_VFX_spawner.gml b/scripts/node_VFX_spawner/node_VFX_spawner.gml index 6380c28ef..bfd97940b 100644 --- a/scripts/node_VFX_spawner/node_VFX_spawner.gml +++ b/scripts/node_VFX_spawner/node_VFX_spawner.gml @@ -102,7 +102,7 @@ function Node_VFX_Spawner(_x, _y, _group = noone) : Node_VFX_Spawner_Base(_x, _y var cx = xx + w * _s / 2; var cy = yy + h * _s / 2; - var ss = min((w - 8) / surface_get_width(spr), (h - 8) / surface_get_height(spr)) * _s; + var ss = min((w - 8) / surface_get_width_safe(spr), (h - 8) / surface_get_height_safe(spr)) * _s; draw_surface_align(spr, cx, cy, ss, fa_center, fa_center); } } \ No newline at end of file diff --git a/scripts/node_alpha_hash/node_alpha_hash.gml b/scripts/node_alpha_hash/node_alpha_hash.gml index 58fbe63d6..bf8a86f8a 100644 --- a/scripts/node_alpha_hash/node_alpha_hash.gml +++ b/scripts/node_alpha_hash/node_alpha_hash.gml @@ -26,7 +26,7 @@ function Node_Alpha_Hash(_x, _y, _group = noone) : Node_Processor(_x, _y, _group BLEND_OVERRIDE; shader_set(shader); - shader_set_uniform_f(uniform_dim, surface_get_width(_data[0]), surface_get_height(_data[0])); + shader_set_uniform_f(uniform_dim, surface_get_width_safe(_data[0]), surface_get_height_safe(_data[0])); shader_set_uniform_f_array_safe(uniform_dit, dither8); draw_surface_safe(_data[0], 0, 0); shader_reset(); diff --git a/scripts/node_armature_bind/node_armature_bind.gml b/scripts/node_armature_bind/node_armature_bind.gml index eca90de7b..f3a3e9bb5 100644 --- a/scripts/node_armature_bind/node_armature_bind.gml +++ b/scripts/node_armature_bind/node_armature_bind.gml @@ -132,8 +132,8 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr for( var i = 0, n = array_length(_sdata); i < n; i++ ) { var _sid = _sdata[i][0]; var _surf = _sdata[i][1]; - var _sw = surface_get_width(_surf); - var _sh = surface_get_height(_surf); + var _sw = surface_get_width_safe(_surf); + var _sh = surface_get_height_safe(_surf); var _ss = (_hh - 8) / _sh; draw_surface_ext_safe(_surf, _sx, _sy, _ss, _ss, 0, c_white, 1); @@ -281,8 +281,8 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr var _sy1 = _sy0 + ssh; draw_rectangle(_sx0, _sy0, _sx1, _sy1, true); - var _ssw = surface_get_width(_surf); - var _ssh = surface_get_height(_surf); + var _ssw = surface_get_width_safe(_surf); + var _ssh = surface_get_height_safe(_surf); var _sss = min(ssh / _ssw, ssh / _ssh); draw_surface_ext_safe(_surf, _sx0, _sy0, _sss, _sss, 0, c_white, 1); @@ -556,8 +556,8 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr _tran[TRANSFORM.rot] = sa; } else if(drag_type == NODE_COMPOSE_DRAG.scale) { var _rot = _aang * (_pang? _bone.angle : _bone.pose_local_angle) + _tran[TRANSFORM.rot]; - var _sw = surface_get_width(_surf); - var _sh = surface_get_height(_surf); + var _sw = surface_get_width_safe(_surf); + var _sh = surface_get_height_safe(_surf); var _p = point_rotate(_mx - dragging_mx, _my - dragging_my, 0, 0, -_rot); var sca_x = _p[0] / _s / _sw * 2; @@ -621,8 +621,8 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr _sca[1] *= _psca? _bone.pose_scale : _bone.pose_local_scale; } - var _ww = surface_get_width(_surf); - var _hh = surface_get_height(_surf); + var _ww = surface_get_width_safe(_surf); + var _hh = surface_get_height_safe(_surf); var _sw = _ww * _sca[0]; var _sh = _hh * _sca[1]; @@ -836,8 +836,8 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr _sca[1] *= _psca? _b.pose_scale : _b.pose_local_scale; } - var _ww = surface_get_width(_s); - var _hh = surface_get_height(_s); + var _ww = surface_get_width_safe(_s); + var _hh = surface_get_height_safe(_s); var _sw = _ww * _sca[0]; var _sh = _hh * _sca[1]; @@ -887,8 +887,8 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr _b = boneMap[? _b]; - var _cx = surface_get_width(_surf) / 2; - var _cy = surface_get_height(_surf) / 2; + var _cx = surface_get_width_safe(_surf) / 2; + var _cy = surface_get_height_safe(_surf) / 2; var _anc = _b.getPoint(0.5); var _rot = _arot? -_b.angle : 0; diff --git a/scripts/node_atlas/node_atlas.gml b/scripts/node_atlas/node_atlas.gml index 5dd50bb2d..a89301792 100644 --- a/scripts/node_atlas/node_atlas.gml +++ b/scripts/node_atlas/node_atlas.gml @@ -20,7 +20,7 @@ function Node_Atlas(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con BLEND_OVERRIDE; shader_set(sh_atlas); - shader_set_uniform_f_array_safe(uniform_dim, [surface_get_width(_data[0]), surface_get_height(_data[0])]); + shader_set_uniform_f_array_safe(uniform_dim, [surface_get_width_safe(_data[0]), surface_get_height_safe(_data[0])]); draw_surface_safe(_data[0], 0, 0); shader_reset(); diff --git a/scripts/node_average/node_average.gml b/scripts/node_average/node_average.gml index e1b7c71f7..faee831d0 100644 --- a/scripts/node_average/node_average.gml +++ b/scripts/node_average/node_average.gml @@ -33,7 +33,7 @@ function Node_Average(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c if(_output_index == 1) return array_safe_get(colors, _array_index); - var side = max(surface_get_width(inSurf), surface_get_height(inSurf)); + var side = max(surface_get_width_safe(inSurf), surface_get_height_safe(inSurf)); var lop = ceil(log2(side)); var cc; side = power(2, lop); diff --git a/scripts/node_bevel/node_bevel.gml b/scripts/node_bevel/node_bevel.gml index df687b8d3..0c9b9dd1a 100644 --- a/scripts/node_bevel/node_bevel.gml +++ b/scripts/node_bevel/node_bevel.gml @@ -49,8 +49,8 @@ function Node_Bevel(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con var _surf = current_data[0]; if(!is_surface(_surf)) return; - var _pw = surface_get_width(_surf) * _s / 2; - var _ph = surface_get_height(_surf) * _s / 2; + var _pw = surface_get_width_safe(_surf) * _s / 2; + var _ph = surface_get_height_safe(_surf) * _s / 2; inputs[| 2].drawOverlay(active, _x + _pw, _y + _ph, _s, _mx, _my, _snx, _sny); } @@ -67,7 +67,7 @@ function Node_Bevel(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con shader_set_uniform_f_array_safe(uniform_shf, _shf); shader_set_uniform_f_array_safe(uniform_sca, _sca); shader_set_uniform_i(uniform_slp, _slp); - shader_set_uniform_f_array_safe(uniform_dim, [ surface_get_width(_data[0]), surface_get_height(_data[0]) ]); + shader_set_uniform_f_array_safe(uniform_dim, [ surface_get_width_safe(_data[0]), surface_get_height_safe(_data[0]) ]); shader_set_uniform_i(uniform_sam, _sam); draw_surface_safe(_data[0], 0, 0); diff --git a/scripts/node_blend/node_blend.gml b/scripts/node_blend/node_blend.gml index 9cafb61b0..c5a93a90e 100644 --- a/scripts/node_blend/node_blend.gml +++ b/scripts/node_blend/node_blend.gml @@ -74,11 +74,11 @@ function Node_Blend(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con inputs[| 11].setVisible(_tile == 0); if(_tile == 0 && is_surface(_fore)) { - ww = surface_get_width(_back); - hh = surface_get_height(_back); + ww = surface_get_width_safe(_back); + hh = surface_get_height_safe(_back); - var fw = surface_get_width(_fore); - var fh = surface_get_height(_fore); + var fw = surface_get_width_safe(_fore); + var fh = surface_get_height_safe(_fore); temp_surface[0] = surface_verify(temp_surface[0], ww, hh, cDep); _foreDraw = temp_surface[0]; @@ -108,22 +108,22 @@ function Node_Blend(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con switch(_outp) { case 0 : - ww = surface_get_width(_back); - hh = surface_get_height(_back); + ww = surface_get_width_safe(_back); + hh = surface_get_height_safe(_back); break; case 1 : if(is_surface(_foreDraw)) { - ww = surface_get_width(_foreDraw); - hh = surface_get_height(_foreDraw); + ww = surface_get_width_safe(_foreDraw); + hh = surface_get_height_safe(_foreDraw); } break; case 2 : - ww = surface_get_width(_mask); - hh = surface_get_height(_mask); + ww = surface_get_width_safe(_mask); + hh = surface_get_height_safe(_mask); break; case 3 : - ww = max(surface_get_width(_back), is_surface(_fore)? surface_get_width(_fore) : 1, surface_get_width(_mask)); - hh = max(surface_get_height(_back), is_surface(_fore)? surface_get_height(_fore) : 1, surface_get_height(_mask)); + ww = max(surface_get_width_safe(_back), is_surface(_fore)? surface_get_width_safe(_fore) : 1, surface_get_width_safe(_mask)); + hh = max(surface_get_height_safe(_back), is_surface(_fore)? surface_get_height_safe(_fore) : 1, surface_get_height_safe(_mask)); break; case 4 : ww = _out_dim[0]; diff --git a/scripts/node_blinker/node_blinker.gml b/scripts/node_blinker/node_blinker.gml index cd25e5527..531639c6d 100644 --- a/scripts/node_blinker/node_blinker.gml +++ b/scripts/node_blinker/node_blinker.gml @@ -38,7 +38,7 @@ function Node_Blinker(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c //if(!is_surface(_surf)) return _outSurf; - //temp_surface[0] = surface_verify(temp_surface[0], surface_get_width(_outSurf), surface_get_height(_outSurf)); + //temp_surface[0] = surface_verify(temp_surface[0], surface_get_width_safe(_outSurf), surface_get_height_safe(_outSurf)); //surface_set_shader(temp_surface[0], sh_blink_extract); // draw_surface_safe(_surf); diff --git a/scripts/node_bloom/node_bloom.gml b/scripts/node_bloom/node_bloom.gml index 4cdc62eb4..6843251e9 100644 --- a/scripts/node_bloom/node_bloom.gml +++ b/scripts/node_bloom/node_bloom.gml @@ -44,7 +44,7 @@ function Node_Bloom(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con var _tole = _data[2]; var _stre = _data[3]; var _mask = _data[4]; - var pass1 = surface_create_valid(surface_get_width(_outSurf), surface_get_height(_outSurf), attrDepth()); + var pass1 = surface_create_valid(surface_get_width_safe(_outSurf), surface_get_height_safe(_outSurf), attrDepth()); surface_set_target(pass1); draw_clear_alpha(c_black, 1); diff --git a/scripts/node_blur_bokeh/node_blur_bokeh.gml b/scripts/node_blur_bokeh/node_blur_bokeh.gml index 9d51b4a4b..fd3541ce8 100644 --- a/scripts/node_blur_bokeh/node_blur_bokeh.gml +++ b/scripts/node_blur_bokeh/node_blur_bokeh.gml @@ -37,7 +37,7 @@ function Node_Blur_Bokeh(_x, _y, _group = noone) : Node_Processor(_x, _y, _group BLEND_OVERRIDE; shader_set(shader); - shader_set_uniform_f(uniform_dim, surface_get_width(_data[0]), surface_get_height(_data[0])); + shader_set_uniform_f(uniform_dim, surface_get_width_safe(_data[0]), surface_get_height_safe(_data[0])); shader_set_uniform_f(uniform_str, _str); draw_surface_safe(_data[0], 0, 0); shader_reset(); diff --git a/scripts/node_blur_contrast/node_blur_contrast.gml b/scripts/node_blur_contrast/node_blur_contrast.gml index 6a0cfb2d9..133ef1e64 100644 --- a/scripts/node_blur_contrast/node_blur_contrast.gml +++ b/scripts/node_blur_contrast/node_blur_contrast.gml @@ -41,8 +41,8 @@ function Node_Blur_Contrast(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr var _mask = _data[3]; var _mix = _data[4]; - var ww = surface_get_width(_surf); - var hh = surface_get_height(_surf); + var ww = surface_get_width_safe(_surf); + var hh = surface_get_height_safe(_surf); temp_surface[0] = surface_verify(temp_surface[0], ww, hh, attrDepth()); diff --git a/scripts/node_blur_directional/node_blur_directional.gml b/scripts/node_blur_directional/node_blur_directional.gml index b88c23fdb..b1f554195 100644 --- a/scripts/node_blur_directional/node_blur_directional.gml +++ b/scripts/node_blur_directional/node_blur_directional.gml @@ -34,8 +34,8 @@ function Node_Blur_Directional(_x, _y, _group = noone) : Node_Processor(_x, _y, _surf = _surf[preview_index]; } - var ww = surface_get_width(_surf); - var hh = surface_get_height(_surf); + var ww = surface_get_width_safe(_surf); + var hh = surface_get_height_safe(_surf); inputs[| 2].drawOverlay(active, _x + ww / 2 * _s, _y + hh / 2 * _s, _s, _mx, _my, _snx, _sny); } @@ -47,7 +47,7 @@ function Node_Blur_Directional(_x, _y, _group = noone) : Node_Processor(_x, _y, var _mix = _data[4]; surface_set_shader(_outSurf, sh_blur_directional); - shader_set_f("size", max(surface_get_width(_data[0]), surface_get_height( _data[1]))); + shader_set_f("size", max(surface_get_width_safe(_data[0]), surface_get_height_safe( _data[1]))); shader_set_f("strength", _str); shader_set_f("direction", _dir + 90); shader_set_i("sampleMode", struct_try_get(attributes, "oversample")); diff --git a/scripts/node_blur_radial/node_blur_radial.gml b/scripts/node_blur_radial/node_blur_radial.gml index 302521e33..f45ecaace 100644 --- a/scripts/node_blur_radial/node_blur_radial.gml +++ b/scripts/node_blur_radial/node_blur_radial.gml @@ -46,12 +46,12 @@ function Node_Blur_Radial(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou var _cen = _data[2]; var _mask = _data[4]; var _mix = _data[5]; - _cen[0] /= surface_get_width(_outSurf); - _cen[1] /= surface_get_height(_outSurf); + _cen[0] /= surface_get_width_safe(_outSurf); + _cen[1] /= surface_get_height_safe(_outSurf); surface_set_shader(_outSurf, sh_blur_radial); shader_set_interpolation(_data[0]); - shader_set_f("dimension", surface_get_width(_outSurf), surface_get_height(_outSurf)); + shader_set_f("dimension", surface_get_width_safe(_outSurf), surface_get_height_safe(_outSurf)); shader_set_f("strength", abs(_str)); shader_set_f("center", _cen); diff --git a/scripts/node_blur_simple/node_blur_simple.gml b/scripts/node_blur_simple/node_blur_simple.gml index 5bad324f8..7fbab0577 100644 --- a/scripts/node_blur_simple/node_blur_simple.gml +++ b/scripts/node_blur_simple/node_blur_simple.gml @@ -59,7 +59,7 @@ function Node_Blur_Simple(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou BLEND_OVERRIDE; shader_set(shader); - shader_set_uniform_f(uniform_dim, surface_get_width(_data[0]), surface_get_height(_data[0])); + shader_set_uniform_f(uniform_dim, surface_get_width_safe(_data[0]), surface_get_height_safe(_data[0])); shader_set_uniform_f(uniform_siz, _size); shader_set_uniform_i(uniform_sam, _samp); diff --git a/scripts/node_blur_zoom/node_blur_zoom.gml b/scripts/node_blur_zoom/node_blur_zoom.gml index 6626bac86..aee3f119b 100644 --- a/scripts/node_blur_zoom/node_blur_zoom.gml +++ b/scripts/node_blur_zoom/node_blur_zoom.gml @@ -52,8 +52,8 @@ function Node_Blur_Zoom(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) var _msk = _data[5]; var _mask = _data[6]; var _mix = _data[7]; - _cen[0] /= surface_get_width(_outSurf); - _cen[1] /= surface_get_height(_outSurf); + _cen[0] /= surface_get_width_safe(_outSurf); + _cen[1] /= surface_get_height_safe(_outSurf); surface_set_shader(_outSurf, sh_blur_zoom); shader_set_f("strength", _str); diff --git a/scripts/node_camera/node_camera.gml b/scripts/node_camera/node_camera.gml index b3a6367d9..cb69bd9c3 100644 --- a/scripts/node_camera/node_camera.gml +++ b/scripts/node_camera/node_camera.gml @@ -188,8 +188,8 @@ function Node_Camera(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co py = _cam_y + sy; } - _scnW = surface_get_width(_surface); - _scnH = surface_get_height(_surface); + _scnW = surface_get_width_safe(_surface); + _scnH = surface_get_height_safe(_surface); px /= _scnW; py /= _scnH; diff --git a/scripts/node_canvas/node_canvas.gml b/scripts/node_canvas/node_canvas.gml index 8b9be78f2..2296d6407 100644 --- a/scripts/node_canvas/node_canvas.gml +++ b/scripts/node_canvas/node_canvas.gml @@ -106,7 +106,7 @@ function Node_Canvas(_x, _y, _group = noone) : Node(_x, _y, _group) constructor if(!is_surface(canvas_surface)) { canvas_surface = surface_create_from_buffer(_dim[0], _dim[1], canvas_buffer); - } else if(surface_get_width(canvas_surface) != _dim[0] || surface_get_height(canvas_surface) != _dim[1]) { + } else if(surface_get_width_safe(canvas_surface) != _dim[0] || surface_get_height_safe(canvas_surface) != _dim[1]) { buffer_delete(canvas_buffer); canvas_buffer = buffer_create(_dim[0] * _dim[1] * 4, buffer_fixed, 4); canvas_surface = surface_size_to(canvas_surface, _dim[0], _dim[1]); @@ -119,8 +119,8 @@ function Node_Canvas(_x, _y, _group = noone) : Node(_x, _y, _group) constructor function surface_store_buffer() { buffer_delete(canvas_buffer); - surface_w = surface_get_width(canvas_surface); - surface_h = surface_get_height(canvas_surface); + surface_w = surface_get_width_safe(canvas_surface); + surface_h = surface_get_height_safe(canvas_surface); canvas_buffer = buffer_create(surface_w * surface_h * 4, buffer_fixed, 4); buffer_get_surface(canvas_buffer, canvas_surface, 0); @@ -163,8 +163,8 @@ function Node_Canvas(_x, _y, _group = noone) : Node(_x, _y, _group) constructor } else draw_circle_prec(_x, _y, _siz / 2, 0); } else { - var _sw = surface_get_width(_brush); - var _sh = surface_get_height(_brush); + var _sw = surface_get_width_safe(_brush); + var _sh = surface_get_height_safe(_brush); draw_surface_ext_safe(_brush, _x - floor(_sw / 2), _y - floor(_sh / 2), 1, 1, 0, draw_get_color(), draw_get_alpha()); } @@ -377,8 +377,8 @@ function Node_Canvas(_x, _y, _group = noone) : Node(_x, _y, _group) constructor function canvas_fill(_x, _y, _surf, _thres) { #region var _alp = inputs[| 11].getValue(); - var w = surface_get_width(_surf); - var h = surface_get_height(_surf); + var w = surface_get_width_safe(_surf); + var h = surface_get_height_safe(_surf); var _c1 = get_color_buffer(_x, _y); var thr = _thres * _thres; @@ -425,8 +425,8 @@ function Node_Canvas(_x, _y, _group = noone) : Node(_x, _y, _group) constructor if(!surface_exists(canvas_surface)) surface_store_buffer(); - var _surf_w = surface_get_width(canvas_surface); - var _surf_h = surface_get_height(canvas_surface); + var _surf_w = surface_get_width_safe(canvas_surface); + var _surf_h = surface_get_height_safe(canvas_surface); #region drawing surface review _drawing_surface = surface_verify(_drawing_surface, _surf_w, _surf_h); @@ -474,8 +474,8 @@ function Node_Canvas(_x, _y, _group = noone) : Node(_x, _y, _group) constructor if(mouse_press(mb_left, active)) { var pos_x = selection_position[0]; var pos_y = selection_position[1]; - var sel_w = surface_get_width(selection_surface); - var sel_h = surface_get_height(selection_surface); + var sel_w = surface_get_width_safe(selection_surface); + var sel_h = surface_get_height_safe(selection_surface); if(point_in_rectangle(mouse_cur_x, mouse_cur_y, pos_x, pos_y, pos_x + sel_w, pos_y + sel_h)) { is_select_drag = true; @@ -683,7 +683,7 @@ function Node_Canvas(_x, _y, _group = noone) : Node(_x, _y, _group) constructor prev_surface = surface_verify(prev_surface, _dim[0], _dim[1]); preview_draw_surface = surface_verify(preview_draw_surface, _dim[0], _dim[1]); - _preview_draw_surface = surface_verify(_preview_draw_surface, surface_get_width(__s), surface_get_height(__s)); + _preview_draw_surface = surface_verify(_preview_draw_surface, surface_get_width_safe(__s), surface_get_height_safe(__s)); surface_set_shader(preview_draw_surface, noone,, BLEND.alpha); draw_surface_safe(_drawing_surface, 0, 0); @@ -723,8 +723,8 @@ function Node_Canvas(_x, _y, _group = noone) : Node(_x, _y, _group) constructor if(is_selected) { var pos_x = _x + selection_position[0] * _s; var pos_y = _y + selection_position[1] * _s; - var sel_w = surface_get_width(selection_surface) * _s; - var sel_h = surface_get_height(selection_surface) * _s; + var sel_w = surface_get_width_safe(selection_surface) * _s; + var sel_h = surface_get_height_safe(selection_surface) * _s; draw_set_color(c_white); draw_rectangle_dashed(pos_x, pos_y, pos_x + sel_w, pos_y + sel_h, true, 4); @@ -743,7 +743,7 @@ function Node_Canvas(_x, _y, _group = noone) : Node(_x, _y, _group) constructor surface_reset_target(); shader_set(sh_brush_outline); - shader_set_f("dimension", surface_get_width(_preview_draw_surface), surface_get_height(_preview_draw_surface)); + shader_set_f("dimension", surface_get_width_safe(_preview_draw_surface), surface_get_height_safe(_preview_draw_surface)); draw_surface_ext_safe(_preview_draw_surface, 0, 0, 1, 1, 0, c_white, 1); shader_reset(); } diff --git a/scripts/node_checkerboard/node_checkerboard.gml b/scripts/node_checkerboard/node_checkerboard.gml index c277aff54..734bdb0ee 100644 --- a/scripts/node_checkerboard/node_checkerboard.gml +++ b/scripts/node_checkerboard/node_checkerboard.gml @@ -58,7 +58,7 @@ function Node_Checker(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c surface_set_target(_outSurf); shader_set(shader); - shader_set_uniform_f(uniform_dim, surface_get_width(_outSurf), surface_get_height(_outSurf)); + shader_set_uniform_f(uniform_dim, surface_get_width_safe(_outSurf), surface_get_height_safe(_outSurf)); shader_set_uniform_f(uniform_pos, _pos[0] / _dim[0], _pos[1] / _dim[1]); shader_set_uniform_f(uniform_angle, degtorad(_ang)); shader_set_uniform_f(uniform_amount, _amo); diff --git a/scripts/node_chromatic_aberration/node_chromatic_aberration.gml b/scripts/node_chromatic_aberration/node_chromatic_aberration.gml index bab452bb7..37d8479f5 100644 --- a/scripts/node_chromatic_aberration/node_chromatic_aberration.gml +++ b/scripts/node_chromatic_aberration/node_chromatic_aberration.gml @@ -37,7 +37,7 @@ function Node_Chromatic_Aberration(_x, _y, _group = noone) : Node_Processor(_x, surface_set_shader(_outSurf, shader); shader_set_interpolation(_data[0]); - shader_set_uniform_f_array_safe(uniform_dim, [ surface_get_width(_data[0]), surface_get_height(_data[0]) ]); + shader_set_uniform_f_array_safe(uniform_dim, [ surface_get_width_safe(_data[0]), surface_get_height_safe(_data[0]) ]); shader_set_uniform_f_array_safe(uniform_cen, center); shader_set_uniform_f(uniform_str, stren); draw_surface_safe(_data[0], 0, 0); diff --git a/scripts/node_color_replacement/node_color_replacement.gml b/scripts/node_color_replacement/node_color_replacement.gml index 567865253..a5a54b3ee 100644 --- a/scripts/node_color_replacement/node_color_replacement.gml +++ b/scripts/node_color_replacement/node_color_replacement.gml @@ -139,8 +139,8 @@ function Node_Colors_Replace(_x, _y, _group = noone) : Node_Processor(_x, _y, _g var _pall = ds_map_create(); for( var i = 0, n = array_length(_surf); i < n; i++ ) { - var ww = surface_get_width(_surf[i]); - var hh = surface_get_height(_surf[i]); + var ww = surface_get_width_safe(_surf[i]); + var hh = surface_get_height_safe(_surf[i]); var c_buffer = buffer_create(ww * hh * 4, buffer_fixed, 2); diff --git a/scripts/node_color_sampler/node_color_sampler.gml b/scripts/node_color_sampler/node_color_sampler.gml index 154ee0bbd..b3d14c8e7 100644 --- a/scripts/node_color_sampler/node_color_sampler.gml +++ b/scripts/node_color_sampler/node_color_sampler.gml @@ -20,8 +20,8 @@ function Node_Sampler(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c var _suf = current_data[0]; if(!is_surface(_suf)) return; - var ww = surface_get_width(_suf); - var hh = surface_get_height(_suf); + var ww = surface_get_width_safe(_suf); + var hh = surface_get_height_safe(_suf); var _pos = current_data[1]; var _sam = 1 + (current_data[2] - 1) * 2; @@ -51,8 +51,8 @@ function Node_Sampler(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c var _sam = _data[2]; if(!is_surface(_surf)) return c_black; - var ww = surface_get_width(_surf); - var hh = surface_get_height(_surf); + var ww = surface_get_width_safe(_surf); + var hh = surface_get_height_safe(_surf); var r = 0, g = 0, b = 0, amo = 0; diff --git a/scripts/node_combine_hsv/node_combine_hsv.gml b/scripts/node_combine_hsv/node_combine_hsv.gml index ccab9a659..85104097a 100644 --- a/scripts/node_combine_hsv/node_combine_hsv.gml +++ b/scripts/node_combine_hsv/node_combine_hsv.gml @@ -28,7 +28,7 @@ function Node_Combine_HSV(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou texture_set_stage(uniform_s, surface_get_texture(_s)); texture_set_stage(uniform_v, surface_get_texture(_v)); - draw_sprite_ext(s_fx_pixel, 0, 0, 0, surface_get_width(_outSurf), surface_get_width(_outSurf), 0, c_white, 1); + draw_sprite_ext(s_fx_pixel, 0, 0, 0, surface_get_width_safe(_outSurf), surface_get_width_safe(_outSurf), 0, c_white, 1); shader_reset(); BLEND_NORMAL; diff --git a/scripts/node_combine_rgb/node_combine_rgb.gml b/scripts/node_combine_rgb/node_combine_rgb.gml index 2ddba2598..91cfdf164 100644 --- a/scripts/node_combine_rgb/node_combine_rgb.gml +++ b/scripts/node_combine_rgb/node_combine_rgb.gml @@ -47,7 +47,7 @@ function Node_Combine_RGB(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou shader_set_uniform_i(uniform_usea, is_surface(_a)); texture_set_stage(uniform_a, surface_get_texture(_a)); - draw_sprite_ext(s_fx_pixel, 0, 0, 0, surface_get_width(_outSurf), surface_get_width(_outSurf), 0, c_white, 1); + draw_sprite_ext(s_fx_pixel, 0, 0, 0, surface_get_width_safe(_outSurf), surface_get_width_safe(_outSurf), 0, c_white, 1); shader_reset(); BLEND_NORMAL; diff --git a/scripts/node_composite/node_composite.gml b/scripts/node_composite/node_composite.gml index ad4894988..337256bf7 100644 --- a/scripts/node_composite/node_composite.gml +++ b/scripts/node_composite/node_composite.gml @@ -120,8 +120,8 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) var _sy1 = _sy0 + ssh; draw_rectangle(_sx0, _sy0, _sx1, _sy1, true); - var _ssw = surface_get_width(_surf); - var _ssh = surface_get_height(_surf); + var _ssw = surface_get_width_safe(_surf); + var _ssh = surface_get_height_safe(_surf); var _sss = min(ssh / _ssw, ssh / _ssh); draw_surface_ext_safe(_surf, _sx0, _sy0, _sss, _sss, 0, c_white, 1); @@ -496,8 +496,8 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) if(key_mod_press(ALT)) { var _surf = current_data[input_dragging - 1]; - var _sw = surface_get_width(_surf); - var _sh = surface_get_height(_surf); + var _sw = surface_get_width_safe(_surf); + var _sh = surface_get_height_safe(_surf); var x0 = pos_x, x1 = pos_x + _sw; var y0 = pos_y, y1 = pos_y + _sh; @@ -554,8 +554,8 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) } else if(drag_type == NODE_COMPOSE_DRAG.scale) { var _surf = inputs[| surf_dragging + 0].getValue(); var _rot = inputs[| surf_dragging + 2].getValue(); - var _sw = surface_get_width(_surf); - var _sh = surface_get_height(_surf); + var _sw = surface_get_width_safe(_surf); + var _sh = surface_get_height_safe(_surf); var _p = point_rotate(_mx - dragging_mx, _my - dragging_my, 0, 0, -_rot); var sca_x = _p[0] / _s / _sw * 2; @@ -599,8 +599,8 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) if(!_surf || is_array(_surf)) continue; - var _ww = surface_get_width(_surf); - var _hh = surface_get_height(_surf); + var _ww = surface_get_width_safe(_surf); + var _hh = surface_get_height_safe(_surf); var _sw = _ww * _sca[0]; var _sh = _hh * _sca[1]; @@ -757,14 +757,14 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) switch(_dim_type) { case COMPOSE_OUTPUT_SCALING.first : - ww = surface_get_width(base); - hh = surface_get_height(base); + ww = surface_get_width_safe(base); + hh = surface_get_height_safe(base); break; case COMPOSE_OUTPUT_SCALING.largest : for(var i = input_fix_len; i < array_length(_data) - data_length; i += data_length) { var _s = _data[i]; - ww = max(ww, surface_get_width(_s)); - hh = max(hh, surface_get_height(_s)); + ww = max(ww, surface_get_width_safe(_s)); + hh = max(hh, surface_get_height_safe(_s)); } break; case COMPOSE_OUTPUT_SCALING.constant : @@ -800,8 +800,8 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) if(!_s || is_array(_s)) continue; - var _ww = surface_get_width(_s); - var _hh = surface_get_height(_s); + var _ww = surface_get_width_safe(_s); + var _hh = surface_get_height_safe(_s); var _sw = _ww * _sca[0]; var _sh = _hh * _sca[1]; diff --git a/scripts/node_convolution/node_convolution.gml b/scripts/node_convolution/node_convolution.gml index e9921da20..dea47abb5 100644 --- a/scripts/node_convolution/node_convolution.gml +++ b/scripts/node_convolution/node_convolution.gml @@ -41,7 +41,7 @@ function Node_Convolution(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou BLEND_OVERRIDE; shader_set(shader); - shader_set_uniform_f(uniform_dim, surface_get_width(_outSurf), surface_get_height(_outSurf)); + shader_set_uniform_f(uniform_dim, surface_get_width_safe(_outSurf), surface_get_height_safe(_outSurf)); shader_set_uniform_f_array_safe(uniform_ker, _ker); shader_set_uniform_i(uniform_sam, _sam); draw_surface_safe(_data[0], 0, 0); diff --git a/scripts/node_corner/node_corner.gml b/scripts/node_corner/node_corner.gml index 4dc2ac64b..21e0c3e54 100644 --- a/scripts/node_corner/node_corner.gml +++ b/scripts/node_corner/node_corner.gml @@ -32,14 +32,14 @@ function Node_Corner(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co static processData = function(_outSurf, _data, _output_index, _array_index) { var wd = _data[1]; - var temp = surface_create_valid(surface_get_width(_data[0]), surface_get_height(_data[0]), attrDepth()); + var temp = surface_create_valid(surface_get_width_safe(_data[0]), surface_get_height_safe(_data[0]), attrDepth()); surface_set_target(temp); DRAW_CLEAR BLEND_OVERRIDE; shader_set(sh_corner_erode); - shader_set_uniform_f_array_safe(uniform_er_dim, [surface_get_width(_data[0]), surface_get_height(_data[0])]); + shader_set_uniform_f_array_safe(uniform_er_dim, [surface_get_width_safe(_data[0]), surface_get_height_safe(_data[0])]); shader_set_uniform_f(uniform_er_size, wd); draw_surface_safe(_data[0], 0, 0); @@ -52,7 +52,7 @@ function Node_Corner(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co BLEND_OVERRIDE; shader_set(sh_corner); - shader_set_uniform_f_array_safe(uniform_dim, [surface_get_width(_data[0]), surface_get_height(_data[0])]); + shader_set_uniform_f_array_safe(uniform_dim, [surface_get_width_safe(_data[0]), surface_get_height_safe(_data[0])]); shader_set_uniform_f(uniform_rad, wd); shader_set_surface("original", _data[0]); draw_surface_safe(temp, 0, 0); diff --git a/scripts/node_crop/node_crop.gml b/scripts/node_crop/node_crop.gml index ce8e161da..878a94bbe 100644 --- a/scripts/node_crop/node_crop.gml +++ b/scripts/node_crop/node_crop.gml @@ -34,7 +34,7 @@ function Node_Crop(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons for( var i = 0, n = array_length(_splice); i < n; i++ ) _splice[i] = round(_splice[i]); - var dim = [ surface_get_width(_inSurf), surface_get_height(_inSurf) ] + var dim = [ surface_get_width_safe(_inSurf), surface_get_height_safe(_inSurf) ] var sp_r = _x + (dim[0] - _splice[0]) * _s; var sp_l = _x + _splice[2] * _s; @@ -110,7 +110,7 @@ function Node_Crop(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons static processData = function(_outSurf, _data, _output_index, _array_index) { var _inSurf = _data[0]; var _crop = _data[1]; - var _dim = [ surface_get_width(_inSurf) - _crop[0] - _crop[2], surface_get_height(_inSurf) - _crop[1] - _crop[3] ]; + var _dim = [ surface_get_width_safe(_inSurf) - _crop[0] - _crop[2], surface_get_height_safe(_inSurf) - _crop[1] - _crop[3] ]; _outSurf = surface_verify(_outSurf, _dim[0], _dim[1]); diff --git a/scripts/node_crop_content/node_crop_content.gml b/scripts/node_crop_content/node_crop_content.gml index 89ce4fc23..c3b3a68e1 100644 --- a/scripts/node_crop_content/node_crop_content.gml +++ b/scripts/node_crop_content/node_crop_content.gml @@ -55,7 +55,7 @@ function Node_Crop_Content(_x, _y, _group = noone) : Node(_x, _y, _group) constr for( var j = 0; j < array_length(_inSurf); j++ ) { var _surf = _inSurf[j]; - var _dim = [ surface_get_width(_surf), surface_get_height(_surf) ]; + var _dim = [ surface_get_width_safe(_surf), surface_get_height_safe(_surf) ]; var s = surface_create(_dim[0], _dim[1], surface_r8unorm); surface_set_target(s); DRAW_CLEAR diff --git a/scripts/node_data/node_data.gml b/scripts/node_data/node_data.gml index ace8f2cf0..fc39111a6 100644 --- a/scripts/node_data/node_data.gml +++ b/scripts/node_data/node_data.gml @@ -851,8 +851,8 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x return ""; } - var pw = surface_get_width(preview_surface); - var ph = surface_get_height(preview_surface); + var pw = surface_get_width_safe(preview_surface); + var ph = surface_get_height_safe(preview_surface); var format = surface_get_format(preview_surface); var txt = "[" + string(pw) + " x " + string(ph) + " "; @@ -1278,7 +1278,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x _surf = array_safe_get(_surf, preview_index, noone); if(!is_surface(_surf)) return noone; - return BBOX().fromWH(preview_x, preview_y, surface_get_width(_surf), surface_get_height(_surf)); + return BBOX().fromWH(preview_x, preview_y, surface_get_width_safe(_surf), surface_get_height_safe(_surf)); } #endregion static getTool = function() { return self; } diff --git a/scripts/node_de_corner/node_de_corner.gml b/scripts/node_de_corner/node_de_corner.gml index 2a3c61399..3ed459a2d 100644 --- a/scripts/node_de_corner/node_de_corner.gml +++ b/scripts/node_de_corner/node_de_corner.gml @@ -19,7 +19,7 @@ function Node_De_Corner(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) static processData = function(_outSurf, _data, _output_index, _array_index) { surface_set_shader(_outSurf, sh_de_corner); - shader_set_f("dimension", [ surface_get_width(_data[0]), surface_get_height(_data[0]) ]); + shader_set_f("dimension", [ surface_get_width_safe(_data[0]), surface_get_height_safe(_data[0]) ]); shader_set_f("tolerance", _data[2]); draw_surface_safe(_data[0], 0, 0); diff --git a/scripts/node_dilate/node_dilate.gml b/scripts/node_dilate/node_dilate.gml index 2d83a6d58..5557ee460 100644 --- a/scripts/node_dilate/node_dilate.gml +++ b/scripts/node_dilate/node_dilate.gml @@ -59,7 +59,7 @@ function Node_Dilate(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co surface_set_shader(_outSurf, shader); shader_set_interpolation(_data[0]); - shader_set_uniform_f_array_safe(uniform_dim, [ surface_get_width(_data[0]), surface_get_height(_data[0]) ]); + shader_set_uniform_f_array_safe(uniform_dim, [ surface_get_width_safe(_data[0]), surface_get_height_safe(_data[0]) ]); shader_set_uniform_f_array_safe(uniform_cen, center); shader_set_uniform_f(uniform_str, stren); shader_set_uniform_f(uniform_rad, rad); diff --git a/scripts/node_displacement/node_displacement.gml b/scripts/node_displacement/node_displacement.gml index 627d19f3e..5d05cf334 100644 --- a/scripts/node_displacement/node_displacement.gml +++ b/scripts/node_displacement/node_displacement.gml @@ -68,10 +68,10 @@ If set, then strength value control how many times the effect applies on itself. inputs[| 2].setVisible(false); break; } - var ww = surface_get_width(_data[0]); - var hh = surface_get_height(_data[0]); - var mw = surface_get_width(_data[1]); - var mh = surface_get_height(_data[1]); + var ww = surface_get_width_safe(_data[0]); + var hh = surface_get_height_safe(_data[0]); + var mw = surface_get_width_safe(_data[1]); + var mh = surface_get_height_safe(_data[1]); surface_set_shader(_outSurf, shader); shader_set_interpolation(_data[0]); diff --git a/scripts/node_dither/node_dither.gml b/scripts/node_dither/node_dither.gml index b8ed85ca8..b6969bca7 100644 --- a/scripts/node_dither/node_dither.gml +++ b/scripts/node_dither/node_dither.gml @@ -97,7 +97,7 @@ function Node_Dither(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co shader_set(shader); - shader_set_uniform_f_array_safe(uniform_dim, [ surface_get_width(_data[0]), surface_get_height(_data[0]) ] ); + shader_set_uniform_f_array_safe(uniform_dim, [ surface_get_width_safe(_data[0]), surface_get_height_safe(_data[0]) ] ); switch(_typ) { case 0 : @@ -118,7 +118,7 @@ function Node_Dither(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co case 3 : if(is_surface(_map)) { shader_set_uniform_i(uniform_map_use, 1); - shader_set_uniform_f_array_safe(uniform_map_dim, [ surface_get_width(_map), surface_get_height(_map) ]); + shader_set_uniform_f_array_safe(uniform_map_dim, [ surface_get_width_safe(_map), surface_get_height_safe(_map) ]); texture_set_stage(uniform_map, surface_get_texture(_map)); } break; diff --git a/scripts/node_edge_detect/node_edge_detect.gml b/scripts/node_edge_detect/node_edge_detect.gml index 64c630dc8..43f02e2cc 100644 --- a/scripts/node_edge_detect/node_edge_detect.gml +++ b/scripts/node_edge_detect/node_edge_detect.gml @@ -41,7 +41,7 @@ function Node_Edge_Detect(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou BLEND_OVERRIDE; shader_set(shader); - shader_set_uniform_f_array_safe(uniform_dim, [surface_get_width(_data[0]), surface_get_height(_data[0])]); + shader_set_uniform_f_array_safe(uniform_dim, [surface_get_width_safe(_data[0]), surface_get_height_safe(_data[0])]); shader_set_uniform_i(uniform_filter, ft); shader_set_uniform_i(uniform_sam, ov); draw_surface_safe(_data[0], 0, 0); diff --git a/scripts/node_erode/node_erode.gml b/scripts/node_erode/node_erode.gml index a2e0b5f54..6c1242aff 100644 --- a/scripts/node_erode/node_erode.gml +++ b/scripts/node_erode/node_erode.gml @@ -40,7 +40,7 @@ function Node_Erode(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con BLEND_OVERRIDE; shader_set(shader); - shader_set_uniform_f_array_safe(uniform_dim, [surface_get_width(_data[0]), surface_get_height(_data[0])]); + shader_set_uniform_f_array_safe(uniform_dim, [surface_get_width_safe(_data[0]), surface_get_height_safe(_data[0])]); shader_set_uniform_f(uniform_size, wd); shader_set_uniform_i(uniform_bor, _data[2]? 1 : 0); shader_set_uniform_i(uniform_alp, _data[3]? 1 : 0); diff --git a/scripts/node_find_pixel/node_find_pixel.gml b/scripts/node_find_pixel/node_find_pixel.gml index e094f13de..1a69f3a7c 100644 --- a/scripts/node_find_pixel/node_find_pixel.gml +++ b/scripts/node_find_pixel/node_find_pixel.gml @@ -29,14 +29,14 @@ function Node_Find_Pixel(_x, _y, _group = noone) : Node_Processor(_x, _y, _group DRAW_CLEAR shader_set(shader); texture_set_stage(shader_tex, surface_get_texture(_surf)); - shader_set_uniform_f(shader_dim, surface_get_width(_surf), surface_get_height(_surf)); + shader_set_uniform_f(shader_dim, surface_get_width_safe(_surf), surface_get_height_safe(_surf)); draw_sprite_ext(s_fx_pixel, 0, 0, 0, 1, 1, 0, _col, 1); shader_reset(); surface_reset_target(); var pos = surface_get_pixel(temp_surface[0], 0, 0); - var _x = round(color_get_red(pos) / 255 * surface_get_width(_surf)); - var _y = round(color_get_green(pos) / 255 * surface_get_height(_surf)); + var _x = round(color_get_red(pos) / 255 * surface_get_width_safe(_surf)); + var _y = round(color_get_green(pos) / 255 * surface_get_height_safe(_surf)); return [ _x, _y ]; } diff --git a/scripts/node_flood_fill/node_flood_fill.gml b/scripts/node_flood_fill/node_flood_fill.gml index 42174c202..ad38cd792 100644 --- a/scripts/node_flood_fill/node_flood_fill.gml +++ b/scripts/node_flood_fill/node_flood_fill.gml @@ -56,8 +56,8 @@ function Node_Flood_Fill(_x, _y, _group = noone) : Node_Processor(_x, _y, _group var _filC = surface_get_pixel_ext(inSurf, _pos[0], _pos[1]); - var sw = surface_get_width(inSurf); - var sh = surface_get_height(inSurf); + var sw = surface_get_width_safe(inSurf); + var sh = surface_get_height_safe(inSurf); for( var i = 0, n = array_length(temp_surface); i < n; i++ ) temp_surface[i] = surface_verify(temp_surface[i], sw, sh, attrDepth()); diff --git a/scripts/node_fluid_add/node_fluid_add.gml b/scripts/node_fluid_add/node_fluid_add.gml index ebb93df40..36548a6ae 100644 --- a/scripts/node_fluid_add/node_fluid_add.gml +++ b/scripts/node_fluid_add/node_fluid_add.gml @@ -33,8 +33,8 @@ function Node_Fluid_Add(_x, _y, _group = noone) : Node_Fluid(_x, _y, _group) con var _pos = inputs[| 2].getValue(); if(is_surface(_mat)) { - var sw = surface_get_width(_mat) * _s; - var sh = surface_get_height(_mat) * _s; + var sw = surface_get_width_safe(_mat) * _s; + var sh = surface_get_height_safe(_mat) * _s; var mx = _x + _pos[0] * _s - sw / 2; var my = _y + _pos[1] * _s - sh / 2; @@ -60,8 +60,8 @@ function Node_Fluid_Add(_x, _y, _group = noone) : Node_Fluid(_x, _y, _group) con if(!_act) return; if(!is_surface(_mat)) return; - var sw = surface_get_width(_mat); - var sh = surface_get_height(_mat); + var sw = surface_get_width_safe(_mat); + var sh = surface_get_height_safe(_mat); if(_prevPos != noone && _inh != 0) { var dx = _pos[0] - _prevPos[0]; diff --git a/scripts/node_fluid_apply_velo/node_fluid_apply_velo.gml b/scripts/node_fluid_apply_velo/node_fluid_apply_velo.gml index 9de4c9534..7be186e1f 100644 --- a/scripts/node_fluid_apply_velo/node_fluid_apply_velo.gml +++ b/scripts/node_fluid_apply_velo/node_fluid_apply_velo.gml @@ -28,8 +28,8 @@ function Node_Fluid_Apply_Velocity(_x, _y, _group = noone) : Node_Fluid(_x, _y, var _pos = inputs[| 2].getValue(); if(is_surface(_mat)) { - var sw = surface_get_width(_mat) * _s; - var sh = surface_get_height(_mat) * _s; + var sw = surface_get_width_safe(_mat) * _s; + var sh = surface_get_height_safe(_mat) * _s; var mx = _x + _pos[0] * _s - sw / 2; var my = _y + _pos[1] * _s - sh / 2; @@ -52,8 +52,8 @@ function Node_Fluid_Apply_Velocity(_x, _y, _group = noone) : Node_Fluid(_x, _y, if(!_act) return; if(!is_surface(_mat)) return; - var sw = surface_get_width(_mat); - var sh = surface_get_height(_mat); + var sw = surface_get_width_safe(_mat); + var sh = surface_get_height_safe(_mat); fd_rectangle_add_velocity_surface(_dom, _mat, _pos[0] - sw / 2, _pos[1] - sh / 2, 1, 1, _vel[0], _vel[1]); } diff --git a/scripts/node_glow/node_glow.gml b/scripts/node_glow/node_glow.gml index 7744cc123..e10d7dd72 100644 --- a/scripts/node_glow/node_glow.gml +++ b/scripts/node_glow/node_glow.gml @@ -42,12 +42,12 @@ function Node_Glow(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons var _size = _data[2]; var _stre = _data[3]; var cl = _data[4]; - var pass1 = surface_create_valid(surface_get_width(_outSurf), surface_get_height(_outSurf), attrDepth()); + var pass1 = surface_create_valid(surface_get_width_safe(_outSurf), surface_get_height_safe(_outSurf), attrDepth()); surface_set_target(pass1); draw_clear_alpha(c_black, 1); shader_set(shader); - shader_set_uniform_f_array_safe(uniform_dim, [ surface_get_width(_outSurf), surface_get_height(_outSurf) ]); + shader_set_uniform_f_array_safe(uniform_dim, [ surface_get_width_safe(_outSurf), surface_get_height_safe(_outSurf) ]); shader_set_uniform_f(uniform_size, _size + _border); shader_set_uniform_f_array_safe(uniform_colr, [ 1., 1., 1., 1. ]); diff --git a/scripts/node_hlsl/node_hlsl.gml b/scripts/node_hlsl/node_hlsl.gml index d855dd525..9b97e2179 100644 --- a/scripts/node_hlsl/node_hlsl.gml +++ b/scripts/node_hlsl/node_hlsl.gml @@ -160,7 +160,7 @@ struct PixelShaderOutput { static processData = function(_output, _data, _output_index, _array_index = 0) { var _surf = _data[2]; if(!is_surface(_surf)) return; - _output = surface_verify(_output, surface_get_width(_surf), surface_get_height(_surf)); + _output = surface_verify(_output, surface_get_width_safe(_surf), surface_get_height_safe(_surf)); surface_set_target(_output); DRAW_CLEAR @@ -186,7 +186,7 @@ struct PixelShaderOutput { } } - matrix_set(matrix_world, matrix_build(0, 0, 0, 0, 0, 0, surface_get_width(_surf), surface_get_height(_surf), 1)); + matrix_set(matrix_world, matrix_build(0, 0, 0, 0, 0, 0, surface_get_width_safe(_surf), surface_get_height_safe(_surf), 1)); vertex_submit(global.HLSL_VB, pr_trianglestrip, surface_get_texture(_surf)); matrix_set(matrix_world, matrix_build_identity()); diff --git a/scripts/node_image_splice_sheet/node_image_splice_sheet.gml b/scripts/node_image_splice_sheet/node_image_splice_sheet.gml index 74692505b..dc760af9b 100644 --- a/scripts/node_image_splice_sheet/node_image_splice_sheet.gml +++ b/scripts/node_image_splice_sheet/node_image_splice_sheet.gml @@ -33,8 +33,8 @@ function Node_Image_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group) constru .setDisplay(VALUE_DISPLAY.button, [ function() { var _sur = inputs[| 0].getValue(); if(!is_surface(_sur) || _sur == DEF_SURFACE) return; - var ww = surface_get_width(_sur); - var hh = surface_get_height(_sur); + var ww = surface_get_width_safe(_sur); + var hh = surface_get_height_safe(_sur); var _size = inputs[| 1].getValue(); var _offs = inputs[| 4].getValue(); diff --git a/scripts/node_isosurf/node_counter.yy b/scripts/node_isosurf/node_counter.yy new file mode 100644 index 000000000..7f559330c --- /dev/null +++ b/scripts/node_isosurf/node_counter.yy @@ -0,0 +1,12 @@ +{ + "isDnD": false, + "isCompatibility": false, + "parent": { + "name": "number", + "path": "folders/nodes/data/number.yy", + }, + "resourceVersion": "1.0", + "name": "node_counter", + "tags": [], + "resourceType": "GMScript", +} \ No newline at end of file diff --git a/scripts/node_isosurf/node_isosurf.gml b/scripts/node_isosurf/node_isosurf.gml new file mode 100644 index 000000000..9681f1117 --- /dev/null +++ b/scripts/node_isosurf/node_isosurf.gml @@ -0,0 +1,29 @@ +function Node_IsoSurf(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor { + name = "IsoSurf"; + + inputs[| 0] = nodeValue("Direction", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + .setDisplay(VALUE_DISPLAY.enum_button, [ "4", "8" ]); + + inputs[| 1] = nodeValue("Surfaces", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone) + .setVisible(true, true) + .setArrayDepth(1); + + outputs[| 0] = nodeValue("IsoSurf", self, JUNCTION_CONNECT.output, VALUE_TYPE.dynaSurf, noone); + + input_display_list = [ + ["Isometric", false], 0, + ["Surfaces", false], 1, + ]; + + static processData = function(_outSurf, _data, _output_index, _array_index) { + var _type = _data[0]; + var _surf = _data[1]; + var _amo = _type == 0? 4 : 8; + + var _iso = new dynaSurf_iso_4(); + for( var i = 0; i < _amo; i++ ) + _iso.surfaces[i] = array_safe_get(_surf, i, noone); + + return _iso; + } +} \ No newline at end of file diff --git a/scripts/node_isosurf/node_isosurf.yy b/scripts/node_isosurf/node_isosurf.yy new file mode 100644 index 000000000..42f979581 --- /dev/null +++ b/scripts/node_isosurf/node_isosurf.yy @@ -0,0 +1,11 @@ +{ + "resourceType": "GMScript", + "resourceVersion": "1.0", + "name": "node_isosurf", + "isCompatibility": false, + "isDnD": false, + "parent": { + "name": "surface", + "path": "folders/nodes/data/value/surface.yy", + }, +} \ No newline at end of file diff --git a/scripts/node_local_analyze/node_local_analyze.gml b/scripts/node_local_analyze/node_local_analyze.gml index 2de855966..96597cc4c 100644 --- a/scripts/node_local_analyze/node_local_analyze.gml +++ b/scripts/node_local_analyze/node_local_analyze.gml @@ -51,7 +51,7 @@ function Node_Local_Analyze(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr BLEND_OVERRIDE; shader_set(shader); - shader_set_uniform_f(uniform_dim, surface_get_width(_data[0]), surface_get_height(_data[0])); + shader_set_uniform_f(uniform_dim, surface_get_width_safe(_data[0]), surface_get_height_safe(_data[0])); shader_set_uniform_i(uniform_alg, _alg); shader_set_uniform_i(uniform_sam, _sam); shader_set_uniform_i(uniform_sha, _shp); diff --git a/scripts/node_mirror/node_mirror.gml b/scripts/node_mirror/node_mirror.gml index 31d921946..068df7f07 100644 --- a/scripts/node_mirror/node_mirror.gml +++ b/scripts/node_mirror/node_mirror.gml @@ -43,7 +43,7 @@ function Node_Mirror(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co } static processData = function(_outSurf, _data, _output_index, _array_index) { - var _dim = [ surface_get_width(_data[0]), surface_get_height(_data[0]) ]; + var _dim = [ surface_get_width_safe(_data[0]), surface_get_height_safe(_data[0]) ]; var _pos = _data[1]; var _ang = _data[2]; diff --git a/scripts/node_morph_surface/node_morph_surface.gml b/scripts/node_morph_surface/node_morph_surface.gml index 0836a2b18..38380b434 100644 --- a/scripts/node_morph_surface/node_morph_surface.gml +++ b/scripts/node_morph_surface/node_morph_surface.gml @@ -34,11 +34,11 @@ function Node_Morph_Surface(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr shader_set_interpolation(_data[0]); shader_set_surface("sFrom", sFrom); shader_set_surface("sTo", sTo); - shader_set_f("dimension", surface_get_width(sFrom), surface_get_height(sTo)); + shader_set_f("dimension", surface_get_width_safe(sFrom), surface_get_height_safe(sTo)); shader_set_f("amount", amo); shader_set_f("threshold", thres); - draw_sprite_stretched(s_fx_pixel, 0, 0, 0, surface_get_width(sFrom), surface_get_height(sTo)); + draw_sprite_stretched(s_fx_pixel, 0, 0, 0, surface_get_width_safe(sFrom), surface_get_height_safe(sTo)); surface_reset_shader(); return _outSurf; diff --git a/scripts/node_normal/node_normal.gml b/scripts/node_normal/node_normal.gml index e958008a6..c21939a6f 100644 --- a/scripts/node_normal/node_normal.gml +++ b/scripts/node_normal/node_normal.gml @@ -30,7 +30,7 @@ function Node_Normal(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co surface_set_shader(_outSurf, sh_normal); shader_set_uniform_f(uniform_hei, _hei); shader_set_uniform_i(uniform_smt, _smt); - shader_set_uniform_f_array_safe(uniform_dim, [ surface_get_width(_data[0]), surface_get_height(_data[0]) ]); + shader_set_uniform_f_array_safe(uniform_dim, [ surface_get_width_safe(_data[0]), surface_get_height_safe(_data[0]) ]); draw_surface_safe(_data[0], 0, 0); surface_reset_shader(); diff --git a/scripts/node_normal_light/node_normal_light.gml b/scripts/node_normal_light/node_normal_light.gml index 6fa12cad3..446e51624 100644 --- a/scripts/node_normal_light/node_normal_light.gml +++ b/scripts/node_normal_light/node_normal_light.gml @@ -69,7 +69,7 @@ function Node_Normal_Light(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro texture_set_stage(uniform_map, surface_get_texture(_map)); shader_set_uniform_f(uniform_hei, _hei); - shader_set_uniform_f_array_safe(uniform_dim, [ surface_get_width(_data[0]), surface_get_height(_data[0]) ]); + shader_set_uniform_f_array_safe(uniform_dim, [ surface_get_width_safe(_data[0]), surface_get_height_safe(_data[0]) ]); shader_set_uniform_f_array_safe(uniform_amb, [color_get_red(_amb) / 255, color_get_green(_amb) / 255, color_get_blue(_amb) / 255]); shader_set_uniform_f_array_safe(uniform_light_pos, [ _light_pos[0], _light_pos[1], _light_pos[2] / 100, _light_ran ] ); diff --git a/scripts/node_onion_skin/node_onion_skin.gml b/scripts/node_onion_skin/node_onion_skin.gml index cc3bb7ca4..264621239 100644 --- a/scripts/node_onion_skin/node_onion_skin.gml +++ b/scripts/node_onion_skin/node_onion_skin.gml @@ -46,7 +46,7 @@ function Node_Onion_Skin(_x, _y, _group = noone) : Node(_x, _y, _group) construc cacheCurrentFrame(_surf); var _outSurf = outputs[| 0].getValue(); - _outSurf = surface_verify(_outSurf, surface_get_width(_surf), surface_get_height(_surf)); + _outSurf = surface_verify(_outSurf, surface_get_width_safe(_surf), surface_get_height_safe(_surf)); outputs[| 0].setValue(_outSurf); surface_set_target(_outSurf); diff --git a/scripts/node_outline/node_outline.gml b/scripts/node_outline/node_outline.gml index e95fa5b70..cdc8a28b9 100644 --- a/scripts/node_outline/node_outline.gml +++ b/scripts/node_outline/node_outline.gml @@ -57,8 +57,8 @@ function Node_Outline(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c attribute_oversample(); static processData = function(_outSurf, _data, _output_index, _array_index) { - var ww = surface_get_width(_data[0]); - var hh = surface_get_height(_data[0]); + var ww = surface_get_width_safe(_data[0]); + var hh = surface_get_height_safe(_data[0]); var wd = _data[1]; var cl = _data[2]; diff --git a/scripts/node_pack_sprites/node_pack_sprites.gml b/scripts/node_pack_sprites/node_pack_sprites.gml index 88d7add0e..25a7143e9 100644 --- a/scripts/node_pack_sprites/node_pack_sprites.gml +++ b/scripts/node_pack_sprites/node_pack_sprites.gml @@ -35,8 +35,8 @@ function Node_Pack_Sprites(_x, _y, _group = noone) : Node(_x, _y, _group) constr if(!is_surface(_surf)) continue; - var _sw = surface_get_width(_surf); - var _sh = surface_get_height(_surf); + var _sw = surface_get_width_safe(_surf); + var _sh = surface_get_height_safe(_surf); draw_rectangle( _x + _s * (_sx + spac), @@ -66,8 +66,8 @@ function Node_Pack_Sprites(_x, _y, _group = noone) : Node(_x, _y, _group) constr var s = _inpt[i]; if(!is_surface(s)) continue; - _rects[i] = new spriteAtlasData(0, 0, surface_get_width(s) + _spac * 2, - surface_get_height(s) + _spac * 2, s, i); + _rects[i] = new spriteAtlasData(0, 0, surface_get_width_safe(s) + _spac * 2, + surface_get_height_safe(s) + _spac * 2, s, i); } var pack; diff --git a/scripts/node_padding/node_padding.gml b/scripts/node_padding/node_padding.gml index 49172ddd1..2eb8f94a3 100644 --- a/scripts/node_padding/node_padding.gml +++ b/scripts/node_padding/node_padding.gml @@ -63,8 +63,8 @@ function Node_Padding(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c inputs[| 3].setVisible(fill); - var ww = surface_get_width(_data[0]); - var hh = surface_get_height(_data[0]); + var ww = surface_get_width_safe(_data[0]); + var hh = surface_get_height_safe(_data[0]); if(mode == 0) { var sw = ww + padding[0] + padding[2]; diff --git a/scripts/node_palette_extract/node_palette_extract.gml b/scripts/node_palette_extract/node_palette_extract.gml index 8870c6de4..26fffea0f 100644 --- a/scripts/node_palette_extract/node_palette_extract.gml +++ b/scripts/node_palette_extract/node_palette_extract.gml @@ -59,11 +59,11 @@ function Node_Palette_Extract(_x, _y, _group = noone) : Node(_x, _y, _group) con } function extractKmean(_surfFull, _size, _seed) { - var _surf = surface_create_valid(min(32, surface_get_width(_surfFull)), min(32, surface_get_height(_surfFull)), attrDepth()); + var _surf = surface_create_valid(min(32, surface_get_width_safe(_surfFull)), min(32, surface_get_height_safe(_surfFull)), attrDepth()); _size = max(1, _size); - var ww = surface_get_width(_surf); - var hh = surface_get_height(_surf); + var ww = surface_get_width_safe(_surf); + var hh = surface_get_height_safe(_surf); surface_set_target(_surf); DRAW_CLEAR @@ -183,8 +183,8 @@ function Node_Palette_Extract(_x, _y, _group = noone) : Node(_x, _y, _group) con } function extractAll(_surfFull) { - var ww = surface_get_width(_surfFull); - var hh = surface_get_height(_surfFull); + var ww = surface_get_width_safe(_surfFull); + var hh = surface_get_height_safe(_surfFull); var c_buffer = buffer_create(ww * hh * 4, buffer_fixed, 2); @@ -209,11 +209,11 @@ function Node_Palette_Extract(_x, _y, _group = noone) : Node(_x, _y, _group) con function extractFrequence(_surfFull, _size) { var msize = 128; - var _surf = surface_create_valid(min(msize, surface_get_width(_surfFull)), min(msize, surface_get_height(_surfFull))); + var _surf = surface_create_valid(min(msize, surface_get_width_safe(_surfFull)), min(msize, surface_get_height_safe(_surfFull))); _size = max(1, _size); - var ww = surface_get_width(_surf); - var hh = surface_get_height(_surf); + var ww = surface_get_width_safe(_surf); + var hh = surface_get_height_safe(_surf); surface_set_target(_surf); DRAW_CLEAR diff --git a/scripts/node_particle/node_particle.gml b/scripts/node_particle/node_particle.gml index 6b90c17da..421e963ac 100644 --- a/scripts/node_particle/node_particle.gml +++ b/scripts/node_particle/node_particle.gml @@ -87,8 +87,8 @@ function Node_Particle(_x, _y, _group = noone) : Node_VFX_Spawner_Base(_x, _y, _ else if(_blend == PARTICLE_BLEND_MODE.additive) BLEND_ADD; - var surf_w = surface_get_width(_outSurf); - var surf_h = surface_get_height(_outSurf); + var surf_w = surface_get_width_safe(_outSurf); + var surf_h = surface_get_height_safe(_outSurf); for(var i = 0; i < attributes.part_amount; i++) parts[i].draw(_exact, surf_w, surf_h); diff --git a/scripts/node_pb_fx/node_pb_fx.gml b/scripts/node_pb_fx/node_pb_fx.gml index 4db8d12ca..7603c3c0c 100644 --- a/scripts/node_pb_fx/node_pb_fx.gml +++ b/scripts/node_pb_fx/node_pb_fx.gml @@ -14,11 +14,11 @@ function Node_PB_Fx(_x, _y, _group = noone) : Node_PB(_x, _y, _group) constructo \ var _pbox = new __pbBox(); \ \ - _pbox.w = surface_get_width(_surf); \ - _pbox.h = surface_get_height(_surf); \ + _pbox.w = surface_get_width_safe(_surf); \ + _pbox.h = surface_get_height_safe(_surf); \ \ - _pbox.layer_w = surface_get_width(_surf); \ - _pbox.layer_h = surface_get_height(_surf); \ + _pbox.layer_w = surface_get_width_safe(_surf); \ + _pbox.layer_h = surface_get_height_safe(_surf); \ \ _pbox.mask = surface_create(_pbox.w, _pbox.h); \ surface_set_shader(_pbox.mask, sh_pb_to_mask); \ diff --git a/scripts/node_pb_fx_radial/node_pb_fx_radial.gml b/scripts/node_pb_fx_radial/node_pb_fx_radial.gml index 077bb2944..80e6a3259 100644 --- a/scripts/node_pb_fx_radial/node_pb_fx_radial.gml +++ b/scripts/node_pb_fx_radial/node_pb_fx_radial.gml @@ -19,7 +19,7 @@ function Node_PB_Fx_Radial(_x, _y, _group = noone) : Node_PB_Fx(_x, _y, _group) surface_set_shader(_nbox.content); for( var i = 0; i < _amo; i++ ) { var aa = i / _amo * 360; - var p = point_rotate(0, 0, surface_get_width(_pbox.content) / 2, surface_get_height(_pbox.content) / 2, aa); + var p = point_rotate(0, 0, surface_get_width_safe(_pbox.content) / 2, surface_get_height_safe(_pbox.content) / 2, aa); draw_surface_ext_safe(_pbox.content, p[0], p[1],,, aa); } diff --git a/scripts/node_pixel_sort/node_pixel_sort.gml b/scripts/node_pixel_sort/node_pixel_sort.gml index ae1d538f2..ba5cce5a8 100644 --- a/scripts/node_pixel_sort/node_pixel_sort.gml +++ b/scripts/node_pixel_sort/node_pixel_sort.gml @@ -43,8 +43,8 @@ function Node_Pixel_Sort(_x, _y, _group = noone) : Node_Processor(_x, _y, _group if(_dr < 0) _dr = 4 + _dr; if(_it <= 0) return _outSurf; - var sw = surface_get_width(_outSurf); - var sh = surface_get_height(_outSurf); + var sw = surface_get_width_safe(_outSurf); + var sh = surface_get_height_safe(_outSurf); var pp = [ surface_create_valid(sw, sh), surface_create_valid(sw, sh) ]; var sBase, sDraw; @@ -57,7 +57,7 @@ function Node_Pixel_Sort(_x, _y, _group = noone) : Node_Processor(_x, _y, _group surface_reset_target(); shader_set(shader); - shader_set_uniform_f(uniform_dim, surface_get_width(_in), surface_get_height(_in)); + shader_set_uniform_f(uniform_dim, surface_get_width_safe(_in), surface_get_height_safe(_in)); shader_set_uniform_f(uniform_tre, _tr); shader_set_uniform_i(uniform_dir, _dr); diff --git a/scripts/node_processor/node_processor.gml b/scripts/node_processor/node_processor.gml index 15ba34f40..49f82d45b 100644 --- a/scripts/node_processor/node_processor.gml +++ b/scripts/node_processor/node_processor.gml @@ -57,8 +57,8 @@ function Node_Processor(_x, _y, _group = noone) : Node(_x, _y, _group) construct var _in = getSingleValue(dimension_index, arr); if(inputs[| dimension_index].type == VALUE_TYPE.surface && is_surface(_in)) { - var ww = surface_get_width(_in); - var hh = surface_get_height(_in); + var ww = surface_get_width_safe(_in); + var hh = surface_get_height_safe(_in); return [ww, hh]; } @@ -84,8 +84,8 @@ function Node_Processor(_x, _y, _group = noone) : Node(_x, _y, _group) construct var _sw = 1, _sh = 1; if(inputs[| dimension_index].type == VALUE_TYPE.surface) { if(is_surface(surf)) { - _sw = surface_get_width(surf); - _sh = surface_get_height(surf); + _sw = surface_get_width_safe(surf); + _sh = surface_get_height_safe(surf); } else return noone; } else if(is_array(surf)) { @@ -128,8 +128,8 @@ function Node_Processor(_x, _y, _group = noone) : Node(_x, _y, _group) construct var _sw = 1, _sh = 1; if(inputs[| dimension_index].type == VALUE_TYPE.surface) { if(is_surface(surf)) { - _sw = surface_get_width(surf); - _sh = surface_get_height(surf); + _sw = surface_get_width_safe(surf); + _sh = surface_get_height_safe(surf); } else return noone; } else if(is_array(surf)) { diff --git a/scripts/node_random_shape/node_random_shape.gml b/scripts/node_random_shape/node_random_shape.gml index 9297abd97..0eed3ec29 100644 --- a/scripts/node_random_shape/node_random_shape.gml +++ b/scripts/node_random_shape/node_random_shape.gml @@ -15,8 +15,8 @@ function Node_Random_Shape(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro function surfaceContentRatio(_surf) { var s = 0; - var _sw = surface_get_width(_surf); - var _sh = surface_get_height(_surf); + var _sw = surface_get_width_safe(_surf); + var _sh = surface_get_height_safe(_surf); var total = _sw * _sh; var _buff = buffer_create(_sw * _sh * 4, buffer_fixed, 4); buffer_get_surface(_buff, _surf, 0); diff --git a/scripts/node_region_fill/node_region_fill.gml b/scripts/node_region_fill/node_region_fill.gml index f3af0ebb6..2b21125de 100644 --- a/scripts/node_region_fill/node_region_fill.gml +++ b/scripts/node_region_fill/node_region_fill.gml @@ -36,8 +36,8 @@ function Node_Region_Fill(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou var _fill = _data[3]; var _seed = _data[4]; - var _sw = surface_get_width(_surf); - var _sh = surface_get_height(_surf) + var _sw = surface_get_width_safe(_surf); + var _sh = surface_get_height_safe(_surf) temp_surface[0] = surface_verify(temp_surface[0], _sw, _sh); temp_surface[1] = surface_verify(temp_surface[1], _sw, _sh); diff --git a/scripts/node_registry/node_registry.gml b/scripts/node_registry/node_registry.gml index 99af60847..b6061080b 100644 --- a/scripts/node_registry/node_registry.gml +++ b/scripts/node_registry/node_registry.gml @@ -584,6 +584,7 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { addNodeObject(values, "Atlas Set", s_node_atlas_set, "Node_Atlas_Set", [1, Node_Atlas_Set]).setVersion(1141); ds_list_add(values, "Surface"); + addNodeObject(values, "IsoSurf", s_node_surface_from_buffer, "Node_IsoSurf", [1, Node_IsoSurf]).setVersion(11520); addNodeObject(values, "Surface from Buffer", s_node_surface_from_buffer, "Node_Surface_From_Buffer", [1, Node_Surface_From_Buffer], ["buffer to surface"], "Create surface from buffer.").setVersion(1146); ds_list_add(values, "Buffer"); diff --git a/scripts/node_render_sprite_sheet/node_render_sprite_sheet.gml b/scripts/node_render_sprite_sheet/node_render_sprite_sheet.gml index 7ae6d9e33..3c2048cab 100644 --- a/scripts/node_render_sprite_sheet/node_render_sprite_sheet.gml +++ b/scripts/node_render_sprite_sheet/node_render_sprite_sheet.gml @@ -106,8 +106,8 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group) _atl[i] = []; if(!is_surface(inpt[i])) continue; - var sw = surface_get_width(inpt[i]); - var sh = surface_get_height(inpt[i]); + var sw = surface_get_width_safe(inpt[i]); + var sh = surface_get_height_safe(inpt[i]); var ww = sw, hh = sh; switch(pack) { @@ -184,11 +184,11 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group) else oo = oupt[i]; if(!is_surface(oo)) break; - var ww = surface_get_width(oo); - var hh = surface_get_height(oo); + var ww = surface_get_width_safe(oo); + var hh = surface_get_height_safe(oo); - var _w = surface_get_width(inpt[i]); - var _h = surface_get_height(inpt[i]); + var _w = surface_get_width_safe(inpt[i]); + var _h = surface_get_height_safe(inpt[i]); surface_set_target(oo); BLEND_OVERRIDE; @@ -303,15 +303,15 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group) switch(pack) { case SPRITE_STACK.horizontal : for(var i = _st; i < _ed; i++) { - ww += surface_get_width(inpt[i]); + ww += surface_get_width_safe(inpt[i]); if(i > _st) ww += spac; - hh = max(hh, surface_get_height(inpt[i])); + hh = max(hh, surface_get_height_safe(inpt[i])); } break; case SPRITE_STACK.vertical : for(var i = _st; i < _ed; i++) { - ww = max(ww, surface_get_width(inpt[i])); - hh += surface_get_height(inpt[i]); + ww = max(ww, surface_get_width_safe(inpt[i])); + hh += surface_get_height_safe(inpt[i]); if(i > _st) hh += spac; } break; @@ -329,9 +329,9 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group) for(var j = 0; j < col; j++) { var index = _st + i * col + j; if(index >= amo) break; - row_w += surface_get_width(inpt[index]); + row_w += surface_get_width_safe(inpt[index]); if(j) row_w += spac; - row_h = max(row_h, surface_get_height(inpt[index])); + row_h = max(row_h, surface_get_height_safe(inpt[index])); } ww = max(ww, row_w); @@ -354,8 +354,8 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group) var px = padd[2]; var py = padd[1]; for(var i = _st; i < _ed; i++) { - var _w = surface_get_width(inpt[i]); - var _h = surface_get_height(inpt[i]); + var _w = surface_get_width_safe(inpt[i]); + var _h = surface_get_height_safe(inpt[i]); var _sx = px; var _sy = py; @@ -374,8 +374,8 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group) var px = padd[2]; var py = padd[1]; for(var i = _st; i < _ed; i++) { - var _w = surface_get_width(inpt[i]); - var _h = surface_get_height(inpt[i]); + var _w = surface_get_width_safe(inpt[i]); + var _h = surface_get_height_safe(inpt[i]); var _sx = px; var _sy = py; @@ -409,8 +409,8 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group) var index = _st + i * col + j; if(index >= amo) break; - var _w = surface_get_width(inpt[index]); - var _h = surface_get_height(inpt[index]); + var _w = surface_get_width_safe(inpt[index]); + var _h = surface_get_height_safe(inpt[index]); array_push(_atl, new SurfaceAtlas(inpt[index], [px, py])); draw_surface_safe(inpt[index], px, py); diff --git a/scripts/node_repeat/node_repeat.gml b/scripts/node_repeat/node_repeat.gml index 1ee1ce37f..f4548b590 100644 --- a/scripts/node_repeat/node_repeat.gml +++ b/scripts/node_repeat/node_repeat.gml @@ -97,11 +97,11 @@ function Node_Repeat(_x, _y, _group = noone) : Node(_x, _y, _group) constructor if(is_array(_surf)) { if(array_length(_surf) == 0) return [1, 1]; if(!is_surface(_surf[0])) return [1, 1]; - return [ surface_get_width(_surf[0]), surface_get_height(_surf[0]) ]; + return [ surface_get_width_safe(_surf[0]), surface_get_height_safe(_surf[0]) ]; } if(!is_surface(_surf)) return [1, 1]; - return [ surface_get_width(_surf), surface_get_height(_surf) ]; + return [ surface_get_width_safe(_surf), surface_get_height_safe(_surf) ]; } static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { @@ -220,8 +220,8 @@ function Node_Repeat(_x, _y, _group = noone) : Node(_x, _y, _group) constructor if(is_array(_inSurf)) _surf = array_safe_get(_inSurf, _arr? irandom(array_length(_inSurf) - 1) : safe_mod(i, array_length(_inSurf))); - var _sw = surface_get_width(_surf); - var _sh = surface_get_height(_surf); + var _sw = surface_get_width_safe(_surf); + var _sh = surface_get_height_safe(_surf); var sw = _sw * scax; var sh = _sh * scay; diff --git a/scripts/node_rigid_object/node_rigid_object.gml b/scripts/node_rigid_object/node_rigid_object.gml index 12ba6057e..2daa81b93 100644 --- a/scripts/node_rigid_object/node_rigid_object.gml +++ b/scripts/node_rigid_object/node_rigid_object.gml @@ -97,8 +97,8 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr if(_shp == 2) { var _tex = inputs[| 6].getValue(); if(is_array(_tex)) _tex = _tex[safe_mod(preview_index, array_length(_tex))]; - var tw = surface_get_width(_tex); - var th = surface_get_height(_tex); + var tw = surface_get_width_safe(_tex); + var th = surface_get_height_safe(_tex); draw_set_color(is_convex? COLORS._main_accent : COLORS._main_value_negative); @@ -263,8 +263,8 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr var meshes = attributes.mesh; var mesh = []; - var ww = surface_get_width(_tex); - var hh = surface_get_height(_tex); + var ww = surface_get_width_safe(_tex); + var hh = surface_get_height_safe(_tex); var surface_buffer = buffer_create(ww * hh * 4, buffer_fixed, 2); buffer_get_surface(surface_buffer, _tex, 0); @@ -514,8 +514,8 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr var _spos = inputs[| 7].getValue(); - var ww = max(1, surface_get_width(_tex)); - var hh = max(1, surface_get_height(_tex)); + var ww = max(1, surface_get_width_safe(_tex)); + var hh = max(1, surface_get_height_safe(_tex)); var ox = rpos == noone? _spos[0] : rpos[0]; var oy = rpos == noone? _spos[1] : rpos[1]; diff --git a/scripts/node_scale/node_scale.gml b/scripts/node_scale/node_scale.gml index b72b16edd..04c4e63b6 100644 --- a/scripts/node_scale/node_scale.gml +++ b/scripts/node_scale/node_scale.gml @@ -38,8 +38,8 @@ function Node_Scale(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con var ww, hh; switch(mode) { case 0 : - ww = scale * surface_get_width(_data[0]); - hh = scale * surface_get_height(_data[0]); + ww = scale * surface_get_width_safe(_data[0]); + hh = scale * surface_get_height_safe(_data[0]); break; case 1 : ww = targ[0]; diff --git a/scripts/node_scale_algo/node_scale_algo.gml b/scripts/node_scale_algo/node_scale_algo.gml index 5f30d94aa..69ec2f878 100644 --- a/scripts/node_scale_algo/node_scale_algo.gml +++ b/scripts/node_scale_algo/node_scale_algo.gml @@ -36,8 +36,8 @@ function Node_Scale_Algo(_x, _y, _group = noone) : Node_Processor(_x, _y, _group static processData = function(_outSurf, _data, _output_index, _array_index) { var inSurf = _data[0]; var algo = _data[1]; - var ww = surface_get_width(inSurf); - var hh = surface_get_height(inSurf); + var ww = surface_get_width_safe(inSurf); + var hh = surface_get_height_safe(inSurf); var cDep = attrDepth(); var shader; var sc = 2; diff --git a/scripts/node_scatter/node_scatter.gml b/scripts/node_scatter/node_scatter.gml index 2a2dfe3d4..204e56a9f 100644 --- a/scripts/node_scatter/node_scatter.gml +++ b/scripts/node_scatter/node_scatter.gml @@ -244,8 +244,8 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c posS++; } - var sw = surface_get_width(surf); - var sh = surface_get_height(surf); + var sw = surface_get_width_safe(surf); + var sh = surface_get_height_safe(surf); if(_dist != AREA_DISTRIBUTION.area || _scat != AREA_SCATTER.uniform) { var p = point_rotate(-sw / 2 * _scx, -sh * _scy / 2, 0, 0, _r); @@ -264,8 +264,8 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c draw_surface_ext_safe(surf, _x, _y, _scx, _scy, _r, clr, alp); if(_dist == 5) { - var _sw = surface_get_width(surf) * _scx; - var _sh = surface_get_height(surf) * _scy; + var _sw = surface_get_width_safe(surf) * _scx; + var _sh = surface_get_height_safe(surf) * _scy; if(_x < _sw) draw_surface_ext_safe(surf, _dim[0] + _x, _y, _scx, _scy, _r, clr, alp); diff --git a/scripts/node_sdf/node_sdf.gml b/scripts/node_sdf/node_sdf.gml index 2863a65d3..d07d4dc87 100644 --- a/scripts/node_sdf/node_sdf.gml +++ b/scripts/node_sdf/node_sdf.gml @@ -34,8 +34,8 @@ function Node_SDF(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) const var inSurf = _data[0]; var _side = _data[2]; var _dist = _data[3]; - var sw = surface_get_width(inSurf); - var sh = surface_get_height(inSurf); + var sw = surface_get_width_safe(inSurf); + var sh = surface_get_height_safe(inSurf); var _n = max(sw, sh); var cDep = attrDepth(); diff --git a/scripts/node_seperate_shapes/node_seperate_shapes.gml b/scripts/node_seperate_shapes/node_seperate_shapes.gml index d19bd39b9..d2748291f 100644 --- a/scripts/node_seperate_shapes/node_seperate_shapes.gml +++ b/scripts/node_seperate_shapes/node_seperate_shapes.gml @@ -67,8 +67,8 @@ function Node_Seperate_Shape(_x, _y, _group = noone) : Node(_x, _y, _group) cons if(!is_surface(_inSurf)) return; - var ww = surface_get_width(_inSurf); - var hh = surface_get_height(_inSurf); + var ww = surface_get_width_safe(_inSurf); + var hh = surface_get_height_safe(_inSurf); surface_w = ww; surface_h = hh; diff --git a/scripts/node_sequence_to_anim/node_sequence_to_anim.gml b/scripts/node_sequence_to_anim/node_sequence_to_anim.gml index 6f04c4624..6880a752a 100644 --- a/scripts/node_sequence_to_anim/node_sequence_to_anim.gml +++ b/scripts/node_sequence_to_anim/node_sequence_to_anim.gml @@ -58,8 +58,8 @@ function Node_Sequence_Anim(_x, _y, _group = noone) : Node(_x, _y, _group) const var xx = nn * i; - var _sw = surface_get_width(s); - var _sh = surface_get_height(s); + var _sw = surface_get_width_safe(s); + var _sh = surface_get_height_safe(s); var _ss = (nn - ui(4)) / max(_sw, _sh); var _sx = xx + nn / 2 - _sw * _ss / 2; var _sy = nn / 2 - _sh * _ss / 2; diff --git a/scripts/node_shadow/node_shadow.gml b/scripts/node_shadow/node_shadow.gml index f6dc8021c..2f099a545 100644 --- a/scripts/node_shadow/node_shadow.gml +++ b/scripts/node_shadow/node_shadow.gml @@ -47,8 +47,8 @@ function Node_Shadow(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co _surf = _surf[preview_index]; } - var ww = surface_get_width(_surf) * _s; - var hh = surface_get_height(_surf) * _s; + var ww = surface_get_width_safe(_surf) * _s; + var hh = surface_get_height_safe(_surf) * _s; inputs[| 3].drawOverlay(active, _x + ww / 2, _y + hh / 2, _s, _mx, _my, _snx, _sny); } @@ -60,13 +60,13 @@ function Node_Shadow(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co var _border = _data[4]; var _size = _data[5]; - var pass1 = surface_create_valid(surface_get_width(_outSurf), surface_get_height(_outSurf), attrDepth()); + var pass1 = surface_create_valid(surface_get_width_safe(_outSurf), surface_get_height_safe(_outSurf), attrDepth()); surface_set_target(pass1); DRAW_CLEAR BLEND_OVERRIDE; shader_set(shader); - shader_set_uniform_f_array_safe(uniform_dim, [ surface_get_width(_outSurf), surface_get_height(_outSurf) ]); + shader_set_uniform_f_array_safe(uniform_dim, [ surface_get_width_safe(_outSurf), surface_get_height_safe(_outSurf) ]); shader_set_uniform_f(uniform_size, _border); shader_set_uniform_f_array_safe(uniform_colr, [1., 1., 1., 1.0]); diff --git a/scripts/node_shadow_cast/node_shadow_cast.gml b/scripts/node_shadow_cast/node_shadow_cast.gml index 6f5829f3d..75d6a92d0 100644 --- a/scripts/node_shadow_cast/node_shadow_cast.gml +++ b/scripts/node_shadow_cast/node_shadow_cast.gml @@ -43,7 +43,7 @@ function Node_Shadow_Cast(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou if(!is_surface(_surf)) return [1, 1]; - return [surface_get_width(_surf), surface_get_height(_surf)]; + return [surface_get_width_safe(_surf), surface_get_height_safe(_surf)]; }, VALUE_UNIT.reference); inputs[| 3] = nodeValue("Soft light radius", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1) @@ -143,7 +143,7 @@ function Node_Shadow_Cast(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou BLEND_OVERRIDE; shader_set(shader); - shader_set_uniform_f(uniform_dim, surface_get_width(_bg), surface_get_height(_bg)); + shader_set_uniform_f(uniform_dim, surface_get_width_safe(_bg), surface_get_height_safe(_bg)); shader_set_uniform_f_array_safe(uniform_lpos, _pos); shader_set_uniform_f_array_safe(uniform_lamb, colToVec4(_lamb)); shader_set_uniform_f_array_safe(uniform_lclr, colToVec4(_lclr)); diff --git a/scripts/node_skew/node_skew.gml b/scripts/node_skew/node_skew.gml index f4ce6d874..151af0e47 100644 --- a/scripts/node_skew/node_skew.gml +++ b/scripts/node_skew/node_skew.gml @@ -39,8 +39,8 @@ function Node_Skew(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons static centerAnchor = function() { if(!is_surface(current_data[0])) return; - var ww = surface_get_width(current_data[0]); - var hh = surface_get_height(current_data[0]); + var ww = surface_get_width_safe(current_data[0]); + var hh = surface_get_height_safe(current_data[0]); inputs[| 4].setValue([ww / 2, hh / 2]); } diff --git a/scripts/node_solid/node_solid.gml b/scripts/node_solid/node_solid.gml index 1e46486a4..488bd8b2c 100644 --- a/scripts/node_solid/node_solid.gml +++ b/scripts/node_solid/node_solid.gml @@ -30,7 +30,7 @@ function Node_Solid(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con inputs[| 4].setVisible(is_surface(_msk)); if(is_surface(_msk) && _msd) - _dim = [ surface_get_width(_msk), surface_get_height(_msk) ]; + _dim = [ surface_get_width_safe(_msk), surface_get_height_safe(_msk) ]; _outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth()); diff --git a/scripts/node_sprite_stack/node_sprite_stack.gml b/scripts/node_sprite_stack/node_sprite_stack.gml index edbb16c0f..184baa358 100644 --- a/scripts/node_sprite_stack/node_sprite_stack.gml +++ b/scripts/node_sprite_stack/node_sprite_stack.gml @@ -86,8 +86,8 @@ function Node_Sprite_Stack(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro surface_set_target(_outSurf); DRAW_CLEAR if(is_surface(_in)) { - var _ww = surface_get_width(_in); - var _hh = surface_get_height(_in); + var _ww = surface_get_width_safe(_in); + var _hh = surface_get_height_safe(_in); var _po = point_rotate(0, 0, _ww / 2, _hh / 2, _rot); var aa = _alp; var aa_delta = (1 - aa) / _amo; @@ -117,8 +117,8 @@ function Node_Sprite_Stack(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro for(var i = 0; i < _amo; i++) { var index = clamp(i, 0, array_length(_in) - 1); if(is_surface(_in[index])) { - var _ww = surface_get_width(_in[index]); - var _hh = surface_get_width(_in[index]); + var _ww = surface_get_width_safe(_in[index]); + var _hh = surface_get_width_safe(_in[index]); var _po = point_rotate(0, 0, _ww / 2, _hh / 2, _rot); _po[0] += _pos[0]; _po[1] += _pos[1]; diff --git a/scripts/node_stack/node_stack.gml b/scripts/node_stack/node_stack.gml index 37011af74..a41b20945 100644 --- a/scripts/node_stack/node_stack.gml +++ b/scripts/node_stack/node_stack.gml @@ -73,8 +73,8 @@ function Node_Stack(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { for( var j = 0; j < array_length(_surf); j++ ) { if(!is_surface(_surf[j])) continue; - var sw = surface_get_width(_surf[j]); - var sh = surface_get_height(_surf[j]); + var sw = surface_get_width_safe(_surf[j]); + var sh = surface_get_height_safe(_surf[j]); if(_axis == 0) { ww += sw + (i > input_fix_len && j == array_length(_surf) - 1) * _spac; @@ -106,8 +106,8 @@ function Node_Stack(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { for( var j = 0; j < array_length(_surf); j++ ) { if(!is_surface(_surf[j])) continue; - var sw = surface_get_width(_surf[j]); - var sh = surface_get_height(_surf[j]); + var sw = surface_get_width_safe(_surf[j]); + var sh = surface_get_height_safe(_surf[j]); if(_axis == 0) { switch(_alig) { diff --git a/scripts/node_surface_data/node_surface_data.gml b/scripts/node_surface_data/node_surface_data.gml index f40dc7ec7..f91af133f 100644 --- a/scripts/node_surface_data/node_surface_data.gml +++ b/scripts/node_surface_data/node_surface_data.gml @@ -19,8 +19,8 @@ function Node_Surface_data(_x, _y, _group = noone) : Node(_x, _y, _group) constr var _dim = array_create(len); for( var i = 0; i < len; i++ ) { - _dim[i][0] = surface_get_width(_insurf[i]); - _dim[i][1] = surface_get_height(_insurf[i]); + _dim[i][0] = surface_get_width_safe(_insurf[i]); + _dim[i][1] = surface_get_height_safe(_insurf[i]); } outputs[| 0].setValue(_dim); @@ -30,6 +30,6 @@ function Node_Surface_data(_x, _y, _group = noone) : Node(_x, _y, _group) constr if(!_insurf || !surface_exists(_insurf)) return; - outputs[| 0].setValue([ surface_get_width(_insurf), surface_get_height(_insurf) ]); + outputs[| 0].setValue([ surface_get_width_safe(_insurf), surface_get_height_safe(_insurf) ]); } } \ No newline at end of file diff --git a/scripts/node_surface_replace/node_surface_replace.gml b/scripts/node_surface_replace/node_surface_replace.gml index 8cb4a86c0..4b33f4489 100644 --- a/scripts/node_surface_replace/node_surface_replace.gml +++ b/scripts/node_surface_replace/node_surface_replace.gml @@ -37,12 +37,12 @@ function Node_Surface_Replace(_x, _y, _group = noone) : Node_Processor(_x, _y, _ static matchTemplate = function(_index, _surf, _base, _target, _cthr, _pthr, _fst) { surface_set_shader(_surf, _fst? sh_surface_replace_fast_find : sh_surface_replace_find, false); - shader_set_f("dimension", surface_get_width(_base), surface_get_height(_base)); + shader_set_f("dimension", surface_get_width_safe(_base), surface_get_height_safe(_base)); shader_set_surface("target", _target); - shader_set_f("targetDimension", surface_get_width(_target), surface_get_height(_target)); + shader_set_f("targetDimension", surface_get_width_safe(_target), surface_get_height_safe(_target)); - //print($"{surface_get_width(_base)}, {surface_get_height(_base)} | {surface_get_width(_target)}, {surface_get_height(_target)}"); + //print($"{surface_get_width_safe(_base)}, {surface_get_height_safe(_base)} | {surface_get_width_safe(_target)}, {surface_get_height_safe(_target)}"); shader_set_f("colorThreshold", _cthr); shader_set_f("pixelThreshold", _pthr); @@ -62,9 +62,9 @@ function Node_Surface_Replace(_x, _y, _group = noone) : Node_Processor(_x, _y, _ static replaceTemplate = function(_index, _surf, _base, _res, _replace, _fst) { surface_set_shader(_surf, _fst? sh_surface_replace_fast_replace : sh_surface_replace_replace, false, BLEND.normal); - shader_set_f("dimension", surface_get_width(_base), surface_get_height(_base)); + shader_set_f("dimension", surface_get_width_safe(_base), surface_get_height_safe(_base)); shader_set_surface("replace", _replace); - shader_set_f("replace_dim", surface_get_width(_replace), surface_get_height(_replace)); + shader_set_f("replace_dim", surface_get_width_safe(_replace), surface_get_height_safe(_replace)); shader_set_surface("findRes", _res); shader_set_f("index", _index); @@ -90,7 +90,7 @@ function Node_Surface_Replace(_x, _y, _group = noone) : Node_Processor(_x, _y, _ if(!is_array(_tar)) _tar = [ _tar ]; if(!is_array(_rep)) _rep = [ _rep ]; - temp_surface[0] = surface_verify(temp_surface[0], surface_get_width(_bas), surface_get_height(_bas)); + temp_surface[0] = surface_verify(temp_surface[0], surface_get_width_safe(_bas), surface_get_height_safe(_bas)); surface_set_target(temp_surface[0]); DRAW_CLEAR; surface_reset_target(); @@ -100,7 +100,7 @@ function Node_Surface_Replace(_x, _y, _group = noone) : Node_Processor(_x, _y, _ matchTemplate(i / amo, temp_surface[0], _bas, _tar[i], _cthr, _pthr, _fst); //return temp_surface[0]; - _outSurf = surface_verify(_outSurf, surface_get_width(_bas), surface_get_height(_bas)); + _outSurf = surface_verify(_outSurf, surface_get_width_safe(_bas), surface_get_height_safe(_bas)); surface_set_target(_outSurf); DRAW_CLEAR; if(_drw) draw_surface_safe(_bas); diff --git a/scripts/node_time_remap/node_time_remap.gml b/scripts/node_time_remap/node_time_remap.gml index 132773fbd..25269b0c5 100644 --- a/scripts/node_time_remap/node_time_remap.gml +++ b/scripts/node_time_remap/node_time_remap.gml @@ -34,7 +34,7 @@ function Node_Time_Remap(_x, _y, _group = noone) : Node(_x, _y, _group) construc var _loop = inputs[| 3].getValue(); var _surf = outputs[| 0].getValue(); - _surf = surface_verify(_surf, surface_get_width(_inSurf), surface_get_height(_inSurf), attrDepth()); + _surf = surface_verify(_surf, surface_get_width_safe(_inSurf), surface_get_height_safe(_inSurf), attrDepth()); outputs[| 0].setValue(_surf); var ste = 1 / _life; diff --git a/scripts/node_trail/node_trail.gml b/scripts/node_trail/node_trail.gml index 515e05e10..0b19615ea 100644 --- a/scripts/node_trail/node_trail.gml +++ b/scripts/node_trail/node_trail.gml @@ -55,18 +55,18 @@ function Node_Trail(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { cacheCurrentFrame(_surf); for( var i = 0, n = array_length(temp_surface); i < n; i++ ) { - temp_surface[i] = surface_verify(temp_surface[i], surface_get_width(_surf), surface_get_height(_surf), cDep); + temp_surface[i] = surface_verify(temp_surface[i], surface_get_width_safe(_surf), surface_get_height_safe(_surf), cDep); surface_set_target(temp_surface[i]); DRAW_CLEAR surface_reset_target(); } var _outSurf = outputs[| 0].getValue(); - _outSurf = surface_verify(_outSurf, surface_get_width(_surf), surface_get_height(_surf), cDep); + _outSurf = surface_verify(_outSurf, surface_get_width_safe(_surf), surface_get_height_safe(_surf), cDep); outputs[| 0].setValue(_outSurf); var _outUV = outputs[| 1].getValue(); - _outUV = surface_verify(_outUV, surface_get_width(_surf), surface_get_height(_surf), cDep); + _outUV = surface_verify(_outUV, surface_get_width_safe(_surf), surface_get_height_safe(_surf), cDep); outputs[| 1].setValue(_outUV); var curf = PROJECT.animator.current_frame; @@ -102,7 +102,7 @@ function Node_Trail(_x, _y, _group = noone) : Node(_x, _y, _group) constructor { shader_set(sh_trail_filler_pass1); shader_set_dim("dimension", _surf); - shader_set_f("range", _rang? _rang : surface_get_width(_surf) / 2); + shader_set_f("range", _rang? _rang : surface_get_width_safe(_surf) / 2); shader_set_i("matchColor", _colr); shader_set_i("blendColor", _blend); shader_set_f("segmentStart", (frame_amo - i) / frame_amo); diff --git a/scripts/node_transform/node_transform.gml b/scripts/node_transform/node_transform.gml index 42caced6c..b6e761572 100644 --- a/scripts/node_transform/node_transform.gml +++ b/scripts/node_transform/node_transform.gml @@ -69,20 +69,20 @@ function Node_Transform(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) switch(_out_type) { case OUTPUT_SCALING.same_as_input : - ww = surface_get_width(_surf); - hh = surface_get_height(_surf); + ww = surface_get_width_safe(_surf); + hh = surface_get_height_safe(_surf); break; case OUTPUT_SCALING.relative : - ww = surface_get_width(_surf) * _out[0]; - hh = surface_get_height(_surf) * _out[1]; + ww = surface_get_width_safe(_surf) * _out[0]; + hh = surface_get_height_safe(_surf) * _out[1]; break; case OUTPUT_SCALING.constant : ww = _out[0]; hh = _out[1]; break; case OUTPUT_SCALING.scale : - ww = surface_get_width(_surf) * _scale[0]; - hh = surface_get_height(_surf) * _scale[1]; + ww = surface_get_width_safe(_surf) * _scale[0]; + hh = surface_get_height_safe(_surf) * _scale[1]; break; } @@ -106,7 +106,7 @@ function Node_Transform(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) } inputs[| 3].setValue([ 0.5, 0.5]); - inputs[| 2].setValue([ surface_get_width(_surf) / 2, surface_get_height(_surf) / 2 ]); + inputs[| 2].setValue([ surface_get_width_safe(_surf) / 2, surface_get_height_safe(_surf) / 2 ]); } static step = function() { @@ -145,8 +145,8 @@ function Node_Transform(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) var cDep = attrDepth(); - var ww = surface_get_width(ins); - var hh = surface_get_height(ins); + var ww = surface_get_width_safe(ins); + var hh = surface_get_height_safe(ins); var _ww = ww, _hh = hh; if(_ww <= 1 && _hh <= 1) return _outSurf; @@ -281,11 +281,11 @@ function Node_Transform(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) var rot = current_data[5]; var sca = current_data[6]; - var srw = surface_get_width(_surf); - var srh = surface_get_height(_surf); + var srw = surface_get_width_safe(_surf); + var srh = surface_get_height_safe(_surf); - var ow = surface_get_width(_surf_out); - var oh = surface_get_height(_surf_out); + var ow = surface_get_width_safe(_surf_out); + var oh = surface_get_height_safe(_surf_out); var ww = srw * sca[0]; var hh = srh * sca[1]; diff --git a/scripts/node_transform_single/node_transform_single.gml b/scripts/node_transform_single/node_transform_single.gml index 9e56b9dd7..31e6c810f 100644 --- a/scripts/node_transform_single/node_transform_single.gml +++ b/scripts/node_transform_single/node_transform_single.gml @@ -63,8 +63,8 @@ function Node_Transform_Single(_x, _y, _group = noone) : Node_Processor(_x, _y, var rot = current_data[5]; var sca_x = current_data[6]; var sca_y = current_data[7]; - var ww = surface_get_width(_surf) * sca_x; - var hh = surface_get_height(_surf) * sca_y; + var ww = surface_get_width_safe(_surf) * sca_x; + var hh = surface_get_height_safe(_surf) * sca_y; var psc_x = anc_x * sca_x; var psc_y = anc_y * sca_y; diff --git a/scripts/node_twirl/node_twirl.gml b/scripts/node_twirl/node_twirl.gml index 4823070ce..29c9e839e 100644 --- a/scripts/node_twirl/node_twirl.gml +++ b/scripts/node_twirl/node_twirl.gml @@ -58,7 +58,7 @@ function Node_Twirl(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con surface_set_shader(_outSurf, shader); shader_set_interpolation(_data[0]); - shader_set_uniform_f_array_safe(uniform_dim, [ surface_get_width(_data[0]), surface_get_height(_data[0]) ]); + shader_set_uniform_f_array_safe(uniform_dim, [ surface_get_width_safe(_data[0]), surface_get_height_safe(_data[0]) ]); shader_set_uniform_f_array_safe(uniform_cen, center); shader_set_uniform_f(uniform_str, stren); shader_set_uniform_f(uniform_rad, rad); diff --git a/scripts/node_value/node_value.gml b/scripts/node_value/node_value.gml index e3f30efa2..8335198c4 100644 --- a/scripts/node_value/node_value.gml +++ b/scripts/node_value/node_value.gml @@ -52,6 +52,8 @@ enum VALUE_TYPE { d3Scene = 29, d3Material = 30, + dynaSurf = 31, + action = 99, } @@ -158,6 +160,7 @@ function value_color(i) { #region $ffa64d, //d3Camera $ffa64d, //d3Scene $976bff, //d3Material + $976bff, //dynaSurf ]; if(i == 99) return $5dde8f; @@ -171,6 +174,7 @@ function value_bit(i) { #region case VALUE_TYPE.boolean : return 1 << 3 | 1 << 1; case VALUE_TYPE.color : return 1 << 4; case VALUE_TYPE.gradient : return 1 << 25; + case VALUE_TYPE.dynaSurf : case VALUE_TYPE.surface : return 1 << 5; case VALUE_TYPE.path : return 1 << 10; case VALUE_TYPE.text : return 1 << 10; @@ -1264,7 +1268,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru for( var i = 0, n = array_length(val); i < n; i++ ) { if(!is_surface(val[i])) continue; - var surfSz = [ surface_get_width(val[i]), surface_get_height(val[i]) ]; + var surfSz = [ surface_get_width_safe(val[i]), surface_get_height_safe(val[i]) ]; array_push(sArr, surfSz); if(i && !array_equals(surfSz, _osZ)) @@ -1276,7 +1280,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru if(eqSize) return _osZ; return sArr; } else if (is_surface(val)) - return [ surface_get_width(val), surface_get_height(val) ]; + return [ surface_get_width_safe(val), surface_get_height_safe(val) ]; return [1, 1]; } diff --git a/scripts/node_wav_file_read/node_wav_file_read.gml b/scripts/node_wav_file_read/node_wav_file_read.gml index 56165ff5d..17ace530e 100644 --- a/scripts/node_wav_file_read/node_wav_file_read.gml +++ b/scripts/node_wav_file_read/node_wav_file_read.gml @@ -269,8 +269,8 @@ function Node_WAV_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const draw_arc(cx, cy, rr, 90, 90 - 360 * wav_file_prg / content.packet, 4 * _s, 180); return; } else if(is_surface(audio_surface)) { - var sw = surface_get_width(audio_surface); - var sh = surface_get_height(audio_surface); + var sw = surface_get_width_safe(audio_surface); + var sh = surface_get_height_safe(audio_surface); var ss = min(bbox.w / sw, bbox.h / sh); draw_surface_ext_safe(audio_surface, diff --git a/scripts/node_wrap/node_wrap.gml b/scripts/node_wrap/node_wrap.gml index b628fc450..50884de0b 100644 --- a/scripts/node_wrap/node_wrap.gml +++ b/scripts/node_wrap/node_wrap.gml @@ -44,8 +44,8 @@ function Node_Warp(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons var _surf = inputs[| 0].getValue(); if(!is_surface(_surf)) return; - var _sw = surface_get_width(_surf); - var _sh = surface_get_height(_surf); + var _sw = surface_get_width_safe(_surf); + var _sh = surface_get_height_safe(_surf); inputs[| 1].setValue([ 0, 0 ]); inputs[| 2].setValue([ _sw, 0 ]); @@ -198,8 +198,8 @@ function Node_Warp(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons var bl = _data[3]; var br = _data[4]; - var sw = surface_get_width(_data[0]); - var sh = surface_get_height(_data[0]); + var sw = surface_get_width_safe(_data[0]); + var sh = surface_get_height_safe(_data[0]); var teq = round(tl[1]) == round(tr[1]); var beq = round(bl[1]) == round(br[1]); diff --git a/scripts/node_wrap_area/node_wrap_area.gml b/scripts/node_wrap_area/node_wrap_area.gml index 67b6383e3..88b02b9be 100644 --- a/scripts/node_wrap_area/node_wrap_area.gml +++ b/scripts/node_wrap_area/node_wrap_area.gml @@ -26,8 +26,8 @@ function Node_Wrap_Area(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) var _surf = inputs[| 0].getValue(); if(!is_surface(_surf)) return; - var _sw = surface_get_width(_surf); - var _sh = surface_get_height(_surf); + var _sw = surface_get_width_safe(_surf); + var _sh = surface_get_height_safe(_surf); inputs[| 1].setValue([ _sw / 2, _sh / 2, _sw / 2, _sh / 2, AREA_SHAPE.rectangle ]); attributes[? "initalset"] = true; @@ -51,8 +51,8 @@ function Node_Wrap_Area(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) var cw = _area[2]; var ch = _area[3]; - var ww = cw / surface_get_width(_inSurf) * 2; - var hh = ch / surface_get_height(_inSurf) * 2; + var ww = cw / surface_get_width_safe(_inSurf) * 2; + var hh = ch / surface_get_height_safe(_inSurf) * 2; surface_set_shader(_outSurf); shader_set_interpolation(_inSurf); diff --git a/scripts/node_wrap_mesh/node_wrap_mesh.gml b/scripts/node_wrap_mesh/node_wrap_mesh.gml index f7bd9d5f1..313514ed9 100644 --- a/scripts/node_wrap_mesh/node_wrap_mesh.gml +++ b/scripts/node_wrap_mesh/node_wrap_mesh.gml @@ -374,9 +374,9 @@ function Node_Mesh_Warp(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) } static initSurface = function(surf) { - p0.mapTexture(surface_get_width(surf), surface_get_height(surf)); - p1.mapTexture(surface_get_width(surf), surface_get_height(surf)); - p2.mapTexture(surface_get_width(surf), surface_get_height(surf)); + p0.mapTexture(surface_get_width_safe(surf), surface_get_height_safe(surf)); + p1.mapTexture(surface_get_width_safe(surf), surface_get_height_safe(surf)); + p2.mapTexture(surface_get_width_safe(surf), surface_get_height_safe(surf)); } static drawSurface = function(surf) { @@ -411,8 +411,8 @@ function Node_Mesh_Warp(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) if(!inputs[| 0].value_from) return; var useArray = is_array(surf); - var ww = useArray? surface_get_width(surf[0]) : surface_get_width(surf); - var hh = useArray? surface_get_height(surf[0]) : surface_get_height(surf); + var ww = useArray? surface_get_width_safe(surf[0]) : surface_get_width_safe(surf); + var hh = useArray? surface_get_height_safe(surf[0]) : surface_get_height_safe(surf); var fullmh = inputs[| 7].getValue(); if(is_array(fullmh)) fullmh = false; @@ -512,8 +512,8 @@ function Node_Mesh_Warp(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) if(!inputs[| 0].value_from) return; var useArray = is_array(surf); - var ww = useArray? surface_get_width(surf[0]) : surface_get_width(surf); - var hh = useArray? surface_get_height(surf[0]) : surface_get_height(surf); + var ww = useArray? surface_get_width_safe(surf[0]) : surface_get_width_safe(surf); + var hh = useArray? surface_get_height_safe(surf[0]) : surface_get_height_safe(surf); data.points = []; data.tris = []; @@ -681,7 +681,7 @@ function Node_Mesh_Warp(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) reset(); control(); - _outSurf = surface_verify(_outSurf, surface_get_width(_inSurf), surface_get_height(_inSurf), attrDepth()); + _outSurf = surface_verify(_outSurf, surface_get_width_safe(_inSurf), surface_get_height_safe(_inSurf), attrDepth()); surface_set_shader(_outSurf); shader_set_interpolation(_outSurf); diff --git a/scripts/node_wrap_perspective/node_wrap_perspective.gml b/scripts/node_wrap_perspective/node_wrap_perspective.gml index 7bc0d6623..325172df6 100644 --- a/scripts/node_wrap_perspective/node_wrap_perspective.gml +++ b/scripts/node_wrap_perspective/node_wrap_perspective.gml @@ -203,8 +203,8 @@ function Node_Warp_Perspective(_x, _y, _group = noone) : Node_Processor(_x, _y, var Tbl = _data[8]; var Tbr = _data[9]; - var sw = surface_get_width(_data[0]); - var sh = surface_get_height(_data[0]); + var sw = surface_get_width_safe(_data[0]); + var sh = surface_get_height_safe(_data[0]); surface_set_shader(_outSurf, sh_warp_4points_pers); shader_set_interpolation(_data[0]); diff --git a/scripts/panel_array_sequence/panel_array_sequence.gml b/scripts/panel_array_sequence/panel_array_sequence.gml index 8be0d69d5..20daf7888 100644 --- a/scripts/panel_array_sequence/panel_array_sequence.gml +++ b/scripts/panel_array_sequence/panel_array_sequence.gml @@ -42,8 +42,8 @@ function Panel_Array_Sequence(node) : PanelContent() constructor { var _sx = content_x + i * (_ns + ui(8)); var _sy = 0; - var _sw = surface_get_width(_s); - var _sh = surface_get_height(_s); + var _sw = surface_get_width_safe(_s); + var _sh = surface_get_height_safe(_s); var _ss = (_ns - ui(8)) / max(_sw, _sh); var _ssx = _sx + (_ns - _sw * _ss) / 2; var _ssy = _sy + (_ns - _sh * _ss) / 2; @@ -124,8 +124,8 @@ function Panel_Array_Sequence(node) : PanelContent() constructor { var _sx = sequence_x + i * _ns; var _sy = ui(24); - var _sw = surface_get_width(_s); - var _sh = surface_get_height(_s); + var _sw = surface_get_width_safe(_s); + var _sh = surface_get_height_safe(_s); var _ss = min(_ns / _sw, _ns / _sh); var _ssx = _sx + (_ns - _sw * _ss) / 2; var _ssy = _sy + (_ns - _sh * _ss) / 2; @@ -146,8 +146,8 @@ function Panel_Array_Sequence(node) : PanelContent() constructor { var frm = round((msx - sequence_x - _ns / 2) / _ns); var _sx = sequence_x + frm * _ns; var _sy = ui(24); - var _sw = surface_get_width(_s); - var _sh = surface_get_height(_s); + var _sw = surface_get_width_safe(_s); + var _sh = surface_get_height_safe(_s); var _ss = min(_ns / _sw, _ns / _sh); var _ssx = _sx + (_ns - _sw * _ss) / 2; var _ssy = _sy + (_ns - _sh * _ss) / 2; @@ -186,8 +186,8 @@ function Panel_Array_Sequence(node) : PanelContent() constructor { if(draw_drag) { var _s = _seq[content_drag]; var _ns = content_h; - var _sw = surface_get_width(_s); - var _sh = surface_get_height(_s); + var _sw = surface_get_width_safe(_s); + var _sh = surface_get_height_safe(_s); var _ss = (_ns - ui(8)) / max(_sw, _sh); draw_surface_ext_safe(_s, mx, my, _ss, _ss,,, 0.5); diff --git a/scripts/panel_graph/panel_graph.gml b/scripts/panel_graph/panel_graph.gml index f876053d6..ee96cc9bf 100644 --- a/scripts/panel_graph/panel_graph.gml +++ b/scripts/panel_graph/panel_graph.gml @@ -315,7 +315,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { var _canvas = nodeBuild("Node_Canvas", _node.x + _node.w + 64, _node.y); - _canvas.inputs[| 0].setValue([surface_get_width(surf), surface_get_height(surf)]); + _canvas.inputs[| 0].setValue([surface_get_width_safe(surf), surface_get_height_safe(surf)]); _canvas.canvas_surface = surface_clone(surf); _canvas.apply_surface(); } #endregion @@ -364,7 +364,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { var _canvas = nodeBuild("Node_Canvas", _node.x, _node.y + _node.h + 64); - _canvas.inputs[| 0].setValue([surface_get_width(surf), surface_get_height(surf)]); + _canvas.inputs[| 0].setValue([surface_get_width_safe(surf), surface_get_height_safe(surf)]); _canvas.inputs[| 5].setValue(true); var _blend = new Node_Blend(_node.x + _node.w + 64, _node.y, getCurrentContext()); @@ -902,7 +902,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { surface_reset_target(); shader_set(sh_downsample); shader_set_f("down", aa); - shader_set_f("dimension", surface_get_width(connection_surface), surface_get_height(connection_surface)); + shader_set_f("dimension", surface_get_width_safe(connection_surface), surface_get_height_safe(connection_surface)); draw_surface(connection_surface, 0, 0); shader_reset(); @@ -1320,7 +1320,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { var hover = mini_hover && !point_in_rectangle(mx, my, mx0, my0, mx0 + ui(16), my0 + ui(16)) && !minimap_dragging; - if(!is_surface(minimap_surface) || surface_get_width(minimap_surface) != minimap_w || surface_get_height(minimap_surface) != minimap_h) { + if(!is_surface(minimap_surface) || surface_get_width_safe(minimap_surface) != minimap_w || surface_get_height_safe(minimap_surface) != minimap_h) { minimap_surface = surface_create_valid(minimap_w, minimap_h); } diff --git a/scripts/panel_graph_export_image/panel_graph_export_image.gml b/scripts/panel_graph_export_image/panel_graph_export_image.gml index 7313e444a..c5b17f9d4 100644 --- a/scripts/panel_graph_export_image/panel_graph_export_image.gml +++ b/scripts/panel_graph_export_image/panel_graph_export_image.gml @@ -108,7 +108,7 @@ function graph_export_image(allList, nodeList, settings = {}) { shader_set(sh_downsample); shader_set_f("down", aa); - shader_set_f("dimension", surface_get_width(cs), surface_get_height(cs)); + shader_set_f("dimension", surface_get_width_safe(cs), surface_get_height_safe(cs)); draw_surface(cs, 0, 0); shader_reset(); surface_free(cs); diff --git a/scripts/panel_graph_export_image_dialog/panel_graph_export_image_dialog.gml b/scripts/panel_graph_export_image_dialog/panel_graph_export_image_dialog.gml index 1c472b155..26b248729 100644 --- a/scripts/panel_graph_export_image_dialog/panel_graph_export_image_dialog.gml +++ b/scripts/panel_graph_export_image_dialog/panel_graph_export_image_dialog.gml @@ -112,14 +112,14 @@ function Panel_Graph_Export_Image(targetPanel) : PanelContent() constructor { var sh = 160; if(is_surface(surface)) { - var _sw = surface_get_width(surface); - var _sh = surface_get_height(surface); + var _sw = surface_get_width_safe(surface); + var _sh = surface_get_height_safe(surface); var ss = min((w - padding * 2) / _sw, sh / _sh); draw_surface_ext(surface, w / 2 - _sw * ss / 2, ty + sh / 2 - _sh * ss / 2, ss, ss, 0, c_white, 1); draw_set_text(f_p2, fa_center, fa_bottom, COLORS._main_text_sub); - draw_text_add(w / 2, ty + sh - ui(2), $"{surface_get_width(surface)} x {surface_get_height(surface)} px"); + draw_text_add(w / 2, ty + sh - ui(2), $"{surface_get_width_safe(surface)} x {surface_get_height_safe(surface)} px"); } draw_set_color(COLORS._main_icon); diff --git a/scripts/panel_preview/panel_preview.gml b/scripts/panel_preview/panel_preview.gml index 473e7a44a..1b288f388 100644 --- a/scripts/panel_preview/panel_preview.gml +++ b/scripts/panel_preview/panel_preview.gml @@ -326,8 +326,8 @@ function Panel_Preview() : PanelContent() constructor { var prevS = getNodePreviewSurface(); if(is_surface(prevS)) { - canvas_w = surface_get_width(prevS); - canvas_h = surface_get_height(prevS); + canvas_w = surface_get_width_safe(prevS); + canvas_h = surface_get_height_safe(prevS); } } #endregion @@ -603,8 +603,8 @@ function Panel_Preview() : PanelContent() constructor { psx = canvas_x + preview_node[0].preview_x * ss; psy = canvas_y + preview_node[0].preview_y * ss; - psw = surface_get_width(preview_surface[0]); - psh = surface_get_height(preview_surface[0]); + psw = surface_get_width_safe(preview_surface[0]); + psh = surface_get_height_safe(preview_surface[0]); pswd = psw * ss; pshd = psh * ss; @@ -616,8 +616,8 @@ function Panel_Preview() : PanelContent() constructor { var ssx = canvas_x + preview_node[1].preview_x * ss; var ssy = canvas_y + preview_node[1].preview_y * ss; - var ssw = surface_get_width(preview_surface[1]); - var ssh = surface_get_height(preview_surface[1]); + var ssw = surface_get_width_safe(preview_surface[1]); + var ssh = surface_get_height_safe(preview_surface[1]); } var _node = getNodePreview(); @@ -642,7 +642,7 @@ function Panel_Preview() : PanelContent() constructor { switch(tileMode) { case 1 : - tile_surface = surface_verify(tile_surface, w, surface_get_height(preview_surface[0]) * ss); + tile_surface = surface_verify(tile_surface, w, surface_get_height_safe(preview_surface[0]) * ss); surface_set_target(tile_surface); DRAW_CLEAR draw_surface_tiled_ext_safe(preview_surface[0], psx, 0, ss, ss, c_white, 1); @@ -650,7 +650,7 @@ function Panel_Preview() : PanelContent() constructor { draw_surface_safe(tile_surface, 0, psy); break; case 2 : - tile_surface = surface_verify(tile_surface, surface_get_width(preview_surface[0]) * ss, h); + tile_surface = surface_verify(tile_surface, surface_get_width_safe(preview_surface[0]) * ss, h); surface_set_target(tile_surface); DRAW_CLEAR draw_surface_tiled_ext_safe(preview_surface[0], 0, psy, ss, ss, c_white, 1); @@ -1024,8 +1024,8 @@ function Panel_Preview() : PanelContent() constructor { prev = prev.surface; if(!is_surface(prev)) continue; - var prev_w = surface_get_width(prev); - var prev_h = surface_get_height(prev); + var prev_w = surface_get_width_safe(prev); + var prev_h = surface_get_height_safe(prev); var ss = prev_size / max(prev_w, prev_h); var prev_sw = prev_w * ss; @@ -1460,8 +1460,8 @@ function Panel_Preview() : PanelContent() constructor { var prevS = getNodePreviewSurface(); if(!is_surface(prevS)) return; - var buff = buffer_create(surface_get_width(prevS) * surface_get_height(prevS) * 4, buffer_fixed, 1); - var s = surface_create(surface_get_width(prevS), surface_get_height(prevS)); + var buff = buffer_create(surface_get_width_safe(prevS) * surface_get_height_safe(prevS) * 4, buffer_fixed, 1); + var s = surface_create(surface_get_width_safe(prevS), surface_get_height_safe(prevS)); surface_set_target(s); shader_set(sh_BGR); @@ -1472,7 +1472,7 @@ function Panel_Preview() : PanelContent() constructor { buffer_get_surface(buff, s, 0); surface_free(s); - clipboard_set_bitmap(buffer_get_address(buff), surface_get_width(prevS), surface_get_height(prevS)); + clipboard_set_bitmap(buffer_get_address(buff), surface_get_width_safe(prevS), surface_get_height_safe(prevS)); } #endregion function saveCurrentFrame() { #region diff --git a/scripts/panel_preview_window/panel_preview_window.gml b/scripts/panel_preview_window/panel_preview_window.gml index 8e53b417d..cc0ad6b64 100644 --- a/scripts/panel_preview_window/panel_preview_window.gml +++ b/scripts/panel_preview_window/panel_preview_window.gml @@ -78,8 +78,8 @@ function Panel_Preview_Window() : PanelContent() constructor { for( var i = 0, n = array_length(surf); i < n; i++ ) { var s = surf[i]; - var sw = surface_get_width(s); - var sh = surface_get_height(s); + var sw = surface_get_width_safe(s); + var sh = surface_get_height_safe(s); if(scale == 0) scale = min(w / sw, h / sh); var sx = dx + w / 2 - (sw * scale) / 2 + panx; diff --git a/scripts/shader_functions/shader_functions.gml b/scripts/shader_functions/shader_functions.gml index 7cddc1a75..084c4f78a 100644 --- a/scripts/shader_functions/shader_functions.gml +++ b/scripts/shader_functions/shader_functions.gml @@ -95,7 +95,7 @@ function shader_set_surface_dimension(uniform, surface) { function shader_set_dim(uniform = "dimension", surf = noone) { if(!is_surface(surf)) return; - shader_set_f(uniform, surface_get_width(surf), surface_get_height(surf)); + shader_set_f(uniform, surface_get_width_safe(surf), surface_get_height_safe(surf)); } function shader_set_color(uniform, col, alpha = 1) { @@ -127,7 +127,7 @@ function shader_set_palette(pal, pal_uni = "palette", amo_uni = "paletteAmount", gpu_set_tex_filter(intp); shader_set_i("interpolation", intp); - shader_set_f("sampleDimension", surface_get_width(surface), surface_get_height(surface)); + shader_set_f("sampleDimension", surface_get_width_safe(surface), surface_get_height_safe(surface)); shader_set_i("sampleMode", struct_try_get(attributes, "oversample")); } diff --git a/scripts/steam_ugc_project/steam_ugc_project.gml b/scripts/steam_ugc_project/steam_ugc_project.gml index 066024001..4626508a0 100644 --- a/scripts/steam_ugc_project/steam_ugc_project.gml +++ b/scripts/steam_ugc_project/steam_ugc_project.gml @@ -65,9 +65,9 @@ function steam_ugc_project_generate(dest_path = DIRECTORY + "steamUGCthumbnail.p draw_sprite_stretched(s_workshop_frame, 0, 0, 0, prev_size, prev_size); if(is_surface(preview_surface)) { - var ss = (prev_size - 160) / max(surface_get_width(preview_surface), surface_get_height(preview_surface)); - var ox = surface_get_width(preview_surface) / 2 * ss; - var oy = surface_get_height(preview_surface) / 2 * ss; + var ss = (prev_size - 160) / max(surface_get_width_safe(preview_surface), surface_get_height_safe(preview_surface)); + var ox = surface_get_width_safe(preview_surface) / 2 * ss; + var oy = surface_get_height_safe(preview_surface) / 2 * ss; draw_surface_ext(preview_surface, prev_size / 2 - ox, prev_size / 2 - oy, ss, ss, 0, c_white, 1); } diff --git a/scripts/surfaceBox/surfaceBox.gml b/scripts/surfaceBox/surfaceBox.gml index 463f80dd9..9258c5bb5 100644 --- a/scripts/surfaceBox/surfaceBox.gml +++ b/scripts/surfaceBox/surfaceBox.gml @@ -61,8 +61,8 @@ function surfaceBox(_onModify, def_path = "") : widget() constructor { _surface = _surface[safe_mod(round(current_time / 250), array_length(_surface))]; if(is_surface(_surface)) { - var sfw = surface_get_width(_surface); - var sfh = surface_get_height(_surface); + var sfw = surface_get_width_safe(_surface); + var sfh = surface_get_height_safe(_surface); var ss = min(sw / sfw, sh / sfh); var _sx = sx0 + sw / 2 - ss * sfw / 2; var _sy = sy0 + sh / 2 - ss * sfh / 2; diff --git a/scripts/surface_functions/surface_functions.gml b/scripts/surface_functions/surface_functions.gml index c17c6cd88..8a8668be8 100644 --- a/scripts/surface_functions/surface_functions.gml +++ b/scripts/surface_functions/surface_functions.gml @@ -2,7 +2,7 @@ function draw_surface_safe(surface, _x = 0, _y = 0) { gml_pragma("forceinline"); - if(is_struct(surface) && is_instanceof(surface, dynaSurf)) { + if(is_struct(surface) && is_instanceof(surface, DynaSurf)) { surface.draw(_x, _y); return; } @@ -16,7 +16,7 @@ function draw_surface_safe(surface, _x = 0, _y = 0) { function draw_surface_stretched_safe(surface, _x, _y, _w, _h) { gml_pragma("forceinline"); - if(is_struct(surface) && is_instanceof(surface, dynaSurf)) { + if(is_struct(surface) && is_instanceof(surface, DynaSurf)) { surface.drawStretch(_x, _y, _w, _h); return; } @@ -30,7 +30,7 @@ function draw_surface_stretched_safe(surface, _x, _y, _w, _h) { function draw_surface_ext_safe(surface, _x, _y, _xs = 1, _ys = 1, _rot = 0, _col = c_white, _alpha = 1) { gml_pragma("forceinline"); - if(is_struct(surface) && is_instanceof(surface, dynaSurf)) { + if(is_struct(surface) && is_instanceof(surface, DynaSurf)) { surface.draw(_x, _y, _xs, _ys, _rot, _col, _alpha); return; } @@ -44,7 +44,7 @@ function draw_surface_ext_safe(surface, _x, _y, _xs = 1, _ys = 1, _rot = 0, _col function draw_surface_tiled_safe(surface, _x, _y) { gml_pragma("forceinline"); - if(is_struct(surface) && is_instanceof(surface, dynaSurf)) { + if(is_struct(surface) && is_instanceof(surface, DynaSurf)) { surface.drawTile(_x, _y); return; } @@ -58,7 +58,7 @@ function draw_surface_tiled_safe(surface, _x, _y) { function draw_surface_tiled_ext_safe(surface, _x, _y, _xs = 1, _ys = 1, _col = c_white, _alpha = 1) { gml_pragma("forceinline"); - if(is_struct(surface) && is_instanceof(surface, dynaSurf)) { + if(is_struct(surface) && is_instanceof(surface, DynaSurf)) { surface.drawTile(_x, _y, _xs, _ys, _col, _alpha); return; } @@ -72,7 +72,7 @@ function draw_surface_tiled_ext_safe(surface, _x, _y, _xs = 1, _ys = 1, _col = c function draw_surface_part_ext_safe(surface, _l, _t, _w, _h, _x, _y, _xs = 1, _ys = 1, _rot = 0, _col = c_white, _alpha = 1) { gml_pragma("forceinline"); - if(is_struct(surface) && is_instanceof(surface, dynaSurf)) { + if(is_struct(surface) && is_instanceof(surface, DynaSurf)) { surface.drawPart(_l, _t, _w, _h, _x, _y, _xs, _ys, _rot, _col, _alpha); return; } @@ -102,8 +102,8 @@ function surface_save_safe(surface, path) { return; } - var w = surface_get_width(surface); - var h = surface_get_height(surface); + var w = surface_get_width_safe(surface); + var h = surface_get_height_safe(surface); var s = surface_create(w, h, surface_rgba8unorm); switch(f) { @@ -138,18 +138,31 @@ function surface_save_safe(surface, path) { return; } +function surface_get_width_safe(s) { + gml_pragma("forceinline"); + + return (is_struct(s) && is_instanceof(s, DynaSurf)))? s.getWidth() : surface_get_width(s); +} + +function surface_get_height_safe(s) { + gml_pragma("forceinline"); + + return (is_struct(s) && is_instanceof(s, DynaSurf)))? s.getHeight() : surface_get_height(s); +} + //check function is_surface(s) { gml_pragma("forceinline"); if(is_undefined(s)) return false; if(is_array(s)) return false; + if(is_struct(s) && is_instanceof(s, DynaSurf)) return true; if(!is_real(s)) return false; if(!s) return false; if(!surface_exists(s)) return false; - if(surface_get_width(s) <= 0) return false; - if(surface_get_height(s) <= 0) return false; + if(surface_get_width_safe(s) <= 0) return false; + if(surface_get_height_safe(s) <= 0) return false; return true; } @@ -198,7 +211,7 @@ function surface_create_empty(w, h, format = surface_rgba8unorm) { function surface_create_size(surface, format = surface_rgba8unorm) { gml_pragma("forceinline"); - return surface_create_valid(surface_get_width(surface), surface_get_height(surface), format); + return surface_create_valid(surface_get_width_safe(surface), surface_get_height_safe(surface), format); } function surface_create_valid(w, h, format = surface_rgba8unorm) { @@ -267,8 +280,8 @@ function surface_create_from_sprite_ext(spr, ind, format = surface_rgba8unorm) { } function surface_size_lim(surface, width, height) { - var sw = surface_get_width(surface); - var sh = surface_get_height(surface); + var sw = surface_get_width_safe(surface); + var sh = surface_get_height_safe(surface); if(sw <= width && sh <= height) return surface; var ss = min(width / sw, height / sh); @@ -292,8 +305,8 @@ function surface_size_to(surface, width, height, format = noone, skipCheck = fal width = surface_valid_size(width); height = surface_valid_size(height); - var ww = surface_get_width(surface); - var hh = surface_get_height(surface); + var ww = surface_get_width_safe(surface); + var hh = surface_get_height_safe(surface); if(ww == width && hh == height) return surface; //print($"Reset surface {ww}, {width} | {hh}, {height}"); @@ -329,7 +342,7 @@ function surface_clone(surface, source = noone, format = noone) { if(!is_surface(surface)) return noone; - source = surface_verify(source, surface_get_width(surface), surface_get_height(surface), format == noone? surface_get_format(surface) : format); + source = surface_verify(source, surface_get_width_safe(surface), surface_get_height_safe(surface), format == noone? surface_get_format(surface) : format); surface_set_target(source); DRAW_CLEAR @@ -369,8 +382,8 @@ function surface_mirror(surf, _h, _v) { surface_set_target(_surf); DRAW_CLEAR - var x0 = _h * surface_get_width(_surf); - var y0 = _v * surface_get_height(_surf); + var x0 = _h * surface_get_width_safe(_surf); + var y0 = _v * surface_get_height_safe(_surf); draw_surface_ext(surf, x0, y0, _h * 2 - 1, _v * 2 - 1, 0, c_white, 1); surface_reset_target(); @@ -386,7 +399,7 @@ function surface_copy_size(dest, source, format = noone) { if(!is_surface(dest)) return; if(!is_surface(source)) return; - surface_size_to(dest, surface_get_width(source), surface_get_height(source), format); + surface_size_to(dest, surface_get_width_safe(source), surface_get_height_safe(source), format); surface_set_target(dest); DRAW_CLEAR surface_reset_target(); @@ -441,12 +454,12 @@ function surface_array_serialize(arr) { function __surface_array_serialize(arr) { if(!is_array(arr)) { if(is_surface(arr)) { - var buff = buffer_create(surface_get_width(arr) * surface_get_height(arr) * 4, buffer_fixed, 1); + var buff = buffer_create(surface_get_width_safe(arr) * surface_get_height_safe(arr) * 4, buffer_fixed, 1); buffer_get_surface(buff, arr, 0); var comp = buffer_compress(buff, 0, buffer_get_size(buff)); var enc = buffer_base64_encode(comp, 0, buffer_get_size(comp)); buffer_delete(buff); - return { width: surface_get_width(arr), height: surface_get_height(arr), buffer: enc }; + return { width: surface_get_width_safe(arr), height: surface_get_height_safe(arr), buffer: enc }; } else return arr; } @@ -487,12 +500,12 @@ function __surface_array_deserialize(arr) { function surface_encode(surface) { if(!is_surface(surface)) return ""; - var buff = buffer_create(surface_get_width(surface) * surface_get_height(surface) * 4, buffer_fixed, 1); + var buff = buffer_create(surface_get_width_safe(surface) * surface_get_height_safe(surface) * 4, buffer_fixed, 1); buffer_get_surface(buff, surface, 0); var comp = buffer_compress(buff, 0, buffer_get_size(buff)); var enc = buffer_base64_encode(comp, 0, buffer_get_size(comp)); buffer_delete(buff); - var str = { width: surface_get_width(surface), height: surface_get_height(surface), buffer: enc }; + var str = { width: surface_get_width_safe(surface), height: surface_get_height_safe(surface), buffer: enc }; return json_stringify(str); } @@ -519,8 +532,8 @@ function surface_format_get_bytes(format) { function surface_get_size(surface) { gml_pragma("forceinline"); - var sw = surface_get_width(surface); - var sh = surface_get_height(surface); + var sw = surface_get_width_safe(surface); + var sh = surface_get_height_safe(surface); var sz = sw * sh * surface_format_get_bytes(surface_get_format(surface)); return sz; }