Add the ability to expose node metadata (name, position) as junction.

This commit is contained in:
Tanasart 2024-10-29 09:03:29 +07:00
parent ceffc4caea
commit 03a061651f
14 changed files with 302 additions and 188 deletions

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.3.006"; VERSION_STRING = MAC? "1.18.003m" : "1.18.3.007";
BUILD_NUMBER = 1_18_01_0; BUILD_NUMBER = 1_18_01_0;
HOTKEYS = ds_map_create(); HOTKEYS = ds_map_create();

View file

@ -19,7 +19,7 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _foc
var xc = xx + ww / 2; var xc = xx + ww / 2;
var _font = viewMode == INSP_VIEW_MODE.spacious? f_p1 : f_p2; var _font = viewMode == INSP_VIEW_MODE.spacious? f_p1 : f_p2;
var breakLine = viewMode == INSP_VIEW_MODE.spacious || jun.expUse; var breakLine = viewMode == INSP_VIEW_MODE.spacious || jun.expUse;
var lb_h = line_get_height(_font) + ui(6); var lb_h = line_get_height(_font, 6);
var lb_y = yy + lb_h / 2; var lb_y = yy + lb_h / 2;
var _name = jun.getName(); var _name = jun.getName();

View file

@ -4,7 +4,7 @@ function Node_Armature(_x, _y, _group = noone) : Node(_x, _y, _group) constructo
//newInput(0, nodeValue_Int("Axis", self, 0)); //newInput(0, nodeValue_Int("Axis", self, 0));
bone_renderer = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus) { #region bone_renderer = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus) {
var _b = attributes.bones; var _b = attributes.bones;
if(_b == noone) return 0; if(_b == noone) return 0;
var amo = _b.childCount(); var amo = _b.childCount();
@ -121,13 +121,13 @@ function Node_Armature(_x, _y, _group = noone) : Node(_x, _y, _group) constructo
} }
return bh; return bh;
}); #endregion });
input_display_list = [ input_display_list = [
bone_renderer, bone_renderer,
]; ];
static createBone = function(parent, distance, direction) { #region static createBone = function(parent, distance, direction) {
recordAction(ACTION_TYPE.struct_modify, attributes.bones, attributes.bones.serialize()); recordAction(ACTION_TYPE.struct_modify, attributes.bones, attributes.bones.serialize());
var bone = new __Bone(parent, distance, direction,,, self); var bone = new __Bone(parent, distance, direction,,, self);
@ -136,28 +136,28 @@ function Node_Armature(_x, _y, _group = noone) : Node(_x, _y, _group) constructo
if(parent == attributes.bones) if(parent == attributes.bones)
bone.parent_anchor = false; bone.parent_anchor = false;
return bone; return bone;
} #endregion }
newOutput(0, nodeValue_Output("Armature", self, VALUE_TYPE.armature, noone)); newOutput(0, nodeValue_Output("Armature", self, VALUE_TYPE.armature, noone));
#region ++++ attributes ++++ #region ++++ attributes ++++
attributes.bones = new __Bone(,,,,, self); attributes.bones = new __Bone(,,,,, self);
attributes.bones.name = "Main"; attributes.bones.name = "Main";
attributes.bones.is_main = true; attributes.bones.is_main = true;
attributes.bones.node = self; attributes.bones.node = self;
attributes.display_name = true; attributes.display_name = true;
attributes.display_bone = 0; attributes.display_bone = 0;
array_push(attributeEditors, "Display"); array_push(attributeEditors, "Display");
array_push(attributeEditors, ["Display name", function() { return attributes.display_name; }, array_push(attributeEditors, ["Display name", function() { return attributes.display_name; },
new checkBox(function() { new checkBox(function() {
attributes.display_name = !attributes.display_name; attributes.display_name = !attributes.display_name;
})]); })]);
array_push(attributeEditors, ["Display bone", function() { return attributes.display_bone; }, array_push(attributeEditors, ["Display bone", function() { return attributes.display_bone; },
new scrollBox(["Octahedral", "Stick"], function(ind) { new scrollBox(["Octahedral", "Stick"], function(ind) {
attributes.display_bone = ind; attributes.display_bone = ind;
})]); })]);
#endregion #endregion
tools = [ tools = [
@ -185,7 +185,7 @@ function Node_Armature(_x, _y, _group = noone) : Node(_x, _y, _group) constructo
moving = false; moving = false;
scaling = false; scaling = false;
static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) { #region static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) {
var mx = (_mx - _x) / _s; var mx = (_mx - _x) / _s;
var my = (_my - _y) / _s; var my = (_my - _y) / _s;
@ -194,7 +194,7 @@ function Node_Armature(_x, _y, _group = noone) : Node(_x, _y, _group) constructo
var _b = attributes.bones; var _b = attributes.bones;
if(builder_bone != noone) { #region if(builder_bone != noone) {
anchor_selecting = _b.draw(attributes, false, _x, _y, _s, _mx, _my, anchor_selecting); anchor_selecting = _b.draw(attributes, false, _x, _y, _s, _mx, _my, anchor_selecting);
var dir = point_direction(builder_sx, builder_sy, smx, smy); var dir = point_direction(builder_sx, builder_sy, smx, smy);
@ -263,8 +263,8 @@ function Node_Armature(_x, _y, _group = noone) : Node(_x, _y, _group) constructo
} }
triggerRender(); triggerRender();
#endregion
} else if(ik_dragging != noone) { #region } else if(ik_dragging != noone) {
anchor_selecting = _b.draw(attributes, active * 0b100, _x, _y, _s, _mx, _my, anchor_selecting, ik_dragging); anchor_selecting = _b.draw(attributes, active * 0b100, _x, _y, _s, _mx, _my, anchor_selecting, ik_dragging);
if(anchor_selecting != noone && anchor_selecting[1] == 2) { if(anchor_selecting != noone && anchor_selecting[1] == 2) {
@ -309,10 +309,10 @@ function Node_Armature(_x, _y, _group = noone) : Node(_x, _y, _group) constructo
} }
triggerRender(); triggerRender();
#endregion
} }
if(isUsingTool("Move")) { #region if(isUsingTool("Move")) {
_b.draw(attributes, false, _x, _y, _s, _mx, _my); _b.draw(attributes, false, _x, _y, _s, _mx, _my);
var bbox = _b.bbox(); var bbox = _b.bbox();
@ -358,8 +358,8 @@ function Node_Armature(_x, _y, _group = noone) : Node(_x, _y, _group) constructo
draw_rectangle(x0, y0, x1, y1, true); draw_rectangle(x0, y0, x1, y1, true);
draw_set_alpha(1); draw_set_alpha(1);
} }
#endregion
} else if(isUsingTool("Scale")) { #region } else if(isUsingTool("Scale")) {
_b.draw(attributes, false, _x, _y, _s, _mx, _my); _b.draw(attributes, false, _x, _y, _s, _mx, _my);
var bbox = _b.bbox(); var bbox = _b.bbox();
@ -425,8 +425,8 @@ function Node_Armature(_x, _y, _group = noone) : Node(_x, _y, _group) constructo
recordAction(ACTION_TYPE.struct_modify, attributes.bones, attributes.bones.serialize()); recordAction(ACTION_TYPE.struct_modify, attributes.bones, attributes.bones.serialize());
} }
} }
#endregion
} else if(isUsingTool("Add bones")) { #region // builder } else if(isUsingTool("Add bones")) { // builder
if(builder_bone == noone) if(builder_bone == noone)
anchor_selecting = _b.draw(attributes, active * 0b111, _x, _y, _s, _mx, _my, anchor_selecting); anchor_selecting = _b.draw(attributes, active * 0b111, _x, _y, _s, _mx, _my, anchor_selecting);
@ -470,8 +470,8 @@ function Node_Armature(_x, _y, _group = noone) : Node(_x, _y, _group) constructo
draw_sprite_ext(THEME.bone_tool_add, 1, _mx + 24, _my + 24, 1, 1, 0, c_white, 1); draw_sprite_ext(THEME.bone_tool_add, 1, _mx + 24, _my + 24, 1, 1, 0, c_white, 1);
} else if(anchor_selecting[1] == 2) } else if(anchor_selecting[1] == 2)
draw_sprite_ext(THEME.bone_tool_add, 0, _mx + 24, _my + 24, 1, 1, 0, c_white, 1); draw_sprite_ext(THEME.bone_tool_add, 0, _mx + 24, _my + 24, 1, 1, 0, c_white, 1);
#endregion
} else if(isUsingTool("Remove bones")) { #region //remover } else if(isUsingTool("Remove bones")) { //remover
anchor_selecting = _b.draw(attributes, active * 0b100, _x, _y, _s, _mx, _my, anchor_selecting); anchor_selecting = _b.draw(attributes, active * 0b100, _x, _y, _s, _mx, _my, anchor_selecting);
if(anchor_selecting != noone && anchor_selecting[1] == 2 && anchor_selecting[0].parent != noone && mouse_press(mb_left, active)) { if(anchor_selecting != noone && anchor_selecting[1] == 2 && anchor_selecting[0].parent != noone && mouse_press(mb_left, active)) {
@ -492,8 +492,8 @@ function Node_Armature(_x, _y, _group = noone) : Node(_x, _y, _group) constructo
if(anchor_selecting != noone) if(anchor_selecting != noone)
draw_sprite_ext(THEME.bone_tool_remove, 1, _mx + 24, _my + 24, 1, 1, 0, c_white, 1); draw_sprite_ext(THEME.bone_tool_remove, 1, _mx + 24, _my + 24, 1, 1, 0, c_white, 1);
#endregion
} else if(isUsingTool("Detach bones")) { #region //detach } else if(isUsingTool("Detach bones")) { //detach
if(builder_bone == noone) if(builder_bone == noone)
anchor_selecting = _b.draw(attributes, active * 0b100, _x, _y, _s, _mx, _my, anchor_selecting); anchor_selecting = _b.draw(attributes, active * 0b100, _x, _y, _s, _mx, _my, anchor_selecting);
@ -514,16 +514,16 @@ function Node_Armature(_x, _y, _group = noone) : Node(_x, _y, _group) constructo
builder_my = my; builder_my = my;
UNDO_HOLDING = true; UNDO_HOLDING = true;
} }
#endregion
} else if(isUsingTool("IK")) { #region //IK } else if(isUsingTool("IK")) { //IK
if(ik_dragging == noone) if(ik_dragging == noone)
anchor_selecting = _b.draw(attributes, active * 0b100, _x, _y, _s, _mx, _my, anchor_selecting); anchor_selecting = _b.draw(attributes, active * 0b100, _x, _y, _s, _mx, _my, anchor_selecting);
if(anchor_selecting != noone && anchor_selecting[1] == 2 && mouse_press(mb_left, active)) { if(anchor_selecting != noone && anchor_selecting[1] == 2 && mouse_press(mb_left, active)) {
ik_dragging = anchor_selecting[0]; ik_dragging = anchor_selecting[0];
} }
#endregion
} else { #region //mover } else { //mover
if(builder_bone == noone) if(builder_bone == noone)
anchor_selecting = _b.draw(attributes, active * 0b111, _x, _y, _s, _mx, _my, anchor_selecting); anchor_selecting = _b.draw(attributes, active * 0b111, _x, _y, _s, _mx, _my, anchor_selecting);
@ -555,17 +555,17 @@ function Node_Armature(_x, _y, _group = noone) : Node(_x, _y, _group) constructo
UNDO_HOLDING = true; UNDO_HOLDING = true;
} }
#endregion
} }
} #endregion }
static step = function() {} static step = function() {}
static update = function(frame = CURRENT_FRAME) { #region static update = function(frame = CURRENT_FRAME) {
outputs[0].setValue(attributes.bones); outputs[0].setValue(attributes.bones);
} #endregion }
static getPreviewBoundingBox = function() { #region static getPreviewBoundingBox = function() {
var minx = 9999999; var minx = 9999999;
var miny = 9999999; var miny = 9999999;
var maxx = -9999999; var maxx = -9999999;
@ -596,25 +596,24 @@ function Node_Armature(_x, _y, _group = noone) : Node(_x, _y, _group) constructo
if(minx == 9999999) return noone; if(minx == 9999999) return noone;
return BBOX().fromPoints(minx, miny, maxx, maxy); return BBOX().fromPoints(minx, miny, maxx, maxy);
} #endregion }
static attributeSerialize = function() { return {}; } static doSerialize = function(_map) {
static attributeDeserialize = function(attr) {}
static doSerialize = function(_map) { #region
_map.bones = attributes.bones.serialize(); _map.bones = attributes.bones.serialize();
} #endregion }
static postDeserialize = function() { #region // static attributeDeserialize = function() {}
static postDeserialize = function() {
if(!struct_has(load_map, "bones")) return; if(!struct_has(load_map, "bones")) return;
attributes.bones = new __Bone(,,,,, self); attributes.bones = new __Bone(,,,,, self);
attributes.bones.deserialize(load_map.bones, self); attributes.bones.deserialize(load_map.bones, self);
attributes.bones.connect(); attributes.bones.connect();
} #endregion }
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
var bbox = drawGetBbox(xx, yy, _s); var bbox = drawGetBbox(xx, yy, _s);
draw_sprite_fit(s_node_armature_create, 0, bbox.xc, bbox.yc, bbox.w, bbox.h); draw_sprite_fit(s_node_armature_create, 0, bbox.xc, bbox.yc, bbox.w, bbox.h);
} #endregion }
} }

