This commit is contained in:
Tanasart 2024-11-07 13:59:04 +07:00
parent e3a03ca6ca
commit ca8c746321
153 changed files with 734 additions and 616 deletions

View file

@ -234,6 +234,7 @@
{"name":"widget","order":10,"path":"folders/theme/widget.yy",}, {"name":"widget","order":10,"path":"folders/theme/widget.yy",},
{"name":"VCT","order":154,"path":"folders/VCT.yy",}, {"name":"VCT","order":154,"path":"folders/VCT.yy",},
{"name":"widgets","order":155,"path":"folders/widgets.yy",}, {"name":"widgets","order":155,"path":"folders/widgets.yy",},
{"name":"object","order":18,"path":"folders/widgets/object.yy",},
], ],
"ResourceOrderSettings":[ "ResourceOrderSettings":[
{"name":"ac_disappear","order":2,"path":"animcurves/ac_disappear/ac_disappear.yy",}, {"name":"ac_disappear","order":2,"path":"animcurves/ac_disappear/ac_disappear.yy",},
@ -437,6 +438,7 @@
{"name":"area_function","order":2,"path":"scripts/area_function/area_function.yy",}, {"name":"area_function","order":2,"path":"scripts/area_function/area_function.yy",},
{"name":"areaBox","order":13,"path":"scripts/areaBox/areaBox.yy",}, {"name":"areaBox","order":13,"path":"scripts/areaBox/areaBox.yy",},
{"name":"argumentRenderer","order":2,"path":"scripts/argumentRenderer/argumentRenderer.yy",}, {"name":"argumentRenderer","order":2,"path":"scripts/argumentRenderer/argumentRenderer.yy",},
{"name":"armatureBox","order":2,"path":"scripts/armatureBox/armatureBox.yy",},
{"name":"array_functions","order":2,"path":"scripts/array_functions/array_functions.yy",}, {"name":"array_functions","order":2,"path":"scripts/array_functions/array_functions.yy",},
{"name":"ase_object","order":7,"path":"scripts/ase_object/ase_object.yy",}, {"name":"ase_object","order":7,"path":"scripts/ase_object/ase_object.yy",},
{"name":"ase_reader","order":1,"path":"scripts/ase_reader/ase_reader.yy",}, {"name":"ase_reader","order":1,"path":"scripts/ase_reader/ase_reader.yy",},
@ -1340,7 +1342,6 @@
{"name":"path_reader","order":5,"path":"scripts/path_reader/path_reader.yy",}, {"name":"path_reader","order":5,"path":"scripts/path_reader/path_reader.yy",},
{"name":"pathAnchorBox","order":17,"path":"scripts/pathAnchorBox/pathAnchorBox.yy",}, {"name":"pathAnchorBox","order":17,"path":"scripts/pathAnchorBox/pathAnchorBox.yy",},
{"name":"pathArrayBox","order":12,"path":"scripts/pathArrayBox/pathArrayBox.yy",}, {"name":"pathArrayBox","order":12,"path":"scripts/pathArrayBox/pathArrayBox.yy",},
{"name":"pathnodeBox","order":17,"path":"scripts/pathnodeBox/pathnodeBox.yy",},
{"name":"pcx_parse","order":3,"path":"scripts/pcx_parse/pcx_parse.yy",}, {"name":"pcx_parse","order":3,"path":"scripts/pcx_parse/pcx_parse.yy",},
{"name":"pcx_server","order":2,"path":"scripts/pcx_server/pcx_server.yy",}, {"name":"pcx_server","order":2,"path":"scripts/pcx_server/pcx_server.yy",},
{"name":"perlin_noise","order":5,"path":"scripts/perlin_noise/perlin_noise.yy",}, {"name":"perlin_noise","order":5,"path":"scripts/perlin_noise/perlin_noise.yy",},
@ -1403,7 +1404,7 @@
{"name":"tiler_tool_fill","order":3,"path":"scripts/tiler_tool_fill/tiler_tool_fill.yy",}, {"name":"tiler_tool_fill","order":3,"path":"scripts/tiler_tool_fill/tiler_tool_fill.yy",},
{"name":"tiler_tool_selection_shape","order":6,"path":"scripts/tiler_tool_selection_shape/tiler_tool_selection_shape.yy",}, {"name":"tiler_tool_selection_shape","order":6,"path":"scripts/tiler_tool_selection_shape/tiler_tool_selection_shape.yy",},
{"name":"tiler_tool_selection","order":5,"path":"scripts/tiler_tool_selection/tiler_tool_selection.yy",}, {"name":"tiler_tool_selection","order":5,"path":"scripts/tiler_tool_selection/tiler_tool_selection.yy",},
{"name":"tilesetBox","order":16,"path":"scripts/tilesetBox/tilesetBox.yy",}, {"name":"tilesetBox","order":1,"path":"scripts/tilesetBox/tilesetBox.yy",},
{"name":"time_source","order":25,"path":"scripts/time_source/time_source.yy",}, {"name":"time_source","order":25,"path":"scripts/time_source/time_source.yy",},
{"name":"timeline_data","order":18,"path":"scripts/timeline_data/timeline_data.yy",}, {"name":"timeline_data","order":18,"path":"scripts/timeline_data/timeline_data.yy",},
{"name":"toggleGroup","order":7,"path":"scripts/toggleGroup/toggleGroup.yy",}, {"name":"toggleGroup","order":7,"path":"scripts/toggleGroup/toggleGroup.yy",},
@ -1866,6 +1867,7 @@
{"name":"s_bone_tool_detach","order":5,"path":"sprites/s_bone_tool_detach/s_bone_tool_detach.yy",}, {"name":"s_bone_tool_detach","order":5,"path":"sprites/s_bone_tool_detach/s_bone_tool_detach.yy",},
{"name":"s_bone_tool_IK","order":6,"path":"sprites/s_bone_tool_IK/s_bone_tool_IK.yy",}, {"name":"s_bone_tool_IK","order":6,"path":"sprites/s_bone_tool_IK/s_bone_tool_IK.yy",},
{"name":"s_bone_tool_move","order":7,"path":"sprites/s_bone_tool_move/s_bone_tool_move.yy",}, {"name":"s_bone_tool_move","order":7,"path":"sprites/s_bone_tool_move/s_bone_tool_move.yy",},
{"name":"s_bone_tool_pose","order":69,"path":"sprites/s_bone_tool_pose/s_bone_tool_pose.yy",},
{"name":"s_bone_tool_remove","order":8,"path":"sprites/s_bone_tool_remove/s_bone_tool_remove.yy",}, {"name":"s_bone_tool_remove","order":8,"path":"sprites/s_bone_tool_remove/s_bone_tool_remove.yy",},
{"name":"s_bone_tool_scale","order":9,"path":"sprites/s_bone_tool_scale/s_bone_tool_scale.yy",}, {"name":"s_bone_tool_scale","order":9,"path":"sprites/s_bone_tool_scale/s_bone_tool_scale.yy",},
{"name":"s_bone_tool_transform","order":10,"path":"sprites/s_bone_tool_transform/s_bone_tool_transform.yy",}, {"name":"s_bone_tool_transform","order":10,"path":"sprites/s_bone_tool_transform/s_bone_tool_transform.yy",},

View file

@ -354,6 +354,7 @@
{"$GMFolder":"","%Name":"widget","folderPath":"folders/VCT/widget.yy","name":"widget","resourceType":"GMFolder","resourceVersion":"2.0",}, {"$GMFolder":"","%Name":"widget","folderPath":"folders/VCT/widget.yy","name":"widget","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"widgets","folderPath":"folders/widgets.yy","name":"widgets","resourceType":"GMFolder","resourceVersion":"2.0",}, {"$GMFolder":"","%Name":"widgets","folderPath":"folders/widgets.yy","name":"widgets","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"button","folderPath":"folders/widgets/button.yy","name":"button","resourceType":"GMFolder","resourceVersion":"2.0",}, {"$GMFolder":"","%Name":"button","folderPath":"folders/widgets/button.yy","name":"button","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"object","folderPath":"folders/widgets/object.yy","name":"object","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"rotator","folderPath":"folders/widgets/rotator.yy","name":"rotator","resourceType":"GMFolder","resourceVersion":"2.0",}, {"$GMFolder":"","%Name":"rotator","folderPath":"folders/widgets/rotator.yy","name":"rotator","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"sliders","folderPath":"folders/widgets/sliders.yy","name":"sliders","resourceType":"GMFolder","resourceVersion":"2.0",}, {"$GMFolder":"","%Name":"sliders","folderPath":"folders/widgets/sliders.yy","name":"sliders","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"text","folderPath":"folders/widgets/text.yy","name":"text","resourceType":"GMFolder","resourceVersion":"2.0",}, {"$GMFolder":"","%Name":"text","folderPath":"folders/widgets/text.yy","name":"text","resourceType":"GMFolder","resourceVersion":"2.0",},
@ -935,6 +936,7 @@
{"id":{"name":"area_function","path":"scripts/area_function/area_function.yy",},}, {"id":{"name":"area_function","path":"scripts/area_function/area_function.yy",},},
{"id":{"name":"areaBox","path":"scripts/areaBox/areaBox.yy",},}, {"id":{"name":"areaBox","path":"scripts/areaBox/areaBox.yy",},},
{"id":{"name":"argumentRenderer","path":"scripts/argumentRenderer/argumentRenderer.yy",},}, {"id":{"name":"argumentRenderer","path":"scripts/argumentRenderer/argumentRenderer.yy",},},
{"id":{"name":"armatureBox","path":"scripts/armatureBox/armatureBox.yy",},},
{"id":{"name":"array_functions","path":"scripts/array_functions/array_functions.yy",},}, {"id":{"name":"array_functions","path":"scripts/array_functions/array_functions.yy",},},
{"id":{"name":"ase_object","path":"scripts/ase_object/ase_object.yy",},}, {"id":{"name":"ase_object","path":"scripts/ase_object/ase_object.yy",},},
{"id":{"name":"ase_reader","path":"scripts/ase_reader/ase_reader.yy",},}, {"id":{"name":"ase_reader","path":"scripts/ase_reader/ase_reader.yy",},},
@ -2584,6 +2586,7 @@
{"id":{"name":"s_bone_tool_detach","path":"sprites/s_bone_tool_detach/s_bone_tool_detach.yy",},}, {"id":{"name":"s_bone_tool_detach","path":"sprites/s_bone_tool_detach/s_bone_tool_detach.yy",},},
{"id":{"name":"s_bone_tool_IK","path":"sprites/s_bone_tool_IK/s_bone_tool_IK.yy",},}, {"id":{"name":"s_bone_tool_IK","path":"sprites/s_bone_tool_IK/s_bone_tool_IK.yy",},},
{"id":{"name":"s_bone_tool_move","path":"sprites/s_bone_tool_move/s_bone_tool_move.yy",},}, {"id":{"name":"s_bone_tool_move","path":"sprites/s_bone_tool_move/s_bone_tool_move.yy",},},
{"id":{"name":"s_bone_tool_pose","path":"sprites/s_bone_tool_pose/s_bone_tool_pose.yy",},},
{"id":{"name":"s_bone_tool_remove","path":"sprites/s_bone_tool_remove/s_bone_tool_remove.yy",},}, {"id":{"name":"s_bone_tool_remove","path":"sprites/s_bone_tool_remove/s_bone_tool_remove.yy",},},
{"id":{"name":"s_bone_tool_scale","path":"sprites/s_bone_tool_scale/s_bone_tool_scale.yy",},}, {"id":{"name":"s_bone_tool_scale","path":"sprites/s_bone_tool_scale/s_bone_tool_scale.yy",},},
{"id":{"name":"s_bone_tool_transform","path":"sprites/s_bone_tool_transform/s_bone_tool_transform.yy",},}, {"id":{"name":"s_bone_tool_transform","path":"sprites/s_bone_tool_transform/s_bone_tool_transform.yy",},},

Binary file not shown.

View file

@ -46,20 +46,20 @@ function __Bone(parent = noone, distance = 0, direction = 0, angle = 0, length =
direction = parent.angle; direction = parent.angle;
} }
static addChild = function(bone) { #region static addChild = function(bone) {
array_push(childs, bone); array_push(childs, bone);
bone.parent = self; bone.parent = self;
return self; return self;
} #endregion }
static childCount = function() { #region static childCount = function() {
var amo = array_length(childs); var amo = array_length(childs);
for( var i = 0, n = array_length(childs); i < n; i++ ) for( var i = 0, n = array_length(childs); i < n; i++ )
amo += childs[i].childCount(); amo += childs[i].childCount();
return amo; return amo;
} #endregion }
static freeze = function() { #region static freeze = function() {
freeze_data = { freeze_data = {
angle: angle, angle: angle,
length: length, length: length,
@ -69,9 +69,9 @@ function __Bone(parent = noone, distance = 0, direction = 0, angle = 0, length =
for( var i = 0, n = array_length(childs); i < n; i++ ) for( var i = 0, n = array_length(childs); i < n; i++ )
childs[i].freeze(); childs[i].freeze();
} #endregion }
static findBone = function(_id) { #region static findBone = function(_id) {
if(ID == _id) if(ID == _id)
return self; return self;
@ -82,9 +82,9 @@ function __Bone(parent = noone, distance = 0, direction = 0, angle = 0, length =
} }
return noone; return noone;
} #endregion }
static findBoneByName = function(_name) { #region static findBoneByName = function(_name) {
//print($"Print {string_length(string_trim(name))} : {string_length(string_trim(_name))}"); //print($"Print {string_length(string_trim(name))} : {string_length(string_trim(_name))}");
if(string_trim(name) == string_trim(_name)) if(string_trim(name) == string_trim(_name))
return self; return self;
@ -96,9 +96,9 @@ function __Bone(parent = noone, distance = 0, direction = 0, angle = 0, length =
} }
return noone; return noone;
} #endregion }
static getPoint = function(progress, pose = true) { #region static getPoint = function(progress, pose = true) {
var _len = pose? length : init_length; var _len = pose? length : init_length;
var _ang = pose? angle : init_angle; var _ang = pose? angle : init_angle;
@ -118,18 +118,18 @@ function __Bone(parent = noone, distance = 0, direction = 0, angle = 0, length =
.addElement(lengthdir_x(distance, direction), lengthdir_y(distance, direction)) .addElement(lengthdir_x(distance, direction), lengthdir_y(distance, direction))
.addElement(lengthdir_x(len, _ang), lengthdir_y(len, _ang)) .addElement(lengthdir_x(len, _ang), lengthdir_y(len, _ang))
return p; return p;
} #endregion }
static draw = function(attributes, edit = false, _x = 0, _y = 0, _s = 1, _mx = 0, _my = 0, hovering = noone, selecting = noone) { #region static draw = function(attributes, edit = false, _x = 0, _y = 0, _s = 1, _mx = 0, _my = 0, hovering = noone, selecting = noone) {
var hover = _drawBone(attributes, edit, _x, _y, _s, _mx, _my, hovering, selecting); var hover = _drawBone(attributes, edit, _x, _y, _s, _mx, _my, hovering, selecting);
drawControl(attributes); drawControl(attributes);
return hover; return hover;
} #endregion }
control_x0 = 0; control_y0 = 0; control_i0 = 0; control_x0 = 0; control_y0 = 0; control_i0 = 0;
control_x1 = 0; control_y1 = 0; control_i1 = 0; control_x1 = 0; control_y1 = 0; control_i1 = 0;
static _drawBone = function(attributes, edit = false, _x = 0, _y = 0, _s = 1, _mx = 0, _my = 0, hovering = noone, selecting = noone) { #region static _drawBone = function(attributes, edit = false, _x = 0, _y = 0, _s = 1, _mx = 0, _my = 0, hovering = noone, selecting = noone) {
var hover = noone; var hover = noone;
var p0 = getPoint(0); var p0 = getPoint(0);
@ -166,11 +166,31 @@ function __Bone(parent = noone, distance = 0, direction = 0, angle = 0, length =
if(attributes.display_bone == 0) { if(attributes.display_bone == 0) {
var _ppx = lerp(p0.x, p1.x, 0.2); var _ppx = lerp(p0.x, p1.x, 0.2);
var _ppy = lerp(p0.y, p1.y, 0.2); var _ppy = lerp(p0.y, p1.y, 0.2);
draw_line_width2(p0.x, p0.y, _ppx, _ppy, 2 * pose_scale, 12 * pose_scale); var _prr = point_direction(p0.x, p0.y, p1.x, p1.y) + 90;
draw_line_width2(_ppx, _ppy, p1.x, p1.y, 12 * pose_scale, 2 * pose_scale); var _prx = lengthdir_x(6 * pose_scale, _prr);
var _pry = lengthdir_y(6 * pose_scale, _prr);
draw_primitive_begin(pr_trianglelist);
draw_vertex(p0.x, p0.y);
draw_vertex(_ppx, _ppy);
draw_vertex(_ppx + _prx, _ppy + _pry);
draw_vertex(p0.x, p0.y);
draw_vertex(_ppx, _ppy);
draw_vertex(_ppx - _prx, _ppy - _pry);
draw_vertex(p1.x, p1.y);
draw_vertex(_ppx, _ppy);
draw_vertex(_ppx + _prx, _ppy + _pry);
draw_vertex(p1.x, p1.y);
draw_vertex(_ppx, _ppy);
draw_vertex(_ppx - _prx, _ppy - _pry);
draw_primitive_end();
if((edit & 0b100) && distance_to_line(_mx, _my, p0.x, p0.y, p1.x, p1.y) <= 12) //drag bone if((edit & 0b100) && distance_to_line(_mx, _my, p0.x, p0.y, p1.x, p1.y) <= 12) //drag bone
hover = [ self, 2, p0 ]; hover = [ self, 2, p0 ];
} else if(attributes.display_bone == 1) { } else if(attributes.display_bone == 1) {
draw_line_width(p0.x, p0.y, p1.x, p1.y, 3); draw_line_width(p0.x, p0.y, p1.x, p1.y, 3);
@ -225,9 +245,9 @@ function __Bone(parent = noone, distance = 0, direction = 0, angle = 0, length =
} }
return hover; return hover;
} #endregion }
static drawControl = function(attributes) { #region static drawControl = function(attributes) {
if(parent != noone && IKlength == 0) { if(parent != noone && IKlength == 0) {
var spr, ind0, ind1; var spr, ind0, ind1;
if(attributes.display_bone == 0) { if(attributes.display_bone == 0) {
@ -243,23 +263,23 @@ function __Bone(parent = noone, distance = 0, direction = 0, angle = 0, length =
for( var i = 0, n = array_length(childs); i < n; i++ ) for( var i = 0, n = array_length(childs); i < n; i++ )
childs[i].drawControl(attributes); childs[i].drawControl(attributes);
} #endregion }
static resetPose = function() { #region static resetPose = function() {
pose_angle = 0; pose_angle = 0;
pose_scale = 1; pose_scale = 1;
pose_posit = [ 0, 0 ]; pose_posit = [ 0, 0 ];
for( var i = 0, n = array_length(childs); i < n; i++ ) for( var i = 0, n = array_length(childs); i < n; i++ )
childs[i].resetPose(); childs[i].resetPose();
} #endregion }
static setPose = function(_position = [ 0, 0 ], _angle = 0, _scale = 1) { #region static setPose = function(_position = [ 0, 0 ], _angle = 0, _scale = 1) {
setPoseTransform(_position, _angle, _scale); setPoseTransform(_position, _angle, _scale);
setIKconstrain(); setIKconstrain();
} #endregion }
static setPoseTransform = function(_position = [ 0, 0 ], _angle = 0, _scale = 1) { #region static setPoseTransform = function(_position = [ 0, 0 ], _angle = 0, _scale = 1) {
if(is_main) { if(is_main) {
for( var i = 0, n = array_length(childs); i < n; i++ ) for( var i = 0, n = array_length(childs); i < n; i++ )
childs[i].setPoseTransform(_position, _angle, _scale); childs[i].setPoseTransform(_position, _angle, _scale);
@ -288,9 +308,9 @@ function __Bone(parent = noone, distance = 0, direction = 0, angle = 0, length =
for( var i = 0, n = array_length(childs); i < n; i++ ) for( var i = 0, n = array_length(childs); i < n; i++ )
childs[i].setPoseTransform(_position, pose_angle, pose_scale); childs[i].setPoseTransform(_position, pose_angle, pose_scale);
} #endregion }
static setIKconstrain = function() { #region static setIKconstrain = function() {
if(IKlength > 0 && IKTarget != noone) { if(IKlength > 0 && IKTarget != noone) {
var points = array_create(IKlength + 1); var points = array_create(IKlength + 1);
var lengths = array_create(IKlength); var lengths = array_create(IKlength);
@ -329,10 +349,10 @@ function __Bone(parent = noone, distance = 0, direction = 0, angle = 0, length =
for( var i = 0, n = array_length(childs); i < n; i++ ) for( var i = 0, n = array_length(childs); i < n; i++ )
childs[i].setIKconstrain(); childs[i].setIKconstrain();
} #endregion }
FABRIK_result = []; FABRIK_result = [];
static FABRIK = function(bones, points, lengths, dx, dy) { #region static FABRIK = function(bones, points, lengths, dx, dy) {
var threshold = 0.01; var threshold = 0.01;
var _bo = array_create(array_length(points)); var _bo = array_create(array_length(points));
for( var i = 0, n = array_length(points); i < n; i++ ) for( var i = 0, n = array_length(points); i < n; i++ )
@ -368,9 +388,9 @@ function __Bone(parent = noone, distance = 0, direction = 0, angle = 0, length =
} }
FABRIK_result[i] = p1; FABRIK_result[i] = p1;
} #endregion }
static FABRIK_backward = function(points, lengths, dx, dy) { #region static FABRIK_backward = function(points, lengths, dx, dy) {
var tx = dx; var tx = dx;
var ty = dy; var ty = dy;
@ -389,9 +409,9 @@ function __Bone(parent = noone, distance = 0, direction = 0, angle = 0, length =
tx = p0.x; tx = p0.x;
ty = p0.y; ty = p0.y;
} }
} #endregion }
static FABRIK_forward = function(points, lengths, sx, sy) { #region static FABRIK_forward = function(points, lengths, sx, sy) {
var tx = sx; var tx = sx;
var ty = sy; var ty = sy;
@ -410,9 +430,9 @@ function __Bone(parent = noone, distance = 0, direction = 0, angle = 0, length =
tx = p1.x; tx = p1.x;
ty = p1.y; ty = p1.y;
} }
} #endregion }
static __getBBOX = function() { #region static __getBBOX = function() {
var p0 = getPoint(0); var p0 = getPoint(0);
var p1 = getPoint(1); var p1 = getPoint(1);
@ -422,9 +442,9 @@ function __Bone(parent = noone, distance = 0, direction = 0, angle = 0, length =
var y1 = max(p0.y, p1.y); var y1 = max(p0.y, p1.y);
return [ x0, y0, x1, y1 ]; return [ x0, y0, x1, y1 ];
} #endregion }
static bbox = function() { #region static bbox = function() {
var _bbox = __getBBOX(); var _bbox = __getBBOX();
//print($"BBOX: {_bbox}") //print($"BBOX: {_bbox}")
@ -439,9 +459,9 @@ function __Bone(parent = noone, distance = 0, direction = 0, angle = 0, length =
} }
return _bbox; return _bbox;
} #endregion }
static serialize = function() { #region static serialize = function() {
var bone = {}; var bone = {};
bone.ID = ID; bone.ID = ID;
@ -465,9 +485,9 @@ function __Bone(parent = noone, distance = 0, direction = 0, angle = 0, length =
bone.childs[i] = childs[i].serialize(); bone.childs[i] = childs[i].serialize();
return bone; return bone;
} #endregion }
static deserialize = function(bone, node) { #region static deserialize = function(bone, node) {
ID = bone.ID; ID = bone.ID;
name = bone.name; name = bone.name;
distance = bone.distance; distance = bone.distance;
@ -493,18 +513,18 @@ function __Bone(parent = noone, distance = 0, direction = 0, angle = 0, length =
} }
return self; return self;
} #endregion }
static connect = function() { #region static connect = function() {
IKTarget = noone; IKTarget = noone;
if(parent != noone && IKTargetID != "") if(parent != noone && IKTargetID != "")
IKTarget = parent.findBone(IKTargetID); IKTarget = parent.findBone(IKTargetID);
for( var i = 0, n = array_length(childs); i < n; i++ ) for( var i = 0, n = array_length(childs); i < n; i++ )
childs[i].connect(); childs[i].connect();
} #endregion }
static clone = function() { #region static clone = function() {
var _b = new __Bone(parent, distance, direction, angle, length); var _b = new __Bone(parent, distance, direction, angle, length);
_b.ID = ID; _b.ID = ID;
_b.name = name; _b.name = name;
@ -521,7 +541,7 @@ function __Bone(parent = noone, distance = 0, direction = 0, angle = 0, length =
_b.addChild(childs[i].clone()); _b.addChild(childs[i].clone());
return _b; return _b;
} #endregion }
static toString = function() { return $"Bone {name} [{ID}]"; } static toString = function() { return $"Bone {name} [{ID}]"; }
} }

View file

@ -50,10 +50,7 @@ function Node_3D_Object(_x, _y, _group = noone) : Node_3D(_x, _y, _group) constr
tool_pos = new NodeTool( "Transform", THEME.tools_3d_transform, "Node_3D_Object" ); tool_pos = new NodeTool( "Transform", THEME.tools_3d_transform, "Node_3D_Object" );
tool_rot = new NodeTool( "Rotate", THEME.tools_3d_rotate, "Node_3D_Object" ); tool_rot = new NodeTool( "Rotate", THEME.tools_3d_rotate, "Node_3D_Object" );
tool_sca = new NodeTool( "Scale", THEME.tools_3d_scale, "Node_3D_Object" ); tool_sca = new NodeTool( "Scale", THEME.tools_3d_scale, "Node_3D_Object" );
tools = [ tool_pos, tool_rot, tool_sca ];
tool_euler = [ tool_pos, tool_sca ];
tool_quate = [ tool_pos, tool_rot, tool_sca ];
tools = tool_quate;
tool_axis_edit = new scrollBox([ "local", "global" ], function(val) { tool_attribute.context = val; }); tool_axis_edit = new scrollBox([ "local", "global" ], function(val) { tool_attribute.context = val; });
tool_attribute.context = 0; tool_attribute.context = 0;
@ -198,7 +195,7 @@ function Node_3D_Object(_x, _y, _group = noone) : Node_3D(_x, _y, _group) constr
axis_hover = _hover; axis_hover = _hover;
#endregion display #endregion display
if(drag_axis != noone) { #region editing if(drag_axis != noone) { // editing
if(!MOUSE_WRAPPING) { if(!MOUSE_WRAPPING) {
drag_mx += _mx - drag_px; drag_mx += _mx - drag_px;
drag_my += _my - drag_py; drag_my += _my - drag_py;
@ -263,9 +260,9 @@ function Node_3D_Object(_x, _y, _group = noone) : Node_3D(_x, _y, _group) constr
setMouseWrap(); setMouseWrap();
drag_px = _mx; drag_px = _mx;
drag_py = _my; drag_py = _my;
} #endregion }
if(_hover != noone && mouse_press(mb_left, active)) { #region if(_hover != noone && mouse_press(mb_left, active)) {
drag_axis = _hover; drag_axis = _hover;
drag_prev = undefined; drag_prev = undefined;
drag_mx = _mx; drag_mx = _mx;
@ -277,7 +274,7 @@ function Node_3D_Object(_x, _y, _group = noone) : Node_3D(_x, _y, _group) constr
drag_val = _pos; drag_val = _pos;
drag_original = new __vec3(_pos); drag_original = new __vec3(_pos);
} #endregion }
} }
static drawGizmoRotation = function(index, object, _vpos, active, params, _mx, _my, _snx, _sny, _panel) { static drawGizmoRotation = function(index, object, _vpos, active, params, _mx, _my, _snx, _sny, _panel) {
@ -290,7 +287,8 @@ function Node_3D_Object(_x, _y, _group = noone) : Node_3D(_x, _y, _group) constr
var _qview = new BBMOD_Quaternion().FromEuler(_camera.focus_angle_y, -_camera.focus_angle_x, 0); var _qview = new BBMOD_Quaternion().FromEuler(_camera.focus_angle_y, -_camera.focus_angle_x, 0);
var _ang = inputs[index].display_data.angle_display; var _ang = inputs[index].display_data.angle_display;
var _global = _ang == QUARTERNION_DISPLAY.quarterion? tool_attribute.context : 1; var _quat = _ang == QUARTERNION_DISPLAY.quarterion;
var _global = _quat? tool_attribute.context : 1;
var _hover = noone; var _hover = noone;
var _hoverDist = 10; var _hoverDist = 10;
@ -322,8 +320,8 @@ function Node_3D_Object(_x, _y, _group = noone) : Node_3D(_x, _y, _group) constr
switch(i) { switch(i) {
case 0 : np = new BBMOD_Vec3(0, lengthdir_x(size, ang), lengthdir_y(size, ang)); break; case 0 : np = new BBMOD_Vec3(0, lengthdir_x(size, ang), lengthdir_y(size, ang)); break;
case 1 : np = new BBMOD_Vec3(lengthdir_x(size, ang), lengthdir_y(size, ang), 0); break; case 1 : np = new BBMOD_Vec3(lengthdir_x(size, ang), 0, lengthdir_y(size, ang)); break;
case 2 : np = new BBMOD_Vec3(lengthdir_x(size, ang), 0, lengthdir_y(size, ang)); break; case 2 : np = new BBMOD_Vec3(lengthdir_x(size, ang), lengthdir_y(size, ang), 0); break;
} }
if(_global) np = _qview.Rotate(_qinv.Rotate(np)); if(_global) np = _qview.Rotate(_qinv.Rotate(np));
@ -344,51 +342,77 @@ function Node_3D_Object(_x, _y, _group = noone) : Node_3D(_x, _y, _group) constr
axis_hover = _hover; axis_hover = _hover;
#endregion #endregion
if(drag_axis != noone) { #region if(_quat) {
var mAng = point_direction(cx, cy, _mx, _my); if(drag_axis != noone) {
var mAng = point_direction(cx, cy, _mx, _my);
if(drag_rot_axis == undefined) {
drag_rot_axis = BBMOD_VEC3_FORWARD;
switch(drag_axis) { if(drag_rot_axis == undefined) {
case 0 : drag_rot_axis = new BBMOD_Vec3(-1, 0, 0); break; drag_rot_axis = BBMOD_VEC3_FORWARD;
case 1 : drag_rot_axis = new BBMOD_Vec3( 0, 0, -1); break;
case 2 : drag_rot_axis = new BBMOD_Vec3( 0, -1, 0); break; switch(drag_axis) {
case 0 : drag_rot_axis = new BBMOD_Vec3(-1, 0, 0); break;
case 1 : drag_rot_axis = new BBMOD_Vec3( 0, -1, 0); break;
case 2 : drag_rot_axis = new BBMOD_Vec3( 0, 0, -1); break;
}
if(!_global) drag_rot_axis = _qrot.Rotate(drag_rot_axis).Normalize();
} }
if(!_global) drag_rot_axis = _qrot.Rotate(drag_rot_axis).Normalize(); var _nv = _qview.Rotate(_qinv.Rotate(drag_rot_axis));
draw_line_round(cx, cy, cx + _nv.X * 100, cy + _nv.Y * 100, 2);
if(drag_prev != undefined) {
var _rd = (mAng - drag_prev) * (_nv.Z > 0? 1 : -1);
drag_dist += _rd;
var _dist = value_snap(drag_dist, _sny);
var _currR = new BBMOD_Quaternion().FromAxisAngle(drag_rot_axis, _dist);
var _val = _currR.Mul(drag_val);
var _Nrot = _val.ToArray();
if(inputs[index].setValue(_Nrot))
UNDO_HOLDING = true;
}
draw_set_color(COLORS._main_accent);
draw_line_dashed(cx, cy, _mx, _my, 1, 4);
drag_prev = mAng;
}
if(_hover != noone && mouse_press(mb_left, active)) {
drag_axis = _hover;
drag_prev = undefined;
drag_val = _qrot.Clone();
drag_dist = 0;
drag_rot_axis = undefined;
} }
var _nv = _qview.Rotate(_qinv.Rotate(drag_rot_axis)); } else {
draw_line_round(cx, cy, cx + _nv.X * 100, cy + _nv.Y * 100, 2); if(drag_axis != noone) {
var mAng = point_direction(cx, cy, _mx, _my);
if(drag_prev != undefined) { if(drag_prev != undefined) {
var _rd = (mAng - drag_prev) * (_nv.Z > 0? 1 : -1); drag_dist += drag_prev - mAng;
drag_dist += _rd;
var _dist = value_snap(drag_dist, _sny); var _Nrot = array_clone(drag_val);
_Nrot[drag_axis] += drag_dist;
if(inputs[index].setValue(_Nrot))
UNDO_HOLDING = true;
}
var _currR = new BBMOD_Quaternion().FromAxisAngle(drag_rot_axis, _dist); drag_prev = mAng;
var _val = _currR.Mul(drag_val); }
var _Nrot = _ang == QUARTERNION_DISPLAY.quarterion? _val.ToArray() : _val.ToEuler(true);
if(inputs[index].setValue(_Nrot))
UNDO_HOLDING = true;
}
draw_set_color(COLORS._main_accent);
draw_line_dashed(cx, cy, _mx, _my, 1, 4);
drag_prev = mAng;
} #endregion
if(_hover != noone && mouse_press(mb_left, active)) { #region if(_hover != noone && mouse_press(mb_left, active)) {
drag_axis = _hover; drag_axis = _hover;
drag_prev = undefined; drag_prev = undefined;
drag_val = _qrot.Clone(); drag_val = inputs[index].getValue(CURRENT_FRAME, false);
drag_dist = 0; drag_dist = 0;
}
drag_rot_axis = undefined; }
} #endregion
} }
static drawGizmoScale = function(index, object, _vpos, active, params, _mx, _my, _snx, _sny, _panel) { static drawGizmoScale = function(index, object, _vpos, active, params, _mx, _my, _snx, _sny, _panel) {
@ -507,7 +531,7 @@ function Node_3D_Object(_x, _y, _group = noone) : Node_3D(_x, _y, _group) constr
axis_hover = _hover; axis_hover = _hover;
#endregion #endregion
if(drag_axis != noone) { #region editing if(drag_axis != noone) { // editing
if(!MOUSE_WRAPPING) { if(!MOUSE_WRAPPING) {
drag_mx += _mx - drag_px; drag_mx += _mx - drag_px;
drag_my += _my - drag_py; drag_my += _my - drag_py;
@ -566,9 +590,9 @@ function Node_3D_Object(_x, _y, _group = noone) : Node_3D(_x, _y, _group) constr
setMouseWrap(); setMouseWrap();
drag_px = _mx; drag_px = _mx;
drag_py = _my; drag_py = _my;
} #endregion }
if(_hover != noone && mouse_press(mb_left, active)) { #region if(_hover != noone && mouse_press(mb_left, active)) {
drag_axis = _hover; drag_axis = _hover;
drag_prev = undefined; drag_prev = undefined;
drag_mx = _mx; drag_mx = _mx;
@ -580,15 +604,10 @@ function Node_3D_Object(_x, _y, _group = noone) : Node_3D(_x, _y, _group) constr
drag_val = [ _sca[0], _sca[1], _sca[2] ]; drag_val = [ _sca[0], _sca[1], _sca[2] ];
drag_original = new __vec3(_sca); drag_original = new __vec3(_sca);
} #endregion }
} }
static drawOverlay3D = function(active, params, _mx, _my, _snx, _sny, _panel) { static drawOverlay3D = function(active, params, _mx, _my, _snx, _sny, _panel) {
var _rot = inputs[1].display_data.angle_display;
tools = _rot == QUARTERNION_DISPLAY.quarterion? tool_quate : tool_euler;
if(_rot == QUARTERNION_DISPLAY.euler && isUsingTool("Rotate"))
PANEL_PREVIEW.tool_current = noone;
var object = getPreviewObjects(); var object = getPreviewObjects();
if(array_empty(object)) return; if(array_empty(object)) return;
object = object[0]; object = object[0];

View file

@ -44,8 +44,7 @@ function Node_VFX_effector(_x, _y, _group = noone) : Node(_x, _y, _group) constr
newInput(7, nodeValue_Vec2_Range("Scale particle", self, [ 0, 0, 0, 0 ] , { linked : true })) newInput(7, nodeValue_Vec2_Range("Scale particle", self, [ 0, 0, 0, 0 ] , { linked : true }))
.rejectArray(); .rejectArray();
newInput(8, nodeValue_Int("Seed", self, seed_random(6))) newInput(8, nodeValueSeed(self))
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[8].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) })
.rejectArray(); .rejectArray();
effector_input_length = array_length(inputs); effector_input_length = array_length(inputs);

View file

@ -74,8 +74,7 @@ function Node_VFX_Spawner_Base(_x, _y, _group = noone) : Node(_x, _y, _group) co
newInput(31, nodeValue_Surface("Atlas", self, [])) newInput(31, nodeValue_Surface("Atlas", self, []))
.setArrayDepth(1); .setArrayDepth(1);
newInput(32, nodeValue_Float("Seed", self, seed_random(6))) newInput(32, nodeValueSeed(self));
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[32].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) });
newInput(33, nodeValue_Rotation("Gravity direction", self, -90)); newInput(33, nodeValue_Rotation("Gravity direction", self, -90));

View file

@ -0,0 +1,51 @@
function armatureBox(_junction) : widget() constructor {
self.junction = _junction;
b_newTileset = button(function() /*=>*/ {
var b = nodeBuild("Node_Armature", junction.node.x - 160, junction.ry - 32);
junction.setFrom(b.outputs[0]);
});
b_newTileset.text = __txt("New armature");
b_newTileset.icon = THEME.add_16;
b_newTileset.icon_size = .75;
b_newTileset.icon_blend = COLORS._main_value_positive;
static trigger = function() { }
static drawParam = function(params) {
setParam(params);
return draw(params.x, params.y, params.w, params.data, params.m);
}
static draw = function(_x, _y, _w, _armature, _m) {
x = _x;
y = _y;
w = _w;
h = TEXTBOX_HEIGHT;
if(_armature == noone) {
b_newTileset.setFocusHover(active, hover);
var param = new widgetParam(x, y, w, h, noone, {}, _m, rx, ry);
b_newTileset.drawParam(param);
} else {
var ic = s_bone;
var iw = ui(24);
var _s = (iw - ui(8)) / max(sprite_get_width(ic), sprite_get_height(ic));
var bi = 0;
draw_sprite_stretched_ext(THEME.button_def, bi, x, y, iw, h);
draw_sprite_stretched_ext(THEME.ui_panel_bg, 1, x + iw + ui(4), y, w - iw - ui(4), h, COLORS._main_icon_light);
draw_sprite_ext(ic, 1, x + iw / 2, y + h / 2, _s, _s);
draw_set_text(f_p2, fa_left, fa_center, COLORS._main_text_sub);
draw_text_add(x + iw + ui(4 + 8), y + h / 2, "Armature");
}
return h;
}
static clone = function() { return new tilesetBox(); }
}

View file

@ -0,0 +1,13 @@
{
"$GMScript":"v1",
"%Name":"armatureBox",
"isCompatibility":false,
"isDnD":false,
"name":"armatureBox",
"parent":{
"name":"object",
"path":"folders/widgets/object.yy",
},
"resourceType":"GMScript",
"resourceVersion":"2.0",
}

View file

@ -170,6 +170,7 @@ function buttonColor(_onApply, dialog = noone) : widget() constructor {
if(_a == 1) { if(_a == 1) {
draw_sprite_stretched_ext(THEME.palette_mask, 1, _bx, _by, _bww, _bh, current_color, 1); draw_sprite_stretched_ext(THEME.palette_mask, 1, _bx, _by, _bww, _bh, current_color, 1);
} else { } else {
// draw_sprite_stretched_ext(THEME.button_def, 0, _bx, _by, _bww, _bh, boxColor, 1);
draw_sprite_stretched_ext(THEME.palette_mask, 1, _bx, _by, _bww, _bh - ui(8), current_color, 1); draw_sprite_stretched_ext(THEME.palette_mask, 1, _bx, _by, _bww, _bh - ui(8), current_color, 1);
draw_sprite_stretched_ext(THEME.palette_mask, 1, _bx, _by + _bh - ui(6), _bww, ui(6), c_black, 1); draw_sprite_stretched_ext(THEME.palette_mask, 1, _bx, _by + _bh - ui(6), _bww, ui(6), c_black, 1);
@ -190,10 +191,10 @@ function buttonColor(_onApply, dialog = noone) : widget() constructor {
return h; return h;
} }
static clone = function() { #region static clone = function() {
var cln = new buttonColor(onApply, parentDialog); var cln = new buttonColor(onApply, parentDialog);
return cln; return cln;
} #endregion }
} }
function drawColor(color, _x, _y, _w, _h, _alp = true, _ind = 1) { function drawColor(color, _x, _y, _w, _h, _alp = true, _ind = 1) {

View file

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

View file

@ -104,11 +104,6 @@ function Node_3D_Camera(_x, _y, _group = noone) : Node_3D_Object(_x, _y, _group)
} }
static drawOverlay3D = function(active, params, _mx, _my, _snx, _sny, _panel) { static drawOverlay3D = function(active, params, _mx, _my, _snx, _sny, _panel) {
var _rot = inputs[1].display_data.angle_display;
tools = _rot == QUARTERNION_DISPLAY.quarterion? tool_quate : tool_euler;
if(_rot == QUARTERNION_DISPLAY.euler && isUsingTool("Rotate"))
PANEL_PREVIEW.tool_current = noone;
var preObj = getPreviewObjects(); var preObj = getPreviewObjects();
if(array_empty(preObj)) return; if(array_empty(preObj)) return;
preObj = preObj[0]; preObj = preObj[0];

View file

@ -27,8 +27,7 @@ function Node_FLIP_Spawner(_x, _y, _group = noone) : Node(_x, _y, _group) constr
newInput(8, nodeValue_Float("Spawn Radius", self, 2 )) newInput(8, nodeValue_Float("Spawn Radius", self, 2 ))
.setDisplay(VALUE_DISPLAY.slider, { range: [1, 16, 0.1] }); .setDisplay(VALUE_DISPLAY.slider, { range: [1, 16, 0.1] });
newInput(9, nodeValue_Int("Seed", self, seed_random(6))) newInput(9, nodeValueSeed(self));
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[9].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) });
newInput(10, nodeValue_Rotation_Random("Spawn Direction", self, [ 0, 45, 135, 0, 0 ] )); newInput(10, nodeValue_Rotation_Random("Spawn Direction", self, [ 0, 45, 135, 0, 0 ] ));

View file

@ -5,22 +5,20 @@ 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) { bone_renderer = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus) {
var _b = attributes.bones; var _b = bones;
if(_b == noone) return 0; if(_b == noone) return 0;
var amo = _b.childCount(); var amo = _b.childCount();
var _hh = ui(28); var _hh = ui(28);
var bh = ui(32 + 16) + amo * _hh; var bh = ui(32 + 16) + amo * _hh;
var ty = _y; var ty = _y;
draw_set_text(f_p0, fa_left, fa_top, COLORS._main_text); draw_set_text(f_p2, fa_left, fa_top, COLORS._main_text_sub);
draw_text_add(_x + ui(16), ty + ui(4), __txt("Bones")); draw_text_add(_x + ui(16), ty + ui(4), __txt("Bones"));
ty += ui(28);
ty += ui(32);
draw_sprite_stretched_ext(THEME.ui_panel_bg, 1, _x, ty, _w, bh - ui(32), COLORS.node_composite_bg_blend, 1); draw_sprite_stretched_ext(THEME.ui_panel_bg, 1, _x, ty, _w, bh - ui(32), COLORS.node_composite_bg_blend, 1);
draw_set_color(COLORS.node_composite_separator); // draw_set_color(COLORS.node_composite_separator);
draw_line(_x + 16, ty + ui(8), _x + _w - 16, ty + ui(8)); // draw_line(_x + 16, ty + ui(8), _x + _w - 16, ty + ui(8));
ty += ui(8); ty += ui(8);
var hovering = noone; var hovering = noone;
@ -42,8 +40,10 @@ function Node_Armature(_x, _y, _group = noone) : Node(_x, _y, _group) constructo
if(bone.parent_anchor) if(bone.parent_anchor)
draw_sprite_ui(THEME.bone, 1, __x + 12, ty + 14,,,, COLORS._main_icon); draw_sprite_ui(THEME.bone, 1, __x + 12, ty + 14,,,, COLORS._main_icon);
else if(bone.IKlength) else if(bone.IKlength)
draw_sprite_ui(THEME.bone, 2, __x + 12, ty + 14,,,, COLORS._main_icon); draw_sprite_ui(THEME.bone, 2, __x + 12, ty + 14,,,, COLORS._main_icon);
else { else {
if(_hover && point_in_circle(_m[0], _m[1], __x + 12, ty + 12, 12)) { if(_hover && point_in_circle(_m[0], _m[1], __x + 12, ty + 12, 12)) {
draw_sprite_ui(THEME.bone, 0, __x + 12, ty + 14,,,, COLORS._main_icon_light); draw_sprite_ui(THEME.bone, 0, __x + 12, ty + 14,,,, COLORS._main_icon_light);
@ -98,8 +98,10 @@ function Node_Armature(_x, _y, _group = noone) : Node(_x, _y, _group) constructo
ty += _hh; ty += _hh;
draw_set_color(COLORS.node_composite_separator); if(!ds_stack_empty(_bst)) {
draw_line(_x + 16, ty, _x + _w - 16, ty); draw_set_color(COLORS.node_composite_separator);
draw_line(_x + 16, ty, _x + _w - 16, ty);
}
} }
ds_stack_destroy(_bst); ds_stack_destroy(_bst);
@ -109,7 +111,7 @@ function Node_Armature(_x, _y, _group = noone) : Node(_x, _y, _group) constructo
if(bone_remove != noone) { if(bone_remove != noone) {
var _par = bone_remove.parent; var _par = bone_remove.parent;
recordAction(ACTION_TYPE.struct_modify, attributes.bones, attributes.bones.serialize()); recordAction(ACTION_TYPE.struct_modify, bones, bones.serialize());
array_remove(_par.childs, bone_remove); array_remove(_par.childs, bone_remove);
for( var i = 0, n = array_length(bone_remove.childs); i < n; i++ ) { for( var i = 0, n = array_length(bone_remove.childs); i < n; i++ ) {
@ -128,12 +130,12 @@ function Node_Armature(_x, _y, _group = noone) : Node(_x, _y, _group) constructo
]; ];
static createBone = function(parent, distance, direction) { static createBone = function(parent, distance, direction) {
recordAction(ACTION_TYPE.struct_modify, attributes.bones, attributes.bones.serialize()); recordAction(ACTION_TYPE.struct_modify, bones, bones.serialize());
var bone = new __Bone(parent, distance, direction,,, self); var bone = new __Bone(parent, distance, direction,,, self);
parent.addChild(bone); parent.addChild(bone);
if(parent == attributes.bones) if(parent == bones)
bone.parent_anchor = false; bone.parent_anchor = false;
return bone; return bone;
} }
@ -141,10 +143,10 @@ function Node_Armature(_x, _y, _group = noone) : Node(_x, _y, _group) constructo
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); bones = new __Bone(,,,,, self);
attributes.bones.name = "Main"; bones.name = "Main";
attributes.bones.is_main = true; bones.is_main = true;
attributes.bones.node = self; bones.node = self;
attributes.display_name = true; attributes.display_name = true;
attributes.display_bone = 0; attributes.display_bone = 0;
@ -192,7 +194,7 @@ function Node_Armature(_x, _y, _group = noone) : Node(_x, _y, _group) constructo
var smx = value_snap(mx, _snx); var smx = value_snap(mx, _snx);
var smy = value_snap(my, _sny); var smy = value_snap(my, _sny);
var _b = attributes.bones; var _b = bones;
if(builder_bone != noone) { 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);
@ -291,7 +293,7 @@ function Node_Armature(_x, _y, _group = noone) : Node(_x, _y, _group) constructo
var _len = point_distance(p0.x, p0.y, p1.x, p1.y); var _len = point_distance(p0.x, p0.y, p1.x, p1.y);
var _ang = point_direction(p0.x, p0.y, p1.x, p1.y); var _ang = point_direction(p0.x, p0.y, p1.x, p1.y);
recordAction(ACTION_TYPE.struct_modify, attributes.bones, attributes.bones.serialize()); recordAction(ACTION_TYPE.struct_modify, bones, bones.serialize());
var IKbone = new __Bone(anc, _len, _ang, ik_dragging.angle + 90, 0, self); var IKbone = new __Bone(anc, _len, _ang, ik_dragging.angle + 90, 0, self);
anc.addChild(IKbone); anc.addChild(IKbone);
@ -349,7 +351,7 @@ function Node_Armature(_x, _y, _group = noone) : Node(_x, _y, _group) constructo
builder_mx = mx; builder_mx = mx;
builder_my = my; builder_my = my;
recordAction(ACTION_TYPE.struct_modify, attributes.bones, attributes.bones.serialize()); recordAction(ACTION_TYPE.struct_modify, bones, bones.serialize());
} }
} else } else
draw_set_color(c_white); draw_set_color(c_white);
@ -422,7 +424,7 @@ function Node_Armature(_x, _y, _group = noone) : Node(_x, _y, _group) constructo
builder_mx = _mx; builder_mx = _mx;
builder_my = _my; builder_my = _my;
recordAction(ACTION_TYPE.struct_modify, attributes.bones, attributes.bones.serialize()); recordAction(ACTION_TYPE.struct_modify, bones, bones.serialize());
} }
} }
@ -432,7 +434,7 @@ function Node_Armature(_x, _y, _group = noone) : Node(_x, _y, _group) constructo
if(mouse_press(mb_left, active)) { if(mouse_press(mb_left, active)) {
if(anchor_selecting == noone) { if(anchor_selecting == noone) {
builder_bone = createBone(attributes.bones, point_distance(0, 0, smx, smy), point_direction(0, 0, smx, smy)); builder_bone = createBone(bones, point_distance(0, 0, smx, smy), point_direction(0, 0, smx, smy));
builder_type = 1; builder_type = 1;
builder_sx = smx; builder_sx = smx;
builder_sy = smy; builder_sy = smy;
@ -447,7 +449,7 @@ function Node_Armature(_x, _y, _group = noone) : Node(_x, _y, _group) constructo
} else if(anchor_selecting[1] == 2) { } else if(anchor_selecting[1] == 2) {
var _pr = anchor_selecting[0]; var _pr = anchor_selecting[0];
recordAction(ACTION_TYPE.struct_modify, attributes.bones, attributes.bones.serialize()); recordAction(ACTION_TYPE.struct_modify, bones, bones.serialize());
var _md = new __Bone(noone, 0, 0, _pr.angle, _pr.length / 2, self); var _md = new __Bone(noone, 0, 0, _pr.angle, _pr.length / 2, self);
_pr.length = _md.length; _pr.length = _md.length;
@ -464,7 +466,7 @@ 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_add, 1, _mx + 24, _my + 24, 1, 1, 0, c_white, 1); draw_sprite_ext(THEME.bone_tool_add, 1, _mx + 16, _my + 16, 1, 1, 0, c_white, 1);
else if(anchor_selecting[1] == 1) { else if(anchor_selecting[1] == 1) {
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);
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);
@ -531,7 +533,7 @@ function Node_Armature(_x, _y, _group = noone) : Node(_x, _y, _group) constructo
builder_bone = anchor_selecting[0]; builder_bone = anchor_selecting[0];
builder_type = anchor_selecting[1]; builder_type = anchor_selecting[1];
recordAction(ACTION_TYPE.struct_modify, attributes.bones, attributes.bones.serialize()); recordAction(ACTION_TYPE.struct_modify, bones, bones.serialize());
if(builder_type == 0) { if(builder_type == 0) {
var orig = builder_bone.parent.getPoint(0); var orig = builder_bone.parent.getPoint(0);
@ -562,7 +564,7 @@ function Node_Armature(_x, _y, _group = noone) : Node(_x, _y, _group) constructo
static step = function() {} static step = function() {}
static update = function(frame = CURRENT_FRAME) { static update = function(frame = CURRENT_FRAME) {
outputs[0].setValue(attributes.bones); outputs[0].setValue(bones);
} }
static getPreviewBoundingBox = function() { static getPreviewBoundingBox = function() {
@ -571,7 +573,7 @@ function Node_Armature(_x, _y, _group = noone) : Node(_x, _y, _group) constructo
var maxx = -9999999; var maxx = -9999999;
var maxy = -9999999; var maxy = -9999999;
var _b = attributes.bones; var _b = bones;
var _bst = ds_stack_create(); var _bst = ds_stack_create();
ds_stack_push(_bst, _b); ds_stack_push(_bst, _b);
@ -599,16 +601,15 @@ function Node_Armature(_x, _y, _group = noone) : Node(_x, _y, _group) constructo
} }
static doSerialize = function(_map) { static doSerialize = function(_map) {
_map.bones = attributes.bones.serialize(); _map.bones = bones.serialize();
} }
// static attributeDeserialize = function() {}
static postDeserialize = function() { static postDeserialize = function() {
if(struct_has(attributes, "bones")) struct_remove(attributes, "bones");
if(!struct_has(load_map, "bones")) return; if(!struct_has(load_map, "bones")) return;
attributes.bones = new __Bone(,,,,, self); bones = new __Bone(,,,,, self);
attributes.bones.deserialize(load_map.bones, self); bones.deserialize(load_map.bones, self);
attributes.bones.connect(); bones.connect();
} }
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {

View file

@ -10,7 +10,6 @@ function __armature_bind_data(_surface, _bone, _tran, _aang, _pang, _asca, _psca
function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor { function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
name = "Armature Bind"; name = "Armature Bind";
batch_output = false;
newInput(0, nodeValue_Dimension(self)); newInput(0, nodeValue_Dimension(self));
@ -27,6 +26,8 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
newInput(4, nodeValue_Float("Bone scale", self, 1)) newInput(4, nodeValue_Float("Bone scale", self, 1))
.setDisplay(VALUE_DISPLAY.slider, { range: [ 0.1, 2, 0.01 ] }); .setDisplay(VALUE_DISPLAY.slider, { range: [ 0.1, 2, 0.01 ] });
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
newOutput(0, nodeValue_Output("Surface out", self, VALUE_TYPE.surface, noone)); newOutput(0, nodeValue_Output("Surface out", self, VALUE_TYPE.surface, noone));
newOutput(1, nodeValue_Output("Atlas data", self, VALUE_TYPE.surface, [])) newOutput(1, nodeValue_Output("Atlas data", self, VALUE_TYPE.surface, []))
@ -47,44 +48,42 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
anchor_selecting = noone; anchor_selecting = noone;
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() /*=>*/ { attributes.display_name = !attributes.display_name; })]);
new checkBox(function() { array_push(attributeEditors, ["Display bone", function() /*=>*/ {return attributes.display_bone}, new scrollBox(["Octahedral", "Stick"], function(ind) /*=>*/ { attributes.display_bone = ind; })]);
attributes.display_name = !attributes.display_name;
})]);
array_push(attributeEditors, ["Display bone", function() { return attributes.display_bone; },
new scrollBox(["Octahedral", "Stick"], function(ind) {
attributes.display_bone = ind;
})]);
boneMap = ds_map_create(); tools = [
surfMap = ds_map_create(); new NodeTool( "Pose", THEME.bone_tool_pose )
];
boneMap = ds_map_create();
surfMap = ds_map_create();
boneIDMap = [];
hold_visibility = true; hold_visibility = true;
hold_select = true; hold_select = true;
_layer_dragging = noone;
_layer_drag_y = noone;
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) { 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 amo = min(array_length(inputs) - data_length, array_length(current_data)); var amo = min(array_length(inputs) - data_length, array_length(current_data));
var _bind = getSingleValue(2); var _bind = getSingleValue(2);
var use_data = _bind != noone; var use_data = _bind != noone;
var _surfAmo = getInputAmount();
for(var i = input_fix_len; i < amo; i += data_length) { for(var i = 0; i < _surfAmo; i++) {
index++; var _surf = current_data[input_fix_len + i * data_length];
var _surf = current_data[i]; var _id = array_safe_get(boneIDMap, i, "");
var _id = inputs[i].display_data.bone_id;
if(_id == "") continue; if(_id == "") continue;
if(ds_map_exists(surfMap, _id)) if(!ds_map_exists(surfMap, _id)) surfMap[? _id] = [];
array_push(surfMap[? _id], [ index, _surf ]); array_push(surfMap[? _id], [ i, _surf ]);
else
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();
@ -92,17 +91,13 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
var bh = ui(32 + 16) + amo * _hh; var bh = ui(32 + 16) + amo * _hh;
var ty = _y; var ty = _y;
draw_set_text(f_p0, fa_left, fa_top, COLORS._main_text); draw_set_text(f_p2, fa_left, fa_top, COLORS._main_text_sub);
draw_text_add(_x + ui(16), ty + ui(4), __txt("Bones")); draw_text_add(_x + ui(16), ty + ui(4), __txt("Bones"));
ty += ui(28);
ty += ui(32);
var _ty = ty; var _ty = ty;
draw_sprite_stretched_ext(THEME.ui_panel_bg, 1, _x, ty, _w, bh - ui(32), COLORS.node_composite_bg_blend, 1); draw_sprite_stretched_ext(THEME.ui_panel_bg, 1, _x, ty, _w, bh - ui(32), COLORS.node_composite_bg_blend, 1);
draw_set_color(COLORS.node_composite_separator);
draw_line(_x + 16, ty + ui(8), _x + _w - 16, ty + ui(8));
ty += ui(8); ty += ui(8);
var hovering = noone; var hovering = noone;
@ -122,16 +117,13 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
if(_bone.is_main) continue; if(_bone.is_main) continue;
if(_bone.parent_anchor) if(_bone.parent_anchor) draw_sprite_ui(THEME.bone, 1, __x + 12, ty + 14,,,, COLORS._main_icon);
draw_sprite_ui(THEME.bone, 1, __x + 12, ty + 14,,,, COLORS._main_icon); else if(_bone.IKlength) draw_sprite_ui(THEME.bone, 2, __x + 12, ty + 14,,,, COLORS._main_icon);
else if(_bone.IKlength) else draw_sprite_ui(THEME.bone, 0, __x + 12, ty + 14,,,, COLORS._main_icon);
draw_sprite_ui(THEME.bone, 2, __x + 12, ty + 14,,,, COLORS._main_icon);
else
draw_sprite_ui(THEME.bone, 0, __x + 12, ty + 14,,,, COLORS._main_icon);
draw_set_text(f_p2, fa_left, fa_center, COLORS._main_text); draw_set_text(f_p2, fa_left, fa_center, COLORS._main_text);
draw_text(__x + 24, ty + 12, _bone.name); draw_text_add(__x + 24, ty + 12, _bone.name);
if(ds_map_exists(surfMap, _bone.ID)) { if(ds_map_exists(surfMap, _bone.ID)) {
var _sdata = surfMap[? _bone.ID]; var _sdata = surfMap[? _bone.ID];
@ -150,15 +142,18 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
if(_hover && point_in_rectangle(_m[0], _m[1], _sx, _sy, _sx + _sw * _ss, _sy + _sh * _ss)) { if(_hover && point_in_rectangle(_m[0], _m[1], _sx, _sy, _sx + _sw * _ss, _sy + _sh * _ss)) {
TOOLTIP = [ _surf, VALUE_TYPE.surface ]; TOOLTIP = [ _surf, VALUE_TYPE.surface ];
if(mouse_press(mb_left, _focus)) { if(mouse_press(mb_left, _focus)) {
layer_dragging = _sid; layer_dragging = _sid;
inputs[input_fix_len + _sid * data_length].display_data.bone_id = ""; boneIDMap[_sid] = "";
} }
draw_set_color(COLORS._main_accent); draw_set_color(COLORS._main_accent);
} else draw_sprite_stretched_add(THEME.s_box_r2, 1, _sx, _sy, _sw * _ss, _sh * _ss, COLORS._main_accent, 1);
draw_set_color(COLORS.node_composite_bg);
draw_rectangle(_sx, _sy, _sx + _sw * _ss, _sy + _sh * _ss, true);
} else {
draw_set_color(COLORS.node_composite_bg);
draw_sprite_stretched_add(THEME.s_box_r2, 1, _sx, _sy, _sw * _ss, _sh * _ss, COLORS._main_icon, .3);
}
_sx += _sw * _ss + 4; _sx += _sw * _ss + 4;
} }
} }
@ -174,16 +169,16 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
ty += _hh; ty += _hh;
draw_set_color(COLORS.node_composite_separator); if(!ds_stack_empty(_bst)) {
draw_line(_x + 16, ty, _x + _w - 16, ty); draw_set_color(COLORS.node_composite_separator);
draw_line(_x + 16, ty, _x + _w - 16, ty);
}
} }
ds_stack_destroy(_bst); ds_stack_destroy(_bst);
if(layer_dragging != noone && hovering && mouse_release(mb_left)) { if(layer_dragging != noone && hovering && mouse_release(mb_left)) {
var _lind = input_fix_len + layer_dragging * data_length; boneIDMap[layer_dragging] = hovering.ID;
inputs[_lind].display_data.bone_id = hovering.ID;
layer_dragging = noone; layer_dragging = noone;
triggerRender(); triggerRender();
} }
@ -200,139 +195,136 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
return layer_renderer.h; return layer_renderer.h;
} }
var ty = _y + bh + ui(8); var ty = _y + bh;
draw_set_text(f_p0, fa_left, fa_top, COLORS._main_text); draw_sprite_ext(THEME.arrow, 1, _x + _w / 2, ty + ui(6), 1, 1, 0, COLORS._main_icon);
draw_text_add(_x + ui(16), ty + ui(4), __txt("Surfaces")); ty += ui(16);
ty += ui(32);
#region draw surface #region draw surface
var lh = 32; var lh = 28;
var sh = 8 + max(1, amo) * (lh + 4) + 8; var sh = 4 + max(1, amo) * (lh + 4) + 4;
draw_sprite_stretched_ext(THEME.ui_panel_bg, 1, _x, ty, _w, sh, COLORS.node_composite_bg_blend, 1); draw_sprite_stretched_ext(THEME.ui_panel_bg, 1, _x, ty, _w, sh, COLORS.node_composite_bg_blend, 1);
var _vis = attributes.layer_visible; var _vis = attributes.layer_visible;
var _sel = attributes.layer_selectable; var _sel = attributes.layer_selectable;
var ly = ty + 8; var ly = ty + 6;
var ssh = lh - 6; var ssh = lh - 6;
var hoverIndex = noone; var hoverIndex = noone;
draw_set_color(COLORS.node_composite_separator);
draw_line(_x + 16, ly, _x + _w - 16, ly);
layer_remove = -1; layer_remove = -1;
var index = amo;
for(var i = 0; i < amo; i++) { for(var i = 0; i < amo; i++) {
var _inp = input_fix_len + (amo - i - 1) * data_length; var _ind = amo - i - 1;
var _surf = current_data[_inp]; var _inp = input_fix_len + _ind * data_length;
var _surf = current_data[_inp];
var binded = array_safe_get(boneIDMap, _ind, "") != "";
index--;
var _bx = _x + _w - 24; var _bx = _x + _w - 24;
var _cy = ly + index * (lh + 4); var _cy = ly + _ind * (lh + 4);
if(point_in_circle(_m[0], _m[1], _bx, _cy + lh / 2, 16)) { if(point_in_circle(_m[0], _m[1], _bx, _cy + lh / 2, 16)) {
draw_sprite_ui_uniform(THEME.icon_delete, 3, _bx, _cy + lh / 2, 1, COLORS._main_value_negative); draw_sprite_ui_uniform(THEME.icon_delete, 3, _bx, _cy + lh / 2, 1, COLORS._main_value_negative);
if(mouse_press(mb_left, _focus)) if(mouse_press(mb_left, _focus))
layer_remove = index; layer_remove = _ind;
} else } else
draw_sprite_ui_uniform(THEME.icon_delete, 3, _bx, _cy + lh / 2, 1, COLORS._main_icon); draw_sprite_ui_uniform(THEME.icon_delete, 3, _bx, _cy + lh / 2, 1, COLORS._main_icon);
_bx -= 32; _bx -= 32;
//if(point_in_circle(_m[0], _m[1], _bx, _cy + lh / 2, 16)) { if(binded) {
// draw_sprite_ui_uniform(THEME.reset_16, 3, _bx, _cy + lh / 2, 1, COLORS._main_value_negative); if(point_in_circle(_m[0], _m[1], _bx, _cy + lh / 2, 16)) {
draw_sprite_ui_uniform(THEME.reset_16, 3, _bx, _cy + lh / 2, 1, COLORS._main_value_negative);
// if(mouse_press(mb_left, _focus))
// resetTransform(i); if(mouse_press(mb_left, _focus))
//} else resetTransform(_ind);
// draw_sprite_ui_uniform(THEME.reset_16, 3, _bx, _cy + lh / 2, 1, COLORS._main_icon); } else
draw_sprite_ui_uniform(THEME.reset_16, 3, _bx, _cy + lh / 2, 1, COLORS._main_icon);
}
if(!is_surface(_surf)) continue; if(!is_surface(_surf)) continue;
var aa = (index != layer_dragging || layer_dragging == noone)? 1 : 0.5; var aa = (_ind != layer_dragging || layer_dragging == noone)? 1 : 0.5;
var vis = _vis[index]; var vis = _vis[_ind];
var sel = _sel[index]; var sel = _sel[_ind];
var hover = point_in_rectangle(_m[0], _m[1], _x, _cy, _x + _w, _cy + lh); var hov = _hover && point_in_rectangle(_m[0], _m[1], _x, _cy, _x + _w, _cy + lh);
draw_set_color(COLORS.node_composite_separator); var _bx = _x + 24;
draw_line(_x + 16, _cy + lh + 2, _x + _w - 16, _cy + lh + 2);
var _bx = _x + 24 * 2 + 8;
if(point_in_circle(_m[0], _m[1], _bx, _cy + lh / 2, 12)) { if(point_in_circle(_m[0], _m[1], _bx, _cy + lh / 2, 12)) {
draw_sprite_ui_uniform(THEME.junc_visible, vis, _bx, _cy + lh / 2, 1, c_white); draw_sprite_ui_uniform(THEME.junc_visible, vis, _bx, _cy + lh / 2, 1, c_white);
if(mouse_press(mb_left, _focus)) if(mouse_press(mb_left, _focus))
hold_visibility = !_vis[index]; hold_visibility = !_vis[_ind];
if(mouse_click(mb_left, _focus) && _vis[index] != hold_visibility) { if(mouse_click(mb_left, _focus) && _vis[_ind] != hold_visibility) {
_vis[index] = hold_visibility; _vis[_ind] = hold_visibility;
doUpdate(); doUpdate();
} }
} else } else
draw_sprite_ui_uniform(THEME.junc_visible, vis, _bx, _cy + lh / 2, 1, COLORS._main_icon, 0.5 + 0.5 * vis); draw_sprite_ui_uniform(THEME.junc_visible, vis, _bx, _cy + lh / 2, 1, COLORS._main_icon, 0.5 + 0.5 * vis);
_bx += 24 + 8; _bx += 24 + 1;
if(point_in_circle(_m[0], _m[1], _bx, _cy + lh / 2, 12)) { if(point_in_circle(_m[0], _m[1], _bx, _cy + lh / 2, 12)) {
draw_sprite_ui_uniform(THEME.cursor_select, sel, _bx, _cy + lh / 2, 1, c_white); draw_sprite_ui_uniform(THEME.cursor_select, sel, _bx, _cy + lh / 2, 1, c_white);
if(mouse_press(mb_left, _focus)) if(mouse_press(mb_left, _focus))
hold_select = !_sel[index]; hold_select = !_sel[_ind];
if(mouse_click(mb_left, _focus) && _sel[index] != hold_select) if(mouse_click(mb_left, _focus) && _sel[_ind] != hold_select)
_sel[index] = hold_select; _sel[_ind] = hold_select;
} else } else
draw_sprite_ui_uniform(THEME.cursor_select, sel, _bx, _cy + lh / 2, 1, COLORS._main_icon, 0.5 + 0.5 * sel); draw_sprite_ui_uniform(THEME.cursor_select, sel, _bx, _cy + lh / 2, 1, COLORS._main_icon, 0.5 + 0.5 * sel);
draw_set_color(COLORS.node_composite_bg); draw_set_color(COLORS.node_composite_bg);
var _sx0 = _bx + 24; var _sx0 = _bx + 18;
var _sx1 = _sx0 + ssh; var _sx1 = _sx0 + ssh;
var _sy0 = _cy + 3; var _sy0 = _cy + 3;
var _sy1 = _sy0 + ssh; var _sy1 = _sy0 + ssh;
draw_rectangle(_sx0, _sy0, _sx1, _sy1, true);
var _ssw = surface_get_width_safe(_surf); var _ssw = surface_get_width_safe(_surf);
var _ssh = surface_get_height_safe(_surf); var _ssh = surface_get_height_safe(_surf);
var _sss = min(ssh / _ssw, ssh / _ssh); var _sss = min(ssh / _ssw, ssh / _ssh);
var _ins = _ind == dynamic_input_inspecting;
draw_surface_ext_safe(_surf, _sx0, _sy0, _sss, _sss, 0, c_white, 1); draw_surface_ext_safe(_surf, _sx0, _sy0, _sss, _sss, 0, c_white, 1);
if(_ins) draw_sprite_stretched_add(THEME.s_box_r2, 1, _sx0, _sy0, ssh, ssh, COLORS._main_text_accent, 1);
draw_set_text(f_p1, fa_left, fa_center, hover? COLORS._main_text : COLORS._main_text); else draw_sprite_stretched_add(THEME.s_box_r2, 1, _sx0, _sy0, ssh, ssh, COLORS._main_icon, .3);
var tc = _ins? COLORS._main_text_accent : COLORS._main_icon;
if(hov) tc = COLORS._main_text;
draw_set_text(f_p2, fa_left, fa_center, tc);
draw_set_alpha(aa); draw_set_alpha(aa);
draw_text(_sx1 + 12, _cy + lh / 2, inputs[_inp].name); draw_text_add(_sx1 + 12, _cy + lh / 2, inputs[_inp].name);
draw_set_alpha(1); draw_set_alpha(1);
if(_hover && point_in_rectangle(_m[0], _m[1], _x, _cy, _x + _w, _cy + lh)) { if(_hover && point_in_rectangle(_m[0], _m[1], _x, _cy, _x + _w, _cy + lh)) {
hoverIndex = index; hoverIndex = _ind;
if(mouse_press(mb_left, _focus)) {
_layer_dragging = _ind;
_layer_drag_y = _m[1];
dynamic_input_inspecting = _ind;
refreshDynamicDisplay();
}
if(layer_dragging != noone) { if(layer_dragging != noone) {
draw_set_color(COLORS._main_accent); draw_set_color(COLORS._main_accent);
if(layer_dragging > index) if(layer_dragging < _ind) draw_line_width(_x + 16, _cy + lh + 2, _x + _w - 16, _cy + lh + 2, 2);
draw_line_width(_x + 16, _cy + lh + 2, _x + _w - 16, _cy + lh + 2, 2); else if(layer_dragging > _ind) draw_line_width(_x + 16, _cy - 2, _x + _w - 16, _cy - 2, 2);
else if(layer_dragging < index)
draw_line_width(_x + 16, _cy - 2, _x + _w - 16, _cy - 2, 2);
}
}
var binded = inputs[_inp].display_data.bone_id != "";
if(layer_dragging == noone || layer_dragging == index) {
var _bx = _x + 24;
if(point_in_circle(_m[0], _m[1], _bx, _cy + lh / 2, 16)) {
draw_sprite_ui_uniform(THEME.hamburger_s, 3, _bx, _cy + lh / 2, 1, c_white);
if(mouse_press(mb_left, _focus))
layer_dragging = index;
} else {
if(!binded) {
var cc = merge_color(COLORS._main_icon, COLORS._main_accent, 0.5 + 0.5 * (sin(current_time / 100) * 0.5 + 0.5));
draw_sprite_ui_uniform(THEME.hamburger_s, 3, _bx, _cy + lh / 2, 1, cc);
} else
draw_sprite_ui_uniform(THEME.hamburger_s, 3, _bx, _cy + lh / 2, 1, COLORS._main_icon);
} }
} }
} }
if(_layer_dragging != noone) {
if(abs(_m[1] - _layer_drag_y) > 4)
layer_dragging = _layer_dragging;
}
#endregion #endregion
if(mouse_release(mb_left)) _layer_dragging = noone;
if(layer_dragging != noone && mouse_release(mb_left)) { 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;
@ -364,7 +356,7 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
layer_dragging = noone; layer_dragging = noone;
} }
layer_renderer.h = bh + ui(40) + sh; layer_renderer.h = bh + ui(16) + sh;
return layer_renderer.h; return layer_renderer.h;
}); });
@ -372,9 +364,7 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
input_display_list = [ 1, 2, input_display_list = [ 1, 2,
["Output", true], 0, ["Output", true], 0,
["Armature", false], 3, 4, layer_renderer, ["Armature", false], 3, 4, layer_renderer,
["Surfaces", true],
]; ];
input_display_list_len = array_length(input_display_list);
function deleteLayer(index) { function deleteLayer(index) {
var idx = input_fix_len + index * data_length; var idx = input_fix_len + index * data_length;
@ -394,30 +384,32 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
static createNewInput = function() { static createNewInput = function() {
var index = array_length(inputs); var index = array_length(inputs);
var _s = floor((index - input_fix_len) / data_length); var _s = floor((index - input_fix_len) / data_length);
if(!LOADING && !APPENDING) boneIDMap = array_verify(boneIDMap, max(array_length(boneIDMap), _s + 1));
newInput(index + 0, nodeValue_Surface("Surface", self)); newInput(index + 0, nodeValue_Surface("Surface", self));
inputs[index + 0].surface_index = index; inputs[index + 0].surface_index = index;
inputs[index + 0].hover_effect = 0; inputs[index + 0].hover_effect = 0;
inputs[index + 0].display_data.bone_id = "";
newInput(index + 1, nodeValue_Float("Transform", self, [ 0, 0, 0, 1, 1 ] )) newInput(index + 1, nodeValue_Float("Transform", self, [ 0, 0, 0, 1, 1 ] ))
.setDisplay(VALUE_DISPLAY.transform); .setDisplay(VALUE_DISPLAY.transform);
newInput(index + 2, nodeValue_Bool("Inherit Rotation", self, true )); newInput(index + 2, nodeValue_Bool("Inherit Rotation", self, true ));
newInput(index + 3, nodeValue_Bool("Apply Bone Rotation", self, false )); newInput(index + 3, nodeValue_Bool("Apply Bone Rotation", self, false ));
newInput(index + 4, nodeValue_Bool("Inherit Scale", self, false )); newInput(index + 4, nodeValue_Bool("Inherit Scale", self, false ));
newInput(index + 5, nodeValue_Bool("Apply Bone Scale", self, false )); newInput(index + 5, nodeValue_Bool("Apply Bone Scale", self, false ));
for( var i = 0; i < data_length; i++ ) while(_s >= array_length(attributes.layer_visible)) array_push(attributes.layer_visible, true);
array_push(input_display_list, index + i); while(_s >= array_length(attributes.layer_selectable)) array_push(attributes.layer_selectable, true);
while(_s >= array_length(attributes.layer_visible))
array_push(attributes.layer_visible, true);
while(_s >= array_length(attributes.layer_selectable))
array_push(attributes.layer_selectable, true);
refreshDynamicDisplay();
return inputs[index + 0]; return inputs[index + 0];
} setDynamicInput(6); }
input_display_dynamic = [
["Surface data", false], 0, 1, 2, 3, 4, 5,
];
setDynamicInput(6, true, VALUE_TYPE.surface);
temp_surface = [ surface_create(1, 1), surface_create(1, 1), surface_create(1, 1) ]; temp_surface = [ surface_create(1, 1), surface_create(1, 1), surface_create(1, 1) ];
blend_temp_surface = temp_surface[2]; blend_temp_surface = temp_surface[2];
@ -470,6 +462,13 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
} }
static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) { static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) {
if(isUsingTool("Pose")) {
var _arm = inputs[1].value_from;
if(_arm == noone) return;
return _arm.node.drawOverlay(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);
@ -509,7 +508,7 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
_tran = array_clone(_tran); _tran = array_clone(_tran);
var _bone = inputs[surf_dragging].display_data.bone_id; var _bone = array_safe_get(boneIDMap, (surf_dragging - input_fix_len) / data_length, "");
_bone = boneMap[? _bone]; _bone = boneMap[? _bone];
if(drag_type == NODE_COMPOSE_DRAG.move) { if(drag_type == NODE_COMPOSE_DRAG.move) {
@ -579,11 +578,9 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
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;
var _bone = inputs[index].display_data.bone_id; var _bone = array_safe_get(boneIDMap, i, "");
if(!ds_map_exists(boneMap, _bone)) { if(!ds_map_exists(boneMap, _bone)) continue;
//print($"Bone not found {_bone}");
continue;
}
_bone = boneMap[? _bone]; _bone = boneMap[? _bone];
var _tran = current_data[index + 1]; var _tran = current_data[index + 1];
@ -644,9 +641,8 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
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;
var _bone = inputs[index].display_data.bone_id; var _bone = array_safe_get(boneIDMap, i, "");
if(!ds_map_exists(boneMap, _bone)) if(!ds_map_exists(boneMap, _bone)) continue;
continue;
var a = anchors[index]; var a = anchors[index];
@ -749,18 +745,13 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
} }
} }
static processData = function(_outSurf, _data, _output_index, _array_index) { static processData = function(_outData, _data, _output_index, _array_index) {
if(_output_index == 1) return atlas_data; var atlas_data = [];
if(_output_index == 2) return bind_data; var bind_data = [];
if(_output_index == 0 && _array_index == 0) {
atlas_data = [];
bind_data = [];
}
var _dim = _data[0]; var _dim = _data[0];
var _bone = _data[1]; var _bone = _data[1];
var _bind = _data[2]; var _bind = _data[2];
var _dpos = _data[3]; var _dpos = _data[3];
var _dsca = _data[4]; var _dsca = _data[4];
var cDep = attrDepth(); var cDep = attrDepth();
@ -769,6 +760,9 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
////////////////////////////////////////// //////////////////////////////////////////
if(getInputAmount() == 0) return _outData;
dynamic_input_inspecting = clamp(dynamic_input_inspecting, 0, getInputAmount() - 1);
overlay_w = _dim[0]; overlay_w = _dim[0];
overlay_h = _dim[1]; overlay_h = _dim[1];
@ -802,10 +796,8 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
if(!is_surface(_s)) continue; if(!is_surface(_s)) continue;
var _b = use_data? _bind[i].bone : inputs[datInd].display_data.bone_id; var _b = use_data? _bind[i].bone : array_safe_get(boneIDMap, i, "");
if(!ds_map_exists(boneMap, _b)) continue;
if(!ds_map_exists(boneMap, _b))
continue;
_b = boneMap[? _b]; _b = boneMap[? _b];
@ -846,24 +838,24 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
_bg = !_bg; _bg = !_bg;
} }
_outSurf = surface_verify(_outSurf, _dim[0], _dim[1], cDep); var _outSurf = surface_verify(_outData[0], _dim[0], _dim[1], cDep);
surface_set_shader(_outSurf); surface_set_shader(_outSurf);
draw_surface_safe(temp_surface[!_bg]); draw_surface_safe(temp_surface[!_bg]);
surface_reset_shader(); surface_reset_shader();
return _outSurf; return [ _outSurf, atlas_data, bind_data ];
} }
static resetTransform = function(surfIndex) { static resetTransform = function(surfIndex) {
var _bind = getInputData(2); var _bind = getInputData(2);
var use_data = _bind != noone; var use_data = _bind != noone;
var _surf = getInputData(surfIndex + 0); var _surf = getInputData(surfIndex + 0);
var _tran = getInputData(surfIndex + 1); var _tran = getInputData(surfIndex + 1);
var _arot = getInputData(surfIndex + 2); var _arot = getInputData(surfIndex + 2);
var _b = use_data? _bind[i].bone : inputs[surfIndex].display_data.bone_id; var _b = use_data? _bind[i].bone : array_safe_get(boneIDMap, (surfIndex - input_fix_len) / data_length, "");
if(!ds_map_exists(boneMap, _b)) return; if(!ds_map_exists(boneMap, _b)) return;
_b = boneMap[? _b]; _b = boneMap[? _b];
@ -879,24 +871,16 @@ function Node_Armature_Bind(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
} }
static attributeSerialize = function() { static attributeSerialize = function() {
var att = {}; var att = {
att.layer_visible = attributes.layer_visible; boneIDMap,
att.layer_selectable = attributes.layer_selectable; };
return att; return att;
} }
static attributeDeserialize = function(attr) { static attributeDeserialize = function(attr) {
struct_append(attributes, attr); struct_append(attributes, attr);
boneIDMap = struct_try_get(attr, "boneIDMap", boneIDMap);
if(struct_has(attributes, "use_project_dimension") && !struct_has(attr, "use_project_dimension"))
attributes.use_project_dimension = false;
if(struct_has(attr, "layer_visible"))
attributes.layer_visible = attr.layer_visible;
if(struct_has(attr, "layer_selectable"))
attributes.layer_selectable = attr.layer_selectable;
} }
static doApplyDeserialize = function() { static doApplyDeserialize = function() {

View file

@ -13,7 +13,6 @@ function Node_Armature_Path(_x, _y, _group = noone) : Node(_x, _y, _group) const
current_length = 0; current_length = 0;
boundary = new BoundingBox(); boundary = new BoundingBox();
#region ++++ attributes ++++
attributes.display_name = true; attributes.display_name = true;
attributes.display_bone = 0; attributes.display_bone = 0;
@ -26,14 +25,13 @@ function Node_Armature_Path(_x, _y, _group = noone) : Node(_x, _y, _group) const
new scrollBox(["Octahedral", "Stick"], function(ind) { new scrollBox(["Octahedral", "Stick"], function(ind) {
attributes.display_bone = ind; attributes.display_bone = ind;
})]); })]);
#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 _b = getInputData(0); var _b = getInputData(0);
if(_b == noone) return; if(_b == noone) return;
_b.draw(attributes, false, _x, _y, _s, _mx, _my); _b.draw(attributes, false, _x, _y, _s, _mx, _my);
} #endregion }
static getBoundary = function() { return boundary; } static getBoundary = function() { return boundary; }
@ -42,11 +40,9 @@ function Node_Armature_Path(_x, _y, _group = noone) : Node(_x, _y, _group) const
static getLength = function() { return current_length; } static getLength = function() { return current_length; }
static getAccuLength = function() { return [ 0, current_length ]; } static getAccuLength = function() { return [ 0, current_length ]; }
static getWeightDistance = function (_dist, _ind = 0) { #region static getWeightDistance = function (_dist, _ind = 0) { return getWeightRatio(_dist / current_length, _ind); }
return getWeightRatio(_dist / current_length, _ind);
} #endregion
static getWeightRatio = function (_rat, _ind = 0) { #region static getWeightRatio = function (_rat, _ind = 0) {
var _p0 = lines[_ind][0]; var _p0 = lines[_ind][0];
var _p1 = lines[_ind][1]; var _p1 = lines[_ind][1];
@ -54,11 +50,11 @@ function Node_Armature_Path(_x, _y, _group = noone) : Node(_x, _y, _group) const
if(!is_array(_p1) || array_length(_p1) < 3) return 1; if(!is_array(_p1) || array_length(_p1) < 3) return 1;
return lerp(_p0[2], _p1[2], _rat); return lerp(_p0[2], _p1[2], _rat);
} #endregion }
static getPointDistance = function(_dist, _ind = 0, out = undefined) { return getPointRatio(_dist / current_length, _ind, out); } static getPointDistance = function(_dist, _ind = 0, out = undefined) { return getPointRatio(_dist / current_length, _ind, out); }
static getPointRatio = function(_rat, _ind = 0, out = undefined) { #region static getPointRatio = function(_rat, _ind = 0, out = undefined) {
if(out == undefined) out = new __vec2(); else { out.x = 0; out.y = 0; } if(out == undefined) out = new __vec2(); else { out.x = 0; out.y = 0; }
var _p0 = lines[_ind][0]; var _p0 = lines[_ind][0];
@ -71,9 +67,9 @@ function Node_Armature_Path(_x, _y, _group = noone) : Node(_x, _y, _group) const
out.y = lerp(_p0[1], _p1[1], _rat); out.y = lerp(_p0[1], _p1[1], _rat);
return out; return out;
} #endregion }
static update = function() { #region static update = function() {
var _bone = getInputData(0); var _bone = getInputData(0);
if(_bone == noone) return; if(_bone == noone) return;
@ -108,10 +104,10 @@ function Node_Armature_Path(_x, _y, _group = noone) : Node(_x, _y, _group) const
ds_stack_destroy(_bst); ds_stack_destroy(_bst);
outputs[0].setValue(self); outputs[0].setValue(self);
} #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_path, 0, bbox.xc, bbox.yc, bbox.w, bbox.h); draw_sprite_fit(s_node_armature_path, 0, bbox.xc, bbox.yc, bbox.w, bbox.h);
} #endregion }
} }

