mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-12-24 22:16:17 +01:00
Undo armature
This commit is contained in:
parent
fa00d1e2b2
commit
0dfcbce2ce
43 changed files with 9346 additions and 3710 deletions
|
@ -0,0 +1,924 @@
|
|||
// 2023-08-08 14:25:53
|
||||
function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
|
||||
name = "Armature Bind";
|
||||
|
||||
inputs[| 0] = nodeValue("Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, DEF_SURF)
|
||||
.setDisplay(VALUE_DISPLAY.vector);
|
||||
|
||||
inputs[| 1] = nodeValue("Armature", self, JUNCTION_CONNECT.input, VALUE_TYPE.armature, noone)
|
||||
.setVisible(true, true)
|
||||
.rejectArray();
|
||||
|
||||
inputs[| 2] = nodeValue("Bind data", self, JUNCTION_CONNECT.input, VALUE_TYPE.struct, noone)
|
||||
.setVisible(true, true)
|
||||
.setArrayDepth(1);
|
||||
|
||||
inputs[| 3] = nodeValue("Bone transform", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ])
|
||||
.setDisplay(VALUE_DISPLAY.vector);
|
||||
|
||||
inputs[| 4] = nodeValue("Bone scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1)
|
||||
.setDisplay(VALUE_DISPLAY.slider, [ 0.1, 2, 0.01 ]);
|
||||
|
||||
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
|
||||
|
||||
outputs[| 1] = nodeValue("Atlas data", self, JUNCTION_CONNECT.output, VALUE_TYPE.atlas, [])
|
||||
.rejectArrayProcess();
|
||||
|
||||
outputs[| 2] = nodeValue("Bind data", self, JUNCTION_CONNECT.output, VALUE_TYPE.struct, [])
|
||||
.setArrayDepth(1);
|
||||
|
||||
attribute_surface_depth();
|
||||
attribute_interpolation();
|
||||
|
||||
attributes.layer_visible = [];
|
||||
attributes.layer_selectable = [];
|
||||
|
||||
attributes.display_name = true;
|
||||
attributes.display_bone = 0;
|
||||
|
||||
anchor_selecting = noone;
|
||||
|
||||
array_push(attributeEditors, "Display");
|
||||
array_push(attributeEditors, ["Display name", function() { return attributes.display_name; },
|
||||
new checkBox(function() {
|
||||
attributes.display_name = !attributes.display_name;
|
||||
})]);
|
||||
array_push(attributeEditors, ["Display bone", function() { return attributes.display_bone; },
|
||||
new scrollBox(["Octahedral", "Stick"], function(ind) {
|
||||
attributes.display_bone = ind;
|
||||
})]);
|
||||
|
||||
boneMap = ds_map_create();
|
||||
surfMap = ds_map_create();
|
||||
|
||||
hold_visibility = true;
|
||||
hold_select = true;
|
||||
layer_dragging = noone;
|
||||
layer_remove = -1;
|
||||
|
||||
layer_renderer = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus) { #region
|
||||
ds_map_clear(surfMap);
|
||||
|
||||
var index = -1;
|
||||
for(var i = input_fix_len; i < ds_list_size(inputs) - data_length; i += data_length) {
|
||||
index++;
|
||||
var _surf = current_data[i];
|
||||
var _id = inputs[| i].extra_data.bone_id;
|
||||
if(_id == "") continue;
|
||||
|
||||
if(ds_map_exists(surfMap, _id))
|
||||
array_push(surfMap[? _id], [ index, _surf ]);
|
||||
else
|
||||
surfMap[? _id] = [ [ index, _surf ] ];
|
||||
|
||||
//print($"Add {_surf} to {_id}");
|
||||
}
|
||||
|
||||
#region draw bones
|
||||
var _b = bone;
|
||||
if(_b == noone) return 0;
|
||||
var amo = _b.childCount();
|
||||
var _hh = ui(28);
|
||||
var bh = ui(32 + 16) + amo * _hh;
|
||||
var ty = _y;
|
||||
|
||||
draw_set_text(f_p0, fa_left, fa_top, COLORS._main_text);
|
||||
draw_text_add(_x + ui(16), ty + ui(4), "Bones");
|
||||
|
||||
ty += ui(32);
|
||||
|
||||
var _ty = ty;
|
||||
draw_sprite_stretched_ext(THEME.ui_panel_bg, 1, _x, ty, _w, bh - ui(32), COLORS.node_composite_bg_blend, 1);
|
||||
|
||||
draw_set_color(COLORS.node_composite_separator);
|
||||
draw_line(_x + 16, ty + ui(8), _x + _w - 16, ty + ui(8));
|
||||
|
||||
ty += ui(8);
|
||||
|
||||
var hovering = noone;
|
||||
var _bst = ds_stack_create();
|
||||
ds_stack_push(_bst, [ _b, _x, _w ]);
|
||||
|
||||
anchor_selecting = noone;
|
||||
|
||||
while(!ds_stack_empty(_bst)) {
|
||||
var _st = ds_stack_pop(_bst);
|
||||
var _bone = _st[0];
|
||||
var __x = _st[1];
|
||||
var __w = _st[2];
|
||||
|
||||
for( var i = 0, n = array_length(_bone.childs); i < n; i++ )
|
||||
ds_stack_push(_bst, [ _bone.childs[i], __x + 16, __w - 16 ]);
|
||||
|
||||
if(_bone.is_main) continue;
|
||||
|
||||
if(_bone.parent_anchor)
|
||||
draw_sprite_ui(THEME.bone, 1, __x + 12, ty + 14,,,, COLORS._main_icon);
|
||||
else if(_bone.IKlength)
|
||||
draw_sprite_ui(THEME.bone, 2, __x + 12, ty + 14,,,, COLORS._main_icon);
|
||||
else
|
||||
draw_sprite_ui(THEME.bone, 0, __x + 12, ty + 14,,,, COLORS._main_icon);
|
||||
|
||||
draw_set_text(f_p2, fa_left, fa_center, COLORS._main_text);
|
||||
draw_text(__x + 24, ty + 12, _bone.name);
|
||||
|
||||
if(ds_map_exists(surfMap, _bone.ID)) {
|
||||
var _sdata = surfMap[? _bone.ID];
|
||||
|
||||
var _sx = __x + 24 + string_width(_bone.name) + 8;
|
||||
var _sy = ty + 4;
|
||||
|
||||
for( var i = 0, n = array_length(_sdata); i < n; i++ ) {
|
||||
var _sid = _sdata[i][0];
|
||||
var _surf = _sdata[i][1];
|
||||
var _sw = surface_get_width(_surf);
|
||||
var _sh = surface_get_height(_surf);
|
||||
var _ss = (_hh - 8) / _sh;
|
||||
|
||||
draw_surface_ext_safe(_surf, _sx, _sy, _ss, _ss, 0, c_white, 1);
|
||||
|
||||
if(_hover && point_in_rectangle(_m[0], _m[1], _sx, _sy, _sx + _sw * _ss, _sy + _sh * _ss)) {
|
||||
TOOLTIP = [ _surf, VALUE_TYPE.surface ];
|
||||
if(mouse_press(mb_left, _focus)) {
|
||||
layer_dragging = _sid;
|
||||
inputs[| input_fix_len + _sid * data_length].extra_data.bone_id = "";
|
||||
}
|
||||
|
||||
draw_set_color(COLORS._main_accent);
|
||||
} else
|
||||
draw_set_color(COLORS.node_composite_bg);
|
||||
draw_rectangle(_sx, _sy, _sx + _sw * _ss, _sy + _sh * _ss, true);
|
||||
|
||||
_sx += _sw * _ss + 4;
|
||||
}
|
||||
}
|
||||
|
||||
if(point_in_rectangle(_m[0], _m[1], _x, ty, _x + _w, ty + _hh - 1)) {
|
||||
if(layer_dragging != noone) {
|
||||
draw_sprite_stretched_ext(THEME.ui_panel_active, 0, _x, ty, _w, _hh, COLORS._main_accent, 1);
|
||||
hovering = _bone;
|
||||
}
|
||||
|
||||
anchor_selecting = [ _bone, 2 ];
|
||||
}
|
||||
|
||||
ty += _hh;
|
||||
|
||||
draw_set_color(COLORS.node_composite_separator);
|
||||
draw_line(_x + 16, ty, _x + _w - 16, ty);
|
||||
}
|
||||
|
||||
ds_stack_destroy(_bst);
|
||||
|
||||
if(layer_dragging != noone && hovering && mouse_release(mb_left)) {
|
||||
var _lind = input_fix_len + layer_dragging * data_length;
|
||||
inputs[| _lind].extra_data.bone_id = hovering.ID;
|
||||
|
||||
layer_dragging = noone;
|
||||
triggerRender();
|
||||
}
|
||||
|
||||
if(layer_dragging != noone && !hovering)
|
||||
draw_sprite_stretched_ext(THEME.ui_panel_active, 0, _x, _ty, _w, bh - ui(32), COLORS._main_accent, 1);
|
||||
#endregion
|
||||
|
||||
var amo = (ds_list_size(inputs) - input_fix_len) / data_length - 1;
|
||||
if(array_length(current_data) != ds_list_size(inputs)) return 0;
|
||||
|
||||
var ty = _y + bh + ui(8);
|
||||
|
||||
//draw_set_color(COLORS.node_composite_separator);
|
||||
//draw_line(_x + 16, ty - ui(4), _x + _w - 16, ty - ui(4));
|
||||
|
||||
draw_set_text(f_p0, fa_left, fa_top, COLORS._main_text);
|
||||
draw_text_add(_x + ui(16), ty + ui(4), "Surfaces");
|
||||
|
||||
ty += ui(32);
|
||||
|
||||
#region draw surface
|
||||
var lh = 32;
|
||||
var sh = 8 + max(1, amo) * (lh + 4) + 8;
|
||||
draw_sprite_stretched_ext(THEME.ui_panel_bg, 1, _x, ty, _w, sh, COLORS.node_composite_bg_blend, 1);
|
||||
|
||||
var _vis = attributes.layer_visible;
|
||||
var _sel = attributes.layer_selectable;
|
||||
var ly = ty + 8;
|
||||
var ssh = lh - 6;
|
||||
var hoverIndex = noone;
|
||||
draw_set_color(COLORS.node_composite_separator);
|
||||
draw_line(_x + 16, ly, _x + _w - 16, ly);
|
||||
|
||||
layer_remove = -1;
|
||||
var index = -1;
|
||||
for(var i = input_fix_len; i < ds_list_size(inputs) - data_length; i += data_length) {
|
||||
var _surf = current_data[i];
|
||||
|
||||
index++;
|
||||
var _bx = _x + _w - 24;
|
||||
var _cy = ly + index * (lh + 4);
|
||||
|
||||
if(point_in_circle(_m[0], _m[1], _bx, _cy + lh / 2, 16)) {
|
||||
draw_sprite_ui_uniform(THEME.icon_delete, 3, _bx, _cy + lh / 2, 1, COLORS._main_value_negative);
|
||||
|
||||
if(mouse_press(mb_left, _focus))
|
||||
layer_remove = index;
|
||||
} else
|
||||
draw_sprite_ui_uniform(THEME.icon_delete, 3, _bx, _cy + lh / 2, 1, COLORS._main_icon);
|
||||
|
||||
_bx -= 32;
|
||||
|
||||
//if(point_in_circle(_m[0], _m[1], _bx, _cy + lh / 2, 16)) {
|
||||
// draw_sprite_ui_uniform(THEME.reset_16, 3, _bx, _cy + lh / 2, 1, COLORS._main_value_negative);
|
||||
|
||||
// if(mouse_press(mb_left, _focus))
|
||||
// resetTransform(i);
|
||||
//} else
|
||||
// draw_sprite_ui_uniform(THEME.reset_16, 3, _bx, _cy + lh / 2, 1, COLORS._main_icon);
|
||||
|
||||
if(!is_surface(_surf)) continue;
|
||||
|
||||
var aa = (index != layer_dragging || layer_dragging == noone)? 1 : 0.5;
|
||||
var vis = _vis[index];
|
||||
var sel = _sel[index];
|
||||
var hover = point_in_rectangle(_m[0], _m[1], _x, _cy, _x + _w, _cy + lh);
|
||||
|
||||
draw_set_color(COLORS.node_composite_separator);
|
||||
draw_line(_x + 16, _cy + lh + 2, _x + _w - 16, _cy + lh + 2);
|
||||
|
||||
var _bx = _x + 24 * 2 + 8;
|
||||
if(point_in_circle(_m[0], _m[1], _bx, _cy + lh / 2, 12)) {
|
||||
draw_sprite_ui_uniform(THEME.junc_visible, vis, _bx, _cy + lh / 2, 1, c_white);
|
||||
|
||||
if(mouse_press(mb_left, _focus))
|
||||
hold_visibility = !_vis[index];
|
||||
|
||||
if(mouse_click(mb_left, _focus) && _vis[index] != hold_visibility) {
|
||||
_vis[@ index] = hold_visibility;
|
||||
doUpdate();
|
||||
}
|
||||
} else
|
||||
draw_sprite_ui_uniform(THEME.junc_visible, vis, _bx, _cy + lh / 2, 1, COLORS._main_icon, 0.5 + 0.5 * vis);
|
||||
|
||||
_bx += 24 + 8;
|
||||
if(point_in_circle(_m[0], _m[1], _bx, _cy + lh / 2, 12)) {
|
||||
draw_sprite_ui_uniform(THEME.cursor_select, sel, _bx, _cy + lh / 2, 1, c_white);
|
||||
|
||||
if(mouse_press(mb_left, _focus))
|
||||
hold_select = !_sel[index];
|
||||
|
||||
if(mouse_click(mb_left, _focus) && _sel[index] != hold_select)
|
||||
_sel[@ index] = hold_select;
|
||||
} else
|
||||
draw_sprite_ui_uniform(THEME.cursor_select, sel, _bx, _cy + lh / 2, 1, COLORS._main_icon, 0.5 + 0.5 * sel);
|
||||
|
||||
draw_set_color(COLORS.node_composite_bg);
|
||||
var _sx0 = _bx + 24;
|
||||
var _sx1 = _sx0 + ssh;
|
||||
var _sy0 = _cy + 3;
|
||||
var _sy1 = _sy0 + ssh;
|
||||
draw_rectangle(_sx0, _sy0, _sx1, _sy1, true);
|
||||
|
||||
var _ssw = surface_get_width(_surf);
|
||||
var _ssh = surface_get_height(_surf);
|
||||
var _sss = min(ssh / _ssw, ssh / _ssh);
|
||||
draw_surface_ext_safe(_surf, _sx0, _sy0, _sss, _sss, 0, c_white, 1);
|
||||
|
||||
draw_set_text(f_p1, fa_left, fa_center, hover? COLORS._main_text : COLORS._main_text);
|
||||
draw_set_alpha(aa);
|
||||
draw_text(_sx1 + 12, _cy + lh / 2, inputs[| i].name);
|
||||
draw_set_alpha(1);
|
||||
|
||||
if(_hover && point_in_rectangle(_m[0], _m[1], _x, _cy, _x + _w, _cy + lh)) {
|
||||
hoverIndex = index;
|
||||
if(layer_dragging != noone) {
|
||||
draw_set_color(COLORS._main_accent);
|
||||
if(layer_dragging > index)
|
||||
draw_line_width(_x + 16, _cy + lh + 2, _x + _w - 16, _cy + lh + 2, 2);
|
||||
else if(layer_dragging < index)
|
||||
draw_line_width(_x + 16, _cy - 2, _x + _w - 16, _cy - 2, 2);
|
||||
}
|
||||
}
|
||||
|
||||
var binded = inputs[| i].extra_data.bone_id != "";
|
||||
|
||||
if(layer_dragging == noone || layer_dragging == index) {
|
||||
var _bx = _x + 24;
|
||||
if(point_in_circle(_m[0], _m[1], _bx, _cy + lh / 2, 16)) {
|
||||
draw_sprite_ui_uniform(THEME.hamburger_s, 3, _bx, _cy + lh / 2, 1, c_white);
|
||||
|
||||
if(mouse_press(mb_left, _focus))
|
||||
layer_dragging = index;
|
||||
} else {
|
||||
if(!binded) {
|
||||
var cc = merge_color(COLORS._main_icon, COLORS._main_accent, 0.5 + 0.5 * (sin(current_time / 100) * 0.5 + 0.5));
|
||||
draw_sprite_ui_uniform(THEME.hamburger_s, 3, _bx, _cy + lh / 2, 1, cc);
|
||||
} else
|
||||
draw_sprite_ui_uniform(THEME.hamburger_s, 3, _bx, _cy + lh / 2, 1, COLORS._main_icon);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
if(layer_dragging != noone && mouse_release(mb_left)) {
|
||||
if(layer_dragging != hoverIndex && hoverIndex != noone) {
|
||||
var index = input_fix_len + layer_dragging * data_length;
|
||||
var targt = input_fix_len + hoverIndex * data_length;
|
||||
var _vis = attributes.layer_visible;
|
||||
var _sel = attributes.layer_selectable;
|
||||
|
||||
var ext = [];
|
||||
var vis = _vis[layer_dragging];
|
||||
array_delete(_vis, layer_dragging, 1);
|
||||
array_insert(_vis, hoverIndex, vis);
|
||||
|
||||
var sel = _sel[layer_dragging];
|
||||
array_delete(_sel, layer_dragging, 1);
|
||||
array_insert(_sel, hoverIndex, sel);
|
||||
|
||||
for( var i = 0; i < data_length; i++ ) {
|
||||
ext[i] = inputs[| index];
|
||||
ds_list_delete(inputs, index);
|
||||
}
|
||||
|
||||
for( var i = 0; i < data_length; i++ ) {
|
||||
ds_list_insert(inputs, targt + i, ext[i]);
|
||||
}
|
||||
|
||||
doUpdate();
|
||||
}
|
||||
|
||||
layer_dragging = noone;
|
||||
}
|
||||
|
||||
layer_renderer.h = bh + ui(40) + sh;
|
||||
return layer_renderer.h;
|
||||
#endregion
|
||||
});
|
||||
|
||||
input_display_list = [ 1, 2,
|
||||
["Output", true], 0,
|
||||
["Armature", false], 3, 4, layer_renderer,
|
||||
["Surfaces", true],
|
||||
];
|
||||
input_display_list_len = array_length(input_display_list);
|
||||
|
||||
function deleteLayer(index) { #region
|
||||
var idx = input_fix_len + index * data_length;
|
||||
for( var i = 0; i < data_length; i++ ) {
|
||||
ds_list_delete(inputs, idx);
|
||||
array_remove(input_display_list, idx + i);
|
||||
}
|
||||
|
||||
for( var i = input_display_list_len; i < array_length(input_display_list); i++ ) {
|
||||
if(input_display_list[i] > idx)
|
||||
input_display_list[i] = input_display_list[i] - data_length;
|
||||
}
|
||||
|
||||
if(ds_list_size(inputs) == input_fix_len)
|
||||
createNewInput();
|
||||
doUpdate();
|
||||
#endregion
|
||||
}
|
||||
|
||||
static createNewInput = function() { #region
|
||||
var index = ds_list_size(inputs);
|
||||
var _s = floor((index - input_fix_len) / data_length);
|
||||
|
||||
inputs[| index + 0] = nodeValue("Surface", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
|
||||
inputs[| index + 0].surface_index = index;
|
||||
inputs[| index + 0].hover_effect = 0;
|
||||
inputs[| index + 0].extra_data.bone_id = "";
|
||||
|
||||
inputs[| index + 1] = nodeValue("Transform", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0, 1, 1 ] )
|
||||
.setDisplay(VALUE_DISPLAY.transform);
|
||||
inputs[| index + 2] = nodeValue("Inherit Rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true );
|
||||
inputs[| index + 3] = nodeValue("Apply Rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true );
|
||||
inputs[| index + 4] = nodeValue("Inherit Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false );
|
||||
|
||||
for( var i = 0; i < data_length; i++ )
|
||||
array_push(input_display_list, index + i);
|
||||
|
||||
while(_s >= array_length(attributes.layer_visible))
|
||||
array_push(attributes.layer_visible, true);
|
||||
while(_s >= array_length(attributes.layer_selectable))
|
||||
array_push(attributes.layer_selectable, true);
|
||||
#endregion
|
||||
}
|
||||
|
||||
setIsDynamicInput(5);
|
||||
|
||||
if(!LOADING && !APPENDING) createNewInput();
|
||||
|
||||
temp_surface = [ surface_create(1, 1), surface_create(1, 1) ];
|
||||
|
||||
surf_dragging = -1;
|
||||
drag_type = 0;
|
||||
dragging_sx = 0;
|
||||
dragging_sy = 0;
|
||||
dragging_mx = 0;
|
||||
dragging_my = 0;
|
||||
|
||||
rot_anc_x = 0;
|
||||
rot_anc_y = 0;
|
||||
|
||||
overlay_w = 0;
|
||||
overlay_h = 0;
|
||||
|
||||
atlas_data = [];
|
||||
bind_data = [];
|
||||
|
||||
bone = noone;
|
||||
surface_selecting = noone;
|
||||
|
||||
static getInputAmount = function() {
|
||||
return input_fix_len + (ds_list_size(inputs) - input_fix_len) / data_length;
|
||||
}
|
||||
|
||||
static getInputIndex = function(index) {
|
||||
if(index < input_fix_len) return index;
|
||||
return input_fix_len + (index - input_fix_len) * data_length;
|
||||
}
|
||||
|
||||
static setHeight = function() {
|
||||
var _hi = ui(32);
|
||||
var _ho = ui(32);
|
||||
|
||||
for( var i = 0; i < getInputAmount(); i++ )
|
||||
if(inputs[| getInputIndex(i)].isVisible())
|
||||
_hi += 24;
|
||||
|
||||
for( var i = 0; i < ds_list_size(outputs); i++ )
|
||||
if(outputs[| i].isVisible())
|
||||
_ho += 24;
|
||||
|
||||
h = max(min_h, (preview_surface && previewable)? 128 : 0, _hi, _ho);
|
||||
}
|
||||
|
||||
static onValueFromUpdate = function(index) { #region
|
||||
if(LOADING || APPENDING) return;
|
||||
|
||||
if(index + data_length >= ds_list_size(inputs))
|
||||
createNewInput();
|
||||
#endregion
|
||||
}
|
||||
|
||||
static setBone = function() { #region
|
||||
ds_map_clear(boneMap);
|
||||
|
||||
var _b = inputs[| 1].getValue();
|
||||
bone = _b;
|
||||
if(bone == noone) return;
|
||||
|
||||
var _bst = ds_stack_create();
|
||||
ds_stack_push(_bst, bone);
|
||||
|
||||
while(!ds_stack_empty(_bst)) {
|
||||
var _bone = ds_stack_pop(_bst);
|
||||
|
||||
for( var i = 0, n = array_length(_bone.childs); i < n; i++ ) {
|
||||
var child_bone = _bone.childs[i];
|
||||
boneMap[? child_bone.ID] = child_bone;
|
||||
ds_stack_push(_bst, child_bone);
|
||||
}
|
||||
}
|
||||
|
||||
ds_stack_destroy(_bst);
|
||||
#endregion
|
||||
}
|
||||
|
||||
static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { #region
|
||||
var dim = inputs[| 0].getValue();
|
||||
var _bind = inputs[| 2].getValue();
|
||||
|
||||
var _dpos = inputs[| 3].getValue();
|
||||
var _dsca = inputs[| 4].getValue();
|
||||
|
||||
if(bone == noone) return;
|
||||
|
||||
bone.draw(attributes, false, _x + _dpos[0] * _s, _y + _dpos[1] * _s, _s * _dsca, _mx, _my, anchor_selecting);
|
||||
inputs[| 3].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny);
|
||||
//inputs[| 4].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny);
|
||||
|
||||
var mx = (_mx - _x) / _s;
|
||||
var my = (_my - _y) / _s;
|
||||
|
||||
var smx = value_snap(mx, _snx);
|
||||
var smy = value_snap(my, _sny);
|
||||
|
||||
if(_bind != noone)
|
||||
return;
|
||||
|
||||
var ww = dim[0];
|
||||
var hh = dim[1];
|
||||
|
||||
var x0 = _x;
|
||||
var x1 = _x + ww * _s;
|
||||
var y0 = _y;
|
||||
var y1 = _y + hh * _s;
|
||||
|
||||
if(surf_dragging > -1) {
|
||||
var _surf = current_data[surf_dragging + 0];
|
||||
var _tran = current_data[surf_dragging + 1];
|
||||
var _aang = current_data[surf_dragging + 2];
|
||||
var _pang = current_data[surf_dragging + 3];
|
||||
var _asca = current_data[surf_dragging + 4];
|
||||
|
||||
var _bone = inputs[| surf_dragging].extra_data.bone_id;
|
||||
_bone = boneMap[? _bone];
|
||||
|
||||
if(drag_type == NODE_COMPOSE_DRAG.move) {
|
||||
var _dx = smx - dragging_mx;
|
||||
var _dy = smy - dragging_my;
|
||||
|
||||
var _p = point_rotate(_dx, _dy, 0, 0, -_bone.angle);
|
||||
|
||||
var pos_x = dragging_sx + _p[0];
|
||||
var pos_y = dragging_sy + _p[1];
|
||||
|
||||
_tran[TRANSFORM.pos_x] = pos_x;
|
||||
_tran[TRANSFORM.pos_y] = pos_y;
|
||||
} else if(drag_type == NODE_COMPOSE_DRAG.rotate) {
|
||||
var aa = point_direction(rot_anc_x, rot_anc_y, _mx, _my);
|
||||
var da = angle_difference(dragging_mx, aa);
|
||||
var sa;
|
||||
|
||||
if(key_mod_press(CTRL))
|
||||
sa = round((dragging_sx - da) / 15) * 15;
|
||||
else
|
||||
sa = dragging_sx - da;
|
||||
|
||||
_tran[TRANSFORM.rot] = sa;
|
||||
} else if(drag_type == NODE_COMPOSE_DRAG.scale) {
|
||||
var _rot = _aang * (_pang? _bone.angle : _bone.pose_local_angle) + _tran[TRANSFORM.rot];
|
||||
var _sw = surface_get_width(_surf);
|
||||
var _sh = surface_get_height(_surf);
|
||||
|
||||
var _p = point_rotate(_mx - dragging_mx, _my - dragging_my, 0, 0, -_rot);
|
||||
var sca_x = _p[0] / _s / _sw * 2;
|
||||
var sca_y = _p[1] / _s / _sh * 2;
|
||||
|
||||
if(key_mod_press(SHIFT)) {
|
||||
sca_x = min(sca_x, sca_y);
|
||||
sca_y = sca_x;
|
||||
}
|
||||
|
||||
if(_asca) {
|
||||
sca_x /= _bone.pose_scale;
|
||||
sca_y /= _bone.pose_scale;
|
||||
}
|
||||
|
||||
_tran[TRANSFORM.sca_x] = sca_x;
|
||||
_tran[TRANSFORM.sca_y] = sca_y;
|
||||
}
|
||||
|
||||
if(inputs[| surf_dragging + 1].setValue(_tran))
|
||||
UNDO_HOLDING = true;
|
||||
|
||||
if(mouse_release(mb_left)) {
|
||||
surf_dragging = -1;
|
||||
UNDO_HOLDING = false;
|
||||
}
|
||||
}
|
||||
|
||||
var hovering = noone;
|
||||
var hovering_type = noone;
|
||||
var _vis = attributes.layer_visible;
|
||||
var _sel = attributes.layer_selectable;
|
||||
|
||||
var amo = (ds_list_size(inputs) - input_fix_len) / data_length;
|
||||
var anchors = array_create(ds_list_size(inputs));
|
||||
|
||||
for(var i = 0; i < amo; i++) {
|
||||
var index = input_fix_len + i * data_length;
|
||||
var _surf = array_safe_get(current_data, index);
|
||||
if(!_surf || is_array(_surf)) continue;
|
||||
|
||||
var _bone = inputs[| index].extra_data.bone_id;
|
||||
if(!ds_map_exists(boneMap, _bone)) {
|
||||
//print($"Bone not found {_bone}");
|
||||
continue;
|
||||
}
|
||||
_bone = boneMap[? _bone];
|
||||
|
||||
var _tran = current_data[index + 1];
|
||||
var _aang = current_data[index + 2];
|
||||
var _pang = current_data[index + 3];
|
||||
var _asca = current_data[index + 4];
|
||||
|
||||
var _rot = _aang * (_pang? _bone.angle : _bone.pose_local_angle) + _tran[TRANSFORM.rot];
|
||||
var _anc = _bone.getPoint(0.5);
|
||||
var _mov = point_rotate(_tran[TRANSFORM.pos_x], _tran[TRANSFORM.pos_y], 0, 0, _bone.angle);
|
||||
var _sca = [ _tran[TRANSFORM.sca_x], _tran[TRANSFORM.sca_y] ];
|
||||
if(_asca) {
|
||||
_sca[0] *= _bone.pose_scale;
|
||||
_sca[1] *= _bone.pose_scale;
|
||||
}
|
||||
|
||||
var _ww = surface_get_width(_surf);
|
||||
var _hh = surface_get_height(_surf);
|
||||
var _sw = _ww * _sca[0];
|
||||
var _sh = _hh * _sca[1];
|
||||
|
||||
var _cx = (_anc.x * _dsca) + _mov[0] + _dpos[0];
|
||||
var _cy = (_anc.y * _dsca) + _mov[1] + _dpos[1];
|
||||
|
||||
var _d0 = point_rotate(_cx - _sw / 2, _cy - _sh / 2, _cx, _cy, _rot);
|
||||
var _d1 = point_rotate(_cx - _sw / 2, _cy + _sh / 2, _cx, _cy, _rot);
|
||||
var _d2 = point_rotate(_cx + _sw / 2, _cy - _sh / 2, _cx, _cy, _rot);
|
||||
var _d3 = point_rotate(_cx + _sw / 2, _cy + _sh / 2, _cx, _cy, _rot);
|
||||
var _rr = point_rotate(_cx, _cy - _sh / 2 - 4, _cx, _cy, _rot);
|
||||
|
||||
_d0[0] = overlay_x(_d0[0], _x, _s); _d0[1] = overlay_y(_d0[1], _y, _s);
|
||||
_d1[0] = overlay_x(_d1[0], _x, _s); _d1[1] = overlay_y(_d1[1], _y, _s);
|
||||
_d2[0] = overlay_x(_d2[0], _x, _s); _d2[1] = overlay_y(_d2[1], _y, _s);
|
||||
_d3[0] = overlay_x(_d3[0], _x, _s); _d3[1] = overlay_y(_d3[1], _y, _s);
|
||||
_rr[0] = overlay_x(_rr[0], _x, _s); _rr[1] = overlay_y(_rr[1], _y, _s);
|
||||
|
||||
anchors[index] = {
|
||||
cx: _cx,
|
||||
cy: _cy,
|
||||
d0: _d0,
|
||||
d1: _d1,
|
||||
d2: _d2,
|
||||
d3: _d3,
|
||||
rr: _rr,
|
||||
|
||||
rot: _rot,
|
||||
}
|
||||
}
|
||||
|
||||
for(var i = 0; i < amo; i++) {
|
||||
var vis = array_safe_get(_vis, i);
|
||||
var sel = array_safe_get(_sel, i);
|
||||
if(!vis) continue;
|
||||
if(!sel) continue;
|
||||
|
||||
var index = input_fix_len + i * data_length;
|
||||
var _surf = array_safe_get(current_data, index);
|
||||
if(!_surf || is_array(_surf)) continue;
|
||||
|
||||
var _bone = inputs[| index].extra_data.bone_id;
|
||||
if(!ds_map_exists(boneMap, _bone))
|
||||
continue;
|
||||
|
||||
var a = anchors[index];
|
||||
|
||||
if(surface_selecting == index) {
|
||||
var _ri = 0;
|
||||
var _si = 0;
|
||||
|
||||
if(point_in_circle(_mx, _my, a.d3[0], a.d3[1], 12)) {
|
||||
hovering = index;
|
||||
hovering_type = NODE_COMPOSE_DRAG.scale;
|
||||
_si = 1;
|
||||
} else if(point_in_rectangle_points(_mx, _my, a.d0[0], a.d0[1], a.d1[0], a.d1[1], a.d2[0], a.d2[1], a.d3[0], a.d3[1])) {
|
||||
hovering = index;
|
||||
hovering_type = NODE_COMPOSE_DRAG.move;
|
||||
} else if(point_in_circle(_mx, _my, a.rr[0], a.rr[1], 12)) {
|
||||
hovering = index;
|
||||
hovering_type = NODE_COMPOSE_DRAG.rotate;
|
||||
_ri = 1;
|
||||
}
|
||||
|
||||
draw_sprite_colored(THEME.anchor_rotate, _ri, a.rr[0], a.rr[1],, a.rot);
|
||||
draw_sprite_colored(THEME.anchor_scale, _si, a.d3[0], a.d3[1],, a.rot);
|
||||
} else if(point_in_rectangle_points(_mx, _my, a.d0[0], a.d0[1], a.d1[0], a.d1[1], a.d2[0], a.d2[1], a.d3[0], a.d3[1]) &&
|
||||
(surface_selecting != hovering || surface_selecting == noone)) {
|
||||
|
||||
hovering = index;
|
||||
hovering_type = NODE_COMPOSE_DRAG.move;
|
||||
}
|
||||
}
|
||||
|
||||
if(mouse_press(mb_left, active))
|
||||
surface_selecting = hovering;
|
||||
|
||||
if(hovering != noone) {
|
||||
var a = anchors[hovering];
|
||||
|
||||
draw_set_color(COLORS.node_composite_overlay_border);
|
||||
draw_line(a.d0[0], a.d0[1], a.d1[0], a.d1[1]);
|
||||
draw_line(a.d0[0], a.d0[1], a.d2[0], a.d2[1]);
|
||||
draw_line(a.d3[0], a.d3[1], a.d1[0], a.d1[1]);
|
||||
draw_line(a.d3[0], a.d3[1], a.d2[0], a.d2[1]);
|
||||
}
|
||||
|
||||
if(surface_selecting != noone) {
|
||||
var a = anchors[surface_selecting];
|
||||
|
||||
draw_set_color(COLORS._main_accent);
|
||||
draw_line(a.d0[0], a.d0[1], a.d1[0], a.d1[1]);
|
||||
draw_line(a.d0[0], a.d0[1], a.d2[0], a.d2[1]);
|
||||
draw_line(a.d3[0], a.d3[1], a.d1[0], a.d1[1]);
|
||||
draw_line(a.d3[0], a.d3[1], a.d2[0], a.d2[1]);
|
||||
}
|
||||
|
||||
if(hovering != noone && hovering_type != noone && mouse_press(mb_left, active)) {
|
||||
var _tran = current_data[hovering + 1];
|
||||
var _aang = current_data[hovering + 2];
|
||||
var _asca = current_data[hovering + 3];
|
||||
|
||||
var a = anchors[hovering];
|
||||
|
||||
if(hovering_type == NODE_COMPOSE_DRAG.move) { //move
|
||||
surf_dragging = hovering;
|
||||
drag_type = hovering_type;
|
||||
dragging_sx = _tran[TRANSFORM.pos_x];
|
||||
dragging_sy = _tran[TRANSFORM.pos_y];
|
||||
dragging_mx = mx;
|
||||
dragging_my = my;
|
||||
} else if(hovering_type == NODE_COMPOSE_DRAG.rotate) { //rot
|
||||
surf_dragging = hovering;
|
||||
drag_type = hovering_type;
|
||||
dragging_sx = _tran[TRANSFORM.rot];
|
||||
rot_anc_x = overlay_x(a.cx, _x, _s);
|
||||
rot_anc_y = overlay_y(a.cy, _y, _s);
|
||||
dragging_mx = point_direction(rot_anc_x, rot_anc_y, _mx, _my);
|
||||
} else if(hovering_type == NODE_COMPOSE_DRAG.scale) { //sca
|
||||
surf_dragging = hovering;
|
||||
drag_type = hovering_type;
|
||||
dragging_mx = (a.d0[0] + a.d3[0]) / 2;
|
||||
dragging_my = (a.d0[1] + a.d3[1]) / 2;
|
||||
}
|
||||
}
|
||||
|
||||
if(layer_remove > -1) {
|
||||
deleteLayer(layer_remove);
|
||||
layer_remove = -1;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
static step = function() {
|
||||
var _dim_type = getSingleValue(1);
|
||||
inputs[| 2].setVisible(_dim_type == COMPOSE_OUTPUT_SCALING.constant);
|
||||
}
|
||||
|
||||
static process_data = function(_outSurf, _data, _output_index, _array_index) {
|
||||
if(_output_index == 1) return atlas_data;
|
||||
if(_output_index == 2) return bind_data;
|
||||
if(_output_index == 0 && _array_index == 0) {
|
||||
atlas_data = [];
|
||||
bind_data = [];
|
||||
}
|
||||
|
||||
var _dim = _data[0];
|
||||
var _bone = _data[1];
|
||||
var _bind = _data[2];
|
||||
|
||||
var _dpos = _data[3];
|
||||
var _dsca = _data[4];
|
||||
var cDep = attrDepth();
|
||||
|
||||
setBone();
|
||||
|
||||
//////////////////////////////////////////
|
||||
|
||||
overlay_w = _dim[0];
|
||||
overlay_h = _dim[1];
|
||||
|
||||
_outSurf = surface_verify(_outSurf, _dim[0], _dim[1], cDep);
|
||||
|
||||
for(var i = 0; i < 2; i++) {
|
||||
temp_surface[i] = surface_verify(temp_surface[i], surface_get_width(_outSurf), surface_get_height(_outSurf), cDep);
|
||||
|
||||
surface_set_target(temp_surface[i]);
|
||||
DRAW_CLEAR
|
||||
surface_reset_target();
|
||||
}
|
||||
|
||||
var use_data = _bind != noone;
|
||||
var res_index = 0;
|
||||
var bg = 0;
|
||||
var imageAmo = use_data? array_length(_bind) : (ds_list_size(inputs) - input_fix_len) / data_length;
|
||||
var _vis = attributes.layer_visible;
|
||||
|
||||
surface_set_shader(_outSurf, sh_sample, true, BLEND.alphamulp);
|
||||
|
||||
for(var i = 0; i < imageAmo; i++) {
|
||||
var vis = array_safe_get(_vis, i, true);
|
||||
if(!vis) continue;
|
||||
|
||||
var datInd = input_fix_len + i * data_length;
|
||||
var _s = use_data? _bind[i].surface.get() : _data[datInd];
|
||||
if(!is_surface(_s)) continue;
|
||||
|
||||
var _b = use_data? _bind[i].bone : inputs[| datInd].extra_data.bone_id;
|
||||
|
||||
if(!ds_map_exists(boneMap, _b)) {
|
||||
//print($"Bone not exist {_bone} from map {ds_map_size(boneMap)}")
|
||||
continue;
|
||||
}
|
||||
_b = boneMap[? _b];
|
||||
|
||||
var _tran = use_data? _bind[i].transform : _data[datInd + 1];
|
||||
var _aang = _data[datInd + 2];
|
||||
var _pang = _data[datInd + 3];
|
||||
var _asca = _data[datInd + 4];
|
||||
|
||||
var _rot = _aang * (_pang? _b.angle : _b.pose_local_angle) + _tran[TRANSFORM.rot];
|
||||
var _anc = _b.getPoint(0.5);
|
||||
var _mov = point_rotate(_tran[TRANSFORM.pos_x], _tran[TRANSFORM.pos_y], 0, 0, _b.angle);
|
||||
var _sca = [ _tran[TRANSFORM.sca_x], _tran[TRANSFORM.sca_y] ];
|
||||
if(_asca) {
|
||||
_sca[0] *= _b.pose_scale;
|
||||
_sca[1] *= _b.pose_scale;
|
||||
}
|
||||
|
||||
var _ww = surface_get_width(_s);
|
||||
var _hh = surface_get_height(_s);
|
||||
var _sw = _ww * _sca[0];
|
||||
var _sh = _hh * _sca[1];
|
||||
|
||||
var _cen = point_rotate(-_sw / 2, -_sh / 2, 0, 0, _rot);
|
||||
var _pos = [
|
||||
(_anc.x * _dsca) + _cen[0] + _mov[0] + _dpos[0],
|
||||
(_anc.y * _dsca) + _cen[1] + _mov[1] + _dpos[1]
|
||||
];
|
||||
|
||||
shader_set_interpolation(_s);
|
||||
|
||||
array_push(atlas_data, new SurfaceAtlas(_s, _pos, _rot, _sca));
|
||||
array_push(bind_data, {
|
||||
surface: new Surface(_s),
|
||||
bone: _b.ID,
|
||||
transform: _tran
|
||||
});
|
||||
draw_surface_ext_safe(_s, _pos[0], _pos[1], _sca[0], _sca[1], _rot);
|
||||
}
|
||||
|
||||
surface_reset_shader();
|
||||
|
||||
return _outSurf;
|
||||
}
|
||||
|
||||
static resetTransform = function(surfIndex) {
|
||||
var _bind = inputs[| 2].getValue();
|
||||
var use_data = _bind != noone;
|
||||
|
||||
var _surf = inputs[| surfIndex + 0].getValue();
|
||||
var _tran = inputs[| surfIndex + 1].getValue();
|
||||
var _arot = inputs[| surfIndex + 2].getValue();
|
||||
|
||||
var _b = use_data? _bind[i].bone : inputs[| surfIndex].extra_data.bone_id;
|
||||
if(!ds_map_exists(boneMap, _b)) return;
|
||||
|
||||
_b = boneMap[? _b];
|
||||
|
||||
var _cx = surface_get_width(_surf) / 2;
|
||||
var _cy = surface_get_height(_surf) / 2;
|
||||
|
||||
var _anc = _b.getPoint(0.5);
|
||||
var _rot = _arot? -_b.angle : 0;
|
||||
|
||||
var _tr = [ _cx - _anc.x, _cy - _anc.y, _rot, 1, 1 ];
|
||||
inputs[| surfIndex + 1].setValue(_tr);
|
||||
}
|
||||
|
||||
//static postDeserialize = function() {
|
||||
// var _inputs = load_map.inputs;
|
||||
|
||||
// var load_fix_len = input_fix_len;
|
||||
// var amo = (array_length(_inputs) - load_fix_len) / data_length;
|
||||
|
||||
// if(PROJECT.version < 11481) {
|
||||
// var _idx = [];
|
||||
// for( var i = load_fix_len, n = array_length(_inputs); i < n; i += 2 ) {
|
||||
// array_append(_idx, i + 3);
|
||||
// array_append(_idx, i + 4);
|
||||
// }
|
||||
|
||||
// for( var i = array_length(_idx) - 1; i >= 0; i++ )
|
||||
// array_insert(load_map.inputs, _idx[i], noone);
|
||||
// }
|
||||
|
||||
// if(PROJECT.version < 11470) {
|
||||
// array_insert(load_map.inputs, 3, noone);
|
||||
// array_insert(load_map.inputs, 4, noone);
|
||||
// load_fix_len = 3;
|
||||
// }
|
||||
|
||||
// repeat(amo) createNewInput();
|
||||
//}
|
||||
|
||||
static attributeSerialize = function() {
|
||||
var att = {};
|
||||
att.layer_visible = attributes.layer_visible;
|
||||
att.layer_selectable = attributes.layer_selectable;
|
||||
|
||||
return att;
|
||||
}
|
||||
|
||||
static attributeDeserialize = function(attr) {
|
||||
if(struct_has(attr, "layer_visible"))
|
||||
attributes.layer_visible = attr.layer_visible;
|
||||
|
||||
if(struct_has(attr, "layer_selectable"))
|
||||
attributes.layer_selectable = attr.layer_selectable;
|
||||
}
|
||||
|
||||
static doApplyDeserialize = function() {
|
||||
setBone();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,924 @@
|
|||
// 2023-08-08 14:23:48
|
||||
function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
|
||||
name = "Armature Bind";
|
||||
|
||||
inputs[| 0] = nodeValue("Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, DEF_SURF)
|
||||
.setDisplay(VALUE_DISPLAY.vector);
|
||||
|
||||
inputs[| 1] = nodeValue("Armature", self, JUNCTION_CONNECT.input, VALUE_TYPE.armature, noone)
|
||||
.setVisible(true, true)
|
||||
.rejectArray();
|
||||
|
||||
inputs[| 2] = nodeValue("Bind data", self, JUNCTION_CONNECT.input, VALUE_TYPE.struct, noone)
|
||||
.setVisible(true, true)
|
||||
.setArrayDepth(1);
|
||||
|
||||
inputs[| 3] = nodeValue("Bone transform", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ])
|
||||
.setDisplay(VALUE_DISPLAY.vector);
|
||||
|
||||
inputs[| 4] = nodeValue("Bone scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1)
|
||||
.setDisplay(VALUE_DISPLAY.slider, [ 0.1, 2, 0.01 ]);
|
||||
|
||||
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
|
||||
|
||||
outputs[| 1] = nodeValue("Atlas data", self, JUNCTION_CONNECT.output, VALUE_TYPE.atlas, [])
|
||||
.rejectArrayProcess();
|
||||
|
||||
outputs[| 2] = nodeValue("Bind data", self, JUNCTION_CONNECT.output, VALUE_TYPE.struct, [])
|
||||
.setArrayDepth(1);
|
||||
|
||||
attribute_surface_depth();
|
||||
attribute_interpolation();
|
||||
|
||||
attributes.layer_visible = [];
|
||||
attributes.layer_selectable = [];
|
||||
|
||||
attributes.display_name = true;
|
||||
attributes.display_bone = 0;
|
||||
|
||||
anchor_selecting = noone;
|
||||
|
||||
array_push(attributeEditors, "Display");
|
||||
array_push(attributeEditors, ["Display name", function() { return attributes.display_name; },
|
||||
new checkBox(function() {
|
||||
attributes.display_name = !attributes.display_name;
|
||||
})]);
|
||||
array_push(attributeEditors, ["Display bone", function() { return attributes.display_bone; },
|
||||
new scrollBox(["Octahedral", "Stick"], function(ind) {
|
||||
attributes.display_bone = ind;
|
||||
})]);
|
||||
|
||||
boneMap = ds_map_create();
|
||||
surfMap = ds_map_create();
|
||||
|
||||
hold_visibility = true;
|
||||
hold_select = true;
|
||||
layer_dragging = noone;
|
||||
layer_remove = -1;
|
||||
|
||||
layer_renderer = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus) { #region
|
||||
ds_map_clear(surfMap);
|
||||
|
||||
var index = -1;
|
||||
for(var i = input_fix_len; i < ds_list_size(inputs) - data_length; i += data_length) {
|
||||
index++;
|
||||
var _surf = current_data[i];
|
||||
var _id = inputs[| i].extra_data.bone_id;
|
||||
if(_id == "") continue;
|
||||
|
||||
if(ds_map_exists(surfMap, _id))
|
||||
array_push(surfMap[? _id], [ index, _surf ]);
|
||||
else
|
||||
surfMap[? _id] = [ [ index, _surf ] ];
|
||||
|
||||
//print($"Add {_surf} to {_id}");
|
||||
}
|
||||
|
||||
#region draw bones
|
||||
var _b = bone;
|
||||
if(_b == noone) return 0;
|
||||
var amo = _b.childCount();
|
||||
var _hh = ui(28);
|
||||
var bh = ui(32 + 16) + amo * _hh;
|
||||
var ty = _y;
|
||||
|
||||
draw_set_text(f_p0, fa_left, fa_top, COLORS._main_text);
|
||||
draw_text_add(_x + ui(16), ty + ui(4), "Bones");
|
||||
|
||||
ty += ui(32);
|
||||
|
||||
var _ty = ty;
|
||||
draw_sprite_stretched_ext(THEME.ui_panel_bg, 1, _x, ty, _w, bh - ui(32), COLORS.node_composite_bg_blend, 1);
|
||||
|
||||
draw_set_color(COLORS.node_composite_separator);
|
||||
draw_line(_x + 16, ty + ui(8), _x + _w - 16, ty + ui(8));
|
||||
|
||||
ty += ui(8);
|
||||
|
||||
var hovering = noone;
|
||||
var _bst = ds_stack_create();
|
||||
ds_stack_push(_bst, [ _b, _x, _w ]);
|
||||
|
||||
anchor_selecting = noone;
|
||||
|
||||
while(!ds_stack_empty(_bst)) {
|
||||
var _st = ds_stack_pop(_bst);
|
||||
var _bone = _st[0];
|
||||
var __x = _st[1];
|
||||
var __w = _st[2];
|
||||
|
||||
for( var i = 0, n = array_length(_bone.childs); i < n; i++ )
|
||||
ds_stack_push(_bst, [ _bone.childs[i], __x + 16, __w - 16 ]);
|
||||
|
||||
if(_bone.is_main) continue;
|
||||
|
||||
if(_bone.parent_anchor)
|
||||
draw_sprite_ui(THEME.bone, 1, __x + 12, ty + 14,,,, COLORS._main_icon);
|
||||
else if(_bone.IKlength)
|
||||
draw_sprite_ui(THEME.bone, 2, __x + 12, ty + 14,,,, COLORS._main_icon);
|
||||
else
|
||||
draw_sprite_ui(THEME.bone, 0, __x + 12, ty + 14,,,, COLORS._main_icon);
|
||||
|
||||
draw_set_text(f_p2, fa_left, fa_center, COLORS._main_text);
|
||||
draw_text(__x + 24, ty + 12, _bone.name);
|
||||
|
||||
if(ds_map_exists(surfMap, _bone.ID)) {
|
||||
var _sdata = surfMap[? _bone.ID];
|
||||
|
||||
var _sx = __x + 24 + string_width(_bone.name) + 8;
|
||||
var _sy = ty + 4;
|
||||
|
||||
for( var i = 0, n = array_length(_sdata); i < n; i++ ) {
|
||||
var _sid = _sdata[i][0];
|
||||
var _surf = _sdata[i][1];
|
||||
var _sw = surface_get_width(_surf);
|
||||
var _sh = surface_get_height(_surf);
|
||||
var _ss = (_hh - 8) / _sh;
|
||||
|
||||
draw_surface_ext_safe(_surf, _sx, _sy, _ss, _ss, 0, c_white, 1);
|
||||
|
||||
if(_hover && point_in_rectangle(_m[0], _m[1], _sx, _sy, _sx + _sw * _ss, _sy + _sh * _ss)) {
|
||||
TOOLTIP = [ _surf, VALUE_TYPE.surface ];
|
||||
if(mouse_press(mb_left, _focus)) {
|
||||
layer_dragging = _sid;
|
||||
inputs[| input_fix_len + _sid * data_length].extra_data.bone_id = "";
|
||||
}
|
||||
|
||||
draw_set_color(COLORS._main_accent);
|
||||
} else
|
||||
draw_set_color(COLORS.node_composite_bg);
|
||||
draw_rectangle(_sx, _sy, _sx + _sw * _ss, _sy + _sh * _ss, true);
|
||||
|
||||
_sx += _sw * _ss + 4;
|
||||
}
|
||||
}
|
||||
|
||||
if(point_in_rectangle(_m[0], _m[1], _x, ty, _x + _w, ty + _hh - 1)) {
|
||||
if(layer_dragging != noone) {
|
||||
draw_sprite_stretched_ext(THEME.ui_panel_active, 0, _x, ty, _w, _hh, COLORS._main_accent, 1);
|
||||
hovering = _bone;
|
||||
}
|
||||
|
||||
anchor_selecting = [ _bone, 2 ];
|
||||
}
|
||||
|
||||
ty += _hh;
|
||||
|
||||
draw_set_color(COLORS.node_composite_separator);
|
||||
draw_line(_x + 16, ty, _x + _w - 16, ty);
|
||||
}
|
||||
|
||||
ds_stack_destroy(_bst);
|
||||
|
||||
if(layer_dragging != noone && hovering && mouse_release(mb_left)) {
|
||||
var _lind = input_fix_len + layer_dragging * data_length;
|
||||
inputs[| _lind].extra_data.bone_id = hovering.ID;
|
||||
|
||||
layer_dragging = noone;
|
||||
triggerRender();
|
||||
}
|
||||
|
||||
if(layer_dragging != noone && !hovering)
|
||||
draw_sprite_stretched_ext(THEME.ui_panel_active, 0, _x, _ty, _w, bh - ui(32), COLORS._main_accent, 1);
|
||||
#endregion
|
||||
|
||||
var amo = (ds_list_size(inputs) - input_fix_len) / data_length - 1;
|
||||
if(array_length(current_data) != ds_list_size(inputs)) return 0;
|
||||
|
||||
var ty = _y + bh + ui(8);
|
||||
|
||||
//draw_set_color(COLORS.node_composite_separator);
|
||||
//draw_line(_x + 16, ty - ui(4), _x + _w - 16, ty - ui(4));
|
||||
|
||||
draw_set_text(f_p0, fa_left, fa_top, COLORS._main_text);
|
||||
draw_text_add(_x + ui(16), ty + ui(4), "Surfaces");
|
||||
|
||||
ty += ui(32);
|
||||
|
||||
#region draw surface
|
||||
var lh = 32;
|
||||
var sh = 8 + max(1, amo) * (lh + 4) + 8;
|
||||
draw_sprite_stretched_ext(THEME.ui_panel_bg, 1, _x, ty, _w, sh, COLORS.node_composite_bg_blend, 1);
|
||||
|
||||
var _vis = attributes.layer_visible;
|
||||
var _sel = attributes.layer_selectable;
|
||||
var ly = ty + 8;
|
||||
var ssh = lh - 6;
|
||||
var hoverIndex = noone;
|
||||
draw_set_color(COLORS.node_composite_separator);
|
||||
draw_line(_x + 16, ly, _x + _w - 16, ly);
|
||||
|
||||
layer_remove = -1;
|
||||
var index = -1;
|
||||
for(var i = input_fix_len; i < ds_list_size(inputs) - data_length; i += data_length) {
|
||||
var _surf = current_data[i];
|
||||
|
||||
index++;
|
||||
var _bx = _x + _w - 24;
|
||||
var _cy = ly + index * (lh + 4);
|
||||
|
||||
if(point_in_circle(_m[0], _m[1], _bx, _cy + lh / 2, 16)) {
|
||||
draw_sprite_ui_uniform(THEME.icon_delete, 3, _bx, _cy + lh / 2, 1, COLORS._main_value_negative);
|
||||
|
||||
if(mouse_press(mb_left, _focus))
|
||||
layer_remove = index;
|
||||
} else
|
||||
draw_sprite_ui_uniform(THEME.icon_delete, 3, _bx, _cy + lh / 2, 1, COLORS._main_icon);
|
||||
|
||||
_bx -= 32;
|
||||
|
||||
//if(point_in_circle(_m[0], _m[1], _bx, _cy + lh / 2, 16)) {
|
||||
// draw_sprite_ui_uniform(THEME.reset_16, 3, _bx, _cy + lh / 2, 1, COLORS._main_value_negative);
|
||||
|
||||
// if(mouse_press(mb_left, _focus))
|
||||
// resetTransform(i);
|
||||
//} else
|
||||
// draw_sprite_ui_uniform(THEME.reset_16, 3, _bx, _cy + lh / 2, 1, COLORS._main_icon);
|
||||
|
||||
if(!is_surface(_surf)) continue;
|
||||
|
||||
var aa = (index != layer_dragging || layer_dragging == noone)? 1 : 0.5;
|
||||
var vis = _vis[index];
|
||||
var sel = _sel[index];
|
||||
var hover = point_in_rectangle(_m[0], _m[1], _x, _cy, _x + _w, _cy + lh);
|
||||
|
||||
draw_set_color(COLORS.node_composite_separator);
|
||||
draw_line(_x + 16, _cy + lh + 2, _x + _w - 16, _cy + lh + 2);
|
||||
|
||||
var _bx = _x + 24 * 2 + 8;
|
||||
if(point_in_circle(_m[0], _m[1], _bx, _cy + lh / 2, 12)) {
|
||||
draw_sprite_ui_uniform(THEME.junc_visible, vis, _bx, _cy + lh / 2, 1, c_white);
|
||||
|
||||
if(mouse_press(mb_left, _focus))
|
||||
hold_visibility = !_vis[index];
|
||||
|
||||
if(mouse_click(mb_left, _focus) && _vis[index] != hold_visibility) {
|
||||
_vis[@ index] = hold_visibility;
|
||||
doUpdate();
|
||||
}
|
||||
} else
|
||||
draw_sprite_ui_uniform(THEME.junc_visible, vis, _bx, _cy + lh / 2, 1, COLORS._main_icon, 0.5 + 0.5 * vis);
|
||||
|
||||
_bx += 24 + 8;
|
||||
if(point_in_circle(_m[0], _m[1], _bx, _cy + lh / 2, 12)) {
|
||||
draw_sprite_ui_uniform(THEME.cursor_select, sel, _bx, _cy + lh / 2, 1, c_white);
|
||||
|
||||
if(mouse_press(mb_left, _focus))
|
||||
hold_select = !_sel[index];
|
||||
|
||||
if(mouse_click(mb_left, _focus) && _sel[index] != hold_select)
|
||||
_sel[@ index] = hold_select;
|
||||
} else
|
||||
draw_sprite_ui_uniform(THEME.cursor_select, sel, _bx, _cy + lh / 2, 1, COLORS._main_icon, 0.5 + 0.5 * sel);
|
||||
|
||||
draw_set_color(COLORS.node_composite_bg);
|
||||
var _sx0 = _bx + 24;
|
||||
var _sx1 = _sx0 + ssh;
|
||||
var _sy0 = _cy + 3;
|
||||
var _sy1 = _sy0 + ssh;
|
||||
draw_rectangle(_sx0, _sy0, _sx1, _sy1, true);
|
||||
|
||||
var _ssw = surface_get_width(_surf);
|
||||
var _ssh = surface_get_height(_surf);
|
||||
var _sss = min(ssh / _ssw, ssh / _ssh);
|
||||
draw_surface_ext_safe(_surf, _sx0, _sy0, _sss, _sss, 0, c_white, 1);
|
||||
|
||||
draw_set_text(f_p1, fa_left, fa_center, hover? COLORS._main_text : COLORS._main_text);
|
||||
draw_set_alpha(aa);
|
||||
draw_text(_sx1 + 12, _cy + lh / 2, inputs[| i].name);
|
||||
draw_set_alpha(1);
|
||||
|
||||
if(_hover && point_in_rectangle(_m[0], _m[1], _x, _cy, _x + _w, _cy + lh)) {
|
||||
hoverIndex = index;
|
||||
if(layer_dragging != noone) {
|
||||
draw_set_color(COLORS._main_accent);
|
||||
if(layer_dragging > index)
|
||||
draw_line_width(_x + 16, _cy + lh + 2, _x + _w - 16, _cy + lh + 2, 2);
|
||||
else if(layer_dragging < index)
|
||||
draw_line_width(_x + 16, _cy - 2, _x + _w - 16, _cy - 2, 2);
|
||||
}
|
||||
}
|
||||
|
||||
var binded = inputs[| i].extra_data.bone_id != "";
|
||||
|
||||
if(layer_dragging == noone || layer_dragging == index) {
|
||||
var _bx = _x + 24;
|
||||
if(point_in_circle(_m[0], _m[1], _bx, _cy + lh / 2, 16)) {
|
||||
draw_sprite_ui_uniform(THEME.hamburger_s, 3, _bx, _cy + lh / 2, 1, c_white);
|
||||
|
||||
if(mouse_press(mb_left, _focus))
|
||||
layer_dragging = index;
|
||||
} else {
|
||||
if(!binded) {
|
||||
var cc = merge_color(COLORS._main_icon, COLORS._main_accent, 0.5 + 0.5 * (sin(current_time / 100) * 0.5 + 0.5));
|
||||
draw_sprite_ui_uniform(THEME.hamburger_s, 3, _bx, _cy + lh / 2, 1, cc);
|
||||
} else
|
||||
draw_sprite_ui_uniform(THEME.hamburger_s, 3, _bx, _cy + lh / 2, 1, COLORS._main_icon);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
if(layer_dragging != noone && mouse_release(mb_left)) {
|
||||
if(layer_dragging != hoverIndex && hoverIndex != noone) {
|
||||
var index = input_fix_len + layer_dragging * data_length;
|
||||
var targt = input_fix_len + hoverIndex * data_length;
|
||||
var _vis = attributes.layer_visible;
|
||||
var _sel = attributes.layer_selectable;
|
||||
|
||||
var ext = [];
|
||||
var vis = _vis[layer_dragging];
|
||||
array_delete(_vis, layer_dragging, 1);
|
||||
array_insert(_vis, hoverIndex, vis);
|
||||
|
||||
var sel = _sel[layer_dragging];
|
||||
array_delete(_sel, layer_dragging, 1);
|
||||
array_insert(_sel, hoverIndex, sel);
|
||||
|
||||
for( var i = 0; i < data_length; i++ ) {
|
||||
ext[i] = inputs[| index];
|
||||
ds_list_delete(inputs, index);
|
||||
}
|
||||
|
||||
for( var i = 0; i < data_length; i++ ) {
|
||||
ds_list_insert(inputs, targt + i, ext[i]);
|
||||
}
|
||||
|
||||
doUpdate();
|
||||
}
|
||||
|
||||
layer_dragging = noone;
|
||||
}
|
||||
|
||||
layer_renderer.h = bh + ui(40) + sh;
|
||||
return layer_renderer.h;
|
||||
#endregion
|
||||
});
|
||||
|
||||
input_display_list = [ 1, 2,
|
||||
["Output", true], 0,
|
||||
["Armature", false], 3, 4, layer_renderer,
|
||||
["Surfaces", true],
|
||||
];
|
||||
input_display_list_len = array_length(input_display_list);
|
||||
|
||||
function deleteLayer(index) { #region
|
||||
var idx = input_fix_len + index * data_length;
|
||||
for( var i = 0; i < data_length; i++ ) {
|
||||
ds_list_delete(inputs, idx);
|
||||
array_remove(input_display_list, idx + i);
|
||||
}
|
||||
|
||||
for( var i = input_display_list_len; i < array_length(input_display_list); i++ ) {
|
||||
if(input_display_list[i] > idx)
|
||||
input_display_list[i] = input_display_list[i] - data_length;
|
||||
}
|
||||
|
||||
if(ds_list_size(inputs) == input_fix_len)
|
||||
createNewInput();
|
||||
doUpdate();
|
||||
#endregion
|
||||
}
|
||||
|
||||
static createNewInput = function() { #region
|
||||
var index = ds_list_size(inputs);
|
||||
var _s = floor((index - input_fix_len) / data_length);
|
||||
|
||||
inputs[| index + 0] = nodeValue("Surface", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
|
||||
inputs[| index + 0].surface_index = index;
|
||||
inputs[| index + 0].hover_effect = 0;
|
||||
inputs[| index + 0].extra_data.bone_id = "";
|
||||
|
||||
inputs[| index + 1] = nodeValue("Transform", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0, 1, 1 ] )
|
||||
.setDisplay(VALUE_DISPLAY.transform);
|
||||
inputs[| index + 2] = nodeValue("Inherit Rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true );
|
||||
inputs[| index + 3] = nodeValue("Apply Rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true );
|
||||
inputs[| index + 4] = nodeValue("Inherit Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false );
|
||||
|
||||
for( var i = 0; i < data_length; i++ )
|
||||
array_push(input_display_list, index + i);
|
||||
|
||||
while(_s >= array_length(attributes.layer_visible))
|
||||
array_push(attributes.layer_visible, true);
|
||||
while(_s >= array_length(attributes.layer_selectable))
|
||||
array_push(attributes.layer_selectable, true);
|
||||
#endregion
|
||||
}
|
||||
|
||||
setIsDynamicInput(5);
|
||||
|
||||
if(!LOADING && !APPENDING) createNewInput();
|
||||
|
||||
temp_surface = [ surface_create(1, 1), surface_create(1, 1) ];
|
||||
|
||||
surf_dragging = -1;
|
||||
drag_type = 0;
|
||||
dragging_sx = 0;
|
||||
dragging_sy = 0;
|
||||
dragging_mx = 0;
|
||||
dragging_my = 0;
|
||||
|
||||
rot_anc_x = 0;
|
||||
rot_anc_y = 0;
|
||||
|
||||
overlay_w = 0;
|
||||
overlay_h = 0;
|
||||
|
||||
atlas_data = [];
|
||||
bind_data = [];
|
||||
|
||||
bone = noone;
|
||||
surface_selecting = noone;
|
||||
|
||||
static getInputAmount = function() {
|
||||
return input_fix_len + (ds_list_size(inputs) - input_fix_len) / data_length;
|
||||
}
|
||||
|
||||
static getInputIndex = function(index) {
|
||||
if(index < input_fix_len) return index;
|
||||
return input_fix_len + (index - input_fix_len) * data_length;
|
||||
}
|
||||
|
||||
static setHeight = function() {
|
||||
var _hi = ui(32);
|
||||
var _ho = ui(32);
|
||||
|
||||
for( var i = 0; i < getInputAmount(); i++ )
|
||||
if(inputs[| getInputIndex(i)].isVisible())
|
||||
_hi += 24;
|
||||
|
||||
for( var i = 0; i < ds_list_size(outputs); i++ )
|
||||
if(outputs[| i].isVisible())
|
||||
_ho += 24;
|
||||
|
||||
h = max(min_h, (preview_surface && previewable)? 128 : 0, _hi, _ho);
|
||||
}
|
||||
|
||||
static onValueFromUpdate = function(index) { #region
|
||||
if(LOADING || APPENDING) return;
|
||||
|
||||
if(index + data_length >= ds_list_size(inputs))
|
||||
createNewInput();
|
||||
#endregion
|
||||
}
|
||||
|
||||
static setBone = function() { #region
|
||||
ds_map_clear(boneMap);
|
||||
|
||||
var _b = inputs[| 1].getValue();
|
||||
bone = _b;
|
||||
if(bone == noone) return;
|
||||
|
||||
var _bst = ds_stack_create();
|
||||
ds_stack_push(_bst, bone);
|
||||
|
||||
while(!ds_stack_empty(_bst)) {
|
||||
var _bone = ds_stack_pop(_bst);
|
||||
|
||||
for( var i = 0, n = array_length(_bone.childs); i < n; i++ ) {
|
||||
var child_bone = _bone.childs[i];
|
||||
boneMap[? child_bone.ID] = child_bone;
|
||||
ds_stack_push(_bst, child_bone);
|
||||
}
|
||||
}
|
||||
|
||||
ds_stack_destroy(_bst);
|
||||
#endregion
|
||||
}
|
||||
|
||||
static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) { #region
|
||||
var dim = inputs[| 0].getValue();
|
||||
var _bind = inputs[| 2].getValue();
|
||||
|
||||
var _dpos = inputs[| 3].getValue();
|
||||
var _dsca = inputs[| 4].getValue();
|
||||
|
||||
if(bone == noone) return;
|
||||
|
||||
bone.draw(attributes, false, _x + _dpos[0] * _s, _y + _dpos[1] * _s, _s * _dsca, _mx, _my, anchor_selecting);
|
||||
inputs[| 3].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny);
|
||||
//inputs[| 4].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny);
|
||||
|
||||
var mx = (_mx - _x) / _s;
|
||||
var my = (_my - _y) / _s;
|
||||
|
||||
var smx = value_snap(mx, _snx);
|
||||
var smy = value_snap(my, _sny);
|
||||
|
||||
if(_bind != noone)
|
||||
return;
|
||||
|
||||
var ww = dim[0];
|
||||
var hh = dim[1];
|
||||
|
||||
var x0 = _x;
|
||||
var x1 = _x + ww * _s;
|
||||
var y0 = _y;
|
||||
var y1 = _y + hh * _s;
|
||||
|
||||
if(surf_dragging > -1) {
|
||||
var _surf = current_data[surf_dragging];
|
||||
var _tran = current_data[surf_dragging + 1];
|
||||
var _aang = current_data[surf_dragging + 2];
|
||||
var _pang = current_data[surf_dragging + 3];
|
||||
var _asca = current_data[surf_dragging + 4];
|
||||
|
||||
var _bone = inputs[| surf_dragging].extra_data.bone_id;
|
||||
_bone = boneMap[? _bone];
|
||||
|
||||
if(drag_type == NODE_COMPOSE_DRAG.move) {
|
||||
var _dx = smx - dragging_mx;
|
||||
var _dy = smy - dragging_my;
|
||||
|
||||
var _p = point_rotate(_dx, _dy, 0, 0, -_bone.angle);
|
||||
|
||||
var pos_x = dragging_sx + _p[0];
|
||||
var pos_y = dragging_sy + _p[1];
|
||||
|
||||
_tran[TRANSFORM.pos_x] = pos_x;
|
||||
_tran[TRANSFORM.pos_y] = pos_y;
|
||||
} else if(drag_type == NODE_COMPOSE_DRAG.rotate) {
|
||||
var aa = point_direction(rot_anc_x, rot_anc_y, _mx, _my);
|
||||
var da = angle_difference(dragging_mx, aa);
|
||||
var sa;
|
||||
|
||||
if(key_mod_press(CTRL))
|
||||
sa = round((dragging_sx - da) / 15) * 15;
|
||||
else
|
||||
sa = dragging_sx - da;
|
||||
|
||||
_tran[TRANSFORM.rot] = sa;
|
||||
} else if(drag_type == NODE_COMPOSE_DRAG.scale) {
|
||||
var _rot = _aang * (_pang? _bone.angle : _bone.pose_local_angle) + _tran[TRANSFORM.rot];
|
||||
var _sw = surface_get_width(_surf);
|
||||
var _sh = surface_get_height(_surf);
|
||||
|
||||
var _p = point_rotate(_mx - dragging_mx, _my - dragging_my, 0, 0, -_rot);
|
||||
var sca_x = _p[0] / _s / _sw * 2;
|
||||
var sca_y = _p[1] / _s / _sh * 2;
|
||||
|
||||
if(key_mod_press(SHIFT)) {
|
||||
sca_x = min(sca_x, sca_y);
|
||||
sca_y = sca_x;
|
||||
}
|
||||
|
||||
if(_asca) {
|
||||
sca_x /= _bone.pose_scale;
|
||||
sca_y /= _bone.pose_scale;
|
||||
}
|
||||
|
||||
_tran[TRANSFORM.sca_x] = sca_x;
|
||||
_tran[TRANSFORM.sca_y] = sca_y;
|
||||
}
|
||||
|
||||
if(inputs[| surf_dragging + 1].setValue(_tran))
|
||||
UNDO_HOLDING = true;
|
||||
|
||||
if(mouse_release(mb_left)) {
|
||||
surf_dragging = -1;
|
||||
UNDO_HOLDING = false;
|
||||
}
|
||||
}
|
||||
|
||||
var hovering = noone;
|
||||
var hovering_type = noone;
|
||||
var _vis = attributes.layer_visible;
|
||||
var _sel = attributes.layer_selectable;
|
||||
|
||||
var amo = (ds_list_size(inputs) - input_fix_len) / data_length;
|
||||
var anchors = array_create(ds_list_size(inputs));
|
||||
|
||||
for(var i = 0; i < amo; i++) {
|
||||
var index = input_fix_len + i * data_length;
|
||||
var _surf = array_safe_get(current_data, index);
|
||||
if(!_surf || is_array(_surf)) continue;
|
||||
|
||||
var _bone = inputs[| index].extra_data.bone_id;
|
||||
if(!ds_map_exists(boneMap, _bone)) {
|
||||
//print($"Bone not found {_bone}");
|
||||
continue;
|
||||
}
|
||||
_bone = boneMap[? _bone];
|
||||
|
||||
var _tran = current_data[index + 1];
|
||||
var _aang = current_data[index + 2];
|
||||
var _pang = current_data[index + 3];
|
||||
var _asca = current_data[index + 4];
|
||||
|
||||
var _rot = _aang * (_pang? _bone.angle : _bone.pose_local_angle) + _tran[TRANSFORM.rot];
|
||||
var _anc = _bone.getPoint(0.5);
|
||||
var _mov = point_rotate(_tran[TRANSFORM.pos_x], _tran[TRANSFORM.pos_y], 0, 0, _bone.angle);
|
||||
var _sca = [ _tran[TRANSFORM.sca_x], _tran[TRANSFORM.sca_y] ];
|
||||
if(_asca) {
|
||||
_sca[0] *= _bone.pose_scale;
|
||||
_sca[1] *= _bone.pose_scale;
|
||||
}
|
||||
|
||||
var _ww = surface_get_width(_surf);
|
||||
var _hh = surface_get_height(_surf);
|
||||
var _sw = _ww * _sca[0];
|
||||
var _sh = _hh * _sca[1];
|
||||
|
||||
var _cx = (_anc.x * _dsca) + _mov[0] + _dpos[0];
|
||||
var _cy = (_anc.y * _dsca) + _mov[1] + _dpos[1];
|
||||
|
||||
var _d0 = point_rotate(_cx - _sw / 2, _cy - _sh / 2, _cx, _cy, _rot);
|
||||
var _d1 = point_rotate(_cx - _sw / 2, _cy + _sh / 2, _cx, _cy, _rot);
|
||||
var _d2 = point_rotate(_cx + _sw / 2, _cy - _sh / 2, _cx, _cy, _rot);
|
||||
var _d3 = point_rotate(_cx + _sw / 2, _cy + _sh / 2, _cx, _cy, _rot);
|
||||
var _rr = point_rotate(_cx, _cy - _sh / 2 - 4, _cx, _cy, _rot);
|
||||
|
||||
_d0[0] = overlay_x(_d0[0], _x, _s); _d0[1] = overlay_y(_d0[1], _y, _s);
|
||||
_d1[0] = overlay_x(_d1[0], _x, _s); _d1[1] = overlay_y(_d1[1], _y, _s);
|
||||
_d2[0] = overlay_x(_d2[0], _x, _s); _d2[1] = overlay_y(_d2[1], _y, _s);
|
||||
_d3[0] = overlay_x(_d3[0], _x, _s); _d3[1] = overlay_y(_d3[1], _y, _s);
|
||||
_rr[0] = overlay_x(_rr[0], _x, _s); _rr[1] = overlay_y(_rr[1], _y, _s);
|
||||
|
||||
anchors[index] = {
|
||||
cx: _cx,
|
||||
cy: _cy,
|
||||
d0: _d0,
|
||||
d1: _d1,
|
||||
d2: _d2,
|
||||
d3: _d3,
|
||||
rr: _rr,
|
||||
|
||||
rot: _rot,
|
||||
}
|
||||
}
|
||||
|
||||
for(var i = 0; i < amo; i++) {
|
||||
var vis = array_safe_get(_vis, i);
|
||||
var sel = array_safe_get(_sel, i);
|
||||
if(!vis) continue;
|
||||
if(!sel) continue;
|
||||
|
||||
var index = input_fix_len + i * data_length;
|
||||
var _surf = array_safe_get(current_data, index);
|
||||
if(!_surf || is_array(_surf)) continue;
|
||||
|
||||
var _bone = inputs[| index].extra_data.bone_id;
|
||||
if(!ds_map_exists(boneMap, _bone))
|
||||
continue;
|
||||
|
||||
var a = anchors[index];
|
||||
|
||||
if(surface_selecting == index) {
|
||||
var _ri = 0;
|
||||
var _si = 0;
|
||||
|
||||
if(point_in_circle(_mx, _my, a.d3[0], a.d3[1], 12)) {
|
||||
hovering = index;
|
||||
hovering_type = NODE_COMPOSE_DRAG.scale;
|
||||
_si = 1;
|
||||
} else if(point_in_rectangle_points(_mx, _my, a.d0[0], a.d0[1], a.d1[0], a.d1[1], a.d2[0], a.d2[1], a.d3[0], a.d3[1])) {
|
||||
hovering = index;
|
||||
hovering_type = NODE_COMPOSE_DRAG.move;
|
||||
} else if(point_in_circle(_mx, _my, a.rr[0], a.rr[1], 12)) {
|
||||
hovering = index;
|
||||
hovering_type = NODE_COMPOSE_DRAG.rotate;
|
||||
_ri = 1;
|
||||
}
|
||||
|
||||
draw_sprite_colored(THEME.anchor_rotate, _ri, a.rr[0], a.rr[1],, a.rot);
|
||||
draw_sprite_colored(THEME.anchor_scale, _si, a.d3[0], a.d3[1],, a.rot);
|
||||
} else if(point_in_rectangle_points(_mx, _my, a.d0[0], a.d0[1], a.d1[0], a.d1[1], a.d2[0], a.d2[1], a.d3[0], a.d3[1]) &&
|
||||
(surface_selecting != hovering || surface_selecting == noone)) {
|
||||
|
||||
hovering = index;
|
||||
hovering_type = NODE_COMPOSE_DRAG.move;
|
||||
}
|
||||
}
|
||||
|
||||
if(mouse_press(mb_left, active))
|
||||
surface_selecting = hovering;
|
||||
|
||||
if(hovering != noone) {
|
||||
var a = anchors[hovering];
|
||||
|
||||
draw_set_color(COLORS.node_composite_overlay_border);
|
||||
draw_line(a.d0[0], a.d0[1], a.d1[0], a.d1[1]);
|
||||
draw_line(a.d0[0], a.d0[1], a.d2[0], a.d2[1]);
|
||||
draw_line(a.d3[0], a.d3[1], a.d1[0], a.d1[1]);
|
||||
draw_line(a.d3[0], a.d3[1], a.d2[0], a.d2[1]);
|
||||
}
|
||||
|
||||
if(surface_selecting != noone) {
|
||||
var a = anchors[surface_selecting];
|
||||
|
||||
draw_set_color(COLORS._main_accent);
|
||||
draw_line(a.d0[0], a.d0[1], a.d1[0], a.d1[1]);
|
||||
draw_line(a.d0[0], a.d0[1], a.d2[0], a.d2[1]);
|
||||
draw_line(a.d3[0], a.d3[1], a.d1[0], a.d1[1]);
|
||||
draw_line(a.d3[0], a.d3[1], a.d2[0], a.d2[1]);
|
||||
}
|
||||
|
||||
if(hovering != noone && hovering_type != noone && mouse_press(mb_left, active)) {
|
||||
var _tran = current_data[hovering + 1];
|
||||
var _aang = current_data[hovering + 2];
|
||||
var _asca = current_data[hovering + 3];
|
||||
|
||||
var a = anchors[hovering];
|
||||
|
||||
if(hovering_type == NODE_COMPOSE_DRAG.move) { //move
|
||||
surf_dragging = hovering;
|
||||
drag_type = hovering_type;
|
||||
dragging_sx = _tran[TRANSFORM.pos_x];
|
||||
dragging_sy = _tran[TRANSFORM.pos_y];
|
||||
dragging_mx = mx;
|
||||
dragging_my = my;
|
||||
} else if(hovering_type == NODE_COMPOSE_DRAG.rotate) { //rot
|
||||
surf_dragging = hovering;
|
||||
drag_type = hovering_type;
|
||||
dragging_sx = _tran[TRANSFORM.rot];
|
||||
rot_anc_x = overlay_x(a.cx, _x, _s);
|
||||
rot_anc_y = overlay_y(a.cy, _y, _s);
|
||||
dragging_mx = point_direction(rot_anc_x, rot_anc_y, _mx, _my);
|
||||
} else if(hovering_type == NODE_COMPOSE_DRAG.scale) { //sca
|
||||
surf_dragging = hovering;
|
||||
drag_type = hovering_type;
|
||||
dragging_mx = (a.d0[0] + a.d3[0]) / 2;
|
||||
dragging_my = (a.d0[1] + a.d3[1]) / 2;
|
||||
}
|
||||
}
|
||||
|
||||
if(layer_remove > -1) {
|
||||
deleteLayer(layer_remove);
|
||||
layer_remove = -1;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
static step = function() {
|
||||
var _dim_type = getSingleValue(1);
|
||||
inputs[| 2].setVisible(_dim_type == COMPOSE_OUTPUT_SCALING.constant);
|
||||
}
|
||||
|
||||
static process_data = function(_outSurf, _data, _output_index, _array_index) {
|
||||
if(_output_index == 1) return atlas_data;
|
||||
if(_output_index == 2) return bind_data;
|
||||
if(_output_index == 0 && _array_index == 0) {
|
||||
atlas_data = [];
|
||||
bind_data = [];
|
||||
}
|
||||
|
||||
var _dim = _data[0];
|
||||
var _bone = _data[1];
|
||||
var _bind = _data[2];
|
||||
|
||||
var _dpos = _data[3];
|
||||
var _dsca = _data[4];
|
||||
var cDep = attrDepth();
|
||||
|
||||
setBone();
|
||||
|
||||
//////////////////////////////////////////
|
||||
|
||||
overlay_w = _dim[0];
|
||||
overlay_h = _dim[1];
|
||||
|
||||
_outSurf = surface_verify(_outSurf, _dim[0], _dim[1], cDep);
|
||||
|
||||
for(var i = 0; i < 2; i++) {
|
||||
temp_surface[i] = surface_verify(temp_surface[i], surface_get_width(_outSurf), surface_get_height(_outSurf), cDep);
|
||||
|
||||
surface_set_target(temp_surface[i]);
|
||||
DRAW_CLEAR
|
||||
surface_reset_target();
|
||||
}
|
||||
|
||||
var use_data = _bind != noone;
|
||||
var res_index = 0;
|
||||
var bg = 0;
|
||||
var imageAmo = use_data? array_length(_bind) : (ds_list_size(inputs) - input_fix_len) / data_length;
|
||||
var _vis = attributes.layer_visible;
|
||||
|
||||
surface_set_shader(_outSurf, sh_sample, true, BLEND.alphamulp);
|
||||
|
||||
for(var i = 0; i < imageAmo; i++) {
|
||||
var vis = array_safe_get(_vis, i, true);
|
||||
if(!vis) continue;
|
||||
|
||||
var datInd = input_fix_len + i * data_length;
|
||||
var _s = use_data? _bind[i].surface.get() : _data[datInd];
|
||||
if(!is_surface(_s)) continue;
|
||||
|
||||
var _b = use_data? _bind[i].bone : inputs[| datInd].extra_data.bone_id;
|
||||
|
||||
if(!ds_map_exists(boneMap, _b)) {
|
||||
//print($"Bone not exist {_bone} from map {ds_map_size(boneMap)}")
|
||||
continue;
|
||||
}
|
||||
_b = boneMap[? _b];
|
||||
|
||||
var _tran = use_data? _bind[i].transform : _data[datInd + 1];
|
||||
var _aang = _data[datInd + 2];
|
||||
var _pang = _data[datInd + 3];
|
||||
var _asca = _data[datInd + 4];
|
||||
|
||||
var _rot = _aang * (_pang? _b.angle : _b.pose_local_angle) + _tran[TRANSFORM.rot];
|
||||
var _anc = _b.getPoint(0.5);
|
||||
var _mov = point_rotate(_tran[TRANSFORM.pos_x], _tran[TRANSFORM.pos_y], 0, 0, _b.angle);
|
||||
var _sca = [ _tran[TRANSFORM.sca_x], _tran[TRANSFORM.sca_y] ];
|
||||
if(_asca) {
|
||||
_sca[0] *= _b.pose_scale;
|
||||
_sca[1] *= _b.pose_scale;
|
||||
}
|
||||
|
||||
var _ww = surface_get_width(_s);
|
||||
var _hh = surface_get_height(_s);
|
||||
var _sw = _ww * _sca[0];
|
||||
var _sh = _hh * _sca[1];
|
||||
|
||||
var _cen = point_rotate(-_sw / 2, -_sh / 2, 0, 0, _rot);
|
||||
var _pos = [
|
||||
(_anc.x * _dsca) + _cen[0] + _mov[0] + _dpos[0],
|
||||
(_anc.y * _dsca) + _cen[1] + _mov[1] + _dpos[1]
|
||||
];
|
||||
|
||||
shader_set_interpolation(_s);
|
||||
|
||||
array_push(atlas_data, new SurfaceAtlas(_s, _pos, _rot, _sca));
|
||||
array_push(bind_data, {
|
||||
surface: new Surface(_s),
|
||||
bone: _b.ID,
|
||||
transform: _tran
|
||||
});
|
||||
draw_surface_ext_safe(_s, _pos[0], _pos[1], _sca[0], _sca[1], _rot);
|
||||
}
|
||||
|
||||
surface_reset_shader();
|
||||
|
||||
return _outSurf;
|
||||
}
|
||||
|
||||
static resetTransform = function(surfIndex) {
|
||||
var _bind = inputs[| 2].getValue();
|
||||
var use_data = _bind != noone;
|
||||
|
||||
var _surf = inputs[| surfIndex + 0].getValue();
|
||||
var _tran = inputs[| surfIndex + 1].getValue();
|
||||
var _arot = inputs[| surfIndex + 2].getValue();
|
||||
|
||||
var _b = use_data? _bind[i].bone : inputs[| surfIndex].extra_data.bone_id;
|
||||
if(!ds_map_exists(boneMap, _b)) return;
|
||||
|
||||
_b = boneMap[? _b];
|
||||
|
||||
var _cx = surface_get_width(_surf) / 2;
|
||||
var _cy = surface_get_height(_surf) / 2;
|
||||
|
||||
var _anc = _b.getPoint(0.5);
|
||||
var _rot = _arot? -_b.angle : 0;
|
||||
|
||||
var _tr = [ _cx - _anc.x, _cy - _anc.y, _rot, 1, 1 ];
|
||||
inputs[| surfIndex + 1].setValue(_tr);
|
||||
}
|
||||
|
||||
//static postDeserialize = function() {
|
||||
// var _inputs = load_map.inputs;
|
||||
|
||||
// var load_fix_len = input_fix_len;
|
||||
// var amo = (array_length(_inputs) - load_fix_len) / data_length;
|
||||
|
||||
// if(PROJECT.version < 11481) {
|
||||
// var _idx = [];
|
||||
// for( var i = load_fix_len, n = array_length(_inputs); i < n; i += 2 ) {
|
||||
// array_append(_idx, i + 3);
|
||||
// array_append(_idx, i + 4);
|
||||
// }
|
||||
|
||||
// for( var i = array_length(_idx) - 1; i >= 0; i++ )
|
||||
// array_insert(load_map.inputs, _idx[i], noone);
|
||||
// }
|
||||
|
||||
// if(PROJECT.version < 11470) {
|
||||
// array_insert(load_map.inputs, 3, noone);
|
||||
// array_insert(load_map.inputs, 4, noone);
|
||||
// load_fix_len = 3;
|
||||
// }
|
||||
|
||||
// repeat(amo) createNewInput();
|
||||
//}
|
||||
|
||||
static attributeSerialize = function() {
|
||||
var att = {};
|
||||
att.layer_visible = attributes.layer_visible;
|
||||
att.layer_selectable = attributes.layer_selectable;
|
||||
|
||||
return att;
|
||||
}
|
||||
|
||||
static attributeDeserialize = function(attr) {
|
||||
if(struct_has(attr, "layer_visible"))
|
||||
attributes.layer_visible = attr.layer_visible;
|
||||
|
||||
if(struct_has(attr, "layer_selectable"))
|
||||
attributes.layer_selectable = attr.layer_selectable;
|
||||
}
|
||||
|
||||
static doApplyDeserialize = function() {
|
||||
setBone();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// 2023-08-08 10:31:45
|
||||
// 2023-08-08 14:42:15
|
||||
global.loop_nodes = [ "Node_Iterate", "Node_Iterate_Each" ];
|
||||
|
||||
function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x, _y) constructor {
|
||||
|
@ -276,7 +276,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
|
|||
if(x == _x && y == _y) return;
|
||||
|
||||
x = _x;
|
||||
y = _y;
|
||||
y = _y;
|
||||
if(!LOADING) PROJECT.modified = true;
|
||||
}
|
||||
|
||||
|
@ -1291,6 +1291,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
|
|||
isTool = true;
|
||||
}
|
||||
|
||||
#region[#88ffe916] === Save Load ===
|
||||
static serialize = function(scale = false, preset = false) {
|
||||
var _map = {};
|
||||
//print(" > Serializing: " + name);
|
||||
|
@ -1394,12 +1395,15 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
|
|||
var _input_fix_len = load_map.input_fix_len;
|
||||
var _data_length = load_map.data_length;
|
||||
|
||||
print($"Balancing IO: {input_fix_len} => {load_map.input_fix_len} : {data_length} => {load_map.data_length}");
|
||||
print($"IO size before: {array_length(load_map.inputs)}");
|
||||
|
||||
var _dynamic_inputs = (array_length(load_map.inputs) - _input_fix_len) / _data_length;
|
||||
if(frac(_dynamic_inputs) != 0) {
|
||||
noti_warning("LOAD: Uneven dynamic input.");
|
||||
_dynamic_inputs = ceil(_dynamic_inputs);
|
||||
}
|
||||
|
||||
|
||||
if(_input_fix_len == input_fix_len && _data_length == data_length)
|
||||
return;
|
||||
|
||||
|
@ -1414,6 +1418,8 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
|
|||
var _pad_fix = input_fix_len - _input_fix_len;
|
||||
repeat(_pad_fix)
|
||||
array_insert(load_map.inputs, _input_fix_len, noone);
|
||||
|
||||
print($"IO size after: {array_length(load_map.inputs)}");
|
||||
}
|
||||
|
||||
static inputGenerate = function() { //Generate input for dynamic input nodes
|
||||
|
@ -1421,7 +1427,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
|
|||
return;
|
||||
|
||||
var _dynamic_inputs = (array_length(load_map.inputs) - input_fix_len) / data_length;
|
||||
print($"Node {name} create {_dynamic_inputs} inputs for data length {data_length}");
|
||||
//print($"Node {name} create {_dynamic_inputs} inputs for data length {data_length}");
|
||||
repeat(_dynamic_inputs)
|
||||
createNewInput();
|
||||
}
|
||||
|
@ -1439,6 +1445,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
|
|||
|
||||
for(var i = 0; i < amo; i++) {
|
||||
if(inputs[| i] == noone || _inputs[i] == noone) continue;
|
||||
print($"Apply deserialize {_inputs[i].name} to {inputs[| i].name}");
|
||||
inputs[| i].applyDeserialize(_inputs[i], load_scale, preset);
|
||||
}
|
||||
|
||||
|
@ -1501,6 +1508,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
|
|||
|
||||
static preConnect = function() {}
|
||||
static postConnect = function() {}
|
||||
#endregion
|
||||
|
||||
static resetAnimation = function() {}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// 2023-08-08 10:28:44
|
||||
// 2023-08-08 14:41:40
|
||||
global.loop_nodes = [ "Node_Iterate", "Node_Iterate_Each" ];
|
||||
|
||||
function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x, _y) constructor {
|
||||
|
@ -276,7 +276,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
|
|||
if(x == _x && y == _y) return;
|
||||
|
||||
x = _x;
|
||||
y = _y;
|
||||
y = _y;
|
||||
if(!LOADING) PROJECT.modified = true;
|
||||
}
|
||||
|
||||
|
@ -1291,6 +1291,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
|
|||
isTool = true;
|
||||
}
|
||||
|
||||
#region[#88ffe916] === Save Load ===
|
||||
static serialize = function(scale = false, preset = false) {
|
||||
var _map = {};
|
||||
//print(" > Serializing: " + name);
|
||||
|
@ -1394,12 +1395,15 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
|
|||
var _input_fix_len = load_map.input_fix_len;
|
||||
var _data_length = load_map.data_length;
|
||||
|
||||
print($"Balancing IO: {input_fix_len} => {load_map.input_fix_len} : {data_length} => {load_map.data_length}");
|
||||
print($"IO size before: {array_length(load_map.inputs)}");
|
||||
|
||||
var _dynamic_inputs = (array_length(load_map.inputs) - _input_fix_len) / _data_length;
|
||||
if(frac(_dynamic_inputs) != 0) {
|
||||
noti_warning("LOAD: Uneven dynamic input.");
|
||||
_dynamic_inputs = ceil(_dynamic_inputs);
|
||||
}
|
||||
|
||||
|
||||
if(_input_fix_len == input_fix_len && _data_length == data_length)
|
||||
return;
|
||||
|
||||
|
@ -1414,6 +1418,8 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
|
|||
var _pad_fix = input_fix_len - _input_fix_len;
|
||||
repeat(_pad_fix)
|
||||
array_insert(load_map.inputs, _input_fix_len, noone);
|
||||
|
||||
print($"IO size after: {array_length(load_map.inputs)}");
|
||||
}
|
||||
|
||||
static inputGenerate = function() { //Generate input for dynamic input nodes
|
||||
|
@ -1421,7 +1427,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
|
|||
return;
|
||||
|
||||
var _dynamic_inputs = (array_length(load_map.inputs) - input_fix_len) / data_length;
|
||||
print($"Node {name} create {_dynamic_inputs} inputs for data length {data_length}");
|
||||
//print($"Node {name} create {_dynamic_inputs} inputs for data length {data_length}");
|
||||
repeat(_dynamic_inputs)
|
||||
createNewInput();
|
||||
}
|
||||
|
@ -1439,6 +1445,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
|
|||
|
||||
for(var i = 0; i < amo; i++) {
|
||||
if(inputs[| i] == noone || _inputs[i] == noone) continue;
|
||||
print($"Apply deserialize {_inputs[| i].name} to {inputs[| i].name}");
|
||||
inputs[| i].applyDeserialize(_inputs[i], load_scale, preset);
|
||||
}
|
||||
|
||||
|
@ -1501,6 +1508,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
|
|||
|
||||
static preConnect = function() {}
|
||||
static postConnect = function() {}
|
||||
#endregion
|
||||
|
||||
static resetAnimation = function() {}
|
||||
|
||||
|
|
2000
#backups/scripts/node_value/node_value.gml.backup0
Normal file
2000
#backups/scripts/node_value/node_value.gml.backup0
Normal file
File diff suppressed because it is too large
Load diff
2000
#backups/scripts/node_value/node_value.gml.backup1
Normal file
2000
#backups/scripts/node_value/node_value.gml.backup1
Normal file
File diff suppressed because it is too large
Load diff
|
@ -49,7 +49,6 @@
|
|||
{"name":"object","order":4,"path":"folders/functions/fluid sim/Internal/Compatibility/object.yy",},
|
||||
{"name":"texture","order":5,"path":"folders/functions/fluid sim/Internal/Compatibility/texture.yy",},
|
||||
{"name":"view","order":6,"path":"folders/functions/fluid sim/Internal/Compatibility/view.yy",},
|
||||
{"name":null,"path":"folders/shader/_crash_handler.yy","order":16,},
|
||||
{"name":"geometry","order":31,"path":"folders/functions/geometry.yy",},
|
||||
{"name":"importers","order":6,"path":"folders/functions/importers.yy",},
|
||||
{"name":"inputs","order":7,"path":"folders/functions/inputs.yy",},
|
||||
|
@ -152,7 +151,6 @@
|
|||
{"name":"blur","order":38,"path":"folders/shader/blur.yy",},
|
||||
{"name":"channels","order":42,"path":"folders/shader/channels.yy",},
|
||||
{"name":"color picker","order":56,"path":"folders/shader/color picker.yy",},
|
||||
{"name":null,"path":"folders/nodes/data/IO.yy","order":1,},
|
||||
{"name":"color selector","order":51,"path":"folders/shader/color selector.yy",},
|
||||
{"name":"draw","order":39,"path":"folders/shader/draw.yy",},
|
||||
{"name":"filter","order":30,"path":"folders/shader/filter.yy",},
|
||||
|
|
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
File diff suppressed because one or more lines are too long
|
@ -31,8 +31,9 @@ function __Bone(parent = noone, distance = 0, direction = 0, angle = 0, length =
|
|||
|
||||
updated = false;
|
||||
|
||||
IKlength = 0;
|
||||
IKTarget = noone;
|
||||
IKlength = 0;
|
||||
IKTargetID = "";
|
||||
IKTarget = noone;
|
||||
|
||||
freeze_data = {};
|
||||
|
||||
|
@ -291,7 +292,7 @@ function __Bone(parent = noone, distance = 0, direction = 0, angle = 0, length =
|
|||
var points = array_create(IKlength + 1);
|
||||
var lengths = array_create(IKlength);
|
||||
var bones = array_create(IKlength);
|
||||
var bn = IKTarget;
|
||||
var bn = IKTarget;
|
||||
|
||||
for( var i = IKlength; i > 0; i-- ) {
|
||||
var _p = bn.getPoint(1);
|
||||
|
@ -451,7 +452,7 @@ function __Bone(parent = noone, distance = 0, direction = 0, angle = 0, length =
|
|||
bone.parent_anchor = parent_anchor;
|
||||
|
||||
bone.IKlength = IKlength;
|
||||
bone.IKTarget = IKTarget == noone? "" : IKTarget.ID;
|
||||
bone.IKTargetID = IKTargetID;
|
||||
|
||||
bone.apply_rotation = apply_rotation;
|
||||
bone.apply_scale = apply_scale;
|
||||
|
@ -477,7 +478,7 @@ function __Bone(parent = noone, distance = 0, direction = 0, angle = 0, length =
|
|||
self.node = node;
|
||||
|
||||
IKlength = bone.IKlength;
|
||||
IKTarget = bone.IKTarget;
|
||||
IKTargetID = struct_try_get(bone, "IKTargetID", "");
|
||||
|
||||
apply_rotation = bone.apply_rotation;
|
||||
apply_scale = bone.apply_scale;
|
||||
|
@ -492,10 +493,9 @@ function __Bone(parent = noone, distance = 0, direction = 0, angle = 0, length =
|
|||
}
|
||||
|
||||
static connect = function() {
|
||||
if(parent == noone || IKTarget == "")
|
||||
IKTarget = noone;
|
||||
else if(is_string(IKTarget))
|
||||
IKTarget = parent.findBone(IKTarget);
|
||||
IKTarget = noone;
|
||||
if(parent != noone && IKTargetID != "")
|
||||
IKTarget = parent.findBone(IKTargetID);
|
||||
|
||||
for( var i = 0, n = array_length(childs); i < n; i++ )
|
||||
childs[i].connect();
|
||||
|
@ -508,8 +508,8 @@ function __Bone(parent = noone, distance = 0, direction = 0, angle = 0, length =
|
|||
_b.is_main = is_main;
|
||||
_b.parent_anchor = parent_anchor;
|
||||
|
||||
_b.IKlength = IKlength;
|
||||
_b.IKTarget = IKTarget == noone? "" : IKTarget.ID;
|
||||
_b.IKlength = IKlength;
|
||||
_b.IKTargetID = IKTargetID;
|
||||
|
||||
_b.apply_rotation = apply_rotation;
|
||||
_b.apply_scale = apply_scale;
|
||||
|
|
|
@ -24,6 +24,8 @@ enum ACTION_TYPE {
|
|||
ungroup,
|
||||
|
||||
collection_loaded,
|
||||
|
||||
struct_modify,
|
||||
}
|
||||
|
||||
enum DS_TYPE {
|
||||
|
@ -97,6 +99,11 @@ function Action(_type, _object, _data) constructor {
|
|||
for( var i = 0, n = array_length(obj); i < n; i++ )
|
||||
nodeDelete(obj[i]);
|
||||
break;
|
||||
case ACTION_TYPE.struct_modify :
|
||||
var _data = obj.serialize();
|
||||
obj.deserialize(data);
|
||||
data = _data;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -159,6 +166,11 @@ function Action(_type, _object, _data) constructor {
|
|||
for( var i = 0, n = array_length(obj); i < n; i++ )
|
||||
obj[i].restore();
|
||||
break;
|
||||
case ACTION_TYPE.struct_modify :
|
||||
var _data = obj.serialize();
|
||||
obj.deserialize(data);
|
||||
data = _data;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -167,48 +179,51 @@ function Action(_type, _object, _data) constructor {
|
|||
switch(type) {
|
||||
case ACTION_TYPE.var_modify :
|
||||
if(array_length(data) > 2)
|
||||
ss = "modify " + string(data[2]);
|
||||
ss = $"modify {data[2]}";
|
||||
else
|
||||
ss = "modify " + string(data[1]);
|
||||
ss = $"modify {data[1]}";
|
||||
break;
|
||||
case ACTION_TYPE.list_insert :
|
||||
if(array_length(data) > 2)
|
||||
ss = data[2];
|
||||
else
|
||||
ss = "insert " + string(data[1]) + " to list " + string(obj);
|
||||
ss = $"insert {data[1]} to list {obj}";
|
||||
break;
|
||||
case ACTION_TYPE.list_modify :
|
||||
ss = "modify " + string(data[1]) + " of list " + string(obj);
|
||||
ss = $"modify {data[1]} of list {obj}";
|
||||
break;
|
||||
case ACTION_TYPE.list_delete :
|
||||
ss = "delete " + string(data[1]) + " from list " + string(obj);
|
||||
ss = $"delete {data[1]} from list {obj}";
|
||||
break;
|
||||
case ACTION_TYPE.node_added :
|
||||
ss = "add " + string(obj.name) + " node";
|
||||
ss = $"add {obj.name} node";
|
||||
break;
|
||||
case ACTION_TYPE.node_delete :
|
||||
ss = "deleted " + string(obj.name) + " node";
|
||||
ss = $"deleted {obj.name} node";
|
||||
break;
|
||||
case ACTION_TYPE.junction_connect :
|
||||
ss = "connect " + string(obj.name);
|
||||
ss = $"connect {obj.name}";
|
||||
break;
|
||||
case ACTION_TYPE.junction_disconnect :
|
||||
ss = "disconnect " + string(obj.name);
|
||||
ss = $"disconnect {obj.name}";
|
||||
break;
|
||||
case ACTION_TYPE.group_added :
|
||||
ss = "add " + string(obj.name) + " to group";
|
||||
ss = $"add {obj.name} to group";
|
||||
break;
|
||||
case ACTION_TYPE.group_removed :
|
||||
ss = "remove " + string(obj.name) + " from group";
|
||||
ss = $"remove {obj.name} from group";
|
||||
break;
|
||||
case ACTION_TYPE.group :
|
||||
ss = "group " + string(array_length(data.content)) + " nodes";
|
||||
ss = $"group {array_length(data.content)} nodes";
|
||||
break;
|
||||
case ACTION_TYPE.ungroup :
|
||||
ss = "ungroup " + string(obj.name) + " node";
|
||||
ss = $"ungroup {obj.name} node";
|
||||
break;
|
||||
case ACTION_TYPE.collection_loaded :
|
||||
ss = "load " + string(filename_name(data));
|
||||
ss = $"load {filename_name(data)}";
|
||||
break;
|
||||
case ACTION_TYPE.struct_modify :
|
||||
ss = $"modify {struct_try_get(obj, "name", "value")}";
|
||||
break;
|
||||
}
|
||||
return ss;
|
||||
|
|
|
@ -186,11 +186,4 @@ function Node_3D_Combine(_x, _y, _group = noone) : Node(_x, _y, _group) construc
|
|||
_3d_post_setup();
|
||||
}
|
||||
}
|
||||
|
||||
//static postDeserialize = function() {
|
||||
// var _inputs = load_map.inputs;
|
||||
|
||||
// for(var i = input_fix_len; i < array_length(_inputs); i += data_length)
|
||||
// createNewInput();
|
||||
//}
|
||||
}
|
|
@ -112,11 +112,4 @@ function Node_VFX_Renderer(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
|||
|
||||
cacheCurrentFrame(_outSurf);
|
||||
}
|
||||
|
||||
//static postDeserialize = function() {
|
||||
// var _inputs = load_map.inputs;
|
||||
|
||||
// for(var i = input_fix_len; i < array_length(_inputs); i += data_length)
|
||||
// createNewInput();
|
||||
//}
|
||||
}
|
|
@ -110,6 +110,7 @@ function Node_Armature(_x, _y, _group = noone) : Node(_x, _y, _group) constructo
|
|||
|
||||
if(bone_remove != noone) {
|
||||
var _par = bone_remove.parent;
|
||||
recordAction(ACTION_TYPE.struct_modify, attributes.bones, attributes.bones.serialize());
|
||||
array_remove(_par.childs, bone_remove);
|
||||
|
||||
for( var i = 0, n = array_length(bone_remove.childs); i < n; i++ ) {
|
||||
|
@ -128,6 +129,8 @@ function Node_Armature(_x, _y, _group = noone) : Node(_x, _y, _group) constructo
|
|||
];
|
||||
|
||||
static createBone = function(parent, distance, direction) {
|
||||
recordAction(ACTION_TYPE.struct_modify, attributes.bones, attributes.bones.serialize());
|
||||
|
||||
var bone = new __Bone(parent, distance, direction,,, self);
|
||||
parent.addChild(bone);
|
||||
|
||||
|
@ -286,10 +289,12 @@ function Node_Armature(_x, _y, _group = noone) : Node(_x, _y, _group) constructo
|
|||
var _len = point_distance(p0.x, p0.y, p1.x, p1.y);
|
||||
var _ang = point_direction(p0.x, p0.y, p1.x, p1.y);
|
||||
|
||||
recordAction(ACTION_TYPE.struct_modify, attributes.bones, attributes.bones.serialize());
|
||||
|
||||
var IKbone = new __Bone(anc, _len, _ang, ik_dragging.angle + 90, 0, self);
|
||||
anc.addChild(IKbone);
|
||||
IKbone.IKlength = len;
|
||||
IKbone.IKTarget = ik_dragging;
|
||||
IKbone.IKTargetID = ik_dragging;
|
||||
|
||||
IKbone.name = "IK handle";
|
||||
IKbone.parent_anchor = false;
|
||||
|
@ -326,8 +331,10 @@ function Node_Armature(_x, _y, _group = noone) : Node(_x, _y, _group) constructo
|
|||
_b.distance = point_distance(0, 0, _bx, _by);
|
||||
_b.direction = point_direction(0, 0, _bx, _by);
|
||||
|
||||
if(mouse_release(mb_left))
|
||||
if(mouse_release(mb_left)) {
|
||||
builder_moving = false;
|
||||
UNDO_HOLDING = false;
|
||||
}
|
||||
|
||||
draw_set_color(COLORS._main_accent);
|
||||
draw_rectangle(x0, y0, x1, y1, true);
|
||||
|
@ -338,6 +345,8 @@ function Node_Armature(_x, _y, _group = noone) : Node(_x, _y, _group) constructo
|
|||
builder_moving = true;
|
||||
builder_mx = mx;
|
||||
builder_my = my;
|
||||
|
||||
recordAction(ACTION_TYPE.struct_modify, attributes.bones, attributes.bones.serialize());
|
||||
}
|
||||
} else
|
||||
draw_set_color(c_white);
|
||||
|
@ -400,13 +409,16 @@ function Node_Armature(_x, _y, _group = noone) : Node(_x, _y, _group) constructo
|
|||
_b.distance = point_distance(0, 0, _bx, _by);
|
||||
_b.direction = point_direction(0, 0, _bx, _by);
|
||||
|
||||
if(mouse_release(mb_left))
|
||||
if(mouse_release(mb_left)) {
|
||||
builder_scaling = false;
|
||||
}
|
||||
} else {
|
||||
if(mouse_press(mb_left, active)) {
|
||||
builder_scaling = true;
|
||||
builder_mx = _mx;
|
||||
builder_my = _my;
|
||||
|
||||
recordAction(ACTION_TYPE.struct_modify, attributes.bones, attributes.bones.serialize());
|
||||
}
|
||||
}
|
||||
} else if(isUsingTool("Add bones")) { // builder
|
||||
|
@ -427,6 +439,8 @@ function Node_Armature(_x, _y, _group = noone) : Node(_x, _y, _group) constructo
|
|||
UNDO_HOLDING = true;
|
||||
} else if(anchor_selecting[1] == 2) {
|
||||
var _pr = anchor_selecting[0];
|
||||
recordAction(ACTION_TYPE.struct_modify, attributes.bones, attributes.bones.serialize());
|
||||
|
||||
var _md = new __Bone(noone, 0, 0, _pr.angle, _pr.length / 2, self);
|
||||
_pr.length = _md.length;
|
||||
|
||||
|
@ -501,6 +515,8 @@ function Node_Armature(_x, _y, _group = noone) : Node(_x, _y, _group) constructo
|
|||
builder_bone = anchor_selecting[0];
|
||||
builder_type = anchor_selecting[1];
|
||||
|
||||
recordAction(ACTION_TYPE.struct_modify, attributes.bones, attributes.bones.serialize());
|
||||
|
||||
if(builder_type == 0) {
|
||||
var orig = builder_bone.parent.getPoint(0);
|
||||
builder_sx = orig.x;
|
||||
|
|
|
@ -137,6 +137,7 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
|
|||
draw_surface_ext_safe(_surf, _sx, _sy, _ss, _ss, 0, c_white, 1);
|
||||
|
||||
if(_hover && point_in_rectangle(_m[0], _m[1], _sx, _sy, _sx + _sw * _ss, _sy + _sh * _ss)) {
|
||||
TOOLTIP = [ _surf, VALUE_TYPE.surface ];
|
||||
if(mouse_press(mb_left, _focus)) {
|
||||
layer_dragging = _sid;
|
||||
inputs[| input_fix_len + _sid * data_length].extra_data.bone_id = "";
|
||||
|
@ -147,7 +148,7 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
|
|||
draw_set_color(COLORS.node_composite_bg);
|
||||
draw_rectangle(_sx, _sy, _sx + _sw * _ss, _sy + _sh * _ss, true);
|
||||
|
||||
_sy += _sh * _ss + 4;
|
||||
_sx += _sw * _ss + 4;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -180,7 +181,7 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
|
|||
draw_sprite_stretched_ext(THEME.ui_panel_active, 0, _x, _ty, _w, bh - ui(32), COLORS._main_accent, 1);
|
||||
#endregion
|
||||
|
||||
var amo = (ds_list_size(inputs) - input_fix_len) / data_length - 1;
|
||||
var amo = floor((ds_list_size(inputs) - input_fix_len) / data_length) - 1;
|
||||
if(array_length(current_data) != ds_list_size(inputs)) return 0;
|
||||
|
||||
var ty = _y + bh + ui(8);
|
||||
|
@ -208,9 +209,11 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
|
|||
|
||||
layer_remove = -1;
|
||||
var index = -1;
|
||||
for(var i = input_fix_len; i < ds_list_size(inputs) - data_length; i += data_length) {
|
||||
var _surf = current_data[i];
|
||||
|
||||
for(var i = 0; i < amo; i++) {
|
||||
var _inp = input_fix_len + (amo - i - 1) * data_length;
|
||||
var _surf = current_data[_inp];
|
||||
|
||||
index++;
|
||||
var _bx = _x + _w - 24;
|
||||
var _cy = ly + index * (lh + 4);
|
||||
|
@ -297,7 +300,7 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
|
|||
}
|
||||
}
|
||||
|
||||
var binded = inputs[| i].extra_data.bone_id != "";
|
||||
var binded = inputs[| _inp].extra_data.bone_id != "";
|
||||
|
||||
if(layer_dragging == noone || layer_dragging == index) {
|
||||
var _bx = _x + 24;
|
||||
|
@ -389,10 +392,11 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
|
|||
|
||||
inputs[| index + 1] = nodeValue("Transform", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0, 1, 1 ] )
|
||||
.setDisplay(VALUE_DISPLAY.transform);
|
||||
|
||||
inputs[| index + 2] = nodeValue("Inherit Rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true );
|
||||
inputs[| index + 3] = nodeValue("Apply Bone Rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false );
|
||||
|
||||
inputs[| index + 3] = nodeValue("Inherit Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false );
|
||||
inputs[| index + 4] = nodeValue("Inherit Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false );
|
||||
inputs[| index + 5] = nodeValue("Apply Bone Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false );
|
||||
|
||||
for( var i = 0; i < data_length; i++ )
|
||||
array_push(input_display_list, index + i);
|
||||
|
@ -404,7 +408,7 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
|
|||
#endregion
|
||||
}
|
||||
|
||||
setIsDynamicInput(4);
|
||||
setIsDynamicInput(6);
|
||||
|
||||
if(!LOADING && !APPENDING) createNewInput();
|
||||
|
||||
|
@ -516,11 +520,12 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
|
|||
var y1 = _y + hh * _s;
|
||||
|
||||
if(surf_dragging > -1) {
|
||||
var input_dragging = surf_dragging + 1;
|
||||
var _surf = current_data[surf_dragging];
|
||||
var _tran = current_data[input_dragging + 0];
|
||||
var _aang = current_data[input_dragging + 1];
|
||||
var _asca = current_data[input_dragging + 2];
|
||||
var _surf = current_data[surf_dragging + 0];
|
||||
var _tran = current_data[surf_dragging + 1];
|
||||
var _aang = current_data[surf_dragging + 2];
|
||||
var _pang = current_data[surf_dragging + 3];
|
||||
var _asca = current_data[surf_dragging + 4];
|
||||
var _psca = current_data[surf_dragging + 5];
|
||||
|
||||
var _bone = inputs[| surf_dragging].extra_data.bone_id;
|
||||
_bone = boneMap[? _bone];
|
||||
|
@ -548,7 +553,7 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
|
|||
|
||||
_tran[TRANSFORM.rot] = sa;
|
||||
} else if(drag_type == NODE_COMPOSE_DRAG.scale) {
|
||||
var _rot = _aang * _bone.angle + _tran[TRANSFORM.rot];
|
||||
var _rot = _aang * (_pang? _bone.angle : _bone.pose_local_angle) + _tran[TRANSFORM.rot];
|
||||
var _sw = surface_get_width(_surf);
|
||||
var _sh = surface_get_height(_surf);
|
||||
|
||||
|
@ -562,15 +567,15 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
|
|||
}
|
||||
|
||||
if(_asca) {
|
||||
sca_x /= _bone.pose_scale;
|
||||
sca_y /= _bone.pose_scale;
|
||||
sca_x /= _psca? _bone.pose_scale : _bone.pose_local_scale;
|
||||
sca_y /= _psca? _bone.pose_scale : _bone.pose_local_scale;
|
||||
}
|
||||
|
||||
_tran[TRANSFORM.sca_x] = sca_x;
|
||||
_tran[TRANSFORM.sca_y] = sca_y;
|
||||
}
|
||||
|
||||
if(inputs[| input_dragging].setValue(_tran))
|
||||
if(inputs[| surf_dragging + 1].setValue(_tran))
|
||||
UNDO_HOLDING = true;
|
||||
|
||||
if(mouse_release(mb_left)) {
|
||||
|
@ -601,15 +606,17 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
|
|||
|
||||
var _tran = current_data[index + 1];
|
||||
var _aang = current_data[index + 2];
|
||||
var _asca = current_data[index + 3];
|
||||
var _pang = current_data[index + 3];
|
||||
var _asca = current_data[index + 4];
|
||||
var _psca = current_data[index + 5];
|
||||
|
||||
var _rot = _aang * _bone.angle + _tran[TRANSFORM.rot];
|
||||
var _rot = _aang * (_pang? _bone.angle : _bone.pose_local_angle) + _tran[TRANSFORM.rot];
|
||||
var _anc = _bone.getPoint(0.5);
|
||||
var _mov = point_rotate(_tran[TRANSFORM.pos_x], _tran[TRANSFORM.pos_y], 0, 0, _bone.angle);
|
||||
var _sca = [ _tran[TRANSFORM.sca_x], _tran[TRANSFORM.sca_y] ];
|
||||
if(_asca) {
|
||||
_sca[0] *= _bone.pose_scale;
|
||||
_sca[1] *= _bone.pose_scale;
|
||||
_sca[0] *= _psca? _bone.pose_scale : _bone.pose_local_scale;
|
||||
_sca[1] *= _psca? _bone.pose_scale : _bone.pose_local_scale;
|
||||
}
|
||||
|
||||
var _ww = surface_get_width(_surf);
|
||||
|
@ -811,15 +818,17 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
|
|||
|
||||
var _tran = use_data? _bind[i].transform : _data[datInd + 1];
|
||||
var _aang = _data[datInd + 2];
|
||||
var _asca = _data[datInd + 3];
|
||||
var _pang = _data[datInd + 3];
|
||||
var _asca = _data[datInd + 4];
|
||||
var _psca = _data[datInd + 5];
|
||||
|
||||
var _rot = _aang * _b.angle + _tran[TRANSFORM.rot];
|
||||
var _rot = _aang * (_pang? _b.angle : _b.pose_local_angle) + _tran[TRANSFORM.rot];
|
||||
var _anc = _b.getPoint(0.5);
|
||||
var _mov = point_rotate(_tran[TRANSFORM.pos_x], _tran[TRANSFORM.pos_y], 0, 0, _b.angle);
|
||||
var _sca = [ _tran[TRANSFORM.sca_x], _tran[TRANSFORM.sca_y] ];
|
||||
if(_asca) {
|
||||
_sca[0] *= _b.pose_scale;
|
||||
_sca[1] *= _b.pose_scale;
|
||||
_sca[0] *= _psca? _b.pose_scale : _b.pose_local_scale;
|
||||
_sca[1] *= _psca? _b.pose_scale : _b.pose_local_scale;
|
||||
}
|
||||
|
||||
var _ww = surface_get_width(_s);
|
||||
|
@ -872,32 +881,6 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
|
|||
inputs[| surfIndex + 1].setValue(_tr);
|
||||
}
|
||||
|
||||
//static postDeserialize = function() {
|
||||
// var _inputs = load_map.inputs;
|
||||
|
||||
// var load_fix_len = input_fix_len;
|
||||
// var amo = (array_length(_inputs) - load_fix_len) / data_length;
|
||||
|
||||
// if(PROJECT.version < 11481) {
|
||||
// var _idx = [];
|
||||
// for( var i = load_fix_len, n = array_length(_inputs); i < n; i += 2 ) {
|
||||
// array_append(_idx, i + 3);
|
||||
// array_append(_idx, i + 4);
|
||||
// }
|
||||
|
||||
// for( var i = array_length(_idx) - 1; i >= 0; i++ )
|
||||
// array_insert(load_map.inputs, _idx[i], noone);
|
||||
// }
|
||||
|
||||
// if(PROJECT.version < 11470) {
|
||||
// array_insert(load_map.inputs, 3, noone);
|
||||
// array_insert(load_map.inputs, 4, noone);
|
||||
// load_fix_len = 3;
|
||||
// }
|
||||
|
||||
// repeat(amo) createNewInput();
|
||||
//}
|
||||
|
||||
static attributeSerialize = function() {
|
||||
var att = {};
|
||||
att.layer_visible = attributes.layer_visible;
|
||||
|
|
|
@ -160,9 +160,9 @@ function Node_Armature_Pose(_x, _y, _group = noone) : Node(_x, _y, _group) const
|
|||
|
||||
var val = posing_input.getValue();
|
||||
val[TRANSFORM.rot] = posing_sx;
|
||||
|
||||
if(posing_input.setValue(val))
|
||||
UNDO_HOLDING = true;
|
||||
|
||||
}
|
||||
|
||||
if(mouse_release(mb_left)) {
|
||||
|
@ -310,13 +310,6 @@ function Node_Armature_Pose(_x, _y, _group = noone) : Node(_x, _y, _group) const
|
|||
return BBOX().fromPoints(minx, miny, maxx, maxy);
|
||||
}
|
||||
|
||||
//static postDeserialize = function() {
|
||||
// var _inputs = load_map.inputs;
|
||||
|
||||
// for( var i = input_fix_len; i < array_length(_inputs); i += data_length )
|
||||
// createNewInput();
|
||||
//}
|
||||
|
||||
static doApplyDeserialize = function() {
|
||||
for( var i = input_fix_len; i < ds_list_size(inputs); i += data_length ) {
|
||||
var inp = inputs[| i];
|
||||
|
|
|
@ -182,13 +182,6 @@ function Node_Array(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
|||
outputs[| 0].setValue(res);
|
||||
}
|
||||
|
||||
//static postDeserialize = function() {
|
||||
// var _inputs = load_map.inputs;
|
||||
|
||||
// for(var i = input_fix_len; i < array_length(_inputs); i += data_length)
|
||||
// createNewInput();
|
||||
//}
|
||||
|
||||
static doApplyDeserialize = function() {
|
||||
var _typ = getType();
|
||||
if(_typ == VALUE_TYPE.any) return;
|
||||
|
|
|
@ -81,13 +81,6 @@ function Node_Array_Add(_x, _y, _group = noone) : Node(_x, _y, _group) construct
|
|||
outputs[| 0].setValue(_out);
|
||||
}
|
||||
|
||||
//static postDeserialize = function() {
|
||||
// var _inputs = load_map.inputs;
|
||||
|
||||
// for(var i = input_fix_len; i < array_length(_inputs); i += data_length )
|
||||
// createNewInput();
|
||||
//}
|
||||
|
||||
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
|
||||
var bbox = drawGetBbox(xx, yy, _s);
|
||||
draw_sprite_fit(s_node_array_add, 0, bbox.xc, bbox.yc, bbox.w, bbox.h);
|
||||
|
|
|
@ -84,13 +84,6 @@ function Node_Array_Zip(_x, _y, _group = noone) : Node(_x, _y, _group) construct
|
|||
outputs[| 0].setValue(_out);
|
||||
}
|
||||
|
||||
//static postDeserialize = function() {
|
||||
// var _inputs = load_map.inputs;
|
||||
|
||||
// for(var i = input_fix_len; i < array_length(_inputs); i += data_length )
|
||||
// createNewInput();
|
||||
//}
|
||||
|
||||
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
|
||||
var bbox = drawGetBbox(xx, yy, _s);
|
||||
draw_sprite_fit(s_node_array_zip, 0, bbox.xc, bbox.yc, bbox.w, bbox.h);
|
||||
|
|
|
@ -222,11 +222,4 @@ function Node_Camera(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
|
|||
|
||||
return _outSurf;
|
||||
}
|
||||
|
||||
//static postDeserialize = function() {
|
||||
// var _inputs = load_map.inputs;
|
||||
|
||||
// for(var i = input_fix_len; i < array_length(_inputs); i += data_length)
|
||||
// createNewInput();
|
||||
//}
|
||||
}
|
|
@ -6,7 +6,8 @@ function Node_Colors_Replace(_x, _y, _group = noone) : Node_Processor(_x, _y, _g
|
|||
.setDisplay(VALUE_DISPLAY.palette);
|
||||
|
||||
inputs[| 2] = nodeValue("Palette to", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, [])
|
||||
.setDisplay(VALUE_DISPLAY.palette);
|
||||
.setDisplay(VALUE_DISPLAY.palette)
|
||||
.setVisible(false, false);
|
||||
|
||||
inputs[| 3] = nodeValue("Threshold", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.1)
|
||||
.setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01]);
|
||||
|
@ -43,9 +44,9 @@ function Node_Colors_Replace(_x, _y, _group = noone) : Node_Processor(_x, _y, _g
|
|||
jun.setAnim(!jun.is_anim);
|
||||
|
||||
bx += bs + ui(4);
|
||||
index = jun.visible;
|
||||
if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, _focus, _hover,, THEME.junc_visible, index) == 2)
|
||||
jun.visible = !jun.visible;
|
||||
var vis = jun.visible;
|
||||
if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, _focus, _hover,, THEME.junc_visible, vis) == 2)
|
||||
jun.visible = !vis;
|
||||
|
||||
var _from = inputs[| 1].getValue();
|
||||
var _to = inputs[| 2].getValue();
|
||||
|
@ -118,7 +119,7 @@ function Node_Colors_Replace(_x, _y, _group = noone) : Node_Processor(_x, _y, _g
|
|||
|
||||
input_display_list = [ 6,
|
||||
["Output", true], 0, 4, 5,
|
||||
["Replace", false], render_palette,
|
||||
["Replace", false], render_palette, 2,
|
||||
["Comparison", false], 3,
|
||||
];
|
||||
|
||||
|
|
|
@ -819,13 +819,6 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
|
|||
return _outSurf;
|
||||
}
|
||||
|
||||
//static postDeserialize = function() {
|
||||
// var _inputs = load_map.inputs;
|
||||
|
||||
// for(var i = input_fix_len; i < array_length(_inputs); i += data_length)
|
||||
// createNewInput();
|
||||
//}
|
||||
|
||||
static attributeSerialize = function() {
|
||||
var att = {};
|
||||
att.layer_visible = attributes.layer_visible;
|
||||
|
|
|
@ -275,7 +275,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
|
|||
if(x == _x && y == _y) return;
|
||||
|
||||
x = _x;
|
||||
y = _y;
|
||||
y = _y;
|
||||
if(!LOADING) PROJECT.modified = true;
|
||||
}
|
||||
|
||||
|
@ -1290,6 +1290,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
|
|||
isTool = true;
|
||||
}
|
||||
|
||||
#region[#88ffe916] === Save Load ===
|
||||
static serialize = function(scale = false, preset = false) {
|
||||
var _map = {};
|
||||
//print(" > Serializing: " + name);
|
||||
|
@ -1393,18 +1394,23 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
|
|||
var _input_fix_len = load_map.input_fix_len;
|
||||
var _data_length = load_map.data_length;
|
||||
|
||||
//print($"Balancing IO: {input_fix_len} => {load_map.input_fix_len} : {data_length} => {load_map.data_length}");
|
||||
//print($"IO size before: {array_length(load_map.inputs)}");
|
||||
//for( var i = 0, n = array_length(load_map.inputs); i < n; i++ )
|
||||
// print($"{i}: {load_map.inputs[i].name}");
|
||||
|
||||
var _dynamic_inputs = (array_length(load_map.inputs) - _input_fix_len) / _data_length;
|
||||
if(frac(_dynamic_inputs) != 0) {
|
||||
noti_warning("LOAD: Uneven dynamic input.");
|
||||
_dynamic_inputs = ceil(_dynamic_inputs);
|
||||
}
|
||||
|
||||
|
||||
if(_input_fix_len == input_fix_len && _data_length == data_length)
|
||||
return;
|
||||
|
||||
var _pad_dyna = data_length - _data_length;
|
||||
|
||||
for( var i = _dynamic_inputs - 1; i >= 0; i-- ) {
|
||||
for( var i = _dynamic_inputs; i >= 1; i-- ) {
|
||||
var _ind = _input_fix_len + i * _data_length;
|
||||
repeat(_pad_dyna)
|
||||
array_insert(load_map.inputs, _ind, noone);
|
||||
|
@ -1413,6 +1419,10 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
|
|||
var _pad_fix = input_fix_len - _input_fix_len;
|
||||
repeat(_pad_fix)
|
||||
array_insert(load_map.inputs, _input_fix_len, noone);
|
||||
|
||||
//print($"IO size after: {array_length(load_map.inputs)}");
|
||||
//for( var i = 0, n = array_length(load_map.inputs); i < n; i++ )
|
||||
// print($"{i}: {load_map.inputs[i] == noone? "noone" : load_map.inputs[i].name}");
|
||||
}
|
||||
|
||||
static inputGenerate = function() { //Generate input for dynamic input nodes
|
||||
|
@ -1420,7 +1430,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
|
|||
return;
|
||||
|
||||
var _dynamic_inputs = (array_length(load_map.inputs) - input_fix_len) / data_length;
|
||||
print($"Node {name} create {_dynamic_inputs} inputs for data length {data_length}");
|
||||
//print($"Node {name} create {_dynamic_inputs} inputs for data length {data_length}");
|
||||
repeat(_dynamic_inputs)
|
||||
createNewInput();
|
||||
}
|
||||
|
@ -1500,6 +1510,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
|
|||
|
||||
static preConnect = function() {}
|
||||
static postConnect = function() {}
|
||||
#endregion
|
||||
|
||||
static resetAnimation = function() {}
|
||||
|
||||
|
|
|
@ -161,13 +161,6 @@ function Node_Equation(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
|
|||
draw_text_transformed(bbox.xc, bbox.yc, str, ss, ss, 0);
|
||||
}
|
||||
|
||||
//static postDeserialize = function() {
|
||||
// var _inputs = load_map.inputs;
|
||||
|
||||
// for(var i = input_fix_len; i < array_length(_inputs); i += data_length)
|
||||
// createNewInput();
|
||||
//}
|
||||
|
||||
static doApplyDeserialize = function() {
|
||||
refreshDynamicInput();
|
||||
}
|
||||
|
|
|
@ -49,13 +49,6 @@ function Node_Fluid_Domain_Queue(_x, _y, _group = noone) : Node_Fluid(_x, _y, _g
|
|||
}
|
||||
}
|
||||
|
||||
//static postDeserialize = function() {
|
||||
// var _inputs = load_map.inputs;
|
||||
|
||||
// for(var i = 0; i < array_length(_inputs); i++)
|
||||
// createNewInput();
|
||||
//}
|
||||
|
||||
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
|
||||
var bbox = drawGetBbox(xx, yy, _s);
|
||||
|
||||
|
|
|
@ -189,13 +189,6 @@ function Node_Json_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) cons
|
|||
draw_text_transformed(bbox.xc, bbox.yc, str, ss, ss, 0);
|
||||
}
|
||||
|
||||
//static postDeserialize = function() {
|
||||
// var _inputs = load_map.inputs;
|
||||
|
||||
// for(var i = input_fix_len; i < array_length(_inputs); i += data_length)
|
||||
// createNewInput();
|
||||
//}
|
||||
|
||||
static doApplyDeserialize = function() {
|
||||
refreshDynamicInput();
|
||||
}
|
||||
|
|
|
@ -124,13 +124,6 @@ function Node_Json_File_Write(_x, _y, _group = noone) : Node(_x, _y, _group) con
|
|||
draw_text_transformed(bbox.xc, bbox.yc, str, ss, ss, 0);
|
||||
}
|
||||
|
||||
//static postDeserialize = function() {
|
||||
// var _inputs = load_map.inputs;
|
||||
|
||||
// for(var i = input_fix_len; i < array_length(_inputs); i += data_length)
|
||||
// createNewInput();
|
||||
//}
|
||||
|
||||
static doApplyDeserialize = function() {
|
||||
refreshDynamicInput();
|
||||
}
|
||||
|
|
|
@ -324,7 +324,9 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor {
|
|||
if(isEqual(values[| 0].value, _val))
|
||||
return false;
|
||||
|
||||
if(_record) recordAction(ACTION_TYPE.var_modify, values[| 0], [ values[| 0].value, "value", prop.name ]);
|
||||
if(_record)
|
||||
recordAction(ACTION_TYPE.var_modify, values[| 0], [ values[| 0].value, "value", prop.name ]);
|
||||
|
||||
values[| 0].value = _val;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -228,11 +228,4 @@ function Node_Logic(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
|||
var ss = string_scale(str, bbox.w, bbox.h);
|
||||
draw_text_transformed(bbox.xc, bbox.yc, str, ss, ss, 0);
|
||||
}
|
||||
|
||||
//static postDeserialize = function() {
|
||||
// var _inputs = load_map.inputs;
|
||||
|
||||
// for(var i = input_fix_len; i < array_length(_inputs); i += data_length)
|
||||
// createNewInput();
|
||||
//}
|
||||
}
|
|
@ -239,13 +239,6 @@ function Node_Lua_Compute(_x, _y, _group = noone) : Node(_x, _y, _group) constru
|
|||
doUpdate();
|
||||
}
|
||||
|
||||
//static postDeserialize = function() {
|
||||
// var _inputs = load_map.inputs;
|
||||
|
||||
// for(var i = input_fix_len; i < array_length(_inputs); i += data_length)
|
||||
// createNewInput();
|
||||
//}
|
||||
|
||||
static doApplyDeserialize = function() {
|
||||
refreshDynamicInput();
|
||||
|
||||
|
|
|
@ -234,13 +234,6 @@ function Node_Lua_Surface(_x, _y, _group = noone) : Node(_x, _y, _group) constru
|
|||
doUpdate();
|
||||
}
|
||||
|
||||
//static postDeserialize = function() {
|
||||
// var _inputs = load_map.inputs;
|
||||
|
||||
// for(var i = input_fix_len; i < array_length(_inputs); i += data_length)
|
||||
// createNewInput();
|
||||
//}
|
||||
|
||||
static doApplyDeserialize = function() {
|
||||
refreshDynamicInput();
|
||||
|
||||
|
|
|
@ -994,11 +994,4 @@ function Node_Path(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
|||
var bbox = drawGetBbox(xx, yy, _s);
|
||||
draw_sprite_fit(THEME.node_draw_path, 0, bbox.xc, bbox.yc, bbox.w, bbox.h);
|
||||
}
|
||||
|
||||
//static postDeserialize = function() {
|
||||
// var _inputs = load_map.inputs;
|
||||
|
||||
// for(var i = input_fix_len; i < array_length(_inputs); i++)
|
||||
// createAnchor(0, 0);
|
||||
//}
|
||||
}
|
|
@ -131,13 +131,6 @@ function Node_Path_Array(_x, _y, _group = noone) : Node(_x, _y, _group) construc
|
|||
outputs[| 0].setValue(self);
|
||||
}
|
||||
|
||||
//static postDeserialize = function() {
|
||||
// var _inputs = load_map.inputs;
|
||||
|
||||
// for(var i = input_fix_len; i < array_length(_inputs); i += data_length)
|
||||
// createNewInput();
|
||||
//}
|
||||
|
||||
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
|
||||
|
||||
}
|
||||
|
|
|
@ -284,11 +284,4 @@ function Node_Path_L_System(_x, _y, _group = noone) : Node(_x, _y, _group) const
|
|||
var bbox = drawGetBbox(xx, yy, _s);
|
||||
draw_sprite_fit(s_node_path_l_system, 0, bbox.xc, bbox.yc, bbox.w, bbox.h);
|
||||
}
|
||||
|
||||
//static postDeserialize = function() {
|
||||
// var _inputs = load_map.inputs;
|
||||
|
||||
// for(var i = input_fix_len; i < array_length(_inputs); i += data_length)
|
||||
// createNewInput();
|
||||
//}
|
||||
}
|
|
@ -314,7 +314,7 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor {
|
|||
|
||||
ds_list_add(filter, "Colors");
|
||||
addNodeObject(filter, "Replace Palette", s_node_replace_palette, "Node_Color_replace", [1, Node_Color_replace], ["isolate color", "select color", "palette swap", "color replace"], "Replace color that match one palette with another palette.");
|
||||
addNodeObject(filter, "Replace Colors", s_node_color_replace, "Node_Colors_Replace", [1, Node_Colors_Replace]);
|
||||
addNodeObject(filter, "Replace Colors", s_node_color_replace, "Node_Colors_Replace", [1, Node_Colors_Replace], ["isolate color", "select color", "palette swap", "color replace"]);
|
||||
addNodeObject(filter, "Remove Color", s_node_color_remove, "Node_Color_Remove", [1, Node_Color_Remove], ["delete color"], "Remove color that match a palette.");
|
||||
addNodeObject(filter, "Colorize", s_node_colorize, "Node_Colorize", [1, Node_Colorize], ["recolor"], "Map brightness of a pixel to a color from a gradient.");
|
||||
addNodeObject(filter, "Posterize", s_node_posterize, "Node_Posterize", [1, Node_Posterize],, "Reduce and remap color to match a palette.");
|
||||
|
|
|
@ -116,11 +116,4 @@ function Node_Rigid_Render(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
|||
surface_reset_target();
|
||||
cacheCurrentFrame(_outSurf);
|
||||
}
|
||||
|
||||
//static postDeserialize = function() {
|
||||
// var _inputs = load_map.inputs;
|
||||
|
||||
// for(var i = input_fix_len; i < array_length(_inputs); i += data_length)
|
||||
// createNewInput();
|
||||
//}
|
||||
}
|
|
@ -141,12 +141,5 @@ function Node_Stack(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
|||
|
||||
outputs[| 1].setValue(atlas);
|
||||
}
|
||||
|
||||
//static postDeserialize = function() {
|
||||
// var _inputs = load_map.inputs;
|
||||
|
||||
// for(var i = input_fix_len; i < array_length(_inputs); i += data_length)
|
||||
// createNewInput();
|
||||
//}
|
||||
}
|
||||
|
||||
|
|
|
@ -173,13 +173,6 @@ function Node_Statistic(_x, _y, _group = noone) : Node(_x, _y, _group) construct
|
|||
outputs[| 0].setValue(res);
|
||||
}
|
||||
|
||||
//static postDeserialize = function() {
|
||||
// var _inputs = load_map.inputs;
|
||||
|
||||
// for(var i = input_fix_len; i < array_length(_inputs); i += data_length)
|
||||
// createNewInput();
|
||||
//}
|
||||
|
||||
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
|
||||
draw_set_text(f_h3, fa_center, fa_center, COLORS._main_text);
|
||||
var str = "";
|
||||
|
|
|
@ -92,13 +92,6 @@ function Node_Struct(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
|
|||
|
||||
}
|
||||
|
||||
//static postDeserialize = function() {
|
||||
// var _inputs = load_map.inputs;
|
||||
|
||||
// for(var i = input_fix_len; i < array_length(_inputs); i += data_length)
|
||||
// createNewInput();
|
||||
//}
|
||||
|
||||
static doApplyDeserialize = function() {
|
||||
refreshDynamicInput();
|
||||
}
|
||||
|
|
|
@ -124,13 +124,6 @@ function Node_Switch(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
|
|||
draw_set_alpha(1);
|
||||
}
|
||||
|
||||
//static postDeserialize = function() {
|
||||
// var _inputs = load_map.inputs;
|
||||
|
||||
// for(var i = input_fix_len; i < array_length(_inputs); i += data_length)
|
||||
// createNewInput();
|
||||
//}
|
||||
|
||||
static doApplyDeserialize = function() {
|
||||
refreshDynamicInput();
|
||||
}
|
||||
|
|
|
@ -1065,6 +1065,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
cache_value[0] = false;
|
||||
}
|
||||
|
||||
#region[#eb004b20] === GetValue ===
|
||||
static getValue = function(_time = PROJECT.animator.current_frame, applyUnit = true, arrIndex = 0, useCache = false) {
|
||||
if(type == VALUE_TYPE.trigger)
|
||||
useCache = false;
|
||||
|
@ -1200,6 +1201,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
|
||||
return val;
|
||||
}
|
||||
#endregion
|
||||
|
||||
static setAnim = function(anim) {
|
||||
is_anim = anim;
|
||||
|
@ -1291,6 +1293,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
return array_length(ar);
|
||||
}
|
||||
|
||||
#region[#8fde5d16] === SetValue ===
|
||||
static setValue = function(val = 0, record = true, time = PROJECT.animator.current_frame, _update = true) {
|
||||
//if(type == VALUE_TYPE.d3vertex && !is_array(val))
|
||||
// print(val);
|
||||
|
@ -1319,13 +1322,12 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
var _val = variable_clone(animator.getValue(time));
|
||||
_val[index] = val;
|
||||
updated = animator.setValue(_val, connect_type == JUNCTION_CONNECT.input && record, time);
|
||||
} else
|
||||
} else
|
||||
updated = animator.setValue(val, connect_type == JUNCTION_CONNECT.input && record, time);
|
||||
}
|
||||
|
||||
if(type == VALUE_TYPE.gradient) updated = true;
|
||||
if(display_type == VALUE_DISPLAY.palette) updated = true;
|
||||
if(display_type == VALUE_DISPLAY.transform) updated = true;
|
||||
|
||||
if(updated) {
|
||||
if(connect_type == JUNCTION_CONNECT.input) {
|
||||
|
@ -1345,6 +1347,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
|
||||
return updated;
|
||||
}
|
||||
#endregion
|
||||
|
||||
static isConnectable = function(_valueFrom, checkRecur = true, log = false) {
|
||||
if(_valueFrom == -1 || _valueFrom == undefined || _valueFrom == noone) {
|
||||
|
@ -1861,6 +1864,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
DRAGGING.from = self;
|
||||
}
|
||||
|
||||
#region[#88ffe916] === Save Load ===
|
||||
static serialize = function(scale = false, preset = false) {
|
||||
var _map = {};
|
||||
|
||||
|
@ -1952,7 +1956,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
if(_node == noone)
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
if(!ds_map_exists(PROJECT.nodeMap, _node)) {
|
||||
var txt = $"Node connect error : Node ID {_node} not found.";
|
||||
log_warning("LOAD", $"[Connect] {txt}", node);
|
||||
|
@ -1977,6 +1981,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
log_warning("LOAD", $"[Connect] Connection conflict {node.name} to {_nd.name} : Output not exist.", node);
|
||||
return false;
|
||||
}
|
||||
#endregion
|
||||
|
||||
static destroy = function() {
|
||||
if(error_notification != noone) {
|
||||
|
|
Loading…
Reference in a new issue