This commit is contained in:
Tanasart 2024-09-16 14:29:37 +07:00
parent a559812400
commit f1f9aa197b
18 changed files with 207 additions and 240 deletions

View file

@ -2626,7 +2626,6 @@
{"name":"s_sort_24","order":189,"path":"sprites/s_sort_24/s_sort_24.yy",},
{"name":"s_splice_draw","order":60,"path":"sprites/s_splice_draw/s_splice_draw.yy",},
{"name":"s_star","order":190,"path":"sprites/s_star/s_star.yy",},
{"name":"s_steam_1","order":192,"path":"sprites/s_steam_1/s_steam_1.yy",},
{"name":"s_steam_creator","order":193,"path":"sprites/s_steam_creator/s_steam_creator.yy",},
{"name":"s_steam","order":191,"path":"sprites/s_steam/s_steam.yy",},
{"name":"s_strand_tool_comb","order":61,"path":"sprites/s_strand_tool_comb/s_strand_tool_comb.yy",},

View file

@ -3377,7 +3377,6 @@
{"id":{"name":"s_sort_24","path":"sprites/s_sort_24/s_sort_24.yy",},},
{"id":{"name":"s_splice_draw","path":"sprites/s_splice_draw/s_splice_draw.yy",},},
{"id":{"name":"s_star","path":"sprites/s_star/s_star.yy",},},
{"id":{"name":"s_steam_1","path":"sprites/s_steam_1/s_steam_1.yy",},},
{"id":{"name":"s_steam_creator","path":"sprites/s_steam_creator/s_steam_creator.yy",},},
{"id":{"name":"s_steam","path":"sprites/s_steam/s_steam.yy",},},
{"id":{"name":"s_strand_tool_comb","path":"sprites/s_strand_tool_comb/s_strand_tool_comb.yy",},},

Binary file not shown.

View file

