mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2025-01-23 11:28:06 +01:00
[Canvas] Add corner tool.
This commit is contained in:
parent
cc296a4cd2
commit
11de0da99f
19 changed files with 495 additions and 121 deletions
|
@ -12,6 +12,11 @@
|
|||
{"name":"SNAP","order":17,"path":"folders/_extensions/SNAP.yy",},
|
||||
{"name":"XML","order":1,"path":"folders/_extensions/SNAP/XML.yy",},
|
||||
{"name":"WinMan","order":5,"path":"folders/_extensions/WinMan.yy",},
|
||||
{"name":"addons","order":1,"path":"folders/addons.yy",},
|
||||
{"name":"animation_curve","order":2,"path":"folders/animation_curve.yy",},
|
||||
{"name":"dialog","order":3,"path":"folders/dialog.yy",},
|
||||
{"name":"font","order":4,"path":"folders/font.yy",},
|
||||
{"name":"functions","order":5,"path":"folders/functions.yy",},
|
||||
{"name":"camera","order":7,"path":"folders/functions/3d/camera.yy",},
|
||||
{"name":"gizmo","order":8,"path":"folders/functions/3d/gizmo.yy",},
|
||||
{"name":"light","order":9,"path":"folders/functions/3d/light.yy",},
|
||||
|
@ -26,6 +31,9 @@
|
|||
{"name":"Shaders","order":8,"path":"folders/functions/fluid_sim/Shaders.yy",},
|
||||
{"name":"dynamic_surface","order":8,"path":"folders/functions/surface/dynamic_surface.yy",},
|
||||
{"name":"svg","order":47,"path":"folders/functions/svg.yy",},
|
||||
{"name":"main","order":6,"path":"folders/main.yy",},
|
||||
{"name":"misc","order":7,"path":"folders/misc.yy",},
|
||||
{"name":"nodes","order":8,"path":"folders/nodes.yy",},
|
||||
{"name":"__base__","order":11,"path":"folders/nodes/data/__base__.yy",},
|
||||
{"name":"collections","order":21,"path":"folders/nodes/data/__base__/collections.yy",},
|
||||
{"name":"values","order":20,"path":"folders/nodes/data/__base__/values.yy",},
|
||||
|
@ -134,10 +142,12 @@
|
|||
{"name":"surface","order":7,"path":"folders/nodes/icons/value/surface.yy",},
|
||||
{"name":"texts","order":8,"path":"folders/nodes/icons/value/texts.yy",},
|
||||
{"name":"VFX","order":16,"path":"folders/nodes/icons/VFX.yy",},
|
||||
{"name":"panels","order":9,"path":"folders/panels.yy",},
|
||||
{"name":"video_banner","order":11,"path":"folders/panels/_others/video_banner.yy",},
|
||||
{"name":"components","order":3,"path":"folders/panels/inspectors/components.yy",},
|
||||
{"name":"overlay","order":6,"path":"folders/panels/preview/overlay.yy",},
|
||||
{"name":"sprites","order":7,"path":"folders/panels/preview/sprites.yy",},
|
||||
{"name":"shader","order":10,"path":"folders/shader.yy",},
|
||||
{"name":"3d","order":1,"path":"folders/shader/3d.yy",},
|
||||
{"name":"2d effect","order":12,"path":"folders/shader/3d/2d effect.yy",},
|
||||
{"name":"legacy","order":13,"path":"folders/shader/3d/legacy.yy",},
|
||||
|
@ -189,6 +199,10 @@
|
|||
{"name":"histogram","order":3,"path":"folders/shader/UI/histogram.yy",},
|
||||
{"name":"node","order":5,"path":"folders/shader/UI/node.yy",},
|
||||
{"name":"palette mixer","order":2,"path":"folders/shader/UI/palette mixer.yy",},
|
||||
{"name":"sprites","order":11,"path":"folders/sprites.yy",},
|
||||
{"name":"Steamworks","order":12,"path":"folders/Steamworks.yy",},
|
||||
{"name":"VCT","order":13,"path":"folders/VCT.yy",},
|
||||
{"name":"widgets","order":14,"path":"folders/widgets.yy",},
|
||||
],
|
||||
"ResourceOrderSettings":[
|
||||
{"name":"ac_disappear","order":2,"path":"animcurves/ac_disappear/ac_disappear.yy",},
|
||||
|
@ -400,6 +414,7 @@
|
|||
{"name":"canvas_freeform","order":3,"path":"scripts/canvas_freeform/canvas_freeform.yy",},
|
||||
{"name":"canvas_magic_selection_functions","order":4,"path":"scripts/canvas_magic_selection_functions/canvas_magic_selection_functions.yy",},
|
||||
{"name":"canvas_tool_brush_shape","order":3,"path":"scripts/canvas_tool_brush_shape/canvas_tool_brush_shape.yy",},
|
||||
{"name":"canvas_tool_corner","order":7,"path":"scripts/canvas_tool_corner/canvas_tool_corner.yy",},
|
||||
{"name":"canvas_tool_curve","order":14,"path":"scripts/canvas_tool_curve/canvas_tool_curve.yy",},
|
||||
{"name":"canvas_tool_draw_freeform","order":5,"path":"scripts/canvas_tool_draw_freeform/canvas_tool_draw_freeform.yy",},
|
||||
{"name":"canvas_tool_extrude","order":1,"path":"scripts/canvas_tool_extrude/canvas_tool_extrude.yy",},
|
||||
|
@ -1328,6 +1343,7 @@
|
|||
{"name":"sh_brush_outline","order":7,"path":"shaders/sh_brush_outline/sh_brush_outline.yy",},
|
||||
{"name":"sh_bw","order":3,"path":"shaders/sh_bw/sh_bw.yy",},
|
||||
{"name":"sh_canvas_apply_draw","order":3,"path":"shaders/sh_canvas_apply_draw/sh_canvas_apply_draw.yy",},
|
||||
{"name":"sh_canvas_corner","order":5,"path":"shaders/sh_canvas_corner/sh_canvas_corner.yy",},
|
||||
{"name":"sh_canvas_extrude","order":1,"path":"shaders/sh_canvas_extrude/sh_canvas_extrude.yy",},
|
||||
{"name":"sh_canvas_inset","order":2,"path":"shaders/sh_canvas_inset/sh_canvas_inset.yy",},
|
||||
{"name":"sh_canvas_skew","order":4,"path":"shaders/sh_canvas_skew/sh_canvas_skew.yy",},
|
||||
|
|
|
@ -741,6 +741,7 @@
|
|||
{"id":{"name":"canvas_magic_selection_functions","path":"scripts/canvas_magic_selection_functions/canvas_magic_selection_functions.yy",},},
|
||||
{"id":{"name":"canvas_tool_brush_shape","path":"scripts/canvas_tool_brush_shape/canvas_tool_brush_shape.yy",},},
|
||||
{"id":{"name":"canvas_tool_brush","path":"scripts/canvas_tool_brush/canvas_tool_brush.yy",},},
|
||||
{"id":{"name":"canvas_tool_corner","path":"scripts/canvas_tool_corner/canvas_tool_corner.yy",},},
|
||||
{"id":{"name":"canvas_tool_curve","path":"scripts/canvas_tool_curve/canvas_tool_curve.yy",},},
|
||||
{"id":{"name":"canvas_tool_draw_freeform","path":"scripts/canvas_tool_draw_freeform/canvas_tool_draw_freeform.yy",},},
|
||||
{"id":{"name":"canvas_tool_extrude","path":"scripts/canvas_tool_extrude/canvas_tool_extrude.yy",},},
|
||||
|
@ -1815,6 +1816,7 @@
|
|||
{"id":{"name":"sh_bw","path":"shaders/sh_bw/sh_bw.yy",},},
|
||||
{"id":{"name":"sh_camera","path":"shaders/sh_camera/sh_camera.yy",},},
|
||||
{"id":{"name":"sh_canvas_apply_draw","path":"shaders/sh_canvas_apply_draw/sh_canvas_apply_draw.yy",},},
|
||||
{"id":{"name":"sh_canvas_corner","path":"shaders/sh_canvas_corner/sh_canvas_corner.yy",},},
|
||||
{"id":{"name":"sh_canvas_extrude","path":"shaders/sh_canvas_extrude/sh_canvas_extrude.yy",},},
|
||||
{"id":{"name":"sh_canvas_inset","path":"shaders/sh_canvas_inset/sh_canvas_inset.yy",},},
|
||||
{"id":{"name":"sh_canvas_mask","path":"shaders/sh_canvas_mask/sh_canvas_mask.yy",},},
|
||||
|
|
Binary file not shown.
|
@ -149,7 +149,10 @@
|
|||
function checkFocus() {
|
||||
if(!active) return;
|
||||
|
||||
if(point_in(mouse_mx, mouse_my)) {
|
||||
var _mx = FILE_IS_DROPPING? FILE_DROPPING_X : mouse_mx;
|
||||
var _my = FILE_IS_DROPPING? FILE_DROPPING_Y : mouse_my;
|
||||
|
||||
if(point_in(_mx, _my)) {
|
||||
if(depth < DIALOG_DEPTH_HOVER) {
|
||||
DIALOG_DEPTH_HOVER = depth;
|
||||
HOVER = self.id;
|
||||
|
|
|
@ -131,109 +131,13 @@
|
|||
file_dnd_allowmulti = true;
|
||||
}
|
||||
|
||||
drop_path = [];
|
||||
globalvar FILE_IS_DROPPING, FILE_DROPPING_X, FILE_DROPPING_Y, FILE_DROPPING, FILE_DROPPED;
|
||||
|
||||
function load_file_path(path, _x = undefined, _y = undefined) {
|
||||
if(!is_array(path)) path = [ path ];
|
||||
if(array_length(path) == 0) return;
|
||||
|
||||
_x = _x == undefined? PANEL_GRAPH.graph_cx : _x;
|
||||
_y = _y == undefined? PANEL_GRAPH.graph_cy : _y;
|
||||
|
||||
var type = "others";
|
||||
|
||||
if(array_length(path) == 1 && directory_exists(path[0]))
|
||||
type = "image";
|
||||
|
||||
for( var i = 0, n = array_length(path); i < n; i++ ) {
|
||||
var p = path[i];
|
||||
var ext = string_lower(filename_ext(p));
|
||||
|
||||
switch(ext) {
|
||||
case ".png" :
|
||||
case ".jpg" :
|
||||
case ".jpeg" :
|
||||
type = "image";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
var is_multi = type == "image" && (array_length(path) > 1 || directory_exists(path[0]));
|
||||
|
||||
if(is_multi) {
|
||||
with(dialogCall(o_dialog_add_multiple_images, WIN_W / 2, WIN_H / 2))
|
||||
setPath(path);
|
||||
} else {
|
||||
if(!IS_CMD) PANEL_GRAPH.onStepBegin();
|
||||
|
||||
var node = noone;
|
||||
for( var i = 0, n = array_length(path); i < n; i++ ) {
|
||||
var p = path[i];
|
||||
var ext = filename_ext_raw(p);
|
||||
|
||||
switch(ext) {
|
||||
case "txt" :
|
||||
node = Node_create_Text_File_Read_path(_x, _y, p);
|
||||
break;
|
||||
|
||||
case "csv" :
|
||||
node = Node_create_CSV_File_Read_path(_x, _y, p);
|
||||
break;
|
||||
|
||||
case "json" :
|
||||
node = Node_create_Json_File_Read_path(_x, _y, p);
|
||||
break;
|
||||
|
||||
case "ase" :
|
||||
case "aseprite" :
|
||||
node = Node_create_ASE_File_Read_path(_x, _y, p);
|
||||
break;
|
||||
|
||||
case "png" :
|
||||
case "jpg" :
|
||||
case "jpeg" :
|
||||
if(key_mod_press(SHIFT))
|
||||
node = Node_create_Image_path(_x, _y, p);
|
||||
else
|
||||
node = Node_create_Image_path(_x, _y, p);
|
||||
break;
|
||||
|
||||
case "gif" :
|
||||
node = Node_create_Image_gif_path(_x, _y, p);
|
||||
break;
|
||||
|
||||
case "obj" :
|
||||
node = Node_create_3D_Obj_path(_x, _y, p);
|
||||
break;
|
||||
|
||||
case "wav" :
|
||||
node = Node_create_WAV_File_Read_path(_x, _y, p);
|
||||
break;
|
||||
|
||||
case "xml" :
|
||||
node = Node_create_XML_File_Read_path(_x, _y, p);
|
||||
break;
|
||||
|
||||
case "svg" :
|
||||
node = Node_create_SVG_path(_x, _y, p);
|
||||
break;
|
||||
|
||||
case "pxc" :
|
||||
case "cpxc" :
|
||||
LOAD_PATH(p);
|
||||
break;
|
||||
|
||||
case "pxcc" :
|
||||
APPEND(p);
|
||||
break;
|
||||
}
|
||||
|
||||
if(!IS_CMD) PANEL_GRAPH.mouse_grid_y += 160;
|
||||
}
|
||||
|
||||
// if(node && !IS_CMD) PANEL_GRAPH.toCenterNode();
|
||||
}
|
||||
}
|
||||
FILE_IS_DROPPING = false;
|
||||
FILE_DROPPING_X = 0;
|
||||
FILE_DROPPING_Y = 0;
|
||||
FILE_DROPPING = [];
|
||||
FILE_DROPPED = false;
|
||||
#endregion
|
||||
|
||||
#region undo
|
||||
|
|
|
@ -2,7 +2,28 @@
|
|||
var ev_id = async_load[? "id"];
|
||||
var ev_type = async_load[? "event_type"];
|
||||
|
||||
if(ev_type == "file_drop") {
|
||||
dropping = async_load[?"filename"];
|
||||
array_push(drop_path, dropping);
|
||||
switch(ev_type) {
|
||||
|
||||
case "file_drop_start" :
|
||||
FILE_DROPPING = [];
|
||||
break;
|
||||
|
||||
case "file_drop" :
|
||||
array_push(FILE_DROPPING, async_load[?"filename"]);
|
||||
break;
|
||||
|
||||
case "file_drop_end" :
|
||||
FILE_DROPPED = true;
|
||||
FILE_IS_DROPPING = false;
|
||||
break;
|
||||
|
||||
case "file_drag_over" :
|
||||
FILE_IS_DROPPING = true;
|
||||
FILE_DROPPING_X = async_load[? "x"] - window_get_x();
|
||||
FILE_DROPPING_Y = async_load[? "y"] - window_get_y();
|
||||
break;
|
||||
|
||||
case "file_drag_leave" :
|
||||
FILE_IS_DROPPING = false;
|
||||
break;
|
||||
}
|
|
@ -76,13 +76,7 @@ if(PROJECT.active && !PROJECT.safeMode) { #region node step
|
|||
#endregion
|
||||
|
||||
#region file drop
|
||||
if(OS == os_windows) {
|
||||
if(array_length(drop_path)) {
|
||||
load_file_path(drop_path);
|
||||
drop_path = [];
|
||||
}
|
||||
|
||||
} else if(OS == os_macosx) {
|
||||
if(OS == os_macosx) {
|
||||
file_dnd_set_files(file_dnd_pattern, file_dnd_allowfiles, file_dnd_allowdirs, file_dnd_allowmulti);
|
||||
file_dnd_filelist = file_dnd_get_files();
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ global.cache_hit = 0;
|
|||
|
||||
HOVERING_ELEMENT = _HOVERING_ELEMENT;
|
||||
_HOVERING_ELEMENT = noone;
|
||||
FILE_DROPPED = false;
|
||||
|
||||
#region minimize
|
||||
if(winMan_isMinimized()) {
|
||||
|
|
49
scripts/canvas_tool_corner/canvas_tool_corner.gml
Normal file
49
scripts/canvas_tool_corner/canvas_tool_corner.gml
Normal file
|
@ -0,0 +1,49 @@
|
|||
function canvas_tool_corner() : canvas_tool_shader() constructor {
|
||||
|
||||
mouse_sx = 0;
|
||||
mouse_sy = 0;
|
||||
|
||||
modifying = false;
|
||||
amount = 0;
|
||||
|
||||
function init() { mouse_init = true; }
|
||||
|
||||
function onInit(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) {
|
||||
mouse_sx = _mx;
|
||||
mouse_sy = _my;
|
||||
}
|
||||
|
||||
function stepEffect(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) {
|
||||
modifying = true;
|
||||
var _dim = node.attributes.dimension;
|
||||
var _suf = node.getCanvasSurface();
|
||||
|
||||
var _dx = (_mx - mouse_sx) / _s / 4;
|
||||
amount = clamp(round(_dx), 0, 3);
|
||||
|
||||
surface_set_shader(preview_surface[1], sh_canvas_corner);
|
||||
|
||||
shader_set_f("dimension", _dim);
|
||||
shader_set_f("amount", amount);
|
||||
shader_set_surface("base", _suf);
|
||||
|
||||
draw_surface(preview_surface[0], 0, 0);
|
||||
surface_reset_shader();
|
||||
|
||||
}
|
||||
|
||||
function drawPostOverlay(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) {
|
||||
if(!modifying) return;
|
||||
|
||||
var _x0 = mouse_sx;
|
||||
var _y0 = mouse_sy;
|
||||
|
||||
var _x1 = _x0 + amount * _s * 4;
|
||||
|
||||
draw_set_color(COLORS._main_accent);
|
||||
draw_line(_x0, _y0, _x1, _y0);
|
||||
|
||||
draw_circle(_x1, _y0, 5, false);
|
||||
|
||||
}
|
||||
}
|
13
scripts/canvas_tool_corner/canvas_tool_corner.yy
Normal file
13
scripts/canvas_tool_corner/canvas_tool_corner.yy
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"$GMScript":"",
|
||||
"%Name":"canvas_tool_corner",
|
||||
"isCompatibility":false,
|
||||
"isDnD":false,
|
||||
"name":"canvas_tool_corner",
|
||||
"parent":{
|
||||
"name":"actions",
|
||||
"path":"folders/nodes/data/canvas/actions.yy",
|
||||
},
|
||||
"resourceType":"GMScript",
|
||||
"resourceVersion":"2.0",
|
||||
}
|
|
@ -38,7 +38,7 @@
|
|||
LATEST_VERSION = 11700;
|
||||
VERSION = 11760;
|
||||
SAVE_VERSION = 11700;
|
||||
VERSION_STRING = "1.17.6.002";
|
||||
VERSION_STRING = "1.17.6.003";
|
||||
BUILD_NUMBER = 11760;
|
||||
|
||||
globalvar HOTKEYS, HOTKEY_CONTEXT;
|
||||
|
|
|
@ -362,6 +362,7 @@ function Node_Canvas(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
|
|||
/* 4 */ new NodeTool( "Extrude", THEME.canvas_tools_extrude ).setToolObject( new canvas_tool_extrude() ),
|
||||
/* 5 */ new NodeTool( "Inset", THEME.canvas_tools_inset ).setToolObject( new canvas_tool_inset() ),
|
||||
/* 6 */ new NodeTool( "Skew", THEME.canvas_tools_skew ).setToolObject( new canvas_tool_skew() ),
|
||||
/* 7 */ new NodeTool( "Corner", THEME.canvas_tools_corner ).setToolObject( new canvas_tool_corner() ),
|
||||
];
|
||||
|
||||
rightTools_not_selection = [
|
||||
|
@ -370,6 +371,7 @@ function Node_Canvas(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
|
|||
new NodeTool( "Extrude", THEME.canvas_tools_extrude).setContext(self).setToolObject( new canvas_tool_with_selector(rightTools_selection[4]) ),
|
||||
new NodeTool( "Inset", THEME.canvas_tools_inset ).setContext(self).setToolObject( new canvas_tool_with_selector(rightTools_selection[5]) ),
|
||||
new NodeTool( "Skew", THEME.canvas_tools_skew ).setContext(self).setToolObject( new canvas_tool_with_selector(rightTools_selection[6]) ),
|
||||
new NodeTool( "Corner", THEME.canvas_tools_corner ).setContext(self).setToolObject( new canvas_tool_with_selector(rightTools_selection[7]) ),
|
||||
];
|
||||
|
||||
rightTools_brush = [
|
||||
|
@ -701,9 +703,6 @@ function Node_Canvas(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
|
|||
rightTools = [];
|
||||
array_append(rightTools, rightTools_general);
|
||||
|
||||
if(tool_selection.is_selected) array_append(rightTools, rightTools_selection);
|
||||
else array_append(rightTools, rightTools_not_selection);
|
||||
|
||||
if(nodeTool != noone)
|
||||
_tool = nodeTool;
|
||||
|
||||
|
@ -727,6 +726,9 @@ function Node_Canvas(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
|
|||
tool_mirror_edit.sprs = (!tool_selection.is_selected && tool_attribute.mirror[0])? THEME.canvas_mirror_diag : THEME.canvas_mirror;
|
||||
}
|
||||
|
||||
if(tool_selection.is_selected) array_append(rightTools, rightTools_selection);
|
||||
else array_append(rightTools, rightTools_not_selection);
|
||||
|
||||
if(_tool && _tool.override) {
|
||||
_tool.node = self;
|
||||
_tool.step(hover, active, _x, _y, _s, _mx, _my, _snx, _sny);
|
||||
|
|
|
@ -388,7 +388,10 @@ function Panel(_parent, _x, _y, _w, _h) constructor { #region
|
|||
dragging = -1;
|
||||
}
|
||||
} else {
|
||||
if(con && point_in_rectangle(mouse_mx, mouse_my, x + ui(2), y + ui(2), x + w - ui(4), y + h - ui(4))) {
|
||||
var _mx = FILE_IS_DROPPING? FILE_DROPPING_X : mouse_mx;
|
||||
var _my = FILE_IS_DROPPING? FILE_DROPPING_Y : mouse_my;
|
||||
|
||||
if(con && point_in_rectangle(_mx, _my, x + ui(2), y + ui(2), x + w - ui(4), y + h - ui(4))) {
|
||||
HOVER = self;
|
||||
if(mouse_press(mb_any))
|
||||
setFocus(self);
|
||||
|
@ -652,9 +655,12 @@ function Panel(_parent, _x, _y, _w, _h) constructor { #region
|
|||
|
||||
if(tab) drawTab();
|
||||
|
||||
var _mx = FILE_IS_DROPPING? FILE_DROPPING_X : mouse_mx;
|
||||
var _my = FILE_IS_DROPPING? FILE_DROPPING_Y : mouse_my;
|
||||
|
||||
var p = ui(6);
|
||||
var m_in = point_in_rectangle(mouse_mx, mouse_my, tx + p, ty + p, tx + tw - p, ty + th - p);
|
||||
var m_ot = point_in_rectangle(mouse_mx, mouse_my, tx, ty, tx + tw, ty + th);
|
||||
var m_in = point_in_rectangle(_mx, _my, tx + p, ty + p, tx + tw - p, ty + th - p);
|
||||
var m_ot = point_in_rectangle(_mx, _my, tx, ty, tx + tw, ty + th);
|
||||
mouse_active = m_in;
|
||||
|
||||
var _tw = tw - padding * 2;
|
||||
|
@ -935,6 +941,7 @@ function PanelContent() constructor { #region
|
|||
|
||||
static draw = function(panel) { #region
|
||||
self.panel = panel;
|
||||
|
||||
if(o_main.panel_dragging == noone) {
|
||||
pFOCUS = FOCUS == panel/* && panel.mouse_active*/;
|
||||
pHOVER = !CURSOR_IS_LOCK && HOVER == panel && panel.mouse_active;
|
||||
|
|
|
@ -2004,7 +2004,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
draw_set_alpha(1);
|
||||
} #endregion
|
||||
|
||||
function drawContent(panel) { #region ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// MAIN DRAW
|
||||
function drawContent(panel) { #region //// Main Draw
|
||||
if(!project.active) return;
|
||||
|
||||
dragGraph();
|
||||
|
@ -2063,6 +2063,25 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
draw_set_text(f_p0b, fa_right, fa_bottom, COLORS._main_value_negative);
|
||||
draw_text(w - 8, h - toolbar_height, "Live Update");
|
||||
}
|
||||
|
||||
////////////////////////////////// File drop //////////////////////////////////
|
||||
|
||||
if(!array_empty(FILE_DROPPING)) {
|
||||
load_file_path(FILE_DROPPING);
|
||||
FILE_DROPPING = [];
|
||||
}
|
||||
|
||||
if(pHOVER) {
|
||||
var _gx = mx / graph_s - graph_x;
|
||||
var _gy = my / graph_s - graph_y;
|
||||
|
||||
if(FILE_IS_DROPPING)
|
||||
draw_sprite_stretched_ext(THEME.ui_panel_selection, 0, 8, 8, w - 16, h - 16, COLORS._main_value_positive, 1);
|
||||
|
||||
if(FILE_DROPPED && !array_empty(FILE_DROPPING))
|
||||
load_file_path(FILE_DROPPING, _gx, _gy);
|
||||
}
|
||||
|
||||
} #endregion
|
||||
|
||||
//// ============ Action ============
|
||||
|
@ -2598,3 +2617,107 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
dia.project = project;
|
||||
} #endregion
|
||||
}
|
||||
|
||||
//// ========== Graph Drop ==========
|
||||
|
||||
function load_file_path(path, _x = undefined, _y = undefined) {
|
||||
if(!is_array(path)) path = [ path ];
|
||||
if(array_length(path) == 0) return;
|
||||
|
||||
_x = _x == undefined? PANEL_GRAPH.graph_cx : _x;
|
||||
_y = _y == undefined? PANEL_GRAPH.graph_cy : _y;
|
||||
|
||||
var type = "others";
|
||||
|
||||
if(array_length(path) == 1 && directory_exists(path[0]))
|
||||
type = "image";
|
||||
|
||||
for( var i = 0, n = array_length(path); i < n; i++ ) {
|
||||
var p = path[i];
|
||||
var ext = string_lower(filename_ext(p));
|
||||
|
||||
switch(ext) {
|
||||
case ".png" :
|
||||
case ".jpg" :
|
||||
case ".jpeg" :
|
||||
type = "image";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
var is_multi = type == "image" && (array_length(path) > 1 || directory_exists(path[0]));
|
||||
|
||||
if(is_multi) {
|
||||
with(dialogCall(o_dialog_add_multiple_images, WIN_W / 2, WIN_H / 2))
|
||||
setPath(path);
|
||||
} else {
|
||||
if(!IS_CMD) PANEL_GRAPH.onStepBegin();
|
||||
|
||||
var node = noone;
|
||||
for( var i = 0, n = array_length(path); i < n; i++ ) {
|
||||
var p = path[i];
|
||||
var ext = filename_ext_raw(p);
|
||||
|
||||
switch(ext) {
|
||||
case "txt" :
|
||||
node = Node_create_Text_File_Read_path(_x, _y, p);
|
||||
break;
|
||||
|
||||
case "csv" :
|
||||
node = Node_create_CSV_File_Read_path(_x, _y, p);
|
||||
break;
|
||||
|
||||
case "json" :
|
||||
node = Node_create_Json_File_Read_path(_x, _y, p);
|
||||
break;
|
||||
|
||||
case "ase" :
|
||||
case "aseprite" :
|
||||
node = Node_create_ASE_File_Read_path(_x, _y, p);
|
||||
break;
|
||||
|
||||
case "png" :
|
||||
case "jpg" :
|
||||
case "jpeg" :
|
||||
if(key_mod_press(SHIFT))
|
||||
node = Node_create_Image_path(_x, _y, p);
|
||||
else
|
||||
node = Node_create_Image_path(_x, _y, p);
|
||||
break;
|
||||
|
||||
case "gif" :
|
||||
node = Node_create_Image_gif_path(_x, _y, p);
|
||||
break;
|
||||
|
||||
case "obj" :
|
||||
node = Node_create_3D_Obj_path(_x, _y, p);
|
||||
break;
|
||||
|
||||
case "wav" :
|
||||
node = Node_create_WAV_File_Read_path(_x, _y, p);
|
||||
break;
|
||||
|
||||
case "xml" :
|
||||
node = Node_create_XML_File_Read_path(_x, _y, p);
|
||||
break;
|
||||
|
||||
case "svg" :
|
||||
node = Node_create_SVG_path(_x, _y, p);
|
||||
break;
|
||||
|
||||
case "pxc" :
|
||||
case "cpxc" :
|
||||
LOAD_PATH(p);
|
||||
break;
|
||||
|
||||
case "pxcc" :
|
||||
APPEND(p);
|
||||
break;
|
||||
}
|
||||
|
||||
if(!IS_CMD) PANEL_GRAPH.mouse_grid_y += 160;
|
||||
}
|
||||
|
||||
// if(node && !IS_CMD) PANEL_GRAPH.toCenterNode();
|
||||
}
|
||||
}
|
|
@ -2064,6 +2064,13 @@ function Panel_Preview() : PanelContent() constructor {
|
|||
],, getNodePreview());
|
||||
}
|
||||
|
||||
if(pHOVER) {
|
||||
if(FILE_IS_DROPPING)
|
||||
draw_sprite_stretched_ext(THEME.ui_panel_selection, 0, 8, 8, w - 16, h - 16, COLORS._main_value_positive, 1);
|
||||
|
||||
if(FILE_DROPPED && !array_empty(FILE_DROPPING)) {}
|
||||
}
|
||||
|
||||
} #endregion
|
||||
|
||||
////=========== ACTION ===========
|
||||
|
|
|
@ -50,6 +50,10 @@ function _sprite_load_from_struct(str, theme, key) { #region
|
|||
slice.bottom = str.slice;
|
||||
|
||||
}
|
||||
|
||||
if(struct_has(str, "slicemode"))
|
||||
slice.tilemode = array_create(5, str.slicemode);
|
||||
|
||||
sprite_set_nineslice(s, slice);
|
||||
}
|
||||
|
||||
|
|
197
shaders/sh_canvas_corner/sh_canvas_corner.fsh
Normal file
197
shaders/sh_canvas_corner/sh_canvas_corner.fsh
Normal file
|
@ -0,0 +1,197 @@
|
|||
varying vec2 v_vTexcoord;
|
||||
varying vec4 v_vColour;
|
||||
|
||||
uniform sampler2D base;
|
||||
uniform vec2 dimension;
|
||||
uniform float amount;
|
||||
|
||||
vec4 s( float x, float y ) { return texture2D( base, v_vTexcoord + vec2(x, y)); }
|
||||
bool e( float x, float y ) { return texture2D( gm_BaseTexture, v_vTexcoord + vec2(x, y)).a == 0.; }
|
||||
|
||||
void main() {
|
||||
vec4 c = texture2D( gm_BaseTexture, v_vTexcoord);
|
||||
gl_FragColor = c;
|
||||
|
||||
if(c.a == 0.) return;
|
||||
if(amount == 0.) return;
|
||||
|
||||
float x = 1. / dimension.x;
|
||||
float y = 1. / dimension.y;
|
||||
|
||||
bool a1, a2, a3, a4, a5, a6, a7, a8, a9;
|
||||
|
||||
if(amount >= 1.) {
|
||||
a1 = e(-x, -y);
|
||||
a2 = e(0., -y);
|
||||
a3 = e( x, -y);
|
||||
|
||||
a4 = e(-x, 0.);
|
||||
a5 = e(0., 0.);
|
||||
a6 = e( x, 0.);
|
||||
|
||||
a7 = e(-x, y);
|
||||
a8 = e(0., y);
|
||||
a9 = e( x, y);
|
||||
|
||||
if( a1 && a2 && a3 &&
|
||||
a4 && !a5 && !a6 &&
|
||||
a7 && !a8 ) gl_FragColor = s(-x, -y);
|
||||
|
||||
else if( a1 && !a2 &&
|
||||
a4 && !a5 && !a6 &&
|
||||
a7 && a8 && a9 ) gl_FragColor = s(-x, y);
|
||||
|
||||
else if( !a2 && a3 &&
|
||||
!a4 && !a5 && a6 &&
|
||||
a7 && a8 && a9 ) gl_FragColor = s( x, y);
|
||||
|
||||
else if( a1 && a2 && a3 &&
|
||||
!a4 && !a5 && a6 &&
|
||||
!a8 && a9 ) gl_FragColor = s( x, -y);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
else if( a1 && a2 && a3 &&
|
||||
a4 && !a5 && a6 &&
|
||||
!a8 ) gl_FragColor = s(0., -y);
|
||||
|
||||
else if( !a2 &&
|
||||
a4 && !a5 && a6 &&
|
||||
a7 && a8 && a9 ) gl_FragColor = s(0., y);
|
||||
|
||||
else if( a2 && a3 &&
|
||||
!a4 && !a5 && a6 &&
|
||||
a8 && a9 ) gl_FragColor = s( x, 0.);
|
||||
|
||||
else if( a1 && a2 &&
|
||||
a4 && !a5 && !a6 &&
|
||||
a7 && a8 ) gl_FragColor = s(-x, 0.);
|
||||
}
|
||||
|
||||
bool a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25;
|
||||
|
||||
if(amount >= 2.) {
|
||||
// a10 = e(-x * 2., -y * 2.);
|
||||
a11 = e(-x , -y * 2.);
|
||||
a12 = e(0. , -y * 2.);
|
||||
a13 = e( x , -y * 2.);
|
||||
// a14 = e( x * 2., -y * 2.);
|
||||
|
||||
a15 = e(-x * 2., -y );
|
||||
a16 = e( x * 2., -y );
|
||||
a17 = e(-x * 2., 0. );
|
||||
a18 = e( x * 2., 0. );
|
||||
a19 = e(-x * 2., y );
|
||||
a20 = e( x * 2., y );
|
||||
|
||||
// a21 = e(-x * 2., y * 2.);
|
||||
a22 = e(-x , y * 2.);
|
||||
a23 = e(0. , y * 2.);
|
||||
a24 = e( x , y * 2.);
|
||||
// a25 = e( x * 2., y * 2.);
|
||||
|
||||
// a10 && a11 && a12 && a13 && a14 &&
|
||||
// a15 && a1 && a2 && a3 && a16 &&
|
||||
// a17 && a4 && a5 && a6 && a18 &&
|
||||
// a19 && a7 && a8 && a9 && a20 &&
|
||||
// a21 && a22 && a23 && a24 && a25 &&
|
||||
|
||||
if( a15 && a1 && a2 && a3 &&
|
||||
a17 && !a4 && !a5 && !a6 &&
|
||||
a19 && !a7 && !a8 && !a9 ) gl_FragColor = s(-x * 2., -y );
|
||||
|
||||
else if( a15 && !a1 && !a2 && !a3 &&
|
||||
a17 && !a4 && !a5 && !a6 &&
|
||||
a19 && a7 && a8 && a9 ) gl_FragColor = s(-x * 2., y );
|
||||
|
||||
else if(!a1 && !a2 && !a3 && a16 &&
|
||||
!a4 && !a5 && !a6 && a18 &&
|
||||
a7 && a8 && a9 && a20 ) gl_FragColor = s( x * 2., y );
|
||||
|
||||
else if( a1 && a2 && a3 && a16 &&
|
||||
!a4 && !a5 && !a6 && a18 &&
|
||||
!a7 && !a8 && !a9 && a20 ) gl_FragColor = s( x * 2., -y );
|
||||
|
||||
else if( a11 && a12 && a13 &&
|
||||
a1 && !a2 && !a3 &&
|
||||
a4 && !a5 && !a6 &&
|
||||
a7 && !a8 && !a9 ) gl_FragColor = s(-x , -y * 2.);
|
||||
|
||||
else if( a11 && a12 && a13 &&
|
||||
!a1 && !a2 && a3 &&
|
||||
!a4 && !a5 && a6 &&
|
||||
!a7 && !a8 && a9 ) gl_FragColor = s( x , -y * 2.);
|
||||
|
||||
else if( a1 && !a2 && !a3 &&
|
||||
a4 && !a5 && !a6 &&
|
||||
a7 && !a8 && !a9 &&
|
||||
a22 && a23 && a24 ) gl_FragColor = s(-x , y * 2.);
|
||||
|
||||
else if(!a1 && !a2 && a3 &&
|
||||
!a4 && !a5 && a6 &&
|
||||
!a7 && !a8 && a9 &&
|
||||
a22 && a23 && a24 ) gl_FragColor = s( x , y * 2.);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}
|
||||
|
||||
bool a26, a27, a28, a29;
|
||||
bool a30, a31, a32, a33;
|
||||
bool a34, a35, a36, a37;
|
||||
|
||||
if(amount >= 3.) {
|
||||
a26 = e(-x * 3., 0.);
|
||||
a27 = e( x * 3., 0.);
|
||||
a28 = e(0., -y * 3.);
|
||||
a29 = e(0., y * 3.);
|
||||
|
||||
a30 = e(-x * 3., y);
|
||||
a31 = e(-x * 3., -y);
|
||||
a32 = e( x * 3., -y);
|
||||
a33 = e( x * 3., y);
|
||||
|
||||
a34 = e( x, -y * 3.);
|
||||
a35 = e(-x, -y * 3.);
|
||||
a36 = e( x, y * 3.);
|
||||
a37 = e(-x, y * 3.);
|
||||
|
||||
if( a15 && a1 && a2 &&
|
||||
a26 && !a17 && !a4 && !a5 &&
|
||||
a30 && !a19 && !a7 && !a8 ) gl_FragColor = s(-x * 2., -y );
|
||||
|
||||
else if( a31 && !a15 && !a1 && !a2 &&
|
||||
a26 && !a17 && !a4 && !a5 &&
|
||||
a19 && a7 && a8 ) gl_FragColor = s(-x * 2., y );
|
||||
|
||||
else if(!a2 && !a3 && !a16 && a32 &&
|
||||
!a5 && !a6 && !a18 && a27 &&
|
||||
a8 && a9 && a20 ) gl_FragColor = s( x * 2., y );
|
||||
|
||||
else if( a2 && a3 && a16 &&
|
||||
!a5 && !a6 && !a18 && a27 &&
|
||||
!a8 && !a9 && !a20 && a33 ) gl_FragColor = s( x * 2., -y );
|
||||
|
||||
else if( a28 && a34 &&
|
||||
a11 && !a12 && !a13 &&
|
||||
a1 && !a2 && !a3 &&
|
||||
a4 && !a5 && !a6 ) gl_FragColor = s(-x , -y * 2.);
|
||||
|
||||
else if( a35 && a28 &&
|
||||
!a11 && !a12 && a13 &&
|
||||
!a1 && !a2 && a3 &&
|
||||
!a4 && !a5 && a6 ) gl_FragColor = s( x , -y * 2.);
|
||||
|
||||
else if( a4 && !a5 && !a6 &&
|
||||
a7 && !a8 && !a9 &&
|
||||
a22 && !a23 && !a24 &&
|
||||
a29 && a36 ) gl_FragColor = s(-x , y * 2.);
|
||||
|
||||
else if(!a4 && !a5 && a6 &&
|
||||
!a7 && !a8 && a9 &&
|
||||
!a22 && !a23 && a24 &&
|
||||
a37 && a29 ) gl_FragColor = s( x , y * 2.);
|
||||
|
||||
|
||||
}
|
||||
}
|
19
shaders/sh_canvas_corner/sh_canvas_corner.vsh
Normal file
19
shaders/sh_canvas_corner/sh_canvas_corner.vsh
Normal file
|
@ -0,0 +1,19 @@
|
|||
//
|
||||
// Simple passthrough vertex shader
|
||||
//
|
||||
attribute vec3 in_Position; // (x,y,z)
|
||||
//attribute vec3 in_Normal; // (x,y,z) unused in this shader.
|
||||
attribute vec4 in_Colour; // (r,g,b,a)
|
||||
attribute vec2 in_TextureCoord; // (u,v)
|
||||
|
||||
varying vec2 v_vTexcoord;
|
||||
varying vec4 v_vColour;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 object_space_pos = vec4( in_Position.x, in_Position.y, in_Position.z, 1.0);
|
||||
gl_Position = gm_Matrices[MATRIX_WORLD_VIEW_PROJECTION] * object_space_pos;
|
||||
|
||||
v_vColour = in_Colour;
|
||||
v_vTexcoord = in_TextureCoord;
|
||||
}
|
12
shaders/sh_canvas_corner/sh_canvas_corner.yy
Normal file
12
shaders/sh_canvas_corner/sh_canvas_corner.yy
Normal file
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"$GMShader":"",
|
||||
"%Name":"sh_canvas_corner",
|
||||
"name":"sh_canvas_corner",
|
||||
"parent":{
|
||||
"name":"shader",
|
||||
"path":"folders/nodes/data/canvas/shader.yy",
|
||||
},
|
||||
"resourceType":"GMShader",
|
||||
"resourceVersion":"2.0",
|
||||
"type":1,
|
||||
}
|
Loading…
Reference in a new issue