View file

@ -64,7 +64,7 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
layer_dragging = noone; layer_dragging = noone;
layer_remove = -1; layer_remove = -1;
layer_renderer = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus) { #region layer_renderer = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus) {
ds_map_clear(surfMap); ds_map_clear(surfMap);
var index = -1; var index = -1;
@ -84,7 +84,7 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
surfMap[? _id] = [ [ index, _surf ] ]; surfMap[? _id] = [ [ index, _surf ] ];
} }
#region draw bones #region draw bones
var _b = bone; var _b = bone;
if(_b == noone) return 0; if(_b == noone) return 0;
var amo = _b.childCount(); var amo = _b.childCount();
@ -333,7 +333,7 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
} }
#endregion #endregion
if(layer_dragging != noone && mouse_release(mb_left)) { #region if(layer_dragging != noone && mouse_release(mb_left)) {
if(layer_dragging != hoverIndex && hoverIndex != noone) { if(layer_dragging != hoverIndex && hoverIndex != noone) {
var index = input_fix_len + layer_dragging * data_length; var index = input_fix_len + layer_dragging * data_length;
var targt = input_fix_len + hoverIndex * data_length; var targt = input_fix_len + hoverIndex * data_length;
@ -362,11 +362,11 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
} }
layer_dragging = noone; layer_dragging = noone;
} #endregion }
layer_renderer.h = bh + ui(40) + sh; layer_renderer.h = bh + ui(40) + sh;
return layer_renderer.h; return layer_renderer.h;
#endregion
}); });
input_display_list = [ 1, 2, input_display_list = [ 1, 2,
@ -441,12 +441,12 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
bone = noone; bone = noone;
surface_selecting = noone; surface_selecting = noone;
static getInputIndex = function(index) { #region static getInputIndex = function(index) {
if(index < input_fix_len) return index; if(index < input_fix_len) return index;
return input_fix_len + (index - input_fix_len) * data_length; return input_fix_len + (index - input_fix_len) * data_length;
} #endregion }
static setBone = function() { #region static setBone = function() {
ds_map_clear(boneMap); ds_map_clear(boneMap);
var _b = getInputData(1); var _b = getInputData(1);
@ -467,9 +467,9 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
} }
ds_stack_destroy(_bst); ds_stack_destroy(_bst);
} #endregion }
static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) { #region static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) {
var dim = getInputData(0); var dim = getInputData(0);
var _bind = getInputData(2); var _bind = getInputData(2);
@ -499,7 +499,7 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
var y0 = _y; var y0 = _y;
var y1 = _y + hh * _s; var y1 = _y + hh * _s;
if(surf_dragging > -1) { #region if(surf_dragging > -1) {
var _surf = current_data[surf_dragging + 0]; var _surf = current_data[surf_dragging + 0];
var _tran = current_data[surf_dragging + 1]; var _tran = current_data[surf_dragging + 1];
var _aang = current_data[surf_dragging + 2]; var _aang = current_data[surf_dragging + 2];
@ -564,7 +564,7 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
surf_dragging = -1; surf_dragging = -1;
UNDO_HOLDING = false; UNDO_HOLDING = false;
} }
} #endregion }
var hovering = noone; var hovering = noone;
var hovering_type = noone; var hovering_type = noone;
@ -574,7 +574,7 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
var amo = (array_length(inputs) - input_fix_len) / data_length; var amo = (array_length(inputs) - input_fix_len) / data_length;
var anchors = array_create(array_length(inputs)); var anchors = array_create(array_length(inputs));
for(var i = 0; i < amo; i++) { #region for(var i = 0; i < amo; i++) {
var index = input_fix_len + i * data_length; var index = input_fix_len + i * data_length;
var _surf = array_safe_get_fast(current_data, index); var _surf = array_safe_get_fast(current_data, index);
if(!_surf || is_array(_surf)) continue; if(!_surf || is_array(_surf)) continue;
@ -632,9 +632,9 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
rot: _rot, rot: _rot,
} }
} #endregion }
for(var i = 0; i < amo; i++) { #region for(var i = 0; i < amo; i++) {
var vis = array_safe_get_fast(_vis, i); var vis = array_safe_get_fast(_vis, i);
var sel = array_safe_get_fast(_sel, i); var sel = array_safe_get_fast(_sel, i);
if(!vis) continue; if(!vis) continue;
@ -675,7 +675,7 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
hovering = index; hovering = index;
hovering_type = NODE_COMPOSE_DRAG.move; hovering_type = NODE_COMPOSE_DRAG.move;
} }
} #endregion }
if(mouse_press(mb_left, active)) if(mouse_press(mb_left, active))
surface_selecting = hovering; surface_selecting = hovering;
@ -704,7 +704,7 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
draw_line(a.d3[0], a.d3[1], a.d2[0], a.d2[1]); draw_line(a.d3[0], a.d3[1], a.d2[0], a.d2[1]);
} }
if(hovering != noone && hovering_type != noone && mouse_press(mb_left, active)) { #region if(hovering != noone && hovering_type != noone && mouse_press(mb_left, active)) {
var _tran = current_data[hovering + 1]; var _tran = current_data[hovering + 1];
var _aang = current_data[hovering + 2]; var _aang = current_data[hovering + 2];
var _asca = current_data[hovering + 3]; var _asca = current_data[hovering + 3];
@ -731,15 +731,15 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
dragging_mx = (a.d0[0] + a.d3[0]) / 2; dragging_mx = (a.d0[0] + a.d3[0]) / 2;
dragging_my = (a.d0[1] + a.d3[1]) / 2; dragging_my = (a.d0[1] + a.d3[1]) / 2;
} }
} #endregion }
if(layer_remove > -1) { if(layer_remove > -1) {
deleteLayer(layer_remove); deleteLayer(layer_remove);
layer_remove = -1; layer_remove = -1;
} }
} #endregion }
static step = function() { #region static step = function() {
var _dim_type = getSingleValue(1); var _dim_type = getSingleValue(1);
inputs[2].setVisible(_dim_type == COMPOSE_OUTPUT_SCALING.constant); inputs[2].setVisible(_dim_type == COMPOSE_OUTPUT_SCALING.constant);
@ -747,9 +747,9 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
inputs[i + 3].setVisible(current_data[i + 2]); inputs[i + 3].setVisible(current_data[i + 2]);
inputs[i + 5].setVisible(current_data[i + 4]); inputs[i + 5].setVisible(current_data[i + 4]);
} }
} #endregion }
static processData = function(_outSurf, _data, _output_index, _array_index) { #region static processData = function(_outSurf, _data, _output_index, _array_index) {
if(_output_index == 1) return atlas_data; if(_output_index == 1) return atlas_data;
if(_output_index == 2) return bind_data; if(_output_index == 2) return bind_data;
if(_output_index == 0 && _array_index == 0) { if(_output_index == 0 && _array_index == 0) {
@ -853,9 +853,9 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
surface_reset_shader(); surface_reset_shader();
return _outSurf; return _outSurf;
} #endregion }
static resetTransform = function(surfIndex) { #region static resetTransform = function(surfIndex) {
var _bind = getInputData(2); var _bind = getInputData(2);
var use_data = _bind != noone; var use_data = _bind != noone;
@ -876,17 +876,17 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
var _tr = [ _cx - _anc.x, _cy - _anc.y, _rot, 1, 1 ]; var _tr = [ _cx - _anc.x, _cy - _anc.y, _rot, 1, 1 ];
inputs[surfIndex + 1].setValue(_tr); inputs[surfIndex + 1].setValue(_tr);
} #endregion }
static attributeSerialize = function() { #region static attributeSerialize = function() {
var att = {}; var att = {};
att.layer_visible = attributes.layer_visible; att.layer_visible = attributes.layer_visible;
att.layer_selectable = attributes.layer_selectable; att.layer_selectable = attributes.layer_selectable;
return att; return att;
} #endregion }
static attributeDeserialize = function(attr) { #region static attributeDeserialize = function(attr) {
struct_append(attributes, attr); struct_append(attributes, attr);
if(struct_has(attributes, "use_project_dimension") && !struct_has(attr, "use_project_dimension")) if(struct_has(attributes, "use_project_dimension") && !struct_has(attr, "use_project_dimension"))
@ -897,10 +897,10 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
if(struct_has(attr, "layer_selectable")) if(struct_has(attr, "layer_selectable"))
attributes.layer_selectable = attr.layer_selectable; attributes.layer_selectable = attr.layer_selectable;
} #endregion }
static doApplyDeserialize = function() { #region static doApplyDeserialize = function() {
setBone(); setBone();
} #endregion }
} }

