Timeline rework 1

This commit is contained in:
MakhamDev 2023-10-14 13:00:35 +07:00
parent 5173301279
commit 6afa977b27
23 changed files with 646 additions and 475 deletions

View file

@ -354,7 +354,7 @@
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_fluid_sim.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_folder_24.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_folder_add_strip2.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_folder_content_strip2.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_folder_content.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_gear_24.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_grad_blend.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_graph.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/icon",},
@ -634,6 +634,9 @@
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_ui_panel_tab.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/UI",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_ui_scroll_bar.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/UI",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_ui_selection.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/UI",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_ui_timeline_color.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/UI",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_ui_timeline_folder.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/UI",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_ui_timeline_node.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/UI",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"s_ui_window_frame.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/UI",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"workshop_badge.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/UI",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"workshop_bg.png","CopyToMask":-1,"filePath":"datafiles/data/themes/default/graphics/UI",},

Binary file not shown.

View file

@ -46,7 +46,7 @@ event_inherited();
if(instanceof(_menuItem) == "MenuItemGroup") {
var amo = array_length(_menuItem.group);
ww = max(ww, ui(16) + amo * (hght + ui(4)));
ww = max(ww, ui(16) + amo * (_menuItem.spacing + ui(4)));
dialog_h += hght;
}

View file

