- [Inspector Panel] Fix error when removing keyframe through the property widget.

This commit is contained in:
Tanasart 2024-08-03 09:32:32 +07:00
parent 8dfd2d3c88
commit aac0bef31e
13 changed files with 152 additions and 29 deletions

View file

@ -2165,6 +2165,7 @@
{"name":"s_node_junction_add","order":18,"path":"sprites/s_node_junction_add/s_node_junction_add.yy",},
{"name":"s_node_junction_inspector","order":19,"path":"sprites/s_node_junction_inspector/s_node_junction_inspector.yy",},
{"name":"s_node_junction_name_bg","order":20,"path":"sprites/s_node_junction_name_bg/s_node_junction_name_bg.yy",},
{"name":"s_node_junction_selecting","order":33,"path":"sprites/s_node_junction_selecting/s_node_junction_selecting.yy",},
{"name":"s_node_junctions_bg_2x","order":11,"path":"sprites/s_node_junctions_bg_2x/s_node_junctions_bg_2x.yy",},
{"name":"s_node_junctions_bg","order":12,"path":"sprites/s_node_junctions_bg/s_node_junctions_bg.yy",},
{"name":"s_node_junctions_outline_2x","order":13,"path":"sprites/s_node_junctions_outline_2x/s_node_junctions_outline_2x.yy",},

View file

@ -2882,6 +2882,7 @@
{"id":{"name":"s_node_junction_add","path":"sprites/s_node_junction_add/s_node_junction_add.yy",},},
{"id":{"name":"s_node_junction_inspector","path":"sprites/s_node_junction_inspector/s_node_junction_inspector.yy",},},
{"id":{"name":"s_node_junction_name_bg","path":"sprites/s_node_junction_name_bg/s_node_junction_name_bg.yy",},},
{"id":{"name":"s_node_junction_selecting","path":"sprites/s_node_junction_selecting/s_node_junction_selecting.yy",},},
{"id":{"name":"s_node_junctions_bg_2x","path":"sprites/s_node_junctions_bg_2x/s_node_junctions_bg_2x.yy",},},
{"id":{"name":"s_node_junctions_bg","path":"sprites/s_node_junctions_bg/s_node_junctions_bg.yy",},},
{"id":{"name":"s_node_junctions_outline_2x","path":"sprites/s_node_junctions_outline_2x/s_node_junctions_outline_2x.yy",},},

File diff suppressed because one or more lines are too long

Binary file not shown.

View file