View file

@ -611,7 +611,7 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc
static attributeSerialize = function() { static attributeSerialize = function() {
sortIO(); sortIO();
var _attr = variable_clone(attributes); var _attr = {};
_attr.custom_input_list = []; _attr.custom_input_list = [];
for( var i = custom_input_index, n = array_length(inputs); i < n; i++ ) { for( var i = custom_input_index, n = array_length(inputs); i < n; i++ ) {

View file

@ -208,6 +208,16 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
input_button_length = array_length(input_buttons); input_button_length = array_length(input_buttons);
}); });
junc_meta = [
nodeValue_Output("Name", self, VALUE_TYPE.text, ""),
nodeValue_Output("Position", self, VALUE_TYPE.float, [ 0, 0 ])
.setDisplay(VALUE_DISPLAY.vector),
];
for( var i = 0, n = array_length(junc_meta); i < n; i++ ) {
junc_meta[i].index = i;
junc_meta[i].tags = VALUE_TAG.matadata;
}
#endregion #endregion
#region --- attributes ---- #region --- attributes ----
@ -215,15 +225,17 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
attributes.node_width = 0; attributes.node_width = 0;
attributes.node_height = 0; attributes.node_height = 0;
attributes.annotation = ""; attributes.annotation = "";
attributes.outp_meta = false;
attributeEditors = [ attributeEditors = [
"Display", "Display",
["Annotation", function() { return attributes.annotation; }, new textArea(TEXTBOX_INPUT.text, function(val) { attributes.annotation = val; }) ], ["Annotation", function() /*=>*/ {return attributes.annotation}, new textArea(TEXTBOX_INPUT.text, function(val) /*=>*/ { attributes.annotation = val; }) ],
["Params Width", function() { return attributes.node_param_width; }, new textBox(TEXTBOX_INPUT.number, function(val) { attributes.node_param_width = val; refreshNodeDisplay(); }) ], ["Params Width", function() /*=>*/ {return attributes.node_param_width}, new textBox(TEXTBOX_INPUT.number, function(val) /*=>*/ { attributes.node_param_width = val; refreshNodeDisplay(); }) ],
"Node update", "Node",
["Auto update", function() { return attributes.update_graph; }, new checkBox(function() { attributes.update_graph = !attributes.update_graph; }) ], ["Auto update", function() /*=>*/ {return attributes.update_graph}, new checkBox(function() /*=>*/ { attributes.update_graph = !attributes.update_graph; }) ],
["Update trigger", function() { return attributes.show_update_trigger; }, new checkBox(function() { attributes.show_update_trigger = !attributes.show_update_trigger; }) ], ["Update trigger", function() /*=>*/ {return attributes.show_update_trigger}, new checkBox(function() /*=>*/ { attributes.show_update_trigger = !attributes.show_update_trigger; }) ],
["Output metadata", function() /*=>*/ {return attributes.outp_meta}, new checkBox(function() /*=>*/ { attributes.outp_meta = !attributes.outp_meta; setHeight(); }) ],
]; ];
bufferStore = {}; bufferStore = {};
@ -584,6 +596,10 @@ 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;
if(attributes.outp_meta) {
junc_meta[0].setValue(getDisplayName());
junc_meta[1].setValue([ x, y ]);
}
} }
static doStepBegin = function() {} static doStepBegin = function() {}
@ -718,6 +734,13 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
_ho += junction_draw_hei_y * _byp.visible; _ho += junction_draw_hei_y * _byp.visible;
} }
if(attributes.outp_meta) {
for( var i = 0; i < array_length(junc_meta); i++ ) {
if(!junc_meta[i].isVisible()) continue;
_ho += junction_draw_hei_y;
}
}
h = max(min_h, _prev_surf * 128, _hi, _ho); h = max(min_h, _prev_surf * 128, _hi, _ho);
if(attributes.node_height) h = max(h, attributes.node_height); if(attributes.node_height) h = max(h, attributes.node_height);
@ -1333,6 +1356,16 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
ry += junction_draw_hei_y * jun.visible; ry += junction_draw_hei_y * jun.visible;
} }
for( var i = 0, n = array_length(junc_meta); i < n; i++ ) {
var jun = junc_meta[i];
jun.x = _ox; jun.rx = rx;
jun.y = _oy; jun.ry = ry;
_oy += junction_draw_hei_y * jun.isVisible() * _s;
ry += junction_draw_hei_y * jun.isVisible();
}
if(SHOW_PARAM) h = h_param; if(SHOW_PARAM) h = h_param;
onPreDraw(_x, _y, _s, _iy, _oy); onPreDraw(_x, _y, _s, _iy, _oy);
@ -1549,6 +1582,15 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
if(updatedOutTrigger.drawJunction(_s, _mx, _my)) hover = updatedOutTrigger; if(updatedOutTrigger.drawJunction(_s, _mx, _my)) hover = updatedOutTrigger;
} }
if(attributes.outp_meta) {
for(var i = 0; i < array_length(junc_meta); i++) { // outputs
var jun = junc_meta[i];
if(!jun.isVisible()) continue;
if(jun.drawJunction(_s, _mx, _my)) hover = jun;
}
}
onDrawJunctions(_x, _y, _mx, _my, _s); onDrawJunctions(_x, _y, _mx, _my, _s);
return hover; return hover;
@ -1589,6 +1631,15 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
if(updatedOutTrigger.drawJunction_fast(_s, _mx, _my)) hover = updatedOutTrigger; if(updatedOutTrigger.drawJunction_fast(_s, _mx, _my)) hover = updatedOutTrigger;
} }
if(attributes.outp_meta) {
for(var i = 0; i < array_length(junc_meta); i++) { // outputs
var jun = junc_meta[i];
if(!jun.isVisible()) continue;
if(jun.drawJunction_fast(_s, _mx, _my)) hover = jun;
}
}
onDrawJunctions(_x, _y, _mx, _my, _s); onDrawJunctions(_x, _y, _mx, _my, _s);
return hover; return hover;
@ -1652,6 +1703,17 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
if(jun == noone || !jun.visible) continue; if(jun == noone || !jun.visible) continue;
jun.drawName(_s, _mx, _my); jun.drawName(_s, _mx, _my);
} }
if(attributes.outp_meta) {
for(var i = 0; i < array_length(junc_meta); i++) {
var jun = junc_meta[i];
if(!jun.isVisible()) continue;
jun.drawNameBG(_s);
jun.drawName(_s, _mx, _my);
}
}
} }
if(hasInspector1Update() && PANEL_GRAPH.pHOVER && point_in_circle(_mx, _my, inspectInput1.x, inspectInput1.y, 10)) { if(hasInspector1Update() && PANEL_GRAPH.pHOVER && point_in_circle(_mx, _my, inspectInput1.x, inspectInput1.y, 10)) {
@ -2235,7 +2297,8 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
_map.show_parameter = show_parameter; _map.show_parameter = show_parameter;
} }
_map.attri = attributeSerialize(); var _attr = attributeSerialize();
_map.attri = struct_append(attributes, _attr);
if(is_dynamic_input) { if(is_dynamic_input) {
_map.input_fix_len = input_fix_len; _map.input_fix_len = input_fix_len;
@ -2258,7 +2321,12 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
array_push(_trigger, updatedInTrigger.serialize(scale, preset)); array_push(_trigger, updatedInTrigger.serialize(scale, preset));
array_push(_trigger, updatedOutTrigger.serialize(scale, preset)); array_push(_trigger, updatedOutTrigger.serialize(scale, preset));
var _outMeta = [];
for(var i = 0; i < array_length(junc_meta); i++)
_outData[i] = junc_meta[i].serialize(scale, preset);
_map.inspectInputs = _trigger; _map.inspectInputs = _trigger;
_map.outputMeta = _outMeta;
_map.renamed = renamed; _map.renamed = renamed;
_map.buffer = {}; _map.buffer = {};
@ -2273,7 +2341,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
return _map; return _map;
} }
static attributeSerialize = function() { return attributes; } static attributeSerialize = function() { return {}; }
static doSerialize = function(_map) {} static doSerialize = function(_map) {}
static processSerialize = function(_map) {} static processSerialize = function(_map) {}
@ -2433,6 +2501,13 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
if(array_length(insInp) > 3) updatedOutTrigger.applyDeserialize(insInp[3], load_scale, preset); if(array_length(insInp) > 3) updatedOutTrigger.applyDeserialize(insInp[3], load_scale, preset);
} }
if(struct_has(load_map, "outputMeta")) {
var _outMeta = load_map.outputMeta;
for(var i = 0; i < min(array_length(_outMeta), array_length(junc_meta)); i++)
junc_meta[i].applyDeserialize(_outMeta[i], load_scale, preset);
}
//print($"Applying deserialzie for {name} complete"); //print($"Applying deserialzie for {name} complete");
doApplyDeserialize(); doApplyDeserialize();