@ -69,20 +69,22 @@ if(!ready) exit;
draw_set_alpha(1);
var amo = array_length(_submenus);
var _w = (amo - 1) / 2 * (hght + ui(4));
var _w = (amo - 1) / 2 * (_menuItem.spacing + ui(4));
var _sx = dialog_x + dialog_w / 2 - _w;
for(var j = 0; j < amo; j++) {
var _submenu = _submenus[j];
var _bx = _sx + j * (hght + ui(4));
var _bx = _sx + j * (_menuItem.spacing + ui(4));
var _by = yy + hght + hght / 2 - ui(4);
var _spr = noone, _ind = 0;
var _sprs = _submenu[0];
var _tlp = array_safe_get(_submenu, 2, "");
var _dat = array_safe_get(_submenu, 3, {});
var _clr = c_white;
var _str = "";
var _sw = ui(28);
var _sh = ui(28);
var _sw = _menuItem.spacing;
var _sh = _menuItem.spacing;
if(is_string(_sprs)) {
_str = _sprs;
@ -94,7 +96,11 @@ if(!ready) exit;
if(is_array(_sprs)) {
_spr = _sprs[0];
_ind = _sprs[1];
_clr = array_safe_get(_sprs, 2, c_white);
} else _spr = _sprs;
_sw = sprite_get_width(_spr) + ui(8);
_sh = sprite_get_height(_spr) + ui(8);
}
if(sHOVER && point_in_rectangle(mouse_mx, mouse_my, _bx - _sw / 2, _by - _sh / 2, _bx + _sw / 2, _by + _sh / 2)) {
@ -103,13 +109,13 @@ if(!ready) exit;
draw_sprite_stretched_ext(THEME.textbox, 1, _bx - _sw / 2, _by - _sh / 2, _sw, _sh, COLORS.dialog_menubox_highlight, 1);
if(mouse_press(mb_left, sFOCUS)) {
_submenu[1]();
_submenu[1](_dat);
instance_destroy(o_dialog_menubox);
}
}
if(_spr != noone)
draw_sprite_ui_uniform(_spr, _ind, _bx, _by);
draw_sprite_ui_uniform(_spr, _ind, _bx, _by,, _clr);
if(_str != "")
draw_text(_bx, _by, _str);

View file

@ -63,11 +63,16 @@
log_message("SESSION", "Begin");
log_message("DIRECTORY", DIRECTORY);
PREF_APPLY();
loadGraphic(PREF_MAP[? "theme"]);
loadColor(PREF_MAP[? "theme"]);
log_message("SESSION", "> init Locale"); __initLocale();
log_message("SESSION", "> init Font"); loadFonts();
log_message("SESSION", "> init Theme"); __initTheme();
log_message("SESSION", "> init Project"); __initProject();
log_message("SESSION", "> init Action"); __initAction();
log_message("SESSION", "> init SurfaceFormat"); __initSurfaceFormat();
log_message("SESSION", "> init Theme"); __initTheme();
log_message("SESSION", "> init Collection"); __initCollection();
log_message("SESSION", "> init Assets"); __initAssets();
log_message("SESSION", "> init Presets"); __initPresets();
@ -78,11 +83,6 @@
log_message("SESSION", "> init SteamUGC"); __initSteamUGC();
log_message("SESSION", "> init Addon"); __initAddon();
PREF_APPLY();
loadGraphic(PREF_MAP[? "theme"]);
loadColor(PREF_MAP[? "theme"]);
loadFonts();
setPanel();
loadAddon();

View file

@ -8,7 +8,6 @@ function __Node_Base(x, y) constructor {
active_index = -1;
preview_index = 0;
anim_show = true;
anim_priority = -999;
static step = function() {}

View file

@ -129,7 +129,6 @@ function __APPEND_MAP(_map, context = PANEL_GRAPH.getCurrentContext()) {
ds_list_destroy(appended_list);
APPENDING = false;
PANEL_ANIMATION.updatePropertyList();
RENDER_ALL_REORDER

View file

@ -72,5 +72,7 @@
active = true;
self.name = name;
self.group = group;
spacing = ui(36);
}
#endregion

View file

@ -59,7 +59,6 @@ function Action(_type, _object, _data) constructor {
case ACTION_TYPE.list_insert :
if(!ds_exists(obj, ds_type_list)) return;
ds_list_delete(obj, data[1]);
PANEL_ANIMATION.updatePropertyList();
break;
case ACTION_TYPE.list_modify :
if(!ds_exists(obj, ds_type_list)) return;
@ -129,7 +128,6 @@ function Action(_type, _object, _data) constructor {
case ACTION_TYPE.list_insert :
if(!ds_exists(obj, ds_type_list)) return;
ds_list_insert(obj, data[1], data[0]);
PANEL_ANIMATION.updatePropertyList();
break;
case ACTION_TYPE.list_modify :
if(!ds_exists(obj, ds_type_list)) return;

View file

@ -26,10 +26,10 @@
globalvar VERSION, SAVE_VERSION, VERSION_STRING, BUILD_NUMBER;
VERSION = 11543;
VERSION = 11550;
SAVE_VERSION = 11530;
VERSION_STRING = "1.14.3";
BUILD_NUMBER = 11543;
VERSION_STRING = "1.15";
BUILD_NUMBER = 11550;
globalvar APPEND_MAP;
APPEND_MAP = ds_map_create();

View file

@ -43,7 +43,6 @@ function LOAD_PATH(path, readonly = false, safe_mode = false) {
var res = __LOAD_PATH(path, readonly, safe_mode);
if(!res) return false;
PANEL_ANIMATION.updatePropertyList();
setFocus(PANEL_GRAPH.panel);
return PROJECT;
@ -242,7 +241,7 @@ function __LOAD_PATH(path, readonly = false, safe_mode = false, override = false
refreshNodeMap();
if(struct_has(_load_content, "timelines"))
if(struct_has(_load_content, "timelines") && !array_empty(_load_content.timelines.contents))
PROJECT.timelines.deserialize(_load_content.timelines);
return true;

View file

@ -38,7 +38,6 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _foc
jun.setAnim(!jun.is_anim);
anim_hold = jun.is_anim;
}
PANEL_ANIMATION.updatePropertyList();
}
}
} #endregion

View file

@ -21,6 +21,4 @@ function rearrange_priority(node, newpri) {
}
ds_priority_destroy(pr);
PANEL_ANIMATION.updatePropertyList();
}

View file

@ -111,7 +111,6 @@ function Node_ASE_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const
inputs[| 2].removeFrom();
else
inputs[| 2].setAnim(!inputs[| 2].is_anim);
PANEL_ANIMATION.updatePropertyList();
}
}

View file

