Timeline range, Override channel

This commit is contained in:
Tanasart 2024-01-19 15:33:37 +07:00
parent 7389c97dd9
commit fc0bf1d8b5
60 changed files with 628 additions and 229 deletions

View file

@ -569,6 +569,7 @@
{"name":"font_loader","order":8,"path":"scripts/font_loader/font_loader.yy",},
{"name":"sh_water_caustic","order":36,"path":"shaders/sh_water_caustic/sh_water_caustic.yy",},
{"name":"node_iterator_filter_input","order":1,"path":"scripts/node_iterator_filter_input/node_iterator_filter_input.yy",},
{"name":"s_node_ovreride_channel","order":62,"path":"sprites/s_node_ovreride_channel/s_node_ovreride_channel.yy",},
{"name":"point_rotate","order":1,"path":"scripts/point_rotate/point_rotate.yy",},
{"name":"s_node_vfx_variable","order":10,"path":"sprites/s_node_vfx_variable/s_node_vfx_variable.yy",},
{"name":"node_displacement","order":1,"path":"scripts/node_displacement/node_displacement.yy",},
@ -1028,6 +1029,7 @@
{"name":"s_node_json_file_read","order":11,"path":"sprites/s_node_json_file_read/s_node_json_file_read.yy",},
{"name":"s_node_wavelet","order":34,"path":"sprites/s_node_wavelet/s_node_wavelet.yy",},
{"name":"s_workshop_badge_version","order":3,"path":"sprites/s_workshop_badge_version/s_workshop_badge_version.yy",},
{"name":"node_override_channel","order":2,"path":"scripts/node_override_channel/node_override_channel.yy",},
{"name":"s_node_palette_shift","order":58,"path":"sprites/s_node_palette_shift/s_node_palette_shift.yy",},
{"name":"__strandSim","order":2,"path":"scripts/__strandSim/__strandSim.yy",},
{"name":"s_node_random_tile","order":40,"path":"sprites/s_node_random_tile/s_node_random_tile.yy",},
@ -1740,6 +1742,7 @@
{"name":"node_string_merge","order":6,"path":"scripts/node_string_merge/node_string_merge.yy",},
{"name":"d3d_plane_mesh","order":6,"path":"scripts/d3d_plane_mesh/d3d_plane_mesh.yy",},
{"name":"s_node_palette_replace","order":1,"path":"sprites/s_node_palette_replace/s_node_palette_replace.yy",},
{"name":"sh_override_channel","order":21,"path":"shaders/sh_override_channel/sh_override_channel.yy",},
{"name":"node_action_object","order":1,"path":"scripts/node_action_object/node_action_object.yy",},
{"name":"Obj_Debug_FallText_Firestore","order":3,"path":"objects/Obj_Debug_FallText_Firestore/Obj_Debug_FallText_Firestore.yy",},
{"name":"s_node_pb_box_divide","order":24,"path":"sprites/s_node_pb_box_divide/s_node_pb_box_divide.yy",},

View file

@ -800,6 +800,7 @@
{"id":{"name":"font_loader","path":"scripts/font_loader/font_loader.yy",},},
{"id":{"name":"sh_water_caustic","path":"shaders/sh_water_caustic/sh_water_caustic.yy",},},
{"id":{"name":"node_iterator_filter_input","path":"scripts/node_iterator_filter_input/node_iterator_filter_input.yy",},},
{"id":{"name":"s_node_ovreride_channel","path":"sprites/s_node_ovreride_channel/s_node_ovreride_channel.yy",},},
{"id":{"name":"point_rotate","path":"scripts/point_rotate/point_rotate.yy",},},
{"id":{"name":"s_node_vfx_variable","path":"sprites/s_node_vfx_variable/s_node_vfx_variable.yy",},},
{"id":{"name":"node_struct","path":"scripts/node_struct/node_struct.yy",},},
@ -1327,6 +1328,7 @@
{"id":{"name":"s_node_json_file_read","path":"sprites/s_node_json_file_read/s_node_json_file_read.yy",},},
{"id":{"name":"s_node_wavelet","path":"sprites/s_node_wavelet/s_node_wavelet.yy",},},
{"id":{"name":"s_workshop_badge_version","path":"sprites/s_workshop_badge_version/s_workshop_badge_version.yy",},},
{"id":{"name":"node_override_channel","path":"scripts/node_override_channel/node_override_channel.yy",},},
{"id":{"name":"s_node_palette_shift","path":"sprites/s_node_palette_shift/s_node_palette_shift.yy",},},
{"id":{"name":"__strandSim","path":"scripts/__strandSim/__strandSim.yy",},},
{"id":{"name":"s_node_random_tile","path":"sprites/s_node_random_tile/s_node_random_tile.yy",},},
@ -2139,6 +2141,7 @@
{"id":{"name":"node_string_merge","path":"scripts/node_string_merge/node_string_merge.yy",},},
{"id":{"name":"d3d_plane_mesh","path":"scripts/d3d_plane_mesh/d3d_plane_mesh.yy",},},
{"id":{"name":"s_node_palette_replace","path":"sprites/s_node_palette_replace/s_node_palette_replace.yy",},},
{"id":{"name":"sh_override_channel","path":"shaders/sh_override_channel/sh_override_channel.yy",},},
{"id":{"name":"node_action_object","path":"scripts/node_action_object/node_action_object.yy",},},
{"id":{"name":"Obj_Debug_FallText_Firestore","path":"objects/Obj_Debug_FallText_Firestore/Obj_Debug_FallText_Firestore.yy",},},
{"id":{"name":"s_node_pb_box_divide","path":"sprites/s_node_pb_box_divide/s_node_pb_box_divide.yy",},},

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 58 KiB

View file

@ -85,13 +85,14 @@ _HOVERING_ELEMENT = noone;
UPDATE_RENDER_ORDER = false;
if(PROJECT.active) {
PROJECT.animator.is_simulating = false;
array_foreach(PROJECT.nodeArray, function(_node) { if(!_node.active) return; _node.stepBegin(); });
if(IS_PLAYING || IS_RENDERING) {
if(PROJECT.animator.frame_progress) {
__addon_preAnim();
if(CURRENT_FRAME == 0)
if(IS_FIRST_FRAME)
ResetAllNodesRender();
Render(true);
@ -107,7 +108,6 @@ _HOVERING_ELEMENT = noone;
}
}
if(LAST_FRAME) RENDERING = [];
UPDATE = RENDER_TYPE.none;
#endregion

View file

@ -8,12 +8,17 @@
#macro ANIMATION_STATIC !(PROJECT.animator.is_playing || PROJECT.animator.frame_progress)
#macro IS_PLAYING PROJECT.animator.is_playing
#macro IS_RENDERING PROJECT.animator.is_rendering
#macro CURRENT_FRAME PROJECT.animator.current_frame
#macro LAST_FRAME (CURRENT_FRAME == TOTAL_FRAMES - 1)
#macro TOTAL_FRAMES PROJECT.animator.frames_total
#macro RENDERING PROJECT.animator.rendering
#macro FRAME_RANGE PROJECT.animator.frame_range
#macro IS_RENDERING array_length(PROJECT.animator.rendering)
#macro FIRST_FRAME PROJECT.animator.getFirstFrame()
#macro LAST_FRAME PROJECT.animator.getLastFrame()
#macro IS_FIRST_FRAME PROJECT.animator.isFirstFrame()
#macro IS_LAST_FRAME PROJECT.animator.isLastFrame()
#endregion
#region animation class
@ -25,46 +30,42 @@
framerate = 30;
is_playing = false;
is_rendering = false;
frame_progress = false;
render_stop = false;
frame_range = noone;
is_simulating = false;
__debug_animator_counter = 0;
rendering = [];
playback = ANIMATOR_END.loop;
static setFrame = function(frame, resetTime = true) { #region
static setFrame = function(frame) { #region
var _c = current_frame;
frame = clamp(frame, 0, frames_total);
real_frame = frame;
current_frame = round(frame);
if(current_frame == frames_total) {
if(render_stop) {
is_playing = false;
setFrame(0, resetTime);
render_stop = false;
} else if(playback == ANIMATOR_END.stop) {
is_playing = false;
} else {
setFrame(0, resetTime);
}
}
frame_progress = _c != current_frame;
if(_c != current_frame) {
frame_progress = true;
if(resetTime)
time_since_last_frame = 0;
if(frame_progress) {
time_since_last_frame = 0;
RENDER_ALL
} else
frame_progress = false;
if(array_length(rendering)) render_stop = true;
}
} #endregion
static getFirstFrame = function(range = true) { INLINE return range && frame_range != noone? frame_range[0] - 1 : 0; }
static getLastFrame = function(range = true) { INLINE return range && frame_range != noone? frame_range[1] - 1 : frames_total - 1; }
static firstFrame = function(range = true) { INLINE setFrame(getFirstFrame(range)); }
static lastFrame = function(range = true) { INLINE setFrame(getLastFrame(range)); }
static isFirstFrame = function() { INLINE return current_frame == getFirstFrame(); }
static isLastFrame = function() { INLINE return current_frame == getLastFrame(); }
static resetAnimation = function() { #region
INLINE
var _key = ds_map_find_first(PROJECT.nodeMap);
var amo = ds_map_size(PROJECT.nodeMap);
@ -75,45 +76,77 @@
}
} #endregion
static render = function() { #region
setFrame(0);
is_playing = true;
frame_progress = true;
time_since_last_frame = 0;
} #endregion
static toggle = function() { #region
is_playing = !is_playing;
frame_progress = true;
INLINE
is_playing = !is_playing;
frame_progress = true;
time_since_last_frame = 0;
} #endregion
static pause = function() { #region
is_playing = false;
frame_progress = true;
INLINE
is_playing = false;
frame_progress = true;
time_since_last_frame = 0;
} #endregion
static play = function() { #region
setFrame(0);
is_playing = true;
frame_progress = true;
INLINE
if(is_simulating) setFrame(0);
else firstFrame();
is_playing = true;
frame_progress = true;
time_since_last_frame = 0;
} #endregion
static render = function() { #region
INLINE
if(is_simulating) setFrame(0);
else firstFrame();
is_playing = true;
is_rendering = true;
frame_progress = true;
time_since_last_frame = 0;
} #endregion
static resume = function() { #region
is_playing = true;
frame_progress = true;
INLINE
is_playing = true;
frame_progress = true;
time_since_last_frame = 0;
} #endregion
static stop = function() { #region
setFrame(0);
is_playing = false;
INLINE
firstFrame();
is_playing = false;
time_since_last_frame = 0;
} #endregion
static step = function() { #region
INLINE
if(frame_range != noone) {
var _fr0 = min(frame_range[0], frame_range[1]);
var _fr1 = max(frame_range[0], frame_range[1]);
if(_fr0 == _fr1) {
frame_range = noone;
} else {
frame_range[0] = max(_fr0, 0);
frame_range[1] = min(_fr1, frames_total);
}
}
if(!is_playing) return;
var _frTime = 1 / framerate;
@ -121,15 +154,22 @@
var tslf = time_since_last_frame;
if(time_since_last_frame >= _frTime) {
setFrame(real_frame + 1, false);
time_since_last_frame -= _frTime;
var dt = time_since_last_frame - _frTime;
setFrame(real_frame + 1);
time_since_last_frame = dt;
var _maxFrame = frame_range != noone? frame_range[1] : frames_total;
if(current_frame >= _maxFrame) {
firstFrame();
//var _t = get_timer();
//print($"Frame progress {current_frame} delay {(_t - __debug_animator_counter) / 1000}");
//__debug_animator_counter = _t;
}
if(playback == ANIMATOR_END.stop || is_rendering) {
is_playing = false;
is_rendering = false;
time_since_last_frame = 0;
}
}
//print($" > TSLF: {tslf} > {_frTime} > {time_since_last_frame}");
}
} #endregion
}
#endregion

