mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2025-01-23 19:38:05 +01:00
1.16rc5
This commit is contained in:
parent
292deadd78
commit
27c9c6fb8d
30 changed files with 318 additions and 203 deletions
|
@ -61,7 +61,7 @@ event_inherited();
|
|||
hh += data[i] == -1? ui(8) : hght;
|
||||
|
||||
dialog_h = min(max_h, hh);
|
||||
sc_content.resize(dialog_w, dialog_h);
|
||||
sc_content.resize(dialog_w, dialog_h - ui(40));
|
||||
|
||||
resetPosition();
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
tb_search.sprite_index = 0;
|
||||
|
||||
sc_content.setFocusHover(sFOCUS, sHOVER);
|
||||
sc_content.draw(dialog_x, dialog_y + ui(16 + 24));
|
||||
sc_content.draw(dialog_x, dialog_y + ui(40));
|
||||
|
||||
draw_sprite_stretched(THEME.textbox, 1, dialog_x, dialog_y, dialog_w, dialog_h);
|
||||
#endregion
|
|
@ -40,7 +40,7 @@ event_inherited();
|
|||
var y0 = dialog_y + ui(128);
|
||||
var y1 = dialog_y + dialog_h - ui(16);
|
||||
|
||||
sp_recent = new scrollPane(x1 - x0 - ui(12), y1 - y0, function(_y, _m) {
|
||||
sp_recent = new scrollPane(x1 - x0 - ui(12), y1 - y0, function(_y, _m) { #region
|
||||
draw_clear_alpha(COLORS.panel_bg_clear_inner, 0);
|
||||
var expand = PREFERENCES.splash_expand_recent;
|
||||
var ww = ui(264);
|
||||
|
@ -104,12 +104,12 @@ event_inherited();
|
|||
}
|
||||
|
||||
return hh;
|
||||
});
|
||||
}); #endregion
|
||||
|
||||
x0 = x1 + ui(16);
|
||||
x1 = dialog_x + dialog_w - ui(16);
|
||||
|
||||
sp_sample = new scrollPane(x1 - x0 - ui(12), y1 - y0, function(_y, _m) {
|
||||
sp_sample = new scrollPane(x1 - x0 - ui(12), y1 - y0, function(_y, _m) { #region
|
||||
draw_clear_alpha(COLORS.panel_bg_clear_inner, 0);
|
||||
|
||||
var txt = pages[project_page];
|
||||
|
@ -149,6 +149,7 @@ event_inherited();
|
|||
draw_sprite_stretched_ext(THEME.node_active, 0, _boxx, yy, grid_width, grid_heigh, COLORS._main_accent, 1);
|
||||
if(mouse_press(mb_left, sFOCUS)) {
|
||||
LOAD_PATH(_project.path, true);
|
||||
PROJECT.thumbnail = _project.spr_path[0];
|
||||
METADATA.steam = txt == "Workshop";
|
||||
if(txt == "Workshop")
|
||||
METADATA.file_id = _meta.file_id;
|
||||
|
@ -201,7 +202,7 @@ event_inherited();
|
|||
}
|
||||
|
||||
return hh;
|
||||
});
|
||||
}); #endregion
|
||||
#endregion
|
||||
|
||||
#region contest
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
/// @description init
|
||||
PROJECT.modified = false;
|
||||
PREF_LOAD();
|
||||
|
||||
#region reset data
|
||||
ds_stack_clear(UNDO_STACK);
|
||||
|
|
|
@ -21,7 +21,7 @@ if(string(ev_id) == string(STEAM_UGC_ITEM_ID) && ev_type == "ugc_create_item") {
|
|||
|
||||
steam_ugc_set_item_tags(STEAM_UGC_UPDATE_HANDLE, tgs);
|
||||
steam_ugc_set_item_preview(STEAM_UGC_UPDATE_HANDLE, TEMPDIR + "steamUGCthumbnail.png");
|
||||
steam_ugc_set_item_content(STEAM_UGC_UPDATE_HANDLE, "steamUGC");
|
||||
steam_ugc_set_item_content(STEAM_UGC_UPDATE_HANDLE, DIRECTORY + "steamUGC");
|
||||
|
||||
STEAM_UGC_SUBMIT_ID = steam_ugc_submit_item_update(STEAM_UGC_UPDATE_HANDLE, "Initial upload");
|
||||
exit;
|
||||
|
|
|
@ -69,8 +69,12 @@ function Node_3D(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constr
|
|||
|
||||
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover = false, _focus = false) { #region
|
||||
if(!is_surface(mesh_prev_surface)) return;
|
||||
if(!previewable) return;
|
||||
|
||||
var bbox = drawGetBbox(xx, yy, _s);
|
||||
draw_surface_bbox(mesh_prev_surface, bbox);
|
||||
var aa = 0.5 + 0.5 * renderActive;
|
||||
if(!isHighlightingInGraph()) aa *= 0.25;
|
||||
|
||||
draw_surface_bbox(mesh_prev_surface, bbox,, aa);
|
||||
} #endregion
|
||||
}
|
|
@ -247,7 +247,7 @@ function __LOAD_PATH(path, readonly = false, override = false) { #region
|
|||
if(struct_has(_load_content, "timelines") && !array_empty(_load_content.timelines.contents))
|
||||
PROJECT.timelines.deserialize(_load_content.timelines);
|
||||
|
||||
PANEL_GRAPH.toCenterNode();
|
||||
run_in(1, PANEL_GRAPH.toCenterNode);
|
||||
|
||||
return true;
|
||||
} #endregion
|
||||
|
|
|
@ -54,6 +54,8 @@ function MetaDataManager() constructor {
|
|||
tags = struct_try_get(m, "tags", tags);
|
||||
version = struct_try_get(m, "version", version);
|
||||
|
||||
//if(STEAM_ENABLED && author_steam_id == STEAM_USER_ID) steam = true;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
|
|
|
@ -59,6 +59,8 @@ function Node_3D_Material(_x, _y, _group = noone) : Node_3D(_x, _y, _group) cons
|
|||
}
|
||||
|
||||
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
|
||||
if(!previewable) return;
|
||||
|
||||
var bbox = drawGetBbox(xx, yy, _s);
|
||||
var _mat = outputs[| 0].getValue();
|
||||
|
||||
|
@ -69,7 +71,11 @@ function Node_3D_Material(_x, _y, _group = noone) : Node_3D(_x, _y, _group) cons
|
|||
_mat = _mat[0];
|
||||
}
|
||||
|
||||
if(is_instanceof(_mat, __d3dMaterial) && is_surface(_mat.surface))
|
||||
draw_surface_bbox(_mat.surface, bbox);
|
||||
if(is_instanceof(_mat, __d3dMaterial) && is_surface(_mat.surface)) {
|
||||
var aa = 0.5 + 0.5 * renderActive;
|
||||
if(!isHighlightingInGraph()) aa *= 0.25;
|
||||
|
||||
draw_surface_bbox(_mat.surface, bbox,, aa);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -44,7 +44,7 @@ function Node_3D_Scene(_x, _y, _group = noone) : Node_3D(_x, _y, _group) constru
|
|||
|
||||
for( var i = input_fix_len, n = ds_list_size(inputs); i < n; i += data_length ) {
|
||||
var _obj = _data[i];
|
||||
if(_obj == noone) continue;
|
||||
if(!is_instanceof(_obj, __3dObject)) continue;
|
||||
|
||||
_scene.addObject(_obj);
|
||||
}
|
||||
|
|
|
@ -100,11 +100,16 @@ function Node_3D_Transform_Image(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y,
|
|||
static getPreviewValues = function() { return array_safe_get(all_inputs, in_mesh + 0, noone); }
|
||||
|
||||
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover = false, _focus = false) { #region
|
||||
if(!previewable) return;
|
||||
|
||||
var _surf = outputs[| 1].getValue();
|
||||
if(is_array(_surf)) _surf = array_safe_get(_surf[preview_index]);
|
||||
if(!is_surface(_surf)) return;
|
||||
|
||||
var bbox = drawGetBbox(xx, yy, _s);
|
||||
draw_surface_bbox(_surf, bbox);
|
||||
var aa = 0.5 + 0.5 * renderActive;
|
||||
if(!isHighlightingInGraph()) aa *= 0.25;
|
||||
|
||||
draw_surface_bbox(_surf, bbox,, aa);
|
||||
} #endregion
|
||||
}
|
|
@ -8,7 +8,7 @@ function Node_Array(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
|||
.setDisplay(VALUE_DISPLAY.enum_scroll, { data: [ "Any", "Surface", "Number", "Color", "Text" ], update_hover: false })
|
||||
.rejectArray();
|
||||
|
||||
inputs[| 1] = nodeValue("Spread array", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false )
|
||||
inputs[| 1] = nodeValue("Spread array", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false, "Unpack array and push the contents into the output one by one." )
|
||||
.rejectArray();
|
||||
|
||||
array_adjust_tool = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus) { #region
|
||||
|
@ -64,10 +64,10 @@ function Node_Array(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
|||
var _type = getInputData(0);
|
||||
|
||||
switch(_type) {
|
||||
case 1 : return VALUE_TYPE.surface;
|
||||
case 2 : return VALUE_TYPE.float;
|
||||
case 3 : return VALUE_TYPE.color;
|
||||
case 4 : return VALUE_TYPE.text;
|
||||
case 1 : return VALUE_TYPE.surface;
|
||||
case 2 : return VALUE_TYPE.float;
|
||||
case 3 : return VALUE_TYPE.color;
|
||||
case 4 : return VALUE_TYPE.text;
|
||||
default : return VALUE_TYPE.any;
|
||||
}
|
||||
} #endregion
|
||||
|
@ -104,7 +104,6 @@ function Node_Array(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
|||
input_display_list = [];
|
||||
for( var i = 0; i < ds_list_size(_l); i++ ) {
|
||||
_l[| i].index = i;
|
||||
_l[| i].setVisible(i < ds_list_size(_l) - 1);
|
||||
array_push(input_display_list, i);
|
||||
|
||||
if(i >= input_fix_len && _l[| i].isLeaf())
|
||||
|
@ -118,8 +117,29 @@ function Node_Array(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
|||
if(extra) lastNode = createNewInput();
|
||||
} #endregion
|
||||
|
||||
static updateType = function(resetVal = false) { #region
|
||||
var _typ = getType();
|
||||
outputs[| 0].setType(_typ);
|
||||
|
||||
for( var i = ds_list_size(inputs) - 1; i >= input_fix_len; i-- ) {
|
||||
if(resetVal) inputs[| i].resetValue();
|
||||
|
||||
if(inputs[| i].value_from == noone || (value_bit(inputs[| i].value_from.type) & value_bit(_typ) != 0)) {
|
||||
inputs[| i].setType(inputs[| i].value_from? inputs[| i].value_from.type : _typ);
|
||||
inputs[| i].resetDisplay();
|
||||
} else {
|
||||
inputs[| i].removeFrom();
|
||||
}
|
||||
}
|
||||
|
||||
refreshDynamicInput();
|
||||
} #endregion
|
||||
|
||||
static onValueUpdate = function(index = 0) { #region
|
||||
if(index < input_fix_len) return;
|
||||
if(LOADING || APPENDING) return;
|
||||
|
||||
if(index == 0) { updateType(true); return; }
|
||||
if(index == 1) return;
|
||||
|
||||
refreshDynamicInput();
|
||||
} #endregion
|
||||
|
@ -128,28 +148,29 @@ function Node_Array(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
|||
if(LOADING || APPENDING) return;
|
||||
|
||||
refreshDynamicInput();
|
||||
|
||||
var _typ = getType();
|
||||
if(_typ != VALUE_TYPE.any) return;
|
||||
|
||||
inputs[| index].setType(inputs[| index].value_from? inputs[| index].value_from.type : _typ);
|
||||
inputs[| index].resetDisplay();
|
||||
} #endregion
|
||||
|
||||
static update = function(frame = CURRENT_FRAME) { #region
|
||||
var _typ = getType();
|
||||
|
||||
outputs[| 0].setType(_typ);
|
||||
var res = [];
|
||||
var ind = 0;
|
||||
var spd = getInputData(1);
|
||||
var res = [];
|
||||
var ind = 0;
|
||||
var spd = getInputData(1);
|
||||
|
||||
for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i++ ) {
|
||||
var val = getInputData(i);
|
||||
|
||||
if(is_array(val) && spd) array_append(res, val);
|
||||
else array_push(res, val);
|
||||
|
||||
inputs[| i].setType(inputs[| i].value_from? inputs[| i].value_from.type : _typ);
|
||||
|
||||
if(i == input_fix_len && _typ == VALUE_TYPE.any && inputs[| i].value_from)
|
||||
outputs[| 0].setType(inputs[| i].value_from.type);
|
||||
}
|
||||
|
||||
if(_typ == VALUE_TYPE.any && inputs[| input_fix_len].value_from)
|
||||
outputs[| 0].setType(inputs[| input_fix_len].value_from.type);
|
||||
outputs[| 0].setValue(res);
|
||||
|
||||
if(outputs[| 0].type == VALUE_TYPE.surface) {
|
||||
|
@ -161,13 +182,7 @@ function Node_Array(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
|||
}
|
||||
} #endregion
|
||||
|
||||
static doApplyDeserialize = function() { #region
|
||||
var _typ = getType();
|
||||
if(_typ == VALUE_TYPE.any) return;
|
||||
|
||||
for( var i = input_fix_len; i < ds_list_size(inputs); i++ ) {
|
||||
inputs[| i].setType(_typ);
|
||||
inputs[| i].resetDisplay();
|
||||
}
|
||||
static postConnect = function() { #region
|
||||
updateType(false);
|
||||
} #endregion
|
||||
}
|
|
@ -9,10 +9,13 @@ function Node_Combine_RGB(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
|
|||
inputs[| 4] = nodeValue("Sampling type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
|
||||
.setDisplay(VALUE_DISPLAY.enum_scroll, ["Brightness", "Channel value"]);
|
||||
|
||||
inputs[| 5] = nodeValue("Base value", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0, "Set value to the unconnected color channels.")
|
||||
.setDisplay(VALUE_DISPLAY.slider);
|
||||
|
||||
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
|
||||
|
||||
input_display_list = [
|
||||
["Sampling", false], 4,
|
||||
["Sampling", false], 4, 5,
|
||||
["Surfaces", true], 0, 1, 2, 3,
|
||||
]
|
||||
|
||||
|
@ -24,6 +27,7 @@ function Node_Combine_RGB(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
|
|||
var _b = _data[2];
|
||||
var _a = _data[3];
|
||||
var _mode = _data[4];
|
||||
var _base = _data[5];
|
||||
|
||||
surface_set_shader(_outSurf, sh_combine_rgb);
|
||||
shader_set_surface("samplerR", _r);
|
||||
|
@ -31,7 +35,12 @@ function Node_Combine_RGB(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
|
|||
shader_set_surface("samplerB", _b);
|
||||
shader_set_surface("samplerA", _a);
|
||||
|
||||
shader_set_i("useR", is_surface(_r));
|
||||
shader_set_i("useG", is_surface(_g));
|
||||
shader_set_i("useB", is_surface(_b));
|
||||
shader_set_i("useA", is_surface(_a));
|
||||
|
||||
shader_set_f("base", _base);
|
||||
shader_set_i("mode", _mode);
|
||||
|
||||
draw_sprite_stretched(s_fx_pixel, 0, 0, 0, surface_get_width_safe(_outSurf), surface_get_height_safe(_outSurf));
|
||||
|
|
|
@ -182,6 +182,9 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
|
|||
graph_preview_alpha = 1;
|
||||
|
||||
getPreviewingNode = noone;
|
||||
|
||||
preview_value = 0;
|
||||
preview_array = "";
|
||||
#endregion
|
||||
|
||||
#region ---- rendering ----
|
||||
|
@ -824,9 +827,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
|
|||
static onPreDraw = function(_x, _y, _s, _iny, _outy) {}
|
||||
|
||||
static isHighlightingInGraph = function() { #region
|
||||
var _high = struct_try_get(display_parameter, "highlight", 0);
|
||||
var high = (_high == 1 && key_mod_press(ALT) || _high == 2);
|
||||
|
||||
var high = struct_try_get(display_parameter, "highlight", 0);
|
||||
var _selc = active_draw_index == 0 || branch_drawing;
|
||||
return !high || _selc;
|
||||
} #endregion
|
||||
|
@ -1009,6 +1010,9 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
|
|||
var hovering = noone;
|
||||
var drawLineIndex = 1;
|
||||
|
||||
var high = struct_try_get(params, "highlight", 0);
|
||||
var bg = struct_try_get(params, "bg", c_black);
|
||||
|
||||
for(var i = 0; i < ds_list_size(outputs); i++) {
|
||||
var jun = outputs[| i];
|
||||
var connected = false;
|
||||
|
@ -1022,6 +1026,12 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
|
|||
jun.drawLineIndex = drawLineIndex;
|
||||
drawLineIndex += 0.5;
|
||||
}
|
||||
|
||||
if(high) {
|
||||
jun.draw_blend_color = bg;
|
||||
jun.draw_blend = PREFERENCES.connection_line_highlight_fade;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var st = 0;
|
||||
|
@ -1036,6 +1046,11 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
|
|||
else if(i == -2) jun = inspectInput2;
|
||||
else jun = inputs[| i];
|
||||
|
||||
if(high) {
|
||||
jun.draw_blend_color = bg;
|
||||
jun.draw_blend = PREFERENCES.connection_line_highlight_fade;
|
||||
}
|
||||
|
||||
if(is_instanceof(jun, NodeModule)) {
|
||||
jun.drawConnections(params, _inputs);
|
||||
continue;
|
||||
|
@ -1108,23 +1123,21 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
|
|||
|
||||
var bbox = drawGetBbox(xx, yy, _s);
|
||||
var aa = 0.5 + 0.5 * renderActive;
|
||||
if(!isHighlightingInGraph()) aa *= 0.25;
|
||||
|
||||
draw_surface_bbox(preview_surface, bbox, c_white, aa * graph_preview_alpha);
|
||||
} #endregion
|
||||
|
||||
static getNodeDimension = function(showFormat = true) { #region
|
||||
if(!is_surface(preview_surface)) {
|
||||
if(ds_list_size(outputs))
|
||||
return "[" + array_shape(outputs[| 0].getValue()) + "]";
|
||||
return "";
|
||||
}
|
||||
if(!is_surface(preview_surface))
|
||||
return preview_array;
|
||||
|
||||
var pw = surface_get_width_safe(preview_surface);
|
||||
var ph = surface_get_height_safe(preview_surface);
|
||||
var format = surface_get_format(preview_surface);
|
||||
|
||||
var txt = "[" + string(pw) + " x " + string(ph) + " ";
|
||||
if(preview_amount) txt = string(preview_amount) + " x " + txt;
|
||||
var txt = $"[{pw} x {ph} ";
|
||||
if(preview_amount) txt = $"{preview_amount} x {txt}";
|
||||
|
||||
switch(format) {
|
||||
case surface_rgba4unorm : txt += showFormat? "4RGBA" : "4R"; break;
|
||||
|
@ -1205,11 +1218,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
|
|||
draw_sprite_stretched_ext(THEME.node_glow, 0, xx - 9, yy - 9, w * _s + 18, h * _s + 18, COLORS._main_value_negative, 1);
|
||||
|
||||
drawNodeBase(xx, yy, _s);
|
||||
if(previewable) {
|
||||
if(preview_channel >= ds_list_size(outputs))
|
||||
preview_channel = 0;
|
||||
drawPreview(xx, yy, _s);
|
||||
}
|
||||
if(previewable) drawPreview(xx, yy, _s);
|
||||
drawDimension(xx, yy, _s);
|
||||
|
||||
onDrawNode(xx, yy, _mx, _my, _s, PANEL_GRAPH.node_hovering == self, PANEL_GRAPH.getFocusingNode() == self);
|
||||
|
@ -1220,9 +1229,10 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
|
|||
active_draw_index = -1;
|
||||
}
|
||||
|
||||
if(draw_droppable)
|
||||
if(draw_droppable) {
|
||||
draw_sprite_stretched_ext(THEME.ui_panel_active, 0, xx, yy, w * _s, h * _s, COLORS._main_value_positive, 1);
|
||||
draw_droppable = false;
|
||||
draw_droppable = false;
|
||||
}
|
||||
|
||||
return drawJunctions(xx, yy, _mx, _my, _s);
|
||||
} #endregion
|
||||
|
@ -1260,19 +1270,23 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
|
|||
previewing = 0;
|
||||
} #endregion
|
||||
|
||||
static drawBranch = function() { #region
|
||||
static drawBranch = function(_depth = 0) { #region
|
||||
if(branch_drawing) return;
|
||||
branch_drawing = true;
|
||||
|
||||
if(!PREFERENCES.connection_line_highlight_all && _depth == 1) return;
|
||||
|
||||
for( var i = 0, n = ds_list_size(inputs); i < n; i++ ) {
|
||||
if(inputs[| i].isLeaf()) continue;
|
||||
inputs[| i].value_from.node.drawBranch();
|
||||
inputs[| i].value_from.node.drawBranch(_depth + 1);
|
||||
}
|
||||
} #endregion
|
||||
|
||||
static drawActive = function(_x, _y, _s, ind = 0) { #region
|
||||
active_draw_index = ind;
|
||||
|
||||
if(PREFERENCES.connection_line_highlight_all) drawBranch();
|
||||
var high = struct_try_get(display_parameter, "highlight", 0);
|
||||
if(high) drawBranch();
|
||||
} #endregion
|
||||
|
||||
static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny) {}
|
||||
|
|
|
@ -16,40 +16,54 @@ function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constru
|
|||
#region data
|
||||
data_type_list = [ "Integer", "Float", "Boolean", "Color", "Surface",
|
||||
"File Path", "Curve", "Text", "Object", "Node",
|
||||
"3D object", "Any", "Path", "Particle", "Rigidbody Object",
|
||||
"Domain", "Struct", "Strands", "Mesh", "Trigger",
|
||||
-1, "Any", "Path", "Particle", "Rigidbody Object",
|
||||
"Domain", "Struct", "Strands", "Mesh", "Trigger",
|
||||
-1, "3D Mesh", "3D Light", "3D Scene", "3D Material",
|
||||
-1, "Audio"
|
||||
];
|
||||
|
||||
data_type_map = [ VALUE_TYPE.integer, VALUE_TYPE.float, VALUE_TYPE.boolean, VALUE_TYPE.color, VALUE_TYPE.surface,
|
||||
VALUE_TYPE.path, VALUE_TYPE.curve, VALUE_TYPE.text, VALUE_TYPE.object, VALUE_TYPE.node,
|
||||
VALUE_TYPE.d3object, VALUE_TYPE.any, VALUE_TYPE.pathnode, VALUE_TYPE.particle, VALUE_TYPE.rigid,
|
||||
VALUE_TYPE.fdomain, VALUE_TYPE.struct, VALUE_TYPE.strands, VALUE_TYPE.mesh, VALUE_TYPE.trigger,
|
||||
data_type_map = [ VALUE_TYPE.integer, VALUE_TYPE.float, VALUE_TYPE.boolean, VALUE_TYPE.color, VALUE_TYPE.surface,
|
||||
VALUE_TYPE.path, VALUE_TYPE.curve, VALUE_TYPE.text, VALUE_TYPE.object, VALUE_TYPE.node,
|
||||
noone, VALUE_TYPE.any, VALUE_TYPE.pathnode, VALUE_TYPE.particle, VALUE_TYPE.rigid,
|
||||
VALUE_TYPE.fdomain, VALUE_TYPE.struct, VALUE_TYPE.strands, VALUE_TYPE.mesh, VALUE_TYPE.trigger,
|
||||
|
||||
noone, VALUE_TYPE.d3Mesh, VALUE_TYPE.d3Light, VALUE_TYPE.d3Scene, VALUE_TYPE.d3Material,
|
||||
noone, VALUE_TYPE.audioBit,
|
||||
];
|
||||
|
||||
display_list = [
|
||||
/*Integer*/ [ "Default", "Range", "Rotation", "Rotation range", "Slider", "Slider range", "Padding", "Vector", "Vector range", "Area", "Enum button", "Menu scroll" ],
|
||||
/*Float*/ [ "Default", "Range", "Rotation", "Rotation range", "Slider", "Slider range", "Padding", "Vector", "Vector range", "Area" ],
|
||||
/*Boolean*/ [ "Default" ],
|
||||
/*Boolean*/ 0,
|
||||
/*Color*/ [ "Default", "Gradient", "Palette" ],
|
||||
/*Surface*/ [ "Default", ],
|
||||
/*Surface*/ 0,
|
||||
|
||||
/*Path*/ [ "Default", ],
|
||||
/*Path*/ 0,
|
||||
/*Curve*/ [ "Curve", ],
|
||||
/*Text*/ [ "Default", ],
|
||||
/*Object*/ [ "Default", ],
|
||||
/*Node*/ [ "Default", ],
|
||||
/*Text*/ 0,
|
||||
/*Object*/ 0,
|
||||
/*Node*/ 0,
|
||||
|
||||
/*3D*/ [ "Default", ],
|
||||
/*Any*/ [ "Default", ],
|
||||
/*Pathnode*/[ "Default", ],
|
||||
/*Particle*/[ "Default", ],
|
||||
/*Rigid*/ [ "Default", ],
|
||||
/*3D*/ 0,
|
||||
/*Any*/ 0,
|
||||
/*Pathnode*/0,
|
||||
/*Particle*/0,
|
||||
/*Rigid*/ 0,
|
||||
|
||||
/*Fdomain*/ [ "Default", ],
|
||||
/*Struct*/ [ "Default", ],
|
||||
/*Strand*/ [ "Default", ],
|
||||
/*Mesh*/ [ "Default", ],
|
||||
/*Trigger*/ [ "Default", ],
|
||||
/*Fdomain*/ 0,
|
||||
/*Struct*/ 0,
|
||||
/*Strand*/ 0,
|
||||
/*Mesh*/ 0,
|
||||
/*Trigger*/ 0,
|
||||
|
||||
/*noone*/ 0,
|
||||
/*3D Mesh*/ 0,
|
||||
/*3D Light*/ 0,
|
||||
/*3D Scene*/ 0,
|
||||
/*3D Material*/ 0,
|
||||
|
||||
/*noone*/ 0,
|
||||
/*Audio*/ 0,
|
||||
];
|
||||
#endregion
|
||||
|
||||
|
@ -157,7 +171,7 @@ function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constru
|
|||
attributes.inherit_type = false;
|
||||
}
|
||||
|
||||
_dtype = array_safe_get(array_safe_get(display_list, _val_type, []), _dtype);
|
||||
_dtype = array_safe_get(array_safe_get(display_list, _val_type), _dtype);
|
||||
|
||||
inParent.setType(_val_type);
|
||||
outputs[| 0].setType(_val_type);
|
||||
|
@ -297,8 +311,10 @@ function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constru
|
|||
|
||||
var _type = getInputData(2);
|
||||
var _val_type = array_safe_get(data_type_map, _type, VALUE_TYPE.any);
|
||||
inputs[| 0].display_data.data = array_safe_get(display_list, _val_type);
|
||||
inputs[| 0].editWidget.data_list = array_safe_get(display_list, _val_type);
|
||||
var _dsList = array_safe_get(display_list, _val_type);
|
||||
if(_dsList == 0) _dsList = [ "Default" ];
|
||||
inputs[| 0].display_data.data = _dsList;
|
||||
inputs[| 0].editWidget.data_list = _dsList;
|
||||
|
||||
if(inParent.name != display_name) {
|
||||
inParent.name = display_name;
|
||||
|
@ -328,7 +344,8 @@ function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constru
|
|||
|
||||
var _dstype = getInputData(0);
|
||||
var _data = getInputData(2);
|
||||
_dstype = array_safe_get(array_safe_get(display_list, _data, []), _dstype);
|
||||
var _dsList = array_safe_get(display_list, _data);
|
||||
_dstype = _dsList == 0? "Default" : array_safe_get(_dsList, _dstype);
|
||||
|
||||
var _datype = array_safe_get(data_type_map, _data, VALUE_TYPE.any);
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ function valueKey(_time, _value, _anim = noone, _in = 0, _ot = 0) constructor {
|
|||
|
||||
static setTime = function(time) { #region
|
||||
self.time = time;
|
||||
ratio = time / (TOTAL_FRAMES - 1);
|
||||
ratio = time / (TOTAL_FRAMES - 1);
|
||||
} #endregion
|
||||
|
||||
static clone = function(target = noone) { #region
|
||||
|
|
|
@ -604,7 +604,7 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { #regio
|
|||
|
||||
ds_list_add(generator, "Region");
|
||||
addNodeObject(generator, "Separate Shape", s_node_sepearte_shape, "Node_Seperate_Shape", [1, Node_Seperate_Shape],, "Separate disconnected pixel each into an image in an image array.");
|
||||
addNodeObject(generator, "Region Fill", s_node_region_fill, "Node_Region_Fill", [1, Node_Region_Fill],, "Fill connected pixel with the same color.").setVersion(1147);
|
||||
addNodeObject(generator, "Region Fill", s_node_region_fill, "Node_Region_Fill", [1, Node_Region_Fill],, "Fill connected pixel with colors.").setVersion(1147);
|
||||
|
||||
ds_list_add(generator, "Others");
|
||||
addNodeObject(generator, "Flood Fill", s_node_flood_fill, "Node_Flood_Fill", [1, Node_Flood_Fill],, "Filled connected pixel given position and color.").setVersion(1133);
|
||||
|
|
|
@ -695,6 +695,8 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
|||
} #endregion
|
||||
|
||||
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region
|
||||
if(!previewable) return;
|
||||
|
||||
var bbox = drawGetBbox(xx, yy, _s);
|
||||
var _tex = getInputData(6);
|
||||
|
||||
|
@ -703,7 +705,9 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
|||
_tex = _tex[0];
|
||||
}
|
||||
|
||||
draw_surface_bbox(_tex, bbox);
|
||||
var aa = 0.5 + 0.5 * renderActive;
|
||||
if(!isHighlightingInGraph()) aa *= 0.25;
|
||||
draw_surface_bbox(_tex, bbox,, aa);
|
||||
} #endregion
|
||||
|
||||
static attributeSerialize = function() { #region
|
||||
|
|
|
@ -616,6 +616,12 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
|
||||
color = -1;
|
||||
color_display = 0;
|
||||
|
||||
draw_bg = c_black;
|
||||
draw_fg = c_black;
|
||||
|
||||
draw_blend = 1;
|
||||
draw_blend_color = 1;
|
||||
#endregion
|
||||
|
||||
#region ---- timeline ----
|
||||
|
@ -1221,13 +1227,29 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
}
|
||||
|
||||
setDropKey();
|
||||
updateColor();
|
||||
} resetDisplay(); #endregion
|
||||
|
||||
static updateColor = function(val) { #region
|
||||
INLINE
|
||||
|
||||
if(color == -1) {
|
||||
draw_bg = isArray(val)? value_color_bg_array(draw_junction_index) : value_color_bg(draw_junction_index);
|
||||
draw_fg = value_color(draw_junction_index);
|
||||
} else {
|
||||
draw_bg = isArray(val)? merge_color(color, colorMultiply(color, CDEF.main_dkgrey), 0.5) : value_color_bg(draw_junction_index);
|
||||
draw_fg = color;
|
||||
}
|
||||
|
||||
color_display = type == VALUE_TYPE.action? #8fde5d : draw_fg;
|
||||
} #endregion
|
||||
|
||||
static setType = function(_type) { #region
|
||||
if(type == _type) return false;
|
||||
|
||||
type = _type;
|
||||
draw_junction_index = type;
|
||||
updateColor();
|
||||
|
||||
return true;
|
||||
} #endregion
|
||||
|
@ -1466,6 +1488,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
|
||||
cache_value[2] = array_clone(val);
|
||||
cache_value[3] = applyUnit;
|
||||
updateColor(val);
|
||||
|
||||
return val;
|
||||
} #endregion
|
||||
|
@ -1787,7 +1810,13 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
draw_junction_index = VALUE_TYPE.atlas;
|
||||
}
|
||||
|
||||
if(connect_type == JUNCTION_CONNECT.output) return;
|
||||
if(connect_type == JUNCTION_CONNECT.output) {
|
||||
if(self.index == 0) {
|
||||
node.preview_value = getValue();
|
||||
node.preview_array = "[" + array_shape(node.preview_value) + "]";
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if(is_instanceof(node, Node))
|
||||
node.setInputData(self.index, animator.getValue(time));
|
||||
|
@ -2042,21 +2071,9 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
} #endregion
|
||||
|
||||
static drawJunction = function(_s, _mx, _my, sca = 1) { #region
|
||||
var _bgC, _fgC;
|
||||
|
||||
if(color == -1) {
|
||||
_bgC = isArray()? value_color_bg_array(draw_junction_index) : value_color_bg(draw_junction_index);
|
||||
_fgC = value_color(draw_junction_index);
|
||||
} else {
|
||||
_bgC = isArray()? merge_color(color, colorMultiply(color, CDEF.main_dkgrey), 0.5) : value_color_bg(draw_junction_index);
|
||||
_fgC = color;
|
||||
}
|
||||
|
||||
color_display = type == VALUE_TYPE.action? #8fde5d : _fgC;
|
||||
|
||||
if(!isVisible()) return false;
|
||||
|
||||
var ss = max(0.25, _s / 2);
|
||||
var ss = max(0.25, _s / 2);
|
||||
var hov = PANEL_GRAPH.pHOVER && (PANEL_GRAPH.node_hovering == noone || PANEL_GRAPH.node_hovering == node);
|
||||
var is_hover = hov && point_in_circle(_mx, _my, x, y, 10 * _s * sca);
|
||||
|
||||
|
@ -2064,10 +2081,23 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
var _fgS = is_hover? THEME.node_junctions_outline_hover : THEME.node_junctions_outline;
|
||||
|
||||
if(type == VALUE_TYPE.action) {
|
||||
draw_sprite_ext(THEME.node_junction_inspector, is_hover, x, y, ss, ss, 0, c_white, 1);
|
||||
var _cbg = c_white;
|
||||
|
||||
if(draw_blend != -1)
|
||||
_cbg = merge_color(draw_blend_color, _cbg, draw_blend);
|
||||
|
||||
draw_sprite_ext(THEME.node_junction_inspector, is_hover, x, y, ss, ss, 0, _cbg, 1);
|
||||
} else {
|
||||
draw_sprite_ext(_bgS, draw_junction_index, x, y, ss, ss, 0, _bgC, 1);
|
||||
draw_sprite_ext(_fgS, draw_junction_index, x, y, ss, ss, 0, _fgC, 1);
|
||||
var _cbg = draw_bg;
|
||||
var _cfg = draw_fg;
|
||||
|
||||
if(draw_blend != -1) {
|
||||
_cbg = merge_color(draw_blend_color, _cbg, draw_blend);
|
||||
_cfg = merge_color(draw_blend_color, _cfg, draw_blend);
|
||||
}
|
||||
|
||||
draw_sprite_ext(_bgS, draw_junction_index, x, y, ss, ss, 0, _cbg, 1);
|
||||
draw_sprite_ext(_fgS, draw_junction_index, x, y, ss, ss, 0, _cfg, 1);
|
||||
}
|
||||
|
||||
return is_hover;
|
||||
|
@ -2117,6 +2147,8 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
|
||||
static drawConnections = function(params = {}) { #region
|
||||
var log = struct_try_get(params, "log", false);
|
||||
var high = struct_try_get(params, "highlight", 0);
|
||||
var bg = struct_try_get(params, "bg", c_black);
|
||||
|
||||
if(isLeaf()) return noone;
|
||||
if(!value_from.node.active) return noone;
|
||||
|
@ -2131,10 +2163,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
var cur_layer = params.cur_layer;
|
||||
var max_layer = params.max_layer;
|
||||
|
||||
var aa = struct_try_get(params, "aa", 1);
|
||||
var high = struct_try_get(params, "highlight", 0);
|
||||
|
||||
var bg = struct_try_get(params, "bg", c_black);
|
||||
var aa = struct_try_get(params, "aa", 1);
|
||||
|
||||
var hovering = noone;
|
||||
var jx = x;
|
||||
|
@ -2218,17 +2247,24 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
ty = LINE_STYLE.dashed;
|
||||
|
||||
var c0, c1;
|
||||
var _selc = node.active_draw_index == 0 || value_from.node.active_draw_index == 0 || node.branch_drawing;
|
||||
var _selc = node.branch_drawing && value_from.node.branch_drawing;
|
||||
|
||||
if(!thicken && (high == 1 && key_mod_press(ALT) || high == 2)) {
|
||||
if(high) {
|
||||
var _fade = PREFERENCES.connection_line_highlight_fade;
|
||||
var _colr = _selc? 1 : _fade;
|
||||
|
||||
c0 = merge_color(bg, value_from.color_display, _colr);
|
||||
c1 = merge_color(bg, color_display, _colr);
|
||||
|
||||
draw_blend_color = bg;
|
||||
draw_blend = _colr;
|
||||
value_from.draw_blend = max(value_from.draw_blend, _colr);
|
||||
} else {
|
||||
c0 = value_from.color_display;
|
||||
c1 = color_display;
|
||||
|
||||
draw_blend_color = bg;
|
||||
draw_blend = -1;
|
||||
}
|
||||
|
||||
var ss = _s * aa;
|
||||
|
|
|
@ -718,7 +718,11 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
function drawNodes() { #region
|
||||
if(selection_block-- > 0) return;
|
||||
//print("==== DRAW NODES ====");
|
||||
display_parameter.highlight = !array_empty(nodes_selecting) * PREFERENCES.connection_line_highlight;
|
||||
display_parameter.highlight =
|
||||
!array_empty(nodes_selecting) && (
|
||||
(PREFERENCES.connection_line_highlight == 1 && key_mod_press(ALT)) ||
|
||||
PREFERENCES.connection_line_highlight == 2
|
||||
);
|
||||
|
||||
var gr_x = graph_x * graph_s;
|
||||
var gr_y = graph_y * graph_s;
|
||||
|
@ -908,7 +912,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
maxy : h + 64,
|
||||
active : hoverable,
|
||||
max_layer : ds_list_size(nodes_list),
|
||||
highlight : array_length(nodes_selecting),
|
||||
highlight : display_parameter.highlight,
|
||||
};
|
||||
|
||||
for(var i = 0; i < ds_list_size(nodes_list); i++) {
|
||||
|
@ -1157,7 +1161,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
value_dragging.drawJunction(graph_s, value_dragging.x, value_dragging.y);
|
||||
if(target) target.drawJunction(graph_s, target.x, target.y);
|
||||
|
||||
if(mouse_release(mb_left)) { // CONNECT junction
|
||||
if(mouse_release(mb_left)) { // CONNECT junction
|
||||
if(target != noone) {
|
||||
var _addInput = false;
|
||||
if(target.isLeaf() && target.connect_type == JUNCTION_CONNECT.input && target.node.auto_input)
|
||||
|
@ -1223,6 +1227,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
|
|||
if(value_bit(_junction.type) & value_bit(value_dragging.type) == 0) continue;
|
||||
|
||||
ds_priority_add(_jlist, _junction, _junction.y);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -833,17 +833,21 @@ function Panel_Inspector() : PanelContent() constructor {
|
|||
var s = PANEL_PREVIEW.getNodePreviewSurface();
|
||||
if(is_surface(s)) {
|
||||
METADATA.author_steam_id = STEAM_USER_ID;
|
||||
SAVE();
|
||||
METADATA.steam = true;
|
||||
SAVE_AT(PROJECT, PROJECT.path);
|
||||
|
||||
steam_ugc_create_project();
|
||||
workshop_uploading = true;
|
||||
} else
|
||||
noti_warning("Please send any node to preview panel to use as a thumbnail.")
|
||||
}
|
||||
}
|
||||
|
||||
if(METADATA.steam && METADATA.author_steam_id == STEAM_USER_ID && METADATA.file_id != 0) {
|
||||
if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), [mx, my], pFOCUS, pHOVER, __txtx("panel_inspector_workshop_update", "Update Steam Workshop"), THEME.workshop_update, 0, COLORS._main_icon) == 2) {
|
||||
SAVE();
|
||||
|
||||
if(METADATA.steam && METADATA.author_steam_id == STEAM_USER_ID) {
|
||||
if(METADATA.file_id == 0) {
|
||||
buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), [mx, my], false, pHOVER, __txtx("panel_inspector_workshop_restart", "Open project from the workshop tab to update."), THEME.workshop_update, 0, COLORS._main_icon);
|
||||
} else if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), [mx, my], pFOCUS, pHOVER, __txtx("panel_inspector_workshop_update", "Update Steam Workshop content"), THEME.workshop_update, 0, COLORS._main_icon) == 2) {
|
||||
SAVE_AT(PROJECT, PROJECT.path);
|
||||
steam_ugc_update_project();
|
||||
workshop_uploading = true;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
PREFERENCES = {};
|
||||
HOTKEYS_DATA = {};
|
||||
|
||||
PREFERENCES.ui_framerate = 60;
|
||||
PREFERENCES.ui_framerate = 120;
|
||||
PREFERENCES.path_resolution = 32;
|
||||
|
||||
PREFERENCES.node_recents_amount = 20;
|
||||
|
|
|
@ -6,9 +6,10 @@
|
|||
function Project() constructor {
|
||||
active = true; /// @is {bool}
|
||||
|
||||
path = ""; /// @is {string}
|
||||
version = SAVE_VERSION; /// @is {number}
|
||||
seed = irandom_range(100000, 999999); /// @is {number}
|
||||
path = ""; /// @is {string}
|
||||
thumbnail = "";
|
||||
version = SAVE_VERSION; /// @is {number}
|
||||
seed = irandom_range(100000, 999999); /// @is {number}
|
||||
|
||||
modified = false; /// @is {bool}
|
||||
readonly = false; /// @is {bool}
|
||||
|
|
|
@ -110,12 +110,11 @@ function SAVE_AT(project = PROJECT, path = "", log = "save at ") { #region
|
|||
if(DEMO) return false;
|
||||
|
||||
SAVING = true;
|
||||
if(TESTING && string_char_at(filename_name(path), 1) != "[")
|
||||
path = $"{filename_dir(path)}/[{VERSION_STRING}] {filename_name(path)}";
|
||||
|
||||
if(file_exists(path))
|
||||
file_delete(path);
|
||||
var file = file_text_open_write(path);
|
||||
file_text_write_string(file, save_serialize(project));
|
||||
file_text_close(file);
|
||||
if(file_exists(path)) file_delete(path);
|
||||
file_text_write_all(path, save_serialize(project));
|
||||
|
||||
SAVING = false;
|
||||
project.readonly = false;
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
function steam_ugc_create_collection(file) { #region
|
||||
if(STEAM_UGC_ITEM_UPLOADING) return;
|
||||
|
||||
STEAM_UGC_UPDATE = false;
|
||||
STEAM_UGC_UPDATE = false;
|
||||
STEAM_UGC_ITEM_UPLOADING = true;
|
||||
STEAM_UGC_ITEM_FILE = file;
|
||||
STEAM_UGC_TYPE = STEAM_UGC_FILE_TYPE.collection;
|
||||
STEAM_UGC_ITEM_FILE = file;
|
||||
STEAM_UGC_TYPE = STEAM_UGC_FILE_TYPE.collection;
|
||||
|
||||
directory_destroy(DIRECTORY + "steamUGC");
|
||||
directory_create(DIRECTORY + "steamUGC");
|
||||
|
@ -22,10 +22,10 @@ function steam_ugc_create_collection(file) { #region
|
|||
function steam_ugc_update_collection(file, update_preview = false, update_note = "Updated") { #region
|
||||
if(STEAM_UGC_ITEM_UPLOADING) return;
|
||||
|
||||
STEAM_UGC_UPDATE = true;
|
||||
STEAM_UGC_UPDATE = true;
|
||||
STEAM_UGC_ITEM_UPLOADING = true;
|
||||
STEAM_UGC_ITEM_FILE = file;
|
||||
STEAM_UGC_TYPE = STEAM_UGC_FILE_TYPE.collection;
|
||||
STEAM_UGC_ITEM_FILE = file;
|
||||
STEAM_UGC_TYPE = STEAM_UGC_FILE_TYPE.collection;
|
||||
|
||||
directory_destroy(DIRECTORY + "steamUGC");
|
||||
directory_create(DIRECTORY + "steamUGC");
|
||||
|
@ -43,8 +43,8 @@ function steam_ugc_update_collection(file, update_preview = false, update_note =
|
|||
|
||||
var tgs = STEAM_UGC_ITEM_FILE.meta.tags;
|
||||
|
||||
array_insert(tgs, 0, "Collection");
|
||||
array_push(tgs, VERSION_STRING);
|
||||
array_insert_unique(tgs, 0, "Collection");
|
||||
array_push_unique(tgs, VERSION_STRING);
|
||||
|
||||
steam_ugc_collection_generate(array_safe_get(file.spr_path, 0));
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ function __initSteamUGC() {
|
|||
if(DEMO) return;
|
||||
if(!STEAM_ENABLED) return;
|
||||
|
||||
directory_verify(DIRECTORY + "steamUGC");
|
||||
steamUCGload();
|
||||
}
|
||||
|
||||
|
@ -19,7 +20,6 @@ function steamUCGload() {
|
|||
|
||||
for( var i = 0; i < ds_list_size(STEAM_SUBS); i++ ) {
|
||||
var item_map = ds_map_create();
|
||||
//print("Querying item ID " + string(STEAM_SUBS[| i]));
|
||||
|
||||
if (steam_ugc_get_item_install_info(STEAM_SUBS[| i], item_map)) {
|
||||
var info_map = ds_map_create();
|
||||
|
@ -30,16 +30,10 @@ function steamUCGload() {
|
|||
|
||||
ds_map_destroy(info_map);
|
||||
|
||||
if(_update) {
|
||||
steam_ugc_subscribe_item(STEAM_SUBS[| i]);
|
||||
//print("Item need update");
|
||||
} else {
|
||||
__loadSteamUGC(STEAM_SUBS[| i], item_map);
|
||||
}
|
||||
} else {
|
||||
if(_update) steam_ugc_subscribe_item(STEAM_SUBS[| i]);
|
||||
else __loadSteamUGC(STEAM_SUBS[| i], item_map);
|
||||
} else
|
||||
steam_ugc_subscribe_item(STEAM_SUBS[| i]);
|
||||
//print("Item not downloaded");
|
||||
}
|
||||
|
||||
ds_map_destroy(item_map);
|
||||
}
|
||||
|
@ -73,7 +67,7 @@ function __loadSteamUGCCollection(file_id, f, path) {
|
|||
var hh = sprite_get_height(_temp);
|
||||
var amo = safe_mod(ww, hh) == 0? ww / hh : 1;
|
||||
sprite_delete(_temp);
|
||||
file.spr_path = [icon_path, amo, false];
|
||||
file.spr_path = [ icon_path, amo, false ];
|
||||
}
|
||||
|
||||
ds_list_add(STEAM_COLLECTION, file);
|
||||
|
@ -87,7 +81,7 @@ function __loadSteamUGCProject(file_id, f, path) {
|
|||
var name = string_replace(filename_name(f), ".pxc", "");
|
||||
var file = new FileObject(name, path + "/" + f);
|
||||
var icon_path = path + "/thumbnail.png";
|
||||
file.spr_path = [icon_path, 1, false];
|
||||
file.spr_path = [ icon_path, 1, false ];
|
||||
|
||||
ds_list_add(STEAM_PROJECTS, file);
|
||||
|
||||
|
|
|
@ -1,22 +1,21 @@
|
|||
function steam_ugc_create_project() { #region
|
||||
if(STEAM_UGC_ITEM_UPLOADING) return;
|
||||
|
||||
var file = new FileObject(string_replace(filename_name(PROJECT.path), filename_ext(PROJECT.path), ""), PROJECT.path);
|
||||
file.getMetadata();
|
||||
file.spr_path = DIRECTORY + "steamUGC/thumbnail.png";
|
||||
var file = new FileObject(string_replace(filename_name(PROJECT.path), filename_ext(PROJECT.path), ""), PROJECT.path);
|
||||
file.meta = METADATA;
|
||||
file.spr_path[0] = DIRECTORY + "steamUGC/thumbnail.png";
|
||||
|
||||
STEAM_UGC_UPDATE = false;
|
||||
STEAM_UGC_UPDATE = false;
|
||||
STEAM_UGC_ITEM_UPLOADING = true;
|
||||
STEAM_UGC_ITEM_FILE = file;
|
||||
STEAM_UGC_TYPE = STEAM_UGC_FILE_TYPE.project;
|
||||
STEAM_UGC_ITEM_FILE = file;
|
||||
STEAM_UGC_TYPE = STEAM_UGC_FILE_TYPE.project;
|
||||
|
||||
directory_destroy(DIRECTORY + "steamUGC");
|
||||
directory_create(DIRECTORY + "steamUGC");
|
||||
directory_verify(DIRECTORY + "steamUGC");
|
||||
file_copy(file.path, DIRECTORY + "steamUGC/" + filename_name(file.path));
|
||||
|
||||
steam_ugc_project_generate();
|
||||
var preview_surface = PANEL_PREVIEW.getNodePreviewSurface();
|
||||
surface_save_safe(preview_surface, DIRECTORY + "steamUGC/thumbnail.png");
|
||||
steam_ugc_project_generate(DIRECTORY + "steamUGC/thumbnail.png");
|
||||
|
||||
STEAM_UGC_ITEM_ID = steam_ugc_create_item(STEAM_APP_ID, ugc_filetype_community);
|
||||
} #endregion
|
||||
|
@ -24,19 +23,18 @@ function steam_ugc_create_project() { #region
|
|||
function steam_ugc_update_project(update_preview = false, update_note = "Updated") { #region
|
||||
if(STEAM_UGC_ITEM_UPLOADING) return;
|
||||
|
||||
var file = new FileObject(string_replace(filename_name(PROJECT.path), filename_ext(PROJECT.path), ""), PROJECT.path);
|
||||
file.getMetadata();
|
||||
file.spr_path = DIRECTORY + "steamUGC/thumbnail.png";
|
||||
var file = new FileObject(string_replace(filename_name(PROJECT.path), filename_ext(PROJECT.path), ""), PROJECT.path);
|
||||
file.meta = METADATA;
|
||||
|
||||
STEAM_UGC_UPDATE = true;
|
||||
STEAM_UGC_UPDATE = true;
|
||||
STEAM_UGC_ITEM_UPLOADING = true;
|
||||
STEAM_UGC_ITEM_FILE = file;
|
||||
STEAM_UGC_TYPE = STEAM_UGC_FILE_TYPE.project;
|
||||
STEAM_UGC_ITEM_FILE = file;
|
||||
STEAM_UGC_TYPE = STEAM_UGC_FILE_TYPE.project;
|
||||
|
||||
directory_destroy(DIRECTORY + "steamUGC");
|
||||
directory_create(DIRECTORY + "steamUGC");
|
||||
directory_verify(DIRECTORY + "steamUGC");
|
||||
file_copy(file.path, DIRECTORY + "steamUGC/" + filename_name(file.path));
|
||||
file_copy(file.spr_path[0], DIRECTORY + "steamUGC/thumbnail.png");
|
||||
if(file_exists(PROJECT.thumbnail))
|
||||
file_copy(PROJECT.thumbnail, DIRECTORY + "steamUGC/thumbnail.png");
|
||||
|
||||
STEAM_UGC_PUBLISH_ID = file.meta.file_id;
|
||||
STEAM_UGC_UPDATE_HANDLE = steam_ugc_start_item_update(STEAM_APP_ID, STEAM_UGC_PUBLISH_ID);
|
||||
|
@ -46,41 +44,45 @@ function steam_ugc_update_project(update_preview = false, update_note = "Updated
|
|||
|
||||
var tgs = STEAM_UGC_ITEM_FILE.meta.tags;
|
||||
|
||||
array_insert(tgs, 0, "Project");
|
||||
array_push(tgs, VERSION_STRING);
|
||||
array_insert_unique(tgs, 0, "Project");
|
||||
array_push_unique(tgs, VERSION_STRING);
|
||||
|
||||
steam_ugc_collection_generate(PROJECT.thumbnail);
|
||||
|
||||
steam_ugc_set_item_tags(STEAM_UGC_UPDATE_HANDLE, tgs);
|
||||
steam_ugc_set_item_content(STEAM_UGC_UPDATE_HANDLE, DIRECTORY + "steamUGC");
|
||||
|
||||
if(file_exists(TEMPDIR + "steamUGCthumbnail.png"))
|
||||
steam_ugc_set_item_preview(STEAM_UGC_UPDATE_HANDLE, TEMPDIR + "steamUGCthumbnail.png");
|
||||
|
||||
STEAM_UGC_SUBMIT_ID = steam_ugc_submit_item_update(STEAM_UGC_UPDATE_HANDLE, update_note);
|
||||
} #endregion
|
||||
|
||||
function steam_ugc_project_generate(dest_path = TEMPDIR + "steamUGCthumbnail.png") { #region
|
||||
function steam_ugc_project_generate(file, dest_path = TEMPDIR + "steamUGCthumbnail.png") { #region
|
||||
file_delete(dest_path);
|
||||
|
||||
var preview_surface = PANEL_PREVIEW.getNodePreviewSurface();
|
||||
var prev_size = 512;
|
||||
var _s = surface_create(prev_size, prev_size);
|
||||
var spr = sprite_add(file, 0, false, false, 0, 0);
|
||||
var _s = surface_create(prev_size, prev_size);
|
||||
|
||||
surface_set_target(_s);
|
||||
draw_clear(COLORS._main_icon_dark);
|
||||
draw_sprite_tiled(s_workshop_bg, 0, -64, -64);
|
||||
draw_sprite_stretched(s_workshop_frame, 0, 0, 0, prev_size, prev_size);
|
||||
|
||||
if(is_surface(preview_surface)) {
|
||||
var ss = (prev_size - 160) / max(surface_get_width_safe(preview_surface), surface_get_height_safe(preview_surface));
|
||||
var ox = surface_get_width_safe(preview_surface) / 2 * ss;
|
||||
var oy = surface_get_height_safe(preview_surface) / 2 * ss;
|
||||
draw_surface_ext_safe(preview_surface, prev_size / 2 - ox, prev_size / 2 - oy, ss, ss, 0, c_white, 1);
|
||||
}
|
||||
if(spr == -1) spr = THEME.workshop_collection;
|
||||
var ss = (prev_size - 160) / max(sprite_get_width(spr), sprite_get_height(spr));
|
||||
var ox = (sprite_get_xoffset(spr) - sprite_get_width(spr) / 2) * ss;
|
||||
var oy = (sprite_get_yoffset(spr) - sprite_get_height(spr) / 2) * ss;
|
||||
draw_sprite_ext(spr, 0, prev_size / 2 + ox, prev_size / 2 + oy, ss, ss, 0, c_white, 1);
|
||||
|
||||
draw_sprite_stretched(s_workshop_badge, 0, 8, 8, 88, 88);
|
||||
draw_sprite_ext(THEME.workshop_project, 0, 40, 40, 1, 1, 0, COLORS._main_icon_dark, 1);
|
||||
|
||||
draw_set_text(f_h2, fa_right, fa_bottom, COLORS._main_icon_dark);
|
||||
var _bw = 48 + string_width(VERSION_STRING);
|
||||
var _bh = 88;
|
||||
var _bh = 80;
|
||||
draw_sprite_stretched(s_workshop_badge_version, 0, prev_size - 8 - _bw, prev_size - 8 - _bh, _bw, _bh);
|
||||
draw_text(prev_size - 16, prev_size - 12, VERSION_STRING);
|
||||
draw_text(prev_size - 16, prev_size - 8, VERSION_STRING);
|
||||
surface_reset_target();
|
||||
surface_save_safe(_s, dest_path);
|
||||
surface_free(_s);
|
||||
|
|
|
@ -96,6 +96,12 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor
|
|||
|
||||
static isCodeFormat = function() { INLINE return format == TEXT_AREA_FORMAT.codeLUA || format == TEXT_AREA_FORMAT.codeHLSL; }
|
||||
|
||||
static breakCharacter = function(ch) { #region
|
||||
if(isCodeFormat())
|
||||
return ch == "\n" || array_exists(global.CODE_BREAK_TOKEN, ch);
|
||||
return ch == " " || ch == "\n";
|
||||
} #endregion
|
||||
|
||||
static onModified = function() { #region
|
||||
if(!isCodeFormat()) return;
|
||||
if(autocomplete_server == noone) return;
|
||||
|
@ -158,12 +164,6 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor
|
|||
o_dialog_textbox_function_guide.deactivate(self);
|
||||
} #endregion
|
||||
|
||||
static breakCharacter = function(ch) { #region
|
||||
if(isCodeFormat())
|
||||
return ch == "\n" || array_exists(global.CODE_BREAK_TOKEN, ch);
|
||||
return ch == " " || ch == "\n";
|
||||
} #endregion
|
||||
|
||||
static keyboardEnter = function() { #region
|
||||
if(!keyboard_check_pressed(vk_enter))
|
||||
return 0;
|
||||
|
|
|
@ -8,8 +8,10 @@ function textInput(_input, _onModify) : widget() constructor {
|
|||
|
||||
static onKey = function(key) {}
|
||||
|
||||
static setSideButton = function(_button) {
|
||||
static setSideButton = function(_button) { #region
|
||||
self.side_button = _button;
|
||||
return self;
|
||||
}
|
||||
} #endregion
|
||||
|
||||
static breakCharacter = function(ch) { return ch == " " || ch == "\n"; }
|
||||
}
|
|
@ -4,32 +4,28 @@
|
|||
varying vec2 v_vTexcoord;
|
||||
varying vec4 v_vColour;
|
||||
|
||||
uniform int useA;
|
||||
uniform float base;
|
||||
uniform int mode;
|
||||
uniform sampler2D samplerR;
|
||||
uniform sampler2D samplerG;
|
||||
uniform sampler2D samplerB;
|
||||
uniform sampler2D samplerA;
|
||||
|
||||
uniform int useR;
|
||||
uniform int useG;
|
||||
uniform int useB;
|
||||
uniform int useA;
|
||||
|
||||
float sample(vec4 col, int ch) {
|
||||
if(mode == 0) return (col[0] + col[1] + col[2]) / 3.;
|
||||
return col[ch];
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec4 _r = texture2D( samplerR, v_vTexcoord );
|
||||
vec4 _g = texture2D( samplerG, v_vTexcoord );
|
||||
vec4 _b = texture2D( samplerB, v_vTexcoord );
|
||||
|
||||
float r = sample(_r, 0);
|
||||
float g = sample(_g, 1);
|
||||
float b = sample(_b, 2);
|
||||
float a = 1.;
|
||||
|
||||
if(useA == 1) {
|
||||
vec4 _a = texture2D( samplerA, v_vTexcoord );
|
||||
a = sample(_a, 3);
|
||||
}
|
||||
float r = (useR == 1)? sample(texture2D( samplerR, v_vTexcoord ), 0) : base;
|
||||
float g = (useG == 1)? sample(texture2D( samplerG, v_vTexcoord ), 1) : base;
|
||||
float b = (useB == 1)? sample(texture2D( samplerB, v_vTexcoord ), 2) : base;
|
||||
float a = (useA == 1)? sample(texture2D( samplerA, v_vTexcoord ), 3) : 1.;
|
||||
|
||||
gl_FragColor = vec4(r, g, b, a);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue