- [Displace] Add surface map option for strength.

This commit is contained in:
Tanasart 2023-12-22 14:42:02 +07:00
parent e4c55a13b9
commit cc27b0eecc
77 changed files with 325 additions and 120 deletions

View file

@ -921,6 +921,7 @@
{"name":"fd_rectangle_set_material_size","order":7,"path":"scripts/fd_rectangle_set_material_size/fd_rectangle_set_material_size.yy",},
{"name":"fd_rectangle_shift_content","order":19,"path":"scripts/fd_rectangle_shift_content/fd_rectangle_shift_content.yy",},
{"name":"sh_texture_remap","order":24,"path":"shaders/sh_texture_remap/sh_texture_remap.yy",},
{"name":"node_application_in","order":20,"path":"scripts/node_application_in/node_application_in.yy",},
{"name":"obj_fd_rectangle","order":1,"path":"objects/obj_fd_rectangle/obj_fd_rectangle.yy",},
{"name":"node_noise_simplex","order":7,"path":"scripts/node_noise_simplex/node_noise_simplex.yy",},
{"name":"sh_fd_visualize_velocity_divergence_glsl","order":18,"path":"shaders/sh_fd_visualize_velocity_divergence_glsl/sh_fd_visualize_velocity_divergence_glsl.yy",},
@ -1631,6 +1632,7 @@
{"name":"sh_blend_screen","order":3,"path":"shaders/sh_blend_screen/sh_blend_screen.yy",},
{"name":"node_group_output","order":2,"path":"scripts/node_group_output/node_group_output.yy",},
{"name":"s_node_palette_extract","order":12,"path":"sprites/s_node_palette_extract/s_node_palette_extract.yy",},
{"name":"node_application_out","order":19,"path":"scripts/node_application_out/node_application_out.yy",},
{"name":"node_perlin_extra","order":10,"path":"scripts/node_perlin_extra/node_perlin_extra.yy",},
{"name":"node_palette_replacement","order":2,"path":"scripts/node_palette_replacement/node_palette_replacement.yy",},
{"name":"s_node_scatter","order":19,"path":"sprites/s_node_scatter/s_node_scatter.yy",},
@ -1648,7 +1650,7 @@
{"name":"s_node_3d_sphere","order":8,"path":"sprites/s_node_3d_sphere/s_node_3d_sphere.yy",},
{"name":"fd_rectangle_replace_velocity","order":16,"path":"scripts/fd_rectangle_replace_velocity/fd_rectangle_replace_velocity.yy",},
{"name":"s_node_group_thumbnail","order":34,"path":"sprites/s_node_group_thumbnail/s_node_group_thumbnail.yy",},
{"name":"node_VFX_effector","order":8,"path":"scripts/node_VFX_effector/node_VFX_effector.yy",},
{"name":"__node_VFX_effector","order":8,"path":"scripts/__node_VFX_effector/__node_VFX_effector.yy",},
{"name":"node_path_shift","order":5,"path":"scripts/node_path_shift/node_path_shift.yy",},
{"name":"s_node_wav_file_write","order":17,"path":"sprites/s_node_wav_file_write/s_node_wav_file_write.yy",},
{"name":"s_node_3d_cylinder","order":1,"path":"sprites/s_node_3d_cylinder/s_node_3d_cylinder.yy",},

View file

@ -1207,6 +1207,7 @@
{"id":{"name":"fd_rectangle_set_material_size","path":"scripts/fd_rectangle_set_material_size/fd_rectangle_set_material_size.yy",},},
{"id":{"name":"fd_rectangle_shift_content","path":"scripts/fd_rectangle_shift_content/fd_rectangle_shift_content.yy",},},
{"id":{"name":"sh_texture_remap","path":"shaders/sh_texture_remap/sh_texture_remap.yy",},},
{"id":{"name":"node_application_in","path":"scripts/node_application_in/node_application_in.yy",},},
{"id":{"name":"sh_fluid_bleach","path":"shaders/sh_fluid_bleach/sh_fluid_bleach.yy",},},
{"id":{"name":"__node_3d_modifier","path":"scripts/__node_3d_modifier/__node_3d_modifier.yy",},},
{"id":{"name":"obj_fd_rectangle","path":"objects/obj_fd_rectangle/obj_fd_rectangle.yy",},},
@ -2020,6 +2021,7 @@
{"id":{"name":"sh_blend_screen","path":"shaders/sh_blend_screen/sh_blend_screen.yy",},},
{"id":{"name":"node_group_output","path":"scripts/node_group_output/node_group_output.yy",},},
{"id":{"name":"s_node_palette_extract","path":"sprites/s_node_palette_extract/s_node_palette_extract.yy",},},
{"id":{"name":"node_application_out","path":"scripts/node_application_out/node_application_out.yy",},},
{"id":{"name":"node_perlin_extra","path":"scripts/node_perlin_extra/node_perlin_extra.yy",},},
{"id":{"name":"node_palette_replacement","path":"scripts/node_palette_replacement/node_palette_replacement.yy",},},
{"id":{"name":"s_node_scatter","path":"sprites/s_node_scatter/s_node_scatter.yy",},},
@ -2038,7 +2040,7 @@
{"id":{"name":"s_node_3d_sphere","path":"sprites/s_node_3d_sphere/s_node_3d_sphere.yy",},},
{"id":{"name":"fd_rectangle_replace_velocity","path":"scripts/fd_rectangle_replace_velocity/fd_rectangle_replace_velocity.yy",},},
{"id":{"name":"s_node_group_thumbnail","path":"sprites/s_node_group_thumbnail/s_node_group_thumbnail.yy",},},
{"id":{"name":"node_VFX_effector","path":"scripts/node_VFX_effector/node_VFX_effector.yy",},},
{"id":{"name":"__node_VFX_effector","path":"scripts/__node_VFX_effector/__node_VFX_effector.yy",},},
{"id":{"name":"sh_blur_gaussian","path":"shaders/sh_blur_gaussian/sh_blur_gaussian.yy",},},
{"id":{"name":"node_path_shift","path":"scripts/node_path_shift/node_path_shift.yy",},},
{"id":{"name":"s_node_wav_file_write","path":"sprites/s_node_wav_file_write/s_node_wav_file_write.yy",},},

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 58 KiB