View file

@ -14,7 +14,6 @@ function Node_Armature_Sample(_x, _y, _group = noone) : Node(_x, _y, _group) con
newOutput(0, nodeValue_Output("Position", self, VALUE_TYPE.integer, [ 0, 0 ])) newOutput(0, nodeValue_Output("Position", self, VALUE_TYPE.integer, [ 0, 0 ]))
.setDisplay(VALUE_DISPLAY.vector); .setDisplay(VALUE_DISPLAY.vector);
#region ++++ attributes ++++
attributes.display_name = true; attributes.display_name = true;
attributes.display_bone = 0; attributes.display_bone = 0;
@ -27,16 +26,15 @@ function Node_Armature_Sample(_x, _y, _group = noone) : Node(_x, _y, _group) con
new scrollBox(["Octahedral", "Stick"], function(ind) { new scrollBox(["Octahedral", "Stick"], function(ind) {
attributes.display_bone = ind; attributes.display_bone = ind;
})]); })]);
#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 _b = getInputData(0); var _b = getInputData(0);
if(_b == noone) return; if(_b == noone) return;
_b.draw(attributes, false, _x, _y, _s, _mx, _my); _b.draw(attributes, false, _x, _y, _s, _mx, _my);
} #endregion }
static update = function() { #region static update = function() {
var _bone = getInputData(0); var _bone = getInputData(0);
var _name = getInputData(1); var _name = getInputData(1);
var _prog = getInputData(2); var _prog = getInputData(2);
@ -53,10 +51,10 @@ function Node_Armature_Sample(_x, _y, _group = noone) : Node(_x, _y, _group) con
var _p = _b.getPoint(_prog); var _p = _b.getPoint(_prog);
outputs[0].setValue([_p.x, _p.y]); outputs[0].setValue([_p.x, _p.y]);
} #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_sample, 0, bbox.xc, bbox.yc, bbox.w, bbox.h); draw_sprite_fit(s_node_armature_sample, 0, bbox.xc, bbox.yc, bbox.w, bbox.h);
} #endregion }
} }

