mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2025-01-11 23:06:51 +01:00
dynamic input undo
This commit is contained in:
parent
b422fdcf65
commit
ad7c736a89
18 changed files with 725 additions and 556 deletions
|
@ -1037,6 +1037,8 @@
|
|||
{"name":"node_tunnel_out","order":1,"path":"scripts/node_tunnel_out/node_tunnel_out.yy",},
|
||||
{"name":"node_twirl","order":4,"path":"scripts/node_twirl/node_twirl.yy",},
|
||||
{"name":"node_unicode","order":1,"path":"scripts/node_unicode/node_unicode.yy",},
|
||||
{"name":"node_value_base","order":17,"path":"scripts/node_value_base/node_value_base.yy",},
|
||||
{"name":"node_value_types","order":18,"path":"scripts/node_value_types/node_value_types.yy",},
|
||||
{"name":"node_value","order":5,"path":"scripts/node_value/node_value.yy",},
|
||||
{"name":"node_vector_cross_2D","order":11,"path":"scripts/node_vector_cross_2D/node_vector_cross_2D.yy",},
|
||||
{"name":"node_vector_cross_3D","order":10,"path":"scripts/node_vector_cross_3D/node_vector_cross_3D.yy",},
|
||||
|
|
|
@ -1493,6 +1493,8 @@
|
|||
{"id":{"name":"node_tunnel_out","path":"scripts/node_tunnel_out/node_tunnel_out.yy",},},
|
||||
{"id":{"name":"node_twirl","path":"scripts/node_twirl/node_twirl.yy",},},
|
||||
{"id":{"name":"node_unicode","path":"scripts/node_unicode/node_unicode.yy",},},
|
||||
{"id":{"name":"node_value_base","path":"scripts/node_value_base/node_value_base.yy",},},
|
||||
{"id":{"name":"node_value_types","path":"scripts/node_value_types/node_value_types.yy",},},
|
||||
{"id":{"name":"node_value","path":"scripts/node_value/node_value.yy",},},
|
||||
{"id":{"name":"node_VCT","path":"scripts/node_VCT/node_VCT.yy",},},
|
||||
{"id":{"name":"node_vector_cross_2D","path":"scripts/node_vector_cross_2D/node_vector_cross_2D.yy",},},
|
||||
|
|
|
@ -19,6 +19,11 @@ function buttonClass(_onClick, _icon = noone) : widget() constructor {
|
|||
toggled = false;
|
||||
context = noone;
|
||||
|
||||
static setContext = function(struct) { #region
|
||||
onClick = method(struct, onClick);
|
||||
return self;
|
||||
} #endregion
|
||||
|
||||
static setLua = function(_lua_thread, _lua_key, _lua_func) { #region
|
||||
lua_thread = _lua_thread;
|
||||
lua_thread_key = _lua_key;
|
||||
|
@ -163,14 +168,16 @@ function buttonInstant(spr, _x, _y, _w, _h, _m, _act, _hvr, _tip = "", _icon = n
|
|||
return res;
|
||||
}
|
||||
|
||||
function buttonTextIconInstant(spr, _x, _y, _w, _h, _m, _act, _hvr, _tip = "", _icon = noone, _icon_label = "") {
|
||||
var _b = buttonInstant(spr, _x, _y, _w, _h, _m, _act, _hvr, _tip);
|
||||
function buttonTextIconInstant(active, spr, _x, _y, _w, _h, _m, _act, _hvr, _tip = "", _icon = noone, _icon_label = "", _icon_blend = COLORS._main_icon_light, _icon_alpha = 1) {
|
||||
var _b = 0;
|
||||
|
||||
draw_set_text(f_p1, fa_left, fa_center, COLORS._main_icon_light);
|
||||
if(active) _b = buttonInstant(spr, _x, _y, _w, _h, _m, _act, _hvr, _tip);
|
||||
|
||||
draw_set_text(f_p1, fa_left, fa_center, active? COLORS._main_icon_light : COLORS._main_icon);
|
||||
var bxc = _x + _w / 2 - (string_width(_icon_label) + ui(64)) / 2;
|
||||
var byc = _y + _h / 2;
|
||||
draw_sprite_ui(_icon, 0, bxc + ui(24), byc,,,, COLORS._main_icon_light);
|
||||
draw_text(bxc + ui(48), byc, _icon_label);
|
||||
draw_sprite_ui(_icon, 0, bxc + ui(24), byc, 1, 1, 0, _icon_blend, _icon_alpha * (0.5 + 0.5 * active));
|
||||
draw_text_add(bxc + ui(48), byc, _icon_label);
|
||||
|
||||
return _b;
|
||||
}
|
|
@ -149,7 +149,7 @@ function Action(_type, _object, _data, _trigger = 0) constructor {
|
|||
break;
|
||||
|
||||
case ACTION_TYPE.custom :
|
||||
obj(data);
|
||||
obj(data, true);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -239,7 +239,7 @@ function Action(_type, _object, _data, _trigger = 0) constructor {
|
|||
break;
|
||||
|
||||
case ACTION_TYPE.custom :
|
||||
obj(data);
|
||||
obj(data, false);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -342,9 +342,9 @@ function recordAction(_type, _object, _data = -1, _trigger = 0) { #region
|
|||
return act;
|
||||
} #endregion
|
||||
|
||||
function recordAction_variable_change(object, variable_name, variable_old_value, undo_label = "") {
|
||||
function recordAction_variable_change(object, variable_name, variable_old_value, undo_label = "", _trigger = 0) {
|
||||
INLINE
|
||||
recordAction(ACTION_TYPE.var_modify, object, undo_label == ""? [ variable_old_value, variable_name ] : [ variable_old_value, variable_name, undo_label ]);
|
||||
recordAction(ACTION_TYPE.var_modify, object, undo_label == ""? [ variable_old_value, variable_name ] : [ variable_old_value, variable_name, undo_label ], _trigger);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -40,7 +40,9 @@ function Node_VFX_Renderer(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
|||
array_push(input_display_list, ["Particle", false], index + 0, index + 1);
|
||||
|
||||
return inputs[| index + 1];
|
||||
} setDynamicInput(2, true, VALUE_TYPE.particle);
|
||||
}
|
||||
|
||||
setDynamicInput(2, true, VALUE_TYPE.particle);
|
||||
dyna_input_check_shift = 1;
|
||||
|
||||
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
|
||||
|
@ -81,7 +83,7 @@ function Node_VFX_Renderer(_x, _y, _group = noone) : Node(_x, _y, _group) constr
|
|||
if(_type == PARTICLE_RENDER_TYPE.surface)
|
||||
shader_set_interpolation(_outSurf);
|
||||
|
||||
for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i += data_length ) {
|
||||
for( var i = input_fix_len; i < ds_list_size(inputs); i += data_length ) {
|
||||
var blend = inputs[| i + 0].getValue(_time);
|
||||
var parts = inputs[| i + 1].getValue(_time);
|
||||
|
||||
|
|
|
@ -46,7 +46,9 @@ function Node_VFX_Renderer_Output(_x, _y, _group = noone) : Node_Group_Output(_x
|
|||
array_push(input_display_list, ["Particle", false], index + 0, index + 1);
|
||||
|
||||
return inputs[| index + 1];
|
||||
} setDynamicInput(2, true, VALUE_TYPE.particle);
|
||||
}
|
||||
|
||||
setDynamicInput(2, true, VALUE_TYPE.particle);
|
||||
dyna_input_check_shift = 1;
|
||||
|
||||
static createOutput = function() { #region
|
||||
|
@ -106,7 +108,7 @@ function Node_VFX_Renderer_Output(_x, _y, _group = noone) : Node_Group_Output(_x
|
|||
if(_type == PARTICLE_RENDER_TYPE.surface)
|
||||
shader_set_interpolation(_outSurf);
|
||||
|
||||
for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i += data_length ) {
|
||||
for( var i = input_fix_len; i < ds_list_size(inputs); i += data_length ) {
|
||||
var blend = inputs[| i + 0].getValue(_time);
|
||||
var parts = inputs[| i + 1].getValue(_time);
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ function Node_Array(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
|||
|
||||
setDimension(96, 48);
|
||||
|
||||
attributes.size = 0;
|
||||
attributes.spread_value = false;
|
||||
|
||||
inputs[| 0] = nodeValue("Type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0 )
|
||||
|
@ -18,17 +17,15 @@ function Node_Array(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
|||
|
||||
var bw = _w / 2 - ui(4);
|
||||
var bh = ui(36);
|
||||
if(buttonTextIconInstant(THEME.button_hide, _x, _y + ui(8), bw, bh, _m, _focus, _hover, "", THEME.add, __txt("Add")) == 2) {
|
||||
attributes.size++;
|
||||
refreshDynamicInput();
|
||||
update();
|
||||
if(buttonTextIconInstant(true, THEME.button_hide, _x, _y + ui(8), bw, bh, _m, _focus, _hover, "", THEME.add, __txt("Add"), COLORS._main_value_positive) == 2) {
|
||||
attributes.size = max(attributes.size, (ds_list_size(inputs) - input_fix_len) / data_length ) + 1;
|
||||
onInputResize();
|
||||
}
|
||||
|
||||
var amo = attributes.size;
|
||||
if(buttonTextIconInstant(THEME.button_hide, _x + _w - bw, _y + ui(8), bw, bh, _m, _focus, _hover, "", THEME.minus, __txt("Remove")) == 2) {
|
||||
attributes.size = max(attributes.size - 1, 0);
|
||||
refreshDynamicInput();
|
||||
update();
|
||||
if(buttonTextIconInstant(attributes.size > 0, THEME.button_hide, _x + _w - bw, _y + ui(8), bw, bh, _m, _focus, _hover, "", THEME.minus, __txt("Remove"), COLORS._main_value_negative) == 2) {
|
||||
attributes.size--;
|
||||
onInputResize();
|
||||
}
|
||||
|
||||
return _h;
|
||||
|
@ -47,7 +44,9 @@ function Node_Array(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
|||
array_push(input_display_list, index);
|
||||
|
||||
return inputs[| index];
|
||||
} setDynamicInput(1);
|
||||
}
|
||||
|
||||
setDynamicInput(1);
|
||||
|
||||
static getType = function() { #region
|
||||
var _type = getInputData(0);
|
||||
|
@ -145,7 +144,7 @@ function Node_Array(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
|||
var ind = 0;
|
||||
var spd = getInputData(1);
|
||||
|
||||
for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i++ ) {
|
||||
for( var i = input_fix_len; i < ds_list_size(inputs); i++ ) {
|
||||
var val = getInputData(i);
|
||||
|
||||
if(is_array(val) && spd) array_append(res, val);
|
||||
|
|
|
@ -466,6 +466,8 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
|||
.setDummy(function() { return createNewInput(); })
|
||||
.setVisible(false, true);
|
||||
}
|
||||
|
||||
attributes.size = 0;
|
||||
} #endregion
|
||||
|
||||
static refreshDynamicInput = function() { #region
|
||||
|
@ -513,6 +515,8 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
|||
|
||||
static getInputAmount = function() { return (ds_list_size(inputs) - input_fix_len) / data_length; }
|
||||
|
||||
function onInputResize() { refreshDynamicInput(); triggerRender(); }
|
||||
|
||||
#endregion //////////////////////////////// Dynamic IO ////////////////////////////////
|
||||
|
||||
static getOutput = function(junc = noone) { #region
|
||||
|
@ -999,7 +1003,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
|||
getJunctionList();
|
||||
} run_in(1, function() { refreshNodeDisplay(); }); #endregion
|
||||
|
||||
static getJunctionList = function() { #region
|
||||
static getJunctionList = function() { #region ////getJunctionList
|
||||
var amo = input_display_list == -1? ds_list_size(inputs) : array_length(input_display_list);
|
||||
inputDisplayList = [];
|
||||
|
||||
|
|
|
@ -50,15 +50,15 @@ function Node_Equation(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
|
|||
|
||||
var bw = _w / 2 - ui(4);
|
||||
var bh = ui(36);
|
||||
if(buttonTextIconInstant(THEME.button_hide, _x, _y + ui(8), bw, bh, _m, _focus, _hover, "", THEME.add, __txt("Add")) == 2) {
|
||||
if(buttonTextIconInstant(true, THEME.button_hide, _x, _y + ui(8), bw, bh, _m, _focus, _hover, "", THEME.add, __txt("Add"), COLORS._main_value_positive) == 2) {
|
||||
attributes.size++;
|
||||
refreshDynamicInput();
|
||||
update();
|
||||
}
|
||||
|
||||
var amo = attributes.size;
|
||||
if(buttonTextIconInstant(THEME.button_hide, _x + _w - bw, _y + ui(8), bw, bh, _m, _focus, _hover, "", THEME.minus, __txt("Remove")) == 2) {
|
||||
attributes.size = max(attributes.size - 1, 0);
|
||||
if(buttonTextIconInstant(attributes.size > 0 && THEME.button_hide, _x + _w - bw, _y + ui(8), bw, bh, _m, _focus, _hover, "", THEME.minus, __txt("Remove"), COLORS._main_value_negative) == 2) {
|
||||
attributes.size--;
|
||||
refreshDynamicInput();
|
||||
update();
|
||||
}
|
||||
|
|
|
@ -28,12 +28,12 @@ function Node_MIDI_In(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
|
|||
|
||||
var bw = _w / 2 - ui(4);
|
||||
var bh = ui(36);
|
||||
if(buttonTextIconInstant(THEME.button_hide, _x, _y + ui(8), bw, bh, _m, _focus, _hover, "", THEME.add, __txt("Add")) == 2) {
|
||||
if(buttonTextIconInstant(true, THEME.button_hide, _x, _y + ui(8), bw, bh, _m, _focus, _hover, "", THEME.add, __txt("Add"), COLORS._main_value_positive) == 2) {
|
||||
createNewInput();
|
||||
}
|
||||
|
||||
var amo = ds_list_size(inputs);
|
||||
if(amo > 1 && buttonTextIconInstant(THEME.button_hide, _x + _w - bw, _y + ui(8), bw, bh, _m, _focus, _hover, "", THEME.minus, __txt("Remove")) == 2) {
|
||||
if(buttonTextIconInstant(amo > 1, THEME.button_hide, _x + _w - bw, _y + ui(8), bw, bh, _m, _focus, _hover, "", THEME.minus, __txt("Remove"), COLORS._main_value_negative) == 2) {
|
||||
var _out = outputs[| ds_list_size(outputs) - 1];
|
||||
for( var i = 0, n = array_length(_out.value_to); i < n; i++ )
|
||||
_out.value_to[i].removeFrom();
|
||||
|
|
|
@ -40,7 +40,9 @@ function Node_Statistic(_x, _y, _group = noone) : Node(_x, _y, _group) construct
|
|||
.setVisible(false, true);
|
||||
|
||||
return inputs[| index];
|
||||
} setDynamicInput(1, true, VALUE_TYPE.float);
|
||||
}
|
||||
|
||||
setDynamicInput(1, true, VALUE_TYPE.float);
|
||||
|
||||
outputs[| 0] = nodeValue("Statistic", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, -1);
|
||||
|
||||
|
@ -48,14 +50,9 @@ function Node_Statistic(_x, _y, _group = noone) : Node(_x, _y, _group) construct
|
|||
var type = getInputData(0);
|
||||
var res = 0;
|
||||
|
||||
if(ds_list_size(inputs) - 1 == input_fix_len) {
|
||||
outputs[| 0].setValue(0);
|
||||
return;
|
||||
}
|
||||
|
||||
switch(type) {
|
||||
case STAT_OPERATOR._sum :
|
||||
for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i++ ) {
|
||||
for( var i = input_fix_len; i < ds_list_size(inputs); i++ ) {
|
||||
var val = getInputData(i);
|
||||
if(is_array(val)) {
|
||||
for( var j = 0; j < array_length(val); j++ )
|
||||
|
@ -71,7 +68,7 @@ function Node_Statistic(_x, _y, _group = noone) : Node(_x, _y, _group) construct
|
|||
}
|
||||
|
||||
var amo = 0;
|
||||
for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i++ ) {
|
||||
for( var i = input_fix_len; i < ds_list_size(inputs); i++ ) {
|
||||
var val = getInputData(i);
|
||||
if(is_array(val)) {
|
||||
for( var j = 0; j < array_length(val); j++ ) {
|
||||
|
@ -86,14 +83,14 @@ function Node_Statistic(_x, _y, _group = noone) : Node(_x, _y, _group) construct
|
|||
res /= amo;
|
||||
break;
|
||||
case STAT_OPERATOR._median :
|
||||
if(ds_list_size(inputs) - 1 - input_fix_len == 0) {
|
||||
if(ds_list_size(inputs) - input_fix_len == 0) {
|
||||
res = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
var vals = [];
|
||||
var amo = 0;
|
||||
for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i++ ) {
|
||||
for( var i = input_fix_len; i < ds_list_size(inputs); i++ ) {
|
||||
var val = getInputData(i);
|
||||
if(is_array(val)) {
|
||||
for( var j = 0; j < array_length(val); j++ ) {
|
||||
|
@ -119,7 +116,7 @@ function Node_Statistic(_x, _y, _group = noone) : Node(_x, _y, _group) construct
|
|||
break;
|
||||
case STAT_OPERATOR._min :
|
||||
var _min = 9999999999;
|
||||
for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i++ ) {
|
||||
for( var i = input_fix_len; i < ds_list_size(inputs); i++ ) {
|
||||
var val = getInputData(i);
|
||||
if(is_array(val)) {
|
||||
for( var j = 0; j < array_length(val); j++ )
|
||||
|
@ -132,7 +129,7 @@ function Node_Statistic(_x, _y, _group = noone) : Node(_x, _y, _group) construct
|
|||
case STAT_OPERATOR._max :
|
||||
var _max = -9999999999;
|
||||
|
||||
for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i++ ) {
|
||||
for( var i = input_fix_len; i < ds_list_size(inputs); i++ ) {
|
||||
var val = getInputData(i);
|
||||
if(is_array(val)) {
|
||||
for( var j = 0; j < array_length(val); j++ )
|
||||
|
|
|
@ -3,56 +3,119 @@ function Node_Struct(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
|
|||
|
||||
setDimension(96, 48);
|
||||
|
||||
size_adjust_tool = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus) { #region
|
||||
var _h = ui(48);
|
||||
|
||||
var bw = _w / 2 - ui(4);
|
||||
var bh = ui(36);
|
||||
if(buttonTextIconInstant(true, THEME.button_hide, _x, _y + ui(8), bw, bh, _m, _focus, _hover, "", THEME.add, __txt("Add"), COLORS._main_value_positive) == 2)
|
||||
addInput();
|
||||
|
||||
var amo = attributes.size;
|
||||
if(buttonTextIconInstant(attributes.size > 0, THEME.button_hide, _x + _w - bw, _y + ui(8), bw, bh, _m, _focus, _hover, "", THEME.minus, __txt("Remove"), COLORS._main_value_negative) == 2)
|
||||
deleteInput(ds_list_size(inputs) - data_length);
|
||||
|
||||
return _h;
|
||||
}); #endregion
|
||||
|
||||
input_display_list = [ size_adjust_tool, ];
|
||||
|
||||
outputs[| 0] = nodeValue("Struct", self, JUNCTION_CONNECT.output, VALUE_TYPE.struct, {});
|
||||
|
||||
static createNewInput = function() {
|
||||
var index = ds_list_size(inputs);
|
||||
inputs[| index + 0] = nodeValue("Key", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "" );
|
||||
|
||||
inputs[| index + 1] = nodeValue("value", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, 0 )
|
||||
.setVisible(false, false);
|
||||
|
||||
return inputs[| index + 0];
|
||||
} setDynamicInput(2, false);
|
||||
|
||||
if(!LOADING && !APPENDING) createNewInput();
|
||||
#region //////////////////////////////// Dynamic IO ////////////////////////////////
|
||||
|
||||
static refreshDynamicInput = function() {
|
||||
var _in = ds_list_create();
|
||||
|
||||
for( var i = 0; i < input_fix_len; i++ )
|
||||
ds_list_add(_in, inputs[| i]);
|
||||
|
||||
for( var i = input_fix_len; i < ds_list_size(inputs); i += data_length ) {
|
||||
var _val = inputs[| i].getValue();
|
||||
static createNewInput = function(list = inputs) {
|
||||
var index = ds_list_size(list);
|
||||
|
||||
if(_val != "") {
|
||||
ds_list_add(_in, inputs[| i + 0]);
|
||||
ds_list_add(_in, inputs[| i + 1].setVisible(false, true));
|
||||
var bDel = button(function() { node.deleteInput(index); })
|
||||
.setIcon(THEME.minus_16, 0, COLORS._main_icon);
|
||||
|
||||
list[| index + 0] = nodeValue("Key", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "" )
|
||||
.setDisplay(VALUE_DISPLAY.text_box, { side_button : bDel })
|
||||
.setAnimable(false);
|
||||
bDel.setContext(list[| index + 0]);
|
||||
|
||||
list[| index + 1] = nodeValue("value", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, 0 )
|
||||
.setVisible(false, false);
|
||||
|
||||
return list[| index + 0];
|
||||
}
|
||||
|
||||
setDynamicInput(2, false);
|
||||
|
||||
static addInput = function() {
|
||||
var index = ds_list_size(inputs);
|
||||
|
||||
attributes.size++;
|
||||
createNewInput();
|
||||
|
||||
if(!UNDO_HOLDING) {
|
||||
var _inputs = array_create(data_length);
|
||||
for(var i = 0; i < data_length; i++)
|
||||
_inputs[i] = inputs[| index + i];
|
||||
|
||||
recordAction(ACTION_TYPE.custom, function(data, undo) {
|
||||
if(undo) deleteInput(data.index);
|
||||
else insertInput(data.index, data.inputs);
|
||||
}, { index, inputs : _inputs });
|
||||
}
|
||||
|
||||
onInputResize();
|
||||
}
|
||||
|
||||
for( var i = 0; i < ds_list_size(_in); i++ )
|
||||
_in[| i].index = i;
|
||||
static deleteInput = function(index) {
|
||||
if(!UNDO_HOLDING) {
|
||||
var _inputs = array_create(data_length);
|
||||
for(var i = 0; i < data_length; i++)
|
||||
_inputs[i] = inputs[| index + i];
|
||||
|
||||
recordAction(ACTION_TYPE.custom, function(data, undo) {
|
||||
if(undo) insertInput(data.index, data.inputs);
|
||||
else deleteInput(data.index);
|
||||
}, { index, inputs : _inputs });
|
||||
}
|
||||
|
||||
attributes.size--;
|
||||
for(var i = data_length - 1; i >= 0; i--)
|
||||
ds_list_delete(inputs, index + i);
|
||||
|
||||
onInputResize();
|
||||
}
|
||||
|
||||
ds_list_destroy(inputs);
|
||||
inputs = _in;
|
||||
static insertInput = function(index, _inputs) {
|
||||
attributes.size++;
|
||||
|
||||
for(var i = 0; i < data_length; i++)
|
||||
ds_list_insert(inputs, index + i, _inputs[i]);
|
||||
|
||||
onInputResize();
|
||||
}
|
||||
|
||||
createNewInput();
|
||||
}
|
||||
static refreshDynamicInput = function() {
|
||||
input_display_list = array_clone(input_display_list_raw);
|
||||
|
||||
for( var i = 0; i < ds_list_size(inputs); i++ ) {
|
||||
inputs[| i].index = i;
|
||||
array_push(input_display_list, i);
|
||||
}
|
||||
|
||||
getJunctionList();
|
||||
}
|
||||
|
||||
#endregion //////////////////////////////// Dynamic IO ////////////////////////////////
|
||||
|
||||
static onValueUpdate = function(index = 0) {
|
||||
if(LOADING || APPENDING) return;
|
||||
if(index < 0) return;
|
||||
|
||||
if(safe_mod(index - input_fix_len, data_length) == 0)
|
||||
if(safe_mod(index - input_fix_len, data_length) == 0) {
|
||||
inputs[| index + 1].setVisible(false, true);
|
||||
inputs[| index + 1].name = $"{getInputData(index)} value";
|
||||
|
||||
refreshDynamicInput();
|
||||
}
|
||||
}
|
||||
|
||||
static step = function() {
|
||||
for(var i = input_fix_len; i < ds_list_size(inputs) - data_length; i += data_length) {
|
||||
for(var i = input_fix_len; i < ds_list_size(inputs); i += data_length) {
|
||||
var inp = inputs[| i + 1];
|
||||
var typ = inp.value_from == noone? VALUE_TYPE.any : inp.value_from.type;
|
||||
inp.setType(typ);
|
||||
|
@ -62,7 +125,7 @@ function Node_Struct(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
|
|||
static update = function() {
|
||||
var str = {};
|
||||
|
||||
for(var i = input_fix_len; i < ds_list_size(inputs) - data_length; i += data_length) {
|
||||
for(var i = input_fix_len; i < ds_list_size(inputs); i += data_length) {
|
||||
var key = getInputData(i + 0);
|
||||
var val = getInputData(i + 1);
|
||||
var frm = inputs[| i + 1].value_from;
|
||||
|
@ -85,9 +148,11 @@ function Node_Struct(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
|
|||
|
||||
draw_set_text(f_sdf, fa_left, fa_center, COLORS._main_text);
|
||||
|
||||
for(var i = input_fix_len; i < ds_list_size(inputs) - data_length; i += data_length) {
|
||||
var key = getInputData(i + 0);
|
||||
for(var i = input_fix_len; i < ds_list_size(inputs); i += data_length) {
|
||||
var key = getInputData(i + 0, "");
|
||||
var val = inputs[| i + 1];
|
||||
if(!val.visible) continue;
|
||||
|
||||
var _ss = min(_s * .4, string_scale(key, bbox.w - 12 * _s, 9999));
|
||||
|
||||
draw_set_color(value_color(val.type));
|
||||
|
|
|
@ -10,55 +10,108 @@ function Node_Switch(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
|
|||
inputs[| 1] = nodeValue("Default value", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, 0 )
|
||||
.setVisible(false, true);
|
||||
|
||||
size_adjust_tool = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus) { #region
|
||||
var _h = ui(48);
|
||||
|
||||
var bw = _w / 2 - ui(4);
|
||||
var bh = ui(36);
|
||||
if(buttonTextIconInstant(true, THEME.button_hide, _x, _y + ui(8), bw, bh, _m, _focus, _hover, "", THEME.add, __txt("Add"), COLORS._main_value_positive) == 2)
|
||||
addInput();
|
||||
|
||||
var amo = attributes.size;
|
||||
if(buttonTextIconInstant(attributes.size > 0, THEME.button_hide, _x + _w - bw, _y + ui(8), bw, bh, _m, _focus, _hover, "", THEME.minus, __txt("Remove"), COLORS._main_value_negative) == 2)
|
||||
deleteInput(ds_list_size(inputs) - data_length);
|
||||
|
||||
return _h;
|
||||
}); #endregion
|
||||
|
||||
outputs[| 0] = nodeValue("Result", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, 0);
|
||||
|
||||
input_display_list = [ 0,
|
||||
["Inputs", false], 1
|
||||
input_display_list = [ 0, 1,
|
||||
["Cases", false], size_adjust_tool
|
||||
]
|
||||
|
||||
static createNewInput = function() {
|
||||
var index = ds_list_size(inputs);
|
||||
inputs[| index + 0] = nodeValue("Case", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "" );
|
||||
#region //////////////////////////////// Dynamic IO ////////////////////////////////
|
||||
|
||||
inputs[| index + 1] = nodeValue("value", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, 0 )
|
||||
.setVisible(false, false);
|
||||
static createNewInput = function(list = inputs) {
|
||||
var index = ds_list_size(list);
|
||||
var bDel = button(function() { node.deleteInput(index); })
|
||||
.setIcon(THEME.minus_16, 0, COLORS._main_icon);
|
||||
|
||||
list[| index + 0] = nodeValue("Case", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "" )
|
||||
.setDisplay(VALUE_DISPLAY.text_box, { side_button : bDel })
|
||||
.setAnimable(false);
|
||||
bDel.setContext(list[| index + 0]);
|
||||
|
||||
list[| index + 1] = nodeValue("value", self, JUNCTION_CONNECT.input, VALUE_TYPE.any, 0 )
|
||||
.setVisible(false, false);
|
||||
|
||||
return list[| index + 0];
|
||||
}
|
||||
|
||||
array_push(input_display_list, index + 0);
|
||||
array_push(input_display_list, index + 1);
|
||||
setDynamicInput(2, false);
|
||||
|
||||
return inputs[| index + 0];
|
||||
} setDynamicInput(2, false);
|
||||
|
||||
if(!LOADING && !APPENDING) createNewInput();
|
||||
|
||||
static refreshDynamicInput = function() { #region
|
||||
var _in = ds_list_create();
|
||||
|
||||
for( var i = 0; i < input_fix_len; i++ )
|
||||
ds_list_add(_in, inputs[| i]);
|
||||
|
||||
array_resize(input_display_list, input_display_len);
|
||||
|
||||
for( var i = input_fix_len; i < ds_list_size(inputs); i += data_length ) {
|
||||
if(inputs[| i].getValue() != "") {
|
||||
ds_list_add(_in, inputs[| i + 0]);
|
||||
ds_list_add(_in, inputs[| i + 1]);
|
||||
inputs[| i + 1].setVisible(false, true);
|
||||
static addInput = function() {
|
||||
var index = ds_list_size(inputs);
|
||||
|
||||
attributes.size++;
|
||||
createNewInput();
|
||||
|
||||
if(!UNDO_HOLDING) {
|
||||
var _inputs = array_create(data_length);
|
||||
for(var i = 0; i < data_length; i++)
|
||||
_inputs[i] = inputs[| index + i];
|
||||
|
||||
array_push(input_display_list, i + 0);
|
||||
array_push(input_display_list, i + 1);
|
||||
recordAction(ACTION_TYPE.custom, function(data, undo) {
|
||||
if(undo) deleteInput(data.index);
|
||||
else insertInput(data.index, data.inputs);
|
||||
}, { index, inputs : _inputs });
|
||||
}
|
||||
|
||||
onInputResize();
|
||||
}
|
||||
|
||||
for( var i = 0; i < ds_list_size(_in); i++ )
|
||||
_in[| i].index = i;
|
||||
static deleteInput = function(index) {
|
||||
if(!UNDO_HOLDING) {
|
||||
var _inputs = array_create(data_length);
|
||||
for(var i = 0; i < data_length; i++)
|
||||
_inputs[i] = inputs[| index + i];
|
||||
|
||||
recordAction(ACTION_TYPE.custom, function(data, undo) {
|
||||
if(undo) insertInput(data.index, data.inputs);
|
||||
else deleteInput(data.index);
|
||||
}, { index, inputs : _inputs });
|
||||
}
|
||||
|
||||
attributes.size--;
|
||||
for(var i = data_length - 1; i >= 0; i--)
|
||||
ds_list_delete(inputs, index + i);
|
||||
|
||||
onInputResize();
|
||||
}
|
||||
|
||||
ds_list_destroy(inputs);
|
||||
inputs = _in;
|
||||
static insertInput = function(index, _inputs) {
|
||||
attributes.size++;
|
||||
|
||||
for(var i = 0; i < data_length; i++)
|
||||
ds_list_insert(inputs, index + i, _inputs[i]);
|
||||
|
||||
onInputResize();
|
||||
}
|
||||
|
||||
createNewInput();
|
||||
} #endregion
|
||||
static refreshDynamicInput = function() {
|
||||
input_display_list = array_clone(input_display_list_raw);
|
||||
|
||||
for( var i = input_fix_len; i < ds_list_size(inputs); i++ ) {
|
||||
inputs[| i].index = i;
|
||||
array_push(input_display_list, i);
|
||||
}
|
||||
|
||||
getJunctionList();
|
||||
}
|
||||
|
||||
#endregion //////////////////////////////// Dynamic IO ////////////////////////////////
|
||||
|
||||
static onValueFromUpdate = function(index) { #region
|
||||
if(LOADING || APPENDING) return;
|
||||
if(index < 0) return;
|
||||
|
@ -76,8 +129,10 @@ function Node_Switch(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
|
|||
if(index < input_fix_len) return;
|
||||
if(LOADING || APPENDING) return;
|
||||
|
||||
if(safe_mod(index - input_fix_len, data_length) == 0) //Variable name
|
||||
if(safe_mod(index - input_fix_len, data_length) == 0) {
|
||||
inputs[| index + 1].setVisible(false, true);
|
||||
inputs[| index + 1].name = $"{getInputData(index)} value";
|
||||
}
|
||||
|
||||
refreshDynamicInput();
|
||||
} #endregion
|
||||
|
@ -97,7 +152,7 @@ function Node_Switch(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
|
|||
|
||||
outputs[| 0].setType(inputs[| 1].value_from? inputs[| 1].value_from.type : VALUE_TYPE.any);
|
||||
|
||||
for( var i = input_fix_len; i < ds_list_size(inputs) - data_length; i += data_length ) {
|
||||
for( var i = input_fix_len; i < ds_list_size(inputs); i += data_length ) {
|
||||
var _cas = getInputData(i + 0);
|
||||
var _val = getInputData(i + 1);
|
||||
|
||||
|
@ -116,7 +171,7 @@ function Node_Switch(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
|
|||
var sele = getInputData(0);
|
||||
var _res = getInputData(1);
|
||||
|
||||
for( var i = input_fix_len; i < ds_list_size(inputs) - data_length; i += data_length ) {
|
||||
for( var i = input_fix_len; i < ds_list_size(inputs); i += data_length ) {
|
||||
var _cas = getInputData(i + 0);
|
||||
if(sele == _cas) frm = inputs[| i + 1];
|
||||
}
|
||||
|
@ -139,10 +194,12 @@ function Node_Switch(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
|
|||
draw_text_transformed(bbox.x0 + 8 * _s, inputs[| 1].y, str, ss, ss, 0);
|
||||
}
|
||||
|
||||
for( var i = input_fix_len; i < ds_list_size(inputs) - data_length; i += data_length ) {
|
||||
for( var i = input_fix_len; i < ds_list_size(inputs); i += data_length ) {
|
||||
if(!inputs[| i + 1].visible) continue;
|
||||
|
||||
var str = string(getInputData(i));
|
||||
var str = string(getInputData(i, ""));
|
||||
if(str == "") continue;
|
||||
|
||||
var ss = min(_s * 0.4, string_scale(str, bbox.w - 16 * _s, 999));
|
||||
draw_set_color(value_color(inputs[| i + 1].type));
|
||||
draw_text_transformed(bbox.x0 + 8 * _s, inputs[| i + 1].y, str, ss, ss, 0);
|
||||
|
|
|
@ -1,438 +1,3 @@
|
|||
#region ---- global names ----
|
||||
global.junctionEndName = [ "Hold", "Loop", "Ping pong", "Wrap" ];
|
||||
|
||||
global.displaySuffix_Range = [ "min", "max" ];
|
||||
global.displaySuffix_Area = [ "x", "y", "w", "h", "shape" ];
|
||||
global.displaySuffix_Padding = [ "right", "top", "left", "bottom" ];
|
||||
global.displaySuffix_VecRange = [ "x min", "x max", "y min", "y max" ];
|
||||
global.displaySuffix_Axis = [ "x", "y", "z", "w" ];
|
||||
#endregion
|
||||
|
||||
enum JUNCTION_CONNECT {
|
||||
input,
|
||||
output
|
||||
}
|
||||
|
||||
enum VALUE_TYPE {
|
||||
integer = 0,
|
||||
float = 1,
|
||||
boolean = 2,
|
||||
color = 3,
|
||||
surface = 4,
|
||||
|
||||
path = 5,
|
||||
curve = 6,
|
||||
text = 7,
|
||||
object = 8,
|
||||
node = 9,
|
||||
d3object = 10,
|
||||
|
||||
any = 11,
|
||||
|
||||
pathnode = 12,
|
||||
particle = 13,
|
||||
rigid = 14,
|
||||
sdomain = 15,
|
||||
struct = 16,
|
||||
strands = 17,
|
||||
mesh = 18,
|
||||
trigger = 19,
|
||||
atlas = 20,
|
||||
|
||||
d3vertex = 21,
|
||||
gradient = 22,
|
||||
armature = 23,
|
||||
buffer = 24,
|
||||
|
||||
pbBox = 25,
|
||||
|
||||
d3Mesh = 26,
|
||||
d3Light = 27,
|
||||
d3Camera = 28,
|
||||
d3Scene = 29,
|
||||
d3Material = 30,
|
||||
|
||||
dynaSurface = 31,
|
||||
PCXnode = 32,
|
||||
|
||||
audioBit = 33,
|
||||
|
||||
fdomain = 34,
|
||||
|
||||
action = 99,
|
||||
}
|
||||
|
||||
enum VALUE_DISPLAY {
|
||||
_default,
|
||||
none,
|
||||
range,
|
||||
|
||||
//Int
|
||||
enum_scroll,
|
||||
enum_button,
|
||||
rotation,
|
||||
rotation_range,
|
||||
rotation_random,
|
||||
slider,
|
||||
slider_range,
|
||||
|
||||
//Color
|
||||
palette,
|
||||
|
||||
//Int array
|
||||
padding,
|
||||
vector,
|
||||
vector_range,
|
||||
area,
|
||||
transform,
|
||||
corner,
|
||||
toggle,
|
||||
matrix,
|
||||
path_anchor,
|
||||
gradient_range,
|
||||
boolean_grid,
|
||||
|
||||
//Curve
|
||||
curve,
|
||||
|
||||
//Misc
|
||||
puppet_control,
|
||||
button,
|
||||
label,
|
||||
|
||||
//Array
|
||||
path_array,
|
||||
|
||||
//Text
|
||||
codeLUA,
|
||||
codeHLSL,
|
||||
text_array,
|
||||
text_box,
|
||||
text_tunnel,
|
||||
|
||||
//path
|
||||
path_save,
|
||||
path_load,
|
||||
path_font,
|
||||
|
||||
//d3d
|
||||
d3vertex,
|
||||
d3quarternion,
|
||||
}
|
||||
|
||||
enum KEYFRAME_END {
|
||||
hold,
|
||||
loop,
|
||||
ping,
|
||||
wrap,
|
||||
}
|
||||
|
||||
enum VALIDATION {
|
||||
pass,
|
||||
warning,
|
||||
error
|
||||
}
|
||||
|
||||
enum VALUE_UNIT {
|
||||
constant,
|
||||
reference
|
||||
}
|
||||
|
||||
enum VALUE_TAG {
|
||||
updateInTrigger = -2,
|
||||
updateOutTrigger = -3,
|
||||
none = 0
|
||||
}
|
||||
|
||||
enum LINE_STYLE {
|
||||
solid,
|
||||
dashed
|
||||
}
|
||||
|
||||
function value_color(i) { #region
|
||||
static JUNCTION_COLORS = [
|
||||
#ff9166, //int
|
||||
#ffe478, //float
|
||||
#8c3f5d, //bool
|
||||
#8fde5d, //color
|
||||
#ff6b97, //surface
|
||||
#eb004b, //path
|
||||
#c2c2d1, //curve
|
||||
#66ffe3, //text
|
||||
#ffb5b5, //object
|
||||
#4da6ff, //node
|
||||
#c1007c, //3D
|
||||
#808080, //any
|
||||
#ffb5b5, //path
|
||||
#8fde5d, //particle
|
||||
#88ffe9, //rigid
|
||||
#6d6e71, //sdomain
|
||||
#8c3f5d, //struct
|
||||
#ff9166, //strand
|
||||
#c2c2d1, //mesh
|
||||
#8fde5d, //trigger
|
||||
#ff6b97, //atlas
|
||||
#c1007c, //d3vertex
|
||||
#8fde5d, //gradient
|
||||
#ff9166, //armature
|
||||
#808080, //buffer
|
||||
#ff6b97, //pbBox
|
||||
#4da6ff, //d3Mesh
|
||||
#4da6ff, //d3Light
|
||||
#4da6ff, //d3Camera
|
||||
#4da6ff, //d3Scene
|
||||
#ff6b97, //d3Material
|
||||
#ff6b97, //dynaSurf
|
||||
#c2c2d1, //PCX
|
||||
#8fde5d, //audiobit
|
||||
#4da6ff, //flipfluid
|
||||
];
|
||||
static JUNCTION_COLORS_LENGTH = array_length(JUNCTION_COLORS);
|
||||
|
||||
if(i == 99) return #8fde5d;
|
||||
|
||||
return JUNCTION_COLORS[i];
|
||||
} #endregion
|
||||
|
||||
function value_color_bg(i) { #region
|
||||
return #3b3b4e;
|
||||
} #endregion
|
||||
|
||||
function value_color_bg_array(i) { #region
|
||||
static JUNCTION_COLORS = [
|
||||
#e36956, //int
|
||||
#ff9166, //float
|
||||
#5e315b, //bool
|
||||
#3ca370, //color
|
||||
#bd4882, //surface
|
||||
#bb003c, //path
|
||||
#83839b, //curve
|
||||
#4da6ff, //text
|
||||
#e28989, //object
|
||||
#4b5bab, //node
|
||||
#64003f, //3D
|
||||
#4d4d4d, //any
|
||||
#e28989, //path
|
||||
#3ca370, //particle
|
||||
#4da6ff, //rigid
|
||||
#4b5bab, //sdomain
|
||||
#5e315b, //struct
|
||||
#e36956, //strand
|
||||
#83839b, //mesh
|
||||
#3ca370, //trigger
|
||||
#9e2a69, //atlas
|
||||
#64003f, //d3vertex
|
||||
#3ca370, //gradient
|
||||
#e36956, //armature
|
||||
#4d4d4d, //buffer
|
||||
#bd4882, //pbBox
|
||||
#4b5bab, //d3Mesh
|
||||
#4b5bab, //d3Light
|
||||
#4b5bab, //d3Camera
|
||||
#4b5bab, //d3Scene
|
||||
#bd4882, //d3Material
|
||||
#bd4882, //dynaSurf
|
||||
#83839b, //PCX
|
||||
#3ca370, //audiobit
|
||||
];
|
||||
|
||||
if(i == 99) return $5dde8f;
|
||||
return JUNCTION_COLORS[safe_mod(max(0, i), array_length(JUNCTION_COLORS))];
|
||||
} #endregion
|
||||
|
||||
function value_bit(i) { #region
|
||||
switch(i) {
|
||||
case VALUE_TYPE.integer : return 1 << 0 | 1 << 1;
|
||||
case VALUE_TYPE.float : return 1 << 2 | 1 << 1;
|
||||
case VALUE_TYPE.boolean : return 1 << 3 | 1 << 1;
|
||||
case VALUE_TYPE.color : return 1 << 4;
|
||||
case VALUE_TYPE.gradient : return 1 << 25;
|
||||
case VALUE_TYPE.dynaSurface :
|
||||
case VALUE_TYPE.surface : return 1 << 5 | 1 << 23;
|
||||
case VALUE_TYPE.path : return 1 << 10;
|
||||
case VALUE_TYPE.text : return 1 << 10;
|
||||
case VALUE_TYPE.object : return 1 << 13;
|
||||
case VALUE_TYPE.d3object : return 1 << 14;
|
||||
case VALUE_TYPE.d3vertex : return 1 << 24;
|
||||
|
||||
case VALUE_TYPE.pathnode : return 1 << 15;
|
||||
case VALUE_TYPE.particle : return 1 << 16;
|
||||
case VALUE_TYPE.rigid : return 1 << 17;
|
||||
case VALUE_TYPE.sdomain : return 1 << 18;
|
||||
case VALUE_TYPE.struct : return 1 << 19;
|
||||
case VALUE_TYPE.strands : return 1 << 20;
|
||||
case VALUE_TYPE.mesh : return 1 << 21;
|
||||
case VALUE_TYPE.armature : return 1 << 26 | 1 << 19;
|
||||
|
||||
case VALUE_TYPE.node : return 1 << 32;
|
||||
|
||||
case VALUE_TYPE.buffer : return 1 << 27;
|
||||
|
||||
case VALUE_TYPE.pbBox : return 1 << 28;
|
||||
|
||||
case VALUE_TYPE.trigger : return 1 << 22;
|
||||
case VALUE_TYPE.action : return 1 << 22 | 1 << 3;
|
||||
|
||||
case VALUE_TYPE.d3Mesh : return 1 << 29;
|
||||
case VALUE_TYPE.d3Light : return 1 << 29;
|
||||
case VALUE_TYPE.d3Camera : return 1 << 29;
|
||||
case VALUE_TYPE.d3Scene : return 1 << 29 | 1 << 30;
|
||||
case VALUE_TYPE.d3Material : return 1 << 33;
|
||||
|
||||
case VALUE_TYPE.PCXnode : return 1 << 34;
|
||||
case VALUE_TYPE.audioBit : return 1 << 35;
|
||||
case VALUE_TYPE.fdomain : return 1 << 36;
|
||||
|
||||
case VALUE_TYPE.any : return ~0 & ~(1 << 32);
|
||||
}
|
||||
return 0;
|
||||
} #endregion
|
||||
|
||||
function value_type_directional(f, t) { #region
|
||||
if(f == VALUE_TYPE.surface && t == VALUE_TYPE.integer) return true;
|
||||
if(f == VALUE_TYPE.surface && t == VALUE_TYPE.float) return true;
|
||||
|
||||
if(f == VALUE_TYPE.integer && t == VALUE_TYPE.text) return true;
|
||||
if(f == VALUE_TYPE.float && t == VALUE_TYPE.text) return true;
|
||||
if(f == VALUE_TYPE.boolean && t == VALUE_TYPE.text) return true;
|
||||
|
||||
if(f == VALUE_TYPE.integer && t == VALUE_TYPE.color) return true;
|
||||
if(f == VALUE_TYPE.float && t == VALUE_TYPE.color) return true;
|
||||
if(f == VALUE_TYPE.color && t == VALUE_TYPE.integer) return true;
|
||||
if(f == VALUE_TYPE.color && t == VALUE_TYPE.float ) return true;
|
||||
if(f == VALUE_TYPE.color && t == VALUE_TYPE.gradient) return true;
|
||||
|
||||
if(f == VALUE_TYPE.strands && t == VALUE_TYPE.pathnode ) return true;
|
||||
|
||||
if(f == VALUE_TYPE.color && t == VALUE_TYPE.struct ) return true;
|
||||
if(f == VALUE_TYPE.mesh && t == VALUE_TYPE.struct ) return true;
|
||||
if(f == VALUE_TYPE.particle && t == VALUE_TYPE.struct ) return true;
|
||||
|
||||
if(f == VALUE_TYPE.surface && t == VALUE_TYPE.d3Material ) return true;
|
||||
|
||||
return false;
|
||||
} #endregion
|
||||
|
||||
function value_type_from_string(str) { #region
|
||||
switch(str) {
|
||||
case "integer" : return VALUE_TYPE.integer;
|
||||
case "float" : return VALUE_TYPE.float;
|
||||
case "boolean" : return VALUE_TYPE.boolean;
|
||||
case "color" : return VALUE_TYPE.color;
|
||||
case "surface" : return VALUE_TYPE.surface;
|
||||
|
||||
case "path" : return VALUE_TYPE.path;
|
||||
case "curve" : return VALUE_TYPE.curve;
|
||||
case "text" : return VALUE_TYPE.text;
|
||||
case "object" : return VALUE_TYPE.object;
|
||||
case "node" : return VALUE_TYPE.node;
|
||||
case "d3object" : return VALUE_TYPE.d3object;
|
||||
|
||||
case "any" : return VALUE_TYPE.any;
|
||||
|
||||
case "pathnode" : return VALUE_TYPE.pathnode;
|
||||
case "particle" : return VALUE_TYPE.particle;
|
||||
case "rigid" : return VALUE_TYPE.rigid;
|
||||
case "sdomain" : return VALUE_TYPE.sdomain;
|
||||
case "struct" : return VALUE_TYPE.struct;
|
||||
case "strands" : return VALUE_TYPE.strands;
|
||||
case "mesh" : return VALUE_TYPE.mesh;
|
||||
case "trigger" : return VALUE_TYPE.trigger;
|
||||
case "atlas" : return VALUE_TYPE.atlas;
|
||||
|
||||
case "d3vertex" : return VALUE_TYPE.d3vertex;
|
||||
case "gradient" : return VALUE_TYPE.gradient;
|
||||
case "armature" : return VALUE_TYPE.armature;
|
||||
case "buffer" : return VALUE_TYPE.buffer;
|
||||
|
||||
case "pbBox" : return VALUE_TYPE.pbBox;
|
||||
|
||||
case "d3Mesh" : return VALUE_TYPE.d3Mesh;
|
||||
case "d3Light" : return VALUE_TYPE.d3Light;
|
||||
case "d3Camera" : return VALUE_TYPE.d3Camera;
|
||||
case "d3Scene" : return VALUE_TYPE.d3Scene;
|
||||
case "d3Material" : return VALUE_TYPE.d3Material;
|
||||
|
||||
case "dynaSurface" : return VALUE_TYPE.dynaSurface;
|
||||
case "PCXnode" : return VALUE_TYPE.PCXnode;
|
||||
|
||||
case "audioBit" : return VALUE_TYPE.audioBit;
|
||||
|
||||
case "fDomain" : return VALUE_TYPE.fdomain;
|
||||
|
||||
case "action" : return VALUE_TYPE.action;
|
||||
}
|
||||
|
||||
return VALUE_TYPE.any;
|
||||
} #endregion
|
||||
|
||||
function typeArray(_type) { #region
|
||||
switch(_type) {
|
||||
case VALUE_DISPLAY.range :
|
||||
case VALUE_DISPLAY.vector_range :
|
||||
case VALUE_DISPLAY.rotation_range :
|
||||
case VALUE_DISPLAY.rotation_random :
|
||||
case VALUE_DISPLAY.slider_range :
|
||||
case VALUE_DISPLAY.path_anchor :
|
||||
case VALUE_DISPLAY.gradient_range :
|
||||
|
||||
case VALUE_DISPLAY.vector :
|
||||
case VALUE_DISPLAY.padding :
|
||||
case VALUE_DISPLAY.area :
|
||||
case VALUE_DISPLAY.puppet_control :
|
||||
case VALUE_DISPLAY.matrix :
|
||||
case VALUE_DISPLAY.transform :
|
||||
case VALUE_DISPLAY.boolean_grid :
|
||||
|
||||
case VALUE_DISPLAY.curve :
|
||||
|
||||
case VALUE_DISPLAY.path_array :
|
||||
case VALUE_DISPLAY.palette :
|
||||
case VALUE_DISPLAY.text_array :
|
||||
|
||||
case VALUE_DISPLAY.d3vertex :
|
||||
case VALUE_DISPLAY.d3quarternion :
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
} #endregion
|
||||
|
||||
function typeCompatible(fromType, toType, directional_cast = true) { #region
|
||||
if(value_bit(fromType) & value_bit(toType) != 0)
|
||||
return true;
|
||||
if(!directional_cast)
|
||||
return false;
|
||||
return value_type_directional(fromType, toType);
|
||||
} #endregion
|
||||
|
||||
function typeIncompatible(from, to) { #region
|
||||
if(from.type == VALUE_TYPE.surface && (to.type == VALUE_TYPE.integer || to.type == VALUE_TYPE.float)) {
|
||||
switch(to.display_type) {
|
||||
case VALUE_DISPLAY.area :
|
||||
case VALUE_DISPLAY.matrix :
|
||||
case VALUE_DISPLAY.vector_range :
|
||||
case VALUE_DISPLAY.puppet_control :
|
||||
case VALUE_DISPLAY.padding :
|
||||
case VALUE_DISPLAY.curve :
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
} #endregion
|
||||
|
||||
function isGraphable(prop) { #region
|
||||
if(prop.type == VALUE_TYPE.integer || prop.type == VALUE_TYPE.float) {
|
||||
if(prop.display_type == VALUE_DISPLAY.puppet_control)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
if(prop.type == VALUE_TYPE.color && prop.display_type == VALUE_DISPLAY._default)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
} #endregion
|
||||
|
||||
function nodeValueUnit(_nodeValue) constructor { #region
|
||||
self._nodeValue = _nodeValue;
|
||||
|
||||
|
@ -630,6 +195,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
cache_value = [ false, false, undefined, undefined ];
|
||||
cache_array = [ false, false ];
|
||||
use_cache = true;
|
||||
record_value = true;
|
||||
|
||||
process_array = true;
|
||||
dynamic_array = false;
|
||||
|
@ -919,7 +485,6 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
|
||||
if(struct_has(display_data, "slide_speed")) editWidget.setSlidable(display_data.slide_speed);
|
||||
if(struct_has(display_data, "unit")) editWidget.unit = display_data.unit;
|
||||
if(struct_has(display_data, "side_button")) editWidget.side_button = display_data.side_button;
|
||||
if(struct_has(display_data, "front_button")) editWidget.front_button = display_data.front_button;
|
||||
|
||||
extract_node = "Node_Number";
|
||||
|
@ -949,7 +514,6 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
if(struct_has(display_data, "linkable")) editWidget.linkable = display_data.linkable;
|
||||
if(struct_has(display_data, "per_line")) editWidget.per_line = display_data.per_line;
|
||||
if(struct_has(display_data, "linked")) editWidget.linked = display_data.linked;
|
||||
if(struct_has(display_data, "side_button")) editWidget.side_button = display_data.side_button;
|
||||
|
||||
if(type == VALUE_TYPE.integer) editWidget.setSlideSpeed(1 / 10);
|
||||
|
||||
|
@ -1338,6 +902,9 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
break; #endregion
|
||||
}
|
||||
|
||||
if(struct_has(display_data, "side_button") && editWidget.side_button == noone)
|
||||
editWidget.side_button = display_data.side_button;
|
||||
|
||||
editWidgetRaw = editWidget;
|
||||
if(editWidget) graphWidget = editWidget.clone();
|
||||
|
||||
|
@ -1636,7 +1203,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) { #region ////Get value
|
||||
if(type == VALUE_TYPE.trigger)
|
||||
return _getValue(_time, false, 0, false);
|
||||
|
||||
|
@ -1991,7 +1558,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
return array_length(ar);
|
||||
} #endregion
|
||||
|
||||
static setValue = function(val = 0, record = true, time = CURRENT_FRAME, _update = true) { #region //Set value
|
||||
static setValue = function(val = 0, record = true, time = CURRENT_FRAME, _update = true) { #region ////Set value
|
||||
val = unit.invApply(val);
|
||||
return setValueDirect(val, noone, record, time, _update);
|
||||
} #endregion
|
||||
|
@ -2035,6 +1602,8 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
var _val = val;
|
||||
var _inp = connect_type == JUNCTION_CONNECT.input;
|
||||
|
||||
record &= record_value;
|
||||
|
||||
if(sep_axis) {
|
||||
if(index == noone) {
|
||||
for( var i = 0, n = array_length(animators); i < n; i++ )
|
||||
|
|
3
scripts/node_value_base/node_value_base.gml
Normal file
3
scripts/node_value_base/node_value_base.gml
Normal file
|
@ -0,0 +1,3 @@
|
|||
function NodeValueBase(_name, _node, _connect, _type, _value, _tooltip = "") constructor {
|
||||
|
||||
}
|
13
scripts/node_value_base/node_value_base.yy
Normal file
13
scripts/node_value_base/node_value_base.yy
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"$GMScript":"",
|
||||
"%Name":"node_value_base",
|
||||
"isCompatibility":false,
|
||||
"isDnD":false,
|
||||
"name":"node_value_base",
|
||||
"parent":{
|
||||
"name":"__base__",
|
||||
"path":"folders/nodes/data/__base__.yy",
|
||||
},
|
||||
"resourceType":"GMScript",
|
||||
"resourceVersion":"2.0",
|
||||
}
|
434
scripts/node_value_types/node_value_types.gml
Normal file
434
scripts/node_value_types/node_value_types.gml
Normal file
|
@ -0,0 +1,434 @@
|
|||
#region ---- global names ----
|
||||
global.junctionEndName = [ "Hold", "Loop", "Ping pong", "Wrap" ];
|
||||
|
||||
global.displaySuffix_Range = [ "min", "max" ];
|
||||
global.displaySuffix_Area = [ "x", "y", "w", "h", "shape" ];
|
||||
global.displaySuffix_Padding = [ "right", "top", "left", "bottom" ];
|
||||
global.displaySuffix_VecRange = [ "x min", "x max", "y min", "y max" ];
|
||||
global.displaySuffix_Axis = [ "x", "y", "z", "w" ];
|
||||
#endregion
|
||||
|
||||
enum JUNCTION_CONNECT {
|
||||
input,
|
||||
output
|
||||
}
|
||||
|
||||
enum VALUE_TYPE {
|
||||
integer = 0,
|
||||
float = 1,
|
||||
boolean = 2,
|
||||
color = 3,
|
||||
surface = 4,
|
||||
|
||||
path = 5,
|
||||
curve = 6,
|
||||
text = 7,
|
||||
object = 8,
|
||||
node = 9,
|
||||
d3object = 10,
|
||||
|
||||
any = 11,
|
||||
|
||||
pathnode = 12,
|
||||
particle = 13,
|
||||
rigid = 14,
|
||||
sdomain = 15,
|
||||
struct = 16,
|
||||
strands = 17,
|
||||
mesh = 18,
|
||||
trigger = 19,
|
||||
atlas = 20,
|
||||
|
||||
d3vertex = 21,
|
||||
gradient = 22,
|
||||
armature = 23,
|
||||
buffer = 24,
|
||||
|
||||
pbBox = 25,
|
||||
|
||||
d3Mesh = 26,
|
||||
d3Light = 27,
|
||||
d3Camera = 28,
|
||||
d3Scene = 29,
|
||||
d3Material = 30,
|
||||
|
||||
dynaSurface = 31,
|
||||
PCXnode = 32,
|
||||
|
||||
audioBit = 33,
|
||||
|
||||
fdomain = 34,
|
||||
|
||||
action = 99,
|
||||
}
|
||||
|
||||
enum VALUE_DISPLAY {
|
||||
_default,
|
||||
none,
|
||||
range,
|
||||
|
||||
//Int
|
||||
enum_scroll,
|
||||
enum_button,
|
||||
rotation,
|
||||
rotation_range,
|
||||
rotation_random,
|
||||
slider,
|
||||
slider_range,
|
||||
|
||||
//Color
|
||||
palette,
|
||||
|
||||
//Int array
|
||||
padding,
|
||||
vector,
|
||||
vector_range,
|
||||
area,
|
||||
transform,
|
||||
corner,
|
||||
toggle,
|
||||
matrix,
|
||||
path_anchor,
|
||||
gradient_range,
|
||||
boolean_grid,
|
||||
|
||||
//Curve
|
||||
curve,
|
||||
|
||||
//Misc
|
||||
puppet_control,
|
||||
button,
|
||||
label,
|
||||
|
||||
//Array
|
||||
path_array,
|
||||
|
||||
//Text
|
||||
codeLUA,
|
||||
codeHLSL,
|
||||
text_array,
|
||||
text_box,
|
||||
text_tunnel,
|
||||
|
||||
//path
|
||||
path_save,
|
||||
path_load,
|
||||
path_font,
|
||||
|
||||
//d3d
|
||||
d3vertex,
|
||||
d3quarternion,
|
||||
}
|
||||
|
||||
enum KEYFRAME_END {
|
||||
hold,
|
||||
loop,
|
||||
ping,
|
||||
wrap,
|
||||
}
|
||||
|
||||
enum VALIDATION {
|
||||
pass,
|
||||
warning,
|
||||
error
|
||||
}
|
||||
|
||||
enum VALUE_UNIT {
|
||||
constant,
|
||||
reference
|
||||
}
|
||||
|
||||
enum VALUE_TAG {
|
||||
updateInTrigger = -2,
|
||||
updateOutTrigger = -3,
|
||||
none = 0
|
||||
}
|
||||
|
||||
enum LINE_STYLE {
|
||||
solid,
|
||||
dashed
|
||||
}
|
||||
|
||||
function value_color(i) { #region
|
||||
static JUNCTION_COLORS = [
|
||||
#ff9166, //int
|
||||
#ffe478, //float
|
||||
#8c3f5d, //bool
|
||||
#8fde5d, //color
|
||||
#ff6b97, //surface
|
||||
#eb004b, //path
|
||||
#c2c2d1, //curve
|
||||
#66ffe3, //text
|
||||
#ffb5b5, //object
|
||||
#4da6ff, //node
|
||||
#c1007c, //3D
|
||||
#808080, //any
|
||||
#ffb5b5, //path
|
||||
#8fde5d, //particle
|
||||
#88ffe9, //rigid
|
||||
#6d6e71, //sdomain
|
||||
#8c3f5d, //struct
|
||||
#ff9166, //strand
|
||||
#c2c2d1, //mesh
|
||||
#8fde5d, //trigger
|
||||
#ff6b97, //atlas
|
||||
#c1007c, //d3vertex
|
||||
#8fde5d, //gradient
|
||||
#ff9166, //armature
|
||||
#808080, //buffer
|
||||
#ff6b97, //pbBox
|
||||
#4da6ff, //d3Mesh
|
||||
#4da6ff, //d3Light
|
||||
#4da6ff, //d3Camera
|
||||
#4da6ff, //d3Scene
|
||||
#ff6b97, //d3Material
|
||||
#ff6b97, //dynaSurf
|
||||
#c2c2d1, //PCX
|
||||
#8fde5d, //audiobit
|
||||
#4da6ff, //flipfluid
|
||||
];
|
||||
static JUNCTION_COLORS_LENGTH = array_length(JUNCTION_COLORS);
|
||||
|
||||
if(i == 99) return #8fde5d;
|
||||
|
||||
return JUNCTION_COLORS[i];
|
||||
} #endregion
|
||||
|
||||
function value_color_bg(i) { #region
|
||||
return #3b3b4e;
|
||||
} #endregion
|
||||
|
||||
function value_color_bg_array(i) { #region
|
||||
static JUNCTION_COLORS = [
|
||||
#e36956, //int
|
||||
#ff9166, //float
|
||||
#5e315b, //bool
|
||||
#3ca370, //color
|
||||
#bd4882, //surface
|
||||
#bb003c, //path
|
||||
#83839b, //curve
|
||||
#4da6ff, //text
|
||||
#e28989, //object
|
||||
#4b5bab, //node
|
||||
#64003f, //3D
|
||||
#4d4d4d, //any
|
||||
#e28989, //path
|
||||
#3ca370, //particle
|
||||
#4da6ff, //rigid
|
||||
#4b5bab, //sdomain
|
||||
#5e315b, //struct
|
||||
#e36956, //strand
|
||||
#83839b, //mesh
|
||||
#3ca370, //trigger
|
||||
#9e2a69, //atlas
|
||||
#64003f, //d3vertex
|
||||
#3ca370, //gradient
|
||||
#e36956, //armature
|
||||
#4d4d4d, //buffer
|
||||
#bd4882, //pbBox
|
||||
#4b5bab, //d3Mesh
|
||||
#4b5bab, //d3Light
|
||||
#4b5bab, //d3Camera
|
||||
#4b5bab, //d3Scene
|
||||
#bd4882, //d3Material
|
||||
#bd4882, //dynaSurf
|
||||
#83839b, //PCX
|
||||
#3ca370, //audiobit
|
||||
];
|
||||
|
||||
if(i == 99) return $5dde8f;
|
||||
return JUNCTION_COLORS[safe_mod(max(0, i), array_length(JUNCTION_COLORS))];
|
||||
} #endregion
|
||||
|
||||
function value_bit(i) { #region
|
||||
switch(i) {
|
||||
case VALUE_TYPE.integer : return 1 << 0 | 1 << 1;
|
||||
case VALUE_TYPE.float : return 1 << 2 | 1 << 1;
|
||||
case VALUE_TYPE.boolean : return 1 << 3 | 1 << 1;
|
||||
case VALUE_TYPE.color : return 1 << 4;
|
||||
case VALUE_TYPE.gradient : return 1 << 25;
|
||||
case VALUE_TYPE.dynaSurface :
|
||||
case VALUE_TYPE.surface : return 1 << 5 | 1 << 23;
|
||||
case VALUE_TYPE.path : return 1 << 10;
|
||||
case VALUE_TYPE.text : return 1 << 10;
|
||||
case VALUE_TYPE.object : return 1 << 13;
|
||||
case VALUE_TYPE.d3object : return 1 << 14;
|
||||
case VALUE_TYPE.d3vertex : return 1 << 24;
|
||||
|
||||
case VALUE_TYPE.pathnode : return 1 << 15;
|
||||
case VALUE_TYPE.particle : return 1 << 16;
|
||||
case VALUE_TYPE.rigid : return 1 << 17;
|
||||
case VALUE_TYPE.sdomain : return 1 << 18;
|
||||
case VALUE_TYPE.struct : return 1 << 19;
|
||||
case VALUE_TYPE.strands : return 1 << 20;
|
||||
case VALUE_TYPE.mesh : return 1 << 21;
|
||||
case VALUE_TYPE.armature : return 1 << 26 | 1 << 19;
|
||||
|
||||
case VALUE_TYPE.node : return 1 << 32;
|
||||
|
||||
case VALUE_TYPE.buffer : return 1 << 27;
|
||||
|
||||
case VALUE_TYPE.pbBox : return 1 << 28;
|
||||
|
||||
case VALUE_TYPE.trigger : return 1 << 22;
|
||||
case VALUE_TYPE.action : return 1 << 22 | 1 << 3;
|
||||
|
||||
case VALUE_TYPE.d3Mesh : return 1 << 29;
|
||||
case VALUE_TYPE.d3Light : return 1 << 29;
|
||||
case VALUE_TYPE.d3Camera : return 1 << 29;
|
||||
case VALUE_TYPE.d3Scene : return 1 << 29 | 1 << 30;
|
||||
case VALUE_TYPE.d3Material : return 1 << 33;
|
||||
|
||||
case VALUE_TYPE.PCXnode : return 1 << 34;
|
||||
case VALUE_TYPE.audioBit : return 1 << 35;
|
||||
case VALUE_TYPE.fdomain : return 1 << 36;
|
||||
|
||||
case VALUE_TYPE.any : return ~0 & ~(1 << 32);
|
||||
}
|
||||
return 0;
|
||||
} #endregion
|
||||
|
||||
function value_type_directional(f, t) { #region
|
||||
if(f == VALUE_TYPE.surface && t == VALUE_TYPE.integer) return true;
|
||||
if(f == VALUE_TYPE.surface && t == VALUE_TYPE.float) return true;
|
||||
|
||||
if(f == VALUE_TYPE.integer && t == VALUE_TYPE.text) return true;
|
||||
if(f == VALUE_TYPE.float && t == VALUE_TYPE.text) return true;
|
||||
if(f == VALUE_TYPE.boolean && t == VALUE_TYPE.text) return true;
|
||||
|
||||
if(f == VALUE_TYPE.integer && t == VALUE_TYPE.color) return true;
|
||||
if(f == VALUE_TYPE.float && t == VALUE_TYPE.color) return true;
|
||||
if(f == VALUE_TYPE.color && t == VALUE_TYPE.integer) return true;
|
||||
if(f == VALUE_TYPE.color && t == VALUE_TYPE.float ) return true;
|
||||
if(f == VALUE_TYPE.color && t == VALUE_TYPE.gradient) return true;
|
||||
|
||||
if(f == VALUE_TYPE.strands && t == VALUE_TYPE.pathnode ) return true;
|
||||
|
||||
if(f == VALUE_TYPE.color && t == VALUE_TYPE.struct ) return true;
|
||||
if(f == VALUE_TYPE.mesh && t == VALUE_TYPE.struct ) return true;
|
||||
if(f == VALUE_TYPE.particle && t == VALUE_TYPE.struct ) return true;
|
||||
|
||||
if(f == VALUE_TYPE.surface && t == VALUE_TYPE.d3Material ) return true;
|
||||
|
||||
return false;
|
||||
} #endregion
|
||||
|
||||
function value_type_from_string(str) { #region
|
||||
switch(str) {
|
||||
case "integer" : return VALUE_TYPE.integer;
|
||||
case "float" : return VALUE_TYPE.float;
|
||||
case "boolean" : return VALUE_TYPE.boolean;
|
||||
case "color" : return VALUE_TYPE.color;
|
||||
case "surface" : return VALUE_TYPE.surface;
|
||||
|
||||
case "path" : return VALUE_TYPE.path;
|
||||
case "curve" : return VALUE_TYPE.curve;
|
||||
case "text" : return VALUE_TYPE.text;
|
||||
case "object" : return VALUE_TYPE.object;
|
||||
case "node" : return VALUE_TYPE.node;
|
||||
case "d3object" : return VALUE_TYPE.d3object;
|
||||
|
||||
case "any" : return VALUE_TYPE.any;
|
||||
|
||||
case "pathnode" : return VALUE_TYPE.pathnode;
|
||||
case "particle" : return VALUE_TYPE.particle;
|
||||
case "rigid" : return VALUE_TYPE.rigid;
|
||||
case "sdomain" : return VALUE_TYPE.sdomain;
|
||||
case "struct" : return VALUE_TYPE.struct;
|
||||
case "strands" : return VALUE_TYPE.strands;
|
||||
case "mesh" : return VALUE_TYPE.mesh;
|
||||
case "trigger" : return VALUE_TYPE.trigger;
|
||||
case "atlas" : return VALUE_TYPE.atlas;
|
||||
|
||||
case "d3vertex" : return VALUE_TYPE.d3vertex;
|
||||
case "gradient" : return VALUE_TYPE.gradient;
|
||||
case "armature" : return VALUE_TYPE.armature;
|
||||
case "buffer" : return VALUE_TYPE.buffer;
|
||||
|
||||
case "pbBox" : return VALUE_TYPE.pbBox;
|
||||
|
||||
case "d3Mesh" : return VALUE_TYPE.d3Mesh;
|
||||
case "d3Light" : return VALUE_TYPE.d3Light;
|
||||
case "d3Camera" : return VALUE_TYPE.d3Camera;
|
||||
case "d3Scene" : return VALUE_TYPE.d3Scene;
|
||||
case "d3Material" : return VALUE_TYPE.d3Material;
|
||||
|
||||
case "dynaSurface" : return VALUE_TYPE.dynaSurface;
|
||||
case "PCXnode" : return VALUE_TYPE.PCXnode;
|
||||
|
||||
case "audioBit" : return VALUE_TYPE.audioBit;
|
||||
|
||||
case "fDomain" : return VALUE_TYPE.fdomain;
|
||||
|
||||
case "action" : return VALUE_TYPE.action;
|
||||
}
|
||||
|
||||
return VALUE_TYPE.any;
|
||||
} #endregion
|
||||
|
||||
function typeArray(_type) { #region
|
||||
switch(_type) {
|
||||
case VALUE_DISPLAY.range :
|
||||
case VALUE_DISPLAY.vector_range :
|
||||
case VALUE_DISPLAY.rotation_range :
|
||||
case VALUE_DISPLAY.rotation_random :
|
||||
case VALUE_DISPLAY.slider_range :
|
||||
case VALUE_DISPLAY.path_anchor :
|
||||
case VALUE_DISPLAY.gradient_range :
|
||||
|
||||
case VALUE_DISPLAY.vector :
|
||||
case VALUE_DISPLAY.padding :
|
||||
case VALUE_DISPLAY.area :
|
||||
case VALUE_DISPLAY.puppet_control :
|
||||
case VALUE_DISPLAY.matrix :
|
||||
case VALUE_DISPLAY.transform :
|
||||
case VALUE_DISPLAY.boolean_grid :
|
||||
|
||||
case VALUE_DISPLAY.curve :
|
||||
|
||||
case VALUE_DISPLAY.path_array :
|
||||
case VALUE_DISPLAY.palette :
|
||||
case VALUE_DISPLAY.text_array :
|
||||
|
||||
case VALUE_DISPLAY.d3vertex :
|
||||
case VALUE_DISPLAY.d3quarternion :
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
} #endregion
|
||||
|
||||
function typeCompatible(fromType, toType, directional_cast = true) { #region
|
||||
if(value_bit(fromType) & value_bit(toType) != 0)
|
||||
return true;
|
||||
if(!directional_cast)
|
||||
return false;
|
||||
return value_type_directional(fromType, toType);
|
||||
} #endregion
|
||||
|
||||
function typeIncompatible(from, to) { #region
|
||||
if(from.type == VALUE_TYPE.surface && (to.type == VALUE_TYPE.integer || to.type == VALUE_TYPE.float)) {
|
||||
switch(to.display_type) {
|
||||
case VALUE_DISPLAY.area :
|
||||
case VALUE_DISPLAY.matrix :
|
||||
case VALUE_DISPLAY.vector_range :
|
||||
case VALUE_DISPLAY.puppet_control :
|
||||
case VALUE_DISPLAY.padding :
|
||||
case VALUE_DISPLAY.curve :
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
} #endregion
|
||||
|
||||
function isGraphable(prop) { #region
|
||||
if(prop.type == VALUE_TYPE.integer || prop.type == VALUE_TYPE.float) {
|
||||
if(prop.display_type == VALUE_DISPLAY.puppet_control)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
if(prop.type == VALUE_TYPE.color && prop.display_type == VALUE_DISPLAY._default)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
} #endregion
|
13
scripts/node_value_types/node_value_types.yy
Normal file
13
scripts/node_value_types/node_value_types.yy
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"$GMScript":"",
|
||||
"%Name":"node_value_types",
|
||||
"isCompatibility":false,
|
||||
"isDnD":false,
|
||||
"name":"node_value_types",
|
||||
"parent":{
|
||||
"name":"__base__",
|
||||
"path":"folders/nodes/data/__base__.yy",
|
||||
},
|
||||
"resourceType":"GMScript",
|
||||
"resourceVersion":"2.0",
|
||||
}
|
Loading…
Reference in a new issue