This commit is contained in:
Tanasart 2024-10-18 09:47:55 +07:00
parent f2e919d6be
commit db274ac2d6
10 changed files with 73 additions and 39 deletions

View File

@ -14,5 +14,6 @@ function asyncLoad(data) {
var parameters = cal[1]; var parameters = cal[1];
if(callback != noone) callback(parameters, data); if(callback != noone) callback(parameters, data);
ds_map_delete(global.asyncCalls, data[? "id"]); if(data[? "status"] == 0)
ds_map_delete(global.asyncCalls, data[? "id"]);
} }

View File

@ -42,7 +42,7 @@
LATEST_VERSION = 1_18_00_0; LATEST_VERSION = 1_18_00_0;
VERSION = 1_18_01_0; VERSION = 1_18_01_0;
SAVE_VERSION = 1_18_02_0; SAVE_VERSION = 1_18_02_0;
VERSION_STRING = MAC? "1.18.003m" : "1.18.2.0077"; VERSION_STRING = MAC? "1.18.003m" : "1.18.2.1";
BUILD_NUMBER = 1_18_01_0; BUILD_NUMBER = 1_18_01_0;
HOTKEYS = ds_map_create(); HOTKEYS = ds_map_create();

View File

@ -2,10 +2,11 @@ function Node_3D_Displace(_x, _y, _group = noone) : Node_3D_Modifier(_x, _y, _gr
name = "Displace vertex"; name = "Displace vertex";
newInput(in_mesh + 0, nodeValue_D3Material("Displace Texture", self, new __d3dMaterial())) newInput(in_mesh + 0, nodeValue_D3Material("Displace Texture", self, new __d3dMaterial()))
.setVisible(true, true);
newInput(in_mesh + 1, nodeValue_Float("Height", self, .1)) newInput(in_mesh + 1, nodeValue_Float("Height", self, .1));
newInput(in_mesh + 2, nodeValue_Float("Subobjects", self, -1)) newInput(in_mesh + 2, nodeValue_Float("Subobjects", self, -1));
input_display_list = [ input_display_list = [
["Mesh", false], 0, in_mesh + 2, ["Mesh", false], 0, in_mesh + 2,
@ -21,8 +22,11 @@ function Node_3D_Displace(_x, _y, _group = noone) : Node_3D_Modifier(_x, _y, _gr
if(!is_instanceof(_obj, __3dObject)) return noone; if(!is_instanceof(_obj, __3dObject)) return noone;
if(!is_instanceof(_tex, __d3dMaterial)) return noone; if(!is_instanceof(_tex, __d3dMaterial)) return noone;
var _tsc = _tex.texScale; var _tsc = _tex.texScale;
var _tif = _tex.texShift; var _tif = _tex.texShift;
var _surf = _tex.surface;
if(!is_surface(_surf)) return _obj;
var dim = surface_get_dimension(_tex.surface); var dim = surface_get_dimension(_tex.surface);
var _sw = dim[0] - 1; var _sw = dim[0] - 1;

View File

@ -71,7 +71,7 @@
} }
function attribute_surface_depth(label = true) { function attribute_surface_depth(label = true) {
attr_depth_array = global.SURFACE_FORMAT_NAME; attr_depth_array = array_clone(global.SURFACE_FORMAT_NAME);
if(!array_empty(inputs) && inputs[0].type == VALUE_TYPE.surface) if(!array_empty(inputs) && inputs[0].type == VALUE_TYPE.surface)
attr_depth_array[0] = "Input"; attr_depth_array[0] = "Input";
@ -83,21 +83,23 @@
} }
function attribute_interpolation(label = false) { function attribute_interpolation(label = false) {
attr_interpolate_array = array_clone(global.SURFACE_INTERPOLATION);
attributes.interpolate = 1; attributes.interpolate = 1;
attributes.oversample = 1; attributes.oversample = 1;
if(label) array_push(attributeEditors, "Surface"); if(label) array_push(attributeEditors, "Surface");
array_push(attributeEditors, ["Texture interpolation", function() /*=>*/ {return attributes.interpolate}, array_push(attributeEditors, ["Texture interpolation", function() /*=>*/ {return attributes.interpolate},
new scrollBox(global.SURFACE_INTERPOLATION, function(val) /*=>*/ { attribute_set("interpolate", val); }, false), "interpolate"]); new scrollBox(attr_interpolate_array, function(val) /*=>*/ { attribute_set("interpolate", val); }, false), "interpolate"]);
} }
function attribute_oversample(label = false) { function attribute_oversample(label = false) {
attr_oversample_array = array_clone(global.SURFACE_OVERSAMPLE);
attributes.interpolate = 1; attributes.interpolate = 1;
attributes.oversample = 1; attributes.oversample = 1;
if(label) array_push(attributeEditors, "Surface"); if(label) array_push(attributeEditors, "Surface");
array_push(attributeEditors, ["Oversample", function() /*=>*/ {return attributes.oversample}, array_push(attributeEditors, ["Oversample", function() /*=>*/ {return attributes.oversample},
new scrollBox(global.SURFACE_OVERSAMPLE, function(val) /*=>*/ { attribute_set("oversample", val); }, false), "oversample"]); new scrollBox(attr_oversample_array, function(val) /*=>*/ { attribute_set("oversample", val); }, false), "oversample"]);
} }
function attribute_auto_execute(label = false) { function attribute_auto_execute(label = false) {

View File

@ -52,7 +52,7 @@ function groupNodes(nodeArray, _group = noone, record = true, check_connect = tr
_content[i] = _ctx_nodes[i]; _content[i] = _ctx_nodes[i];
} }
if(check_connect) { #region IO creation if(check_connect) { // IO creation
var _io = { inputs: {}, outputs: {}, map: {} }; var _io = { inputs: {}, outputs: {}, map: {} };
for(var i = 0; i < array_length(nodeArray); i++) for(var i = 0; i < array_length(nodeArray); i++)
@ -112,8 +112,7 @@ function groupNodes(nodeArray, _group = noone, record = true, check_connect = tr
_to.setFrom(_n.outParent); _to.setFrom(_n.outParent);
} }
} }
}
} #endregion
UNDO_HOLDING = false; UNDO_HOLDING = false;
if(record) recordAction(ACTION_TYPE.group, _group, { content: _content }); if(record) recordAction(ACTION_TYPE.group, _group, { content: _content });