@ -191,8 +191,8 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
#region ---- timeline ----
timeline_item = new timelineItemNode(self);
anim_priority = ds_map_size(PROJECT.nodeMap);
is_anim_timeline = false;
anim_show = true;
dopesheet_color = COLORS.panel_animation_dope_blend_default;
dopesheet_y = 0;
#endregion
@ -1168,7 +1168,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
if(PANEL_INSPECTOR.inspecting == self) PANEL_INSPECTOR.inspecting = noone;
PANEL_PREVIEW.removeNodePreview(self);
PANEL_ANIMATION.updatePropertyList();
timeline_item.removeSelf();
for(var i = 0; i < ds_list_size(outputs); i++) {
var jun = outputs[| i];
@ -1391,6 +1391,26 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
return _tool.selecting == subtool;
} #endregion
static refreshTimeline = function() { #region
var _pre_anim = is_anim_timeline;
var _cur_anim = false;
for( var i = 0, n = ds_list_size(inputs); i < n; i++ ) {
var _inp = inputs[| i];
if(_inp.is_anim && _inp.value_from == noone) {
_cur_anim = true;
break;
}
}
if(_pre_anim && !_cur_anim)
timeline_item.removeSelf();
else if(!_pre_anim && _cur_anim)
PROJECT.timelines.addItem(timeline_item);
is_anim_timeline = _cur_anim;
} #endregion
static clone = function(target = PANEL_GRAPH.getCurrentContext()) { #region
CLONING = true;
var _type = instanceof(self);
@ -1410,8 +1430,8 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
PROJECT.nodeMap[? node_id] = self;
PROJECT.nodeMap[? _nid] = _node;
PANEL_ANIMATION.updatePropertyList();
CLONING = false;
refreshTimeline();
onClone(_node, target);
@ -1708,6 +1728,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
updatedInTrigger.connect(log);
if(!connected) ds_queue_enqueue(CONNECTION_CONFLICT, self);
refreshTimeline();
return connected;
} #endregion

View file

@ -159,7 +159,6 @@
node.destroy(_merge);
recordAction(ACTION_TYPE.node_delete, node);
PANEL_ANIMATION.updatePropertyList();
}
function nodeCleanUp() {

View file

@ -74,7 +74,7 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor {
index = 0;
prop = _prop;
dopesheet_y = 0;
y = 0;
if(_prop.type != VALUE_TYPE.trigger)
ds_list_add(values, new valueKey(0, _val, self));

View file

@ -1490,11 +1490,13 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
} #endregion
static setAnim = function(anim) { #region
if(is_anim == anim) return;
if(anim && !is_anim && ds_list_size(animator.values) == 1)
animator.values[| 0].time = CURRENT_FRAME;
is_anim = anim;
PANEL_ANIMATION.updatePropertyList();
node.refreshTimeline();
} #endregion
static isActiveDynamic = function() { #region
@ -2238,7 +2240,6 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
}
ext.doUpdate();
PANEL_ANIMATION.updatePropertyList();
} #endregion
static getJunctionTo = function() { #region
@ -2364,8 +2365,9 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
if(APPENDING) def_val = getValue(0);
if(connect_type == JUNCTION_CONNECT.input && index >= 0) {
setInputData(index, animator.getValue(0));
//print($"Set input {node.name} - {index} = {node.inputs_data[index]} | {node.inputs_data}");
var _value = animator.getValue(0);
node.inputs_data[index] = _value;
node.input_value_map[$ internalName] = _value;
}
onValidate();

File diff suppressed because it is too large Load diff

View file

@ -133,7 +133,6 @@
file = DIRECTORY + "layouts/Horizontal.json";
loadPanel(file, PANEL_MAIN);
PANEL_ANIMATION.updatePropertyList();
PANEL_MAIN.refresh();
PANEL_MAIN.refreshSize();
}

View file

