mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-12-25 06:26:42 +01:00
[Armature] Detach bone tool now support bone re-attach.
This commit is contained in:
parent
aaa74eed52
commit
e785d29926
7 changed files with 44 additions and 26 deletions
|
@ -397,7 +397,7 @@ event_inherited();
|
|||
catagory_pane.scroll_color_bg = undefined;
|
||||
catagory_pane.scroll_color_bar_alpha = .5;
|
||||
|
||||
content_pane = new scrollPane(dialog_w - category_width - ui(34), dialog_h - ui(66), function(_y, _m) {
|
||||
content_pane = new scrollPane(dialog_w - category_width - ui(36), dialog_h - ui(66), function(_y, _m) {
|
||||
draw_clear_alpha(c_white, 0);
|
||||
|
||||
var _hover = sHOVER && content_pane.hover;
|
||||
|
@ -829,7 +829,7 @@ event_inherited();
|
|||
var _ch = dialog_h - ui(66);
|
||||
|
||||
catagory_pane.resize( category_width, _ch);
|
||||
content_pane.resize( dialog_w - category_width - ui(34), _ch);
|
||||
content_pane.resize( dialog_w - category_width - ui(36), _ch);
|
||||
search_pane.resize( dialog_w - ui(36), _ch);
|
||||
|
||||
PREFERENCES.dialog_add_node_w = dialog_w;
|
||||
|
|
|
@ -14,14 +14,14 @@ if !ready exit;
|
|||
var th = ui(32);
|
||||
var tx = dialog_x + ui(14);
|
||||
var ty = dialog_y + ui(14);
|
||||
var sy = ty + th + ui(6);
|
||||
var sy = ty + th + ui(6);
|
||||
|
||||
if(search_string == "") {
|
||||
catagory_pane.setFocusHover(sFOCUS, sHOVER);
|
||||
catagory_pane.draw(dialog_x + ui(8), sy);
|
||||
|
||||
var _x = dialog_x + category_width + ui(16);
|
||||
draw_sprite_stretched(THEME.ui_panel_bg, 1, _x, sy, dialog_w - category_width - ui(28), dialog_h - ui(66));
|
||||
draw_sprite_stretched(THEME.ui_panel_bg, 1, _x, sy, dialog_w - category_width - ui(30), dialog_h - ui(66));
|
||||
content_pane.setFocusHover(sFOCUS, sHOVER);
|
||||
content_pane.draw(_x, sy);
|
||||
|
||||
|
|
|
@ -293,32 +293,38 @@ function __3dTerrain() : __3dObject() constructor {
|
|||
vertex_normal( vb, _v0.nx, _v0.ny, _v0.nz);
|
||||
vertex_texcoord( vb, _v0.u, _v0.v);
|
||||
vertex_color( vb, _v0.color, _v0.alpha);
|
||||
vertex_float3( vb, 255, 0, 0);
|
||||
|
||||
vertex_position_3d(vb, _v1.x, _v1.y, _v1.z);
|
||||
vertex_normal( vb, _v1.nx, _v1.ny, _v1.nz);
|
||||
vertex_texcoord( vb, _v1.u, _v1.v);
|
||||
vertex_color( vb, _v1.color, _v1.alpha);
|
||||
vertex_float3( vb, 0, 255, 0);
|
||||
|
||||
vertex_position_3d(vb, _v2.x, _v2.y, _v2.z);
|
||||
vertex_normal( vb, _v2.nx, _v2.ny, _v2.nz);
|
||||
vertex_texcoord( vb, _v2.u, _v2.v);
|
||||
vertex_color( vb, _v2.color, _v2.alpha);
|
||||
vertex_float3( vb, 0, 0, 255);
|
||||
|
||||
|
||||
vertex_position_3d(vb, _v3.x, _v3.y, _v3.z);
|
||||
vertex_normal( vb, _v3.nx, _v3.ny, _v3.nz);
|
||||
vertex_texcoord( vb, _v3.u, _v3.v);
|
||||
vertex_color( vb, _v3.color, _v3.alpha);
|
||||
vertex_float3( vb, 255, 0, 0);
|
||||
|
||||
vertex_position_3d(vb, _v4.x, _v4.y, _v4.z);
|
||||
vertex_normal( vb, _v4.nx, _v4.ny, _v4.nz);
|
||||
vertex_texcoord( vb, _v4.u, _v4.v);
|
||||
vertex_color( vb, _v4.color, _v4.alpha);
|
||||
vertex_float3( vb, 0, 255, 0);
|
||||
|
||||
vertex_position_3d(vb, _v5.x, _v5.y, _v5.z);
|
||||
vertex_normal( vb, _v5.nx, _v5.ny, _v5.nz);
|
||||
vertex_texcoord( vb, _v5.u, _v5.v);
|
||||
vertex_color( vb, _v5.color, _v5.alpha);
|
||||
vertex_float3( vb, 0, 0, 255);
|
||||
|
||||
_in += 6;
|
||||
|
||||
|
@ -367,32 +373,38 @@ function __3dTerrain() : __3dObject() constructor {
|
|||
vertex_normal( vb, _v0.nx, _v0.ny, _v0.nz);
|
||||
vertex_texcoord( vb, _v0.u, _v0.v);
|
||||
vertex_color( vb, _v0.color, _v0.alpha);
|
||||
vertex_float3( vb, 255, 0, 0);
|
||||
|
||||
vertex_position_3d(vb, _v1.x, _v1.y, _v1.z);
|
||||
vertex_normal( vb, _v1.nx, _v1.ny, _v1.nz);
|
||||
vertex_texcoord( vb, _v1.u, _v1.v);
|
||||
vertex_color( vb, _v1.color, _v1.alpha);
|
||||
vertex_float3( vb, 0, 255, 0);
|
||||
|
||||
vertex_position_3d(vb, _v2.x, _v2.y, _v2.z);
|
||||
vertex_normal( vb, _v2.nx, _v2.ny, _v2.nz);
|
||||
vertex_texcoord( vb, _v2.u, _v2.v);
|
||||
vertex_color( vb, _v2.color, _v2.alpha);
|
||||
vertex_float3( vb, 0, 0, 255);
|
||||
|
||||
|
||||
vertex_position_3d(vb, _v3.x, _v3.y, _v3.z);
|
||||
vertex_normal( vb, _v3.nx, _v3.ny, _v3.nz);
|
||||
vertex_texcoord( vb, _v3.u, _v3.v);
|
||||
vertex_color( vb, _v3.color, _v3.alpha);
|
||||
vertex_float3( vb, 255, 0, 0);
|
||||
|
||||
vertex_position_3d(vb, _v4.x, _v4.y, _v4.z);
|
||||
vertex_normal( vb, _v4.nx, _v4.ny, _v4.nz);
|
||||
vertex_texcoord( vb, _v4.u, _v4.v);
|
||||
vertex_color( vb, _v4.color, _v4.alpha);
|
||||
vertex_float3( vb, 0, 255, 0);
|
||||
|
||||
vertex_position_3d(vb, _v5.x, _v5.y, _v5.z);
|
||||
vertex_normal( vb, _v5.nx, _v5.ny, _v5.nz);
|
||||
vertex_texcoord( vb, _v5.u, _v5.v);
|
||||
vertex_color( vb, _v5.color, _v5.alpha);
|
||||
vertex_float3( vb, 0, 0, 255);
|
||||
|
||||
_in += 6;
|
||||
|
||||
|
|
|
@ -343,21 +343,24 @@ function Node_Armature(_x, _y, _group = noone) : Node(_x, _y, _group) constructo
|
|||
builder_bone.direction = dir;
|
||||
builder_bone.distance = dis;
|
||||
|
||||
if(builder_bone.parent) {
|
||||
var par_anc = builder_bone.parent.getTail();
|
||||
var par_ancx = _x + par_anc.x * _s;
|
||||
var par_ancy = _y + par_anc.y * _s;
|
||||
|
||||
var inRange = point_in_circle(_mx, _my, par_ancx, par_ancy, 16) && mouse_release(mb_left);
|
||||
if(!builder_bone.parent.is_main && builder_bone.IKlength > 0 && inRange)
|
||||
builder_bone.parent_anchor = true;
|
||||
|
||||
}
|
||||
|
||||
orig = builder_bone.getHead();
|
||||
var _rx = _x + _s * orig.x;
|
||||
var _ry = _y + _s * orig.y;
|
||||
draw_sprite_ext(s_bone_move, 0, _rx, _ry, 1, 1, 0, COLORS._main_value_positive, 1);
|
||||
var cc = COLORS._main_value_positive;
|
||||
|
||||
if(isUsingTool("Detach bones") && builder_bone.parent) { // re-attach
|
||||
var par_anc = builder_bone.parent.getTail();
|
||||
var pardist = point_distance(orig.x, orig.y, par_anc.x, par_anc.y) * _s;
|
||||
var inRange = pardist < 8 && !builder_bone.parent.is_main;
|
||||
|
||||
if(inRange) {
|
||||
cc = COLORS._main_accent;
|
||||
if(mouse_release(mb_left))
|
||||
builder_bone.parent_anchor = true;
|
||||
}
|
||||
}
|
||||
|
||||
draw_sprite_ext(s_bone_move, 0, _rx, _ry, 1, 1, 0, cc, 1);
|
||||
|
||||
} else if(builder_type == 1) {
|
||||
builder_bone.angle = dir;
|
||||
|
|
|
@ -1105,9 +1105,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
var yy = -gr_ls - 1, ys = safe_mod(gr_y, gr_ls);
|
||||
|
||||
draw_set_color(project.graphGrid.color);
|
||||
var aa = 0.5;
|
||||
if(graph_s < 0.25)
|
||||
aa = 0.3;
|
||||
var aa = graph_s < 0.25? .3 : .5;
|
||||
var oa = project.graphGrid.opacity;
|
||||
var ori = project.graphGrid.show_origin;
|
||||
var hig = project.graphGrid.highlight;
|
||||
|
@ -1115,18 +1113,21 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
while(xx < w + gr_ls) {
|
||||
draw_set_alpha( oa * aa * (1 + (round((xx + xs - gr_x) / gr_ls) % hig == 0) * 2) );
|
||||
draw_line(xx + xs, 0, xx + xs, h);
|
||||
|
||||
if(ori && xx + xs - gr_x == 0) draw_line_width(xx + xs, 0, xx + xs, h, 3);
|
||||
xx += gr_ls;
|
||||
}
|
||||
|
||||
while(yy < h + gr_ls) {
|
||||
draw_set_alpha( oa * aa * (1 + (round((yy + ys - gr_y) / gr_ls) % hig == 0) * 2) );
|
||||
draw_line(0, yy + ys, w, yy + ys);
|
||||
|
||||
if(ori && yy + ys - gr_y == 0) draw_line_width(0, yy + ys, w, yy + ys, 3);
|
||||
yy += gr_ls;
|
||||
}
|
||||
|
||||
draw_set_alpha(.2);
|
||||
if(ori) {
|
||||
draw_line(gr_x, 0, gr_x, h);
|
||||
draw_line(0, gr_y, w, gr_y);
|
||||
}
|
||||
|
||||
draw_set_alpha(1);
|
||||
}
|
||||
|
||||
|
|
|
@ -1260,7 +1260,6 @@ function Panel_Preview() : PanelContent() constructor {
|
|||
#region draw
|
||||
d3_scene_preview.reset();
|
||||
gpu_set_cullmode(d3_scene_preview.cull_mode);
|
||||
// gpu_set_cullmode(cull_counterclockwise);
|
||||
|
||||
var _prev_obj = _node.getPreviewObjects();
|
||||
|
||||
|
|
|
@ -184,13 +184,16 @@ uniform int use_8bit;
|
|||
|
||||
vec4 wireframeCalc(in vec4 baseColr) {
|
||||
vec3 bc_width = fwidth(v_barycentric);
|
||||
vec3 aa_width = wireframe_aa == 1? smoothstep(bc_width * wireframe_width * .9, bc_width * wireframe_width, v_barycentric) :
|
||||
step(bc_width * wireframe_width, v_barycentric);
|
||||
vec3 baryWidth = bc_width * wireframe_width;
|
||||
|
||||
vec3 aa_width = wireframe_aa == 1? smoothstep(baryWidth * .9, baryWidth, v_barycentric) :
|
||||
step(baryWidth, v_barycentric);
|
||||
|
||||
float edge_factor = 1. - min(aa_width.r, min(aa_width.g, aa_width.b));
|
||||
vec4 baseColor = wireframe_only == 1? vec4(0.) : baseColr;
|
||||
vec4 mixed_color = mix(baseColor, wireframe_color, edge_factor * wireframe_color.a);
|
||||
|
||||
mixed_color.a *= baseColr.a;
|
||||
return mixed_color;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue