General fixes

This commit is contained in:
Tanasart 2023-11-20 11:10:55 +07:00
parent 164c6f6e83
commit b314b53a88
22 changed files with 250 additions and 151 deletions

Binary file not shown.

View file

@ -6,20 +6,19 @@
"sprPath": "./Iso cube.png",
"nodes": [
{ "id": "cube", "node": "Node_3D_Mesh_Cube", "x": 0, "y": 0 },
{ "id": "light", "node": "Node_3D_Light_Directional", "x": 0, "y": 160 },
{ "id": "scene", "node": "Node_3D_Scene", "x": 160, "y": 0 },
{ "id": "camera", "node": "Node_3D_Camera", "x": 320, "y": 0,
{ "id": "camera", "node": "Node_3D_Camera_Set", "x": 320, "y": 0,
"setValues": [ { "index": "projection", "value": 1 },
{ "index": "orthographic_scale", "value": 0.5 },
{ "index": "postioning_mode", "value": 2 },
{ "index": "horizontal_angle", "value": 45 },
{ "index": "vertical_angle", "value": 30 }
{ "index": "vertical_angle", "value": 30 },
{ "index": "l1_h_angle", "value": 0 },
{ "index": "l1_v_angle", "value": 75 },
{ "index": "l2_intensity", "value": 0 }
]
}
],
"connections": [
{ "from": "cube", "fromIndex": 0, "to": "scene", "toIndex": 0 },
{ "from": "light", "fromIndex": 0, "to": "scene", "toIndex": 1 },
{ "from": "scene", "fromIndex": 0, "to": "camera", "toIndex": "scene" }
{ "from": "cube", "fromIndex": 0, "to": "camera", "toIndex": "scene" }
]
}

View file