View file

@ -12,7 +12,7 @@ function Node_Array_Sample(_x, _y, _group = noone) : Node(_x, _y, _group) constr
newInput(3, nodeValue_Int("Shift", self, 0)) newInput(3, nodeValue_Int("Shift", self, 0))
newInput(4, nodeValueSeed(self, VALUE_TYPE.float)); newInput(4, nodeValueSeed(self));
newInput(5, nodeValue_Int("Amount", self, 4)) newInput(5, nodeValue_Int("Amount", self, 4))

View file

@ -6,8 +6,7 @@ function Node_Array_Shuffle(_x, _y, _group = noone) : Node(_x, _y, _group) const
newInput(0, nodeValue("Array in", self, CONNECT_TYPE.input, VALUE_TYPE.any, [])) newInput(0, nodeValue("Array in", self, CONNECT_TYPE.input, VALUE_TYPE.any, []))
.setVisible(true, true); .setVisible(true, true);
newInput(1, nodeValue_Int("Seed", self, seed_random(6))) newInput(1, nodeValueSeed(self))
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[1].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) })
.rejectArray(); .rejectArray();
newOutput(0, nodeValue_Output("Shuffled array", self, VALUE_TYPE.any, [])); newOutput(0, nodeValue_Output("Shuffled array", self, VALUE_TYPE.any, []));