View file

@ -751,7 +751,6 @@ function Node_Mesh_Warp(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
static attributeSerialize = function() { static attributeSerialize = function() {
var att = {}; var att = {};
struct_append(att, attributes);
var pinList = []; var pinList = [];
for( var j = 0; j < array_length(mesh_data.points); j++ ) { for( var j = 0; j < array_length(mesh_data.points); j++ ) {

View file

@ -97,11 +97,11 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr
anchor_drag_mx = -1; anchor_drag_mx = -1;
anchor_drag_my = -1; anchor_drag_my = -1;
static getPreviewValues = function() { #region static getPreviewValues = function() {
return getInputData(6); return getInputData(6);
} #endregion }
static generateAllMesh = function() { #region static generateAllMesh = function() {
var _tex = getInputData(6); var _tex = getInputData(6);
if(is_array(_tex)) { if(is_array(_tex)) {
@ -110,9 +110,9 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr
} else } else
generateMesh(); generateMesh();
doUpdate(); doUpdate();
} #endregion }
static drawOverlayPreviewSingle = function(_i, _x, _y, _s, _pr_x, _pr_y, _tex_s) { #region static drawOverlayPreviewSingle = function(_i, _x, _y, _s, _pr_x, _pr_y, _tex_s) {
var meshes = attributes.mesh; var meshes = attributes.mesh;
var _shp = getInputData(5); var _shp = getInputData(5);
@ -151,9 +151,9 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr
} }
draw_surface_ext_safe(_tex, _pr_x, _pr_y, _s, _s, 0, c_white, 0.5); draw_surface_ext_safe(_tex, _pr_x, _pr_y, _s, _s, 0, c_white, 0.5);
} #endregion }
static drawOverlayPreview = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) { #region static drawOverlayPreview = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) {
var _pos = getInputData(7); var _pos = getInputData(7);
var _tex = getInputData(6); var _tex = getInputData(6);
@ -167,9 +167,9 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr
drawOverlayPreviewSingle(0, _x, _y, _s, _pr_x, _pr_y, _tex); drawOverlayPreviewSingle(0, _x, _y, _s, _pr_x, _pr_y, _tex);
return inputs[7].drawOverlay(hover, active, _x, _y, _s, _mx, _my, _snx, _sny); return inputs[7].drawOverlay(hover, active, _x, _y, _s, _mx, _my, _snx, _sny);
} #endregion }
static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) { #region static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) {
var gr = is_instanceof(group, Node_Rigid_Group)? group : noone; var gr = is_instanceof(group, Node_Rigid_Group)? group : noone;
if(inline_context != noone) gr = inline_context; if(inline_context != noone) gr = inline_context;
@ -289,9 +289,9 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr
var a = inputs[7].drawOverlay(hover, active, _x, _y, _s, _mx, _my, _snx, _sny); active &= !a; var a = inputs[7].drawOverlay(hover, active, _x, _y, _s, _mx, _my, _snx, _sny); active &= !a;
return active; return active;
} #endregion }
static generateMesh = function(index = 0) { #region static generateMesh = function(index = 0) {
var _tex = getInputData(6); var _tex = getInputData(6);
var _exp = getInputData(10); var _exp = getInputData(10);
var _pix = getInputData(11); var _pix = getInputData(11);
@ -432,9 +432,9 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr
meshes[index] = mesh; meshes[index] = mesh;
attributes.mesh = meshes; attributes.mesh = meshes;
} #endregion }
static removeColinear = function(mesh) { #region static removeColinear = function(mesh) {
var len = array_length(mesh), _side = 0; var len = array_length(mesh), _side = 0;
var remSt = []; var remSt = [];
var tolerance = 5; var tolerance = 5;
@ -461,9 +461,9 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr
} }
return mesh; return mesh;
} #endregion }
static removeConcave = function(mesh) { #region static removeConcave = function(mesh) {
var len = array_length(mesh); var len = array_length(mesh);
if(len <= 3) return; if(len <= 3) return;
@ -528,9 +528,9 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr
} }
return mesh; return mesh;
} #endregion }
static fixtureCreate = function(fixture, object, dx = 0, dy = 0) { #region static fixtureCreate = function(fixture, object, dx = 0, dy = 0) {
var _mov = getInputData(0); var _mov = getInputData(0);
var _den = getInputData(1); var _den = getInputData(1);
var _cnt_frc = getInputData(2); var _cnt_frc = getInputData(2);
@ -552,9 +552,9 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr
array_push(object.fixture, physics_fixture_bind_ext(fixture, object, dx, dy)); array_push(object.fixture, physics_fixture_bind_ext(fixture, object, dx, dy));
physics_fixture_delete(fixture); physics_fixture_delete(fixture);
} #endregion }
static spawn = function(index = 0, object = noone) { #region static spawn = function(index = 0, object = noone) {
var _shp = getInputData(5); var _shp = getInputData(5);
var _tex = getInputData(6); var _tex = getInputData(6);
var _spos = getInputData(7); var _spos = getInputData(7);
@ -682,15 +682,15 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr
} }
return object; return object;
} #endregion }
static update = function(frame = CURRENT_FRAME) { #region static update = function(frame = CURRENT_FRAME) {
if(IS_FIRST_FRAME) reset(); if(IS_FIRST_FRAME) reset();
outputs[0].setValue(object); outputs[0].setValue(object);
} #endregion }
static step = function() { #region static step = function() {
var _shp = getInputData(5); var _shp = getInputData(5);
inputs[ 9].setVisible(_shp == 2); inputs[ 9].setVisible(_shp == 2);
@ -707,9 +707,9 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr
for( var i = array_length(meshes); i < array_length(_tex); i++ ) for( var i = array_length(meshes); i < array_length(_tex); i++ )
newMesh(i); newMesh(i);
} }
} #endregion }
static reset = function() { #region static reset = function() {
var _tex = getInputData(6); var _tex = getInputData(6);
for( var i = 0, n = array_length(object); i < n; i++ ) { for( var i = 0, n = array_length(object); i < n; i++ ) {
@ -726,9 +726,9 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr
object[i] = spawn(i); object[i] = spawn(i);
} else } else
object = [ spawn() ]; object = [ spawn() ];
} #endregion }
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
if(!previewable) return; if(!previewable) return;
var bbox = drawGetBbox(xx, yy, _s); var bbox = drawGetBbox(xx, yy, _s);
@ -742,21 +742,21 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr
var aa = 0.5 + 0.5 * renderActive; var aa = 0.5 + 0.5 * renderActive;
if(!isHighlightingInGraph()) aa *= 0.25; if(!isHighlightingInGraph()) aa *= 0.25;
draw_surface_bbox(_tex, bbox,, aa); draw_surface_bbox(_tex, bbox,, aa);
} #endregion }
static attributeSerialize = function() { #region static attributeSerialize = function() {
var att = {}; var att = {};
var mesh = struct_try_get(attributes, "mesh", []); var mesh = struct_try_get(attributes, "mesh", []);
att.mesh = json_stringify(mesh); att.mesh = json_stringify(mesh);
return att; return att;
} #endregion }
static attributeDeserialize = function(attr) { #region static attributeDeserialize = function(attr) {
struct_append(attributes, attr); struct_append(attributes, attr);
if(struct_has(attr, "mesh")) if(struct_has(attr, "mesh"))
attributes.mesh = json_parse(attr.mesh); attributes.mesh = json_parse(attr.mesh);
} #endregion }
} }

