diff --git a/PixelComposer.resource_order b/PixelComposer.resource_order index 3a8a3393f..e263a8ff4 100644 --- a/PixelComposer.resource_order +++ b/PixelComposer.resource_order @@ -209,6 +209,7 @@ {"name":"biterator","order":2,"path":"folders/VCT/biterator.yy",}, {"name":"widget","order":3,"path":"folders/VCT/widget.yy",}, {"name":"widgets","order":5,"path":"folders/widgets.yy",}, + {"name":"interpret","order":35,"path":"folders/shader/generator/interpret.yy",}, ], "ResourceOrderSettings": [ {"name":"s_node_corner","order":16,"path":"sprites/s_node_corner/s_node_corner.yy",}, @@ -896,6 +897,7 @@ {"name":"node_pb_fx_outline","order":2,"path":"scripts/node_pb_fx_outline/node_pb_fx_outline.yy",}, {"name":"save_function","order":1,"path":"scripts/save_function/save_function.yy",}, {"name":"s_node_gradient_replace","order":18,"path":"sprites/s_node_gradient_replace/s_node_gradient_replace.yy",}, + {"name":"file_functions","order":10,"path":"scripts/file_functions/file_functions.yy",}, {"name":"node_perlin_smear","order":9,"path":"scripts/node_perlin_smear/node_perlin_smear.yy",}, {"name":"node_alpha_cutoff","order":10,"path":"scripts/node_alpha_cutoff/node_alpha_cutoff.yy",}, {"name":"sh_channel_R","order":4,"path":"shaders/sh_channel_R/sh_channel_R.yy",}, @@ -1030,6 +1032,7 @@ {"name":"s_node_array_length","order":5,"path":"sprites/s_node_array_length/s_node_array_length.yy",}, {"name":"string_splice","order":3,"path":"scripts/string_splice/string_splice.yy",}, {"name":"s_node_vfx_input","order":12,"path":"sprites/s_node_vfx_input/s_node_vfx_input.yy",}, + {"name":"s_node_interpret_number","order":30,"path":"sprites/s_node_interpret_number/s_node_interpret_number.yy",}, {"name":"node_strand_force_apply","order":6,"path":"scripts/node_strand_force_apply/node_strand_force_apply.yy",}, {"name":"sh_seperate_shape_ite","order":2,"path":"shaders/sh_seperate_shape_ite/sh_seperate_shape_ite.yy",}, {"name":"node_PCX_fn_surface_width","order":1,"path":"scripts/node_PCX_fn_surface_width/node_PCX_fn_surface_width.yy",}, @@ -1128,6 +1131,7 @@ {"name":"json_prettify","order":7,"path":"scripts/json_prettify/json_prettify.yy",}, {"name":"s_node_loop_output","order":13,"path":"sprites/s_node_loop_output/s_node_loop_output.yy",}, {"name":"panel_notification","order":4,"path":"scripts/panel_notification/panel_notification.yy",}, + {"name":"node_interpret_number","order":22,"path":"scripts/node_interpret_number/node_interpret_number.yy",}, {"name":"render_data","order":3,"path":"scripts/render_data/render_data.yy",}, {"name":"panel_preview_grid_setting","order":6,"path":"scripts/panel_preview_grid_setting/panel_preview_grid_setting.yy",}, {"name":"fd_rectangle_get_velocity_height","order":22,"path":"scripts/fd_rectangle_get_velocity_height/fd_rectangle_get_velocity_height.yy",}, @@ -1435,6 +1439,7 @@ {"name":"fd_rectangle_set_visualization_shader","order":18,"path":"scripts/fd_rectangle_set_visualization_shader/fd_rectangle_set_visualization_shader.yy",}, {"name":"s_biterator_bg","order":2,"path":"sprites/s_biterator_bg/s_biterator_bg.yy",}, {"name":"s_node_ase_layer","order":14,"path":"sprites/s_node_ase_layer/s_node_ase_layer.yy",}, + {"name":"directory_functions","order":9,"path":"scripts/directory_functions/directory_functions.yy",}, {"name":"_f_p1","order":1,"path":"fonts/_f_p1/_f_p1.yy",}, {"name":"tuple_functions","order":5,"path":"scripts/tuple_functions/tuple_functions.yy",}, {"name":"node_3d_mesh_obj","order":2,"path":"scripts/node_3d_mesh_obj/node_3d_mesh_obj.yy",}, diff --git a/PixelComposer.yyp b/PixelComposer.yyp index 0ced07067..e9fd98edc 100644 --- a/PixelComposer.yyp +++ b/PixelComposer.yyp @@ -248,6 +248,7 @@ {"resourceType":"GMFolder","resourceVersion":"1.0","name":"biterator","folderPath":"folders/VCT/biterator.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"widget","folderPath":"folders/VCT/widget.yy",}, {"resourceType":"GMFolder","resourceVersion":"1.0","name":"widgets","folderPath":"folders/widgets.yy",}, + {"resourceType":"GMFolder","resourceVersion":"1.0","name":"interpret","folderPath":"folders/shader/generator/interpret.yy",}, ], "IncludedFiles": [ {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"ApolloHelp.html","ConfigValues":{"Itch":{"CopyToMask":"0",},},"CopyToMask":-1,"filePath":"datafiles",}, @@ -286,6 +287,7 @@ {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"words.json","CopyToMask":-1,"filePath":"datafiles/data/locale/sample locale",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"nodes.json","CopyToMask":-1,"filePath":"datafiles/data",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"Nodes.zip","CopyToMask":-1,"filePath":"datafiles/data",}, + {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"related_node.json","CopyToMask":-1,"filePath":"datafiles/data",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"default.zip","CopyToMask":-1,"filePath":"datafiles/data/themes",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"FiraCode-Medium.ttf","CopyToMask":-1,"filePath":"datafiles/data/themes/default/fonts",}, {"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"fonts.json","CopyToMask":-1,"filePath":"datafiles/data/themes/default/fonts",}, @@ -1529,6 +1531,7 @@ {"id":{"name":"node_pb_fx_outline","path":"scripts/node_pb_fx_outline/node_pb_fx_outline.yy",},}, {"id":{"name":"save_function","path":"scripts/save_function/save_function.yy",},}, {"id":{"name":"s_node_gradient_replace","path":"sprites/s_node_gradient_replace/s_node_gradient_replace.yy",},}, + {"id":{"name":"file_functions","path":"scripts/file_functions/file_functions.yy",},}, {"id":{"name":"node_perlin_smear","path":"scripts/node_perlin_smear/node_perlin_smear.yy",},}, {"id":{"name":"node_alpha_cutoff","path":"scripts/node_alpha_cutoff/node_alpha_cutoff.yy",},}, {"id":{"name":"pack_best_fit","path":"scripts/pack_best_fit/pack_best_fit.yy",},}, @@ -1676,6 +1679,7 @@ {"id":{"name":"s_node_array_length","path":"sprites/s_node_array_length/s_node_array_length.yy",},}, {"id":{"name":"string_splice","path":"scripts/string_splice/string_splice.yy",},}, {"id":{"name":"s_node_vfx_input","path":"sprites/s_node_vfx_input/s_node_vfx_input.yy",},}, + {"id":{"name":"s_node_interpret_number","path":"sprites/s_node_interpret_number/s_node_interpret_number.yy",},}, {"id":{"name":"node_strand_force_apply","path":"scripts/node_strand_force_apply/node_strand_force_apply.yy",},}, {"id":{"name":"s_node_rigidSim","path":"sprites/s_node_rigidSim/s_node_rigidSim.yy",},}, {"id":{"name":"sh_seperate_shape_ite","path":"shaders/sh_seperate_shape_ite/sh_seperate_shape_ite.yy",},}, @@ -1729,6 +1733,7 @@ {"id":{"name":"s_node_fluidSim_update_paused","path":"sprites/s_node_fluidSim_update_paused/s_node_fluidSim_update_paused.yy",},}, {"id":{"name":"s_node_decorner","path":"sprites/s_node_decorner/s_node_decorner.yy",},}, {"id":{"name":"s_node_text_combine","path":"sprites/s_node_text_combine/s_node_text_combine.yy",},}, + {"id":{"name":"sh_interpret_number","path":"shaders/sh_interpret_number/sh_interpret_number.yy",},}, {"id":{"name":"_line_drawer","path":"scripts/_line_drawer/_line_drawer.yy",},}, {"id":{"name":"sh_noise_fbm","path":"shaders/sh_noise_fbm/sh_noise_fbm.yy",},}, {"id":{"name":"s_node_gradient","path":"sprites/s_node_gradient/s_node_gradient.yy",},}, @@ -1787,6 +1792,7 @@ {"id":{"name":"s_node_loop_output","path":"sprites/s_node_loop_output/s_node_loop_output.yy",},}, {"id":{"name":"_p_dialog","path":"objects/_p_dialog/_p_dialog.yy",},}, {"id":{"name":"panel_notification","path":"scripts/panel_notification/panel_notification.yy",},}, + {"id":{"name":"node_interpret_number","path":"scripts/node_interpret_number/node_interpret_number.yy",},}, {"id":{"name":"render_data","path":"scripts/render_data/render_data.yy",},}, {"id":{"name":"panel_preview_grid_setting","path":"scripts/panel_preview_grid_setting/panel_preview_grid_setting.yy",},}, {"id":{"name":"fd_rectangle_get_velocity_height","path":"scripts/fd_rectangle_get_velocity_height/fd_rectangle_get_velocity_height.yy",},}, @@ -2149,6 +2155,7 @@ {"id":{"name":"s_biterator_bg","path":"sprites/s_biterator_bg/s_biterator_bg.yy",},}, {"id":{"name":"addonPanel","path":"scripts/addonPanel/addonPanel.yy",},}, {"id":{"name":"s_node_ase_layer","path":"sprites/s_node_ase_layer/s_node_ase_layer.yy",},}, + {"id":{"name":"directory_functions","path":"scripts/directory_functions/directory_functions.yy",},}, {"id":{"name":"_f_p1","path":"fonts/_f_p1/_f_p1.yy",},}, {"id":{"name":"tuple_functions","path":"scripts/tuple_functions/tuple_functions.yy",},}, {"id":{"name":"curve_bezier_function","path":"scripts/curve_bezier_function/curve_bezier_function.yy",},}, diff --git a/datafiles/data/related_node.json b/datafiles/data/related_node.json new file mode 100644 index 000000000..7b3a6977f --- /dev/null +++ b/datafiles/data/related_node.json @@ -0,0 +1,26 @@ +{ + "connectFrom": { + "key": "connectionType", + "relations": { + "integer": [ "Node_Math", "Node_Equation", "Node_To_Text" ], + "float": [ "Node_Math", "Node_Equation", "Node_To_Text" ], + "color": [ "Node_Solid", "Node_Color_Data", "Node_Color_Mix" ], + "surface": [ "Node_Transform", "Node_Blend", "Node_Composite", "Node_Export" ], + + "path": [ "Node_Line" ], + "text": [ "Node_Text", "Node_To_Number" ], + + "pathnode": [ "Node_Line", "Node_Mesh_Create_Path" ], + "struct": [ "Node_Struct_Get" ], + "atlas": [ "Node_Atlas_Draw", "Node_Atlas_Get", "Node_Atlas_Set" ], + + "gradient": [ "Node_Gradient", "Node_Gradient_Extract" ], + "armature": [ "Node_Armature_Pose", "Node_Armature_Bind", "Node_Armature_Path", "Node_Armature_Sample" ], + "buffer": [ "Node_Surface_From_Buffer" ] + } + }, + "connectTo": { + "key": "connectionType", + "relations": {} + } +} \ No newline at end of file diff --git a/objects/o_dialog_add_node/Create_0.gml b/objects/o_dialog_add_node/Create_0.gml index 2a8312395..cdc47a9cb 100644 --- a/objects/o_dialog_add_node/Create_0.gml +++ b/objects/o_dialog_add_node/Create_0.gml @@ -319,7 +319,11 @@ event_inherited(); _list = ds_list_create(); if(node_called != noone) { - var sug = ds_map_try_get(global.VALUE_SUGGESTION, node_called.type, []); + var sug = nodeReleatedQuery( + node_called.connect_type == JUNCTION_CONNECT.input? "connectTo" : "connectFrom", + node_called.type + ); + if(array_length(sug)) { ds_list_add(_list, "Related"); for( var i = 0, n = array_length(sug); i < n; i++ ) diff --git a/objects/o_main/Other_2.gml b/objects/o_main/Other_2.gml index 1b2621412..4bff3d832 100644 --- a/objects/o_main/Other_2.gml +++ b/objects/o_main/Other_2.gml @@ -63,9 +63,10 @@ log_message("SESSION", "Begin"); log_message("DIRECTORY", DIRECTORY); + log_message("SESSION", "> init Locale"); __initLocale(); + log_message("SESSION", "> init Project"); __initProject(); log_message("SESSION", "> init Action"); __initAction(); log_message("SESSION", "> init SurfaceFormat"); __initSurfaceFormat(); - log_message("SESSION", "> init Locale"); __initLocale(); log_message("SESSION", "> init Theme"); __initTheme(); log_message("SESSION", "> init Collection"); __initCollection(); log_message("SESSION", "> init Assets"); __initAssets(); diff --git a/scripts/__VFX/__VFX.gml b/scripts/__VFX/__VFX.gml index 36401b1ea..18bea17e1 100644 --- a/scripts/__VFX/__VFX.gml +++ b/scripts/__VFX/__VFX.gml @@ -190,7 +190,8 @@ function __part(_node) constructor { } } - var surface = node.surface_cache[? ss]; + var surface = node.surface_cache[$ ss]; + //print($"VFX: {surface} ({is_surface(surface)})") if(!is_surface(surface)) return; var lifeRat = 1 - life / life_total; diff --git a/scripts/__panel_linear_setting/__panel_linear_setting.gml b/scripts/__panel_linear_setting/__panel_linear_setting.gml index 334bd5d5a..ea5cd93e6 100644 --- a/scripts/__panel_linear_setting/__panel_linear_setting.gml +++ b/scripts/__panel_linear_setting/__panel_linear_setting.gml @@ -54,7 +54,7 @@ function Panel_Linear_Setting() : PanelContent() constructor { draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text); draw_text_add(ui(16), yy, _text); - var params = new widgetParam(w - ui(8) - ww, yy - wh / 2, ww, wh, _data,, [ mx, my ], x, y); + var params = new widgetParam(w - ui(8) - ww, yy - wh / 2, ww, wh, _data, {}, [ mx, my ], x, y); if(is_instanceof(_widg, checkBox)) { params.halign = fa_center; params.valign = fa_center; diff --git a/scripts/_node_VFX_spawner/_node_VFX_spawner.gml b/scripts/_node_VFX_spawner/_node_VFX_spawner.gml index e630ddc4b..95d97c426 100644 --- a/scripts/_node_VFX_spawner/_node_VFX_spawner.gml +++ b/scripts/_node_VFX_spawner/_node_VFX_spawner.gml @@ -2,45 +2,45 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co name = "Spawner"; update_on_frame = true; - inputs[| 0] = nodeValue("Particle sprite", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0); + inputs[| 0] = nodeValue("Particle sprite", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0 ); - inputs[| 1] = nodeValue("Spawn delay", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 4, "Frames delay between each particle spawn.") + inputs[| 1] = nodeValue("Spawn delay", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 4, "Frames delay between each particle spawn." ) .rejectArray(); - inputs[| 2] = nodeValue("Spawn amount", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 2, "Amount of particle spawn in that frame.") + inputs[| 2] = nodeValue("Spawn amount", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 2, "Amount of particle spawn in that frame." ) .rejectArray(); - inputs[| 3] = nodeValue("Spawn area", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ DEF_SURF_W / 2, DEF_SURF_H / 2, DEF_SURF_W / 2, DEF_SURF_H / 2, AREA_SHAPE.rectangle ]) + inputs[| 3] = nodeValue("Spawn area", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ DEF_SURF_W / 2, DEF_SURF_H / 2, DEF_SURF_W / 2, DEF_SURF_H / 2, AREA_SHAPE.rectangle ] ) .setDisplay(VALUE_DISPLAY.area); - inputs[| 4] = nodeValue("Spawn distribution", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + inputs[| 4] = nodeValue("Spawn distribution", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0 ) .rejectArray() - .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Area", "Border", "Map", "Direct Data" ]); + .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Area", "Border", "Map", "Direct Data" ] ); - inputs[| 5] = nodeValue("Lifespan", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 20, 30 ]) + inputs[| 5] = nodeValue("Lifespan", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 20, 30 ] ) .setDisplay(VALUE_DISPLAY.range); - inputs[| 6] = nodeValue("Spawn direction", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 0, 45, 135, 0, 0 ]) - .setDisplay(VALUE_DISPLAY.rotation_random); + inputs[| 6] = nodeValue("Spawn direction", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 0, 45, 135, 0, 0 ] ) + .setDisplay(VALUE_DISPLAY.rotation_random); - inputs[| 7] = nodeValue("Acceleration", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ]) - .setDisplay(VALUE_DISPLAY.range); + inputs[| 7] = nodeValue("Acceleration", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ] ) + .setDisplay(VALUE_DISPLAY.range, { linked : true }); - inputs[| 8] = nodeValue("Orientation", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 0, 0, 0, 0, 0 ]) + inputs[| 8] = nodeValue("Orientation", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 0, 0, 0, 0, 0 ] ) .setDisplay(VALUE_DISPLAY.rotation_random); - inputs[| 9] = nodeValue("Rotational speed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ]) - .setDisplay(VALUE_DISPLAY.range); + inputs[| 9] = nodeValue("Rotational speed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ] ) + .setDisplay(VALUE_DISPLAY.range, { linked : true }); inputs[| 10] = nodeValue("Spawn scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1, 1, 1 ] ) - .setDisplay(VALUE_DISPLAY.vector_range); + .setDisplay(VALUE_DISPLAY.vector_range, { linked : true }); inputs[| 11] = nodeValue("Scale over time", self, JUNCTION_CONNECT.input, VALUE_TYPE.curve, CURVE_DEF_11 ); inputs[| 12] = nodeValue("Color over lifetime", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(c_white) ); inputs[| 13] = nodeValue("Alpha", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1 ]) - .setDisplay(VALUE_DISPLAY.range); + .setDisplay(VALUE_DISPLAY.range, { linked : true }); inputs[| 14] = nodeValue("Alpha over time", self, JUNCTION_CONNECT.input, VALUE_TYPE.curve, CURVE_DEF_11); @@ -51,15 +51,17 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co .setDisplay(VALUE_DISPLAY.enum_button, [ "Stream", "Burst" ]); inputs[| 17] = nodeValue("Spawn size", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1 ] ) - .setDisplay(VALUE_DISPLAY.range); + .setDisplay(VALUE_DISPLAY.range, { linked : true }); inputs[| 18] = nodeValue("Spawn velocity", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 2 ] ) .setDisplay(VALUE_DISPLAY.range); - inputs[| 19] = nodeValue("Gravity", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0 ) + inputs[| 19] = nodeValue("Gravity", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ] ) + .setDisplay(VALUE_DISPLAY.range, { linked : true }) .rejectArray(); - inputs[| 20] = nodeValue("Wiggle", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0 ) + inputs[| 20] = nodeValue("Wiggle", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ] ) + .setDisplay(VALUE_DISPLAY.range, { linked : true }) .rejectArray(); inputs[| 21] = nodeValue("Loop", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true ) @@ -69,7 +71,8 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Random", "Order", "Animation" ]) .setVisible(false); - inputs[| 23] = nodeValue("Animation speed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1 ) + inputs[| 23] = nodeValue("Animation speed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1 ] ) + .setDisplay(VALUE_DISPLAY.range, { linked : true }) .rejectArray() .setVisible(false); @@ -107,7 +110,7 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co .setDisplay(VALUE_DISPLAY.rotation); inputs[| 34] = nodeValue("Turning", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ] ) - .setDisplay(VALUE_DISPLAY.range); + .setDisplay(VALUE_DISPLAY.range, { linked : true }); inputs[| 35] = nodeValue("Turn both directions", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false, "Apply randomized 1, -1 multiplier to the turning speed." ) .rejectArray(); @@ -152,7 +155,7 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co def_surface = -1; current_data = []; - surface_cache = ds_map_create(); + surface_cache = {}; for(var i = 0; i < attributes.part_amount; i++) parts[i] = new __part(self); @@ -160,12 +163,6 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co static spawn = function(_time = PROJECT.animator.current_frame, _pos = -1) { #region var _inSurf = current_data[0]; - if(!is_surface(_inSurf)) { - if(!is_surface(def_surface)) - return; - _inSurf = def_surface; - } - var _spawn_amount = current_data[ 2]; var _amo = _spawn_amount; @@ -295,13 +292,16 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co part.seed = irandom_range(100000, 999999); part.create(_spr, xx, yy, _lif); - part.anim_speed = _anim_speed; + part.anim_speed = random_range(_anim_speed[0], _anim_speed[1]); part.anim_end = _anim_end; var _trn = random_range(_turn[0], _turn[1]); if(_turnBi) _trn *= choose(-1, 1); - part.setPhysic(_vx, _vy, _acc, _grav, _gvDir, _wigg, _trn, _turnSc); + var _gravity = random_range(_grav[0], _grav[1]); + var _wiggle = random_range(_wigg[0], _wigg[1]); + + part.setPhysic(_vx, _vy, _acc, _gravity, _gvDir, _wiggle, _trn, _turnSc); part.setGround(_ground, _ground_offset, _ground_bounce); part.setTransform(_scx, _scy, _scale_time, _rot, _rot_spd, _follow); part.setDraw(_color, _bld, _alp, _fade); @@ -327,9 +327,10 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co render(); seed = inputs[| 32].getValue(); - var keys = ds_map_keys_to_array(surface_cache); + var keys = variable_struct_get_names(surface_cache); for( var i = 0, n = array_length(keys); i < n; i++ ) - surface_free_safe(surface_cache[? keys[i]]); + surface_free_safe(surface_cache[$ keys[i]]); + surface_cache = {}; var _loop = inputs[| 21].getValue(); if(!_loop) return; @@ -363,16 +364,19 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co current_data[i] = inputs[| i].getValue(_time); var surfs = current_data[0]; + if(!is_array(current_data[0])) surfs = [ surfs ]; if(!array_empty(current_data[0])) { if(is_array(current_data[0])) surfs = array_spread(surfs); for( var i = 0, n = array_length(surfs); i < n; i++ ) { - if(is_surface(surface_cache[? surfs[i]])) continue; - surface_cache[? surfs[i]] = surface_clone(surfs[i]); + if(is_surface(surface_cache[$ surfs[i]])) continue; + surface_cache[$ surfs[i]] = surface_clone(surfs[i]); } } + //print(surface_cache); + if(_spawn_active) { switch(_spawn_type) { case 0 : diff --git a/scripts/directory_functions/directory_functions.gml b/scripts/directory_functions/directory_functions.gml new file mode 100644 index 000000000..0f01011e8 --- /dev/null +++ b/scripts/directory_functions/directory_functions.gml @@ -0,0 +1,4 @@ +function directory_verify(path) { + if(directory_exists(path)) return; + directory_create(path); +} \ No newline at end of file diff --git a/scripts/directory_functions/directory_functions.yy b/scripts/directory_functions/directory_functions.yy new file mode 100644 index 000000000..0214fe928 --- /dev/null +++ b/scripts/directory_functions/directory_functions.yy @@ -0,0 +1,11 @@ +{ + "resourceType": "GMScript", + "resourceVersion": "1.0", + "name": "directory_functions", + "isCompatibility": false, + "isDnD": false, + "parent": { + "name": "files", + "path": "folders/functions/files.yy", + }, +} \ No newline at end of file diff --git a/scripts/file_functions/file_functions.gml b/scripts/file_functions/file_functions.gml new file mode 100644 index 000000000..ca48ab128 --- /dev/null +++ b/scripts/file_functions/file_functions.gml @@ -0,0 +1,4 @@ +function file_copy_override(src, dest) { + if(file_exists(dest)) file_delete(dest); + file_copy(src, dest); +} \ No newline at end of file diff --git a/scripts/file_functions/file_functions.yy b/scripts/file_functions/file_functions.yy new file mode 100644 index 000000000..15f745997 --- /dev/null +++ b/scripts/file_functions/file_functions.yy @@ -0,0 +1,11 @@ +{ + "resourceType": "GMScript", + "resourceVersion": "1.0", + "name": "file_functions", + "isCompatibility": false, + "isDnD": false, + "parent": { + "name": "files", + "path": "folders/functions/files.yy", + }, +} \ No newline at end of file diff --git a/scripts/globals/globals.gml b/scripts/globals/globals.gml index 7c73b5eb4..e8630e672 100644 --- a/scripts/globals/globals.gml +++ b/scripts/globals/globals.gml @@ -35,8 +35,7 @@ previewGrid = { show : false, snap : false, - width : 16, - height : 16, + size : [ 16, 16 ], opacity : 0.5, color : COLORS.panel_preview_grid, } @@ -89,8 +88,7 @@ globalvar PROJECTS; /// @is {Project[]} globalvar PROJECT; /// @is {Project} - gml_pragma("global", "__init()"); - function __init() { + function __initProject() { PROJECT = new Project(); PROJECTS = [ PROJECT ]; } @@ -107,10 +105,10 @@ globalvar VERSION, SAVE_VERSION, VERSION_STRING, BUILD_NUMBER; - VERSION = 11523; + VERSION = 11530; SAVE_VERSION = 11500; - VERSION_STRING = "1.15.2.3"; - BUILD_NUMBER = 11523; + VERSION_STRING = "1.15.3.0"; + BUILD_NUMBER = 11530; globalvar APPEND_MAP; APPEND_MAP = ds_map_create(); diff --git a/scripts/gradients_function/gradients_function.gml b/scripts/gradients_function/gradients_function.gml index 9cf88035a..fded18edb 100644 --- a/scripts/gradients_function/gradients_function.gml +++ b/scripts/gradients_function/gradients_function.gml @@ -152,6 +152,17 @@ function gradientObject(color = c_black) constructor { return grad; } + static shader_submit = function() { + var _grad = toArray(); + var _grad_color = _grad[0]; + var _grad_time = _grad[1]; + + shader_set_i("gradient_blend", type); + shader_set_f("gradient_color", _grad_color); + shader_set_f("gradient_time", _grad_time); + shader_set_i("gradient_keys", array_length(keys)); + } + static clone = function() { var g = new gradientObject(); g.keys = []; diff --git a/scripts/node_VFX_effector/node_VFX_effector.gml b/scripts/node_VFX_effector/node_VFX_effector.gml index 28a49be32..f6acd3a23 100644 --- a/scripts/node_VFX_effector/node_VFX_effector.gml +++ b/scripts/node_VFX_effector/node_VFX_effector.gml @@ -34,7 +34,7 @@ function Node_VFX_effector(_x, _y, _group = noone) : Node(_x, _y, _group) constr .rejectArray(); inputs[| 7] = nodeValue("Scale particle", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0, 0 ] ) - .setDisplay(VALUE_DISPLAY.vector_range) + .setDisplay(VALUE_DISPLAY.vector_range, { linked : true }) .rejectArray(); input_display_list = [ 0, diff --git a/scripts/node_group_input/node_group_input.gml b/scripts/node_group_input/node_group_input.gml index 9a6b840db..bb37f6ed7 100644 --- a/scripts/node_group_input/node_group_input.gml +++ b/scripts/node_group_input/node_group_input.gml @@ -64,7 +64,7 @@ function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constru inputs[| 0].editWidget.update_hover = false; inputs[| 1] = nodeValue("Range", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [0, 1]) - .setDisplay(VALUE_DISPLAY.vector_range) + .setDisplay(VALUE_DISPLAY.range) .uncache() .setVisible(false) .rejectArray(); diff --git a/scripts/node_guide/node_guide.gml b/scripts/node_guide/node_guide.gml index 07919a72d..a30c89e91 100644 --- a/scripts/node_guide/node_guide.gml +++ b/scripts/node_guide/node_guide.gml @@ -1,7 +1,7 @@ globalvar NODE_EXTRACT; NODE_EXTRACT = false; -function __generate_node_data() { +function __generate_node_data() { #region var amo = ds_map_size(ALL_NODES); var k = ds_map_find_first(ALL_NODES); @@ -82,7 +82,58 @@ function __generate_node_data() { CLONING = false; game_end(); -} +} #endregion + +#region node suggestion + function __loadNodeReleated(path) { + var _json = json_load_struct(path); + var _keys = variable_struct_get_names(_json); + var _rel = global.NODE_RELATION; + + for( var i = 0, n = array_length(_keys); i < n; i++ ) { + var _group = _json[$ _keys[i]]; + if(!struct_has(_rel, _keys[i])) + _rel[$ _keys[i]] = { relations : {} }; + var _Vgroup = _rel[$ _keys[i]].relations; + + switch(_group.key) { + case "connectionType" : + var _types = variable_struct_get_names(_group.relations); + for( var j = 0, m = array_length(_types); j < m; j++ ) { + var _k = value_type_from_string(_types[j]); + if(!struct_has(_Vgroup, _k)) _Vgroup[$ _k] = []; + array_append(_Vgroup[$ _k], _group.relations[$ _types[j]]); + } + break; + } + } + } + + + function __initNodeReleated() { + global.NODE_RELATION = {}; + + var _dir = DIRECTORY + "Nodes/Related"; + if(!directory_exists(_dir)) return; + + var f = file_find_first(_dir + "/*.json", fa_none); + + while (f != "") { + __loadNodeReleated(_dir + "/" + f); + f = file_find_next(); + } + + file_find_close(); + } + + function nodeReleatedQuery(type, key) { + if(!struct_has(global.NODE_RELATION, type)) return []; + var _sugs = global.NODE_RELATION[$ type]; + + if(!struct_has(_sugs.relations, key)) return []; + return _sugs.relations[$ key]; + } +#endregion function __initNodeData() { global.NODE_GUIDE = {}; @@ -90,12 +141,6 @@ function __initNodeData() { var nodeDir = DIRECTORY + "Nodes/"; var _l = nodeDir + "/version"; - //if(file_exists(_l)) { - // var res = json_load_struct(_l); - // if(res.version == BUILD_NUMBER) return; - //} - //json_save_struct(_l, { version: BUILD_NUMBER }); - if(file_exists("data/tooltip.zip")) zip_unzip("data/tooltip.zip", nodeDir); else @@ -103,6 +148,11 @@ function __initNodeData() { if(file_exists("data/nodes.json")) { file_delete(nodeDir + "nodes.json"); - file_copy("data/nodes.json", nodeDir + "nodes.json"); + file_copy_override("data/nodes.json", nodeDir + "nodes.json"); } + + directory_verify(nodeDir + "/Related"); + file_copy_override("data/related_node.json", nodeDir + "/Related/default.json"); + + __initNodeReleated(); } \ No newline at end of file diff --git a/scripts/node_image_gif/node_image_gif.gml b/scripts/node_image_gif/node_image_gif.gml index 07992d962..72ee523ce 100644 --- a/scripts/node_image_gif/node_image_gif.gml +++ b/scripts/node_image_gif/node_image_gif.gml @@ -41,6 +41,8 @@ function Node_Image_gif(_x, _y, _group = noone) : Node(_x, _y, _group) construct PROJECT.animator.framerate = 12; }, "Match length"] ); + inputs[| 2] = nodeValue("Output as array", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); outputs[| 1] = nodeValue("Path", self, JUNCTION_CONNECT.output, VALUE_TYPE.path, "") .setVisible(true, true); @@ -52,6 +54,8 @@ function Node_Image_gif(_x, _y, _group = noone) : Node(_x, _y, _group) construct loading = 0; spr_builder = noone; + surfaces = []; + on_dragdrop_file = function(path) { if(updatePaths(path)) { doUpdate(); @@ -99,11 +103,12 @@ function Node_Image_gif(_x, _y, _group = noone) : Node(_x, _y, _group) construct static step = function() { if(loading == 2 && spr_builder != noone && spr_builder.building()) { + surfaces = []; spr = spr_builder._spr; triggerRender(); loading = 0; delete spr_builder; - + gc_collect(); } } @@ -112,27 +117,46 @@ function Node_Image_gif(_x, _y, _group = noone) : Node(_x, _y, _group) construct var path = inputs[| 0].getValue(); if(path == "") return; if(path_current != path) updatePaths(path); - if(!spr || !sprite_exists(spr)) return; var ww = sprite_get_width(spr); var hh = sprite_get_height(spr); var _outsurf = outputs[| 0].getValue(); + var array = inputs[| 2].getValue(); + + if(array) { + var amo = sprite_get_number(spr); + if(array_length(surfaces) == amo && is_surface(surfaces[0])) { + outputs[| 0].setValue(surfaces); + return; + } + + surface_array_free(_outsurf); + surfaces = array_create(amo); + + for( var i = 0; i < amo; i++ ) { + surfaces[i] = surface_create_valid(ww, hh, attrDepth()); + + surface_set_shader(surfaces[i]); + draw_sprite(spr, i, 0, 0); + surface_reset_shader(); + } + + outputs[| 0].setValue(surfaces); + return; + } + _outsurf = surface_verify(_outsurf, ww, hh, attrDepth()); outputs[| 0].setValue(_outsurf); - surface_set_target(_outsurf); - DRAW_CLEAR - BLEND_OVERRIDE; - draw_sprite(spr, PROJECT.animator.current_frame, 0, 0); - BLEND_NORMAL; - surface_reset_target(); + surface_set_shader(_outsurf); + draw_sprite(spr, PROJECT.animator.current_frame, 0, 0); + surface_reset_shader(); } static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { - if(loading) - draw_sprite_ui(THEME.loading, 0, xx + w * _s / 2, yy + h * _s / 2, _s, _s, current_time / 2, COLORS._main_icon, 1); + if(loading) draw_sprite_ui(THEME.loading, 0, xx + w * _s / 2, yy + h * _s / 2, _s, _s, current_time / 2, COLORS._main_icon, 1); } static onDestroy = function() { diff --git a/scripts/node_image_sequence/node_image_sequence.gml b/scripts/node_image_sequence/node_image_sequence.gml index ca258c17f..0ea1c21f4 100644 --- a/scripts/node_image_sequence/node_image_sequence.gml +++ b/scripts/node_image_sequence/node_image_sequence.gml @@ -137,10 +137,12 @@ function Node_Image_Sequence(_x, _y, _group = noone) : Node(_x, _y, _group) cons var _ww = -1, _hh = -1; var surfs = outputs[| 0].getValue(); - surface_array_free(surfs); - surfs = []; + var amo = array_length(spr); + for(var i = amo; i < array_length(surfs); i++) + surface_free(surfs[i]); + array_resize(surfs, amo); - for(var i = 0; i < array_length(spr); i++) { + for(var i = 0; i < amo; i++) { var _spr = spr[i]; var _w = sprite_get_width(_spr); var _h = sprite_get_height(_spr); @@ -172,7 +174,7 @@ function Node_Image_Sequence(_x, _y, _group = noone) : Node(_x, _y, _group) cons ww = sprite_get_width(_spr) + pad[0] + pad[2]; hh = sprite_get_height(_spr) + pad[1] + pad[3]; - surfs[i] = surface_create(ww, hh, attrDepth()); + surfs[i] = surface_verify(surfs[i], ww, hh, attrDepth()); surface_set_target(surfs[i]); DRAW_CLEAR BLEND_OVERRIDE; @@ -182,7 +184,7 @@ function Node_Image_Sequence(_x, _y, _group = noone) : Node(_x, _y, _group) cons break; case CANVAS_SIZE.maximum : case CANVAS_SIZE.minimum : - surfs[i] = surface_create(ww, hh, attrDepth()); + surfs[i] = surface_verify(surfs[i], ww, hh, attrDepth()); var _w = sprite_get_width(_spr); var _h = sprite_get_height(_spr); diff --git a/scripts/node_interpret_number/node_checkerboard.yy b/scripts/node_interpret_number/node_checkerboard.yy new file mode 100644 index 000000000..f65eb196c --- /dev/null +++ b/scripts/node_interpret_number/node_checkerboard.yy @@ -0,0 +1,12 @@ +{ + "isDnD": false, + "isCompatibility": false, + "parent": { + "name": "generator", + "path": "folders/nodes/data/generator.yy", + }, + "resourceVersion": "1.0", + "name": "node_checkerboard", + "tags": [], + "resourceType": "GMScript", +} \ No newline at end of file diff --git a/scripts/node_interpret_number/node_interpret_number.gml b/scripts/node_interpret_number/node_interpret_number.gml new file mode 100644 index 000000000..bfaa39a68 --- /dev/null +++ b/scripts/node_interpret_number/node_interpret_number.gml @@ -0,0 +1,62 @@ +function Node_Interpret_Number(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor { + name = "Interpret Number"; + dimension_index = -1; + + inputs[| 0] = nodeValue("Number", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [] ) + .setVisible(true, true) + .setArrayDepth(1); + + inputs[| 1] = nodeValue("Mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0) + .setDisplay(VALUE_DISPLAY.enum_button, [ "Greyscale", "Gradient" ]); + + inputs[| 2] = nodeValue("Range", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 1 ] ) + .setDisplay(VALUE_DISPLAY.range); + + inputs[| 3] = nodeValue("Gradient", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(c_white) ); + + outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); + + input_display_list = [ 0, + ["Interpret", false], 1, 2, 3, + ]; + + attribute_surface_depth(); + + static step = function() { + var _mode = getInputData(1); + + inputs[| 3].setVisible(_mode == 1); + } + + static processData = function(_outSurf, _data, _output_index, _array_index) { + static BATCH_SIZE = 1024; + + var _num = _data[0]; + var _mod = _data[1]; + var _ran = _data[2]; + var _grd = _data[3]; + + if(!is_array(_num)) _num = [ _num ]; + _num = array_spread(_num); + + var _amo = array_length(_num); + + _outSurf = surface_verify(_outSurf, _amo, 1, attrDepth()); + + surface_set_shader(_outSurf, sh_interpret_number); + shader_set_i("mode", _mod); + shader_set_f("range", _ran); + _grd.shader_submit(); + + for(var i = 0; i < _amo; i += BATCH_SIZE) { + var _arr = []; + array_copy(_arr, 0, _num, i, BATCH_SIZE); + shader_set_f("number", _arr); + + draw_sprite_stretched(s_fx_pixel, 0, i, 0, BATCH_SIZE, 1); + } + surface_reset_shader(); + + return _outSurf; + } +} \ No newline at end of file diff --git a/scripts/node_interpret_number/node_interpret_number.yy b/scripts/node_interpret_number/node_interpret_number.yy new file mode 100644 index 000000000..d8737b258 --- /dev/null +++ b/scripts/node_interpret_number/node_interpret_number.yy @@ -0,0 +1,11 @@ +{ + "resourceType": "GMScript", + "resourceVersion": "1.0", + "name": "node_interpret_number", + "isCompatibility": false, + "isDnD": false, + "parent": { + "name": "generator", + "path": "folders/nodes/data/generator.yy", + }, +} \ No newline at end of file diff --git a/scripts/node_interpret_number/node_stripe.yy b/scripts/node_interpret_number/node_stripe.yy new file mode 100644 index 000000000..3c179d416 --- /dev/null +++ b/scripts/node_interpret_number/node_stripe.yy @@ -0,0 +1,12 @@ +{ + "isDnD": false, + "isCompatibility": false, + "parent": { + "name": "generator", + "path": "folders/nodes/data/generator.yy", + }, + "resourceVersion": "1.0", + "name": "node_stripe", + "tags": [], + "resourceType": "GMScript", +} \ No newline at end of file diff --git a/scripts/node_number/node_number.gml b/scripts/node_number/node_number.gml index e0d8090d4..af46f8846 100644 --- a/scripts/node_number/node_number.gml +++ b/scripts/node_number/node_number.gml @@ -23,7 +23,7 @@ function Node_Number(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Number", "Slider", "Rotator" ], { update_hover: false }); inputs[| 3] = nodeValue("Range", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 1 ]) - .setDisplay(VALUE_DISPLAY.vector_range); + .setDisplay(VALUE_DISPLAY.range); inputs[| 4] = nodeValue("Step", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.01) diff --git a/scripts/node_registry/node_registry.gml b/scripts/node_registry/node_registry.gml index 40dc3019c..ac83f370b 100644 --- a/scripts/node_registry/node_registry.gml +++ b/scripts/node_registry/node_registry.gml @@ -428,6 +428,7 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { #regio addNodeObject(generator, "Draw Text", s_node_text_render, "Node_Text", [1, Node_Text],, "Draw text on an image."); addNodeObject(generator, "Shape", s_node_shape, "Node_Shape", [1, Node_Shape],, "Draw simple shapes using signed distance field."); addNodeObject(generator, "Polygon Shape", s_node_shape_polygon, "Node_Shape_Polygon", [1, Node_Shape_Polygon],, "Draw simple shapes using triangles.").setVersion(1130); + addNodeObject(generator, "Interpret Number",s_node_interpret_number,"Node_Interpret_Number",[1, Node_Interpret_Number]).setVersion(11530); addNodeObject(generator, "Random Shape", s_node_random_shape, "Node_Random_Shape", [1, Node_Random_Shape]).setVersion(1147); ds_list_add(generator, "Noises"); @@ -450,7 +451,6 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { #regio addNodeObject(generator, "Scatter", s_node_scatter, "Node_Scatter", [1, Node_Scatter],, "Scatter image randomly multiple times."); ds_list_add(generator, "Simulation"); - //addNodeObject(generator, "Dust", s_node_particle, "Node_Dust", [1, Node_Dust]).setVersion(1147); addNodeObject(generator, "Particle", s_node_particle, "Node_Particle", [1, Node_Particle],, "Generate particle effect."); addNodeObject(generator, "VFX", s_node_vfx, "Node_VFX_Group", [1, Node_VFX_Group],, "Create VFX group, which generate particles that can be manipulated using different force nodes."); addNodeObject(generator, "RigidSim", s_node_rigidSim, "Node_Rigid_Group", [1, Node_Rigid_Group],, "Create group for rigidbody simulation.").setVersion(1110); @@ -811,40 +811,4 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { #regio addNodeObject(hid, "getHeight", s_node_pixel_builder, "Node_DynaSurf_Out_Height", [1, Node_DynaSurf_Out_Height]); #endregion } -#endregion - -#region node suggestion - global.VALUE_SUGGESTION = ds_map_create(); - - global.VALUE_SUGGESTION[? VALUE_TYPE.integer] = [ "Node_Math", "Node_Equation", "Node_To_Text" ]; - global.VALUE_SUGGESTION[? VALUE_TYPE.float] = [ "Node_Math", "Node_Equation", "Node_To_Text" ]; - global.VALUE_SUGGESTION[? VALUE_TYPE.boolean] = [ ]; - global.VALUE_SUGGESTION[? VALUE_TYPE.color] = [ "Node_Solid", "Node_Color_Data", "Node_Color_Mix" ]; - global.VALUE_SUGGESTION[? VALUE_TYPE.surface] = [ "Node_Transform", "Node_Blend", "Node_Composite", "Node_Export" ]; - - global.VALUE_SUGGESTION[? VALUE_TYPE.path] = [ "Node_Line" ]; - global.VALUE_SUGGESTION[? VALUE_TYPE.curve] = [ ]; - global.VALUE_SUGGESTION[? VALUE_TYPE.text] = [ "Node_Text", "Node_To_Number" ]; - global.VALUE_SUGGESTION[? VALUE_TYPE.object] = [ ]; - global.VALUE_SUGGESTION[? VALUE_TYPE.node] = [ ]; - global.VALUE_SUGGESTION[? VALUE_TYPE.d3object] = [ ]; - - global.VALUE_SUGGESTION[? VALUE_TYPE.any] = [ ]; - - global.VALUE_SUGGESTION[? VALUE_TYPE.pathnode] = [ "Node_Line", "Node_Mesh_Create_Path" ]; - global.VALUE_SUGGESTION[? VALUE_TYPE.particle] = [ ]; - global.VALUE_SUGGESTION[? VALUE_TYPE.rigid] = [ ]; - global.VALUE_SUGGESTION[? VALUE_TYPE.fdomain] = [ ]; - global.VALUE_SUGGESTION[? VALUE_TYPE.struct] = [ "Node_Struct_Get" ]; - global.VALUE_SUGGESTION[? VALUE_TYPE.strands] = [ ]; - global.VALUE_SUGGESTION[? VALUE_TYPE.mesh] = [ ]; - global.VALUE_SUGGESTION[? VALUE_TYPE.trigger] = [ ]; - global.VALUE_SUGGESTION[? VALUE_TYPE.atlas] = [ "Node_Atlas_Draw", "Node_Atlas_Get", "Node_Atlas_Set" ]; - - global.VALUE_SUGGESTION[? VALUE_TYPE.d3vertex] = [ ]; - global.VALUE_SUGGESTION[? VALUE_TYPE.gradient] = [ "Node_Gradient", "Node_Gradient_Extract" ]; - global.VALUE_SUGGESTION[? VALUE_TYPE.armature] = [ "Node_Armature_Pose", "Node_Armature_Bind", "Node_Armature_Path", "Node_Armature_Sample" ]; - global.VALUE_SUGGESTION[? VALUE_TYPE.buffer] = [ "Node_Surface_From_Buffer" ]; - - global.VALUE_SUGGESTION[? VALUE_TYPE.action] = [ ]; #endregion \ No newline at end of file diff --git a/scripts/node_scatter/node_scatter.gml b/scripts/node_scatter/node_scatter.gml index 5fe61fad4..7880920d9 100644 --- a/scripts/node_scatter/node_scatter.gml +++ b/scripts/node_scatter/node_scatter.gml @@ -10,7 +10,7 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c inputs[| 2] = nodeValue("Amount", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 8); inputs[| 3] = nodeValue("Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1, 1, 1 ] ) - .setDisplay(VALUE_DISPLAY.vector_range); + .setDisplay(VALUE_DISPLAY.vector_range, { linked : true }); inputs[| 4] = nodeValue("Angle", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 0, 0, 0, 0, 0 ] ) .setDisplay(VALUE_DISPLAY.rotation_random); diff --git a/scripts/node_skew/node_skew.gml b/scripts/node_skew/node_skew.gml index 151af0e47..e00faf79d 100644 --- a/scripts/node_skew/node_skew.gml +++ b/scripts/node_skew/node_skew.gml @@ -11,9 +11,9 @@ function Node_Skew(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons inputs[| 3] = nodeValue("Wrap", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); inputs[| 4] = nodeValue("Center", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [0, 0] ) - .setDisplay(VALUE_DISPLAY.vector, button(function() { centerAnchor(); }) - .setIcon(THEME.anchor) - .setTooltip(__txt("Set to center"))); + .setDisplay(VALUE_DISPLAY.vector, { side_button : button(function() { centerAnchor(); }) + .setIcon(THEME.anchor) + .setTooltip(__txt("Set to center")) }); inputs[| 5] = nodeValue("Oversample mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0, "How to deal with pixel outside the surface.\n - Empty: Use empty pixel\n - Clamp: Repeat edge pixel\n - Repeat: Repeat texture.") .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Empty", "Clamp", "Repeat" ]); diff --git a/scripts/node_solid/node_solid.gml b/scripts/node_solid/node_solid.gml index 488bd8b2c..77f8fcc77 100644 --- a/scripts/node_solid/node_solid.gml +++ b/scripts/node_solid/node_solid.gml @@ -40,6 +40,7 @@ function Node_Solid(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con surface_reset_target(); return _outSurf; } + surface_set_target(_outSurf); DRAW_CLEAR diff --git a/scripts/node_strand_render/node_strand_render.gml b/scripts/node_strand_render/node_strand_render.gml index 1750059f0..02fe8cf3c 100644 --- a/scripts/node_strand_render/node_strand_render.gml +++ b/scripts/node_strand_render/node_strand_render.gml @@ -11,7 +11,7 @@ function Node_Strand_Render(_x, _y, _group = noone) : Node(_x, _y, _group) const .setVisible(true, true); inputs[| 2] = nodeValue("Thickness", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 1, 1 ]) - .setDisplay(VALUE_DISPLAY.vector_range); + .setDisplay(VALUE_DISPLAY.range, { linked : true }); inputs[| 3] = nodeValue("Thickness over length", self, JUNCTION_CONNECT.input, VALUE_TYPE.curve, CURVE_DEF_11); diff --git a/scripts/node_strand_render_texture/node_strand_render_texture.gml b/scripts/node_strand_render_texture/node_strand_render_texture.gml index 090dd3139..48e7eb462 100644 --- a/scripts/node_strand_render_texture/node_strand_render_texture.gml +++ b/scripts/node_strand_render_texture/node_strand_render_texture.gml @@ -11,7 +11,7 @@ function Node_Strand_Render_Texture(_x, _y, _group = noone) : Node(_x, _y, _grou .setVisible(true, true); inputs[| 2] = nodeValue("Thickness", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 8, 8 ]) - .setDisplay(VALUE_DISPLAY.vector_range); + .setDisplay(VALUE_DISPLAY.range, { linked : true }); inputs[| 3] = nodeValue("Random color", self, JUNCTION_CONNECT.input, VALUE_TYPE.gradient, new gradientObject(c_white)); diff --git a/scripts/node_transform/node_transform.gml b/scripts/node_transform/node_transform.gml index a87d2caf3..589a76104 100644 --- a/scripts/node_transform/node_transform.gml +++ b/scripts/node_transform/node_transform.gml @@ -19,9 +19,9 @@ function Node_Transform(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) .setUnitRef(function(index) { return getDimension(index); }, VALUE_UNIT.reference); inputs[| 3] = nodeValue("Anchor", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0.5, 0.5 ]) - .setDisplay(VALUE_DISPLAY.vector, button(function() { centerAnchor(); }) - .setIcon(THEME.anchor) - .setTooltip("Set to center")); + .setDisplay(VALUE_DISPLAY.vector, { side_button : button(function() { centerAnchor(); }) + .setIcon(THEME.anchor) + .setTooltip("Set to center") }); inputs[| 4] = nodeValue("Relative anchor", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true); diff --git a/scripts/node_value/node_value.gml b/scripts/node_value/node_value.gml index 1de3a660c..a68e76116 100644 --- a/scripts/node_value/node_value.gml +++ b/scripts/node_value/node_value.gml @@ -52,8 +52,8 @@ enum VALUE_TYPE { d3Scene = 29, d3Material = 30, - dynaSurface = 31, - PCXnode = 32, + dynaSurface = 31, + PCXnode = 32, action = 99, } @@ -248,13 +248,16 @@ function value_type_from_string(str) { #region case "boolean" : return VALUE_TYPE.boolean; case "color" : return VALUE_TYPE.color; case "surface" : return VALUE_TYPE.surface; + case "path" : return VALUE_TYPE.path; case "curve" : return VALUE_TYPE.curve; case "text" : return VALUE_TYPE.text; case "object" : return VALUE_TYPE.object; case "node" : return VALUE_TYPE.node; case "d3object" : return VALUE_TYPE.d3object; + case "any" : return VALUE_TYPE.any; + case "pathnode" : return VALUE_TYPE.pathnode; case "particle" : return VALUE_TYPE.particle; case "rigid" : return VALUE_TYPE.rigid; @@ -264,18 +267,23 @@ function value_type_from_string(str) { #region case "mesh" : return VALUE_TYPE.mesh; case "trigger" : return VALUE_TYPE.trigger; case "atlas" : return VALUE_TYPE.atlas; + case "d3vertex" : return VALUE_TYPE.d3vertex; case "gradient" : return VALUE_TYPE.gradient; case "armature" : return VALUE_TYPE.armature; case "buffer" : return VALUE_TYPE.buffer; + case "pbBox" : return VALUE_TYPE.pbBox; + case "d3Mesh" : return VALUE_TYPE.d3Mesh; case "d3Light" : return VALUE_TYPE.d3Light; case "d3Camera" : return VALUE_TYPE.d3Camera; case "d3Scene" : return VALUE_TYPE.d3Scene; case "d3Material" : return VALUE_TYPE.d3Material; + case "dynaSurface" : return VALUE_TYPE.dynaSurface; case "PCXnode" : return VALUE_TYPE.PCXnode; + case "action" : return VALUE_TYPE.action; } @@ -716,12 +724,13 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru break; #endregion case VALUE_DISPLAY.range : #region editWidget = new rangeBox(_txt, function(index, 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; + + extra_data = { linked : false }; + if(display_data != -1) struct_override(extra_data, display_data); for( var i = 0, n = array_length(animators); i < n; i++ ) animators[i].suffix = " " + array_safe_get(global.displaySuffix_Range, i); @@ -734,13 +743,13 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru if(len <= 4) { editWidget = new vectorBox(len, function(index, 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 && is_struct(display_data)) - editWidget.extras = display_data; + + extra_data = { linked : false, side_button : noone }; + if(display_data != -1) struct_override(extra_data, display_data); if(len == 2) { extract_node = [ "Node_Vector2", "Node_Path" ]; @@ -758,12 +767,13 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru var val = animator.getValue(); editWidget = new vectorRangeBox(array_length(val), _txt, function(index, 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; + + extra_data = { linked : false }; + if(display_data != -1) struct_override(extra_data, display_data); if(array_length(val) == 2) extract_node = "Node_Vector2"; diff --git a/scripts/node_websocket_sender/node_websocket_sender.gml b/scripts/node_websocket_sender/node_websocket_sender.gml index f443126ae..8c0094bf0 100644 --- a/scripts/node_websocket_sender/node_websocket_sender.gml +++ b/scripts/node_websocket_sender/node_websocket_sender.gml @@ -29,7 +29,7 @@ function Node_Websocket_Sender(_x, _y, _group = noone) : Node(_x, _y, _group) co connected = false; socket = noone; - function connectTo(newPort, newUrl) { + static connectTo = function(newPort, newUrl) { if(ds_map_exists(PORT_MAP, port)) array_remove(PORT_MAP[? port], self); diff --git a/scripts/panel_preview/panel_preview.gml b/scripts/panel_preview/panel_preview.gml index 3d1757060..a2413906e 100644 --- a/scripts/panel_preview/panel_preview.gml +++ b/scripts/panel_preview/panel_preview.gml @@ -726,11 +726,11 @@ function Panel_Preview() : PanelContent() constructor { if(is_surface(preview_surface[0])) { #region outline if(PROJECT.previewGrid.show) { - var _gw = PROJECT.previewGrid.width * canvas_s; - var _gh = PROJECT.previewGrid.height * canvas_s; + var _gw = PROJECT.previewGrid.size[0] * canvas_s; + var _gh = PROJECT.previewGrid.size[1] * canvas_s; - var gw = floor(pswd / _gw); - var gh = floor(pshd / _gh); + var gw = pswd / _gw; + var gh = pshd / _gh; var cx = canvas_x; var cy = canvas_y; @@ -1099,11 +1099,11 @@ function Panel_Preview() : PanelContent() constructor { _node.drawOverlay3D(overlayHover, d3_scene, _mx, _my, _snx, _sny, { w, h }); } else { if(key_mod_press(CTRL)) { - _snx = PROJECT.previewGrid.show? PROJECT.previewGrid.width : 1; - _sny = PROJECT.previewGrid.show? PROJECT.previewGrid.height : 1; + _snx = PROJECT.previewGrid.show? PROJECT.previewGrid.size[0] : 1; + _sny = PROJECT.previewGrid.show? PROJECT.previewGrid.size[1] : 1; } else if(PROJECT.previewGrid.snap) { - _snx = PROJECT.previewGrid.width; - _sny = PROJECT.previewGrid.height; + _snx = PROJECT.previewGrid.size[0]; + _sny = PROJECT.previewGrid.size[1]; } _node.drawOverlay(overlayHover, cx, cy, canvas_s, _mx, _my, _snx, _sny, { w, h }); diff --git a/scripts/panel_preview_grid_setting/panel_preview_grid_setting.gml b/scripts/panel_preview_grid_setting/panel_preview_grid_setting.gml index df337a78e..d32e5602c 100644 --- a/scripts/panel_preview_grid_setting/panel_preview_grid_setting.gml +++ b/scripts/panel_preview_grid_setting/panel_preview_grid_setting.gml @@ -20,18 +20,14 @@ function Panel_Preview_Grid_Setting() : Panel_Linear_Setting() constructor { function() { return PROJECT.previewGrid.snap; } ], [ - new textBox(TEXTBOX_INPUT.number, function(str) { - PROJECT.previewGrid.width = max(1, real(str)); - }), - __txt("Grid width"), - function() { return PROJECT.previewGrid.width; } - ], - [ - new textBox(TEXTBOX_INPUT.number, function(str) { - PROJECT.previewGrid.height = max(1, real(str)); - }), - __txt("Grid height"), - function() { return PROJECT.previewGrid.height; } + new vectorBox(2, function(index, value) { + var _v = PROJECT.previewGrid.size[index]; + PROJECT.previewGrid.size[index] = max(1, value); + + return _v != max(1, value); + }).setLinkInactiveColor(COLORS._main_icon_light), + __txt("Grid size"), + function() { return PROJECT.previewGrid.size; } ], [ new slider(0, 1, .05, function(str) { diff --git a/scripts/rangeBox/rangeBox.gml b/scripts/rangeBox/rangeBox.gml index 45dacb4ba..be3cad404 100644 --- a/scripts/rangeBox/rangeBox.gml +++ b/scripts/rangeBox/rangeBox.gml @@ -1,14 +1,16 @@ function rangeBox(_type, _onModify) : widget() constructor { - onModify = _onModify; + onModify = _onModify; + extra_data = { linked : false }; - linked = false; - b_link = button(function() { linked = !linked; }); - b_link.icon = THEME.value_link; + tooltip = new tooltipSelector("Value Type", [ + __txt("Random Range"), + __txt("Constant"), + ]); onModifyIndex = function(index, val) { var modi = false; - if(linked) { + if(extra_data.linked) { for( var i = 0; i < 2; i++ ) modi |= onModify(i, toNumber(val)); return modi; @@ -29,63 +31,67 @@ function rangeBox(_type, _onModify) : widget() constructor { } static setSlideSpeed = function(speed) { - for(var i = 0; i < 2; i++) - tb[i].slide_speed = speed; + tb[0].slide_speed = speed; + tb[1].slide_speed = speed; } static setInteract = function(interactable = noone) { self.interactable = interactable; - b_link.interactable = interactable; - for( var i = 0; i < 2; i++ ) - tb[i].interactable = interactable; + tb[0].interactable = interactable; + if(!extra_data.linked) + tb[1].interactable = interactable; } static register = function(parent = noone) { - b_link.register(parent); - - for( var i = 0; i < 2; i++ ) - tb[i].register(parent); + tb[0].register(parent); + if(!extra_data.linked) + tb[1].register(parent); } static drawParam = function(params) { - return draw(params.x, params.y, params.w, params.h, params.data, params.m); + return draw(params.x, params.y, params.w, params.h, params.data, params.extra_data, params.m); } - static draw = function(_x, _y, _w, _h, _data, _m) { + static draw = function(_x, _y, _w, _h, _data, _extra_data, _m) { x = _x; y = _y; w = _w; h = _h; + if(struct_has(_extra_data, "linked")) extra_data.linked = _extra_data.linked; + tooltip.index = extra_data.linked; - b_link.setFocusHover(active, hover); - b_link.icon_index = linked; - b_link.icon_blend = linked? COLORS._main_accent : COLORS._main_icon; - b_link.tooltip = linked? __txt("Unlink values") : __txt("Link values"); - + var _icon_blend = extra_data.linked? COLORS._main_accent : COLORS._main_icon; var bx = _x; var by = _y + _h / 2 - ui(32 / 2); - b_link.draw(bx + ui(4), by + ui(4), ui(24), ui(24), _m, THEME.button_hide); + if(buttonInstant(THEME.button_hide, bx + ui(4), by + ui(4), ui(24), ui(24), _m, active, hover, tooltip, THEME.value_link, extra_data.linked, _icon_blend) == 2) { + extra_data.linked = !extra_data.linked; + _extra_data.linked = extra_data.linked; + + if(extra_data.linked) { + onModify(0, _data[0]); + onModify(1, _data[0]); + } + } _x += ui(28); _w -= ui(28); - if(extras != -1 && is_struct(extras) && instanceof(extras) == "buttonClass") { - extras.setFocusHover(active, hover); - extras.draw(_x + _w - ui(32), _y + _h / 2 - ui(32 / 2), ui(32), ui(32), _m, THEME.button_hide); - _w -= ui(40); - } - - if(is_array(_data) && array_length(_data) >= 2) { - var ww = _w / 2; - for(var i = 0; i < 2; i++) { - tb[i].setFocusHover(active, hover); + if(extra_data.linked) { + tb[0].setFocusHover(active, hover); + tb[0].draw(_x + ui(8), _y, _w - ui(8), _h, _data[0], _m); + } else { + if(is_array(_data) && array_length(_data) >= 2) { + var ww = _w / 2; + for(var i = 0; i < 2; i++) { + tb[i].setFocusHover(active, hover); - var bx = _x + ww * i; - tb[i].draw(bx + ui(44), _y, ww - ui(44), _h, _data[i], _m); + var bx = _x + ww * i; + tb[i].draw(bx + ui(44), _y, ww - ui(44), _h, _data[i], _m); - draw_set_text(f_p0, fa_left, fa_center, COLORS._main_text_sub); - draw_text(bx + ui(8), _y + _h / 2, label[i]); + draw_set_text(f_p0, fa_left, fa_center, COLORS._main_text_sub); + draw_text(bx + ui(8), _y + _h / 2, label[i]); + } } } diff --git a/scripts/vectorBox/vectorBox.gml b/scripts/vectorBox/vectorBox.gml index 83fe9f4a1..47d1ccdd0 100644 --- a/scripts/vectorBox/vectorBox.gml +++ b/scripts/vectorBox/vectorBox.gml @@ -8,14 +8,19 @@ function vectorBox(_size, _onModify, _unit = noone) : widget() constructor { onModify = _onModify; unit = _unit; current_value = []; + extra_data = { linked : false, side_button : noone }; - linked = false; - b_link = button(function() { linked = !linked; }); + link_inactive_color = noone; + + tooltip = new tooltipSelector("Axis", [ + __txt("Independent"), + __txt("Linked"), + ]); onModifyIndex = function(index, val) { var v = toNumber(val); - if(linked) { + if(extra_data.linked) { var modi = false; for( var i = 0; i < size; i++ ) { tb[i]._input_text = v; @@ -37,59 +42,66 @@ function vectorBox(_size, _onModify, _unit = noone) : widget() constructor { onModifySingle[2] = function(val) { return onModifyIndex(2, val); } onModifySingle[3] = function(val) { return onModifyIndex(3, val); } - extras = noone; - for(var i = 0; i < 4; i++) { tb[i] = new textBox(TEXTBOX_INPUT.number, onModifySingle[i]); tb[i].slidable = true; } + static setLinkInactiveColor = function(color) { + link_inactive_color = color; + return self; + } + static setSlideSpeed = function(speed) { for(var i = 0; i < size; i++) tb[i].slide_speed = speed; + return self; } static setInteract = function(interactable) { self.interactable = interactable; - b_link.interactable = interactable; - if(extras != noone) extras.interactable = interactable; + if(extra_data.side_button != noone) + extra_data.side_button.interactable = interactable; for( var i = 0; i < size; i++ ) tb[i].interactable = interactable; } static register = function(parent = noone) { - b_link.register(parent); - for( var i = 0; i < size; i++ ) tb[i].register(parent); - if(extras != noone) extras.register(parent); + if(extra_data.side_button != noone) + extra_data.side_button.register(parent); if(unit != noone && unit.reference != noone) unit.triggerButton.register(parent); } static drawParam = function(params) { - return draw(params.x, params.y, params.w, params.h, params.data, params.m); + return draw(params.x, params.y, params.w, params.h, params.data, params.extra_data, params.m); } - static draw = function(_x, _y, _w, _h, _data, _m) { + static draw = function(_x, _y, _w, _h, _data, _extra_data, _m) { x = _x; y = _y; w = _w; h = _h; + if(struct_has(_extra_data, "linked")) extra_data.linked = _extra_data.linked; + if(struct_has(_extra_data, "side_button")) extra_data.side_button = _extra_data.side_button; + tooltip.index = extra_data.linked; + if(!is_array(_data)) return 0; if(array_empty(_data)) return 0; if(is_array(_data[0])) return 0; current_value = _data; - if(extras && instanceof(extras) == "buttonClass") { - extras.setFocusHover(active, hover); - extras.draw(_x + _w - ui(32), _y + _h / 2 - ui(32 / 2), ui(32), ui(32), _m, THEME.button_hide); + if(extra_data.side_button) { + extra_data.side_button.setFocusHover(active, hover); + extra_data.side_button.draw(_x + _w - ui(32), _y + _h / 2 - ui(32 / 2), ui(32), ui(32), _m, THEME.button_hide); _w -= ui(40); } @@ -101,15 +113,18 @@ function vectorBox(_size, _onModify, _unit = noone) : widget() constructor { _w -= ui(40); } - b_link.setFocusHover(active, hover); - b_link.icon = THEME.value_link; - b_link.icon_index = linked; - b_link.icon_blend = linked? COLORS._main_accent : COLORS._main_icon; - b_link.tooltip = linked? __txt("Unlink values") : __txt("Link values"); - + var _icon_blend = extra_data.linked? COLORS._main_accent : (link_inactive_color == noone? COLORS._main_icon : link_inactive_color); var bx = _x; var by = _y + _h / 2 - ui(32 / 2); - b_link.draw(bx + ui(4), by + ui(4), ui(24), ui(24), _m, THEME.button_hide); + if(buttonInstant(THEME.button_hide, bx + ui(4), by + ui(4), ui(24), ui(24), _m, active, hover, tooltip, THEME.value_link, extra_data.linked, _icon_blend) == 2) { + extra_data.linked = !extra_data.linked; + _extra_data.linked = extra_data.linked; + + if(extra_data.linked) { + onModify(0, _data[0]); + onModify(1, _data[0]); + } + } _x += ui(28); _w -= ui(28); diff --git a/scripts/vectorRangeBox/vectorRangeBox.gml b/scripts/vectorRangeBox/vectorRangeBox.gml index 0919bdfbc..86fb377a1 100644 --- a/scripts/vectorRangeBox/vectorRangeBox.gml +++ b/scripts/vectorRangeBox/vectorRangeBox.gml @@ -2,13 +2,15 @@ function vectorRangeBox(_size, _type, _onModify, _unit = noone) : widget() const size = _size; onModify = _onModify; unit = _unit; + extra_data = { linked : false }; - linked = false; - b_link = button(function() { linked = !linked; }); - b_link.icon = THEME.value_link; + tooltip = new tooltipSelector("Value Type", [ + __txt("Random Range"), + __txt("Constant"), + ]); onModifyIndex = function(index, val) { - if(linked) { + if(extra_data.linked) { var modi = false; modi |= onModify(floor(index / 2) * 2 + 0, toNumber(val)); modi |= onModify(floor(index / 2) * 2 + 1, toNumber(val)); @@ -19,7 +21,6 @@ function vectorRangeBox(_size, _type, _onModify, _unit = noone) : widget() const } axis = [ "x", "y", "z", "w"]; - label = []; onModifySingle[0] = function(val) { return onModifyIndex(0, toNumber(val)); } onModifySingle[1] = function(val) { return onModifyIndex(1, toNumber(val)); } onModifySingle[2] = function(val) { return onModifyIndex(2, toNumber(val)); } @@ -30,8 +31,6 @@ function vectorRangeBox(_size, _type, _onModify, _unit = noone) : widget() const for(var i = 0; i < size; i++) { tb[i] = new textBox(_type, onModifySingle[i]); tb[i].slidable = true; - - label[i] = (i % 2? __txt("Max") : __txt("Min")) + " " + axis[floor(i / 2)]; } static setSlideSpeed = function(speed) { @@ -41,64 +40,70 @@ function vectorRangeBox(_size, _type, _onModify, _unit = noone) : widget() const static setInteract = function(interactable = noone) { self.interactable = interactable; - b_link.interactable = interactable; - for( var i = 0; i < size; i++ ) + var _step = extra_data.linked? 2 : 1; + for( var i = 0; i < size; i += _step ) tb[i].interactable = interactable; - if(extras) - extras.interactable = interactable; } static register = function(parent = noone) { - b_link.register(parent); - - for( var i = 0; i < size; i++ ) + var _step = extra_data.linked? 2 : 1; + for( var i = 0; i < size; i += _step ) tb[i].register(parent); - if(extras) extras.register(parent); } static drawParam = function(params) { - return draw(params.x, params.y, params.w, params.h, params.data, params.m); + return draw(params.x, params.y, params.w, params.h, params.data, params.extra_data, params.m); } - static draw = function(_x, _y, _w, _h, _data, _m) { + static draw = function(_x, _y, _w, _h, _data, _extra_data, _m) { x = _x; y = _y; w = _w; - h = _h * 2 + ui(4); - b_link.setFocusHover(active, hover); - b_link.icon_index = linked; - b_link.icon_blend = linked? COLORS._main_accent : COLORS._main_icon; - b_link.tooltip = linked? __txt("Unlink values") : __txt("Link values"); + if(struct_has(_extra_data, "linked")) extra_data.linked = _extra_data.linked; + h = extra_data.linked? _h : _h * 2 + ui(4); + tooltip.index = extra_data.linked; + + var _icon_blend = extra_data.linked? COLORS._main_accent : COLORS._main_icon; var bx = _x; var by = _y + _h / 2 - ui(32 / 2); - b_link.draw(bx + ui(4), by + ui(4), ui(24), ui(24), _m, THEME.button_hide); + if(buttonInstant(THEME.button_hide, bx + ui(4), by + ui(4), ui(24), ui(24), _m, active, hover, tooltip, THEME.value_link, extra_data.linked, _icon_blend) == 2) { + extra_data.linked = !extra_data.linked; + _extra_data.linked = extra_data.linked; + + if(extra_data.linked) { + for(var i = 0; i < size; i += 2) { + onModify(i + 0, _data[i]); + onModify(i + 1, _data[i]); + } + } + } _x += ui(28); _w -= ui(28); - if(extras && instanceof(extras) == "buttonClass") { - extras.setFocusHover(active, hover); - extras.draw(_x + _w - ui(32), _y + _h / 2 - ui(32 / 2), ui(32), ui(32), _m, THEME.button_hide); - _w -= ui(40); - } + var _step = extra_data.linked? 2 : 1; + var ww = _w / size * 2; - var ww = _w / size * 2; - for(var i = 0; i < size; i++) { + for(var i = 0; i < size; i += _step) { tb[i].setFocusHover(active, hover); var bx = _x + ww * floor(i / 2); var by = _y + i % 2 * (_h + ui(4)); - tb[i].draw(bx + ui(56), by, ww - ui(56), _h, _data[i], _m); + var _ww = ui(32 + 32 * !extra_data.linked); + tb[i].draw(bx + _ww, by, ww - _ww, _h, _data[i], _m); draw_set_text(f_p0, fa_left, fa_center, COLORS._main_text_inner); - draw_text(bx + ui(8), by + _h / 2, label[i]); + + var _label = extra_data.linked? axis[floor(i / 2)] + : (i % 2? __txt("Max") : __txt("Min")) + " " + axis[floor(i / 2)]; + draw_text(bx + ui(8), by + _h / 2, _label); } resetFocus(); - return _h * 2 + ui(4); + return h; } } \ No newline at end of file diff --git a/shaders/sh_gradient/sh_gradient.fsh b/shaders/sh_gradient/sh_gradient.fsh index 63d7db008..a66a3997a 100644 --- a/shaders/sh_gradient/sh_gradient.fsh +++ b/shaders/sh_gradient/sh_gradient.fsh @@ -5,13 +5,6 @@ varying vec2 v_vTexcoord; varying vec4 v_vColour; #define TAU 6.283185307179586 -#define GRADIENT_LIMIT 128 - -uniform int gradient_blend; -uniform vec4 gradient_color[GRADIENT_LIMIT]; -uniform float gradient_time[GRADIENT_LIMIT]; -uniform int gradient_keys; -uniform int gradient_loop; uniform vec2 center; uniform float angle; @@ -19,6 +12,16 @@ uniform float radius; uniform float shift; uniform int type; +uniform int gradient_loop; + +#region ////////////////////////////////////////// GRADIENT BEGIN ////////////////////////////////////////// + +#define GRADIENT_LIMIT 128 +uniform int gradient_blend; +uniform vec4 gradient_color[GRADIENT_LIMIT]; +uniform float gradient_time[GRADIENT_LIMIT]; +uniform int gradient_keys; + vec3 rgb2hsv(vec3 c) { vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0); vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g)); @@ -83,6 +86,8 @@ vec4 gradientEval(in float prog) { return col; } +#endregion ////////////////////////////////////////// GRADIENT END ////////////////////////////////////////// + void main() { float prog = 0.; if(type == 0) { diff --git a/shaders/sh_interpret_number/sh_interpret_number.fsh b/shaders/sh_interpret_number/sh_interpret_number.fsh new file mode 100644 index 000000000..017e24add --- /dev/null +++ b/shaders/sh_interpret_number/sh_interpret_number.fsh @@ -0,0 +1,98 @@ +varying vec2 v_vTexcoord; +varying vec4 v_vColour; + +#define BATCH_SIZE 1024 + +uniform int mode; +uniform vec2 range; +uniform float number[BATCH_SIZE]; + +#region ////////////////////////////////////////// GRADIENT BEGIN ////////////////////////////////////////// + +#define GRADIENT_LIMIT 128 +uniform int gradient_blend; +uniform vec4 gradient_color[GRADIENT_LIMIT]; +uniform float gradient_time[GRADIENT_LIMIT]; +uniform int gradient_keys; + +vec3 rgb2hsv(vec3 c) { + vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0); + vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g)); + vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r)); + + float d = q.x - min(q.w, q.y); + float e = 0.0000000001; + return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x); + } + +vec3 hsv2rgb(vec3 c) { + vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0); + vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www); + return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y); +} + +float hueDist(float a0, float a1, float t) { + float da = fract(a1 - a0); + float ds = fract(2. * da) - da; + return a0 + ds * t; +} + +vec3 hsvMix(vec3 c1, vec3 c2, float t) { + vec3 h1 = rgb2hsv(c1); + vec3 h2 = rgb2hsv(c2); + + vec3 h = vec3(0.); + h.x = h.x + hueDist(h1.x, h2.x, t); + h.y = mix(h1.y, h2.y, t); + h.z = mix(h1.z, h2.z, t); + + return hsv2rgb(h); +} + +vec4 gradientEval(in float prog) { + vec4 col = vec4(0.); + + for(int i = 0; i < GRADIENT_LIMIT; i++) { + if(gradient_time[i] == prog) { + col = gradient_color[i]; + break; + } else if(gradient_time[i] > prog) { + if(i == 0) + col = gradient_color[i]; + else { + float t = (prog - gradient_time[i - 1]) / (gradient_time[i] - gradient_time[i - 1]); + if(gradient_blend == 0) + col = mix(gradient_color[i - 1], gradient_color[i], t); + else if(gradient_blend == 1) + col = gradient_color[i - 1]; + else if(gradient_blend == 2) + col = vec4(hsvMix(gradient_color[i - 1].rgb, gradient_color[i].rgb, t), 1.); + } + break; + } + if(i >= gradient_keys - 1) { + col = gradient_color[gradient_keys - 1]; + break; + } + } + + return col; +} + +#endregion ////////////////////////////////////////// GRADIENT END ////////////////////////////////////////// + +void main() { + vec2 px = v_vTexcoord; + px.x *= float(BATCH_SIZE); + float value = number[int(px.x)]; + float grey = (value - range[0]) / (range[1] - range[0]); + + gl_FragColor = vec4(0.); + + if(mode == 0) { + gl_FragColor = vec4(vec3(grey), 1.); + } else if(mode == 1) { + vec4 color = gradientEval(grey); + gl_FragColor = color; + } +} diff --git a/shaders/sh_interpret_number/sh_interpret_number.vsh b/shaders/sh_interpret_number/sh_interpret_number.vsh new file mode 100644 index 000000000..d4b316559 --- /dev/null +++ b/shaders/sh_interpret_number/sh_interpret_number.vsh @@ -0,0 +1,18 @@ +// +// 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; +} diff --git a/shaders/sh_interpret_number/sh_interpret_number.yy b/shaders/sh_interpret_number/sh_interpret_number.yy new file mode 100644 index 000000000..e611640ee --- /dev/null +++ b/shaders/sh_interpret_number/sh_interpret_number.yy @@ -0,0 +1,10 @@ +{ + "resourceType": "GMShader", + "resourceVersion": "1.0", + "name": "sh_interpret_number", + "parent": { + "name": "interpret", + "path": "folders/shader/generator/interpret.yy", + }, + "type": 1, +} \ No newline at end of file diff --git a/sprites/s_node_interpret_number/531352c0-b9aa-416a-8d1c-5d339dc0a796.png b/sprites/s_node_interpret_number/531352c0-b9aa-416a-8d1c-5d339dc0a796.png new file mode 100644 index 000000000..cccab53d0 Binary files /dev/null and b/sprites/s_node_interpret_number/531352c0-b9aa-416a-8d1c-5d339dc0a796.png differ diff --git a/sprites/s_node_interpret_number/layers/531352c0-b9aa-416a-8d1c-5d339dc0a796/e116bbce-8a06-4848-b04c-455e5817ddb4.png b/sprites/s_node_interpret_number/layers/531352c0-b9aa-416a-8d1c-5d339dc0a796/e116bbce-8a06-4848-b04c-455e5817ddb4.png new file mode 100644 index 000000000..cccab53d0 Binary files /dev/null and b/sprites/s_node_interpret_number/layers/531352c0-b9aa-416a-8d1c-5d339dc0a796/e116bbce-8a06-4848-b04c-455e5817ddb4.png differ diff --git a/sprites/s_node_interpret_number/s_node_interpret_number.yy b/sprites/s_node_interpret_number/s_node_interpret_number.yy new file mode 100644 index 000000000..af55292f2 --- /dev/null +++ b/sprites/s_node_interpret_number/s_node_interpret_number.yy @@ -0,0 +1,74 @@ +{ + "resourceType": "GMSprite", + "resourceVersion": "1.0", + "name": "s_node_interpret_number", + "bbox_bottom": 45, + "bbox_left": 0, + "bbox_right": 63, + "bbox_top": 18, + "bboxMode": 0, + "collisionKind": 1, + "collisionTolerance": 0, + "DynamicTexturePage": false, + "edgeFiltering": false, + "For3D": false, + "frames": [ + {"resourceType":"GMSpriteFrame","resourceVersion":"1.1","name":"531352c0-b9aa-416a-8d1c-5d339dc0a796",}, + ], + "gridX": 0, + "gridY": 0, + "height": 64, + "HTile": false, + "layers": [ + {"resourceType":"GMImageLayer","resourceVersion":"1.0","name":"e116bbce-8a06-4848-b04c-455e5817ddb4","blendMode":0,"displayName":"default","isLocked":false,"opacity":100.0,"visible":true,}, + ], + "nineSlice": null, + "origin": 4, + "parent": { + "name": "generator", + "path": "folders/nodes/icons/generator.yy", + }, + "preMultiplyAlpha": false, + "sequence": { + "resourceType": "GMSequence", + "resourceVersion": "1.4", + "name": "s_node_interpret_number", + "autoRecord": true, + "backdropHeight": 768, + "backdropImageOpacity": 0.5, + "backdropImagePath": "", + "backdropWidth": 1366, + "backdropXOffset": 0.0, + "backdropYOffset": 0.0, + "events": {"resourceType":"KeyframeStore","resourceVersion":"1.0","Keyframes":[],}, + "eventStubScript": null, + "eventToFunction": {}, + "length": 1.0, + "lockOrigin": false, + "moments": {"resourceType":"KeyframeStore","resourceVersion":"1.0","Keyframes":[],}, + "playback": 1, + "playbackSpeed": 30.0, + "playbackSpeedType": 0, + "showBackdrop": true, + "showBackdropImage": false, + "timeUnits": 1, + "tracks": [ + {"resourceType":"GMSpriteFramesTrack","resourceVersion":"1.0","name":"frames","builtinName":0,"events":[],"inheritsTrackColour":true,"interpolation":1,"isCreationTrack":false,"keyframes":{"resourceType":"KeyframeStore","resourceVersion":"1.0","Keyframes":[ + {"resourceType":"Keyframe","resourceVersion":"1.0","Channels":{"0":{"resourceType":"SpriteFrameKeyframe","resourceVersion":"1.0","Id":{"name":"531352c0-b9aa-416a-8d1c-5d339dc0a796","path":"sprites/s_node_interpret_number/s_node_interpret_number.yy",},},},"Disabled":false,"id":"3d5fd266-9f78-4f11-ada4-7cadbe2f5c10","IsCreationKey":false,"Key":0.0,"Length":1.0,"Stretch":false,}, + ],},"modifiers":[],"spriteId":null,"trackColour":0,"tracks":[],"traits":0,}, + ], + "visibleRange": null, + "volume": 1.0, + "xorigin": 32, + "yorigin": 32, + }, + "swatchColours": null, + "swfPrecision": 2.525, + "textureGroupId": { + "name": "Default", + "path": "texturegroups/Default", + }, + "type": 0, + "VTile": false, + "width": 64, +} \ No newline at end of file