View file

@ -70,7 +70,7 @@ function Node_Bevel(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
var _shf = _data[2]; var _shf = _data[2];
var _sca = _data[3]; var _sca = _data[3];
var _slp = _data[4]; var _slp = _data[4];
var _sam = struct_try_get(attributes, "oversample"); var _sam = getAttribute("oversample");
var _dim = surface_get_dimension(_data[0]); var _dim = surface_get_dimension(_data[0]);
surface_set_shader(_outSurf, max(_dim[0], _dim[1]) < 256? sh_bevel : sh_bevel_highp); surface_set_shader(_outSurf, max(_dim[0], _dim[1]) < 256? sh_bevel : sh_bevel_highp);

View file

@ -54,7 +54,7 @@ function Node_Blur(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
static processData = function(_outSurf, _data, _output_index, _array_index) { static processData = function(_outSurf, _data, _output_index, _array_index) {
var _surf = _data[0]; var _surf = _data[0];
var _size = min(128, _data[1]); var _size = min(128, _data[1]);
var _clamp = struct_try_get(attributes, "oversample"); var _clamp = getAttribute("oversample");
var _isovr = _data[3]; var _isovr = _data[3];
var _mask = _data[5]; var _mask = _data[5];
var _mix = _data[6]; var _mix = _data[6];

View file

@ -75,7 +75,7 @@ function Node_Blur_Directional(_x, _y, _group = noone) : Node_Processor(_x, _y,
shader_set_f_map("direction", _data[ 2], _data[10], inputs[ 2]); shader_set_f_map("direction", _data[ 2], _data[10], inputs[ 2]);
shader_set_i("scale", _data[11]); shader_set_i("scale", _data[11]);
shader_set_i("gamma", _data[12]); shader_set_i("gamma", _data[12]);
shader_set_i("sampleMode", struct_try_get(attributes, "oversample")); shader_set_i("sampleMode", getAttribute("oversample"));
draw_surface_safe(_data[0]); draw_surface_safe(_data[0]);
surface_reset_shader(); surface_reset_shader();

View file

@ -58,7 +58,7 @@ function Node_Blur_Path(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
static processData = function(_outSurf, _data, _output_index, _array_index) { static processData = function(_outSurf, _data, _output_index, _array_index) {
if(!is_surface(_data[0])) return _outSurf; if(!is_surface(_data[0])) return _outSurf;
var _samp = struct_try_get(attributes, "oversample"); var _samp = getAttribute("oversample");
var _surf = _data[0]; var _surf = _data[0];
var _path = _data[1]; var _path = _data[1];
var _reso = _data[2]; var _reso = _data[2];

View file

@ -39,7 +39,7 @@ function Node_Blur_Shape(_x, _y, _group = noone) : Node_Processor(_x, _y, _group
static processData = function(_outSurf, _data, _output_index, _array_index) { #region static processData = function(_outSurf, _data, _output_index, _array_index) { #region
if(!is_surface(_data[0])) return _outSurf; if(!is_surface(_data[0])) return _outSurf;
var _samp = struct_try_get(attributes, "oversample"); var _samp = getAttribute("oversample");
var _blur = _data[1]; var _blur = _data[1];
var _mask = _data[2]; var _mask = _data[2];
var _mode = _data[7]; var _mode = _data[7];

View file

@ -58,7 +58,7 @@ function Node_Blur_Simple(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
static processData = function(_outSurf, _data, _output_index, _array_index) { static processData = function(_outSurf, _data, _output_index, _array_index) {
if(!is_surface(_data[0])) return _outSurf; if(!is_surface(_data[0])) return _outSurf;
var _size = _data[1]; var _size = _data[1];
var _samp = struct_try_get(attributes, "oversample"); var _samp = getAttribute("oversample");
var _mask = _data[3]; var _mask = _data[3];
var _isovr = _data[4]; var _isovr = _data[4];
var _overc = _data[5]; var _overc = _data[5];

View file

@ -57,7 +57,7 @@ function Node_Blur_Slope(_x, _y, _group = noone) : Node_Processor(_x, _y, _group
shader_set_f("stepSize", _data[10]); shader_set_f("stepSize", _data[10]);
shader_set_surface("slopeMap", _data[2]); shader_set_surface("slopeMap", _data[2]);
shader_set_f("slopeMapDim", surface_get_dimension(_data[2])); shader_set_f("slopeMapDim", surface_get_dimension(_data[2]));
shader_set_i("sampleMode", struct_try_get(attributes, "oversample")); shader_set_i("sampleMode", getAttribute("oversample"));
shader_set_i("gamma", _data[11]); shader_set_i("gamma", _data[11]);
draw_surface_safe(_data[0]); draw_surface_safe(_data[0]);

View file

@ -65,7 +65,7 @@ function Node_Blur_Zoom(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
} }
static processData = function(_outSurf, _data, _output_index, _array_index) { static processData = function(_outSurf, _data, _output_index, _array_index) {
var _sam = struct_try_get(attributes, "oversample"); var _sam = getAttribute("oversample");
var _cen = array_clone(_data[2]); var _cen = array_clone(_data[2]);
_cen[0] /= surface_get_width_safe(_outSurf); _cen[0] /= surface_get_width_safe(_outSurf);

View file

@ -9,8 +9,7 @@ function Node_Brush_Linear(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
newInput(2, nodeValue_Int("Iteration", self, 10)) newInput(2, nodeValue_Int("Iteration", self, 10))
.setValidator(VV_min(1)); .setValidator(VV_min(1));
newInput(3, nodeValue_Float("Seed", self, seed_random(6))) newInput(3, nodeValueSeed(self));
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[3].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) })
newInput(4, nodeValue_Float("Length", self, 10)); newInput(4, nodeValue_Float("Length", self, 10));

View file

@ -9,11 +9,10 @@ function Node_Caustic(_x, _y, _group = noone) : Node_Shader_Generator(_x, _y, _g
newInput(2, nodeValue_Vec2("Scale", self, [ 4, 4 ])); newInput(2, nodeValue_Vec2("Scale", self, [ 4, 4 ]));
addShaderProp(SHADER_UNIFORM.float, "scale"); addShaderProp(SHADER_UNIFORM.float, "scale");
newInput(3, nodeValue_Float("Seed", self, seed_random(6))) newInput(3, nodeValueSeed(self));
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[3].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) });
addShaderProp(SHADER_UNIFORM.float, "seed"); addShaderProp(SHADER_UNIFORM.float, "seed");
newInput(4, nodeValue_Float("Progress", self, 0)) newInput(4, nodeValue_Float("Progress", self, 0));
addShaderProp(SHADER_UNIFORM.float, "progress"); addShaderProp(SHADER_UNIFORM.float, "progress");
newInput(5, nodeValue_Float("Detail", self, 1.24)) newInput(5, nodeValue_Float("Detail", self, 1.24))

View file

@ -9,8 +9,7 @@ function Node_Cellular(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
newInput(2, nodeValue_Float("Scale", self, 4)) newInput(2, nodeValue_Float("Scale", self, 4))
.setMappable(11); .setMappable(11);
newInput(3, nodeValue_Float("Seed", self, seed_random(6))) newInput(3, nodeValueSeed(self));
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[3].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) });
newInput(4, nodeValue_Enum_Scroll("Type", self, 0, [ "Point", "Edge", "Cell", "Crystal" ])); newInput(4, nodeValue_Enum_Scroll("Type", self, 0, [ "Point", "Edge", "Cell", "Crystal" ]));

View file

@ -29,7 +29,7 @@ function Node_Color_replace(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
newInput(13, nodeValue_Enum_Scroll("Mode", self, 0, [ "Closet", "Random" ])); newInput(13, nodeValue_Enum_Scroll("Mode", self, 0, [ "Closet", "Random" ]));
newInput(14, nodeValueSeed(self, VALUE_TYPE.float)); newInput(14, nodeValueSeed(self));
input_display_list = [ 9, 10, 14, input_display_list = [ 9, 10, 14,
["Surfaces", true], 0, 7, 8, 11, 12, ["Surfaces", true], 0, 7, 8, 11, 12,

View file

@ -226,12 +226,12 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
draw_sprite_ui_uniform(THEME.icon_canvas, 0, _icx, _icy, 1, _icc, _ica); draw_sprite_ui_uniform(THEME.icon_canvas, 0, _icx, _icy, 1, _icc, _ica);
draw_set_alpha(aa); draw_set_alpha(aa);
draw_text(_txx + ui(8 + 16), _txy, _txt); draw_text_add(_txx + ui(8 + 16), _txy, _txt);
draw_set_alpha(1); draw_set_alpha(1);
} else { } else {
draw_set_alpha(aa); draw_set_alpha(aa);
draw_text(_txx, _txy, _txt); draw_text_add(_txx, _txy, _txt);
draw_set_alpha(1); draw_set_alpha(1);
} }
} }
@ -429,11 +429,6 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
newInput(index + 5, nodeValue_Float($"Opacity {_s}", self, 1)) newInput(index + 5, nodeValue_Float($"Opacity {_s}", self, 1))
.setDisplay(VALUE_DISPLAY.slider); .setDisplay(VALUE_DISPLAY.slider);
for( var i = 0; i < data_length; i++ ) {
array_push(input_display_list, index + i);
inputs[index + i].surface_index = index;
}
while(_s >= array_length(attributes.layer_visible)) while(_s >= array_length(attributes.layer_visible))
array_push(attributes.layer_visible, true); array_push(attributes.layer_visible, true);
@ -771,7 +766,6 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
var _outSurf = _outData[0]; var _outSurf = _outData[0];
if(getInputAmount() == 0) return _outData; if(getInputAmount() == 0) return _outData;
dynamic_input_inspecting = clamp(dynamic_input_inspecting, 0, getInputAmount() - 1); dynamic_input_inspecting = clamp(dynamic_input_inspecting, 0, getInputAmount() - 1);
var _pad = _data[0]; var _pad = _data[0];

View file

@ -9,11 +9,13 @@ function Node_Crop_Content(_x, _y, _group = noone) : Node(_x, _y, _group) constr
.setTooltip("Cropping mode for dealing with image array."); .setTooltip("Cropping mode for dealing with image array.");
newInput(3, nodeValue_Padding("Padding", self, [ 0, 0, 0, 0 ], "Add padding back after crop.")); newInput(3, nodeValue_Padding("Padding", self, [ 0, 0, 0, 0 ], "Add padding back after crop."));
newInput(4, nodeValue_Color("Background", self, cola(c_black, 0)));
newOutput(0, nodeValue_Output("Surface out", self, VALUE_TYPE.surface, noone)); newOutput(0, nodeValue_Output("Surface out", self, VALUE_TYPE.surface, noone));
input_display_list = [ 1, input_display_list = [ 1,
["Surfaces", false], 0, 2, ["Surfaces", false], 0, 2, 4,
["Padding", false], 3, ["Padding", false], 3,
] ]
@ -24,13 +26,14 @@ function Node_Crop_Content(_x, _y, _group = noone) : Node(_x, _y, _group) constr
drag_my = 0; drag_my = 0;
drag_sv = 0; drag_sv = 0;
temp_surface = [ surface_create(1, 1, surface_r32float), surface_create(1, 1, surface_r32float) ]; temp_surface = [ 0, 0 ];
static update = function() { static update = function() {
var _inSurf = getInputData(0); var _inSurf = getInputData(0);
var _active = getInputData(1); var _active = getInputData(1);
var _array = getInputData(2); var _array = getInputData(2);
var _padd = getInputData(3); var _padd = getInputData(3);
var _bg = getInputData(4);
var _outSurf = outputs[0].getValue(); var _outSurf = outputs[0].getValue();
surface_array_free(_outSurf); surface_array_free(_outSurf);
@ -38,7 +41,6 @@ function Node_Crop_Content(_x, _y, _group = noone) : Node(_x, _y, _group) constr
if(!_active) { if(!_active) {
_outSurf = surface_array_clone(_inSurf); _outSurf = surface_array_clone(_inSurf);
outputs[0].setValue(_outSurf); outputs[0].setValue(_outSurf);
return; return;
} }
@ -63,23 +65,33 @@ function Node_Crop_Content(_x, _y, _group = noone) : Node(_x, _y, _group) constr
var _dim = [ surface_get_width_safe(_surf), surface_get_height_safe(_surf) ]; var _dim = [ surface_get_width_safe(_surf), surface_get_height_safe(_surf) ];
var _minx = 0, _miny = 0, _maxx = _dim[0] - 1, _maxy = _dim[1] - 1; var _minx = 0, _miny = 0, _maxx = _dim[0] - 1, _maxy = _dim[1] - 1;
temp_surface[0] = surface_verify(temp_surface[0], _dim[0], _dim[1], surface_r32float); temp_surface[0] = surface_verify(temp_surface[0], _dim[0], _dim[1], surface_r8unorm);
temp_surface[1] = surface_verify(temp_surface[1], _dim[0], _dim[1], surface_r32float); temp_surface[1] = surface_verify(temp_surface[1], _dim[0], _dim[1], surface_r8unorm);
surface_set_shader(temp_surface[0], sh_find_boundary_stretch_x); surface_set_shader(temp_surface[0], sh_find_boundary_stretch_x);
shader_set_color("background", _bg);
shader_set_f("dimension", _dim); shader_set_f("dimension", _dim);
draw_surface_safe(_surf); draw_surface_safe(_surf);
surface_reset_shader(); surface_reset_shader();
surface_set_shader(temp_surface[1], sh_find_boundary_stretch_y); surface_set_shader(temp_surface[1], sh_find_boundary_stretch_y);
shader_set_color("background", _bg);
shader_set_f("dimension", _dim); shader_set_f("dimension", _dim);
draw_surface_safe(_surf); draw_surface_safe(_surf);
surface_reset_shader(); surface_reset_shader();
for( ; _minx < _dim[0]; _minx++ ) if(surface_get_pixel(temp_surface[0], _minx, 0) > 0) break; var _buff0 = buffer_from_surface(temp_surface[0], false);
for( ; _maxx >= 0; _maxx-- ) if(surface_get_pixel(temp_surface[0], _maxx, 0) > 0) break; var _buff1 = buffer_from_surface(temp_surface[1], false);
for( ; _miny < _dim[1]; _miny++ ) if(surface_get_pixel(temp_surface[1], 0, _miny) > 0) break;
for( ; _maxy >= 0; _maxy-- ) if(surface_get_pixel(temp_surface[1], 0, _maxy) > 0) break; for( ; _minx < _dim[0]; _minx++ ) if(buffer_read_at(_buff0, _minx, buffer_u8) > 0) break;
for( ; _maxx >= 0; _maxx-- ) if(buffer_read_at(_buff0, _maxx, buffer_u8) > 0) break;
for( ; _miny < _dim[1]; _miny++ ) if(buffer_read_at(_buff1, _dim[0] * _miny, buffer_u8) > 0) break;
for( ; _maxy >= 0; _maxy-- ) if(buffer_read_at(_buff1, _dim[0] * _maxy, buffer_u8) > 0) break;
buffer_delete(_buff0);
buffer_delete(_buff1);
if(_array) { if(_array) {
minx[j] = _minx; minx[j] = _minx;

View file

@ -2419,7 +2419,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
postLoad(); postLoad();
} }
anim_timeline = attributes.show_timeline; anim_timeline = struct_try_get(attributes, "show_timeline", false);
if(anim_timeline) refreshTimeline(); if(anim_timeline) refreshTimeline();
} }

View file

@ -15,8 +15,7 @@ function Node_Diffuse(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
newInput(5, nodeValue_Slider_Range("Threshold", self, [ 0.5, 0.7 ])); newInput(5, nodeValue_Slider_Range("Threshold", self, [ 0.5, 0.7 ]));
newInput(6, nodeValue_Int("Seed", self, seed_random(6))) newInput(6, nodeValueSeed(self));
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[6].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) });
newInput(7, nodeValue_Surface("External", self)); newInput(7, nodeValue_Surface("External", self));

View file

@ -71,7 +71,7 @@ function Node_Dilate(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
} }
static processData = function(_outSurf, _data, _output_index, _array_index) { static processData = function(_outSurf, _data, _output_index, _array_index) {
var sam = struct_try_get(attributes, "oversample"); var sam = getAttribute("oversample");
surface_set_shader(_outSurf, sh_dilate); surface_set_shader(_outSurf, sh_dilate);
shader_set_interpolation(_data[0]); shader_set_interpolation(_data[0]);

View file

@ -44,8 +44,7 @@ function Node_Dither(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
__init_mask_modifier(7); // inputs 11, 12, __init_mask_modifier(7); // inputs 11, 12,
newInput(13, nodeValue_Int("Seed", self, seed_random(6))) newInput(13, nodeValueSeed(self));
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[13].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) });
newInput(14, nodeValue_Bool("Use palette", self, true)); newInput(14, nodeValue_Bool("Use palette", self, true));

View file

@ -41,7 +41,7 @@ function Node_Edge_Detect(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
static processData = function(_outSurf, _data, _output_index, _array_index) { static processData = function(_outSurf, _data, _output_index, _array_index) {
var ft = _data[1]; var ft = _data[1];
var ov = struct_try_get(attributes, "oversample"); var ov = getAttribute("oversample");
surface_set_target(_outSurf); surface_set_target(_outSurf);
DRAW_CLEAR DRAW_CLEAR

View file

@ -6,8 +6,7 @@ function Node_Wiggler(_x, _y, _group = noone) : Node_Fn(_x, _y, _group) construc
newInput(inl + 1, nodeValue_Int("Frequency", self, 4 )) newInput(inl + 1, nodeValue_Int("Frequency", self, 4 ))
.setDisplay(VALUE_DISPLAY.slider, { range: [1, 32, 0.1] }); .setDisplay(VALUE_DISPLAY.slider, { range: [1, 32, 0.1] });
newInput(inl + 2, nodeValue_Float("Seed", self, seed_random(6))) newInput(inl + 2, nodeValueSeed(self));
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[inl + 2].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) });
newInput(inl + 3, nodeValue_Toggle("Clip", self, 0b11 , { data : [ "Start", "End" ] })); newInput(inl + 3, nodeValue_Toggle("Clip", self, 0b11 , { data : [ "Start", "End" ] }));

View file

@ -10,8 +10,7 @@ function Node_Gabor_Noise(_x, _y, _group = noone) : Node_Shader_Generator(_x, _y
.setMappable(8); .setMappable(8);
addShaderProp(SHADER_UNIFORM.float, "scale"); addShaderProp(SHADER_UNIFORM.float, "scale");
newInput(3, nodeValue_Float("Seed", self, seed_random(6))) newInput(3, nodeValueSeed(self));
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[3].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) });
addShaderProp(SHADER_UNIFORM.float, "seed"); addShaderProp(SHADER_UNIFORM.float, "seed");
newInput(4, nodeValue_Float("Density", self, 2)) newInput(4, nodeValue_Float("Density", self, 2))

View file

@ -21,8 +21,7 @@ function Node_Grain(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
newInput(8, nodeValueMap("Brightness map", self)); newInput(8, nodeValueMap("Brightness map", self));
newInput(9, nodeValue_Float("Seed", self, seed_random(6))) newInput(9, nodeValueSeed(self));
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[9].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) });
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

View file

@ -31,8 +31,7 @@ function Node_Grid(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
newInput(10, nodeValue_Enum_Scroll("Render type", self, 0, ["Colored tile", "Colored tile (Accurate)", "Height map", "Texture grid", "Texture sample"])); newInput(10, nodeValue_Enum_Scroll("Render type", self, 0, ["Colored tile", "Colored tile (Accurate)", "Height map", "Texture grid", "Texture sample"]));
newInput(11, nodeValue_Float("Seed", self, seed_random(6))) newInput(11, nodeValueSeed(self));
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[11].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) });
newInput(12, nodeValue_Bool("Anti aliasing", self, false)); newInput(12, nodeValue_Bool("Anti aliasing", self, false));

