mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2025-01-11 23:06:51 +01:00
y snap
This commit is contained in:
parent
85919c6912
commit
e09089b3b2
15 changed files with 422 additions and 145 deletions
|
@ -1695,6 +1695,7 @@
|
|||
{"name":"s_node_cache","order":27,"path":"sprites/s_node_cache/s_node_cache.yy",},
|
||||
{"name":"s_node_camera_repeat","order":19,"path":"sprites/s_node_camera_repeat/s_node_camera_repeat.yy",},
|
||||
{"name":"s_node_camera","order":3,"path":"sprites/s_node_camera/s_node_camera.yy",},
|
||||
{"name":"s_node_canvas_group","order":39,"path":"sprites/s_node_canvas_group/s_node_canvas_group.yy",},
|
||||
{"name":"s_node_caustic","order":35,"path":"sprites/s_node_caustic/s_node_caustic.yy",},
|
||||
{"name":"s_node_chromatic_abarration","order":10,"path":"sprites/s_node_chromatic_abarration/s_node_chromatic_abarration.yy",},
|
||||
{"name":"s_node_color_adjust","order":1,"path":"sprites/s_node_color_adjust/s_node_color_adjust.yy",},
|
||||
|
|
|
@ -2241,6 +2241,7 @@
|
|||
{"id":{"name":"s_node_cache","path":"sprites/s_node_cache/s_node_cache.yy",},},
|
||||
{"id":{"name":"s_node_camera_repeat","path":"sprites/s_node_camera_repeat/s_node_camera_repeat.yy",},},
|
||||
{"id":{"name":"s_node_camera","path":"sprites/s_node_camera/s_node_camera.yy",},},
|
||||
{"id":{"name":"s_node_canvas_group","path":"sprites/s_node_canvas_group/s_node_canvas_group.yy",},},
|
||||
{"id":{"name":"s_node_canvas","path":"sprites/s_node_canvas/s_node_canvas.yy",},},
|
||||
{"id":{"name":"s_node_caustic","path":"sprites/s_node_caustic/s_node_caustic.yy",},},
|
||||
{"id":{"name":"s_node_character","path":"sprites/s_node_character/s_node_character.yy",},},
|
||||
|
|
Binary file not shown.
|
@ -6,6 +6,8 @@ event_inherited();
|
|||
|
||||
node_target_x = 0;
|
||||
node_target_y = 0;
|
||||
node_target_x_raw = 0;
|
||||
node_target_y_raw = 0;
|
||||
node_called = noone;
|
||||
junction_hovering = noone;
|
||||
|
||||
|
@ -236,12 +238,11 @@ event_inherited();
|
|||
}
|
||||
}
|
||||
} else if(junction_hovering != noone) { //right click on junction
|
||||
var to = junction_hovering;
|
||||
var to = junction_hovering;
|
||||
var from = junction_hovering.value_from;
|
||||
|
||||
|
||||
for( var i = 0; i < ds_list_size(_inputs); i++ ) {
|
||||
var _in = _inputs[| i];
|
||||
|
||||
if(_in.auto_connect && _in.isConnectable(from)) {
|
||||
_in.setFrom(from);
|
||||
break;
|
||||
|
@ -255,6 +256,22 @@ event_inherited();
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(_new_node) {
|
||||
var _fx = from.node.x, _fy = from.node.y;
|
||||
var _tx = to.node.x, _ty = to.node.y;
|
||||
var _ny = node_target_y_raw;
|
||||
|
||||
if(_tx > _fx) {
|
||||
var _rt = abs((_ny - _fy) / (_ty - _fy));
|
||||
|
||||
if(_rt < 0.3) _new_node.y = _fy;
|
||||
else if(_rt > 0.7) {
|
||||
_new_node.y = _ty;
|
||||
// _new_node.x = min(_new_node.x, _tx - _new_node.w - 32);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} #endregion
|
||||
|
||||
|
|
|
@ -162,8 +162,7 @@ function buttonInstant(spr, _x, _y, _w, _h, _m, _act, _hvr, _tip = "", _icon = n
|
|||
} else if(spr)
|
||||
draw_sprite_stretched(spr, 0, _x, _y, _w, _h);
|
||||
|
||||
if(_icon)
|
||||
draw_sprite_ui_uniform(_icon, _icon_index, _x + _w / 2, _y + _h / 2, _icon_scale, cc, _icon_alpha);
|
||||
if(_icon) draw_sprite_ui_uniform(_icon, _icon_index, _x + _w / 2, _y + _h / 2, _icon_scale, cc, _icon_alpha);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -57,6 +57,7 @@ function Node_Canvas(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
|
|||
var _h = 64;
|
||||
_y += 8;
|
||||
|
||||
var _anim = getInputData(12);
|
||||
var _cnt_hover = false;
|
||||
|
||||
draw_sprite_stretched(THEME.button_def, 0, _x, _y, _w, _h);
|
||||
|
@ -66,11 +67,12 @@ function Node_Canvas(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
|
|||
_cnt_hover = _hover;
|
||||
}
|
||||
|
||||
var _ww = _w - 4 - 40;
|
||||
var _hh = _h - 4 - 4;
|
||||
var _aw = ui(32);
|
||||
var _ww = _w - ui(4) - _aw;
|
||||
var _hh = _h - ui(4) - ui(4);
|
||||
|
||||
var _x0 = _x + 4;
|
||||
var _y0 = _y + 4;
|
||||
var _x0 = _x + ui(4);
|
||||
var _y0 = _y + ui(4);
|
||||
var _x1 = _x0 + _ww;
|
||||
var _y1 = _y0 + _hh;
|
||||
|
||||
|
@ -119,7 +121,10 @@ function Node_Canvas(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
|
|||
if(mouse_press(mb_left, _focus))
|
||||
_del = i;
|
||||
} else if(point_in_rectangle(_msx, _msy, _sx, _sy, _sx + _sw * _ss, _sy + _sh * _ss)) {
|
||||
if(mouse_press(mb_left, _focus)) preview_index = i;
|
||||
if(mouse_press(mb_left, _focus)) {
|
||||
if(_anim) PROJECT.animator.setFrame(i);
|
||||
else preview_index = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -141,11 +146,11 @@ function Node_Canvas(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
|
|||
if(mouse_wheel_up()) frame_renderer_x_to = clamp(frame_renderer_x_to - 80, 0, frame_renderer_x_max);
|
||||
}
|
||||
|
||||
var _bs = 32;
|
||||
var _bx = _x1 + ui(20) - _bs / 2;
|
||||
var _bs = _aw - ui(8);
|
||||
var _bx = _x1 + _aw / 2 - _bs / 2;
|
||||
var _by = _y + _h / 2 - _bs / 2;
|
||||
|
||||
if(buttonInstant(THEME.button_hide, _bx, _by, _bs, _bs, _m, _focus, _hover,, THEME.add,, COLORS._main_value_positive) == 2) {
|
||||
if(buttonInstant(THEME.button_hide, _bx, _by, _bs, _bs, _m, _focus, _hover, "", THEME.add_16, 0, COLORS._main_value_positive) == 2) {
|
||||
attributes.frames++;
|
||||
refreshFrames();
|
||||
update();
|
||||
|
|
|
@ -7,6 +7,7 @@ function Node_Canvas_Group(_x, _y, _group) : Node_Collection_Inline(_x, _y, _gro
|
|||
inputs[| 0] = nodeValue("Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, DEF_SURF )
|
||||
.setDisplay(VALUE_DISPLAY.vector);
|
||||
|
||||
layers = {};
|
||||
canvases = [];
|
||||
composite = noone;
|
||||
canvas_sel = noone;
|
||||
|
@ -14,24 +15,23 @@ function Node_Canvas_Group(_x, _y, _group) : Node_Collection_Inline(_x, _y, _gro
|
|||
layer_height = 0;
|
||||
layer_renderer = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus) {
|
||||
var _h = ui(4);
|
||||
var _yy = _y;
|
||||
|
||||
if(composite == noone) return _h;
|
||||
|
||||
composite.canvas_draw = true;
|
||||
composite.canvas_draw = self;
|
||||
var _layer_ren = composite.layer_renderer;
|
||||
_layer_ren.register(layer_renderer.parent);
|
||||
_layer_ren.rx = layer_renderer.rx;
|
||||
_layer_ren.ry = layer_renderer.ry;
|
||||
|
||||
var _yy = _y + _h;
|
||||
var bx = _x;
|
||||
var by = _y;
|
||||
var by = _yy;
|
||||
var bs = ui(24);
|
||||
if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, _focus, _hover, "", THEME.add_16, 0, COLORS._main_value_positive) == 2)
|
||||
layerAdd();
|
||||
|
||||
_h += ui(32);
|
||||
_yy += ui(32);
|
||||
_h += bs + ui(8);
|
||||
_yy += bs + ui(8);
|
||||
|
||||
var _wdh = _layer_ren.draw(_x, _yy, _w, _m, _hover, _focus);
|
||||
if(!is_undefined(_wdh)) _h += _wdh;
|
||||
|
@ -39,8 +39,31 @@ function Node_Canvas_Group(_x, _y, _group) : Node_Collection_Inline(_x, _y, _gro
|
|||
return _h;
|
||||
});
|
||||
|
||||
frame_renderer = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus) {
|
||||
var _h = ui(4);
|
||||
var _yy = _y;
|
||||
|
||||
for (var i = 0, n = array_length(canvases); i < n; i++) {
|
||||
var _canvas = canvases[i];
|
||||
|
||||
var _frame_render = _canvas.frame_renderer;
|
||||
_frame_render.register(frame_renderer.parent);
|
||||
_frame_render.rx = frame_renderer.rx;
|
||||
_frame_render.ry = frame_renderer.ry;
|
||||
|
||||
var _wdh = _frame_render.draw(_x, _yy, _w, _m, _hover, _focus);
|
||||
if(!is_undefined(_wdh)) {
|
||||
_h += _wdh;
|
||||
_yy += _wdh;
|
||||
}
|
||||
}
|
||||
|
||||
return _h;
|
||||
});
|
||||
|
||||
input_display_list = [ 0,
|
||||
["Layers", false], layer_renderer,
|
||||
["Frames", false], frame_renderer,
|
||||
];
|
||||
|
||||
static refreshNodes = function() {
|
||||
|
@ -54,13 +77,61 @@ function Node_Canvas_Group(_x, _y, _group) : Node_Collection_Inline(_x, _y, _gro
|
|||
array_push(canvases, _node);
|
||||
else if(is_instanceof(_node, Node_Composite))
|
||||
composite = _node;
|
||||
|
||||
_node.modifiable = false;
|
||||
_node.modify_parent = self;
|
||||
}
|
||||
|
||||
refreshLayer();
|
||||
}
|
||||
|
||||
static onAddNode = function(node) {
|
||||
static refreshLayer = function() {
|
||||
layers = {};
|
||||
if(composite == noone) return;
|
||||
|
||||
var _amo = composite.getInputAmount();
|
||||
for(var i = 0; i < _amo; i++) {
|
||||
var index = composite.input_fix_len + i * composite.data_length;
|
||||
|
||||
var _can = composite.inputs[| index].value_from;
|
||||
if(_can == noone) continue;
|
||||
|
||||
var _nod = _can.node;
|
||||
var _lay = _can.node;
|
||||
var _modStack = [ _nod ];
|
||||
|
||||
while(!is_instanceof(_nod, Node_Canvas)) {
|
||||
if(_nod.inputs[| 0].type != VALUE_TYPE.surface)
|
||||
break;
|
||||
if(_nod.inputs[| 0].value_from == noone)
|
||||
break;
|
||||
|
||||
_nod = _nod.inputs[| 0].value_from.node;
|
||||
array_push(_modStack, _nod);
|
||||
}
|
||||
|
||||
if(!is_instanceof(_nod, Node_Canvas)) continue;
|
||||
array_pop(_modStack);
|
||||
|
||||
layers[$ _lay.node_id] = {
|
||||
input : _lay,
|
||||
canvas : _nod,
|
||||
modifier : _modStack,
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static onAddNode = function(node) {
|
||||
node.modifiable = false;
|
||||
node.modify_parent = self;
|
||||
refreshNodes();
|
||||
|
||||
if(is_instanceof(node, Node_Canvas))
|
||||
array_push(canvases, node);
|
||||
else if(is_instanceof(node, Node_Composite))
|
||||
composite = node;
|
||||
|
||||
refreshLayer();
|
||||
}
|
||||
|
||||
static layerAdd = function() {
|
||||
|
@ -81,16 +152,30 @@ function Node_Canvas_Group(_x, _y, _group) : Node_Collection_Inline(_x, _y, _gro
|
|||
|
||||
_b += 32;
|
||||
var _canvas = nodeBuild("Node_Canvas", _l, _b);
|
||||
_canvas.inputs[| 12].setValue(true);
|
||||
|
||||
composite.dummy_input.setFrom(_canvas.outputs[| 0]);
|
||||
|
||||
addNode(_canvas);
|
||||
return _canvas;
|
||||
}
|
||||
|
||||
if(NODE_NEW_MANUAL) {
|
||||
var _canvas = nodeBuild("Node_Canvas", x, y);
|
||||
var _compose = nodeBuild("Node_Composite", x + 160, y);
|
||||
static deleteLayer = function(index) {
|
||||
if(composite == noone) return;
|
||||
|
||||
var idx = composite.input_fix_len + index * composite.data_length;
|
||||
var inp = composite.inputs[| idx];
|
||||
var nod = inp.value_from? inp.value_from.node : noone;
|
||||
if(!nod) return;
|
||||
|
||||
nod.destroy();
|
||||
}
|
||||
|
||||
if(NODE_NEW_MANUAL) {
|
||||
var _canvas = nodeBuild("Node_Canvas", x, y);
|
||||
_canvas.inputs[| 12].setValue(true);
|
||||
|
||||
var _compose = nodeBuild("Node_Composite", x + 160, y);
|
||||
_compose.dummy_input.setFrom(_canvas.outputs[| 0]);
|
||||
|
||||
addNode(_canvas);
|
||||
|
@ -110,6 +195,7 @@ function Node_Canvas_Group(_x, _y, _group) : Node_Collection_Inline(_x, _y, _gro
|
|||
canvas_sel = noone;
|
||||
|
||||
if(composite == noone) return;
|
||||
composite.deleteLayer = deleteLayer;
|
||||
|
||||
if(composite.getInputAmount()) {
|
||||
var _ind = composite.surface_selecting;
|
||||
|
@ -117,11 +203,8 @@ function Node_Canvas_Group(_x, _y, _group) : Node_Collection_Inline(_x, _y, _gro
|
|||
_ind = composite.input_fix_len;
|
||||
|
||||
var _can = composite.inputs[| _ind].value_from;
|
||||
|
||||
if(_can) {
|
||||
var _nod = _can.node;
|
||||
canvas_sel = _nod;
|
||||
}
|
||||
if(_can && struct_has(layers, _can.node.node_id))
|
||||
canvas_sel = layers[$ _can.node.node_id].canvas;
|
||||
}
|
||||
|
||||
if(canvas_sel) {
|
||||
|
@ -132,6 +215,10 @@ function Node_Canvas_Group(_x, _y, _group) : Node_Collection_Inline(_x, _y, _gro
|
|||
}
|
||||
}
|
||||
|
||||
static update = function() {
|
||||
refreshLayer();
|
||||
}
|
||||
|
||||
static getPreviewValues = function() { return composite == noone? noone : composite.getPreviewValues(); }
|
||||
|
||||
static postDeserialize = function() {
|
||||
|
|
|
@ -34,7 +34,7 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
|
|||
hold_select = true;
|
||||
layer_dragging = noone;
|
||||
layer_remove = -1;
|
||||
canvas_draw = false;
|
||||
canvas_draw = noone;
|
||||
|
||||
renaming = noone;
|
||||
rename_text = "";
|
||||
|
@ -54,6 +54,7 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
|
|||
tb_rename.font = f_p1;
|
||||
tb_rename.hide = true;
|
||||
|
||||
layer_height = 0;
|
||||
layer_renderer = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus) { #region
|
||||
PROCESSOR_OVERLAY_CHECK
|
||||
|
||||
|
@ -63,13 +64,8 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
|
|||
|
||||
properties_expand = array_verify(properties_expand, amo);
|
||||
var _h = ui(4);
|
||||
for(var i = 0; i < amo; i++)
|
||||
_h += lh + ui(4) + properties_expand[i] * eh;
|
||||
_h = max(ui(16), _h);
|
||||
|
||||
layer_renderer.h = _h;
|
||||
|
||||
draw_sprite_stretched_ext(THEME.ui_panel_bg, 1, _x, _y, _w, _h, COLORS.node_composite_bg_blend, 1);
|
||||
draw_sprite_stretched_ext(THEME.ui_panel_bg, 1, _x, _y, _w, layer_height, COLORS.node_composite_bg_blend, 1);
|
||||
|
||||
var _vis = attributes.layer_visible;
|
||||
var _sel = attributes.layer_selectable;
|
||||
|
@ -86,6 +82,7 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
|
|||
var _surf = current_data[index + 0];
|
||||
var _pos = current_data[index + 1];
|
||||
var _inp = inputs[| index];
|
||||
var _junc = _inp.value_from? _inp.value_from.node : noone;
|
||||
|
||||
var _bx = _x + _w - ui(24);
|
||||
var aa = (ind != layer_dragging || layer_dragging == noone)? 1 : 0.5;
|
||||
|
@ -93,111 +90,174 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
|
|||
var sel = _sel[ind];
|
||||
|
||||
var _exp = properties_expand[i];
|
||||
var _lh = lh + 4 + _exp * eh;
|
||||
var _lh = lh + ui(4) + _exp * eh;
|
||||
_h += _lh;
|
||||
|
||||
if(_exp) { #region extended
|
||||
var _px = _x + ui(4);
|
||||
var _py = _cy + lh + ui(4);
|
||||
var _pw = _w - ui(8);
|
||||
var _ph = eh - ui(4);
|
||||
|
||||
var _pww = (_pw - ui(8)) / 2 - ui(8);
|
||||
var _pwh = _ph - ui(8);
|
||||
|
||||
draw_sprite_stretched_ext(THEME.ui_panel_bg, 0, _px, _py, _pw, _ph, COLORS.node_composite_bg_blend, 1);
|
||||
|
||||
var jn_bld = inputs[| index + 4];
|
||||
var jn_alp = inputs[| index + 5];
|
||||
|
||||
var wd_bld = jn_bld.editWidget;
|
||||
var wd_alp = jn_alp.editWidget;
|
||||
|
||||
var _param = new widgetParam(_px + ui(4), _py + ui(4), _pww, _pwh, jn_bld.showValue(), jn_bld.display_data, _m, layer_renderer.rx, layer_renderer.ry);
|
||||
_param.font = f_p2;
|
||||
|
||||
wd_bld.setFocusHover(_focus, _hover);
|
||||
wd_bld.drawParam(_param);
|
||||
|
||||
var _param = new widgetParam(_px + ui(4) + _pww + ui(8), _py + ui(4), _pww, _pwh, jn_alp.showValue(), jn_alp.display_data, _m, layer_renderer.rx, layer_renderer.ry);
|
||||
_param.font = f_p2;
|
||||
|
||||
wd_alp.setFocusHover(_focus, _hover);
|
||||
wd_alp.drawParam(_param);
|
||||
} #endregion
|
||||
|
||||
if(point_in_circle(_m[0], _m[1], _bx, _cy + lh / 2, ui(16))) {
|
||||
draw_sprite_ui_uniform(THEME.icon_delete, 3, _bx, _cy + lh / 2, 1, COLORS._main_value_negative);
|
||||
|
||||
if(mouse_press(mb_left, _focus))
|
||||
layer_remove = ind;
|
||||
} else
|
||||
draw_sprite_ui_uniform(THEME.icon_delete, 3, _bx, _cy + lh / 2, 1, COLORS._main_icon);
|
||||
|
||||
if(!is_surface(_surf)) continue;
|
||||
|
||||
var _bx = _x + ui(16 + 24);
|
||||
if(point_in_circle(_m[0], _m[1], _bx, _cy + lh / 2, ui(12))) {
|
||||
draw_sprite_ui_uniform(THEME.junc_visible, vis, _bx, _cy + lh / 2, 1, c_white);
|
||||
|
||||
if(mouse_press(mb_left, _focus))
|
||||
hold_visibility = !_vis[ind];
|
||||
#region extended
|
||||
if(_exp) {
|
||||
var _px = _x + ui(4);
|
||||
var _py = _cy + lh + ui(4);
|
||||
var _pw = _w - ui(8);
|
||||
var _ph = eh - ui(4);
|
||||
|
||||
if(mouse_click(mb_left, _focus) && _vis[ind] != hold_visibility) {
|
||||
_vis[ind] = hold_visibility;
|
||||
doUpdate();
|
||||
var _pww = (_pw - ui(8)) / 2 - ui(8);
|
||||
var _pwh = _ph - ui(8);
|
||||
|
||||
draw_sprite_stretched_ext(THEME.ui_panel_bg, 0, _px, _py, _pw, _ph, COLORS.node_composite_bg_blend, 1);
|
||||
|
||||
var jn_bld = inputs[| index + 4];
|
||||
var jn_alp = inputs[| index + 5];
|
||||
|
||||
var wd_bld = jn_bld.editWidget;
|
||||
var wd_alp = jn_alp.editWidget;
|
||||
|
||||
var _param = new widgetParam(_px + ui(4), _py + ui(4), _pww, _pwh, jn_bld.showValue(), jn_bld.display_data, _m, layer_renderer.rx, layer_renderer.ry);
|
||||
_param.font = f_p2;
|
||||
|
||||
wd_bld.setFocusHover(_focus, _hover);
|
||||
wd_bld.drawParam(_param);
|
||||
|
||||
var _param = new widgetParam(_px + ui(4) + _pww + ui(8), _py + ui(4), _pww, _pwh, jn_alp.showValue(), jn_alp.display_data, _m, layer_renderer.rx, layer_renderer.ry);
|
||||
_param.font = f_p2;
|
||||
|
||||
wd_alp.setFocusHover(_focus, _hover);
|
||||
wd_alp.drawParam(_param);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region draw buttons
|
||||
if(point_in_circle(_m[0], _m[1], _bx, _cy + lh / 2, ui(16))) {
|
||||
draw_sprite_ui_uniform(THEME.icon_delete, 3, _bx, _cy + lh / 2, 1, COLORS._main_value_negative);
|
||||
|
||||
if(mouse_press(mb_left, _focus))
|
||||
layer_remove = ind;
|
||||
} else
|
||||
draw_sprite_ui_uniform(THEME.icon_delete, 3, _bx, _cy + lh / 2, 1, COLORS._main_icon);
|
||||
|
||||
if(!is_surface(_surf)) continue;
|
||||
|
||||
var _bx = _x + ui(16 + 24);
|
||||
if(point_in_circle(_m[0], _m[1], _bx, _cy + lh / 2, ui(12))) {
|
||||
draw_sprite_ui_uniform(THEME.junc_visible, vis, _bx, _cy + lh / 2, 1, c_white);
|
||||
|
||||
if(mouse_press(mb_left, _focus))
|
||||
hold_visibility = !_vis[ind];
|
||||
|
||||
if(mouse_click(mb_left, _focus) && _vis[ind] != hold_visibility) {
|
||||
_vis[ind] = hold_visibility;
|
||||
doUpdate();
|
||||
}
|
||||
} else
|
||||
draw_sprite_ui_uniform(THEME.junc_visible, vis, _bx, _cy + lh / 2, 1, COLORS._main_icon, 0.5 + 0.5 * vis);
|
||||
|
||||
_bx += ui(12 + 1 + 12);
|
||||
if(point_in_circle(_m[0], _m[1], _bx, _cy + lh / 2, ui(12))) {
|
||||
draw_sprite_ui_uniform(THEME.cursor_select, sel, _bx, _cy + lh / 2, 1, c_white);
|
||||
|
||||
if(mouse_press(mb_left, _focus))
|
||||
hold_select = !_sel[ind];
|
||||
|
||||
if(mouse_click(mb_left, _focus) && _sel[ind] != hold_select)
|
||||
_sel[ind] = hold_select;
|
||||
} else
|
||||
draw_sprite_ui_uniform(THEME.cursor_select, sel, _bx, _cy + lh / 2, 1, COLORS._main_icon, 0.5 + 0.5 * sel);
|
||||
|
||||
var hover = point_in_rectangle(_m[0], _m[1], _bx + ui(12 + 6), _cy, _x + _w - ui(48), _cy + lh - 1);
|
||||
#endregion
|
||||
|
||||
#region draw surface
|
||||
var _sx0 = _bx + ui(12 + 6);
|
||||
var _sx1 = _sx0 + ssh;
|
||||
var _sy0 = _cy + ui(3);
|
||||
var _sy1 = _sy0 + ssh;
|
||||
|
||||
var _ssw = surface_get_width_safe(_surf);
|
||||
var _ssh = surface_get_height_safe(_surf);
|
||||
var _sss = min(ssh / _ssw, ssh / _ssh);
|
||||
draw_surface_ext_safe(_surf, _sx0, _sy0, _sss, _sss, 0, c_white, 1);
|
||||
|
||||
if(surface_selecting == index) draw_sprite_stretched_add(THEME.menu_button_mask, 1, _sx0, _sy0, ssh, ssh, COLORS._main_accent, 1);
|
||||
else draw_sprite_stretched_add(THEME.menu_button_mask, 1, _sx0, _sy0, ssh, ssh, COLORS._main_icon, 0.3);
|
||||
#endregion
|
||||
|
||||
#region layers
|
||||
var _junc_canvas = noone;
|
||||
var _jun_layer = noone;
|
||||
if(canvas_draw != noone && _junc && struct_has(canvas_draw.layers, _junc.node_id)) {
|
||||
_jun_layer = canvas_draw.layers[$ _junc.node_id];
|
||||
_junc_canvas = _jun_layer.canvas;
|
||||
}
|
||||
} else
|
||||
draw_sprite_ui_uniform(THEME.junc_visible, vis, _bx, _cy + lh / 2, 1, COLORS._main_icon, 0.5 + 0.5 * vis);
|
||||
#endregion
|
||||
|
||||
_bx += ui(12 + 1 + 12);
|
||||
if(point_in_circle(_m[0], _m[1], _bx, _cy + lh / 2, ui(12))) {
|
||||
draw_sprite_ui_uniform(THEME.cursor_select, sel, _bx, _cy + lh / 2, 1, c_white);
|
||||
#region draw title
|
||||
draw_set_text(f_p1, fa_left, fa_center, hover? COLORS._main_text_accent : COLORS._main_text);
|
||||
var _txt = _inp.name;
|
||||
var _txx = _sx1 + ui(12);
|
||||
var _txy = _cy + lh / 2 + ui(2);
|
||||
|
||||
if(mouse_press(mb_left, _focus))
|
||||
hold_select = !_sel[ind];
|
||||
if(canvas_draw != noone && _junc_canvas)
|
||||
_txt = _junc_canvas.display_name;
|
||||
|
||||
if(renaming_index == index) {
|
||||
tb_rename.setFocusHover(_focus, _hover);
|
||||
tb_rename.draw(_txx, _cy, _w - ui(172), lh, rename_text, _m);
|
||||
|
||||
} else {
|
||||
var _txw = string_width(_txt);
|
||||
var _txh = string_height(_txt);
|
||||
|
||||
if(mouse_click(mb_left, _focus) && _sel[ind] != hold_select)
|
||||
_sel[ind] = hold_select;
|
||||
} else
|
||||
draw_sprite_ui_uniform(THEME.cursor_select, sel, _bx, _cy + lh / 2, 1, COLORS._main_icon, 0.5 + 0.5 * sel);
|
||||
if(_junc_canvas) {
|
||||
draw_sprite_ui_uniform(THEME.icon_canvas, 0, _txx + ui(12), _txy - ui(1), 1, COLORS._main_icon, aa * .8);
|
||||
|
||||
draw_set_alpha(aa);
|
||||
draw_text(_txx + ui(28), _txy, _txt);
|
||||
draw_set_alpha(1);
|
||||
} else {
|
||||
draw_set_alpha(aa);
|
||||
draw_text(_txx, _txy, _txt);
|
||||
draw_set_alpha(1);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
var hover = point_in_rectangle(_m[0], _m[1], _bx + ui(12 + 6), _cy, _x + _w - ui(48), _cy + lh - 1);
|
||||
|
||||
var _sx0 = _bx + ui(12 + 6);
|
||||
var _sx1 = _sx0 + ssh;
|
||||
var _sy0 = _cy + ui(3);
|
||||
var _sy1 = _sy0 + ssh;
|
||||
|
||||
var _ssw = surface_get_width_safe(_surf);
|
||||
var _ssh = surface_get_height_safe(_surf);
|
||||
var _sss = min(ssh / _ssw, ssh / _ssh);
|
||||
draw_surface_ext_safe(_surf, _sx0, _sy0, _sss, _sss, 0, c_white, 1);
|
||||
|
||||
draw_set_text(f_p1, fa_left, fa_center, hover? COLORS._main_text_accent : COLORS._main_text);
|
||||
var _txt = _inp.name;
|
||||
|
||||
if(canvas_draw) {
|
||||
if(_inp.value_from && is_instanceof(_inp.value_from.node, Node_Canvas))
|
||||
_txt = _inp.value_from.node.display_name;
|
||||
}
|
||||
|
||||
var _txx = _sx1 + ui(12);
|
||||
var _txy = _cy + lh / 2 + ui(2);
|
||||
|
||||
if(renaming_index == index) {
|
||||
tb_rename.setFocusHover(_focus, _hover);
|
||||
tb_rename.draw(_txx, _cy, _w - ui(172), lh, rename_text, _m);
|
||||
|
||||
} else {
|
||||
var _txw = string_width(_txt);
|
||||
var _txh = string_height(_txt);
|
||||
draw_set_alpha(aa);
|
||||
draw_text(_txx, _txy, _txt);
|
||||
draw_set_alpha(1);
|
||||
|
||||
if(surface_selecting == index)
|
||||
draw_sprite_stretched_add(THEME.menu_button_mask, 1, _txx - ui(8), _txy - _txh / 2 - ui(2), _txw + ui(16), _txh + ui(4), COLORS._main_icon, 0.3);
|
||||
}
|
||||
#region modifiers
|
||||
if(_jun_layer) {
|
||||
var _modis = _jun_layer.modifier;
|
||||
var _mdx = _txx - ui(23);
|
||||
var _mdy = _cy + _lh;
|
||||
var mh = ui(24);
|
||||
|
||||
for (var j = array_length(_modis) - 1; j >= 0; j--) {
|
||||
var _modi = _modis[j];
|
||||
var _mtx = _mdx;
|
||||
|
||||
if(_modi.active_index != -1) {
|
||||
var _bx = _mtx + ui(12);
|
||||
var _by = _mdy + mh / 2;
|
||||
|
||||
var _acti = _modi.inputs[| _modi.active_index].getValue();
|
||||
|
||||
if(_hover && point_in_circle(_m[0], _m[1], _bx, _by, ui(12))) {
|
||||
draw_sprite_ui_uniform(THEME.visible_12, _acti, _bx, _by - ui(2), 1, c_white);
|
||||
|
||||
if(mouse_press(mb_left, _focus))
|
||||
_modi.inputs[| _modi.active_index].setValue(!_acti);
|
||||
} else
|
||||
draw_sprite_ui_uniform(THEME.visible_12, _acti, _bx, _by - ui(2), 1, COLORS._main_icon);
|
||||
|
||||
}
|
||||
|
||||
_mtx += ui(24);
|
||||
var _mhov = _hover && point_in_rectangle(_m[0], _m[1], _mtx, _mdy, _x + _w, _mdy + mh - 1);
|
||||
draw_set_text(f_p2, fa_left, fa_center, _mhov? COLORS._main_text : COLORS._main_text_sub);
|
||||
draw_text_add(_mtx, _mdy + mh / 2 - ui(2), _modi.display_name);
|
||||
|
||||
_h += mh;
|
||||
_lh += mh;
|
||||
_mdy += mh;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
if(_hover && point_in_rectangle(_m[0], _m[1], _x, _cy, _x + _w, _cy + lh)) {
|
||||
hoverIndex = ind;
|
||||
|
@ -227,8 +287,8 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
|
|||
renaming = index;
|
||||
rename_text = _txt;
|
||||
|
||||
if(canvas_draw && _inp.value_from && is_instanceof(_inp.value_from.node, Node_Canvas))
|
||||
renaming = _inp.value_from.node;
|
||||
if(canvas_draw != noone && _junc_canvas)
|
||||
renaming = _junc_canvas;
|
||||
|
||||
tb_rename._current_text = _txt;
|
||||
tb_rename.activate();
|
||||
|
@ -273,7 +333,10 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
|
|||
layer_dragging = noone;
|
||||
}
|
||||
|
||||
return _h;
|
||||
layer_height = max(ui(16), _h);
|
||||
layer_renderer.h = layer_height;
|
||||
|
||||
return layer_height;
|
||||
}); #endregion
|
||||
|
||||
input_display_list = [
|
||||
|
@ -646,6 +709,9 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
|
|||
var _dim_type = getSingleValue(1);
|
||||
|
||||
inputs[| 2].setVisible(_dim_type == COMPOSE_OUTPUT_SCALING.constant);
|
||||
|
||||
if(canvas_draw != noone && surface_selecting == noone && getInputAmount())
|
||||
surface_selecting = input_fix_len;
|
||||
} #endregion
|
||||
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
|
||||
|
|
|
@ -40,6 +40,8 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
|||
|
||||
modifiable = true;
|
||||
modify_parent = noone;
|
||||
|
||||
onDoubleClick = -1;
|
||||
#endregion
|
||||
|
||||
static resetInternalName = function() { #region
|
||||
|
|
|
@ -490,7 +490,7 @@ function __initNodes() {
|
|||
addNodeCatagory("IO", input);
|
||||
ds_list_add(input, "Images");
|
||||
addNodeObject(input, "Canvas", s_node_canvas, "Node_Canvas", [1, Node_Canvas], ["draw"], "Draw on surface using brush, eraser, etc.");
|
||||
addNodeObject(input, "Canvas Group", s_node_canvas, "Node_Canvas_Group", [1, Node_Canvas_Group]);
|
||||
addNodeObject(input, "Canvas Group", s_node_canvas_group, "Node_Canvas_Group", [1, Node_Canvas_Group]).setVersion(11740);
|
||||
addNodeObject(input, "Active Canvas", s_node_active_canvas, "Node_Active_Canvas", [1, Node_Active_Canvas], ["draw"], "Draw using parameterized brush.").setVersion(11570);
|
||||
addNodeObject(input, "Image", s_node_image, "Node_Image", [0, Node_create_Image],, "Load a single image from your computer.");
|
||||
addNodeObject(input, "Image GIF", s_node_image_gif, "Node_Image_gif", [0, Node_create_Image_gif],, "Load animated .gif from your computer.");
|
||||
|
|
|
@ -1043,14 +1043,15 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
for(var i = 0; i < array_length(nodes_list); i++) {
|
||||
var _node = nodes_list[i];
|
||||
_node.branch_drawing = false;
|
||||
|
||||
if(_node.pointIn(gr_x, gr_y, mx, my, graph_s))
|
||||
node_hovering = _node.modify_parent == noone? _node : _node.modify_parent;
|
||||
node_hovering = _node;
|
||||
}
|
||||
|
||||
if(node_hovering != noone)
|
||||
_HOVERING_ELEMENT = node_hovering;
|
||||
|
||||
if(node_hovering != noone && _focus && DOUBLE_CLICK && struct_has(node_hovering, "onDoubleClick")) {
|
||||
if(node_hovering != noone && _focus && DOUBLE_CLICK && node_hovering.onDoubleClick != -1) {
|
||||
|
||||
if(node_hovering.onDoubleClick(self)) {
|
||||
DOUBLE_CLICK = false;
|
||||
|
@ -1111,6 +1112,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
}
|
||||
} else if(DOUBLE_CLICK) {
|
||||
PANEL_PREVIEW.setNodePreview(node_hovering);
|
||||
|
||||
if(PREFERENCES.inspector_focus_on_double_click) {
|
||||
if(PANEL_INSPECTOR.panel && struct_has(PANEL_INSPECTOR.panel, "switchContent"))
|
||||
PANEL_INSPECTOR.panel.switchContent(PANEL_INSPECTOR);
|
||||
|
@ -1252,6 +1254,9 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
|
||||
if(is_instanceof(frame_hovering, Node_Collection_Inline) && DOUBLE_CLICK && array_empty(nodes_selecting)) { #region
|
||||
nodes_selecting = [ frame_hovering ];
|
||||
|
||||
if(frame_hovering.onDoubleClick != -1) frame_hovering.onDoubleClick(self)
|
||||
if(frame_hovering.previewable) PANEL_PREVIEW.setNodePreview(frame_hovering);
|
||||
} #endregion
|
||||
}
|
||||
#endregion
|
||||
|
@ -1561,9 +1566,11 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
ctx = value_dragging.node.inline_context;
|
||||
|
||||
with(dialogCall(o_dialog_add_node, mouse_mx + 8, mouse_my + 8, { context: ctx })) {
|
||||
node_target_x = other.mouse_grid_x;
|
||||
node_target_y = other.mouse_grid_y;
|
||||
node_called = other.value_dragging;
|
||||
node_target_x = other.mouse_grid_x;
|
||||
node_target_y = other.mouse_grid_y;
|
||||
node_target_x_raw = other.mouse_grid_x;
|
||||
node_target_y_raw = other.mouse_grid_y;
|
||||
node_called = other.value_dragging;
|
||||
|
||||
alarm[0] = 1;
|
||||
}
|
||||
|
@ -1761,6 +1768,8 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
with(_dia) {
|
||||
node_target_x = other.mouse_grid_x;
|
||||
node_target_y = other.mouse_grid_y;
|
||||
node_target_x_raw = other.mouse_grid_x;
|
||||
node_target_y_raw = other.mouse_grid_y;
|
||||
junction_hovering = other.junction_hovering;
|
||||
|
||||
resetPosition();
|
||||
|
|
|
@ -1897,8 +1897,8 @@ function Panel_Preview() : PanelContent() constructor {
|
|||
|
||||
function drawContent(panel) { #region >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> MAIN DRAW <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
||||
mouse_on_preview = pHOVER && point_in_rectangle(mx, my, 0, topbar_height, w, h - toolbar_height);
|
||||
|
||||
if(do_fullView) fullView();
|
||||
|
||||
if(do_fullView) run_in(1, fullView);
|
||||
do_fullView = false;
|
||||
|
||||
var _prev_node = getNodePreview();
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
90
sprites/s_node_canvas_group/s_node_canvas_group.yy
Normal file
90
sprites/s_node_canvas_group/s_node_canvas_group.yy
Normal file
|
@ -0,0 +1,90 @@
|
|||
{
|
||||
"$GMSprite":"",
|
||||
"%Name":"s_node_canvas_group",
|
||||
"bboxMode":0,
|
||||
"bbox_bottom":63,
|
||||
"bbox_left":2,
|
||||
"bbox_right":63,
|
||||
"bbox_top":2,
|
||||
"collisionKind":1,
|
||||
"collisionTolerance":0,
|
||||
"DynamicTexturePage":false,
|
||||
"edgeFiltering":false,
|
||||
"For3D":false,
|
||||
"frames":[
|
||||
{"$GMSpriteFrame":"","%Name":"f9dbf063-7abe-47a2-bc35-983ff7f9e83e","name":"f9dbf063-7abe-47a2-bc35-983ff7f9e83e","resourceType":"GMSpriteFrame","resourceVersion":"2.0",},
|
||||
],
|
||||
"gridX":0,
|
||||
"gridY":0,
|
||||
"height":64,
|
||||
"HTile":false,
|
||||
"layers":[
|
||||
{"$GMImageLayer":"","%Name":"6c3c616c-af55-430e-99da-29a0fd5aab17","blendMode":0,"displayName":"default","isLocked":false,"name":"6c3c616c-af55-430e-99da-29a0fd5aab17","opacity":100.0,"resourceType":"GMImageLayer","resourceVersion":"2.0","visible":true,},
|
||||
],
|
||||
"name":"s_node_canvas_group",
|
||||
"nineSlice":null,
|
||||
"origin":4,
|
||||
"parent":{
|
||||
"name":"IO",
|
||||
"path":"folders/nodes/icons/IO.yy",
|
||||
},
|
||||
"preMultiplyAlpha":false,
|
||||
"resourceType":"GMSprite",
|
||||
"resourceVersion":"2.0",
|
||||
"sequence":{
|
||||
"$GMSequence":"",
|
||||
"%Name":"s_node_canvas_group",
|
||||
"autoRecord":true,
|
||||
"backdropHeight":768,
|
||||
"backdropImageOpacity":0.5,
|
||||
"backdropImagePath":"",
|
||||
"backdropWidth":1366,
|
||||
"backdropXOffset":0.0,
|
||||
"backdropYOffset":0.0,
|
||||
"events":{
|
||||
"$KeyframeStore<MessageEventKeyframe>":"",
|
||||
"Keyframes":[],
|
||||
"resourceType":"KeyframeStore<MessageEventKeyframe>",
|
||||
"resourceVersion":"2.0",
|
||||
},
|
||||
"eventStubScript":null,
|
||||
"eventToFunction":{},
|
||||
"length":1.0,
|
||||
"lockOrigin":false,
|
||||
"moments":{
|
||||
"$KeyframeStore<MomentsEventKeyframe>":"",
|
||||
"Keyframes":[],
|
||||
"resourceType":"KeyframeStore<MomentsEventKeyframe>",
|
||||
"resourceVersion":"2.0",
|
||||
},
|
||||
"name":"s_node_canvas_group",
|
||||
"playback":1,
|
||||
"playbackSpeed":30.0,
|
||||
"playbackSpeedType":0,
|
||||
"resourceType":"GMSequence",
|
||||
"resourceVersion":"2.0",
|
||||
"showBackdrop":true,
|
||||
"showBackdropImage":false,
|
||||
"timeUnits":1,
|
||||
"tracks":[
|
||||
{"$GMSpriteFramesTrack":"","builtinName":0,"events":[],"inheritsTrackColour":true,"interpolation":1,"isCreationTrack":false,"keyframes":{"$KeyframeStore<SpriteFrameKeyframe>":"","Keyframes":[
|
||||
{"$Keyframe<SpriteFrameKeyframe>":"","Channels":{
|
||||
"0":{"$SpriteFrameKeyframe":"","Id":{"name":"f9dbf063-7abe-47a2-bc35-983ff7f9e83e","path":"sprites/s_node_canvas_group/s_node_canvas_group.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},
|
||||
},"Disabled":false,"id":"0ff72cb6-ecd8-47ca-a671-b475834f3bdd","IsCreationKey":false,"Key":0.0,"Length":1.0,"resourceType":"Keyframe<SpriteFrameKeyframe>","resourceVersion":"2.0","Stretch":false,},
|
||||
],"resourceType":"KeyframeStore<SpriteFrameKeyframe>","resourceVersion":"2.0",},"modifiers":[],"name":"frames","resourceType":"GMSpriteFramesTrack","resourceVersion":"2.0","spriteId":null,"trackColour":0,"tracks":[],"traits":0,},
|
||||
],
|
||||
"visibleRange":null,
|
||||
"volume":1.0,
|
||||
"xorigin":32,
|
||||
"yorigin":32,
|
||||
},
|
||||
"swatchColours":null,
|
||||
"swfPrecision":0.5,
|
||||
"textureGroupId":{
|
||||
"name":"Default",
|
||||
"path":"texturegroups/Default",
|
||||
},
|
||||
"type":0,
|
||||
"VTile":false,
|
||||
"width":64,
|
||||
}
|
Loading…
Reference in a new issue