mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-11-10 12:34:06 +01:00
- [Animation Panel] Add tooltip when hovering on a keyframe.
This commit is contained in:
parent
ee9b5ac672
commit
3ae01f7d86
@ -27,7 +27,6 @@ event_inherited();
|
||||
|
||||
sp_content = new scrollPane(dialog_w - ui(padding + padding), dialog_h - ui(title_height + padding), function(_y, _m) {
|
||||
if(!target) return 0;
|
||||
if(!struct_has(target, "spr")) return 0;
|
||||
|
||||
draw_clear_alpha(COLORS.dialog_array_edit_bg, 0);
|
||||
|
||||
@ -37,9 +36,7 @@ event_inherited();
|
||||
var hh = ui(100);
|
||||
var pad = ui(16);
|
||||
|
||||
var arr = target.getInputData(0);
|
||||
if(array_length(arr) != array_length(target.spr))
|
||||
target.updatePaths(arr);
|
||||
var arr = target.getValue();
|
||||
|
||||
var len = array_length(arr);
|
||||
var col = floor((sp_content.surface_w - pad) / (ww + pad));
|
||||
@ -56,13 +53,15 @@ event_inherited();
|
||||
var index = i * col + j;
|
||||
if(index >= len) break;
|
||||
|
||||
var xx = pad + (ww + pad) * j;
|
||||
var path = arr[index];
|
||||
var xx = pad + (ww + pad) * j;
|
||||
|
||||
draw_sprite_stretched(THEME.ui_panel_bg, 0, xx, yy, ww, hh);
|
||||
draw_sprite_stretched_add(THEME.ui_panel_fg, 0, xx, yy, ww, hh, c_white, 0.3);
|
||||
|
||||
if(sHOVER && sp_content.hover && point_in_rectangle(_m[0], _m[1], xx, yy, xx + ww, yy + hh)) {
|
||||
inb_hover = index;
|
||||
if(dragging == -1)
|
||||
if(dragging == -1 || dragging == index)
|
||||
draw_sprite_stretched_ext(THEME.ui_panel_active, 0, xx, yy, ww, hh, COLORS._main_accent, 1);
|
||||
|
||||
if(mouse_press(mb_left, sFOCUS))
|
||||
@ -74,7 +73,7 @@ event_inherited();
|
||||
}
|
||||
}
|
||||
|
||||
var spr = array_safe_get_fast(target.spr, index, noone);
|
||||
var spr = struct_try_get(SPRITE_PATH_MAP, path, noone);
|
||||
if(spr == noone || !sprite_exists(spr))
|
||||
spr = s_texture_default;
|
||||
|
||||
@ -88,8 +87,7 @@ event_inherited();
|
||||
draw_sprite_ext(spr, 0, spr_x, spr_y, spr_s, spr_s, 0, c_white, aa);
|
||||
|
||||
draw_set_text(f_p2, fa_center, fa_top, COLORS._main_text);
|
||||
var path = arr[index];
|
||||
var name = string_cut_line(string_replace(filename_name(path), filename_ext(path), ""), ww);
|
||||
var name = string_cut_line(filename_name_only(path), ww);
|
||||
var txt_h = string_height_ext(name, -1, ww);
|
||||
|
||||
draw_text_line(xx + ww / 2, yy + hh + ui(16), name, -1, ww);
|
||||
@ -114,11 +112,11 @@ event_inherited();
|
||||
if(menu > -1) {
|
||||
menuCall("image_array_edit_menu",,, [
|
||||
menuItem(__txt("Remove"), function() {
|
||||
var arr = target.getInputData(0);
|
||||
var arr = target.getValue();
|
||||
array_delete(arr, menuOn, 1);
|
||||
|
||||
target.inputs[| 0].setValue(arr);
|
||||
target.triggerRender();
|
||||
target.setValue(arr);
|
||||
target.node.triggerRender();
|
||||
})
|
||||
],, target );
|
||||
}
|
||||
@ -131,24 +129,24 @@ event_inherited();
|
||||
function rearrange(oldindex, newindex) {
|
||||
if(oldindex == newindex) return;
|
||||
|
||||
var arr = target.getInputData(0);
|
||||
var arr = target.getValue();
|
||||
var val = arr[oldindex];
|
||||
array_delete(arr, oldindex, 1);
|
||||
array_insert(arr, newindex, val);
|
||||
|
||||
target.inputs[| 0].setValue(arr);
|
||||
target.triggerRender();
|
||||
target.setValue(arr);
|
||||
target.node.triggerRender();
|
||||
}
|
||||
|
||||
sortAsc = true;
|
||||
function sortByName() {
|
||||
if(!target) return 0;
|
||||
var arr = target.getInputData(0);
|
||||
var arr = target.getValue();
|
||||
|
||||
array_sort(arr, bool(sortAsc));
|
||||
sortAsc = !sortAsc;
|
||||
|
||||
target.inputs[| 0].setValue(arr);
|
||||
target.triggerRender();
|
||||
target.setValue(arr);
|
||||
target.node.triggerRender();
|
||||
}
|
||||
#endregion
|
@ -34,14 +34,12 @@ if !target exit;
|
||||
key_release();
|
||||
|
||||
if(path != "") {
|
||||
var paths = paths_to_array_ext(path, ".png;.jpg");
|
||||
var arr = target.getInputData(0);
|
||||
var paths = string_splice(path, "\n");
|
||||
var arr = target.getValue();
|
||||
array_append(arr, paths);
|
||||
|
||||
for( var i = 0, n = array_length(paths); i < n; i++ )
|
||||
array_push(arr, paths[i]);
|
||||
|
||||
target.inputs[| 0].setValue(arr);
|
||||
target.triggerRender();
|
||||
target.setValue(arr);
|
||||
target.node.triggerRender();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -64,6 +64,14 @@ function draw_sprite_bbox(spr, ind, _bbox) { #region
|
||||
__draw_sprite_stretched(spr, ind, _bbox.x0, _bbox.y0, _bbox.w, _bbox.h);
|
||||
} #endregion
|
||||
|
||||
function draw_sprite_bbox_uniform(spr, ind, _bbox) { #region
|
||||
INLINE
|
||||
if(_bbox == noone) return;
|
||||
var _minS = min(_bbox.w, _bbox.h);
|
||||
|
||||
__draw_sprite_stretched(spr, ind, _bbox.xc - _minS / 2, _bbox.y0 - _minS / 2, _minS, _minS);
|
||||
} #endregion
|
||||
|
||||
function draw_sprite_uniform(spr, ind, _x, _y, scale, color = c_white) { #region
|
||||
INLINE
|
||||
draw_sprite_ext(spr, ind, _x, _y, scale, scale, 0, color, 1);
|
||||
|
@ -9,6 +9,7 @@
|
||||
PEN_RELEASED = false;
|
||||
|
||||
#macro SCROLL_SPEED PREFERENCES.mouse_wheel_speed
|
||||
#macro MOUSE_MOVED (window_mouse_get_delta_x() || window_mouse_get_delta_y())
|
||||
|
||||
function setMouseWrap() {
|
||||
INLINE
|
||||
|
@ -1621,7 +1621,13 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
||||
|
||||
static groupCheck = function(_x, _y, _s, _mx, _my) {}
|
||||
|
||||
static drawNodeBG = function(_x, _y, _mx, _my, _s, display_parameter = noone) { return false; }
|
||||
static drawNodeBG = function(_x, _y, _mx, _my, _s, display_parameter = noone) {
|
||||
var xx = x * _s + _x;
|
||||
var yy = y * _s + _y;
|
||||
|
||||
drawDimension(xx, yy, _s);
|
||||
return false;
|
||||
}
|
||||
|
||||
static drawNode = function(_x, _y, _mx, _my, _s, display_parameter = noone) { #region
|
||||
if(draw_graph_culled) return;
|
||||
@ -1640,7 +1646,6 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
||||
draw_sprite_stretched_ext(THEME.node_glow_border, 0, xx - 9, yy - 9, w * _s + 18, h * _s + 18, COLORS._main_value_negative, 1);
|
||||
|
||||
drawNodeBase(xx, yy, _s);
|
||||
drawDimension(xx, yy, _s);
|
||||
|
||||
draggable = true;
|
||||
|
||||
|
@ -37,7 +37,7 @@ function Node_Image_Sequence(_x, _y, _group = noone) : Node(_x, _y, _group) cons
|
||||
spr = [];
|
||||
color = COLORS.node_blend_input;
|
||||
|
||||
inputs[| 0] = nodeValue("Path", self, JUNCTION_CONNECT.input, VALUE_TYPE.path, [])
|
||||
inputs[| 0] = nodeValue("Paths", self, JUNCTION_CONNECT.input, VALUE_TYPE.path, [])
|
||||
.setDisplay(VALUE_DISPLAY.path_array, { filter: ["image|*.png;*.jpg", ""] });
|
||||
|
||||
inputs[| 1] = nodeValue("Padding", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [0, 0, 0, 0])
|
||||
@ -120,7 +120,7 @@ function Node_Image_Sequence(_x, _y, _group = noone) : Node(_x, _y, _group) cons
|
||||
case ".png" :
|
||||
case ".jpg" :
|
||||
case ".jpeg" :
|
||||
var _spr = sprite_add(path, 1, false, false, 0, 0);
|
||||
var _spr = sprite_add_map(path);
|
||||
|
||||
if(_spr == -1) {
|
||||
noti_warning($"Image node: File not a valid image.");
|
||||
|
@ -24,18 +24,33 @@ enum MATH_OPERATOR {
|
||||
}
|
||||
|
||||
#region create
|
||||
global.node_math_keys = [ "add", "subtract", "multiply", "divide", "power", "root", "modulo", "round", "ceiling", "floor", "sin", "cos", "tan", "lerp", "abs", "clamp", "snap" ];
|
||||
global.node_math_keys = [ "add", "subtract", "multiply", "divide", "power", "root", "+", "-", "*", "/", "^",
|
||||
"sin", "cos", "tan",
|
||||
"modulo",
|
||||
"round", "ceiling", "floor",
|
||||
"lerp", "abs",
|
||||
"clamp", "snap" ];
|
||||
|
||||
function Node_create_Math(_x, _y, _group = noone, _param = {}) {
|
||||
var query = struct_try_get(_param, "query", "");
|
||||
var node = new Node_Math(_x, _y, _group);
|
||||
|
||||
switch(query) { #region
|
||||
case "add" : node.inputs[| 0].setValue(MATH_OPERATOR.add); break;
|
||||
case "subtract" : node.inputs[| 0].setValue(MATH_OPERATOR.subtract); break;
|
||||
case "multiply" : node.inputs[| 0].setValue(MATH_OPERATOR.multiply); break;
|
||||
case "divide" : node.inputs[| 0].setValue(MATH_OPERATOR.divide); break;
|
||||
case "power" : node.inputs[| 0].setValue(MATH_OPERATOR.power); break;
|
||||
case "add" :
|
||||
case "+" :
|
||||
node.inputs[| 0].setValue(MATH_OPERATOR.add); break;
|
||||
case "subtract" :
|
||||
case "-" :
|
||||
node.inputs[| 0].setValue(MATH_OPERATOR.subtract); break;
|
||||
case "multiply" :
|
||||
case "*" :
|
||||
node.inputs[| 0].setValue(MATH_OPERATOR.multiply); break;
|
||||
case "divide" :
|
||||
case "/" :
|
||||
node.inputs[| 0].setValue(MATH_OPERATOR.divide); break;
|
||||
case "power" :
|
||||
case "^" :
|
||||
node.inputs[| 0].setValue(MATH_OPERATOR.power); break;
|
||||
case "root" : node.inputs[| 0].setValue(MATH_OPERATOR.root); break;
|
||||
|
||||
case "sin" : node.inputs[| 0].setValue(MATH_OPERATOR.sin); break;
|
||||
|
@ -866,7 +866,7 @@ function Node_Path(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
||||
nx = (segment[j + 0] - minx) / rngx * prev_s;
|
||||
ny = (segment[j + 1] - miny) / rngy * prev_s;
|
||||
|
||||
if(j) draw_line_round(ox, oy, nx, ny, 3);
|
||||
if(j) draw_line_round(ox, oy, nx, ny, 4);
|
||||
|
||||
ox = nx;
|
||||
oy = ny;
|
||||
@ -876,7 +876,7 @@ function Node_Path(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
||||
draw_set_color(COLORS._main_accent);
|
||||
for (var i = 0, n = array_length(anchors); i < n; i++) {
|
||||
var _a0 = anchors[i];
|
||||
draw_circle((_a0[0] - minx) / rngx * prev_s, (_a0[1] - miny) / rngy * prev_s, 6, false);
|
||||
draw_circle((_a0[0] - minx) / rngx * prev_s, (_a0[1] - miny) / rngy * prev_s, 8, false);
|
||||
}
|
||||
surface_reset_target();
|
||||
|
||||
@ -1030,8 +1030,14 @@ function Node_Path(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
||||
|
||||
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region
|
||||
var bbox = drawGetBbox(xx, yy, _s);
|
||||
gpu_set_tex_filter(true);
|
||||
draw_surface_bbox(path_preview_surface, bbox);
|
||||
gpu_set_tex_filter(false);
|
||||
|
||||
if(array_empty(segments)) {
|
||||
draw_sprite_fit(s_node_path, 0, bbox.xc, bbox.yc, bbox.w, bbox.h);
|
||||
|
||||
} else {
|
||||
gpu_set_tex_filter(true);
|
||||
draw_surface_bbox(path_preview_surface, bbox);
|
||||
gpu_set_tex_filter(false);
|
||||
}
|
||||
} #endregion
|
||||
}
|
@ -35,22 +35,26 @@ function Node_Path_Scatter(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
||||
|
||||
inputs[| 11] = nodeValue("Flip if Negative", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false );
|
||||
|
||||
inputs[| 12] = nodeValue("Origin", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0 )
|
||||
.setDisplay(VALUE_DISPLAY.enum_scroll, [ "Individual", "First", "Zero" ]);
|
||||
|
||||
outputs[| 0] = nodeValue("Path", self, JUNCTION_CONNECT.output, VALUE_TYPE.pathnode, self);
|
||||
|
||||
input_display_list = [ 5,
|
||||
["Paths", false], 0, 1, 10, 9,
|
||||
["Scatter", false], 8, 3,
|
||||
["Position", false], 2,
|
||||
["Position", false], 12, 2,
|
||||
["Rotation", false], 7, 11,
|
||||
["Scale", false], 4, 6,
|
||||
];
|
||||
|
||||
cached_pos = ds_map_create();
|
||||
|
||||
line_amount = 0;
|
||||
paths = [];
|
||||
segment_counts = [];
|
||||
line_lengths = [];
|
||||
accu_lengths = [];
|
||||
line_amount = 0;
|
||||
|
||||
__temp_p = [ 0, 0 ];
|
||||
|
||||
@ -63,12 +67,11 @@ function Node_Path_Scatter(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
||||
|
||||
} #endregion
|
||||
|
||||
static getLineCount = function() { return line_amount; }
|
||||
static getSegmentCount = function(ind = 0) { return array_safe_get_fast(segment_counts, ind); }
|
||||
static getLength = function(ind = 0) { return array_safe_get_fast(line_lengths, ind); }
|
||||
static getAccuLength = function(ind = 0) { return array_safe_get_fast(accu_lengths, ind); }
|
||||
|
||||
static getPointRatio = function(_rat, ind = 0, out = undefined) { #region
|
||||
static getLineCount = function() { return line_amount; }
|
||||
static getSegmentCount = function(ind = 0) { return array_safe_get_fast(segment_counts, ind); }
|
||||
static getLength = function(ind = 0) { return array_safe_get_fast(line_lengths, ind); }
|
||||
static getAccuLength = function(ind = 0) { return array_safe_get_fast(accu_lengths, ind); }
|
||||
static getPointRatio = function(_rat, ind = 0, out = undefined) { #region
|
||||
if(out == undefined) out = new __vec2(); else { out.x = 0; out.y = 0; }
|
||||
|
||||
var _path = array_safe_get_fast(paths, ind, 0);
|
||||
@ -78,6 +81,7 @@ function Node_Path_Scatter(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
||||
if(!is_struct(_pathObj) || !struct_has(_pathObj, "getPointRatio"))
|
||||
return out;
|
||||
|
||||
var _ind = _path.index;
|
||||
var _ori = _path.ori;
|
||||
var _pos = _path.pos;
|
||||
var _rot = _path.rot;
|
||||
@ -88,7 +92,7 @@ function Node_Path_Scatter(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
||||
|
||||
_rat *= _trm;
|
||||
|
||||
out = _pathObj.getPointRatio(_rat, 0, out);
|
||||
out = _pathObj.getPointRatio(_rat, _ind, out);
|
||||
|
||||
var _px = out.x - _ori[0];
|
||||
var _py = out.y - _ori[1];
|
||||
@ -103,21 +107,19 @@ function Node_Path_Scatter(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
||||
|
||||
return out;
|
||||
} #endregion
|
||||
|
||||
static getPointDistance = function(_dist, ind = 0, out = undefined) { return getPointRatio(_dist / getLength(ind), ind, out); }
|
||||
|
||||
static getBoundary = function(ind = 0) { #region
|
||||
static getBoundary = function(ind = 0) { #region
|
||||
var _path = getInputData(0);
|
||||
return struct_has(_path, "getBoundary")? _path.getBoundary(ind) : new BoundingBox( 0, 0, 1, 1 );
|
||||
} #endregion
|
||||
|
||||
|
||||
static update = function() { #region
|
||||
ds_map_clear(cached_pos);
|
||||
|
||||
var path_base = getInputData(0);
|
||||
var path_scat = getInputData(1);
|
||||
var _range = getInputData(2);
|
||||
var _amount = getInputData(3);
|
||||
var _repeat = getInputData(3);
|
||||
var _scale = getInputData(4);
|
||||
var _seed = getInputData(5);
|
||||
var _sca_wid = getInputData(6);
|
||||
@ -126,75 +128,100 @@ function Node_Path_Scatter(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
||||
var _trim = getInputData(9);
|
||||
var _trim_rng = getInputData(10);
|
||||
var _flip = getInputData(11);
|
||||
|
||||
amount = 0;
|
||||
var _resetOri = getInputData(12);
|
||||
|
||||
if(path_base == noone) return;
|
||||
if(path_scat == noone) return;
|
||||
|
||||
line_amount = _amount;
|
||||
paths = array_create(_amount);
|
||||
segment_counts = array_create(_amount);
|
||||
line_lengths = array_create(_amount);
|
||||
accu_lengths = array_create(_amount);
|
||||
|
||||
var p = new __vec2();
|
||||
|
||||
random_set_seed(_seed);
|
||||
|
||||
for (var i = 0, n = array_length(paths); i < n; i++) {
|
||||
var _line_amounts = path_scat.getLineCount();
|
||||
var _ind = 0;
|
||||
|
||||
line_amount = _repeat * _line_amounts;
|
||||
paths = array_create(line_amount);
|
||||
segment_counts = array_create(line_amount);
|
||||
line_lengths = array_create(line_amount);
|
||||
accu_lengths = array_create(line_amount);
|
||||
|
||||
var ori, pos;
|
||||
var _prog_raw, _prog;
|
||||
var x0, y0, x1, y1;
|
||||
var _dir, _sca, _rot, _rotW, _trm;
|
||||
|
||||
for (var i = 0; i < _repeat; i++) {
|
||||
|
||||
p = path_scat.getPointRatio(0, p);
|
||||
var ori = [ p.x, p.y ];
|
||||
_prog_raw = _distrib? random_range(0, 1) : (i / max(1, _repeat - 1)) * 0.9999;
|
||||
_prog = lerp(_range[0], _range[1], _prog_raw);
|
||||
|
||||
var _prog_raw = _distrib? random_range(0, 1) : (i / max(1, line_amount - 1)) * 0.9999;
|
||||
var _prog = lerp(_range[0], _range[1], _prog_raw);
|
||||
_sca = random_range(_scale[0], _scale[1]);
|
||||
_sca *= eval_curve_x(_sca_wid, _prog_raw);
|
||||
|
||||
p = path_base.getPointRatio(_prog, p);
|
||||
var pos = [ p.x, p.y ];
|
||||
_rot = angle_random_eval(_rotation);
|
||||
|
||||
p = path_base.getPointRatio(clamp(_prog - 0.001, 0., 0.9999), p);
|
||||
var x0 = p.x;
|
||||
var y0 = p.y;
|
||||
|
||||
p = path_base.getPointRatio(clamp(_prog + 0.001, 0., 0.9999), p);
|
||||
var x1 = p.x;
|
||||
var y1 = p.y;
|
||||
|
||||
var _dir = point_direction(x0, y0, x1, y1);
|
||||
var _sca = random_range(_scale[0], _scale[1]);
|
||||
_sca *= eval_curve_x(_sca_wid, _prog_raw);
|
||||
|
||||
var _rot = _dir;
|
||||
var _rotW = angle_random_eval(_rotation);
|
||||
_rot += _rotW;
|
||||
|
||||
var _trm = _trim_rng;
|
||||
_trm *= eval_curve_x(_trim, _prog_raw);
|
||||
|
||||
paths[i] = {
|
||||
path : path_scat,
|
||||
ori : ori,
|
||||
pos : pos,
|
||||
rot : _rot,
|
||||
rotW : _rotW,
|
||||
sca : _sca,
|
||||
trim : max(0, _trm),
|
||||
flip : _flip,
|
||||
_trm = _trim_rng;
|
||||
_trm *= eval_curve_x(_trim, _prog_raw);
|
||||
|
||||
for (var k = 0; k < _line_amounts; k++) {
|
||||
|
||||
switch(_resetOri) {
|
||||
case 0 :
|
||||
p = path_scat.getPointRatio(0, k, p);
|
||||
ori = [ p.x, p.y ];
|
||||
break;
|
||||
|
||||
case 1 :
|
||||
p = path_scat.getPointRatio(0, 0, p);
|
||||
ori = [ p.x, p.y ];
|
||||
break;
|
||||
|
||||
case 2 :
|
||||
ori = [ 0, 0 ];
|
||||
break;
|
||||
}
|
||||
|
||||
p = path_base.getPointRatio(_prog, k, p);
|
||||
pos = [ p.x, p.y ];
|
||||
|
||||
p = path_base.getPointRatio(clamp(_prog - 0.001, 0., 0.9999), k, p);
|
||||
x0 = p.x;
|
||||
y0 = p.y;
|
||||
|
||||
p = path_base.getPointRatio(clamp(_prog + 0.001, 0., 0.9999), k, p);
|
||||
x1 = p.x;
|
||||
y1 = p.y;
|
||||
|
||||
_dir = point_direction(x0, y0, x1, y1);
|
||||
_dir += _rot;
|
||||
|
||||
paths[_ind] = {
|
||||
path : path_scat,
|
||||
index : k,
|
||||
ori : ori,
|
||||
pos : pos,
|
||||
rot : _dir,
|
||||
rotW : _rot,
|
||||
sca : _sca,
|
||||
trim : max(0, _trm),
|
||||
flip : _flip,
|
||||
}
|
||||
|
||||
var _segment_counts = array_clone(path_scat.getSegmentCount(k));
|
||||
var _line_lengths = array_clone(path_scat.getLength(k));
|
||||
var _accu_lengths = array_clone(path_scat.getAccuLength(k));
|
||||
|
||||
_line_lengths *= _sca;
|
||||
|
||||
for (var j = 0, m = array_length(_accu_lengths); j < m; j++)
|
||||
_accu_lengths[j] *= _sca;
|
||||
|
||||
segment_counts[_ind] = _segment_counts;
|
||||
line_lengths[_ind] = _line_lengths;
|
||||
accu_lengths[_ind] = _accu_lengths;
|
||||
|
||||
_ind++;
|
||||
}
|
||||
|
||||
var _segment_counts = array_clone(path_scat.getSegmentCount(0));
|
||||
var _line_lengths = array_clone(path_scat.getLength(0));
|
||||
var _accu_lengths = array_clone(path_scat.getAccuLength(0));
|
||||
|
||||
_line_lengths *= _sca;
|
||||
|
||||
for (var j = 0, m = array_length(_accu_lengths); j < m; j++)
|
||||
_accu_lengths[j] *= _sca;
|
||||
|
||||
segment_counts[i] = _segment_counts;
|
||||
line_lengths[i] = _line_lengths;
|
||||
accu_lengths[i] = _accu_lengths;
|
||||
}
|
||||
|
||||
outputs[| 0].setValue(self);
|
||||
|
@ -802,7 +802,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
||||
case VALUE_TYPE.path : #region
|
||||
switch(display_type) {
|
||||
case VALUE_DISPLAY.path_array :
|
||||
editWidget = new pathArrayBox(node, display_data.filter, function(path) { setValueInspector(path); } );
|
||||
editWidget = new pathArrayBox(self, display_data.filter, function(path) { setValueInspector(path); } );
|
||||
break;
|
||||
|
||||
case VALUE_DISPLAY.path_load :
|
||||
|
@ -1155,7 +1155,8 @@ function Panel_Animation() : PanelContent() constructor {
|
||||
return key_hover;
|
||||
} #endregion
|
||||
|
||||
function _drawDopesheetAnimatorKeys(_cont, animator, msx, msy) { #region
|
||||
//// DRAW KEYFRAMES
|
||||
function _drawDopesheetAnimatorKeys(_cont, animator, msx, msy) { #region
|
||||
var _node = _cont.node;
|
||||
var prop_y = animator.y;
|
||||
var node_y = _cont.y;
|
||||
@ -1189,6 +1190,7 @@ function Panel_Animation() : PanelContent() constructor {
|
||||
if(pHOVER && point_in_circle(msx, msy, t, prop_y, ui(8))) {
|
||||
cc = COLORS.panel_animation_keyframe_selected;
|
||||
key_hover = keyframe;
|
||||
TOOLTIP = [ keyframe.value, animator.prop.type ];
|
||||
|
||||
if(pFOCUS && !key_mod_press(SHIFT)) {
|
||||
if(DOUBLE_CLICK) {
|
||||
@ -1238,6 +1240,55 @@ function Panel_Animation() : PanelContent() constructor {
|
||||
var tx = tool_width;
|
||||
var ty = animator.y - 1;
|
||||
|
||||
var hov = item_dragging == noone && pHOVER && point_in_rectangle(msx, msy, 0, ty - ui(8), w, ty + ui(8));
|
||||
|
||||
//// DRAW NAME
|
||||
var cc = prop.sep_axis? COLORS.axis[animator.index] : COLORS._main_text_inner;
|
||||
if(hov) cc = COLORS._main_text_accent;
|
||||
|
||||
draw_set_color(cc);
|
||||
|
||||
var _title_x = ui(32);
|
||||
if(!show_nodes) {
|
||||
var _txt = animator.prop.node.getDisplayName();
|
||||
|
||||
draw_set_alpha(aa * 0.5);
|
||||
draw_text_add(_title_x, ty - 2, _txt);
|
||||
_title_x += string_width(_txt) + ui(4);
|
||||
}
|
||||
|
||||
var _txt = animator.getName();
|
||||
draw_set_alpha(aa);
|
||||
draw_text_add(_title_x, ty - 2, _txt);
|
||||
draw_set_alpha(1);
|
||||
_title_x += string_width(_txt) + ui(4);
|
||||
|
||||
if(hov) {
|
||||
value_hovering = prop;
|
||||
if(mouse_click(mb_left, pFOCUS))
|
||||
value_focusing = prop;
|
||||
}
|
||||
|
||||
var _gx = ui(20);
|
||||
var _gy = ty;
|
||||
if(hov)
|
||||
if(buttonInstant(noone, _gx - ui(10), _gy - ui(9), ui(20), ui(17), [msx, msy], pFOCUS, pHOVER, "", THEME.animate_prop_go, 0, [COLORS._main_icon, COLORS._main_icon_on_inner], 0.75) == 2) {
|
||||
graphFocusNode(_node);
|
||||
PANEL_INSPECTOR.highlightProp(prop);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var _tool_a = 0.5 + hov * 0.5;
|
||||
|
||||
var _on_end_disp = prop.on_end || hov;
|
||||
var _tool_x0 = tool_width - ui(20 + 16 * (3 + _on_end_disp * 1.5) + 12);
|
||||
var _tool_x1 = tool_width;
|
||||
draw_set_color(c_white);
|
||||
BLEND_SUBTRACT
|
||||
draw_rectangle(_tool_x0, ty - ui(8), _tool_x1, ty + ui(8), false);
|
||||
BLEND_NORMAL
|
||||
|
||||
if(prop.show_graph) {
|
||||
var _y1 = ty + ui(10) + prop.graph_h + ui(8);
|
||||
var c1 = colorMultiply(_item.item.color_cur, COLORS.panel_animation_dope_key_bg_hover);
|
||||
@ -1251,7 +1302,7 @@ function Panel_Animation() : PanelContent() constructor {
|
||||
|
||||
#region keyframe control
|
||||
tx = tool_width - ui(20 + 16 * 3);
|
||||
if(buttonInstant(noone, tx - ui(10), ty - ui(9), ui(20), ui(17), [msx, msy], pFOCUS, pHOVER, "", THEME.prop_keyframe, 0, [COLORS._main_icon, COLORS._main_icon_on_inner]) == 2) {
|
||||
if(buttonInstant(noone, tx - ui(10), ty - ui(9), ui(20), ui(17), [msx, msy], pFOCUS, pHOVER, "", THEME.prop_keyframe, 0, [COLORS._main_icon, COLORS._main_icon_on_inner], _tool_a) == 2) {
|
||||
var _t = -1;
|
||||
for(var k = 0; k < ds_list_size(animator.values); k++) {
|
||||
var _key = animator.values[| k];
|
||||
@ -1262,7 +1313,7 @@ function Panel_Animation() : PanelContent() constructor {
|
||||
}
|
||||
|
||||
tx = tool_width - ui(20 + 16 * 1);
|
||||
if(buttonInstant(noone, tx - ui(10), ty - ui(9), ui(20), ui(17), [msx, msy], pFOCUS, pHOVER, "", THEME.prop_keyframe, 2, [COLORS._main_icon, COLORS._main_icon_on_inner]) == 2) {
|
||||
if(buttonInstant(noone, tx - ui(10), ty - ui(9), ui(20), ui(17), [msx, msy], pFOCUS, pHOVER, "", THEME.prop_keyframe, 2, [COLORS._main_icon, COLORS._main_icon_on_inner], _tool_a) == 2) {
|
||||
for(var k = 0; k < ds_list_size(animator.values); k++) {
|
||||
var _key = animator.values[| k];
|
||||
if(_key.time > CURRENT_FRAME) {
|
||||
@ -1275,7 +1326,7 @@ function Panel_Animation() : PanelContent() constructor {
|
||||
|
||||
#region add keyframe
|
||||
tx = tool_width - ui(20 + 16 * 2);
|
||||
if(buttonInstant(noone, tx - ui(10), ty - ui(9), ui(20), ui(17), [msx, msy], pFOCUS, pHOVER, "", THEME.prop_keyframe, 1, [COLORS._main_accent, COLORS._main_icon_on_inner]) == 2) {
|
||||
if(buttonInstant(noone, tx - ui(10), ty - ui(9), ui(20), ui(17), [msx, msy], pFOCUS, pHOVER, "", THEME.prop_keyframe, 1, [COLORS._main_accent, COLORS._main_icon_on_inner], _tool_a) == 2) {
|
||||
var _add = false;
|
||||
for(var k = 0; k < ds_list_size(animator.values); k++) {
|
||||
var _key = animator.values[| k];
|
||||
@ -1297,18 +1348,19 @@ function Panel_Animation() : PanelContent() constructor {
|
||||
if(isGraphable(prop)) {
|
||||
tx = tool_width - ui(16);
|
||||
if(pHOVER && point_in_rectangle(msx, msy, tx - ui(9), ty - ui(10), tx + ui(10), ty + ui(8))) {
|
||||
draw_sprite_ui_uniform(THEME.timeline_graph, 1, tx, ty, 1, COLORS._main_icon_on_inner, 1);
|
||||
draw_sprite_ui_uniform(THEME.timeline_graph, 1, tx, ty, 1, COLORS._main_icon_on_inner, _tool_a);
|
||||
TOOLTIP = __txtx("panel_animation_show_graph", "Show graph");
|
||||
|
||||
if(mouse_press(mb_left, pFOCUS))
|
||||
prop.show_graph = !prop.show_graph;
|
||||
} else
|
||||
draw_sprite_ui_uniform(THEME.timeline_graph, 1, tx, ty, 1, prop.show_graph? COLORS._main_accent : COLORS._main_icon);
|
||||
draw_sprite_ui_uniform(THEME.timeline_graph, 1, tx, ty, 1, prop.show_graph? COLORS._main_accent : COLORS._main_icon, _tool_a);
|
||||
}
|
||||
|
||||
tx = tool_width - ui(20 + 16 * 4.5);
|
||||
|
||||
if(pHOVER && point_in_rectangle(msx, msy, tx - ui(10), ty - ui(9), tx + ui(10), ty + ui(8))) {
|
||||
draw_sprite_ui_uniform(THEME.prop_on_end, prop.on_end, tx, ty, 1, COLORS._main_icon_on_inner, 1);
|
||||
draw_sprite_ui_uniform(THEME.prop_on_end, prop.on_end, tx, ty, 1, COLORS._main_icon_on_inner, _on_end_disp);
|
||||
|
||||
if(tooltip_loop_prop != prop)
|
||||
tooltip_loop_type.arrow_pos = noone;
|
||||
@ -1321,39 +1373,8 @@ function Panel_Animation() : PanelContent() constructor {
|
||||
if(mouse_press(mb_left, pFOCUS))
|
||||
on_end_dragging_anim = prop;
|
||||
} else
|
||||
draw_sprite_ui_uniform(THEME.prop_on_end, prop.on_end, tx, ty, 1, on_end_dragging_anim == prop? COLORS._main_accent : COLORS._main_icon);
|
||||
|
||||
var hov = item_dragging == noone && pHOVER && point_in_rectangle(msx, msy, 0, ty - ui(8), w, ty + ui(8));
|
||||
if(hov) {
|
||||
value_hovering = prop;
|
||||
if(mouse_click(mb_left, pFOCUS))
|
||||
value_focusing = prop;
|
||||
}
|
||||
draw_sprite_ui_uniform(THEME.prop_on_end, prop.on_end, tx, ty, 1, on_end_dragging_anim == prop? COLORS._main_accent : COLORS._main_icon, _on_end_disp);
|
||||
|
||||
var _gx = ui(20);
|
||||
var _gy = ty;
|
||||
if(hov)
|
||||
if(buttonInstant(noone, _gx - ui(10), _gy - ui(9), ui(20), ui(17), [msx, msy], pFOCUS, pHOVER, "", THEME.animate_prop_go, 0, [COLORS._main_icon, COLORS._main_icon_on_inner], 0.75) == 2) {
|
||||
graphFocusNode(_node);
|
||||
PANEL_INSPECTOR.highlightProp(prop);
|
||||
}
|
||||
|
||||
var cc = prop.sep_axis? COLORS.axis[animator.index] : COLORS._main_text_inner;
|
||||
if(hov) cc = COLORS._main_text_accent;
|
||||
|
||||
var _tx = ui(32);
|
||||
draw_set_color(cc);
|
||||
|
||||
if(!show_nodes) {
|
||||
var _txt = animator.prop.node.getDisplayName();
|
||||
|
||||
draw_set_alpha(aa * 0.5);
|
||||
draw_text_add(_tx, ty - 2, _txt);
|
||||
_tx += string_width(_txt) + ui(4);
|
||||
}
|
||||
|
||||
draw_set_alpha(aa);
|
||||
draw_text_add(_tx, ty - 2, animator.getName());
|
||||
draw_set_alpha(1);
|
||||
} #endregion
|
||||
|
||||
@ -1383,7 +1404,7 @@ function Panel_Animation() : PanelContent() constructor {
|
||||
|
||||
function _drawDopesheetLabel() { #region
|
||||
surface_set_target(dope_sheet_name_surface);
|
||||
draw_clear_alpha(COLORS.panel_bg_clear, 0);
|
||||
draw_clear_alpha(COLORS.panel_bg_clear_inner, 0);
|
||||
var msx = mx - ui(8);
|
||||
var msy = my - ui(8);
|
||||
|
||||
|
@ -53,7 +53,8 @@
|
||||
function panel_graph_add_vec3() { CALL("graph_add_vec3"); PANEL_GRAPH.createNodeHotkey("Node_Vector3"); }
|
||||
function panel_graph_add_vec4() { CALL("graph_add_vec4"); PANEL_GRAPH.createNodeHotkey("Node_Vector4"); }
|
||||
function panel_graph_add_display() { CALL("graph_add_disp"); PANEL_GRAPH.createNodeHotkey("Node_Display_Text"); }
|
||||
function panel_graph_add_transform() { CALL("graph_add_transform"); PANEL_GRAPH.doTransform(); }
|
||||
|
||||
function panel_graph_add_math_add() { CALL("graph_add_math_add"); PANEL_GRAPH.createNodeHotkey(Node_create_Math, { query: "add" }); }
|
||||
|
||||
function panel_graph_select_all() { CALL("graph_select_all"); PANEL_GRAPH.nodes_selecting = PANEL_GRAPH.nodes_list; }
|
||||
function panel_graph_toggle_grid() { CALL("graph_toggle_grid"); PANEL_GRAPH.display_parameter.show_grid = !PANEL_GRAPH.display_parameter.show_grid; }
|
||||
@ -63,6 +64,7 @@
|
||||
|
||||
function panel_graph_export() { CALL("graph_export"); PANEL_GRAPH.setCurrentExport(); }
|
||||
|
||||
function panel_graph_add_transform() { CALL("graph_add_transform"); PANEL_GRAPH.doTransform(); }
|
||||
function panel_graph_blend() { CALL("graph_blend"); PANEL_GRAPH.doBlend(); }
|
||||
function panel_graph_compose() { CALL("graph_compose"); PANEL_GRAPH.doCompose(); }
|
||||
function panel_graph_array() { CALL("graph_array"); PANEL_GRAPH.doArray(); }
|
||||
@ -341,14 +343,14 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
||||
addHotkey("Graph", "Preview focusing node", "P", MOD_KEY.none, panel_graph_preview_focus);
|
||||
addHotkey("Graph", "Preview window", "P", MOD_KEY.ctrl, panel_graph_preview_window);
|
||||
|
||||
addHotkey("Graph", "Import image", "I", MOD_KEY.none, panel_graph_import_image);
|
||||
addHotkey("Graph", "Import image array", "I", MOD_KEY.shift, panel_graph_import_image_array);
|
||||
addHotkey("Graph", "Add number", "1", MOD_KEY.none, panel_graph_add_number);
|
||||
addHotkey("Graph", "Add vector2", "2", MOD_KEY.none, panel_graph_add_vec2);
|
||||
addHotkey("Graph", "Add vector3", "3", MOD_KEY.none, panel_graph_add_vec3);
|
||||
addHotkey("Graph", "Add vector4", "4", MOD_KEY.none, panel_graph_add_vec4);
|
||||
addHotkey("Graph", "Add display", "D", MOD_KEY.none, panel_graph_add_display);
|
||||
addHotkey("Graph", "Transform node", "T", MOD_KEY.ctrl, panel_graph_add_transform);
|
||||
addHotkey("Graph", "Import image", "I", MOD_KEY.none, panel_graph_import_image);
|
||||
addHotkey("Graph", "Import image array", "I", MOD_KEY.shift, panel_graph_import_image_array);
|
||||
addHotkey("Graph", "Add Number", "1", MOD_KEY.none, panel_graph_add_number);
|
||||
addHotkey("Graph", "Add Vector2", "2", MOD_KEY.none, panel_graph_add_vec2);
|
||||
addHotkey("Graph", "Add Vector3", "3", MOD_KEY.none, panel_graph_add_vec3);
|
||||
addHotkey("Graph", "Add Vector4", "4", MOD_KEY.none, panel_graph_add_vec4);
|
||||
addHotkey("Graph", "Add Display", "D", MOD_KEY.none, panel_graph_add_display);
|
||||
addHotkey("Graph", "Transform node", "T", MOD_KEY.ctrl, panel_graph_add_transform);
|
||||
|
||||
addHotkey("Graph", "Select all", "A", MOD_KEY.ctrl, panel_graph_select_all);
|
||||
addHotkey("Graph", "Toggle grid", "G", MOD_KEY.none, panel_graph_toggle_grid);
|
||||
@ -2065,8 +2067,11 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
||||
|
||||
//// ============ Action ============
|
||||
|
||||
function createNodeHotkey(_node) { #region
|
||||
var node = nodeBuild(_node, mouse_grid_x, mouse_grid_y);
|
||||
function createNodeHotkey(_node, _param = noone) { #region
|
||||
var node;
|
||||
|
||||
if(is_string(_node)) node = nodeBuild(_node, mouse_grid_x, mouse_grid_y);
|
||||
else node = _node(mouse_grid_x, mouse_grid_y, getCurrentContext(), _param);
|
||||
|
||||
if(value_dragging) {
|
||||
|
||||
|
@ -14,7 +14,7 @@ function pathArrayBox(_target, _data, _onClick) : widget() constructor {
|
||||
|
||||
static trigger = function() {
|
||||
with(dialogCall(o_dialog_image_array_edit, WIN_W / 2, WIN_H / 2))
|
||||
target = other.target;
|
||||
target = other.target;
|
||||
}
|
||||
|
||||
static drawParam = function(params) {
|
||||
|
@ -1,3 +1,12 @@
|
||||
globalvar SPRITE_PATH_MAP;
|
||||
SPRITE_PATH_MAP = {};
|
||||
|
||||
function sprite_add_map(path) {
|
||||
var _s = sprite_add(path, 1, 0, 0, 0, 0);
|
||||
SPRITE_PATH_MAP[$ path] = _s;
|
||||
return _s;
|
||||
}
|
||||
|
||||
function sprite_add_center(path) {
|
||||
if(!file_exists_empty(path)) return noone;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user