View file

@ -23,8 +23,7 @@ function Node_Grid_Hex(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
newInput(7, nodeValue_Enum_Scroll("Render type", self, 0, ["Colored tile", "Height map", "Texture grid", "Texture sample"])); newInput(7, nodeValue_Enum_Scroll("Render type", self, 0, ["Colored tile", "Height map", "Texture grid", "Texture sample"]));
newInput(8, nodeValue_Float("Seed", self, seed_random(6))) newInput(8, nodeValueSeed(self));
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[8].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) });
newInput(9, nodeValue_Surface("Texture", self)); newInput(9, nodeValue_Surface("Texture", self));

View file

@ -8,8 +8,7 @@ function Node_Grid_Noise(_x, _y, _group = noone) : Node_Processor(_x, _y, _group
newInput(2, nodeValue_Vec2("Scale", self, [ 8, 8 ])); newInput(2, nodeValue_Vec2("Scale", self, [ 8, 8 ]));
newInput(3, nodeValue_Float("Seed", self, seed_random(6))) newInput(3, nodeValueSeed(self));
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[3].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) });
newInput(4, nodeValue_Float("Shift", self, 0)) newInput(4, nodeValue_Float("Shift", self, 0))
.setDisplay(VALUE_DISPLAY.slider, { range: [-0.5, 0.5, 0.01] }); .setDisplay(VALUE_DISPLAY.slider, { range: [-0.5, 0.5, 0.01] });

