- Fix connection issues for some dynamic input nodes .

This commit is contained in:
Tanasart 2023-09-16 20:26:35 +02:00
parent fa8b22b517
commit 8f84b61d3f
28 changed files with 301 additions and 85 deletions

View file

@ -884,6 +884,7 @@
{"name":"node_3dsurf","order":5,"path":"scripts/node_3dsurf/node_3dsurf.yy",},
{"name":"fd_rectangle_reset_target","order":17,"path":"scripts/fd_rectangle_reset_target/fd_rectangle_reset_target.yy",},
{"name":"node_rate_remap","order":3,"path":"scripts/node_rate_remap/node_rate_remap.yy",},
{"name":"s_node_dynasurf","order":3,"path":"sprites/s_node_dynasurf/s_node_dynasurf.yy",},
{"name":"obj_reader","order":2,"path":"scripts/obj_reader/obj_reader.yy",},
{"name":"sh_invert","order":17,"path":"shaders/sh_invert/sh_invert.yy",},
{"name":"preview_overlay_puppet","order":4,"path":"scripts/preview_overlay_puppet/preview_overlay_puppet.yy",},

View file

@ -14,6 +14,7 @@
{"children":[],"name":"ItchDemo",},
{"children":[],"name":"MacAlpha",},
],"name":"Itch",},
{"children":[],"name":"GX",},
],
"name": "Default",
},
@ -1511,6 +1512,7 @@
{"id":{"name":"node_3dsurf","path":"scripts/node_3dsurf/node_3dsurf.yy",},},
{"id":{"name":"fd_rectangle_reset_target","path":"scripts/fd_rectangle_reset_target/fd_rectangle_reset_target.yy",},},
{"id":{"name":"node_rate_remap","path":"scripts/node_rate_remap/node_rate_remap.yy",},},
{"id":{"name":"s_node_dynasurf","path":"sprites/s_node_dynasurf/s_node_dynasurf.yy",},},
{"id":{"name":"obj_reader","path":"scripts/obj_reader/obj_reader.yy",},},
{"id":{"name":"sh_invert","path":"shaders/sh_invert/sh_invert.yy",},},
{"id":{"name":"preview_overlay_puppet","path":"scripts/preview_overlay_puppet/preview_overlay_puppet.yy",},},

View file

@ -11,7 +11,6 @@ event_inherited();
name = filename_name_only(directory);
thread = lua_create();
lua_error_handler = _lua_error;
__addon_lua_setup(thread, self);
self.directory = directory;

View file

@ -122,7 +122,7 @@
#endregion
#region lua
lua_error_handler = _lua_error;
//lua_error_handler = _lua_error;
#endregion
//print("===== Game Start End =====");

View file

