1.14.0pr2

This commit is contained in:
Tanasart 2023-03-21 09:01:53 +07:00
parent 9d7854efe8
commit 6c594650a4
84 changed files with 2875 additions and 1843 deletions

View file

@ -117,6 +117,7 @@
{"name":"overlay","order":2,"path":"folders/panels/preview/overlay.yy",},
{"name":"sprites","order":3,"path":"folders/panels/preview/sprites.yy",},
{"name":"shader","order":8,"path":"folders/shader.yy",},
{"name":"_helper","order":49,"path":"folders/shader/_helper.yy",},
{"name":"3d","order":29,"path":"folders/shader/3d.yy",},
{"name":"blend","order":18,"path":"folders/shader/blend.yy",},
{"name":"blur","order":38,"path":"folders/shader/blur.yy",},
@ -127,6 +128,7 @@
{"name":"flood fill","order":47,"path":"folders/shader/flood fill.yy",},
{"name":"generator","order":19,"path":"folders/shader/generator.yy",},
{"name":"mask","order":45,"path":"folders/shader/mask.yy",},
{"name":"misc","order":50,"path":"folders/shader/misc.yy",},
{"name":"shape seperator","order":35,"path":"folders/shader/shape seperator.yy",},
{"name":"sprites","order":20,"path":"folders/shader/sprites.yy",},
{"name":"warp","order":41,"path":"folders/shader/warp.yy",},
@ -141,7 +143,7 @@
{"name":"node_time_remap","order":3,"path":"scripts/node_time_remap/node_time_remap.yy",},
{"name":"sh_perlin","order":1,"path":"shaders/sh_perlin/sh_perlin.yy",},
{"name":"node_tool","order":10,"path":"scripts/node_tool/node_tool.yy",},
{"name":"sh_find_pixel","order":46,"path":"shaders/sh_find_pixel/sh_find_pixel.yy",},
{"name":"sh_find_pixel","order":3,"path":"shaders/sh_find_pixel/sh_find_pixel.yy",},
{"name":"panel_preview_window","order":1,"path":"scripts/panel_preview_window/panel_preview_window.yy",},
{"name":"sh_scale3x","order":29,"path":"shaders/sh_scale3x/sh_scale3x.yy",},
{"name":"node_csv_file_write","order":13,"path":"scripts/node_csv_file_write/node_csv_file_write.yy",},
@ -231,7 +233,7 @@
{"name":"_3D","order":6,"path":"scripts/_3D/_3D.yy",},
{"name":"sh_corner_erode","order":48,"path":"shaders/sh_corner_erode/sh_corner_erode.yy",},
{"name":"node_outline","order":11,"path":"scripts/node_outline/node_outline.yy",},
{"name":"sh_mesh_generation","order":44,"path":"shaders/sh_mesh_generation/sh_mesh_generation.yy",},
{"name":"sh_mesh_generation","order":4,"path":"shaders/sh_mesh_generation/sh_mesh_generation.yy",},
{"name":"math_function","order":7,"path":"scripts/math_function/math_function.yy",},
{"name":"__point","order":4,"path":"scripts/__point/__point.yy",},
{"name":"scrollBox","order":13,"path":"scripts/scrollBox/scrollBox.yy",},
@ -586,6 +588,7 @@
{"name":"node_VFX_spawner","order":1,"path":"scripts/node_VFX_spawner/node_VFX_spawner.yy",},
{"name":"_draw_defines","order":21,"path":"scripts/_draw_defines/_draw_defines.yy",},
{"name":"sh_color_replace","order":8,"path":"shaders/sh_color_replace/sh_color_replace.yy",},
{"name":"__surface","order":8,"path":"scripts/__surface/__surface.yy",},
{"name":"rotator","order":11,"path":"scripts/rotator/rotator.yy",},
{"name":"s_node_edge_detect","order":20,"path":"sprites/s_node_edge_detect/s_node_edge_detect.yy",},
{"name":"node_fluid_add_collider","order":6,"path":"scripts/node_fluid_add_collider/node_fluid_add_collider.yy",},
@ -694,7 +697,6 @@
{"name":"sh_fd_turbulence","order":22,"path":"shaders/sh_fd_turbulence/sh_fd_turbulence.yy",},
{"name":"s_node_compare","order":1,"path":"sprites/s_node_compare/s_node_compare.yy",},
{"name":"s_node_fluidSim_domain_queue","order":9,"path":"sprites/s_node_fluidSim_domain_queue/s_node_fluidSim_domain_queue.yy",},
{"name":"sh_camera","order":43,"path":"shaders/sh_camera/sh_camera.yy",},
{"name":"s_node_vfx_spawn","order":2,"path":"sprites/s_node_vfx_spawn/s_node_vfx_spawn.yy",},
{"name":"texture_set_repeat","order":1,"path":"scripts/texture_set_repeat/texture_set_repeat.yy",},
{"name":"fd_rectangle_update_velocity","order":22,"path":"scripts/fd_rectangle_update_velocity/fd_rectangle_update_velocity.yy",},
@ -720,7 +722,7 @@
{"name":"s_node_fluidSim_vortex","order":8,"path":"sprites/s_node_fluidSim_vortex/s_node_fluidSim_vortex.yy",},
{"name":"string_hexadecimal","order":1,"path":"scripts/string_hexadecimal/string_hexadecimal.yy",},
{"name":"s_node_camera","order":3,"path":"sprites/s_node_camera/s_node_camera.yy",},
{"name":"sh_find_boundary","order":48,"path":"shaders/sh_find_boundary/sh_find_boundary.yy",},
{"name":"sh_find_boundary","order":2,"path":"shaders/sh_find_boundary/sh_find_boundary.yy",},
{"name":"_node_strand_affector","order":10,"path":"scripts/_node_strand_affector/_node_strand_affector.yy",},
{"name":"sh_vertex_pnt_light","order":4,"path":"shaders/sh_vertex_pnt_light/sh_vertex_pnt_light.yy",},
{"name":"surfaceBox","order":22,"path":"scripts/surfaceBox/surfaceBox.yy",},
@ -795,7 +797,7 @@
{"name":"steam_ugc_project","order":1,"path":"scripts/steam_ugc_project/steam_ugc_project.yy",},
{"name":"sh_fd_visualize_pixel_art_fire_glsl","order":15,"path":"shaders/sh_fd_visualize_pixel_art_fire_glsl/sh_fd_visualize_pixel_art_fire_glsl.yy",},
{"name":"struct_functions","order":4,"path":"scripts/struct_functions/struct_functions.yy",},
{"name":"sh_content_sampler","order":34,"path":"shaders/sh_content_sampler/sh_content_sampler.yy",},
{"name":"sh_content_sampler","order":1,"path":"shaders/sh_content_sampler/sh_content_sampler.yy",},
{"name":"fd_rectangle_get_repeat","order":19,"path":"scripts/fd_rectangle_get_repeat/fd_rectangle_get_repeat.yy",},
{"name":"s_menu_white","order":1,"path":"sprites/s_menu_white/s_menu_white.yy",},
{"name":"color_loader","order":13,"path":"scripts/color_loader/color_loader.yy",},

View file

@ -144,6 +144,7 @@
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"overlay","folderPath":"folders/panels/preview/overlay.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"sprites","folderPath":"folders/panels/preview/sprites.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"shader","folderPath":"folders/shader.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"_helper","folderPath":"folders/shader/_helper.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"3d","folderPath":"folders/shader/3d.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"blend","folderPath":"folders/shader/blend.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"blur","folderPath":"folders/shader/blur.yy",},
@ -154,6 +155,7 @@
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"flood fill","folderPath":"folders/shader/flood fill.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"generator","folderPath":"folders/shader/generator.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"mask","folderPath":"folders/shader/mask.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"misc","folderPath":"folders/shader/misc.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"shape seperator","folderPath":"folders/shader/shape seperator.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"sprites","folderPath":"folders/shader/sprites.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"warp","folderPath":"folders/shader/warp.yy",},
@ -278,6 +280,10 @@
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_noti_icon_warning_strip2.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_padding_link_strip2.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_panel_active_split.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_panel_animation.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_panel_graph.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_panel_inspector.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_panel_preview.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_paste.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_pin.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_play_all.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
@ -293,6 +299,7 @@
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_sequence_control_strip7.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_slider.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_sort_24.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_star.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_steam_creator.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_steam.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_strandSim.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
@ -644,7 +651,7 @@
{"id":{"name":"node_polygonal_shape","path":"scripts/node_polygonal_shape/node_polygonal_shape.yy",},},
{"id":{"name":"fd_rectangle_get_collision_mask_sprite","path":"scripts/fd_rectangle_get_collision_mask_sprite/fd_rectangle_get_collision_mask_sprite.yy",},},
{"id":{"name":"node_flip","path":"scripts/node_flip/node_flip.yy",},},
{"id":{"name":"shader_set_functions","path":"scripts/shader_set_functions/shader_set_functions.yy",},},
{"id":{"name":"shader_functions","path":"scripts/shader_functions/shader_functions.yy",},},
{"id":{"name":"node_gradient_points","path":"scripts/node_gradient_points/node_gradient_points.yy",},},
{"id":{"name":"_f_code","path":"fonts/_f_code/_f_code.yy",},},
{"id":{"name":"sh_combine_rgb","path":"shaders/sh_combine_rgb/sh_combine_rgb.yy",},},
@ -1041,6 +1048,7 @@
{"id":{"name":"s_node_equation","path":"sprites/s_node_equation/s_node_equation.yy",},},
{"id":{"name":"_draw_defines","path":"scripts/_draw_defines/_draw_defines.yy",},},
{"id":{"name":"sh_color_replace","path":"shaders/sh_color_replace/sh_color_replace.yy",},},
{"id":{"name":"__surface","path":"scripts/__surface/__surface.yy",},},
{"id":{"name":"rotator","path":"scripts/rotator/rotator.yy",},},
{"id":{"name":"s_node_edge_detect","path":"sprites/s_node_edge_detect/s_node_edge_detect.yy",},},
{"id":{"name":"node_fluid_add_collider","path":"scripts/node_fluid_add_collider/node_fluid_add_collider.yy",},},
@ -1443,6 +1451,7 @@
{"id":{"name":"buttonGradient","path":"scripts/buttonGradient/buttonGradient.yy",},},
{"id":{"name":"sh_draw_downsample","path":"shaders/sh_draw_downsample/sh_draw_downsample.yy",},},
{"id":{"name":"__view_get","path":"scripts/__view_get/__view_get.yy",},},
{"id":{"name":"sh_sample","path":"shaders/sh_sample/sh_sample.yy",},},
{"id":{"name":"s_node_texture_map","path":"sprites/s_node_texture_map/s_node_texture_map.yy",},},
{"id":{"name":"fd_rectangle_create","path":"scripts/fd_rectangle_create/fd_rectangle_create.yy",},},
{"id":{"name":"s_node_level_selector","path":"sprites/s_node_level_selector/s_node_level_selector.yy",},},

Binary file not shown.

View file