View file

@ -25,8 +25,7 @@ function Node_Grid_Pentagonal(_x, _y, _group = noone) : Node_Processor(_x, _y, _
newInput(8, nodeValue_Enum_Scroll("Render type", self, 0, ["Colored tile", "Height map", "Texture grid"])); newInput(8, nodeValue_Enum_Scroll("Render type", self, 0, ["Colored tile", "Height map", "Texture grid"]));
newInput(9, nodeValue_Float("Seed", self, seed_random(6))) newInput(9, nodeValueSeed(self));
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[9].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) });
newInput(10, nodeValue_Bool("Anti aliasing", self, false)); newInput(10, nodeValue_Bool("Anti aliasing", self, false));

View file

@ -25,8 +25,7 @@ function Node_Grid_Tri(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
newInput(8, nodeValue_Enum_Scroll("Render type", self, 0, ["Colored tile", "Height map", "Texture grid", "Texture sample"])); newInput(8, nodeValue_Enum_Scroll("Render type", self, 0, ["Colored tile", "Height map", "Texture grid", "Texture sample"]));
newInput(9, nodeValue_Float("Seed", self, seed_random(6))) newInput(9, nodeValueSeed(self));
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[9].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) });
newInput(10, nodeValue_Bool("Anti aliasing", self, false)); newInput(10, nodeValue_Bool("Anti aliasing", self, false));

