mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-12-24 22:16:17 +01:00
Project bind grid
This commit is contained in:
parent
6595ae4898
commit
1d282222ca
23 changed files with 237 additions and 189 deletions
Binary file not shown.
|
@ -10,18 +10,22 @@ event_inherited();
|
|||
|
||||
#region data
|
||||
cb_enable = new checkBox(function(str) {
|
||||
PANEL_GRAPH.node_drag_snap = !PANEL_GRAPH.node_drag_snap;
|
||||
if(PANEL_GRAPH.project == noone || !PANEL_GRAPH.project.active) return;
|
||||
PANEL_GRAPH.project.graphGrid.snap = !PANEL_GRAPH.project.graphGrid.snap;
|
||||
})
|
||||
|
||||
tb_size = new textBox(TEXTBOX_INPUT.number, function(str) {
|
||||
PANEL_GRAPH.graph_line_s = max(1, real(str));
|
||||
if(PANEL_GRAPH.project == noone || !PANEL_GRAPH.project.active) return;
|
||||
PANEL_GRAPH.project.graphGrid.size = max(1, real(str));
|
||||
})
|
||||
|
||||
sl_opacity = new slider(0, 1, .05, function(str) {
|
||||
PANEL_GRAPH.grid_opacity = clamp(real(str), 0, 1);
|
||||
if(PANEL_GRAPH.project == noone || !PANEL_GRAPH.project.active) return;
|
||||
PANEL_GRAPH.project.graphGrid.opacity = clamp(real(str), 0, 1);
|
||||
})
|
||||
|
||||
cl_color = new buttonColor(function(color) {
|
||||
PANEL_GRAPH.grid_color = color;
|
||||
if(PANEL_GRAPH.project == noone || !PANEL_GRAPH.project.active) return;
|
||||
PANEL_GRAPH.project.graphGrid.color = color;
|
||||
}, self);
|
||||
#endregion
|
|
@ -1,5 +1,7 @@
|
|||
/// @description init
|
||||
if !ready exit;
|
||||
if(PANEL_GRAPH.project == noone || !PANEL_GRAPH.project.active)
|
||||
instance_destroy();
|
||||
|
||||
#region base UI
|
||||
draw_sprite_stretched(THEME.dialog_bg, 0, dialog_x, dialog_y, dialog_w, dialog_h);
|
||||
|
@ -18,26 +20,26 @@ if !ready exit;
|
|||
cb_enable.register();
|
||||
draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text);
|
||||
draw_text(dialog_x + ui(32), yy, __txtx("grid_snap", "Snap to grid"));
|
||||
cb_enable.draw(dialog_x + dialog_w - ui(24) - ww / 2, yy, PANEL_GRAPH.node_drag_snap, mouse_ui,, fa_center, fa_center);
|
||||
cb_enable.draw(dialog_x + dialog_w - ui(24) - ww / 2, yy, PANEL_GRAPH.project.graphGrid.snap, mouse_ui,, fa_center, fa_center);
|
||||
|
||||
yy += ui(40);
|
||||
tb_size.setFocusHover(sFOCUS, sHOVER);
|
||||
tb_size.register();
|
||||
draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text);
|
||||
draw_text(dialog_x + ui(32), yy, __txtx("grid_size", "Grid size"));
|
||||
tb_size.draw(dialog_x + dialog_w - ui(24), yy, ww, TEXTBOX_HEIGHT, PANEL_GRAPH.graph_line_s, mouse_ui,, fa_right, fa_center);
|
||||
tb_size.draw(dialog_x + dialog_w - ui(24), yy, ww, TEXTBOX_HEIGHT, PANEL_GRAPH.project.graphGrid.size, mouse_ui,, fa_right, fa_center);
|
||||
|
||||
yy += ui(40);
|
||||
sl_opacity.setFocusHover(sFOCUS, sHOVER);
|
||||
sl_opacity.register();
|
||||
draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text);
|
||||
draw_text(dialog_x + ui(32), yy, __txtx("grid_opacity", "Grid opacity"));
|
||||
sl_opacity.draw(dialog_x + dialog_w - ui(24), yy, ww, TEXTBOX_HEIGHT, PANEL_GRAPH.grid_opacity, mouse_ui, ui(52), fa_right, fa_center);
|
||||
draw_text(dialog_x + ui(32), yy, __txtx("project.graphGrid.opacity", "Grid opacity"));
|
||||
sl_opacity.draw(dialog_x + dialog_w - ui(24), yy, ww, TEXTBOX_HEIGHT, PANEL_GRAPH.project.graphGrid.opacity, mouse_ui, ui(52), fa_right, fa_center);
|
||||
|
||||
yy += ui(40);
|
||||
cl_color.setFocusHover(sFOCUS, sHOVER);
|
||||
cl_color.register();
|
||||
draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text);
|
||||
draw_text(dialog_x + ui(32), yy, __txtx("grid_color", "Grid color"));
|
||||
cl_color.draw(dialog_x + dialog_w - ui(24) - ww, yy - TEXTBOX_HEIGHT / 2, ww, TEXTBOX_HEIGHT, PANEL_GRAPH.grid_color, mouse_ui);
|
||||
draw_text(dialog_x + ui(32), yy, __txtx("project.graphGrid.color", "Grid color"));
|
||||
cl_color.draw(dialog_x + dialog_w - ui(24) - ww, yy - TEXTBOX_HEIGHT / 2, ww, TEXTBOX_HEIGHT, PANEL_GRAPH.project.graphGrid.color, mouse_ui);
|
||||
#endregion
|
|
@ -10,26 +10,26 @@ event_inherited();
|
|||
|
||||
#region data
|
||||
cb_enable = new checkBox(function() {
|
||||
PANEL_PREVIEW.grid_show = !PANEL_PREVIEW.grid_show;
|
||||
PROJECT.previewGrid.show = !PROJECT.previewGrid.show;
|
||||
});
|
||||
|
||||
cb_snap = new checkBox(function() {
|
||||
PANEL_PREVIEW.grid_snap = !PANEL_PREVIEW.grid_snap;
|
||||
PROJECT.previewGrid.snap = !PROJECT.previewGrid.snap;
|
||||
});
|
||||
|
||||
tb_width = new textBox(TEXTBOX_INPUT.number, function(str) {
|
||||
PANEL_PREVIEW.grid_width = max(1, real(str));
|
||||
PROJECT.previewGrid.width = max(1, real(str));
|
||||
});
|
||||
|
||||
tb_height = new textBox(TEXTBOX_INPUT.number, function(str) {
|
||||
PANEL_PREVIEW.grid_height = max(1, real(str));
|
||||
PROJECT.previewGrid.height = max(1, real(str));
|
||||
});
|
||||
|
||||
sl_opacity = new slider(0, 1, .05, function(str) {
|
||||
PANEL_PREVIEW.grid_opacity = clamp(real(str), 0, 1);
|
||||
PROJECT.previewGrid.opacity = clamp(real(str), 0, 1);
|
||||
});
|
||||
|
||||
cl_color = new buttonColor(function(color) {
|
||||
PANEL_PREVIEW.grid_color = color;
|
||||
PROJECT.previewGrid.color = color;
|
||||
}, self);
|
||||
#endregion
|
|
@ -18,40 +18,40 @@ if !ready exit;
|
|||
cb_enable.register();
|
||||
draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text);
|
||||
draw_text(dialog_x + ui(32), yy, __txt("Enabled"));
|
||||
cb_enable.draw(dialog_x + dialog_w - ui(24) - ww / 2, yy, PANEL_PREVIEW.grid_show, mouse_ui,, fa_center, fa_center);
|
||||
cb_enable.draw(dialog_x + dialog_w - ui(24) - ww / 2, yy, PROJECT.previewGrid.show, mouse_ui,, fa_center, fa_center);
|
||||
|
||||
yy += ui(40);
|
||||
cb_snap.setFocusHover(sFOCUS, sHOVER);
|
||||
cb_snap.register();
|
||||
draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text);
|
||||
draw_text(dialog_x + ui(32), yy, __txtx("grid_snap", "Snap to grid"));
|
||||
cb_snap.draw(dialog_x + dialog_w - ui(24) - ww / 2, yy, PANEL_PREVIEW.grid_snap, mouse_ui,, fa_center, fa_center);
|
||||
cb_snap.draw(dialog_x + dialog_w - ui(24) - ww / 2, yy, PROJECT.previewGrid.snap, mouse_ui,, fa_center, fa_center);
|
||||
|
||||
yy += ui(40);
|
||||
tb_width.setFocusHover(sFOCUS, sHOVER);
|
||||
tb_width.register();
|
||||
draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text);
|
||||
draw_text(dialog_x + ui(32), yy, __txt("Grid width"));
|
||||
tb_width.draw(dialog_x + dialog_w - ui(24), yy, ww, TEXTBOX_HEIGHT, PANEL_PREVIEW.grid_width, mouse_ui,, fa_right, fa_center);
|
||||
tb_width.draw(dialog_x + dialog_w - ui(24), yy, ww, TEXTBOX_HEIGHT, PROJECT.previewGrid.width, mouse_ui,, fa_right, fa_center);
|
||||
|
||||
yy += ui(40);
|
||||
tb_height.setFocusHover(sFOCUS, sHOVER);
|
||||
tb_height.register();
|
||||
draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text);
|
||||
draw_text(dialog_x + ui(32), yy, __txt("Grid height"));
|
||||
tb_height.draw(dialog_x + dialog_w - ui(24), yy, ww, TEXTBOX_HEIGHT, PANEL_PREVIEW.grid_height, mouse_ui,, fa_right, fa_center);
|
||||
tb_height.draw(dialog_x + dialog_w - ui(24), yy, ww, TEXTBOX_HEIGHT, PROJECT.previewGrid.height, mouse_ui,, fa_right, fa_center);
|
||||
|
||||
yy += ui(40);
|
||||
sl_opacity.setFocusHover(sFOCUS, sHOVER);
|
||||
sl_opacity.register();
|
||||
draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text);
|
||||
draw_text(dialog_x + ui(32), yy, __txt("Grid opacity"));
|
||||
sl_opacity.draw(dialog_x + dialog_w - ui(24), yy, ww, TEXTBOX_HEIGHT, PANEL_PREVIEW.grid_opacity, mouse_ui, ui(52), fa_right, fa_center);
|
||||
sl_opacity.draw(dialog_x + dialog_w - ui(24), yy, ww, TEXTBOX_HEIGHT, PROJECT.previewGrid.opacity, mouse_ui, ui(52), fa_right, fa_center);
|
||||
|
||||
yy += ui(40);
|
||||
cl_color.setFocusHover(sFOCUS, sHOVER);
|
||||
cl_color.register();
|
||||
draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text);
|
||||
draw_text(dialog_x + ui(32), yy, __txt("Grid Color"));
|
||||
cl_color.draw(dialog_x + dialog_w - ui(24) - ww, yy - TEXTBOX_HEIGHT / 2, ww, TEXTBOX_HEIGHT, PANEL_PREVIEW.grid_color, mouse_ui);
|
||||
cl_color.draw(dialog_x + dialog_w - ui(24) - ww, yy - TEXTBOX_HEIGHT / 2, ww, TEXTBOX_HEIGHT, PROJECT.previewGrid.color, mouse_ui);
|
||||
#endregion
|
|
@ -14,6 +14,9 @@ function __Bone(parent = noone, distance = 0, direction = 0, angle = 0, length =
|
|||
pose_local_scale = 1;
|
||||
pose_local_posit = [ 0, 0 ];
|
||||
|
||||
apply_scale = true;
|
||||
apply_rotation = true;
|
||||
|
||||
self.is_main = false;
|
||||
self.parent_anchor = true;
|
||||
self.childs = [];
|
||||
|
@ -161,12 +164,12 @@ function __Bone(parent = noone, distance = 0, direction = 0, angle = 0, length =
|
|||
draw_line_width2(_ppx, _ppy, p1.x, p1.y, 12 * pose_scale, 2 * pose_scale);
|
||||
|
||||
if((edit & 0b100) && distance_to_line(_mx, _my, p0.x, p0.y, p1.x, p1.y) <= 12) //drag bone
|
||||
hover = [ self, 2 ];
|
||||
hover = [ self, 2, p0 ];
|
||||
} else if(attributes.display_bone == 1) {
|
||||
draw_line_width(p0.x, p0.y, p1.x, p1.y, 3);
|
||||
|
||||
if((edit & 0b100) && distance_to_line(_mx, _my, p0.x, p0.y, p1.x, p1.y) <= 6) //drag bone
|
||||
hover = [ self, 2 ];
|
||||
hover = [ self, 2, p0 ];
|
||||
}
|
||||
} else {
|
||||
draw_set_color(c_white);
|
||||
|
@ -180,7 +183,7 @@ function __Bone(parent = noone, distance = 0, direction = 0, angle = 0, length =
|
|||
draw_sprite_ui(THEME.preview_bone_IK, 0, p0.x, p0.y,,,, c_white, draw_get_alpha());
|
||||
|
||||
if((edit & 0b100) && point_in_circle(_mx, _my, p0.x, p0.y, 24))
|
||||
hover = [ self, 2 ];
|
||||
hover = [ self, 2, p0 ];
|
||||
}
|
||||
draw_set_alpha(1.00);
|
||||
|
||||
|
@ -199,13 +202,13 @@ function __Bone(parent = noone, distance = 0, direction = 0, angle = 0, length =
|
|||
control_i0 = (hovering != noone && hovering[0] == self && hovering[1] == 0)? 0 : 2;
|
||||
|
||||
if((edit & 0b001) && point_in_circle(_mx, _my, p0.x, p0.y, ui(16))) //drag head
|
||||
hover = [ self, 0 ];
|
||||
hover = [ self, 0, p0 ];
|
||||
}
|
||||
|
||||
control_i1 = (hovering != noone && hovering[0] == self && hovering[1] == 1)? 0 : 2;
|
||||
|
||||
if((edit & 0b010) && point_in_circle(_mx, _my, p1.x, p1.y, ui(16))) //drag tail
|
||||
hover = [ self, 1 ];
|
||||
hover = [ self, 1, p1 ];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -263,8 +266,8 @@ function __Bone(parent = noone, distance = 0, direction = 0, angle = 0, length =
|
|||
|
||||
pose_posit[0] += _position[0];
|
||||
pose_posit[1] += _position[1];
|
||||
pose_angle += _angle;
|
||||
pose_scale *= _scale;
|
||||
if(apply_rotation) pose_angle += _angle;
|
||||
if(apply_scale) pose_scale *= _scale;
|
||||
|
||||
var _x = lengthdir_x(distance, direction) + pose_posit[0];
|
||||
var _y = lengthdir_y(distance, direction) + pose_posit[1];
|
||||
|
@ -450,6 +453,9 @@ function __Bone(parent = noone, distance = 0, direction = 0, angle = 0, length =
|
|||
bone.IKlength = IKlength;
|
||||
bone.IKTarget = IKTarget == noone? "" : IKTarget.ID;
|
||||
|
||||
bone.apply_rotation = apply_rotation;
|
||||
bone.apply_scale = apply_scale;
|
||||
|
||||
bone.childs = [];
|
||||
for( var i = 0, n = array_length(childs); i < n; i++ )
|
||||
bone.childs[i] = childs[i].serialize();
|
||||
|
@ -473,6 +479,9 @@ function __Bone(parent = noone, distance = 0, direction = 0, angle = 0, length =
|
|||
IKlength = bone.IKlength;
|
||||
IKTarget = bone.IKTarget;
|
||||
|
||||
apply_rotation = bone.apply_rotation;
|
||||
apply_scale = bone.apply_scale;
|
||||
|
||||
childs = [];
|
||||
for( var i = 0, n = array_length(bone.childs); i < n; i++ ) {
|
||||
var _b = new __Bone().deserialize(bone.childs[i], node);
|
||||
|
@ -494,13 +503,17 @@ function __Bone(parent = noone, distance = 0, direction = 0, angle = 0, length =
|
|||
|
||||
static clone = function() {
|
||||
var _b = new __Bone(parent, distance, direction, angle, length);
|
||||
_b.ID = ID;
|
||||
_b.name = name;
|
||||
_b.is_main = is_main;
|
||||
_b.ID = ID;
|
||||
_b.name = name;
|
||||
_b.is_main = is_main;
|
||||
_b.parent_anchor = parent_anchor;
|
||||
|
||||
_b.IKlength = IKlength;
|
||||
_b.IKTarget = IKTarget == noone? "" : IKTarget.ID;
|
||||
|
||||
_b.apply_rotation = apply_rotation;
|
||||
_b.apply_scale = apply_scale;
|
||||
|
||||
for( var i = 0, n = array_length(childs); i < n; i++ )
|
||||
_b.addChild(childs[i].clone());
|
||||
|
||||
|
|
|
@ -32,6 +32,23 @@
|
|||
|
||||
globalNode = new Node_Global();
|
||||
|
||||
previewGrid = {
|
||||
show : false,
|
||||
snap : false,
|
||||
width : 16,
|
||||
height : 16,
|
||||
opacity : 0.5,
|
||||
color : COLORS.panel_preview_grid,
|
||||
}
|
||||
|
||||
graphGrid = {
|
||||
show : true,
|
||||
snap : true,
|
||||
size : 32,
|
||||
opacity : 0.05,
|
||||
color : c_white,
|
||||
}
|
||||
|
||||
addons = {};
|
||||
|
||||
onion_skin = {
|
||||
|
@ -93,7 +110,7 @@
|
|||
globalvar VERSION, SAVE_VERSION, VERSION_STRING, BUILD_NUMBER;
|
||||
|
||||
VERSION = 11482;
|
||||
SAVE_VERSION = 11480;
|
||||
SAVE_VERSION = 11481;
|
||||
VERSION_STRING = "1.15rc2";
|
||||
BUILD_NUMBER = 11482;
|
||||
|
||||
|
|
|
@ -124,9 +124,14 @@ function __LOAD_PATH(path, readonly = false, safe_mode = false, override = false
|
|||
log_warning("LOAD, animator", exception_print(e));
|
||||
}
|
||||
|
||||
if(struct_has(_load_content, "onion_skin")) {
|
||||
if(struct_has(_load_content, "onion_skin"))
|
||||
PROJECT.onion_skin = _load_content.onion_skin;
|
||||
}
|
||||
|
||||
if(struct_has(_load_content, "previewGrid"))
|
||||
PROJECT.previewGrid = _load_content.previewGrid;
|
||||
|
||||
if(struct_has(_load_content, "graphGrid"))
|
||||
PROJECT.graphGrid = _load_content.graphGrid;
|
||||
|
||||
try {
|
||||
if(struct_has(_load_content, "metadata"))
|
||||
|
|
|
@ -69,10 +69,19 @@ function Node_Armature(_x, _y, _group = noone) : Node(_x, _y, _group) constructo
|
|||
bone_remove = bone;
|
||||
} else
|
||||
draw_sprite_ui_uniform(THEME.icon_delete, 3, bx, by, 1, COLORS._main_icon);
|
||||
|
||||
|
||||
draw_set_font(f_p2);
|
||||
var ww = string_width(bone.name);
|
||||
|
||||
bone.tb_name.setFocusHover(_focus, _hover);
|
||||
bone.tb_name.draw(__x + 24, ty + 3, __w - 24 - 40, _hh - 6, bone.name, _m);
|
||||
|
||||
bone.tb_name.draw(__x + 24, ty + 3, ww + 16, _hh - 6, bone.name, _m);
|
||||
|
||||
var _x0 = __x + 24 + ww + 32;
|
||||
draw_sprite_ui(THEME.bone, 3, _x0, ty + 14,,,, COLORS._main_icon, 0.5);
|
||||
|
||||
_x0 += 20;
|
||||
draw_sprite_ui(THEME.bone, 4, _x0, ty + 14,,,, COLORS._main_icon, 0.5);
|
||||
|
||||
ty += _hh;
|
||||
|
||||
draw_set_color(COLORS.node_composite_separator);
|
||||
|
@ -164,17 +173,20 @@ function Node_Armature(_x, _y, _group = noone) : Node(_x, _y, _group) constructo
|
|||
var mx = (_mx - _x) / _s;
|
||||
var my = (_my - _y) / _s;
|
||||
|
||||
var smx = value_snap(mx, _snx);
|
||||
var smy = value_snap(my, _sny);
|
||||
|
||||
var _b = attributes.bones;
|
||||
|
||||
if(builder_bone != noone) {
|
||||
anchor_selecting = _b.draw(attributes, false, _x, _y, _s, _mx, _my, anchor_selecting);
|
||||
|
||||
var dir = point_direction(builder_sx, builder_sy, mx, my);
|
||||
var dis = point_distance(builder_sx, builder_sy, mx, my);
|
||||
var dir = point_direction(builder_sx, builder_sy, smx, smy);
|
||||
var dis = point_distance(builder_sx, builder_sy, smx, smy);
|
||||
|
||||
if(builder_type == 2) {
|
||||
var bx = builder_sx + (mx - builder_mx);
|
||||
var by = builder_sy + (my - builder_my);
|
||||
var bx = builder_sx + (smx - builder_mx);
|
||||
var by = builder_sy + (smy - builder_my);
|
||||
|
||||
if(!builder_bone.parent_anchor) {
|
||||
builder_bone.direction = point_direction(0, 0, bx, by);
|
||||
|
@ -390,16 +402,16 @@ function Node_Armature(_x, _y, _group = noone) : Node(_x, _y, _group) constructo
|
|||
|
||||
if(mouse_press(mb_left, active)) {
|
||||
if(anchor_selecting == noone) {
|
||||
builder_bone = createBone(attributes.bones, point_distance(0, 0, mx, my), point_direction(0, 0, mx, my));
|
||||
builder_bone = createBone(attributes.bones, point_distance(0, 0, smx, smy), point_direction(0, 0, smx, smy));
|
||||
builder_type = 1;
|
||||
builder_sx = mx;
|
||||
builder_sy = my;
|
||||
builder_sx = smx;
|
||||
builder_sy = smy;
|
||||
UNDO_HOLDING = true;
|
||||
} else if(anchor_selecting[1] == 1) {
|
||||
builder_bone = createBone(anchor_selecting[0], 0, 0);
|
||||
builder_type = 1;
|
||||
builder_sx = mx;
|
||||
builder_sy = my;
|
||||
builder_sx = smx;
|
||||
builder_sy = smy;
|
||||
UNDO_HOLDING = true;
|
||||
} else if(anchor_selecting[1] == 2) {
|
||||
var _pr = anchor_selecting[0];
|
||||
|
|
|
@ -29,9 +29,6 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
|
|||
attribute_surface_depth();
|
||||
attribute_interpolation();
|
||||
|
||||
input_fix_len = ds_list_size(inputs);
|
||||
data_length = 2;
|
||||
|
||||
attributes.layer_visible = [];
|
||||
attributes.layer_selectable = [];
|
||||
|
||||
|
@ -383,8 +380,10 @@ 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);
|
||||
|
||||
array_push(input_display_list, index + 0);
|
||||
array_push(input_display_list, index + 1);
|
||||
inputs[| index + 2] = nodeValue("Inherit Rotation", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true );
|
||||
|
||||
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);
|
||||
|
@ -393,6 +392,9 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
|
|||
#endregion
|
||||
}
|
||||
|
||||
input_fix_len = ds_list_size(inputs);
|
||||
data_length = 3;
|
||||
|
||||
if(!LOADING && !APPENDING) createNewSurface();
|
||||
|
||||
temp_surface = [ surface_create(1, 1), surface_create(1, 1) ];
|
||||
|
@ -452,8 +454,8 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
|
|||
ds_map_clear(boneMap);
|
||||
|
||||
var _b = inputs[| 1].getValue();
|
||||
if(_b == noone) return;
|
||||
bone = _b.clone();
|
||||
bone = _b;
|
||||
if(bone == noone) return;
|
||||
|
||||
var _bst = ds_stack_create();
|
||||
ds_stack_push(_bst, bone);
|
||||
|
@ -485,6 +487,12 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
|
|||
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;
|
||||
|
||||
|
@ -505,8 +513,8 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
|
|||
_bone = boneMap[? _bone];
|
||||
|
||||
if(drag_type == NODE_COMPOSE_DRAG.move) {
|
||||
var _dx = (_mx - dragging_mx) / _s;
|
||||
var _dy = (_my - dragging_my) / _s;
|
||||
var _dx = smx - dragging_mx;
|
||||
var _dy = smy - dragging_my;
|
||||
|
||||
var _p = point_rotate(_dx, _dy, 0, 0, -_bone.angle);
|
||||
|
||||
|
@ -527,7 +535,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 = _bone.angle + _tran[TRANSFORM.rot];
|
||||
var _rot = _ang * _bone.angle + _tran[TRANSFORM.rot];
|
||||
var _sw = surface_get_width(_surf);
|
||||
var _sh = surface_get_height(_surf);
|
||||
|
||||
|
@ -574,7 +582,10 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
|
|||
_bone = boneMap[? _bone];
|
||||
|
||||
var _tran = current_data[index + 1];
|
||||
var _rot = _bone.angle + _tran[TRANSFORM.rot];
|
||||
var _aang = current_data[index + 2];
|
||||
var _asca = current_data[index + 3];
|
||||
|
||||
var _rot = _aang * _bone.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] ];
|
||||
|
@ -684,8 +695,8 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
|
|||
drag_type = hovering_type;
|
||||
dragging_sx = _tran[TRANSFORM.pos_x];
|
||||
dragging_sy = _tran[TRANSFORM.pos_y];
|
||||
dragging_mx = _mx;
|
||||
dragging_my = _my;
|
||||
dragging_mx = mx;
|
||||
dragging_my = my;
|
||||
} else if(hovering_type == NODE_COMPOSE_DRAG.rotate) { //rot
|
||||
surf_dragging = hovering;
|
||||
drag_type = hovering_type;
|
||||
|
@ -708,14 +719,7 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
|
|||
#endregion
|
||||
}
|
||||
|
||||
bone_prev = noone;
|
||||
static step = function() {
|
||||
var _b = inputs[| 1].getValue();
|
||||
if(bone_prev != _b) {
|
||||
setBone();
|
||||
bone_prev = _b;
|
||||
}
|
||||
|
||||
var _dim_type = getSingleValue(1);
|
||||
inputs[| 2].setVisible(_dim_type == COMPOSE_OUTPUT_SCALING.constant);
|
||||
}
|
||||
|
@ -736,14 +740,10 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
|
|||
var _dsca = _data[4];
|
||||
var cDep = attrDepth();
|
||||
|
||||
if(bone == noone && _bone != noone) setBone();
|
||||
if(bone == noone) return _outSurf;
|
||||
setBone();
|
||||
|
||||
//////////////////////////////////////////
|
||||
|
||||
if(ds_map_size(boneMap) == 0)
|
||||
setBone();
|
||||
|
||||
overlay_w = _dim[0];
|
||||
overlay_h = _dim[1];
|
||||
|
||||
|
@ -782,7 +782,8 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
|
|||
_b = boneMap[? _b];
|
||||
|
||||
var _tran = use_data? _bind[i].transform : _data[datInd + 1];
|
||||
var _rot = _b.angle + _tran[TRANSFORM.rot];
|
||||
var _aang = _data[datInd + 2];
|
||||
var _rot = _aang * _b.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] ];
|
||||
|
@ -818,14 +819,24 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
|
|||
var _inputs = load_map.inputs;
|
||||
|
||||
var load_fix_len = input_fix_len;
|
||||
if(PROJECT.version < SAVE_VERSION) {
|
||||
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);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
for(var i = load_fix_len; i < array_length(_inputs); i += data_length)
|
||||
createNewSurface();
|
||||
repeat(amo) createNewSurface();
|
||||
}
|
||||
|
||||
static attributeSerialize = function() {
|
||||
|
|
|
@ -124,12 +124,15 @@ function Node_Armature_Pose(_x, _y, _group = noone) : Node(_x, _y, _group) const
|
|||
var mx = (_mx - _x) / _s;
|
||||
var my = (_my - _y) / _s;
|
||||
|
||||
var smx = value_snap(mx, _snx);
|
||||
var smy = value_snap(my, _sny);
|
||||
|
||||
if(posing_bone) {
|
||||
if(posing_type == 0 && posing_bone.parent) { //move
|
||||
var ang = posing_bone.parent.pose_angle;
|
||||
var pp = point_rotate(mx - posing_mx, my - posing_my, 0, 0, -ang);
|
||||
var bx = posing_sx + pp[0];
|
||||
var by = posing_sy + pp[1];
|
||||
var pp = point_rotate(smx - posing_mx, smy - posing_my, 0, 0, -ang);
|
||||
var bx = posing_sx + pp[0];
|
||||
var by = posing_sy + pp[1];
|
||||
|
||||
var val = posing_input.getValue();
|
||||
val[TRANSFORM.pos_x] = bx;
|
||||
|
@ -138,16 +141,14 @@ function Node_Armature_Pose(_x, _y, _group = noone) : Node(_x, _y, _group) const
|
|||
UNDO_HOLDING = true;
|
||||
|
||||
} else if(posing_type == 1) { //scale
|
||||
var ss = point_distance(posing_mx, posing_my, mx, my) / posing_sx;
|
||||
var ss = point_distance(posing_mx, posing_my, smx, smy) / posing_sx;
|
||||
var ori = posing_bone.getPoint(0);
|
||||
var ang = point_direction(ori.x, ori.y, mx, my);
|
||||
var rot = angle_difference(ang, posing_sz);
|
||||
posing_sz = ang;
|
||||
posing_sy += rot;
|
||||
var ang = point_direction(ori.x, ori.y, smx, smy);
|
||||
var rot = ang - posing_sy;
|
||||
|
||||
var val = posing_input.getValue();
|
||||
val[TRANSFORM.sca_x] = ss;
|
||||
val[TRANSFORM.rot] = posing_sy;
|
||||
val[TRANSFORM.rot] = rot;
|
||||
if(posing_input.setValue(val))
|
||||
UNDO_HOLDING = true;
|
||||
|
||||
|
@ -184,8 +185,9 @@ function Node_Armature_Pose(_x, _y, _group = noone) : Node(_x, _y, _group) const
|
|||
posing_sx = val[TRANSFORM.pos_x];
|
||||
posing_sy = val[TRANSFORM.pos_y];
|
||||
|
||||
posing_mx = mx;
|
||||
posing_my = my;
|
||||
var _p = anchor_selecting[2];
|
||||
posing_mx = (_p.x - _x) / _s;
|
||||
posing_my = (_p.y - _y) / _s;
|
||||
|
||||
} else if(anchor_selecting[1] == 1) { // scale
|
||||
posing_bone = anchor_selecting[0];
|
||||
|
@ -197,8 +199,8 @@ function Node_Armature_Pose(_x, _y, _group = noone) : Node(_x, _y, _group) const
|
|||
var ori = posing_bone.getPoint(0);
|
||||
var val = posing_input.getValue();
|
||||
posing_sx = posing_bone.length / posing_bone.pose_local_scale;
|
||||
posing_sy = val[TRANSFORM.rot];
|
||||
posing_sz = point_direction(ori.x, ori.y, mx, my);
|
||||
posing_sy = posing_bone.angle - posing_bone.pose_local_angle;
|
||||
posing_sz = point_direction(ori.x, ori.y, smx, smy);
|
||||
|
||||
var pnt = posing_bone.getPoint(0);
|
||||
posing_mx = pnt.x;
|
||||
|
@ -280,7 +282,9 @@ function Node_Armature_Pose(_x, _y, _group = noone) : Node(_x, _y, _group) const
|
|||
var maxx = -9999999;
|
||||
var maxy = -9999999;
|
||||
|
||||
var _b = attributes.bones;
|
||||
var _b = outputs[| 0].getValue();
|
||||
if(_b == noone) return BBOX().fromPoints(0, 0, 1, 1);
|
||||
|
||||
var _bst = ds_stack_create();
|
||||
ds_stack_push(_bst, _b);
|
||||
|
||||
|
@ -317,7 +321,7 @@ function Node_Armature_Pose(_x, _y, _group = noone) : Node(_x, _y, _group) const
|
|||
static doApplyDeserialize = function() {
|
||||
for( var i = input_fix_len; i < ds_list_size(inputs); i += data_length ) {
|
||||
var inp = inputs[| i];
|
||||
var idx = struct_try_get(inp.extra_data, bone_id);
|
||||
var idx = struct_try_get(inp.extra_data, "bone_id");
|
||||
|
||||
boneMap[? idx] = inp;
|
||||
}
|
||||
|
|
|
@ -30,6 +30,15 @@ function Node_Fluid_Render(_x, _y, _group = noone) : Node_Fluid(_x, _y, _group)
|
|||
|
||||
static onInspector2Update = function() { clearCache(); }
|
||||
|
||||
static step = function() {
|
||||
var _dim = inputs[| 1].getValue();
|
||||
var _outSurf = outputs[| 0].getValue();
|
||||
if(!is_surface(_outSurf)) {
|
||||
_outSurf = surface_create_valid(_dim[0], _dim[1], attrDepth());
|
||||
outputs[| 0].setValue(_outSurf);
|
||||
}
|
||||
}
|
||||
|
||||
static update = function(frame = PROJECT.animator.current_frame) {
|
||||
if(recoverCache() || !PROJECT.animator.is_playing)
|
||||
return;
|
||||
|
@ -49,20 +58,14 @@ function Node_Fluid_Render(_x, _y, _group = noone) : Node_Fluid(_x, _y, _group)
|
|||
if(!is_surface(fSurf)) return;
|
||||
outputs[| 1].setValue(_dom.sf_world);
|
||||
|
||||
surface_set_target(_outSurf);
|
||||
DRAW_CLEAR
|
||||
|
||||
BLEND_OVERRIDE;
|
||||
shader_set(sh_fd_visualize_colorize_glsl);
|
||||
surface_set_shader(_outSurf, sh_fd_visualize_colorize_glsl);
|
||||
gpu_set_texfilter(_int);
|
||||
draw_surface_stretched_safe(fSurf, 0, 0, _dim[0], _dim[1]);
|
||||
gpu_set_texfilter(false);
|
||||
shader_reset();
|
||||
BLEND_NORMAL;
|
||||
|
||||
if(_drw && is_surface(_dom.sf_world))
|
||||
draw_surface_stretched_safe(_dom.sf_world, 0, 0, _dim[0], _dim[1]);
|
||||
surface_reset_target();
|
||||
surface_reset_shader();
|
||||
|
||||
var frm = cacheCurrentFrame(_outSurf);
|
||||
}
|
||||
|
|
|
@ -1,12 +1,6 @@
|
|||
function Node_Posterize(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
|
||||
name = "Posterize";
|
||||
|
||||
uniform_colors = shader_get_uniform(sh_posterize, "colors");
|
||||
uniform_gamma = shader_get_uniform(sh_posterize, "gamma");
|
||||
|
||||
uniform_color = shader_get_uniform(sh_posterize_palette, "palette");
|
||||
uniform_key = shader_get_uniform(sh_posterize_palette, "keys");
|
||||
|
||||
inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
|
||||
|
||||
inputs[| 1] = nodeValue("Palette", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, DEF_PALETTE )
|
||||
|
@ -22,9 +16,11 @@ function Node_Posterize(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
|
|||
|
||||
inputs[| 5] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true);
|
||||
active_index = 5;
|
||||
|
||||
inputs[| 6] = nodeValue("Posterize alpha", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true);
|
||||
|
||||
input_display_list = [ 5,
|
||||
["Effect settings", false], 0, 2, 1,
|
||||
["Effect settings", false], 0, 2, 1, 6,
|
||||
["Auto color", false], 3, 4
|
||||
];
|
||||
|
||||
|
@ -43,6 +39,7 @@ function Node_Posterize(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
|
|||
static process_data = function(_outSurf, _data, _output_index, _array_index) {
|
||||
var _gra = _data[1];
|
||||
var _use_gra = _data[2];
|
||||
var _alp = _data[6];
|
||||
|
||||
if(_use_gra) {
|
||||
var _colors = array_create(array_length(_gra) * 4);
|
||||
|
@ -53,36 +50,24 @@ function Node_Posterize(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
|
|||
_colors[i * 4 + 3] = 1;
|
||||
}
|
||||
|
||||
surface_set_target(_outSurf);
|
||||
DRAW_CLEAR
|
||||
BLEND_OVERRIDE;
|
||||
|
||||
shader_set(sh_posterize_palette);
|
||||
shader_set_uniform_f_array_safe(uniform_color, _colors);
|
||||
shader_set_uniform_i(uniform_key, array_length(_gra));
|
||||
surface_set_shader(_outSurf, sh_posterize_palette);
|
||||
shader_set_f("palette", _colors);
|
||||
shader_set_i("keys", array_length(_gra));
|
||||
shader_set_i("alpha", _alp);
|
||||
|
||||
draw_surface_safe(_data[0], 0, 0);
|
||||
shader_reset();
|
||||
|
||||
BLEND_NORMAL;
|
||||
surface_reset_target();
|
||||
surface_reset_shader();
|
||||
} else {
|
||||
var _colors = _data[3];
|
||||
var _gamma = _data[4];
|
||||
|
||||
surface_set_target(_outSurf);
|
||||
DRAW_CLEAR
|
||||
BLEND_OVERRIDE;
|
||||
|
||||
shader_set(sh_posterize);
|
||||
shader_set_uniform_i(uniform_colors, _colors);
|
||||
shader_set_uniform_f(uniform_gamma, _gamma);
|
||||
surface_set_shader(_outSurf, sh_posterize);
|
||||
shader_set_i("colors", _colors);
|
||||
shader_set_f("gamma", _gamma);
|
||||
shader_set_i("alpha", _alp);
|
||||
|
||||
draw_surface_safe(_data[0], 0, 0);
|
||||
shader_reset();
|
||||
|
||||
BLEND_NORMAL;
|
||||
surface_reset_target();
|
||||
surface_reset_shader();
|
||||
}
|
||||
|
||||
return _outSurf;
|
||||
|
|
|
@ -227,7 +227,7 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor {
|
|||
addNodeObject(input, "Animation", s_node_image_animation, "Node_Image_Animated", [0, Node_create_Image_Animated],, "Load multiple images from your computer as animation.");
|
||||
addNodeObject(input, "Array to Anim", s_node_image_sequence_to_anim, "Node_Sequence_Anim", [1, Node_Sequence_Anim],, "Convert array of images into animation.");
|
||||
if(!DEMO) addNodeObject(input, "Export", s_node_export, "Node_Export", [0, Node_create_Export],, "Export image, image array to file, image sequence, animation.");
|
||||
|
||||
|
||||
ds_list_add(input, "Files");
|
||||
addNodeObject(input, "Text File In", s_node_text_file_read, "Node_Text_File_Read", [1, Node_Text_File_Read], ["txt"], "Load .txt in as text.").setVersion(1080);
|
||||
addNodeObject(input, "Text File Out", s_node_text_file_write, "Node_Text_File_Write", [1, Node_Text_File_Write], ["txt"], "Save text as a .txt file.").setVersion(1090);
|
||||
|
|
|
@ -14,9 +14,6 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
scale = [ 0.01, 0.02, 0.05, 0.10, 0.15, 0.20, 0.25, 0.33, 0.5, 0.65, 0.8, 1, 1.2, 1.35, 1.5, 2.0];
|
||||
graph_s = 1;
|
||||
graph_s_to = graph_s;
|
||||
graph_line_s = 32;
|
||||
grid_color = c_white;
|
||||
grid_opacity = 0.05;
|
||||
|
||||
graph_dragging_key = false;
|
||||
graph_zooming_key = false;
|
||||
|
@ -52,7 +49,6 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
node_drag_sy = 0;
|
||||
node_drag_ox = 0;
|
||||
node_drag_oy = 0;
|
||||
node_drag_snap = true;
|
||||
|
||||
selection_block = 0;
|
||||
nodes_select_list = ds_list_create();
|
||||
|
@ -286,8 +282,8 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
mouse_graph_x = m_x;
|
||||
mouse_graph_y = m_y;
|
||||
|
||||
mouse_grid_x = round(m_x / graph_line_s) * graph_line_s;
|
||||
mouse_grid_y = round(m_y / graph_line_s) * graph_line_s;
|
||||
mouse_grid_x = round(m_x / project.graphGrid.size) * project.graphGrid.size;
|
||||
mouse_grid_y = round(m_y / project.graphGrid.size) * project.graphGrid.size;
|
||||
}
|
||||
|
||||
function focusNode(_node) {
|
||||
|
@ -436,7 +432,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
}
|
||||
|
||||
function drawGrid() {
|
||||
var gls = graph_line_s;
|
||||
var gls = project.graphGrid.size;
|
||||
if(graph_s <= 0.15) gls *= 10;
|
||||
|
||||
var gr_x = graph_x * graph_s;
|
||||
|
@ -445,8 +441,8 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
var xx = -gr_ls, xs = safe_mod(gr_x, gr_ls);
|
||||
var yy = -gr_ls, ys = safe_mod(gr_y, gr_ls);
|
||||
|
||||
draw_set_color(grid_color);
|
||||
draw_set_alpha(grid_opacity * (graph_s >= 1? 1 : 0.5));
|
||||
draw_set_color(project.graphGrid.color);
|
||||
draw_set_alpha(project.graphGrid.opacity * (graph_s >= 1? 1 : 0.5));
|
||||
while(xx < w + gr_ls) {
|
||||
draw_line(xx + xs, 0, xx + xs, h);
|
||||
if(xx + xs - gr_x == 0)
|
||||
|
@ -851,9 +847,9 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
var nx = node_drag_sx + (mouse_graph_x - node_drag_mx);
|
||||
var ny = node_drag_sy + (mouse_graph_y - node_drag_my);
|
||||
|
||||
if(!key_mod_press(CTRL) && node_drag_snap) {
|
||||
nx = round(nx / graph_line_s) * graph_line_s;
|
||||
ny = round(ny / graph_line_s) * graph_line_s;
|
||||
if(!key_mod_press(CTRL) && project.graphGrid.snap) {
|
||||
nx = round(nx / project.graphGrid.size) * project.graphGrid.size;
|
||||
ny = round(ny / project.graphGrid.size) * project.graphGrid.size;
|
||||
}
|
||||
|
||||
node_dragging.move(nx, ny);
|
||||
|
@ -866,9 +862,9 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
var nx = node_drag_sx + (mouse_graph_x - node_drag_mx);
|
||||
var ny = node_drag_sy + (mouse_graph_y - node_drag_my);
|
||||
|
||||
if(!key_mod_press(CTRL) && node_drag_snap) {
|
||||
nx = round(nx / graph_line_s) * graph_line_s;
|
||||
ny = round(ny / graph_line_s) * graph_line_s;
|
||||
if(!key_mod_press(CTRL) && project.graphGrid.snap) {
|
||||
nx = round(nx / project.graphGrid.size) * project.graphGrid.size;
|
||||
ny = round(ny / project.graphGrid.size) * project.graphGrid.size;
|
||||
}
|
||||
|
||||
if(node_drag_ox == -1 || node_drag_oy == -1) {
|
||||
|
@ -883,9 +879,9 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
var _nx = _node.x + dx;
|
||||
var _ny = _node.y + dy;
|
||||
|
||||
if(!key_mod_press(CTRL) && node_drag_snap) {
|
||||
_nx = round(_nx / graph_line_s) * graph_line_s;
|
||||
_ny = round(_ny / graph_line_s) * graph_line_s;
|
||||
if(!key_mod_press(CTRL) && project.graphGrid.snap) {
|
||||
_nx = round(_nx / project.graphGrid.size) * project.graphGrid.size;
|
||||
_ny = round(_ny / project.graphGrid.size) * project.graphGrid.size;
|
||||
}
|
||||
|
||||
_node.move(_nx, _ny);
|
||||
|
@ -929,8 +925,8 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
}
|
||||
|
||||
if(DOUBLE_CLICK && junction_hovering != noone) {
|
||||
var _mx = round(mouse_graph_x / graph_line_s) * graph_line_s;
|
||||
var _my = round(mouse_graph_y / graph_line_s) * graph_line_s;
|
||||
var _mx = round(mouse_graph_x / project.graphGrid.size) * project.graphGrid.size;
|
||||
var _my = round(mouse_graph_y / project.graphGrid.size) * project.graphGrid.size;
|
||||
|
||||
var _pin = nodeBuild("Node_Pin", _mx, _my);
|
||||
_pin.inputs[| 0].setFrom(junction_hovering.value_from);
|
||||
|
|
|
@ -16,8 +16,8 @@ function Panel_Graph_Export_Image(targetPanel) : PanelContent() constructor {
|
|||
bgColor : COLORS.panel_bg_clear,
|
||||
|
||||
gridEnable : false,
|
||||
gridColor : targetPanel.grid_color,
|
||||
gridAlpha : targetPanel.grid_opacity,
|
||||
gridColor : targetPanel.project.graphGrid.color,
|
||||
gridAlpha : targetPanel.project.graphGrid.opacity,
|
||||
|
||||
borderPad : 0,
|
||||
borderColor : c_white,
|
||||
|
|
|
@ -114,13 +114,7 @@ function Panel_Menu() : PanelContent() constructor {
|
|||
[ s_menu_transparent, function() { PANEL_PREVIEW.canvas_bg = -1; } ],
|
||||
[ s_menu_white, function() { PANEL_PREVIEW.canvas_bg = c_white; } ],
|
||||
[ s_menu_black, function() { PANEL_PREVIEW.canvas_bg = c_black; } ],
|
||||
]),
|
||||
-1,
|
||||
menuItem(__txtx("panel_menu_show_grid", "Show Grid"), function() { PANEL_PREVIEW.grid_show = !PANEL_PREVIEW.grid_show; }, [ THEME.icon_grid, 1 ], ["Preview", "Toggle grid"]),
|
||||
menuItem(__txtx("panel_menu_grid_setting", "Grid setting..."), function() {
|
||||
var dia = dialogCall(o_dialog_preview_grid);
|
||||
dia.anchor = ANCHOR.none;
|
||||
}, THEME.icon_grid_setting),
|
||||
]),
|
||||
]],
|
||||
[ __txt("Animation"), [
|
||||
menuItem(__txtx("panel_menu_animation_setting", "Animation setting..."), function() {
|
||||
|
|
|
@ -51,14 +51,7 @@ function Panel_Preview() : PanelContent() constructor {
|
|||
preview_x_max = 0;
|
||||
preview_sequence = [ 0, 0 ];
|
||||
_preview_sequence = preview_sequence;
|
||||
preview_rate = 10;
|
||||
|
||||
grid_show = false;
|
||||
grid_snap = false;
|
||||
grid_width = 16;
|
||||
grid_height = 16;
|
||||
grid_opacity = 0.5;
|
||||
grid_color = COLORS.panel_preview_grid;
|
||||
preview_rate = 10;
|
||||
|
||||
tool_x = 0;
|
||||
tool_x_to = 0;
|
||||
|
@ -116,7 +109,7 @@ function Panel_Preview() : PanelContent() constructor {
|
|||
},
|
||||
function(data) {
|
||||
menuCall("preview_tile_menu", data.x + ui(28), data.y + ui(28), [
|
||||
menuItem(__txtx("panel_preview_tile_off", "Tile off"), function() { tileMode = 0; }),
|
||||
menuItem(__txtx("panel_preview_tile_off", "Tile off"), function() { tileMode = 0; }),
|
||||
menuItem(__txtx("panel_preview_tile_horizontal", "Tile horizontal"), function() { tileMode = 1; }),
|
||||
menuItem(__txtx("panel_preview_tile_vertical", "Tile vertical"), function() { tileMode = 2; }),
|
||||
menuItem(__txtx("panel_preview_tile_both", "Tile both"), function() { tileMode = 3; }),
|
||||
|
@ -163,7 +156,7 @@ function Panel_Preview() : PanelContent() constructor {
|
|||
addHotkey("Preview", "Save current frame", "S", MOD_KEY.shift, function() { PANEL_PREVIEW.saveCurrentFrame(); });
|
||||
addHotkey("Preview", "Save all current frame", -1, MOD_KEY.none, function() { PANEL_PREVIEW.saveAllCurrentFrames(); });
|
||||
addHotkey("Preview", "Preview window", "P", MOD_KEY.ctrl, function() { create_preview_window(PANEL_PREVIEW.getNodePreview()); });
|
||||
addHotkey("Preview", "Toggle grid", "G", MOD_KEY.ctrl, function() { PANEL_PREVIEW.grid_show = !PANEL_PREVIEW.grid_show; });
|
||||
addHotkey("Preview", "Toggle grid", "G", MOD_KEY.ctrl, function() { PROJECT.previewGrid.show = !PROJECT.previewGrid.show; });
|
||||
|
||||
addHotkey("Preview", "Pan", "", MOD_KEY.alt, function() {
|
||||
if(PREF_MAP[? "alt_picker"]) return;
|
||||
|
@ -203,8 +196,8 @@ function Panel_Preview() : PanelContent() constructor {
|
|||
|
||||
if(node == noone) continue;
|
||||
if(!node.active) {
|
||||
preview_node[i] = noone;
|
||||
continue;
|
||||
resetNodePreview();
|
||||
return;
|
||||
}
|
||||
|
||||
var _prev_val = node.getPreviewValue();
|
||||
|
@ -568,9 +561,9 @@ function Panel_Preview() : PanelContent() constructor {
|
|||
}
|
||||
|
||||
if(is_surface(preview_surface[0])) {
|
||||
if(grid_show) {
|
||||
var _gw = grid_width * canvas_s;
|
||||
var _gh = grid_height * canvas_s;
|
||||
if(PROJECT.previewGrid.show) {
|
||||
var _gw = PROJECT.previewGrid.width * canvas_s;
|
||||
var _gh = PROJECT.previewGrid.height * canvas_s;
|
||||
|
||||
var gw = floor(pswd / _gw);
|
||||
var gh = floor(pshd / _gh);
|
||||
|
@ -578,8 +571,8 @@ function Panel_Preview() : PanelContent() constructor {
|
|||
var cx = canvas_x;
|
||||
var cy = canvas_y;
|
||||
|
||||
draw_set_color(grid_color);
|
||||
draw_set_alpha(grid_opacity);
|
||||
draw_set_color(PROJECT.previewGrid.color);
|
||||
draw_set_alpha(PROJECT.previewGrid.opacity);
|
||||
|
||||
for( var i = 1; i < gw; i++ ) {
|
||||
var _xx = cx + i * _gw;
|
||||
|
@ -736,11 +729,11 @@ function Panel_Preview() : PanelContent() constructor {
|
|||
}
|
||||
|
||||
if(key_mod_press(CTRL)) {
|
||||
_snx = grid_show? grid_width : 1;
|
||||
_sny = grid_show? grid_height : 1;
|
||||
} else if(grid_snap) {
|
||||
_snx = grid_width;
|
||||
_sny = grid_height;
|
||||
_snx = PROJECT.previewGrid.show? PROJECT.previewGrid.width : 1;
|
||||
_sny = PROJECT.previewGrid.show? PROJECT.previewGrid.height : 1;
|
||||
} else if(PROJECT.previewGrid.snap) {
|
||||
_snx = PROJECT.previewGrid.width;
|
||||
_sny = PROJECT.previewGrid.height;
|
||||
}
|
||||
|
||||
var overlayHover = tool_hovering == noone;
|
||||
|
@ -1039,8 +1032,9 @@ function Panel_Preview() : PanelContent() constructor {
|
|||
if(inspect_node) {
|
||||
tool = inspect_node.getTool();
|
||||
if(tool) drawNodeTools(pFOCUS, tool);
|
||||
} else
|
||||
} else {
|
||||
tool_current = noone;
|
||||
}
|
||||
|
||||
if(do_fullView) {
|
||||
do_fullView = false;
|
||||
|
|
|
@ -13,7 +13,7 @@ function __nodeLeafList(_list) {
|
|||
var nodes = [];
|
||||
var nodeNames = [];
|
||||
|
||||
for( var i = 0; i < ds_list_size(_list); i++ ) {
|
||||
for( var i = 0, n = ds_list_size(_list); i < n; i++ ) {
|
||||
var _node = _list[| i];
|
||||
if(!_node.active) continue;
|
||||
if(!_node.isRenderActive()) continue;
|
||||
|
|
|
@ -36,6 +36,9 @@ function save_serialize(project = PROJECT) {
|
|||
_map.global_node = project.globalNode.serialize();
|
||||
_map.onion_skin = project.onion_skin;
|
||||
|
||||
_map.previewGrid = project.previewGrid;
|
||||
_map.graphGrid = project.graphGrid;
|
||||
|
||||
var prev = PANEL_PREVIEW.getNodePreviewSurface();
|
||||
if(!is_surface(prev)) _map.preview = "";
|
||||
else _map.preview = surface_encode(surface_size_lim(prev, 128, 128));
|
||||
|
|
|
@ -111,7 +111,7 @@ function shader_set_palette(pal, pal_uni = "palette", amo_uni = "paletteAmount",
|
|||
shader_set_f("sampleDimension", surface_get_width(surface), surface_get_height(surface));
|
||||
}
|
||||
|
||||
function surface_set_shader(surface, shader = sh_sample, clear = true, blend = BLEND.over) {
|
||||
function surface_set_shader(surface, shader = sh_sample, clear = true, blend = BLEND.alpha) {
|
||||
if(!is_surface(surface)) {
|
||||
__surface_set = false;
|
||||
return;
|
||||
|
|
|
@ -5,12 +5,15 @@ varying vec2 v_vTexcoord;
|
|||
varying vec4 v_vColour;
|
||||
|
||||
uniform int colors;
|
||||
uniform int alpha;
|
||||
uniform float gamma;
|
||||
|
||||
void main() {
|
||||
vec4 _col = texture2D( gm_BaseTexture, v_vTexcoord );
|
||||
vec3 c = _col.rgb;
|
||||
c = floor(pow(c, vec3(gamma)) * float(colors));
|
||||
c = pow(c / float(colors), vec3(1.0 / gamma));
|
||||
gl_FragColor = vec4(c, _col.a);
|
||||
vec4 c = _col;
|
||||
c = floor(pow(c, vec4(gamma)) * float(colors));
|
||||
c = pow(c / float(colors), vec4(1.0 / gamma));
|
||||
|
||||
if(alpha == 1) gl_FragColor = c;
|
||||
else gl_FragColor = vec4(c.rgb, _col.a);
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ varying vec4 v_vColour;
|
|||
|
||||
uniform vec4 palette[PALETTE_LIMIT];
|
||||
uniform int keys;
|
||||
uniform int alpha;
|
||||
|
||||
vec3 rgb2xyz( vec3 c ) {
|
||||
vec3 tmp;
|
||||
|
@ -43,13 +44,14 @@ float colorDifferent(in vec4 c1, in vec4 c2) {
|
|||
|
||||
void main() {
|
||||
vec4 _col = v_vColour * texture2D( gm_BaseTexture, v_vTexcoord );
|
||||
vec4 col = alpha == 1? _col * _col.a : _col;
|
||||
|
||||
int closet_index = 0;
|
||||
float closet_value = 99.;
|
||||
|
||||
for(int i = 0; i < keys; i++) {
|
||||
vec4 p_col = palette[i];
|
||||
float dif = colorDifferent(p_col, _col);
|
||||
float dif = colorDifferent(p_col, col);
|
||||
|
||||
if(dif < closet_value) {
|
||||
closet_value = dif;
|
||||
|
@ -58,5 +60,5 @@ void main() {
|
|||
}
|
||||
|
||||
gl_FragColor = palette[closet_index];
|
||||
gl_FragColor.a = _col.a;
|
||||
if(alpha == 0) gl_FragColor.a = _col.a;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue