- Fix active property not working.

This commit is contained in:
Tanasart 2024-07-07 14:08:13 +07:00
parent c54e918ff4
commit 47fb7b0ce5
8 changed files with 106 additions and 83 deletions

View file

@ -15,9 +15,7 @@
function d3d11_shader_compile_ps(_file, _entryPoint, _profile) {
if(!GMD3D11_IS_SUPPORTED) return;
INLINE
static _fn = external_define(
GMD3D11_PATH, "d3d11_shader_compile_ps", dll_cdecl, ty_real,
3, ty_string, ty_string, ty_string);
static _fn = external_define( GMD3D11_PATH, "d3d11_shader_compile_ps", dll_cdecl, ty_real, 3, ty_string, ty_string, ty_string);
return external_call(_fn, _file, _entryPoint, _profile);
}
@ -35,9 +33,7 @@ function d3d11_shader_compile_ps(_file, _entryPoint, _profile) {
function d3d11_shader_compile_vs(_file, _entryPoint, _profile) {
if(!GMD3D11_IS_SUPPORTED) return;
INLINE
static _fn = external_define(
GMD3D11_PATH, "d3d11_shader_compile_vs", dll_cdecl, ty_real,
3, ty_string, ty_string, ty_string);
static _fn = external_define( GMD3D11_PATH, "d3d11_shader_compile_vs", dll_cdecl, ty_real, 3, ty_string, ty_string, ty_string);
return external_call(_fn, _file, _entryPoint, _profile);
}
@ -50,9 +46,7 @@ function d3d11_shader_compile_vs(_file, _entryPoint, _profile) {
function d3d11_shader_override_ps(_ps) {
if(!GMD3D11_IS_SUPPORTED) return;
INLINE
static _fn = external_define(
GMD3D11_PATH, "d3d11_shader_override_ps", dll_cdecl, ty_real,
1, ty_real);
static _fn = external_define( GMD3D11_PATH, "d3d11_shader_override_ps", dll_cdecl, ty_real, 1, ty_real);
return external_call(_fn, _ps);
}
@ -67,9 +61,7 @@ function d3d11_shader_override_ps(_ps) {
function d3d11_shader_override_vs(_vs) {
if(!GMD3D11_IS_SUPPORTED) return;
INLINE
static _fn = external_define(
GMD3D11_PATH, "d3d11_shader_override_vs", dll_cdecl, ty_real,
1, ty_real);
static _fn = external_define( GMD3D11_PATH, "d3d11_shader_override_vs", dll_cdecl, ty_real, 1, ty_real);
return external_call(_fn, _vs);
}
@ -83,9 +75,7 @@ function d3d11_shader_override_vs(_vs) {
function d3d11_shader_exists(_shader) {
if(!GMD3D11_IS_SUPPORTED) return;
INLINE
static _fn = external_define(
GMD3D11_PATH, "d3d11_shader_exists", dll_cdecl, ty_real,
1, ty_real);
static _fn = external_define( GMD3D11_PATH, "d3d11_shader_exists", dll_cdecl, ty_real, 1, ty_real);
return external_call(_fn, _shader);
}
@ -97,8 +87,6 @@ function d3d11_shader_exists(_shader) {
function d3d11_shader_destroy(_shader) {
if(!GMD3D11_IS_SUPPORTED) return;
INLINE
static _fn = external_define(
GMD3D11_PATH, "d3d11_shader_destroy", dll_cdecl, ty_real,
1, ty_real);
static _fn = external_define( GMD3D11_PATH, "d3d11_shader_destroy", dll_cdecl, ty_real, 1, ty_real);
return external_call(_fn, _shader);
}

View file

@ -773,9 +773,10 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
inputs_data = array_verify(inputs_data, ds_list_size(inputs));
for(var i = 0; i < ds_list_size(inputs); i++) {
if(!is_instanceof(inputs[| i], NodeValue)) continue;
var _inp = inputs[| i];
if(!is_instanceof(_inp, NodeValue)) continue;
var val = inputs[| i].getValue(frame);
var val = _inp.getValue(frame);
setInputData(i, val);
}
} #endregion
@ -1087,6 +1088,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
} #endregion
static refreshNodeDisplay = function() { #region
if(IS_PLAYING) return;
INLINE
updateIO();

View file

@ -57,7 +57,7 @@ output.color = surfaceColor;")
setDynamicInput(3, false);
static refreshDynamicInput = function() { #region
static refreshDynamicInput = function() {
var _in = ds_list_create();
for( var i = 0; i < input_fix_len; i++ )
@ -91,52 +91,68 @@ output.color = surfaceColor;")
switch(type) {
case 1 :
if(is_array(cur_valu)) inp_valu.overrideValue(0);
inp_valu.setType(VALUE_TYPE.integer);
inp_valu.setDisplay(VALUE_DISPLAY._default);
break;
case 0 :
if(is_array(cur_valu)) inp_valu.overrideValue(0);
inp_valu.setType(VALUE_TYPE.float);
inp_valu.setDisplay(VALUE_DISPLAY._default);
break;
case 2 :
if(!is_array(cur_valu) || array_length(cur_valu) != 2)
inp_valu.overrideValue([ 0, 0 ]);
inp_valu.setType(VALUE_TYPE.float);
inp_valu.setDisplay(VALUE_DISPLAY.vector);
break;
case 3 :
if(!is_array(cur_valu) || array_length(cur_valu) != 3)
inp_valu.overrideValue([ 0, 0, 0 ]);
inp_valu.setType(VALUE_TYPE.float);
inp_valu.setDisplay(VALUE_DISPLAY.vector);
break;
case 4 :
if(!is_array(cur_valu) || array_length(cur_valu) != 4)
inp_valu.overrideValue([ 0, 0, 0, 0 ]);
inp_valu.setType(VALUE_TYPE.float);
inp_valu.setDisplay(VALUE_DISPLAY.vector);
break;
case 5 :
if(!is_array(cur_valu) || array_length(cur_valu) != 9)
inp_valu.overrideValue(array_create(9));
inp_valu.setType(VALUE_TYPE.float);
inp_valu.setDisplay(VALUE_DISPLAY.matrix, { size: 3 });
break;
case 6 :
if(!is_array(cur_valu) || array_length(cur_valu) != 16)
inp_valu.overrideValue(array_create(16));
inp_valu.setType(VALUE_TYPE.float);
inp_valu.setDisplay(VALUE_DISPLAY.matrix, { size: 4 });
break;
case 7 :
inp_valu.setType(VALUE_TYPE.surface);
inp_valu.setDisplay(VALUE_DISPLAY._default);
break;
case 8 :
inp_valu.setType(VALUE_TYPE.color);
inp_valu.setDisplay(VALUE_DISPLAY._default);
break;
}
array_push(input_display_list, i + 2);
@ -154,7 +170,6 @@ output.color = surfaceColor;")
//for( var i = 0, n = array_length(input_display_list); i < n; i++ )
// print(input_display_list[i]);
//print("==========================");
#endregion
} if(!LOADING && !APPENDING) refreshDynamicInput();
insp1UpdateTooltip = __txt("Compile");
@ -223,19 +238,20 @@ struct PixelShaderOutput {
var _arg_type = getInputData(i + 1);
switch(_arg_type) {
case 0 : fs_param += $"float {_arg_name};\n"; break; //u_float
case 1 : fs_param += $"int {_arg_name};\n"; break; //u_int
case 2 : fs_param += $"float2 {_arg_name};\n"; break; //u_vec2
case 3 : fs_param += $"float3 {_arg_name};\n"; break; //u_vec3
case 4 : fs_param += $"float4 {_arg_name};\n"; break; //u_vec4
case 5 : fs_param += $"float3x3 {_arg_name};\n"; break; //u_mat3
case 6 : fs_param += $"float4x4 {_arg_name};\n"; break; //u_mat4
case 7 : //u_sampler2D
case 0 : fs_param += $"float {_arg_name};\n"; break; // u_float
case 1 : fs_param += $"int {_arg_name};\n"; break; // u_int
case 2 : fs_param += $"float2 {_arg_name};\n"; break; // u_vec2
case 3 : fs_param += $"float3 {_arg_name};\n"; break; // u_vec3
case 4 : fs_param += $"float4 {_arg_name};\n"; break; // u_vec4
case 5 : fs_param += $"float3x3 {_arg_name};\n"; break; // u_mat3
case 6 : fs_param += $"float4x4 {_arg_name};\n"; break; // u_mat4
case 7 : // u_sampler2D
fs_sample += $"Texture2D {_arg_name}Object : register(t{sampler_slot});\n";
fs_sample += $"SamplerState {_arg_name} : register(s{sampler_slot});\n";
sampler_slot++;
break;
case 8 : fs_param += $"float4 {_arg_name};\n"; break; //u_vec4
case 8 : fs_param += $"float4 {_arg_name};\n"; break; // u_vec4
}
}

View file

@ -124,12 +124,8 @@ function Node_Processor(_x, _y, _group = noone) : Node(_x, _y, _group) construct
current_data = _data;
if(active_index > -1 && !_data[active_index]) { // skip
if(inputs[| 0].type == VALUE_TYPE.surface)
return surface_clone(_data[0], _out);
else
return _data[0];
}
if(active_index > -1 && !_data[active_index]) // skip
return inputs[| 0].type == VALUE_TYPE.surface? surface_clone(_data[0], _out) : _data[0];
var data = processData(_out, _data, outIndex, 0); // Process data
@ -198,6 +194,7 @@ function Node_Processor(_x, _y, _group = noone) : Node(_x, _y, _group) construct
_out[l] = surface_clone(_data[0], _out[l]);
else
_out[l] = _data[0];
} else {
_out[l] = processData(_out[l], _data, outIndex, l); // Process data
@ -224,10 +221,19 @@ function Node_Processor(_x, _y, _group = noone) : Node(_x, _y, _group) construct
var data;
var _out = array_create(_os);
for(var i = 0; i < _os; i++) _out[i] = outputs[| i].getValue();
var _surfOut = outputs[| 0];
var _skip = active_index != -1 && !inputs_data[active_index];
if(process_amount == 1) {
current_data = inputs_data;
if(_skip) { // skip
var _skp = inputs[| 0].type == VALUE_TYPE.surface? surface_clone(inputs_data[0], _out[0]) : inputs_data[0];
_surfOut.setValue(_skp);
return;
}
var _dim = getDimension();
for(var i = 0; i < _os; i++) {
@ -247,35 +253,42 @@ function Node_Processor(_x, _y, _group = noone) : Node(_x, _y, _group) construct
return;
}
var _inputs = array_create(_is);
var _outputs = array_create(_os);
if(_skip) {
var _skp = inputs[| 0].type == VALUE_TYPE.surface? surface_array_clone(inputs_data[0]) : inputs_data[0];
_surfOut.setValue(_skp);
} else {
var _inputs = array_create(_is);
var _outputs = array_create(_os);
for( var l = 0; l < process_amount; l++ ) {
for(var i = 0; i < _is; i++) _inputs[i] = all_inputs[i][l];
if(l == 0 || l == preview_index) current_data = _inputs;
var _dim = getDimension(l);
var _outa = array_create(_os);
for(var i = 0; i < _os; i++) {
_outa[i] = array_safe_get(_out[i], l);
if(outputs[| i].type == VALUE_TYPE.surface)
_outa[i] = surface_verify(_outa[i], _dim[0], _dim[1], _dep);
}
if(_os == 1) {
data = processData(_outa[0], _inputs, 0, l);
_outputs[0][l] = data;
for( var l = 0; l < process_amount; l++ ) {
for(var i = 0; i < _is; i++) _inputs[i] = all_inputs[i][l];
if(l == 0 || l == preview_index) current_data = _inputs;
} else {
data = processData(_outa, _inputs, 0, l);
for(var i = 0; i < _os; i++) _outputs[i][l] = data[i];
var _dim = getDimension(l);
var _outa = array_create(_os);
for(var i = 0; i < _os; i++) {
_outa[i] = array_safe_get(_out[i], l);
if(outputs[| i].type == VALUE_TYPE.surface)
_outa[i] = surface_verify(_outa[i], _dim[0], _dim[1], _dep);
}
if(_os == 1) {
data = processData(_outa[0], _inputs, 0, l);
_outputs[0][l] = data;
} else {
data = processData(_outa, _inputs, 0, l);
for(var i = 0; i < _os; i++) _outputs[i][l] = data[i];
}
}
}
for( var i = 0, n = _os; i < n; i++ )
outputs[| i].setValue(_outputs[i]);
for( var i = 0, n = _os; i < n; i++ )
outputs[| i].setValue(_outputs[i]);
}
}
@ -301,16 +314,18 @@ function Node_Processor(_x, _y, _group = noone) : Node(_x, _y, _group) construct
all_inputs = array_verify(all_inputs, _len);
for(var i = 0; i < _len; i++) {
var raw = inputs[| i].getValue();
var amo = inputs[| i].arrayLength(raw);
var _in = inputs[| i];
var raw = _in._getValue();
var amo = _in.arrayLength(raw);
var val = raw;
if(amo == 0) val = noone; //empty array
if(amo == 0) val = noone; //empty array
else if(amo == 1) val = raw[0]; //spread single array
amo = max(1, amo);
setInputData(i, val);
inputs_is_array[i] = inputs[| i].isArray(val);
inputs_is_array[i] = _in.isArray(val);
switch(attributes.array_process) {
case ARRAY_PROCESS.loop :
@ -324,7 +339,7 @@ function Node_Processor(_x, _y, _group = noone) : Node(_x, _y, _group) construct
break;
}
process_length[i] = [amo, process_amount];
process_length[i] = [ amo, process_amount ];
}
var amoMax = process_amount;

View file

@ -1,5 +1,5 @@
{
"$GMScript":"v1",
"$GMScript":"",
"%Name":"node_processor",
"isCompatibility":false,
"isDnD":false,

View file

@ -1084,7 +1084,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
static getStaticValue = function() { INLINE return ds_list_empty(animator.values)? 0 : animator.values[| 0].value; }
static getValue = function(_time = CURRENT_FRAME, applyUnit = true, arrIndex = 0, useCache = false, log = false) { #region ////Get value
static getValue = function(_time = CURRENT_FRAME, applyUnit = true, arrIndex = 0, useCache = false, log = false) { //// Get value
if(type == VALUE_TYPE.trigger)
return _getValue(_time, false, 0, false);
@ -1113,9 +1113,10 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
draw_junction_index = type;
if(type == VALUE_TYPE.surface || type == VALUE_TYPE.any) {
var _sval = val;
if(is_array(_sval) && !array_empty(_sval))
if(is_array(_sval) && !array_empty(_sval))
_sval = _sval[0];
if(is_instanceof(_sval, SurfaceAtlas))
if(is_instanceof(_sval, SurfaceAtlas))
draw_junction_index = VALUE_TYPE.atlas;
}
@ -1130,9 +1131,9 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
updateColor(val);
return val;
} #endregion
}
static _getValue = function(_time = CURRENT_FRAME, applyUnit = true, arrIndex = 0, log = false) { #region
static _getValue = function(_time = CURRENT_FRAME, applyUnit = true, arrIndex = 0, log = false) {
getValueRecursive(self.__curr_get_val, _time);
var val = __curr_get_val[0];
@ -1144,7 +1145,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
if(connect_type == JUNCTION_CONNECT.output)
return val;
if(typ == VALUE_TYPE.surface && (type == VALUE_TYPE.integer || type == VALUE_TYPE.float)) { #region Dimension conversion
if(typ == VALUE_TYPE.surface && (type == VALUE_TYPE.integer || type == VALUE_TYPE.float)) { // Dimension conversion
if(is_array(val)) {
var eqSize = true;
var sArr = [];
@ -1168,9 +1169,9 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
return [ surface_get_width_safe(val), surface_get_height_safe(val) ];
return [ 1, 1 ];
} #endregion
}
if(type == VALUE_TYPE.d3Material) { #region
if(type == VALUE_TYPE.d3Material) {
if(nod == self) {
return def_val;
@ -1183,22 +1184,22 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
return _val;
}
} #endregion
}
if(PROJECT.attributes.strict) return val;
val = arrayBalance(val);
if(isArray(val) && array_length(val) < 1024) { #region Process data
if(isArray(val) && array_length(val) < 1024) { // Process data
var _val = array_create(array_length(val));
for( var i = 0, n = array_length(val); i < n; i++ )
_val[i] = valueProcess(val[i], nod, applyUnit, arrIndex);
return _val;
} #endregion
}
return valueProcess(val, nod, applyUnit, arrIndex);
} #endregion
}
static getValueRecursive = function(arr = __curr_get_val, _time = CURRENT_FRAME) { #region

View file

@ -226,7 +226,7 @@ function Render(partial = false, runAction = false) { #region
if(renderable) {
var _render_pt = get_timer();
rendering.doUpdate();
rendering.doUpdate();
_render_time += get_timer() - _render_pt;
var nextNodes = rendering.getNextNodes();
@ -258,6 +258,7 @@ function Render(partial = false, runAction = false) { #region
}
LOG_END();
} #endregion
function __renderListReset(arr) { #region

View file

@ -1,5 +1,5 @@
{
"$GMScript":"v1",
"$GMScript":"",
"%Name":"render_data",
"isCompatibility":false,
"isDnD":false,