@ -328,7 +328,7 @@ event_inherited();
var _hover = sHOVER && content_pane.hover;
var _list = node_list;
if(ADD_NODE_PAGE == -1) {
if(ADD_NODE_PAGE == -1) { #region
var context = PANEL_GRAPH.getCurrentContext();
context = context == noone? "" : instanceof(context);
@ -343,7 +343,8 @@ event_inherited();
ds_list_add(_list, cat.list[| j]);
}
}
} else if(ADD_NODE_PAGE == NODE_PAGE_DEFAULT) {
#endregion
} else if(ADD_NODE_PAGE == NODE_PAGE_DEFAULT) { #region
_list = ds_list_create();
var sug = [];
@ -383,17 +384,21 @@ event_inherited();
if(_node.show_in_recent)
ds_list_add(_list, _node);
}
}
} #endregion
if(_list == noone) {
setPage(NODE_PAGE_DEFAULT);
return 0;
}
var node_count = ds_list_size(_list);
var group_labels = [];
var node_count = ds_list_size(_list);
var group_labels = [];
var _hoverContent = _hover;
if(ADD_NODE_PAGE > -1 && PREFERENCES.dialog_add_node_grouping)
_hoverContent &= _m[1] > ui(8 + 24);
if(PREFERENCES.dialog_add_node_view == 0) { //grid
if(PREFERENCES.dialog_add_node_view == 0) { #region grid
var grid_size = ui(64);
var grid_width = ui(80);
var grid_space = ui(12);
@ -445,7 +450,7 @@ event_inherited();
draw_sprite_stretched_ext(THEME.node_bg, 0, _boxx, yy, grid_size, grid_size, cc, 1);
BLEND_NORMAL
if(_hover && point_in_rectangle(_m[0], _m[1], _nx, yy, _nx + grid_width, yy + grid_size)) {
if(_hoverContent && point_in_rectangle(_m[0], _m[1], _nx, yy, _nx + grid_width, yy + grid_size)) {
draw_sprite_stretched_ext(THEME.node_active, 0, _boxx, yy, grid_size, grid_size, COLORS._main_accent, 1);
if(mouse_press(mb_left, sFOCUS))
buildNode(_node);
@ -518,7 +523,8 @@ event_inherited();
hh += curr_height;
yy += curr_height;
} else if(PREFERENCES.dialog_add_node_view == 1) { //list
#endregion
} else if(PREFERENCES.dialog_add_node_view == 1) { #region list
var list_width = content_pane.surface_w;
var list_height = ui(28);
var yy = _y + list_height / 2;
@ -555,7 +561,7 @@ event_inherited();
BLEND_NORMAL;
}
if(_hover && point_in_rectangle(_m[0], _m[1], 0, yy, list_width, yy + list_height - 1)) {
if(_hoverContent && point_in_rectangle(_m[0], _m[1], 0, yy, list_width, yy + list_height - 1)) {
if(_node.getTooltip() != "") {
node_tooltip = _node;
node_tooltip_x = content_pane.x + ui(16);
@ -613,6 +619,7 @@ event_inherited();
draw_text(ui(16 + 16), _yy + ui(12), lb.text);
}
}
#endregion
}
if(ADD_NODE_PAGE == -1)
@ -656,7 +663,7 @@ event_inherited();
tb_search.auto_update = true;
WIDGET_CURRENT = tb_search;
function searchNodes() {
function searchNodes() { #region
ds_list_clear(search_list);
var pr_list = ds_priority_create();
@ -707,7 +714,7 @@ event_inherited();
ds_list_add(search_list, ds_priority_delete_max(pr_list));
ds_priority_destroy(pr_list);
}
} #endregion
search_pane = new scrollPane(dialog_w - ui(36), dialog_h - ui(66), function(_y, _m) {
draw_clear_alpha(c_white, 0);
@ -721,7 +728,7 @@ event_inherited();
var grid_width = ui(80);
var grid_space = ui(16);
if(equation) {
if(equation) { #region
var eq = string_replace(search_string, "=", "");
draw_set_text(f_h5, fa_center, fa_bottom, COLORS._main_text_sub);
@ -735,9 +742,9 @@ event_inherited();
if(keyboard_check_pressed(vk_enter))
buildNode(ALL_NODES[? "Node_Equation"], { query: eq } );
return hh;
}
} #endregion
if(PREFERENCES.dialog_add_node_view == 0) { //grid view
if(PREFERENCES.dialog_add_node_view == 0) { #region grid
var col = floor(search_pane.surface_w / (grid_width + grid_space));
var yy = _y + grid_space;
var index = 0;
@ -836,7 +843,8 @@ event_inherited();
yy += hght;
}
}
} else if(PREFERENCES.dialog_add_node_view == 1) { //list view
#endregion
} else if(PREFERENCES.dialog_add_node_view == 1) { #region list
var list_width = search_pane.surface_w;
var list_height = ui(28);
var yy = _y + list_height / 2;
@ -910,6 +918,7 @@ event_inherited();
hh += list_height;
yy += list_height;
}
#endregion
}
node_focusing = -1;

View file

@ -29,8 +29,7 @@ if(!ready) exit;
if(is_instanceof(_menuItem, MenuItemGroup))
_h += hght;
var hoverable = _menuItem.active && sHOVER;
if(hoverable && point_in_rectangle(mouse_mx, mouse_my, dialog_x, yy + 1, dialog_x + dialog_w, yy + _h - 1)) {
if(sHOVER && point_in_rectangle(mouse_mx, mouse_my, dialog_x, yy + 1, dialog_x + dialog_w, yy + _h - 1)) {
selecting = i;
var tips = array_safe_get(tooltips, i, noone);
if(tips != noone) TOOLTIP = tips;
@ -46,7 +45,9 @@ if(!ready) exit;
else
draw_sprite_stretched_ext(THEME.textbox, 3, dialog_x, yy, dialog_w, _h, cc, 0.8);
if(instanceof(_menuItem) == "MenuItem" && sFOCUS && (mouse_release(mb_left) || keyboard_check_released(vk_enter))) {
if(instanceof(_menuItem) == "MenuItem" && _menuItem.active && sFOCUS &&
(mouse_release(mb_left) || keyboard_check_released(vk_enter))) {
var _dat = {
_x: dialog_x,
x: dialog_x + dialog_w,

View file

@ -569,7 +569,7 @@ event_inherited();
dialog.setDefault(val);
self.key = key;
dialog.onApply = function(color) {
variable_struct_set(COLORS, self.key, color);
variable_struct_set(COLORS, key, color);
overrideColor();
};
dialog.selector.onApply = dialog.onApply;
@ -588,7 +588,7 @@ event_inherited();
});
function overrideColor() {
var path = $"{DIRECTORY}themes{PREFERENCES.theme}/override.json";
var path = $"{DIRECTORY}themes/{PREFERENCES.theme}/override.json";
json_save_struct(path, COLORS, true);
}
#endregion

View file

@ -25,6 +25,11 @@ function array_safe_set(arr, index, value, fill = 0) { #region
return arr;
} #endregion
function array_safe_length(arr) { #region
INLINE
return is_array(arr)? array_length(arr) : 0;
} #endregion
function array_fill(arr, startIndex, endIndex, value = 0) { #region
INLINE

View file

@ -72,6 +72,8 @@ function globalvar_viewer_draw(xx, yy, ww, _m, focus, hover, _scrollPane, rx, ry
_edit.sc_type.setFocusHover(_foc, _hov);
_edit.sc_disp.setFocusHover(_foc, _hov);
if(_foc) _edit.tb_name.register(_scrollPane);
_edit.tb_name.draw(_wd_x + ui(32), yy, wd_w - wd_h - ui(32 + 4), wd_h, _inpu.name, _m, TEXTBOX_INPUT.text);
if(buttonInstant(THEME.button_hide, _wd_x + wd_w - wd_h, yy, wd_h, wd_h, _m, _foc, _hov,, THEME.icon_delete,, COLORS._main_value_negative) == 2)
del = j;

View file

@ -4,26 +4,34 @@ function Node_3D_Camera_Set(_x, _y, _group = noone) : Node_3D_Camera(_x, _y, _gr
light_key = new __3dLightDirectional();
light_fill = new __3dLightDirectional();
inputs[| in_cam + 0] = nodeValue("Horizontal angle", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 45 )
inputs[| in_cam + 0] = nodeValue("L1 H angle", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 45 )
.setName("Horizontal angle")
.setDisplay(VALUE_DISPLAY.rotation);
inputs[| in_cam + 1] = nodeValue("Vertical angle", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 215 )
inputs[| in_cam + 1] = nodeValue("L1 V angle", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 45 )
.setName("Vertical angle")
.setDisplay(VALUE_DISPLAY.slider, { range: [0, 90, 1] });
inputs[| in_cam + 2] = nodeValue("Color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white )
inputs[| in_cam + 2] = nodeValue("L1 Color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white )
.setName("Color")
inputs[| in_cam + 3] = nodeValue("Intensity", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1 )
inputs[| in_cam + 3] = nodeValue("L1 Intensity", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1 )
.setName("Intensity")
.setDisplay(VALUE_DISPLAY.slider);
inputs[| in_cam + 4] = nodeValue("Horizontal angle", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, -45 )
inputs[| in_cam + 4] = nodeValue("L2 H angle", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, -45 )
.setName("Horizontal angle")
.setDisplay(VALUE_DISPLAY.rotation);
inputs[| in_cam + 5] = nodeValue("Vertical angle", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 45 )
inputs[| in_cam + 5] = nodeValue("L2 V angle", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 45 )
.setName("Vertical angle")
.setDisplay(VALUE_DISPLAY.slider, { range: [0, 90, 1] });
inputs[| in_cam + 6] = nodeValue("Color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white )
inputs[| in_cam + 6] = nodeValue("L2 Color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white )
.setName("Color")
inputs[| in_cam + 7] = nodeValue("Intensity", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5 )
inputs[| in_cam + 7] = nodeValue("L2 Intensity", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5 )
.setName("Intensity")
.setDisplay(VALUE_DISPLAY.slider);
array_append(input_display_list, [
@ -31,15 +39,15 @@ function Node_3D_Camera_Set(_x, _y, _group = noone) : Node_3D_Camera(_x, _y, _gr
["Fill light", false], in_cam + 4, in_cam + 5, in_cam + 6, in_cam + 7,
]);
static submitShadow = function() {
static submitShadow = function() { #region
light_key.submitShadow(scene, light_key);
light_fill.submitShadow(scene, light_fill);
}
} #endregion
static submitShader = function() {
static submitShader = function() { #region
scene.submitShader(light_key);
scene.submitShader(light_fill);
}
} #endregion
static preProcessData = function(_data) { #region
var _han = _data[in_cam + 0];

View file

@ -65,7 +65,7 @@ function Node_Array(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
attributes.size = 1;
attributes.spread_value = false;
static getType = function() {
static getType = function() { #region
var _type = getInputData(0);
switch(_type) {
@ -75,21 +75,20 @@ function Node_Array(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
case 4 : return VALUE_TYPE.text;
default : return VALUE_TYPE.any;
}
}
} #endregion
static createNewInput = function() {
static createNewInput = function() { #region
var index = ds_list_size(inputs);
var _typ = getType();
var _typ = getType();
inputs[| index] = nodeValue("Input", self, JUNCTION_CONNECT.input, _typ, -1 )
.setVisible(true, true);
array_push(input_display_list, index);
return inputs[| index];
}
if(!LOADING && !APPENDING) createNewInput();
} if(!LOADING && !APPENDING) createNewInput(); #endregion
static refreshDynamicInput = function() {
static refreshDynamicInput = function() { #region
var _l = ds_list_create();
var amo = attributes.size;
var extra = true;
@ -124,9 +123,9 @@ function Node_Array(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
if(extra)
lastNode = createNewInput();
}
} #endregion
static onValueUpdate = function(index = 0) {
static onValueUpdate = function(index = 0) { #region
if(index != 0) return;
var ls = ds_list_create();
@ -138,15 +137,15 @@ function Node_Array(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
input_display_list = [ 0, array_adjust_tool, 1 ];
refreshDynamicInput();
}
} #endregion
static onValueFromUpdate = function(index) {
static onValueFromUpdate = function(index) { #region
if(LOADING || APPENDING) return;
refreshDynamicInput();
}
} #endregion
static update = function(frame = CURRENT_FRAME) {
static update = function(frame = CURRENT_FRAME) { #region
var _typ = getType();
outputs[| 0].setType(_typ);
@ -169,9 +168,9 @@ function Node_Array(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
}
outputs[| 0].setValue(res);
}
} #endregion
static doApplyDeserialize = function() {
static doApplyDeserialize = function() { #region
var _typ = getType();
if(_typ == VALUE_TYPE.any) return;
@ -179,6 +178,5 @@ function Node_Array(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
inputs[| i].setType(_typ);
inputs[| i].resetDisplay();
}
}
} #endregion
}

View file

@ -73,7 +73,10 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
w = 128;
h = 128;
min_w = 0;
min_h = 0;
will_setHeight = false;
draw_padding = 4;
auto_height = true;
@ -144,11 +147,8 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
#endregion
#region --- attributes ----
attributes = {
update_graph: true,
show_update_trigger: false,
color: -1,
};
attributes.node_width = 0;
attributes.node_height = 0;
attributeEditors = [
"Node update",
@ -306,7 +306,8 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
for( var i = 0; i < ds_list_size(outputs); i++ )
if(outputs[| i].isVisible()) _ho += 24;
h = max(min_h, _prev_surf * 128, _hi, _ho);
//w = max(min_w, attributes.node_width);
h = max(min_h, _prev_surf * 128, _hi, _ho, attributes.node_height);
} run_in(1, function() { setHeight(); }); #endregion
static setDisplayName = function(_name) { #region
@ -458,6 +459,11 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
}
updatedOutTrigger.setValue(false);
}
if(will_setHeight) {
setHeight();
will_setHeight = false;
}
} #endregion
static doStepBegin = function() {}
@ -595,13 +601,13 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
onValueUpdate(index);
if(cache_group) cache_group.enableNodeGroup();
if(is_dynamic_input) setHeight();
if(is_dynamic_input) will_setHeight = true;
} #endregion
static valueFromUpdate = function(index) { #region
onValueFromUpdate(index);
if(cache_group) cache_group.enableNodeGroup();
if(is_dynamic_input) setHeight();
if(is_dynamic_input) will_setHeight = true;
} #endregion
static onValueUpdate = function(index = 0) {}

View file

@ -177,10 +177,17 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor {
return processType(merge_color(_f, _t, _lrp));
}
if(is_array(_f)) {
var _vec = array_create(array_length(_f));
for(var i = 0; i < array_length(_vec); i++)
_vec[i] = processType(lerp(_f[i], _t[i], _lrp));
if(is_array(_f) || is_array(_t)) {
var _len = max(array_safe_length(_f), array_safe_length(_t));
var _vec = array_create(_len);
for(var i = 0; i < _len; i++)
_vec[i] = processType(
lerp(
is_array(_f)? array_safe_get(_f, i, 0) : _f,
is_array(_t)? array_safe_get(_t, i, 0) : _t,
_lrp)
);
return _vec;
}

View file

@ -52,6 +52,8 @@ function Node_Number(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
var int = getInputData(1);
var disp = getInputData(2);
var _h = min_h;
w = 96;
min_h = 56;
@ -64,7 +66,7 @@ function Node_Number(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
case 1 :
if(inputs[| 0].isLeaf()) {
w = 160;
min_h = 96;
min_h = 96;
}
inputs[| 3].setVisible(true);
inputs[| 4].setVisible(true);
@ -81,6 +83,8 @@ function Node_Number(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
break;
}
if(_h != min_h) setHeight();
for( var i = 0; i < 1; i++ ) {
inputs[| i].setType(int? VALUE_TYPE.integer : VALUE_TYPE.float);
inputs[| i].editWidget.setSlidable(int? 0.1 : 0.01);
@ -154,10 +158,14 @@ function Node_Number(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
var _valL = lerp(_minn, _maxx, _valM);
_valL = value_snap(_valL, stp);
if(cmp) _valL = clamp(_valL, _minn, _maxx);
inputs[| 0].setValue(_valL);
if(mouse_release(mb_left))
if(inputs[| 0].setValue(_valL))
UNDO_HOLDING = true;
if(mouse_release(mb_left)) {
slider_dragging = false;
UNDO_HOLDING = false;
}
} else
slider_m = lerp_float(slider_m, 0, 5);
@ -201,10 +209,13 @@ function Node_Number(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
var dx = angle_difference(dir, rotator_p);
rotator_p = dir;
inputs[| 0].setValue(val + dx);
if(inputs[| 0].setValue(val + dx))
UNDO_HOLDING = true;
if(mouse_release(mb_left))
if(mouse_release(mb_left)) {
rotator_dragging = false;
UNDO_HOLDING = false;
}
} else
rotator_m = lerp_float(rotator_m, 0, 5);
@ -246,14 +257,6 @@ function Node_Vector2(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
inputs[| 3] = nodeValue("Display", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
.setDisplay(VALUE_DISPLAY.enum_scroll, [ "Number", "Coordinate" ]);
inputs[| 4] = nodeValue("Reset to center", self, JUNCTION_CONNECT.input, VALUE_TYPE.trigger, 0)
.setDisplay(VALUE_DISPLAY.button, { name: "To center", onClick: function () {
wd_minx = -1;
wd_miny = -1;
wd_maxx = 1;
wd_maxy = 1;
} });
outputs[| 0] = nodeValue("Vector", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, [ 0, 0 ])
.setDisplay(VALUE_DISPLAY.vector);
@ -275,6 +278,24 @@ function Node_Vector2(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
wd_pan_mx = 0;
wd_pan_my = 0;
coordinate_menu = [
menuItem(__txt("Reset view"), function() {
wd_minx = -1;
wd_miny = -1;
wd_maxx = 1;
wd_maxy = 1;
}),
menuItem(__txt("Focus value"), function() {
var _x = inputs[| 0].getValue();
var _y = inputs[| 1].getValue();
wd_minx = _x - 1;
wd_miny = _y - 1;
wd_maxx = _x + 1;
wd_maxy = _y + 1;
}),
];
static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { #region
var __ax = getInputData(0);
var __ay = getInputData(1);
@ -333,9 +354,9 @@ function Node_Vector2(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
inputs[| i].editWidget.setSlidable(int? 0.1 : 0.01);
}
inputs[| 4].setVisible(disp == 1, disp == 1);
outputs[| 0].setType(int? VALUE_TYPE.integer : VALUE_TYPE.float);
var _h = min_h;
w = 96;
min_h = 80;
@ -343,6 +364,8 @@ function Node_Vector2(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
w = 160;
min_h = 160;
}
if(min_h != _h) setHeight();
} #endregion
static processData = function(_output, _data, _output_index, _array_index = 0) { #region
@ -399,29 +422,33 @@ function Node_Vector2(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
draw_rectangle(bbox.x0, bbox.y0, bbox.x1, bbox.y1, 1);
draw_set_alpha(1);
var pin_x = (v0 - wd_minx) / (wd_maxx - wd_minx);
var pin_y = (v1 - wd_miny) / (wd_maxy - wd_miny);
if(point_in_rectangle(v0, v1, wd_minx, wd_miny, wd_maxx, wd_maxy)) {
var pin_dx = bbox.x0 + bbox.w * pin_x;
var pin_dy = bbox.y1 - bbox.h * pin_y;
var pin_x = (v0 - wd_minx) / (wd_maxx - wd_minx);
var pin_y = (v1 - wd_miny) / (wd_maxy - wd_miny);
if(point_in_rectangle(v0, v1, wd_minx, wd_miny, wd_maxx, wd_maxy)) { #region draw pin
var pin_dx = bbox.x0 + bbox.w * pin_x;
var pin_dy = bbox.y1 - bbox.h * pin_y;
draw_sprite_ext(THEME.node_coor_pin, 0, pin_dx, pin_dy, 1, 1, 0, c_white, 1);
}
} #endregion
if(wd_dragging) {
if(wd_dragging) { #region
var mx = wd_minx + (_mx - bbox.x0) / bbox.w * (wd_maxx - wd_minx);
var my = wd_maxy - (_my - bbox.y0) / bbox.h * (wd_maxy - wd_miny);
if(key_mod_press(CTRL)) {
mx = round(mx);
my = round(my);
}
var _i0 = inputs[| 0].setValue(mx);
var _i1 = inputs[| 1].setValue(my);
if(_i0 || _i1) UNDO_HOLDING = true;
inputs[| 0].setValue(mx);
inputs[| 1].setValue(my);
if(mouse_release(mb_left))
wd_dragging = false;
} else if(wd_panning) {
if(mouse_release(mb_left)) {
wd_dragging = false;
UNDO_HOLDING = false;
}
#endregion
} else if(wd_panning) { #region
draw_set_color(color);
draw_rectangle(bbox.x0, bbox.y0, bbox.x1, bbox.y1, 1);
@ -435,11 +462,12 @@ function Node_Vector2(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
wd_maxx = wd_minx + rx;
wd_maxy = wd_miny + ry;
if(mouse_release(mb_middle))
wd_panning = false;
if(mouse_release(mb_middle))
wd_panning = false;
#endregion
}
if(point_in_rectangle(_mx, _my, bbox.x0, bbox.y0, bbox.x1, bbox.y1)) {
if(_hover && point_in_rectangle(_mx, _my, bbox.x0, bbox.y0, bbox.x1, bbox.y1)) { #region
draw_set_color(color);
draw_rectangle(bbox.x0, bbox.y0, bbox.x1, bbox.y1, 1);
@ -480,11 +508,16 @@ function Node_Vector2(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
wd_maxx = wd_cx + rx;
wd_maxy = wd_cy + ry;
}
}
if(mouse_press(mb_right, _focus)) {
menuCall("node_vec2_coordinate",,, coordinate_menu);
}
} #endregion
draw_set_text(f_p2, fa_center, fa_bottom, COLORS._main_text);
var str = $"[{v0}, {v1}]";
draw_text(bbox.xc, bbox.y1 - 4, str);
var ss = min(1, string_scale(str, bbox.w - 16 * _s, bbox.h));
draw_text_transformed(bbox.xc, bbox.y1 - 4, str, ss, ss, 0);
} #endregion
} #endregion

View file

@ -18,43 +18,43 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { #regio
tooltip_spr = sprite_add(pth, 0, false, false, 0, 0);
new_node = false;
if(struct_has(global.NODE_GUIDE, node)) {
if(struct_has(global.NODE_GUIDE, node)) { #region
var _n = global.NODE_GUIDEarn[$ node];
name = _n.name;
if(_n.tooltip != "")
tooltip = _n.tooltip;
}
} #endregion
static setVersion = function(version) {
static setVersion = function(version) { #region
INLINE
new_node = version == VERSION;
return self;
}
} #endregion
static isDeprecated = function() {
static isDeprecated = function() { #region
INLINE
deprecated = true;
return self;
}
} #endregion
static hideRecent = function() {
static hideRecent = function() { #region
INLINE
show_in_recent = false;
return self;
}
} #endregion
static patreonExtra = function() {
static patreonExtra = function() { #region
INLINE
is_patreon_extra = true;
ds_list_add(global.SUPPORTER_NODES, self);
return self;
}
} #endregion
static getName = function() { return __txt_node_name(node, name); }
static getTooltip = function() { return __txt_node_tooltip(node, tooltip); }
static build = function(_x = 0, _y = 0, _group = PANEL_GRAPH.getCurrentContext(), _param = {}) {
static build = function(_x = 0, _y = 0, _group = PANEL_GRAPH.getCurrentContext(), _param = {}) { #region
var _node;
var _buildCon = createNode[0];
if(array_length(createNode) > 2)
@ -67,7 +67,7 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { #regio
if(!LOADING && !APPENDING) _node.doUpdate();
return _node;
}
} #endregion
static drawGrid = function(_x, _y, _mx, _my, grid_size) { #region
var spr_x = _x + grid_size / 2;

View file

@ -20,12 +20,12 @@ function Node_Trigger(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
doTrigger = 0;
static onInspector2Update = function() {
static onInspector2Update = function() { #region
inputs[| 0].setAnim(true);
inputs[| 0].setValue(true);
}
} #endregion
static step = function() {
static step = function() { #region
if(doTrigger == 1) {
outputs[| 0].setValue(true);
doTrigger = -1;
@ -33,14 +33,14 @@ function Node_Trigger(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
outputs[| 0].setValue(false);
doTrigger = 0;
}
}
} #endregion
static update = function() {
static update = function() { #region
var trg = getInputData(0);
if(trg) doTrigger = 1;
}
} #endregion
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region
draw_set_text(f_h5, fa_center, fa_center, COLORS._main_text);
var bbox = drawGetBbox(xx, yy, _s);
var trg = outputs[| 0].getValue();
@ -55,5 +55,5 @@ function Node_Trigger(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
draw_set_circle_precision(32);
if(trg) draw_circle(bbox.xc, bbox.yc, rr - 6, false);
}
} #endregion
}

View file

@ -511,6 +511,8 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
forward = true;
_initName = _name;
node.will_setHeight = true;
static updateName = function(_name) {
name = _name;
internalName = string_to_var(name);
@ -686,6 +688,12 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
return __txt_junction_name(instanceof(node), connect_type, index, name);
} #endregion
static setName = function(_name) { #region
INLINE
name = _name;
return self;
} #endregion
static resetValue = function() { setValue(def_val); }
static setUnitRef = function(ref, mode = VALUE_UNIT.constant) { #region
@ -702,6 +710,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
visible = argument_count > 1? argument[1] : visible;
} else
visible = inspector;
node.will_setHeight = true;
return self;
} #endregion
@ -1574,9 +1583,13 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
is_anim = anim;
if(is_anim) {
if(ds_list_empty(animator.values))
ds_list_add(animator.values, new valueKey(CURRENT_FRAME, animator.getValue(), animator));
animator.values[| 0].time = CURRENT_FRAME;
for( var i = 0, n = array_length(animators); i < n; i++ ) {
if(ds_list_empty(animators[i].values))
ds_list_add(animators[i].values, new valueKey(CURRENT_FRAME, animators[i].getValue(), animators[i]));
animators[i].values[| 0].time = CURRENT_FRAME;
}
} else {
@ -1903,6 +1916,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
} #endregion
static setString = function(str) { #region
if(connect_type == JUNCTION_CONNECT.output) return;
var _o = animator.getValue();
if(string_pos(",", str) > 0) {

View file

@ -658,11 +658,19 @@ function Panel(_parent, _x, _y, _w, _h) constructor { #region
surface_set_target(content_surface);
draw_clear(COLORS.panel_bg_clear);
if(con) {
min_w = con.min_w;
min_h = con.min_h;
if(tw >= min_w && th >= min_h)
con.draw(self);
else {
draw_set_text(f_p1, fa_center, fa_center, COLORS._main_text_sub);
draw_text(tw / 2, th / 2, "Panel too small for content");
}
} else {
draw_set_text(f_p1, fa_center, fa_center, COLORS._main_text_sub);
draw_text(tw / 2, th / 2, "No content");
}
gpu_set_blendmode(bm_subtract);

View file

@ -830,11 +830,11 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
}
}
#endregion
if(mouse_press(mb_right, pFOCUS)) { #region
node_hover = node_hovering;
if(node_hover) {
if(node_hover && node_hover.draggable) {
var menu = [];
array_push(menu, menu_node_color, -1, menu_sent_to_preview, menu_send_to_window, menu_sent_to_inspector);
if(!DEMO)
@ -856,7 +856,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
array_push(menu, -1, menu_nodes_align, menu_nodes_blend, menu_nodes_compose, menu_nodes_array, menu_nodes_group, menu_nodes_frame);
menuCall("graph_node_selected_multiple_menu",,, menu );
} else {
} else if(node_hover == noone) {
var menu = [];
__junction_hovering = junction_hovering;

View file

@ -50,7 +50,7 @@ function Panel_Graph_Export_Image(targetPanel) : PanelContent() constructor {
widgets[10] = [ "Border Opacity", new textBox(TEXTBOX_INPUT.number, function(val) { settings.borderAlpha = val; refresh(); }),
function() { return settings.borderAlpha } ];
b_export = button(function() {
b_export = button(function() { #region
if(!is_surface(surface)) return;
var path = get_save_filename("*.png", "Screenshot");
@ -59,9 +59,9 @@ function Panel_Graph_Export_Image(targetPanel) : PanelContent() constructor {
if(filename_ext(path) != ".png") path += ".png";
surface_save(surface, path);
noti_status($"Graph image exported at {path}");
});
}); #endregion
sc_settings = new scrollPane(w - ui(padding + padding), h - ui(title_height + padding + 204), function(_y, _m) {
sc_settings = new scrollPane(w - ui(padding + padding), h - ui(title_height + padding + 204), function(_y, _m) { #region
draw_clear_alpha(COLORS.panel_bg_clear, 0);
var _ww = ui(160);
@ -89,13 +89,13 @@ function Panel_Graph_Export_Image(targetPanel) : PanelContent() constructor {
var _h = wh * array_length(widgets) + _hh;
return _h;
})
}); #endregion
function onResize() {
function onResize() { #region
sc_settings.resize(w - ui(padding + padding), h - ui(title_height + padding + 204));
}
} #endregion
function refresh() {
function refresh() { #region
if(is_surface(surface))
surface_free(surface);
surface = noone;
@ -104,9 +104,9 @@ function Panel_Graph_Export_Image(targetPanel) : PanelContent() constructor {
return;
surface = graph_export_image(targetPanel.nodes_list, nodeList, settings);
} refresh();
} refresh(); #endregion
function drawContent(panel) {
function drawContent(panel) { #region
var tx = padding;
var ty = padding;
var sh = 160;
@ -139,17 +139,19 @@ function Panel_Graph_Export_Image(targetPanel) : PanelContent() constructor {
sc_settings.setFocusHover(pFOCUS, pHOVER);
sc_settings.draw(sx, sy, mx - sx, my - sy);
if(is_surface(surface)) {
var txt = __txt("Export") + "...";
draw_set_text(f_p1, fa_left, fa_top, COLORS._main_text);
var _bw = string_width(txt) + ui(32);
var _bh = string_height(txt) + ui(12);
bx = w - padding - _bw;
by = h - padding - _bh;
var txt = __txt("Export") + "...";
draw_set_text(f_p1, fa_left, fa_top, COLORS._main_text);
var _bw = string_width(txt) + ui(32);
var _bh = string_height(txt) + ui(12);
bx = w - padding - _bw;
by = h - padding - _bh;
b_export.setInteract(is_surface(surface));
b_export.setFocusHover(pFOCUS, pHOVER);
b_export.draw(bx, by, _bw, _bh, _m);
b_export.setFocusHover(pFOCUS, pHOVER);
b_export.draw(bx, by, _bw, _bh, _m);
draw_text(bx + ui(16), by + ui(6), txt);
}
}
draw_set_alpha(is_surface(surface) * 0.5 + 0.5);
draw_text(bx + ui(16), by + ui(6), txt);
draw_set_alpha(1);
} #endregion
}

View file

@ -340,9 +340,9 @@ function Panel_Inspector() : PanelContent() constructor {
var byc = by + bh / 2;
draw_sprite_ui(icon, 0, bxc + ui(24), byc,,,, colr);
draw_text_add(bxc + ui(48), byc, txt);
bx += bw + ui(4);
if(buttonInstant(THEME.button_hide, bx, by, bw, bh, _m, pFOCUS, _hover) == 2)
PROJECT.globalNode.createValue();
@ -631,10 +631,12 @@ function Panel_Inspector() : PanelContent() constructor {
if(jun.sepable) array_push(_menuItem, jun.sep_axis? menu_junc_combine_axis : menu_junc_separate_axis);
array_push(_menuItem, -1);
}
array_push(_menuItem, jun.expUse? menu_junc_expression_dis : menu_junc_expression_ena, -1, menu_junc_copy, menu_junc_paste);
if(jun.extract_node != "") {
array_push(_menuItem, jun.expUse? menu_junc_expression_dis : menu_junc_expression_ena, -1, menu_junc_copy);
if(jun.connect_type == JUNCTION_CONNECT.input)
array_push(_menuItem, menu_junc_paste);
if(jun.connect_type == JUNCTION_CONNECT.input && jun.extract_node != "") {
if(is_array(jun.extract_node)) {
var ext = menuItem(__txtx("panel_inspector_extract_multiple", "Extract to..."), function(_dat) {
var arr = [];
@ -723,6 +725,7 @@ function Panel_Inspector() : PanelContent() constructor {
function propSelectPaste() { #region
if(!prop_selecting) return;
prop_selecting.setString(clipboard_get_text());
} #endregion

View file

@ -16,7 +16,8 @@ function Panel_Workspace() : PanelContent() constructor {
var f = file_find_first(DIRECTORY + "layouts/*", 0);
while(f != "") {
array_push(workspaces, filename_name_only(f));
if(filename_ext(f) == ".json")
array_push(workspaces, filename_name_only(f));
f = file_find_next();
}
}

View file

@ -88,6 +88,7 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor
static deactivate = function() { #region
if(WIDGET_CURRENT != self) return;
apply();
WIDGET_CURRENT = noone;
UNDO_HOLDING = false;

View file

@ -76,6 +76,8 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
} #endregion
static deactivate = function() { #region
if(WIDGET_CURRENT != self) return;
apply();
WIDGET_CURRENT = noone;
UNDO_HOLDING = false;