View file

@ -23,8 +23,7 @@ function Node_Herringbone_Tile(_x, _y, _group = noone) : Node_Processor(_x, _y,
newInput(7, nodeValue_Enum_Scroll("Render type", self, 0, ["Colored tile", "Height map", "Texture grid"])); newInput(7, nodeValue_Enum_Scroll("Render type", self, 0, ["Colored tile", "Height map", "Texture grid"]));
newInput(8, nodeValue_Float("Seed", self, seed_random(6))) newInput(8, nodeValueSeed(self));
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[8].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) });
newInput(9, nodeValue_Surface("Texture", self)); newInput(9, nodeValue_Surface("Texture", self));

View file

@ -15,8 +15,7 @@ function Node_Honeycomb_Noise(_x, _y, _group = noone) : Node_Shader_Generator(_x
newInput(4, nodeValue_Enum_Button("Mode", self, 0, [ "Hexagon", "Star" ])); newInput(4, nodeValue_Enum_Button("Mode", self, 0, [ "Hexagon", "Star" ]));
addShaderProp(SHADER_UNIFORM.integer, "mode"); addShaderProp(SHADER_UNIFORM.integer, "mode");
newInput(5, nodeValue_Float("Seed", self, seed_random(6))) newInput(5, nodeValueSeed(self));
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[5].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) })
addShaderProp(SHADER_UNIFORM.float, "seed"); addShaderProp(SHADER_UNIFORM.float, "seed");
newInput(6, nodeValue_Int("Iteration", self, 1)); newInput(6, nodeValue_Int("Iteration", self, 1));

View file

@ -296,7 +296,7 @@ function Node_Liquefy(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
var _amo = getInputAmount(); var _amo = getInputAmount();
if(_amo == 0) return _outSurf; if(_amo == 0) return _outSurf;
var sam = struct_try_get(attributes, "oversample"); var sam = getAttribute("oversample");
var _surf = _data[0]; var _surf = _data[0];
if(!is_surface(_surf)) return _outSurf; if(!is_surface(_surf)) return _outSurf;

View file

@ -45,7 +45,7 @@ function Node_Local_Analyze(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
var _alg = _data[1]; var _alg = _data[1];
var _siz = _data[2]; var _siz = _data[2];
var _shp = _data[4]; var _shp = _data[4];
var _sam = struct_try_get(attributes, "oversample"); var _sam = getAttribute("oversample");
surface_set_shader(_outSurf, sh_local_analyze); surface_set_shader(_outSurf, sh_local_analyze);
shader_set_f("dimension" , surface_get_dimension(_data[0])); shader_set_f("dimension" , surface_get_dimension(_data[0]));

View file

@ -4,8 +4,7 @@ function Node_Lovify(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
newInput(0, nodeValue_Surface("Surface in", self)); newInput(0, nodeValue_Surface("Surface in", self));
newInput(1, nodeValue_Int("Seed", self, seed_random(6))) newInput(1, nodeValueSeed(self));
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[1].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) });
newInput(2, nodeValue_Float("Density", self, 0.5 )) newInput(2, nodeValue_Float("Density", self, 0.5 ))
.setDisplay(VALUE_DISPLAY.slider); .setDisplay(VALUE_DISPLAY.slider);

View file

@ -178,8 +178,7 @@ function Node_Mesh_Warp(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
newInput(8, nodeValue_Enum_Scroll("Mesh Type", self, 0, [ new scrollItem("Grid", s_node_mesh_type, 0), newInput(8, nodeValue_Enum_Scroll("Mesh Type", self, 0, [ new scrollItem("Grid", s_node_mesh_type, 0),
new scrollItem("Custom", s_node_mesh_type, 1), ] )); new scrollItem("Custom", s_node_mesh_type, 1), ] ));
newInput(9, nodeValue_Int("Seed", self, seed_random(6))) newInput(9, nodeValueSeed(self));
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[9].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) });
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

View file

@ -6,8 +6,7 @@ function Node_MK_Blinker(_x, _y, _group = noone) : Node_Processor(_x, _y, _group
newInput(1, nodeValue_Surface("Mask", self)); newInput(1, nodeValue_Surface("Mask", self));
newInput(2, nodeValue_Int("Seed", self, seed_random(6))) newInput(2, nodeValueSeed(self));
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[2].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) });
newInput(3, nodeValue_Float("Amount", self, 0.5)) newInput(3, nodeValue_Float("Amount", self, 0.5))
.setDisplay(VALUE_DISPLAY.slider); .setDisplay(VALUE_DISPLAY.slider);

View file

@ -18,8 +18,7 @@ function Node_MK_Brownian(_x, _y, _group = noone) : Node(_x, _y, _group) constru
newInput(7, nodeValue_Curve("Alpha", self, CURVE_DEF_11)); newInput(7, nodeValue_Curve("Alpha", self, CURVE_DEF_11));
newInput(8, nodeValue_Int("Seed", self, seed_random(6))) newInput(8, nodeValueSeed(self));
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[8].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) });
newInput(9, nodeValue_Range("Angular speed", self, [ -45, 45 ])); newInput(9, nodeValue_Range("Angular speed", self, [ -45, 45 ]));

View file

@ -16,8 +16,7 @@ function Node_MK_Delay_Machine(_x, _y, _group = noone) : Node(_x, _y, _group) co
newInput(5, nodeValue_Enum_Scroll("Palette Select", self, 0, [ "Loop", "Pingpong", "Random" ])); newInput(5, nodeValue_Enum_Scroll("Palette Select", self, 0, [ "Loop", "Pingpong", "Random" ]));
newInput(6, nodeValue_Int("Seed", self, seed_random(6))) newInput(6, nodeValueSeed(self));
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[6].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) });
newInput(7, nodeValue_Bool("Loop", self, false)); newInput(7, nodeValue_Bool("Loop", self, false));

View file

@ -6,8 +6,7 @@ function Node_MK_Fall(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
newInput(1, nodeValue_Dimension(self)); newInput(1, nodeValue_Dimension(self));
newInput(2, nodeValue_Int("Seed", self, seed_random(6))) newInput(2, nodeValueSeed(self));
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[2].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) });
newInput(3, nodeValue_Area("Area", self, DEF_AREA)); newInput(3, nodeValue_Area("Area", self, DEF_AREA));

View file

@ -11,8 +11,7 @@ function Node_MK_GridBalls(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
newInput(4, nodeValue_Float("Scatter", self, 0)); newInput(4, nodeValue_Float("Scatter", self, 0));
newInput(5, nodeValue_Int("Seed", self, seed_random(6))) newInput(5, nodeValueSeed(self));
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[5].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) });
newInput(6, nodeValue_Float("Shading", self, 0.5)) newInput(6, nodeValue_Float("Shading", self, 0.5))
.setDisplay(VALUE_DISPLAY.slider); .setDisplay(VALUE_DISPLAY.slider);

View file

@ -7,8 +7,7 @@ function Node_MK_GridFlip(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
newInput(2, nodeValue_Vec2("Amount", self, [ 4, 4 ])); newInput(2, nodeValue_Vec2("Amount", self, [ 4, 4 ]));
newInput(3, nodeValue_Int("Seed", self, seed_random(6))) newInput(3, nodeValueSeed(self));
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[3].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) });
newInput(4, nodeValue_Surface("Surface back", self)); newInput(4, nodeValue_Surface("Surface back", self));

View file

@ -18,8 +18,7 @@ function Node_MK_Rain(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
newInput(7, nodeValue_Range("Velocity", self, [ 1, 2 ])); newInput(7, nodeValue_Range("Velocity", self, [ 1, 2 ]));
newInput(8, nodeValue_Int("Seed", self, seed_random(6))) newInput(8, nodeValueSeed(self));
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[8].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) });
newInput(9, nodeValue_Enum_Scroll("Shape", self, 0, [ new scrollItem("Rain", s_node_mk_rain_type, 0), newInput(9, nodeValue_Enum_Scroll("Shape", self, 0, [ new scrollItem("Rain", s_node_mk_rain_type, 0),
new scrollItem("Snow", s_node_mk_rain_type, 1), new scrollItem("Snow", s_node_mk_rain_type, 1),

View file

@ -8,7 +8,7 @@ function Node_MK_Sparkle(_x, _y, _group = noone) : Node_Processor(_x, _y, _group
newInput(0, nodeValue_Int("Size", self, 5)); newInput(0, nodeValue_Int("Size", self, 5));
newInput(1, nodeValueSeed(self, VALUE_TYPE.float)); newInput(1, nodeValueSeed(self));
newInput(2, nodeValue_Float("Speed", self, 1)) newInput(2, nodeValue_Float("Speed", self, 1))
.setDisplay(VALUE_DISPLAY.slider) .setDisplay(VALUE_DISPLAY.slider)

View file

@ -21,7 +21,7 @@ function Node_MK_Subpixel(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
newInput(7, nodeValue_Surface("Surface", self)); newInput(7, nodeValue_Surface("Surface", self));
newInput(8, nodeValueSeed(self, VALUE_TYPE.float)); newInput(8, nodeValueSeed(self));
newInput(9, nodeValue_Float("Ridge amount", self, 8)); newInput(9, nodeValue_Float("Ridge amount", self, 8));

View file

@ -3,8 +3,7 @@ function Node_Noise(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
newInput(0, nodeValue_Dimension(self)); newInput(0, nodeValue_Dimension(self));
newInput(1, nodeValue_Float("Seed", self, seed_random(6))) newInput(1, nodeValueSeed(self));
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[1].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) });
newInput(2, nodeValue_Enum_Button("Color mode", self, 0, [ "Greyscale", "RGB", "HSV" ])); newInput(2, nodeValue_Enum_Button("Color mode", self, 0, [ "Greyscale", "RGB", "HSV" ]));

View file

@ -6,8 +6,7 @@ function Node_Noise_Aniso(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
newInput(1, nodeValue_Float("X Amount", self, 2)) newInput(1, nodeValue_Float("X Amount", self, 2))
.setMappable(6); .setMappable(6);
newInput(2, nodeValue_Float("Seed", self, seed_random(6))) newInput(2, nodeValueSeed(self));
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[2].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) });
newInput(3, nodeValue_Vec2("Position", self, [ 0, 0 ])) newInput(3, nodeValue_Vec2("Position", self, [ 0, 0 ]))
.setUnitRef(function(index) { return getDimension(index); }); .setUnitRef(function(index) { return getDimension(index); });
@ -30,8 +29,7 @@ function Node_Noise_Aniso(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
newInput(9, nodeValue_Enum_Scroll("Render mode", self, 0, [ "Blend", "Waterfall" ] )) newInput(9, nodeValue_Enum_Scroll("Render mode", self, 0, [ "Blend", "Waterfall" ] ))
newInput(10, nodeValue_Float("Color Seed", self, seed_random(6))) newInput(10, nodeValueSeed(self));
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[2].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) });
input_display_list = [ input_display_list = [
["Output", false], 0, ["Output", false], 0,

View file

@ -6,8 +6,7 @@ function Node_Noise_Bubble(_x, _y, _group = noone) : Node_Shader_Generator(_x, _
.setDisplay(VALUE_DISPLAY.slider); .setDisplay(VALUE_DISPLAY.slider);
addShaderProp(SHADER_UNIFORM.float, "density"); addShaderProp(SHADER_UNIFORM.float, "density");
newInput(2, nodeValue_Float("Seed", self, seed_random(6))) newInput(2, nodeValueSeed(self));
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[2].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) });
addShaderProp(SHADER_UNIFORM.float, "seed"); addShaderProp(SHADER_UNIFORM.float, "seed");
newInput(3, nodeValue_Slider_Range("Scale", self, [ 0.5, 0.8 ] )); newInput(3, nodeValue_Slider_Range("Scale", self, [ 0.5, 0.8 ] ));

View file

@ -8,8 +8,7 @@ function Node_Noise_Cristal(_x, _y, _group = noone) : Node_Shader_Generator(_x,
newInput(2, nodeValue_Vec2("Scale", self, [ 1, 1 ] )); newInput(2, nodeValue_Vec2("Scale", self, [ 1, 1 ] ));
addShaderProp(SHADER_UNIFORM.float, "scale"); addShaderProp(SHADER_UNIFORM.float, "scale");
newInput(3, nodeValue_Float("Seed", self, seed_random(6))) newInput(3, nodeValueSeed(self));
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[3].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) });
addShaderProp(SHADER_UNIFORM.float, "seed"); addShaderProp(SHADER_UNIFORM.float, "seed");
newInput(4, nodeValue_Int("Iteration", self, 15 )); newInput(4, nodeValue_Int("Iteration", self, 15 ));

View file

@ -3,8 +3,7 @@ function Node_Noise_FBM(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
newInput(0, nodeValue_Dimension(self)); newInput(0, nodeValue_Dimension(self));
newInput(1, nodeValue_Float("Seed", self, seed_random(6))) newInput(1, nodeValueSeed(self));
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[1].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) });
newInput(2, nodeValue_Vec2("Position", self, [ 0, 0 ])); newInput(2, nodeValue_Vec2("Position", self, [ 0, 0 ]));

View file

@ -13,8 +13,7 @@ function Node_Noise_Hex(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
newInput(0, nodeValue_Dimension(self)); newInput(0, nodeValue_Dimension(self));
newInput(1, nodeValue_Float("Seed", self, seed_random(6))) newInput(1, nodeValueSeed(self));
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[1].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) });
newInput(2, nodeValue_Vec2("Position", self, [ 0, 0] )); newInput(2, nodeValue_Vec2("Position", self, [ 0, 0] ));
@ -48,7 +47,7 @@ function Node_Noise_Hex(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
var _pos = _data[2]; var _pos = _data[2];
var _sca = _data[3]; var _sca = _data[3];
var _sam = _data[4]; var _sam = _data[4];
var _samTyp = struct_try_get(attributes, "oversample"); var _samTyp = getAttribute("oversample");
_outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth()); _outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth());

View file

@ -10,8 +10,7 @@ function Node_Noise_Strand(_x, _y, _group = noone) : Node_Shader_Generator(_x, _
.setDisplay(VALUE_DISPLAY.slider); .setDisplay(VALUE_DISPLAY.slider);
addShaderProp(SHADER_UNIFORM.float, "density"); addShaderProp(SHADER_UNIFORM.float, "density");
newInput(3, nodeValue_Float("Seed", self, seed_random(6))) newInput(3, nodeValueSeed(self));
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[3].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) });
addShaderProp(SHADER_UNIFORM.float, "seed"); addShaderProp(SHADER_UNIFORM.float, "seed");
newInput(4, nodeValue_Float("Slope", self, 0.5 )) newInput(4, nodeValue_Float("Slope", self, 0.5 ))

View file

@ -13,8 +13,7 @@ function Node_Noise_Tri(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
newInput(0, nodeValue_Dimension(self)); newInput(0, nodeValue_Dimension(self));
newInput(1, nodeValue_Float("Seed", self, seed_random(6))) newInput(1, nodeValueSeed(self));
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[1].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) });
newInput(2, nodeValue_Vec2("Position", self, [ 0, 0] )); newInput(2, nodeValue_Vec2("Position", self, [ 0, 0] ));
@ -48,7 +47,7 @@ function Node_Noise_Tri(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
var _pos = _data[2]; var _pos = _data[2];
var _sca = _data[3]; var _sca = _data[3];
var _sam = _data[4]; var _sam = _data[4];
var _samTyp = struct_try_get(attributes, "oversample"); var _samTyp = getAttribute("oversample");
_outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth()); _outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth());

View file

@ -98,7 +98,7 @@ function Node_Outline(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
var blend = _data[3]; var blend = _data[3];
var side = _data[5]; var side = _data[5];
var aa = _data[6]; var aa = _data[6];
var sam = struct_try_get(attributes, "oversample"); var sam = getAttribute("oversample");
var _crop = _data[12]; var _crop = _data[12];
surface_set_shader(_outSurf, sh_outline); surface_set_shader(_outSurf, sh_outline);

View file

@ -7,8 +7,7 @@ function Node_Palette_Extract(_x, _y, _group = noone) : Node_Processor(_x, _y, _
newInput(1, nodeValue_Int("Max colors", self, 5, "Amount of color in a palette.")) newInput(1, nodeValue_Int("Max colors", self, 5, "Amount of color in a palette."))
.rejectArray(); .rejectArray();
newInput(2, nodeValue_Int("Seed", self, seed_random(6), "Random seed to be used to initialize K-mean algorithm.")) newInput(2, nodeValueSeed(self))
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[2].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) })
.rejectArray(); .rejectArray();
newInput(3, nodeValue_Enum_Scroll("Algorithm", self, 0, { data: [ "K-mean", "Frequency", "All colors" ], update_hover: false })) newInput(3, nodeValue_Enum_Scroll("Algorithm", self, 0, { data: [ "K-mean", "Frequency", "All colors" ], update_hover: false }))

View file

@ -10,7 +10,7 @@ function Node_Palette_Shrink(_x, _y, _group = noone) : Node_Processor(_x, _y, _g
newInput(2, nodeValue_Int("Amount", self, 4)); newInput(2, nodeValue_Int("Amount", self, 4));
newInput(3, nodeValueSeed(self, VALUE_TYPE.float)); newInput(3, nodeValueSeed(self));
newInput(4, nodeValue_Enum_Button("Color Space", self, 0, [ "RGB", "HSV" ])) newInput(4, nodeValue_Enum_Button("Color Space", self, 0, [ "RGB", "HSV" ]))

View file

@ -33,8 +33,7 @@ function Node_Path_L_System(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
newInput(6, nodeValue_Rotation("Starting Angle", self, 90)); newInput(6, nodeValue_Rotation("Starting Angle", self, 90));
newInput(7, nodeValue_Int("Seed", self, seed_random(6))) newInput(7, nodeValueSeed(self));
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[7].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) });
newInput(8, nodeValue_Bool("3D", self, false)); newInput(8, nodeValue_Bool("3D", self, false));

