This commit is contained in:
Tanasart 2024-11-27 13:26:38 +07:00
parent e7895f2de1
commit 21839119d9
17 changed files with 63 additions and 62 deletions

View file

@ -396,11 +396,6 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
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;
}
doUpdate();
}
@ -485,14 +480,24 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
}
static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) {
var dim = getInputData(0);
if(isUsingTool("Pose")) {
var _x0 = _x;
var _y0 = _y;
var _x1 = _x + dim[0] * _s;
var _y1 = _y + dim[1] * _s;
draw_set_color_alpha(COLORS.panel_bg_clear, .5);
draw_rectangle(_x0, _y0, _x1 - 1, _y1 - 1, false);
draw_set_alpha(1);
var _arm = inputs[1].value_from;
if(_arm == noone) return;
return _arm.node.drawOverlay(hover, active, _x, _y, _s, _mx, _my, _snx, _sny);
}
var dim = getInputData(0);
var _bind = getInputData(2);
var _dpos = getInputData(3);
@ -537,7 +542,7 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
var _dx = smx - dragging_mx;
var _dy = smy - dragging_my;
var _p = point_rotate(_dx, _dy, 0, 0, -_bone.angle);
var _p = point_rotate(_dx, _dy, 0, 0, -_bone.pose_angle);
var pos_x = dragging_sx + _p[0];
var pos_y = dragging_sy + _p[1];
@ -556,7 +561,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 * (_pang? _bone.angle : _bone.pose_local_rotate) + _tran[TRANSFORM.rot];
var _rot = _aang * (_pang? _bone.pose_angle : _bone.pose_apply_rotate) + _tran[TRANSFORM.rot];
var _sw = surface_get_width_safe(_surf);
var _sh = surface_get_height_safe(_surf);
@ -570,8 +575,8 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
}
if(_asca) {
sca_x /= _psca? _bone.pose_scale : _bone.pose_local_scale;
sca_y /= _psca? _bone.pose_scale : _bone.pose_local_scale;
sca_x /= _psca? _bone.pose_scale : _bone.pose_apply_scale;
sca_y /= _psca? _bone.pose_scale : _bone.pose_apply_scale;
}
_tran[TRANSFORM.sca_x] = sca_x;
@ -621,13 +626,13 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
var _asca = current_data[index + 4];
var _psca = current_data[index + 5];
var _rot = _aang * (_pang? _bone.angle : _bone.pose_local_rotate) + _tran[TRANSFORM.rot];
var _rot = _aang * (_pang? _bone.pose_angle : _bone.pose_apply_rotate) + _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 _mov = point_rotate(_tran[TRANSFORM.pos_x], _tran[TRANSFORM.pos_y], 0, 0, _bone.pose_angle);
var _sca = [ _tran[TRANSFORM.sca_x], _tran[TRANSFORM.sca_y] ];
if(_asca) {
_sca[0] *= _psca? _bone.pose_scale : _bone.pose_local_scale;
_sca[1] *= _psca? _bone.pose_scale : _bone.pose_local_scale;
_sca[0] *= _psca? _bone.pose_scale : _bone.pose_apply_scale;
_sca[1] *= _psca? _bone.pose_scale : _bone.pose_apply_scale;
}
var _ww = surface_get_width_safe(_surf);
@ -770,7 +775,7 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
}
}
static step = function() {
static processData_prebatch = function() {
var _dim_type = getSingleValue(1);
inputs[2].setVisible(_dim_type == COMPOSE_OUTPUT_SCALING.constant);
@ -805,21 +810,18 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
var _weight = array_safe_get_fast(_rmapp, i, 0);
if(_weight == 0) continue;
var _bm = _rbon[$ _rBoneID];
var _b = boneMap[$ _rBoneID];
var _bf = _rbon[$ _rBoneID];
var _bt = boneMap[$ _rBoneID];
var _ax = _p.sx - _bm.bone_head_pose.x;
var _ay = _p.sy - _bm.bone_head_pose.y;
var _ax = _p.sx - _bf.bone_head_pose.x;
var _ay = _p.sy - _bf.bone_head_pose.y;
point_rotate_origin(_ax, _ay, _b.pose_rotate - _bm.pose_rotate, _ar);
var _nx = _b.bone_head_pose.x + _ar[0] * _b.pose_scale / _bm.pose_scale;
var _ny = _b.bone_head_pose.y + _ar[1] * _b.pose_scale / _bm.pose_scale;
point_rotate_origin(_ax, _ay, _bt.pose_angle - _bf.pose_angle, _ar);
var _nx = _bt.bone_head_pose.x + _ar[0] * _bt.pose_apply_scale / _bf.pose_apply_scale;
var _ny = _bt.bone_head_pose.y + _ar[1] * _bt.pose_apply_scale / _bf.pose_apply_scale;
var _dx = _nx - _p.sx;
var _dy = _ny - _p.sy;
_px += _dx * _weight;
_py += _dy * _weight;
_px += (_nx - _p.sx) * _weight;
_py += (_ny - _p.sy) * _weight;
}
_p.x = _px;
@ -900,18 +902,18 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
_b = boneMap[$ _b];
var _tran = use_data? _bind[i].transform : _data[_i + 1];
var _aang = use_data? _bind[i].applyRot : _data[_i + 2];
var _pang = use_data? _bind[i].applyRotl : _data[_i + 3];
var _asca = use_data? _bind[i].applySca : _data[_i + 4];
var _psca = use_data? _bind[i].applyScal : _data[_i + 5];
var _aang = use_data? _bind[i].applyRot : _data[_i + 2]; // inherit rotation
var _pang = use_data? _bind[i].applyRotl : _data[_i + 3]; // apply bone rotation
var _asca = use_data? _bind[i].applySca : _data[_i + 4]; // inherit scale
var _psca = use_data? _bind[i].applyScal : _data[_i + 5]; // apply bone scale
var _rot = _aang * (_pang? _b.angle : _b.pose_local_rotate) + _tran[TRANSFORM.rot];
var _rot = _aang * (_pang? _b.pose_angle : _b.pose_apply_rotate) + _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 _mov = point_rotate(_tran[TRANSFORM.pos_x], _tran[TRANSFORM.pos_y], 0, 0, _b.pose_angle);
var _sca = [ _tran[TRANSFORM.sca_x], _tran[TRANSFORM.sca_y] ];
if(_asca) {
_sca[0] *= _psca? _b.pose_scale : _b.pose_local_scale;
_sca[1] *= _psca? _b.pose_scale : _b.pose_local_scale;
_sca[0] *= _psca? _b.pose_scale : _b.pose_apply_scale;
_sca[1] *= _psca? _b.pose_scale : _b.pose_apply_scale;
}
var _ww = surface_get_width_safe(_s);
@ -962,7 +964,7 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
var _cy = surface_get_height_safe(_surf) / 2;
var _anc = _b.getPoint(0.5);
var _rot = _arot? -_b.angle : 0;
var _rot = _arot? -_b.pose_angle : 0;
var _tr = [ _cx - _anc.x, _cy - _anc.y, _rot, 1, 1 ];
inputs[surfIndex + 1].setValue(_tr);

View file

@ -138,7 +138,7 @@ function Node_Armature_Mesh_Rig(_x, _y, _group = noone) : Node(_x, _y, _group) c
static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) {
var _bones = inputs[0].getValue();
var _mesh = inputs[1].getValue();
var _mesh = inputs[1].getValue();
if(_mesh != noone) {
__weights = anchor_selecting == noone? noone : struct_try_get(rigdata, anchor_selecting[0].ID, noone);
@ -378,11 +378,10 @@ function Node_Armature_Mesh_Rig(_x, _y, _group = noone) : Node(_x, _y, _group) c
var _map = {};
bone_posed = _bones.clone();
current_bone = _bones;
bone_posed.connect();
bone_posed.resetPose();
bone_posed = _bones.clone()
.connect()
.resetPose();
var _barr = bone_posed.toArray();
for( var i = 0, n = array_length(_barr); i < n; i++ ) {
@ -391,10 +390,10 @@ function Node_Armature_Mesh_Rig(_x, _y, _group = noone) : Node(_x, _y, _group) c
_map[$ _b.ID] = _b;
if(!struct_has(attributes.bonePoseData, _b.ID)) continue;
var _trn = attributes.bonePoseData[$ _b.ID];
_b.pose_posit = [ _trn[TRANSFORM.pos_x], _trn[TRANSFORM.pos_y] ];
var _trn = attributes.bonePoseData[$ _b.ID];
_b.pose_posit = [ _trn[TRANSFORM.pos_x], _trn[TRANSFORM.pos_y] ];
_b.pose_rotate = _trn[TRANSFORM.rot];
_b.pose_scale = _trn[TRANSFORM.sca_x];
_b.pose_scale = _trn[TRANSFORM.sca_x];
}
bone_posed.setPose(false);

Binary file not shown.

After

Width:  |  Height:  |  Size: 541 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 483 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 541 B

View file

@ -2,24 +2,24 @@
"$GMSprite":"",
"%Name":"s_refresh_16",
"bboxMode":0,
"bbox_bottom":14,
"bbox_left":1,
"bbox_right":14,
"bbox_top":1,
"bbox_bottom":13,
"bbox_left":2,
"bbox_right":13,
"bbox_top":2,
"collisionKind":1,
"collisionTolerance":0,
"DynamicTexturePage":false,
"edgeFiltering":false,
"For3D":false,
"frames":[
{"$GMSpriteFrame":"","%Name":"59760b25-95c7-490c-8c15-234aa0b70e2e","name":"59760b25-95c7-490c-8c15-234aa0b70e2e","resourceType":"GMSpriteFrame","resourceVersion":"2.0",},
{"$GMSpriteFrame":"","%Name":"17bb26d8-ba69-4146-aa0c-c427217a729f","name":"17bb26d8-ba69-4146-aa0c-c427217a729f","resourceType":"GMSpriteFrame","resourceVersion":"2.0",},
],
"gridX":0,
"gridY":0,
"height":16,
"HTile":false,
"layers":[
{"$GMImageLayer":"","%Name":"95044ec9-f89e-4cd9-83cd-3cab8af270a8","blendMode":0,"displayName":"default","isLocked":false,"name":"95044ec9-f89e-4cd9-83cd-3cab8af270a8","opacity":100.0,"resourceType":"GMImageLayer","resourceVersion":"2.0","visible":true,},
{"$GMImageLayer":"","%Name":"c7dcc880-5312-4e86-a5c7-b2b088230769","blendMode":0,"displayName":"default","isLocked":false,"name":"c7dcc880-5312-4e86-a5c7-b2b088230769","opacity":100.0,"resourceType":"GMImageLayer","resourceVersion":"2.0","visible":true,},
],
"name":"s_refresh_16",
"nineSlice":null,
@ -69,8 +69,8 @@
"tracks":[
{"$GMSpriteFramesTrack":"","builtinName":0,"events":[],"inheritsTrackColour":true,"interpolation":1,"isCreationTrack":false,"keyframes":{"$KeyframeStore<SpriteFrameKeyframe>":"","Keyframes":[
{"$Keyframe<SpriteFrameKeyframe>":"","Channels":{
"0":{"$SpriteFrameKeyframe":"","Id":{"name":"59760b25-95c7-490c-8c15-234aa0b70e2e","path":"sprites/s_refresh_16/s_refresh_16.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},
},"Disabled":false,"id":"decb8710-8249-45a7-a91d-2273ef7e4bb1","IsCreationKey":false,"Key":0.0,"Length":1.0,"resourceType":"Keyframe<SpriteFrameKeyframe>","resourceVersion":"2.0","Stretch":false,},
"0":{"$SpriteFrameKeyframe":"","Id":{"name":"17bb26d8-ba69-4146-aa0c-c427217a729f","path":"sprites/s_refresh_16/s_refresh_16.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},
},"Disabled":false,"id":"d0fb7eb1-2fe7-4f9f-889b-c803855bca00","IsCreationKey":false,"Key":0.0,"Length":1.0,"resourceType":"Keyframe<SpriteFrameKeyframe>","resourceVersion":"2.0","Stretch":false,},
],"resourceType":"KeyframeStore<SpriteFrameKeyframe>","resourceVersion":"2.0",},"modifiers":[],"name":"frames","resourceType":"GMSpriteFramesTrack","resourceVersion":"2.0","spriteId":null,"trackColour":0,"tracks":[],"traits":0,},
],
"visibleRange":null,

Binary file not shown.

After

Width:  |  Height:  |  Size: 584 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 520 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 584 B

View file

@ -12,14 +12,14 @@
"edgeFiltering":false,
"For3D":false,
"frames":[
{"$GMSpriteFrame":"","%Name":"f700c157-44b6-45f1-a38b-99cbe046394b","name":"f700c157-44b6-45f1-a38b-99cbe046394b","resourceType":"GMSpriteFrame","resourceVersion":"2.0",},
{"$GMSpriteFrame":"","%Name":"4c66ea62-b8b9-4d09-926f-354901f2058f","name":"4c66ea62-b8b9-4d09-926f-354901f2058f","resourceType":"GMSpriteFrame","resourceVersion":"2.0",},
],
"gridX":0,
"gridY":0,
"height":20,
"HTile":false,
"layers":[
{"$GMImageLayer":"","%Name":"a6152731-bd34-434a-86d6-bdbbfdd387f3","blendMode":0,"displayName":"default","isLocked":false,"name":"a6152731-bd34-434a-86d6-bdbbfdd387f3","opacity":100.0,"resourceType":"GMImageLayer","resourceVersion":"2.0","visible":true,},
{"$GMImageLayer":"","%Name":"e72c5ee2-6b70-4de4-b255-2fbe77cd0e01","blendMode":0,"displayName":"default","isLocked":false,"name":"e72c5ee2-6b70-4de4-b255-2fbe77cd0e01","opacity":100.0,"resourceType":"GMImageLayer","resourceVersion":"2.0","visible":true,},
],
"name":"s_refresh_20",
"nineSlice":null,
@ -69,8 +69,8 @@
"tracks":[
{"$GMSpriteFramesTrack":"","builtinName":0,"events":[],"inheritsTrackColour":true,"interpolation":1,"isCreationTrack":false,"keyframes":{"$KeyframeStore<SpriteFrameKeyframe>":"","Keyframes":[
{"$Keyframe<SpriteFrameKeyframe>":"","Channels":{
"0":{"$SpriteFrameKeyframe":"","Id":{"name":"f700c157-44b6-45f1-a38b-99cbe046394b","path":"sprites/s_refresh_20/s_refresh_20.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},
},"Disabled":false,"id":"7f32f199-ebe0-4d0b-91be-5a34398bd25a","IsCreationKey":false,"Key":0.0,"Length":1.0,"resourceType":"Keyframe<SpriteFrameKeyframe>","resourceVersion":"2.0","Stretch":false,},
"0":{"$SpriteFrameKeyframe":"","Id":{"name":"4c66ea62-b8b9-4d09-926f-354901f2058f","path":"sprites/s_refresh_20/s_refresh_20.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},
},"Disabled":false,"id":"d92f3c14-ec2b-4136-8214-457989974072","IsCreationKey":false,"Key":0.0,"Length":1.0,"resourceType":"Keyframe<SpriteFrameKeyframe>","resourceVersion":"2.0","Stretch":false,},
],"resourceType":"KeyframeStore<SpriteFrameKeyframe>","resourceVersion":"2.0",},"modifiers":[],"name":"frames","resourceType":"GMSpriteFramesTrack","resourceVersion":"2.0","spriteId":null,"trackColour":0,"tracks":[],"traits":0,},
],
"visibleRange":null,

Binary file not shown.

Before

Width:  |  Height:  |  Size: 579 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 656 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 656 B

View file

@ -3,8 +3,8 @@
"%Name":"s_refresh_24",
"bboxMode":0,
"bbox_bottom":20,
"bbox_left":4,
"bbox_right":19,
"bbox_left":3,
"bbox_right":20,
"bbox_top":3,
"collisionKind":1,
"collisionTolerance":0,
@ -12,14 +12,14 @@
"edgeFiltering":false,
"For3D":false,
"frames":[
{"$GMSpriteFrame":"","%Name":"2c157098-5673-472d-8606-fba69fa2058c","name":"2c157098-5673-472d-8606-fba69fa2058c","resourceType":"GMSpriteFrame","resourceVersion":"2.0",},
{"$GMSpriteFrame":"","%Name":"f81f4950-9e79-4f07-a9d6-c20f46c25720","name":"f81f4950-9e79-4f07-a9d6-c20f46c25720","resourceType":"GMSpriteFrame","resourceVersion":"2.0",},
],
"gridX":0,
"gridY":0,
"height":24,
"HTile":false,
"layers":[
{"$GMImageLayer":"","%Name":"5d1dcbb9-5e68-4c4a-98d8-92a8dfd242ae","blendMode":0,"displayName":"default","isLocked":false,"name":"5d1dcbb9-5e68-4c4a-98d8-92a8dfd242ae","opacity":100.0,"resourceType":"GMImageLayer","resourceVersion":"2.0","visible":true,},
{"$GMImageLayer":"","%Name":"d0b95144-fab7-4661-99dc-5b4ce54d9637","blendMode":0,"displayName":"default","isLocked":false,"name":"d0b95144-fab7-4661-99dc-5b4ce54d9637","opacity":100.0,"resourceType":"GMImageLayer","resourceVersion":"2.0","visible":true,},
],
"name":"s_refresh_24",
"nineSlice":null,
@ -69,8 +69,8 @@
"tracks":[
{"$GMSpriteFramesTrack":"","builtinName":0,"events":[],"inheritsTrackColour":true,"interpolation":1,"isCreationTrack":false,"keyframes":{"$KeyframeStore<SpriteFrameKeyframe>":"","Keyframes":[
{"$Keyframe<SpriteFrameKeyframe>":"","Channels":{
"0":{"$SpriteFrameKeyframe":"","Id":{"name":"2c157098-5673-472d-8606-fba69fa2058c","path":"sprites/s_refresh_24/s_refresh_24.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},
},"Disabled":false,"id":"43d4fd99-eef3-4f9a-b14f-e6027cac8bd3","IsCreationKey":false,"Key":0.0,"Length":1.0,"resourceType":"Keyframe<SpriteFrameKeyframe>","resourceVersion":"2.0","Stretch":false,},
"0":{"$SpriteFrameKeyframe":"","Id":{"name":"f81f4950-9e79-4f07-a9d6-c20f46c25720","path":"sprites/s_refresh_24/s_refresh_24.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},
},"Disabled":false,"id":"ae87f4f8-a3f2-41af-8647-9a78221f309b","IsCreationKey":false,"Key":0.0,"Length":1.0,"resourceType":"Keyframe<SpriteFrameKeyframe>","resourceVersion":"2.0","Stretch":false,},
],"resourceType":"KeyframeStore<SpriteFrameKeyframe>","resourceVersion":"2.0",},"modifiers":[],"name":"frames","resourceType":"GMSpriteFramesTrack","resourceVersion":"2.0","spriteId":null,"trackColour":0,"tracks":[],"traits":0,},
],
"visibleRange":null,