mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-12-24 14:06:23 +01:00
- repeat animators
This commit is contained in:
parent
a920ab2359
commit
d6a15520e2
15 changed files with 521 additions and 50 deletions
|
@ -2391,6 +2391,7 @@
|
|||
{"name":"s_node_regex_search","order":11,"path":"sprites/s_node_regex_search/s_node_regex_search.yy",},
|
||||
{"name":"s_node_region_fill","order":29,"path":"sprites/s_node_region_fill/s_node_region_fill.yy",},
|
||||
{"name":"s_node_repeat_axis","order":16,"path":"sprites/s_node_repeat_axis/s_node_repeat_axis.yy",},
|
||||
{"name":"s_node_repeat_selection_types","order":28,"path":"sprites/s_node_repeat_selection_types/s_node_repeat_selection_types.yy",},
|
||||
{"name":"s_node_repeat_texture","order":55,"path":"sprites/s_node_repeat_texture/s_node_repeat_texture.yy",},
|
||||
{"name":"s_node_repeat","order":23,"path":"sprites/s_node_repeat/s_node_repeat.yy",},
|
||||
{"name":"s_node_replace_palette","order":44,"path":"sprites/s_node_replace_palette/s_node_replace_palette.yy",},
|
||||
|
|
|
@ -3131,6 +3131,7 @@
|
|||
{"id":{"name":"s_node_regex_search","path":"sprites/s_node_regex_search/s_node_regex_search.yy",},},
|
||||
{"id":{"name":"s_node_region_fill","path":"sprites/s_node_region_fill/s_node_region_fill.yy",},},
|
||||
{"id":{"name":"s_node_repeat_axis","path":"sprites/s_node_repeat_axis/s_node_repeat_axis.yy",},},
|
||||
{"id":{"name":"s_node_repeat_selection_types","path":"sprites/s_node_repeat_selection_types/s_node_repeat_selection_types.yy",},},
|
||||
{"id":{"name":"s_node_repeat_texture","path":"sprites/s_node_repeat_texture/s_node_repeat_texture.yy",},},
|
||||
{"id":{"name":"s_node_repeat","path":"sprites/s_node_repeat/s_node_repeat.yy",},},
|
||||
{"id":{"name":"s_node_replace_palette","path":"sprites/s_node_replace_palette/s_node_replace_palette.yy",},},
|
||||
|
|
|
@ -59,7 +59,7 @@ function Node_VFX_effector(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
|||
|
||||
UPDATE_PART_FORWARD
|
||||
|
||||
static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) { #region
|
||||
static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) {
|
||||
inputs[1].drawOverlay(hover, active, _x, _y, _s, _mx, _my, _snx, _sny);
|
||||
|
||||
var area = getInputData(1);
|
||||
|
@ -99,19 +99,19 @@ function Node_VFX_effector(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
|||
}
|
||||
draw_set_alpha(1);
|
||||
}
|
||||
} #endregion
|
||||
}
|
||||
|
||||
function reset() { #region
|
||||
function reset() {
|
||||
resetSeed();
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static resetSeed = function() { #region
|
||||
static resetSeed = function() {
|
||||
seed = getInputData(8);
|
||||
} #endregion
|
||||
}
|
||||
|
||||
function onAffect(part, str) {}
|
||||
|
||||
function affect(part) { #region
|
||||
function affect(part) {
|
||||
if(!part.active) return;
|
||||
|
||||
var _area = getInputData(1);
|
||||
|
@ -158,9 +158,9 @@ function Node_VFX_effector(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
|||
if(str == 0) return;
|
||||
|
||||
onAffect(part, str);
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static update = function(frame = CURRENT_FRAME) { #region
|
||||
static update = function(frame = CURRENT_FRAME) {
|
||||
var val = getInputData(0);
|
||||
outputs[0].setValue(val);
|
||||
if(val == -1) return;
|
||||
|
@ -177,12 +177,12 @@ function Node_VFX_effector(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
|||
if(jun.value_to[j].value_from == jun)
|
||||
jun.value_to[j].node.doUpdate();
|
||||
}
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region
|
||||
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
|
||||
var bbox = drawGetBbox(xx, yy, _s);
|
||||
draw_sprite_fit(node_draw_icon, 0, bbox.xc, bbox.yc, bbox.w, bbox.h);
|
||||
} #endregion
|
||||
}
|
||||
|
||||
getPreviewingNode = VFX_PREVIEW_NODE;
|
||||
}
|
|
@ -146,4 +146,73 @@ function area_get_random_point(area, distrib = AREA_DISTRIBUTION.area, scatter =
|
|||
}
|
||||
|
||||
return [xx, yy];
|
||||
}
|
||||
|
||||
function area_point_in(_area, _x, _y) {
|
||||
var _area_x = _area[0];
|
||||
var _area_y = _area[1];
|
||||
var _area_w = _area[2];
|
||||
var _area_h = _area[3];
|
||||
var _area_t = _area[4];
|
||||
|
||||
var _area_x0 = _area_x - _area_w;
|
||||
var _area_x1 = _area_x + _area_w;
|
||||
var _area_y0 = _area_y - _area_h;
|
||||
var _area_y1 = _area_y + _area_h;
|
||||
|
||||
var in = false;
|
||||
|
||||
if(_area_t == AREA_SHAPE.rectangle) {
|
||||
in = point_in_rectangle(_x, _y, _area_x0, _area_y0, _area_x1, _area_y1);
|
||||
} else if(_area_t == AREA_SHAPE.elipse) {
|
||||
var _dirr = point_direction(_area_x, _area_y, _x, _y);
|
||||
var _epx = _area_x + lengthdir_x(_area_w, _dirr);
|
||||
var _epy = _area_y + lengthdir_y(_area_h, _dirr);
|
||||
|
||||
in = point_distance(_area_x, _area_y, _x, _y) < point_distance(_area_x, _area_y, _epx, _epy);
|
||||
}
|
||||
|
||||
return in;
|
||||
}
|
||||
|
||||
function area_point_in_fallout(_area, _x, _y, _fall_distance) {
|
||||
if(_fall_distance == 0) return area_point_in(_area, _x, _y);
|
||||
|
||||
var _area_x = _area[0];
|
||||
var _area_y = _area[1];
|
||||
var _area_w = _area[2];
|
||||
var _area_h = _area[3];
|
||||
var _area_t = _area[4];
|
||||
|
||||
var _area_x0 = _area_x - _area_w;
|
||||
var _area_x1 = _area_x + _area_w;
|
||||
var _area_y0 = _area_y - _area_h;
|
||||
var _area_y1 = _area_y + _area_h;
|
||||
|
||||
var str = 0, in, _dst;
|
||||
|
||||
if(_area_t == AREA_SHAPE.rectangle) {
|
||||
in = point_in_rectangle(_x, _y, _area_x0, _area_y0, _area_x1, _area_y1)
|
||||
_dst = min( distance_to_line(_x, _y, _area_x0, _area_y0, _area_x1, _area_y0),
|
||||
distance_to_line(_x, _y, _area_x0, _area_y1, _area_x1, _area_y1),
|
||||
distance_to_line(_x, _y, _area_x0, _area_y0, _area_x0, _area_y1),
|
||||
distance_to_line(_x, _y, _area_x1, _area_y0, _area_x1, _area_y1));
|
||||
|
||||
} else if(_area_t == AREA_SHAPE.elipse) {
|
||||
var _dirr = point_direction(_area_x, _area_y, _x, _y);
|
||||
var _epx = _area_x + lengthdir_x(_area_w, _dirr);
|
||||
var _epy = _area_y + lengthdir_y(_area_h, _dirr);
|
||||
|
||||
in = point_distance(_area_x, _area_y, _x, _y) < point_distance(_area_x, _area_y, _epx, _epy);
|
||||
_dst = point_distance(_x, _y, _epx, _epy);
|
||||
}
|
||||
|
||||
if(_dst <= _fall_distance) {
|
||||
var inf = in? 0.5 + _dst / _fall_distance : 0.5 - _dst / _fall_distance;
|
||||
str = clamp(inf, 0., 1.);
|
||||
|
||||
} else if(in)
|
||||
str = 1;
|
||||
|
||||
return str;
|
||||
}
|
|
@ -42,7 +42,7 @@
|
|||
LATEST_VERSION = 1_18_00;
|
||||
VERSION = 1_18_00_0;
|
||||
SAVE_VERSION = 1_18_00_0;
|
||||
VERSION_STRING = MAC? "1.18.003m" : "1.18.1.001";
|
||||
VERSION_STRING = MAC? "1.18.003m" : "1.18.1.002";
|
||||
BUILD_NUMBER = 1_18_00_1;
|
||||
|
||||
HOTKEYS = ds_map_create();
|
||||
|
@ -116,6 +116,7 @@
|
|||
#macro DELTA_TIME delta_time / 1_000_000
|
||||
|
||||
#macro INLINE gml_pragma("forceinline");
|
||||
#macro IS is_instanceof
|
||||
|
||||
#macro CONF_TESTING false
|
||||
globalvar TESTING, TEST_ERROR;
|
||||
|
|
|
@ -11,25 +11,25 @@ enum LIGHT_SHAPE_2D {
|
|||
function Node_2D_light(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
|
||||
name = "2D Light";
|
||||
|
||||
light_inspecting = 0;
|
||||
|
||||
newInput(0, nodeValue_Surface("Surface in", self));
|
||||
|
||||
light_inspecting = 0;
|
||||
typeList = [
|
||||
new scrollItem("Point", s_node_2d_light_shape, 0),
|
||||
new scrollItem("Ellipse", s_node_2d_light_shape, 1),
|
||||
new scrollItem("Line", s_node_2d_light_shape, 2),
|
||||
new scrollItem("Line asymmetric", s_node_2d_light_shape, 3),
|
||||
new scrollItem("Saber", s_node_2d_light_shape, 4),
|
||||
new scrollItem("Spot", s_node_2d_light_shape, 5),
|
||||
new scrollItem("Flame", s_node_2d_light_shape, 6),
|
||||
];
|
||||
typeListStr = array_create_ext(array_length(typeList), function(i) /*=>*/ {return typeList[i].name});
|
||||
|
||||
static createNewInput = function() {
|
||||
var _index = array_length(inputs);
|
||||
light_inspecting = getInputAmount();
|
||||
|
||||
typeList = [
|
||||
new scrollItem("Point", s_node_2d_light_shape, 0),
|
||||
new scrollItem("Ellipse", s_node_2d_light_shape, 1),
|
||||
new scrollItem("Line", s_node_2d_light_shape, 2),
|
||||
new scrollItem("Line asymmetric", s_node_2d_light_shape, 3),
|
||||
new scrollItem("Saber", s_node_2d_light_shape, 4),
|
||||
new scrollItem("Spot", s_node_2d_light_shape, 5),
|
||||
new scrollItem("Flame", s_node_2d_light_shape, 6),
|
||||
];
|
||||
typeListStr = array_create_ext(array_length(typeList), function(i) /*=>*/ {return typeList[i].name});
|
||||
|
||||
var _val = nodeValue_Enum_Scroll("Light shape", self, 0, typeList);
|
||||
_val.options_histories = [ typeListStr,
|
||||
{
|
||||
|
@ -96,6 +96,7 @@ function Node_2D_light(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
|
|||
}
|
||||
|
||||
newOutput(0, nodeValue_Output("Surface out", self, VALUE_TYPE.surface, noone));
|
||||
|
||||
newOutput(1, nodeValue_Output("Light only", self, VALUE_TYPE.surface, noone));
|
||||
|
||||
lights_renderer = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus) {
|
||||
|
|
|
@ -20,6 +20,8 @@ function Node_Repeat(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
|
|||
name = "Repeat";
|
||||
dimension_index = 1;
|
||||
|
||||
animator_inspecting = 0;
|
||||
|
||||
newInput(0, nodeValue_Surface("Surface in", self));
|
||||
|
||||
newInput(1, nodeValue_Dimension(self));
|
||||
|
@ -32,7 +34,7 @@ function Node_Repeat(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
|
|||
new scrollItem("Circular", s_node_repeat_axis, 2), ]));
|
||||
|
||||
newInput(4, nodeValue_Vec2("Shift position", self, [ DEF_SURF_W / 2, 0 ]))
|
||||
.setUnitRef(function() { return getDimension(); });
|
||||
.setUnitRef(function() /*=>*/ {return getDimension()});
|
||||
|
||||
newInput(5, nodeValue_Rotation_Range("Repeat rotation", self, [0, 0]));
|
||||
|
||||
|
@ -69,7 +71,7 @@ function Node_Repeat(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
|
|||
newInput(18, nodeValue_Int("Column", self, 4));
|
||||
|
||||
newInput(19, nodeValue_Vec2("Column shift", self, [0, DEF_SURF_H / 2]))
|
||||
.setUnitRef(function() { return getDimension(); });
|
||||
.setUnitRef(function() /*=>*/ {return getDimension()});
|
||||
|
||||
/* deprecated */ newInput(20, nodeValue_Float("Animator midpoint", self, 0.5))
|
||||
.setDisplay(VALUE_DISPLAY.slider, { range: [-1, 2, 0.01] });
|
||||
|
@ -122,6 +124,118 @@ function Node_Repeat(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
|
|||
|
||||
newOutput(0, nodeValue_Output("Surface out", self, VALUE_TYPE.surface, noone));
|
||||
|
||||
typeList = [ "Transform", "Blending" ]
|
||||
|
||||
static createNewInput = function() {
|
||||
var _index = array_length(inputs);
|
||||
animator_inspecting = getInputAmount();
|
||||
|
||||
newInput(_index + 0, nodeValue_Enum_Scroll("Animated property", self, 0, typeList));
|
||||
|
||||
newInput(_index + 1, nodeValue_Enum_Scroll("Select mode", self, 0, [ new scrollItem("Index", s_node_repeat_selection_types, 0),
|
||||
new scrollItem("Area", s_node_repeat_selection_types, 1),
|
||||
new scrollItem("Surface", s_node_repeat_selection_types, 2),]));
|
||||
|
||||
newInput(_index + 2, nodeValue_Vec2("Position", self, [ 0, 0 ]));
|
||||
|
||||
newInput(_index + 3, nodeValue_Rotation("Rotation", self, 0));
|
||||
|
||||
newInput(_index + 4, nodeValue_Vec2("Scale", self, [ 0, 0 ]));
|
||||
|
||||
newInput(_index + 5, nodeValue_Enum_Button("Anchor type", self, 1, [ "Global", "Local" ]));
|
||||
|
||||
newInput(_index + 6, nodeValue_Vec2("Anchor Position", self, [ 0.5, 0.5 ]))
|
||||
.setTooltip("Anchor point for transformation, absolute value for global type, relative for local.");
|
||||
|
||||
newInput(_index + 7, nodeValue_Color("Color", self, c_white));
|
||||
|
||||
newInput(_index + 8, nodeValue_Float("Alpha", self, 0))
|
||||
.setDisplay(VALUE_DISPLAY.slider, { range : [ -1, 1, 0.01 ] });
|
||||
|
||||
newInput(_index + 9, nodeValue_Area("Selection area", self, DEF_AREA_REF))
|
||||
.setUnitRef(function() /*=>*/ {return getDimension()}, VALUE_UNIT.reference);
|
||||
|
||||
newInput(_index + 10, nodeValue_Float("Selection index", self, 0));
|
||||
|
||||
newInput(_index + 11, nodeValue_Float("Selection range", self, 2));
|
||||
|
||||
newInput(_index + 12, nodeValue_Float("Selection falloff", self, 0));
|
||||
|
||||
newInput(_index + 13, nodeValue("Selection falloff curve", self, CONNECT_TYPE.input, VALUE_TYPE.curve, CURVE_DEF_10));
|
||||
|
||||
newInput(_index + 14, nodeValue_Surface("Selection surface", self, noone));
|
||||
|
||||
resetDisplay();
|
||||
return inputs[_index];
|
||||
}
|
||||
|
||||
animator_renderer = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus) {
|
||||
|
||||
var bs = ui(24);
|
||||
var bx = _x + ui(20);
|
||||
var by = _y;
|
||||
if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, _focus, _hover, "", THEME.add_16, 0, COLORS._main_value_positive) == 2) {
|
||||
createNewInput();
|
||||
triggerRender();
|
||||
}
|
||||
|
||||
draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text_sub);
|
||||
draw_text_add(bx + bx + ui(8), by + bs / 2, "Animators");
|
||||
|
||||
var amo = getInputAmount();
|
||||
var lh = ui(28);
|
||||
var _h = ui(8) + lh * amo;
|
||||
var yy = _y + bs + ui(4);
|
||||
|
||||
var del_animator = -1;
|
||||
draw_sprite_stretched_ext(THEME.ui_panel_bg, 1, _x, yy, _w, _h, COLORS.node_composite_bg_blend, 1);
|
||||
|
||||
for(var i = 0; i < amo; i++) {
|
||||
var _x0 = _x + ui(24);
|
||||
var _x1 = _x + _w - ui(16);
|
||||
var _yy = ui(4) + yy + i * lh + lh / 2;
|
||||
|
||||
var _ind = input_fix_len + i * data_length;
|
||||
var _dtyp = current_data[_ind + 0];
|
||||
var _styp = current_data[_ind + 1];
|
||||
var cc = i == animator_inspecting? COLORS._main_icon : COLORS._main_icon;
|
||||
var tc = i == animator_inspecting? COLORS._main_text_accent : COLORS._main_icon;
|
||||
var hov = _hover && point_in_rectangle(_m[0], _m[1], _x0, _yy - lh / 2, _x1, _yy + lh / 2 - 1);
|
||||
|
||||
if(hov && _m[0] < _x1 - ui(32)) {
|
||||
tc = COLORS._main_text;
|
||||
|
||||
if(mouse_press(mb_left, _focus)) {
|
||||
animator_inspecting = i;
|
||||
resetDisplay();
|
||||
}
|
||||
}
|
||||
|
||||
draw_sprite_ext(s_node_repeat_selection_types, _styp, _x0 + ui(8), _yy, 1, 1, 0, cc);
|
||||
|
||||
draw_set_text(f_p2, fa_left, fa_center, tc);
|
||||
draw_text_add(_x0 + ui(28), _yy, typeList[_dtyp]);
|
||||
|
||||
if(amo > 1) {
|
||||
var bs = ui(24);
|
||||
var bx = _x1 - bs;
|
||||
var by = _yy - bs / 2;
|
||||
if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, _focus, _hover, "", THEME.minus_16, 0, hov? COLORS._main_value_negative : COLORS._main_icon) == 2)
|
||||
del_animator = i;
|
||||
}
|
||||
}
|
||||
|
||||
if(del_animator > -1)
|
||||
deleteAnimator(del_animator);
|
||||
|
||||
return ui(32) + _h;
|
||||
});
|
||||
|
||||
input_display_animator = [
|
||||
["Selection", false], 1, 9, 10, 11, 12, 13, 14,
|
||||
["Effects", false], 0, 2, 3, 4, 5, 6, 7, 8,
|
||||
];
|
||||
|
||||
input_display_list = [
|
||||
["Surfaces", true], 0, 35, 36, 37, 1, 16, 17,
|
||||
["Pattern", false], 3, 9, 32, 2, 18, 7, 8,
|
||||
|
@ -130,9 +244,37 @@ function Node_Repeat(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
|
|||
["Rotation", false], 33, 5,
|
||||
["Scale", false], 6, 10,
|
||||
["Render", false], 34, 14, 30,
|
||||
//["Animator", true, 29], 20, 21, 25, 22, 23, 24, 27,
|
||||
new Inspector_Spacer(8, true),
|
||||
new Inspector_Spacer(2, false, false),
|
||||
animator_renderer,
|
||||
];
|
||||
|
||||
setDynamicInput(15, false);
|
||||
|
||||
static resetDisplay = function() {
|
||||
array_resize(input_display_list, array_length(input_display_list_raw));
|
||||
|
||||
if(getInputAmount()) animator_inspecting = clamp(animator_inspecting, 0, getInputAmount() - 1);
|
||||
|
||||
var _ind = input_fix_len + animator_inspecting * data_length;
|
||||
|
||||
for( var i = 0, n = array_length(input_display_animator); i < n; i++ ) {
|
||||
var v = input_display_animator[i];
|
||||
if(is_real(v)) v += _ind;
|
||||
|
||||
array_push(input_display_list, v);
|
||||
}
|
||||
}
|
||||
|
||||
static deleteAnimator = function(index) {
|
||||
var _ind = input_fix_len + index * data_length;
|
||||
|
||||
array_delete(inputs, _ind, data_length);
|
||||
animator_inspecting = clamp(animator_inspecting, 0, getInputAmount() - 1);
|
||||
resetDisplay();
|
||||
triggerRender();
|
||||
}
|
||||
|
||||
attribute_surface_depth();
|
||||
attribute_interpolation();
|
||||
|
||||
|
@ -153,6 +295,23 @@ function Node_Repeat(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
|
|||
|
||||
var hv = inputs[31].drawOverlay(hover, active, _x, _y, _s, _mx, _my, _snx, _sny, current_data[1]); active &= !hv; _hov |= hv;
|
||||
|
||||
var _ani_amo = getInputAmount();
|
||||
if(_ani_amo == 0) return _hov;
|
||||
|
||||
animator_inspecting = clamp(animator_inspecting, 0, getInputAmount() - 1);
|
||||
var _ind = input_fix_len + animator_inspecting * data_length;
|
||||
|
||||
var _prop = current_data[_ind + 0];
|
||||
var _selc = current_data[_ind + 1];
|
||||
|
||||
if(_selc == 0) {
|
||||
|
||||
|
||||
} else if(_selc == 1) {
|
||||
var hv = inputs[_ind + 9].drawOverlay(hover, active, _x, _y, _s, _mx, _my, _snx, _sny); active &= !hv; _hov |= hv;
|
||||
|
||||
}
|
||||
|
||||
return _hov;
|
||||
}
|
||||
|
||||
|
@ -209,15 +368,38 @@ function Node_Repeat(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
|
|||
var _arr = _data[16];
|
||||
var _sed = _data[17];
|
||||
|
||||
var _col = _data[18];
|
||||
var _cls = _data[19];
|
||||
|
||||
var _col = _data[18];
|
||||
var _cls = _data[19];
|
||||
var _bld_md = _data[34];
|
||||
|
||||
var _surf, runx, runy, posx, posy, scax, scay, rot;
|
||||
var _dim;
|
||||
var _ani_amo = getInputAmount();
|
||||
|
||||
var _surf = _iSrf, _sdim = [ 1, 1 ];
|
||||
if(_ani_amo > 0) { // animator visibility
|
||||
animator_inspecting = clamp(animator_inspecting, 0, getInputAmount() - 1);
|
||||
var _ind = input_fix_len + animator_inspecting * data_length;
|
||||
|
||||
var _prop = _data[_ind + 0];
|
||||
var _selc = _data[_ind + 1];
|
||||
|
||||
inputs[_ind + 2].setVisible(_prop == 0);
|
||||
inputs[_ind + 3].setVisible(_prop == 0);
|
||||
inputs[_ind + 4].setVisible(_prop == 0);
|
||||
inputs[_ind + 5].setVisible(_prop == 0);
|
||||
inputs[_ind + 6].setVisible(_prop == 0);
|
||||
inputs[_ind + 7].setVisible(_prop == 1);
|
||||
inputs[_ind + 8].setVisible(_prop == 1);
|
||||
|
||||
inputs[_ind + 9].setVisible(_selc == 1);
|
||||
inputs[_ind + 10].setVisible(_selc == 0);
|
||||
inputs[_ind + 11].setVisible(_selc == 0);
|
||||
inputs[_ind + 12].setVisible(_selc != 2);
|
||||
inputs[_ind + 13].setVisible(_selc != 2);
|
||||
inputs[_ind + 14].setVisible(_selc == 2, _selc == 2);
|
||||
}
|
||||
|
||||
var _surf, runx, runy, posx, posy, scax, scay, rot;
|
||||
var _dim, _sdim = [ 1, 1 ];
|
||||
var _surf = _iSrf;
|
||||
|
||||
var minx = 999999, miny = 999999;
|
||||
var maxx = -999999, maxy = -999999;
|
||||
|
@ -301,21 +483,13 @@ function Node_Repeat(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
|
|||
}
|
||||
}
|
||||
|
||||
var pos = point_rotate(-sw / 2, -sh / 2, 0, 0, rot);
|
||||
var cc = evaluate_gradient_map(i / (_amo - 1), _grad, _grad_map, _grad_range, inputs[14]);
|
||||
var aa = _color_get_alpha(cc);
|
||||
|
||||
////////////////////////////////////////// animator system goes here...
|
||||
|
||||
minx = min(minx, posx + pos[0], posx - pos[0], posx + pos[1], posx - pos[1]);
|
||||
miny = min(miny, posy + pos[0], posy - pos[0], posy + pos[1], posy - pos[1]);
|
||||
maxx = max(maxx, posx + pos[0], posx - pos[0], posx + pos[1], posx - pos[1]);
|
||||
maxy = max(maxy, posy + pos[0], posy - pos[0], posy + pos[1], posy - pos[1]);
|
||||
|
||||
atlases[atlas_i++] = {
|
||||
surface : _surf,
|
||||
x : posx + pos[0],
|
||||
y : posy + pos[1],
|
||||
x : posx,
|
||||
y : posy,
|
||||
sx : scax,
|
||||
sy : scay,
|
||||
rot : rot,
|
||||
|
@ -328,10 +502,123 @@ function Node_Repeat(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
|
|||
}
|
||||
|
||||
array_resize(atlases, atlas_i);
|
||||
var __temp_p = [ 0,0 ];
|
||||
|
||||
for( var i = 0, n = array_length(atlases); i < n; i++ ) { // animators
|
||||
var _a = atlases[i];
|
||||
var _surf = _a.surface;
|
||||
|
||||
var _x = _a.x;
|
||||
var _y = _a.y;
|
||||
|
||||
for( var j = 0; j < _ani_amo; j++ ) {
|
||||
var _ii = input_fix_len + j * data_length;
|
||||
|
||||
var _an_prop = _data[_ii + 0];
|
||||
var _an_selt = _data[_ii + 1];
|
||||
|
||||
var _an_posi = _data[_ii + 2];
|
||||
var _an_rota = _data[_ii + 3];
|
||||
var _an_scal = _data[_ii + 4];
|
||||
var _an_anct = _data[_ii + 5];
|
||||
var _an_ancp = _data[_ii + 6];
|
||||
var _an_colr = _data[_ii + 7];
|
||||
var _an_alph = _data[_ii + 8];
|
||||
|
||||
var _an_sare = _data[_ii + 9];
|
||||
var _an_sind = _data[_ii + 10];
|
||||
var _an_srng = _data[_ii + 11];
|
||||
var _an_sfal = _data[_ii + 12];
|
||||
var _an_sfcr = _data[_ii + 13];
|
||||
var _an_ssrf = _data[_ii + 14];
|
||||
|
||||
var _inf = 0;
|
||||
var _ax = 0, _ay = 0;
|
||||
|
||||
if(_an_selt == 0) { // index
|
||||
if(i < _an_sind - _an_srng - _an_sfal || i > _an_sind + _an_srng + _an_sfal)
|
||||
_inf = 0;
|
||||
else if (_an_sfal > 0 && (i < _an_sind - _an_srng || i > _an_sind + _an_srng))
|
||||
_inf = 1 - clamp(min(abs(i - (_an_sind - _an_srng)), abs(i - (_an_sind + _an_srng))) / _an_sfal, 0, 1);
|
||||
else
|
||||
_inf = 1;
|
||||
|
||||
} else if(_an_selt == 1) { // area
|
||||
_inf = 1 - area_point_in_fallout(_an_sare, _x, _y, _an_sfal);
|
||||
|
||||
} else if(_an_selt == 2) { // surface
|
||||
if(is_surface(_an_ssrf)) {
|
||||
var b = surface_getpixel(_an_ssrf, _x, _y);
|
||||
_inf = 1 - _color_get_light(b);
|
||||
}
|
||||
}
|
||||
|
||||
_inf = eval_curve_x(_an_sfcr, _inf);
|
||||
if(_inf == 0) continue;
|
||||
|
||||
if(_an_prop == 0) { // transform
|
||||
if(_an_anct == 0) { // global
|
||||
_ax = _an_ancp[0];
|
||||
_ay = _an_ancp[1];
|
||||
|
||||
} else if(_an_anct == 1) { // local
|
||||
var _surf_dim = surface_get_dimension(_surf);
|
||||
_ax = _x + (_an_ancp[0] - .5) * _surf_dim[0];
|
||||
_ay = _y + (_an_ancp[1] - .5) * _surf_dim[1];
|
||||
|
||||
}
|
||||
|
||||
_x += _inf * _an_posi[0];
|
||||
_y += _inf * _an_posi[1];
|
||||
|
||||
var _dr = _inf * _an_rota;
|
||||
if(_dr != 0) {
|
||||
_a.rot += _dr;
|
||||
|
||||
__temp_p = point_rotate(_x, _y, _ax, _ay, _dr, __temp_p);
|
||||
_x = __temp_p[0];
|
||||
_y = __temp_p[1];
|
||||
}
|
||||
|
||||
var _dsx = _inf * _an_scal[0];
|
||||
var _dsy = _inf * _an_scal[1];
|
||||
if(_dsx != 0 || _dsy != 0) {
|
||||
_a.sx += _inf * _an_scal[0];
|
||||
_a.sy += _inf * _an_scal[1];
|
||||
|
||||
_x += _dsx * (_x - _ax);
|
||||
_y += _dsy * (_y - _ay);
|
||||
}
|
||||
|
||||
} else if(_an_prop == 1) { // blending
|
||||
_a.color = merge_color(_a.color, _an_colr, _inf);
|
||||
_a.alpha += _inf * _an_alph;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var _sw = surface_get_width_safe(_surf);
|
||||
var _sh = surface_get_height_safe(_surf);
|
||||
var sw = _sw * _a.sx;
|
||||
var sh = _sh * _a.sy;
|
||||
var pos = point_rotate(-sw / 2, -sh / 2, 0, 0, rot);
|
||||
|
||||
minx = min(minx, _x + pos[0], _x - pos[0], _x + pos[1], _x - pos[1]);
|
||||
miny = min(miny, _y + pos[0], _y - pos[0], _y + pos[1], _y - pos[1]);
|
||||
maxx = max(maxx, _x + pos[0], _x - pos[0], _x + pos[1], _x - pos[1]);
|
||||
maxy = max(maxy, _y + pos[0], _y - pos[0], _y + pos[1], _y - pos[1]);
|
||||
|
||||
_a.x = _x + pos[0];
|
||||
_a.y = _y + pos[1];
|
||||
}
|
||||
|
||||
/////////////////////////////////////// ===== DIMENSION
|
||||
|
||||
inputs[ 1].setVisible(false);
|
||||
inputs[36].setVisible(false);
|
||||
inputs[37].setVisible(false);
|
||||
|
||||
|
||||
switch(_dimt) {
|
||||
case OUTPUT_SCALING.same_as_input :
|
||||
_dim = _sdim;
|
||||
|
@ -363,6 +650,8 @@ function Node_Repeat(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
|
|||
_outSurf = surface_verify(_outSurf, _dim[0], _dim[1]);
|
||||
var _x, _y;
|
||||
|
||||
/////////////////////////////////////// ===== RENDERING
|
||||
|
||||
surface_set_shader(_outSurf);
|
||||
if(_bld_md == 0) { BLEND_ALPHA_MULP }
|
||||
else if(_bld_md == 1) { BLEND_ADD }
|
||||
|
|
|
@ -85,9 +85,18 @@ function Inspector_Custom_Renderer(drawFn, registerFn = noone) : widget() constr
|
|||
static toString = function() { return $"Custon renderer"; }
|
||||
}
|
||||
|
||||
function Inspector_Sprite(spr) constructor { self.spr = spr; }
|
||||
function Inspector_Spacer(height, line = false) constructor { self.h = height; self.line = line; }
|
||||
function Inspector_Label( text, font = f_p3) constructor { self.text = text; self.font = font; }
|
||||
function Inspector_Sprite(spr) constructor { self.spr = spr; }
|
||||
|
||||
function Inspector_Label( text, font = f_p3) constructor {
|
||||
self.text = text;
|
||||
self.font = font;
|
||||
}
|
||||
|
||||
function Inspector_Spacer(height, line = false, coll = true) constructor {
|
||||
self.h = height;
|
||||
self.line = line;
|
||||
self.coll = coll;
|
||||
}
|
||||
|
||||
function Panel_Inspector() : PanelContent() constructor {
|
||||
#region ---- main ----
|
||||
|
@ -810,6 +819,7 @@ function Panel_Inspector() : PanelContent() constructor {
|
|||
|
||||
if(mouse_press(mb_left, pFOCUS))
|
||||
jun[@ 1] = !coll;
|
||||
|
||||
if(mouse_press(mb_right, pFOCUS))
|
||||
menuCall("inspector_group_menu", group_menu, 0, 0, fa_left);
|
||||
} else
|
||||
|
@ -851,8 +861,9 @@ function Panel_Inspector() : PanelContent() constructor {
|
|||
|
||||
while(j < _len) {
|
||||
var j_jun = _inspecting.input_display_list[j];
|
||||
if(is_array(j_jun))
|
||||
break;
|
||||
if(is_array(j_jun)) break;
|
||||
if(IS(j_jun, Inspector_Spacer) && !j_jun.coll) break;
|
||||
|
||||
j++;
|
||||
}
|
||||
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 610 B |
Binary file not shown.
After Width: | Height: | Size: 535 B |
Binary file not shown.
After Width: | Height: | Size: 770 B |
Binary file not shown.
After Width: | Height: | Size: 610 B |
Binary file not shown.
After Width: | Height: | Size: 535 B |
Binary file not shown.
After Width: | Height: | Size: 770 B |
|
@ -0,0 +1,98 @@
|
|||
{
|
||||
"$GMSprite":"",
|
||||
"%Name":"s_node_repeat_selection_types",
|
||||
"bboxMode":0,
|
||||
"bbox_bottom":21,
|
||||
"bbox_left":2,
|
||||
"bbox_right":21,
|
||||
"bbox_top":2,
|
||||
"collisionKind":1,
|
||||
"collisionTolerance":0,
|
||||
"DynamicTexturePage":false,
|
||||
"edgeFiltering":false,
|
||||
"For3D":false,
|
||||
"frames":[
|
||||
{"$GMSpriteFrame":"","%Name":"71a60998-4c2f-4f5f-b5af-63b69dce2512","name":"71a60998-4c2f-4f5f-b5af-63b69dce2512","resourceType":"GMSpriteFrame","resourceVersion":"2.0",},
|
||||
{"$GMSpriteFrame":"","%Name":"000dc648-1068-48f1-be2a-6428a509db2e","name":"000dc648-1068-48f1-be2a-6428a509db2e","resourceType":"GMSpriteFrame","resourceVersion":"2.0",},
|
||||
{"$GMSpriteFrame":"","%Name":"9a395831-399b-45d2-bebd-6fb20d8d6b79","name":"9a395831-399b-45d2-bebd-6fb20d8d6b79","resourceType":"GMSpriteFrame","resourceVersion":"2.0",},
|
||||
],
|
||||
"gridX":0,
|
||||
"gridY":0,
|
||||
"height":24,
|
||||
"HTile":false,
|
||||
"layers":[
|
||||
{"$GMImageLayer":"","%Name":"9c737327-1000-4655-9cc5-d32fb498c866","blendMode":0,"displayName":"default","isLocked":false,"name":"9c737327-1000-4655-9cc5-d32fb498c866","opacity":100.0,"resourceType":"GMImageLayer","resourceVersion":"2.0","visible":true,},
|
||||
],
|
||||
"name":"s_node_repeat_selection_types",
|
||||
"nineSlice":null,
|
||||
"origin":4,
|
||||
"parent":{
|
||||
"name":"nodes",
|
||||
"path":"folders/sprites/nodes.yy",
|
||||
},
|
||||
"preMultiplyAlpha":false,
|
||||
"resourceType":"GMSprite",
|
||||
"resourceVersion":"2.0",
|
||||
"sequence":{
|
||||
"$GMSequence":"",
|
||||
"%Name":"s_node_repeat_selection_types",
|
||||
"autoRecord":true,
|
||||
"backdropHeight":768,
|
||||
"backdropImageOpacity":0.5,
|
||||
"backdropImagePath":"",
|
||||
"backdropWidth":1366,
|
||||
"backdropXOffset":0.0,
|
||||
"backdropYOffset":0.0,
|
||||
"events":{
|
||||
"$KeyframeStore<MessageEventKeyframe>":"",
|
||||
"Keyframes":[],
|
||||
"resourceType":"KeyframeStore<MessageEventKeyframe>",
|
||||
"resourceVersion":"2.0",
|
||||
},
|
||||
"eventStubScript":null,
|
||||
"eventToFunction":{},
|
||||
"length":3.0,
|
||||
"lockOrigin":false,
|
||||
"moments":{
|
||||
"$KeyframeStore<MomentsEventKeyframe>":"",
|
||||
"Keyframes":[],
|
||||
"resourceType":"KeyframeStore<MomentsEventKeyframe>",
|
||||
"resourceVersion":"2.0",
|
||||
},
|
||||
"name":"s_node_repeat_selection_types",
|
||||
"playback":1,
|
||||
"playbackSpeed":30.0,
|
||||
"playbackSpeedType":0,
|
||||
"resourceType":"GMSequence",
|
||||
"resourceVersion":"2.0",
|
||||
"showBackdrop":true,
|
||||
"showBackdropImage":false,
|
||||
"timeUnits":1,
|
||||
"tracks":[
|
||||
{"$GMSpriteFramesTrack":"","builtinName":0,"events":[],"inheritsTrackColour":true,"interpolation":1,"isCreationTrack":false,"keyframes":{"$KeyframeStore<SpriteFrameKeyframe>":"","Keyframes":[
|
||||
{"$Keyframe<SpriteFrameKeyframe>":"","Channels":{
|
||||
"0":{"$SpriteFrameKeyframe":"","Id":{"name":"71a60998-4c2f-4f5f-b5af-63b69dce2512","path":"sprites/s_node_repeat_selection_types/s_node_repeat_selection_types.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},
|
||||
},"Disabled":false,"id":"54099991-8e8a-4c97-b0f3-c4c3457fcd4c","IsCreationKey":false,"Key":0.0,"Length":1.0,"resourceType":"Keyframe<SpriteFrameKeyframe>","resourceVersion":"2.0","Stretch":false,},
|
||||
{"$Keyframe<SpriteFrameKeyframe>":"","Channels":{
|
||||
"0":{"$SpriteFrameKeyframe":"","Id":{"name":"000dc648-1068-48f1-be2a-6428a509db2e","path":"sprites/s_node_repeat_selection_types/s_node_repeat_selection_types.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},
|
||||
},"Disabled":false,"id":"ca68b041-6bdb-4460-9e52-5de9768d1186","IsCreationKey":false,"Key":1.0,"Length":1.0,"resourceType":"Keyframe<SpriteFrameKeyframe>","resourceVersion":"2.0","Stretch":false,},
|
||||
{"$Keyframe<SpriteFrameKeyframe>":"","Channels":{
|
||||
"0":{"$SpriteFrameKeyframe":"","Id":{"name":"9a395831-399b-45d2-bebd-6fb20d8d6b79","path":"sprites/s_node_repeat_selection_types/s_node_repeat_selection_types.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},
|
||||
},"Disabled":false,"id":"514189bf-c26d-4bca-9d69-3fe5b164ef0a","IsCreationKey":false,"Key":2.0,"Length":1.0,"resourceType":"Keyframe<SpriteFrameKeyframe>","resourceVersion":"2.0","Stretch":false,},
|
||||
],"resourceType":"KeyframeStore<SpriteFrameKeyframe>","resourceVersion":"2.0",},"modifiers":[],"name":"frames","resourceType":"GMSpriteFramesTrack","resourceVersion":"2.0","spriteId":null,"trackColour":0,"tracks":[],"traits":0,},
|
||||
],
|
||||
"visibleRange":null,
|
||||
"volume":1.0,
|
||||
"xorigin":12,
|
||||
"yorigin":12,
|
||||
},
|
||||
"swatchColours":null,
|
||||
"swfPrecision":0.5,
|
||||
"textureGroupId":{
|
||||
"name":"Default",
|
||||
"path":"texturegroups/Default",
|
||||
},
|
||||
"type":0,
|
||||
"VTile":false,
|
||||
"width":24,
|
||||
}
|
Loading…
Reference in a new issue