View file

@ -14,8 +14,7 @@ function Node_Path_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
newInput(4, nodeValue_Slider_Range("Scale", self, [ 0.5, 1 ])); newInput(4, nodeValue_Slider_Range("Scale", self, [ 0.5, 1 ]));
newInput(5, nodeValue_Float("Seed", self, seed_random(6))) newInput(5, nodeValueSeed(self));
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[5].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) });
newInput(6, nodeValue_Curve("Scale over Length", self, CURVE_DEF_11)); newInput(6, nodeValue_Curve("Scale over Length", self, CURVE_DEF_11));

View file

@ -13,8 +13,7 @@ function Node_Path_Wave(_x, _y, _group = noone) : Node(_x, _y, _group) construct
newInput(4, nodeValue_Bool("Smooth", self, false)); newInput(4, nodeValue_Bool("Smooth", self, false));
newInput(5, nodeValue_Float("Seed", self, seed_random(6))) newInput(5, nodeValueSeed(self));
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[5].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) });
newInput(6, nodeValue_Bool("Wiggle", self, false)); newInput(6, nodeValue_Bool("Wiggle", self, false));

View file

@ -13,8 +13,7 @@ function Node_PB_Fx_Highlight(_x, _y, _group = noone) : Node_PB_Fx(_x, _y, _grou
newInput(5, nodeValue_Float("Roughness Scale", self, 1 )); newInput(5, nodeValue_Float("Roughness Scale", self, 1 ));
newInput(6, nodeValue_Float("Seed", self, seed_random(6))) newInput(6, nodeValueSeed(self));
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[6].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) });
holding_side = noone; holding_side = noone;

View file

@ -13,8 +13,7 @@ function Node_Perlin(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
newInput(4, nodeValue_Bool("Tile", self, true)); newInput(4, nodeValue_Bool("Tile", self, true));
newInput(5, nodeValue_Float("Seed", self, seed_random(6))) newInput(5, nodeValueSeed(self));
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[5].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) });
newInput(6, nodeValue_Enum_Button("Color mode", self, 0, [ "Greyscale", "RGB", "HSV" ])); newInput(6, nodeValue_Enum_Button("Color mode", self, 0, [ "Greyscale", "RGB", "HSV" ]));

View file

@ -16,8 +16,7 @@ function Node_Perlin_Extra(_x, _y, _group = noone) : Node_Shader_Generator(_x, _
newInput(4, nodeValue_Bool("Tile", self, true, "Tiling only works with integer scale, and some effect type doesn't support tiling.")); newInput(4, nodeValue_Bool("Tile", self, true, "Tiling only works with integer scale, and some effect type doesn't support tiling."));
addShaderProp(SHADER_UNIFORM.integer, "tile"); addShaderProp(SHADER_UNIFORM.integer, "tile");
newInput(5, nodeValue_Float("Seed", self, seed_random(6))) newInput(5, nodeValueSeed(self));
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[5].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) });
addShaderProp(SHADER_UNIFORM.float, "seed"); addShaderProp(SHADER_UNIFORM.float, "seed");
newInput(6, nodeValue_Enum_Button("Color mode", self, 0, [ "Greyscale", "RGB", "HSV" ])); newInput(6, nodeValue_Enum_Button("Color mode", self, 0, [ "Greyscale", "RGB", "HSV" ]));

View file

@ -3,8 +3,7 @@ function Node_Pixel_Cloud(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
newInput(0, nodeValue_Surface("Surface in", self)); newInput(0, nodeValue_Surface("Surface in", self));
newInput(1, nodeValue_Int("Seed", self, seed_random(6))) newInput(1, nodeValueSeed(self));
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[1].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) });
newInput(2, nodeValue_Float("Strength", self, 0.1)) newInput(2, nodeValue_Float("Strength", self, 0.1))
.setDisplay(VALUE_DISPLAY.slider, { range: [ 0, 2, 0.01] }); .setDisplay(VALUE_DISPLAY.slider, { range: [ 0, 2, 0.01] });

View file

@ -23,8 +23,7 @@ function Node_Pytagorean_Tile(_x, _y, _group = noone) : Node_Processor(_x, _y, _
newInput(7, nodeValue_Enum_Scroll("Render type", self, 0, ["Colored tile", "Height map", "Texture grid"])); newInput(7, nodeValue_Enum_Scroll("Render type", self, 0, ["Colored tile", "Height map", "Texture grid"]));
newInput(8, nodeValue_Float("Seed", self, seed_random(6))) newInput(8, nodeValueSeed(self));
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[8].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) });
newInput(9, nodeValue_Surface("Texture", self)); newInput(9, nodeValue_Surface("Texture", self));

View file

@ -3,8 +3,7 @@ function Node_Random_Shape(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
newInput(0, nodeValue_Dimension(self)); newInput(0, nodeValue_Dimension(self));
newInput(1, nodeValue_Int("Seed", self, seed_random(6))) newInput(1, nodeValueSeed(self));
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[1].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) });
newInput(2, nodeValue_Enum_Scroll("SSAA", self, 0, [ "None", "2x", "4x", "8x" ])); newInput(2, nodeValue_Enum_Scroll("SSAA", self, 0, [ "None", "2x", "4x", "8x" ]));

View file

@ -23,8 +23,7 @@ function Node_Random_Tile(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
newInput(7, nodeValue_Enum_Scroll("Render type", self, 0, ["Colored tile", "Height map", "Texture grid"])); newInput(7, nodeValue_Enum_Scroll("Render type", self, 0, ["Colored tile", "Height map", "Texture grid"]));
newInput(8, nodeValue_Float("Seed", self, seed_random(6))) newInput(8, nodeValueSeed(self));
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[8].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) });
newInput(9, nodeValue_Surface("Texture", self)); newInput(9, nodeValue_Surface("Texture", self));

View file

@ -9,8 +9,7 @@ function Node_Region_Fill(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
newInput(3, nodeValue_Bool("Fill", self, true)); newInput(3, nodeValue_Bool("Fill", self, true));
newInput(4, nodeValue_Int("Seed", self, seed_random(6))) newInput(4, nodeValueSeed(self));
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[4].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) });
newInput(5, nodeValue_Color("Target Color", self, c_white)); newInput(5, nodeValue_Color("Target Color", self, c_white));

View file

@ -63,8 +63,7 @@ function Node_Repeat(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
newInput(16, nodeValue_Enum_Button("Array select", self, 0, [ "Order", "Random", "Spread" ])) newInput(16, nodeValue_Enum_Button("Array select", self, 0, [ "Order", "Random", "Spread" ]))
.setTooltip("Whether to select image from an array in order, at random, or spread each image to its own output."); .setTooltip("Whether to select image from an array in order, at random, or spread each image to its own output.");
newInput(17, nodeValue_Int("Seed", self, seed_random(6))) newInput(17, nodeValueSeed(self));
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[17].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) });
newInput(18, nodeValue_Int("Column", self, 4)); newInput(18, nodeValue_Int("Column", self, 4));
@ -659,6 +658,7 @@ function Node_Repeat(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
_y += _padd[1] - miny; _y += _padd[1] - miny;
} }
// print(dec_to_hex(color_real(_a.color)));
draw_surface_ext_safe(_a.surface, _x, _y, _a.sx, _a.sy, _a.rot, _a.color, _a.alpha); draw_surface_ext_safe(_a.surface, _x, _y, _a.sx, _a.sy, _a.rot, _a.color, _a.alpha);
} }

View file

@ -8,8 +8,7 @@ function Node_Repeat_Texture(_x, _y, _group = noone) : Node_Processor(_x, _y, _g
newInput(2, nodeValue_Enum_Scroll("Type", self, 1, [ "Tile", "Scatter", "Cell" ])); newInput(2, nodeValue_Enum_Scroll("Type", self, 1, [ "Tile", "Scatter", "Cell" ]));
newInput(3, nodeValue_Float("Seed", self, seed_random(6))) newInput(3, nodeValueSeed(self));
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[3].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) })
newOutput(0, nodeValue_Output("Surface out", self, VALUE_TYPE.surface, noone)); newOutput(0, nodeValue_Output("Surface out", self, VALUE_TYPE.surface, noone));

View file

@ -29,8 +29,7 @@ function Node_Rigid_Object_Spawner(_x, _y, _group = noone) : Node(_x, _y, _group
newInput(6, nodeValue_Bool("Spawn", self, true)) newInput(6, nodeValue_Bool("Spawn", self, true))
.rejectArray(); .rejectArray();
newInput(7, nodeValue_Int("Seed", self, seed_random(6))) newInput(7, nodeValueSeed(self));
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[7].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) });
newOutput(0, nodeValue_Output("Object", self, VALUE_TYPE.rigid, object)); newOutput(0, nodeValue_Output("Object", self, VALUE_TYPE.rigid, object));

View file

@ -27,12 +27,12 @@ function Node_Scale(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
attribute_surface_depth(); attribute_surface_depth();
attribute_interpolation(); attribute_interpolation();
static step = function() { #region static step = function() {
var _surf = getSingleValue(0); var _surf = getSingleValue(0);
var _atlas = is_instanceof(_surf, SurfaceAtlas); var _atlas = is_instanceof(_surf, SurfaceAtlas);
inputs[5].setVisible(_atlas); inputs[5].setVisible(_atlas);
} #endregion }
static processData = function(_outSurf, _data, _output_index, _array_index) { static processData = function(_outSurf, _data, _output_index, _array_index) {
var surf = _data[0]; var surf = _data[0];

View file

@ -34,8 +34,7 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
newInput(9, nodeValue_Enum_Button("Scatter", self, 1, [ "Uniform", "Random" ])); newInput(9, nodeValue_Enum_Button("Scatter", self, 1, [ "Uniform", "Random" ]));
newInput(10, nodeValue_Float("Seed", self, seed_random(6))) newInput(10, nodeValueSeed(self));
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[10].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) });
newInput(11, nodeValue_Gradient("Random blend", self, new gradientObject(cola(c_white)))) newInput(11, nodeValue_Gradient("Random blend", self, new gradientObject(cola(c_white))))
.setMappable(28); .setMappable(28);

View file

@ -20,8 +20,7 @@ function Node_Scatter_Points(_x, _y, _group = noone) : Node(_x, _y, _group) cons
newInput(4, nodeValue_Surface("Distribution map", self)) newInput(4, nodeValue_Surface("Distribution map", self))
.rejectArray(); .rejectArray();
newInput(5, nodeValue_Float("Seed", self, seed_random(6))) newInput(5, nodeValueSeed(self))
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[5].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) })
.rejectArray(); .rejectArray();
newInput(6, nodeValue_Bool("Fixed position", self, false, "Fix point position, and only select point in the area.")); newInput(6, nodeValue_Bool("Fixed position", self, false, "Fix point position, and only select point in the area."));

View file

@ -354,9 +354,9 @@ function Node_Shape(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
var sample = quality * segCount; var sample = quality * segCount;
var _step = 1 / sample; var _step = 1 / sample;
path_points = array_verify(path_points, sample); path_points = array_verify_ext(path_points, sample, function() /*=>*/ {return new __vec2()});
for( var i = 0; i < sample; i++ ) for( var i = 0; i < sample; i++ )
path_points[i] = _path.getPointRatio(i * _step, array_safe_get(path_points, i, undefined)); path_points[i] = _path.getPointRatio(i * _step, 0, array_safe_get(path_points, i, undefined));
var tri = polygon_triangulate(path_points); var tri = polygon_triangulate(path_points);
triangles = tri[0]; triangles = tri[0];

View file

@ -10,8 +10,7 @@ function Node_Shard_Noise(_x, _y, _group = noone) : Node_Shader_Generator(_x, _y
.setMappable(6); .setMappable(6);
addShaderProp(SHADER_UNIFORM.float, "scale"); addShaderProp(SHADER_UNIFORM.float, "scale");
newInput(3, nodeValue_Float("Seed", self, seed_random(6))) newInput(3, nodeValueSeed(self));
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[3].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) });
addShaderProp(SHADER_UNIFORM.float, "seed"); addShaderProp(SHADER_UNIFORM.float, "seed");
newInput(4, nodeValue_Float("Sharpness", self, 1)) newInput(4, nodeValue_Float("Sharpness", self, 1))

View file

@ -68,7 +68,7 @@ function Node_Skew(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
} }
static processData = function(_outSurf, _data, _output_index, _array_index) { static processData = function(_outSurf, _data, _output_index, _array_index) {
var _samp = struct_try_get(attributes, "oversample"); var _samp = getAttribute("oversample");
surface_set_shader(_outSurf, sh_skew); surface_set_shader(_outSurf, sh_skew);
shader_set_interpolation(_data[0]); shader_set_interpolation(_data[0]);

View file

@ -86,7 +86,7 @@ function Node_Smear(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
shader_set_f_map("strength", _data[ 1], _data[ 9], inputs[ 1]); shader_set_f_map("strength", _data[ 1], _data[ 9], inputs[ 1]);
shader_set_f_map("direction", _data[ 2], _data[10], inputs[ 2]); shader_set_f_map("direction", _data[ 2], _data[10], inputs[ 2]);
shader_set_i("sampleMode", struct_try_get(attributes, "oversample")); shader_set_i("sampleMode", getAttribute("oversample"));
shader_set_i("alpha", _data[11]); shader_set_i("alpha", _data[11]);
shader_set_i("inv", _data[14]); shader_set_i("inv", _data[14]);
shader_set_i("blend", _data[15]); shader_set_i("blend", _data[15]);

View file

@ -15,8 +15,7 @@ function Node_Smoke_Turbulence(_x, _y, _group = noone) : Node_Smoke(_x, _y, _gro
newInput(3, nodeValue_Float("Scale", self, 4)) newInput(3, nodeValue_Float("Scale", self, 4))
.setDisplay(VALUE_DISPLAY.slider, { range: [1, 16, 0.01] }); .setDisplay(VALUE_DISPLAY.slider, { range: [1, 16, 0.01] });
newInput(4, nodeValue_Float("Seed", self, seed_random(6))) newInput(4, nodeValueSeed(self));
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[4].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) });
newInput(5, nodeValue_Enum_Button("Mode", self, 0, [ "Override", "Add" ])); newInput(5, nodeValue_Enum_Button("Mode", self, 0, [ "Override", "Add" ]));

View file

@ -76,7 +76,7 @@ function Node_Spherize(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
} #endregion } #endregion
static processData = function(_outSurf, _data, _output_index, _array_index) { #region static processData = function(_outSurf, _data, _output_index, _array_index) { #region
var sam = struct_try_get(attributes, "oversample"); var sam = getAttribute("oversample");
surface_set_shader(_outSurf, sh_spherize); surface_set_shader(_outSurf, sh_spherize);
shader_set_interpolation(_data[0]); shader_set_interpolation(_data[0]);

View file

@ -9,8 +9,7 @@ function Node_Strand_Break(_x, _y, _group = noone) : _Node_Strand_Affector(_x, _
newInput(input_fix_len + 0, nodeValue_Float("Chance", self, 1)) newInput(input_fix_len + 0, nodeValue_Float("Chance", self, 1))
.setDisplay(VALUE_DISPLAY.slider); .setDisplay(VALUE_DISPLAY.slider);
newInput(input_fix_len + 1, nodeValue_Int("Seed", self, seed_random(6))) newInput(input_fix_len + 1, nodeValueSeed(self));
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[input_fix_len + 1].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) });
array_push(input_display_list, array_push(input_display_list,
["Break", false], input_fix_len + 0, input_fix_len + 1 ["Break", false], input_fix_len + 0, input_fix_len + 1

View file

@ -30,8 +30,7 @@ function Node_Strand_Create(_x, _y, _group = noone) : Node(_x, _y, _group) const
newInput(9, nodeValue_Float("Structure", self, 0.2, "The ability to keep its original shape.")) newInput(9, nodeValue_Float("Structure", self, 0.2, "The ability to keep its original shape."))
.setDisplay(VALUE_DISPLAY.slider); .setDisplay(VALUE_DISPLAY.slider);
newInput(10, nodeValue_Int("Seed", self, seed_random(6))) newInput(10, nodeValueSeed(self));
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[10].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) });
newInput(11, nodeValue_Float("Curl frequency", self, 0)); newInput(11, nodeValue_Float("Curl frequency", self, 0));

View file

@ -11,8 +11,7 @@ function Node_Strand_Force_Apply(_x, _y, _group = noone) : _Node_Strand_Affector
newInput(input_fix_len + 1, nodeValue_Float("Turbulence", self, 0)); newInput(input_fix_len + 1, nodeValue_Float("Turbulence", self, 0));
newInput(input_fix_len + 2, nodeValue_Int("Seed", self, seed_random(6))) newInput(input_fix_len + 2, nodeValueSeed(self));
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[input_fix_len + 2].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) });
newInput(input_fix_len + 3, nodeValue_Float("Turbulence frequency", self, 0.5)); newInput(input_fix_len + 3, nodeValue_Float("Turbulence frequency", self, 0.5));

View file

@ -19,8 +19,7 @@ function Node_Strand_Render(_x, _y, _group = noone) : Node(_x, _y, _group) const
newInput(5, nodeValue_Gradient("Color over length", self, new gradientObject(cola(c_white)))); newInput(5, nodeValue_Gradient("Color over length", self, new gradientObject(cola(c_white))));
newInput(6, nodeValue_Float("Seed", self, seed_random(6))) newInput(6, nodeValueSeed(self));
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[6].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) });
newInput(7, nodeValue_Float("Child", self, 0, "Render extra strands between the real strands.")); newInput(7, nodeValue_Float("Child", self, 0, "Render extra strands between the real strands."));

View file

@ -17,8 +17,7 @@ function Node_Strand_Render_Texture(_x, _y, _group = noone) : Node(_x, _y, _grou
newInput(4, nodeValue_Surface("Texture", self)); newInput(4, nodeValue_Surface("Texture", self));
newInput(5, nodeValue_Float("Seed", self, seed_random(6))) newInput(5, nodeValueSeed(self));
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[5].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) });
newOutput(0, nodeValue_Output("Surface out", self, VALUE_TYPE.surface, noone)); newOutput(0, nodeValue_Output("Surface out", self, VALUE_TYPE.surface, noone));

Some files were not shown because too many files have changed in this diff Show more