- [VectorRange box] Axis link and range mode are now separated settings. Add link line to show which values is being linked.

This commit is contained in:
Tanasart 2024-07-19 09:37:06 +07:00
parent c677d84243
commit 45096510fe
14 changed files with 190 additions and 78 deletions

View file

@ -2588,6 +2588,7 @@
{"name":"s_unit_angle","order":205,"path":"sprites/s_unit_angle/s_unit_angle.yy",},
{"name":"s_unit_audio","order":206,"path":"sprites/s_unit_audio/s_unit_audio.yy",},
{"name":"s_unit_ref","order":207,"path":"sprites/s_unit_ref/s_unit_ref.yy",},
{"name":"s_value_range","order":229,"path":"sprites/s_value_range/s_value_range.yy",},
{"name":"s_value_use_surface","order":208,"path":"sprites/s_value_use_surface/s_value_use_surface.yy",},
{"name":"s_vct","order":209,"path":"sprites/s_vct/s_vct.yy",},
{"name":"s_vfx","order":210,"path":"sprites/s_vfx/s_vfx.yy",},

View file

@ -74,20 +74,6 @@
{"$GMFolder":"","%Name":"dynaSurf","folderPath":"folders/functions/draw/dynaSurf.yy","name":"dynaSurf","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"ds","folderPath":"folders/functions/ds.yy","name":"ds","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"files","folderPath":"folders/functions/files.yy","name":"files","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"smokesim","folderPath":"folders/functions/smokesim.yy","name":"smokesim","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"API","folderPath":"folders/functions/smokesim/API.yy","name":"API","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"Get_scripts","folderPath":"folders/functions/smokesim/API/Get_scripts.yy","name":"Get_scripts","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"Set_scripts","folderPath":"folders/functions/smokesim/API/Set_scripts.yy","name":"Set_scripts","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"SimenGames_View Extension","folderPath":"folders/functions/smokesim/API/SimenGames_View Extension.yy","name":"SimenGames_View Extension","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"Compat","folderPath":"folders/functions/smokesim/Compat.yy","name":"Compat","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"background","folderPath":"folders/functions/smokesim/Compat/background.yy","name":"background","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"draw","folderPath":"folders/functions/smokesim/Compat/draw.yy","name":"draw","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"instance","folderPath":"folders/functions/smokesim/Compat/instance.yy","name":"instance","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"object","folderPath":"folders/functions/smokesim/Compat/object.yy","name":"object","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"texture","folderPath":"folders/functions/smokesim/Compat/texture.yy","name":"texture","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"view","folderPath":"folders/functions/smokesim/Compat/view.yy","name":"view","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"Internal","folderPath":"folders/functions/smokesim/Internal.yy","name":"Internal","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"Shaders","folderPath":"folders/functions/smokesim/Shaders.yy","name":"Shaders","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"geometry","folderPath":"folders/functions/geometry.yy","name":"geometry","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"GLSL","folderPath":"folders/functions/GLSL.yy","name":"GLSL","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"importers","folderPath":"folders/functions/importers.yy","name":"importers","resourceType":"GMFolder","resourceVersion":"2.0",},
@ -102,6 +88,20 @@
{"$GMFolder":"","%Name":"physics","folderPath":"folders/functions/physics.yy","name":"physics","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"project","folderPath":"folders/functions/project.yy","name":"project","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"shader","folderPath":"folders/functions/shader.yy","name":"shader","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"smokesim","folderPath":"folders/functions/smokesim.yy","name":"smokesim","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"API","folderPath":"folders/functions/smokesim/API.yy","name":"API","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"Get_scripts","folderPath":"folders/functions/smokesim/API/Get_scripts.yy","name":"Get_scripts","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"Set_scripts","folderPath":"folders/functions/smokesim/API/Set_scripts.yy","name":"Set_scripts","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"SimenGames_View Extension","folderPath":"folders/functions/smokesim/API/SimenGames_View Extension.yy","name":"SimenGames_View Extension","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"Compat","folderPath":"folders/functions/smokesim/Compat.yy","name":"Compat","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"background","folderPath":"folders/functions/smokesim/Compat/background.yy","name":"background","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"draw","folderPath":"folders/functions/smokesim/Compat/draw.yy","name":"draw","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"instance","folderPath":"folders/functions/smokesim/Compat/instance.yy","name":"instance","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"object","folderPath":"folders/functions/smokesim/Compat/object.yy","name":"object","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"texture","folderPath":"folders/functions/smokesim/Compat/texture.yy","name":"texture","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"view","folderPath":"folders/functions/smokesim/Compat/view.yy","name":"view","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"Internal","folderPath":"folders/functions/smokesim/Internal.yy","name":"Internal","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"Shaders","folderPath":"folders/functions/smokesim/Shaders.yy","name":"Shaders","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"sprite","folderPath":"folders/functions/sprite.yy","name":"sprite","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"string","folderPath":"folders/functions/string.yy","name":"string","resourceType":"GMFolder","resourceVersion":"2.0",},
{"$GMFolder":"","%Name":"surface","folderPath":"folders/functions/surface.yy","name":"surface","resourceType":"GMFolder","resourceVersion":"2.0",},
@ -3148,6 +3148,7 @@
{"id":{"name":"s_unit_angle","path":"sprites/s_unit_angle/s_unit_angle.yy",},},
{"id":{"name":"s_unit_audio","path":"sprites/s_unit_audio/s_unit_audio.yy",},},
{"id":{"name":"s_unit_ref","path":"sprites/s_unit_ref/s_unit_ref.yy",},},
{"id":{"name":"s_value_range","path":"sprites/s_value_range/s_value_range.yy",},},
{"id":{"name":"s_value_use_surface","path":"sprites/s_value_use_surface/s_value_use_surface.yy",},},
{"id":{"name":"s_vct","path":"sprites/s_vct/s_vct.yy",},},
{"id":{"name":"s_vfx","path":"sprites/s_vfx/s_vfx.yy",},},

Binary file not shown.

View file

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

View file

@ -38,7 +38,7 @@
LATEST_VERSION = 11700;
VERSION = 11770;
SAVE_VERSION = 11700;
VERSION_STRING = "1.17.8.002";
VERSION_STRING = "1.17.8.003";
BUILD_NUMBER = 11770;
globalvar HOTKEYS, HOTKEY_CONTEXT;

View file

@ -591,6 +591,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
if(type == VALUE_TYPE.integer) editWidget.setSlideSpeed(1 / 10);
if(!struct_has(display_data, "linked")) display_data.linked = false;
if(!struct_has(display_data, "ranged")) display_data.ranged = false;
if(array_length(val) == 2) extract_node = "Node_Vector2";
else if(array_length(val) == 3) extract_node = "Node_Vector3";

View file

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

View file

@ -207,6 +207,7 @@ function Theme() constructor {
unit_audio = s_unit_audio;
unit_ref = s_unit_ref;
value_link = s_padding_link;
value_range = s_value_range;
value_use_surface = s_value_use_surface;
vct = s_vct;
vfx = s_vfx;

View file

@ -3,31 +3,44 @@ function vectorRangeBox(_size, _type, _onModify, _unit = noone) : widget() const
type = _type;
onModify = _onModify;
unit = _unit;
linked = false;
ranged = false;
disp_h = 0;
tooltip = new tooltipSelector("Value Type", [
__txtx("widget_range_random", "Random Range"),
__txtx("widget_range_constant", "Constant"),
]);
tooltip_ranged = new tooltipSelector("Value Type", [ __txtx("widget_range_constant", "Constant"), __txtx("widget_range_random", "Random Range") ]);
onModifyIndex = function(val, index) {
if(linked) {
var modi = false;
modi |= onModify(toNumber(val), floor(index / 2) * 2 + 0);
modi |= onModify(toNumber(val), floor(index / 2) * 2 + 1);
return modi;
var v = toNumber(val);
if(!linked && ranged) return onModify(v, index);
var modi = false;
if(linked && !ranged) {
modi |= onModify(v, 0);
modi |= onModify(v, 1);
modi |= onModify(v, 2);
modi |= onModify(v, 3);
} else if(linked) {
modi |= onModify(v, index);
modi |= onModify(v, (index + 2) % 4);
} else if(!ranged) {
modi |= onModify(v, floor(index / 2) * 2 + 0);
modi |= onModify(v, floor(index / 2) * 2 + 1);
}
return onModify(toNumber(val), index);
return modi;
}
axis = [ "x", "y", "z", "w"];
onModifySingle[0] = function(val) { return onModifyIndex(toNumber(val), 0); }
onModifySingle[1] = function(val) { return onModifyIndex(toNumber(val), 1); }
onModifySingle[2] = function(val) { return onModifyIndex(toNumber(val), 2); }
onModifySingle[3] = function(val) { return onModifyIndex(toNumber(val), 3); }
onModifySingle[0] = function(val) { return onModifyIndex(val, 0); }
onModifySingle[1] = function(val) { return onModifyIndex(val, 1); }
onModifySingle[2] = function(val) { return onModifyIndex(val, 2); }
onModifySingle[3] = function(val) { return onModifyIndex(val, 3); }
extras = -1;
@ -37,24 +50,14 @@ function vectorRangeBox(_size, _type, _onModify, _unit = noone) : widget() const
tb[i].hide = true;
}
static setSlideSpeed = function(speed) {
for(var i = 0; i < size; i++)
tb[i].setSlidable(speed);
}
static setSlideSpeed = function(speed) { for(var i = 0; i < size; i++) tb[i].setSlidable(speed); }
static setInteract = function(interactable = noone) {
self.interactable = interactable;
var _step = linked? 2 : 1;
for( var i = 0; i < size; i += _step )
tb[i].interactable = interactable;
for( var i = 0; i < size; i++ ) tb[i].interactable = interactable;
}
static register = function(parent = noone) {
var _step = linked? 2 : 1;
for( var i = 0; i < size; i += _step )
tb[i].register(parent);
}
static register = function(parent = noone) { for( var i = 0; i < size; i++ ) tb[i].register(parent); }
static isHovering = function() {
for( var i = 0, n = array_length(tb); i < n; i++ ) if(tb[i].isHovering()) return true;
@ -76,13 +79,12 @@ function vectorRangeBox(_size, _type, _onModify, _unit = noone) : widget() const
_data = array_verify(_data, size);
if(struct_has(_display_data, "linked")) linked = _display_data.linked;
var _hh = linked? _h : _h * 2 + ui(4);
h = h == 0? _hh : lerp_float(h, _hh, 5);
tooltip.index = linked;
if(struct_has(_display_data, "ranged")) ranged = _display_data.ranged;
var _icon_blend = linked? COLORS._main_accent : COLORS._main_icon;
h = _h * 2 + ui(4);
var _bs = min(_h, ui(32));
if((_w - _bs) / 2 > ui(64)) {
if(side_button) {
side_button.setFocusHover(active, hover);
@ -90,53 +92,65 @@ function vectorRangeBox(_size, _type, _onModify, _unit = noone) : widget() const
_w -= _bs + ui(4);
}
var bx = _x;
var by = _y + _h / 2 - _bs / 2;
var bx = _x;
var by = _y + _h / 2 - _bs / 2;
var bc = linked? COLORS._main_accent : COLORS._main_icon;
if(buttonInstant(THEME.button_hide, bx, by, _bs, _bs, _m, active, hover, tooltip, THEME.value_link, linked, _icon_blend) == 2) {
if(buttonInstant(THEME.button_hide, bx, by, _bs, _bs, _m, active, hover, __txt("Link axis"), THEME.value_link, linked, bc) == 2) {
linked = !linked;
_display_data.linked = linked;
if(linked) {
for(var i = 0; i < size; i += 2) {
onModify(_data[i], i + 0);
onModify(_data[i], i + 1);
}
onModifyIndex(_data[0], 0);
onModifyIndex(_data[1], 1);
}
}
by += _h + ui(4);
tooltip_ranged.index = ranged;
if(buttonInstant(THEME.button_hide, bx, by, _bs, _bs, _m, active, hover, tooltip_ranged, THEME.value_range, ranged, COLORS._main_icon) == 2) {
ranged = !ranged;
_display_data.ranged = ranged;
if(!ranged) {
onModifyIndex(_data[0], 0);
onModifyIndex(_data[1], 2);
}
}
_x += _bs + ui(4);
_w -= _bs + ui(4);
}
var ww = _w / 2;
if(linked) {
draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y, _w, _h, boxColor, 1);
draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y, _w, _h, boxColor, 0.5 + 0.5 * interactable);
for( var j = 0; j < 2; j++ ) {
var by = _y + (_h + ui(4)) * j;
draw_sprite_stretched_ext(THEME.textbox, 3, _x, by, _w, _h, boxColor, 1);
draw_sprite_stretched_ext(THEME.textbox, 0, _x, by, _w, _h, boxColor, 0.5 + 0.5 * interactable);
}
if(linked) {
draw_sprite_stretched_ext(THEME.ui_scrollbar, 0, _x + ww / 2 - ui(3), _y + _h / 2, ui(6), _h + ui(4), COLORS._main_accent, .2);
draw_sprite_stretched_ext(THEME.ui_scrollbar, 0, _x + ww + ww / 2 - ui(3), _y + _h / 2, ui(6), _h + ui(4), COLORS._main_accent, .2);
}
if(!ranged) {
draw_sprite_stretched_ext(THEME.ui_scrollbar, 0, _x + ww / 2, _y + _h / 2 - ui(3), ww, ui(6), COLORS._main_accent, .2);
draw_sprite_stretched_ext(THEME.ui_scrollbar, 0, _x + ww / 2, _y + _h + ui(4) + _h / 2 - ui(3), ww, ui(6), COLORS._main_accent, .2);
}
for( var j = 0; j < 2; j++ ) {
var by = _y + (_h + ui(4)) * j;
for( var i = 0; i < 2; i++ ) {
var bx = _x + ww * i;
var by = _y;
tb[i * 2].label = axis[i];
tb[i * 2].setFocusHover(active, hover);
tb[i * 2].draw(bx, by, ww, _h, _data[i * 2], _m);
}
} else {
for( var j = 0; j < 2; j++ ) {
var by = _y + (_h + ui(4)) * j;
draw_sprite_stretched_ext(THEME.textbox, 3, _x, by, _w, _h, boxColor, 1);
draw_sprite_stretched_ext(THEME.textbox, 0, _x, by, _w, _h, boxColor, 0.5 + 0.5 * interactable);
for( var i = 0; i < 2; i++ ) {
var bx = _x + ww * i;
if(i == 0) tb[j * 2 + i].label = axis[j];
tb[j * 2 + i].setFocusHover(active, hover);
tb[j * 2 + i].draw(bx, by, ww, _h, _data[j * 2 + i], _m);
}
if(i == 0) tb[j * 2 + i].label = axis[j];
tb[j * 2 + i].setFocusHover(active, hover);
tb[j * 2 + i].draw(bx, by, ww, _h, _data[j * 2 + i], _m);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 436 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 506 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 436 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 506 B

View file

@ -0,0 +1,94 @@
{
"$GMSprite":"",
"%Name":"s_value_range",
"bboxMode":0,
"bbox_bottom":18,
"bbox_left":2,
"bbox_right":21,
"bbox_top":4,
"collisionKind":1,
"collisionTolerance":0,
"DynamicTexturePage":false,
"edgeFiltering":false,
"For3D":false,
"frames":[
{"$GMSpriteFrame":"","%Name":"bcd2d62c-e633-4d90-a686-86ebaa88a9b5","name":"bcd2d62c-e633-4d90-a686-86ebaa88a9b5","resourceType":"GMSpriteFrame","resourceVersion":"2.0",},
{"$GMSpriteFrame":"","%Name":"dca2d7a7-daa9-453e-bebb-96c73fe41279","name":"dca2d7a7-daa9-453e-bebb-96c73fe41279","resourceType":"GMSpriteFrame","resourceVersion":"2.0",},
],
"gridX":0,
"gridY":0,
"height":24,
"HTile":false,
"layers":[
{"$GMImageLayer":"","%Name":"bd8e77e4-0f38-497b-b3ad-1217aed8b858","blendMode":0,"displayName":"default","isLocked":false,"name":"bd8e77e4-0f38-497b-b3ad-1217aed8b858","opacity":100.0,"resourceType":"GMImageLayer","resourceVersion":"2.0","visible":true,},
],
"name":"s_value_range",
"nineSlice":null,
"origin":4,
"parent":{
"name":"icon",
"path":"folders/theme/icon.yy",
},
"preMultiplyAlpha":false,
"resourceType":"GMSprite",
"resourceVersion":"2.0",
"sequence":{
"$GMSequence":"",
"%Name":"s_value_range",
"autoRecord":true,
"backdropHeight":768,
"backdropImageOpacity":0.5,
"backdropImagePath":"",
"backdropWidth":1366,
"backdropXOffset":0.0,
"backdropYOffset":0.0,
"events":{
"$KeyframeStore<MessageEventKeyframe>":"",
"Keyframes":[],
"resourceType":"KeyframeStore<MessageEventKeyframe>",
"resourceVersion":"2.0",
},
"eventStubScript":null,
"eventToFunction":{},
"length":2.0,
"lockOrigin":false,
"moments":{
"$KeyframeStore<MomentsEventKeyframe>":"",
"Keyframes":[],
"resourceType":"KeyframeStore<MomentsEventKeyframe>",
"resourceVersion":"2.0",
},
"name":"s_value_range",
"playback":1,
"playbackSpeed":30.0,
"playbackSpeedType":0,
"resourceType":"GMSequence",
"resourceVersion":"2.0",
"showBackdrop":true,
"showBackdropImage":false,
"timeUnits":1,
"tracks":[
{"$GMSpriteFramesTrack":"","builtinName":0,"events":[],"inheritsTrackColour":true,"interpolation":1,"isCreationTrack":false,"keyframes":{"$KeyframeStore<SpriteFrameKeyframe>":"","Keyframes":[
{"$Keyframe<SpriteFrameKeyframe>":"","Channels":{
"0":{"$SpriteFrameKeyframe":"","Id":{"name":"bcd2d62c-e633-4d90-a686-86ebaa88a9b5","path":"sprites/s_value_range/s_value_range.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},
},"Disabled":false,"id":"9940dd61-4025-4beb-9bc7-a24c728809fe","IsCreationKey":false,"Key":0.0,"Length":1.0,"resourceType":"Keyframe<SpriteFrameKeyframe>","resourceVersion":"2.0","Stretch":false,},
{"$Keyframe<SpriteFrameKeyframe>":"","Channels":{
"0":{"$SpriteFrameKeyframe":"","Id":{"name":"dca2d7a7-daa9-453e-bebb-96c73fe41279","path":"sprites/s_value_range/s_value_range.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},
},"Disabled":false,"id":"c08da459-41d1-4749-bd1a-bf42f7c2b658","IsCreationKey":false,"Key":1.0,"Length":1.0,"resourceType":"Keyframe<SpriteFrameKeyframe>","resourceVersion":"2.0","Stretch":false,},
],"resourceType":"KeyframeStore<SpriteFrameKeyframe>","resourceVersion":"2.0",},"modifiers":[],"name":"frames","resourceType":"GMSpriteFramesTrack","resourceVersion":"2.0","spriteId":null,"trackColour":0,"tracks":[],"traits":0,},
],
"visibleRange":null,
"volume":1.0,
"xorigin":12,
"yorigin":12,
},
"swatchColours":null,
"swfPrecision":0.5,
"textureGroupId":{
"name":"Default",
"path":"texturegroups/Default",
},
"type":0,
"VTile":false,
"width":24,
}