diff --git a/PixelComposer.resource_order b/PixelComposer.resource_order index 0227a3942..c23f55b91 100644 --- a/PixelComposer.resource_order +++ b/PixelComposer.resource_order @@ -67,6 +67,7 @@ {"name":"shader","order":16,"path":"folders/functions/shader.yy",}, {"name":"string","order":5,"path":"folders/functions/string.yy",}, {"name":"surface","order":9,"path":"folders/functions/surface.yy",}, + {"name":"dynamic surface","order":10,"path":"folders/functions/surface/dynamic surface.yy",}, {"name":"test","order":23,"path":"folders/functions/test.yy",}, {"name":"tooltip","order":40,"path":"folders/functions/tooltip.yy",}, {"name":"tween","order":31,"path":"folders/functions/tween.yy",}, @@ -198,7 +199,6 @@ {"name":"biterator","order":2,"path":"folders/VCT/biterator.yy",}, {"name":"widget","order":3,"path":"folders/VCT/widget.yy",}, {"name":"widgets","order":5,"path":"folders/widgets.yy",}, - {"name":"dynamic surface","order":10,"path":"folders/functions/surface/dynamic surface.yy",}, ], "ResourceOrderSettings": [ {"name":"s_node_corner","order":16,"path":"sprites/s_node_corner/s_node_corner.yy",}, diff --git a/PixelComposer.yyp b/PixelComposer.yyp index c69e03d9c..ec4e08ecf 100644 --- a/PixelComposer.yyp +++ b/PixelComposer.yyp @@ -89,6 +89,7 @@ {"resourceType":"GMFolder","resourceVersion":"1.0","name":"shader","folderPath":"folders/functions/shader.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"string","folderPath":"folders/functions/string.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"surface","folderPath":"folders/functions/surface.yy",}, + {"resourceType":"GMFolder","resourceVersion":"1.0","name":"dynamic surface","folderPath":"folders/functions/surface/dynamic surface.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"test","folderPath":"folders/functions/test.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"tooltip","folderPath":"folders/functions/tooltip.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"tween","folderPath":"folders/functions/tween.yy",}, @@ -235,7 +236,6 @@ {"resourceType":"GMFolder","resourceVersion":"1.0","name":"biterator","folderPath":"folders/VCT/biterator.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"widget","folderPath":"folders/VCT/widget.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"widgets","folderPath":"folders/widgets.yy",}, - {"resourceType":"GMFolder","resourceVersion":"1.0","name":"dynamic surface","folderPath":"folders/functions/surface/dynamic surface.yy",}, ], "IncludedFiles": [ {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"ApolloHelp.html","ConfigValues":{"Itch":{"CopyToMask":"0",},},"CopyToMask":-1,"filePath":"datafiles",}, diff --git a/objects/o_dialog_panel/Create_0.gml b/objects/o_dialog_panel/Create_0.gml index c35cb58e2..f452bcf33 100644 --- a/objects/o_dialog_panel/Create_0.gml +++ b/objects/o_dialog_panel/Create_0.gml @@ -60,8 +60,6 @@ event_inherited(); function onDestroy() { if(!content) return; content.onClose(); - - print("On close on panel"); } function remove() { diff --git a/objects/o_dialog_splash/Create_0.gml b/objects/o_dialog_splash/Create_0.gml index 7ddf97487..512432c6a 100644 --- a/objects/o_dialog_splash/Create_0.gml +++ b/objects/o_dialog_splash/Create_0.gml @@ -295,7 +295,7 @@ event_inherited(); gpu_set_colorwriteenable(1, 1, 1, 1); surface_reset_target(); - draw_surface_ext(grid_surface, tx, ty, 1, 1, 0, c_white, 0.85); + draw_surface_ext_safe(grid_surface, tx, ty, 1, 1, 0, c_white, 0.85); } } diff --git a/scripts/__pbBox/__pbBox.gml b/scripts/__pbBox/__pbBox.gml index f7013f2a1..67c7a1cfe 100644 --- a/scripts/__pbBox/__pbBox.gml +++ b/scripts/__pbBox/__pbBox.gml @@ -37,12 +37,12 @@ function __pbBox() constructor { surface_set_target(_ms); DRAW_CLEAR - draw_surface_ext(mask, _x0, _y0, _s, _s, 0, color, 1); + draw_surface_ext_safe(mask, _x0, _y0, _s, _s, 0, color, 1); surface_reset_target(); shader_set(sh_pb_draw_mask); shader_set_dim(, _ms); - draw_surface_ext(_ms, 0, 0, 1, 1, 0, color, 1); + draw_surface_ext_safe(_ms, 0, 0, 1, 1, 0, color, 1); shader_reset(); surface_free(_ms); diff --git a/scripts/addon_lua/addon_lua.gml b/scripts/addon_lua/addon_lua.gml index 5b6d26405..96c68575a 100644 --- a/scripts/addon_lua/addon_lua.gml +++ b/scripts/addon_lua/addon_lua.gml @@ -220,7 +220,7 @@ [ "is_surface", is_surface ], [ "draw_surface", draw_surface ], - [ "draw_surface_ext", draw_surface_ext ], + [ "draw_surface_ext_safe", draw_surface_ext_safe ], [ "draw_surface_part", draw_surface_part ], [ "draw_surface_part_ext", draw_surface_part_ext ], [ "draw_surface_stretched", draw_surface_stretched ], diff --git a/scripts/biterator/biterator.gml b/scripts/biterator/biterator.gml index e28cf17e3..eb36c72cc 100644 --- a/scripts/biterator/biterator.gml +++ b/scripts/biterator/biterator.gml @@ -181,7 +181,7 @@ function Biterator(node) : VCT(node) constructor { if(_shape == 3) { var ang = shape_knob[0].get() / 8 * 360; var p = point_rotate(0, 0, _dim / 2, _dim / 2, ang); - draw_surface_ext(shap, p[0], p[1], 1, 1, ang, c_white, 1); + draw_surface_ext_safe(shap, p[0], p[1], 1, 1, ang, c_white, 1); } else draw_surface(shap, 0, 0); surface_reset_target(); diff --git a/scripts/draw_surface_blend/draw_surface_blend.gml b/scripts/draw_surface_blend/draw_surface_blend.gml index d48eb7991..41d9eb255 100644 --- a/scripts/draw_surface_blend/draw_surface_blend.gml +++ b/scripts/draw_surface_blend/draw_surface_blend.gml @@ -23,27 +23,19 @@ function draw_surface_blend(background, foreground, blend = 0, alpha = 1, _pre_a default: return; } - var uniform_foreground = shader_get_sampler_index(sh, "fore"); - var uniform_mask = shader_get_sampler_index(sh, "mask"); - var uniform_dim_rat = shader_get_uniform(sh, "dimension"); - var uniform_is_mask = shader_get_uniform(sh, "useMask"); - var uniform_alpha = shader_get_uniform(sh, "opacity"); - var uniform_tile = shader_get_uniform(sh, "tile_type"); - var uniform_presalpha = shader_get_uniform(sh, "preserveAlpha"); - var surf = surface_get_target(); 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_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); + shader_set_surface("fore", foreground); + shader_set_surface("mask", _mask); + shader_set_i("useMask", _mask != 0? 1 : 0); + shader_set_f("dimension", surface_get_width_safe(background) / surface_get_width_safe(foreground), surface_get_height_safe(background) / surface_get_height_safe(foreground)); + shader_set_f("opacity", alpha); + shader_set_i("preserveAlpha", _pre_alp); + shader_set_i("tile_type", tile); } BLEND_ALPHA @@ -57,7 +49,7 @@ function draw_surface_blend_ext(bg, fg, _x, _y, _sx = 1, _sy = 1, _rot = 0, _col surface_set_shader(_tmpS); shader_set_interpolation(fg); - draw_surface_ext(fg, _x, _y, _sx, _sy, _rot, _col, 1); + draw_surface_ext_safe(fg, _x, _y, _sx, _sy, _rot, _col, 1); surface_reset_shader(); draw_surface_blend(bg, _tmpS, _blend, _alpha, false); diff --git a/scripts/draw_surface_functions/draw_surface_functions.gml b/scripts/draw_surface_functions/draw_surface_functions.gml index a0c48051a..8cd2bad7e 100644 --- a/scripts/draw_surface_functions/draw_surface_functions.gml +++ b/scripts/draw_surface_functions/draw_surface_functions.gml @@ -17,5 +17,5 @@ function draw_surface_align(surface, _x, _y, _s, _halign = fa_left, _valign = fa case fa_bottom: _sy = _y - h; break; } - draw_surface_ext(surface, _sx, _sy, _s, _s, 0, c_white, 1); + draw_surface_ext_safe(surface, _sx, _sy, _s, _s, 0, c_white, 1); } \ No newline at end of file diff --git a/scripts/dynaSurf/dynaSurf.gml b/scripts/dynaSurf/dynaSurf.gml index bcb10a247..8b3434eb0 100644 --- a/scripts/dynaSurf/dynaSurf.gml +++ b/scripts/dynaSurf/dynaSurf.gml @@ -1,8 +1,8 @@ function DynaSurf() constructor { surfaces = []; - static getWidth = function() { return 1; } - static getHeight = function() { return 1; } + static getWidth = function() { return is_surface(surfaces[0])? surface_get_width(surfaces[0]) : 1; } + static getHeight = function() { return is_surface(surfaces[0])? surface_get_height(surfaces[0]) : 1; } static draw = function(_x = 0, _y = 0, _sx = 1, _sy = 1, _ang = 0, _col = c_white, _alp = 1) {} static drawStretch = function(_x = 0, _y = 0, _w = 1, _h = 1, _ang = 0, _col = c_white, _alp = 1) { diff --git a/scripts/dynaSurf_iso/dynaSurf_iso.gml b/scripts/dynaSurf_iso/dynaSurf_iso.gml index d9fbb3318..2e3c90c97 100644 --- a/scripts/dynaSurf_iso/dynaSurf_iso.gml +++ b/scripts/dynaSurf_iso/dynaSurf_iso.gml @@ -1,19 +1,15 @@ -function dynaSurf_iso_4() : DynaSurf() constructor { - surfaces = array_create(4, noone); +function DynaSurf_iso() : DynaSurf() constructor { + angle = 0; - static getSurface = function(_rot) { - var ind = 0; - if(abs(angle_difference( 0, _rot)) <= 45) ind = 0; - else if(abs(angle_difference( 90, _rot)) <= 45) ind = 1; - else if(abs(angle_difference(180, _rot)) <= 45) ind = 2; - else if(abs(angle_difference(270, _rot)) <= 45) ind = 3; - - return surfaces[ind]; - } + static getSurface = function(_rot) {} static draw = function(_x = 0, _y = 0, _xs = 1, _ys = 1, _rot = 0, _col = c_white, _alp = 1) { var _surf = getSurface(_rot); - draw_surface_ext_safe(_surf, _x, _y, _xs, _ys, 0, _col, _alp); + var _w = getWidth() * _xs; + var _h = getHeight() * _ys; + var _px = point_rotate(0, 0, _w / 2, _h / 2, _rot); + + draw_surface_ext_safe(_surf, _x - _px[0], _y - _px[1], _xs, _ys, 0, _col, _alp); } static drawTile = function(_x = 0, _y = 0, _xs = 1, _ys = 1, _col = c_white, _alp = 1) { @@ -25,10 +21,53 @@ function dynaSurf_iso_4() : DynaSurf() constructor { var _surf = getSurface(_rot); draw_surface_part_ext_safe(_surf, _l, _t, _w, _h, _x, _y, _xs, _ys, 0, _col, _alp); } +} + +function dynaSurf_iso_4() : DynaSurf_iso() constructor { + surfaces = array_create(4, noone); + + static getSurface = function(_rot) { + _rot += angle; + var ind = 0; + if(abs(angle_difference( 0, _rot)) <= 45) ind = 0; + else if(abs(angle_difference( 90, _rot)) <= 45) ind = 1; + else if(abs(angle_difference(180, _rot)) <= 45) ind = 2; + else if(abs(angle_difference(270, _rot)) <= 45) ind = 3; + + return surfaces[ind]; + } static clone = function() { var _new = new dynaSurf_iso_4(); _new.surfaces = surfaces; + _new.angle = angle; + + return _new; + } +} + +function dynaSurf_iso_8() : DynaSurf_iso() constructor { + surfaces = array_create(8, noone); + + static getSurface = function(_rot) { + _rot += angle; + var ind = 0; + if(abs(angle_difference( 0, _rot)) <= 22.5) ind = 0; + else if(abs(angle_difference( 45, _rot)) <= 22.5) ind = 1; + else if(abs(angle_difference( 90, _rot)) <= 22.5) ind = 2; + else if(abs(angle_difference(135, _rot)) <= 22.5) ind = 3; + else if(abs(angle_difference(180, _rot)) <= 22.5) ind = 4; + else if(abs(angle_difference(225, _rot)) <= 22.5) ind = 5; + else if(abs(angle_difference(270, _rot)) <= 22.5) ind = 6; + else if(abs(angle_difference(315, _rot)) <= 22.5) ind = 7; + + return surfaces[ind]; + } + + static clone = function() { + var _new = new dynaSurf_iso_8(); + _new.surfaces = surfaces; + _new.angle = angle; return _new; } diff --git a/scripts/fd_draw_surface_to_collision_mask_surface/fd_draw_surface_to_collision_mask_surface.gml b/scripts/fd_draw_surface_to_collision_mask_surface/fd_draw_surface_to_collision_mask_surface.gml index d83c351b9..a478c48d7 100644 --- a/scripts/fd_draw_surface_to_collision_mask_surface/fd_draw_surface_to_collision_mask_surface.gml +++ b/scripts/fd_draw_surface_to_collision_mask_surface/fd_draw_surface_to_collision_mask_surface.gml @@ -4,9 +4,9 @@ function fd_draw_surface_to_collision_mask_surface(domain, surface, _x, _y, xsca // this script should be called every step to draw the surface blocking the fluid. This will draw the surface at the correct position in the collision mask according to the // new view position. Call it before fd_rectangle_update_view. If you e.g. call fd_rectangle_update_view in the step event, call this in the begin step event. // instance id: The instance id of the fluid dynamics rectangle. - // surface id, x, y, xscale, yscale, rot, color, alpha: See draw_surface_ext in the GameMaker manual. + // surface id, x, y, xscale, yscale, rot, color, alpha: See draw_surface_ext_safe in the GameMaker manual. surface_set_target(fd_rectangle_get_collision_mask_surface(domain)); - draw_surface_ext(surface, fd_x(domain, _x), fd_y(domain, _y), xscale / domain.fd_wratio, yscale / domain.fd_hratio, rot, color, alpha); + draw_surface_ext_safe(surface, fd_x(domain, _x), fd_y(domain, _y), xscale / domain.fd_wratio, yscale / domain.fd_hratio, rot, color, alpha); surface_reset_target(); } diff --git a/scripts/fd_rectangle_add_material_surface/fd_rectangle_add_material_surface.gml b/scripts/fd_rectangle_add_material_surface/fd_rectangle_add_material_surface.gml index 6a0b1b7c5..57891df56 100644 --- a/scripts/fd_rectangle_add_material_surface/fd_rectangle_add_material_surface.gml +++ b/scripts/fd_rectangle_add_material_surface/fd_rectangle_add_material_surface.gml @@ -10,7 +10,7 @@ function fd_rectangle_add_material_surface(domain, surface, _x, _y, xscale, ysca with (domain) { fd_rectangle_set_target(id, FD_TARGET_TYPE.ADD_MATERIAL); - draw_surface_ext(surface, _x, _y, xscale, yscale, 0, color, alpha); + draw_surface_ext_safe(surface, _x, _y, xscale, yscale, 0, color, alpha); fd_rectangle_reset_target(id); } } diff --git a/scripts/fd_rectangle_add_velocity_surface/fd_rectangle_add_velocity_surface.gml b/scripts/fd_rectangle_add_velocity_surface/fd_rectangle_add_velocity_surface.gml index 770bcda30..aeadbd99f 100644 --- a/scripts/fd_rectangle_add_velocity_surface/fd_rectangle_add_velocity_surface.gml +++ b/scripts/fd_rectangle_add_velocity_surface/fd_rectangle_add_velocity_surface.gml @@ -14,7 +14,7 @@ function fd_rectangle_add_velocity_surface(domain, surface, _x, _y, xscale, ysca with (domain) { fd_rectangle_set_target(id, FD_TARGET_TYPE.ADD_VELOCITY); var color = make_color_rgb(ceil((clamp(xvelo, -1, 1) * 0.125 + 0.5) * 255), ceil((clamp(yvelo, -1, 1) * 0.125 + 0.5) * 255), 0); - draw_surface_ext(surface, _x, _y, xscale, yscale, 0, color, 1); + draw_surface_ext_safe(surface, _x, _y, xscale, yscale, 0, color, 1); fd_rectangle_reset_target(id); } } diff --git a/scripts/fd_rectangle_draw/fd_rectangle_draw.gml b/scripts/fd_rectangle_draw/fd_rectangle_draw.gml index f6cdfb1a4..850b6d3fb 100644 --- a/scripts/fd_rectangle_draw/fd_rectangle_draw.gml +++ b/scripts/fd_rectangle_draw/fd_rectangle_draw.gml @@ -4,8 +4,8 @@ function fd_rectangle_draw(domain, _x, _y, xscale, yscale, color, alpha, interpo // instance id: The instance id of the fluid dynamics rectangle. // x, y: The pixel position to draw at. // xscale, yscale: The scale to draw at. - // color: The image blending color, the same as color in draw_surface_ext. - // alpha: The alpha to draw at, the same as alpha in draw_surface_ext. + // color: The image blending color, the same as color in draw_surface_ext_safe. + // alpha: The alpha to draw at, the same as alpha in draw_surface_ext_safe. // use interpolation: Set this to true if you want linear interpolation to be enabled, and false if you want nearest neighbor to be used instead. fd_rectangle_draw_part(domain, 0, 0, domain.sf_material_width, domain.sf_material_height, _x, _y, xscale, yscale, color, alpha, interpolate); diff --git a/scripts/fd_rectangle_draw_part/fd_rectangle_draw_part.gml b/scripts/fd_rectangle_draw_part/fd_rectangle_draw_part.gml index 66cf40280..815c064c4 100644 --- a/scripts/fd_rectangle_draw_part/fd_rectangle_draw_part.gml +++ b/scripts/fd_rectangle_draw_part/fd_rectangle_draw_part.gml @@ -5,8 +5,8 @@ function fd_rectangle_draw_part(domain, left, top, width, height, _x, _y, xscale // left, top, width, height: See the manual on draw_surface_part for an explanation. // x, y: The pixel position to draw at. // _x, _y: The scale to draw at. - // color: The image blending color, the same as color in draw_surface_ext. - // alpha: The alpha to draw at, the same as alpha in draw_surface_ext. + // color: The image blending color, the same as color in draw_surface_ext_safe. + // alpha: The alpha to draw at, the same as alpha in draw_surface_ext_safe. // use interpolation: Set this to true if you want linear interpolation to be enabled, and false if you want nearest neighbor to be used instead. with (domain) { diff --git a/scripts/fd_rectangle_draw_stretched/fd_rectangle_draw_stretched.gml b/scripts/fd_rectangle_draw_stretched/fd_rectangle_draw_stretched.gml index 4d5e0ebb2..9e5afa236 100644 --- a/scripts/fd_rectangle_draw_stretched/fd_rectangle_draw_stretched.gml +++ b/scripts/fd_rectangle_draw_stretched/fd_rectangle_draw_stretched.gml @@ -4,8 +4,8 @@ function fd_rectangle_draw_stretched(domain, _x, _y, width, height, color, alpha // instance id: The instance id of the fluid dynamics rectangle. // x, y: The pixel position to draw at. // width, height: The width and height to draw the fluid dynamics rectangle at. - // color: The image blending color, the same as color in draw_surface_ext. - // alpha: The alpha to draw at, the same as alpha in draw_surface_ext. + // color: The image blending color, the same as color in draw_surface_ext_safe. + // alpha: The alpha to draw at, the same as alpha in draw_surface_ext_safe. // use interpolation: Set this to true if you want linear interpolation to be enabled, and false if you want nearest neighbor to be used instead. with (domain) { diff --git a/scripts/fd_rectangle_draw_view/fd_rectangle_draw_view.gml b/scripts/fd_rectangle_draw_view/fd_rectangle_draw_view.gml index 451fa0b8b..047d33569 100644 --- a/scripts/fd_rectangle_draw_view/fd_rectangle_draw_view.gml +++ b/scripts/fd_rectangle_draw_view/fd_rectangle_draw_view.gml @@ -2,8 +2,8 @@ function fd_rectangle_draw_view(domain, color, alpha, interpolate) { // Draws a fluid dynamics rectangle that has been attached to a view. // instance id: The instance id of the fluid dynamics rectangle. - // color: The image blending color, the same as color in draw_surface_ext. - // alpha: The alpha to draw at, the same as alpha in draw_surface_ext. + // color: The image blending color, the same as color in draw_surface_ext_safe. + // alpha: The alpha to draw at, the same as alpha in draw_surface_ext_safe. // use interpolation: Set this to true if you want linear interpolation to be enabled, and false if you want nearest neighbor to be used instead. with (domain) { diff --git a/scripts/fd_rectangle_replace_material_surface/fd_rectangle_replace_material_surface.gml b/scripts/fd_rectangle_replace_material_surface/fd_rectangle_replace_material_surface.gml index 255b215a2..51c3c65a5 100644 --- a/scripts/fd_rectangle_replace_material_surface/fd_rectangle_replace_material_surface.gml +++ b/scripts/fd_rectangle_replace_material_surface/fd_rectangle_replace_material_surface.gml @@ -11,7 +11,7 @@ function fd_rectangle_replace_material_surface(domain, surface, _x, _y, xscale, with (domain) { fd_rectangle_set_target(id, FD_TARGET_TYPE.REPLACE_MATERIAL); - draw_surface_ext(surface, _x, _y, xscale, yscale, 0, color, alpha); + draw_surface_ext_safe(surface, _x, _y, xscale, yscale, 0, color, alpha); fd_rectangle_reset_target(id); } } diff --git a/scripts/nodeValue_drawer/nodeValue_drawer.gml b/scripts/nodeValue_drawer/nodeValue_drawer.gml index 8559d6311..ba5feec8a 100644 --- a/scripts/nodeValue_drawer/nodeValue_drawer.gml +++ b/scripts/nodeValue_drawer/nodeValue_drawer.gml @@ -228,7 +228,8 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _foc jun.editWidget.setInteract(false); } - var param = new widgetParam(editBoxX, editBoxY, editBoxW, editBoxH, jun.showValue(), jun.extra_data, _m, rx, ry); + var _show = jun.showValue(); + var param = new widgetParam(editBoxX, editBoxY, editBoxW, editBoxH, _show, jun.extra_data, _m, rx, ry); switch(jun.type) { case VALUE_TYPE.integer : diff --git a/scripts/node_composite/node_composite.gml b/scripts/node_composite/node_composite.gml index 337256bf7..2b0764521 100644 --- a/scripts/node_composite/node_composite.gml +++ b/scripts/node_composite/node_composite.gml @@ -13,13 +13,6 @@ enum COMPOSE_OUTPUT_SCALING { function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor { name = "Composite"; - shader = sh_blend_normal_dim; - uniform_dim = shader_get_uniform(shader, "dimension"); - uniform_pos = shader_get_uniform(shader, "position"); - uniform_sca = shader_get_uniform(shader, "scale"); - uniform_rot = shader_get_uniform(shader, "rotation"); - uniform_for = shader_get_sampler_index(shader, "fore"); - inputs[| 0] = nodeValue("Padding", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 0, 0, 0, 0 ]) .setDisplay(VALUE_DISPLAY.padding); @@ -42,7 +35,7 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) hold_select = true; layer_dragging = noone; layer_remove = -1; - layer_renderer = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus) { + layer_renderer = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus) { #region var amo = (ds_list_size(inputs) - input_fix_len) / data_length - 1; if(array_length(current_data) != ds_list_size(inputs)) return 0; @@ -185,7 +178,7 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) } return _h; - }); + }); #endregion input_display_list = [ ["Output", true], 0, 1, 2, @@ -194,7 +187,7 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) ]; input_display_list_len = array_length(input_display_list); - function deleteLayer(index) { + function deleteLayer(index) { #region var idx = input_fix_len + index * data_length; for( var i = 0; i < data_length; i++ ) { ds_list_delete(inputs, idx); @@ -209,9 +202,9 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) if(ds_list_size(inputs) == input_fix_len) createNewInput(); doUpdate(); - } + } #endregion - static createNewInput = function() { + static createNewInput = function() { #region var index = ds_list_size(inputs); var _s = floor((index - input_fix_len) / data_length); @@ -241,7 +234,7 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) array_push(attributes.layer_visible, true); while(_s >= array_length(attributes.layer_selectable)) array_push(attributes.layer_selectable, true); - } + } #endregion if(!LOADING && !APPENDING) createNewInput(); //function getInput() { return inputs[| ds_list_size(inputs) - data_length]; } @@ -271,16 +264,16 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) surface_selecting = noone; - static getInputAmount = function() { + static getInputAmount = function() { #region return input_fix_len + (ds_list_size(inputs) - input_fix_len) / data_length; - } + } #endregion - static getInputIndex = function(index) { + static getInputIndex = function(index) { #region if(index < input_fix_len) return index; return input_fix_len + (index - input_fix_len) * data_length; - } + } #endregion - static setHeight = function() { + static setHeight = function() { #region var _hi = ui(32); var _ho = ui(32); @@ -293,9 +286,9 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) _ho += 24; h = max(min_h, (preview_surface && previewable)? 128 : 0, _hi, _ho); - } + } #endregion - static drawJunctions = function(_x, _y, _mx, _my, _s) { + static drawJunctions = function(_x, _y, _mx, _my, _s) { #region if(!active) return; var hover = noone; var amo = array_length(input_display_list); @@ -352,9 +345,9 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) hover = outputs[| i]; return hover; - } + } #endregion - static drawJunctionNames = function(_x, _y, _mx, _my, _s) { + static drawJunctionNames = function(_x, _y, _mx, _my, _s) { #region if(!active) return; var amo = input_display_list == -1? ds_list_size(inputs) : array_length(input_display_list); var jun; @@ -404,9 +397,9 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) for(var i = 0; i < ds_list_size(outputs); i++) outputs[| i].drawName(_s, _mx, _my); } - } + } #endregion - static preDraw = function(_x, _y, _s) { + static preDraw = function(_x, _y, _s) { #region var xx = x * _s + _x; var yy = y * _s + _y; var jun; @@ -456,16 +449,16 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) jun.y = _in; _in += 24 * _s * jun.isVisible(); } - } + } #endregion - static onValueFromUpdate = function(index) { + static onValueFromUpdate = function(index) { #region if(LOADING || APPENDING) return; if(index + data_length >= ds_list_size(inputs)) createNewInput(); - } + } #endregion - static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { + static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { #region var pad = inputs[| 0].getValue(); var ww = overlay_w; var hh = overlay_h; @@ -735,15 +728,15 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) deleteLayer(layer_remove); layer_remove = -1; } - } + } #endregion - static step = function() { + static step = function() { #region var _dim_type = getSingleValue(1); inputs[| 2].setVisible(_dim_type == COMPOSE_OUTPUT_SCALING.constant); - } + } #endregion - static processData = function(_outSurf, _data, _output_index, _array_index) { + static processData = function(_outSurf, _data, _output_index, _array_index) { #region if(_output_index == 1) return atlas_data; if(_output_index == 0 && _array_index == 0) atlas_data = []; @@ -826,22 +819,22 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) surface_reset_shader(); return _outSurf; - } + } #endregion - static attributeSerialize = function() { + static attributeSerialize = function() { #region var att = {}; att.layer_visible = attributes.layer_visible; att.layer_selectable = attributes.layer_selectable; return att; - } + } #endregion - static attributeDeserialize = function(attr) { + static attributeDeserialize = function(attr) { #region if(struct_has(attr, "layer_visible")) attributes.layer_visible = attr.layer_visible; if(struct_has(attr, "layer_selectable")) attributes.layer_selectable = attr.layer_selectable; - } + } #endregion } diff --git a/scripts/node_data/node_data.gml b/scripts/node_data/node_data.gml index fc39111a6..44cf1092a 100644 --- a/scripts/node_data/node_data.gml +++ b/scripts/node_data/node_data.gml @@ -233,13 +233,11 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x var _hi = ui(32); var _ho = ui(32); - for( var i = 0; i < ds_list_size(inputs); i++ ) { + for( var i = 0; i < ds_list_size(inputs); i++ ) if(inputs[| i].isVisible()) _hi += 24; - } - for( var i = 0; i < ds_list_size(outputs); i++ ) { + for( var i = 0; i < ds_list_size(outputs); i++ ) if(outputs[| i].isVisible()) _ho += 24; - } h = max(min_h, (preview_surface && previewable)? 128 : 0, _hi, _ho); } #endregion @@ -809,8 +807,13 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x static getGraphPreviewSurface = function() { #region var _node = outputs[| preview_channel]; - if(_node.type != VALUE_TYPE.surface) return noone; - return _node.getValue(); + switch(_node.type) { + case VALUE_TYPE.surface : + case VALUE_TYPE.dynaSurf : + return _node.getValue(); + } + + return noone; } #endregion static drawPreview = function(xx, yy, _s) { #region @@ -924,7 +927,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x draw_sprite_stretched_ext(THEME.node_glow, 0, xx - 9, yy - 9, w * _s + 18, h * _s + 18, COLORS._main_value_negative, 1); drawNodeBase(xx, yy, _s); - if(previewable && ds_list_size(outputs) > 0) { + if(previewable && ds_list_size(outputs)) { if(preview_channel >= ds_list_size(outputs)) preview_channel = 0; drawPreview(xx, yy, _s); @@ -1267,7 +1270,14 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x static getPreviewValues = function() { #region if(preview_channel >= ds_list_size(outputs)) return noone; - if(outputs[| preview_channel].type != VALUE_TYPE.surface) return noone; //I feels like I've wrote this line before. Did I delete it because of a bug? Am I reintroducing old bug? + + switch(outputs[| preview_channel].type) { + case VALUE_TYPE.surface : + case VALUE_TYPE.dynaSurf : + break; + default : + return; + } return outputs[| preview_channel].getValue(); } #endregion diff --git a/scripts/node_dilate/node_dilate.gml b/scripts/node_dilate/node_dilate.gml index 5557ee460..856af29a6 100644 --- a/scripts/node_dilate/node_dilate.gml +++ b/scripts/node_dilate/node_dilate.gml @@ -43,6 +43,7 @@ function Node_Dilate(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { var pos = inputs[| 1].getValue(); + var px = _x + pos[0] * _s; var py = _y + pos[1] * _s; @@ -50,8 +51,7 @@ function Node_Dilate(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co inputs[| 3].drawOverlay(active, px, py, _s, _mx, _my, _snx, _sny, 0, 1, THEME.anchor_scale_hori); } - static processData = function(_outSurf, _data, _output_index, _array_index) { - + static processData = function(_outSurf, _data, _output_index, _array_index) { var center = _data[1]; var stren = _data[2]; var rad = _data[3]; diff --git a/scripts/node_isosurf/node_isosurf.gml b/scripts/node_isosurf/node_isosurf.gml index 9681f1117..25e455bc5 100644 --- a/scripts/node_isosurf/node_isosurf.gml +++ b/scripts/node_isosurf/node_isosurf.gml @@ -8,21 +8,26 @@ function Node_IsoSurf(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c .setVisible(true, true) .setArrayDepth(1); + inputs[| 2] = nodeValue("Angle Shift", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + .setDisplay(VALUE_DISPLAY.rotation); + outputs[| 0] = nodeValue("IsoSurf", self, JUNCTION_CONNECT.output, VALUE_TYPE.dynaSurf, noone); input_display_list = [ - ["Isometric", false], 0, + ["Isometric", false], 0, 2, ["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 _type = _data[0]; + var _surf = _data[1]; + var _angle = _data[2]; + var _amo = _type == 0? 4 : 8; - var _iso = new dynaSurf_iso_4(); + var _iso = _type == 0? new dynaSurf_iso_4() : new dynaSurf_iso_8(); for( var i = 0; i < _amo; i++ ) _iso.surfaces[i] = array_safe_get(_surf, i, noone); + _iso.angle = _angle; return _iso; } diff --git a/scripts/node_processor/node_processor.gml b/scripts/node_processor/node_processor.gml index 49f82d45b..7bd6cfddd 100644 --- a/scripts/node_processor/node_processor.gml +++ b/scripts/node_processor/node_processor.gml @@ -266,7 +266,6 @@ function Node_Processor(_x, _y, _group = noone) : Node(_x, _y, _group) construct static update = function(frame = PROJECT.animator.current_frame) { #region getInputs(); - var val; if(batch_output) processBatchOutput(); else processOutput(); diff --git a/scripts/node_transform/node_transform.gml b/scripts/node_transform/node_transform.gml index b6e761572..418bffd52 100644 --- a/scripts/node_transform/node_transform.gml +++ b/scripts/node_transform/node_transform.gml @@ -60,7 +60,7 @@ function Node_Transform(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) vel = 0; prev_pos = [0, 0]; - static getDimension = function(arr) { + static getDimension = function(arr) { #region var _surf = getSingleValue(0, arr); var _out_type = getSingleValue(9, arr); var _out = getSingleValue(1, arr); @@ -87,13 +87,9 @@ function Node_Transform(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) } return [ww, hh]; - } + } #endregion - static onValueUpdate = function(index, prev) { - var curr = inputs[| 0].getValue(); - } - - static centerAnchor = function() { + static centerAnchor = function() { #region var _surf = inputs[| 0].getValue(); var _out_type = inputs[| 9].getValue(); @@ -105,11 +101,11 @@ function Node_Transform(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) _surf = _surf[preview_index]; } - inputs[| 3].setValue([ 0.5, 0.5]); + inputs[| 3].setValue([ 0.5, 0.5 ]); inputs[| 2].setValue([ surface_get_width_safe(_surf) / 2, surface_get_height_safe(_surf) / 2 ]); - } + } #endregion - static step = function() { + static step = function() { #region var pos = inputs[| 2].getValue(); if(!PROJECT.animator.frame_progress) return; @@ -124,21 +120,21 @@ function Node_Transform(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) prev_pos[0] = pos[0]; prev_pos[1] = pos[1]; } - } + } #endregion - static processData = function(_outSurf, _data, _output_index, _array_index) { + static processData = function(_outSurf, _data, _output_index, _array_index) { #region var ins = _data[0]; var out_type = _data[9]; - var out = _data[1]; + var out = _data[1]; - var pos = _data[2]; + var pos = _data[2]; var pos_exact = _data[10]; var anc = _data[3]; var rot_vel = vel * _data[8]; - var rot = _data[5] + rot_vel; + var rot = _data[5] + rot_vel; var sca = _data[6]; var mode = _data[7]; @@ -244,7 +240,7 @@ function Node_Transform(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) } return _outSurf; - } + } #endregion overlay_dragging = 0; corner_dragging = 0; @@ -257,8 +253,8 @@ function Node_Transform(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) overlay_drag_ma = 0; overlay_drag_sa = 0; - static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { - if(array_length(current_data) < ds_list_size(inputs)) return; + static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { #region + PROCESSOR_OVERLAY_CHECK var _surf = inputs[| 0].getValue(); if(is_array(_surf)) { @@ -335,7 +331,6 @@ function Node_Transform(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) draw_line(tl[0], tl[1], bl[0], bl[1]); draw_line(tr[0], tr[1], br[0], br[1]); draw_line(bl[0], bl[1], br[0], br[1]); - #endregion if(overlay_dragging && overlay_dragging < 3) { //Transform @@ -502,5 +497,5 @@ function Node_Transform(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) draw_set_alpha(1); } #endregion - } + } #endregion } \ No newline at end of file diff --git a/scripts/node_value/node_value.gml b/scripts/node_value/node_value.gml index 8335198c4..c12ae09cf 100644 --- a/scripts/node_value/node_value.gml +++ b/scripts/node_value/node_value.gml @@ -308,16 +308,16 @@ function isGraphable(prop) { #region return false; } #endregion -function nodeValueUnit(value) constructor { #region - self.value = value; +function nodeValueUnit(_nodeValue) constructor { #region + self._nodeValue = _nodeValue; mode = VALUE_UNIT.constant; reference = noone; triggerButton = button(function() { mode = !mode; - value.cache_value[0] = false; - value.unitConvert(mode); - value.node.doUpdate(); + _nodeValue.cache_value[0] = false; + _nodeValue.unitConvert(mode); + _nodeValue.node.doUpdate(); }); triggerButton.icon_blend = COLORS._main_icon_light; triggerButton.icon = THEME.unit_ref; @@ -328,9 +328,9 @@ function nodeValueUnit(value) constructor { #region if(type == "relative" && mode == VALUE_UNIT.reference) return; mode = type == "constant"? VALUE_UNIT.constant : VALUE_UNIT.reference; - value.cache_value[0] = false; - value.unitConvert(mode); - value.node.doUpdate(); + _nodeValue.cache_value[0] = false; + _nodeValue.unitConvert(mode); + _nodeValue.node.doUpdate(); } #endregion static draw = function(_x, _y, _w, _h, _m) { #region @@ -341,6 +341,8 @@ function nodeValueUnit(value) constructor { #region } #endregion static invApply = function(value, index = 0) { #region + //value = variable_clone(value); + if(mode == VALUE_UNIT.constant) return value; if(reference == noone) @@ -350,18 +352,20 @@ function nodeValueUnit(value) constructor { #region } #endregion static apply = function(value, index = 0) { #region - if(mode == VALUE_UNIT.constant) - return value; - if(reference == noone) - return value; + //value = variable_clone(value); + + if(mode == VALUE_UNIT.constant) return value; + if(reference == noone) return value; return convertUnit(value, VALUE_UNIT.constant, index); } #endregion static convertUnit = function(value, unitTo, index = 0) { #region - var disp = self.value.display_type; + //value = variable_clone(value); + + var disp = _nodeValue.display_type; var base = reference(index); - var inv = unitTo == VALUE_UNIT.reference; + var inv = unitTo == VALUE_UNIT.reference; if(!is_array(base) && !is_array(value)) return inv? value / base : value * base; @@ -372,9 +376,8 @@ function nodeValueUnit(value) constructor { #region return value; } - if(is_array(base) && !is_array(value)) { + if(is_array(base) && !is_array(value)) return value; - } switch(disp) { case VALUE_DISPLAY.padding : @@ -458,7 +461,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru dyna_depo = ds_list_create(); is_changed = true; - cache_value = [ false, false, undefined ]; + cache_value = [ false, false, undefined, undefined ]; cache_array = [ false, false ]; use_cache = true; @@ -1167,13 +1170,16 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru if(typeFrom == VALUE_TYPE.boolean && type == VALUE_TYPE.text) return value? "true" : "false"; - if(type == VALUE_TYPE.integer || type == VALUE_TYPE.float) { + if(type == VALUE_TYPE.integer || type == VALUE_TYPE.float) { #region if(typeFrom == VALUE_TYPE.text) value = toNumber(value); - if(applyUnit) - return unit.apply(value, arrIndex); - } + //print($"{name} get value {value} ({applyUnit})"); + //printCallStack(); + //print("======================="); + + if(applyUnit) return unit.apply(value, arrIndex); + } #endregion if(type == VALUE_TYPE.surface && connect_type == JUNCTION_CONNECT.input && !is_surface(value) && def_val == USE_DEF) return DEF_SURFACE; @@ -1187,15 +1193,16 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru return getValue(_time, applyUnit, arrIndex, true); } #endregion - static getValue = function(_time = PROJECT.animator.current_frame, applyUnit = true, arrIndex = 0, useCache = false) { #region + static getValue = function(_time = PROJECT.animator.current_frame, applyUnit = true, arrIndex = 0, useCache = false, log = false) { #region if(type == VALUE_TYPE.trigger) useCache = false; - + global.cache_call++; if(useCache && use_cache) { var cache_hit = cache_value[0]; cache_hit &= (!is_anim && value_from == noone) || cache_value[1] == _time; cache_hit &= cache_value[2] != undefined; + cache_hit &= cache_value[3] == applyUnit; cache_hit &= connect_type == JUNCTION_CONNECT.input; cache_hit &= unit.reference == noone || unit.mode == VALUE_UNIT.constant; //cache_hit &= !expUse; @@ -1206,7 +1213,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru } } - var val = _getValue(_time, applyUnit, arrIndex); + var val = _getValue(_time, applyUnit, arrIndex, log); if(useCache) { is_changed = !isEqual(cache_value[2], val); @@ -1215,6 +1222,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru } cache_value[2] = val; + cache_value[3] = applyUnit; return val; } #endregion @@ -1225,8 +1233,10 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru for( var i = 0, n = array_length(animators); i < n; i++ ) val[i] = animators[i].getValue(_time); return val; - } else - return animator.getValue(_time); + } + + var _val = animator.getValue(_time); + return _val; } #endregion static arrayBalance = function(val) { #region //Balance array (generate uniform array from single values) @@ -1249,7 +1259,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru return val; } #endregion - static _getValue = function(_time = PROJECT.animator.current_frame, applyUnit = true, arrIndex = 0) { #region + static _getValue = function(_time = PROJECT.animator.current_frame, applyUnit = true, arrIndex = 0, log = false) { #region var _val = getValueRecursive(_time); var val = _val[0]; var nod = _val[1]; @@ -1371,7 +1381,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru if(display_type == VALUE_DISPLAY.area) useCache = false; - var val = getValue(, false, 0, useCache); + var val = getValue(, false, 0, useCache, true); if(isArray()) { if(array_length(val) == 0) return 0; @@ -1435,7 +1445,6 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru static setValue = function(val = 0, record = true, time = PROJECT.animator.current_frame, _update = true) { #region //if(type == VALUE_TYPE.d3vertex && !is_array(val)) // print(val); - val = unit.invApply(val); return setValueDirect(val, noone, record, time, _update); } #endregion @@ -1568,10 +1577,11 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru cache_array[0] = false; cache_value[0] = false; - draw_line_shift_x = 0; - draw_line_shift_y = 0; - - if(!LOADING) PROJECT.modified = true; + if(!LOADING) { + draw_line_shift_x = 0; + draw_line_shift_y = 0; + PROJECT.modified = true; + } return true; } #endregion @@ -1798,7 +1808,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru var shx = draw_line_shift_x * _s; var shy = draw_line_shift_y * _s; - + var cx = round((frx + jx) / 2 + shx); var cy = round((fry + jy) / 2 + shy); diff --git a/scripts/panel_function/panel_function.gml b/scripts/panel_function/panel_function.gml index 7a67f1012..709415556 100644 --- a/scripts/panel_function/panel_function.gml +++ b/scripts/panel_function/panel_function.gml @@ -239,7 +239,7 @@ } if(panel_dragging) { - draw_surface_ext(panel_dragging.dragSurface, mouse_mx + 8, mouse_my + 8, 0.5, 0.5, 0, c_white, 0.5); + draw_surface_ext_safe(panel_dragging.dragSurface, mouse_mx + 8, mouse_my + 8, 0.5, 0.5, 0, c_white, 0.5); if((panel_mouse == 0 && mouse_release(mb_left)) || (panel_mouse == 1 && mouse_press(mb_left))) { var p = []; diff --git a/scripts/panel_graph/panel_graph.gml b/scripts/panel_graph/panel_graph.gml index ee96cc9bf..3018fd2c3 100644 --- a/scripts/panel_graph/panel_graph.gml +++ b/scripts/panel_graph/panel_graph.gml @@ -1385,7 +1385,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { } surface_reset_target(); - draw_surface_ext(minimap_surface, mx0, my0, 1, 1, 0, c_white, 0.5 + 0.35 * hover); + draw_surface_ext_safe(minimap_surface, mx0, my0, 1, 1, 0, c_white, 0.5 + 0.35 * hover); draw_set_color(COLORS.panel_graph_minimap_outline); draw_rectangle(mx0, my0, mx1 - 1, my1 - 1, true); @@ -1519,7 +1519,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { if(ds_list_empty(nodes_select_list)) { if(node_focus != noone && !ds_list_empty(node_focus.outputs)) { var _o = node_focus.outputs[| 0]; - if(_o.type == VALUE_TYPE.surface) { + if(_o.type == VALUE_TYPE.surface || _o.type == VALUE_TYPE.dynaSurf) { var tr = nodeBuild("Node_Transform", node_focus.x + node_focus.w + 64, node_focus.y); tr.inputs[| 0].setFrom(_o); } @@ -1530,7 +1530,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { if(ds_list_empty(node.outputs)) continue; var _o = node.outputs[| 0]; - if(_o.type == VALUE_TYPE.surface) { + if(_o.type == VALUE_TYPE.surface || _o.type == VALUE_TYPE.dynaSurf) { var tr = nodeBuild("Node_Transform", node.x + node.w + 64, node.y); tr.inputs[| 0].setFrom(_o); } 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 26b248729..3ba559848 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 @@ -116,7 +116,7 @@ function Panel_Graph_Export_Image(targetPanel) : PanelContent() constructor { 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_surface_ext_safe(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_safe(surface)} x {surface_get_height_safe(surface)} px"); diff --git a/scripts/point_rotate/point_rotate.gml b/scripts/point_rotate/point_rotate.gml index fba3ef7ca..06ed48e3b 100644 --- a/scripts/point_rotate/point_rotate.gml +++ b/scripts/point_rotate/point_rotate.gml @@ -1,4 +1,6 @@ function point_rotate(px, py, ox, oy, a) { + gml_pragma("forceinline"); + a = angle_difference(a, 0); if(a == 0) return [ px, py ]; if(a == 180) return [ ox + (ox - px), oy + (oy - py) ]; diff --git a/scripts/shader_functions/shader_functions.gml b/scripts/shader_functions/shader_functions.gml index 084c4f78a..e6c26b3e7 100644 --- a/scripts/shader_functions/shader_functions.gml +++ b/scripts/shader_functions/shader_functions.gml @@ -53,6 +53,9 @@ function shader_set_uniform_f_array_safe(uniform, array, max_length = 128) { function shader_set_surface(sampler, surface, linear = false, _repeat = false) { var shader = shader_current(); + + if(is_struct(shader) && is_instanceof(shader, dynaSurf)) + shader = shader.surfaces[0]; if(!is_surface(surface)) return; var t = shader_get_sampler_index(shader, sampler); diff --git a/scripts/steam_ugc_project/steam_ugc_project.gml b/scripts/steam_ugc_project/steam_ugc_project.gml index 4626508a0..3bafd0097 100644 --- a/scripts/steam_ugc_project/steam_ugc_project.gml +++ b/scripts/steam_ugc_project/steam_ugc_project.gml @@ -68,7 +68,7 @@ function steam_ugc_project_generate(dest_path = DIRECTORY + "steamUGCthumbnail.p 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); + draw_surface_ext_safe(preview_surface, prev_size / 2 - ox, prev_size / 2 - oy, ss, ss, 0, c_white, 1); } draw_sprite_stretched(s_workshop_badge, 0, 8, 8, 88, 88); diff --git a/scripts/surface_functions/surface_functions.gml b/scripts/surface_functions/surface_functions.gml index 8a8668be8..a472fb93f 100644 --- a/scripts/surface_functions/surface_functions.gml +++ b/scripts/surface_functions/surface_functions.gml @@ -141,13 +141,13 @@ function surface_save_safe(surface, path) { function surface_get_width_safe(s) { gml_pragma("forceinline"); - return (is_struct(s) && is_instanceof(s, DynaSurf)))? s.getWidth() : surface_get_width(s); + 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); + return (is_struct(s) && is_instanceof(s, DynaSurf))? s.getHeight() : surface_get_height(s); } //check @@ -288,7 +288,7 @@ function surface_size_lim(surface, width, height) { var s = surface_create(sw * ss, sh * ss); surface_set_target(s); DRAW_CLEAR; - draw_surface_ext(surface, 0, 0, ss, ss, 0, c_white, 1); + draw_surface_ext_safe(surface, 0, 0, ss, ss, 0, c_white, 1); surface_reset_target(); return s; } @@ -385,7 +385,7 @@ function surface_mirror(surf, _h, _v) { 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); + draw_surface_ext_safe(surf, x0, y0, _h * 2 - 1, _v * 2 - 1, 0, c_white, 1); surface_reset_target(); surface_free(surf);