@ -1,4 +1,4 @@
function DynaSurf() constructor {
function dynaSurf() constructor {
surfaces = [];
static getAbsolutePos = function(_x, _y, _xs = 1, _ys = 1, _rot = 0) {
@ -34,7 +34,7 @@ function DynaSurf() constructor {
static destroy = function() {}
}
function Compute_DynaSurf() : DynaSurf() constructor {
function compute_dynaSurf() : dynaSurf() constructor {
drawFn = noone;
widthFn = noone;
heightFn = noone;

View file

@ -1,4 +1,4 @@
function dynaSurf_3d() : DynaSurf() constructor {
function dynaSurf_3d() : dynaSurf() constructor {
object = noone;
camera = new __3dCamera();

View file

@ -1,10 +1,27 @@
function DynaSurf_iso() : DynaSurf() constructor {
angle = 0;
function dynaSurf_iso() : dynaSurf() constructor {
angles = [];
angle_shift = 0;
static getSurface = function(_rot) {}
static getSurface = function(_rot) {
_rot += angle_shift;
var _ind = 0;
var _minA = 360;
for( var i = 0, n = array_length(angles); i < n; i++ ) {
var _dif = abs(angle_difference(_rot, angles[i]));
if(_dif < _minA) {
_minA = _dif;
_ind = i;
}
}
return array_safe_get(surfaces, _ind);
}
static draw = function(_x = 0, _y = 0, _xs = 1, _ys = 1, _rot = 0, _col = c_white, _alp = 1) {
var _pos = getAbsolutePos(_x, _y, _xs, _ys, _rot);
var _surf = getSurface(_rot);
var _pos = getAbsolutePos(_x, _y, _xs, _ys, _rot);
draw_surface_ext_safe(_surf, _pos[0], _pos[1], _xs, _ys, 0, _col, _alp);
}
@ -19,7 +36,7 @@ function DynaSurf_iso() : DynaSurf() constructor {
}
}
function dynaSurf_iso_4() : DynaSurf_iso() constructor {
function dynaSurf_iso_4() : dynaSurf_iso() constructor {
surfaces = array_create(4, noone);
static getSurface = function(_rot) {
@ -42,7 +59,7 @@ function dynaSurf_iso_4() : DynaSurf_iso() constructor {
}
}
function dynaSurf_iso_8() : DynaSurf_iso() constructor {
function dynaSurf_iso_8() : dynaSurf_iso() constructor {
surfaces = array_create(8, noone);
static getSurface = function(_rot) {

View file

@ -35,8 +35,18 @@ function matrixGrid(_type, _size, _onModify, _unit = noone) : widget() construct
onModifySingle[10] = function(val) { return onModifyIndex(10, val); }
onModifySingle[11] = function(val) { return onModifyIndex(11, val); }
onModifySingle[12] = function(val) { return onModifyIndex(12, val); }
onModifySingle[13] = function(val) { return onModifyIndex(13, val); }
onModifySingle[14] = function(val) { return onModifyIndex(14, val); }
onModifySingle[15] = function(val) { return onModifyIndex(15, val); }
extras = -1;
for(var i = 0; i < inputs; i++) {
tb[i] = new textBox(_type, onModifySingle[i]);
tb[i].slidable = true;
}
static setInteract = function(interactable = noone) {
self.interactable = interactable;
b_link.interactable = interactable;
@ -61,11 +71,6 @@ function matrixGrid(_type, _size, _onModify, _unit = noone) : widget() construct
unit.triggerButton.register(parent);
}
for(var i = 0; i < inputs; i++) {
tb[i] = new textBox(_type, onModifySingle[i]);
tb[i].slidable = true;
}
static setSlideSpeed = function(speed) {
for(var i = 0; i < inputs; i++)
tb[i].slide_speed = speed;
@ -119,8 +124,9 @@ function matrixGrid(_type, _size, _onModify, _unit = noone) : widget() construct
var bx = _x + ww * j;
var by = _y + hh * i;
var _dat = array_safe_get(_data, ind);
tb[ind].draw(bx + ui(8), by, ww - ui(8), TEXTBOX_HEIGHT, _data[ind], _m);
tb[ind].draw(bx + ui(8), by, ww - ui(8), TEXTBOX_HEIGHT, _dat, _m);
}
resetFocus();

View file

@ -14,7 +14,7 @@ function Node_3DSurf(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
inputs[| 3] = nodeValue("Distance", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 4 );
outputs[| 0] = nodeValue("3DSurf", self, JUNCTION_CONNECT.output, VALUE_TYPE.dynaSurf, noone);
outputs[| 0] = nodeValue("3DSurf", self, JUNCTION_CONNECT.output, VALUE_TYPE.dynaSurface, noone);
input_display_list = [ 0,
["Camera", false], 1, 2, 3,

View file

@ -99,6 +99,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
updateAction = nodeValue("Update", self, JUNCTION_CONNECT.input, VALUE_TYPE.action, false).setVisible(true, true);
is_dynamic_input = false;
auto_input = false;
input_display_len = 0;
input_fix_len = 0;
data_length = 1;
@ -256,8 +257,9 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
return self;
} #endregion
static setIsDynamicInput = function(_data_length = 1) { #region
is_dynamic_input = true;
static setIsDynamicInput = function(_data_length = 1, _auto_input = true) { #region
is_dynamic_input = true;
auto_input = _auto_input;
input_display_len = input_display_list == -1? 0 : array_length(input_display_list);
input_fix_len = ds_list_size(inputs);
data_length = _data_length;
@ -813,7 +815,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
var _node = outputs[| preview_channel];
switch(_node.type) {
case VALUE_TYPE.surface :
case VALUE_TYPE.dynaSurf :
case VALUE_TYPE.dynaSurface :
return _node.getValue();
}
@ -1277,7 +1279,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
switch(outputs[| preview_channel].type) {
case VALUE_TYPE.surface :
case VALUE_TYPE.dynaSurf :
case VALUE_TYPE.dynaSurface :
break;
default :
return;

View file

@ -5,7 +5,7 @@ function Node_DynaSurf(_x, _y, _group = noone) : Node_Collection(_x, _y, _group)
reset_all_child = true;
draw_input_overlay = false;
outputs[| 0] = nodeValue("DynaSurf", self, JUNCTION_CONNECT.output, VALUE_TYPE.dynaSurf, noone);
outputs[| 0] = nodeValue("dynaSurf", self, JUNCTION_CONNECT.output, VALUE_TYPE.dynaSurface, noone);
custom_input_index = ds_list_size(inputs);
custom_output_index = ds_list_size(outputs);
@ -71,7 +71,7 @@ function Node_DynaSurf(_x, _y, _group = noone) : Node_Collection(_x, _y, _group)
} #endregion
static setDynamicSurface = function() { #region
var _dyna = new Compute_DynaSurf();
var _dyna = new compute_dynaSurf();
for( var i = 0, n = ds_list_size(nodes); i < n; i++ ) {
var _n = nodes[| i];

View file

@ -61,9 +61,10 @@ output.color = surfaceColor;")
input_display_list = [ 2,
["Shader", false], 1,
["Arguments", false], argument_renderer,
["Values", false],
];
setIsDynamicInput(3);
setIsDynamicInput(3, false);
static refreshDynamicInput = function() { #region
var _in = ds_list_create();
@ -81,8 +82,10 @@ output.color = surfaceColor;")
continue;
}
var inp_name = inputs[| i + 0].getValue();
var inp_type = inputs[| i + 1];
var inp_valu = inputs[| i + 2];
var cur_valu = inputs[| i + 2].getValue();
ds_list_add(_in, inputs[| i + 0]);
ds_list_add(_in, inp_type);
@ -91,34 +94,47 @@ output.color = surfaceColor;")
inp_type.editWidget.interactable = true;
if(inp_valu.editWidget != noone)
inp_valu.editWidget.interactable = true;
inp_valu.name = inp_name;
var type = inp_type.getValue();
switch(type) {
case 1 :
if(is_array(cur_valu)) inp_valu.overrideValue(0);
inp_valu.type = VALUE_TYPE.integer;
inp_valu.setDisplay(VALUE_DISPLAY._default);
break;
case 0 :
if(is_array(cur_valu)) inp_valu.overrideValue(0);
inp_valu.type = VALUE_TYPE.float;
inp_valu.setDisplay(VALUE_DISPLAY._default);
break;
case 2 :
if(!is_array(cur_valu) || array_length(cur_valu) != 2)
inp_valu.overrideValue([ 0, 0 ]);
inp_valu.type = VALUE_TYPE.float;
inp_valu.setDisplay(VALUE_DISPLAY.vector, 2);
inp_valu.setDisplay(VALUE_DISPLAY.vector);
break;
case 3 :
if(!is_array(cur_valu) || array_length(cur_valu) != 3)
inp_valu.overrideValue([ 0, 0, 0 ]);
inp_valu.type = VALUE_TYPE.float;
inp_valu.setDisplay(VALUE_DISPLAY.vector, 3);
inp_valu.setDisplay(VALUE_DISPLAY.vector);
break;
case 4 :
if(!is_array(cur_valu) || array_length(cur_valu) != 4)
inp_valu.overrideValue([ 0, 0, 0, 0 ]);
inp_valu.type = VALUE_TYPE.float;
inp_valu.setDisplay(VALUE_DISPLAY.vector, 4);
inp_valu.setDisplay(VALUE_DISPLAY.vector);
break;
case 5 :
if(!is_array(cur_valu) || array_length(cur_valu) != 9)
inp_valu.overrideValue(array_create(9));
inp_valu.type = VALUE_TYPE.float;
inp_valu.setDisplay(VALUE_DISPLAY.matrix, 3);
break;
case 6 :
if(!is_array(cur_valu) || array_length(cur_valu) != 16)
inp_valu.overrideValue(array_create(16));
inp_valu.type = VALUE_TYPE.float;
inp_valu.setDisplay(VALUE_DISPLAY.matrix, 4);
break;
@ -142,6 +158,11 @@ output.color = surfaceColor;")
inputs = _in;
createNewInput();
//print("==========================");
//for( var i = 0, n = array_length(input_display_list); i < n; i++ )
// print(input_display_list[i]);
//print("==========================");
#endregion
} if(!LOADING && !APPENDING) refreshDynamicInput();
@ -244,17 +265,20 @@ struct PixelShaderOutput {
if(!LOADING && !APPENDING) refreshShader();
static onValueUpdate = function(index) { #region
var _refresh = index == 0 || index == 1
|| (index >= input_fix_len && (index - input_fix_len) % data_length != 2);
if(_refresh) refreshShader();
var _refresh = index == 0 || index == 1 ||
(index >= input_fix_len && (index - input_fix_len) % data_length != 2);
refreshDynamicInput();
if(_refresh) {
refreshShader();
refreshDynamicInput();
}
} #endregion
static processData = function(_output, _data, _output_index, _array_index = 0) { #region
var _surf = _data[2];
if(!is_surface(_surf)) return noone;
if(!d3d11_shader_exists(shader.vs)) return noone;
if(!d3d11_shader_exists(shader.fs)) return noone;
_output = surface_verify(_output, surface_get_width_safe(_surf), surface_get_height_safe(_surf));
@ -341,5 +365,8 @@ struct PixelShaderOutput {
return _output;
} #endregion
static postConnect = function() { refreshShader(); }
static postConnect = function() {
refreshShader();
refreshDynamicInput();
}
}

View file

@ -1,8 +1,7 @@
function Node_IsoSurf(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
name = "IsoSurf";
inputs[| 0] = nodeValue("Direction", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
.setDisplay(VALUE_DISPLAY.enum_button, [ "4", "8" ]);
inputs[| 0] = nodeValue("Direction", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 4);
inputs[| 1] = nodeValue("Surfaces", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone)
.setVisible(true, true)
@ -11,23 +10,111 @@ function Node_IsoSurf(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
inputs[| 2] = nodeValue("Angle Shift", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
.setDisplay(VALUE_DISPLAY.rotation);
outputs[| 0] = nodeValue("IsoSurf", self, JUNCTION_CONNECT.output, VALUE_TYPE.dynaSurf, noone);
inputs[| 3] = nodeValue("Angle Split", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 0 * 90, 1 * 90, 2 * 90, 3 * 90 ])
.setArrayDepth(1);
outputs[| 0] = nodeValue("IsoSurf", self, JUNCTION_CONNECT.output, VALUE_TYPE.dynaSurface, noone);
knob_hover = noone;
knob_dragging = noone;
drag_sv = 0;
drag_sa = 0;
angle_renderer = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus) {
var hh = ui(240);
var _surfs = inputs[| 1].getValue();
var _angle = inputs[| 3].getValue();
var _kx = _x + _w / 2;
var _ky = _y + hh / 2;
draw_sprite_stretched_ext(THEME.ui_panel_bg, 1, _x, _y, _w, hh, COLORS.node_composite_bg_blend, 1);
draw_sprite(THEME.rotator_bg, 0, _kx, _ky);
var _khover = noone;
for( var i = 0, n = array_length(_angle); i < n; i++ ) {
var _ang = _angle[i];
var _knx = _kx + lengthdir_x(ui(28), _ang);
var _kny = _ky + lengthdir_y(ui(28), _ang);
var _ind = (knob_dragging == noone && i == knob_hover) || knob_dragging == i;
var _cc = knob_dragging == i? COLORS._main_accent : c_white;
draw_sprite_ext(THEME.rotator_knob, _ind, _knx, _kny, 1, 1, 0, _cc, 1);
if(point_in_circle(_m[0], _m[1], _knx, _kny, ui(10)))
_khover = i;
var _knx = _kx + lengthdir_x(ui(44), _ang);
var _kny = _ky + lengthdir_y(ui(44), _ang);
draw_set_text(f_p3, fa_center, fa_center, COLORS._main_text_sub);
draw_text_add(_knx, _kny, _ang);
var _knx = _kx + lengthdir_x(ui(84), _ang);
var _kny = _ky + lengthdir_y(ui(84), _ang);
var _surf = array_safe_get(_surfs, i, noone);
if(is_surface(_surf)) {
var _sw = surface_get_width(_surf);
var _sh = surface_get_height(_surf);
var _ss = min(32 / _sw, 32 / _sh);
draw_surface_ext(_surf, _knx - _sw * _ss / 2, _kny - _sh * _ss / 2, _ss, _ss, 0, c_white, 1);
}
draw_set_color(COLORS._main_text_sub);
draw_rectangle(_knx - 16, _kny - 16, _knx + 16, _kny + 16, true);
}
knob_hover = _khover;
if(knob_dragging == noone) {
if(knob_hover >= 0 && mouse_press(mb_left, _focus)) {
knob_dragging = knob_hover;
drag_sv = _angle[knob_hover];
drag_sa = _angle[knob_hover];
}
} else {
var delta = angle_difference(point_direction(_kx, _ky, _m[0], _m[1]), drag_sa);
var real_val = round(delta + drag_sv);
var val = key_mod_press(CTRL)? round(real_val / 15) * 15 : real_val;
_angle[knob_dragging] = val;
if(inputs[| 3].setValue(_angle)) UNDO_HOLDING = true;
if(mouse_release(mb_left)) {
knob_dragging = noone;
}
}
return hh;
});
input_display_list = [
["Isometric", false], 0, 2,
["Iso", false], 0, 2, angle_renderer,
["Surfaces", false], 1,
];
static onValueUpdate = function(index) {
if(index == 0) {
var _amo = inputs[| 0].getValue();
var _ang = array_create(_amo);
for( var i = 0, n = _amo; i < n; i++ )
_ang[i] = 360 * (i / _amo);
inputs[| 3].setValue(_ang);
}
}
static processData = function(_outSurf, _data, _output_index, _array_index) {
var _type = _data[0];
var _amo = _data[0];
var _surf = _data[1];
var _angle = _data[2];
var _amo = _type == 0? 4 : 8;
var _ashft = _data[2];
var _angle = _data[3];
var _iso = new dynaSurf_iso();
var _iso = _type == 0? new dynaSurf_iso_4() : new dynaSurf_iso_8();
for( var i = 0; i < _amo; i++ )
_iso.surfaces[i] = array_safe_get(_surf, i, noone);
_iso.angle = _angle;
_iso.angles = _angle;
_iso.angle_shift = _ashft;
return _iso;
}

View file

@ -257,8 +257,7 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor {
static processType = function(_val) { #region
if(!sep_axis && typeArray(prop.display_type) && is_array(_val)) {
for(var i = 0; i < array_length(_val); i++)
_val[i] = processValue(_val[i]);
_val[i] = processValue(_val[i]);
return _val;
}
return processValue(_val);

View file

@ -41,13 +41,12 @@ function Node_Lua_Compute(_x, _y, _group = noone) : Node(_x, _y, _group) constru
["Inputs", true],
];
setIsDynamicInput(3);
setIsDynamicInput(3, false);
argument_name = [];
argument_val = [];
lua_state = lua_create();
lua_error_handler = _lua_error;
error_notification = noone;
compiled = false;

View file

@ -19,7 +19,6 @@ function Node_Lua_Global(_x, _y, _group = noone) : Node(_x, _y, _group) construc
];
lua_state = lua_create();
lua_error_handler = _lua_error;
is_beginning = false;
error_notification = noone;

View file

@ -42,13 +42,12 @@ function Node_Lua_Surface(_x, _y, _group = noone) : Node(_x, _y, _group) constru
["Inputs", true],
];
setIsDynamicInput(3);
setIsDynamicInput(3, false);
argument_name = [];
argument_val = [];
lua_state = lua_create();
lua_error_handler = _lua_error;
error_notification = noone;
compiled = false;

View file

@ -589,7 +589,7 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor {
addNodeObject(values, "Atlas Set", s_node_atlas_set, "Node_Atlas_Set", [1, Node_Atlas_Set]).setVersion(1141);
ds_list_add(values, "Surface");
//addNodeObject(values, "Dynamic Surface", s_node_surface_from_buffer, "Node_DynaSurf", [1, Node_DynaSurf]).setVersion(11520);
//addNodeObject(values, "Dynamic Surface", s_node_dynasurf, "Node_dynaSurf", [1, Node_dynaSurf]).setVersion(11520);
addNodeObject(values, "IsoSurf", s_node_isosurf, "Node_IsoSurf", [1, Node_IsoSurf]).setVersion(11520);
addNodeObject(values, "Surface from Buffer", s_node_surface_from_buffer, "Node_Surface_From_Buffer", [1, Node_Surface_From_Buffer], ["buffer to surface"], "Create surface from buffer.").setVersion(1146);

View file

@ -52,7 +52,7 @@ enum VALUE_TYPE {
d3Scene = 29,
d3Material = 30,
dynaSurf = 31,
dynaSurface = 31,
PCXnode = 32,
action = 99,
@ -177,7 +177,7 @@ function value_bit(i) { #region
case VALUE_TYPE.boolean : return 1 << 3 | 1 << 1;
case VALUE_TYPE.color : return 1 << 4;
case VALUE_TYPE.gradient : return 1 << 25;
case VALUE_TYPE.dynaSurf :
case VALUE_TYPE.dynaSurface :
case VALUE_TYPE.surface : return 1 << 5;
case VALUE_TYPE.path : return 1 << 10;
case VALUE_TYPE.text : return 1 << 10;
@ -691,7 +691,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
break; #endregion
case VALUE_DISPLAY.vector : #region
var val = animator.getValue();
var len = display_data == -1? array_length(val) : display_data;
var len = array_length(val);
if(len <= 4) {
editWidget = new vectorBox(len, function(index, val) {
@ -700,7 +700,8 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
return setValueDirect(val, index);
}, unit );
if(type == VALUE_TYPE.integer) editWidget.setSlideSpeed(1);
if(display_data != -1) editWidget.extras = display_data;
if(display_data != -1 && is_struct(display_data))
editWidget.extras = display_data;
if(len == 2) {
extract_node = [ "Node_Vector2", "Node_Path" ];
@ -856,7 +857,6 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
return setValueDirect(_val);
}, unit );
if(type == VALUE_TYPE.integer) editWidget.setSlideSpeed(1);
if(display_data != -1) editWidget.extras = display_data;
for( var i = 0, n = array_length(animators); i < n; i++ )
animators[i].suffix = " " + string(i);
@ -1328,9 +1328,9 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
if(value_from == noone) {
var _val = __getAnimValue(_time);
val = [ _val, self ];
return [ _val, self ];
} else if(value_from != self)
val = value_from.getValueRecursive(_time);
return value_from.getValueRecursive(_time);
if(expUse && is_struct(expTree) && expTree.validate()) {
//print($"========== EXPRESSION CALLED ==========");
@ -1468,6 +1468,16 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
return setValueDirect(val, noone, record, time, _update);
} #endregion
static overrideValue = function(_val) { #region
ds_list_clear(animator.values);
ds_list_add(animator.values, new valueKey(0, _val, animator));
for( var i = 0, n = array_length(animators); i < n; i++ ) {
ds_list_clear(animators[i].values);
ds_list_add(animators[i].values, new valueKey(0, array_safe_get(_val, i), animators[i]));
}
} #endregion
static setValueDirect = function(val = 0, index = noone, record = true, time = PROJECT.animator.current_frame, _update = true) { #region
var updated = false;
@ -1566,6 +1576,8 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
} #endregion
static setFrom = function(_valueFrom, _update = true, checkRecur = true, log = false) { #region
print($"Connecting {_valueFrom.name} to {name}");
if(_valueFrom == noone)
return removeFrom();

View file

@ -1118,7 +1118,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
}
}
if(target != noone && target.connect_type == JUNCTION_CONNECT.input && target.node.is_dynamic_input)
if(target != noone && target.connect_type == JUNCTION_CONNECT.input && target.node.auto_input)
_addInput = true;
var _mmx = target != noone? target.x : _mx;
@ -1519,7 +1519,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
if(ds_list_empty(nodes_select_list)) {
if(node_focus != noone && !ds_list_empty(node_focus.outputs)) {
var _o = node_focus.outputs[| 0];
if(_o.type == VALUE_TYPE.surface || _o.type == VALUE_TYPE.dynaSurf) {
if(_o.type == VALUE_TYPE.surface || _o.type == VALUE_TYPE.dynaSurface) {
var tr = nodeBuild("Node_Transform", node_focus.x + node_focus.w + 64, node_focus.y);
tr.inputs[| 0].setFrom(_o);
}
@ -1530,7 +1530,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
if(ds_list_empty(node.outputs)) continue;
var _o = node.outputs[| 0];
if(_o.type == VALUE_TYPE.surface || _o.type == VALUE_TYPE.dynaSurf) {
if(_o.type == VALUE_TYPE.surface || _o.type == VALUE_TYPE.dynaSurface) {
var tr = nodeBuild("Node_Transform", node.x + node.w + 64, node.y);
tr.inputs[| 0].setFrom(_o);
}

View file

@ -1,6 +1,6 @@
function Panel_Text_Editor(_textArea, _inputFunc, _context) : PanelContent() constructor {
title = "";
w = ui(640);
w = min(WIN_W - ui(64), ui(800));
h = ui(480);
auto_pin = true;

View file

@ -54,14 +54,9 @@ function rotator(_onModify, _step = -1) : widget() constructor {
var py = knob_y + lengthdir_y(_r, _data);
if(dragging) {
var delta = angle_difference(point_direction(_x, knob_y, _m[0], _m[1]), drag_sa);
var val;
var real_val = round(delta + drag_sv);
if(key_mod_press(CTRL))
val = round(real_val / 15) * 15;
else
val = real_val;
var delta = angle_difference(point_direction(_x, knob_y, _m[0], _m[1]), drag_sa);
var real_val = round(delta + drag_sv);
var val = key_mod_press(CTRL)? round(real_val / 15) * 15 : real_val;
if(step != -1)
val = round(real_val / step) * step;

View file

@ -2,7 +2,7 @@
function draw_surface_safe(surface, _x = 0, _y = 0) {
gml_pragma("forceinline");
if(is_struct(surface) && is_instanceof(surface, DynaSurf)) {
if(is_struct(surface) && is_instanceof(surface, dynaSurf)) {
surface.draw(_x, _y);
return;
}
@ -16,7 +16,7 @@ function draw_surface_safe(surface, _x = 0, _y = 0) {
function draw_surface_stretched_safe(surface, _x, _y, _w, _h) {
gml_pragma("forceinline");
if(is_struct(surface) && is_instanceof(surface, DynaSurf)) {
if(is_struct(surface) && is_instanceof(surface, dynaSurf)) {
surface.drawStretch(_x, _y, _w, _h);
return;
}
@ -30,7 +30,7 @@ function draw_surface_stretched_safe(surface, _x, _y, _w, _h) {
function draw_surface_ext_safe(surface, _x, _y, _xs = 1, _ys = 1, _rot = 0, _col = c_white, _alpha = 1) {
gml_pragma("forceinline");
if(is_struct(surface) && is_instanceof(surface, DynaSurf)) {
if(is_struct(surface) && is_instanceof(surface, dynaSurf)) {
surface.draw(_x, _y, _xs, _ys, _rot, _col, _alpha);
return;
}
@ -44,7 +44,7 @@ function draw_surface_ext_safe(surface, _x, _y, _xs = 1, _ys = 1, _rot = 0, _col
function draw_surface_tiled_safe(surface, _x, _y) {
gml_pragma("forceinline");
if(is_struct(surface) && is_instanceof(surface, DynaSurf)) {
if(is_struct(surface) && is_instanceof(surface, dynaSurf)) {
surface.drawTile(_x, _y);
return;
}
@ -58,7 +58,7 @@ function draw_surface_tiled_safe(surface, _x, _y) {
function draw_surface_tiled_ext_safe(surface, _x, _y, _xs = 1, _ys = 1, _col = c_white, _alpha = 1) {
gml_pragma("forceinline");
if(is_struct(surface) && is_instanceof(surface, DynaSurf)) {
if(is_struct(surface) && is_instanceof(surface, dynaSurf)) {
surface.drawTile(_x, _y, _xs, _ys, _col, _alpha);
return;
}
@ -72,7 +72,7 @@ function draw_surface_tiled_ext_safe(surface, _x, _y, _xs = 1, _ys = 1, _col = c
function draw_surface_part_ext_safe(surface, _l, _t, _w, _h, _x, _y, _xs = 1, _ys = 1, _rot = 0, _col = c_white, _alpha = 1) {
gml_pragma("forceinline");
if(is_struct(surface) && is_instanceof(surface, DynaSurf)) {
if(is_struct(surface) && is_instanceof(surface, dynaSurf)) {
surface.drawPart(_l, _t, _w, _h, _x, _y, _xs, _ys, _rot, _col, _alpha);
return;
}
@ -141,13 +141,13 @@ function surface_save_safe(surface, path) {
function surface_get_width_safe(s) {
gml_pragma("forceinline");
return (is_struct(s) && is_instanceof(s, DynaSurf))? s.getWidth() : surface_get_width(s);
return (is_struct(s) && is_instanceof(s, dynaSurf))? s.getWidth() : surface_get_width(s);
}
function surface_get_height_safe(s) {
gml_pragma("forceinline");
return (is_struct(s) && is_instanceof(s, DynaSurf))? s.getHeight() : surface_get_height(s);
return (is_struct(s) && is_instanceof(s, dynaSurf))? s.getHeight() : surface_get_height(s);
}
//check
@ -156,7 +156,7 @@ function is_surface(s) {
if(is_undefined(s)) return false;
if(is_array(s)) return false;
if(is_struct(s) && is_instanceof(s, DynaSurf)) return true;
if(is_struct(s) && is_instanceof(s, dynaSurf)) return true;
if(!is_real(s)) return false;
if(!s) return false;
if(!surface_exists(s)) return false;

View file

@ -365,8 +365,8 @@ function textArea(_input, _onModify, _extras = noone) : textInput(_input, _onMod
if(keyboard_check_pressed(vk_escape)) {
} else if(keyboard_check_pressed(vk_tab)) {
} else if(( shift_new_line && keyboard_check_pressed(vk_enter) && key_mod_press(SHIFT)) ||
(!shift_new_line && keyboard_check_pressed(vk_enter))) {
} else if(( shift_new_line && keyboard_check_pressed(vk_enter) && key_mod_press(SHIFT)) ||
(!shift_new_line && keyboard_check_pressed(vk_enter) && !key_mod_press(SHIFT))) {
var ch = "\n";
if(cursor_select == -1) {
var str_before = string_copy(_input_text, 1, cursor);

View file

@ -37,7 +37,7 @@ 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 = -1;
extras = noone;
for(var i = 0; i < 4; i++) {
tb[i] = new textBox(TEXTBOX_INPUT.number, onModifySingle[i]);
@ -53,8 +53,7 @@ function vectorBox(_size, _onModify, _unit = noone) : widget() constructor {
self.interactable = interactable;
b_link.interactable = interactable;
if(extras)
extras.interactable = interactable;
if(extras != noone) extras.interactable = interactable;
for( var i = 0; i < size; i++ )
tb[i].interactable = interactable;
@ -66,8 +65,7 @@ function vectorBox(_size, _onModify, _unit = noone) : widget() constructor {
for( var i = 0; i < size; i++ )
tb[i].register(parent);
if(extras)
extras.register(parent);
if(extras != noone) extras.register(parent);
if(unit != noone && unit.reference != noone)
unit.triggerButton.register(parent);

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View file

@ -0,0 +1,74 @@
{
"resourceType": "GMSprite",
"resourceVersion": "1.0",
"name": "s_node_dynasurf",
"bbox_bottom": 58,
"bbox_left": 5,
"bbox_right": 58,
"bbox_top": 5,
"bboxMode": 0,
"collisionKind": 1,
"collisionTolerance": 0,
"DynamicTexturePage": false,
"edgeFiltering": false,
"For3D": false,
"frames": [
{"resourceType":"GMSpriteFrame","resourceVersion":"1.1","name":"0266d148-cd45-45c0-9c40-3df37b8350c5",},
],
"gridX": 0,
"gridY": 0,
"height": 64,
"HTile": false,
"layers": [
{"resourceType":"GMImageLayer","resourceVersion":"1.0","name":"4741917d-c87e-4e69-9ac9-a60bda969c74","blendMode":0,"displayName":"default","isLocked":false,"opacity":100.0,"visible":true,},
],
"nineSlice": null,
"origin": 4,
"parent": {
"name": "surface",
"path": "folders/nodes/icons/value/surface.yy",
},
"preMultiplyAlpha": false,
"sequence": {
"resourceType": "GMSequence",
"resourceVersion": "1.4",
"name": "s_node_dynasurf",
"autoRecord": true,
"backdropHeight": 768,
"backdropImageOpacity": 0.5,
"backdropImagePath": "",
"backdropWidth": 1366,
"backdropXOffset": 0.0,
"backdropYOffset": 0.0,
"events": {"resourceType":"KeyframeStore<MessageEventKeyframe>","resourceVersion":"1.0","Keyframes":[],},
"eventStubScript": null,
"eventToFunction": {},
"length": 1.0,
"lockOrigin": false,
"moments": {"resourceType":"KeyframeStore<MomentsEventKeyframe>","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<SpriteFrameKeyframe>","resourceVersion":"1.0","Keyframes":[
{"resourceType":"Keyframe<SpriteFrameKeyframe>","resourceVersion":"1.0","Channels":{"0":{"resourceType":"SpriteFrameKeyframe","resourceVersion":"1.0","Id":{"name":"0266d148-cd45-45c0-9c40-3df37b8350c5","path":"sprites/s_node_dynasurf/s_node_dynasurf.yy",},},},"Disabled":false,"id":"79c02c00-0fbf-49c8-b934-c505bdbfe181","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,
}