diff --git a/PixelComposer.resource_order b/PixelComposer.resource_order index ecaedb9df..c566e4536 100644 --- a/PixelComposer.resource_order +++ b/PixelComposer.resource_order @@ -1135,6 +1135,7 @@ {"name":"node_scale_algo","order":12,"path":"scripts/node_scale_algo/node_scale_algo.yy",}, {"name":"s_node_image_replace","order":55,"path":"sprites/s_node_image_replace/s_node_image_replace.yy",}, {"name":"node_alpha_hash","order":11,"path":"scripts/node_alpha_hash/node_alpha_hash.yy",}, + {"name":"toggleGroup","order":31,"path":"scripts/toggleGroup/toggleGroup.yy",}, {"name":"mouse_input","order":1,"path":"scripts/mouse_input/mouse_input.yy",}, {"name":"string_cut","order":2,"path":"scripts/string_cut/string_cut.yy",}, {"name":"node_3d_prim_cylinder","order":2,"path":"scripts/node_3d_prim_cylinder/node_3d_prim_cylinder.yy",}, diff --git a/PixelComposer.yyp b/PixelComposer.yyp index 8b48fdd02..135c71ed9 100644 --- a/PixelComposer.yyp +++ b/PixelComposer.yyp @@ -1784,6 +1784,7 @@ {"id":{"name":"node_scale_algo","path":"scripts/node_scale_algo/node_scale_algo.yy",},}, {"id":{"name":"s_node_image_replace","path":"sprites/s_node_image_replace/s_node_image_replace.yy",},}, {"id":{"name":"node_alpha_hash","path":"scripts/node_alpha_hash/node_alpha_hash.yy",},}, + {"id":{"name":"toggleGroup","path":"scripts/toggleGroup/toggleGroup.yy",},}, {"id":{"name":"mouse_input","path":"scripts/mouse_input/mouse_input.yy",},}, {"id":{"name":"string_cut","path":"scripts/string_cut/string_cut.yy",},}, {"id":{"name":"node_3d_prim_cylinder","path":"scripts/node_3d_prim_cylinder/node_3d_prim_cylinder.yy",},}, diff --git a/objects/o_dialog_history/Create_0.gml b/objects/o_dialog_history/Create_0.gml index ed3cd88b2..c93a0b37e 100644 --- a/objects/o_dialog_history/Create_0.gml +++ b/objects/o_dialog_history/Create_0.gml @@ -111,7 +111,7 @@ event_inherited(); if(i < red) _yc = yy + ui(6); else _yc = yy + hh; - draw_sprite_ui(THEME.arrow, i < red? 3 : 1, ui(16), _yc, 1.5, 1.5, 0, cc, 1); + draw_sprite_ui(THEME.scroll_box_arrow, 0, ui(16), _yc, 1, 1 - (i > red) * 2, 0, cc, 1); BLEND_NORMAL; if(i == hovering) diff --git a/scripts/__bone/__bone.gml b/scripts/__bone/__bone.gml index 56fd813f7..978d6ca8a 100644 --- a/scripts/__bone/__bone.gml +++ b/scripts/__bone/__bone.gml @@ -7,6 +7,9 @@ function __Bone(parent = noone, distance = 0, direction = 0, angle = 0, length = self.length = length; self.node = node; + init_length = length; + init_angle = angle; + pose_angle = 0; pose_scale = 1; pose_posit = [ 0, 0 ]; @@ -95,22 +98,25 @@ function __Bone(parent = noone, distance = 0, direction = 0, angle = 0, length = return noone; } - static getPoint = function(progress) { - var len = length * progress; + static getPoint = function(progress, pose = true) { + var _len = pose? length : init_length; + var _ang = pose? angle : init_angle; + + var len = _len * progress; if(parent == noone) return new Point(lengthdir_x(distance, direction), lengthdir_y(distance, direction)) - .add(lengthdir_x(len, angle), lengthdir_y(len, angle)); + .add(lengthdir_x(len, _ang), lengthdir_y(len, _ang)); if(parent_anchor) { - var p = parent.getPoint(1) - .add(lengthdir_x(len, angle), lengthdir_y(len, angle)) + var p = parent.getPoint(1, pose) + .add(lengthdir_x(len, _ang), lengthdir_y(len, _ang)) return p; } - var p = parent.getPoint(0) + var p = parent.getPoint(0, pose) .add(lengthdir_x(distance, direction), lengthdir_y(distance, direction)) - .add(lengthdir_x(len, angle), lengthdir_y(len, angle)) + .add(lengthdir_x(len, _ang), lengthdir_y(len, _ang)) return p; } @@ -261,30 +267,28 @@ function __Bone(parent = noone, distance = 0, direction = 0, angle = 0, length = return; } - pose_local_angle = pose_angle; - pose_local_scale = pose_scale; - pose_local_posit = pose_posit; - pose_posit[0] += _position[0]; pose_posit[1] += _position[1]; if(apply_rotation) pose_angle += _angle; if(apply_scale) pose_scale *= _scale; + pose_local_angle = pose_angle; + pose_local_scale = pose_scale; + pose_local_posit = pose_posit; + var _x = lengthdir_x(distance, direction) + pose_posit[0]; var _y = lengthdir_y(distance, direction) + pose_posit[1]; direction = point_direction(0, 0, _x, _y) + _angle; distance = point_distance(0, 0, _x, _y) * _scale; + init_length = length; + init_angle = angle; angle += pose_angle; length *= pose_scale; - for( var i = 0, n = array_length(childs); i < n; i++ ) { - if(childs[i].parent_anchor) - childs[i].setPoseTransform(_position, pose_angle, pose_scale); - else - childs[i].setPoseTransform(_position, pose_angle, pose_scale); - } + for( var i = 0, n = array_length(childs); i < n; i++ ) + childs[i].setPoseTransform(_position, pose_angle, pose_scale); } static setIKconstrain = function() { diff --git a/scripts/button/button.gml b/scripts/button/button.gml index 0074ce3a5..20c49e6d0 100644 --- a/scripts/button/button.gml +++ b/scripts/button/button.gml @@ -16,7 +16,9 @@ function buttonClass(_onClick, _icon = noone) : widget() constructor { activate_on_press = false; clicked = false; - + + toggled = false; + static setLua = function(_lua_thread, _lua_key, _lua_func) { lua_thread = _lua_thread; lua_thread_key = _lua_key; @@ -70,7 +72,7 @@ function buttonClass(_onClick, _icon = noone) : widget() constructor { var b = colorMultiply(self.blend, blend); if(hover && point_in_rectangle(_m[0], _m[1], _x, _y, _x + _w, _y + _h)) { - draw_sprite_stretched_ext(spr, 1, _x, _y, _w, _h, b, 1); + draw_sprite_stretched_ext(spr, toggled? 2 : 1, _x, _y, _w, _h, b, 1); if(!activate_on_press && mouse_release(mb_left, active)) trigger(); if(activate_on_press && mouse_press(mb_left, active)) @@ -82,7 +84,7 @@ function buttonClass(_onClick, _icon = noone) : widget() constructor { } if(tooltip != "") TOOLTIP = tooltip; } else { - draw_sprite_stretched_ext(spr, 0, _x, _y, _w, _h, b, 1); + draw_sprite_stretched_ext(spr, toggled? 2 : 0, _x, _y, _w, _h, b, 1); if(mouse_press(mb_left)) deactivate(); } diff --git a/scripts/node_armature_bind/node_armature_bind.gml b/scripts/node_armature_bind/node_armature_bind.gml index 63f0ff1e2..ab81e604f 100644 --- a/scripts/node_armature_bind/node_armature_bind.gml +++ b/scripts/node_armature_bind/node_armature_bind.gml @@ -208,13 +208,13 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr draw_line(_x + 16, ly, _x + _w - 16, ly); layer_remove = -1; - var index = -1; + var index = amo; for(var i = 0; i < amo; i++) { var _inp = input_fix_len + (amo - i - 1) * data_length; var _surf = current_data[_inp]; - index++; + index--; var _bx = _x + _w - 24; var _cy = ly + index * (lh + 4); @@ -286,7 +286,7 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr 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_text(_sx1 + 12, _cy + lh / 2, inputs[| _inp].name); draw_set_alpha(1); if(_hover && point_in_rectangle(_m[0], _m[1], _x, _cy, _x + _w, _cy + lh)) { @@ -757,6 +757,11 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr static step = function() { var _dim_type = getSingleValue(1); inputs[| 2].setVisible(_dim_type == COMPOSE_OUTPUT_SCALING.constant); + + for( var i = input_fix_len, n = ds_list_size(inputs); i < n; i += data_length ) { + inputs[| i + 3].setVisible(current_data[i + 2]); + inputs[| i + 5].setVisible(current_data[i + 4]); + } } static process_data = function(_outSurf, _data, _output_index, _array_index) { diff --git a/scripts/node_armature_pose/node_armature_pose.gml b/scripts/node_armature_pose/node_armature_pose.gml index e91dd3776..5bc6d3a1b 100644 --- a/scripts/node_armature_pose/node_armature_pose.gml +++ b/scripts/node_armature_pose/node_armature_pose.gml @@ -219,7 +219,6 @@ function Node_Armature_Pose(_x, _y, _group = noone) : Node(_x, _y, _group) const posing_mx = mx; posing_my = my; - } } } diff --git a/scripts/node_data/node_data.gml b/scripts/node_data/node_data.gml index 2e40f63d6..533de15ab 100644 --- a/scripts/node_data/node_data.gml +++ b/scripts/node_data/node_data.gml @@ -1412,8 +1412,10 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x 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); + if(_pad_dyna > 0) + repeat(_pad_dyna) array_insert(load_map.inputs, _ind, noone); + else + array_delete(load_map.inputs, _ind + _pad_dyna, -_pad_dyna); } var _pad_fix = input_fix_len - _input_fix_len; diff --git a/scripts/node_value/node_value.gml b/scripts/node_value/node_value.gml index bb645d80b..ab441fb92 100644 --- a/scripts/node_value/node_value.gml +++ b/scripts/node_value/node_value.gml @@ -62,6 +62,7 @@ enum VALUE_DISPLAY { kernel, transform, corner, + toggle, //Curve curve, @@ -789,6 +790,14 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru extract_node = "Node_Transform_Array"; break; + case VALUE_DISPLAY.toggle : + editWidget = new toggleGroup(display_data, function(val) { + return setValueDirect(val); + } ); + + rejectConnect(); + extract_node = ""; + break; } break; case VALUE_TYPE.boolean : @@ -1305,12 +1314,6 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru static setValueDirect = function(val = 0, index = noone, record = true, time = PROJECT.animator.current_frame, _update = true) { var updated = false; - //if(display_type == VALUE_DISPLAY.area) { - // print($"===== Set: {index} = {val} ====="); - // printCallStack(); - // print(""); - //} - if(sep_axis) { if(index == noone) { for( var i = 0, n = array_length(animators); i < n; i++ ) diff --git a/scripts/panel_history/panel_history.gml b/scripts/panel_history/panel_history.gml index a0df32dac..c9d5a9a0d 100644 --- a/scripts/panel_history/panel_history.gml +++ b/scripts/panel_history/panel_history.gml @@ -110,7 +110,7 @@ function Panel_History() : PanelContent() constructor { if(i < red) _yc = yy + ui(6); else _yc = yy + hh; - draw_sprite_ui(THEME.arrow, i < red? 3 : 1, ui(16), _yc, 1.5, 1.5, 0, cc, 1); + draw_sprite_ui(THEME.scroll_box_arrow, 0, ui(16), _yc, 1, 1 - (i > red) * 2, 0, cc, 1); BLEND_NORMAL; if(i == hovering) @@ -151,7 +151,7 @@ function Panel_History() : PanelContent() constructor { hovering = -1; } - return _h; + return _h + ui(64); }) function drawContent(panel) { diff --git a/scripts/toggleGroup/toggleGroup.gml b/scripts/toggleGroup/toggleGroup.gml new file mode 100644 index 000000000..e894589e6 --- /dev/null +++ b/scripts/toggleGroup/toggleGroup.gml @@ -0,0 +1,68 @@ +function toggleGroup(_data, _onClick) : widget() constructor { + data = _data; + onClick = _onClick; + buttonSpr = [ THEME.button_left, THEME.button_middle, THEME.button_right ]; + font = f_p0; + fColor = COLORS._main_text; + value = 0; + + for(var i = 0; i < array_length(data); i++) + buttons[i] = button(-1); + + static trigger = function() {} + + static setInteract = function(interactable = noone) { + self.interactable = interactable; + for(var i = 0; i < array_length(data); i++) + buttons[i].interactable = interactable; + } + + static register = function(parent = noone) { + array_push(WIDGET_ACTIVE, self); + self.parent = parent; + } + + static drawParam = function(params) { + return draw(params.x, params.y, params.w, params.h, params.data, params.m, params.rx, params.ry); + } + + static draw = function(_x, _y, _w, _h, _data, _m, _rx = 0, _ry = 0) { + x = _x; + y = _y; + w = _w; + h = _h; + value = _data; + + var amo = array_length(data); + var ww = _w / amo; + + for(var i = 0; i < amo; i++) { + buttons[i].setFocusHover(active, hover); + + var bx = _x + ww * i; + var spr = i == 0 ? buttonSpr[0] : (i == amo - 1? buttonSpr[2] : buttonSpr[1]); + var tog = _data & (1 << i); + + buttons[i].toggled = tog; + buttons[i].draw(bx, _y, ww, _h, _m, spr); + if(buttons[i].clicked) { + value ^= (1 << i); + onClick(value); + } + + if(is_string(data[i])) { + draw_set_text(font, fa_center, fa_center, fColor); + draw_text(bx + ww / 2, _y + _h / 2, data[i]); + } else if(sprite_exists(data[i])) { + draw_sprite_ui_uniform(data[i], i, bx + ww / 2, _y + _h / 2); + } + } + + if(WIDGET_CURRENT == self) + draw_sprite_stretched_ext(THEME.widget_selecting, 0, x - ui(3), y - ui(3), w + ui(6), h + ui(6), COLORS._main_accent, 1); + + resetFocus(); + + return h; + } +} \ No newline at end of file diff --git a/scripts/toggleGroup/toggleGroup.yy b/scripts/toggleGroup/toggleGroup.yy new file mode 100644 index 000000000..4a1bf9d90 --- /dev/null +++ b/scripts/toggleGroup/toggleGroup.yy @@ -0,0 +1,11 @@ +{ + "resourceType": "GMScript", + "resourceVersion": "1.0", + "name": "toggleGroup", + "isCompatibility": false, + "isDnD": false, + "parent": { + "name": "widgets", + "path": "folders/widgets.yy", + }, +} \ No newline at end of file