@ -1,4 +1,12 @@
function APPEND(_path, context = PANEL_GRAPH.getCurrentContext()) { #region
function GetAppendID(old_id) {
if(old_id == noone) return noone;
if(ds_map_exists(APPEND_MAP, old_id))
return APPEND_MAP[? old_id];
return noone;
}
function APPEND(_path, context = PANEL_GRAPH.getCurrentContext()) {
CALL("append");
if(_path == "") return noone;
@ -14,9 +22,9 @@ function APPEND(_path, context = PANEL_GRAPH.getCurrentContext()) { #region
log_message("FILE", "append file " + _path, THEME.noti_icon_file_load);
return node_create;
} #endregion
}
function __APPEND_MAP(_map, context = PANEL_GRAPH.getCurrentContext(), appended_list = []) { #region
function __APPEND_MAP(_map, context = PANEL_GRAPH.getCurrentContext(), appended_list = []) {
static log = false;
UNDO_HOLDING = true;
@ -154,13 +162,4 @@ function __APPEND_MAP(_map, context = PANEL_GRAPH.getCurrentContext(), appended_
}
return node_create;
} #endregion
function GetAppendID(old_id) { #region
if(old_id == noone) return noone;
if(ds_map_exists(APPEND_MAP, old_id))
return APPEND_MAP[? old_id];
// print("Get append ID error: " + string(old_id));
return noone;
} #endregion
}

View file

@ -4,8 +4,8 @@ function __initCollection() {
globalvar COLLECTIONS;
COLLECTIONS = -1;
var root = DIRECTORY + "Collections";
directory_verify(root);
var root = DIRECTORY + "Collections"; directory_verify(root);
var rootz = DIRECTORY + "Collections_cache"; directory_verify(rootz);
if(check_version($"{root}/version"))
zip_unzip("data/Collections.zip", root);
@ -51,12 +51,19 @@ function searchCollection(_list, _search_str, _clear_list = true) {
function saveCollection(_node, _path, _name, save_surface = true, metadata = noone) {
if(_node == noone) return;
var _pre_name = (_path == ""? "" : _path + "/") + _name;
var ext = filename_ext(_pre_name);
_path = ext == ".pxcc"? _pre_name : _pre_name + ".pxcc";
var _pxz = false;
var _file = _path + "/" + filename_name_only(_name);
if(_pxz) {
_path = _file + ".pxz";
SAVE_PXZ_COLLECTION(_node, _path, PANEL_PREVIEW.getNodePreviewSurface(), metadata, _node.group);
SAVE_COLLECTION(_node, _path, save_surface, metadata, _node.group);
} else {
_path = _file + ".pxcc";
SAVE_COLLECTION(_node, _path, save_surface, metadata, _node.group);
}
PANEL_COLLECTION.updated_path = _path;
PANEL_COLLECTION.updated_prog = 1;
PANEL_COLLECTION.refreshContext();

View file

@ -1,4 +1,4 @@
function FileObject(_name, _path) constructor { #region
function FileObject(_name, _path) constructor {
static loadThumbnailAsync = false;
name = _name;
@ -13,19 +13,25 @@ function FileObject(_name, _path) constructor { #region
var _mname = filename_name_only(path);
meta_path = $"{_mdir}/{_mname}.meta";
meta = noone;
type = FILE_TYPE.collection;
type = FILE_TYPE.assets;
switch(filename_ext_raw(path)) {
var _ext = filename_ext_raw(path);
switch(_ext) {
case "png" :
case "jpg" :
case "gif" :
type = FILE_TYPE.assets;
break;
case "pxc" :
case "pxc" :
case "cpxc" :
type = FILE_TYPE.project;
break;
case "pxcc" :
case "pxz" :
type = FILE_TYPE.collection;
break;
}
retrive_data = false;
@ -121,9 +127,9 @@ function FileObject(_name, _path) constructor { #region
return meta;
}
} #endregion
}
function DirectoryObject(name, path) constructor { #region
function DirectoryObject(name, path) constructor {
self.name = name;
self.path = path;
@ -247,4 +253,4 @@ function DirectoryObject(name, path) constructor { #region
return hh;
}
} #endregion
}

View file

@ -76,7 +76,9 @@ function mouse_press(mouse, focus = true, pass = false) {
if(!focus) return false;
if(PEN_RIGHT_PRESS) return mouse == mb_right;
if(mouse == mb_any) return winwin_mouse_check_button_pressed_safe(WINDOW_ACTIVE, mb_left) || winwin_mouse_check_button_pressed_safe(WINDOW_ACTIVE, mb_right);
if(mouse == mb_any) return winwin_mouse_check_button_pressed_safe(WINDOW_ACTIVE, mb_left) ||
winwin_mouse_check_button_pressed_safe(WINDOW_ACTIVE, mb_right) ||
winwin_mouse_check_button_pressed_safe(WINDOW_ACTIVE, mb_middle);
return winwin_mouse_check_button_pressed_safe(WINDOW_ACTIVE, mouse);
}

View file

@ -1,5 +1,4 @@
#region funtion calls
function panel_animation_settings() { var dia = dialogPanelCall(new Panel_Animation_Setting()); dia.anchor = ANCHOR.none; }
function panel_animation_scale() { dialogPanelCall(new Panel_Animation_Scaler()); }
@ -324,10 +323,10 @@ function Panel_Animation() : PanelContent() constructor {
tool_width_mx = 0;
#endregion
on_end_dragging_anim = noone;
onion_dragging = noone;
prev_cache = array_create(TOTAL_FRAMES);
copy_clipboard = ds_list_create();
on_end_dragging_anim = noone;
onion_dragging = noone;
prev_cache = array_create(TOTAL_FRAMES);
copy_clipboard = ds_list_create();
__collapse = false;
function collapseToggle() {
@ -524,9 +523,7 @@ function Panel_Animation() : PanelContent() constructor {
}
}
function arrangeKeys() {
//keyframe_selecting = l;
}
function arrangeKeys() {}
function staggerKeys(_index, _stag) {
var modified = false;
@ -596,7 +593,7 @@ function Panel_Animation() : PanelContent() constructor {
}
resetTimelineMask();
function getTimelineContentFolder(folder, _context = [], _depth = 0, _show = true) { #region
function getTimelineContentFolder(folder, _context = [], _depth = 0, _show = true) {
var ind = 0;
for( var i = 0, n = array_length(folder.contents); i < n; i++ ) {
@ -653,12 +650,12 @@ function Panel_Animation() : PanelContent() constructor {
if(item_dragging == noone || item_dragging.item != _cont) ind++;
}
} #endregion
}
function getTimelineContent() { #region
function getTimelineContent() {
timeline_contents = [];
getTimelineContentFolder(PROJECT.timelines);
} #endregion
}
function drawTimeline() { // Draw summary
var bar_x = tool_width + ui(16);
@ -674,27 +671,23 @@ function Panel_Animation() : PanelContent() constructor {
surface_set_target(timeline_surface);
draw_clear_alpha(COLORS.panel_bg_clear, 0);
#region bg
draw_sprite_stretched(THEME.ui_panel_bg, 1, 0, 0, bar_w, bar_h);
draw_sprite_stretched_ext(THEME.ui_panel_bg, 2, 0, 0, bar_w, bar_h, COLORS.panel_animation_timeline_blend, 1);
#endregion
draw_sprite_stretched(THEME.ui_panel_bg, 1, 0, 0, bar_w, bar_h);
draw_sprite_stretched_ext(THEME.ui_panel_bg, 2, 0, 0, bar_w, bar_h, COLORS.panel_animation_timeline_blend, 1);
#region cache
if(inspecting && inspecting.use_cache) {
for(var i = 0; i < TOTAL_FRAMES; i++) {
if(i >= array_length(inspecting.cache_result))
break;
var x0 = (i + 0) * timeline_scale + timeline_shift;
var x1 = (i + 1) * timeline_scale + timeline_shift;
if(inspecting && inspecting.use_cache) { //cache
for(var i = 0; i < TOTAL_FRAMES; i++) {
if(i >= array_length(inspecting.cache_result))
break;
draw_set_color(inspecting.getAnimationCacheExist(i)? c_lime : c_red);
draw_set_alpha(0.05);
draw_rectangle(x0, 0, x1, bar_h, false);
draw_set_alpha(1);
}
var x0 = (i + 0) * timeline_scale + timeline_shift;
var x1 = (i + 1) * timeline_scale + timeline_shift;
draw_set_color(inspecting.getAnimationCacheExist(i)? c_lime : c_red);
draw_set_alpha(0.05);
draw_rectangle(x0, 0, x1, bar_h, false);
draw_set_alpha(1);
}
#endregion
}
#region lines
if(inspecting) inspecting.drawAnimationTimeline(timeline_shift, bar_w, bar_h, timeline_scale);
@ -1359,7 +1352,7 @@ function Panel_Animation() : PanelContent() constructor {
}
}
function _drawDopesheetAnimatorKeysBG(animator, msx, msy) { #region
function _drawDopesheetAnimatorKeysBG(animator, msx, msy) {
var prop_dope_y = animator.y;
var key_hover = noone;
var key_list = animator.values;
@ -1415,11 +1408,11 @@ function Panel_Animation() : PanelContent() constructor {
}
return key_hover;
} #endregion
}
__keyframe_editing = noone;
function _drawDopesheetAnimatorKeys(_cont, animator, msx, msy) { #region
function _drawDopesheetAnimatorKeys(_cont, animator, msx, msy) {
var _node = _cont.node;
var prop_y = animator.y;
var node_y = _cont.y;
@ -1501,9 +1494,9 @@ function Panel_Animation() : PanelContent() constructor {
}
return key_hover;
} #endregion
}
function __drawDopesheetLabelAnimator(_item, _node, animator, msx, msy) { #region
function __drawDopesheetLabelAnimator(_item, _node, animator, msx, msy) {
var prop = animator.prop;
var aa = _node.group == PANEL_GRAPH.getCurrentContext()? 1 : 0.9;
var tx = tool_width;
@ -1657,9 +1650,9 @@ function Panel_Animation() : PanelContent() constructor {
draw_sprite_ui_uniform(THEME.prop_on_end, prop.on_end, tx, ty, 1, on_end_dragging_anim == prop? COLORS._main_accent : COLORS._main_icon, _on_end_disp);
draw_set_alpha(1);
} #endregion
}
function __drawDopesheetLabelItem(_item, _x, _y, msx = -1, msy = -1, alpha = 1) { #region
function __drawDopesheetLabelItem(_item, _x, _y, msx = -1, msy = -1, alpha = 1) {
var _itx = _x;
var _ity = _y;
var _itw = tool_width;
@ -1682,9 +1675,9 @@ function Panel_Animation() : PanelContent() constructor {
if(mouse_press(mb_right, _foc))
context_selecting_item = _item;
}
} #endregion
}
function _drawDopesheetLabel() { #region
function _drawDopesheetLabel() {
surface_set_target(dope_sheet_name_surface);
draw_clear_alpha(COLORS.panel_bg_clear_inner, 0);
var msx = mx - ui(8);
@ -1806,9 +1799,9 @@ function Panel_Animation() : PanelContent() constructor {
draw_surface_safe(dope_sheet_name_mask);
gpu_set_blendmode(bm_normal);
surface_reset_target();
} #endregion
}
function drawDopesheet() { #region
function drawDopesheet() {
var bar_x = tool_width + ui(16);
var bar_y = h - timeline_h - ui(10);
var bar_w = timeline_w;
@ -2463,7 +2456,7 @@ function Panel_Animation() : PanelContent() constructor {
_drawDopesheetLabel();
if(keyframe_boxable && mouse_press(mb_right, pFOCUS)) { #region context menu
if(keyframe_boxable && mouse_press(mb_right, pFOCUS)) { // context menu
if(point_in_rectangle(mx, my, bar_x, ui(8), bar_x + dope_sheet_w, ui(8) + dope_sheet_h)) {
if(array_empty(keyframe_selecting)) menuCall("animation_keyframe_empty_menu", keyframe_menu_empty);
@ -2487,7 +2480,7 @@ function Panel_Animation() : PanelContent() constructor {
else if(is_instanceof(context_selecting_item.item, timelineItemGroup))
menuCall("animation_name_empty_menu", name_menu_group);
}
} #endregion
}
draw_sprite_stretched(THEME.ui_panel_bg, 1, ui(8), ui(8), tool_width, dope_sheet_h);
draw_surface_safe(dope_sheet_name_surface, ui(8), ui(8));
@ -2498,9 +2491,9 @@ function Panel_Animation() : PanelContent() constructor {
draw_sprite_stretched(THEME.ui_panel_bg_cover, 1, bar_x, ui(8), bar_w, dope_sheet_h);
if(item_dragging != noone) __drawDopesheetLabelItem(item_dragging, mx - item_dragging_dx, my - item_dragging_dy,,, 0.5);
} #endregion
}
function drawAnimationControl() { #region
function drawAnimationControl() {
var mini = w < ui(348);
var amo = array_length(control_buttons);
@ -2573,7 +2566,7 @@ function Panel_Animation() : PanelContent() constructor {
by += ui(36);
bx = w - ui(44);
if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), [mx, my], pFOCUS, pHOVER, __txtx("panel_animation_animation_settings", "Animation settings"), THEME.animation_setting, 2) == 2)
if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), [mx, my], pFOCUS, pHOVER, __txtx("panel_animation_animation_settings", "Animation settings"), THEME.gear, 2) == 2)
dialogPanelCall(new Panel_Animation_Setting(), x + bx + ui(32), y + by - ui(8), { anchor: ANCHOR.right | ANCHOR.bottom });
by -= ui(40); if(by < 8) return;
@ -2609,9 +2602,9 @@ function Panel_Animation() : PanelContent() constructor {
txt = __txt("Onion skin");
if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(28), [mx, my], pFOCUS, pHOVER, txt, THEME.onion_skin,, PROJECT.onion_skin.enabled? c_white : COLORS._main_icon) == 2)
PROJECT.onion_skin.enabled = !PROJECT.onion_skin.enabled;
} #endregion
}
function drawContent(panel) { #region >>>>>>>>>>>>>>>>>>>> MAIN DRAW <<<<<<<<<<<<<<<<<<<<
function drawContent(panel) { // >>>>>>>>>>>>>>>>>>>> MAIN DRAW <<<<<<<<<<<<<<<<<<<<
draw_clear_alpha(COLORS.panel_bg_clear, 0);
if(!PROJECT.active) return;
@ -2649,9 +2642,9 @@ function Panel_Animation() : PanelContent() constructor {
TOOLTIP = $"{__txt("Frame")} {timeline_show_time + 1}/{TOTAL_FRAMES}";
timeline_show_time = -1;
}
} #endregion
}
function doDuplicate() { #region
function doDuplicate() {
if(array_empty(keyframe_selecting)) return;
var clones = [];
@ -2668,15 +2661,15 @@ function Panel_Animation() : PanelContent() constructor {
keyframe_drag_type = KEYFRAME_DRAG_TYPE.move;
keyframe_drag_mx = mx;
keyframe_drag_my = my;
} #endregion
}
function doCopy() { #region
function doCopy() {
ds_list_clear(copy_clipboard);
for( var i = 0, n = array_length(keyframe_selecting); i < n; i++ )
ds_list_add(copy_clipboard, keyframe_selecting[i]);
} #endregion
}
function doPaste(val = noone) { #region
function doPaste(val = noone) {
if(ds_list_empty(copy_clipboard)) return;
var shf = 0;
@ -2714,5 +2707,5 @@ function Panel_Animation() : PanelContent() constructor {
for( var i = 0; i < ds_list_size(copy_clipboard); i++ )
copy_clipboard[| i].cloneAnimator(shf, (multiVal || val == noone)? noone : val.animator);
}
} #endregion
}
}

View file

@ -52,7 +52,6 @@ function Panel_Collection() : PanelContent() constructor {
updated_path = noone;
updated_prog = 0;
data_path = "";
view_tooltip = new tooltipSelector("View", [ "Grid", "List" ])
PANEL_COLLECTION = self;
@ -510,13 +509,15 @@ function Panel_Collection() : PanelContent() constructor {
var bh = line_get_height(f_p0b, 8);
var rootx = 0;
draw_set_font(f_p0b);
for( var i = 0, n = array_length(roots); i < n; i++ ) {
draw_set_font(f_p0b);
var r = roots[i];
var _bx = _x - ui(8);
var _by = _y - bh / 2;
var _bw = string_width(r[0]) + ui(20);
var _tx = __txt(r[0]);
var _bw = string_width(_tx) + ui(20);
if(buttonInstant(THEME.button_hide_fill, _bx, _by, _bw, bh, [ mx, my ], pFOCUS, pHOVER) == 2) {
page = i;
@ -526,11 +527,11 @@ function Panel_Collection() : PanelContent() constructor {
}
if(i == page) draw_set_text(f_p0b, fa_left, fa_center, COLORS._main_text);
else draw_set_text(f_p0, fa_left, fa_center, COLORS._main_text_sub);
draw_text(_x, _y, __txt(r[0]));
if(i == page) draw_set_text(f_p0b, fa_center, fa_center, COLORS._main_text);
else draw_set_text(f_p0, fa_center, fa_center, COLORS._main_text_sub);
draw_text(_bx + _bw / 2, _y, _tx);
_x += string_width(r[0]) + ui(24);
_x += _bw + ui(4);
}
rootx = _x;
@ -540,18 +541,11 @@ function Panel_Collection() : PanelContent() constructor {
var bs = ui(32);
if(search_string == "") {
if(bx > rootx) {
view_tooltip.index = contentView;
if(buttonInstant(THEME.button_hide, bx, by, bs, bs, [mx, my], pFOCUS, pHOVER, view_tooltip, THEME.view_mode, contentView) == 2)
contentView = !contentView;
}
bx -= ui(36);
if(page == 0 && !DEMO) {
if(bx > rootx) {
if(context != root) {
var txt = __txtx("panel_collection_add_node", "Add selecting node as collection");
if(buttonInstant(THEME.button_hide, bx, by, bs, bs, [mx, my], pFOCUS, pHOVER, txt, THEME.add, 0, COLORS._main_value_positive) == 2) {
if(buttonInstant(THEME.button_hide, bx, by, bs, bs, [mx, my], pFOCUS, pHOVER, txt, THEME.add_20, 0, COLORS._main_value_positive) == 2) {
if(PANEL_INSPECTOR.getInspecting() != noone) {
data_path = context.path;
var dia = dialogCall(o_dialog_file_name_collection, mouse_mx + ui(8), mouse_my + ui(8));

View file

@ -3,25 +3,28 @@ function Panel_Collections_Setting() : Panel_Linear_Setting() constructor {
w = ui(380);
#region data
properties = [
new __Panel_Linear_Setting_Item_Preference(
__txtx("coll_animated", "Animated thumbnail"),
"collection_animated",
new checkBox(function() { PREFERENCES.collection_animated = !PREFERENCES.collection_animated; PREF_SAVE(); }),
),
new __Panel_Linear_Setting_Item_Preference(
__txtx("coll_animated_speed", "Animation speed"),
"collection_preview_speed",
new textBox(TEXTBOX_INPUT.number, function(val) { PREFERENCES.collection_preview_speed = val; PREF_SAVE(); }),
),
new __Panel_Linear_Setting_Item_Preference(
__txtx("coll_thumbnail_scale", "Thumbnail scale"),
"collection_scale",
slider(0, 1, 0.01, function(val) { PREFERENCES.collection_scale = clamp(val, 0.1, 1); PREF_SAVE(); }),
),
];
setHeight();
#endregion
properties = [
new __Panel_Linear_Setting_Item(
__txt("View"),
new buttonGroup([ "Grid", "List" ], function(i) { PANEL_COLLECTION.contentView = i; }),
function() /*=>*/ {return PANEL_COLLECTION.contentView},
),
new __Panel_Linear_Setting_Item_Preference(
__txtx("coll_animated", "Animated thumbnail"),
"collection_animated",
new checkBox(function() { PREFERENCES.collection_animated = !PREFERENCES.collection_animated; PREF_SAVE(); }),
),
new __Panel_Linear_Setting_Item_Preference(
__txtx("coll_animated_speed", "Animation speed"),
"collection_preview_speed",
new textBox(TEXTBOX_INPUT.number, function(val) { PREFERENCES.collection_preview_speed = val; PREF_SAVE(); }),
),
new __Panel_Linear_Setting_Item_Preference(
__txtx("coll_thumbnail_scale", "Thumbnail scale"),
"collection_scale",
slider(0, 1, 0.01, function(val) { PREFERENCES.collection_scale = clamp(val, 0.1, 1); PREF_SAVE(); }),
),
];
setHeight();
}

View file

@ -615,17 +615,20 @@ function Panel_Menu() : PanelContent() constructor {
if(STEAM_ENABLED) txt += " Steam";
version_name_copy = lerp_float(version_name_copy, 0, 10);
var tc = merge_color(COLORS._main_text_sub, COLORS._main_value_positive, min(1, version_name_copy));
var sc = merge_color(c_white, COLORS._main_value_positive, min(1, version_name_copy));
var tc = merge_color(COLORS._main_text_sub, COLORS._main_value_positive, min(1, version_name_copy));
var sc = merge_color(c_white, COLORS._main_value_positive, min(1, version_name_copy));
var fnt = f_p2;
if(hori) {
if(w > 1500) {
draw_set_text(f_p0, fa_center, fa_center, tc);
draw_set_text(fnt, fa_center, fa_center, tc);
var ww = string_width(txt) + ui(12);
var hh = string_height(txt) + ui(8);
var _x0 = _xx1 - ww;
var _y0 = ui(6);
var _x1 = _xx1;
var _y1 = h - ui(6);
var _y0 = h / 2 - hh / 2;
var _y1 = h / 2 + hh / 2;
if(pHOVER && point_in_rectangle(mx, my, _x0, _y0, _x1, _y1)) {
_draggable = false;
@ -646,7 +649,7 @@ function Panel_Menu() : PanelContent() constructor {
var _xx1 = ui(40);
var y1 = h - ui(20);
draw_set_text(f_p0, fa_left, fa_center, tc);
draw_set_text(fnt, fa_left, fa_center, tc);
var ww = string_width(txt) + ui(12);
if(pHOVER && point_in_rectangle(mx, my, _xx1, y1 - ui(16), _xx1 + ww, y1 + ui(16))) {
_draggable = false;

View file

@ -90,4 +90,4 @@ function path_is_backup(path) {
return string_letters(ext) != ext;
}
function filename_ext_raw(path) { return string_lower(string_letters(filename_ext(path))); }
function filename_ext_raw(path) { return string_lower(string_replace(filename_ext(path), ".", "")); }

View file

@ -152,6 +152,22 @@ function SAVE_COLLECTIONS(_list, _path, save_surface = true, metadata = noone, c
PANEL_MENU.setNotiIcon(THEME.noti_icon_file_save);
}
function SAVE_NODE(_arr, _node, dx = 0, dy = 0, scale = false, context = PANEL_GRAPH.getCurrentContext()) {
if(struct_has(_node, "nodes")) {
for(var i = 0; i < array_length(_node.nodes); i++)
SAVE_NODE(_arr, _node.nodes[i], dx, dy, scale, context);
}
var m = _node.serialize(scale);
m.x -= dx;
m.y -= dy;
var c = context == noone? noone : context.node_id;
if(m.group == c) m.group = noone;
array_push(_arr, m);
}
function SAVE_COLLECTION(_node, _path, save_surface = true, metadata = noone, context = PANEL_GRAPH.getCurrentContext()) {
if(save_surface) {
var preview_surface = PANEL_PREVIEW.getNodePreviewSurface();
@ -187,18 +203,48 @@ function SAVE_COLLECTION(_node, _path, save_surface = true, metadata = noone, co
PANEL_MENU.setNotiIcon(THEME.noti_icon_file_save);
}
function SAVE_NODE(_arr, _node, dx = 0, dy = 0, scale = false, context = PANEL_GRAPH.getCurrentContext()) {
if(struct_has(_node, "nodes")) {
for(var i = 0; i < array_length(_node.nodes); i++)
SAVE_NODE(_arr, _node.nodes[i], dx, dy, scale, context);
function SAVE_PXZ_COLLECTION(_node, _path, _surf = noone, metadata = noone, context = PANEL_GRAPH.getCurrentContext()) {
var _name = filename_name_only(_path);
var _path_icon = "";
var _path_node = "";
var _path_meta = "";
if(is_surface(_surf)) {
_path_icon = $"{TEMPDIR}{_name}.png";
surface_save_safe(_surf, _path_icon);
}
var m = _node.serialize(scale);
m.x -= dx;
m.y -= dy;
var _content = {};
_content.version = SAVE_VERSION;
var c = context == noone? noone : context.node_id;
if(m.group == c) m.group = noone;
var _nodes = [];
SAVE_NODE(_nodes, _node, _node.x, _node.y, true, context);
_content.nodes = _nodes;
array_push(_arr, m);
_path_node = $"{TEMPDIR}{_name}.pxcc";
json_save_struct(_path_node, _content, !PREFERENCES.save_file_minify);
if(metadata != noone) {
var _meta = metadata.serialize();
var _dir = filename_dir(_path);
var _name = filename_name_only(_path);
_path_meta = $"{TEMPDIR}{_name}.meta";
_meta.version = SAVE_VERSION;
json_save_struct(_path_meta, _meta, true);
}
print(_path_node);
var _z = zip_create();
if(_path_icon != "") zip_add_file(_z, $"{_name}.png", _path_icon);
if(_path_node != "") zip_add_file(_z, $"{_name}.pxcc", _path_node);
if(_path_meta != "") zip_add_file(_z, $"{_name}.meta", _path_meta);
zip_save(_z, _path);
var pane = findPanel("Panel_Collection");
if(pane) pane.refreshContext();
log_message("COLLECTION", "save collection at " + _path, THEME.noti_icon_file_save);
PANEL_MENU.setNotiIcon(THEME.noti_icon_file_save);
}

View file

@ -53,6 +53,12 @@ function filename_name_only(name) {
name = filename_name(name);
return string_replace(name, filename_ext(name), "")
}
function filename_ext_verify(_path, _ext) {
var _pext = filename_ext(_path);
if(_pext == _ext) return _path;
return filename_dir(_path) + "/" + filename_name_only(_path) + _ext;
}
function string_to_var(str) { INLINE return string_replace_all(string_replace_all(string_lower(str), " ", "_"), "/", "_"); }
function string_to_var2(context, name) { INLINE return string_to_var(context == ""? name : $"{context} {name}"); }

View file

@ -1,4 +1,4 @@
function __test_update_current_collections() { #region
function __test_update_current_collections() {
var st = ds_stack_create();
ds_stack_push(st, PANEL_COLLECTION.context);
@ -29,9 +29,9 @@ function __test_update_current_collections() { #region
ds_stack_destroy(st);
print("---------- COLLECTION UPDATING ENDED ----------");
} #endregion
}
function __test_update_sample_projects() { #region
function __test_update_sample_projects() {
print("---------- PROJECT UPDATING STARTED ----------");
for( var i = 0; i < ds_list_size(SAMPLE_PROJECTS); i++ ) {
@ -48,9 +48,9 @@ function __test_update_sample_projects() { #region
}
print("---------- PROJECT UPDATING ENDED ----------");
} #endregion
}
function __test_load_current_collections() { #region
function __test_load_current_collections() {
var st = ds_stack_create();
ds_stack_push(st, PANEL_COLLECTION.context);
@ -112,9 +112,9 @@ function __test_load_current_collections() { #region
ds_stack_destroy(st);
print("---------- COLLECTION TESTING ENDED ----------");
} #endregion
}
function __test_load_all_nodes() { #region
function __test_load_all_nodes() {
var amo = ds_map_size(ALL_NODES);
var k = ds_map_find_first(ALL_NODES);
var xx = 0;
@ -156,9 +156,9 @@ function __test_load_all_nodes() { #region
k = ds_map_find_next(ALL_NODES, k);
}
LOADING = false;
} #endregion
}
function __test_metadata_current_collections() { #region
function __test_metadata_current_collections() {
var st = ds_stack_create();
ds_stack_push(st, PANEL_COLLECTION.context);
@ -184,9 +184,9 @@ function __test_metadata_current_collections() { #region
ds_stack_destroy(st);
print("---------- COLLECTION UPDATING ENDED ----------");
} #endregion
}
function __test_generate_theme() { #region
function __test_generate_theme() {
var _txt = "function Theme() constructor {\n";
var _spr = struct_get_names(THEME);
@ -195,4 +195,4 @@ function __test_generate_theme() { #region
_txt += "}";
clipboard_set_text(_txt);
} #endregion
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 606 B

View file

@ -1,90 +0,0 @@
{
"$GMSprite":"",
"%Name":"s_steam_1",
"bboxMode":0,
"bbox_bottom":21,
"bbox_left":2,
"bbox_right":21,
"bbox_top":2,
"collisionKind":1,
"collisionTolerance":0,
"DynamicTexturePage":false,
"edgeFiltering":false,
"For3D":false,
"frames":[
{"$GMSpriteFrame":"","%Name":"8dce44ab-cece-4894-b0c0-dc5c384d5adc","name":"8dce44ab-cece-4894-b0c0-dc5c384d5adc","resourceType":"GMSpriteFrame","resourceVersion":"2.0",},
],
"gridX":0,
"gridY":0,
"height":24,
"HTile":false,
"layers":[
{"$GMImageLayer":"","%Name":"87ce7fb2-f0cf-4ef8-b3d8-e1bbfe25518c","blendMode":0,"displayName":"default","isLocked":false,"name":"87ce7fb2-f0cf-4ef8-b3d8-e1bbfe25518c","opacity":100.0,"resourceType":"GMImageLayer","resourceVersion":"2.0","visible":true,},
],
"name":"s_steam_1",
"nineSlice":null,
"origin":4,
"parent":{
"name":"icon",
"path":"folders/theme/icon.yy",
},
"preMultiplyAlpha":false,
"resourceType":"GMSprite",
"resourceVersion":"2.0",
"sequence":{
"$GMSequence":"",
"%Name":"s_steam_1",
"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_steam_1",
"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":"8dce44ab-cece-4894-b0c0-dc5c384d5adc","path":"sprites/s_steam_1/s_steam_1.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},
},"Disabled":false,"id":"6faf9cac-f169-4b98-b50d-c0cc53b269e7","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":12,
"yorigin":12,
},
"swatchColours":null,
"swfPrecision":0.5,
"textureGroupId":{
"name":"Default",
"path":"texturegroups/Default",
},
"type":0,
"VTile":false,
"width":24,
}