@ -162,14 +162,16 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _foc
#region anim
if(jun.connect_type == JUNCTION_CONNECT.input && breakLine && jun.is_anim) {
var _anim = jun.animator;
var bx = xx + ww - ui(12);
var by = lb_y;
var b = buttonInstant(THEME.button_hide, bx - ui(12), by - ui(12), ui(24), ui(24), _m, _focus, _hover, "", THEME.prop_keyframe, 2)
if(b) cHov = true;
if(b == 2) {
for(var j = 0; j < ds_list_size(jun.animator.values); j++) {
var _key = jun.animator.values[| j];
for(var j = 0; j < ds_list_size(_anim.values); j++) {
var _key = _anim.values[| j];
if(_key.time > CURRENT_FRAME) {
PROJECT.animator.setFrame(_key.time);
break;
@ -180,8 +182,9 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _foc
bx -= ui(26);
var cc = COLORS.panel_animation_keyframe_unselected;
var kfFocus = false;
for(var j = 0; j < ds_list_size(jun.animator.values); j++) {
if(jun.animator.values[| j].time == CURRENT_FRAME) {
for(var j = 0; j < ds_list_size(_anim.values); j++) {
if(_anim.values[| j].time == CURRENT_FRAME) {
cc = COLORS.panel_animation_keyframe_selected;
kfFocus = true;
break;
@ -193,21 +196,18 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _foc
if(b) cHov = true;
if(b == 2) {
var _add = false;
for(var j = 0; j < ds_list_size(jun.animator.values); j++) {
var _key = jun.animator.values[| j];
var _remv = false;
for(var j = 0; j < ds_list_size(_anim.values); j++) {
var _key = _anim.values[| j];
if(_key.time == CURRENT_FRAME) {
if(ds_list_size(jun.animator.values) > 1)
ds_list_delete(jun.animator.values, j);
_add = true;
_anim.removeKey(_key);
_remv = true;
break;
} else if(_key.time > CURRENT_FRAME) {
ds_list_insert(jun.animator.values, j, new valueKey(CURRENT_FRAME, jun.showValue(), jun.animator));
_add = true;
break;
}
}
if(!_add) ds_list_add(jun.animator.values, new valueKey(CURRENT_FRAME, jun.showValue(), jun.animator));
if(!_remv) _anim.setValue(jun.showValue(), true, CURRENT_FRAME);
}
bx -= ui(26);
@ -216,11 +216,12 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _foc
if(b) cHov = true;
if(b == 2) {
var _t = -1;
for(var j = 0; j < ds_list_size(jun.animator.values); j++) {
var _key = jun.animator.values[| j];
for(var j = 0; j < ds_list_size(_anim.values); j++) {
var _key = _anim.values[| j];
if(_key.time < CURRENT_FRAME)
_t = _key.time;
}
if(_t > -1) PROJECT.animator.setFrame(_t);
}

View file

@ -166,6 +166,8 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
__overlay_hover = [];
overlay_draw_text = true;
graph_selecting = false;
#endregion
#region ---- timeline ----
@ -1822,6 +1824,10 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
_s *= 2;
}
if(graph_selecting)
__draw_sprite_ext(THEME.node_junction_selecting, 0, x, y, _s, _s, 0, _cfg, .8);
graph_selecting = false;
__draw_sprite_ext(_bgS, draw_junction_index, x, y, _s, _s, 0, _cbg, 1);
gpu_set_blendmode_ext_sepalpha(bm_src_alpha, bm_inv_src_alpha, bm_one, bm_one);

View file

@ -439,13 +439,14 @@ function Panel_Animation() : PanelContent() constructor {
#endregion ++++ context menu ++++
function deleteKeys() { #region
function deleteKeys() {
for( var i = 0, n = array_length(keyframe_selecting); i < n; i++ ) {
var k = keyframe_selecting[i];
k.anim.removeKey(k);
}
keyframe_selecting = [];
} #endregion
}
function alignKeys(halign = fa_left) { #region
if(array_empty(keyframe_selecting)) return;

View file

@ -765,7 +765,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
nodes_list = project.nodes;
setTitle();
run_in(2, function() /*=>*/ { setSlideShow(0, true); });
run_in(2, function() /*=>*/ { setSlideShow(0); });
struct_override(display_parameter, project.graph_display_parameter);
}
@ -1510,6 +1510,9 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
nodes_list[i].drawNodeBehind(gr_x, gr_y, mx, my, graph_s);
}
for( var i = 0, n = array_length(value_draggings); i < n; i++ )
value_draggings[i].graph_selecting = true;
for(var i = 0; i < array_length(nodes_list); i++) {
var _node = nodes_list[i];
@ -1699,9 +1702,9 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
printIf(log, $"Draw selection frame : {get_timer() - t}"); t = get_timer();
} #endregion
function connectDraggingValueTo(target) { #region
function connectDraggingValueTo(target) {
var _connect = [ 0, noone, noone ];
if(is_instanceof(PANEL_INSPECTOR, Panel_Inspector) && PANEL_INSPECTOR.attribute_hovering != noone) {
PANEL_INSPECTOR.attribute_hovering(value_dragging);
@ -1726,9 +1729,10 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
var _addInput = target.value_from == noone && target.connect_type == JUNCTION_CONNECT.input && target.node.auto_input;
if(value_dragging.connect_type == JUNCTION_CONNECT.input) {
if(array_empty(value_draggings)) {
if(array_empty(value_draggings))
_connect = [ value_dragging.setFrom(target), value_dragging, target ];
} else {
else {
for( var i = 0, n = array_length(value_draggings); i < n; i++ )
value_draggings[i].setFrom(target);
}
@ -1740,8 +1744,20 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
} else {
if(value_drag_from && target.value_from && value_drag_from.node == target.node)
value_drag_from.setFrom(target.value_from);
if(array_empty(value_draggings))
_connect = [ target.setFrom(value_dragging), target, value_dragging ];
_connect = [ target.setFrom(value_dragging), target, value_dragging ];
else {
var _node = target.node;
var _indx = target.index;
for( var i = 0, n = array_length(value_draggings); i < n; i++ ) {
_node.inputs[| _indx].setFrom(value_draggings[i]);
if(++_indx > ds_list_size(_node.inputs)) break;
}
}
}
}
@ -1801,11 +1817,12 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
menuCall(,,, menu);
}
} #endregion
}
function draggingValue() {
if(!value_dragging.node.active) {
value_dragging = noone;
value_dragging = noone;
value_draggings = [];
return;
}
@ -1896,6 +1913,8 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
if(mouse_release(mb_left))
connectDraggingValueTo(target);
}
if(mouse_release(mb_left)) value_draggings = [];
}
function drawJunctionConnect() {
@ -2341,7 +2360,10 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
var aa = i == ind? 1 : .5;
var ss = i == ind? 1 : .8;
var slid = struct_try_get(project.slideShow, project.slideShow_keys[i], noone);
if(pHOVER && point_in_circle(mx, my, _sx, _sy, ui(8))) {
if(slid) TOOLTIP = slid.slide_title;
_hv = true;
aa = 1;

View file

@ -166,7 +166,7 @@
useSlideShow = false;
slideShow = {};
slideShow_keys = 0;
slideShow_keys = [];
slideShow_index = 0;
slideShow_amount = 0;
slideShow_current = noone;

View file

@ -259,6 +259,7 @@ function Theme() constructor {
node_junctions_bg = s_node_junctions_bg;
node_junctions_outline = s_node_junctions_outline;
node_junctions_outline_hover = s_node_junctions_outline_hover;
node_junction_selecting = s_node_junction_selecting;
node_active = s_node_active;
node_bg_name = s_node_bg_name;

Binary file not shown.

After

Width:  |  Height:  |  Size: 980 B

View file

@ -0,0 +1,90 @@
{
"$GMSprite":"",
"%Name":"s_node_junction_selecting",
"bboxMode":0,
"bbox_bottom":40,
"bbox_left":8,
"bbox_right":39,
"bbox_top":7,
"collisionKind":1,
"collisionTolerance":0,
"DynamicTexturePage":false,
"edgeFiltering":false,
"For3D":false,
"frames":[
{"$GMSpriteFrame":"","%Name":"51e9020d-993b-483b-8182-ab6025b921de","name":"51e9020d-993b-483b-8182-ab6025b921de","resourceType":"GMSpriteFrame","resourceVersion":"2.0",},
],
"gridX":0,
"gridY":0,
"height":48,
"HTile":false,
"layers":[
{"$GMImageLayer":"","%Name":"c4a34680-397c-4720-8469-b6498fb303c0","blendMode":0,"displayName":"default","isLocked":false,"name":"c4a34680-397c-4720-8469-b6498fb303c0","opacity":100.0,"resourceType":"GMImageLayer","resourceVersion":"2.0","visible":true,},
],
"name":"s_node_junction_selecting",
"nineSlice":null,
"origin":4,
"parent":{
"name":"node",
"path":"folders/theme/node.yy",
},
"preMultiplyAlpha":false,
"resourceType":"GMSprite",
"resourceVersion":"2.0",
"sequence":{
"$GMSequence":"",
"%Name":"s_node_junction_selecting",
"autoRecord":true,
"backdropHeight":768,
"backdropImageOpacity":0.5,
"backdropImagePath":"",
"backdropWidth":1366,
"backdropXOffset":0.0,
"backdropYOffset":0.0,
"events":{
"$KeyframeStore<MessageEventKeyframe>":"",
"Keyframes":[],
"resourceType":"KeyframeStore<MessageEventKeyframe>",
"resourceVersion":"2.0",
},
"eventStubScript":null,
"eventToFunction":{},
"length":1.0,
"lockOrigin":false,
"moments":{
"$KeyframeStore<MomentsEventKeyframe>":"",
"Keyframes":[],
"resourceType":"KeyframeStore<MomentsEventKeyframe>",
"resourceVersion":"2.0",
},
"name":"s_node_junction_selecting",
"playback":1,
"playbackSpeed":30.0,
"playbackSpeedType":0,
"resourceType":"GMSequence",
"resourceVersion":"2.0",
"showBackdrop":true,
"showBackdropImage":false,
"timeUnits":1,
"tracks":[
{"$GMSpriteFramesTrack":"","builtinName":0,"events":[],"inheritsTrackColour":true,"interpolation":1,"isCreationTrack":false,"keyframes":{"$KeyframeStore<SpriteFrameKeyframe>":"","Keyframes":[
{"$Keyframe<SpriteFrameKeyframe>":"","Channels":{
"0":{"$SpriteFrameKeyframe":"","Id":{"name":"51e9020d-993b-483b-8182-ab6025b921de","path":"sprites/s_node_junction_selecting/s_node_junction_selecting.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},
},"Disabled":false,"id":"6a6ee5bd-2e6a-49b2-af1e-a27ee9050a64","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,
"volume":1.0,
"xorigin":24,
"yorigin":24,
},
"swatchColours":null,
"swfPrecision":0.5,
"textureGroupId":{
"name":"Default",
"path":"texturegroups/Default",
},
"type":0,
"VTile":false,
"width":48,
}