@ -878,6 +878,41 @@
"yorigin": 16,
"slice": null
},
"star": {
"path": "./icon/s_star.png",
"subimages": 1,
"xorigin": 16,
"yorigin": 16,
"slice": null
},
"panel_graph": {
"path": "./icon/s_panel_graph.png",
"subimages": 1,
"xorigin": 16,
"yorigin": 16,
"slice": null
},
"panel_preview": {
"path": "./icon/s_panel_preview.png",
"subimages": 1,
"xorigin": 16,
"yorigin": 16,
"slice": null
},
"panel_inspector": {
"path": "./icon/s_panel_inspector.png",
"subimages": 1,
"xorigin": 16,
"yorigin": 16,
"slice": null
},
"panel_animation": {
"path": "./icon/s_panel_animation.png",
"subimages": 1,
"xorigin": 16,
"yorigin": 16,
"slice": null
},
"inspector_area": {
"path": "./inspector/s_inspector_area_strip2.png",
"subimages": 2,

File diff suppressed because it is too large Load diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 348 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 458 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 254 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 411 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 453 B

View file

@ -21,10 +21,12 @@ event_inherited();
[ "Triangle grid", "Farini" ],
[ "Pixel sort", "Ciphrd" ],
[ "Simplex noise", "Ian McEwan" ],
[ "Additional help", "ChatGPT by OpenAI" ],
]
sc_thank = new scrollPane(dialog_w - ui(64), thank_h, function(_y, _m) {
var cx = (dialog_w - ui(64)) / 2;
var cx = sc_thank.surface_w / 2;
var _h = _y;
var yy = _y;
draw_clear_alpha(COLORS.dialog_about_bg, 0);

View file

@ -24,6 +24,24 @@ event_inherited();
anchor = ANCHOR.left | ANCHOR.top;
node_menu_selecting = noone;
function rightClick(node) {
node_menu_selecting = node;
var fav = array_exists(global.FAV_NODES, node.node);
var menu = [
menuItem(fav? "Remove from favorite" : "Add to favorite", function() {
if(array_exists(global.FAV_NODES, node_menu_selecting.node))
array_remove(global.FAV_NODES, node_menu_selecting.node);
else
array_push(global.FAV_NODES, node_menu_selecting.node);
}, THEME.star)
];
menuCall(,, menu);
}
function filtered(node) {
if(!node_show_connectable) return true;
if(node_called == noone && junction_hovering == noone) return true;
@ -72,8 +90,7 @@ event_inherited();
ADD_NODE_PAGE = pageIndex;
node_list = pageIndex == -1? noone : NODE_CATEGORY[| ADD_NODE_PAGE].list;
}
if(ADD_NODE_PAGE < 0)
ADD_NODE_PAGE = NODE_PAGE_DEFAULT;
ADD_NODE_PAGE = 0;
setPage(ADD_NODE_PAGE);
function buildNode(_node, _param = "") {
@ -242,10 +259,24 @@ event_inherited();
ds_list_add(_list, cat.list[| j]);
}
}
} else if(ADD_NODE_PAGE == 0) {
_list = ds_list_create();
for( var i = 0; i < array_length(global.FAV_NODES); i++ ) {
var _nodeIndex = global.FAV_NODES[i];
ds_list_add(_list, ALL_NODES[? _nodeIndex]);
}
}
var node_count = ds_list_size(_list);
if(ADD_NODE_PAGE == NODE_PAGE_DEFAULT && node_count == 0) {
draw_set_text(f_h3, fa_center, fa_bottom, COLORS._main_text_sub);
draw_text(content_pane.w / 2, content_pane.h / 2 - ui(8), "No favorites");
draw_set_text(f_p0, fa_center, fa_top, COLORS._main_text_sub);
draw_text(content_pane.w / 2, content_pane.h / 2 - ui(4), "Right click on a node and select 'Add to favorite'\nto add node to favorite panel.");
}
if(PREF_MAP[? "dialog_add_node_view"] == 0) { //grid
var grid_size = ui(64);
var grid_width = ui(80);
@ -293,6 +324,8 @@ event_inherited();
draw_sprite_stretched_ext(THEME.node_active, 0, _boxx, yy, grid_size, grid_size, COLORS._main_accent, 1);
if(mouse_press(mb_left, sFOCUS))
buildNode(_node);
else if(mouse_press(mb_right, sFOCUS))
rightClick(_node);
}
var spr_x = _boxx + grid_size / 2;
@ -313,6 +346,10 @@ event_inherited();
if(_node.new_node)
draw_sprite_ui_uniform(THEME.node_new_badge, 0, _boxx + grid_size - ui(12), yy + ui(6));
var fav = array_exists(global.FAV_NODES, _node.node);
if(fav)
draw_sprite_ui_uniform(THEME.star, 0, _boxx + grid_size - ui(10), yy + grid_size - ui(10), 0.7, COLORS._main_accent, 1.);
draw_set_text(f_p2, fa_center, fa_top, COLORS._main_text);
draw_text_ext_over(_boxx + grid_size / 2, yy + grid_size + 4, _node.name, -1, grid_width);
@ -377,9 +414,14 @@ event_inherited();
draw_sprite_stretched_ext(THEME.node_active, 0, ui(4), yy, list_width - ui(8), list_height, COLORS._main_accent, 1);
if(mouse_press(mb_left, sFOCUS))
buildNode(_node);
else if(mouse_press(mb_right, sFOCUS))
rightClick(_node);
}
var spr_x = list_height / 2 + ui(14);
var fav = array_exists(global.FAV_NODES, _node.node);
if(fav) draw_sprite_ui_uniform(THEME.star, 0, ui(20), yy + list_height / 2, 0.7, COLORS._main_accent, 1.);
var spr_x = list_height / 2 + ui(32);
var spr_y = yy + list_height / 2;
if(variable_struct_exists(_node, "getSpr")) _node.getSpr();
@ -388,7 +430,7 @@ event_inherited();
draw_sprite_ext(_node.spr, 0, spr_x, spr_y, ss, ss, 0, c_white, 1);
}
var tx = list_height + ui(20);
var tx = list_height + ui(40);
if(_node.new_node) {
draw_sprite_ui_uniform(THEME.node_new_badge, 0, tx + ui(16), yy + list_height / 2 + ui(1));
@ -396,14 +438,14 @@ event_inherited();
}
draw_set_text(f_p2, fa_left, fa_center, COLORS._main_text);
draw_text_over(tx, yy + list_height / 2, _node.name);
draw_text_add(tx, yy + list_height / 2, _node.name);
yy += list_height;
hh += list_height;
}
}
if(ADD_NODE_PAGE == -1)
if(ADD_NODE_PAGE < 1)
ds_list_destroy(_list);
return hh;
@ -556,6 +598,8 @@ event_inherited();
node_selecting = i;
if(mouse_press(mb_left, sFOCUS))
buildNode(_node, _param);
else if(struct_has(_node, "node") && mouse_press(mb_right, sFOCUS))
rightClick(_node);
}
if(node_selecting == i) {
@ -573,6 +617,9 @@ event_inherited();
} else
draw_sprite_ui_uniform(THEME.info, 0, _boxx + ui(8), yy + ui(8), 0.7, COLORS._main_icon, 0.5);
}
var fav = struct_has(_node, "node") && array_exists(global.FAV_NODES, _node.node);
if(fav)
draw_sprite_ui_uniform(THEME.star, 0, _boxx + grid_size - ui(10), yy + grid_size - ui(10), 0.7, COLORS._main_accent, 1.);
if(node_focusing == i)
search_pane.scroll_y_to = -max(0, hh - search_pane.h);
@ -616,7 +663,7 @@ event_inherited();
var _sox = sprite_get_xoffset(_node.spr);
var _soy = sprite_get_yoffset(_node.spr);
var _sx = list_height / 2 + ui(14);
var _sx = list_height / 2 + ui(32);
var _sy = yy + list_height / 2;
_sx += _sw * _ss / 2 - _sox * _ss;
_sy += _sh * _ss / 2 - _soy * _ss;
@ -624,8 +671,12 @@ event_inherited();
draw_sprite_ext(_node.spr, _si, _sx, _sy, _ss, _ss, 0, c_white, 1);
}
var fav = struct_has(_node, "node") && array_exists(global.FAV_NODES, _node.node);
if(fav) draw_sprite_ui_uniform(THEME.star, 0, ui(20), yy + list_height / 2, 0.7, COLORS._main_accent, 1.);
draw_set_text(f_p2, fa_left, fa_center, COLORS._main_text);
draw_text_over(list_height + ui(20), yy + list_height / 2, _node.name);
draw_text_add(list_height + ui(40), yy + list_height / 2, _node.name);
if(_hover && point_in_rectangle(_m[0], _m[1], 0, yy, list_width, yy + list_height - 1)) {
if(struct_has(_node, "tooltip") && _node.tooltip != "") {
@ -637,6 +688,8 @@ event_inherited();
node_selecting = i;
if(mouse_press(mb_left, sFOCUS))
buildNode(_node, _param);
else if(struct_has(_node, "node") && mouse_press(mb_right, sFOCUS))
rightClick(_node);
}
if(node_selecting == i) {

View file

@ -24,7 +24,7 @@ event_inherited();
for(var i = 0; i < ds_list_size(n.inputs); i++) {
var in = n.inputs[| i];
if(!in.animator.is_anim) continue;
if(!in.is_anim) continue;
for(var j = 0; j < ds_list_size(in.animator.values); j++) {
var t = in.animator.values[| j];
t.time = t.ratio * scale_to;

View file

@ -26,14 +26,14 @@
window_set_showborder(false);
__initLocale();
__init_theme();
__initTheme();
__initCollection();
__initAssets();
__initPresets();
__initFontFolder();
__initLua();
__init_node_data();
__init_nodes();
__initNodeData();
__initNodes();
__initSteamUGC();
PREF_LOAD();

View file

@ -14,7 +14,7 @@
"option_windows_description_info": "Pixel Composer",
"option_windows_disable_sandbox": true,
"option_windows_display_cursor": true,
"option_windows_display_name": "Pixel Composer 1.14.0",
"option_windows_display_name": "Pixel Composer 1.14.0pr2",
"option_windows_enable_steam": false,
"option_windows_executable_name": "PixelComposer.exe",
"option_windows_icon": "icons/icon.ico",
@ -33,6 +33,6 @@
"option_windows_steam_use_alternative_launcher": false,
"option_windows_texture_page": "2048x2048",
"option_windows_use_splash": false,
"option_windows_version": "1.14.0.0",
"option_windows_version": "1.14.0.2",
"option_windows_vsync": false,
}

View file

@ -0,0 +1,43 @@
function Surface(surface) constructor {
static set = function(surface) {
self.surface = surface;
w = surface_get_width(surface);
h = surface_get_height(surface);
format = surface_get_format(surface);
}
set(surface);
static get = function() { return surface; }
static isValid = function() { return is_surface(surface); }
static resize = function(w, h) {
surface_resize(surface, w, h);
self.w = w;
self.h = h;
return self;
}
static draw = function(x, y, xs = 1, ys = 1, rot = 0, col = c_white, alpha = 1) {
draw_surface_ext_safe(surface, x, y, xs, ys, rot, col, alpha);
return self;
}
static drawStretch = function(x, y, w = 1, h = 1, rot = 0, col = c_white, alpha = 1) {
draw_surface_stretched_ext(surface, x, y, w, h, col, alpha);
return self;
}
static destroy = function() {
if(!isValid()) return;
surface_free(surface);
}
}
function Surface_get(surface) {
if(is_real(surface))
return surface;
if(is_struct(surface) && struct_has(surface, "surface"))
return surface.surface;
return noone;
}

View file

@ -0,0 +1,11 @@
{
"resourceType": "GMScript",
"resourceVersion": "1.0",
"name": "__surface",
"isCompatibility": false,
"isDnD": false,
"parent": {
"name": "surface",
"path": "folders/functions/surface.yy",
},
}

View file

@ -33,6 +33,7 @@ function surface_apply_gaussian(surface, size, bg = false, bg_c = c_white, sampl
#endregion
BLEND_OVERRIDE;
gpu_set_tex_filter(true);
surface_set_target(__blur_hori);
draw_clear_alpha(bg_c, bg);
@ -60,6 +61,7 @@ function surface_apply_gaussian(surface, size, bg = false, bg_c = c_white, sampl
draw_surface_safe(__blur_hori, 0, 0);
shader_reset();
surface_reset_target();
gpu_set_tex_filter(false);
BLEND_NORMAL;
return __blur_vert;

View file

@ -33,7 +33,7 @@
globalvar VERSION, SAVEFILE_VERSION, VERSION_STRING;
VERSION = 1140;
SAVEFILE_VERSION = 1400;
VERSION_STRING = "1.14.0";
VERSION_STRING = "1.14.0pr1";
globalvar NODES, NODE_MAP, APPEND_MAP, HOTKEYS, HOTKEY_CONTEXT, NODE_INSTANCES;

View file

@ -16,11 +16,11 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover, _focus, _scr
var butx = xx;
if(jun.connect_type == JUNCTION_CONNECT.input && jun.isAnimable() && !jun.global_use && !global_var) {
var index = jun.value_from == noone? jun.animator.is_anim : 2;
var index = jun.value_from == noone? jun.is_anim : 2;
draw_sprite_ui_uniform(THEME.animate_clock, index, butx, lb_y, 1,, 0.8);
if(_hover && point_in_circle(_m[0], _m[1], butx, lb_y, ui(10))) {
if(anim_hold != noone)
jun.animator.is_anim = anim_hold;
jun.setAnim(anim_hold);
draw_sprite_ui_uniform(THEME.animate_clock, index, butx, lb_y, 1,, 1);
TOOLTIP = jun.value_from == noone? get_text("panel_inspector_toggle_anim", "Toggle animation") : get_text("panel_inspector_remove_link", "Remove link");
@ -29,9 +29,9 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover, _focus, _scr
if(jun.value_from != noone)
jun.removeFrom();
else {
recordAction(ACTION_TYPE.var_modify, jun.animator, [ jun.animator.is_anim, "is_anim", jun.name + " animation" ]);
jun.animator.is_anim = !jun.animator.is_anim;
anim_hold = jun.animator.is_anim;
recordAction(ACTION_TYPE.var_modify, jun.animator, [ jun.is_anim, "is_anim", jun.name + " animation" ]);
jun.setAnim(!jun.is_anim);
anim_hold = jun.is_anim;
}
PANEL_ANIMATION.updatePropertyList();
}
@ -92,7 +92,7 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover, _focus, _scr
#endregion
#region anim
if(jun.connect_type == JUNCTION_CONNECT.input && lineBreak && jun.animator.is_anim && !global_var) {
if(jun.connect_type == JUNCTION_CONNECT.input && lineBreak && jun.is_anim && !global_var) {
var bx = xx + ww - ui(12);
var by = lb_y;
if(buttonInstant(THEME.button_hide, bx - ui(12), by - ui(12), ui(24), ui(24), _m, _focus, _hover, "", THEME.prop_keyframe, 2) == 2) {
@ -160,7 +160,7 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover, _focus, _scr
#endregion
#region use global
if(jun.connect_type == JUNCTION_CONNECT.input && lineBreak && !jun.animator.is_anim && !global_var) {
if(jun.connect_type == JUNCTION_CONNECT.input && lineBreak && !jun.is_anim && !global_var) {
var bx = xx + ww - ui(12);
var by = lb_y;
var ic_b = jun.global_use? c_white : COLORS._main_icon;

View file

@ -16,6 +16,7 @@ function Node_9Slice(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
attribute_surface_depth();
attribute_interpolation();
drag_side = -1;
drag_mx = 0;
@ -118,10 +119,8 @@ function Node_9Slice(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
if(!surface_exists(_inSurf)) return;
_outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth());
surface_set_target(_outSurf);
DRAW_CLEAR
BLEND_OVERRIDE;
surface_set_shader(_outSurf);
shader_set_interpolation(_inSurf);
var ww = _dim[0];
var hh = _dim[1];
var in_w = surface_get_width(_inSurf);
@ -179,9 +178,7 @@ function Node_9Slice(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
_x += cw;
}
}
BLEND_NORMAL;
surface_reset_target();
surface_reset_shader();
return _outSurf;
}

View file

@ -99,7 +99,7 @@ function Node_ASE_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const
draw_sprite_stretched_ext(THEME.ui_panel_bg, 1, _x, by, _w, _h, COLORS.node_composite_bg_blend, 1);
var index = inputs[| 2].value_from == noone? inputs[| 2].animator.is_anim : 2;
var index = inputs[| 2].value_from == noone? inputs[| 2].is_anim : 2;
draw_sprite_ui_uniform(THEME.animate_clock, index, abx, lb_y, 1,, 0.8);
if(_hover && point_in_circle(_m[0], _m[1], abx, lb_y, ui(10))) {
draw_sprite_ui_uniform(THEME.animate_clock, index, abx, lb_y, 1,, 1);
@ -109,7 +109,7 @@ function Node_ASE_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const
if(inputs[| 2].value_from != noone)
inputs[| 2].removeFrom();
else
inputs[| 2].animator.is_anim = !inputs[| 2].animator.is_anim;
inputs[| 2].setAnim(!inputs[| 2].is_anim);
PANEL_ANIMATION.updatePropertyList();
}
}

View file

@ -35,25 +35,22 @@ function Node_Bevel(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
input_display_list = [ 7,
["Surface", true], 0, 8, 5, 6,
["Surface", true], 0, 5, 6,
["Bevel", false], 4, 1,
["Transform", false], 2, 3,
];
attribute_surface_depth();
attribute_oversample();
static process_data = function(_outSurf, _data, _output_index, _array_index) {
var _hei = _data[1];
var _shf = _data[2];
var _sca = _data[3];
var _slp = _data[4];
var _sam = _data[8];
var _sam = ds_map_try_get(attributes, "oversample");
surface_set_target(_outSurf);
DRAW_CLEAR
BLEND_OVERRIDE;
shader_set(shader);
surface_set_shader(_outSurf, shader);
shader_set_uniform_f(uniform_hei, _hei);
shader_set_uniform_f_array_safe(uniform_shf, _shf);
shader_set_uniform_f_array_safe(uniform_sca, _sca);
@ -62,10 +59,7 @@ function Node_Bevel(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
shader_set_uniform_i(uniform_sam, _sam);
draw_surface_safe(_data[0], 0, 0);
shader_reset();
BLEND_NORMAL;
surface_reset_target();
surface_reset_shader();
_outSurf = mask_apply(_data[0], _outSurf, _data[5], _data[6]);

View file

@ -23,16 +23,17 @@ function Node_Blur(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
input_display_list = [ 7,
["Surface", true], 0, 2, 5, 6,
["Surface", true], 0, 5, 6,
["Blur", false], 1, 3, 4,
];
attribute_surface_depth();
attribute_oversample();
surface_blur_init();
static process_data = function(_outSurf, _data, _output_index, _array_index) {
var _size = _data[1];
var _clamp = _data[2];
var _clamp = ds_map_try_get(attributes, "oversample");
var _isovr = _data[3];
var _mask = _data[5];
var _mix = _data[6];

View file

@ -30,11 +30,12 @@ function Node_Blur_Radial(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
input_display_list = [ 6,
["Surface", true], 0, 3, 4, 5,
["Surface", true], 0, 4, 5,
["Blur", false], 1, 2,
];
attribute_surface_depth();
attribute_oversample();
static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) {
var pos = inputs[| 2].getValue();
@ -48,7 +49,7 @@ function Node_Blur_Radial(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
static process_data = function(_outSurf, _data, _output_index, _array_index) {
var _str = _data[1];
var _cen = _data[2];
var _sam = _data[3];
var _sam = ds_map_try_get(attributes, "oversample");
var _mask = _data[4];
var _mix = _data[5];
_cen[0] /= surface_get_width(_outSurf);

View file

@ -33,18 +33,19 @@ function Node_Blur_Simple(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
active_index = 8;
input_display_list = [ 8,
["Surface", true], 0, 2, 6, 7,
["Surface", true], 0, 6, 7,
["Blur", false], 1, 3, 4, 5,
];
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
attribute_surface_depth();
attribute_oversample();
static process_data = function(_outSurf, _data, _output_index, _array_index) {
if(!is_surface(_data[0])) return _outSurf;
var _size = _data[1];
var _samp = _data[2];
var _samp = ds_map_try_get(attributes, "oversample");
var _mask = _data[3];
var _isovr = _data[4];
var _overc = _data[5];

View file

@ -37,11 +37,12 @@ function Node_Blur_Zoom(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
input_display_list = [ 8,
["Surface", true], 0, 3, 6, 7,
["Surface", true], 0, 6, 7,
["Blur", false], 1, 2, 4, 5
];
attribute_surface_depth();
attribute_oversample();
static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) {
var pos = inputs[| 2].getValue();
@ -55,7 +56,7 @@ function Node_Blur_Zoom(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
static process_data = function(_outSurf, _data, _output_index, _array_index) {
var _str = _data[1];
var _cen = _data[2];
var _sam = _data[3];
var _sam = ds_map_try_get(attributes, "oversample");
var _blr = _data[4];
var _msk = _data[5];
var _mask = _data[6];

View file

@ -28,12 +28,13 @@ function Node_Camera(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
input_display_list = [
["Surface", true], 0, 3, 4,
["Surface", true], 0, 4,
["Camera", false], 1, 2,
["Elements", true],
];
attribute_surface_depth();
attribute_oversample();
input_display_len = array_length(input_display_list);
input_fix_len = ds_list_size(inputs);
@ -119,7 +120,7 @@ function Node_Camera(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
if(!is_surface(_data[0])) return;
var _area = _data[1];
var _zoom = _data[2];
var _samp = _data[3];
var _samp = ds_map_try_get(attributes, "oversample");
var _fix = _data[4];
var cDep = attrDepth();

View file

@ -21,6 +21,7 @@ function Node_Chromatic_Aberration(_x, _y, _group = noone) : Node_Processor(_x,
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
attribute_surface_depth();
attribute_interpolation();
static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) {
var pos = inputs[| 1].getValue();
@ -31,22 +32,16 @@ function Node_Chromatic_Aberration(_x, _y, _group = noone) : Node_Processor(_x,
}
static process_data = function(_outSurf, _data, _output_index, _array_index) {
surface_set_target(_outSurf);
DRAW_CLEAR
BLEND_OVERRIDE;
var center = _data[1];
var stren = _data[2];
shader_set(shader);
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_cen, center);
shader_set_uniform_f(uniform_str, stren);
draw_surface_safe(_data[0], 0, 0);
shader_reset();
BLEND_NORMAL;
surface_reset_target();
surface_reset_shader();
return _outSurf;
}

View file

@ -31,6 +31,7 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
.setVisible(false);
attribute_surface_depth();
attribute_interpolation();
input_fix_len = ds_list_size(inputs);
data_length = 4;
@ -748,9 +749,8 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
var imageAmo = (ds_list_size(inputs) - input_fix_len) / data_length;
var _vis = attributes[? "layer_visible"];
surface_set_target(_outSurf);
DRAW_CLEAR
BLEND_ALPHA_MULP;
surface_set_shader(_outSurf, sh_sample, true, BLEND.alphamulp);
for(var i = 0; i < imageAmo; i++) {
var vis = _vis[| i];
if(!vis) continue;
@ -773,10 +773,10 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
var _d0 = point_rotate(cx - _sw / 2, cy - _sh / 2, cx, cy, _rot);
shader_set_interpolation(_s);
draw_surface_ext_safe(_s, _d0[0], _d0[1], _sca[0], _sca[1], _rot);
}
BLEND_NORMAL;
surface_reset_target();
surface_reset_shader();
return _outSurf;
}

View file

@ -25,15 +25,16 @@ function Node_Convolution(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
input_display_list = [ 5,
["Surface", true], 0, 2, 3, 4,
["Surface", true], 0, 3, 4,
["Kernel", false], 1,
];
attribute_surface_depth();
attribute_oversample();
static process_data = function(_outSurf, _data, _output_index, _array_index) {
var _ker = _data[1];
var _sam = _data[2];
var _sam = ds_map_try_get(attributes, "oversample");
surface_set_target(_outSurf);
DRAW_CLEAR

View file

@ -33,11 +33,13 @@ function Node_Dilate(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
input_display_list = [ 7,
["Surface", true], 0, 4, 5, 6,
["Surface", true], 0, 5, 6,
["Dilate", false], 1, 2, 3,
];
attribute_surface_depth();
attribute_oversample();
attribute_interpolation();
static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) {
var pos = inputs[| 1].getValue();
@ -49,26 +51,21 @@ function Node_Dilate(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
}
static process_data = function(_outSurf, _data, _output_index, _array_index) {
surface_set_target(_outSurf);
DRAW_CLEAR
BLEND_OVERRIDE;
var center = _data[1];
var stren = _data[2];
var rad = _data[3];
var sam = _data[4];
var sam = ds_map_try_get(attributes, "oversample");
shader_set(shader);
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_cen, center);
shader_set_uniform_f(uniform_str, stren);
shader_set_uniform_f(uniform_rad, rad);
shader_set_uniform_i(uniform_sam, sam);
draw_surface_safe(_data[0], 0, 0);
shader_reset();
BLEND_NORMAL;
surface_reset_target();
surface_reset_shader();
_outSurf = mask_apply(_data[0], _outSurf, _data[5], _data[6]);

View file

@ -46,7 +46,7 @@ If set, then strength value control how many times the effect applies on itself.
active_index = 10;
input_display_list = [ 10,
["Surface", true], 0, 7, 8, 9,
["Surface", true], 0, 8, 9,
["Displace", false], 1, 3, 4,
["Color", false], 5, 2,
["Algorithm", true], 6
@ -55,6 +55,8 @@ If set, then strength value control how many times the effect applies on itself.
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
attribute_surface_depth();
attribute_oversample();
attribute_interpolation();
static process_data = function(_outSurf, _data, _output_index, _array_index) {
switch(_data[5]) {
@ -71,11 +73,8 @@ If set, then strength value control how many times the effect applies on itself.
var mw = surface_get_width(_data[1]);
var mh = surface_get_height(_data[1]);
surface_set_target(_outSurf);
DRAW_CLEAR
BLEND_OVERRIDE;
shader_set(shader);
surface_set_shader(_outSurf, shader);
shader_set_interpolation(_data[0]);
texture_set_stage(displace_map_sample, surface_get_texture(_data[1]));
shader_set_uniform_f_array_safe(uniform_dim, [ww, hh]);
shader_set_uniform_f_array_safe(uniform_map_dim, [mw, mh]);
@ -84,12 +83,9 @@ If set, then strength value control how many times the effect applies on itself.
shader_set_uniform_f(uniform_mid, _data[4]);
shader_set_uniform_i(uniform_rg, _data[5]);
shader_set_uniform_i(uniform_it, _data[6]);
shader_set_uniform_i(uniform_sam, _data[7]);
shader_set_uniform_i(uniform_sam, ds_map_try_get(attributes, "oversample"));
draw_surface_safe(_data[0], 0, 0);
shader_reset();
BLEND_NORMAL;
surface_reset_target();
surface_reset_shader();
_outSurf = mask_apply(_data[0], _outSurf, _data[8], _data[9]);

View file

@ -25,15 +25,16 @@ function Node_Edge_Detect(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
input_display_list = [ 5,
["Surface", true], 0, 2, 3, 4,
["Surface", true], 0, 3, 4,
["Edge detect", false], 1,
];
attribute_surface_depth();
attribute_oversample();
static process_data = function(_outSurf, _data, _output_index, _array_index) {
var ft = _data[1];
var ov = _data[2];
var ov = ds_map_try_get(attributes, "oversample");
surface_set_target(_outSurf);
DRAW_CLEAR

View file

@ -49,10 +49,10 @@ function __generate_node_data() {
game_end();
}
function __init_node_data() {
function __initNodeData() {
global.NODE_GUIDE = {};
var dir = DIRECTORY + "Nodes/";
var dir = DIRECTORY + "Nodes/Guides";
if(!directory_exists(dir))
directory_create(dir);

View file

@ -60,14 +60,15 @@ function valueKey(_time, _value, _anim = noone, _in = 0, _ot = 0) constructor {
}
}
function valueAnimator(_val, _prop) constructor {
function valueAnimator(_val, _prop, _sep_axis = false) constructor {
suffix = "";
values = ds_list_create();
show_graph = false;
sep_axis = _sep_axis;
ds_list_add(values, new valueKey(0, _val, self));
//print(_prop.name + ": " + string(_val));
is_anim = false;
index = 0;
prop = _prop;
dopesheet_y = 0;
static interpolate = function(from, to, rat) {
@ -122,19 +123,24 @@ function valueAnimator(_val, _prop) constructor {
return processType(lerp(from.value, to.value, _lrp));
}
static getName = function() { return prop.name + suffix; }
static getValue = function(_time = ANIMATOR.current_frame) {
if(ds_list_size(values) == 0) return processTypeDefault();
if(ds_list_size(values) == 1) return processType(values[| 0].value);
if(ds_list_size(values) == 1) {
//if(prop.name == "Position") print(values[| 0].value);
return processType(values[| 0].value);
}
if(prop.display_type == VALUE_DISPLAY.gradient) return values[| 0].value;
if(prop.type == VALUE_TYPE.path) return processType(values[| 0].value);
if(!is_anim) return processType(values[| 0].value);
if(!prop.is_anim) return processType(values[| 0].value);
var _time_first = values[| 0].time;
var _time_last = values[| ds_list_size(values) - 1].time;
var _time_dura = _time_last - _time_first;
if(_time > _time_last) {
if(_time > _time_last) { //loop
switch(prop.on_end) {
case KEYFRAME_END.loop :
_time = _time_first + safe_mod(_time - _time_last, _time_dura + 1);
@ -193,12 +199,12 @@ function valueAnimator(_val, _prop) constructor {
}
static processTypeDefault = function() {
if(typeArray(prop.display_type)) return [];
if(!sep_axis && typeArray(prop.display_type)) return [];
return 0;
}
static processType = function(_val) {
if(typeArray(prop.display_type) && is_array(_val)) {
if(!sep_axis && typeArray(prop.display_type) && is_array(_val)) {
for(var i = 0; i < array_length(_val); i++)
_val[i] = processValue(_val[i]);
return _val;
@ -254,7 +260,7 @@ function valueAnimator(_val, _prop) constructor {
}
static setValue = function(_val = 0, _record = true, _time = ANIMATOR.current_frame, ease_in = 0, ease_out = 0) {
if(!is_anim) {
if(!prop.is_anim) {
if(isEqual(values[| 0].value, _val))
return false;
@ -297,7 +303,7 @@ function valueAnimator(_val, _prop) constructor {
if(ds_list_size(values) > 1)
ds_list_remove(values, key);
else
is_anim = false;
prop.is_anim = false;
}
static serialize = function(scale = false) {
@ -316,7 +322,7 @@ function valueAnimator(_val, _prop) constructor {
_value_list[| 1] = json_stringify(val);
else if(is_struct(val))
_value_list[| 1] = val.serialize();
else if(typeArray(prop.display_type) && is_array(val)) {
else if(!sep_axis && typeArray(prop.display_type) && is_array(val)) {
var __v = ds_list_create();
for(var j = 0; j < array_length(val); j++) {
if(is_struct(val[j]) && struct_has(val[j], "serialize"))
@ -375,12 +381,8 @@ function valueAnimator(_val, _prop) constructor {
_time = round(_time * (ANIMATOR.frames_total - 1));
var value = ds_list_get(_keyframe, 1);
var ease_in = ds_list_get(_keyframe, 2);
var ease_out = ds_list_get(_keyframe, 3);
if(LOADING_VERSION >= 1090) {
ease_in = array_create_from_list(ease_in);
ease_out = array_create_from_list(ease_out);
}
var ease_in = array_create_from_list(ds_list_get(_keyframe, 2));
var ease_out = array_create_from_list(ds_list_get(_keyframe, 3));
var ease_in_type = ds_list_get(_keyframe, 4, CURVE_TYPE.bezier);
var ease_out_type = ds_list_get(_keyframe, 5, CURVE_TYPE.bezier);
@ -394,7 +396,7 @@ function valueAnimator(_val, _prop) constructor {
} else if(prop.type == VALUE_TYPE.color && prop.display_type == VALUE_DISPLAY.gradient) {
var grad = new gradientObject();
_val = grad.deserialize(value);
} else if(typeArray(prop.display_type)) {
} else if(!sep_axis && typeArray(prop.display_type)) {
_val = [];
if(ds_exists(value, ds_type_list)) {

View file

@ -33,16 +33,17 @@ function Node_Local_Analyze(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
input_display_list = [ 7,
["Surface", true], 0, 3, 5, 6,
["Surface", true], 0, 5, 6,
["Effect", false], 1, 2, 4,
];
attribute_surface_depth();
attribute_oversample();
static process_data = function(_outSurf, _data, _output_index, _array_index) {
var _alg = _data[1];
var _siz = _data[2];
var _sam = _data[3];
var _sam = ds_map_try_get(attributes, "oversample");
var _shp = _data[4];
surface_set_target(_outSurf);

View file

@ -30,12 +30,13 @@ function Node_Noise_Hex(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
input_display_list = [
["Output", false], 0,
["Noise", false], 1, 2, 3,
["Texture", false], 4, 5
["Texture", false], 4
];
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
attribute_surface_depth();
attribute_oversample();
static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) {
inputs[| 2].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny);
@ -47,7 +48,7 @@ function Node_Noise_Hex(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
var _pos = _data[2];
var _sca = _data[3];
var _sam = _data[4];
var _samTyp = _data[5];
var _samTyp = ds_map_try_get(attributes, "oversample");
_outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth());

View file

@ -30,12 +30,13 @@ function Node_Noise_Tri(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
input_display_list = [
["Output", false], 0,
["Noise", false], 1, 2, 3,
["Texture", false], 4, 5,
["Texture", false], 4,
];
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
attribute_surface_depth();
attribute_oversample();
static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) {
inputs[| 2].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny);
@ -47,7 +48,7 @@ function Node_Noise_Tri(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
var _pos = _data[2];
var _sca = _data[3];
var _sam = _data[4];
var _samTyp = _data[5];
var _samTyp = ds_map_try_get(attributes, "oversample");
_outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth());

View file

@ -27,20 +27,13 @@ function Node_Normal(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
var _hei = _data[1];
var _smt = _data[2];
surface_set_target(_outSurf);
DRAW_CLEAR
BLEND_OVERRIDE;
shader_set(sh_normal);
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]) ]);
draw_surface_safe(_data[0], 0, 0);
shader_reset();
BLEND_NORMAL;
surface_reset_target();
surface_reset_shader();
return _outSurf;
}

View file

@ -1,15 +1,16 @@
function Node_Normal_Light(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
name = "Normal Light";
uniform_map = shader_get_sampler_index(sh_normal_light, "normalMap");
uniform_hei = shader_get_uniform(sh_normal_light, "normalHeight");
uniform_dim = shader_get_uniform(sh_normal_light, "dimension");
shader = sh_normal_light;
uniform_map = shader_get_sampler_index(shader, "normalMap");
uniform_hei = shader_get_uniform(shader, "normalHeight");
uniform_dim = shader_get_uniform(shader, "dimension");
uniform_amb = shader_get_uniform(sh_normal_light, "ambiance");
uniform_light_pos = shader_get_uniform(sh_normal_light, "lightPosition");
uniform_light_col = shader_get_uniform(sh_normal_light, "lightColor");
uniform_light_int = shader_get_uniform(sh_normal_light, "lightIntensity");
uniform_light_typ = shader_get_uniform(sh_normal_light, "lightType");
uniform_amb = shader_get_uniform(shader, "ambiance");
uniform_light_pos = shader_get_uniform(shader, "lightPosition");
uniform_light_col = shader_get_uniform(shader, "lightColor");
uniform_light_int = shader_get_uniform(shader, "lightIntensity");
uniform_light_typ = shader_get_uniform(shader, "lightType");
inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
@ -64,11 +65,8 @@ function Node_Normal_Light(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
var _light_col = _data[7];
var _light_typ = _data[8];
surface_set_target(_outSurf);
DRAW_CLEAR
BLEND_OVERRIDE;
surface_set_shader(_outSurf, shader);
shader_set(sh_normal_light);
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]) ]);
@ -80,10 +78,7 @@ function Node_Normal_Light(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
shader_set_uniform_i(uniform_light_typ, _light_typ);
draw_surface_safe(_data[0], 0, 0);
shader_reset();
BLEND_NORMAL;
surface_reset_target();
surface_reset_shader();
return _outSurf;
}

View file

@ -49,11 +49,12 @@ function Node_Outline(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
input_display_list = [ 11,
["Surface", true], 0, 9, 10,
["Outline", false], 1, 5, 7, 8,
["Outline", false], 1, 5, 8,
["Render", false], 2, 3, 4, 6,
];
attribute_surface_depth();
attribute_oversample();
static process_data = function(_outSurf, _data, _output_index, _array_index) {
var ww = surface_get_width(_data[0]);
@ -65,7 +66,7 @@ function Node_Outline(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
var alpha = _data[4];
var side = _data[5];
var aa = _data[6];
var sam = _data[7];
var sam = ds_map_try_get(attributes, "oversample");
var bst = _data[8];
surface_set_target(_outSurf);

View file

@ -18,18 +18,13 @@ function Node_Polar(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
]
attribute_surface_depth();
attribute_interpolation();
static process_data = function(_outSurf, _data, _output_index, _array_index) {
surface_set_target(_outSurf);
DRAW_CLEAR
BLEND_OVERRIDE;
shader_set(sh_polar);
surface_set_shader(_outSurf, sh_polar);
shader_set_interpolation(_data[0]);
draw_surface_safe(_data[0], 0, 0);
shader_reset();
BLEND_NORMAL;
surface_reset_target();
surface_reset_shader();
_outSurf = mask_apply(_data[0], _outSurf, _data[1], _data[2]);

View file

@ -21,7 +21,7 @@ function Node_Processor(_x, _y, _group = noone) : Node(_x, _y, _group) construct
array_push(attributeEditors, "Array processor");
array_push(attributeEditors, [ "Array process type", "array_process",
new scrollBox([ "Loop", "Hold", "Expand", "Expand inverse" ], function(val) { attributes[? "array_process"] = val; } ) ]);
new scrollBox([ "Loop", "Hold", "Expand", "Expand inverse" ], function(val) { attributes[? "array_process"] = val; }, false) ]);
static process_data = function(_outSurf, _data, _output_index, _array_index = 0) { return _outSurf; }
@ -97,7 +97,8 @@ function Node_Processor(_x, _y, _group = noone) : Node(_x, _y, _group) construct
return inputs_data[0]
}
return process_data(_out, inputs_data, outIndex, 0);
var data = process_data(_out, inputs_data, outIndex, 0); /// Process data
return data;
}
if(outputs[| outIndex].type == VALUE_TYPE.d3object) { //passing 3D vertex call
@ -160,8 +161,9 @@ function Node_Processor(_x, _y, _group = noone) : Node(_x, _y, _group) construct
_out[l] = surface_clone(_data[0], _out[l]);
else
_out[l] = _data[0];
} else
_out[l] = process_data(_out[l], _data, outIndex, l);
} else {
_out[l] = process_data(_out[l], _data, outIndex, l); /// Process data
}
}
return _out;

View file

@ -74,7 +74,12 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor {
ds_list_add(NODE_CATEGORY, { name: name, list: list, filter: filter });
}
function __init_nodes() {
function __initNodes() {
var path = DIRECTORY + "Nodes/fav.json";
global.FAV_NODES = [];
if(file_exists(path))
global.FAV_NODES = json_load_struct(path);
var group = ds_list_create();
addNodeCatagory("Group", group, ["Node_Group"]);
ds_list_add(group, "Groups");
@ -186,9 +191,13 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor {
addNodeObject(strandSim, "Strand Length Adjust", s_node_strandSim_length, "Node_Strand_Length_Adjust", [1, Node_Strand_Length_Adjust]).setVersion(1140);
addNodeObject(strandSim, "Strand Collision", s_node_strandSim_collide, "Node_Strand_Collision", [1, Node_Strand_Collision]).setVersion(1140);
var input = ds_list_create();
NODE_PAGE_DEFAULT = ds_list_size(NODE_CATEGORY);
ADD_NODE_PAGE = NODE_PAGE_DEFAULT;
var fav = ds_list_create();
addNodeCatagory("Favourites", fav);
var input = ds_list_create();
addNodeCatagory("IO", input);
ds_list_add(input, "Images");
addNodeObject(input, "Canvas", s_node_canvas, "Node_Canvas", [1, Node_Canvas], ["draw"], "Draw on surface using brush, eraser, etc.")
@ -528,6 +537,7 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor {
addNodeObject(hid, "Grid Noise", s_node_grid_noise, "Node_Grid_Noise", [1, Node_Grid_Noise]);
addNodeObject(hid, "Triangular Noise", s_node_grid_tri_noise, "Node_Noise_Tri", [1, Node_Noise_Tri]).setVersion(1090);
addNodeObject(hid, "Hexagonal Noise", s_node_grid_hex_noise, "Node_Noise_Hex", [1, Node_Noise_Hex]).setVersion(1090);
}
#endregion
@ -580,7 +590,9 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor {
PANEL_GRAPH.node_focus = node;
PANEL_GRAPH.fullView();
}
#endregion
#region attribute
global.SURFACE_FORMAT = [
surface_rgba4unorm,
surface_rgba8unorm,
@ -601,18 +613,53 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor {
"32 bit Greyscale"
];
global.SURFACE_INTERPOLATION = [
"No aliasing",
"Linear",
"Bicubic",
"radSin"
];
global.SURFACE_OVERSAMPLE = [
"Empty",
"Clamp",
"Repeat"
];
global.SURFACE_FORMAT_NAME_PROCESS = [ "Input" ];
global.SURFACE_FORMAT_NAME_PROCESS = array_append(global.SURFACE_FORMAT_NAME_PROCESS, global.SURFACE_FORMAT_NAME);
function attribute_surface_depth() {
function attribute_surface_depth(label = true) {
attributes[? "color_depth"] = inputs[| 0].type == VALUE_TYPE.surface? 0 : 1;
depth_array = inputs[| 0].type == VALUE_TYPE.surface? global.SURFACE_FORMAT_NAME_PROCESS : global.SURFACE_FORMAT_NAME;
array_push(attributeEditors, "Surface");
if(label) array_push(attributeEditors, "Surface");
array_push(attributeEditors, ["Color depth", "color_depth",
new scrollBox(depth_array, function(val) {
attributes[? "color_depth"] = val;
triggerRender();
}, false)]);
}
function attribute_interpolation(label = false) {
attributes[? "interpolation"] = 0;
if(label) array_push(attributeEditors, "Surface");
array_push(attributeEditors, ["Texture interpolation", "interpolation",
new scrollBox(global.SURFACE_INTERPOLATION, function(val) {
attributes[? "interpolation"] = val;
triggerRender();
}, false)]);
}
function attribute_oversample(label = false) {
attributes[? "oversample"] = 0;
if(label) array_push(attributeEditors, "Surface");
array_push(attributeEditors, ["Oversample", "oversample",
new scrollBox(global.SURFACE_OVERSAMPLE, function(val) {
attributes[? "oversample"] = val;
triggerRender();
}, false)]);
}
#endregion

View file

@ -24,6 +24,7 @@ function Node_Scale(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
];
attribute_surface_depth();
attribute_interpolation();
static process_data = function(_outSurf, _data, _output_index, _array_index) {
var scale = _data[1];
@ -48,12 +49,10 @@ function Node_Scale(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
_outSurf = surface_verify(_outSurf, ww, hh, cDep);
surface_set_target(_outSurf);
DRAW_CLEAR
BLEND_OVERRIDE;
surface_set_shader(_outSurf);
shader_set_interpolation(_data[0]);
draw_surface_stretched_safe(_data[0], 0, 0, ww, hh);
BLEND_NORMAL;
surface_reset_target();
surface_reset_shader();
return _outSurf;
}

View file

@ -34,13 +34,15 @@ function Node_Skew(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
active_index = 8;
input_display_list = [ 8,
["Surface", true], 0, 5, 6, 7,
["Surface", true], 0, 6, 7,
["Skew", false], 1, 2, 4,
]
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
attribute_surface_depth();
attribute_oversample();
attribute_interpolation();
static centerAnchor = function() {
if(!is_surface(current_data[0])) return;
@ -59,23 +61,17 @@ function Node_Skew(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
var _amou = _data[2];
//var _wrap = _data[3];
var _cent = _data[4];
var _samp = _data[5];
var _samp = ds_map_try_get(attributes, "oversample");
surface_set_target(_outSurf);
DRAW_CLEAR
BLEND_OVERRIDE;
shader_set(shader);
surface_set_shader(_outSurf, shader);
shader_set_interpolation(_data[0]);
shader_set_uniform_f(uniform_dim, surface_get_width(_data[0]), surface_get_height(_data[0]));
shader_set_uniform_f(uniform_cen, _cent[0], _cent[1]);
shader_set_uniform_i(uniform_axs, _axis);
shader_set_uniform_f(uniform_amo, _amou);
shader_set_uniform_i(uniform_sam, _samp);
draw_surface_safe(_data[0], 0, 0);
shader_reset();
BLEND_NORMAL;
surface_reset_target();
surface_reset_shader();
_outSurf = mask_apply(_data[0], _outSurf, _data[6], _data[7]);

View file

@ -47,11 +47,11 @@ function Node_Struct(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
static onValueUpdate = function(index = 0) {
if(LOADING || APPENDING) return;
if(safe_mod(index - input_fix_len, data_length) == 0) { //Variable name
inputs[| index + 1].name = inputs[| index].getValue() + " value";
}
refreshDynamicInput();
if(index < 0) return;
if(safe_mod(index - input_fix_len, data_length) == 0)
inputs[| index + 1].name = inputs[| index].getValue() + " value";
}
function step() {
@ -69,6 +69,9 @@ function Node_Struct(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
var key = inputs[| i + 0].getValue();
var val = inputs[| i + 1].getValue();
if(inputs[| i + 1].type == VALUE_TYPE.surface)
str[$ key] = new Surface(val);
else
str[$ key] = val;
}

View file

@ -31,9 +31,13 @@ function Node_Struct_Get(_x, _y, _group = noone) : Node(_x, _y, _group) construc
var val = variable_struct_get(_str, k);
if(j == array_length(keys) - 1) {
if(is_struct(val))
if(is_struct(val)) {
if(instanceof(val) == "Surface") {
out.type = VALUE_TYPE.surface;
val = val.get();
} else
out.type = VALUE_TYPE.struct;
else if(is_array(val) && array_length(val))
} else if(is_array(val) && array_length(val))
out.type = is_string(val[0])? VALUE_TYPE.text : VALUE_TYPE.float;
else
out.type = is_string(val)? VALUE_TYPE.text : VALUE_TYPE.float;

View file

@ -18,21 +18,16 @@ function Node_Texture_Remap(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
]
attribute_surface_depth();
attribute_interpolation();
static process_data = function(_outSurf, _data, _output_index, _array_index) {
if(!is_surface(_data[1])) return _outSurf;
surface_set_target(_outSurf);
DRAW_CLEAR
BLEND_OVERRIDE;
shader_set(shader);
surface_set_shader(_outSurf, shader);
shader_set_interpolation(_data[0]);
texture_set_stage(uniform_map, surface_get_texture(_data[1]));
draw_surface_safe(_data[0], 0, 0);
shader_reset();
BLEND_NORMAL;
surface_reset_target();
surface_reset_shader();
return _outSurf;
}

View file

@ -53,6 +53,7 @@ function Node_Transform(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
attribute_surface_depth();
attribute_interpolation();
vel = 0;
prev_pos = [0, 0];
@ -209,21 +210,13 @@ function Node_Transform(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
surface_reset_target();
var _cc = point_rotate(-_px, -_py, _ww / 2, _hh / 2, rot);
surface_set_target(_outSurf);
DRAW_CLEAR
BLEND_OVERRIDE;
surface_set_shader(_outSurf);
shader_set_interpolation(_s);
draw_surface_ext_safe(_s, _cc[0], _cc[1], 1, 1, rot, c_white, 1);
BLEND_NORMAL;
surface_reset_target();
surface_reset_shader();
surface_free(_s);
} else {
surface_set_target(_outSurf);
DRAW_CLEAR
BLEND_OVERRIDE;
var draw_x, draw_y;
draw_x = pos[0];
draw_y = pos[1];
@ -232,10 +225,11 @@ function Node_Transform(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
draw_x = round(draw_x);
draw_y = round(draw_y);
}
draw_surface_ext_safe(ins, draw_x, draw_y, sca[0], sca[1], rot, c_white, 1);
BLEND_NORMAL;
surface_reset_target();
surface_set_shader(_outSurf);
shader_set_interpolation(ins);
draw_surface_ext_safe(ins, draw_x, draw_y, sca[0], sca[1], rot, c_white, 1);
surface_reset_shader();
}
return _outSurf;
@ -466,7 +460,7 @@ function Node_Transform(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
}
#region path
if(inputs[| 2].animator.is_anim && inputs[| 2].value_from == noone) {
if(inputs[| 2].is_anim && inputs[| 2].value_from == noone && !inputs[| 2].sep_axis) {
var posInp = inputs[| 2];
var allPos = posInp.animator.values;
var ox, oy, nx, ny;

View file

@ -33,11 +33,13 @@ function Node_Twirl(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
input_display_list = [ 7,
["Surface", true], 0, 4, 5, 6,
["Surface", true], 0, 5, 6,
["Twirl", false], 1, 2, 3,
];
attribute_surface_depth();
attribute_oversample();
attribute_interpolation();
static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) {
var pos = inputs[| 1].getValue();
@ -49,26 +51,20 @@ function Node_Twirl(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
}
static process_data = function(_outSurf, _data, _output_index, _array_index) {
surface_set_target(_outSurf);
DRAW_CLEAR
BLEND_OVERRIDE;
var center = _data[1];
var stren = _data[2];
var rad = _data[3];
var sam = _data[4];
var sam = ds_map_try_get(attributes, "oversample");
shader_set(shader);
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_cen, center);
shader_set_uniform_f(uniform_str, stren);
shader_set_uniform_f(uniform_rad, rad);
shader_set_uniform_i(uniform_sam, sam);
draw_surface_safe(_data[0], 0, 0);
shader_reset();
BLEND_NORMAL;
surface_reset_target();
surface_reset_shader();
_outSurf = mask_apply(_data[0], _outSurf, _data[5], _data[6]);

View file

@ -312,6 +312,12 @@ function nodeValueUnit(value) constructor {
}
}
global.displaySuffix_Range = [ "min", "max" ];
global.displaySuffix_Area = [ "x", "y", "w", "h" ];
global.displaySuffix_Padding = [ "right", "top", "left", "bottom" ];
global.displaySuffix_VecRange = [ "x min", "x max", "y min", "y max" ];
global.displaySuffix_Axis = [ "x", "y", "z", "w"];
function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constructor {
name = _name;
node = _node;
@ -332,10 +338,18 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
auto_connect = true;
setFrom_condition = -1;
is_anim = false;
sep_axis = false;
sepable = is_array(_value) && array_length(_value) > 1;
animator = new valueAnimator(_value, self, false);
animators = [];
if(is_array(_value))
for( var i = 0; i < array_length(_value); i++ ) {
animators[i] = new valueAnimator(_value[i], self, true);
animators[i].index = i;
}
def_val = _value;
animator = new valueAnimator(_value, self);
rawAnimator = animator;
graph_h = ui(64);
on_end = KEYFRAME_END.hold;
unit = new nodeValueUnit(self);
extra_data = ds_list_create();
@ -346,6 +360,9 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
draw_line_shift_hover = false;
drawLineIndex = 1;
show_graph = false;
graph_h = ui(64);
visible = _connect == JUNCTION_CONNECT.output || _type == VALUE_TYPE.surface || _type == VALUE_TYPE.path;
show_in_inspector = true;
@ -461,13 +478,16 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
case VALUE_DISPLAY.range :
editWidget = new rangeBox(_txt, function(index, val) {
MODIFIED = true;
var _val = animator.getValue();
_val[index] = val;
return setValueDirect(_val);
//var _val = animator.getValue();
//_val[index] = val;
return setValueDirect(val, index);
} );
if(type == VALUE_TYPE.integer) editWidget.setSlideSpeed(1);
if(display_data != -1) editWidget.extras = display_data;
for( var i = 0; i < array_length(animators); i++ )
animators[i].suffix = " " + array_safe_get(global.displaySuffix_Range, i);
extract_node = "Node_Number";
break;
case VALUE_DISPLAY.vector :
@ -475,9 +495,9 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
if(array_length(val) <= 4) {
editWidget = new vectorBox(array_length(animator.getValue()), _txt, function(index, val) {
MODIFIED = true;
var _val = animator.getValue();
_val[index] = val;
return setValueDirect(_val);
//var _val = animator.getValue();
//_val[index] = val;
return setValueDirect(val, index);
}, unit );
if(type == VALUE_TYPE.integer) editWidget.setSlideSpeed(1);
if(display_data != -1) editWidget.extras = display_data;
@ -489,15 +509,19 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
else if(array_length(val) == 4)
extract_node = "Node_Vector4";
}
for( var i = 0; i < array_length(animators); i++ )
animators[i].suffix = " " + array_safe_get(global.displaySuffix_Axis, i);
break;
case VALUE_DISPLAY.vector_range :
var val = animator.getValue();
editWidget = new vectorRangeBox(array_length(val), _txt, function(index, val) {
MODIFIED = true;
var _val = animator.getValue();
_val[index] = val;
return setValueDirect(_val);
//var _val = animator.getValue();
//_val[index] = val;
return setValueDirect(val, index);
}, unit );
if(type == VALUE_TYPE.integer) editWidget.setSlideSpeed(1);
if(display_data != -1) editWidget.extras = display_data;
@ -508,11 +532,15 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
extract_node = "Node_Vector3";
else if(array_length(val) == 4)
extract_node = "Node_Vector4";
for( var i = 0; i < array_length(animators); i++ )
animators[i].suffix = " " + array_safe_get(global.displaySuffix_VecRange, i);
break;
case VALUE_DISPLAY.rotation :
editWidget = new rotator(function(val, _save) {
editWidget = new rotator(function(val) {
MODIFIED = true;
return setValueDirect(val, _save);
return setValueDirect(val);
}, display_data );
extract_node = "Node_Number";
@ -520,11 +548,14 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
case VALUE_DISPLAY.rotation_range :
editWidget = new rotatorRange(function(index, val) {
MODIFIED = true;
var _val = animator.getValue();
_val[index] = round(val);
return setValueDirect(_val);
//var _val = animator.getValue();
//_val[index] = round(val);
return setValueDirect(val, index);
} );
for( var i = 0; i < array_length(animators); i++ )
animators[i].suffix = " " + array_safe_get(global.displaySuffix_Range, i);
extract_node = "Node_Vector2";
break;
case VALUE_DISPLAY.slider :
@ -539,44 +570,53 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
case VALUE_DISPLAY.slider_range :
editWidget = new sliderRange(display_data[0], display_data[1], display_data[2], function(index, val) {
MODIFIED = true;
var _val = animator.getValue();
_val[index] = val;
return setValueDirect(_val);
//var _val = animator.getValue();
//_val[index] = val;
return setValueDirect(val, index);
} );
if(type == VALUE_TYPE.integer) editWidget.setSlideSpeed(1);
for( var i = 0; i < array_length(animators); i++ )
animators[i].suffix = " " + array_safe_get(global.displaySuffix_Range, i);
extract_node = "Node_Vector2";
break;
case VALUE_DISPLAY.area :
editWidget = new areaBox(function(index, val) {
MODIFIED = true;
var _val = animator.getValue();
_val[index] = val;
return setValueDirect(_val);
//var _val = animator.getValue();
//_val[index] = val;
return setValueDirect(val, index);
}, unit);
if(type == VALUE_TYPE.integer) editWidget.setSlideSpeed(1);
if(display_data != -1) editWidget.onSurfaceSize = display_data;
for( var i = 0; i < array_length(animators); i++ )
animators[i].suffix = " " + array_safe_get(global.displaySuffix_Area, i);
extract_node = "Node_Area";
break;
case VALUE_DISPLAY.padding :
editWidget = new paddingBox(function(index, val) {
MODIFIED = true;
var _val = animator.getValue();
_val[index] = val;
return setValueDirect(_val);
//var _val = animator.getValue();
//_val[index] = val;
return setValueDirect(val, index);
}, unit);
if(type == VALUE_TYPE.integer) editWidget.setSlideSpeed(1);
for( var i = 0; i < array_length(animators); i++ )
animators[i].suffix = " " + array_safe_get(global.displaySuffix_Padding, i);
extra_data[| 0] = AREA_MODE.area;
extract_node = "Node_Vector4";
break;
case VALUE_DISPLAY.puppet_control :
editWidget = new controlPointBox(function(index, val) {
MODIFIED = true;
var _val = animator.getValue();
_val[index] = val;
return setValueDirect(_val);
//var _val = animator.getValue();
//_val[index] = val;
return setValueDirect(val, index);
});
extract_node = "";
@ -613,6 +653,9 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
if(type == VALUE_TYPE.integer) editWidget.setSlideSpeed(1);
if(display_data != -1) editWidget.extras = display_data;
for( var i = 0; i < array_length(animators); i++ )
animators[i].suffix = " " + string(i);
extract_node = "";
break;
}
@ -899,6 +942,16 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
return val;
}
static __getAnimValue = function(_time = ANIMATOR.current_frame) {
if(sep_axis) {
var val = [];
for( var i = 0; i < array_length(animators); i++ )
val[i] = animators[i].getValue(_time);
return val;
} else
return animator.getValue(_time);
}
static _getValue = function(_time = ANIMATOR.current_frame, applyUnit = true, arrIndex = 0) {
var _val = getValueRecursive(_time);
var val = _val[0];
@ -906,7 +959,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
var typ = nod.type;
var dis = nod.display_type;
var _base = animator.getValue(_time);
var _base = __getAnimValue(_time);
if(typ == VALUE_TYPE.surface && (type == VALUE_TYPE.integer || type == VALUE_TYPE.float) && accept_array) { //Dimension conversion
if(is_array(val)) {
@ -956,7 +1009,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
var val = [ -1, self ];
if(value_from == noone) {
var _val = animator.getValue(_time);
var _val = __getAnimValue(_time);
if(global_use && GLOBAL.inputGetable(self, global_key))
return GLOBAL.getInput(global_key).getValueRecursive(_time);
@ -968,9 +1021,14 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
return val;
}
static __anim = function() {
return animator.is_anim || node.update_on_frame;
static setAnim = function(anim) {
is_anim = anim;
}
static __anim = function() {
return is_anim || node.update_on_frame;
}
static isAnimated = function() {
if(value_from == noone) return __anim();
else return value_from.isAnimated() || value_from.__anim();
@ -1037,13 +1095,26 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
static setValue = function(val = 0, record = true, time = ANIMATOR.current_frame, _update = true) {
val = unit.invApply(val);
return setValueDirect(val, record, time, _update);
return setValueDirect(val, noone, record, time, _update);
}
static setValueDirect = function(val = 0, record = true, time = ANIMATOR.current_frame, _update = true) {
var _o = animator.getValue();
var updated = animator.setValue(val, connect_type == JUNCTION_CONNECT.input && record, time);
var _n = animator.getValue();
static setValueDirect = function(val = 0, index = noone, record = true, time = ANIMATOR.current_frame, _update = true) {
var updated = false;
if(sep_axis) {
if(index == noone) {
for( var i = 0; i < array_length(animators); i++ )
updated |= animators[i].setValue(val[i], connect_type == JUNCTION_CONNECT.input && record, time);
} else
updated = animators[index].setValue(val, connect_type == JUNCTION_CONNECT.input && record, time);
} else {
if(index != noone) {
var _val = animator.getValue(time);
_val[index] = val;
updated = animator.setValue(_val, connect_type == JUNCTION_CONNECT.input && record, time);
} else
updated = animator.setValue(val, connect_type == JUNCTION_CONNECT.input && record, time);
}
if(display_type == VALUE_DISPLAY.gradient) updated = true;
if(display_type == VALUE_DISPLAY.palette) updated = true;
@ -1353,7 +1424,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
var animTo = ext.inputs[| j].animator;
var animLs = animTo.values;
animTo.is_anim = animator.is_anim;
ext.setAnim(is_anim);
ds_list_clear(animLs);
}
@ -1372,7 +1443,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
var animTo = ext.inputs[| 0].animator;
var animLs = animTo.values;
animTo.is_anim = animator.is_anim;
ext.setAnim(is_anim);
ds_list_clear(animLs);
for( var i = 0; i < ds_list_size(animFrom); i++ )
@ -1387,19 +1458,24 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
static serialize = function(scale = false, preset = false) {
var _map = ds_map_create();
//print(" = > Serializing: " + name);
ds_map_add_list(_map, "raw value", animator.serialize(scale));
_map[? "on end"] = on_end;
_map[? "visible"] = visible;
_map[? "unit"] = unit.mode;
_map[? "anim"] = animator.is_anim;
_map[? "sep_axis"] = sep_axis;
_map[? "shift x"] = draw_line_shift_x;
_map[? "shift y"] = draw_line_shift_y;
_map[? "from node"] = !preset && value_from? value_from.node.node_id : -1;
_map[? "from index"] = !preset && value_from? value_from.index : -1;
_map[? "global_use"] = global_use;
_map[? "global_key"] = global_key;
_map[? "anim"] = is_anim;
ds_map_add_list(_map, "raw value", animator.serialize(scale));
var _anims = ds_list_create();
for( var i = 0; i < array_length(animators); i++ )
ds_list_add_list(_anims, animators[i].serialize(scale));
ds_map_add_list(_map, "animators", _anims);
ds_map_add_list(_map, "data", ds_list_clone(extra_data));
@ -1417,14 +1493,22 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
on_end = ds_map_try_get(_map, "on end", on_end);
visible = ds_map_try_get(_map, "visible", visible);
unit.mode = ds_map_try_get(_map, "unit", VALUE_UNIT.constant);
draw_line_shift_x = ds_map_try_get(_map, "shift x");
draw_line_shift_y = ds_map_try_get(_map, "shift y");
global_use = ds_map_try_get(_map, "global_use");
global_key = ds_map_try_get(_map, "global_key");
sep_axis = ds_map_try_get(_map, "sep_axis");
is_anim = ds_map_try_get(_map, "anim");
draw_line_shift_x = ds_map_try_get(_map, "shift x");
draw_line_shift_y = ds_map_try_get(_map, "shift y");
animator.deserialize(_map[? "raw value"], scale);
animator.is_anim = _map[? "anim"];
if(ds_map_exists(_map, "animators")) {
var anims = _map[? "animators"];
for( var i = 0; i < ds_list_size(anims); i++ )
animators[i].deserialize(anims[| i], scale);
}
if(!preset) {
con_node = _map[? "from node"];
con_index = _map[? "from index"];

View file

@ -30,6 +30,7 @@ function Node_Warp(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
]
attribute_surface_depth();
attribute_interpolation();
drag_side = -1;
drag_mx = 0;
@ -178,9 +179,8 @@ function Node_Warp(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
var bl = _data[3];
var br = _data[4];
surface_set_target(_outSurf);
DRAW_CLEAR
BLEND_OVERRIDE;
surface_set_shader(_outSurf);
shader_set_interpolation(_data[0]);
draw_set_color(c_white);
var tex = surface_get_texture(_data[0]);
@ -222,9 +222,7 @@ function Node_Warp(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
}
}
draw_primitive_end();
BLEND_NORMAL;
surface_reset_target();
surface_reset_shader();
return _outSurf;
}

View file

@ -17,6 +17,7 @@ function Node_Wrap_Area(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
]
attribute_surface_depth();
attribute_interpolation();
static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) {
inputs[| 1].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny);
@ -38,14 +39,10 @@ function Node_Wrap_Area(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
var ww = cw / surface_get_width(_inSurf) * 2;
var hh = ch / surface_get_height(_inSurf) * 2;
surface_set_target(_outSurf);
DRAW_CLEAR
BLEND_OVERRIDE;
surface_set_shader(_outSurf);
shader_set_interpolation(_inSurf);
draw_surface_ext_safe(_inSurf, cx - cw, cy - ch, ww, hh, 0, c_white, 1);
BLEND_NORMAL;
surface_reset_target();
surface_reset_shader();
return _outSurf;
}

View file

@ -44,6 +44,7 @@ function Node_Mesh_Warp(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
];
attribute_surface_depth();
attribute_interpolation();
input_display_index = array_length(input_display_list);
@ -462,11 +463,11 @@ function Node_Mesh_Warp(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
_outSurf = surface_verify(_outSurf, surface_get_width(_inSurf), surface_get_height(_inSurf), attrDepth());
surface_set_target(_outSurf);
DRAW_CLEAR
surface_set_shader(_outSurf);
shader_set_interpolation(_outSurf);
for(var i = 0; i < ds_list_size(data.tris); i++)
data.tris[| i].drawSurface(_inSurf);
surface_reset_target();
surface_reset_shader();
return _outSurf;
}

View file

@ -8,6 +8,7 @@ enum KEYFRAME_DRAG_TYPE {
function Panel_Animation() : PanelContent() constructor {
title = "Animation";
context_str = "Animation";
icon = THEME.panel_animation;
timeline_h = ui(28);
min_w = ui(40);
@ -134,10 +135,10 @@ function Panel_Animation() : PanelContent() constructor {
addHotkey("", "Previous frame", vk_left, MOD_KEY.none, function() {
ANIMATOR.setFrame(max(ANIMATOR.real_frame - 1, 0));
});
addHotkey("Animation", "Delete keys", vk_delete, MOD_KEY.none, function() { deleteKeys(); });
addHotkey("Animation", "Duplicate", "D", MOD_KEY.ctrl, function() { doDuplicate(); });
addHotkey("Animation", "Copy", "C", MOD_KEY.ctrl, function() { doCopy(); });
addHotkey("Animation", "Paste", "V", MOD_KEY.ctrl, function() { doPaste(value_focusing); });
addHotkey("Animation", "Delete keys", vk_delete, MOD_KEY.none, function() { PANEL_ANIMATION.deleteKeys(); });
addHotkey("Animation", "Duplicate", "D", MOD_KEY.ctrl, function() { PANEL_ANIMATION.doDuplicate(); });
addHotkey("Animation", "Copy", "C", MOD_KEY.ctrl, function() { PANEL_ANIMATION.doCopy(); });
addHotkey("Animation", "Paste", "V", MOD_KEY.ctrl, function() { PANEL_ANIMATION.doPaste(PANEL_ANIMATION.value_focusing); });
function deleteKeys() {
for( var i = 0; i < ds_list_size(keyframe_selecting); i++ ) {
@ -186,8 +187,17 @@ function Panel_Animation() : PanelContent() constructor {
for( var j = 0; j < ds_list_size(node.inputs); j++ ) {
var prop = node.inputs[| j];
if(!prop.animator.is_anim) continue;
if(!prop.is_anim) continue;
if(prop.sep_axis) {
for(var k = 0; k < array_length(prop.animators); k++ )
for(var m = 0; m < ds_list_size(prop.animators[k].values); m++) {
var keyframe = prop.animators[k].values[| m];
if(ds_list_exist(keyframe_selecting, keyframe))
ds_list_add(l, keyframe);
}
} else {
for(var k = 0; k < ds_list_size(prop.animator.values); k++) {
var keyframe = prop.animator.values[| k];
@ -196,6 +206,7 @@ function Panel_Animation() : PanelContent() constructor {
}
}
}
}
ds_list_copy(keyframe_selecting, l);
ds_list_destroy(l);
@ -375,7 +386,7 @@ function Panel_Animation() : PanelContent() constructor {
var is_anim = false;
for(var j = 0; j < ds_list_size(_node.inputs); j++) {
var jun = _node.inputs[| j];
is_anim |= jun.animator.is_anim && jun.value_from == noone;
is_anim |= jun.is_anim && jun.value_from == noone;
}
if(!is_anim) continue;
@ -451,6 +462,15 @@ function Panel_Animation() : PanelContent() constructor {
for( var j = 0; j < ds_list_size(node.inputs); j++ ) {
var prop = node.inputs[| j];
if(prop.sep_axis) {
for(var a = 0; a < array_length(prop.animators); a++)
for(var k = 0; k < ds_list_size(prop.animators[a].values); k++) {
var t = (prop.animators[a].values[| k].time + 1) * ui(timeline_scale) + timeline_shift;
prop.animators[a].values[| k].dopesheet_x = t;
var ind = prop.animators[a].values[| k].ease_in_type == CURVE_TYPE.cut? 4 : 1;
draw_sprite_ui_uniform(THEME.timeline_keyframe, ind, t, key_y, 1, COLORS.panel_animation_keyframe_hide);
}
} else {
for(var k = 0; k < ds_list_size(prop.animator.values); k++) {
var t = (prop.animator.values[| k].time + 1) * ui(timeline_scale) + timeline_shift;
prop.animator.values[| k].dopesheet_x = t;
@ -459,6 +479,7 @@ function Panel_Animation() : PanelContent() constructor {
}
}
}
}
#endregion
#region pan zoom
@ -537,12 +558,151 @@ function Panel_Animation() : PanelContent() constructor {
draw_surface_safe(timeline_surface, bar_x, bar_y);
}
function drawDopesheetGraph(prop, key_y, msx, msy) {
function drawDopesheetLine(animator, key_y, msx, msy, _gy_val_min = 999999, _gy_val_max = -999999) {
var bar_total_w = ANIMATOR.frames_total * ui(timeline_scale);
var bar_show_w = timeline_shift + bar_total_w;
var hovering = noone;
var _gy_val_min = 999999;
var _gy_val_max = -999999;
var _gy_top = key_y + ui(16);
var _gy_bottom = _gy_top + animator.prop.graph_h - ui(8);
var amo = ds_list_size(animator.values);
for(var k = 0; k < amo; k++) {
var key_val = animator.values[| k].value;
if(is_array(key_val)) {
for( var ki = 0; ki < array_length(key_val); ki++ ) {
_gy_val_min = min(_gy_val_min, key_val[ki]);
_gy_val_max = max(_gy_val_max, key_val[ki]);
}
} else {
_gy_val_min = min(_gy_val_min, key_val);
_gy_val_max = max(_gy_val_max, key_val);
}
}
var valArray = is_array(animator.values[| 0].value);
var ox = 0, oy = valArray? [] : noone, nx = 0, ny = noone, oly = 0, nly = 0;
for(var k = 0; k < amo - 1; k++) {
var key = animator.values[| k];
var t = key.dopesheet_x;
var key_next = animator.values[| k + 1];
var dx = key_next.time - key.time;
if(key.ease_out_type == CURVE_TYPE.none && key_next.ease_in_type == CURVE_TYPE.none) { //linear draw
nx = (key_next.time + 1) * ui(timeline_scale) + timeline_shift;
if(valArray) {
for( var ki = 0; ki < array_length(key.value); ki++ ) {
draw_set_color(COLORS.axis[ki]);
ny[ki] = value_map(key.value[ki], _gy_val_min, _gy_val_max, _gy_bottom, _gy_top);
if(array_length(oy) > ki)
draw_line(t, oy[ki], t, ny[ki]);
oy[ki] = ny[ki];
ny[ki] = value_map(key_next.value[ki], _gy_val_min, _gy_val_max, _gy_bottom, _gy_top);
draw_line(t, oy[ki], nx, ny[ki]);
oy[ki] = ny[ki];
}
} else {
draw_set_color(animator.prop.sep_axis? COLORS.axis[animator.index] : COLORS.panel_animation_graph_line);
ny = value_map(key.value, _gy_val_min, _gy_val_max, _gy_bottom, _gy_top);
if(oy != noone) draw_line(t, oy, t, ny);
oy = ny;
ny = value_map(key_next.value, _gy_val_min, _gy_val_max, _gy_bottom, _gy_top);
draw_line(t, oy, nx, ny);
oy = ny;
}
ox = nx;
} else { //bezier easing
var _step = 1 / dx;
for( var _r = 0; _r <= 1; _r += _step ) {
nx = t + _r * dx * ui(timeline_scale);
nly = animator.interpolate(key, key_next, _r);
if(valArray) {
for( var ki = 0; ki < array_length(key.value); ki++ ) {
draw_set_color(COLORS.axis[ki]);
ny[ki] = value_map(lerp(key.value[ki], key_next.value[ki], nly), _gy_val_min, _gy_val_max, _gy_bottom, _gy_top);
if(array_length(oy) > ki)
draw_line(ox, oy[ki], nx, ny[ki]);
oy[ki] = ny[ki];
}
} else {
draw_set_color(animator.prop.sep_axis? COLORS.axis[animator.index] : COLORS.panel_animation_graph_line);
ny = value_map(lerp(key.value, key_next.value, nly), _gy_val_min, _gy_val_max, _gy_bottom, _gy_top);
if(oy != noone)
draw_line(ox, oy, nx, ny);
oy = ny;
}
ox = nx;
oly = nly;
}
}
}
if(animator.prop.show_graph && ds_list_size(animator.values) > 0) {
if(ds_list_size(animator.values) == 1) { //draw graph before and after
var key_first = animator.values[| 0];
if(valArray) {
for( var ki = 0; ki < array_length(key_first.value); ki++ ) {
draw_set_color(COLORS.axis[ki]);
sy = value_map(key_first.value[ki], _gy_val_min, _gy_val_max, _gy_bottom, _gy_top);
draw_line(0, sy, bar_show_w, sy);
}
} else {
draw_set_color(animator.prop.sep_axis? COLORS.axis[animator.index] : COLORS.panel_animation_graph_line);
sy = value_map(key_first.value, _gy_val_min, _gy_val_max, _gy_bottom, _gy_top);
draw_line(0, sy, bar_show_w, sy);
}
} else { //draw graph before and after
var key_first = animator.values[| 0];
var t_first = (key_first.time + 1) * ui(timeline_scale) + timeline_shift;
var sy;
if(valArray) {
for( var ki = 0; ki < array_length(key_first.value); ki++ ) {
draw_set_color(COLORS.axis[ki]);
sy = value_map(key_first.value[ki], _gy_val_min, _gy_val_max, _gy_bottom, _gy_top);
draw_line(0, sy, t_first, sy);
}
} else {
draw_set_color(animator.prop.sep_axis? COLORS.axis[animator.index] : COLORS.panel_animation_graph_line);
sy = value_map(key_first.value, _gy_val_min, _gy_val_max, _gy_bottom, _gy_top);
draw_line(0, sy, t_first, sy);
}
var key_last = animator.values[| ds_list_size(animator.values) - 1];
var t_last = (key_last.time + 1) * ui(timeline_scale) + timeline_shift;
if(key_last.time < ANIMATOR.frames_total) {
if(valArray) {
for( var ki = 0; ki < array_length(key_last.value); ki++ ) {
draw_set_color(COLORS.axis[ki]);
ny[ki] = value_map(key_last.value[ki], _gy_val_min, _gy_val_max, _gy_bottom, _gy_top);
draw_line(t_last, oy[ki], t_last, ny[ki]);
draw_line(t_last, oy[ki], bar_show_w, oy[ki]);
}
} else {
draw_set_color(animator.prop.sep_axis? COLORS.axis[animator.index] : COLORS.panel_animation_graph_line);
ny = value_map(key_last.value, _gy_val_min, _gy_val_max, _gy_bottom, _gy_top);
draw_line(t_last, oy, t_last, ny);
draw_line(t_last, ny, bar_show_w, ny);
}
}
}
}
}
function drawDopesheetGraph(prop, key_y, msx, msy) {
var bar_total_w = ANIMATOR.frames_total * ui(timeline_scale);
var bar_show_w = timeline_shift + bar_total_w;
var _gy_top = key_y + ui(16);
var _gy_bottom = _gy_top + prop.graph_h - ui(8);
@ -582,140 +742,143 @@ function Panel_Animation() : PanelContent() constructor {
return;
}
var amo = ds_list_size(prop.animator.values);
if(prop.sep_axis) {
var _min = 999999;
var _max = -999999;
for(var k = 0; k < amo; k++) {
var key_val = prop.animator.values[| k].value;
for( var i = 0; i < array_length(prop.animators); i++ ) {
var animator = prop.animators[i];
for(var k = 0; k < ds_list_size(animator.values); k++) {
var key_val = animator.values[| k].value;
if(is_array(key_val)) {
for( var ki = 0; ki < array_length(key_val); ki++ ) {
_gy_val_min = min(_gy_val_min, key_val[ki]);
_gy_val_max = max(_gy_val_max, key_val[ki]);
_min = min(_min, key_val[ki]);
_max = max(_max, key_val[ki]);
}
} else {
_gy_val_min = min(_gy_val_min, key_val);
_gy_val_max = max(_gy_val_max, key_val);
}
}
var valArray = is_array(prop.animator.values[| 0].value);
var ox = 0, oy = valArray? [] : noone, nx = 0, ny = noone, oly = 0, nly = 0;
for(var k = 0; k < amo - 1; k++) {
var key = prop.animator.values[| k];
var t = key.dopesheet_x;
var key_next = prop.animator.values[| k + 1];
var dx = key_next.time - key.time;
if(key.ease_out_type == CURVE_TYPE.none && key_next.ease_in_type == CURVE_TYPE.none) { //linear draw
nx = (key_next.time + 1) * ui(timeline_scale) + timeline_shift;
if(valArray) {
for( var ki = 0; ki < array_length(key.value); ki++ ) {
draw_set_color(COLORS.axis[ki]);
ny[ki] = value_map(key.value[ki], _gy_val_min, _gy_val_max, _gy_bottom, _gy_top);
if(array_length(oy) > ki)
draw_line(t, oy[ki], t, ny[ki]);
oy[ki] = ny[ki];
ny[ki] = value_map(key_next.value[ki], _gy_val_min, _gy_val_max, _gy_bottom, _gy_top);
draw_line(t, oy[ki], nx, ny[ki]);
oy[ki] = ny[ki];
}
} else {
draw_set_color(COLORS.panel_animation_graph_line);
ny = value_map(key.value, _gy_val_min, _gy_val_max, _gy_bottom, _gy_top);
if(oy != noone) draw_line(t, oy, t, ny);
oy = ny;
ny = value_map(key_next.value, _gy_val_min, _gy_val_max, _gy_bottom, _gy_top);
draw_line(t, oy, nx, ny);
oy = ny;
}
ox = nx;
} else { //bezier easing
var _step = 1 / dx;
for( var _r = 0; _r <= 1; _r += _step ) {
nx = t + _r * dx * ui(timeline_scale);
nly = prop.animator.interpolate(key, key_next, _r);
if(valArray) {
for( var ki = 0; ki < array_length(key.value); ki++ ) {
draw_set_color(COLORS.axis[ki]);
ny[ki] = value_map(lerp(key.value[ki], key_next.value[ki], nly), _gy_val_min, _gy_val_max, _gy_bottom, _gy_top);
if(array_length(oy) > ki)
draw_line(ox, oy[ki], nx, ny[ki]);
oy[ki] = ny[ki];
}
} else {
draw_set_color(COLORS.panel_animation_graph_line);
ny = value_map(lerp(key.value, key_next.value, nly), _gy_val_min, _gy_val_max, _gy_bottom, _gy_top);
if(oy != noone)
draw_line(ox, oy, nx, ny);
oy = ny;
}
ox = nx;
oly = nly;
_min = min(_min, key_val);
_max = max(_max, key_val);
}
}
}
if(prop.animator.show_graph && ds_list_size(prop.animator.values) > 0) {
if(ds_list_size(prop.animator.values) == 1) { //draw graph before and after
var key_first = prop.animator.values[| 0];
if(valArray) {
for( var ki = 0; ki < array_length(key_first.value); ki++ ) {
draw_set_color(COLORS.axis[ki]);
sy = value_map(key_first.value[ki], _gy_val_min, _gy_val_max, _gy_bottom, _gy_top);
draw_line(0, sy, bar_show_w, sy);
}
} else {
draw_set_color(COLORS.panel_animation_graph_line);
sy = value_map(key_first.value, _gy_val_min, _gy_val_max, _gy_bottom, _gy_top);
draw_line(0, sy, bar_show_w, sy);
}
} else { //draw graph before and after
var key_first = prop.animator.values[| 0];
var t_first = (key_first.time + 1) * ui(timeline_scale) + timeline_shift;
var sy;
if(valArray) {
for( var ki = 0; ki < array_length(key_first.value); ki++ ) {
draw_set_color(COLORS.axis[ki]);
sy = value_map(key_first.value[ki], _gy_val_min, _gy_val_max, _gy_bottom, _gy_top);
draw_line(0, sy, t_first, sy);
}
} else {
draw_set_color(COLORS.panel_animation_graph_line);
sy = value_map(key_first.value, _gy_val_min, _gy_val_max, _gy_bottom, _gy_top);
draw_line(0, sy, t_first, sy);
for( var i = 0; i < array_length(prop.animators); i++ )
drawDopesheetLine(prop.animators[i], key_y, msx, msy, _min, _max);
} else
drawDopesheetLine(prop.animator, key_y, msx, msy);
}
var key_last = prop.animator.values[| ds_list_size(prop.animator.values) - 1];
var t_last = (key_last.time + 1) * ui(timeline_scale) + timeline_shift;
function drawDopesheetAnimator(_node, animator, msx, msy) {
var aa = _node.group == PANEL_GRAPH.getCurrentContext()? 1 : 0.9;
var tx = tool_width - ui(72 + 16 * 3);
var ty = animator.dopesheet_y - 1;
if(key_last.time < ANIMATOR.frames_total) {
if(valArray) {
for( var ki = 0; ki < array_length(key_last.value); ki++ ) {
draw_set_color(COLORS.axis[ki]);
ny[ki] = value_map(key_last.value[ki], _gy_val_min, _gy_val_max, _gy_bottom, _gy_top);
draw_line(t_last, oy[ki], t_last, ny[ki]);
draw_line(t_last, oy[ki], bar_show_w, oy[ki]);
#region keyframe control
if(pHOVER && point_in_circle(msx, msy, tx, ty, ui(6))) {
draw_sprite_ui_uniform(THEME.prop_keyframe, 0, tx, ty, 1, COLORS._main_icon, 1);
if(mouse_press(mb_left, pFOCUS)) {
var _t = -1;
for(var k = 0; k < ds_list_size(animator.values); k++) {
var _key = animator.values[| k];
if(_key.time < ANIMATOR.current_frame)
_t = _key.time;
}
} else {
draw_set_color(COLORS.panel_animation_graph_line);
ny = value_map(key_last.value, _gy_val_min, _gy_val_max, _gy_bottom, _gy_top);
draw_line(t_last, oy, t_last, ny);
draw_line(t_last, ny, bar_show_w, ny);
if(_t > -1) ANIMATOR.setFrame(_t);
}
} else
draw_sprite_ui_uniform(THEME.prop_keyframe, 0, tx, ty, 1, COLORS._main_icon, 0.75);
var tx = tool_width - ui(72 + 16 * 1);
if(pHOVER && point_in_circle(msx, msy, tx, ty, ui(6))) {
draw_sprite_ui_uniform(THEME.prop_keyframe, 2, tx, ty, 1, COLORS._main_icon, 1);
if(mouse_press(mb_left, pFOCUS)) {
for(var k = 0; k < ds_list_size(animator.values); k++) {
var _key = animator.values[| k];
if(_key.time > ANIMATOR.current_frame) {
ANIMATOR.setFrame(_key.time);
break;
}
}
}
} else
draw_sprite_ui_uniform(THEME.prop_keyframe, 2, tx, ty, 1, COLORS._main_icon, 0.75);
#endregion
#region add keyframe
var tx = tool_width - ui(72 + 16 * 2);
if(pHOVER && point_in_circle(msx, msy, tx, ty, ui(6))) {
draw_sprite_ui_uniform(THEME.prop_keyframe, 1, tx, ty, 1, COLORS._main_accent, 1);
if(mouse_press(mb_left, pFOCUS)) {
var _add = false;
for(var k = 0; k < ds_list_size(animator.values); k++) {
var _key = animator.values[| k];
if(_key.time == ANIMATOR.current_frame) {
if(ds_list_size(animator.values) > 1)
ds_list_delete(animator.values, k);
_add = true;
break;
} else if(_key.time > ANIMATOR.current_frame) {
ds_list_insert(animator.values, k, new valueKey(ANIMATOR.current_frame, animator.getValue(), animator));
_add = true;
break;
}
}
if(!_add) ds_list_add(animator.values, new valueKey(ANIMATOR.current_frame, animator.getValue(, false), animator));
}
} else
draw_sprite_ui_uniform(THEME.prop_keyframe, 1, tx, ty, 1, COLORS._main_accent, 0.75);
#endregion
if(isGraphable(animator.prop)) {
var tx = tool_width - ui(68 + 16 * 0);
if(pHOVER && point_in_circle(msx, msy, tx, ty, ui(8))) {
draw_sprite_ui_uniform(THEME.timeline_graph, 1, tx, ty, 1, COLORS._main_icon, animator.prop.show_graph? 1 : 0.75);
TOOLTIP = get_text("panel_animation_show_graph", "Show graph");
if(mouse_press(mb_left, pFOCUS))
animator.prop.show_graph = !animator.prop.show_graph;
} else
draw_sprite_ui_uniform(THEME.timeline_graph, 1, tx, ty, 1, animator.prop.show_graph? COLORS._main_accent : COLORS._main_icon);
}
var tx = tool_width - ui(72 + 16 * 4.5);
if(pHOVER && point_in_circle(msx, msy, tx, ty, ui(6))) {
draw_sprite_ui_uniform(THEME.prop_on_end, animator.prop.on_end, tx, ty, 1, COLORS._main_icon, 1);
TOOLTIP = get_text("panel_animation_looping_mode", "Looping mode") + ": " + ON_END_NAME[animator.prop.on_end];
if(mouse_press(mb_left, pFOCUS))
animator.prop.on_end = safe_mod(animator.prop.on_end + 1, sprite_get_number(THEME.prop_on_end));
} else
draw_sprite_ui_uniform(THEME.prop_on_end, animator.prop.on_end, tx, ty, 1, COLORS._main_icon, 0.75);
if(pHOVER && point_in_circle(msx, msy, ui(22), ty - 1, ui(10))) {
draw_sprite_ui_uniform(THEME.timeline_clock, 1, ui(22), ty - 1, 1, COLORS._main_icon, 1);
if(mouse_press(mb_left, pFOCUS)) {
animator.prop.setAnim(!animator.prop.is_anim);
updatePropertyList();
}
} else
draw_sprite_ui_uniform(THEME.timeline_clock, 1, ui(22), ty - 1, 1, COLORS._main_icon, 0.75);
var hov = pHOVER && point_in_rectangle(msx, msy, 0, ty - ui(8), w, ty + ui(8));
if(hov) {
value_hovering = animator.prop;
if(mouse_click(mb_left, pFOCUS))
value_focusing = animator.prop;
}
var cc = animator.prop.sep_axis? COLORS.axis[animator.index] : COLORS._main_text;
if(hov) cc = COLORS._main_text_accent;
draw_set_color(cc);
draw_set_alpha(aa);
draw_text(ui(32), ty - 2, animator.getName());
draw_set_alpha(1);
}
function drawDopesheetName() {
surface_set_target(ds_name_surface);
@ -737,10 +900,10 @@ function Panel_Animation() : PanelContent() constructor {
for( var i = 0; i < ds_list_size(anim_properties); i++ ) {
_node = anim_properties[| i];
var _node_y = _node.dopesheet_y;
if(!show_node_outside_context && _node.group != PANEL_GRAPH.getCurrentContext()) continue;
var aa = _node.group == PANEL_GRAPH.getCurrentContext()? 1 : 0.9;
var _node_y = _node.dopesheet_y;
if(!show_node_outside_context && _node.group != PANEL_GRAPH.getCurrentContext()) continue;
var _node_y_start = _node_y;
_node_y += dope_sheet_node_padding;
@ -783,115 +946,21 @@ function Panel_Animation() : PanelContent() constructor {
continue;
}
var ty = 0;
for( var j = 0; j < ds_list_size(_node.inputs); j++ ) {
var prop = _node.inputs[| j];
var tx = tool_width - ui(72 + 16 * 3);
var ty = prop.animator.dopesheet_y - 1;
if(!prop.is_anim) continue;
if(!prop.animator.is_anim) continue;
#region keyframe control
if(pHOVER && point_in_circle(msx, msy, tx, ty, ui(6))) {
draw_sprite_ui_uniform(THEME.prop_keyframe, 0, tx, ty, 1, COLORS._main_icon, 1);
if(mouse_press(mb_left, pFOCUS)) {
var _t = -1;
for(var k = 0; k < ds_list_size(prop.animator.values); k++) {
var _key = prop.animator.values[| k];
if(_key.time < ANIMATOR.current_frame)
_t = _key.time;
if(prop.sep_axis) {
for( var i = 0; i < array_length(prop.animators); i++ ) {
drawDopesheetAnimator(_node, prop.animators[i], msx, msy);
ty = prop.animators[i].dopesheet_y - 1;
}
if(_t > -1) ANIMATOR.setFrame(_t);
} else {
drawDopesheetAnimator(_node, prop.animator, msx, msy);
ty = prop.animator.dopesheet_y - 1;
}
} else
draw_sprite_ui_uniform(THEME.prop_keyframe, 0, tx, ty, 1, COLORS._main_icon, 0.75);
var tx = tool_width - ui(72 + 16 * 1);
if(pHOVER && point_in_circle(msx, msy, tx, ty, ui(6))) {
draw_sprite_ui_uniform(THEME.prop_keyframe, 2, tx, ty, 1, COLORS._main_icon, 1);
if(mouse_press(mb_left, pFOCUS)) {
for(var k = 0; k < ds_list_size(prop.animator.values); k++) {
var _key = prop.animator.values[| k];
if(_key.time > ANIMATOR.current_frame) {
ANIMATOR.setFrame(_key.time);
break;
}
}
}
} else
draw_sprite_ui_uniform(THEME.prop_keyframe, 2, tx, ty, 1, COLORS._main_icon, 0.75);
#endregion
#region add keyframe
var tx = tool_width - ui(72 + 16 * 2);
if(pHOVER && point_in_circle(msx, msy, tx, ty, ui(6))) {
draw_sprite_ui_uniform(THEME.prop_keyframe, 1, tx, ty, 1, COLORS._main_accent, 1);
if(mouse_press(mb_left, pFOCUS)) {
var _add = false;
for(var k = 0; k < ds_list_size(prop.animator.values); k++) {
var _key = prop.animator.values[| k];
if(_key.time == ANIMATOR.current_frame) {
if(ds_list_size(prop.animator.values) > 1)
ds_list_delete(prop.animator.values, k);
_add = true;
break;
} else if(_key.time > ANIMATOR.current_frame) {
ds_list_insert(prop.animator.values, k, new valueKey(ANIMATOR.current_frame, prop.getValue(, false), prop.animator));
_add = true;
break;
}
}
if(!_add) ds_list_add(prop.animator.values, new valueKey(ANIMATOR.current_frame, prop.getValue(, false), prop.animator));
}
} else
draw_sprite_ui_uniform(THEME.prop_keyframe, 1, tx, ty, 1, COLORS._main_accent, 0.75);
#endregion
if(isGraphable(prop)) {
var tx = tool_width - ui(68 + 16 * 0);
if(pHOVER && point_in_circle(msx, msy, tx, ty, ui(8))) {
draw_sprite_ui_uniform(THEME.timeline_graph, 1, tx, ty, 1, COLORS._main_icon, prop.animator.show_graph? 1 : 0.75);
TOOLTIP = get_text("panel_animation_show_graph", "Show graph");
if(mouse_press(mb_left, pFOCUS))
prop.animator.show_graph = !prop.animator.show_graph;
} else
draw_sprite_ui_uniform(THEME.timeline_graph, 1, tx, ty, 1, prop.animator.show_graph? COLORS._main_accent : COLORS._main_icon);
}
var tx = tool_width - ui(72 + 16 * 4.5);
if(pHOVER && point_in_circle(msx, msy, tx, ty, ui(6))) {
draw_sprite_ui_uniform(THEME.prop_on_end, prop.on_end, tx, ty, 1, COLORS._main_icon, 1);
TOOLTIP = get_text("panel_animation_looping_mode", "Looping mode") + ": " + ON_END_NAME[prop.on_end];
if(mouse_press(mb_left, pFOCUS))
prop.on_end = safe_mod(prop.on_end + 1, sprite_get_number(THEME.prop_on_end));
} else
draw_sprite_ui_uniform(THEME.prop_on_end, prop.on_end, tx, ty, 1, COLORS._main_icon, 0.75);
if(pHOVER && point_in_circle(msx, msy, ui(22), ty - 1, ui(10))) {
draw_sprite_ui_uniform(THEME.timeline_clock, 1, ui(22), ty - 1, 1, COLORS._main_icon, 1);
if(mouse_press(mb_left, pFOCUS)) {
prop.animator.is_anim = !prop.animator.is_anim;
updatePropertyList();
}
} else
draw_sprite_ui_uniform(THEME.timeline_clock, 1, ui(22), ty - 1, 1, COLORS._main_icon, 0.75);
var hov = pHOVER && point_in_rectangle(msx, msy, 0, ty - ui(8), w, ty + ui(8));
if(hov) {
value_hovering = prop;
if(mouse_click(mb_left, pFOCUS))
value_focusing = prop;
}
draw_set_color(hov? COLORS._main_text_accent : COLORS._main_text);
draw_set_alpha(aa);
draw_text(ui(32), ty - 2, prop.name);
draw_set_alpha(1);
} //end prop loop
if(pHOVER && point_in_rectangle(msx, msy, 0, _node_y_start, lable_w, ty))
@ -913,6 +982,121 @@ function Panel_Animation() : PanelContent() constructor {
surface_reset_target();
}
function drawDopesheetAnimatorKeysBG(animator, msx, msy) {
var prop_dope_y = animator.dopesheet_y;
var key_hover = noone;
var key_list = animator.values;
if((animator.prop.on_end == KEYFRAME_END.loop || animator.prop.on_end == KEYFRAME_END.ping) && ds_list_size(key_list) > 1) {
var keyframe_s = key_list[| 0].time;
var keyframe_e = key_list[| ds_list_size(key_list) - 1].time;
var ks_x = (keyframe_s + 1) * ui(timeline_scale) + timeline_shift;
var ke_x = (keyframe_e + 1) * ui(timeline_scale) + timeline_shift;
draw_set_color(COLORS.panel_animation_loop_line);
draw_set_alpha(0.2);
draw_line_width(ks_x, prop_dope_y - 1, ke_x, prop_dope_y - 1, 4);
draw_set_alpha(1);
}
for( var k = 0; k < ds_list_size(key_list); k++ ) { //draw easing
var key = key_list[| k];
var t = key.dopesheet_x;
if(key.ease_in_type == CURVE_TYPE.bezier) {
draw_set_color(COLORS.panel_animation_keyframe_ease_line);
var _tx = t - key.ease_in[0] * ui(timeline_scale) * 2;
draw_line_width(_tx, prop_dope_y - 1, t, prop_dope_y - 1, 2);
if(pHOVER && point_in_circle(msx, msy, _tx, prop_dope_y, ui(6))) {
key_hover = key;
draw_sprite_ui_uniform(THEME.timeline_keyframe, 2, _tx, prop_dope_y, 1, COLORS.panel_animation_keyframe_selected);
if(mouse_press(mb_left, pFOCUS)) {
keyframe_dragging = animator.values[| k];
keyframe_drag_type = KEYFRAME_DRAG_TYPE.ease_in;
}
} else
draw_sprite_ui_uniform(THEME.timeline_keyframe, 2, _tx, prop_dope_y, 1, COLORS.panel_animation_keyframe_unselected);
}
if(key.ease_out_type == CURVE_TYPE.bezier) {
draw_set_color(COLORS.panel_animation_keyframe_ease_line);
var _tx = t + key.ease_out[0] * ui(timeline_scale) * 2;
draw_line_width(t, prop_dope_y - 1, _tx, prop_dope_y - 1, 2);
if(pHOVER && point_in_circle(msx, msy, _tx, prop_dope_y, ui(6))) {
key_hover = key;
draw_sprite_ui_uniform(THEME.timeline_keyframe, 3, _tx, prop_dope_y, 1, COLORS.panel_animation_keyframe_selected);
if(mouse_press(mb_left, pFOCUS)) {
keyframe_dragging = animator.values[| k];
keyframe_drag_type = KEYFRAME_DRAG_TYPE.ease_out;
}
} else
draw_sprite_ui_uniform(THEME.timeline_keyframe, 3, _tx, prop_dope_y, 1, COLORS.panel_animation_keyframe_unselected);
}
}
return key_hover;
}
function drawDopesheetAnimatorKeys(_node, animator, msx, msy) {
var prop_y = animator.dopesheet_y;
var key_hover = noone;
var node_y = _node.dopesheet_y + dope_sheet_node_padding;
for(var k = 0; k < ds_list_size(animator.values); k++) {
var keyframe = animator.values[| k];
var t = keyframe.dopesheet_x;
draw_sprite_ui_uniform(THEME.timeline_keyframe, 0, t, node_y, 1, COLORS._main_icon);
if(!_node.anim_show) continue;
var cc = COLORS.panel_animation_keyframe_unselected;
if(pHOVER && point_in_circle(msx, msy, t, prop_y, ui(8))) {
cc = COLORS.panel_animation_keyframe_selected;
key_hover = keyframe;
if(pFOCUS) {
if(DOUBLE_CLICK) {
keyframe_dragging = keyframe;
keyframe_drag_type = KEYFRAME_DRAG_TYPE.ease_both;
keyframe_dragout = false;
keyframe_drag_mx = mx;
keyframe_drag_my = my;
} else if(mouse_press(mb_left)) {
keyframe_dragging = keyframe;
keyframe_drag_type = KEYFRAME_DRAG_TYPE.move;
keyframe_drag_mx = mx;
keyframe_drag_my = my;
keyframe_drag_my = my;
}
}
}
if(stagger_mode == 1 && ds_list_exist(keyframe_selecting, keyframe))
cc = key_hover == keyframe? COLORS.panel_animation_keyframe_selected : COLORS._main_accent;
draw_sprite_ui_uniform(THEME.timeline_keyframe, keyframe.ease_in_type == CURVE_TYPE.cut? 4 : 1, t, prop_y, 1, cc);
if(ds_list_exist(keyframe_selecting, keyframe))
draw_sprite_ui_uniform(THEME.timeline_keyframe_selecting, keyframe.ease_in_type == CURVE_TYPE.cut, t, prop_y, 1, COLORS._main_accent);
if(keyframe_boxing) {
var box_x0 = min(keyframe_box_sx, msx);
var box_x1 = max(keyframe_box_sx, msx);
var box_y0 = min(keyframe_box_sy, msy);
var box_y1 = max(keyframe_box_sy, msy);
if(pHOVER && !point_in_rectangle(t, prop_y, box_x0, box_y0, box_x1, box_y1) && ds_list_exist(keyframe_selecting, keyframe))
ds_list_remove(keyframe_selecting, keyframe);
if(pHOVER && point_in_rectangle(t, prop_y, box_x0, box_y0, box_x1, box_y1) && !ds_list_exist(keyframe_selecting, keyframe))
ds_list_add(keyframe_selecting, keyframe);
}
}
return key_hover;
}
function drawDopesheet() {
var bar_x = tool_width - ui(48);
var bar_y = h - timeline_h - ui(10);
@ -993,8 +1177,20 @@ function Panel_Animation() : PanelContent() constructor {
for( var j = 0; j < ds_list_size(_node.inputs); j++ ) {
var prop = _node.inputs[| j];
if(!prop.animator.is_anim) continue;
if(!prop.is_anim) continue;
if(prop.sep_axis) {
for( var k = 0; k < array_length(prop.animators); k++ ) {
prop.animators[k].dopesheet_y = key_y;
if(prop == value_focusing)
draw_sprite_stretched_ext(THEME.ui_panel_bg, 0, 0, key_y - ui(8), bar_show_w, ui(16), merge_color(COLORS._main_icon, COLORS._main_icon_dark, 0.7), 1);
else if(prop == value_hovering)
draw_sprite_stretched_ext(THEME.ui_panel_bg, 0, 0, key_y - ui(6), bar_show_w, ui(12), COLORS.panel_animation_graph_bg, 1);
key_y += ui(18);
dope_sheet_y_max += ui(18);
}
} else {
prop.animator.dopesheet_y = key_y;
if(prop == value_focusing)
draw_sprite_stretched_ext(THEME.ui_panel_bg, 0, 0, key_y - ui(8), bar_show_w, ui(16), merge_color(COLORS._main_icon, COLORS._main_icon_dark, 0.7), 1);
@ -1003,8 +1199,9 @@ function Panel_Animation() : PanelContent() constructor {
key_y += ui(18);
dope_sheet_y_max += ui(18);
}
if(prop.animator.show_graph) {
if(prop.show_graph) {
draw_sprite_stretched_ext(THEME.ui_panel_bg, 0, 0, key_y - ui(4), bar_show_w, prop.graph_h, COLORS.panel_animation_graph_bg, 1);
key_y += prop.graph_h + ui(8);
dope_sheet_y_max += prop.graph_h + ui(8);
@ -1051,11 +1248,18 @@ function Panel_Animation() : PanelContent() constructor {
for(var i = 0; i < ds_list_size(n.inputs); i++) {
var in = n.inputs[| i];
if(!in.animator.is_anim) continue;
if(!in.is_anim) continue;
for(var j = 0; j < ds_list_size(in.animator.values); j++) {
var t = in.animator.values[| j];
t.time = t.ratio * (len - 1);
}
for( var k = 0; k < array_length(in.animators); k++ )
for(var j = 0; j < ds_list_size(in.animators[k].values); j++) {
var t = in.animators[k].values[| j];
t.time = t.ratio * (len - 1);
}
}
}
}
@ -1089,7 +1293,6 @@ function Panel_Animation() : PanelContent() constructor {
#endregion
draw_set_text(f_p2, fa_left, fa_top);
var key_hover = noone;
#region drag key
if(keyframe_dragging) {
@ -1163,7 +1366,8 @@ function Panel_Animation() : PanelContent() constructor {
}
#endregion
#region draw graph
var key_hover = noone;
#region draw graph, easing line
for( var i = 0; i < ds_list_size(anim_properties); i++ ) {
var _node = anim_properties[| i];
if(!show_node_outside_context && _node.group != PANEL_GRAPH.getCurrentContext()) continue;
@ -1171,62 +1375,25 @@ function Panel_Animation() : PanelContent() constructor {
if(!_node.anim_show) continue;
for( var j = 0; j < ds_list_size(_node.inputs); j++ ) {
var prop = _node.inputs[| j];
if(!prop.animator.is_anim) continue;
var prop_dope_y = prop.animator.dopesheet_y;
if(!prop.is_anim) continue;
var key_list = prop.animator.values;
if((prop.on_end == KEYFRAME_END.loop || prop.on_end == KEYFRAME_END.ping) && ds_list_size(key_list) > 1) {
var keyframe_s = key_list[| 0].time;
var keyframe_e = key_list[| ds_list_size(key_list) - 1].time;
var _dy = prop.animator.dopesheet_y;
var ks_x = (keyframe_s + 1) * ui(timeline_scale) + timeline_shift;
var ke_x = (keyframe_e + 1) * ui(timeline_scale) + timeline_shift;
draw_set_color(COLORS.panel_animation_loop_line);
draw_set_alpha(0.2);
draw_line_width(ks_x, prop_dope_y - 1, ke_x, prop_dope_y - 1, 4);
draw_set_alpha(1);
}
for( var k = 0; k < ds_list_size(key_list); k++ ) { //draw easing
var key = key_list[| k];
var t = key.dopesheet_x;
if(key.ease_in_type == CURVE_TYPE.bezier) {
draw_set_color(COLORS.panel_animation_keyframe_ease_line);
var _tx = t - key.ease_in[0] * ui(timeline_scale) * 2;
draw_line_width(_tx, prop_dope_y - 1, t, prop_dope_y - 1, 2);
if(pHOVER && point_in_circle(msx, msy, _tx, prop_dope_y, ui(6))) {
if(prop.sep_axis) {
for( var k = 0; k < array_length(prop.animators); k++ ) {
var key = drawDopesheetAnimatorKeysBG(prop.animators[k], msx, msy);
_dy = prop.animators[k].dopesheet_y;
if(key != noone)
key_hover = key;
draw_sprite_ui_uniform(THEME.timeline_keyframe, 2, _tx, prop_dope_y, 1, COLORS.panel_animation_keyframe_selected);
if(mouse_press(mb_left, pFOCUS)) {
keyframe_dragging = prop.animator.values[| k];
keyframe_drag_type = KEYFRAME_DRAG_TYPE.ease_in;
}
} else
draw_sprite_ui_uniform(THEME.timeline_keyframe, 2, _tx, prop_dope_y, 1, COLORS.panel_animation_keyframe_unselected);
}
if(key.ease_out_type == CURVE_TYPE.bezier) {
draw_set_color(COLORS.panel_animation_keyframe_ease_line);
var _tx = t + key.ease_out[0] * ui(timeline_scale) * 2;
draw_line_width(t, prop_dope_y - 1, _tx, prop_dope_y - 1, 2);
if(pHOVER && point_in_circle(msx, msy, _tx, prop_dope_y, ui(6))) {
} else {
var key = drawDopesheetAnimatorKeysBG(prop.animator, msx, msy);
if(key != noone)
key_hover = key;
draw_sprite_ui_uniform(THEME.timeline_keyframe, 3, _tx, prop_dope_y, 1, COLORS.panel_animation_keyframe_selected);
if(mouse_press(mb_left, pFOCUS)) {
keyframe_dragging = prop.animator.values[| k];
keyframe_drag_type = KEYFRAME_DRAG_TYPE.ease_out;
}
} else
draw_sprite_ui_uniform(THEME.timeline_keyframe, 3, _tx, prop_dope_y, 1, COLORS.panel_animation_keyframe_unselected);
}
}
if(isGraphable(prop) && prop.animator.show_graph)
drawDopesheetGraph(prop, prop_dope_y, msx, msy);
if(isGraphable(prop) && prop.show_graph)
drawDopesheetGraph(prop, _dy, msx, msy);
}
}
#endregion
@ -1245,61 +1412,22 @@ function Panel_Animation() : PanelContent() constructor {
#region draw keys
for( var i = 0; i < ds_list_size(anim_properties); i++ ) {
var _node = anim_properties[| i];
var node_y = _node.dopesheet_y + dope_sheet_node_padding;
if(!show_node_outside_context && _node.group != PANEL_GRAPH.getCurrentContext()) continue;
for( var j = 0; j < ds_list_size(_node.inputs); j++ ) {
var prop = _node.inputs[| j];
if(!prop.animator.is_anim) continue;
var prop_y = prop.animator.dopesheet_y;
if(!prop.is_anim) continue;
for(var k = 0; k < ds_list_size(prop.animator.values); k++) {
var keyframe = prop.animator.values[| k];
var t = keyframe.dopesheet_x;
draw_sprite_ui_uniform(THEME.timeline_keyframe, 0, t, node_y, 1, COLORS._main_icon);
if(!_node.anim_show) continue;
var cc = COLORS.panel_animation_keyframe_unselected;
if(pHOVER && point_in_circle(msx, msy, t, prop_y, ui(8))) {
cc = COLORS.panel_animation_keyframe_selected;
key_hover = keyframe;
if(pFOCUS) {
if(DOUBLE_CLICK) {
keyframe_dragging = keyframe;
keyframe_drag_type = KEYFRAME_DRAG_TYPE.ease_both;
keyframe_dragout = false;
keyframe_drag_mx = mx;
keyframe_drag_my = my;
} else if(mouse_press(mb_left)) {
keyframe_dragging = keyframe;
keyframe_drag_type = KEYFRAME_DRAG_TYPE.move;
keyframe_drag_mx = mx;
keyframe_drag_my = my;
keyframe_drag_my = my;
}
}
}
if(stagger_mode == 1 && ds_list_exist(keyframe_selecting, keyframe))
cc = key_hover == keyframe? COLORS.panel_animation_keyframe_selected : COLORS._main_accent;
draw_sprite_ui_uniform(THEME.timeline_keyframe, keyframe.ease_in_type == CURVE_TYPE.cut? 4 : 1, t, prop_y, 1, cc);
if(ds_list_exist(keyframe_selecting, keyframe))
draw_sprite_ui_uniform(THEME.timeline_keyframe_selecting, keyframe.ease_in_type == CURVE_TYPE.cut, t, prop_y, 1, COLORS._main_accent);
if(keyframe_boxing) {
var box_x0 = min(keyframe_box_sx, msx);
var box_x1 = max(keyframe_box_sx, msx);
var box_y0 = min(keyframe_box_sy, msy);
var box_y1 = max(keyframe_box_sy, msy);
if(pHOVER && !point_in_rectangle(t, prop_y, box_x0, box_y0, box_x1, box_y1) && ds_list_exist(keyframe_selecting, keyframe))
ds_list_remove(keyframe_selecting, keyframe);
if(pHOVER && point_in_rectangle(t, prop_y, box_x0, box_y0, box_x1, box_y1) && !ds_list_exist(keyframe_selecting, keyframe))
ds_list_add(keyframe_selecting, keyframe);
if(prop.sep_axis) {
for( var k = 0; k < array_length(prop.animators); k++ ) {
var key = drawDopesheetAnimatorKeys(_node, prop.animators[k], msx, msy);
if(key != noone)
key_hover = key;
}
} else {
var key = drawDopesheetAnimatorKeys(_node, prop.animator, msx, msy);
if(key != noone)
key_hover = key;
}
}
}

View file

@ -50,6 +50,20 @@ function Panel(_parent, _x, _y, _w, _h) constructor {
tab_holding_sx = 0;
tab_holding_sy = 0;
border_rb_close = menuItem("Close", function() {
extract();
o_main.panel_dragging = noone;
}, THEME.cross);
border_rb_menu = [
menuItem("Move", function() {
extract();
panel_mouse = 1;
}),
menuItem("Pop out", function() { popWindow(); }, THEME.node_goto),
border_rb_close
];
static getContent = function() { return array_safe_get(content, content_index, noone, ARRAY_OVERFLOW._default); }
static hasContent = function() { return bool(array_length(content)); }
@ -198,8 +212,7 @@ function Panel(_parent, _x, _y, _w, _h) constructor {
for( var i = 0; i < array_length(content); i++ )
content[i].onSetPanel(self);
if(_switch)
content_index = array_find(content, _content);
if(_switch) content_index = array_find(content, _content);
refresh();
}
@ -458,7 +471,10 @@ function Panel(_parent, _x, _y, _w, _h) constructor {
draw_set_text(f_p3, fa_left, fa_bottom, COLORS._main_text_sub);
for( var i = 0; i < array_length(content); i++ ) {
var txt = content[i].title;
var icn = content[i].icon;
var tbw = string_width(txt) + ui(16);
if(icn != noone) tbw += ui(16 + 4);
var foc = false;
tab_width += tbw + ui(2);
@ -498,9 +514,23 @@ function Panel(_parent, _x, _y, _w, _h) constructor {
tab_holding_my = msy;
tab_holding_sx = tab_holding.tab_x;
}
if(mouse_press(mb_right, FOCUS == self)) {
var menu = array_clone(border_rb_menu);
if(instanceof(content[i]) == "Panel_Menu")
array_remove(menu, 2, border_rb_close);
menuCall(,, menu);
}
}
draw_set_text(f_p3, fa_left, fa_bottom, foc? COLORS.panel_bg_clear_inner : COLORS._main_text_sub);
var cc = foc? COLORS.panel_bg_clear_inner : COLORS._main_text_sub;
if(icn != noone) {
draw_sprite_ui(icn, 0, _tbx + ui(8 + 8), tab_height / 2 + ui(1),,,, cc);
_tbx += ui(20);
}
draw_set_text(f_p3, fa_left, fa_bottom, cc);
draw_text(_tbx + ui(8), tab_height - ui(2), txt);
tbx += tbw + ui(2);
@ -517,11 +547,18 @@ function Panel(_parent, _x, _y, _w, _h) constructor {
var _tbx = tab_holding.tab_x;
var txt = tab_holding.title;
var icn = tab_holding.icon;
var tbw = string_width(txt) + ui(16);
if(icn != noone) tbw += ui(16 + 4);
draw_set_color(COLORS._main_accent);
draw_roundrect_ext(_tbx, tby, _tbx + tbw, tby + ui(32), ui(8), ui(8), false);
var cc = COLORS.panel_bg_clear_inner;
if(icn != noone) {
draw_sprite_ui(icn, 0, _tbx + ui(8 + 8), tab_height / 2 + ui(1),,,, cc);
_tbx += ui(20);
}
draw_set_text(f_p3, fa_left, fa_bottom, COLORS.panel_bg_clear_inner);
draw_text(_tbx + ui(8), tab_height - ui(2), txt);
@ -605,20 +642,11 @@ function Panel(_parent, _x, _y, _w, _h) constructor {
extract();
panel_mouse = 0;
} else if(mouse_press(mb_right)) {
var arr = [
menuItem("Move", function() {
extract();
panel_mouse = 1;
}),
menuItem("Pop out", function() { popWindow(); }, THEME.node_goto),
];
if(instanceof(getContent()) != "Panel_Menu")
array_push(arr, menuItem("Close", function() {
extract();
o_main.panel_dragging = noone;
}, THEME.cross));
var menu = array_clone(border_rb_menu);
if(instanceof(getContent()) == "Panel_Menu")
array_remove(menu, 2, border_rb_close);
menuCall(,, arr);
menuCall(,, menu);
}
}
}
@ -753,6 +781,7 @@ function Panel(_parent, _x, _y, _w, _h) constructor {
function PanelContent() constructor {
title = "";
icon = noone;
context_str = "";
draggable = true;
expandable = true;

View file

@ -93,7 +93,9 @@
function panelAdd(panel, create = false) {
var pan = getPanelFromName(panel, create);
if(pan) dialogPanelCall(pan);
if(pan == noone) return noone;
return dialogPanelCall(pan);
}
function panelObjectInit() {

View file

@ -1,6 +1,7 @@
function Panel_Graph() : PanelContent() constructor {
title = "Graph";
context_str = "Graph";
icon = THEME.panel_graph;
scale = [ 0.25, 0.33, 0.5, 0.65, 0.8, 1, 1.2, 1.35, 1.5];
graph_s_index = 5;
@ -10,16 +11,6 @@ function Panel_Graph() : PanelContent() constructor {
grid_color = c_white;
grid_opacity = 0.05;
function toOrigin() {
graph_x = round(w / 2 / graph_s);
graph_y = round(h / 2 / graph_s);
}
function initSize() {
toOrigin();
}
initSize();
graph_draggable= true;
graph_dragging = false;
graph_drag_mx = 0;
@ -97,6 +88,39 @@ function Panel_Graph() : PanelContent() constructor {
connection_aa = 2;
connection_surface = surface_create(1, 1);
function toCenterNode() {
if(ds_list_empty(nodes_list)) {
graph_x = round(w / 2 / graph_s);
graph_y = round(h / 2 / graph_s);
return;
}
var minx = 99999;
var maxx = -99999;
var miny = 99999;
var maxy = -99999;
for(var i = 0; i < ds_list_size(nodes_list); i++) {
var n = nodes_list[| i];
minx = min(n.x - 32, minx);
maxx = max(n.x + n.w + 32, maxx);
miny = min(n.y - 32, miny);
maxy = max(n.y + n.h + 32, maxy);
}
graph_x = w / 2 / graph_s - (minx + maxx) / 2;
graph_y = (h - toolbar_height) / 2 / graph_s - (miny + maxy) / 2;
graph_x = round(graph_x);
graph_y = round(graph_y);
//print(title + ": Center " + string(graph_x) + ", " + string(graph_y));
}
function initSize() { toCenterNode(); }
initSize();
toolbar_height = ui(40);
toolbars = [
[
@ -140,18 +164,18 @@ function Panel_Graph() : PanelContent() constructor {
],
];
addHotkey("Graph", "Add node", "A", MOD_KEY.none, function() { callAddDialog(); });
addHotkey("Graph", "Focus content", "F", MOD_KEY.none, function() { fullView(); });
addHotkey("Graph", "Preview focusing node", "P", MOD_KEY.none, function() { setCurrentPreview(); });
addHotkey("Graph", "Preview window", "P", MOD_KEY.ctrl, function() { previewWindow(node_focus); });
addHotkey("Graph", "Import image", "I", MOD_KEY.none, function() { nodeBuild("Node_Image", mouse_grid_x, mouse_grid_y); });
addHotkey("Graph", "Import image array", "I", MOD_KEY.shift, function() { nodeBuild("Node_Image_Sequence", mouse_grid_x, mouse_grid_y); });
addHotkey("Graph", "Add number", "1", MOD_KEY.none, function() { nodeBuild("Node_Number", mouse_grid_x, mouse_grid_y); });
addHotkey("Graph", "Add vector2", "2", MOD_KEY.none, function() { nodeBuild("Node_Vector2", mouse_grid_x, mouse_grid_y); });
addHotkey("Graph", "Add vector3", "3", MOD_KEY.none, function() { nodeBuild("Node_Vector3", mouse_grid_x, mouse_grid_y); });
addHotkey("Graph", "Add vector4", "4", MOD_KEY.none, function() { nodeBuild("Node_Vector4", mouse_grid_x, mouse_grid_y); });
addHotkey("Graph", "Add node", "A", MOD_KEY.none, function() { PANEL_GRAPH.callAddDialog(); });
addHotkey("Graph", "Focus content", "F", MOD_KEY.none, function() { PANEL_GRAPH.fullView(); });
addHotkey("Graph", "Preview focusing node", "P", MOD_KEY.none, function() { PANEL_GRAPH.setCurrentPreview(); });
addHotkey("Graph", "Preview window", "P", MOD_KEY.ctrl, function() { PANEL_GRAPH.previewWindow(PANEL_GRAPH.node_focus); });
addHotkey("Graph", "Import image", "I", MOD_KEY.none, function() { nodeBuild("Node_Image", PANEL_GRAPH.mouse_grid_x, PANEL_GRAPH.mouse_grid_y); });
addHotkey("Graph", "Import image array", "I", MOD_KEY.shift, function() { nodeBuild("Node_Image_Sequence", PANEL_GRAPH.mouse_grid_x, PANEL_GRAPH.mouse_grid_y); });
addHotkey("Graph", "Add number", "1", MOD_KEY.none, function() { nodeBuild("Node_Number", PANEL_GRAPH.mouse_grid_x, PANEL_GRAPH.mouse_grid_y); });
addHotkey("Graph", "Add vector2", "2", MOD_KEY.none, function() { nodeBuild("Node_Vector2", PANEL_GRAPH.mouse_grid_x, PANEL_GRAPH.mouse_grid_y); });
addHotkey("Graph", "Add vector3", "3", MOD_KEY.none, function() { nodeBuild("Node_Vector3", PANEL_GRAPH.mouse_grid_x, PANEL_GRAPH.mouse_grid_y); });
addHotkey("Graph", "Add vector4", "4", MOD_KEY.none, function() { nodeBuild("Node_Vector4", PANEL_GRAPH.mouse_grid_x, PANEL_GRAPH.mouse_grid_y); });
static addNodeTransform = function() {
function addNodeTransform() {
if(ds_list_empty(nodes_select_list)) {
if(node_focus != noone && !ds_list_empty(node_focus.outputs)) {
var _o = node_focus.outputs[| 0];
@ -173,8 +197,8 @@ function Panel_Graph() : PanelContent() constructor {
}
}
}
addNodeTransform = method(self, addNodeTransform);
addHotkey("Graph", "Transform node", "T", MOD_KEY.ctrl, addNodeTransform);
addHotkey("Graph", "Transform node", "T", MOD_KEY.ctrl, function() { PANEL_GRAPH.addNodeTransform(); });
addHotkey("Graph", "Select all", "A", MOD_KEY.ctrl, function() {
ds_list_clear(nodes_select_list);
@ -183,45 +207,38 @@ function Panel_Graph() : PanelContent() constructor {
}
});
addHotkey("Graph", "Toggle grid", "G", MOD_KEY.none, function() { show_grid = !show_grid; });
addHotkey("Graph", "Toggle preview", "H", MOD_KEY.none, function() { setTriggerPreview(); });
addHotkey("Graph", "Toggle render", "R", MOD_KEY.none, function() { setTriggerRender(); });
addHotkey("Graph", "Toggle grid", "G", MOD_KEY.none, function() { PANEL_GRAPH.show_grid = !PANEL_GRAPH.show_grid; });
addHotkey("Graph", "Toggle preview", "H", MOD_KEY.none, function() { PANEL_GRAPH.setTriggerPreview(); });
addHotkey("Graph", "Toggle render", "R", MOD_KEY.none, function() { PANEL_GRAPH.setTriggerRender(); });
if(!DEMO)
addHotkey("Graph", "Export", "E", MOD_KEY.ctrl, function() { setCurrentExport(); });
addHotkey("Graph", "Export", "E", MOD_KEY.ctrl, function() { PANEL_GRAPH.setCurrentExport(); });
addHotkey("Graph", "Blend", "B", MOD_KEY.ctrl, function() { doBlend(); });
addHotkey("Graph", "Compose", "B", MOD_KEY.ctrl | MOD_KEY.shift, function() { doCompose(); });
addHotkey("Graph", "Array", "A", MOD_KEY.ctrl | MOD_KEY.shift, function() { doArray(); });
addHotkey("Graph", "Blend", "B", MOD_KEY.ctrl, function() { PANEL_GRAPH.doBlend(); });
addHotkey("Graph", "Compose", "B", MOD_KEY.ctrl | MOD_KEY.shift, function() { PANEL_GRAPH.doCompose(); });
addHotkey("Graph", "Array", "A", MOD_KEY.ctrl | MOD_KEY.shift, function() { PANEL_GRAPH.doArray(); });
addHotkey("Graph", "Group", "G", MOD_KEY.ctrl, function() { doGroup(); });
addHotkey("Graph", "Ungroup", "G", MOD_KEY.ctrl | MOD_KEY.shift, function() { doUngroup(); });
addHotkey("Graph", "Group", "G", MOD_KEY.ctrl, function() { PANEL_GRAPH.doGroup(); });
addHotkey("Graph", "Ungroup", "G", MOD_KEY.ctrl | MOD_KEY.shift, function() { PANEL_GRAPH.doUngroup(); });
addHotkey("Graph", "Loop", "L", MOD_KEY.ctrl, function() { doLoop(); });
addHotkey("Graph", "Loop", "L", MOD_KEY.ctrl, function() { PANEL_GRAPH.doLoop(); });
addHotkey("Graph", "Canvas", "C", MOD_KEY.ctrl | MOD_KEY.shift, function() { setCurrentCanvas(); });
addHotkey("Graph", "Canvas blend", "C", MOD_KEY.ctrl | MOD_KEY.alt, function() { setCurrentCanvasBlend(); });
addHotkey("Graph", "Canvas", "C", MOD_KEY.ctrl | MOD_KEY.shift, function() { PANEL_GRAPH.setCurrentCanvas(); });
addHotkey("Graph", "Canvas blend", "C", MOD_KEY.ctrl | MOD_KEY.alt, function() { PANEL_GRAPH.setCurrentCanvasBlend(); });
addHotkey("Graph", "Frame", "F", MOD_KEY.ctrl, function() { doFrame(); });
addHotkey("Graph", "Frame", "F", MOD_KEY.ctrl, function() { PANEL_GRAPH.doFrame(); });
addHotkey("Graph", "Delete (break)", vk_delete, MOD_KEY.shift, function() { doDelete(false); });
addHotkey("Graph", "Delete (merge)", vk_delete, MOD_KEY.none, function() { doDelete(true); });
addHotkey("Graph", "Delete (break)", vk_delete, MOD_KEY.shift, function() { PANEL_GRAPH.doDelete(false); });
addHotkey("Graph", "Delete (merge)", vk_delete, MOD_KEY.none, function() { PANEL_GRAPH.doDelete(true); });
addHotkey("Graph", "Duplicate", "D", MOD_KEY.ctrl, function() { doDuplicate(); });
addHotkey("Graph", "Copy", "C", MOD_KEY.ctrl, function() { doCopy(); });
addHotkey("Graph", "Paste", "V", MOD_KEY.ctrl, function() { doPaste(); });
addHotkey("Graph", "Duplicate", "D", MOD_KEY.ctrl, function() { PANEL_GRAPH.doDuplicate(); });
addHotkey("Graph", "Copy", "C", MOD_KEY.ctrl, function() { PANEL_GRAPH.doCopy(); });
addHotkey("Graph", "Paste", "V", MOD_KEY.ctrl, function() { PANEL_GRAPH.doPaste(); });
addHotkey("Graph", "Tunnels", "T", MOD_KEY.none, function() {
var tun = new Panel_Tunnels();
var dia = dialogPanelCall(tun, mouse_mx + ui(8), mouse_my + ui(8));
dia.anchor = ANCHOR.left | ANCHOR.top;
dia.resetPosition();
tun.build_x = PANEL_GRAPH.mouse_grid_x;
tun.build_y = PANEL_GRAPH.mouse_grid_y;
});
function onFocusBegin() { PANEL_GRAPH = self; }
function onFocusBegin() {
PANEL_GRAPH = self;
PANEL_ANIMATION.updatePropertyList();
}
function stepBegin() {
var gr_x = graph_x * graph_s;
@ -249,28 +266,14 @@ function Panel_Graph() : PanelContent() constructor {
graph_y = round(graph_y);
}
function toCenterNode() {
if(ds_list_empty(nodes_list)) {
toOrigin();
function fullView() {
if(node_focus == noone) {
toCenterNode();
return;
}
var minx = 99999;
var maxx = -99999;
var miny = 99999;
var maxy = -99999;
for(var i = 0; i < ds_list_size(nodes_list); i++) {
var n = nodes_list[| i];
minx = min(n.x - 32, minx);
maxx = max(n.x + n.w + 32, maxx);
miny = min(n.y - 32, miny);
maxy = max(n.y + n.h + 32, maxy);
}
graph_x = w / 2 / graph_s - (minx + maxx) / 2;
graph_y = (h - toolbar_height) / 2 / graph_s - (miny + maxy) / 2;
graph_x = -(node_focus.x + node_focus.w / 2) + w / 2 / graph_s;
graph_y = -(node_focus.y + node_focus.h / 2) + h / 2 / graph_s;
graph_x = round(graph_x);
graph_y = round(graph_y);
@ -478,6 +481,13 @@ function Panel_Graph() : PanelContent() constructor {
menuItem(get_text("panel_graph_preview_window", "Send to preview window"), function() {
previewWindow(node_hover);
}, noone, ["Graph", "Preview window"]));
array_push(menu,
menuItem(get_text("panel_graph_inspector_panel", "Send to new inspector"), function() {
var pan = panelAdd("Panel_Inspector", true);
pan.destroy_on_click_out = false;
pan.content.inspecting = node_hover;
pan.content.locked = true;
}));
if(DEMO) {
array_push(menu,
@ -496,12 +506,31 @@ function Panel_Graph() : PanelContent() constructor {
}, noone, ["Graph", "Toggle render"]));
if(struct_has(node_hover, "nodes")) {
array_push(menu, -1);
array_push(menu,
menuItem(get_text("panel_graph_enter_group", "Enter group"), function() {
menuItem(get_text("panel_graph_enter_group", "Open group"), function() {
PANEL_GRAPH.addContext(node_hover);
}, THEME.group));
array_push(menu,
menuItem(get_text("panel_graph_enter_group_new_tab", "Open group in new tab"), function() {
var graph = new Panel_Graph();
panel.setContent(graph, true);
for( var i = 0; i < ds_list_size(node_context); i++ )
graph.addContext(node_context[| i]);
graph.addContext(node_hover);
setFocus(panel);
}, THEME.group));
array_push(menu,
menuItem(get_text("panel_graph_ungroup", "Ungroup"), function() {
doUngroup();
}, THEME.group, ["Graph", "Ungroup"]));
}
array_push(menu, -1);
array_push(menu,
menuItem(get_text("panel_graph_delete_and_merge_connection", "Delete and merge connection"), function() {
doDelete(true);
@ -558,11 +587,6 @@ function Panel_Graph() : PanelContent() constructor {
menuItem(get_text("panel_graph_frame_nodes", "Frame nodes"), function() {
doFrame();
}, noone, ["Graph", "Frame"]));
} else if(variable_struct_exists(node_hover, "nodes")) {
array_push(menu,
menuItem(get_text("panel_graph_ungroup", "Ungroup"), function() {
doUngroup();
}, THEME.group, ["Graph", "Ungroup"]));
}
menuCall(,, menu );
@ -1414,6 +1438,7 @@ function Panel_Graph() : PanelContent() constructor {
if(i == -1) {
ds_list_clear(node_context);
title = "Graph";
nodes_list = NODES;
toCenterNode();
PANEL_ANIMATION.updatePropertyList();
@ -1422,6 +1447,9 @@ function Panel_Graph() : PanelContent() constructor {
ds_list_delete(node_context, j);
nodes_list = node_context[| i].getNodeList();
toCenterNode();
var node = getCurrentContext();
title = node.display_name == ""? node.name : node.display_name;
PANEL_ANIMATION.updatePropertyList();
break;
}
@ -1611,6 +1639,8 @@ function Panel_Graph() : PanelContent() constructor {
}
function addContext(node) {
title = node.display_name == ""? node.name : node.display_name;
var _node = node.getNodeBase();
setContextFrame(false, _node);
@ -1650,20 +1680,6 @@ function Panel_Graph() : PanelContent() constructor {
return false;
}
function fullView() {
if(node_focus) {
graph_x = -(node_focus.x + node_focus.w / 2) + w / 2 / graph_s;
graph_y = -(node_focus.y + node_focus.h / 2) + h / 2 / graph_s;
graph_x = round(graph_x);
graph_y = round(graph_y);
return;
}
toCenterNode();
return;
}
function drawContent(panel) {
dragGraph();

View file

@ -6,6 +6,10 @@ function Inspector_Custom_Renderer(draw) : widget() constructor {
function Panel_Inspector() : PanelContent() constructor {
title = "Inspector";
context_str = "Inspector";
icon = THEME.panel_inspector;
w = ui(400);
h = ui(640);
locked = false;
inspecting = noone;
@ -60,9 +64,9 @@ function Panel_Inspector() : PanelContent() constructor {
workshop_uploading = false;
addHotkey("Inspector", "Copy property", "C", MOD_KEY.ctrl, function() { propSelectCopy(); });
addHotkey("Inspector", "Paste property", "V", MOD_KEY.ctrl, function() { propSelectPaste(); });
addHotkey("Inspector", "Toggle animation", "I", MOD_KEY.none, function() { anim_toggling = true; });
addHotkey("Inspector", "Copy property", "C", MOD_KEY.ctrl, function() { PANEL_INSPECTOR.propSelectCopy(); });
addHotkey("Inspector", "Paste property", "V", MOD_KEY.ctrl, function() { PANEL_INSPECTOR.propSelectPaste(); });
addHotkey("Inspector", "Toggle animation", "I", MOD_KEY.none, function() { PANEL_INSPECTOR.anim_toggling = true; });
group_menu = [
menuItem("Expand all", function() {
@ -406,7 +410,7 @@ function Panel_Inspector() : PanelContent() constructor {
if(_hover && point_in_rectangle(_m[0], _m[1], 4, _selY, contentPane.surface_w - ui(4), _selY + _selH)) {
draw_sprite_stretched_ext(THEME.prop_selecting, 0, 4, _selY, contentPane.surface_w - ui(8), _selH, COLORS._main_accent, 1);
if(anim_toggling) {
jun.animator.is_anim = !jun.animator.is_anim;
jun.setAnim(!jun.is_anim);
PANEL_ANIMATION.updatePropertyList();
anim_toggling = false;
}
@ -420,15 +424,26 @@ function Panel_Inspector() : PanelContent() constructor {
var _menuItem = [];
if(i < amoIn) {
array_push(_menuItem, menuItem(get_text("panel_inspector_reset", "Reset value"), function() {
array_push(_menuItem,
menuItem(get_text("panel_inspector_reset", "Reset value"), function() {
__dialog_junction.setValue(__dialog_junction.def_val);
}),
menuItem(jun.animator.is_anim? get_text("panel_inspector_remove", "Remove animation") : get_text("panel_inspector_add", "Add animation"), function() {
__dialog_junction.animator.is_anim = !__dialog_junction.animator.is_anim;
menuItem(jun.is_anim? get_text("panel_inspector_remove", "Remove animation") : get_text("panel_inspector_add", "Add animation"), function() {
__dialog_junction.setAnim(!__dialog_junction.is_anim);
PANEL_ANIMATION.updatePropertyList();
}),
-1,
);
if(jun.sepable) {
array_push(_menuItem,
menuItem(jun.sep_axis? get_text("panel_inspector_axis_combine", "Combine axis") : get_text("panel_inspector_axis_separate", "Separate axis"), function() {
__dialog_junction.sep_axis = !__dialog_junction.sep_axis;
PANEL_ANIMATION.updatePropertyList();
}),
);
}
array_push(_menuItem, -1);
}
array_push(_menuItem,
@ -516,9 +531,12 @@ function Panel_Inspector() : PanelContent() constructor {
draw_sprite_stretched(THEME.ui_panel_bg, 1, ui(8), top_bar_h - ui(8), w - ui(16), h - top_bar_h);
if(inspecting)
if(inspecting) {
title = inspecting.display_name == ""? inspecting.name : inspecting.display_name;
drawInspectingNode();
else {
} else {
title = "Inspector";
var txt = "Untitled";
var context = PANEL_GRAPH.getCurrentContext();

View file

@ -1,6 +1,7 @@
function Panel_Preview() : PanelContent() constructor {
title = "Preview";
context_str = "Preview";
icon = THEME.panel_preview;
last_focus = noone;
@ -35,6 +36,8 @@ function Panel_Preview() : PanelContent() constructor {
preview_surface = [ 0, 0 ];
tile_surface = surface_create(1, 1);
inspect_node = noone;
preview_x = 0;
preview_x_to = 0;
preview_x_max = 0;
@ -138,12 +141,11 @@ function Panel_Preview() : PanelContent() constructor {
tb_framerate = new textBox(TEXTBOX_INPUT.number, function(val) { preview_rate = real(val); });
addHotkey("Preview", "Focus content", "F", MOD_KEY.none, function() { fullView(); });
addHotkey("Preview", "Save current frame", "S", MOD_KEY.shift, function() { saveCurrentFrame(); });
addHotkey("Preview", "Save all current frame", -1, MOD_KEY.none, function() { saveAllCurrentFrames(); });
addHotkey("Preview", "Preview window", "P", MOD_KEY.ctrl, function() { previewWindow(getNodePreview()); });
addHotkey("Preview", "Toggle grid", "G", MOD_KEY.ctrl, function() { grid_show = !grid_show; });
addHotkey("Preview", "Focus content", "F", MOD_KEY.none, function() { PANEL_PREVIEW.fullView(); });
addHotkey("Preview", "Save current frame", "S", MOD_KEY.shift, function() { PANEL_PREVIEW.saveCurrentFrame(); });
addHotkey("Preview", "Save all current frame", -1, MOD_KEY.none, function() { PANEL_PREVIEW.saveAllCurrentFrames(); });
addHotkey("Preview", "Preview window", "P", MOD_KEY.ctrl, function() { PANEL_PREVIEW.previewWindow(PANEL_PREVIEW.getNodePreview()); });
addHotkey("Preview", "Toggle grid", "G", MOD_KEY.ctrl, function() { PANEL_PREVIEW.grid_show = !PANEL_PREVIEW.grid_show; });
function setNodePreview(node) {
if(resetViewOnDoubleClick)
@ -233,9 +235,11 @@ function Panel_Preview() : PanelContent() constructor {
}
var _canvas_s = canvas_s;
var inc = 0.5;
var inc = 0.1;
if(canvas_s > 16) inc = 2;
else if(canvas_s > 8) inc = 1;
else if(canvas_s > 3) inc = 0.5;
else if(canvas_s > 1) inc = 0.25;
if(mouse_wheel_down()) canvas_s = max(round(canvas_s / inc) * inc - inc, 0.10);
if(mouse_wheel_up()) canvas_s = min(round(canvas_s / inc) * inc + inc, 64);
@ -341,6 +345,10 @@ function Panel_Preview() : PanelContent() constructor {
var ssh = surface_get_height(preview_surface[1]);
}
var _node = getNodePreview();
if(_node)
title = _node.display_name == ""? _node.name : _node.display_name;
switch(splitView) {
case 0 :
if(is_surface(preview_surface[0])) {
@ -799,7 +807,7 @@ function Panel_Preview() : PanelContent() constructor {
} else
draw_line_width(sx, 0, sx, h, 1);
draw_sprite_ui_uniform(THEME.icon_active_split, 0, splitSelection? sx + ui(16) : sx - ui(16), ui(16),, COLORS._main_accent);
draw_sprite_ui_uniform(THEME.icon_active_split, 0, splitSelection? sx + ui(16) : sx - ui(16), toolbar_height + ui(16),, COLORS._main_accent);
if(mouse_on_preview && mouse_press(mb_left, pFOCUS)) {
if(point_in_rectangle(mx, my, 0, 0, sx, h))
@ -839,15 +847,20 @@ function Panel_Preview() : PanelContent() constructor {
else
draw_clear(canvas_bg);
title = "Preview";
dragCanvas();
getPreviewData();
drawNodePreview();
drawPreviewOverlay();
if(PANEL_GRAPH.node_focus)
drawNodeTools(pFOCUS, PANEL_GRAPH.node_focus);
if(last_focus != PANEL_GRAPH.node_focus) {
last_focus = PANEL_GRAPH.node_focus;
if(PANEL_PREVIEW == self)
inspect_node = PANEL_GRAPH.node_focus;
if(inspect_node)
drawNodeTools(pFOCUS, inspect_node);
if(last_focus != inspect_node) {
last_focus = inspect_node;
tool_current = noone;
}

View file

@ -96,7 +96,7 @@
if(!ds_map_exists(HOTKEYS, _context)) {
HOTKEYS[? _context] = ds_list_create();
if(ds_list_find_index(HOTKEY_CONTEXT, _context) == -1)
if(!ds_list_exist(HOTKEY_CONTEXT, _context))
ds_list_add(HOTKEY_CONTEXT, _context);
}
@ -203,6 +203,9 @@
var path = DIRECTORY + "keys.json";
file_text_write_all(path, json_encode_minify(map));
ds_map_destroy(map);
var path = DIRECTORY + "Nodes/fav.json";
json_save_struct(path, global.FAV_NODES);
}
function PREF_LOAD() {

View file

@ -53,7 +53,9 @@ function save_serialize() {
ds_map_add_map(_map, "global", GLOBAL.serialize());
_map[? "preview"] = surface_encode(PANEL_PREVIEW.getNodePreviewSurface());
var prev = PANEL_PREVIEW.getNodePreviewSurface();
if(!is_surface(prev)) _map[? "preview"] = "";
else _map[? "preview"] = surface_encode(surface_size_lim(prev, 128, 128));
var val = json_encode_minify(_map);
ds_map_destroy(_map);

View file

@ -53,3 +53,43 @@ function shader_set_surface(shader, sampler, surface) {
var t = shader_get_sampler_index(shader, sampler);
texture_set_stage(t, surface_get_texture(surface));
}
#region prebuild
enum BLEND {
normal,
add,
over,
alpha,
alphamulp,
}
function shader_set_interpolation(surface) {
var shader = shader_current();
var intp = ds_map_try_get(attributes, "interpolation", 0);
gpu_set_tex_filter(intp);
shader_set_i(shader, "interpolation", intp);
shader_set_f(shader, "sampleDimension", surface_get_width(surface), surface_get_height(surface));
}
function surface_set_shader(surface, shader = sh_sample, clear = true, blend = BLEND.over) {
surface_set_target(surface);
if(clear) DRAW_CLEAR;
switch(blend) {
case BLEND.add : BLEND_ADD; break;
case BLEND.over: BLEND_OVERRIDE; break;
case BLEND.alpha: BLEND_ALPHA; break;
case BLEND.alphamulp: BLEND_ALPHA_MULP; break;
}
shader_set(shader);
}
function surface_reset_shader() {
gpu_set_tex_filter(false);
BLEND_NORMAL;
surface_reset_target();
shader_reset();
}
#endregion

View file

@ -1,7 +1,7 @@
{
"resourceType": "GMScript",
"resourceVersion": "1.0",
"name": "shader_set_functions",
"name": "shader_functions",
"isCompatibility": false,
"isDnD": false,
"parent": {

View file

@ -1,4 +1,4 @@
function __init_theme() {
function __initTheme() {
var root = DIRECTORY + "Themes";
if(!directory_exists(root))
directory_create(root);

View file

@ -158,6 +158,20 @@ function surface_create_from_sprite_ext(spr, ind, format = surface_rgba8unorm) {
return s;
}
function surface_size_lim(surface, width, height) {
var sw = surface_get_width(surface);
var sh = surface_get_height(surface);
if(sw <= width && sh <= height) return surface;
var ss = min(width / sw, height / sh);
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);
surface_reset_target();
return s;
}
function surface_size_to(surface, width, height, format = noone) {
if(!is_surface(surface)) return surface;
if(width < 1 && height < 1) return surface;

View file

@ -3,8 +3,8 @@
"resourceVersion": "1.0",
"name": "sh_camera",
"parent": {
"name": "shader",
"path": "folders/shader.yy",
"name": "misc",
"path": "folders/shader/misc.yy",
},
"type": 1,
}

View file

@ -8,6 +8,54 @@ uniform vec2 dimension;
uniform vec2 center;
uniform float strength;
/////////////// SAMPLING ///////////////
const float PI = 3.14159265358979323846;
uniform int interpolation;
uniform vec2 sampleDimension;
const int RSIN_RADIUS = 1;
float sinc ( float x ) { return x == 0.? 1. : sin(x * PI) / (x * PI); }
vec4 texture2D_rsin( sampler2D texture, vec2 uv ) {
vec2 tx = 1.0 / sampleDimension;
vec2 p = uv * sampleDimension - vec2(0.5);
vec4 sum = vec4(0.0);
float weights = 0.;
for (int x = -RSIN_RADIUS; x <= RSIN_RADIUS; x++)
for (int y = -RSIN_RADIUS; y <= RSIN_RADIUS; y++) {
float a = length(vec2(float(x), float(y))) / float(RSIN_RADIUS);
if(a > 1.) continue;
float w = sinc(a * PI * tx.x) * sinc(a * PI * tx.y);
vec2 offset = vec2(float(x), float(y)) * tx;
vec4 sample = texture2D(texture, (p + offset + vec2(0.5)) / sampleDimension);
sum += w * sample;
weights += w;
}
return sum / weights;
}
vec4 texture2D_bicubic( sampler2D texture, vec2 uv ) {
uv = uv * sampleDimension + 0.5;
vec2 iuv = floor( uv );
vec2 fuv = fract( uv );
uv = iuv + fuv * fuv * (3.0 - 2.0 * fuv);
uv = (uv - 0.5) / sampleDimension;
return texture2D( texture, uv );
}
vec4 texture2Dintp( sampler2D texture, vec2 uv ) {
if(interpolation == 2) return texture2D_bicubic( texture, uv );
else if(interpolation == 3) return texture2D_rsin( texture, uv );
return texture2D( texture, uv );
}
/////////////// SAMPLING ///////////////
void main() {
vec2 texel = 1.0 / dimension;
vec2 coords = (v_vTexcoord - center / dimension) * 2.0;
@ -18,12 +66,12 @@ void main() {
vec2 uvB = v_vTexcoord + texel.xy * precompute;
vec4 color;
color.r = texture2D(gm_BaseTexture, uvR).r;
color.g = texture2D(gm_BaseTexture, v_vTexcoord).g;
color.b = texture2D(gm_BaseTexture, uvB).b;
color.a = texture2D(gm_BaseTexture, v_vTexcoord).a +
texture2D(gm_BaseTexture, uvR).a +
texture2D(gm_BaseTexture, uvB).a;
color.r = texture2Dintp(gm_BaseTexture, uvR).r;
color.g = texture2Dintp(gm_BaseTexture, v_vTexcoord).g;
color.b = texture2Dintp(gm_BaseTexture, uvB).b;
color.a = texture2Dintp(gm_BaseTexture, v_vTexcoord).a +
texture2Dintp(gm_BaseTexture, uvR).a +
texture2Dintp(gm_BaseTexture, uvB).a;
gl_FragColor = color;
}

View file

@ -3,8 +3,8 @@
"resourceVersion": "1.0",
"name": "sh_content_sampler",
"parent": {
"name": "shader",
"path": "folders/shader.yy",
"name": "misc",
"path": "folders/shader/misc.yy",
},
"type": 1,
}

View file

@ -10,16 +10,64 @@ uniform float strength;
uniform float radius;
uniform int sampleMode;
/////////////// SAMPLING ///////////////
const float PI = 3.14159265358979323846;
uniform int interpolation;
uniform vec2 sampleDimension;
const int RSIN_RADIUS = 1;
float sinc ( float x ) { return x == 0.? 1. : sin(x * PI) / (x * PI); }
vec4 texture2D_rsin( sampler2D texture, vec2 uv ) {
vec2 tx = 1.0 / sampleDimension;
vec2 p = uv * sampleDimension - vec2(0.5);
vec4 sum = vec4(0.0);
float weights = 0.;
for (int x = -RSIN_RADIUS; x <= RSIN_RADIUS; x++)
for (int y = -RSIN_RADIUS; y <= RSIN_RADIUS; y++) {
float a = length(vec2(float(x), float(y))) / float(RSIN_RADIUS);
if(a > 1.) continue;
float w = sinc(a * PI * tx.x) * sinc(a * PI * tx.y);
vec2 offset = vec2(float(x), float(y)) * tx;
vec4 sample = texture2D(texture, (p + offset + vec2(0.5)) / sampleDimension);
sum += w * sample;
weights += w;
}
return sum / weights;
}
vec4 texture2D_bicubic( sampler2D texture, vec2 uv ) {
uv = uv * sampleDimension + 0.5;
vec2 iuv = floor( uv );
vec2 fuv = fract( uv );
uv = iuv + fuv * fuv * (3.0 - 2.0 * fuv);
uv = (uv - 0.5) / sampleDimension;
return texture2D( texture, uv );
}
vec4 texture2Dintp( sampler2D texture, vec2 uv ) {
if(interpolation == 2) return texture2D_bicubic( texture, uv );
else if(interpolation == 3) return texture2D_rsin( texture, uv );
return texture2D( texture, uv );
}
/////////////// SAMPLING ///////////////
vec4 sampleTexture(vec2 pos) {
if(pos.x >= 0. && pos.y >= 0. && pos.x <= 1. && pos.y <= 1.)
return texture2D(gm_BaseTexture, pos);
return texture2Dintp(gm_BaseTexture, pos);
if(sampleMode == 0)
return vec4(0.);
if(sampleMode == 1)
return texture2D(gm_BaseTexture, clamp(pos, 0., 1.));
return texture2Dintp(gm_BaseTexture, clamp(pos, 0., 1.));
if(sampleMode == 2)
return texture2D(gm_BaseTexture, fract(pos));
return texture2Dintp(gm_BaseTexture, fract(pos));
return vec4(0.);
}

View file

@ -14,28 +14,74 @@ uniform int iterate;
uniform int use_rg;
uniform int sampleMode;
#define PI 3.14159265359
float bright(in vec4 col) {
return dot(col.rgb, vec3(0.2126, 0.7152, 0.0722)) * col.a;
}
/////////////// SAMPLING ///////////////
const float PI = 3.14159265358979323846;
uniform int interpolation;
uniform vec2 sampleDimension;
const int RSIN_RADIUS = 1;
float sinc ( float x ) { return x == 0.? 1. : sin(x * PI) / (x * PI); }
vec4 texture2D_rsin( sampler2D texture, vec2 uv ) {
vec2 tx = 1.0 / sampleDimension;
vec2 p = uv * sampleDimension - vec2(0.5);
vec4 sum = vec4(0.0);
float weights = 0.;
for (int x = -RSIN_RADIUS; x <= RSIN_RADIUS; x++)
for (int y = -RSIN_RADIUS; y <= RSIN_RADIUS; y++) {
float a = length(vec2(float(x), float(y))) / float(RSIN_RADIUS);
if(a > 1.) continue;
float w = sinc(a * PI * tx.x) * sinc(a * PI * tx.y);
vec2 offset = vec2(float(x), float(y)) * tx;
vec4 sample = texture2D(texture, (p + offset + vec2(0.5)) / sampleDimension);
sum += w * sample;
weights += w;
}
return sum / weights;
}
vec4 texture2D_bicubic( sampler2D texture, vec2 uv ) {
uv = uv * sampleDimension + 0.5;
vec2 iuv = floor( uv );
vec2 fuv = fract( uv );
uv = iuv + fuv * fuv * (3.0 - 2.0 * fuv);
uv = (uv - 0.5) / sampleDimension;
return texture2D( texture, uv );
}
vec4 texture2Dintp( sampler2D texture, vec2 uv ) {
if(interpolation == 2) return texture2D_bicubic( texture, uv );
else if(interpolation == 3) return texture2D_rsin( texture, uv );
return texture2D( texture, uv );
}
/////////////// SAMPLING ///////////////
vec4 sampleTexture(vec2 pos) {
if(pos.x >= 0. && pos.y >= 0. && pos.x <= 1. && pos.y <= 1.)
return texture2D(gm_BaseTexture, pos);
return texture2Dintp(gm_BaseTexture, pos);
if(sampleMode == 0)
return vec4(0.);
if(sampleMode == 1)
return texture2D(gm_BaseTexture, clamp(pos, 0., 1.));
return texture2Dintp(gm_BaseTexture, clamp(pos, 0., 1.));
if(sampleMode == 2)
return texture2D(gm_BaseTexture, fract(pos));
return texture2Dintp(gm_BaseTexture, fract(pos));
return vec4(0.);
}
vec2 shiftMap(in vec2 pos, in float str) {
vec4 disP = texture2D( map, pos );
vec4 disP = texture2Dintp( map, pos );
vec2 sam_pos;
vec2 raw_displace = displace / dimension;
float _str;

View file

@ -3,8 +3,8 @@
"resourceVersion": "1.0",
"name": "sh_find_boundary",
"parent": {
"name": "shader",
"path": "folders/shader.yy",
"name": "misc",
"path": "folders/shader/misc.yy",
},
"type": 1,
}

View file

@ -3,8 +3,8 @@
"resourceVersion": "1.0",
"name": "sh_find_pixel",
"parent": {
"name": "shader",
"path": "folders/shader.yy",
"name": "misc",
"path": "folders/shader/misc.yy",
},
"type": 1,
}

View file

@ -3,8 +3,8 @@
"resourceVersion": "1.0",
"name": "sh_mesh_generation",
"parent": {
"name": "shader",
"path": "folders/shader.yy",
"name": "misc",
"path": "folders/shader/misc.yy",
},
"type": 1,
}

View file

@ -8,9 +8,7 @@ uniform vec2 dimension;
uniform float height;
uniform int smooth;
float bright(in vec4 col) {
return dot(col.rgb, vec3(0.2126, 0.7152, 0.0722)) * col.a;
}
float bright(in vec4 col) { return dot(col.rgb, vec3(0.2126, 0.7152, 0.0722)) * col.a; }
void main() {
vec2 pixelStep = 1. / dimension;

View file

@ -4,13 +4,58 @@
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
#define pi2 1.57079
#define pi 3.14159265
/////////////// SAMPLING ///////////////
const float PI = 3.14159265358979323846;
uniform int interpolation;
uniform vec2 sampleDimension;
const int RSIN_RADIUS = 1;
float sinc ( float x ) { return x == 0.? 1. : sin(x * PI) / (x * PI); }
vec4 texture2D_rsin( sampler2D texture, vec2 uv ) {
vec2 tx = 1.0 / sampleDimension;
vec2 p = uv * sampleDimension - vec2(0.5);
vec4 sum = vec4(0.0);
float weights = 0.;
for (int x = -RSIN_RADIUS; x <= RSIN_RADIUS; x++)
for (int y = -RSIN_RADIUS; y <= RSIN_RADIUS; y++) {
float a = length(vec2(float(x), float(y))) / float(RSIN_RADIUS);
if(a > 1.) continue;
float w = sinc(a * PI * tx.x) * sinc(a * PI * tx.y);
vec2 offset = vec2(float(x), float(y)) * tx;
vec4 sample = texture2D(texture, (p + offset + vec2(0.5)) / sampleDimension);
sum += w * sample;
weights += w;
}
return sum / weights;
}
vec4 texture2D_bicubic( sampler2D texture, vec2 uv ) {
uv = uv * sampleDimension + 0.5;
vec2 iuv = floor( uv );
vec2 fuv = fract( uv );
uv = iuv + fuv * fuv * (3.0 - 2.0 * fuv);
uv = (uv - 0.5) / sampleDimension;
return texture2D( texture, uv );
}
vec4 texture2Dintp( sampler2D texture, vec2 uv ) {
if(interpolation == 2) return texture2D_bicubic( texture, uv );
else if(interpolation == 3) return texture2D_rsin( texture, uv );
return texture2D( texture, uv );
}
/////////////// SAMPLING ///////////////
void main() {
vec2 center = v_vTexcoord - vec2(0.5, 0.5);
float radius = distance(v_vTexcoord, vec2(0.5, 0.5)) / (sqrt(2.) * .5);
float angle = (atan(center.y, center.x) / pi + 1.) / 2.;
float angle = (atan(center.y, center.x) / PI + 1.) / 2.;
vec2 polar = vec2(radius, angle);
gl_FragColor = v_vColour * texture2D( gm_BaseTexture, polar );

View file

@ -0,0 +1,57 @@
//
// Simple passthrough fragment shader
//
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
/////////////// SAMPLING ///////////////
const float PI = 3.14159265358979323846;
uniform int interpolation;
uniform vec2 sampleDimension;
const int RSIN_RADIUS = 1;
float sinc ( float x ) { return x == 0.? 1. : sin(x * PI) / (x * PI); }
vec4 texture2D_rsin( sampler2D texture, vec2 uv ) {
vec2 tx = 1.0 / sampleDimension;
vec2 p = uv * sampleDimension - vec2(0.5);
vec4 sum = vec4(0.0);
float weights = 0.;
for (int x = -RSIN_RADIUS; x <= RSIN_RADIUS; x++)
for (int y = -RSIN_RADIUS; y <= RSIN_RADIUS; y++) {
float a = length(vec2(float(x), float(y))) / float(RSIN_RADIUS);
if(a > 1.) continue;
float w = sinc(a * PI * tx.x) * sinc(a * PI * tx.y);
vec2 offset = vec2(float(x), float(y)) * tx;
vec4 sample = texture2D(texture, (p + offset + vec2(0.5)) / sampleDimension);
sum += w * sample;
weights += w;
}
return sum / weights;
}
vec4 texture2D_bicubic( sampler2D texture, vec2 uv ) {
uv = uv * sampleDimension + 0.5;
vec2 iuv = floor( uv );
vec2 fuv = fract( uv );
uv = iuv + fuv * fuv * (3.0 - 2.0 * fuv);
uv = (uv - 0.5) / sampleDimension;
return texture2D( texture, uv );
}
vec4 texture2Dintp( sampler2D texture, vec2 uv ) {
if(interpolation == 2) return texture2D_bicubic( texture, uv );
else if(interpolation == 3) return texture2D_rsin( texture, uv );
return texture2D( texture, uv );
}
/////////////// SAMPLING ///////////////
void main() {
gl_FragColor = texture2Dintp( gm_BaseTexture, v_vTexcoord );
}

View file

@ -0,0 +1,19 @@
//
// Simple passthrough vertex shader
//
attribute vec3 in_Position; // (x,y,z)
//attribute vec3 in_Normal; // (x,y,z) unused in this shader.
attribute vec4 in_Colour; // (r,g,b,a)
attribute vec2 in_TextureCoord; // (u,v)
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
void main()
{
vec4 object_space_pos = vec4( in_Position.x, in_Position.y, in_Position.z, 1.0);
gl_Position = gm_Matrices[MATRIX_WORLD_VIEW_PROJECTION] * object_space_pos;
v_vColour = in_Colour;
v_vTexcoord = in_TextureCoord;
}

View file

@ -0,0 +1,10 @@
{
"resourceType": "GMShader",
"resourceVersion": "1.0",
"name": "sh_sample",
"parent": {
"name": "_helper",
"path": "folders/shader/_helper.yy",
},
"type": 1,
}

View file

@ -10,16 +10,64 @@ uniform int axis;
uniform float amount;
uniform int sampleMode;
/////////////// SAMPLING ///////////////
const float PI = 3.14159265358979323846;
uniform int interpolation;
uniform vec2 sampleDimension;
const int RSIN_RADIUS = 1;
float sinc ( float x ) { return x == 0.? 1. : sin(x * PI) / (x * PI); }
vec4 texture2D_rsin( sampler2D texture, vec2 uv ) {
vec2 tx = 1.0 / sampleDimension;
vec2 p = uv * sampleDimension - vec2(0.5);
vec4 sum = vec4(0.0);
float weights = 0.;
for (int x = -RSIN_RADIUS; x <= RSIN_RADIUS; x++)
for (int y = -RSIN_RADIUS; y <= RSIN_RADIUS; y++) {
float a = length(vec2(float(x), float(y))) / float(RSIN_RADIUS);
if(a > 1.) continue;
float w = sinc(a * PI * tx.x) * sinc(a * PI * tx.y);
vec2 offset = vec2(float(x), float(y)) * tx;
vec4 sample = texture2D(texture, (p + offset + vec2(0.5)) / sampleDimension);
sum += w * sample;
weights += w;
}
return sum / weights;
}
vec4 texture2D_bicubic( sampler2D texture, vec2 uv ) {
uv = uv * sampleDimension + 0.5;
vec2 iuv = floor( uv );
vec2 fuv = fract( uv );
uv = iuv + fuv * fuv * (3.0 - 2.0 * fuv);
uv = (uv - 0.5) / sampleDimension;
return texture2D( texture, uv );
}
vec4 texture2Dintp( sampler2D texture, vec2 uv ) {
if(interpolation == 2) return texture2D_bicubic( texture, uv );
else if(interpolation == 3) return texture2D_rsin( texture, uv );
return texture2D( texture, uv );
}
/////////////// SAMPLING ///////////////
vec4 sampleTexture(vec2 pos) {
if(pos.x >= 0. && pos.y >= 0. && pos.x <= 1. && pos.y <= 1.)
return texture2D(gm_BaseTexture, pos);
return texture2Dintp(gm_BaseTexture, pos);
if(sampleMode == 0)
return vec4(0.);
if(sampleMode == 1)
return texture2D(gm_BaseTexture, clamp(pos, 0., 1.));
return texture2Dintp(gm_BaseTexture, clamp(pos, 0., 1.));
if(sampleMode == 2)
return texture2D(gm_BaseTexture, fract(pos));
return texture2Dintp(gm_BaseTexture, fract(pos));
return vec4(0.);
}

View file

@ -6,11 +6,59 @@ varying vec4 v_vColour;
uniform sampler2D map;
/////////////// SAMPLING ///////////////
const float PI = 3.14159265358979323846;
uniform int interpolation;
uniform vec2 sampleDimension;
const int RSIN_RADIUS = 1;
float sinc ( float x ) { return x == 0.? 1. : sin(x * PI) / (x * PI); }
vec4 texture2D_rsin( sampler2D texture, vec2 uv ) {
vec2 tx = 1.0 / sampleDimension;
vec2 p = uv * sampleDimension - vec2(0.5);
vec4 sum = vec4(0.0);
float weights = 0.;
for (int x = -RSIN_RADIUS; x <= RSIN_RADIUS; x++)
for (int y = -RSIN_RADIUS; y <= RSIN_RADIUS; y++) {
float a = length(vec2(float(x), float(y))) / float(RSIN_RADIUS);
if(a > 1.) continue;
float w = sinc(a * PI * tx.x) * sinc(a * PI * tx.y);
vec2 offset = vec2(float(x), float(y)) * tx;
vec4 sample = texture2D(texture, (p + offset + vec2(0.5)) / sampleDimension);
sum += w * sample;
weights += w;
}
return sum / weights;
}
vec4 texture2D_bicubic( sampler2D texture, vec2 uv ) {
uv = uv * sampleDimension + 0.5;
vec2 iuv = floor( uv );
vec2 fuv = fract( uv );
uv = iuv + fuv * fuv * (3.0 - 2.0 * fuv);
uv = (uv - 0.5) / sampleDimension;
return texture2D( texture, uv );
}
vec4 texture2Dintp( sampler2D texture, vec2 uv ) {
if(interpolation == 2) return texture2D_bicubic( texture, uv );
else if(interpolation == 3) return texture2D_rsin( texture, uv );
return texture2D( texture, uv );
}
/////////////// SAMPLING ///////////////
void main() {
vec4 map = texture2D( map, v_vTexcoord );
vec4 map = texture2Dintp( map, v_vTexcoord );
vec2 pos = map.rg;
vec4 samp = texture2D( gm_BaseTexture, 1. - vec2(1. - pos.x, pos.y) );
vec4 samp = texture2Dintp( gm_BaseTexture, 1. - vec2(1. - pos.x, pos.y) );
samp.a *= map.a;
gl_FragColor = samp;

View file

@ -9,17 +9,63 @@ uniform vec2 center;
uniform float strength;
uniform float radius;
uniform int sampleMode;
/////////////// SAMPLING ///////////////
const float PI = 3.14159265358979323846;
uniform int interpolation;
uniform vec2 sampleDimension;
const int RSIN_RADIUS = 1;
float sinc ( float x ) { return x == 0.? 1. : sin(x * PI) / (x * PI); }
vec4 texture2D_rsin( sampler2D texture, vec2 uv ) {
vec2 tx = 1.0 / sampleDimension;
vec2 p = uv * sampleDimension - vec2(0.5);
vec4 sum = vec4(0.0);
float weights = 0.;
for (int x = -RSIN_RADIUS; x <= RSIN_RADIUS; x++)
for (int y = -RSIN_RADIUS; y <= RSIN_RADIUS; y++) {
float a = length(vec2(float(x), float(y))) / float(RSIN_RADIUS);
if(a > 1.) continue;
float w = sinc(a * PI * tx.x) * sinc(a * PI * tx.y);
vec2 offset = vec2(float(x), float(y)) * tx;
vec4 sample = texture2D(texture, (p + offset + vec2(0.5)) / sampleDimension);
sum += w * sample;
weights += w;
}
return sum / weights;
}
vec4 texture2D_bicubic( sampler2D texture, vec2 uv ) {
uv = uv * sampleDimension + 0.5;
vec2 iuv = floor( uv );
vec2 fuv = fract( uv );
uv = iuv + fuv * fuv * (3.0 - 2.0 * fuv);
uv = (uv - 0.5) / sampleDimension;
return texture2D( texture, uv );
}
vec4 texture2Dintp( sampler2D texture, vec2 uv ) {
if(interpolation == 2) return texture2D_bicubic( texture, uv );
else if(interpolation == 3) return texture2D_rsin( texture, uv );
return texture2D( texture, uv );
}
/////////////// SAMPLING ///////////////
vec4 sampleTexture(vec2 pos) {
if(pos.x >= 0. && pos.y >= 0. && pos.x <= 1. && pos.y <= 1.)
return texture2D(gm_BaseTexture, pos);
return texture2Dintp(gm_BaseTexture, pos);
if(sampleMode == 0)
return vec4(0.);
if(sampleMode == 1)
return texture2D(gm_BaseTexture, clamp(pos, 0., 1.));
return texture2Dintp(gm_BaseTexture, clamp(pos, 0., 1.));
if(sampleMode == 2)
return texture2D(gm_BaseTexture, fract(pos));
return texture2Dintp(gm_BaseTexture, fract(pos));
return vec4(0.);
}