@ -386,7 +386,6 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
function onFocusBegin() { #region
PANEL_GRAPH = self;
PROJECT = project;
PANEL_ANIMATION.updatePropertyList();
} #endregion
function stepBegin() { #region
@ -1258,7 +1257,6 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
var node = getCurrentContext();
title = node.display_name == ""? node.name : node.display_name;
PANEL_ANIMATION.updatePropertyList();
break;
}
}
@ -1447,7 +1445,6 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
title = __txt("Graph");
nodes_list = project.nodes;
toCenterNode();
PANEL_ANIMATION.updatePropertyList();
} #endregion
function addContext(node) { #region
@ -1464,7 +1461,6 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
selection_block = 1;
toCenterNode();
PANEL_ANIMATION.updatePropertyList();
} #endregion
function setContextFrame(dirr, node) { #region

View file

@ -547,7 +547,6 @@ function Panel_Inspector() : PanelContent() constructor {
if(anim_toggling) {
jun.setAnim(!jun.is_anim);
PANEL_ANIMATION.updatePropertyList();
anim_toggling = false;
}
@ -566,7 +565,6 @@ function Panel_Inspector() : PanelContent() constructor {
}),
menuItem(jun.is_anim? __txtx("panel_inspector_remove", "Remove animation") : __txtx("panel_inspector_add", "Add animation"), function() {
__dialog_junction.setAnim(!__dialog_junction.is_anim);
PANEL_ANIMATION.updatePropertyList();
}),
);
@ -574,7 +572,6 @@ function Panel_Inspector() : PanelContent() constructor {
array_push(_menuItem,
menuItem(jun.sep_axis? __txtx("panel_inspector_axis_combine", "Combine axis") : __txtx("panel_inspector_axis_separate", "Separate axis"), function() {
__dialog_junction.sep_axis = !__dialog_junction.sep_axis;
PANEL_ANIMATION.updatePropertyList();
}),
);
}

View file

