mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2025-02-07 10:45:22 +01:00
Fix error when animating global variable.
This commit is contained in:
parent
ce06db8f8f
commit
1b4c4acd7f
3 changed files with 24 additions and 29 deletions
Binary file not shown.
|
@ -40,7 +40,7 @@ function variable_editor(nodeVal) constructor {
|
|||
refreshInput();
|
||||
|
||||
RENDER_ALL
|
||||
} );
|
||||
});
|
||||
sc_type.update_hover = false;
|
||||
|
||||
sc_disp = new scrollBox(display_list[0], function(value) {
|
||||
|
@ -61,7 +61,7 @@ function variable_editor(nodeVal) constructor {
|
|||
slider_range = [ 0, 1 ];
|
||||
slider_step = 0.01;
|
||||
|
||||
static refreshInput = function() { #region
|
||||
static refreshInput = function() {
|
||||
value.setType(val_type[type_index]);
|
||||
value.name = value_name;
|
||||
|
||||
|
@ -146,9 +146,9 @@ function variable_editor(nodeVal) constructor {
|
|||
case "Export" : value.setDisplay(VALUE_DISPLAY.path_save, { filter: "" }); break;
|
||||
case "Font" : value.setDisplay(VALUE_DISPLAY.path_font); break;
|
||||
}
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static draw = function(_x, _y, _w, _m, _focus, _hover) { #region
|
||||
static draw = function(_x, _y, _w, _m, _focus, _hover) {
|
||||
var _h = 0;
|
||||
|
||||
switch(sc_disp.data_list[disp_index]) {
|
||||
|
@ -177,7 +177,7 @@ function variable_editor(nodeVal) constructor {
|
|||
}
|
||||
|
||||
return _h;
|
||||
} #endregion
|
||||
}
|
||||
}
|
||||
|
||||
function Node_Global(_x = 0, _y = 0) : __Node_Base(_x, _y) constructor {
|
||||
|
@ -193,38 +193,36 @@ function Node_Global(_x = 0, _y = 0) : __Node_Base(_x, _y) constructor {
|
|||
input_display_list = -1;
|
||||
anim_priority = -999;
|
||||
|
||||
static isActiveDynamic = function(frame = CURRENT_FRAME) { return true; }
|
||||
|
||||
static valueUpdate = function(index) { RENDER_ALL }
|
||||
|
||||
static createValue = function() { #region
|
||||
static createValue = function() {
|
||||
var _in = nodeValue_Float("NewValue", self, 0);
|
||||
_in.editor = new variable_editor(_in);
|
||||
array_push(inputs, _in);
|
||||
|
||||
return _in;
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static inputExist = function(key) { #region
|
||||
return ds_map_exists(value, key);
|
||||
} #endregion
|
||||
static inputExist = function(key) { return ds_map_exists(value, key); }
|
||||
|
||||
static inputGetable = function(from, key) { #region
|
||||
static inputGetable = function(from, key) {
|
||||
if(!inputExist(key)) return false;
|
||||
var to = value[? key];
|
||||
|
||||
if(!typeCompatible(from.type, to.type))
|
||||
return false;
|
||||
if(typeIncompatible(from, to))
|
||||
return false;
|
||||
if(!typeCompatible(from.type, to.type)) return false;
|
||||
if(typeIncompatible(from, to)) return false;
|
||||
|
||||
return true;
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static getInputKey = function(key, def = noone) { #region
|
||||
static getInputKey = function(key, def = noone) {
|
||||
if(!ds_map_exists(value, key)) return def;
|
||||
return value[? key];
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static step = function() { #region
|
||||
static step = function() {
|
||||
for( var i = 0; i < array_length(inputs); i++ ) {
|
||||
var _inp = inputs[i];
|
||||
value[? _inp.name] = _inp;
|
||||
|
@ -233,9 +231,9 @@ function Node_Global(_x = 0, _y = 0) : __Node_Base(_x, _y) constructor {
|
|||
if(string_pos(" ", _inp.name)) val = false;
|
||||
_inp.editor.tb_name.boxColor = val? c_white : COLORS._main_value_negative;
|
||||
}
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static serialize = function() { #region
|
||||
static serialize = function() {
|
||||
var _map = {};
|
||||
|
||||
var _inputs = [];
|
||||
|
@ -255,9 +253,9 @@ function Node_Global(_x = 0, _y = 0) : __Node_Base(_x, _y) constructor {
|
|||
_map.attri = attributes;
|
||||
|
||||
return _map;
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static deserialize = function(_map) { #region
|
||||
static deserialize = function(_map) {
|
||||
var _inputs = _map.inputs;
|
||||
|
||||
for(var i = 0; i < array_length(_inputs); i++) {
|
||||
|
@ -283,5 +281,5 @@ function Node_Global(_x = 0, _y = 0) : __Node_Base(_x, _y) constructor {
|
|||
if(struct_has(_map, "attr")) struct_override(attributes, _map.attr);
|
||||
|
||||
step();
|
||||
} #endregion
|
||||
}
|
||||
}
|
|
@ -74,14 +74,13 @@ function timelineItemNode(node) : timelineItem() constructor {
|
|||
color_dsp = cc;
|
||||
|
||||
draw_sprite_stretched_ext(THEME.box_r2, 0, _x, _y, _w, lh, cc, alpha);
|
||||
if(_sel) draw_sprite_stretched_ext(THEME.box_r2, 1, _x, _y, _w, lh, COLORS._main_accent, 1);
|
||||
|
||||
if(hover && point_in_rectangle(_msx, _msy, _x + ui(20), _y, _x + _w, _y + lh - 1)) {
|
||||
draw_sprite_stretched_add(THEME.box_r2, 0, _x, _y, _w, lh, col, 0.05);
|
||||
draw_sprite_stretched_add(THEME.box_r2, 1, _x, _y, _w, lh, col, 0.3);
|
||||
res = 1;
|
||||
}
|
||||
|
||||
// draw_sprite_stretched_add(THEME.box_r2, 1, _x, _y, _w, lh, c_white, 0.15);
|
||||
|
||||
var tx = lx + lw - ui(7);
|
||||
var tt = __txtx("panel_animation_goto", "Go to node");
|
||||
var _m = [ _msx, _msy ];
|
||||
|
@ -89,8 +88,6 @@ function timelineItemNode(node) : timelineItem() constructor {
|
|||
if(buttonInstant(noone, tx - ui(9), _y + ui(1), ui(18), ui(18), _m, hover, focus, tt, THEME.animate_node_go, 0, col == -1? COLORS._main_icon_light : col, 0.4) == 2)
|
||||
graphFocusNode(node);
|
||||
|
||||
if(_sel) draw_sprite_stretched_ext(THEME.box_r2, 1, _x, _y, _w, lh, COLORS._main_accent, 1);
|
||||
|
||||
var aa = 0.75;
|
||||
if(hover && point_in_rectangle(_msx, _msy, lx, _y, lx + ui(20), _y + lh)) {
|
||||
aa = 1;
|
||||
|
|
Loading…
Reference in a new issue