View file

@ -57,7 +57,7 @@ function Node_3D_Mesh_Terrain(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y, _gr
array_copy(_h, 0, _hia, 0, min(array_length(_h), array_length(_hia)));
}
if(CURRENT_FRAME == 0) object.initModel();
if(IS_FIRST_FRAME) object.initModel();
object.checkParameter({ subdivision: _sub });
object.updateHeight(_h);

View file

@ -16,7 +16,7 @@ function Node_3D_Particle(_x, _y, _group = noone) : Node_3D_Modifier(_x, _y, _gr
seed = irandom_range(100000, 999999);
static processData_prebatch = function() {
if(CURRENT_FRAME == 0) {
if(IS_FIRST_FRAME) {
var _sed = seed;
for( var i = 0; i < part_pool_size; i++ )

View file

@ -68,7 +68,7 @@ function Node_3D_Point_Affector(_x, _y, _group = noone) : Node_3D_Object(_x, _y,
plane_normal = _prot.Rotate(new BBMOD_Vec3(0, 0, 1)).ToArray();
}
if(CURRENT_FRAME == 0)
if(IS_FIRST_FRAME)
curve_falloff = new curveMap(_fcrv, 100);
}

View file

@ -102,7 +102,7 @@ function Node_FLIP_Apply_Force(_x, _y, _group = noone) : Node(_x, _y, _group) co
obstracle.y = _posit[1];
obstracle.texture = _tex;
if(frame == 0) {
if(IS_FIRST_FRAME) {
index = FLIP_createObstracle(domain.domain);
array_push(domain.obstracles, obstracle);
}

View file

@ -118,7 +118,7 @@ function Node_FLIP_Domain(_x, _y, _group = noone) : Node(_x, _y, _group) constru
var _itrP = attributes.iteration_pressure;
var _itrR = attributes.iteration_particle;
if(frame == 0) {
if(IS_FIRST_FRAME) {
var width = _dim[0] + _siz * 2;
var height = _dim[1] + _siz * 2;
var particleSize = _siz;

View file

@ -3,6 +3,7 @@ function Node_FLIP_Group_Inline(_x, _y, _group = noone) : Node_Collection_Inline
color = COLORS.node_blend_fluid;
icon = THEME.fluid_sim;
is_simulation = true;
update_on_frame = true;
if(!LOADING && !APPENDING && !CLONING) {

View file

@ -103,7 +103,7 @@ function Node_FLIP_Spawner(_x, _y, _group = noone) : Node(_x, _y, _group) constr
var _dirr = getInputData(10);
var _ivel = getInputData(11);
if(frame == 0) spawn_amo = 0;
if(IS_FIRST_FRAME) spawn_amo = 0;
_amo = min(_amo, domain.maxParticles - domain.numParticles);
spawn_amo += _amo;

View file

@ -73,7 +73,7 @@ function Node_VFX_Group(_x, _y, _group = noone) : Node_Collection(_x, _y, _group
} #endregion
static update = function() { #region
if(CURRENT_FRAME == 0)
if(IS_FIRST_FRAME)
NodeListSort(topoList, nodes);
allCached = true;
@ -82,7 +82,7 @@ function Node_VFX_Group(_x, _y, _group = noone) : Node_Collection(_x, _y, _group
if(!node.recoverCache()) allCached = false;
}
if(!allCached && CURRENT_FRAME == 0)
if(!allCached && IS_FIRST_FRAME)
reset();
if(allCached) {

View file

@ -9,6 +9,7 @@ function Node_VFX_Group_Inline(_x, _y, _group = noone) : Node_Collection_Inline(
inputs[| 0] = nodeValue("Loop", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true )
.rejectArray();
is_simulation = true;
update_on_frame = true;
managedRenderOrder = true;
@ -68,7 +69,7 @@ function Node_VFX_Group_Inline(_x, _y, _group = noone) : Node_Collection_Inline(
} #endregion
static update = function() { #region
if(CURRENT_FRAME == 0) {
if(IS_FIRST_FRAME) {
NodeListSort(topoList, nodes);
reset();
}

View file

@ -71,18 +71,18 @@ function Node_Active_Canvas(_x, _y, _group = noone) : Node(_x, _y, _group) const
outputs[| 0].setValue(_surf);
surface_set_target(_surf);
if(CURRENT_FRAME == 0) DRAW_CLEAR
if(IS_FIRST_FRAME) DRAW_CLEAR
if(_bact) {
if(!is_surface(_bsurf)) {
if(CURRENT_FRAME == 0 || brush_prev == noone)
if(IS_FIRST_FRAME || brush_prev == noone)
draw_point_color(_bpos[0] - 1, _bpos[1] - 1, _bcol);
else
draw_line_color(brush_prev[2][0] - 1, brush_prev[2][1] - 1, _bpos[0] - 1, _bpos[1] - 1, brush_prev[5], _bcol);
} else {
BLEND_ALPHA
if(CURRENT_FRAME == 0 || brush_prev == noone) {
if(IS_FIRST_FRAME || brush_prev == noone) {
brush_draw_surface(_bsurf, _bpos[0], _bpos[1], _bsca[0], _bsca[1], _brot, _bcol, _balp);
} else {
var _x0 = brush_prev[2][0];

View file

@ -47,7 +47,7 @@ function __Node_Cache(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
static disableNodeGroup = function() { #region
if(LOADING || APPENDING) return;
if(IS_PLAYING && LAST_FRAME)
if(IS_PLAYING && IS_LAST_FRAME)
for( var i = 0, n = array_length(cache_group_members); i < n; i++ )
cache_group_members[i].renderActive = false;
} #endregion

View file

@ -210,6 +210,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
topoSorted = false;
temp_surface = [];
force_requeue = false;
is_simulation = false;
in_VFX = false;
@ -507,6 +508,8 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
setHeight();
will_setHeight = false;
}
if(is_simulation) PROJECT.animator.is_simulating = true;
} #endregion
static doStepBegin = function() {}

View file

@ -100,7 +100,7 @@ function Node_Dust(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
_outSurf = surface_verify(_outSurf, _dim[0], _dim[1]);
outputs[| 0].setValue(_outSurf);
if(CURRENT_FRAME == 0) {
if(IS_FIRST_FRAME) {
dusts = [ new __Dust( 0, _dim[1] / 2 ) ];
} else {
for( var i = 0, n = array_length(dusts); i < n; i++ )

View file

@ -117,6 +117,9 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
inputs[| 14] = nodeValue("Frame step", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1);
inputs[| 15] = nodeValue("Custom Range", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false)
.rejectArray();
outputs[| 0] = nodeValue("Loop exit", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, 0);
outputs[| 1] = nodeValue("Preview", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone)
@ -202,8 +205,9 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
input_display_list = [
["Export", false], 0, 1, 2, export_template,
["Format ", false], 3, 9, 6, 7, 10, 13,
["Animation", false], 12, 8, 5, 11, 14,
["Format", false], 3, 9, 6, 7, 10, 13,
["Custom Range", true, 15], 12,
["Animation", false], 8, 5, 11, 14,
];
render_process_id = 0;
@ -328,8 +332,6 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
render_process_id = shell_execute_async(webp, cmd, self);
render_type = "webp";
render_target = target_path;
if(render_process_id != 0) array_push(RENDERING, node_id);
} #endregion
static renderGif = function(temp_path, target_path) { #region
@ -352,8 +354,6 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
render_process_id = shell_execute_async(converter, shell_cmd, self);
render_type = "gif";
render_target = target_path;
if(render_process_id != 0) array_push(RENDERING, node_id);
} #endregion
static renderMp4 = function(temp_path, target_path) { #region
@ -371,8 +371,6 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
render_process_id = shell_execute_async(ffmpeg, shell_cmd, self);
render_type = "mp4";
render_target = target_path;
if(render_process_id != 0) array_push(RENDERING, node_id);
} #endregion
static renderApng = function(temp_path, target_path) { #region
@ -389,8 +387,6 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
render_process_id = shell_execute_async(ffmpeg, shell_cmd, self);
render_type = "apng";
render_target = target_path;
if(render_process_id != 0) array_push(RENDERING, node_id);
} #endregion
static pathString = function(path, index = 0, _array = false) { #region
@ -420,12 +416,12 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
var float_str = string_digits(str);
if(float_str != "") {
var float_val = string_digits(float_str);
var str_val = max(float_val - string_length(string(CURRENT_FRAME + strt)), 0);
var str_val = max(float_val - string_length(string(CURRENT_FRAME + 1 + strt)), 0);
repeat(str_val)
_txt += "0";
}
_txt += string(CURRENT_FRAME + strt);
_txt += string(CURRENT_FRAME + 1 + strt);
if(_array) array_push(s, [ "f", _txt ]);
else s += _txt;
res = true;
@ -561,14 +557,15 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
var form = getInputData( 3);
var rang = getInputData(12);
var stps = getInputData(14);
var user = getInputData(15);
if(form >= 1) {
if(form >= 1 && user) {
var rng_s = rang[0];
var rng_e = rang[1] == -1? TOTAL_FRAMES : rang[1];
var rng_e = rang[1];
var rng_st = stps >= 1? (CURRENT_FRAME - rng_s) % stps : 0;
if(CURRENT_FRAME < rng_s) return;
if(CURRENT_FRAME > rng_e) return;
if(CURRENT_FRAME < rng_s - 1) return;
if(CURRENT_FRAME > rng_e - 1) return;
if(rng_st != 0) return;
}
@ -714,10 +711,8 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
update_on_frame = true;
playing = true;
played = 0;
PROJECT.animator.real_frame = -1;
CURRENT_FRAME = -1;
IS_PLAYING = true;
array_push(RENDERING, node_id);
PROJECT.animator.render();
if(directory_exists(directory))
directory_destroy(directory);
@ -743,10 +738,13 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
var anim = getInputData(3); // single, sequence, animation
var extn = getInputData(9);
var user = getInputData(15);
inputs[| 11].setVisible(anim == 1);
inputs[| 12].setVisible(anim > 0);
inputs[| 12].editWidget.maxx = TOTAL_FRAMES;
inputs[| 12].editWidget.minn = FIRST_FRAME + 1;
inputs[| 12].editWidget.maxx = LAST_FRAME + 1;
if(!user) inputs[| 12].setValueDirect([ FIRST_FRAME + 1, LAST_FRAME + 1], noone, false, 0, false);
inputs[| 14].setVisible(anim > 0);
@ -827,10 +825,8 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
export();
if(LAST_FRAME) {
if(anim == NODE_EXPORT_FORMAT.animation)
renderCompleted();
}
if(IS_LAST_FRAME && anim == NODE_EXPORT_FORMAT.animation)
renderCompleted();
} #endregion
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region

View file

@ -14,7 +14,7 @@ function Node_Feedback_Output(_x, _y, _group = noone) : Node_Group_Output(_x, _y
static update = function(frame = CURRENT_FRAME) {
if(inputs[| 0].isLeaf()) return;
if(LAST_FRAME) {
if(IS_LAST_FRAME) {
cache_value = noone;
return;
}

View file

@ -68,7 +68,7 @@ function Node_Fluid_Domain(_x, _y, _group = noone) : Node_Fluid(_x, _y, _group)
var vMac = inputs[| 10].getValue(frame);
var wrap = inputs[| 11].getValue(frame);
if(CURRENT_FRAME == 0 || !is_surface(domain.sf_world)) {
if(IS_FIRST_FRAME || !is_surface(domain.sf_world)) {
fd_rectangle_clear(domain);
fd_rectangle_destroy(domain);
domain = fd_rectangle_create(_dim[0], _dim[1]);

View file

@ -81,7 +81,7 @@ function Node_Fluid_Group(_x, _y, _group = noone) : Node_Collection(_x, _y, _gro
var vMac = getInputData(10);
var wrap = getInputData(11);
if(CURRENT_FRAME == 0 || !is_surface(domain.sf_world)) {
if(IS_FIRST_FRAME || !is_surface(domain.sf_world)) {
fd_rectangle_clear(domain);
fd_rectangle_destroy(domain);
domain = fd_rectangle_create(_dim[0], _dim[1]);

View file

@ -3,6 +3,8 @@ function Node_Fluid_Group_Inline(_x, _y, _group = noone) : Node_Collection_Inlin
color = COLORS.node_blend_smoke;
icon = THEME.smoke_sim;
is_simulation = true;
if(!LOADING && !APPENDING && !CLONING) {
var _domain = nodeBuild("Node_Fluid_Domain", x, y);
var _render = nodeBuild("Node_Fluid_Render", x + 320, y);

View file

@ -49,7 +49,7 @@ function Node_Iterate_Sort(_x, _y, _group = noone) : Node_Collection(_x, _y, _gr
} #endregion
static update = function(frame = CURRENT_FRAME) { #region
if(frame == 0 || !IS_PLAYING) {
if(IS_FIRST_FRAME) {
NodeListSort(topoList, nodes);
inputNodes = [ noone, noone ];

View file

@ -76,8 +76,7 @@ function Node_Iterate_Sort_Inline(_x, _y, _group = noone) : Node_Collection_Inli
return;
}
if(frame == 0 || !IS_PLAYING)
NodeListSort(topoList, nodes);
if(IS_FIRST_FRAME) NodeListSort(topoList, nodes);
sortArray();
} #endregion

View file

@ -167,7 +167,7 @@ function Node_Line(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
var _clamp = _data[26];
#endregion
if(CURRENT_FRAME == 0 || inputs[| 11].is_anim)
if(IS_FIRST_FRAME || inputs[| 11].is_anim)
ds_map_clear(widthMap);
var __debug_timer = get_timer();

View file

@ -26,7 +26,7 @@ function Node_Lua_Global(_x, _y, _group = noone) : Node(_x, _y, _group) construc
static stepBegin = function() { #region
var _type = getInputData(1);
if(PROJECT.animator.is_playing && PROJECT.animator.frame_progress && (CURRENT_FRAME == 0 || _type == 1))
if(PROJECT.animator.is_playing && PROJECT.animator.frame_progress && (IS_FIRST_FRAME || _type == 1))
setRenderStatus(false);
setHeight();
@ -64,7 +64,7 @@ function Node_Lua_Global(_x, _y, _group = noone) : Node(_x, _y, _group) construc
var _code = getInputData(0);
var _type = getInputData(1);
//if(CURRENT_FRAME == 0) { //rerfesh state on the first frame
//if(IS_FIRST_FRAME) { //rerfesh state on the first frame
// lua_state_destroy(lua_state);
// lua_state = lua_create();
// addCode();
@ -72,7 +72,7 @@ function Node_Lua_Global(_x, _y, _group = noone) : Node(_x, _y, _group) construc
lua_projectData(getState());
if(CURRENT_FRAME == 0 || _type == 1) {
if(IS_FIRST_FRAME || _type == 1) {
try { lua_add_code(getState(), _code); }
catch(e) { noti_warning(exception_print(e),, self); }
}

View file

@ -165,7 +165,7 @@ function Node_Lua_Surface(_x, _y, _group = noone) : Node(_x, _y, _group) constru
array_push(argument_val, getInputData(i + 2));
}
//if(CURRENT_FRAME == 0) { //rerfesh state on the first frame
//if(IS_FIRST_FRAME) { //rerfesh state on the first frame
// lua_state_destroy(lua_state);
// lua_state = lua_create();
// addCode();

View file

@ -206,7 +206,7 @@ function Node_MK_Flag(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
} #endregion
static processData_prebatch = function() { #region
if(CURRENT_FRAME == 0) setGeometry();
if(IS_FIRST_FRAME) setGeometry();
stepFlag();
} #endregion

View file

@ -79,14 +79,14 @@ function Node_MK_Saber(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
var _dir = point_direction(_p1x, _p1y, _p2x, _p2y);
var _cur;
if(prev_points == noone || CURRENT_FRAME == 0) prev_points = [];
if(prev_points == noone || IS_FIRST_FRAME) prev_points = [];
if(!is_array(array_safe_get(prev_points, _array_index)))
prev_points[_array_index] = [];
if(_fixl) { #region
var _prevArr = prev_points[_array_index];
if(CURRENT_FRAME == 0)
if(IS_FIRST_FRAME)
fixed_length = point_distance(_pnt1[0], _pnt1[1], _pnt2[0], _pnt2[1]);
else if(!array_empty(_prevArr)){
var _prev = _prevArr[array_length(_prevArr) - 1];

View file

@ -0,0 +1,12 @@
{
"isDnD": false,
"isCompatibility": false,
"parent": {
"name": "filter",
"path": "folders/nodes/data/filter.yy",
},
"resourceVersion": "1.0",
"name": "node_color_adjustment",
"tags": [],
"resourceType": "GMScript",
}

View file

@ -0,0 +1,12 @@
{
"isDnD": false,
"isCompatibility": false,
"parent": {
"name": "process",
"path": "folders/nodes/data/process.yy",
},
"resourceVersion": "1.0",
"name": "node_color_replacement",
"tags": [],
"resourceType": "GMScript",
}

View file

@ -0,0 +1,12 @@
{
"isDnD": false,
"isCompatibility": false,
"parent": {
"name": "filter",
"path": "folders/nodes/data/filter.yy",
},
"resourceVersion": "1.0",
"name": "node_greyscale",
"tags": [],
"resourceType": "GMScript",
}

View file

@ -0,0 +1,12 @@
{
"isDnD": false,
"isCompatibility": false,
"parent": {
"name": "process",
"path": "folders/nodes/data/process.yy",
},
"resourceVersion": "1.0",
"name": "node_outline",
"tags": [],
"resourceType": "GMScript",
}

View file

@ -0,0 +1,49 @@
function Node_Override_Channel(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
name = "Override Channel";
inputs[| 0] = nodeValue("Surface", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone);
inputs[| 1] = nodeValue("Red", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone);
inputs[| 2] = nodeValue("Green", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone);
inputs[| 3] = nodeValue("Blue", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone);
inputs[| 4] = nodeValue("Alpha", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone);
inputs[| 5] = nodeValue("Sampling type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
.setDisplay(VALUE_DISPLAY.enum_scroll, ["Brightness", "Channel value"]);
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
input_display_list = [ 0,
["Sampling", false], 5,
["Surfaces", true], 1, 2, 3, 4,
]
attribute_surface_depth();
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
var _s = _data[0];
var _r = _data[1];
var _g = _data[2];
var _b = _data[3];
var _a = _data[4];
var _m = _data[5];
surface_set_shader(_outSurf, sh_override_channel);
shader_set_surface("samplerR", _r);
shader_set_surface("samplerG", _g);
shader_set_surface("samplerB", _b);
shader_set_surface("samplerA", _a);
shader_set_i("useR", is_surface(_r));
shader_set_i("useG", is_surface(_g));
shader_set_i("useB", is_surface(_b));
shader_set_i("useA", is_surface(_a));
shader_set_i("mode", _m);
draw_surface_safe(_s);
surface_reset_shader();
return _outSurf;
} #endregion
}

View file

@ -0,0 +1,11 @@
{
"resourceType": "GMScript",
"resourceVersion": "1.0",
"name": "node_override_channel",
"isCompatibility": false,
"isDnD": false,
"parent": {
"name": "combine",
"path": "folders/nodes/data/filter/combine.yy",
},
}

View file

@ -46,7 +46,7 @@ function Node_Particle(_x, _y, _group = noone) : Node_VFX_Spawner_Base(_x, _y, _
}
if(PROJECT.animator.is_playing)
PROJECT.animator.setFrame(-1);
PROJECT.animator.firstFrame();
} #endregion
static reLoop = function() { #region
@ -88,7 +88,7 @@ function Node_Particle(_x, _y, _group = noone) : Node_VFX_Spawner_Base(_x, _y, _
outputs[| 0].setValue(_outSurf);
if(CURRENT_FRAME == 0) {
if(IS_FIRST_FRAME) {
reset();
if(IS_PLAYING) reLoop();
}

View file

@ -488,9 +488,10 @@ function __initNodes() {
var filter = ds_list_create(); #region
addNodeCatagory("Filter", filter);
ds_list_add(filter, "Combines");
addNodeObject(filter, "Blend", s_node_blend, "Node_Blend", [0, Node_create_Blend], ["normal", "add", "subtract", "multiply", "screen", "maxx", "minn"], "Blend 2 images using different blendmodes.");
addNodeObject(filter, "RGBA Combine", s_node_RGB_combine, "Node_Combine_RGB", [1, Node_Combine_RGB],, "Combine 4 image in to one. Each image use to control RGBA channel.").setVersion(1070);
addNodeObject(filter, "HSV Combine", s_node_HSV_combine, "Node_Combine_HSV", [1, Node_Combine_HSV],, "Combine 4 image in to one. Each image use to control HSVA channel.").setVersion(1070);
addNodeObject(filter, "Blend", s_node_blend, "Node_Blend", [0, Node_create_Blend], ["normal", "add", "subtract", "multiply", "screen", "maxx", "minn"], "Blend 2 images using different blendmodes.");
addNodeObject(filter, "RGBA Combine", s_node_RGB_combine, "Node_Combine_RGB", [1, Node_Combine_RGB],, "Combine 4 image in to one. Each image use to control RGBA channel.").setVersion(1070);
addNodeObject(filter, "HSV Combine", s_node_HSV_combine, "Node_Combine_HSV", [1, Node_Combine_HSV],, "Combine 4 image in to one. Each image use to control HSVA channel.").setVersion(1070);
addNodeObject(filter, "Override Channel", s_node_ovreride_channel, "Node_Override_Channel", [1, Node_Override_Channel],, "Replace RGBA value of one surface with anothers.").setVersion(11640);
ds_list_add(filter, "Blurs");
addNodeObject(filter, "Blur", s_node_blur, "Node_Blur", [1, Node_Blur], ["gaussian blur"], "Blur image smoothly.");

View file

@ -41,12 +41,14 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group)
.setDisplay(VALUE_DISPLAY.padding)
inputs[| 8] = nodeValue("Range", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 0, 0 ], "Starting/ending frames, set end to 0 to default to last frame.")
.setDisplay(VALUE_DISPLAY.vector)
.setDisplay(VALUE_DISPLAY.slider_range)
inputs[| 9] = nodeValue("Spacing", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 0, 0 ])
.setDisplay(VALUE_DISPLAY.vector);
inputs[| 10] = nodeValue("Overlappable", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false)
inputs[| 10] = nodeValue("Overlappable", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false);
inputs[| 11] = nodeValue("Custom Range", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false);
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
@ -55,9 +57,10 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group)
input_display_list = [
["Surfaces", false], 0, 1, 2,
["Sprite", false], 3, 8,
["Sprite", false], 3,
["Packing", false], 4, 5, 6, 9, 7,
["Rendering", false], 10,
["Custom Range", true, 11], 8,
]
attribute_surface_depth();
@ -76,12 +79,12 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group)
}
PROJECT.animator.render();
array_push(RENDERING, node_id);
} #endregion
static step = function() { #region
var grup = getInputData(1);
var pack = getInputData(3);
var user = getInputData(11);
if(pack == 0) inputs[| 5].editWidget.data = [ "Top", "Center", "Bottom" ];
else inputs[| 5].editWidget.data = [ "Left", "Center", "Right" ];
@ -92,6 +95,10 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group)
inputs[| 6].setVisible(pack != SPRITE_STACK.grid);
inputs[| 9].setVisible(pack == SPRITE_STACK.grid);
inputs[| 8].editWidget.minn = FIRST_FRAME + 1;
inputs[| 8].editWidget.maxx = LAST_FRAME + 1;
if(!user) inputs[| 8].setValueDirect([ FIRST_FRAME + 1, LAST_FRAME + 1], noone, false, 0, false);
update_on_frame = grup == 0;
} #endregion
@ -300,6 +307,7 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group)
var rang = getInputData(8);
var spc2 = getInputData(9);
var ovlp = getInputData(10);
var user = getInputData(11);
var _atl = outputs[| 1].getValue();
var cDep = attrDepth();
@ -311,14 +319,16 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group)
if(!arr) inpt = [ inpt ];
#region frame
var _st, _ed;
var _st = FIRST_FRAME;
var _ed = LAST_FRAME + 1;
if(rang[0] < 0) _st = TOTAL_FRAMES + rang[0];
else _st = rang[0];
if(user) {
if(rang[0] < 0) _st = LAST_FRAME + rang[0] - 1;
else _st = rang[0] - 1;
if(rang[1] == 0) _ed = TOTAL_FRAMES;
else if(rang[1] < 0) _ed = TOTAL_FRAMES + rang[1];
else _ed = rang[1];
if(rang[1] < 0) _ed = LAST_FRAME + rang[1];
else _ed = rang[1];
}
if(_ed <= _st) return;
var amo = floor((_ed - _st) / skip);
@ -348,11 +358,10 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group)
hh = sh * amo + spac * (amo - 1);
break;
case SPRITE_STACK.grid :
var col = getInputData(4);
var row = ceil(amo / col);
var row = ceil(amo / grid);
ww = sw * col + spc2[0] * (col - 1);
hh = sh * row + spc2[1] * (row - 1);
ww = sw * grid + spc2[0] * (grid - 1);
hh = sh * row + spc2[1] * (row - 1);
break;
}
@ -385,6 +394,7 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group)
var rang = getInputData(8);
var spc2 = getInputData(9);
var ovlp = getInputData(10);
var user = getInputData(11);
var _atl = outputs[| 1].getValue();
var cDep = attrDepth();
@ -396,14 +406,16 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group)
if(!arr) inpt = [ inpt ];
#region frame
var _st, _ed;
var _st = FIRST_FRAME;
var _ed = LAST_FRAME + 1;
if(rang[0] < 0) _st = TOTAL_FRAMES + rang[0];
else _st = rang[0];
if(user) {
if(rang[0] < 0) _st = LAST_FRAME + rang[0] - 1;
else _st = rang[0] - 1;
if(rang[1] == 0) _ed = TOTAL_FRAMES;
else if(rang[1] < 0) _ed = TOTAL_FRAMES + rang[1];
else _ed = rang[1];
if(rang[1] < 0) _ed = LAST_FRAME + rang[1] + 1;
else _ed = rang[1] + 1;
}
if(_ed <= _st) return;
var amo = floor((_ed - _st) / skip);

View file

@ -30,7 +30,7 @@ function Node_Rigid_Group(_x, _y, _group = noone) : Node_Collection(_x, _y, _gro
}
static update = function() {
if(CURRENT_FRAME == 0)
if(IS_FIRST_FRAME)
reset();
}
}

View file

@ -3,7 +3,8 @@ function Node_Rigid_Group_Inline(_x, _y, _group = noone) : Node_Collection_Inlin
color = COLORS.node_blend_simulation;
icon = THEME.rigidSim;
manual_ungroupable = false;
is_simulation = true;
manual_ungroupable = false;
if(!LOADING && !APPENDING && !CLONING) {
var _object = nodeBuild("Node_Rigid_Object", x, y);

View file

@ -667,7 +667,7 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr
} #endregion
static update = function(frame = CURRENT_FRAME) { #region
if(frame == 0) reset();
if(IS_FIRST_FRAME) reset();
} #endregion
static step = function() { #region

View file

@ -78,15 +78,21 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
inputs[| 24] = nodeValue("Array indices", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [])
.setArrayDepth(1);
inputs[| 25] = nodeValue("Array texture", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone)
inputs[| 25] = nodeValue("Array texture", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone);
inputs[| 26] = nodeValue("Animated array", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ])
.setDisplay(VALUE_DISPLAY.range, { linked : true });
inputs[| 27] = nodeValue("Animated array end", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
.setDisplay(VALUE_DISPLAY.enum_scroll, [ "Loop", "Ping Pong" ]);
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
outputs[| 1] = nodeValue("Atlas data", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, [])
.rejectArrayProcess();
input_display_list = [
["Surfaces", true], 0, 1, 15, 10, 24, 25,
["Surfaces", true], 0, 1, 15, 10, 24, 25, 26, 27,
["Scatter", false], 5, 6, 13, 14, 17, 9, 2,
["Path", false], 19, 20, 21, 22,
["Transform", false], 3, 8, 7, 4,
@ -115,6 +121,7 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
static step = function() { #region
var _dis = getInputData(6);
var _arr = getInputData(15);
var _amn = getInputData(26);
inputs[| 0].array_depth = bool(_arr);
inputs[| 13].setVisible(_dis == 2, _dis == 2);
@ -127,6 +134,10 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
inputs[| 22].setVisible(_dis == 4);
inputs[| 24].setVisible(_arr == 3, _arr == 3);
inputs[| 25].setVisible(_arr == 4, _arr == 4);
inputs[| 26].setVisible(_arr);
inputs[| 27].setVisible(_arr);
update_on_frame = _arr && (_amn[0] != 0 || _amn[1] != 0);
} #endregion
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
@ -166,6 +177,8 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
var sortY = _data[23];
var arrId = _data[24];
var arrTex = _data[25], useArrTex = is_surface(arrTex);
var arrAnim = _data[26];
var arrAnimEnd = _data[27];
var _in_w, _in_h;
@ -193,9 +206,10 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
var path_line_index = 0;
}
var _sed = seed;
var _sct = array_create(_amount);
var _sed = seed;
var _sct = array_create(_amount);
var _sct_len = 0;
var _arrLen = array_safe_length(_inSurf);
surface_set_target(_outSurf);
DRAW_CLEAR
@ -213,7 +227,7 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
var posIndex = 0;
for(var i = 0; i < _amount; i++) {
if(is_array(_inSurf) && array_length(_inSurf) == 0) break;
if(is_array(_inSurf) && _arrLen == 0) break;
var sp = noone, _x = 0, _y = 0;
var _v = noone;
@ -289,10 +303,27 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
if(is_array(_inSurf)) {
switch(_arr) {
case 1 : ind = safe_mod(i, array_length(_inSurf)); break;
case 2 : ind = irandom_seed(array_length(_inSurf) - 1, posS); posS++; break;
case 1 : ind = safe_mod(i, _arrLen); break;
case 2 : ind = irandom_seed(_arrLen - 1, posS); posS++; break;
case 3 : ind = array_safe_get(arrId, i, 0); break;
case 4 : if(useArrTex) ind = color_get_brightness(surface_get_pixel(arrTex, _x, _y)) * (array_length(_inSurf) - 1); break;
case 4 : if(useArrTex) ind = color_get_brightness(surface_get_pixel(arrTex, _x, _y)) * (_arrLen - 1); break;
}
if(arrAnim[0] != 0 || arrAnim[1] != 0) {
var _arrAnim_spd = random_range_seed(arrAnim[0], arrAnim[1], posS); posS++;
var _arrAnim_shf = random_seed(_arrLen, posS); posS++;
var _animInd = ind + _arrAnim_shf + CURRENT_FRAME * _arrAnim_spd;
switch(arrAnimEnd) {
case 0 :
ind = safe_mod(_animInd, _arrLen);
break;
case 1 :
var pp = safe_mod(_animInd, _arrLen * 2 - 1);
ind = pp < _arrLen? pp : _arrLen * 2 - pp;
break;
}
}
surf = array_safe_get(_inSurf, ind, 0);

View file

@ -538,7 +538,7 @@ function Node_Strand_Create(_x, _y, _group = noone) : Node(_x, _y, _group) const
} #endregion
static update = function(frame = CURRENT_FRAME) { #region
strandUpdate(CURRENT_FRAME == 0);
strandUpdate(IS_FIRST_FRAME);
} #endregion
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region

View file

@ -3,6 +3,7 @@ function Node_Strand_Group_Inline(_x, _y, _group = noone) : Node_Collection_Inli
color = COLORS.node_blend_strand;
icon = THEME.strandSim;
is_simulation = true;
update_on_frame = true;
if(!LOADING && !APPENDING && !CLONING) {

View file

@ -60,6 +60,16 @@ function Node_Text(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
inputs[| 22] = nodeValue("Wave shape", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0)
.setDisplay(VALUE_DISPLAY.slider, { range: [ 0, 3, 0.01 ] });
inputs[| 23] = nodeValue("Typewriter", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false);
inputs[| 24] = nodeValue("Range", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 1 ])
.setDisplay(VALUE_DISPLAY.slider_range);
inputs[| 25] = nodeValue("Trim type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0 )
.setDisplay(VALUE_DISPLAY.enum_button, [ "Character", "Word", "Line" ]);
inputs[| 26] = nodeValue("Use full text size", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true );
input_display_list = [
["Output", true], 9, 6, 10,
["Text", false], 0, 13, 14, 7, 8,
@ -67,6 +77,7 @@ function Node_Text(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
["Rendering", false], 5,
["Background", true, 16], 17,
["Wave", true, 18], 22, 19, 20, 21,
["Trim", true, 23], 25, 24, 26,
];
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
@ -132,8 +143,8 @@ function Node_Text(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
return random_range_seed(-1, 1, _x + seed) * __wave_ampli;
} #endregion
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
var str = _data[0];
static processData = function(_outSurf, _data, _output_index, _array_index) {
var str = _data[0], strRaw = str;
var _font = _data[1];
var _size = _data[2];
var _aa = _data[3];
@ -157,11 +168,49 @@ function Node_Text(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
var _waveP = _data[21];
var _waveH = _data[22];
var _type = _data[23];
var _typeR = _data[24];
var _typeC = _data[25];
var _typeF = _data[26];
generateFont(_font, _size, _aa);
draw_set_font(font);
#region typewritter
if(_type) {
var _typAmo = 0;
var _typSpa = [];
switch(_typeC) {
case 0 : _typAmo = string_length(str);
break;
case 1 : _typSpa = string_splice(str, [" ", "\n"], true);
_typAmo = array_length(_typSpa);
break;
case 2 : _typSpa = string_splice(str, "\n", true);
_typAmo = array_length(_typSpa);
break;
}
var _typS = round(_typeR[0] * _typAmo);
var _typE = round(_typeR[1] * _typAmo);
var _typStr = "";
switch(_typeC) {
case 0 : _typStr = string_copy( str, _typS, _typE - _typS); break;
case 1 : _typStr = string_concat_ext(_typSpa, _typS, _typE - _typS); break;
case 2 : _typStr = string_concat_ext(_typSpa, _typS, _typE - _typS); break;
}
str = _typStr;
if(_typeF == false) strRaw = str;
}
#endregion
#region cut string
var _str_lines = string_splice(str, "\n");
var _str_lines = string_splice(str, "\n");
_line_widths = [];
__temp_len = string_length(str);
@ -171,13 +220,13 @@ function Node_Text(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
__temp_trck = _trck;
__temp_line = _line;
string_foreach(str, function(_chr, _ind) {
string_foreach(strRaw, function(_chr, _ind) {
if(_chr == "\n") {
var _lw = max(0, __temp_lw - __temp_trck);
array_push(_line_widths, _lw);
__temp_ww = max(__temp_ww, _lw);
__temp_ww = max(__temp_ww, _lw);
__temp_hh += string_height(_chr) + __temp_line;
__temp_lw = 0;
__temp_lw = 0;
} else
__temp_lw += string_width(_chr) + __temp_trck;
});
@ -241,7 +290,7 @@ function Node_Text(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
BLEND_ALPHA_MULP
}
for( var i = 0, n = array_length(_str_lines); i < n; i++ ) {
for( var i = 0, n = array_length(_str_lines); i < n; i++ ) { #region draw
var _str_line = _str_lines[i];
var _line_width = _line_widths[i];
@ -320,9 +369,9 @@ function Node_Text(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
ty += (line_get_height() + _line) * _ss;
}
}
} #endregion
surface_reset_shader();
return _outSurf;
} #endregion
}
}

View file

@ -164,7 +164,7 @@ function Node_Transform(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
if(!PROJECT.animator.frame_progress) return;
if(CURRENT_FRAME == 0) {
if(IS_FIRST_FRAME) {
vel = 0;
prev_pos[0] = pos[0];
prev_pos[1] = pos[1];

View file

@ -148,13 +148,13 @@ function Panel_Animation() : PanelContent() constructor {
function() { return __txtx("panel_animation_go_to_first_frame", "Go to first frame"); },
function() { return 3; },
function() { return COLORS._main_icon; },
function() { PROJECT.animator.setFrame(0); }
function() { PROJECT.animator.firstFrame(); }
],
[
function() { return __txtx("panel_animation_go_to_last_frame", "Go to last frame"); },
function() { return 2; },
function() { return COLORS._main_icon; },
function() { PROJECT.animator.setFrame(TOTAL_FRAMES - 1); }
function() { PROJECT.animator.lastFrame(); }
],
[
function() { return __txtx("panel_animation_previous_frame", "Previous frame"); },
@ -175,8 +175,8 @@ function Panel_Animation() : PanelContent() constructor {
addHotkey("", "Play/Pause", vk_space, MOD_KEY.none, function() { if(IS_RENDERING) return; if(IS_PLAYING) PROJECT.animator.pause() else PROJECT.animator.play(); });
addHotkey("", "Resume/Pause", vk_space, MOD_KEY.shift,function() { if(IS_RENDERING) return; if(PROJECT.animator.is_playing) PROJECT.animator.pause() else PROJECT.animator.resume(); });
addHotkey("", "First frame", vk_home, MOD_KEY.none, function() { if(IS_RENDERING) return; PROJECT.animator.setFrame(0); });
addHotkey("", "Last frame", vk_end, MOD_KEY.none, function() { if(IS_RENDERING) return; PROJECT.animator.setFrame(TOTAL_FRAMES - 1); });
addHotkey("", "First frame", vk_home, MOD_KEY.none, function() { if(IS_RENDERING) return; PROJECT.animator.firstFrame(); });
addHotkey("", "Last frame", vk_end, MOD_KEY.none, function() { if(IS_RENDERING) return; PROJECT.animator.lastFrame(); });
addHotkey("", "Next frame", vk_right, MOD_KEY.none, function() { if(IS_RENDERING) return; PROJECT.animator.setFrame(min(PROJECT.animator.real_frame + 1, TOTAL_FRAMES - 1)); });
addHotkey("", "Previous frame", vk_left, MOD_KEY.none, function() { if(IS_RENDERING) return; PROJECT.animator.setFrame(max(PROJECT.animator.real_frame - 1, 0)); });
@ -509,7 +509,7 @@ function Panel_Animation() : PanelContent() constructor {
var bar_y = h - timeline_h - ui(10);
var bar_w = timeline_w;
var bar_h = timeline_h;
var bar_total_w = TOTAL_FRAMES * ui(timeline_scale);
var bar_total_w = TOTAL_FRAMES * timeline_scale;
var inspecting = PANEL_INSPECTOR.getInspecting();
resetTimelineMask();
@ -521,14 +521,33 @@ function Panel_Animation() : PanelContent() constructor {
#region bg
draw_sprite_stretched(THEME.ui_panel_bg, 1, 0, 0, bar_w, bar_h);
draw_sprite_stretched_ext(THEME.ui_panel_bg, 2, 0, 0, bar_w, bar_h, COLORS.panel_animation_timeline_blend, 1);
#endregion
#region cache
if(inspecting && inspecting.use_cache) {
for(var i = 0; i < TOTAL_FRAMES; i++) {
if(i >= array_length(inspecting.cache_result))
break;
var x0 = (i + 0) * timeline_scale + timeline_shift;
var x1 = (i + 1) * timeline_scale + timeline_shift;
draw_set_color(inspecting.getAnimationCacheExist(i)? c_lime : c_red);
draw_set_alpha(0.05);
draw_rectangle(x0, 0, x1, bar_h, false);
draw_set_alpha(1);
}
}
#endregion
#region lines
if(inspecting)
inspecting.drawAnimationTimeline(timeline_shift, bar_w, bar_h, timeline_scale);
var _fr = ceil(bar_w / ui(timeline_scale) / timeline_separate) * timeline_separate;
var _fr = ceil(bar_w / timeline_scale / timeline_separate) * timeline_separate;
for(var i = timeline_separate; i <= _fr; i += timeline_separate) {
var bar_line_x = i * ui(timeline_scale) + timeline_shift;
var bar_line_x = i * timeline_scale + timeline_shift;
if(i > TOTAL_FRAMES) draw_set_alpha(0.5);
@ -541,13 +560,23 @@ function Panel_Animation() : PanelContent() constructor {
draw_set_alpha(1);
var bar_line_x = TOTAL_FRAMES * ui(timeline_scale) + timeline_shift;
var bar_line_x = TOTAL_FRAMES * timeline_scale + timeline_shift;
draw_set_color(COLORS.panel_animation_end_line);
draw_set_alpha(0.5);
draw_line_width(bar_line_x, 0, bar_line_x, bar_h - PANEL_PAD, 2);
draw_line_width(bar_line_x, 0, bar_line_x, bar_h, 2);
draw_set_alpha(1.0);
var bar_line_x = (CURRENT_FRAME + 1) * ui(timeline_scale) + timeline_shift;
if(FRAME_RANGE != noone) {
var _fr_x0 = FRAME_RANGE[0] * timeline_scale + timeline_shift - 6;
var _fr_x1 = FRAME_RANGE[1] * timeline_scale + timeline_shift + 2;
if(PROJECT.animator.is_simulating)
draw_sprite_stretched_ext(THEME.ui_selection_range_sim_hori, 0, _fr_x0, 0, _fr_x1 - _fr_x0, bar_h, COLORS.panel_animation_range_sim, 1);
else
draw_sprite_stretched_ext(THEME.ui_selection_range_hori, 0, _fr_x0, 0, _fr_x1 - _fr_x0, bar_h, COLORS.panel_animation_range, 1);
}
var bar_line_x = (CURRENT_FRAME + 1) * timeline_scale + timeline_shift;
var cc = PROJECT.animator.is_playing? COLORS._main_value_positive : COLORS._main_accent;
draw_set_color(cc);
draw_line(bar_line_x, ui(15), bar_line_x, bar_h - PANEL_PAD);
@ -556,26 +585,9 @@ function Panel_Animation() : PanelContent() constructor {
draw_text_add(bar_line_x, ui(16), string(CURRENT_FRAME + 1));
#endregion
#region cache
if(inspecting && inspecting.use_cache) {
for(var i = 0; i < TOTAL_FRAMES; i++) {
if(i >= array_length(inspecting.cache_result))
break;
var x0 = (i + 0) * ui(timeline_scale) + timeline_shift;
var x1 = (i + 1) * ui(timeline_scale) + timeline_shift;
draw_set_color(inspecting.getAnimationCacheExist(i)? c_lime : c_red);
draw_set_alpha(0.5);
draw_rectangle(x0, bar_h - ui(4), x1, bar_h, false);
draw_set_alpha(1);
}
}
#endregion
#region summary \\\ Set X for all keyframes
var index = 0;
var key_y = ui(12) + (timeline_h - ui(12)) / 2;
var key_y = ui(12) + (bar_h - ui(12)) / 2;
for( var i = 0, n = array_length(timeline_contents); i < n; i++ ) {
var _cont = timeline_contents[i];
@ -589,7 +601,7 @@ function Panel_Animation() : PanelContent() constructor {
for(var k = 0; k < ds_list_size(_anim.values); k++) {
var _keyframe = _anim.values[| k];
var t = (_keyframe.time + 1) * ui(timeline_scale) + timeline_shift;
var t = (_keyframe.time + 1) * timeline_scale + timeline_shift;
_keyframe.dopesheet_x = t;
draw_sprite_ui_uniform(THEME.timeline_keyframe, _keyframe.getDrawIndex(), t, key_y, 1, COLORS.panel_animation_keyframe_hide);
@ -602,7 +614,7 @@ function Panel_Animation() : PanelContent() constructor {
timeline_shift = lerp_float(timeline_shift, timeline_shift_to, 4);
if(timeline_scubbing) {
var rfrm = (mx - bar_x - timeline_shift) / ui(timeline_scale) - 1;
var rfrm = (mx - bar_x - timeline_shift) / timeline_scale - 1;
PROJECT.animator.setFrame(clamp(rfrm, 0, TOTAL_FRAMES - 1));
timeline_show_time = CURRENT_FRAME;
@ -632,6 +644,9 @@ function Panel_Animation() : PanelContent() constructor {
draw_surface_safe(timeline_surface, bar_x, bar_y);
#region mouse interact
var bar_line_w = TOTAL_FRAMES * timeline_scale + timeline_shift;
var bar_int_x = min(bar_x + bar_w, bar_x + bar_line_w);
if(pHOVER && point_in_rectangle(mx, my, bar_x, 16, bar_x + bar_w, bar_y - 8)) {
var sca = timeline_scale;
@ -646,14 +661,14 @@ function Panel_Animation() : PanelContent() constructor {
else if(timeline_scale <= 10) { timeline_separate = 10; timeline_sep_line = 2; }
if(sca != timeline_scale) {
var mfb = (mx - bar_x - timeline_shift) / ui(timeline_scale);
var mfb = (mx - bar_x - timeline_shift) / timeline_scale;
var mfa = (mx - bar_x - timeline_shift) / ui(sca);
timeline_shift_to = clamp(timeline_shift_to - (mfa - mfb) * timeline_scale, -max(bar_total_w - bar_w + 32, 0), 0);
timeline_shift = timeline_shift_to;
}
if(mouse_press(mb_middle, pFOCUS)) {
if(mx < bar_int_x && mouse_press(mb_middle, pFOCUS)) {
timeline_dragging = true;
timeline_drag_sx = timeline_shift;
@ -667,25 +682,25 @@ function Panel_Animation() : PanelContent() constructor {
if(mouse_wheel_down()) timeline_shift_to = clamp(timeline_shift_to - 64 * SCROLL_SPEED, -max(bar_total_w - bar_w + 32, 0), 0);
if(mouse_wheel_up()) timeline_shift_to = clamp(timeline_shift_to + 64 * SCROLL_SPEED, -max(bar_total_w - bar_w + 32, 0), 0);
if(mouse_press(mb_left, pFOCUS)) {
if(mx < bar_int_x && mouse_press(mb_left, pFOCUS)) {
timeline_scubbing = true;
timeline_scub_st = CURRENT_FRAME;
_scrub_frame = timeline_scub_st;
}
if(mouse_press(mb_right, pFOCUS)) {
__selecting_frame = (mx - bar_x - timeline_shift) / ui(timeline_scale) - 1;
__selecting_frame = clamp(round((mx - bar_x - timeline_shift) / timeline_scale), 0, TOTAL_FRAMES - 1);
menuCall("animation_summary_menu",,, [
menuItem(__txtx("panel_animation_range_start", "Set start"), function() { if(FRAME_RANGE == noone) FRAME_RANGE = [ __selecting_frame, TOTAL_FRAMES ]; else FRAME_RANGE[0] = __selecting_frame; }),
menuItem(__txtx("panel_animation_range_end", "Set end"), function() { if(FRAME_RANGE == noone) FRAME_RANGE = [ 0, __selecting_frame ]; else FRAME_RANGE[1] = __selecting_frame; }),
menuItem(__txtx("panel_animation_range_start", "Set start"), function() { if(FRAME_RANGE == noone) FRAME_RANGE = [ __selecting_frame, TOTAL_FRAMES ]; else FRAME_RANGE[0] = __selecting_frame; }, [ THEME.frame_range, 0 ]),
menuItem(__txtx("panel_animation_range_end", "Set end"), function() { if(FRAME_RANGE == noone) FRAME_RANGE = [ 0, __selecting_frame ]; else FRAME_RANGE[1] = __selecting_frame; }, [ THEME.frame_range, 1 ]),
menuItem(__txtx("panel_animation_range_reset", "Reset range"), function() { FRAME_RANGE = noone; }),
]);
}
}
if(pHOVER && point_in_rectangle(mx, my, bar_x, 8, bar_x + bar_w, 8 + 16)) { //top bar
if(mouse_press(mb_left, pFOCUS) && timeline_draggable) {
if(mx < bar_int_x && mouse_press(mb_left, pFOCUS) && timeline_draggable) {
timeline_scubbing = true;
timeline_scub_st = CURRENT_FRAME;
_scrub_frame = timeline_scub_st;
@ -697,7 +712,7 @@ function Panel_Animation() : PanelContent() constructor {
} #endregion
function drawDopesheetGraphLine(animator, key_y, msx, msy, _gy_val_min = 999999, _gy_val_max = -999999) { #region
var bar_total_w = TOTAL_FRAMES * ui(timeline_scale);
var bar_total_w = TOTAL_FRAMES * timeline_scale;
var bar_show_w = timeline_shift + bar_total_w;
var hovering = noone;
var _gy_top = key_y + ui(16);
@ -774,7 +789,7 @@ function Panel_Animation() : PanelContent() constructor {
var dx = key_next.time - key.time;
if(key.drivers.type) { // driver
nx = (key.time + 1) * ui(timeline_scale) + timeline_shift;
nx = (key.time + 1) * timeline_scale + timeline_shift;
for( var _time = key.time; _time <= key_next.time; _time++ ) {
var rat = (_time - key.time) / (key_next.time - key.time);
@ -795,10 +810,10 @@ function Panel_Animation() : PanelContent() constructor {
}
ox = nx;
nx += ui(timeline_scale);
nx += timeline_scale;
}
} else if(key.ease_out_type == CURVE_TYPE.linear && key_next.ease_in_type == CURVE_TYPE.linear) { //linear draw
nx = (key_next.time + 1) * ui(timeline_scale) + timeline_shift;
nx = (key_next.time + 1) * timeline_scale + timeline_shift;
_kv = key.value;
_kn = key_next.value;
@ -825,7 +840,7 @@ function Panel_Animation() : PanelContent() constructor {
} else { //bezier easing
var _step = 1 / dx;
for( var _r = 0; _r <= 1; _r += _step ) {
nx = t + _r * dx * ui(timeline_scale);
nx = t + _r * dx * timeline_scale;
nly = animator.interpolate(key, key_next, _r);
_kv = key.value;
@ -853,7 +868,7 @@ function Panel_Animation() : PanelContent() constructor {
if(animator.prop.show_graph && ds_list_size(animator.values) > 0) { #region draw line outside keyframe range
var key_first = animator.values[| 0];
var t_first = (key_first.time + 1) * ui(timeline_scale) + timeline_shift;
var t_first = (key_first.time + 1) * timeline_scale + timeline_shift;
_kv = key_first.value;
if(!valArray) _kv = [ _kv ];
@ -867,7 +882,7 @@ function Panel_Animation() : PanelContent() constructor {
}
var key_last = animator.values[| ds_list_size(animator.values) - 1];
var t_last = (key_last.time + 1) * ui(timeline_scale) + timeline_shift;
var t_last = (key_last.time + 1) * timeline_scale + timeline_shift;
if(key_last.time < TOTAL_FRAMES) {
if(key_last.drivers.type) {
@ -889,7 +904,7 @@ function Panel_Animation() : PanelContent() constructor {
}
ox = nx;
nx += ui(timeline_scale);
nx += timeline_scale;
}
} else {
_kv = key_last.value;
@ -907,7 +922,7 @@ function Panel_Animation() : PanelContent() constructor {
} #endregion
function drawDopesheetGraph(prop, key_y, msx, msy) { #region
var bar_total_w = TOTAL_FRAMES * ui(timeline_scale);
var bar_total_w = TOTAL_FRAMES * timeline_scale;
var bar_show_w = timeline_shift + bar_total_w;
var _gy_top = key_y + ui(16);
var _gy_bottom = _gy_top + prop.graph_h - ui(8);
@ -928,7 +943,7 @@ function Panel_Animation() : PanelContent() constructor {
var _step = 1 / dx;
for( var _r = 0; _r <= 1; _r += _step ) {
nx = key.dopesheet_x + _r * dx * ui(timeline_scale);
nx = key.dopesheet_x + _r * dx * timeline_scale;
var lrp = prop.animator.interpolate(key, key_next, _r);
nc = merge_color(key.value, key_next.value, lrp);
@ -983,8 +998,8 @@ function Panel_Animation() : PanelContent() constructor {
var keyframe_s = animator.prop.loop_range == -1? key_list[| 0].time : key_list[| ds_list_size(key_list) - 1 - animator.prop.loop_range].time;
var keyframe_e = key_list[| ds_list_size(key_list) - 1].time;
var ks_x = (keyframe_s + 1) * ui(timeline_scale) + timeline_shift;
var ke_x = (keyframe_e + 1) * ui(timeline_scale) + timeline_shift;
var ks_x = (keyframe_s + 1) * timeline_scale + timeline_shift;
var ke_x = (keyframe_e + 1) * timeline_scale + timeline_shift;
draw_set_color(COLORS.panel_animation_loop_line);
draw_set_alpha(0.2);
@ -998,7 +1013,7 @@ function Panel_Animation() : PanelContent() constructor {
if(key.ease_in_type == CURVE_TYPE.bezier) {
draw_set_color(COLORS.panel_animation_keyframe_ease_line);
var _tx = t - key.ease_in[0] * ui(timeline_scale) * 2;
var _tx = t - key.ease_in[0] * timeline_scale * 2;
draw_line_width(_tx, prop_dope_y - 1, t, prop_dope_y - 1, 2);
if(pHOVER && point_in_circle(msx, msy, _tx, prop_dope_y, ui(6))) {
@ -1014,7 +1029,7 @@ function Panel_Animation() : PanelContent() constructor {
if(key.ease_out_type == CURVE_TYPE.bezier) {
draw_set_color(COLORS.panel_animation_keyframe_ease_line);
var _tx = t + key.ease_out[0] * ui(timeline_scale) * 2;
var _tx = t + key.ease_out[0] * timeline_scale * 2;
draw_line_width(t, prop_dope_y - 1, _tx, prop_dope_y - 1, 2);
if(pHOVER && point_in_circle(msx, msy, _tx, prop_dope_y, ui(6))) {
@ -1365,7 +1380,7 @@ function Panel_Animation() : PanelContent() constructor {
var bar_y = h - timeline_h - ui(10);
var bar_w = timeline_w;
var bar_h = timeline_h;
var bar_total_w = TOTAL_FRAMES * ui(timeline_scale);
var bar_total_w = TOTAL_FRAMES * timeline_scale;
surfaceVerify();
@ -1491,10 +1506,10 @@ function Panel_Animation() : PanelContent() constructor {
dope_sheet_y_max = max(0, dope_sheet_y_max - dope_sheet_h + ui(48));
var _fr = ceil(bar_w / ui(timeline_scale) / timeline_separate) * timeline_separate;
var _fr = ceil(bar_w / timeline_scale / timeline_separate) * timeline_separate;
for(var i = timeline_sep_line; i <= _fr; i += timeline_sep_line) {
var bar_line_x = i * ui(timeline_scale) + timeline_shift;
var bar_line_x = i * timeline_scale + timeline_shift;
draw_set_color(COLORS.panel_animation_frame_divider);
draw_set_alpha((i % timeline_separate == 0? 1 : 0.1) * ((i <= TOTAL_FRAMES) * 0.5 + 0.5));
@ -1502,10 +1517,10 @@ function Panel_Animation() : PanelContent() constructor {
}
draw_set_alpha(1);
var bar_line_x = TOTAL_FRAMES * ui(timeline_scale) + timeline_shift;
var bar_line_x = TOTAL_FRAMES * timeline_scale + timeline_shift;
draw_set_color(COLORS.panel_animation_end_line);
draw_set_alpha(0.5);
draw_line_width(bar_line_x, ui(16), bar_line_x, dope_sheet_h - PANEL_PAD, 2);
draw_line_width(bar_line_x, ui(16), bar_line_x, dope_sheet_h, 2);
draw_set_alpha(1);
#endregion
@ -1514,7 +1529,7 @@ function Panel_Animation() : PanelContent() constructor {
#region drag key
if(keyframe_dragging) {
if(keyframe_drag_type == KEYFRAME_DRAG_TYPE.move) {
var tt = round((mx - bar_x - timeline_shift) / ui(timeline_scale)) - 1;
var tt = round((mx - bar_x - timeline_shift) / timeline_scale) - 1;
tt = max(tt, 0);
var sh = tt - keyframe_dragging.time;
var edited = false;
@ -1540,7 +1555,7 @@ function Panel_Animation() : PanelContent() constructor {
}
}
} else {
var dx = abs((keyframe_dragging.time + 1) - (mx - bar_x - timeline_shift) / ui(timeline_scale)) / 2;
var dx = abs((keyframe_dragging.time + 1) - (mx - bar_x - timeline_shift) / timeline_scale) / 2;
dx = clamp(dx, 0, 1);
if(dx > 0.2) keyframe_dragout = true;
@ -1722,7 +1737,7 @@ function Panel_Animation() : PanelContent() constructor {
if(stagger_mode == 2) {
var ts = keyframe_selecting[stagger_index].time;
var tm = round((mx - bar_x - timeline_shift) / ui(timeline_scale)) - 1;
var tm = round((mx - bar_x - timeline_shift) / timeline_scale) - 1;
tm = max(tm, 0);
var stg = tm - ts;
@ -1736,10 +1751,10 @@ function Panel_Animation() : PanelContent() constructor {
draw_set_color(COLORS.panel_animation_timeline_top);
draw_rectangle(0, 0, bar_w, hh, false);
var _fr = ceil(bar_w / ui(timeline_scale) / timeline_separate) * timeline_separate;
var _fr = ceil(bar_w / timeline_scale / timeline_separate) * timeline_separate;
for(var i = timeline_separate; i <= _fr; i += timeline_separate) {
var bar_line_x = i * ui(timeline_scale) + timeline_shift;
var bar_line_x = i * timeline_scale + timeline_shift;
if(i > TOTAL_FRAMES) draw_set_alpha(0.5);
@ -1752,7 +1767,7 @@ function Panel_Animation() : PanelContent() constructor {
draw_set_alpha(1);
var bar_line_x = TOTAL_FRAMES * ui(timeline_scale) + timeline_shift;
var bar_line_x = TOTAL_FRAMES * timeline_scale + timeline_shift;
draw_set_color(COLORS.panel_animation_end_line);
draw_line_width(bar_line_x, 0, bar_line_x, ui(20), 2);
@ -1761,9 +1776,9 @@ function Panel_Animation() : PanelContent() constructor {
var colr = PROJECT.onion_skin.color;
var fr = CURRENT_FRAME + 1;
var tx = fr * ui(timeline_scale) + timeline_shift;
var sx = (fr + rang[0]) * ui(timeline_scale) + timeline_shift;
var ex = (fr + rang[1]) * ui(timeline_scale) + timeline_shift;
var tx = fr * timeline_scale + timeline_shift;
var sx = (fr + rang[0]) * timeline_scale + timeline_shift;
var ex = (fr + rang[1]) * timeline_scale + timeline_shift;
var y0 = PANEL_PAD;
var y1 = hh;
var yc = (y0 + y1) / 2;
@ -1771,8 +1786,8 @@ function Panel_Animation() : PanelContent() constructor {
draw_sprite_stretched_ext(THEME.timeline_onion_skin, 0, sx, y0, tx - sx, y1 - y0, colr[0], 1);
draw_sprite_stretched_ext(THEME.timeline_onion_skin, 1, tx, y0, ex - tx, y1 - y0, colr[1], 1);
var _sx = (fr + rang[0]) * ui(timeline_scale) + timeline_shift - ui(8);
var _ex = (fr + rang[1]) * ui(timeline_scale) + timeline_shift + ui(8);
var _sx = (fr + rang[0]) * timeline_scale + timeline_shift - ui(8);
var _ex = (fr + rang[1]) * timeline_scale + timeline_shift + ui(8);
if(point_in_circle(msx, msy, _sx, yc, ui(8))) {
draw_sprite_ext(THEME.arrow, 2, _sx, yc, 1, 1, 0, colr[0], 1);
@ -1794,14 +1809,14 @@ function Panel_Animation() : PanelContent() constructor {
if(onion_dragging != noone) {
if(onion_dragging == 0) {
var mf = round((msx - timeline_shift + ui(8)) / ui(timeline_scale)) - fr;
var mf = round((msx - timeline_shift + ui(8)) / timeline_scale) - fr;
mf = min(mf, 0);
if(PROJECT.onion_skin.range[0] != mf) {
PROJECT.onion_skin.range[0] = mf;
}
} else if(onion_dragging == 1) {
var mf = round((msx - timeline_shift - ui(8)) / ui(timeline_scale)) - fr;
var mf = round((msx - timeline_shift - ui(8)) / timeline_scale) - fr;
mf = max(mf, 0);
if(PROJECT.onion_skin.range[1] != mf) {
@ -1814,7 +1829,7 @@ function Panel_Animation() : PanelContent() constructor {
}
}
var bar_line_x = (CURRENT_FRAME + 1) * ui(timeline_scale) + timeline_shift;
var bar_line_x = (CURRENT_FRAME + 1) * timeline_scale + timeline_shift;
var cc = PROJECT.animator.is_playing? COLORS._main_value_positive : COLORS._main_accent;
draw_set_color(cc);
@ -1834,7 +1849,7 @@ function Panel_Animation() : PanelContent() constructor {
var sty = ui(10);
if(timeline_stretch == 1) {
var len = round((mx - bar_x - timeline_shift) / ui(timeline_scale)) - 2;
var len = round((mx - bar_x - timeline_shift) / timeline_scale) - 2;
len = max(1, len);
TOOLTIP = __txtx("panel_animation_length", "Animation length") + " " + string(len);
TOTAL_FRAMES = len;
@ -1844,7 +1859,7 @@ function Panel_Animation() : PanelContent() constructor {
draw_sprite_ui(THEME.animation_stretch, 0, stx, sty, 1, 1, 0, COLORS.panel_animation_end_line, 1);
} else if(timeline_stretch == 2) {
var len = round((mx - bar_x - timeline_shift) / ui(timeline_scale)) - 2;
var len = round((mx - bar_x - timeline_shift) / timeline_scale) - 2;
len = max(1, len);
TOOLTIP = __txtx("panel_animation_length", "Animation length") + " " + string(len);
var _len = TOTAL_FRAMES;

View file

@ -963,7 +963,7 @@ function Panel_Preview() : PanelContent() constructor {
right_menu_y += string_height("l");
draw_set_text(f_p0, fa_right, fa_top, COLORS._main_text_sub);
draw_text(w - ui(8), right_menu_y, $"{__txt("Frame")} {CURRENT_FRAME}/{TOTAL_FRAMES}");
draw_text(w - ui(8), right_menu_y, $"{__txt("Frame")} {CURRENT_FRAME + 1}/{TOTAL_FRAMES}");
right_menu_y += string_height("l");
draw_text(w - ui(8), right_menu_y, $"x{canvas_s}");

View file

@ -58,7 +58,8 @@ function sliderRange(_min, _max, _step, _onModify) : widget() constructor {
if(stepSize >= 1 && sw / ((maxx - minn) / stepSize) > ui(16)) {
for( var i = minn; i <= maxx; i += stepSize ) {
var _v = round(i / stepSize) * stepSize;
var _cx = _x + clamp((_v - minn) / (maxx - minn), 0, 1) * sw;
var _cx = _x0 + clamp((_v - minn) / (maxx - minn), 0, 1) * sw;
draw_sprite_stretched_ext(spr, 4, _cx - ui(4), _y + _h / 2 - ui(4), ui(8), ui(8), COLORS.widget_slider_step, 1);
}
}

View file

@ -0,0 +1,29 @@
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
uniform int mode;
uniform sampler2D samplerR;
uniform sampler2D samplerG;
uniform sampler2D samplerB;
uniform sampler2D samplerA;
uniform int useR;
uniform int useG;
uniform int useB;
uniform int useA;
float sample(vec4 col, int ch) {
if(mode == 0) return (col[0] + col[1] + col[2]) / 3. * col[3];
return col[ch];
}
void main() {
vec4 base = texture2D( gm_BaseTexture, v_vTexcoord );
float r = useR == 1? sample(texture2D( samplerR, v_vTexcoord ), 0) : base.r;
float g = useG == 1? sample(texture2D( samplerG, v_vTexcoord ), 1) : base.g;
float b = useB == 1? sample(texture2D( samplerB, v_vTexcoord ), 2) : base.b;
float a = useA == 1? sample(texture2D( samplerA, v_vTexcoord ), 3) : base.a;
gl_FragColor = vec4(r, g, b, a);
}

View 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;
}

View file

@ -0,0 +1,10 @@
{
"resourceType": "GMShader",
"resourceVersion": "1.0",
"name": "sh_override_channel",
"parent": {
"name": "color",
"path": "folders/shader/filter/color.yy",
},
"type": 1,
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

@ -0,0 +1,74 @@
{
"resourceType": "GMSprite",
"resourceVersion": "1.0",
"name": "s_node_ovreride_channel",
"bbox_bottom": 63,
"bbox_left": 0,
"bbox_right": 63,
"bbox_top": 0,
"bboxMode": 0,
"collisionKind": 1,
"collisionTolerance": 0,
"DynamicTexturePage": false,
"edgeFiltering": false,
"For3D": false,
"frames": [
{"resourceType":"GMSpriteFrame","resourceVersion":"1.1","name":"e8d09ea4-a2bb-41b5-9439-c50a982ac399",},
],
"gridX": 0,
"gridY": 0,
"height": 64,
"HTile": false,
"layers": [
{"resourceType":"GMImageLayer","resourceVersion":"1.0","name":"6d3b6027-ced5-4c0d-8f92-f4ead97c2944","blendMode":0,"displayName":"default","isLocked":false,"opacity":100.0,"visible":true,},
],
"nineSlice": null,
"origin": 4,
"parent": {
"name": "filter",
"path": "folders/nodes/icons/filter.yy",
},
"preMultiplyAlpha": false,
"sequence": {
"resourceType": "GMSequence",
"resourceVersion": "1.4",
"name": "s_node_ovreride_channel",
"autoRecord": true,
"backdropHeight": 768,
"backdropImageOpacity": 0.5,
"backdropImagePath": "",
"backdropWidth": 1366,
"backdropXOffset": 0.0,
"backdropYOffset": 0.0,
"events": {"resourceType":"KeyframeStore<MessageEventKeyframe>","resourceVersion":"1.0","Keyframes":[],},
"eventStubScript": null,
"eventToFunction": {},
"length": 1.0,
"lockOrigin": false,
"moments": {"resourceType":"KeyframeStore<MomentsEventKeyframe>","resourceVersion":"1.0","Keyframes":[],},
"playback": 1,
"playbackSpeed": 30.0,
"playbackSpeedType": 0,
"showBackdrop": true,
"showBackdropImage": false,
"timeUnits": 1,
"tracks": [
{"resourceType":"GMSpriteFramesTrack","resourceVersion":"1.0","name":"frames","builtinName":0,"events":[],"inheritsTrackColour":true,"interpolation":1,"isCreationTrack":false,"keyframes":{"resourceType":"KeyframeStore<SpriteFrameKeyframe>","resourceVersion":"1.0","Keyframes":[
{"resourceType":"Keyframe<SpriteFrameKeyframe>","resourceVersion":"1.0","Channels":{"0":{"resourceType":"SpriteFrameKeyframe","resourceVersion":"1.0","Id":{"name":"e8d09ea4-a2bb-41b5-9439-c50a982ac399","path":"sprites/s_node_ovreride_channel/s_node_ovreride_channel.yy",},},},"Disabled":false,"id":"13f880e0-742e-494d-af93-ab275ecce12c","IsCreationKey":false,"Key":0.0,"Length":1.0,"Stretch":false,},
],},"modifiers":[],"spriteId":null,"trackColour":0,"tracks":[],"traits":0,},
],
"visibleRange": null,
"volume": 1.0,
"xorigin": 32,
"yorigin": 32,
},
"swatchColours": null,
"swfPrecision": 2.525,
"textureGroupId": {
"name": "Default",
"path": "texturegroups/Default",
},
"type": 0,
"VTile": false,
"width": 64,
}