View File

@ -583,6 +583,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
if(is_3D == NODE_3D.polygon) USE_DEPTH = true; if(is_3D == NODE_3D.polygon) USE_DEPTH = true;
if(is_simulation) PROJECT.animator.is_simulating = true; if(is_simulation) PROJECT.animator.is_simulating = true;
} }
static doStepBegin = function() {} static doStepBegin = function() {}
@ -2387,9 +2388,9 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
struct_append(attributes, attr); struct_append(attributes, attr);
if(LOADING_VERSION < 1_18_02_0) { if(LOADING_VERSION < 1_18_02_0) {
if(struct_has(attributes, "color_depth")) attributes.color_depth += inputs[0].type == VALUE_TYPE.surface? 1 : 2; if(struct_has(attr, "color_depth")) attributes.color_depth += (!array_empty(inputs) && inputs[0].type == VALUE_TYPE.surface)? 1 : 2;
if(struct_has(attributes, "interpolate")) attributes.interpolate++; if(struct_has(attr, "interpolate")) attributes.interpolate++;
if(struct_has(attributes, "oversample")) attributes.oversample++; if(struct_has(attr, "oversample")) attributes.oversample++;
} }
} }
@ -2711,10 +2712,11 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
if(_lin != -1) { if(_lin != -1) {
_wid.data_list[_lin] = "-Group"; _wid.data_list[_lin] = "-Group";
var _key = _att[3]; var _key = _att[3];
if(attributes[$ _key] == _lin) if(attributes[$ _key] == _lin)
attributes[$ _key] = 1; attributes[$ _key] = _att[0] == "Color depth"? 3 : 1;
} }
} }
} }
@ -2730,13 +2732,15 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
var _l = _wid.data_list; var _l = _wid.data_list;
var _lin = array_get_index(_l, "-Group"); var _lin = array_get_index(_l, "-Group");
if(_lin != -1) _wid.data_list[_lin] = "Group"; if(_lin != -1) {
_wid.data_list[_lin] = "Group";
}
} }
} }
} }
} checkGroup(); } run_in(1, function() /*=>*/ { checkGroup(); });
static toString = function() { return $"Node [{internalName}]: {node_id}"; } static toString = function() { return $"Node [{internalName}]: {node_id}"; }
} }