View file

@ -1,5 +1,14 @@
/// @description init
if(winMan_isMinimized()) exit;
if(APP_SURF_OVERRIDE) {
APP_SURF = surface_verify(APP_SURF, WIN_W, WIN_H);
PRE_APP_SURF = surface_verify(PRE_APP_SURF, WIN_W, WIN_H);
POST_APP_SURF = surface_verify(POST_APP_SURF, WIN_W, WIN_H);
surface_set_target(APP_SURF);
}
draw_clear(COLORS.bg);
#region widget scroll
@ -46,4 +55,13 @@ draw_clear(COLORS.bg);
#region window
winManDraw();
#endregion
#endregion
if(APP_SURF_OVERRIDE) {
surface_reset_target();
draw_surface(POST_APP_SURF, 0, 0);
surface_set_target(PRE_APP_SURF);
draw_surface(APP_SURF, 0, 0);
surface_reset_target();
}

View file

@ -72,10 +72,11 @@ _HOVERING_ELEMENT = noone;
#endregion
#region animation & render
//physics_pause_enable(true);
DEF_SURFACE_RESET();
if(!PROJECT.safeMode) {
if(APP_SURF_OVERRIDE)
Render();
else if(!PROJECT.safeMode) {
if(UPDATE_RENDER_ORDER) {
ResetAllNodesRender();
NodeTopoSort();

View file

@ -14,7 +14,8 @@ function Node_VFX_effector(_x, _y, _group = noone) : Node(_x, _y, _group) constr
icon = THEME.vfx;
reloop = true;
node_draw_icon = s_node_vfx_accel;
manual_ungroupable = false;
node_draw_icon = s_node_vfx_accel;
w = 96;
h = 80;

View file

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

View file

@ -4,6 +4,8 @@ function Node_VFX_Override(_x, _y, _group = noone) : Node(_x, _y, _group) constr
icon = THEME.vfx;
node_draw_icon = s_node_vfx_override;
manual_ungroupable = false;
w = 96;
h = 80;
min_h = h;

View file

@ -1,10 +1,11 @@
function Node_VFX_Renderer(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
name = "Renderer";
name = "Renderer";
color = COLORS.node_blend_vfx;
icon = THEME.vfx;
use_cache = CACHE_USE.auto;
manual_ungroupable = false;
inputs[| 0] = nodeValue("Output dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, DEF_SURF)
.setDisplay(VALUE_DISPLAY.vector);

View file

@ -1,9 +1,11 @@
function Node_VFX_Renderer_Output(_x, _y, _group = noone) : Node_Group_Output(_x, _y, _group) constructor {
name = "Renderer";
name = "Renderer";
color = COLORS.node_blend_vfx;
icon = THEME.vfx;
use_cache = CACHE_USE.auto;
manual_ungroupable = false;
w = 128;
h = 128;
min_h = h;

View file

@ -4,6 +4,8 @@ function Node_VFX_Spawner(_x, _y, _group = noone) : Node_VFX_Spawner_Base(_x, _y
icon = THEME.vfx;
reloop = true;
manual_ungroupable = false;
attributes.Output_pool = false;
array_push(attributeEditors, ["Output all particles", function() { return attributes.Output_pool; },
new checkBox(function() { attributes.Output_pool = !attributes.Output_pool; }) ]);

View file

@ -1,7 +1,9 @@
function Node_VFX_Trail(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
name = "VFX Trail";
name = "VFX Trail";
w = 96;
manual_ungroupable = false;
w = 96;
length = [];
lengthAcc = [];
lines = [];

View file

@ -4,6 +4,8 @@ function Node_VFX_Variable(_x, _y, _group = noone) : Node(_x, _y, _group) constr
icon = THEME.vfx;
node_draw_icon = s_node_vfx_variable;
manual_ungroupable = false;
w = 96;
h = 80;
min_h = h;

View file

@ -0,0 +1,20 @@
function Node_Application_In(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
name = "GUI In";
update_on_frame = true;
inputs[| 0] = nodeValue("GUI", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone);
static step = function() { #region
var s = inputs[| 0].getValue();
APP_SURF_OVERRIDE = false;
if(!is_surface(s)) return;
APP_SURF_OVERRIDE = true;
surface_set_target(POST_APP_SURF);
BLEND_OVERRIDE
draw_surface_stretched(s, 0, 0, WIN_W, WIN_H);
BLEND_NORMAL
surface_reset_target();
} #endregion
}

View file

@ -0,0 +1,11 @@
{
"resourceType": "GMScript",
"resourceVersion": "1.0",
"name": "node_application_in",
"isCompatibility": false,
"isDnD": false,
"parent": {
"name": "misc",
"path": "folders/nodes/data/misc.yy",
},
}

View file

@ -0,0 +1,16 @@
globalvar APP_SURF, PRE_APP_SURF, POST_APP_SURF, APP_SURF_OVERRIDE;
APP_SURF = surface_create(1, 1);
PRE_APP_SURF = surface_create(1, 1);
POST_APP_SURF = surface_create(1, 1);
APP_SURF_OVERRIDE = false;
function Node_Application_Out(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
name = "GUI Out";
update_on_frame = true;
outputs[| 0] = nodeValue("GUI", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
static step = function() { #region
outputs[| 0].setValue(PRE_APP_SURF);
} #endregion
}

View file

@ -0,0 +1,11 @@
{
"resourceType": "GMScript",
"resourceVersion": "1.0",
"name": "node_application_out",
"isCompatibility": false,
"isDnD": false,
"parent": {
"name": "misc",
"path": "folders/nodes/data/misc.yy",
},
}

View file

@ -9,12 +9,11 @@ function groupNodes(nodeArray, _group = noone, record = true, check_connect = tr
for(var i = 0; i < array_length(nodeArray); i++) {
var node = nodeArray[i];
for( var j = 0, m = array_length(node.context_data); j < m; j++ ) {
var _cnt = node.context_data[j];
array_push_unique(_ctx_nodes, _cnt);
if(inline_context != noone) {
array_push_unique(_ctx_nodes, inline_context);
for( var k = 0, n = array_length(_cnt.members); k < n; k++ ) {
if(!array_exists(nodeArray, _cnt.members[k])) {
for( var k = 0, n = array_length(inline_context.members); k < n; k++ ) {
if(!array_exists(nodeArray, inline_context.members[k])) {
noti_warning("Grouping incomplete inline group is not allowed.");
return;
}

View file

@ -25,19 +25,23 @@ function Node_Collection_Inline(_x, _y, _group = noone) : Node(_x, _y, _group) c
ds_list_remove(nodes, node);
array_remove(node.context_data, self);
if(node.inline_context == self)
node.inline_context = noone;
onRemoveNode(node);
} #endregion
static onRemoveNode = function(node) {}
static addNode = function(node) { #region
if(node.inline_context != noone && node.inline_context != self)
node.inline_context.removeNode(node);
node.inline_context = self;
array_push_unique(attributes.members, node.node_id);
if(!ds_list_exist(nodes, node))
ds_list_add(nodes, node);
array_push_unique(node.context_data, self);
onAddNode(node);
} #endregion
@ -148,25 +152,32 @@ function Node_Collection_Inline(_x, _y, _group = noone) : Node(_x, _y, _group) c
group_adding = false;
if(PANEL_GRAPH.node_dragging && key_mod_press(SHIFT)) {
if(PANEL_GRAPH.node_dragging && PANEL_GRAPH.frame_hovering == self) {
var _list = PANEL_GRAPH.nodes_selecting;
if(group_hovering) {
group_adding = true;
for( var i = 0, n = array_length(_list); i < n; i++ )
addNode(_list[i]);
} else {
for( var i = 0, n = array_length(_list); i < n; i++ )
removeNode(_list[i]);
if(key_mod_press(SHIFT)) {
if(group_hovering) {
group_adding = true;
for( var i = 0, n = array_length(_list); i < n; i++ ) {
if(_list[i].manual_ungroupable)
addNode(_list[i]);
}
} else {
for( var i = 0, n = array_length(_list); i < n; i++ ) {
if(_list[i].manual_ungroupable)
removeNode(_list[i]);
}
}
}
if(!group_dragging) {
for( var i = 0, n = array_length(_list); i < n; i++ )
removeNode(_list[i]);
if(keyboard_check_pressed(vk_shift)) {
for( var i = 0, n = array_length(_list); i < n; i++ ) {
if(_list[i].manual_ungroupable)
removeNode(_list[i]);
}
refreshMember();
refreshGroupBG();
}
group_dragging = true;
}
if(group_dragging && mouse_release(mb_left)) {
@ -223,7 +234,7 @@ function Node_Collection_Inline(_x, _y, _group = noone) : Node(_x, _y, _group) c
draw_vertex(round(v2x), round(v2y));
if(!_hov && point_in_triangle(_mx, _my, v0x, v0y, v1x, v1y, v2x, v2y)) {
group_hovering = 1 + key_mod_press(SHIFT) * 2;
group_hovering = 1 + (PANEL_GRAPH._frame_hovering == self && key_mod_press(SHIFT)) * 2;
_hov = true;
}

View file

@ -21,6 +21,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
node_id = UUID_generate();
group = _group;
manual_deletable = true;
manual_ungroupable = true;
destroy_when_upgroup = false;
ds_list_add(PANEL_GRAPH.getNodeList(_group), self);
@ -29,7 +30,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
array_push(PROJECT.nodeArray, self);
context_data = [];
inline_context = noone;
#endregion
static resetInternalName = function() { #region

View file

@ -9,7 +9,14 @@ function Node_Displace(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
.setDisplay(VALUE_DISPLAY.vector)
.setUnitRef(function(index) { return getDimension(index); });
inputs[| 3] = nodeValue("Strength", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1);
inputs[| 3] = nodeValue("Strength", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1)
.setDisplay(VALUE_DISPLAY._default, { side_button: button(function() {
var jun = inputs[| 15];
jun.visible = !jun.visible;
setHeight();
}).setIcon( THEME.value_use_surface, [ function() { return inputs[| 15].visible; } ], COLORS._main_icon )
.setTooltip("Use map") });
inputs[| 4] = nodeValue("Mid value", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0., "Brightness value to be use as a basis for 'no displacement'.")
.setDisplay(VALUE_DISPLAY.slider);
@ -42,9 +49,12 @@ If set, then strength value control how many times the effect applies on itself.
__init_mask_modifier(8); // inputs 13, 14
inputs[| 15] = nodeValue("Strength map", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone)
.setVisible(false, false);
input_display_list = [ 10, 12,
["Surfaces", true], 0, 8, 9, 13, 14,
["Displace", false], 1, 3, 4,
["Displace", false], 1, 3, 15, 4,
["Color", false], 5, 2,
["Algorithm", true], 6, 11,
];
@ -80,11 +90,14 @@ If set, then strength value control how many times the effect applies on itself.
shader_set_surface("map", _data[1]);
shader_set_f("dimension", [ww, hh]);
shader_set_f("map_dimension", [mw, mh]);
shader_set_f("displace", _data[2]);
shader_set_f("strength", _data[3]);
shader_set_f("middle", _data[4]);
shader_set_i("use_rg", _data[5]);
shader_set_i("iterate", _data[6]);
shader_set_f("displace", _data[ 2]);
shader_set_f("strength", _data[ 3]);
shader_set_surface_i("strengthSurf", "strengthUseSurf", _data[15]);
shader_set_f("middle", _data[ 4]);
shader_set_i("use_rg", _data[ 5]);
shader_set_i("iterate", _data[ 6]);
shader_set_i("blendMode", _data[11]);
draw_surface_safe(_data[0]);
surface_reset_shader();

View file

@ -2,9 +2,11 @@ function Node_Fluid_Add(_x, _y, _group = noone) : Node_Fluid(_x, _y, _group) con
name = "Add Emitter";
color = COLORS.node_blend_smoke;
icon = THEME.smoke_sim;
w = 96;
w = 96;
min_h = 96;
manual_ungroupable = false;
inputs[| 0] = nodeValue("Domain", self, JUNCTION_CONNECT.input, VALUE_TYPE.fdomain, noone)
.setVisible(true, true);

View file

@ -3,6 +3,8 @@ function Node_Fluid_Add_Collider(_x, _y, _group = noone) : Node_Fluid(_x, _y, _g
color = COLORS.node_blend_smoke;
icon = THEME.smoke_sim;
manual_ungroupable = false;
inputs[| 0] = nodeValue("Domain", self, JUNCTION_CONNECT.input, VALUE_TYPE.fdomain, noone)
.setVisible(true, true);

View file

@ -1,8 +1,10 @@
function Node_Fluid_Apply_Velocity(_x, _y, _group = noone) : Node_Fluid(_x, _y, _group) constructor {
name = "Apply Velocity";
w = 96;
w = 96;
min_h = 96;
manual_ungroupable = false;
inputs[| 0] = nodeValue("Domain", self, JUNCTION_CONNECT.input, VALUE_TYPE.fdomain, noone)
.setVisible(true, true);

View file

@ -4,6 +4,8 @@ function Node_Fluid_Domain(_x, _y, _group = noone) : Node_Fluid(_x, _y, _group)
icon = THEME.smoke_sim;
min_h = 128;
manual_ungroupable = false;
inputs[| 0] = nodeValue("Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, DEF_SURF)
.setDisplay(VALUE_DISPLAY.vector);

View file

@ -1,7 +1,8 @@
function Node_Fluid_Domain_Queue(_x, _y, _group = noone) : Node_Fluid(_x, _y, _group) constructor {
name = "Queue Domain";
w = 96;
w = 96;
manual_ungroupable = false;
outputs[| 0] = nodeValue("Domain", self, JUNCTION_CONNECT.output, VALUE_TYPE.fdomain, noone);

View file

@ -4,6 +4,8 @@ function Node_Fluid_Render(_x, _y, _group = noone) : Node_Fluid(_x, _y, _group)
icon = THEME.smoke_sim;
use_cache = CACHE_USE.auto;
manual_ungroupable = false;
inputs[| 0] = nodeValue("Domain", self, JUNCTION_CONNECT.input, VALUE_TYPE.fdomain, noone)
.setVisible(true, true);

View file

@ -9,6 +9,8 @@ function Node_Fluid_Render_Output(_x, _y, _group = noone) : Node_Group_Output(_x
min_h = h;
previewable = true;
manual_ungroupable = false;
inputs[| 0] = nodeValue("Domain", self, JUNCTION_CONNECT.input, VALUE_TYPE.fdomain, noone)
.setVisible(true, true);

View file

@ -1,8 +1,10 @@
function Node_Fluid_Repulse(_x, _y, _group = noone) : Node_Fluid(_x, _y, _group) constructor {
name = "Repulse";
w = 96;
w = 96;
min_h = 96;
manual_ungroupable = false;
inputs[| 0] = nodeValue("Domain", self, JUNCTION_CONNECT.input, VALUE_TYPE.fdomain, noone)
.setVisible(true, true);

View file

@ -5,9 +5,11 @@ function Node_Fluid_Group(_x, _y, _group = noone) : Node_Collection(_x, _y, _gro
color = COLORS.node_blend_smoke;
icon = THEME.smoke_sim;
ungroupable = false;
ungroupable = false;
update_on_frame = true;
manual_ungroupable = false;
outputNode = noone;
inputs[| 0] = nodeValue("Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, DEF_SURF)

View file

@ -1,8 +1,10 @@
function Node_Fluid_Turbulence(_x, _y, _group = noone) : Node_Fluid(_x, _y, _group) constructor {
name = "Turbulence";
w = 96;
w = 96;
min_h = 96;
manual_ungroupable = false;
inputs[| 0] = nodeValue("Domain", self, JUNCTION_CONNECT.input, VALUE_TYPE.fdomain, noone)
.setVisible(true, true);

View file

@ -2,9 +2,11 @@ function Node_Fluid_Update(_x, _y, _group = noone) : Node_Fluid(_x, _y, _group)
name = "Update Fluid";
color = COLORS.node_blend_smoke;
icon = THEME.smoke_sim;
w = 96;
w = 96;
min_h = 96;
manual_ungroupable = false;
inputs[| 0] = nodeValue("Domain", self, JUNCTION_CONNECT.input, VALUE_TYPE.fdomain, noone)
.setVisible(true, true);

View file

@ -1,8 +1,10 @@
function Node_Fluid_Vortex(_x, _y, _group = noone) : Node_Fluid(_x, _y, _group) constructor {
name = "Vortex";
w = 96;
w = 96;
min_h = 96;
manual_ungroupable = false;
inputs[| 0] = nodeValue("Domain", self, JUNCTION_CONNECT.input, VALUE_TYPE.fdomain, noone)
.setVisible(true, true);

View file

@ -60,7 +60,8 @@ function Node_Iterate_Each_Inline(_x, _y, _group = noone) : Node_Collection_Inli
}
var _node = PROJECT.nodeMap[? attributes.members[i]];
array_push_unique(_node.context_data, self);
_node.inline_context = self;
ds_list_add(nodes, _node);
if(is_instanceof(_node, Node_Iterator_Each_Inline_Input)) {

View file

@ -60,7 +60,7 @@ function Node_Iterate_Filter_Inline(_x, _y, _group = noone) : Node_Collection_In
}
var _node = PROJECT.nodeMap[? attributes.members[i]];
array_push_unique(_node.context_data, self);
_node.inline_context = self;
ds_list_add(nodes, _node);
if(is_instanceof(_node, Node_Iterator_Filter_Inline_Input)) {

View file

@ -47,7 +47,7 @@ function Node_Iterate_Sort_Inline(_x, _y, _group = noone) : Node_Collection_Inli
}
var _node = PROJECT.nodeMap[? attributes.members[i]];
array_push_unique(_node.context_data, self);
_node.inline_context = self;
ds_list_add(nodes, _node);
if(is_instanceof(_node, Node_Iterator_Sort_Inline_Input)) {

View file

@ -3,6 +3,8 @@ function Node_Iterator_Each_Inline_Input(_x, _y, _group = noone) : Node(_x, _y,
color = COLORS.node_blend_loop;
loop = noone;
manual_ungroupable = false;
inputs[| 0] = nodeValue("Array in", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, [] )
.setVisible(true, true);

View file

@ -3,6 +3,8 @@ function Node_Iterator_Each_Inline_Output(_x, _y, _group = noone) : Node(_x, _y,
color = COLORS.node_blend_loop;
loop = noone;
manual_ungroupable = false;
inputs[| 0] = nodeValue("Value out", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, 0 )
.setVisible(true, true);

View file

@ -3,6 +3,8 @@ function Node_Iterator_Filter_Inline_Input(_x, _y, _group = noone) : Node(_x, _y
color = COLORS.node_blend_loop;
loop = noone;
manual_ungroupable = false;
inputs[| 0] = nodeValue("Array in", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, [] )
.setVisible(true, true);

View file

@ -3,6 +3,8 @@ function Node_Iterator_Filter_Inline_Output(_x, _y, _group = noone) : Node(_x, _
color = COLORS.node_blend_loop;
loop = noone;
manual_ungroupable = false;
inputs[| 0] = nodeValue("Value out", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, 0 )
.setVisible(true, true);

View file

@ -2,17 +2,16 @@ function Node_Iterator_Index(_x, _y, _group = noone) : Node(_x, _y, _group) cons
name = "Index";
color = COLORS.node_blend_loop;
destroy_when_upgroup = true;
manual_ungroupable = false;
w = 96;
w = 96;
min_h = 80;
outputs[| 0] = nodeValue("Loop index", self, JUNCTION_CONNECT.output, VALUE_TYPE.integer, 0);
static update = function(frame = CURRENT_FRAME) { #region
var gr = is_instanceof(group, Node_Iterator)? group : noone;
for( var i = 0, n = array_length(context_data); i < n; i++ )
if(is_instanceof(context_data[i], Node_Iterate_Inline))
gr = context_data[i];
if(inline_context != noone) gr = inline_context;
if(gr == noone) return;
outputs[| 0].setValue(gr.iterated);

View file

@ -1,10 +1,11 @@
function Node_Iterator_Input(_x, _y, _group = noone) : Node_Group_Input(_x, _y, _group) constructor {
name = "Loop Input";
color = COLORS.node_blend_loop;
is_group_io = true;
is_group_io = true;
local_output = noone;
manual_ungroupable = false;
w = 96;
h = 32 + 24 * 2;
min_h = h;

View file

@ -2,18 +2,17 @@ function Node_Iterator_Length(_x, _y, _group = noone) : Node(_x, _y, _group) con
name = "Loop Amount";
color = COLORS.node_blend_loop;
destroy_when_upgroup = true;
manual_ungroupable = false;
w = 96;
w = 96;
min_h = 80;
outputs[| 0] = nodeValue("Length", self, JUNCTION_CONNECT.output, VALUE_TYPE.integer, 0);
static update = function(frame = CURRENT_FRAME) { #region
var gr = is_instanceof(group, Node_Iterator)? group : noone;
for( var i = 0, n = array_length(context_data); i < n; i++ )
if(is_instanceof(context_data[i], Node_Iterate_Inline))
gr = context_data[i];
if(inline_context != noone) gr = inline_context;
if(gr == noone) return;
outputs[| 0].setValue(gr.getIterationCount());
} #endregion

View file

@ -3,6 +3,8 @@ function Node_Iterator_Output(_x, _y, _group = noone) : Node_Group_Output(_x, _y
color = COLORS.node_blend_loop;
is_group_io = true;
manual_ungroupable = false;
w = 96;
h = 32 + 24 * 2;
min_h = h;

View file

@ -3,6 +3,8 @@ function Node_Iterator_Sort_Inline_Input(_x, _y, _group = noone) : Node(_x, _y,
color = COLORS.node_blend_loop;
loop = noone;
manual_ungroupable = false;
inputs[| 0] = nodeValue("Array in", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, [] )
.setVisible(true, true);

View file

@ -3,6 +3,8 @@ function Node_Iterator_Sort_Inline_Output(_x, _y, _group = noone) : Node(_x, _y,
color = COLORS.node_blend_loop;
loop = noone;
manual_ungroupable = false;
inputs[| 0] = nodeValue("Swap", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false )
.setVisible(true, true);

View file

@ -878,8 +878,9 @@ function __initNodes() {
//addNodeObject(node, "Module Test", s_node_print, "Node_Module_Test", [1, Node_Module_Test]);
ds_list_add(node, "System");
addNodeObject(node, "Execute Shell", s_node_shell_excecute, "Node_Shell", [1, Node_Shell], ["terminal", "execute", "run"], "Execute shell script.").setVersion(11530);
//addNodeObject(node, "Note", s_node_note, "Node_Note", [1, Node_Note]).setVersion(11530);
addNodeObject(node, "Execute Shell", s_node_shell_excecute, "Node_Shell", [1, Node_Shell], ["terminal", "execute", "run"], "Execute shell script.").setVersion(11530);
//addNodeObject(node, "GUI In", s_node_shell_excecute, "Node_Application_In", [1, Node_Application_In]);
//addNodeObject(node, "GUI Out", s_node_shell_excecute, "Node_Application_Out", [1, Node_Application_Out]);
#endregion
var actions = ds_list_create();

View file

@ -1,10 +1,12 @@
function Node_Rigid_Activate(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
name = "Activate Physics";
name = "Activate Physics";
color = COLORS.node_blend_simulation;
icon = THEME.rigidSim;
w = 96;
w = 96;
min_h = 96;
manual_ungroupable = false;
inputs[| 0] = nodeValue("Object", self, JUNCTION_CONNECT.input, VALUE_TYPE.rigid, noone)
.setVisible(true, true);

View file

@ -1,10 +1,12 @@
function Node_Rigid_Force_Apply(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
name = "Apply Force";
name = "Apply Force";
color = COLORS.node_blend_simulation;
icon = THEME.rigidSim;
w = 96;
w = 96;
min_h = 96;
manual_ungroupable = false;
inputs[| 0] = nodeValue("Object", self, JUNCTION_CONNECT.input, VALUE_TYPE.rigid, noone)
.setVisible(true, true);

View file

@ -1,10 +1,12 @@
function Node_Rigid_Global(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
name = "RigidSim Global";
name = "RigidSim Global";
color = COLORS.node_blend_simulation;
icon = THEME.rigidSim;
w = 96;
w = 96;
min_h = 96;
manual_ungroupable = false;
object = noone;
inputs[| 0] = nodeValue("Gravity", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 10 ])

View file

@ -4,6 +4,8 @@ function Node_Rigid_Group(_x, _y, _group = noone) : Node_Collection(_x, _y, _gro
icon = THEME.rigidSim;
update_on_frame = true;
manual_ungroupable = false;
ungroupable = false;
update_on_frame = true;
collIndex = irandom_range(1, 9999);

View file

@ -3,6 +3,8 @@ function Node_Rigid_Group_Inline(_x, _y, _group = noone) : Node_Collection_Inlin
color = COLORS.node_blend_simulation;
icon = THEME.rigidSim;
manual_ungroupable = false;
if(!LOADING && !APPENDING && !CLONING) {
var _object = nodeBuild("Node_Rigid_Object", x, y);
var _output = nodeBuild("Node_Rigid_Render", x + 160, y);

View file

@ -1,12 +1,13 @@
function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
name = "Object";
name = "Object";
color = COLORS.node_blend_simulation;
icon = THEME.rigidSim;
w = 96;
w = 96;
min_h = 96;
object = [];
manual_ungroupable = false;
object = [];
attributes.mesh = [];
inputs[| 0] = nodeValue("Affect by force", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true)
@ -167,10 +168,8 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr
static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { #region
var gr = is_instanceof(group, Node_Rigid_Group)? group : noone;
for( var i = 0, n = array_length(context_data); i < n; i++ )
if(is_instanceof(context_data[i], Node_Rigid_Group_Inline))
gr = context_data[i];
if(inline_context != noone) gr = inline_context;
if(gr == noone) return;
if(previewing == 0) {

View file

@ -1,10 +1,12 @@
function Node_Rigid_Object_Spawner(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
name = "Object Spawner";
name = "Object Spawner";
color = COLORS.node_blend_simulation;
icon = THEME.rigidSim;
w = 96;
w = 96;
min_h = 96;
manual_ungroupable = false;
object = [];
inputs[| 0] = nodeValue("Object", self, JUNCTION_CONNECT.input, VALUE_TYPE.rigid, noone)

View file

@ -4,6 +4,8 @@ function Node_Rigid_Override(_x, _y, _group = noone) : Node(_x, _y, _group) cons
icon = THEME.rigidSim;
node_draw_icon = s_node_rigid_override;
manual_ungroupable = false;
w = 96;
h = 80;
min_h = h;

View file

@ -3,6 +3,8 @@ function Node_Rigid_Render(_x, _y, _group = noone) : Node(_x, _y, _group) constr
color = COLORS.node_blend_simulation;
icon = THEME.rigidSim;
manual_ungroupable = false;
use_cache = CACHE_USE.auto;
update_on_frame = true;
@ -63,9 +65,7 @@ function Node_Rigid_Render(_x, _y, _group = noone) : Node(_x, _y, _group) constr
static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { #region
var gr = is_instanceof(group, Node_Rigid_Group)? group : noone;
for( var i = 0, n = array_length(context_data); i < n; i++ )
if(is_instanceof(context_data[i], Node_Rigid_Group_Inline))
gr = context_data[i];
if(inline_context != noone) gr = inline_context;
if(gr == noone) return;
if(!attributes.show_objects) return;

View file

@ -4,6 +4,8 @@ function Node_Rigid_Render_Output(_x, _y, _group = noone) : Node_Group_Output(_x
icon = THEME.rigidSim;
use_cache = CACHE_USE.auto;
manual_ungroupable = false;
w = 128;
h = 128;
min_h = h;
@ -81,9 +83,7 @@ function Node_Rigid_Render_Output(_x, _y, _group = noone) : Node_Group_Output(_x
static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { #region
var gr = is_instanceof(group, Node_Rigid_Group)? group : noone;
for( var i = 0, n = array_length(context_data); i < n; i++ )
if(is_instanceof(context_data[i], Node_Rigid_Group_Inline))
gr = context_data[i];
if(inline_context != noone) gr = inline_context;
if(gr == noone) return;
if(!attributes.show_objects) return;

View file

@ -4,6 +4,8 @@ function Node_Rigid_Variable(_x, _y, _group = noone) : Node(_x, _y, _group) cons
icon = THEME.rigidSim;
node_draw_icon = s_node_rigid_variable;
manual_ungroupable = false;
w = 96;
h = 80;
min_h = h;

View file

@ -1,8 +1,10 @@
function Node_Strand_Break(_x, _y, _group = noone) : _Node_Strand_Affector(_x, _y, _group) constructor {
name = "Strand Break";
name = "Strand Break";
color = COLORS.node_blend_strand;
icon = THEME.strandSim;
w = 96;
w = 96;
manual_ungroupable = false;
inputs[| input_fix_len + 0] = nodeValue("Chance", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1)
.setDisplay(VALUE_DISPLAY.slider);

View file

@ -1,8 +1,10 @@
function Node_Strand_Collision(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
name = "Strand Collision";
name = "Strand Collision";
color = COLORS.node_blend_strand;
icon = THEME.strandSim;
w = 96;
w = 96;
manual_ungroupable = false;
inputs[| 0] = nodeValue("Strand", self, JUNCTION_CONNECT.input, VALUE_TYPE.strands, noone)
.setVisible(true, true);

View file

@ -2,8 +2,10 @@ function Node_Strand_Create(_x, _y, _group = noone) : Node(_x, _y, _group) const
name = "Strand Create";
color = COLORS.node_blend_strand;
icon = THEME.strandSim;
update_on_frame = true;
w = 96;
w = 96;
update_on_frame = true;
manual_ungroupable = false;
inputs[| 0] = nodeValue("Type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
.setDisplay(VALUE_DISPLAY.enum_scroll, [ "Point", "Path", "Mesh" ]);

View file

@ -1,8 +1,10 @@
function Node_Strand_Force_Apply(_x, _y, _group = noone) : _Node_Strand_Affector(_x, _y, _group) constructor {
name = "Strand Force";
name = "Strand Force";
color = COLORS.node_blend_strand;
icon = THEME.strandSim;
w = 96;
w = 96;
manual_ungroupable = false;
inputs[| input_fix_len + 0] = nodeValue("Strength", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1)
.setDisplay(VALUE_DISPLAY.slider, { range: [ 0, 5, 0.01 ] });

View file

@ -1,8 +1,10 @@
function Node_Strand_Gravity(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
name = "Strand Gravity";
name = "Strand Gravity";
color = COLORS.node_blend_strand;
icon = THEME.strandSim;
w = 96;
w = 96;
manual_ungroupable = false;
inputs[| 0] = nodeValue("Strand", self, JUNCTION_CONNECT.input, VALUE_TYPE.strands, noone)
.setVisible(true, true);

View file

@ -1,8 +1,10 @@
function Node_Strand_Length_Adjust(_x, _y, _group = noone) : _Node_Strand_Affector(_x, _y, _group) constructor {
name = "Strand Length";
name = "Strand Length";
color = COLORS.node_blend_strand;
icon = THEME.strandSim;
w = 96;
w = 96;
manual_ungroupable = false;
inputs[| input_fix_len + 0] = nodeValue("Type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
.setDisplay(VALUE_DISPLAY.enum_button, [ "Increase", "Decrease" ]);

View file

@ -1,9 +1,11 @@
function Node_Strand_Render(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
name = "Strand Render";
name = "Strand Render";
color = COLORS.node_blend_strand;
icon = THEME.strandSim;
use_cache = CACHE_USE.auto;
manual_ungroupable = false;
inputs[| 0] = nodeValue("Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, DEF_SURF)
.setDisplay(VALUE_DISPLAY.vector);

View file

@ -1,9 +1,11 @@
function Node_Strand_Render_Texture(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
name = "Strand Render Texture";
name = "Strand Render Texture";
color = COLORS.node_blend_strand;
icon = THEME.strandSim;
use_cache = CACHE_USE.auto;
manual_ungroupable = false;
inputs[| 0] = nodeValue("Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, DEF_SURF)
.setDisplay(VALUE_DISPLAY.vector);

View file

@ -3,8 +3,9 @@ function Node_Strand_Group(_x, _y, _group = noone) : Node_Collection(_x, _y, _gr
color = COLORS.node_blend_strand;
icon = THEME.strandSim;
ungroupable = false;
update_on_frame = true;
manual_ungroupable = false;
ungroupable = false;
update_on_frame = true;
if(!LOADING && !APPENDING && !CLONING) {
var _create = nodeBuild("Node_Strand_Create", -384, -32, self);

View file

@ -1,8 +1,10 @@
function Node_Strand_Update(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
name = "Strand Update";
name = "Strand Update";
color = COLORS.node_blend_strand;
icon = THEME.strandSim;
w = 96;
w = 96;
manual_ungroupable = false;
inputs[| 0] = nodeValue("Strand", self, JUNCTION_CONNECT.input, VALUE_TYPE.strands, noone)
.setVisible(true, true);

View file

@ -107,6 +107,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
value_draggings = [];
frame_hovering = noone;
_frame_hovering = noone;
#endregion
#region ---- minimap ----
@ -732,7 +733,8 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
var t = get_timer();
printIf(log, "============ Draw start ============");
frame_hovering = noone;
_frame_hovering = frame_hovering;
frame_hovering = noone;
for(var i = 0; i < ds_list_size(nodes_list); i++) {
nodes_list[| i].cullCheck(gr_x, gr_y, graph_s, -32, -32, w + 32, h + 64);

View file

@ -156,8 +156,7 @@ function __nodeIsRenderLeaf(_node) { #region
if(_node.passiveDynamic) { _node.forwardPassiveDynamic(); LOG_IF(global.FLAG.render == 1, $"Skip passive dynamic [{_node.internalName}]"); return false; }
if(!_node.isActiveDynamic()) { LOG_IF(global.FLAG.render == 1, $"Skip rendered static [{_node.internalName}]"); return false; }
for( var i = 0, n = array_length(_node.context_data); i < n; i++ )
if(_node.context_data[i].managedRenderOrder) return false;
if(_node.inline_context != noone && _node.inline_context.managedRenderOrder) return false;
return true;
} #endregion

View file

@ -96,6 +96,13 @@ function shader_set_surface(sampler, surface, linear = false, _repeat = false) {
return t;
}
function shader_set_surface_i(sampler, useSampler, surface) {
INLINE
shader_set_surface(sampler, surface);
shader_set_i(useSampler, is_surface(surface));
}
//function shader_set_surface_ext(sampler, surface, linear = false, _repeat = false) {
// var shader = shader_current();
// if(!is_surface(surface)) return;

View file

@ -10,10 +10,13 @@ uniform vec2 map_dimension;
uniform vec2 displace;
uniform float strength;
uniform float middle;
uniform int iterate;
uniform int use_rg;
uniform int sampleMode;
uniform int blendMode;
uniform int iterate;
uniform int use_rg;
uniform int sampleMode;
uniform int blendMode;
uniform sampler2D strengthSurf;
uniform int strengthUseSurf;
float bright(in vec4 col) { return dot(col.rgb, vec3(0.2126, 0.7152, 0.0722)) * col.a; }
@ -79,12 +82,17 @@ float bright(in vec4 col) { return dot(col.rgb, vec3(0.2126, 0.7152, 0.0722)) *
#endregion /////////////// SAMPLING ///////////////
vec2 shiftMap(in vec2 pos, in float str) {
vec4 disP = texture2Dintp( map, pos );
vec2 sam_pos;
vec2 raw_displace = displace / dimension;
vec2 shiftMap(in vec2 pos, in float str) { #region
vec4 disP = texture2Dintp( map, pos );
vec2 sam_pos;
vec2 raw_displace = displace / dimension;
float _str;
if(strengthUseSurf == 1) {
vec4 strMap = texture2Dintp( strengthSurf, pos );
str *= (strMap.r + strMap.g + strMap.b) / 3.;
}
if(use_rg == 1) {
vec2 _disp = vec2(disP.r - middle, disP.g - middle) * vec2((disP.r + disP.g + disP.b) / 3. - middle) * str;
@ -101,9 +109,9 @@ vec2 shiftMap(in vec2 pos, in float str) {
}
return sam_pos;
}
} #endregion
vec4 blend(in vec4 c0, in vec4 c1) {
vec4 blend(in vec4 c0, in vec4 c1) { #region
if(blendMode == 0) return c1;
else if(blendMode == 1) {
float b0 = bright(c0);
@ -116,9 +124,9 @@ vec4 blend(in vec4 c0, in vec4 c1) {
}
return c1;
}
} #endregion
void main() {
void main() { #region
vec2 samPos = v_vTexcoord;
vec4 ccol = sampleTexture( v_vTexcoord ), ncol;
@ -133,4 +141,4 @@ void main() {
}
gl_FragColor = blend(ccol, ncol);
}
} #endregion