View file

@ -372,9 +372,11 @@ function Node_Tile_Drawer(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
static attributeSerialize = function() { static attributeSerialize = function() {
attributes.canvas = surface_encode(canvas_surface); var _attr = {
canvas : surface_encode(canvas_surface),
}
return attributes; return _attr;
} }
static attributeDeserialize = function(attr) { static attributeDeserialize = function(attr) {

View file

@ -381,7 +381,14 @@ function Node_Tile_Tileset(_x, _y, _group = noone) : Node(_x, _y, _group) constr
draw_sprite_uniform(THEME.cross, 0, _sx + _sw / 2, _sy + _sh / 2, 1, COLORS._main_icon, _aa); draw_sprite_uniform(THEME.cross, 0, _sx + _sw / 2, _sy + _sh / 2, 1, COLORS._main_icon, _aa);
if(_shov) { if(_shov) {
if(is(object_selecting, tiler_rule)) { if(object_selecting == noone) {
if(mouse_press(mb_left, _focus)) {
brush.brush_indices = [[[ -1, 0 ]]];
brush.brush_width = 1;
brush.brush_height = 1;
}
} else if(is(object_selecting, tiler_rule)) {
TOOLTIP = "Set Rule selector"; TOOLTIP = "Set Rule selector";
if(mouse_press(mb_left, _focus)) { if(mouse_press(mb_left, _focus)) {

View file

@ -241,6 +241,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
#region ---- serialization ---- #region ---- serialization ----
con_node = -1; con_node = -1;
con_index = -1; con_index = -1;
con_tag = 0;
#endregion #endregion
/////============= META ============= /////============= META =============
@ -2117,23 +2118,23 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
if(connect_type == CONNECT_TYPE.output) if(connect_type == CONNECT_TYPE.output)
return _map; return _map;
_map.name = name; _map.name = name;
_map.on_end = on_end; _map.on_end = on_end;
_map.loop_range = loop_range; _map.loop_range = loop_range;
_map.unit = unit.mode; _map.unit = unit.mode;
_map.sep_axis = sep_axis; _map.sep_axis = sep_axis;
_map.shift_x = draw_line_shift_x; _map.shift_x = draw_line_shift_x;
_map.shift_y = draw_line_shift_y; _map.shift_y = draw_line_shift_y;
_map.is_modified= is_modified; _map.is_modified = is_modified;
_map.from_node = -1;
_map.from_index = -1;
_map.from_tag = 0;
if(!preset && value_from) { if(!preset && value_from) {
_map.from_node = value_from.node.node_id; _map.from_node = value_from.node.node_id;
_map.from_index = value_from.index;
if(value_from.tags != 0) _map.from_index = value_from.tags; _map.from_tag = value_from.tags;
else _map.from_index = value_from.index;
} else {
_map.from_node = -1;
_map.from_index = -1;
} }
_map.global_use = expUse; _map.global_use = expUse;
@ -2196,8 +2197,9 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
} }
if(!preset) { if(!preset) {
con_node = struct_try_get(_map, "from_node", -1); con_node = struct_try_get(_map, "from_node", -1)
con_index = struct_try_get(_map, "from_index", -1); con_index = struct_try_get(_map, "from_index", -1);
con_tag = struct_try_get(_map, "from_tag", -1);
} }
if(struct_has(_map, "display_data")) { if(struct_has(_map, "display_data")) {
@ -2247,30 +2249,35 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
if(log) log_warning("LOAD", $"[Connect] Reconnecting {node.name} to {_nd.name}", node); if(log) log_warning("LOAD", $"[Connect] Reconnecting {node.name} to {_nd.name}", node);
if(con_index == VALUE_TAG.updateInTrigger) return setFrom(_nd.updatedInTrigger); switch(con_tag) {
if(con_index == VALUE_TAG.updateOutTrigger) return setFrom(_nd.updatedOutTrigger); case VALUE_TAG.updateInTrigger : return setFrom(_nd.updatedInTrigger);
case VALUE_TAG.updateOutTrigger : return setFrom(_nd.updatedOutTrigger);
if(con_index < _ol) { case VALUE_TAG.matadata : return setFrom(_nd.junc_meta[con_index]);
var _set = setFrom(_nd.outputs[con_index], false, true);
if(_set) return true;
if(_set == -1) log_warning("LOAD", $"[Connect] Connection conflict {node.name} to {_nd.name} : Not connectable.", node); default :
else if(_set == -2) log_warning("LOAD", $"[Connect] Connection conflict {node.name} to {_nd.name} : Condition not met.", node); if(con_index < _ol) {
var _set = setFrom(_nd.outputs[con_index], false, true);
return false; if(_set) return true;
}
if(_set == -1) log_warning("LOAD", $"[Connect] Connection conflict {node.name} to {_nd.name} : Not connectable.", node);
if(con_index >= 1000) { //connect bypass else if(_set == -2) log_warning("LOAD", $"[Connect] Connection conflict {node.name} to {_nd.name} : Condition not met.", node);
var _inp = array_safe_get_fast(_nd.inputs, con_index - 1000, noone);
if(_inp == noone) return false; return false;
}
var _set = setFrom(_inp.bypass_junc, false, true);
if(_set) return true; if(con_index >= 1000) { //connect bypass
var _inp = array_safe_get_fast(_nd.inputs, con_index - 1000, noone);
if(_set == -1) log_warning("LOAD", $"[Connect] Connection conflict {node.name} to {_nd.name} (bypass) : Not connectable.", node); if(_inp == noone) return false;
else if(_set == -2) log_warning("LOAD", $"[Connect] Connection conflict {node.name} to {_nd.name} (bypass) : Condition not met.", node);
var _set = setFrom(_inp.bypass_junc, false, true);
return false; if(_set) return true;
if(_set == -1) log_warning("LOAD", $"[Connect] Connection conflict {node.name} to {_nd.name} (bypass) : Not connectable.", node);
else if(_set == -2) log_warning("LOAD", $"[Connect] Connection conflict {node.name} to {_nd.name} (bypass) : Condition not met.", node);
return false;
}
break;
} }
log_warning("LOAD", $"[Connect] Connection conflict {node.name} to {_nd.name} : Output not exist [{con_index}].", node); log_warning("LOAD", $"[Connect] Connection conflict {node.name} to {_nd.name} : Output not exist [{con_index}].", node);

View file

@ -141,9 +141,10 @@ enum VALUE_UNIT {
} }
enum VALUE_TAG { enum VALUE_TAG {
updateInTrigger = -2, updateInTrigger = -2,
updateOutTrigger = -3, updateOutTrigger = -3,
none = 0 matadata = -4,
none = 0,
} }
enum LINE_STYLE { enum LINE_STYLE {

View file

@ -7,16 +7,28 @@ function Panel_Custom_Inspector(_title, _inspector) : PanelContent() constructor
inspector = _inspector; inspector = _inspector;
inspector.popupPanel = self; inspector.popupPanel = self;
sc_content = new scrollPane(w - ui(padding + padding), h - ui(title_height + padding + 40), function(_y, _m) {
draw_clear_alpha(COLORS.panel_bg_clear, 1);
var _wdh = inspector.draw(0, _y, sc_content.surface_w, [ mx, my ], pHOVER, pFOCUS, self);
return _wdh;
});
function onResize() {
var pd = in_dialog? ui(2) : ui(8);
sc_content.resize(w - pd * 2, h - pd * 2);
}
function drawContent(panel) { function drawContent(panel) {
draw_clear_alpha(COLORS.panel_bg_clear, 0); draw_clear_alpha(COLORS.panel_bg_clear, 0);
var pd = in_dialog? ui(0) : ui(8); var pd = in_dialog? ui(2) : ui(8);
inspector.panel = self; inspector.panel = self;
inspector.rx = x; inspector.rx = x + pd;
inspector.ry = y; inspector.ry = y + pd;
inspector.fixHeight = h - pd * 2; inspector.fixHeight = sc_content.surface_h;
var _wdh = inspector.draw(pd, pd, w - pd * 2, [ mx, my ], pHOVER, pFOCUS, self); sc_content.setFocusHover(pFOCUS, pHOVER);
sc_content.draw(pd, pd, mx - pd, my - pd);
} }
static onClose = function() { static onClose = function() {

View file

@ -609,6 +609,7 @@ function Panel_Inspector() : PanelContent() constructor {
var wx1 = con_w - ui(8); var wx1 = con_w - ui(8);
var ww = max(ui(180), con_w / 3); var ww = max(ui(180), con_w / 3);
var wx0 = wx1 - ww; var wx0 = wx1 - ww;
var font = viewMode == INSP_VIEW_MODE.spacious? f_p1 : f_p2;
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];
@ -633,28 +634,33 @@ function Panel_Inspector() : PanelContent() constructor {
var _att_name = edt[0]; var _att_name = edt[0];
var _att_val = edt[1](); var _att_val = edt[1]();
var _att_wid = edt[2]; var _att_wid = edt[2];
var _att_h = viewMode == INSP_VIEW_MODE.spacious? hg : line_get_height(font, 8);
_att_wid.font = font;
_att_wid.setFocusHover(pFOCUS, pHOVER); _att_wid.setFocusHover(pFOCUS, pHOVER);
if(instanceof(_att_wid) == "buttonClass") { if(instanceof(_att_wid) == "buttonClass") {
_att_wid.text = _att_name; _att_wid.text = _att_name;
_att_wid.draw(ui(8), yy, con_w - ui(16), hg, _m); _att_wid.draw(ui(8), yy, con_w - ui(16), _att_h, _m);
if(_att_wid.inBBOX(_m)) contentPane.hover_content = true; if(_att_wid.inBBOX(_m)) contentPane.hover_content = true;
yy += hg + ui(8); yy += _att_h + ui(8);
hh += hg + ui(8); hh += _att_h + ui(8);
continue; continue;
} }
draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text); draw_set_text(font, fa_left, fa_center, COLORS._main_text);
draw_text_add(ui(8), yy + hg / 2, _att_name); draw_text_add(ui(8), yy + _att_h / 2, _att_name);
var _param = new widgetParam(wx0, yy, ww, hg, _att_val, {}, _m, x + contentPane.x, y + contentPane.y); var _param = new widgetParam(wx0, yy, ww, _att_h, _att_val, {}, _m, x + contentPane.x, y + contentPane.y);
_param.s = hg; _param.s = _att_h;
_param.font = font;
var _wh = _att_wid.drawParam(_param); var _wh = _att_wid.drawParam(_param);
var _hg = max(hg, _wh);
if(_att_wid.inBBOX(_m)) contentPane.hover_content = true; if(_att_wid.inBBOX(_m)) contentPane.hover_content = true;
var _hg = max(_att_h, _wh);
yy += _hg + ui(8); yy += _hg + ui(8);
hh += _hg + ui(8); hh += _hg + ui(8);
} }
@ -701,7 +707,9 @@ function Panel_Inspector() : PanelContent() constructor {
var jun = noone; var jun = noone;
var amoIn = is_array(_inspecting.input_display_list)? array_length(_inspecting.input_display_list) : array_length(_inspecting.inputs); var amoIn = is_array(_inspecting.input_display_list)? array_length(_inspecting.input_display_list) : array_length(_inspecting.inputs);
var amoOut = is_array(_inspecting.output_display_list)? array_length(_inspecting.output_display_list) : array_length(_inspecting.outputs); var amoOut = is_array(_inspecting.output_display_list)? array_length(_inspecting.output_display_list) : array_length(_inspecting.outputs);
var amo = inspectGroup == 0? amoIn + 1 + amoOut : amoIn; var amoMeta = _inspecting.attributes.outp_meta? array_length(_inspecting.junc_meta) : 0;
var amo = inspectGroup == 0? amoIn + 1 + amoOut + amoMeta : amoIn;
var color_picker_index = 0; var color_picker_index = 0;
var pickers = []; var pickers = [];
@ -726,7 +734,7 @@ function Panel_Inspector() : PanelContent() constructor {
draw_text_add(xc, yy + ui(8 + 16), __txt("Outputs")); draw_text_add(xc, yy + ui(8 + 16), __txt("Outputs"));
continue; continue;
} else { // outputs } else if(i < amoIn + 1 + amoOut) { // outputs
var _oi = i - amoIn - 1; var _oi = i - amoIn - 1;
var _dsl = _inspecting.output_display_list; var _dsl = _inspecting.output_display_list;
var _dsp = array_safe_get_fast(_dsl, _oi); var _dsp = array_safe_get_fast(_dsl, _oi);
@ -734,7 +742,11 @@ function Panel_Inspector() : PanelContent() constructor {
if(!is_array(_dsl)) jun = array_safe_get_fast(_inspecting.outputs, _oi); if(!is_array(_dsl)) jun = array_safe_get_fast(_inspecting.outputs, _oi);
else if(is_real(_dsp)) jun = array_safe_get_fast(_inspecting.outputs, _dsp); else if(is_real(_dsp)) jun = array_safe_get_fast(_inspecting.outputs, _dsp);
else jun = _dsp; else jun = _dsp;
}
} else { // metadata
jun = _inspecting.junc_meta[i - (amoIn + 1 + amoOut)];
}
if(is_instanceof(jun, Inspector_Spacer)) { // SPACER if(is_instanceof(jun, Inspector_Spacer)) { // SPACER
var _hh = ui(jun.h); var _hh = ui(jun.h);