View File

@ -10,11 +10,16 @@ function Node_HTTP_request(_x, _y, _group = noone) : Node(_x, _y, _group) constr
newOutput(0, nodeValue_Output("Result", self, VALUE_TYPE.text, "")); newOutput(0, nodeValue_Output("Result", self, VALUE_TYPE.text, ""));
address_domain = ""; address_domain = "";
downloaded_size = 0;
insp1UpdateTooltip = "Trigger"; insp1UpdateTooltip = "Trigger";
insp1UpdateIcon = [ THEME.sequence_control, 1, COLORS._main_value_positive ]; insp1UpdateIcon = [ THEME.sequence_control, 1, COLORS._main_value_positive ];
attributes.max_file_size = 10000;
array_push(attributeEditors, "HTTP");
array_push(attributeEditors, ["Max request size", function() { return attributes.max_file_size; }, new textBox(TEXTBOX_INPUT.number, function(val) { attributes.max_file_size = val; }) ]);
static onInspector1Update = function() { static onInspector1Update = function() {
request(); request();
} }
@ -24,20 +29,39 @@ function Node_HTTP_request(_x, _y, _group = noone) : Node(_x, _y, _group) constr
var _type = getInputData(1); var _type = getInputData(1);
var _post = getInputData(2); var _post = getInputData(2);
downloaded_size = 0;
switch(_type) { switch(_type) {
case 0 : case 0 :
asyncCall(http_get(_addr), function(param, data) /*=>*/ { asyncCall(http_get(_addr), function(param, data) /*=>*/ {
var sta = data[? "status"];
var res = data[? "result"]; var res = data[? "result"];
outputs[0].setValue(res);
triggerRender(false); if(sta == 0) {
if(downloaded_size > attributes.max_file_size) {
noti_warning($"HTTP request: Requesed file to large ({downloaded_size} B).");
outputs[0].setValue("");
} else
outputs[0].setValue(res);
triggerRender(true);
} else if(sta == 1) {
var _siz = data[? "contentLength"];
var _dow = data[? "sizeDownloaded"];
downloaded_size = _dow;
}
}); });
break; break;
case 1 : case 1 :
asyncCall(http_post_string(_addr, _post), function(param, data) /*=>*/ { asyncCall(http_post_string(_addr, _post), function(param, data) /*=>*/ {
var sta = data[? "status"];
var res = data[? "result"]; var res = data[? "result"];
outputs[0].setValue(res); outputs[0].setValue(res);
triggerRender(false); triggerRender(true);
}); });
break; break;
} }

View File