@ -1,64 +1,170 @@
function timelineItem() constructor {
color = c_white;
show = true;
color = CDEF.main_grey;
parent = noone;
static removeSelf = function() {
static drawLabel = function(_x, _y, _w, _msx, _msy) {}
static removeSelf = function() { #region
if(parent == noone) return;
array_remove(parent.contents, self);
return self;
}
} #endregion
static serialize = function() {}
static deserialize = function(_map) {
static deserialize = function(_map) { #region
switch(_map.type) {
case "Node" : return new timelineItemNode(noone).deserialize(_map);
case "Folder" : return new timelineItemGroup(noone).deserialize(_map);
}
return self;
}
} #endregion
}
function timelineItemNode(node) : timelineItem() constructor {
self.node = node;
static serialize = function() {
static drawLabel = function(_x, _y, _w, _msx, _msy, hover, focus, itHover, fdHover, nameType, alpha) { #region
_x += ui(2);
_w -= ui(4);
var lh = ui(20);
var res = 0;
var cc = colorMultiply(color, COLORS.panel_animation_dope_bg);
if(hover && point_in_rectangle(_msx, _msy, _x + ui(20), _y, _x + _w, _y + lh)) {
cc = colorMultiply(color, COLORS.panel_animation_dope_bg_hover);
res = 1;
}
draw_sprite_stretched_ext(THEME.timeline_node, 0, _x, _y, _w, lh, cc, alpha);
draw_sprite_stretched_ext(THEME.timeline_node, 1, _x, _y, _w, lh, COLORS.panel_animation_node_outline, 1);
var tx = _x + _w - ui(10);
if(buttonInstant(THEME.button_hide, tx - ui(10), _y, ui(20), ui(20), [ _msx, _msy ], focus, hover,
__txtx("panel_animation_goto", "Go to node"), THEME.animate_node_go, 0, COLORS._main_icon) == 2)
graphFocusNode(node);
if(node == PANEL_INSPECTOR.getInspecting())
draw_sprite_stretched_ext(THEME.timeline_node, 1, _x, _y, _w, lh, COLORS._main_accent, 1);
if(hover && point_in_rectangle(_msx, _msy, _x, _y, _x + ui(20), _y + lh)) {
draw_sprite_ui_uniform(THEME.arrow, show? 3 : 0, _x + ui(10), _y + lh / 2, 1, COLORS._main_icon_light, 1);
if(mouse_press(mb_left, focus)) show = !show;
} else
draw_sprite_ui_uniform(THEME.arrow, show? 3 : 0, _x + ui(10), _y + lh / 2, 1, COLORS._main_icon, 0.75);
draw_set_text(f_p3, fa_left, fa_center);
var nodeName = $"[{node.name}] ";
var tw = string_width(nodeName);
draw_set_color(itHover == self? COLORS._main_text_accent : COLORS._main_text);
var txx = _x + ui(20);
if(nameType == 0 || nameType == 1 || node.display_name == "") {
draw_set_alpha(0.4);
draw_text_add(txx, _y + lh / 2 - ui(2), nodeName);
txx += tw;
}
draw_set_font(f_p2);
if(nameType == 0 || nameType == 2) {
draw_set_alpha(0.9);
draw_text_add(txx, _y + lh / 2 - ui(2), node.display_name);
}
draw_set_alpha(1);
return res;
} #endregion
static serialize = function() { #region
var _map = {};
_map.type = "Node";
_map.show = show;
_map.color = color;
_map.node_id = node.node_id;
return _map;
}
} #endregion
static deserialize = function(_map) {
static deserialize = function(_map) { #region
color = _map.color;
var _node_id = _map.node_id;
show = struct_try_get(_map, "show", true);
var _node_id = _map.node_id;
node = PROJECT.nodeMap[? _node_id];
node.timeline_item = self;
return self;
}
} #endregion
}
function timelineItemGroup() : timelineItem() constructor {
name = "";
renaming = false;
tb_name = new textBox(TEXTBOX_INPUT.text, function(val) { name = val; renaming = false; });
contents = [];
static addItem = function(_item) {
static rename = function() {
renaming = true;
tb_name.setFocusHover(true, true);
run_in(1, function() { tb_name.activate(); });
}
static drawLabel = function(_x, _y, _w, _msx, _msy, hover, focus, itHover, fdHover, nameType, alpha) { #region
var lx = _x + ui(2);
var lh = ui(20);
var res = 0;
var cc = colorMultiply(color, COLORS.panel_animation_dope_bg);
if(hover && point_in_rectangle(_msx, _msy, _x + ui(20), _y, _x + _w, _y + lh)) {
cc = colorMultiply(color, COLORS.panel_animation_dope_bg_hover);
res = 1;
}
draw_sprite_stretched_ext(THEME.timeline_folder, 0, _x, _y, _w, lh, cc, alpha);
draw_sprite_stretched_ext(THEME.timeline_folder, 1, _x, _y, _w, lh, fdHover == self? COLORS._main_accent : COLORS.panel_animation_node_outline, 1);
if(hover && point_in_rectangle(_msx, _msy, lx, _y, lx + ui(20), _y + lh)) {
draw_sprite_ui_uniform(THEME.arrow, show? 3 : 0, lx + ui(10), _y + lh / 2, 1, COLORS._main_icon_light, 1);
if(mouse_press(mb_left, focus)) show = !show;
} else
draw_sprite_ui_uniform(THEME.arrow, show? 3 : 0, lx + ui(10), _y + lh / 2, 1, COLORS._main_icon, 0.75);
draw_set_text(f_p3, fa_left, fa_center);
if(renaming) {
var _param = new widgetParam(lx + ui(20), _y + ui(2), _w - ui(24), lh - ui(4), name,, [ _msx, _msy ]);
tb_name.setFont(f_p3);
tb_name.setFocusHover(focus, hover);
tb_name.drawParam(_param);
} else {
draw_set_color(itHover == self? COLORS._main_text_accent : COLORS._main_text);
draw_text_add(lx + ui(20), _y + lh / 2 - ui(2), name);
}
return res;
} #endregion
static addItem = function(_item) { #region
array_push(contents, _item);
_item.parent = self;
return self;
}
} #endregion
static serialize = function() {
static serialize = function() { #region
var _map = {};
_map.type = "Folder";
_map.name = name;
_map.show = show;
_map.color = color;
var _content = array_create(array_length(contents));
@ -67,10 +173,12 @@ function timelineItemGroup() : timelineItem() constructor {
_map.contents = _content;
return _map;
}
} #endregion
static deserialize = function(_map) {
static deserialize = function(_map) { #region
color = _map.color;
name = struct_try_get(_map, "name", "");
show = struct_try_get(_map, "show", true);
contents = array_create(array_length(_map.contents));
for( var i = 0, n = array_length(_map.contents); i < n; i++ ) {
@ -79,5 +187,5 @@ function timelineItemGroup() : timelineItem() constructor {
}
return self;
}
} #endregion
}