@ -25,7 +25,7 @@ function Node_Pixel_Math(_x, _y, _group = noone) : Node_Processor(_x, _y, _group
newInput(10, nodeValue_Enum_Button("Operand type", self, 0, [ "Vec4", "Surface" ])); newInput(10, nodeValue_Enum_Button("Operand type", self, 0, [ "Vec4", "Surface" ]));
newInput(11, nodeValue_Surface("Mask", self)); newInput(11, nodeValue_Surface("Operand surface", self));
newOutput(0, nodeValue_Output("Surface out", self, VALUE_TYPE.surface, noone)); newOutput(0, nodeValue_Output("Surface out", self, VALUE_TYPE.surface, noone));

View File

@ -636,7 +636,7 @@ function Panel_Inspector() : PanelContent() constructor {
for( var i = 0, n = array_length(_inspecting.attributeEditors); i < n; i++ ) { for( var i = 0, n = array_length(_inspecting.attributeEditors); i < n; i++ ) {
var edt = _inspecting.attributeEditors[i]; var edt = _inspecting.attributeEditors[i];
if(is_string(edt)) { if(is_string(edt)) { // label
var lby = yy + ui(12); var lby = yy + ui(12);
draw_set_alpha(0.5); draw_set_alpha(0.5);
draw_set_text(f_p1, fa_center, fa_center, COLORS._main_text_sub); draw_set_text(f_p1, fa_center, fa_center, COLORS._main_text_sub);
@ -653,28 +653,31 @@ function Panel_Inspector() : PanelContent() constructor {
continue; continue;
} }
var val = edt[1](); var _att_name = edt[0];
edt[2].setFocusHover(pFOCUS, pHOVER); var _att_val = edt[1]();
var _att_wid = edt[2];
if(instanceof(edt[2]) == "buttonClass") { _att_wid.setFocusHover(pFOCUS, pHOVER);
edt[2].text = edt[0];
edt[2].draw(ui(8), yy, con_w - ui(16), hg, _m); if(instanceof(_att_wid) == "buttonClass") {
_att_wid.text = _att_name;
_att_wid.draw(ui(8), yy, con_w - ui(16), hg, _m);
if(edt[2].inBBOX(_m)) contentPane.hover_content = true; if(_att_wid.inBBOX(_m)) contentPane.hover_content = true;
yy += hg + ui(8); yy += hg + ui(8);
hh += hg + ui(8); hh += hg + ui(8);
continue; continue;
} }
draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text); draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text);
draw_text_add(ui(8), yy + hg / 2, edt[0]); draw_text_add(ui(8), yy + hg / 2, _att_name);
var _param = new widgetParam(wx0, yy, ww, hg, val, {}, _m, x + contentPane.x, y + contentPane.y); var _param = new widgetParam(wx0, yy, ww, hg, _att_val, {}, _m, x + contentPane.x, y + contentPane.y);
_param.s = hg; _param.s = hg;
var _wh = edt[2].drawParam(_param); var _wh = _att_wid.drawParam(_param);
var _hg = max(hg, _wh); var _hg = max(hg, _wh);
if(edt[2].inBBOX(_m)) contentPane.hover_content = true; if(_att_wid.inBBOX(_m)) contentPane.hover_content = true;
yy += _hg + ui(8); yy += _hg + ui(8);
hh += _hg + ui(8); hh += _hg + ui(8);
} }

View File

@ -35,8 +35,7 @@ function scrollBox(_data, _onModify, update_hover = true) : widget() constructor
type = 0; type = 0;
static trigger = function() { static trigger = function() {
if(is_method(data_list)) data = data_list(); data = is_method(data_list)? data_list() : data_list;
else data = data_list;
var ind = array_find(data, curr_text); var ind = array_find(data, curr_text);
open = true; open = true;
@ -67,8 +66,7 @@ function scrollBox(_data, _onModify, update_hover = true) : widget() constructor
open_ry = _ry; open_ry = _ry;
h = _h; h = _h;
if(is_method(data_list)) data = data_list(); data = is_method(data_list)? data_list() : data_list;
else data = data_list;
var _selVal = _val; var _selVal = _val;
@ -164,7 +162,6 @@ function scrollBox(_data, _onModify, update_hover = true) : widget() constructor
static clone = function() { static clone = function() {
var cln = new scrollBox(data, onModify, update_hover); var cln = new scrollBox(data, onModify, update_hover);
return cln; return cln;
} }
} }